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
3fabdc6ea029921370f2df6e3badb4138b0bd7c3
68
py
Python
pkg/runner.py
sfauch1/command-line-skeleton
c30cf2b8c0cc3ffb4a0b4b91927ba1be662f57d3
[ "MIT" ]
null
null
null
pkg/runner.py
sfauch1/command-line-skeleton
c30cf2b8c0cc3ffb4a0b4b91927ba1be662f57d3
[ "MIT" ]
null
null
null
pkg/runner.py
sfauch1/command-line-skeleton
c30cf2b8c0cc3ffb4a0b4b91927ba1be662f57d3
[ "MIT" ]
null
null
null
def start(): """Main runner script""" print('Hello World !')
22.666667
28
0.573529
8
68
4.875
1
0
0
0
0
0
0
0
0
0
0
0
0.220588
68
3
29
22.666667
0.735849
0.264706
0
0
0
0
0.288889
0
0
0
0
0
0
1
0.5
true
0
0
0
0.5
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
1
0
5
3fb52cf019c70fa128b887e4f1934344d88314d2
119
py
Python
src/08_Operators/04_operators.py
UltiRequiem/W3Schools-Python-Exercises
34d10d48d7ce7b9e50466cd8537a8aece0426ce8
[ "MIT" ]
5
2021-05-29T23:30:50.000Z
2022-01-15T16:35:20.000Z
src/08_Operators/04_operators.py
UltiRequiem/W3Schools-Python-Exercises
34d10d48d7ce7b9e50466cd8537a8aece0426ce8
[ "MIT" ]
null
null
null
src/08_Operators/04_operators.py
UltiRequiem/W3Schools-Python-Exercises
34d10d48d7ce7b9e50466cd8537a8aece0426ce8
[ "MIT" ]
4
2021-03-18T17:48:06.000Z
2021-07-22T19:32:36.000Z
# Use the correct comparison operator to check if 5 is not equal to 10. if 5 != 10: print("5 and 10 is not equal")
29.75
71
0.680672
24
119
3.375
0.625
0.074074
0.246914
0
0
0
0
0
0
0
0
0.1
0.243697
119
3
72
39.666667
0.8
0.579832
0
0
0
0
0.4375
0
0
0
0
0
0
1
0
true
0
0
0
0
0.5
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
3fc8813fd3731f71620be1a633ad99cd5bf3fa69
93
py
Python
setup.py
ia-flash/lab
6e533a8a5bce2d25eb53d225fa534e1ee2d19172
[ "Apache-2.0" ]
1
2019-12-19T18:02:58.000Z
2019-12-19T18:02:58.000Z
setup.py
ia-flash/lab
6e533a8a5bce2d25eb53d225fa534e1ee2d19172
[ "Apache-2.0" ]
3
2021-03-19T04:19:16.000Z
2022-01-13T01:43:03.000Z
setup.py
ia-flash/lab
6e533a8a5bce2d25eb53d225fa534e1ee2d19172
[ "Apache-2.0" ]
null
null
null
from setuptools import setup, find_packages setup(name="iaflash", packages=find_packages())
23.25
47
0.806452
12
93
6.083333
0.666667
0.328767
0
0
0
0
0
0
0
0
0
0
0.086022
93
3
48
31
0.858824
0
0
0
0
0
0.075269
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
5
3fdcea1c4b16f9e8037287413fbde63015d878f6
187
py
Python
core/systems/__init__.py
Cafolkes/koopman_learning_and_control
0152a2bd5079da4d672dbaac404b6c084410297d
[ "MIT" ]
7
2021-11-06T11:32:40.000Z
2022-03-16T00:06:23.000Z
core/systems/__init__.py
Cafolkes/koopman-learning-and-control
0152a2bd5079da4d672dbaac404b6c084410297d
[ "MIT" ]
null
null
null
core/systems/__init__.py
Cafolkes/koopman-learning-and-control
0152a2bd5079da4d672dbaac404b6c084410297d
[ "MIT" ]
1
2022-03-04T09:34:58.000Z
2022-03-04T09:34:58.000Z
from .cart_pole import CartPole from .double_inverted_pendulum import DoubleInvertedPendulum from .inverted_pendulum import InvertedPendulum from .planar_quadrotor import PlanarQuadrotor
37.4
60
0.893048
21
187
7.714286
0.619048
0.197531
0.271605
0
0
0
0
0
0
0
0
0
0.085562
187
4
61
46.75
0.947368
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
b7459d93705f0a178307014bf006182402163eb4
204
py
Python
dbkrpy/__init__.py
chaemoong/DBKR-API-Python
8df707a8e898789d4c888a91542e44fab47b5574
[ "MIT" ]
8
2020-05-04T04:57:12.000Z
2020-06-22T13:29:24.000Z
dbkrpy/__init__.py
chaemoong/DBKR-API-Python
8df707a8e898789d4c888a91542e44fab47b5574
[ "MIT" ]
6
2020-05-06T08:27:25.000Z
2020-05-14T07:04:41.000Z
dbkrpy/__init__.py
chaemoong/DBKR-API-Python
8df707a8e898789d4c888a91542e44fab47b5574
[ "MIT" ]
4
2020-05-06T12:33:04.000Z
2020-12-17T04:27:50.000Z
from .dbkrupdateguilds import UpdateGuilds from .dbkrgetbyid import GetById from .dbkrvote import CheckVote from .dbkrpage import Page from .dbkrseach import Search from .dbkrcategories import Categories
29.142857
42
0.852941
24
204
7.25
0.583333
0
0
0
0
0
0
0
0
0
0
0
0.117647
204
6
43
34
0.966667
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
1
0
0
5
b75f1fd952ca1ed2722c8e1a1a86e358d4c9f923
108
py
Python
enthought/block_canvas/app/attic/block_application.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/block_canvas/app/attic/block_application.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/block_canvas/app/attic/block_application.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from blockcanvas.app.attic.block_application import *
27
53
0.851852
14
108
6.142857
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.101852
108
3
54
36
0.886598
0.111111
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
1
0
0
5
b780028fde9197e6d650a9361f442e01364ae509
3,327
py
Python
rubix_cube/tests/test_cube_game.py
dgrethlein/RubixCube
e4276107a1cdcf5a4acba4c67198a5b0d0813ffa
[ "MIT" ]
null
null
null
rubix_cube/tests/test_cube_game.py
dgrethlein/RubixCube
e4276107a1cdcf5a4acba4c67198a5b0d0813ffa
[ "MIT" ]
3
2020-03-24T18:08:08.000Z
2021-06-04T15:27:29.000Z
rubix_cube/tests/test_cube_game.py
dgrethlein/RubixCube
e4276107a1cdcf5a4acba4c67198a5b0d0813ffa
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """Rubix :class:`Cube <rubix_cube.cube.Cube` class :mod:`tests` Module Module Description ================== Module Contents =============== .. moduleauthor:: David Grethlein <djg329@drexel.edu> """ import copy import unittest from ..cube import Cube from ..cube_game import Cube_Game class TestCubeGameMethods(unittest.TestCase): def test_up(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('U') cg.manipulate_cube('Ui') self.assertEqual(copy_cube , cg.game_cube) def test_equator(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('E') cg.manipulate_cube('Ei') self.assertEqual(copy_cube , cg.game_cube) def test_down(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('D') cg.manipulate_cube('Di') self.assertEqual(copy_cube , cg.game_cube) def test_left(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('L') cg.manipulate_cube('Li') self.assertEqual(copy_cube , cg.game_cube) def test_middle(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('M') cg.manipulate_cube('Mi') self.assertEqual(copy_cube , cg.game_cube) def test_right(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('R') cg.manipulate_cube('Ri') self.assertEqual(copy_cube , cg.game_cube) def test_front(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('F') cg.manipulate_cube('Fi') self.assertEqual(copy_cube , cg.game_cube) def test_standing(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('S') cg.manipulate_cube('Si') self.assertEqual(copy_cube , cg.game_cube) def test_back(self): cg = Cube_Game() seq = Cube_Game.get_scramble_sequence() for mv in seq: cg.manipulate_cube(mv) copy_cube = copy.deepcopy(cg.game_cube) cg.manipulate_cube('B') cg.manipulate_cube('Bi') self.assertEqual(copy_cube , cg.game_cube) if __name__ == '__main__': unittest.main()
25.015038
70
0.606853
434
3,327
4.37788
0.156682
0.170526
0.227368
0.066316
0.744737
0.744737
0.744737
0.727368
0.727368
0.558947
0
0.001661
0.276225
3,327
133
71
25.015038
0.787375
0.065525
0
0.613636
0
0
0.011283
0
0
0
0
0
0.102273
1
0.102273
false
0
0.045455
0
0.159091
0
0
0
0
null
0
1
0
0
1
1
1
1
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
5
b7a5625b871435341a11acbfe3519814b39b587d
72
py
Python
examples/json.loads/ex1.py
mcorne/python-by-example
15339c0909c84b51075587a6a66391100971c033
[ "MIT" ]
null
null
null
examples/json.loads/ex1.py
mcorne/python-by-example
15339c0909c84b51075587a6a66391100971c033
[ "MIT" ]
null
null
null
examples/json.loads/ex1.py
mcorne/python-by-example
15339c0909c84b51075587a6a66391100971c033
[ "MIT" ]
null
null
null
import json print(json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]'))
24
59
0.555556
12
72
3.333333
0.916667
0
0
0
0
0
0
0
0
0
0
0.046154
0.097222
72
2
60
36
0.569231
0
0
0
0
0
0.527778
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
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
1
0
5
b7b752dee16ab4b73b28669fc83f844affbae0bc
406
py
Python
tests/test_folder/dummy_module.py
WithPrecedent/amos
35b2f5b8d493eac946b583dfcd9d0553e7565292
[ "Apache-2.0" ]
null
null
null
tests/test_folder/dummy_module.py
WithPrecedent/amos
35b2f5b8d493eac946b583dfcd9d0553e7565292
[ "Apache-2.0" ]
null
null
null
tests/test_folder/dummy_module.py
WithPrecedent/amos
35b2f5b8d493eac946b583dfcd9d0553e7565292
[ "Apache-2.0" ]
null
null
null
""" dummy_module: fake module for module introspection tests Corey Rayburn Yung <coreyrayburnyung@gmail.com> Copyright 2020-2021, Corey Rayburn Yung License: Apache-2.0 (https://www.apache.org/licenses/LICENSE-2.0) ToDo: """ import dataclasses @dataclasses.dataclass class DummyDataclass(object): pass class DummyClass(object): pass def dummy_function() -> None: return
16.916667
65
0.721675
50
406
5.82
0.72
0.082474
0.109966
0
0
0
0
0
0
0
0
0.035928
0.17734
406
23
66
17.652174
0.835329
0.534483
0
0.25
0
0
0
0
0
0
0
0.043478
0
1
0.125
true
0.25
0.125
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
0
1
1
0
1
1
0
0
5
b7cc4c1169ab9e87ca29511105f8a227699c870f
23,415
py
Python
src/python/src/grpc/framework/face/interfaces.py
iMilind/grpc
f5b20ce8ec0c1dde684840f6ea8dcf80822bbb1d
[ "BSD-3-Clause" ]
2
2018-01-19T12:18:59.000Z
2019-07-08T15:02:18.000Z
src/python/src/grpc/framework/face/interfaces.py
iMilind/grpc
f5b20ce8ec0c1dde684840f6ea8dcf80822bbb1d
[ "BSD-3-Clause" ]
3
2020-12-31T09:08:34.000Z
2021-09-28T05:42:02.000Z
third_party/grpc/src/python/src/grpc/framework/face/interfaces.py
acidburn0zzz/kythe
6cd4e9c81a1158de43ec783607a4d7edd9b7e4a0
[ "Apache-2.0" ]
1
2021-03-05T06:30:33.000Z
2021-03-05T06:30:33.000Z
# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Interfaces for the face layer of RPC Framework.""" import abc import enum # cardinality, style, exceptions, abandonment, future, and stream are # referenced from specification in this module. from grpc.framework.common import cardinality # pylint: disable=unused-import from grpc.framework.common import style # pylint: disable=unused-import from grpc.framework.face import exceptions # pylint: disable=unused-import from grpc.framework.foundation import abandonment # pylint: disable=unused-import from grpc.framework.foundation import future # pylint: disable=unused-import from grpc.framework.foundation import stream # pylint: disable=unused-import @enum.unique class Abortion(enum.Enum): """Categories of RPC abortion.""" CANCELLED = 'cancelled' EXPIRED = 'expired' NETWORK_FAILURE = 'network failure' SERVICED_FAILURE = 'serviced failure' SERVICER_FAILURE = 'servicer failure' class CancellableIterator(object): """Implements the Iterator protocol and affords a cancel method.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def __iter__(self): """Returns the self object in accordance with the Iterator protocol.""" raise NotImplementedError() @abc.abstractmethod def next(self): """Returns a value or raises StopIteration per the Iterator protocol.""" raise NotImplementedError() @abc.abstractmethod def cancel(self): """Requests cancellation of whatever computation underlies this iterator.""" raise NotImplementedError() class RpcContext(object): """Provides RPC-related information and action.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def is_active(self): """Describes whether the RPC is active or has terminated.""" raise NotImplementedError() @abc.abstractmethod def time_remaining(self): """Describes the length of allowed time remaining for the RPC. Returns: A nonnegative float indicating the length of allowed time in seconds remaining for the RPC to complete before it is considered to have timed out. """ raise NotImplementedError() @abc.abstractmethod def add_abortion_callback(self, abortion_callback): """Registers a callback to be called if the RPC is aborted. Args: abortion_callback: A callable to be called and passed an Abortion value in the event of RPC abortion. """ raise NotImplementedError() class Call(object): """Invocation-side representation of an RPC. Attributes: context: An RpcContext affording information about the RPC. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def cancel(self): """Requests cancellation of the RPC.""" raise NotImplementedError() class UnaryUnaryMultiCallable(object): """Affords invoking a unary-unary RPC in any call style.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def __call__(self, request, timeout): """Synchronously invokes the underlying RPC. Args: request: The request value for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: The response value for the RPC. Raises: exceptions.RpcError: Indicating that the RPC was aborted. """ raise NotImplementedError() @abc.abstractmethod def future(self, request, timeout): """Asynchronously invokes the underlying RPC. Args: request: The request value for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A future.Future representing the RPC. In the event of RPC completion, the returned Future's result value will be the response value of the RPC. In the event of RPC abortion, the returned Future's exception value will be an exceptions.RpcError. """ raise NotImplementedError() @abc.abstractmethod def event(self, request, response_callback, abortion_callback, timeout): """Asynchronously invokes the underlying RPC. Args: request: The request value for the RPC. response_callback: A callback to be called to accept the restponse value of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A Call object for the RPC. """ raise NotImplementedError() class UnaryStreamMultiCallable(object): """Affords invoking a unary-stream RPC in any call style.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def __call__(self, request, timeout): """Synchronously invokes the underlying RPC. Args: request: The request value for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A CancellableIterator that yields the response values of the RPC and affords RPC cancellation. Drawing response values from the returned CancellableIterator may raise exceptions.RpcError indicating abortion of the RPC. """ raise NotImplementedError() @abc.abstractmethod def event(self, request, response_consumer, abortion_callback, timeout): """Asynchronously invokes the underlying RPC. Args: request: The request value for the RPC. response_consumer: A stream.Consumer to be called to accept the restponse values of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A Call object for the RPC. """ raise NotImplementedError() class StreamUnaryMultiCallable(object): """Affords invoking a stream-unary RPC in any call style.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def __call__(self, request_iterator, timeout): """Synchronously invokes the underlying RPC. Args: request_iterator: An iterator that yields request values for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: The response value for the RPC. Raises: exceptions.RpcError: Indicating that the RPC was aborted. """ raise NotImplementedError() @abc.abstractmethod def future(self, request_iterator, timeout): """Asynchronously invokes the underlying RPC. Args: request_iterator: An iterator that yields request values for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A future.Future representing the RPC. In the event of RPC completion, the returned Future's result value will be the response value of the RPC. In the event of RPC abortion, the returned Future's exception value will be an exceptions.RpcError. """ raise NotImplementedError() @abc.abstractmethod def event(self, response_callback, abortion_callback, timeout): """Asynchronously invokes the underlying RPC. Args: request: The request value for the RPC. response_callback: A callback to be called to accept the restponse value of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A pair of a Call object for the RPC and a stream.Consumer to which the request values of the RPC should be passed. """ raise NotImplementedError() class StreamStreamMultiCallable(object): """Affords invoking a stream-stream RPC in any call style.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def __call__(self, request_iterator, timeout): """Synchronously invokes the underlying RPC. Args: request_iterator: An iterator that yields request values for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A CancellableIterator that yields the response values of the RPC and affords RPC cancellation. Drawing response values from the returned CancellableIterator may raise exceptions.RpcError indicating abortion of the RPC. """ raise NotImplementedError() @abc.abstractmethod def event(self, response_consumer, abortion_callback, timeout): """Asynchronously invokes the underlying RPC. l Args: response_consumer: A stream.Consumer to be called to accept the restponse values of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A pair of a Call object for the RPC and a stream.Consumer to which the request values of the RPC should be passed. """ raise NotImplementedError() class MethodImplementation(object): """A sum type that describes an RPC method implementation. Attributes: cardinality: A cardinality.Cardinality value. style: A style.Service value. unary_unary_inline: The implementation of the RPC method as a callable value that takes a request value and an RpcContext object and returns a response value. Only non-None if cardinality is cardinality.Cardinality.UNARY_UNARY and style is style.Service.INLINE. unary_stream_inline: The implementation of the RPC method as a callable value that takes a request value and an RpcContext object and returns an iterator of response values. Only non-None if cardinality is cardinality.Cardinality.UNARY_STREAM and style is style.Service.INLINE. stream_unary_inline: The implementation of the RPC method as a callable value that takes an iterator of request values and an RpcContext object and returns a response value. Only non-None if cardinality is cardinality.Cardinality.STREAM_UNARY and style is style.Service.INLINE. stream_stream_inline: The implementation of the RPC method as a callable value that takes an iterator of request values and an RpcContext object and returns an iterator of response values. Only non-None if cardinality is cardinality.Cardinality.STREAM_STREAM and style is style.Service.INLINE. unary_unary_event: The implementation of the RPC method as a callable value that takes a request value, a response callback to which to pass the response value of the RPC, and an RpcContext. Only non-None if cardinality is cardinality.Cardinality.UNARY_UNARY and style is style.Service.EVENT. unary_stream_event: The implementation of the RPC method as a callable value that takes a request value, a stream.Consumer to which to pass the the response values of the RPC, and an RpcContext. Only non-None if cardinality is cardinality.Cardinality.UNARY_STREAM and style is style.Service.EVENT. stream_unary_event: The implementation of the RPC method as a callable value that takes a response callback to which to pass the response value of the RPC and an RpcContext and returns a stream.Consumer to which the request values of the RPC should be passed. Only non-None if cardinality is cardinality.Cardinality.STREAM_UNARY and style is style.Service.EVENT. stream_stream_event: The implementation of the RPC method as a callable value that takes a stream.Consumer to which to pass the response values of the RPC and an RpcContext and returns a stream.Consumer to which the request values of the RPC should be passed. Only non-None if cardinality is cardinality.Cardinality.STREAM_STREAM and style is style.Service.EVENT. """ __metaclass__ = abc.ABCMeta class MultiMethodImplementation(object): """A general type able to service many RPC methods.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def service(self, name, response_consumer, context): """Services an RPC. Args: name: The RPC method name. response_consumer: A stream.Consumer to be called to accept the response values of the RPC. context: An RpcContext object. Returns: A stream.Consumer with which to accept the request values of the RPC. The consumer returned from this method may or may not be invoked to completion: in the case of RPC abortion, RPC Framework will simply stop passing values to this object. Implementations must not assume that this object will be called to completion of the request stream or even called at all. Raises: abandonment.Abandoned: May or may not be raised when the RPC has been aborted. exceptions.NoSuchMethodError: If this MultiMethod does not recognize the given RPC method name and is not able to service the RPC. """ raise NotImplementedError() class GenericStub(object): """Affords RPC methods to callers.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod def blocking_value_in_value_out(self, name, request, timeout): """Invokes a unary-request-unary-response RPC method. This method blocks until either returning the response value of the RPC (in the event of RPC completion) or raising an exception (in the event of RPC abortion). Args: name: The RPC method name. request: The request value for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: The response value for the RPC. Raises: exceptions.RpcError: Indicating that the RPC was aborted. """ raise NotImplementedError() @abc.abstractmethod def future_value_in_value_out(self, name, request, timeout): """Invokes a unary-request-unary-response RPC method. Args: name: The RPC method name. request: The request value for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A future.Future representing the RPC. In the event of RPC completion, the returned Future will return an outcome indicating that the RPC returned the response value of the RPC. In the event of RPC abortion, the returned Future will return an outcome indicating that the RPC raised an exceptions.RpcError. """ raise NotImplementedError() @abc.abstractmethod def inline_value_in_stream_out(self, name, request, timeout): """Invokes a unary-request-stream-response RPC method. Args: name: The RPC method name. request: The request value for the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A CancellableIterator that yields the response values of the RPC and affords RPC cancellation. Drawing response values from the returned CancellableIterator may raise exceptions.RpcError indicating abortion of the RPC. """ raise NotImplementedError() @abc.abstractmethod def blocking_stream_in_value_out(self, name, request_iterator, timeout): """Invokes a stream-request-unary-response RPC method. This method blocks until either returning the response value of the RPC (in the event of RPC completion) or raising an exception (in the event of RPC abortion). Args: name: The RPC method name. request_iterator: An iterator that yields the request values of the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: The response value for the RPC. Raises: exceptions.RpcError: Indicating that the RPC was aborted. """ raise NotImplementedError() @abc.abstractmethod def future_stream_in_value_out(self, name, request_iterator, timeout): """Invokes a stream-request-unary-response RPC method. Args: name: The RPC method name. request_iterator: An iterator that yields the request values of the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A future.Future representing the RPC. In the event of RPC completion, the returned Future will return an outcome indicating that the RPC returned the response value of the RPC. In the event of RPC abortion, the returned Future will return an outcome indicating that the RPC raised an exceptions.RpcError. """ raise NotImplementedError() @abc.abstractmethod def inline_stream_in_stream_out(self, name, request_iterator, timeout): """Invokes a stream-request-stream-response RPC method. Args: name: The RPC method name. request_iterator: An iterator that yields the request values of the RPC. timeout: A duration of time in seconds to allow for the RPC. Returns: A CancellableIterator that yields the response values of the RPC and affords RPC cancellation. Drawing response values from the returned CancellableIterator may raise exceptions.RpcError indicating abortion of the RPC. """ raise NotImplementedError() @abc.abstractmethod def event_value_in_value_out( self, name, request, response_callback, abortion_callback, timeout): """Event-driven invocation of a unary-request-unary-response RPC method. Args: name: The RPC method name. request: The request value for the RPC. response_callback: A callback to be called to accept the response value of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A Call object for the RPC. """ raise NotImplementedError() @abc.abstractmethod def event_value_in_stream_out( self, name, request, response_consumer, abortion_callback, timeout): """Event-driven invocation of a unary-request-stream-response RPC method. Args: name: The RPC method name. request: The request value for the RPC. response_consumer: A stream.Consumer to be called to accept the response values of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A Call object for the RPC. """ raise NotImplementedError() @abc.abstractmethod def event_stream_in_value_out( self, name, response_callback, abortion_callback, timeout): """Event-driven invocation of a unary-request-unary-response RPC method. Args: name: The RPC method name. response_callback: A callback to be called to accept the response value of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A pair of a Call object for the RPC and a stream.Consumer to which the request values of the RPC should be passed. """ raise NotImplementedError() @abc.abstractmethod def event_stream_in_stream_out( self, name, response_consumer, abortion_callback, timeout): """Event-driven invocation of a unary-request-stream-response RPC method. Args: name: The RPC method name. response_consumer: A stream.Consumer to be called to accept the response values of the RPC. abortion_callback: A callback to be called and passed an Abortion value in the event of RPC abortion. timeout: A duration of time in seconds to allow for the RPC. Returns: A pair of a Call object for the RPC and a stream.Consumer to which the request values of the RPC should be passed. """ raise NotImplementedError() @abc.abstractmethod def unary_unary_multi_callable(self, name): """Creates a UnaryUnaryMultiCallable for a unary-unary RPC method. Args: name: The RPC method name. Returns: A UnaryUnaryMultiCallable value for the named unary-unary RPC method. """ raise NotImplementedError() @abc.abstractmethod def unary_stream_multi_callable(self, name): """Creates a UnaryStreamMultiCallable for a unary-stream RPC method. Args: name: The RPC method name. Returns: A UnaryStreamMultiCallable value for the name unary-stream RPC method. """ raise NotImplementedError() @abc.abstractmethod def stream_unary_multi_callable(self, name): """Creates a StreamUnaryMultiCallable for a stream-unary RPC method. Args: name: The RPC method name. Returns: A StreamUnaryMultiCallable value for the named stream-unary RPC method. """ raise NotImplementedError() @abc.abstractmethod def stream_stream_multi_callable(self, name): """Creates a StreamStreamMultiCallable for a stream-stream RPC method. Args: name: The RPC method name. Returns: A StreamStreamMultiCallable value for the named stream-stream RPC method. """ raise NotImplementedError() class DynamicStub(object): """A stub with RPC-method-bound multi-callable attributes. Instances of this type responsd to attribute access as follows: if the requested attribute is the name of a unary-unary RPC method, the value of the attribute will be a UnaryUnaryMultiCallable with which to invoke the RPC method; if the requested attribute is the name of a unary-stream RPC method, the value of the attribute will be a UnaryStreamMultiCallable with which to invoke the RPC method; if the requested attribute is the name of a stream-unary RPC method, the value of the attribute will be a StreamUnaryMultiCallable with which to invoke the RPC method; and if the requested attribute is the name of a stream-stream RPC method, the value of the attribute will be a StreamStreamMultiCallable with which to invoke the RPC method. """ __metaclass__ = abc.ABCMeta
36.528861
82
0.725005
3,192
23,415
5.257206
0.098371
0.046481
0.025743
0.056195
0.789524
0.75508
0.739825
0.714916
0.685716
0.67058
0
0.000219
0.221695
23,415
640
83
36.585938
0.920599
0.727055
0
0.591241
0
0
0.012532
0
0
0
0
0
0
1
0.233577
false
0
0.058394
0
0.49635
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
1
0
0
0
0
0
0
0
5
b7d835eb658a4188499afb1ab251e22f41a165e9
150
py
Python
dataproviderexample/core/dataproviderbase.py
brymck/data-provider-example
3c7f584f2d96306ad2530bdc090eae2f5d8a5f1e
[ "MIT" ]
null
null
null
dataproviderexample/core/dataproviderbase.py
brymck/data-provider-example
3c7f584f2d96306ad2530bdc090eae2f5d8a5f1e
[ "MIT" ]
null
null
null
dataproviderexample/core/dataproviderbase.py
brymck/data-provider-example
3c7f584f2d96306ad2530bdc090eae2f5d8a5f1e
[ "MIT" ]
null
null
null
from abc import ABC, abstractmethod class DataProviderBase(ABC): @abstractmethod def get_template(self, language: str) -> str: pass
18.75
49
0.7
17
150
6.117647
0.764706
0.326923
0
0
0
0
0
0
0
0
0
0
0.22
150
7
50
21.428571
0.888889
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.2
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
1
0
0
1
0
0
5
b7f88878a7580352498111968d753f5b4974aaf3
219
py
Python
tessled/resources/__init__.py
hodgestar/tesseract-control-software
41f47a4b901a0069f1745c90abe28f0778704b0e
[ "MIT" ]
2
2019-07-13T14:15:30.000Z
2020-01-04T10:44:47.000Z
tessled/resources/__init__.py
hodgestar/tesseract-control-software
41f47a4b901a0069f1745c90abe28f0778704b0e
[ "MIT" ]
null
null
null
tessled/resources/__init__.py
hodgestar/tesseract-control-software
41f47a4b901a0069f1745c90abe28f0778704b0e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Resources package. """ import pkg_resources def resource_filename(name): """ Return the filename of the given resource. """ return pkg_resources.resource_filename(__name__, name)
19.909091
58
0.694064
26
219
5.538462
0.576923
0.166667
0.277778
0
0
0
0
0
0
0
0
0.005495
0.16895
219
10
59
21.9
0.785714
0.392694
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
1
0
1
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
1
0
1
0
0
5
b7fa2be59dd639fade366eb9825633ab139de078
130
py
Python
app/enums/auto_name.py
TiagoValdrich/oci-emulator
843c2e69d6c9387df2286053be238d01526c11eb
[ "MIT" ]
10
2021-03-03T13:45:32.000Z
2021-11-16T13:34:38.000Z
app/enums/auto_name.py
TiagoValdrich/oci-emulator
843c2e69d6c9387df2286053be238d01526c11eb
[ "MIT" ]
5
2021-03-10T00:37:47.000Z
2021-05-07T14:47:53.000Z
app/enums/auto_name.py
TiagoValdrich/oci-emulator
843c2e69d6c9387df2286053be238d01526c11eb
[ "MIT" ]
5
2021-03-03T13:52:00.000Z
2021-04-14T19:22:51.000Z
from enum import Enum class AutoName(Enum): def _generate_next_value_(name, start, count, last_values): return name
18.571429
63
0.723077
18
130
4.944444
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.207692
130
6
64
21.666667
0.864078
0
0
0
1
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
4d4a1ef68e18702c4fd33075ca7ab87c2f1ff460
22,374
py
Python
basis/trimesh/io/collada/light.py
takuya-ki/wrs
f6e1009b94332504042fbde9b39323410394ecde
[ "MIT" ]
null
null
null
basis/trimesh/io/collada/light.py
takuya-ki/wrs
f6e1009b94332504042fbde9b39323410394ecde
[ "MIT" ]
null
null
null
basis/trimesh/io/collada/light.py
takuya-ki/wrs
f6e1009b94332504042fbde9b39323410394ecde
[ "MIT" ]
null
null
null
#################################################################### # # # THIS FILE IS PART OF THE pycollada LIBRARY SOURCE CODE. # # USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS # # GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE # # IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. # # # # THE pycollada SOURCE CODE IS (C) COPYRIGHT 2011 # # by Jeff Terrace and contributors # # # #################################################################### """Contains objects for representing lights.""" import numpy from .common import DaeObject, E, tag from .common import DaeIncompleteError, DaeBrokenRefError, \ DaeMalformedError, DaeUnsupportedError from .util import _correctValInNode from .xmlutil import etree as ElementTree class Light(DaeObject): """Base light class holding data from <light> tags.""" @staticmethod def load(collada, localscope, node): tecnode = node.find( collada.tag('technique_common') ) if tecnode is None or len(tecnode) == 0: raise DaeIncompleteError('Missing common technique in light') lightnode = tecnode[0] if lightnode.tag == collada.tag('directional'): return DirectionalLight.load( collada, localscope, node ) elif lightnode.tag == collada.tag('point'): return PointLight.load( collada, localscope, node ) elif lightnode.tag == collada.tag('ambient'): return AmbientLight.load( collada, localscope, node ) elif lightnode.tag == collada.tag('spot'): return SpotLight.load( collada, localscope, node ) else: raise DaeUnsupportedError('Unrecognized light type: %s'%lightnode.tag) class DirectionalLight(Light): """Directional light as defined in COLLADA tag <directional> tag.""" def __init__(self, id, color, xmlnode = None): """Create a new directional light. :param str id: A unique string identifier for the light :param tuple color: Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light :param xmlnode: If loaded from xml, the xml node """ self.id = id """The unique string identifier for the light""" self.direction = numpy.array( [0, 0, -1], dtype=numpy.float32 ) #Not documenting this because it doesn't make sense to set the direction # of an unbound light. The direction isn't set until binding in a scene. self.color = color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" if xmlnode != None: self.xmlnode = xmlnode """ElementTree representation of the light.""" else: self.xmlnode = E.light( E.technique_common( E.directional( E.color(' '.join(map(str, self.color))) ) ) , id=self.id, name=self.id) def save(self): """Saves the light's properties back to :attr:`xmlnode`""" self.xmlnode.set('id', self.id) self.xmlnode.set('name', self.id) colornode = self.xmlnode.find('%s/%s/%s' % (tag('technique_common'), tag('directional'), tag('color'))) colornode.text = ' '.join(map(str, self.color)) @staticmethod def load(collada, localscope, node): colornode = node.find( '%s/%s/%s'%(collada.tag('technique_common'),collada.tag('directional'), collada.tag('color') ) ) if colornode is None: raise DaeIncompleteError('Missing color for directional light') try: color = tuple([float(v) for v in colornode.text.split()]) except ValueError as ex: raise DaeMalformedError('Corrupted color values in light definition') return DirectionalLight(node.get('id'), color, xmlnode = node) def bind(self, matrix): """Binds this light to a transform matrix. :param numpy.array matrix: A 4x4 numpy float matrix :rtype: :class:`collada.light.BoundDirectionalLight` """ return BoundDirectionalLight(self, matrix) def __str__(self): return '<DirectionalLight id=%s>' % (self.id,) def __repr__(self): return str(self) class AmbientLight(Light): """Ambient light as defined in COLLADA tag <ambient>.""" def __init__(self, id, color, xmlnode = None): """Create a new ambient light. :param str id: A unique string identifier for the light :param tuple color: Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light :param xmlnode: If loaded from xml, the xml node """ self.id = id """The unique string identifier for the light""" self.color = color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" if xmlnode != None: self.xmlnode = xmlnode """ElementTree representation of the light.""" else: self.xmlnode = E.light( E.technique_common( E.ambient( E.color(' '.join(map(str, self.color))) ) ) , id=self.id, name=self.id) def save(self): """Saves the light's properties back to :attr:`xmlnode`""" self.xmlnode.set('id', self.id) self.xmlnode.set('name', self.id) colornode = self.xmlnode.find('%s/%s/%s' % (tag('technique_common'), tag('ambient'), tag('color'))) colornode.text = ' '.join(map(str, self.color)) @staticmethod def load(collada, localscope, node): colornode = node.find('%s/%s/%s' % (collada.tag('technique_common'), collada.tag('ambient'), collada.tag('color'))) if colornode is None: raise DaeIncompleteError('Missing color for ambient light') try: color = tuple( [ float(v) for v in colornode.text.split() ] ) except ValueError as ex: raise DaeMalformedError('Corrupted color values in light definition') return AmbientLight(node.get('id'), color, xmlnode = node) def bind(self, matrix): """Binds this light to a transform matrix. :param numpy.array matrix: A 4x4 numpy float matrix :rtype: :class:`collada.light.BoundAmbientLight` """ return BoundAmbientLight(self, matrix) def __str__(self): return '<AmbientLight id=%s>' % (self.id,) def __repr__(self): return str(self) class PointLight(Light): """Point light as defined in COLLADA tag <point>.""" def __init__(self, id, color, constant_att=None, linear_att=None, quad_att=None, zfar=None, xmlnode = None): """Create a new sun light. :param str id: A unique string identifier for the light :param tuple color: Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light :param float constant_att: Constant attenuation factor :param float linear_att: Linear attenuation factor :param float quad_att: Quadratic attenuation factor :param float zfar: Distance to the far clipping plane :param xmlnode: If loaded from xml, the xml node """ self.id = id """The unique string identifier for the light""" self.position = numpy.array( [0, 0, 0], dtype=numpy.float32 ) #Not documenting this because it doesn't make sense to set the position # of an unbound light. The position isn't set until binding in a scene. self.color = color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" self.constant_att = constant_att """Constant attenuation factor.""" self.linear_att = linear_att """Linear attenuation factor.""" self.quad_att = quad_att """Quadratic attenuation factor.""" self.zfar = zfar """Distance to the far clipping plane""" if xmlnode != None: self.xmlnode = xmlnode """ElementTree representation of the light.""" else: pnode = E.point( E.color(' '.join(map(str, self.color ) )) ) if self.constant_att is not None: pnode.append(E.constant_attenuation(str(self.constant_att))) if self.linear_att is not None: pnode.append(E.linear_attenuation(str(self.linear_att))) if self.quad_att is not None: pnode.append(E.quadratic_attenuation(str(self.quad_att))) if self.zfar is not None: pnode.append(E.zfar(str(self.zvar))) self.xmlnode = E.light( E.technique_common(pnode) , id=self.id, name=self.id) def save(self): """Saves the light's properties back to :attr:`xmlnode`""" self.xmlnode.set('id', self.id) self.xmlnode.set('name', self.id) pnode = self.xmlnode.find( '%s/%s'%(tag('technique_common'), tag('point')) ) colornode = pnode.find( tag('color') ) colornode.text = ' '.join(map(str, self.color ) ) _correctValInNode(pnode, 'constant_attenuation', self.constant_att) _correctValInNode(pnode, 'linear_attenuation', self.linear_att) _correctValInNode(pnode, 'quadratic_attenuation', self.quad_att) _correctValInNode(pnode, 'zfar', self.zfar) @staticmethod def load(collada, localscope, node): pnode = node.find('%s/%s' % (collada.tag('technique_common'), collada.tag('point'))) colornode = pnode.find( collada.tag('color') ) if colornode is None: raise DaeIncompleteError('Missing color for point light') try: color = tuple([float(v) for v in colornode.text.split()]) except ValueError as ex: raise DaeMalformedError('Corrupted color values in light definition') constant_att = linear_att = quad_att = zfar = None qattnode = pnode.find( collada.tag('quadratic_attenuation') ) cattnode = pnode.find( collada.tag('constant_attenuation') ) lattnode = pnode.find( collada.tag('linear_attenuation') ) zfarnode = pnode.find( collada.tag('zfar') ) try: if cattnode is not None: constant_att = float(cattnode.text) if lattnode is not None: linear_att = float(lattnode.text) if qattnode is not None: quad_att = float(qattnode.text) if zfarnode is not None: zfar = float(zfarnode.text) except ValueError as ex: raise DaeMalformedError('Corrupted values in light definition') return PointLight(node.get('id'), color, constant_att, linear_att, quad_att, zfar, xmlnode = node) def bind(self, matrix): """Binds this light to a transform matrix. :param numpy.array matrix: A 4x4 numpy float matrix :rtype: :class:`collada.light.BoundPointLight` """ return BoundPointLight(self, matrix) def __str__(self): return '<PointLight id=%s>' % (self.id,) def __repr__(self): return str(self) class SpotLight(Light): """Spot light as defined in COLLADA tag <spot>.""" def __init__(self, id, color, constant_att=None, linear_att=None, quad_att=None, falloff_ang=None, falloff_exp=None, xmlnode = None): """Create a new spot light. :param str id: A unique string identifier for the light :param tuple color: Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light :param float constant_att: Constant attenuation factor :param float linear_att: Linear attenuation factor :param float quad_att: Quadratic attenuation factor :param float falloff_ang: Falloff angle :param float falloff_exp: Falloff exponent :param xmlnode: If loaded from xml, the xml node """ self.id = id """The unique string identifier for the light""" self.color = color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" self.constant_att = constant_att """Constant attenuation factor.""" self.linear_att = linear_att """Linear attenuation factor.""" self.quad_att = quad_att """Quadratic attenuation factor.""" self.falloff_ang = falloff_ang """Falloff angle""" self.falloff_exp = falloff_exp """Falloff exponent""" if xmlnode != None: self.xmlnode = xmlnode """ElementTree representation of the light.""" else: pnode = E.spot( E.color(' '.join(map(str, self.color ) )), ) if self.constant_att is not None: pnode.append(E.constant_attenuation(str(self.constant_att))) if self.linear_att is not None: pnode.append(E.linear_attenuation(str(self.linear_att))) if self.quad_att is not None: pnode.append(E.quadratic_attenuation(str(self.quad_att))) if self.falloff_ang is not None: pnode.append(E.falloff_angle(str(self.falloff_ang))) if self.falloff_exp is not None: pnode.append(E.falloff_exponent(str(self.falloff_exp))) self.xmlnode = E.light( E.technique_common(pnode) , id=self.id, name=self.id) def save(self): """Saves the light's properties back to :attr:`xmlnode`""" self.xmlnode.set('id', self.id) self.xmlnode.set('name', self.id) pnode = self.xmlnode.find('%s/%s' % (tag('technique_common'), tag('spot'))) colornode = pnode.find(tag('color')) colornode.text = ' '.join(map(str, self.color ) ) _correctValInNode(pnode, 'constant_attenuation', self.constant_att) _correctValInNode(pnode, 'linear_attenuation', self.linear_att) _correctValInNode(pnode, 'quadratic_attenuation', self.quad_att) _correctValInNode(pnode, 'falloff_angle', self.falloff_ang) _correctValInNode(pnode, 'falloff_exponent', self.falloff_exp) @staticmethod def load(collada, localscope, node): pnode = node.find( '%s/%s'%(collada.tag('technique_common'),collada.tag('spot')) ) colornode = pnode.find( collada.tag('color') ) if colornode is None: raise DaeIncompleteError('Missing color for spot light') try: color = tuple([float(v) for v in colornode.text.split()]) except ValueError as ex: raise DaeMalformedError('Corrupted color values in spot light definition') constant_att = linear_att = quad_att = falloff_ang = falloff_exp = None cattnode = pnode.find( collada.tag('constant_attenuation') ) lattnode = pnode.find( collada.tag('linear_attenuation') ) qattnode = pnode.find( collada.tag('quadratic_attenuation') ) fangnode = pnode.find( collada.tag('falloff_angle') ) fexpnode = pnode.find( collada.tag('falloff_exponent') ) try: if cattnode is not None: constant_att = float(cattnode.text) if lattnode is not None: linear_att = float(lattnode.text) if qattnode is not None: quad_att = float(qattnode.text) if fangnode is not None: falloff_ang = float(fangnode.text) if fexpnode is not None: falloff_exp = float(fexpnode.text) except ValueError as ex: raise DaeMalformedError('Corrupted values in spot light definition') return SpotLight(node.get('id'), color, constant_att, linear_att, quad_att, falloff_ang, falloff_exp, xmlnode = node) def bind(self, matrix): """Binds this light to a transform matrix. :param numpy.array matrix: A 4x4 numpy float matrix :rtype: :class:`collada.light.BoundSpotLight` """ return BoundSpotLight(self, matrix) def __str__(self): return '<SpotLight id=%s>' % (self.id,) def __repr__(self): return str(self) class BoundLight(object): """Base class for bound lights""" pass class BoundPointLight(BoundLight): """Point light bound to a scene with transformation. This gets created when a light is instantiated in a scene. Do not create this manually.""" def __init__(self, plight, matrix): self.position = numpy.dot( matrix[:3,:3], plight.position ) + matrix[:3,3] """Numpy array of length 3 representing the position of the light in the scene""" self.color = plight.color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" self.constant_att = plight.constant_att if self.constant_att is None: self.constant_att = 1.0 """Constant attenuation factor.""" self.linear_att = plight.linear_att if self.linear_att is None: self.linear_att = 0.0 """Linear attenuation factor.""" self.quad_att = plight.quad_att if self.quad_att is None: self.quad_att = 0.0 """Quadratic attenuation factor.""" self.zfar = plight.zfar """Distance to the far clipping plane""" self.original = plight """The original :class:`collada.light.PointLight` this is bound to""" def __str__(self): return '<BoundPointLight bound to id=%s>' % str(self.original.id) def __repr__(self): return str(self) class BoundSpotLight(BoundLight): """Spot light bound to a scene with transformation. This gets created when a light is instantiated in a scene. Do not create this manually.""" def __init__(self, slight, matrix): self.position = matrix[:3,3] """Numpy array of length 3 representing the position of the light in the scene""" self.direction = -matrix[:3,2] """Direction of the spot light""" self.up = matrix[:3,1] """Up vector of the spot light""" self.matrix = matrix """Transform matrix for the bound light""" self.color = slight.color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" self.constant_att = slight.constant_att if self.constant_att is None: self.constant_att = 1.0 """Constant attenuation factor.""" self.linear_att = slight.linear_att if self.linear_att is None: self.linear_att = 0.0 """Linear attenuation factor.""" self.quad_att = slight.quad_att if self.quad_att is None: self.quad_att = 0.0 """Quadratic attenuation factor.""" self.falloff_ang = slight.falloff_ang if self.falloff_ang is None: self.falloff_ang = 180.0 """Falloff angle""" self.falloff_exp = slight.falloff_exp if self.falloff_exp is None: self.falloff_exp = 0.0 """Falloff exponent""" self.original = slight """The original :class:`collada.light.SpotLight` this is bound to""" def __str__(self): return '<BoundSpotLight bound to id=%s>' % str(self.original.id) def __repr__(self): return str(self) class BoundDirectionalLight(BoundLight): """Directional light bound to a scene with transformation. This gets created when a light is instantiated in a scene. Do not create this manually.""" def __init__(self, dlight, matrix): self.direction = numpy.dot( matrix[:3,:3], dlight.direction ) """Numpy array of length 3 representing the direction of the light in the scene""" self.color = dlight.color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" self.original = dlight """The original :class:`collada.light.DirectionalLight` this is bound to""" def __str__(self): return '<BoundDirectionalLight bound to id=%s>' % str(self.original.id) def __repr__(self): return str(self) class BoundAmbientLight(BoundLight): """Ambient light bound to a scene with transformation. This gets created when a light is instantiated in a scene. Do not create this manually.""" def __init__(self, alight, matrix): self.color = alight.color """Either a tuple of size 3 containing the RGB color value of the light or a tuple of size 4 containing the RGBA color value of the light""" self.original = alight """The original :class:`collada.light.AmbientLight` this is bound to""" def __str__(self): return '<BoundAmbientLight bound to id=%s>' % str(self.original.id) def __repr__(self): return str(self)
39.321617
102
0.597881
2,705
22,374
4.851017
0.08244
0.026216
0.023624
0.021948
0.799878
0.763756
0.737921
0.715745
0.701113
0.689453
0
0.005162
0.298695
22,374
568
103
39.390845
0.831113
0.188388
0
0.569132
0
0
0.090569
0.007351
0
0
0
0
0
1
0.118971
false
0.003215
0.016077
0.051447
0.257235
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4d63c238b40a3cb91ea2debc857ee06d96f53dc8
19
py
Python
acmicpc/12093/12093.py
love-adela/algorithm
4ccd02173c96f8369962f1fd4e5166a221690fa2
[ "MIT" ]
3
2019-03-09T05:19:23.000Z
2019-04-06T09:26:36.000Z
acmicpc/12093/12093.py
love-adela/algorithm
4ccd02173c96f8369962f1fd4e5166a221690fa2
[ "MIT" ]
1
2020-02-23T10:38:04.000Z
2020-02-23T10:38:04.000Z
acmicpc/12093/12093.py
love-adela/algorithm
4ccd02173c96f8369962f1fd4e5166a221690fa2
[ "MIT" ]
1
2019-05-22T13:47:53.000Z
2019-05-22T13:47:53.000Z
print('1oveadela')
9.5
18
0.736842
2
19
7
1
0
0
0
0
0
0
0
0
0
0
0.055556
0.052632
19
1
19
19
0.722222
0
0
0
0
0
0.473684
0
0
0
0
0
0
1
0
true
0
0
0
0
1
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
1
0
5
4d7735e689575635295d48b1de9865c3e19d2cd2
99
py
Python
EndToEndClassification/MSTmodel/__init__.py
corticph/MSTmodel
a033612fd4ba1ef8c803f8edf631a6014232ced2
[ "Apache-2.0" ]
15
2017-12-14T14:04:50.000Z
2021-12-08T07:30:45.000Z
EndToEndClassification/MSTmodel/__init__.py
corticph/MSTmodel
a033612fd4ba1ef8c803f8edf631a6014232ced2
[ "Apache-2.0" ]
1
2017-12-06T11:40:04.000Z
2017-12-06T11:40:04.000Z
EndToEndClassification/MSTmodel/__init__.py
corticph/MSTmodel
a033612fd4ba1ef8c803f8edf631a6014232ced2
[ "Apache-2.0" ]
6
2018-01-04T08:52:31.000Z
2019-11-02T07:14:30.000Z
from .MSTmodel import MSTmodel from .MSTtrainer import MSTtrainer from .MSTloader import MSTLoader
24.75
34
0.848485
12
99
7
0.416667
0
0
0
0
0
0
0
0
0
0
0
0.121212
99
3
35
33
0.965517
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
1
0
0
5
4d9c80df4c798a6b674cc3bf82943d743a580c61
6,504
py
Python
core/dataloaders/vision.py
AkibMashrur/Ensembling
bdf2f601be90070fed10db62a9c15506e1df37b6
[ "Apache-2.0" ]
null
null
null
core/dataloaders/vision.py
AkibMashrur/Ensembling
bdf2f601be90070fed10db62a9c15506e1df37b6
[ "Apache-2.0" ]
null
null
null
core/dataloaders/vision.py
AkibMashrur/Ensembling
bdf2f601be90070fed10db62a9c15506e1df37b6
[ "Apache-2.0" ]
null
null
null
import logging from typing import Iterable, Tuple import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader, random_split from torch import Tensor class Sampler(): """Basic sampler object""" def __init__(self, sample_size: int) -> None: self.sample_size: int = sample_size self.loader: Iterable def __len__(self) -> int: """Check sample length""" return self.sample_size class CIFAR10Sampler(Sampler): """Instantiates a dataloader object on sample of cifar10""" def __init__(self, sample_size: int, batch_size: int, split: str = 'train') -> None: self.sample_size: int = sample_size train_transform: transforms.Compose = transforms.Compose( [transforms.RandomResizedCrop(size=32, scale=(0.2, 1.)), transforms.RandomHorizontalFlip(), transforms.RandomApply([ transforms.ColorJitter(0.4, 0.4, 0.4, 0.1) ], p=0.8), transforms.RandomGrayscale(p=0.2), transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010))]) test_transform: transforms.Compose = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010))] ) trainset: Dataset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=train_transform) testset: Dataset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=test_transform) smaller_trainset: Dataset smaller_testset: Dataset smaller_trainset, _ = random_split(trainset, lengths=[sample_size, len( trainset)-sample_size], generator=torch.Generator().manual_seed(0)) smaller_testset, _ = random_split(testset, lengths=[sample_size, len( testset)-sample_size], generator=torch.Generator().manual_seed(0)) if split == 'train': self.loader: DataLoader = DataLoader(smaller_trainset, batch_size=batch_size, shuffle=True) elif split == 'test': self.loader: DataLoader = DataLoader(smaller_testset, batch_size=batch_size, shuffle=False) else: raise NotImplementedError('Split should be either train or test') class SVHNSampler(Sampler): """Instantiates a dataloader object on sample of cifar10""" def __init__(self, sample_size: int, batch_size: int, split: str = 'train') -> None: self.sample_size: int = sample_size train_transform: transforms.Compose = transforms.Compose( [transforms.RandomResizedCrop(size=32, scale=(0.2, 1.)), transforms.RandomHorizontalFlip(), transforms.RandomApply([ transforms.ColorJitter(0.4, 0.4, 0.4, 0.1) ], p=0.8), transforms.RandomGrayscale(p=0.2), transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) test_transform: transforms.Compose = transforms.Compose( [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))] ) trainset: Dataset = torchvision.datasets.SVHN(root='./data', split='train', download=True, transform=train_transform) testset: Dataset = torchvision.datasets.SVHN(root='./data', split='test', download=True, transform=test_transform) smaller_trainset: Dataset smaller_testset: Dataset smaller_trainset, _ = random_split(trainset, lengths=[sample_size, len( trainset)-sample_size], generator=torch.Generator().manual_seed(0)) smaller_testset, _ = random_split(testset, lengths=[sample_size, len( testset)-sample_size], generator=torch.Generator().manual_seed(0)) if split == 'train': self.loader: DataLoader = DataLoader(smaller_trainset, batch_size=batch_size, shuffle=True) elif split == 'test': self.loader: DataLoader = DataLoader(smaller_testset, batch_size=batch_size, shuffle=False) else: raise NotImplementedError('Split should be either train or test') def __len__(self) -> int: """Check length of the sample""" return self.sample_size def test_sampler(sampler: Sampler) -> None: """Test CIFAR10 sampler""" logging.basicConfig(level=logging.DEBUG) logging.debug(f"{len(sampler)}") i: int images: Tensor labels: Tensor for i, (images, labels) in enumerate(sampler.loader): logging.debug(f"{i}:{images.shape}:{labels.shape}") if __name__ == "__main__": sampler = CIFAR10Sampler(sample_size=320, batch_size=32) test_sampler(sampler) sampler = SVHNSampler(sample_size=320, batch_size=32) test_sampler(sampler)
41.96129
90
0.490314
568
6,504
5.443662
0.18662
0.067917
0.009702
0.012937
0.796572
0.784929
0.777167
0.726391
0.726391
0.655239
0
0.038533
0.417435
6,504
154
91
42.233766
0.777514
0.030135
0
0.691667
0
0
0.029951
0.005257
0
0
0
0
0
1
0.05
false
0
0.058333
0
0.15
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4d9ce9785c573cc12c04fbedb2d36cfaa76d3e6a
21
py
Python
g2p_en/__init__.py
casonclagg/g2p
087ca98939befcb84688b77a7bcdf8edcbbaafb0
[ "Apache-2.0" ]
523
2018-05-17T10:05:13.000Z
2022-03-30T04:22:09.000Z
g2p_en/__init__.py
casonclagg/g2p
087ca98939befcb84688b77a7bcdf8edcbbaafb0
[ "Apache-2.0" ]
23
2018-10-01T09:55:25.000Z
2022-01-08T16:24:33.000Z
g2p_en/__init__.py
casonclagg/g2p
087ca98939befcb84688b77a7bcdf8edcbbaafb0
[ "Apache-2.0" ]
99
2018-05-17T10:41:21.000Z
2022-03-28T09:18:18.000Z
from .g2p import G2p
10.5
20
0.761905
4
21
4
0.75
0
0
0
0
0
0
0
0
0
0
0.117647
0.190476
21
1
21
21
0.823529
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
4da9ee1807d3f6ab7ec6f0d24aa0cb8c98fb8527
23
py
Python
main.py
gresm/warriorcats
2abc3527eb98ac8ea39d47e678cdc116c681bbd1
[ "Apache-2.0" ]
2
2021-02-26T14:44:51.000Z
2021-02-26T16:23:34.000Z
main.py
gresm/warriorcats
2abc3527eb98ac8ea39d47e678cdc116c681bbd1
[ "Apache-2.0" ]
null
null
null
main.py
gresm/warriorcats
2abc3527eb98ac8ea39d47e678cdc116c681bbd1
[ "Apache-2.0" ]
1
2021-02-26T16:23:25.000Z
2021-02-26T16:23:25.000Z
#! venv/bin/python3.8
7.666667
21
0.652174
4
23
3.75
1
0
0
0
0
0
0
0
0
0
0
0.1
0.130435
23
2
22
11.5
0.65
0.869565
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
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
129377a81d22b1bc3f4c03a6e508156492d47f25
96
py
Python
samples/simple/badvariable.py
ajlopez/JPyScript
51c12fd6e5a9de1484c2504479e7719aa093e427
[ "MIT" ]
2
2018-03-01T13:45:52.000Z
2019-07-03T19:03:05.000Z
samples/simple/badvariable.py
ajlopez/JPyScript
51c12fd6e5a9de1484c2504479e7719aa093e427
[ "MIT" ]
null
null
null
samples/simple/badvariable.py
ajlopez/JPyScript
51c12fd6e5a9de1484c2504479e7719aa093e427
[ "MIT" ]
1
2016-07-31T20:04:42.000Z
2016-07-31T20:04:42.000Z
a = 2 def foo(): print("a in foo", a) a = 1 foo() print("a in global", a)
10.666667
25
0.416667
17
96
2.352941
0.470588
0.4
0.45
0.55
0
0
0
0
0
0
0
0.035088
0.40625
96
9
26
10.666667
0.666667
0
0
0
0
0
0.215909
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.166667
0.333333
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
42316d45156f87f67880bfa2ebc7ae4131d4e2f9
22
py
Python
hdmlp/__init__.py
OpenCoreCH/hdmlp
745abc12d15480a2b4772567313bc07859787cde
[ "BSD-3-Clause" ]
null
null
null
hdmlp/__init__.py
OpenCoreCH/hdmlp
745abc12d15480a2b4772567313bc07859787cde
[ "BSD-3-Clause" ]
null
null
null
hdmlp/__init__.py
OpenCoreCH/hdmlp
745abc12d15480a2b4772567313bc07859787cde
[ "BSD-3-Clause" ]
null
null
null
from .hdmlp import Job
22
22
0.818182
4
22
4.5
1
0
0
0
0
0
0
0
0
0
0
0
0.136364
22
1
22
22
0.947368
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
423a5f134afaaed430c99e5b3b650f0f686229e0
7,538
py
Python
API in den Keller.py
Xceron/API-in-den-Keller
7e8108018097f69dd397cdd61b7d98299883f22e
[ "MIT" ]
null
null
null
API in den Keller.py
Xceron/API-in-den-Keller
7e8108018097f69dd397cdd61b7d98299883f22e
[ "MIT" ]
2
2021-06-21T04:31:32.000Z
2021-06-22T16:44:22.000Z
API in den Keller.py
Xceron/API-in-den-Keller
7e8108018097f69dd397cdd61b7d98299883f22e
[ "MIT" ]
null
null
null
# coding: utf8 import requests from bs4 import BeautifulSoup class Api: def __init__(self, house): """ :param house: house to collect data """ self.houses = {"Wohnanlage Tarforst - Haus I": { "washer_quantity": 4, "id_dryer": 1, "id_washer": 1 }, "Wohnanlage Tarforst - Haus IV": { "washer_quantity": 3, "id_dryer": 2, "id_washer": 2 }, "Wohnanlage Tarforst - Haus VIII": { "washer_quantity": 2, "id_dryer": 3, "id_washer": 3 }, "Wohnanlage Kleeburger Weg": { "washer_quantity": 6, "id_dryer": 7, "id_washer": 6 }, "Wohnanlage Petrisberg": { "washer_quantity": 5, "id_dryer": 11, "id_washer": 10 }, "Wohnanlage Martinskloster": { "washer_quantity": 3, "id_dryer": 9, "id_washer": 9 }, "Wohnanlage Olewig": { "washer_quantity": 4, "id_dryer": 8, "id_washer": 8 } } self.house = house site = requests.get("http://app-in-den-keller.de/cgi-bin/wm") self.soup = BeautifulSoup(site.text, "html.parser").findAll("list") self.same_id = self.houses[self.house]["id_washer"] == self.houses[self.house]["id_dryer"] @property def all_washers(self): """ :return: dict containing all washers with their machine ID and their time """ id_washer = self.houses[self.house]["id_washer"] washer_quantity = self.houses[self.house]["washer_quantity"] output = {} for list_content in self.soup: html_washer_id = list_content.contents[3].contents[0] if html_washer_id == str(id_washer): html_machine_id = list_content.contents[0].contents[0] html_machine_time = list_content.contents[1].contents[0] if not self.same_id: output[html_machine_id] = html_machine_time else: if self.house == "Wohnanlage Martinskloster": if int(html_machine_id) > 2: output[html_machine_id] = html_machine_time elif self.house == "Wohnanlage Tarforst - Haus VIII": if int(html_machine_id) <= washer_quantity or int(html_machine_id) == 5: output[html_machine_id] = html_machine_time else: if int(html_machine_id) <= washer_quantity: output[html_machine_id] = html_machine_time return output @property def all_dryers(self): """ :return: dict containing all dryers with their machine ID and their time """ id_dryer = self.houses[self.house]["id_dryer"] washer_quantity = self.houses[self.house]["washer_quantity"] output = {} for list_content in self.soup: html_dryer_id = list_content.contents[3].contents[0] if html_dryer_id == str(id_dryer): html_machine_id = list_content.contents[0].contents[0] html_machine_time = list_content.contents[1].contents[0] if not self.same_id: output[html_machine_id] = html_machine_time else: if self.house == "Wohnanlage Tarforst - Haus IV": if int(html_machine_id) == 4: output[html_machine_id] = html_machine_time elif self.house == "Wohnanlage Martinskloster": if int(html_machine_id) <= 2: output[html_machine_id] = html_machine_time else: if int(html_machine_id) > washer_quantity: output[html_machine_id] = html_machine_time return output @property def all_machines(self): """ :return: dict containing all washers with times in one dict and all dryers with times in another dict """ return {"washers": self.all_washers, "dryers": self.all_dryers} @property def all_available_washers(self): """ :return: tuple containing all washers which aren't running with their ID """ id_washer = self.houses[self.house]["id_washer"] washer_quantity = self.houses[self.house]["washer_quantity"] output = [] for list_content in self.soup: html_washer_id = list_content.contents[3].contents[0] if html_washer_id == str(id_washer): html_machine_id = list_content.contents[0].contents[0] html_machine_running = list_content.contents[2].contents[0] if not self.same_id: if not html_machine_running == "true": output.append(html_machine_id) else: if self.house == "Wohnanlage Martinskloster": if int(html_machine_id) > 2: if not html_machine_running == "true": output.append(html_machine_id) elif self.house == "Wohnanlage Tarforst - Haus VIII": if int(html_machine_id) <= washer_quantity or int(html_machine_id) == 5: if not html_machine_running == "true": output.append(html_machine_id) else: if int(html_machine_id) <= washer_quantity: if not html_machine_running == "true": output.append(html_machine_id) return tuple(output) @property def all_available_dryers(self): """ :return: tuple containing all dryers which aren't running with their ID """ id_dryer = self.houses[self.house]["id_dryer"] washer_quantity = self.houses[self.house]["washer_quantity"] output = [] for list_content in self.soup: html_dryer_id = list_content.contents[3].contents[0] if html_dryer_id == str(id_dryer): html_machine_id = list_content.contents[0].contents[0] html_machine_running = list_content.contents[2].contents[0] if not self.same_id: if not html_machine_running == "true": output.append(html_machine_id) else: if self.house == "Wohnanlage Tarforst - Haus IV": if int(html_machine_id) == 4: if not html_machine_running == "true": output.append(html_machine_id) elif self.house == "Wohnanlage Martinskloster": if int(html_machine_id) <= 2: if not html_machine_running == "true": output.append(html_machine_id) else: if int(html_machine_id) > washer_quantity: if not html_machine_running == "true": output.append(html_machine_id) return tuple(output)
43.074286
109
0.517777
795
7,538
4.649057
0.12327
0.160714
0.119589
0.060606
0.802489
0.756223
0.749729
0.722403
0.691017
0.691017
0
0.012424
0.39135
7,538
174
110
43.321839
0.793156
0.058769
0
0.687075
0
0
0.119178
0
0
0
0
0
0
1
0.040816
false
0
0.013605
0
0.095238
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
4275310cd2942ab0d1b6d5ed5a632e38feecbd52
45
py
Python
tests/__init__.py
sandervandorsten/chinook_fastapi
9dc6f4e02acedf62ae0d146114135012ec96db33
[ "MIT" ]
null
null
null
tests/__init__.py
sandervandorsten/chinook_fastapi
9dc6f4e02acedf62ae0d146114135012ec96db33
[ "MIT" ]
67
2020-07-23T22:34:02.000Z
2021-06-26T20:38:47.000Z
tests/__init__.py
sandervandorsten/chinook_fastapi
9dc6f4e02acedf62ae0d146114135012ec96db33
[ "MIT" ]
null
null
null
"""Unit test package for chinook_fastapi."""
22.5
44
0.733333
6
45
5.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
45
1
45
45
0.8
0.844444
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
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
427d7eb40d4e420f921bb560f104972050349e72
913
py
Python
config.py
kamilors/Gomob
08f84c3f1fd575a7b8308cc82b10c22986979a43
[ "MIT" ]
21
2016-11-02T17:32:18.000Z
2019-04-04T08:46:33.000Z
config.py
kamilors/Gomob
08f84c3f1fd575a7b8308cc82b10c22986979a43
[ "MIT" ]
1
2017-07-28T08:39:32.000Z
2017-07-28T08:39:32.000Z
config.py
kamilors/Gomob
08f84c3f1fd575a7b8308cc82b10c22986979a43
[ "MIT" ]
4
2016-12-29T11:30:32.000Z
2020-11-20T14:58:10.000Z
def can_build(plat): return plat == "iphone" def configure(env): #env.disable_module() if env['platform'] == "iphone": env.Append(FRAMEWORKPATH=['modules/gomob/ios/lib']) env.Append(LINKFLAGS=['-ObjC', '-framework','AdSupport', '-framework','AudioToolbox', '-framework','AVFoundation', '-framework','CoreGraphics', '-framework','CoreMedia', '-framework','CoreTelephony', '-framework','EventKit', '-framework','EventKitUI', '-framework','MediaPlayer', '-framework','MessageUI', '-framework','StoreKit', '-framework','SystemConfiguration', '-framework','SafariServices', '-framework','CoreBluetooth', '-framework','CoreMotion', '-framework','AssetsLibrary', '-framework','CoreData', '-framework','CoreLocation', '-framework','CoreText', '-framework','ImageIO', '-framework','OpenGLES', '-framework', 'GLKit', '-framework','CoreVideo', '-framework', 'MobileCoreServices', '-framework', 'GoogleMobileAds'])
91.3
733
0.703176
78
913
8.205128
0.589744
0.028125
0
0
0
0
0
0
0
0
0
0
0.05805
913
9
734
101.444444
0.744186
0.021906
0
0
0
0
0.636771
0.023543
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
4287cee03237cdb9dbc75d8124707426bf6d2c4c
142
py
Python
moto/datapipeline/__init__.py
symroe/moto
4e106995af6f2820273528fca8a4e9ee288690a5
[ "Apache-2.0" ]
null
null
null
moto/datapipeline/__init__.py
symroe/moto
4e106995af6f2820273528fca8a4e9ee288690a5
[ "Apache-2.0" ]
1
2022-02-19T02:10:45.000Z
2022-02-19T02:15:52.000Z
moto/datapipeline/__init__.py
symroe/moto
4e106995af6f2820273528fca8a4e9ee288690a5
[ "Apache-2.0" ]
null
null
null
from .models import datapipeline_backends from ..core.models import base_decorator mock_datapipeline = base_decorator(datapipeline_backends)
28.4
57
0.866197
17
142
6.941176
0.529412
0.20339
0
0
0
0
0
0
0
0
0
0
0.084507
142
4
58
35.5
0.907692
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
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
1
0
0
5
429ac3401c6b54ae174a448e181c167e4ad2f706
2,543
py
Python
tests/base/model_test_epoch_ends.py
JackCaster/pytorch-lightning
c94c0a2b1ee6b444ab1ecf58059e922229d44436
[ "Apache-2.0" ]
3
2021-04-09T21:24:32.000Z
2021-04-12T13:09:38.000Z
tests/base/model_test_epoch_ends.py
JackCaster/pytorch-lightning
c94c0a2b1ee6b444ab1ecf58059e922229d44436
[ "Apache-2.0" ]
8
2021-01-15T13:15:09.000Z
2021-04-04T19:52:25.000Z
tests/base/model_test_epoch_ends.py
JackCaster/pytorch-lightning
c94c0a2b1ee6b444ab1ecf58059e922229d44436
[ "Apache-2.0" ]
1
2020-10-19T03:52:27.000Z
2020-10-19T03:52:27.000Z
from abc import ABC import torch class TestEpochEndVariations(ABC): def test_epoch_end(self, outputs): """ Called at the end of test epoch to aggregate outputs :param outputs: list of individual outputs of each validation step :return: """ # if returned a scalar from test_step, outputs is a list of tensor scalars # we return just the average in this case (if we want) # return torch.stack(outputs).mean() test_loss_mean = 0 test_acc_mean = 0 for output in outputs: test_loss = self.get_output_metric(output, 'test_loss') # reduce manually when using dp if self.trainer.use_dp: test_loss = torch.mean(test_loss) test_loss_mean += test_loss # reduce manually when using dp test_acc = self.get_output_metric(output, 'test_acc') if self.trainer.use_dp: test_acc = torch.mean(test_acc) test_acc_mean += test_acc test_loss_mean /= len(outputs) test_acc_mean /= len(outputs) metrics_dict = {'test_loss': test_loss_mean, 'test_acc': test_acc_mean} result = {'progress_bar': metrics_dict, 'log': metrics_dict} return result def test_epoch_end__multiple_dataloaders(self, outputs): """ Called at the end of test epoch to aggregate outputs :param outputs: list of individual outputs of each validation step :return: """ # if returned a scalar from test_step, outputs is a list of tensor scalars # we return just the average in this case (if we want) # return torch.stack(outputs).mean() test_loss_mean = 0 test_acc_mean = 0 i = 0 for dl_output in outputs: for output in dl_output: test_loss = output['test_loss'] # reduce manually when using dp if self.trainer.use_dp: test_loss = torch.mean(test_loss) test_loss_mean += test_loss # reduce manually when using dp test_acc = output['test_acc'] if self.trainer.use_dp: test_acc = torch.mean(test_acc) test_acc_mean += test_acc i += 1 test_loss_mean /= i test_acc_mean /= i tqdm_dict = {'test_loss': test_loss_mean, 'test_acc': test_acc_mean} result = {'progress_bar': tqdm_dict} return result
33.460526
82
0.589461
330
2,543
4.293939
0.206061
0.112915
0.067749
0.052929
0.774877
0.774877
0.748059
0.748059
0.748059
0.748059
0
0.00358
0.340936
2,543
75
83
33.906667
0.841885
0.275265
0
0.45
0
0
0.054131
0
0
0
0
0
0
1
0.05
false
0
0.05
0
0.175
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
c4110ef5d6d62dbbf5244c2fb05c251d9576ea83
695
py
Python
lib/cryptopy/cipher/test_all_ciphers.py
Twilight0/script.module.streamlink.crypto
a5e4542aee5cd3ff08673e946b02cc629bc5368e
[ "MIT" ]
null
null
null
lib/cryptopy/cipher/test_all_ciphers.py
Twilight0/script.module.streamlink.crypto
a5e4542aee5cd3ff08673e946b02cc629bc5368e
[ "MIT" ]
null
null
null
lib/cryptopy/cipher/test_all_ciphers.py
Twilight0/script.module.streamlink.crypto
a5e4542aee5cd3ff08673e946b02cc629bc5368e
[ "MIT" ]
1
2019-08-31T11:29:00.000Z
2019-08-31T11:29:00.000Z
#! /usr/bin/env python """ cryptopy.cipher.test_all_ciphers All unit tests in the cipher package Copyright (c) 2002 by Paul A. Lambert Read LICENSE.txt for license information. """ import unittest import cryptopy.cipher.aes_cbc_test import cryptopy.cipher.aes_test import cryptopy.cipher.arc4_test import cryptopy.cipher.cbc_test import cryptopy.cipher.ccm_test import cryptopy.cipher.icedoll_test import cryptopy.cipher.rijndael_test import cryptopy.cipher.tkip_encr_test import cryptopy.cipher.tkip_fake_crc_test import cryptopy.cipher.wep_test # Make this test module runnable from the command prompt if __name__ == "__main__": unittest.main()
25.740741
57
0.774101
99
695
5.191919
0.494949
0.299611
0.389105
0.420233
0.214008
0
0
0
0
0
0
0.008547
0.158273
695
26
58
26.730769
0.870085
0.328058
0
0
0
0
0.019185
0
0
0
0
0
0
1
0
true
0
0.846154
0
0.846154
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
c4114a81b090b4d91ab1db646c92146aaca1927c
17,093
py
Python
awx/main/tests/functional/test_rbac_api.py
gitEdouble/awx
5885654405ccaf465f08df4db998a6dafebd9b4d
[ "Apache-2.0" ]
1
2018-09-28T16:02:30.000Z
2018-09-28T16:02:30.000Z
awx/main/tests/functional/test_rbac_api.py
gitEdouble/awx
5885654405ccaf465f08df4db998a6dafebd9b4d
[ "Apache-2.0" ]
1
2020-04-09T08:43:28.000Z
2020-04-09T08:43:28.000Z
awx/main/tests/functional/test_rbac_api.py
gitEdouble/awx
5885654405ccaf465f08df4db998a6dafebd9b4d
[ "Apache-2.0" ]
2
2018-09-03T19:10:02.000Z
2019-06-12T07:07:16.000Z
import mock # noqa import pytest from django.db import transaction from awx.api.versioning import reverse from awx.main.models.rbac import Role, ROLE_SINGLETON_SYSTEM_ADMINISTRATOR def mock_feature_enabled(feature): return True #@mock.patch('awx.api.views.feature_enabled', new=mock_feature_enabled) @pytest.fixture def role(): return Role.objects.create(role_field='admin_role') # # /roles # @pytest.mark.django_db def test_get_roles_list_admin(organization, get, admin): 'Admin can see list of all roles' url = reverse('api:role_list') response = get(url, admin) assert response.status_code == 200 roles = response.data assert roles['count'] > 0 @pytest.mark.django_db def test_get_roles_list_user(organization, inventory, team, get, user): 'Users can see all roles they have access to, but not all roles' this_user = user('user-test_get_roles_list_user') organization.member_role.members.add(this_user) custom_role = Role.objects.create(role_field='custom_role-test_get_roles_list_user') organization.member_role.children.add(custom_role) url = reverse('api:role_list') response = get(url, this_user) assert response.status_code == 200 roles = response.data assert roles['count'] > 0 assert roles['count'] == len(roles['results']) # just to make sure the tests below are valid role_hash = {} for r in roles['results']: role_hash[r['id']] = r assert Role.singleton(ROLE_SINGLETON_SYSTEM_ADMINISTRATOR).id in role_hash assert organization.admin_role.id in role_hash assert organization.member_role.id in role_hash assert custom_role.id in role_hash assert inventory.admin_role.id not in role_hash assert team.member_role.id not in role_hash @pytest.mark.django_db def test_roles_visibility(get, organization, project, admin, alice, bob): Role.singleton('system_auditor').members.add(alice) assert get(reverse('api:role_list') + '?id=%d' % project.update_role.id, user=admin).data['count'] == 1 assert get(reverse('api:role_list') + '?id=%d' % project.update_role.id, user=alice).data['count'] == 1 assert get(reverse('api:role_list') + '?id=%d' % project.update_role.id, user=bob).data['count'] == 0 organization.auditor_role.members.add(bob) assert get(reverse('api:role_list') + '?id=%d' % project.update_role.id, user=bob).data['count'] == 1 @pytest.mark.django_db def test_roles_filter_visibility(get, organization, project, admin, alice, bob): Role.singleton('system_auditor').members.add(alice) project.update_role.members.add(admin) assert get(reverse('api:user_roles_list', kwargs={'pk': admin.id}) + '?id=%d' % project.update_role.id, user=admin).data['count'] == 1 assert get(reverse('api:user_roles_list', kwargs={'pk': admin.id}) + '?id=%d' % project.update_role.id, user=alice).data['count'] == 1 assert get(reverse('api:user_roles_list', kwargs={'pk': admin.id}) + '?id=%d' % project.update_role.id, user=bob).data['count'] == 0 organization.auditor_role.members.add(bob) assert get(reverse('api:user_roles_list', kwargs={'pk': admin.id}) + '?id=%d' % project.update_role.id, user=bob).data['count'] == 1 organization.auditor_role.members.remove(bob) project.use_role.members.add(bob) # sibling role should still grant visibility assert get(reverse('api:user_roles_list', kwargs={'pk': admin.id}) + '?id=%d' % project.update_role.id, user=bob).data['count'] == 1 @pytest.mark.django_db def test_cant_create_role(post, admin): "Ensure we can't create new roles through the api" # Some day we might want to do this, but until that is speced out, lets # ensure we don't slip up and allow this implicitly through some helper or # another response = post(reverse('api:role_list'), {'name': 'New Role'}, admin) assert response.status_code == 405 @pytest.mark.django_db def test_cant_delete_role(delete, admin, inventory): "Ensure we can't delete roles through the api" # Some day we might want to do this, but until that is speced out, lets # ensure we don't slip up and allow this implicitly through some helper or # another response = delete(reverse('api:role_detail', kwargs={'pk': inventory.admin_role.id}), admin) assert response.status_code == 405 # # /user/<id>/roles # @pytest.mark.django_db def test_get_user_roles_list(get, admin): url = reverse('api:user_roles_list', kwargs={'pk': admin.id}) response = get(url, admin) assert response.status_code == 200 roles = response.data assert roles['count'] > 0 # 'system_administrator' role if nothing else @pytest.mark.django_db def test_user_view_other_user_roles(organization, inventory, team, get, alice, bob): 'Users can see roles for other users, but only the roles that that user has access to see as well' organization.member_role.members.add(alice) organization.admin_role.members.add(bob) organization.member_role.members.add(bob) custom_role = Role.objects.create(role_field='custom_role-test_user_view_admin_roles_list') organization.member_role.children.add(custom_role) team.member_role.members.add(bob) # alice and bob are in the same org and can see some child role of that org. # Bob is an org admin, alice can see this. # Bob is in a team that alice is not, alice cannot see that bob is a member of that team. url = reverse('api:user_roles_list', kwargs={'pk': bob.id}) response = get(url, alice) assert response.status_code == 200 roles = response.data assert roles['count'] > 0 assert roles['count'] == len(roles['results']) # just to make sure the tests below are valid role_hash = {} for r in roles['results']: role_hash[r['id']] = r['name'] assert organization.admin_role.id in role_hash assert custom_role.id not in role_hash # doesn't show up in the user roles list, not an explicit grant assert Role.singleton(ROLE_SINGLETON_SYSTEM_ADMINISTRATOR).id not in role_hash assert inventory.admin_role.id not in role_hash assert team.member_role.id not in role_hash # alice can't see this # again but this time alice is part of the team, and should be able to see the team role team.member_role.members.add(alice) response = get(url, alice) assert response.status_code == 200 roles = response.data assert roles['count'] > 0 assert roles['count'] == len(roles['results']) # just to make sure the tests below are valid role_hash = {} for r in roles['results']: role_hash[r['id']] = r['name'] assert team.member_role.id in role_hash # Alice can now see this @pytest.mark.django_db def test_add_role_to_user(role, post, admin): assert admin.roles.filter(id=role.id).count() == 0 url = reverse('api:user_roles_list', kwargs={'pk': admin.id}) response = post(url, {'id': role.id}, admin) assert response.status_code == 204 assert admin.roles.filter(id=role.id).count() == 1 response = post(url, {'id': role.id}, admin) assert response.status_code == 204 assert admin.roles.filter(id=role.id).count() == 1 response = post(url, {}, admin) assert response.status_code == 400 assert admin.roles.filter(id=role.id).count() == 1 @pytest.mark.django_db def test_remove_role_from_user(role, post, admin): assert admin.roles.filter(id=role.id).count() == 0 url = reverse('api:user_roles_list', kwargs={'pk': admin.id}) response = post(url, {'id': role.id}, admin) assert response.status_code == 204 assert admin.roles.filter(id=role.id).count() == 1 response = post(url, {'disassociate': role.id, 'id': role.id}, admin) assert response.status_code == 204 assert admin.roles.filter(id=role.id).count() == 0 # # /team/<id>/roles # @pytest.mark.django_db def test_get_teams_roles_list(get, team, organization, admin): team.member_role.children.add(organization.admin_role) url = reverse('api:team_roles_list', kwargs={'pk': team.id}) response = get(url, admin) assert response.status_code == 200 roles = response.data assert roles['count'] == 1 assert roles['results'][0]['id'] == organization.admin_role.id or roles['results'][1]['id'] == organization.admin_role.id @pytest.mark.django_db def test_add_role_to_teams(team, post, admin): assert team.member_role.children.filter(id=team.member_role.id).count() == 0 url = reverse('api:team_roles_list', kwargs={'pk': team.id}) response = post(url, {'id': team.member_role.id}, admin) assert response.status_code == 204 assert team.member_role.children.filter(id=team.member_role.id).count() == 1 response = post(url, {'id': team.member_role.id}, admin) assert response.status_code == 204 assert team.member_role.children.filter(id=team.member_role.id).count() == 1 response = post(url, {}, admin) assert response.status_code == 400 assert team.member_role.children.filter(id=team.member_role.id).count() == 1 @pytest.mark.django_db def test_remove_role_from_teams(team, post, admin): assert team.member_role.children.filter(id=team.member_role.id).count() == 0 url = reverse('api:team_roles_list', kwargs={'pk': team.id}) response = post(url, {'id': team.member_role.id}, admin) assert response.status_code == 204 assert team.member_role.children.filter(id=team.member_role.id).count() == 1 response = post(url, {'disassociate': team.member_role.id, 'id': team.member_role.id}, admin) assert response.status_code == 204 assert team.member_role.children.filter(id=team.member_role.id).count() == 0 # # /roles/<id>/ # @pytest.mark.django_db def test_get_role(get, admin, role): url = reverse('api:role_detail', kwargs={'pk': role.id}) response = get(url, admin) assert response.status_code == 200 assert response.data['id'] == role.id @pytest.mark.django_db def test_put_role_405(put, admin, role): url = reverse('api:role_detail', kwargs={'pk': role.id}) response = put(url, {'name': 'Some new name'}, admin) assert response.status_code == 405 #r = Role.objects.get(id=role.id) #assert r.name == 'Some new name' @pytest.mark.django_db def test_put_role_access_denied(put, alice, role): url = reverse('api:role_detail', kwargs={'pk': role.id}) response = put(url, {'name': 'Some new name'}, alice) assert response.status_code == 403 or response.status_code == 405 # # /roles/<id>/users/ # @pytest.mark.django_db def test_get_role_users(get, admin, role): role.members.add(admin) url = reverse('api:role_users_list', kwargs={'pk': role.id}) response = get(url, admin) assert response.status_code == 200 assert response.data['count'] == 1 assert response.data['results'][0]['id'] == admin.id @pytest.mark.django_db def test_add_user_to_role(post, admin, role): url = reverse('api:role_users_list', kwargs={'pk': role.id}) assert role.members.filter(id=admin.id).count() == 0 post(url, {'id': admin.id}, admin) assert role.members.filter(id=admin.id).count() == 1 @pytest.mark.django_db def test_remove_user_to_role(post, admin, role): role.members.add(admin) url = reverse('api:role_users_list', kwargs={'pk': role.id}) assert role.members.filter(id=admin.id).count() == 1 post(url, {'disassociate': True, 'id': admin.id}, admin) assert role.members.filter(id=admin.id).count() == 0 @pytest.mark.django_db def test_org_admin_add_user_to_job_template(post, organization, check_jobtemplate, user): 'Tests that a user with permissions to assign/revoke membership to a particular role can do so' org_admin = user('org-admin') joe = user('joe') organization.admin_role.members.add(org_admin) assert org_admin in check_jobtemplate.admin_role assert joe not in check_jobtemplate.execute_role post(reverse('api:role_users_list', kwargs={'pk': check_jobtemplate.execute_role.id}), {'id': joe.id}, org_admin) assert joe in check_jobtemplate.execute_role @pytest.mark.django_db def test_org_admin_remove_user_from_job_template(post, organization, check_jobtemplate, user): 'Tests that a user with permissions to assign/revoke membership to a particular role can do so' org_admin = user('org-admin') joe = user('joe') organization.admin_role.members.add(org_admin) check_jobtemplate.execute_role.members.add(joe) assert org_admin in check_jobtemplate.admin_role assert joe in check_jobtemplate.execute_role post(reverse('api:role_users_list', kwargs={'pk': check_jobtemplate.execute_role.id}), {'disassociate': True, 'id': joe.id}, org_admin) assert joe not in check_jobtemplate.execute_role @pytest.mark.django_db def test_user_fail_to_add_user_to_job_template(post, organization, check_jobtemplate, user): 'Tests that a user without permissions to assign/revoke membership to a particular role cannot do so' rando = user('rando') joe = user('joe') assert rando not in check_jobtemplate.admin_role assert joe not in check_jobtemplate.execute_role with transaction.atomic(): res = post(reverse('api:role_users_list', kwargs={'pk': check_jobtemplate.execute_role.id}), {'id': joe.id}, rando) assert res.status_code == 403 assert joe not in check_jobtemplate.execute_role @pytest.mark.django_db def test_user_fail_to_remove_user_to_job_template(post, organization, check_jobtemplate, user): 'Tests that a user without permissions to assign/revoke membership to a particular role cannot do so' rando = user('rando') joe = user('joe') check_jobtemplate.execute_role.members.add(joe) assert rando not in check_jobtemplate.admin_role assert joe in check_jobtemplate.execute_role with transaction.atomic(): res = post(reverse('api:role_users_list', kwargs={'pk': check_jobtemplate.execute_role.id}), {'disassociate': True, 'id': joe.id}, rando) assert res.status_code == 403 assert joe in check_jobtemplate.execute_role # # /roles/<id>/teams/ # @pytest.mark.django_db def test_get_role_teams(get, team, admin, role): role.parents.add(team.member_role) url = reverse('api:role_teams_list', kwargs={'pk': role.id}) response = get(url, admin) assert response.status_code == 200 assert response.data['count'] == 1 assert response.data['results'][0]['id'] == team.id @pytest.mark.django_db def test_add_team_to_role(post, team, admin, role): url = reverse('api:role_teams_list', kwargs={'pk': role.id}) assert role.members.filter(id=admin.id).count() == 0 res = post(url, {'id': team.id}, admin) assert res.status_code == 204 assert role.parents.filter(id=team.member_role.id).count() == 1 @pytest.mark.django_db def test_remove_team_from_role(post, team, admin, role): role.members.add(admin) url = reverse('api:role_teams_list', kwargs={'pk': role.id}) assert role.members.filter(id=admin.id).count() == 1 res = post(url, {'disassociate': True, 'id': team.id}, admin) assert res.status_code == 204 assert role.parents.filter(id=team.member_role.id).count() == 0 # # /roles/<id>/parents/ # @pytest.mark.django_db def test_role_parents(get, team, admin, role): role.parents.add(team.member_role) url = reverse('api:role_parents_list', kwargs={'pk': role.id}) response = get(url, admin) assert response.status_code == 200 assert response.data['count'] == 1 assert response.data['results'][0]['id'] == team.member_role.id # # /roles/<id>/children/ # @pytest.mark.django_db def test_role_children(get, team, admin, role): role.parents.add(team.member_role) url = reverse('api:role_children_list', kwargs={'pk': team.member_role.id}) response = get(url, admin) assert response.status_code == 200 assert response.data['count'] == 2 assert response.data['results'][0]['id'] == role.id or response.data['results'][1]['id'] == role.id # # Generics # @pytest.mark.django_db def test_ensure_rbac_fields_are_present(organization, get, admin): url = reverse('api:organization_detail', kwargs={'pk': organization.id}) response = get(url, admin) assert response.status_code == 200 org = response.data assert 'summary_fields' in org assert 'object_roles' in org['summary_fields'] role_pk = org['summary_fields']['object_roles']['admin_role']['id'] role_url = reverse('api:role_detail', kwargs={'pk': role_pk}) org_role_response = get(role_url, admin) assert org_role_response.status_code == 200 role = org_role_response.data assert role['related']['organization'] == url @pytest.mark.django_db def test_ensure_role_summary_is_present(organization, get, user): url = reverse('api:organization_detail', kwargs={'pk': organization.id}) response = get(url, user('admin', True)) assert response.status_code == 200 org = response.data assert 'summary_fields' in org assert 'object_roles' in org['summary_fields'] assert org['summary_fields']['object_roles']['admin_role']['id'] > 0
36.368085
145
0.706488
2,576
17,093
4.515528
0.072205
0.036107
0.038514
0.046424
0.838549
0.808717
0.783012
0.751204
0.68836
0.653886
0
0.010476
0.156731
17,093
469
146
36.445629
0.796517
0.109694
0
0.646104
0
0.003247
0.138926
0.012435
0
0
0
0
0.363636
1
0.103896
false
0
0.016234
0.006494
0.126623
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
c41b1b6b365913aa72716a611f4b018cdd3081fb
3,885
py
Python
pysrc/verbosity.py
m0n0ph1/xed
d5d801e3413c9d792e2b2381235b4eaf823b3d22
[ "Apache-2.0" ]
1
2021-09-29T02:16:42.000Z
2021-09-29T02:16:42.000Z
pysrc/verbosity.py
m0n0ph1/xed
d5d801e3413c9d792e2b2381235b4eaf823b3d22
[ "Apache-2.0" ]
null
null
null
pysrc/verbosity.py
m0n0ph1/xed
d5d801e3413c9d792e2b2381235b4eaf823b3d22
[ "Apache-2.0" ]
2
2018-12-30T03:48:57.000Z
2021-03-25T22:57:54.000Z
#BEGIN_LEGAL # #Copyright (c) 2016 Intel 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. # #END_LEGAL _verbosity_options = [] def set_verbosity_options(options): global _verbosity_options _verbosity_options = options def vflag(): return 'flag' in _verbosity_options def vnext(): return 'next' in _verbosity_options def vrearrange(): return 'rearrange' in _verbosity_options def vmacro(): return 'macro' in _verbosity_options def vreadyscan(): return 'readyscan' in _verbosity_options def vbitgroup(): return 'bitgroup' in _verbosity_options def vextract(): return 'extract' in _verbosity_options def vstack(): return 'stack' in _verbosity_options def vgraph_res(): return 'graph_res' in _verbosity_options def varraygen(): return 'arraygen' in _verbosity_options def viform(): return 'iform' in _verbosity_options def viclass(): return 'iclass' in _verbosity_options def vattr(): return 'attribute' in _verbosity_options def vopnd(): return 'opnd' in _verbosity_options def vlookup(): return 'lookup' in _verbosity_options def vopvis(): return 'opvis' in _verbosity_options def vcapture(): return 'capture' in _verbosity_options def vcapture1(): return 'capture1' in _verbosity_options def vcapture2(): return 'capture2' in _verbosity_options def vcapturefunc(): return 'capture' in _verbosity_options def vbind(): return 'bind' in _verbosity_options def vod(): return 'od' in _verbosity_options def vtrace(): return 'trace' in _verbosity_options def vparse(): return 'parse' in _verbosity_options def vpart(): return 'partition' in _verbosity_options def vbuild(): return 'build' in _verbosity_options def vmerge(): return 'merge' in _verbosity_options def verb1(): return '1' in _verbosity_options def verb2(): return '2' in _verbosity_options def verb3(): return '3' in _verbosity_options def verb4(): return '4' in _verbosity_options def verb5(): return '5' in _verbosity_options def verb6(): return '6' in _verbosity_options def verb7(): return '7' in _verbosity_options def vencfunc(): return 'encfunc' in _verbosity_options def vencode(): return 'encode' in _verbosity_options def vntname(): return 'ntname' in _verbosity_options def vtestingcond(): return 'testingcond' in _verbosity_options def vclassify(): return 'classify' in _verbosity_options def veparse(): return 'eparse' in _verbosity_options def veemit(): return 'eemit' in _verbosity_options def vignoreod(): return 'ignoreod' in _verbosity_options def vtuples(): return 'tuples' in _verbosity_options def vdumpinput(): return 'dumpinput' in _verbosity_options def vfinalize(): return 'finalize' in _verbosity_options def vopseq(): return 'opseq' in _verbosity_options def voperand(): return 'operand' in _verbosity_options def voperand2(): return 'operand2' in _verbosity_options def vinputs(): return 'inputs' in _verbosity_options def vread(): return 'read' in _verbosity_options def vcapture(): return 'capture' in _verbosity_options def vrule(): return 'rule' in _verbosity_options def vaction(): return 'action' in _verbosity_options def vblot(): return 'blot' in _verbosity_options def vild(): return 'ild' in _verbosity_options def vfuncgen(): return 'funcgen' in _verbosity_options
27.75
75
0.744144
502
3,885
5.511952
0.36255
0.346946
0.384532
0.41742
0.057824
0.057824
0.045537
0.045537
0.045537
0.045537
0
0.008693
0.170914
3,885
139
76
27.94964
0.850357
0.151609
0
0.043103
0
0
0.096371
0
0
0
0
0
0
1
0.491379
false
0
0
0.482759
0.974138
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
c43067dc58a8149cb9bbf8bb24f0d72c06b51b21
536
py
Python
services/MainControl/main.py
calosliu/pythonBall
7f73e7d5c0d4bc91386da614674a99ecea140955
[ "MIT" ]
null
null
null
services/MainControl/main.py
calosliu/pythonBall
7f73e7d5c0d4bc91386da614674a99ecea140955
[ "MIT" ]
null
null
null
services/MainControl/main.py
calosliu/pythonBall
7f73e7d5c0d4bc91386da614674a99ecea140955
[ "MIT" ]
null
null
null
#!usr/bin/env python # -*- coding: UTF-8 -*- """ ------------------------------------------------- File Name: main Author: goldenman date: 2018/3/23 Description: ------------------------------------------------- Change Activity: 2018/3/23: main method entrance ------------------------------------------------- """ # do nothing yet def main(): # invoke Canvas() to create this init planet. pass if __name__ == '__main__': main()
20.615385
49
0.358209
42
536
4.380952
0.809524
0.086957
0.076087
0
0
0
0
0
0
0
0
0.039164
0.285448
536
25
50
21.44
0.441253
0.843284
0
0
0
0
0.109589
0
0
0
0
0
0
1
0.25
true
0.25
0
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
5
c438f605042ccdfaeca164c6c8e19b1b04c683cc
80
py
Python
tests/roots/test-ext-viewcode/spam/__init__.py
samdoran/sphinx
4c91c038b220d07bbdfe0c1680af42fe897f342c
[ "BSD-2-Clause" ]
4,973
2015-01-03T15:44:00.000Z
2022-03-31T03:11:51.000Z
tests/roots/test-ext-viewcode/spam/__init__.py
samdoran/sphinx
4c91c038b220d07bbdfe0c1680af42fe897f342c
[ "BSD-2-Clause" ]
7,850
2015-01-02T08:09:25.000Z
2022-03-31T18:57:40.000Z
tests/roots/test-ext-viewcode/spam/__init__.py
samdoran/sphinx
4c91c038b220d07bbdfe0c1680af42fe897f342c
[ "BSD-2-Clause" ]
2,179
2015-01-03T15:26:53.000Z
2022-03-31T12:22:44.000Z
from .mod1 import Class1, func1 # NOQA from .mod2 import Class2, func2 # NOQA
26.666667
39
0.725
12
80
4.833333
0.75
0
0
0
0
0
0
0
0
0
0
0.09375
0.2
80
2
40
40
0.8125
0.1125
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
1
0
0
5
c43c7364e035162c6932aebbfb59b2cd7148d381
196
py
Python
events/admin.py
wwangwe/Team-213-A-Back-End
0dcb22ec5ff28284f51bec34a7103c6939b81c51
[ "MIT" ]
null
null
null
events/admin.py
wwangwe/Team-213-A-Back-End
0dcb22ec5ff28284f51bec34a7103c6939b81c51
[ "MIT" ]
null
null
null
events/admin.py
wwangwe/Team-213-A-Back-End
0dcb22ec5ff28284f51bec34a7103c6939b81c51
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Event, Location, Category # Register your models here. admin.site.register(Event) admin.site.register(Location) admin.site.register(Category)
24.5
45
0.811224
27
196
5.888889
0.481481
0.169811
0.320755
0
0
0
0
0
0
0
0
0
0.096939
196
7
46
28
0.898305
0.132653
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.4
0
0.4
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
c47c422341c9a07134ac688bfe2bccb85707d551
267
py
Python
gpalu/constants.py
Obito1903/gpa.lu
45db1a53a0818b73485e6862e3ce18daefcc7f72
[ "MIT" ]
null
null
null
gpalu/constants.py
Obito1903/gpa.lu
45db1a53a0818b73485e6862e3ce18daefcc7f72
[ "MIT" ]
null
null
null
gpalu/constants.py
Obito1903/gpa.lu
45db1a53a0818b73485e6862e3ce18daefcc7f72
[ "MIT" ]
null
null
null
import re EMAILS_REGEX = re.compile( 'collapse-(\d{7}).*\n.*title="(.*)".*\n.*\n.*&lt;([\.\-\w]+@[\-\w]+\.[\.\w\-]+)&' ) GPALU_EMAIL_REGEX = re.compile('[a-zA-Z0-9\_\.\-]+@(les\.codes|gpa\.lu|yarien\.eu|saucent\.online)') BASE_URL = 'https://gpa.lu/'
26.7
101
0.513109
39
267
3.384615
0.74359
0.106061
0.212121
0
0
0
0
0
0
0
0
0.012605
0.108614
267
9
102
29.666667
0.542017
0
0
0
0
0.333333
0.620155
0.562016
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6700e605d88551e5392fabfb96f8d8a0337512f2
44
py
Python
server/swissvoice/config/__init__.py
DeepSwissVoice/SwissVoice
b99efff65112ee30fdfa089ef7b2755018290921
[ "MIT" ]
2
2018-02-17T13:04:19.000Z
2018-05-17T11:34:59.000Z
server/swissvoice/config/__init__.py
DeepSwissVoice/SwissVoice
b99efff65112ee30fdfa089ef7b2755018290921
[ "MIT" ]
14
2018-06-15T14:47:39.000Z
2018-09-07T08:18:32.000Z
server/swissvoice/config/__init__.py
DeepSwissVoice/SwissVoice
b99efff65112ee30fdfa089ef7b2755018290921
[ "MIT" ]
1
2018-06-12T16:01:30.000Z
2018-06-12T16:01:30.000Z
from . import default, logging, environment
22
43
0.795455
5
44
7
1
0
0
0
0
0
0
0
0
0
0
0
0.136364
44
1
44
44
0.921053
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
673d8667ac85de2697bb9c361d07294d290641ac
87
py
Python
Python/_05_Math/_04_Mod_Divmod/solution.py
avtomato/HackerRank
96f9cf770ac57d782bb05cccc23764a529bb27ae
[ "MIT" ]
null
null
null
Python/_05_Math/_04_Mod_Divmod/solution.py
avtomato/HackerRank
96f9cf770ac57d782bb05cccc23764a529bb27ae
[ "MIT" ]
null
null
null
Python/_05_Math/_04_Mod_Divmod/solution.py
avtomato/HackerRank
96f9cf770ac57d782bb05cccc23764a529bb27ae
[ "MIT" ]
2
2019-09-21T16:04:13.000Z
2020-03-25T09:07:47.000Z
a = int(input()) b = int(input()) [print(i) for i in divmod(a, b)] print(divmod(a, b))
17.4
32
0.586207
18
87
2.833333
0.5
0.313725
0.313725
0
0
0
0
0
0
0
0
0
0.16092
87
4
33
21.75
0.69863
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
1
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
1
0
5
675365de0b35801f7b5b0e68e9fb96c9dfd86e5f
46,677
py
Python
testsSDW__copy/card_tests/druid_tests.py
jomyhuang/sdwle
9b6e916567e09c7cba4a171fe0adf0f47009a8c3
[ "MIT" ]
null
null
null
testsSDW__copy/card_tests/druid_tests.py
jomyhuang/sdwle
9b6e916567e09c7cba4a171fe0adf0f47009a8c3
[ "MIT" ]
null
null
null
testsSDW__copy/card_tests/druid_tests.py
jomyhuang/sdwle
9b6e916567e09c7cba4a171fe0adf0f47009a8c3
[ "MIT" ]
null
null
null
import random import unittest from SDWLE.agents.basic_agents import DoNothingAgent from SDWLE.cards.base import SpellCard from SDWLE.engine import Game from SDWLE.tags.card_source import CollectionSource from SDWLE.tags.condition import HasCardName from testsSDW.agents.testing_agents import SelfSpellTestingAgent, EnemySpellTestingAgent, OneCardPlayingAgent, \ EnemyMinionSpellTestingAgent, CardTestingAgent, PlayAndAttackAgent from SDWLE.constants import CHARACTER_CLASS, MINION_TYPE, CARD_RARITY from SDWLE.replay import playback, Replay from testsSDW.testing_utils import generate_game_for, StackedDeck, mock from SDWLE.cards import * class TestDruid(unittest.TestCase): def setUp(self): random.seed(1857) def test_Innervate(self): game = generate_game_for(Innervate, StonetuskBoar, SelfSpellTestingAgent, DoNothingAgent) # triggers all four innervate cards the player is holding. game.play_single_turn() self.assertEqual(9, game.current_player.mana) for turn in range(0, 16): game.play_single_turn() # The mana should not go over 10 on turn 9 (or any other turn) self.assertEqual(10, game.current_player.mana) def test_Claw(self): testing_env = self class ClawAgent(EnemySpellTestingAgent): def do_turn(self, player): super().do_turn(player) testing_env.assertEqual(2, game.current_player.hero.calculate_attack()) testing_env.assertEqual(2, game.current_player.hero.armor) game = generate_game_for(Claw, StonetuskBoar, ClawAgent, OneCardPlayingAgent) game.pre_game() game.play_single_turn() def test_Naturalize(self): game = generate_game_for(StonetuskBoar, Naturalize, OneCardPlayingAgent, EnemyMinionSpellTestingAgent) game.play_single_turn() game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) self.assertEqual(5, len(game.other_player.hand)) def test_Savagery(self): class SavageryAgent(EnemyMinionSpellTestingAgent): def do_turn(self, player): if player.mana > 2: player.hero.power.use() super().do_turn(player) game = generate_game_for(Savagery, BloodfenRaptor, SavageryAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.other_player.minions)) self.assertEqual(1, game.other_player.minions[0].health) def test_ClawAndSavagery(self): game = generate_game_for(BloodfenRaptor, [Claw, Claw, Savagery], OneCardPlayingAgent, EnemyMinionSpellTestingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) def test_MarkOfTheWild(self): game = generate_game_for(MarkOfTheWild, StonetuskBoar, EnemyMinionSpellTestingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(3, game.other_player.minions[0].calculate_attack()) self.assertEqual(3, game.other_player.minions[0].health) self.assertEqual(3, game.other_player.minions[0].calculate_max_health()) # Test that this spell is being silenced properly as well game.other_player.minions[0].silence() self.assertEqual(1, game.other_player.minions[0].calculate_attack()) self.assertEqual(1, game.other_player.minions[0].health) self.assertEqual(1, game.other_player.minions[0].calculate_max_health()) def test_PowerOfTheWild(self): deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), PowerOfTheWild()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE) # This is a test of the +1/+1 option of the Power Of the Wild Card game = Game([deck1, deck2], [OneCardPlayingAgent(), OneCardPlayingAgent()]) game.current_player = game.players[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(2, game.current_player.minions[0].calculate_attack()) self.assertEqual(2, game.current_player.minions[0].health) self.assertEqual(2, game.current_player.minions[0].calculate_max_health()) self.assertEqual(2, game.current_player.minions[1].calculate_attack()) self.assertEqual(2, game.current_player.minions[1].calculate_max_health()) # This is a test of the "Summon Panther" option of the Power of the Wild Card agent = OneCardPlayingAgent() agent.choose_option = lambda options, player: options[1] deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), PowerOfTheWild()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE) game = Game([deck1, deck2], [agent, OneCardPlayingAgent()]) game.current_player = game.players[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual("Panther", game.current_player.minions[2].card.__class__.__name__) self.assertEqual(3, game.current_player.minions[2].calculate_attack()) self.assertEqual(2, game.current_player.minions[2].calculate_max_health()) def test_WildGrowth(self): game = generate_game_for(WildGrowth, StonetuskBoar, SelfSpellTestingAgent, DoNothingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(3, game.current_player.max_mana) # Make sure that the case where the player is at 10 mana works as well. for turn in range(0, 5): game.play_single_turn() self.assertEqual(10, game.other_player.max_mana) card_draw_mock = mock.Mock(side_effect=game.other_player.draw) game.other_player.draw = card_draw_mock game.play_single_turn() # Each time the player draws, they will draw another wild growth, which will turn into excess mana, # which will draw another card. However, because of the ordering of the cards, the last excess mana # will be after a wild growth, which prevents SpellTestingAgent from playing the card, so only # 5 draws are made instead of the possible 6 self.assertEqual(5, card_draw_mock.call_count) def test_Wrath(self): game = generate_game_for(Wrath, StonetuskBoar, EnemyMinionSpellTestingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) self.assertEqual(5, len(game.current_player.hand)) random.seed(1857) game = generate_game_for(Wrath, MogushanWarden, EnemyMinionSpellTestingAgent, OneCardPlayingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] for turn in range(0, 8): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(1, len(game.other_player.minions)) # Two wraths will have been played self.assertEqual(1, game.other_player.minions[0].health) def test_HealingTouch(self): game = generate_game_for(HealingTouch, StonetuskBoar, SelfSpellTestingAgent, DoNothingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.other_player.hero.health = 20 game.play_single_turn() self.assertEqual(28, game.current_player.hero.health) game.play_single_turn() game.play_single_turn() self.assertEqual(30, game.current_player.hero.health) def test_MarkOfNature(self): deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), MarkOfNature()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE) game = Game([deck1, deck2], [OneCardPlayingAgent(), OneCardPlayingAgent()]) game.current_player = 1 game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(5, game.other_player.minions[0].calculate_attack()) deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), MarkOfNature()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE) agent = OneCardPlayingAgent() agent.choose_option = lambda options, player: options[1] game = Game([deck1, deck2], [agent, OneCardPlayingAgent()]) game.current_player = 1 game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(5, game.other_player.minions[0].calculate_max_health()) self.assertEqual(5, game.other_player.minions[0].health) self.assertTrue(game.other_player.minions[0].taunt) def test_SavageRoar(self): deck1 = StackedDeck([StonetuskBoar(), StonetuskBoar(), SavageRoar()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.MAGE) game = Game([deck1, deck2], [OneCardPlayingAgent(), OneCardPlayingAgent()]) game.current_player = 1 game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() minion_increase_mock = mock.Mock() game.other_player.minions[0].bind("attack_changed", minion_increase_mock) game.other_player.minions[1].bind("attack_changed", minion_increase_mock) player_increase_mock = mock.Mock() game.other_player.hero.bind("attack_changed", player_increase_mock) game.play_single_turn() self.assertEqual(0, game.current_player.mana) # Make sure the attack got increased self.assertListEqual([mock.call(2), mock.call(2)], minion_increase_mock.call_args_list) self.assertListEqual([mock.call(2)], player_increase_mock.call_args_list) # And make sure that it went down again self.assertEqual(1, game.current_player.minions[0].calculate_attack()) self.assertEqual(1, game.current_player.minions[1].calculate_attack()) self.assertEqual(0, game.current_player.hero.calculate_attack()) def test_Bite(self): testing_env = self class BiteAgent(EnemySpellTestingAgent): def do_turn(self, player): super().do_turn(player) if player.mana == 0: testing_env.assertEqual(4, game.current_player.hero.calculate_attack()) testing_env.assertEqual(4, game.current_player.hero.armor) game = generate_game_for(Bite, StonetuskBoar, BiteAgent, DoNothingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() def test_SoulOfTheForest(self): game = playback(Replay("testsSDW/replays/card_tests/SoulOfTheForest.hsreplay")) game.start() self.assertEqual(2, len(game.other_player.minions)) self.assertEqual(2, game.other_player.minions[0].calculate_attack()) self.assertEqual(2, game.other_player.minions[0].health) self.assertEqual("Treant", game.other_player.minions[0].card.name) def test_Swipe(self): deck1 = StackedDeck([BloodfenRaptor(), StonetuskBoar(), StonetuskBoar()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([Swipe()], CHARACTER_CLASS.DRUID, ) game = Game([deck1, deck2], [OneCardPlayingAgent(), EnemyMinionSpellTestingAgent()]) game.pre_game() game.current_player = game.players[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() # The bloodfen raptor should be left, with one hp self.assertEqual(1, len(game.other_player.minions)) self.assertEqual(1, game.other_player.minions[0].health) self.assertEqual(29, game.other_player.hero.health) def test_KeeperOfTheGrove(self): # Test Moonfire option game = generate_game_for(KeeperOfTheGrove, StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(3, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(2, len(game.other_player.minions)) # Test Dispel option random.seed(1857) game = generate_game_for(KeeperOfTheGrove, StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertTrue(game.current_player.minions[0].charge()) game.play_single_turn() self.assertFalse(game.other_player.minions[0].charge()) # Test when there are no targets for the spell random.seed(1857) game = generate_game_for(KeeperOfTheGrove, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual("Keeper of the Grove", game.current_player.minions[0].card.name) def test_Moonfire(self): game = generate_game_for(Moonfire, StonetuskBoar, EnemySpellTestingAgent, OneCardPlayingAgent) game.play_single_turn() self.assertEqual(26, game.other_player.hero.health) def test_DruidOfTheClaw(self): game = generate_game_for(DruidOfTheClaw, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) for turn in range(0, 9): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(4, game.current_player.minions[0].calculate_attack()) self.assertEqual(4, game.current_player.minions[0].calculate_max_health()) self.assertTrue(game.current_player.minions[0].charge()) self.assertFalse(game.current_player.minions[0].taunt) test_bear = game.current_player.minions[0].card.create_minion(None) test_bear.player = game.current_player self.assertEqual(4, test_bear.calculate_attack()) self.assertEqual(4, test_bear.calculate_max_health()) game.current_player.agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.current_player.minions)) self.assertEqual(4, game.current_player.minions[0].calculate_attack()) self.assertEqual(6, game.current_player.minions[0].calculate_max_health()) self.assertFalse(game.current_player.minions[0].charge()) self.assertTrue(game.current_player.minions[0].taunt) test_bear = game.current_player.minions[0].card.create_minion(None) test_bear.player = game.current_player self.assertEqual(4, test_bear.calculate_attack()) self.assertEqual(6, test_bear.calculate_max_health()) def test_Nourish(self): # Test gaining two mana game = generate_game_for(Nourish, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(7, game.current_player.max_mana) self.assertEqual(7, len(game.current_player.hand)) # Ensure that the case where we would be over 10 mana is handled correctly game.play_single_turn() game.play_single_turn() # Nourish is played. it brings the player to 10 self.assertEqual(10, game.current_player.max_mana) self.assertEqual(5, game.current_player.mana) game.play_single_turn() game.play_single_turn() # Nourish is played. It doesn't affect the max_mana, but it does fill in two crystals. # Tested on patch 2.1.0.7785 self.assertEqual(10, game.current_player.max_mana) self.assertEqual(7, game.current_player.mana) # Test drawing three cards random.seed(1857) game = generate_game_for(Nourish, StonetuskBoar, CardTestingAgent, DoNothingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(10, len(game.current_player.hand)) self.assertEqual(5, game.current_player.max_mana) def test_Starfall(self): # Test damage to all game = generate_game_for(Starfall, StonetuskBoar, CardTestingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(4, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) self.assertEqual(30, game.other_player.hero.health) # Test damage to one random.seed(1857) game = generate_game_for(Starfall, MogushanWarden, CardTestingAgent, OneCardPlayingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.other_player.minions)) self.assertEqual(2, game.other_player.minions[0].health) self.assertEqual(30, game.other_player.hero.health) def test_ForceOfNature(self): game = generate_game_for(ForceOfNature, StonetuskBoar, CardTestingAgent, DoNothingAgent) for turn in range(0, 10): game.play_single_turn() def check_minions(): self.assertEqual(6, len(game.current_player.minions)) for minion in game.current_player.minions: self.assertEqual(2, minion.calculate_attack()) self.assertEqual(2, minion.health) self.assertEqual(2, minion.calculate_max_health()) self.assertEqual("Treant", minion.card.name) game.other_player.bind_once("turn_ended", check_minions) game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) def test_Starfire(self): game = generate_game_for(Starfire, MogushanWarden, EnemyMinionSpellTestingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(2, len(game.other_player.minions)) self.assertEqual(2, game.other_player.minions[0].health) self.assertEqual(7, game.other_player.minions[1].health) self.assertEqual(9, len(game.current_player.hand)) def test_AncientOfLore(self): game = generate_game_for(AncientOfLore, Starfire, OneCardPlayingAgent, EnemySpellTestingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(game.other_player.hero.health, 25) game.play_single_turn() self.assertEqual(30, game.current_player.hero.health) self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[0].health) self.assertEqual(5, game.current_player.minions[0].calculate_attack()) self.assertEqual("Ancient of Lore", game.current_player.minions[0].card.name) random.seed(1857) game = generate_game_for(AncientOfLore, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(10, len(game.current_player.hand)) self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[0].health) self.assertEqual(5, game.current_player.minions[0].calculate_attack()) self.assertEqual("Ancient of Lore", game.current_player.minions[0].card.name) def test_AncientOfWar(self): game = generate_game_for(AncientOfWar, IronbeakOwl, OneCardPlayingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[0].calculate_attack()) self.assertEqual(10, game.current_player.minions[0].health) self.assertEqual(10, game.current_player.minions[0].calculate_max_health()) self.assertTrue(game.current_player.minions[0].taunt) self.assertEqual("Ancient of War", game.current_player.minions[0].card.name) self.assertEqual(5, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(6, len(game.current_player.minions)) self.assertEqual(5, game.other_player.minions[0].health) self.assertEqual(5, game.other_player.minions[0].calculate_max_health()) self.assertFalse(game.other_player.minions[0].taunt) random.seed(1857) game = generate_game_for(AncientOfWar, IronbeakOwl, OneCardPlayingAgent, OneCardPlayingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(10, game.current_player.minions[0].calculate_attack()) self.assertEqual(5, game.current_player.minions[0].health) self.assertEqual(5, game.current_player.minions[0].calculate_max_health()) self.assertFalse(game.current_player.minions[0].taunt) self.assertEqual("Ancient of War", game.current_player.minions[0].card.name) self.assertEqual(5, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(6, len(game.current_player.minions)) self.assertEqual(5, game.other_player.minions[0].health) self.assertEqual(5, game.other_player.minions[0].calculate_max_health()) self.assertEqual(5, game.other_player.minions[0].calculate_attack()) self.assertFalse(game.other_player.minions[0].taunt) def test_IronbarkProtector(self): game = generate_game_for(IronbarkProtector, IronbeakOwl, OneCardPlayingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(8, game.current_player.minions[0].calculate_attack()) self.assertEqual(8, game.current_player.minions[0].health) self.assertEqual(8, game.current_player.minions[0].calculate_max_health()) self.assertTrue(game.current_player.minions[0].taunt) self.assertEqual("Ironbark Protector", game.current_player.minions[0].card.name) self.assertEqual(6, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(7, len(game.current_player.minions)) self.assertFalse(game.other_player.minions[0].taunt) def test_Cenarius(self): deck1 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.DRUID) deck2 = StackedDeck([WarGolem(), WarGolem(), Cenarius(), Cenarius()], CHARACTER_CLASS.DRUID) game = Game([deck1, deck2], [DoNothingAgent(), OneCardPlayingAgent()]) game.pre_game() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.other_player.minions)) for minion in game.other_player.minions: self.assertEqual(7, minion.calculate_attack()) self.assertEqual(7, minion.health) self.assertEqual(7, minion.calculate_max_health()) game.play_single_turn() self.assertEqual(3, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[0].calculate_attack()) self.assertEqual(8, game.current_player.minions[0].health) self.assertEqual(8, game.current_player.minions[0].calculate_max_health()) self.assertEqual("Cenarius", game.current_player.minions[0].card.name) for minion_index in range(1, 3): minion = game.current_player.minions[minion_index] self.assertEqual(9, minion.calculate_attack()) self.assertEqual(9, minion.health) self.assertEqual(9, minion.calculate_max_health()) game.players[1].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() self.assertEqual(6, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[1].calculate_attack()) self.assertEqual(8, game.current_player.minions[1].health) self.assertEqual(8, game.current_player.minions[1].calculate_max_health()) self.assertEqual("Cenarius", game.current_player.minions[1].card.name) self.assertEqual(2, game.current_player.minions[0].calculate_attack()) self.assertEqual(2, game.current_player.minions[0].health) self.assertEqual(2, game.current_player.minions[0].calculate_max_health()) self.assertTrue(game.current_player.minions[0].taunt) self.assertEqual("Treant", game.current_player.minions[0].card.name) self.assertEqual(2, game.current_player.minions[2].calculate_attack()) self.assertEqual(2, game.current_player.minions[2].health) self.assertEqual(2, game.current_player.minions[2].calculate_max_health()) self.assertTrue(game.current_player.minions[2].taunt) self.assertEqual("Treant", game.current_player.minions[2].card.name) def test_PoisonSeeds(self): game = generate_game_for([StonetuskBoar, BloodfenRaptor, IronfurGrizzly, PoisonSeeds], HauntedCreeper, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 6): game.play_single_turn() self.assertEqual(2, len(game.current_player.minions)) self.assertEqual(3, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(3, len(game.current_player.minions)) self.assertEqual(6, len(game.other_player.minions)) for minion in game.current_player.minions: self.assertEqual("Treant", minion.card.name) self.assertEqual(2, minion.calculate_attack()) self.assertEqual(2, minion.calculate_max_health()) for index in range(0, 4): self.assertEqual("Spectral Spider", game.other_player.minions[index].card.name) self.assertEqual(1, game.other_player.minions[index].calculate_attack()) self.assertEqual(1, game.other_player.minions[index].calculate_max_health()) self.assertEqual("Treant", game.other_player.minions[4].card.name) self.assertEqual(2, game.other_player.minions[4].calculate_attack()) self.assertEqual(2, game.other_player.minions[4].calculate_max_health()) self.assertEqual("Treant", game.other_player.minions[5].card.name) self.assertEqual(2, game.other_player.minions[5].calculate_attack()) self.assertEqual(2, game.other_player.minions[5].calculate_max_health()) def test_AnodizedRoboCub(self): game = generate_game_for(AnodizedRoboCub, IronbeakOwl, OneCardPlayingAgent, OneCardPlayingAgent) game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(3, game.current_player.minions[0].calculate_attack()) self.assertEqual(2, game.current_player.minions[0].health) self.assertEqual(2, game.current_player.minions[0].calculate_max_health()) self.assertTrue(game.current_player.minions[0].taunt) self.assertEqual("Anodized Robo Cub", game.current_player.minions[0].card.name) self.assertEqual(0, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(2, game.other_player.minions[0].health) self.assertEqual(2, game.other_player.minions[0].calculate_max_health()) self.assertFalse(game.other_player.minions[0].taunt) random.seed(1857) game = generate_game_for(AnodizedRoboCub, IronbeakOwl, OneCardPlayingAgent, OneCardPlayingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(2, game.current_player.minions[0].calculate_attack()) self.assertEqual(3, game.current_player.minions[0].health) self.assertEqual(3, game.current_player.minions[0].calculate_max_health()) self.assertTrue(game.current_player.minions[0].taunt) self.assertEqual("Anodized Robo Cub", game.current_player.minions[0].card.name) self.assertEqual(0, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(2, game.other_player.minions[0].health) self.assertEqual(2, game.other_player.minions[0].calculate_max_health()) self.assertEqual(2, game.other_player.minions[0].calculate_attack()) self.assertFalse(game.other_player.minions[0].taunt) def test_MechBearCat(self): game = generate_game_for(MechBearCat, Whirlwind, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 11): game.play_single_turn() self.assertEqual(8, len(game.players[0].hand)) self.assertEqual(6, game.players[0].minions[0].health) # Whirlwind damages Mech-Bear-Cat drawing a Spare Part game.play_single_turn() self.assertEqual(9, len(game.players[0].hand)) self.assertEqual(5, game.players[0].minions[0].health) self.assertEqual("Rusty Horn", game.players[0].hand[8].name) def test_DarkWispers(self): game = generate_game_for(DarkWispers, SaltyDog, CardTestingAgent, OneCardPlayingAgent) game.players[0].agent.choose_option = lambda options, player: options[1] for turn in range(0, 10): game.play_single_turn() # 1 Salty Dog on the field self.assertEqual(0, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(7, game.players[1].minions[0].calculate_attack()) self.assertEqual(4, game.players[1].minions[0].health) self.assertFalse(game.players[1].minions[0].taunt) # Chooses to buff enemy Salty Dog game.play_single_turn() self.assertEqual(0, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(12, game.players[1].minions[0].calculate_attack()) self.assertEqual(9, game.players[1].minions[0].health) self.assertTrue(game.players[1].minions[0].taunt) random.seed(1857) game = generate_game_for(DarkWispers, SaltyDog, CardTestingAgent, OneCardPlayingAgent) for turn in range(0, 10): game.play_single_turn() # 1 Salty Dog on the field self.assertEqual(0, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) # Summons 5 Wisps game.play_single_turn() self.assertEqual(5, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(1, game.players[0].minions[0].calculate_attack()) self.assertEqual(1, game.players[0].minions[0].health) self.assertEqual("Wisp", game.players[0].minions[0].card.name) self.assertEqual(1, game.players[0].minions[1].calculate_attack()) self.assertEqual(1, game.players[0].minions[1].health) self.assertEqual("Wisp", game.players[0].minions[1].card.name) self.assertEqual(1, game.players[0].minions[2].calculate_attack()) self.assertEqual(1, game.players[0].minions[2].health) self.assertEqual("Wisp", game.players[0].minions[2].card.name) self.assertEqual(1, game.players[0].minions[3].calculate_attack()) self.assertEqual(1, game.players[0].minions[3].health) self.assertEqual("Wisp", game.players[0].minions[3].card.name) self.assertEqual(1, game.players[0].minions[4].calculate_attack()) self.assertEqual(1, game.players[0].minions[4].health) self.assertEqual("Wisp", game.players[0].minions[4].card.name) game.play_single_turn() game.play_single_turn() self.assertEqual(7, len(game.players[0].minions)) def test_DruidOfTheFang(self): game = generate_game_for([StonetuskBoar, DruidOfTheFang], DruidOfTheFang, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(10): game.play_single_turn() self.assertEqual(2, len(game.other_player.minions)) self.assertEqual(7, game.other_player.minions[0].calculate_attack()) self.assertEqual(7, game.other_player.minions[0].calculate_max_health()) self.assertEqual(MINION_TYPE.BEAST, game.other_player.minions[0].card.minion_type) self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(4, game.current_player.minions[0].calculate_attack()) self.assertEqual(4, game.current_player.minions[0].calculate_max_health()) game.other_player.minions[0].silence() self.assertEqual(7, game.other_player.minions[0].calculate_attack()) self.assertEqual(7, game.other_player.minions[0].calculate_max_health()) self.assertEqual(MINION_TYPE.BEAST, game.other_player.minions[0].card.minion_type) def test_Recycle(self): game = generate_game_for(Recycle, StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(10): game.play_single_turn() self.assertEqual(5, len(game.current_player.minions)) self.assertEqual(21, game.current_player.deck.left) game.play_single_turn() self.assertEqual(4, len(game.other_player.minions)) self.assertEqual(22, game.other_player.deck.left) def test_Malorne(self): game = generate_game_for(Malorne, Assassinate, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(13): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(20, game.players[0].deck.left) game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) self.assertEqual(21, game.other_player.deck.left) for card in game.other_player.deck.cards: self.assertIsNotNone(card) def test_Malorne_game_ends(self): game = generate_game_for(Malorne, Malorne, PlayAndAttackAgent, PlayAndAttackAgent) for turn in range(500): game.play_single_turn() self.assertTrue(game.game_ended) def test_GroveTender(self): game = generate_game_for(GroveTender, Wisp, OneCardPlayingAgent, DoNothingAgent) for turn in range(0, 4): game.play_single_turn() # Before Gift of Mana self.assertEqual(0, len(game.players[0].minions)) self.assertEqual(2, game.players[0].max_mana) self.assertEqual(2, game.players[1].max_mana) game.play_single_turn() # Both players have 1 more full mana crystal self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, game.players[0].mana) self.assertEqual(4, game.players[0].max_mana) self.assertEqual(3, game.players[1].mana) self.assertEqual(3, game.players[1].max_mana) game.players[0].agent.choose_option = lambda options, player: options[1] # Before Gift of Cards game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(5, len(game.players[0].hand)) self.assertEqual(8, len(game.players[1].hand)) # Both players draw 1 game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(6, len(game.players[0].hand)) self.assertEqual(9, len(game.players[1].hand)) def test_TreeOfLife(self): game = generate_game_for([SpiderTank, Hellfire, TreeOfLife], [SpiderTank, Deathwing], OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 16): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(1, game.players[0].minions[0].health) self.assertEqual(1, game.players[1].minions[0].health) self.assertEqual(27, game.current_player.hero.health) self.assertEqual(27, game.other_player.hero.health) game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(4, game.players[0].minions[0].health) self.assertEqual(4, game.players[1].minions[0].health) self.assertEqual(30, game.current_player.hero.health) self.assertEqual(30, game.other_player.hero.health) def test_TreeOfLifeAuchenai(self): game = generate_game_for([ShieldBlock, AuchenaiSoulpriest, TreeOfLife], [ShieldBlock, Deathwing], OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 16): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(5, game.players[0].minions[0].health) self.assertEqual(30, game.current_player.hero.health) self.assertEqual(30, game.other_player.hero.health) self.assertEqual(5, game.current_player.hero.armor) self.assertEqual(5, game.other_player.hero.armor) game.play_single_turn() self.assertEqual(0, len(game.players[0].minions)) self.assertEqual(5, game.current_player.hero.health) self.assertEqual(5, game.other_player.hero.health) self.assertEqual(0, game.current_player.hero.armor) self.assertEqual(0, game.other_player.hero.armor) def test_DruidOfTheFlame(self): game = generate_game_for(DruidOfTheFlame, StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[0].calculate_attack()) self.assertEqual(2, game.current_player.minions[0].calculate_max_health()) test_cat = game.current_player.minions[0].card.create_minion(None) test_cat.player = game.current_player self.assertEqual(5, test_cat.calculate_attack()) self.assertEqual(2, test_cat.calculate_max_health()) game.current_player.agent.choose_option = lambda options, player: options[1] game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.current_player.minions)) self.assertEqual(2, game.current_player.minions[0].calculate_attack()) self.assertEqual(5, game.current_player.minions[0].calculate_max_health()) test_bird = game.current_player.minions[0].card.create_minion(None) test_bird.player = game.current_player self.assertEqual(2, test_bird.calculate_attack()) self.assertEqual(5, test_bird.calculate_max_health()) def test_Malorne_UnstablePortal(self): class MalornePortal(SpellCard): def __init__(self): super().__init__("Malorne Portal", 2, CHARACTER_CLASS.MAGE, CARD_RARITY.RARE) def use(self, player, game): super().use(player, game) query = CollectionSource([HasCardName("Malorne")]) new_minon = query.get_card(player, player, self) player.hand.append(new_minon) new_minon.attach(new_minon, player) game = generate_game_for(MalornePortal, Naturalize, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(3): game.play_single_turn() # Dump all the cards but the portal'd minion game.current_player.hand = game.current_player.hand[-1:] for turn in range(10): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) def test_Malorne_Deathlord(self): game = generate_game_for([Deathlord, Naturalize, Naturalize], Malorne, CardTestingAgent, DoNothingAgent) for turn in range(5): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual("Deathlord", game.current_player.minions[0].card.name) game.play_single_turn() game.play_single_turn() self.assertEqual(0, len(game.current_player.minions)) def test_VolcanicLumberer(self): game = generate_game_for(LeeroyJenkins, [TwistingNether, VolcanicLumberer], OneCardPlayingAgent, CardTestingAgent) for turn in range(0, 15): game.play_single_turn() self.assertEqual(4, len(game.players[0].minions)) self.assertEqual(7, len(game.players[1].minions)) game.play_single_turn() self.assertEqual(0, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(7, game.players[1].minions[0].calculate_attack()) self.assertEqual(8, game.players[1].minions[0].calculate_max_health())
41.490667
113
0.682392
5,712
46,677
5.359419
0.06145
0.143566
0.130794
0.168164
0.848202
0.79659
0.754875
0.701271
0.662137
0.595074
0
0.019231
0.206804
46,677
1,124
114
41.52758
0.807611
0.033678
0
0.651659
0
0
0.008276
0.001154
0
0
0
0
0.381517
1
0.056872
false
0
0.014218
0
0.077014
0
0
0
0
null
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
67775cd3004569e0aff58b5d268e83c0e38f98ac
100
py
Python
django_cloud_tasks/constants.py
huvrdata/django-cloud-tasks
b35187baf1bd0804329dfd5de34acfc221f420f4
[ "MIT" ]
null
null
null
django_cloud_tasks/constants.py
huvrdata/django-cloud-tasks
b35187baf1bd0804329dfd5de34acfc221f420f4
[ "MIT" ]
3
2020-11-11T14:45:02.000Z
2021-06-10T23:36:34.000Z
django_cloud_tasks/constants.py
huvrdata/django-cloud-tasks
b35187baf1bd0804329dfd5de34acfc221f420f4
[ "MIT" ]
null
null
null
HANDLER_SECRET_HEADER_NAME = "X-DCT-SECRET" DJANGO_HANDLER_SECRET_HEADER_NAME = "HTTP_X_DCT_SECRET"
33.333333
55
0.86
16
100
4.75
0.5
0.342105
0.5
0.605263
0
0
0
0
0
0
0
0
0.06
100
2
56
50
0.808511
0
0
0
0
0
0.29
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
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
5
678e5db1eae299daae48d3e895a7b889affd5b35
87
py
Python
test_frame/other_tests/test_subclass.py
kisshang1993/funboost
020ea6fc4c0ed32ef1a43050729acf12514629c3
[ "Apache-2.0" ]
120
2021-12-26T03:27:12.000Z
2022-03-31T16:20:44.000Z
test_frame/other_tests/test_subclass.py
kisshang1993/funboost
020ea6fc4c0ed32ef1a43050729acf12514629c3
[ "Apache-2.0" ]
18
2021-12-31T06:26:37.000Z
2022-03-31T16:16:33.000Z
test_frame/other_tests/test_subclass.py
kisshang1993/funboost
020ea6fc4c0ed32ef1a43050729acf12514629c3
[ "Apache-2.0" ]
27
2021-12-26T16:12:31.000Z
2022-03-26T17:43:08.000Z
class A: pass class B(A): pass class C(B): pass print(issubclass(C, A))
7.909091
23
0.563218
15
87
3.266667
0.466667
0.204082
0.408163
0
0
0
0
0
0
0
0
0
0.298851
87
11
23
7.909091
0.803279
0
0
0.428571
0
0
0
0
0
0
0
0
0
1
0
true
0.428571
0
0
0.428571
0.142857
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
67c0f5078b86490be8f991c4689dd34920fbb1ec
108
py
Python
user_profile/admin.py
BarunBlog/Link_People
1ffd07bc5b31a715133c99efbbb478efe18d632b
[ "MIT" ]
null
null
null
user_profile/admin.py
BarunBlog/Link_People
1ffd07bc5b31a715133c99efbbb478efe18d632b
[ "MIT" ]
null
null
null
user_profile/admin.py
BarunBlog/Link_People
1ffd07bc5b31a715133c99efbbb478efe18d632b
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import UserProfileInfo admin.site.register(UserProfileInfo)
18
36
0.842593
13
108
7
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.101852
108
6
36
18
0.938144
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
1
0
0
5
67da329a587117262fdd0833850dfc32ea3e5c0c
37
py
Python
gitlab-ci/src/git_changes/test_data/ci_cfg_gitlab_ci/after/gitlab-ci/src/changed_file.py
3cL1p5e7/ic
2b6011291d900454cedcf86ec41c8c1994fdf7d9
[ "Apache-2.0" ]
941
2021-05-10T08:14:14.000Z
2022-03-31T11:40:24.000Z
gitlab-ci/src/git_changes/test_data/ci_cfg_gitlab_ci/after/gitlab-ci/src/changed_file.py
3cL1p5e7/ic
2b6011291d900454cedcf86ec41c8c1994fdf7d9
[ "Apache-2.0" ]
4
2021-12-22T22:34:51.000Z
2022-03-31T07:34:19.000Z
gitlab-ci/src/git_changes/test_data/ci_cfg_gitlab_ci/after/gitlab-ci/src/changed_file.py
3cL1p5e7/ic
2b6011291d900454cedcf86ec41c8c1994fdf7d9
[ "Apache-2.0" ]
122
2021-05-10T08:21:23.000Z
2022-03-25T20:34:12.000Z
#!/usr/bin/env python3 # Mock change
12.333333
22
0.702703
6
37
4.333333
1
0
0
0
0
0
0
0
0
0
0
0.03125
0.135135
37
2
23
18.5
0.78125
0.891892
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
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
db087fa89bc9b77a49016324858ed84526abdc21
131
py
Python
example_native/vistanlp_spacy/setup.py
berquist/namespace_package_testing
a570bc94f3bc6b773e06afc18d9e19917b978b95
[ "MIT" ]
null
null
null
example_native/vistanlp_spacy/setup.py
berquist/namespace_package_testing
a570bc94f3bc6b773e06afc18d9e19917b978b95
[ "MIT" ]
null
null
null
example_native/vistanlp_spacy/setup.py
berquist/namespace_package_testing
a570bc94f3bc6b773e06afc18d9e19917b978b95
[ "MIT" ]
null
null
null
from setuptools import setup, find_namespace_packages setup( name="vistanlp-spacy", packages=find_namespace_packages(), )
18.714286
53
0.770992
15
131
6.466667
0.666667
0.268041
0.43299
0
0
0
0
0
0
0
0
0
0.137405
131
6
54
21.833333
0.858407
0
0
0
0
0
0.10687
0
0
0
0
0
0
1
0
true
0
0.2
0
0.2
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
e1e5906b2e637cd1fb749e7d9212406f80d2a253
1,620
py
Python
visual-chatbot/chat/sender.py
hzhucn/Visual_Dialogue.pytorch
74a4d52f87afae7eafe3e8af6d4dc8809398000f
[ "MIT" ]
null
null
null
visual-chatbot/chat/sender.py
hzhucn/Visual_Dialogue.pytorch
74a4d52f87afae7eafe3e8af6d4dc8809398000f
[ "MIT" ]
null
null
null
visual-chatbot/chat/sender.py
hzhucn/Visual_Dialogue.pytorch
74a4d52f87afae7eafe3e8af6d4dc8809398000f
[ "MIT" ]
1
2018-09-15T06:00:27.000Z
2018-09-15T06:00:27.000Z
from django.conf import settings from chat.utils import log_to_terminal import os import pika import sys import json def svqa(input_question, history, image_path, socketid, job_id): connection = pika.BlockingConnection(pika.ConnectionParameters( host='localhost')) channel = connection.channel() channel.queue_declare(queue='visdial_task_queue', durable=True) message = { 'image_path': image_path, 'input_question': input_question, 'history': history, 'socketid': socketid, 'job_id': job_id, } channel.basic_publish(exchange='', routing_key='visdial_task_queue', body=json.dumps(message), properties=pika.BasicProperties( delivery_mode=2, # make message persistent )) connection.close() def captioning(image_path, socketid, job_id): connection = pika.BlockingConnection(pika.ConnectionParameters( host='localhost')) channel = connection.channel() channel.queue_declare(queue='visdial_captioning_task_queue', durable=True) message = { 'image_path': image_path, 'socketid': socketid, 'job_id': job_id, } channel.basic_publish(exchange='', routing_key='visdial_captioning_task_queue', body=json.dumps(message), properties=pika.BasicProperties( delivery_mode=2, # make message persistent )) connection.close()
31.764706
78
0.597531
153
1,620
6.098039
0.346405
0.057878
0.055734
0.042872
0.788853
0.788853
0.788853
0.788853
0.788853
0.69239
0
0.001792
0.311111
1,620
50
79
32.4
0.834229
0.029012
0
0.619048
0
0
0.115287
0.036943
0
0
0
0
0
1
0.047619
false
0
0.142857
0
0.190476
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
c02dc900b4840ff8b242aa4ef2fea6d1093e5b82
68
py
Python
Using_NetSurfP/__init__.py
SarahWooller/Using_NetSurfP
b74718e10118ee4c7be1e7a2b854dc7e08e52cc0
[ "MIT" ]
null
null
null
Using_NetSurfP/__init__.py
SarahWooller/Using_NetSurfP
b74718e10118ee4c7be1e7a2b854dc7e08e52cc0
[ "MIT" ]
null
null
null
Using_NetSurfP/__init__.py
SarahWooller/Using_NetSurfP
b74718e10118ee4c7be1e7a2b854dc7e08e52cc0
[ "MIT" ]
null
null
null
"""Basic tools to enable use of NetSurfP""" from .helper import *
13.6
43
0.691176
10
68
4.7
1
0
0
0
0
0
0
0
0
0
0
0
0.191176
68
4
44
17
0.854545
0.544118
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
1
0
0
5
c03c7c3eb6513d0ea7e87024328a402607788dfd
4,392
py
Python
paasta_tools/paastaapi/__init__.py
rohangulati/paasta
4539e39159424bfbdeddcb243ca337bcd1eb1a06
[ "Apache-2.0" ]
null
null
null
paasta_tools/paastaapi/__init__.py
rohangulati/paasta
4539e39159424bfbdeddcb243ca337bcd1eb1a06
[ "Apache-2.0" ]
null
null
null
paasta_tools/paastaapi/__init__.py
rohangulati/paasta
4539e39159424bfbdeddcb243ca337bcd1eb1a06
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 # flake8: noqa """ Paasta API No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import __version__ = "1.0.0" # import apis into sdk package from paasta_tools.paastaapi.api.autoscaler_api import AutoscalerApi from paasta_tools.paastaapi.api.default_api import DefaultApi from paasta_tools.paastaapi.api.marathon_dashboard_api import MarathonDashboardApi from paasta_tools.paastaapi.api.resources_api import ResourcesApi from paasta_tools.paastaapi.api.service_api import ServiceApi # import ApiClient from paasta_tools.paastaapi.api_client import ApiClient from paasta_tools.paastaapi.configuration import Configuration from paasta_tools.paastaapi.exceptions import OpenApiException from paasta_tools.paastaapi.exceptions import ApiTypeError from paasta_tools.paastaapi.exceptions import ApiValueError from paasta_tools.paastaapi.exceptions import ApiKeyError from paasta_tools.paastaapi.exceptions import ApiAttributeError from paasta_tools.paastaapi.exceptions import ApiException # import models into sdk package from paasta_tools.paastaapi.models.adhoc_launch_history import AdhocLaunchHistory from paasta_tools.paastaapi.models.deploy_queue import DeployQueue from paasta_tools.paastaapi.models.deploy_queue_service_instance import DeployQueueServiceInstance from paasta_tools.paastaapi.models.envoy_backend import EnvoyBackend from paasta_tools.paastaapi.models.envoy_location import EnvoyLocation from paasta_tools.paastaapi.models.envoy_status import EnvoyStatus from paasta_tools.paastaapi.models.float_and_error import FloatAndError from paasta_tools.paastaapi.models.hpa_metric import HPAMetric from paasta_tools.paastaapi.models.inline_object import InlineObject from paasta_tools.paastaapi.models.inline_object1 import InlineObject1 from paasta_tools.paastaapi.models.inline_response200 import InlineResponse200 from paasta_tools.paastaapi.models.inline_response2001 import InlineResponse2001 from paasta_tools.paastaapi.models.inline_response2002 import InlineResponse2002 from paasta_tools.paastaapi.models.inline_response202 import InlineResponse202 from paasta_tools.paastaapi.models.instance_status import InstanceStatus from paasta_tools.paastaapi.models.instance_status_flink import InstanceStatusFlink from paasta_tools.paastaapi.models.instance_status_kafkacluster import InstanceStatusKafkacluster from paasta_tools.paastaapi.models.instance_status_kubernetes import InstanceStatusKubernetes from paasta_tools.paastaapi.models.instance_status_kubernetes_autoscaling_status import InstanceStatusKubernetesAutoscalingStatus from paasta_tools.paastaapi.models.instance_status_marathon import InstanceStatusMarathon from paasta_tools.paastaapi.models.instance_status_tron import InstanceStatusTron from paasta_tools.paastaapi.models.integer_and_error import IntegerAndError from paasta_tools.paastaapi.models.kubernetes_container import KubernetesContainer from paasta_tools.paastaapi.models.kubernetes_pod import KubernetesPod from paasta_tools.paastaapi.models.kubernetes_replica_set import KubernetesReplicaSet from paasta_tools.paastaapi.models.marathon_app_status import MarathonAppStatus from paasta_tools.paastaapi.models.marathon_autoscaling_info import MarathonAutoscalingInfo from paasta_tools.paastaapi.models.marathon_dashboard_item import MarathonDashboardItem from paasta_tools.paastaapi.models.marathon_mesos_nonrunning_task import MarathonMesosNonrunningTask from paasta_tools.paastaapi.models.marathon_mesos_running_task import MarathonMesosRunningTask from paasta_tools.paastaapi.models.marathon_mesos_status import MarathonMesosStatus from paasta_tools.paastaapi.models.marathon_task import MarathonTask from paasta_tools.paastaapi.models.meta_status import MetaStatus from paasta_tools.paastaapi.models.resource_item import ResourceItem from paasta_tools.paastaapi.models.resource_value import ResourceValue from paasta_tools.paastaapi.models.smartstack_backend import SmartstackBackend from paasta_tools.paastaapi.models.smartstack_location import SmartstackLocation from paasta_tools.paastaapi.models.smartstack_status import SmartstackStatus from paasta_tools.paastaapi.models.task_tail_lines import TaskTailLines
57.789474
129
0.891849
535
4,392
7.078505
0.265421
0.137312
0.205968
0.329548
0.52601
0.454713
0.162398
0.028519
0
0
0
0.00999
0.065574
4,392
75
130
58.56
0.912768
0.074226
0
0
1
0
0.001239
0
0
0
0
0
0
1
0
false
0
0.981481
0
0.981481
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
c05fa7f864d19a1034f1b9bd8e721320fdbba303
38
py
Python
python/testData/completion/starImport/starImport.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/completion/starImport/starImport.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/completion/starImport/starImport.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
from importSource import * my_<caret>
12.666667
26
0.789474
5
38
5.8
1
0
0
0
0
0
0
0
0
0
0
0
0.131579
38
3
27
12.666667
0.878788
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
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
1
0
0
0
1
0
0
0
0
5
c05fb93cc5bca34058d957e6fd46bd9aca1bfae6
76
py
Python
src/alchemlyb/estimators/__init__.py
BranniganLab/alchemlyb
a8ac1a1472f124feec9b20b1afdbea352e2ac5a4
[ "BSD-3-Clause" ]
3
2016-09-20T03:34:54.000Z
2016-10-04T21:52:52.000Z
src/alchemlyb/estimators/__init__.py
BranniganLab/alchemlyb
a8ac1a1472f124feec9b20b1afdbea352e2ac5a4
[ "BSD-3-Clause" ]
1
2016-09-28T18:50:20.000Z
2016-09-28T18:50:20.000Z
src/alchemlyb/estimators/__init__.py
Becksteinlab/alchemlyb
9153bbd00425bd02dfb11c6193aa5309d4681e4b
[ "BSD-3-Clause" ]
1
2020-10-11T12:31:19.000Z
2020-10-11T12:31:19.000Z
from .mbar_ import MBAR, AutoMBAR from .bar_ import BAR from .ti_ import TI
19
33
0.776316
13
76
4.307692
0.461538
0
0
0
0
0
0
0
0
0
0
0
0.171053
76
3
34
25.333333
0.888889
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
1
0
0
5
2212cd73bdd71cd75c8a2ce74c36d44e0d5f09d2
29
py
Python
__init__.py
margrietpalm/montage_movies
a7264a27f0370aa0a07bf459442a7ebf0607aaa4
[ "MIT" ]
null
null
null
__init__.py
margrietpalm/montage_movies
a7264a27f0370aa0a07bf459442a7ebf0607aaa4
[ "MIT" ]
null
null
null
__init__.py
margrietpalm/montage_movies
a7264a27f0370aa0a07bf459442a7ebf0607aaa4
[ "MIT" ]
1
2019-02-05T16:09:33.000Z
2019-02-05T16:09:33.000Z
from .montage_movies import *
29
29
0.827586
4
29
5.75
1
0
0
0
0
0
0
0
0
0
0
0
0.103448
29
1
29
29
0.884615
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
221663b629329bafd7a2b1b657b62ac155698840
90
py
Python
bridgedb/distributors/moat/__init__.py
jugheadjones10/bridgedb
94d6bca4b22458c156898785d8f6ccedf562d884
[ "BSD-3-Clause-Clear" ]
4
2016-04-18T06:30:54.000Z
2019-07-17T14:02:45.000Z
bridgedb/distributors/moat/__init__.py
jugheadjones10/bridgedb
94d6bca4b22458c156898785d8f6ccedf562d884
[ "BSD-3-Clause-Clear" ]
null
null
null
bridgedb/distributors/moat/__init__.py
jugheadjones10/bridgedb
94d6bca4b22458c156898785d8f6ccedf562d884
[ "BSD-3-Clause-Clear" ]
1
2019-04-11T23:00:02.000Z
2019-04-11T23:00:02.000Z
"""Servers for BridgeDB's Moat bridge distributor.""" #import distributor #import server
18
53
0.766667
11
90
6.272727
0.818182
0.492754
0
0
0
0
0
0
0
0
0
0
0.122222
90
4
54
22.5
0.873418
0.877778
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
1
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
5
225bc7a0ae4bd45d4819df8517c11289d0c4a968
162
py
Python
example/hello/hello.py
kanade0404/yuri
dcea86566a176be96fac0a5db19d59595e234269
[ "MIT" ]
null
null
null
example/hello/hello.py
kanade0404/yuri
dcea86566a176be96fac0a5db19d59595e234269
[ "MIT" ]
null
null
null
example/hello/hello.py
kanade0404/yuri
dcea86566a176be96fac0a5db19d59595e234269
[ "MIT" ]
null
null
null
from yuri.app import Yuri from yuri.responses import Response app = Yuri() @app.route('/') def hello(request) -> Response: return Response('Hello, world')
16.2
35
0.703704
22
162
5.181818
0.545455
0.140351
0
0
0
0
0
0
0
0
0
0
0.160494
162
9
36
18
0.838235
0
0
0
0
0
0.080247
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0.166667
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
1
1
0
0
5
226d5ed71dd498688733d63de8fb7b07896549bd
112
py
Python
enthought/permissions/default/policy_manager.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
3
2016-12-09T06:05:18.000Z
2018-03-01T13:00:29.000Z
enthought/permissions/default/policy_manager.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
1
2020-12-02T00:51:32.000Z
2020-12-02T08:48:55.000Z
enthought/permissions/default/policy_manager.py
enthought/etsproxy
4aafd628611ebf7fe8311c9d1a0abcf7f7bb5347
[ "BSD-3-Clause" ]
null
null
null
# proxy module from __future__ import absolute_import from apptools.permissions.default.policy_manager import *
28
57
0.857143
14
112
6.428571
0.785714
0
0
0
0
0
0
0
0
0
0
0
0.098214
112
3
58
37.333333
0.891089
0.107143
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
1
0
0
5
227cefbc22fbcfe2d37349fe09ef3855c950063b
158
py
Python
models/__init__.py
mtlong/liif
96699bf45e8e29a73ea8ce8fb08d19b0846aed00
[ "BSD-3-Clause" ]
null
null
null
models/__init__.py
mtlong/liif
96699bf45e8e29a73ea8ce8fb08d19b0846aed00
[ "BSD-3-Clause" ]
null
null
null
models/__init__.py
mtlong/liif
96699bf45e8e29a73ea8ce8fb08d19b0846aed00
[ "BSD-3-Clause" ]
null
null
null
from .models import register, make, make_pretrained, make_finetune from . import edsr, rdn, rcan from . import mlp from . import liif from . import misc
26.333333
67
0.746835
23
158
5.043478
0.565217
0.344828
0
0
0
0
0
0
0
0
0
0
0.189873
158
5
68
31.6
0.90625
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3f0d77dde2ff6cce72b55430d96c0a62b52e9933
162
py
Python
tests/web_platform/css_flexbox_1/test_flex_align_items_center.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
null
null
null
tests/web_platform/css_flexbox_1/test_flex_align_items_center.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
null
null
null
tests/web_platform/css_flexbox_1/test_flex_align_items_center.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
1
2020-01-16T01:56:41.000Z
2020-01-16T01:56:41.000Z
from tests.utils import W3CTestCase class TestFlexAlignItemsCenter(W3CTestCase): vars().update(W3CTestCase.find_tests(__file__, 'flex-align-items-center'))
27
78
0.802469
18
162
6.944444
0.833333
0
0
0
0
0
0
0
0
0
0
0.02027
0.08642
162
5
79
32.4
0.824324
0
0
0
0
0
0.142857
0.142857
0
0
0
0
0
1
0
true
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
1
0
1
0
1
0
0
5
3f13c93d756e6ae19f062c6a045ee2bde0fec8f5
19
py
Python
Tinkering_Graphics_Project/DefaultFile.py
Tragicdragoon/Tinkering_Graphics_COMP120
2666a4f5e849ad7063e2d40c2f5e1adb711f7a78
[ "MIT" ]
null
null
null
Tinkering_Graphics_Project/DefaultFile.py
Tragicdragoon/Tinkering_Graphics_COMP120
2666a4f5e849ad7063e2d40c2f5e1adb711f7a78
[ "MIT" ]
null
null
null
Tinkering_Graphics_Project/DefaultFile.py
Tragicdragoon/Tinkering_Graphics_COMP120
2666a4f5e849ad7063e2d40c2f5e1adb711f7a78
[ "MIT" ]
null
null
null
import sys, pygame
9.5
18
0.789474
3
19
5
1
0
0
0
0
0
0
0
0
0
0
0
0.157895
19
1
19
19
0.9375
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3f163e7f473eb0b1a151ce2ab2e224a4dc1f835d
362
py
Python
cogitare/plugins/__init__.py
cogitare-ai/cogitare
fa99b8ef30e2f74e16fb542f2992582d1bd3ac2c
[ "MIT" ]
90
2017-11-25T13:54:48.000Z
2021-09-04T04:19:52.000Z
cogitare/plugins/__init__.py
cogitare-ai/cogitare
fa99b8ef30e2f74e16fb542f2992582d1bd3ac2c
[ "MIT" ]
43
2017-09-12T20:40:56.000Z
2019-08-03T15:37:37.000Z
cogitare/plugins/__init__.py
cogitare-ai/cogitare
fa99b8ef30e2f74e16fb542f2992582d1bd3ac2c
[ "MIT" ]
9
2018-02-01T22:37:15.000Z
2018-11-05T13:30:58.000Z
from cogitare.plugins.logger import Logger from cogitare.plugins.progress_bar import ProgressBar from cogitare.plugins.plotting import PlottingMatplotlib from cogitare.plugins.early_stopping import EarlyStopping from cogitare.plugins.evaluator import Evaluator __all__ = ['Logger', 'ProgressBar', 'PlottingMatplotlib', 'EarlyStopping', 'Evaluator']
36.2
57
0.814917
38
362
7.605263
0.394737
0.207612
0.32872
0
0
0
0
0
0
0
0
0
0.110497
362
9
58
40.222222
0.897516
0
0
0
0
0
0.157459
0
0
0
0
0
0
1
0
false
0
0.714286
0
0.714286
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
3f1932246fc4b7cbba57af7feaf7fee9a65b7ad4
194
py
Python
tests/apps/newscomp3/views.py
blazelibs/blazeweb
b120a6a2e38c8b53da2b73443ff242e2d1438053
[ "BSD-3-Clause" ]
null
null
null
tests/apps/newscomp3/views.py
blazelibs/blazeweb
b120a6a2e38c8b53da2b73443ff242e2d1438053
[ "BSD-3-Clause" ]
6
2016-11-01T18:42:34.000Z
2020-11-16T16:52:14.000Z
tests/apps/newscomp3/views.py
blazelibs/blazeweb
b120a6a2e38c8b53da2b73443ff242e2d1438053
[ "BSD-3-Clause" ]
1
2020-01-22T18:20:46.000Z
2020-01-22T18:20:46.000Z
class FakeView(object): pass class InNewsComp3(object): pass class News1HasPriority(object): pass class InNlSupporting(object): pass class InNewsComp2(object): pass
9.7
31
0.695876
20
194
6.75
0.4
0.37037
0.444444
0
0
0
0
0
0
0
0
0.02
0.226804
194
19
32
10.210526
0.88
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
450079bc1a4aa16bdab7c380791e93ca0a441e6e
135
py
Python
clever/apis/__init__.py
AltSchool/clever-python
704aff7ec7421c85dcee7894ef39ba01308f70e1
[ "Apache-2.0", "MIT" ]
18
2015-01-28T20:10:16.000Z
2021-10-21T14:46:46.000Z
clever/apis/__init__.py
Clever/clever-python
3ce79753454d065ebc2302d48eda6a1b3a0433a2
[ "Apache-2.0", "MIT" ]
26
2015-02-06T01:09:57.000Z
2021-04-01T11:10:29.000Z
clever/apis/__init__.py
AltSchool/clever-python
704aff7ec7421c85dcee7894ef39ba01308f70e1
[ "Apache-2.0", "MIT" ]
21
2015-03-12T23:37:07.000Z
2021-09-23T08:55:49.000Z
from __future__ import absolute_import # import apis into api package from .data_api import DataApi from .events_api import EventsApi
22.5
38
0.837037
20
135
5.3
0.6
0.169811
0
0
0
0
0
0
0
0
0
0
0.140741
135
5
39
27
0.913793
0.207407
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
1
0
0
5
18af2e74d6715da3ffe103d07552727924259b81
244
py
Python
src/rctgen/impl/activity_decl.py
mballance/pyrctgen
eb47ed2039d36ab236b63e795b313feb499820bd
[ "Apache-2.0" ]
1
2022-03-10T04:12:11.000Z
2022-03-10T04:12:11.000Z
src/rctgen/impl/activity_decl.py
mballance/pyrctgen
eb47ed2039d36ab236b63e795b313feb499820bd
[ "Apache-2.0" ]
null
null
null
src/rctgen/impl/activity_decl.py
mballance/pyrctgen
eb47ed2039d36ab236b63e795b313feb499820bd
[ "Apache-2.0" ]
null
null
null
''' Created on May 8, 2022 @author: mballance ''' class ActivityDecl(object): def __init__(self, activity_f): self._activity_f = activity_f @property def activity_f(self): return self._activity_f
16.266667
37
0.618852
29
244
4.827586
0.586207
0.321429
0.278571
0
0
0
0
0
0
0
0
0.028736
0.286885
244
15
38
16.266667
0.775862
0.172131
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.166667
0.666667
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
5
18b71de43c42ff2ca0af33d51e38289d2cdd9de2
219
py
Python
colour_spectroscope/fraunhofer/__init__.py
colour-science/colour-spectroscope
73ad5920355b509b00939adccd4ec42a2075e698
[ "BSD-3-Clause" ]
2
2017-04-15T09:29:25.000Z
2021-05-11T20:26:41.000Z
colour_spectroscope/fraunhofer/__init__.py
colour-science/colour-spectroscope
73ad5920355b509b00939adccd4ec42a2075e698
[ "BSD-3-Clause" ]
null
null
null
colour_spectroscope/fraunhofer/__init__.py
colour-science/colour-spectroscope
73ad5920355b509b00939adccd4ec42a2075e698
[ "BSD-3-Clause" ]
2
2016-01-18T17:31:33.000Z
2017-07-24T17:35:23.000Z
# -*- coding: utf-8 -*- from __future__ import absolute_import from .analysis import calibrated_RGB_spectrum from .plotting import fraunhofer_lines_plot __all__ = ['calibrated_RGB_spectrum', 'fraunhofer_lines_plot']
24.333333
62
0.803653
27
219
5.888889
0.592593
0.163522
0.264151
0
0
0
0
0
0
0
0
0.005128
0.109589
219
8
63
27.375
0.810256
0.09589
0
0
0
0
0.22449
0.22449
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
18c5470a5929feb4bbd831bf1f969878574c7c80
221
py
Python
tfstater/models/__init__.py
gi0baro/tfstater
2123f20d84838c34bc9eabda7f4bb80b99750586
[ "BSD-3-Clause" ]
4
2021-11-18T19:17:38.000Z
2022-02-09T16:25:48.000Z
tfstater/models/__init__.py
gi0baro/tfstater
2123f20d84838c34bc9eabda7f4bb80b99750586
[ "BSD-3-Clause" ]
null
null
null
tfstater/models/__init__.py
gi0baro/tfstater
2123f20d84838c34bc9eabda7f4bb80b99750586
[ "BSD-3-Clause" ]
1
2021-11-19T16:09:05.000Z
2021-11-19T16:09:05.000Z
from emmett import now from emmett.orm import Model, Field class TSModel(Model): created_at = Field.datetime(default=now, rw=(True, False)) updated_at = Field.datetime(default=now, update=now, rw=(True, False))
27.625
74
0.733032
33
221
4.848485
0.545455
0.125
0.1875
0.275
0.3125
0
0
0
0
0
0
0
0.144796
221
7
75
31.571429
0.846561
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
18cea13c6042af000a9a38fbd6354f42e89d7098
14
py
Python
code/first.py
Codernob/problem-solving-codes
c852bae4e31887bd442d70af921348c8f1d246bf
[ "MIT" ]
null
null
null
code/first.py
Codernob/problem-solving-codes
c852bae4e31887bd442d70af921348c8f1d246bf
[ "MIT" ]
null
null
null
code/first.py
Codernob/problem-solving-codes
c852bae4e31887bd442d70af921348c8f1d246bf
[ "MIT" ]
null
null
null
print("henlo")
14
14
0.714286
2
14
5
1
0
0
0
0
0
0
0
0
0
0
0
0
14
1
14
14
0.714286
0
0
0
0
0
0.333333
0
0
0
0
0
0
1
0
true
0
0
0
0
1
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
1
0
5
18d889f11b21a4532d84f8fbdaccbd7ed08a34e3
3,578
py
Python
erica_app/tests/test_sample_data_validations.py
digitalservice4germany/steuerlotse
ef3e094e4d7d4768431a50ac4be60672cd03221d
[ "MIT" ]
20
2021-07-02T07:49:08.000Z
2022-03-18T22:26:10.000Z
erica_app/tests/test_sample_data_validations.py
digitalservice4germany/steuerlotse
ef3e094e4d7d4768431a50ac4be60672cd03221d
[ "MIT" ]
555
2021-06-28T15:35:15.000Z
2022-03-31T11:51:55.000Z
erica_app/tests/test_sample_data_validations.py
digitalservice4germany/steuerlotse
ef3e094e4d7d4768431a50ac4be60672cd03221d
[ "MIT" ]
1
2021-07-04T20:34:12.000Z
2021-07-04T20:34:12.000Z
import datetime from decimal import Decimal import unittest import pytest from erica.routes import validate_est from tests.utils import create_est, create_est_single, missing_cert, missing_pyeric_lib class TestSampleDataValidation(unittest.TestCase): @pytest.mark.skipif(missing_cert(), reason="skipped because of missing cert.pfx; see pyeric/README.md") @pytest.mark.skipif(missing_pyeric_lib(), reason="skipped because of missing eric lib; see pyeric/README.md") def test_01_not_married(self): response = validate_est(est=create_est_single(True)) self.assertIsNotNone(response) @pytest.mark.skipif(missing_cert(), reason="skipped because of missing cert.pfx; see pyeric/README.md") @pytest.mark.skipif(missing_pyeric_lib(), reason="skipped because of missing eric lib; see pyeric/README.md") def test_02_married_rel_ev(self): married_data = create_est(True) married_data.est_data.__dict__.update({ 'person_a_religion': 'ev', 'familienstand': 'married', 'familienstand_date': datetime.date(2000, 1, 31), }) response = validate_est(married_data) self.assertIsNotNone(response) @pytest.mark.skipif(missing_cert(), reason="skipped because of missing cert.pfx; see pyeric/README.md") @pytest.mark.skipif(missing_pyeric_lib(), reason="skipped because of missing eric lib; see pyeric/README.md") def test_03_divorced_rel_rk(self): single_data = create_est_single(True) single_data.est_data.__dict__.update({ 'person_a_religion': 'rk', 'familienstand': 'divorced', 'familienstand_date': datetime.date(2000, 1, 31), }) response = validate_est(single_data) self.assertIsNotNone(response) @pytest.mark.skipif(missing_cert(), reason="skipped because of missing cert.pfx; see pyeric/README.md") @pytest.mark.skipif(missing_pyeric_lib(), reason="skipped because of missing eric lib; see pyeric/README.md") def test_04_widowed(self): single_data = create_est_single(True) single_data.est_data.__dict__.update({ 'familienstand': 'widowed', 'familienstand_date': datetime.date(2000, 1, 31), }) response = validate_est(single_data) self.assertIsNotNone(response) @pytest.mark.skipif(missing_cert(), reason="skipped because of missing cert.pfx; see pyeric/README.md") @pytest.mark.skipif(missing_pyeric_lib(), reason="skipped because of missing eric lib; see pyeric/README.md") def test_06_with_person_b_same_address(self): married_data = create_est(True) married_data.est_data.__dict__.update({ 'person_b_same_address': True, }) response = validate_est(married_data) self.assertIsNotNone(response) @pytest.mark.skipif(missing_cert(), reason="skipped because of missing cert.pfx; see pyeric/README.md") @pytest.mark.skipif(missing_pyeric_lib(), reason="skipped because of missing eric lib; see pyeric/README.md") def test_07_steuerminderungen(self): single_data = create_est_single(True) single_data.est_data.__dict__.update({ 'haushaltsnahe_entries': ["Gartenarbeiten"], 'haushaltsnahe_summe': Decimal('500.00'), 'handwerker_entries': ["Renovierung Badezimmer"], 'handwerker_summe': Decimal('200.00'), 'handwerker_lohn_etc_summe': Decimal('100.00'), }) response = validate_est(single_data) self.assertIsNotNone(response)
42.595238
113
0.69592
444
3,578
5.34009
0.18018
0.060312
0.080978
0.116407
0.749473
0.749473
0.749473
0.749473
0.715732
0.715732
0
0.016644
0.193963
3,578
83
114
43.108434
0.805479
0
0
0.621212
0
0
0.28256
0.018726
0
0
0
0
0.090909
1
0.090909
false
0
0.090909
0
0.19697
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
18f811d9728dffc38f011af12845bb2fcb04b1c2
270
py
Python
integreat_cms/cms/models/events/__init__.py
Integreat/cms-v2
c79a54fd5abb792696420aa6427a5e5a356fa79c
[ "Apache-2.0" ]
21
2018-10-26T20:10:45.000Z
2020-10-22T09:41:46.000Z
integreat_cms/cms/models/events/__init__.py
Carlosbogo/integreat-cms
066f188b138e105e72f5420bc36d25709f25402d
[ "Apache-2.0" ]
392
2018-10-25T08:34:07.000Z
2020-11-19T08:20:30.000Z
integreat_cms/cms/models/events/__init__.py
Carlosbogo/integreat-cms
066f188b138e105e72f5420bc36d25709f25402d
[ "Apache-2.0" ]
23
2019-03-06T17:11:35.000Z
2020-10-16T04:36:41.000Z
""" This package contains all event-related data models: :class:`~integreat_cms.cms.models.events.event.Event`, :class:`~integreat_cms.cms.models.events.event_translation.EventTranslation` and :class:`~integreat_cms.cms.models.events.recurrence_rule.RecurrenceRule` """
38.571429
80
0.807407
35
270
6.085714
0.514286
0.197183
0.239437
0.28169
0.497653
0.497653
0.347418
0
0
0
0
0
0.048148
270
6
81
45
0.828794
0.966667
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
1
1
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
5
e13e5ff873f5dab4ec949bcef3b949d00610aebe
35
py
Python
modules/jd/__init__.py
srcc-msu/job_statistics
74680a4e4c105ebcff94f089e07fcb44dbcc12d9
[ "MIT" ]
null
null
null
modules/jd/__init__.py
srcc-msu/job_statistics
74680a4e4c105ebcff94f089e07fcb44dbcc12d9
[ "MIT" ]
null
null
null
modules/jd/__init__.py
srcc-msu/job_statistics
74680a4e4c105ebcff94f089e07fcb44dbcc12d9
[ "MIT" ]
null
null
null
from modules.jd import controllers
17.5
34
0.857143
5
35
6
1
0
0
0
0
0
0
0
0
0
0
0
0.114286
35
1
35
35
0.967742
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
e16b690c3e0959991c62e560c0d6e297d3dcf786
96
py
Python
natwork/follows/admin.py
Potisin/Natwork
a42b89f18fdd8f8ac69e56cb7184696d6883a9f7
[ "BSD-3-Clause" ]
null
null
null
natwork/follows/admin.py
Potisin/Natwork
a42b89f18fdd8f8ac69e56cb7184696d6883a9f7
[ "BSD-3-Clause" ]
null
null
null
natwork/follows/admin.py
Potisin/Natwork
a42b89f18fdd8f8ac69e56cb7184696d6883a9f7
[ "BSD-3-Clause" ]
null
null
null
from django.contrib import admin from follows.models import Follow admin.site.register(Follow)
19.2
33
0.833333
14
96
5.714286
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.104167
96
5
34
19.2
0.930233
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
1
0
0
5
e17827548a29fdecbd7711a1db183533b2840430
148
py
Python
fos/core/camera_list.py
ibrahemesam/Fos
f2f284a2c7bdc24dafafebb8aa3141ebf225e451
[ "BSD-3-Clause" ]
2
2016-08-03T10:33:08.000Z
2021-06-23T18:50:14.000Z
fos/core/camera_list.py
fos/fos-legacy
db6047668781a0615abcebc7d55a7164f3105047
[ "BSD-3-Clause" ]
null
null
null
fos/core/camera_list.py
fos/fos-legacy
db6047668781a0615abcebc7d55a7164f3105047
[ "BSD-3-Clause" ]
1
2021-07-11T00:16:46.000Z
2021-07-11T00:16:46.000Z
class CameraList(object): def __init__(self): self.cameras = [] def add(self, obj): self.cameras.append(obj)
16.444444
32
0.540541
16
148
4.75
0.625
0.289474
0
0
0
0
0
0
0
0
0
0
0.337838
148
9
33
16.444444
0.77551
0
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
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
1
0
0
0
0
1
0
0
5
e18a79d4c200119d322976a4192edfecc4453d67
33
py
Python
python/python_notes/HelloWorld/helloworld.py
zhaoace/codecraft
bf06267e86bd7386714911b0df4aa0ca0a91d882
[ "Unlicense" ]
null
null
null
python/python_notes/HelloWorld/helloworld.py
zhaoace/codecraft
bf06267e86bd7386714911b0df4aa0ca0a91d882
[ "Unlicense" ]
null
null
null
python/python_notes/HelloWorld/helloworld.py
zhaoace/codecraft
bf06267e86bd7386714911b0df4aa0ca0a91d882
[ "Unlicense" ]
null
null
null
print 'Hello World!' raw_input()
16.5
21
0.727273
5
33
4.6
1
0
0
0
0
0
0
0
0
0
0
0
0.121212
33
2
22
16.5
0.793103
0
0
0
0
0
0.363636
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
1
0
5
e1b49d9f861251164a31e8e5bfbb4844d8c7766d
26,524
py
Python
electrum_gui/common/tests/unit/transaction/test_manager.py
BixinKey/electrum
f5de4e74e313b9b569f13ba6ab9142a38bf095f2
[ "MIT" ]
12
2020-11-12T08:53:05.000Z
2021-07-06T17:30:39.000Z
electrum_gui/common/tests/unit/transaction/test_manager.py
liyanhrxy/electrum
107608ef201ff1d20d2f6091c257b1ceff9b7362
[ "MIT" ]
209
2020-09-23T06:58:18.000Z
2021-11-18T11:25:41.000Z
electrum_gui/common/tests/unit/transaction/test_manager.py
liyanhrxy/electrum
107608ef201ff1d20d2f6091c257b1ceff9b7362
[ "MIT" ]
19
2020-10-13T11:42:26.000Z
2022-02-06T01:26:34.000Z
import datetime import decimal from unittest import TestCase from unittest.mock import Mock, call, patch import peewee from electrum_gui.common.basic.orm import test_utils from electrum_gui.common.coin import data as coin_data from electrum_gui.common.provider import data as provider_data from electrum_gui.common.provider import exceptions as provider_exceptions from electrum_gui.common.transaction import daos, data, manager, models @test_utils.cls_test_database(models.TxAction) class TestTransactionManager(TestCase): @patch("electrum_gui.common.transaction.manager.coin_manager") @patch("electrum_gui.common.transaction.manager.provider_manager") def test_update_pending_actions(self, fake_provider_manager, fake_coin_manager): # prepare data daos.bulk_create( [ daos.new_action( txid="txid_a", status=data.TxActionStatus.PENDING, chain_code="eth", coin_code="eth", value=decimal.Decimal(0), from_address="address_a", to_address="contract_a", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), nonce=11, raw_tx="", ), daos.new_action( txid="txid_a", status=data.TxActionStatus.PENDING, chain_code="eth", coin_code="eth_usdt", value=decimal.Decimal(10), from_address="address_a", to_address="address_b", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), index=1, raw_tx="", ), daos.new_action( txid="txid_b", status=data.TxActionStatus.PENDING, chain_code="bsc", coin_code="bsc", value=decimal.Decimal(3), from_address="address_b", to_address="address_c", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), nonce=3, raw_tx="", ), daos.new_action( txid="txid_c", status=data.TxActionStatus.PENDING, chain_code="heco", coin_code="heco", value=decimal.Decimal(4), from_address="address_c", to_address="address_b", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), nonce=3, raw_tx="", ), daos.new_action( txid="txid_d", status=data.TxActionStatus.PENDING, chain_code="eth", coin_code="eth", value=decimal.Decimal(10), from_address="address_a", to_address="address_b", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(10), nonce=11, raw_tx="", ), daos.new_action( txid="txid_e", status=data.TxActionStatus.PENDING, chain_code="eth", coin_code="eth", value=decimal.Decimal(11), from_address="address_a", to_address="address_b", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(15), nonce=11, raw_tx="", ), ] ) # Adjust the created time of the transaction to 3 days ago tx_bsc: models.TxAction = models.TxAction.get_or_none(txid="txid_b") models.TxAction.update(created_time=datetime.datetime.now() - datetime.timedelta(days=3)).where( models.TxAction.id == tx_bsc.id ).execute() fake_coin_manager.get_chain_info.return_value = Mock( chain_model=coin_data.ChainModel.ACCOUNT, nonce_supported=True ) def _fake_get_transaction_by_txid(chain_code, txid): if txid not in ("txid_a", "txid_b", "txid_c"): raise provider_exceptions.TransactionNotFound(txid) return { "eth": provider_data.Transaction( txid="txid_a", status=provider_data.TransactionStatus.CONFIRM_SUCCESS, fee=provider_data.TransactionFee(limit=1000, used=900, price_per_unit=20), block_header=provider_data.BlockHeader( block_hash="block_a", block_number=1001, block_time=1600000000, confirmations=3 ), ), "bsc": provider_data.Transaction( txid="txid_b", status=provider_data.TransactionStatus.PENDING, ), "heco": provider_data.Transaction( txid="txid_c", status=provider_data.TransactionStatus.CONFIRM_REVERTED, fee=provider_data.TransactionFee(limit=1000, used=1000, price_per_unit=20), block_header=provider_data.BlockHeader( block_hash="block_c", block_number=1010, block_time=1600000001 ), ), }.get(chain_code) fake_provider_manager.get_transaction_by_txid.side_effect = _fake_get_transaction_by_txid manager.update_pending_actions() txns = list(models.TxAction.select().order_by(models.TxAction.id.asc())) self.assertEqual( [ { "id": 1, "txid": "txid_a", "chain_code": "eth", "coin_code": "eth", "status": data.TxActionStatus.CONFIRM_SUCCESS, "fee_used": decimal.Decimal(900), "block_number": 1001, "block_hash": "block_a", "block_time": 1600000000, }, { "id": 2, "txid": "txid_a", "chain_code": "eth", "coin_code": "eth_usdt", "status": data.TxActionStatus.CONFIRM_SUCCESS, "fee_used": decimal.Decimal(900), "block_number": 1001, "block_hash": "block_a", "block_time": 1600000000, }, { "id": 3, "txid": "txid_b", "chain_code": "bsc", "coin_code": "bsc", "status": data.TxActionStatus.UNKNOWN, "fee_used": decimal.Decimal(0), "block_number": None, "block_hash": None, "block_time": None, }, { "id": 4, "txid": "txid_c", "chain_code": "heco", "coin_code": "heco", "status": data.TxActionStatus.CONFIRM_REVERTED, "fee_used": decimal.Decimal(1000), "block_number": 1010, "block_hash": "block_c", "block_time": 1600000001, }, { "id": 5, "txid": "txid_d", "chain_code": "eth", "coin_code": "eth", "status": data.TxActionStatus.REPLACED, "fee_used": decimal.Decimal(0), "block_number": None, "block_hash": None, "block_time": None, }, { "id": 6, "txid": "txid_e", "chain_code": "eth", "coin_code": "eth", "status": data.TxActionStatus.REPLACED, "fee_used": decimal.Decimal(0), "block_number": None, "block_hash": None, "block_time": None, }, ], [ { "id": i.id, "txid": i.txid, "chain_code": i.chain_code, "coin_code": i.coin_code, "status": i.status, "fee_used": i.fee_used, "block_number": i.block_number, "block_hash": i.block_hash, "block_time": i.block_time, } for i in txns ], ) fake_provider_manager.get_transaction_by_txid.assert_has_calls( [ call("bsc", "txid_b"), call("eth", "txid_a"), call("eth", "txid_d"), call("eth", "txid_e"), call("heco", "txid_c"), ], any_order=True, ) def test_unique_indexes_of_tx_action(self): models.TxAction.create( txid="txid_a", status=data.TxActionStatus.CONFIRM_SUCCESS, chain_code="eth", coin_code="eth", value=decimal.Decimal(0), from_address="address_a", to_address="contract_a", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), raw_tx="", nonce=0, index=0, ) with self.assertRaisesRegex( peewee.IntegrityError, "UNIQUE constraint failed: txaction.txid, txaction.coin_code, txaction.index" ): models.TxAction.create( txid="txid_a", status=data.TxActionStatus.CONFIRM_SUCCESS, chain_code="eth", coin_code="eth", value=decimal.Decimal(0), from_address="address_a", to_address="contract_a", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), raw_tx="", nonce=0, index=0, ) @patch("electrum_gui.common.transaction.manager.provider_manager") @patch("electrum_gui.common.transaction.manager.coin_manager") @patch("electrum_gui.common.transaction.manager.time") def test_query_actions_by_address(self, fake_time, fake_coin_manager, fake_provider_manager): fake_coin_manager.get_chain_info.return_value = Mock(chain_model=coin_data.ChainModel.ACCOUNT) fake_coin_manager.get_coin_info.return_value = Mock(code="eth") fake_coin_manager.query_coins_by_token_addresses.return_value = [] fake_provider_manager.verify_address.side_effect = lambda chain_code, address: Mock(normalized_address=address) def _build_action_by_pattern(txid: str, **kwargs): pattern = dict( chain_code="eth", coin_code="eth", value=decimal.Decimal(10), from_address="address_a", to_address="address_b", fee_limit=decimal.Decimal(1000), fee_price_per_unit=decimal.Decimal(20), raw_tx="", ) _data = pattern.copy() _data.update(kwargs) _data["txid"] = txid return daos.new_action(**_data) # 1. prepare existing actions daos.bulk_create( [ _build_action_by_pattern( "txid_from_a_100", status=data.TxActionStatus.PENDING, nonce=100, created_time=datetime.datetime.utcfromtimestamp(1620000002), ), _build_action_by_pattern( "txid_from_a_99", status=data.TxActionStatus.PENDING, nonce=99, created_time=datetime.datetime.utcfromtimestamp(1620000001), ), ] ) self.assertEqual(2, models.TxAction.select().count()) # 2. prepare fake txs send_from_a = [ provider_data.Transaction( txid=f"txid_from_a_{i}", status=provider_data.TransactionStatus.CONFIRM_SUCCESS, inputs=[provider_data.TransactionInput(address="address_a", value=10)], outputs=[provider_data.TransactionOutput(address="address_b", value=10)], fee=provider_data.TransactionFee(limit=1000, used=900, price_per_unit=20), nonce=i, ) for i in range(100) ] send_to_a = [ provider_data.Transaction( txid=f"txid_to_a_{i}", status=provider_data.TransactionStatus.CONFIRM_SUCCESS, inputs=[provider_data.TransactionInput(address=f"address_{i}", value=10)], outputs=[provider_data.TransactionOutput(address="address_a", value=10)], fee=provider_data.TransactionFee(limit=1000, used=900, price_per_unit=20), nonce=0, ) for i in range(200) ] txs = send_to_a[:100] + send_from_a + send_to_a[100:] for index, tx in enumerate(txs): tx.block_header = provider_data.BlockHeader( block_hash=f"block_{index}", block_number=index, block_time=1610000000 + index ) txs.sort(key=lambda i: i.block_header.block_number, reverse=True) txids = [i.txid for i in txs] txids.remove("txid_from_a_99") txids = ["txid_from_a_100", "txid_from_a_99", *txids] fake_provider_manager.search_txs_by_address.side_effect = lambda chain_code, address, paginate: [ i for i in txs if (not paginate.start_block_number or i.block_header.block_number >= paginate.start_block_number) and (not paginate.end_block_number or i.block_header.block_number <= paginate.end_block_number) ][: paginate.items_per_page] # 2. fetch the first page fake_time.time.return_value = 1620000000 local_actions = manager.query_actions_by_address("eth", "eth", "address_a") self.assertEqual( txids[:20], [i.txid for i in local_actions], ) self.assertEqual(201, models.TxAction.select().count()) fake_time.time.assert_called_once() fake_provider_manager.verify_address.assert_called_once_with("eth", "address_a") fake_provider_manager.search_txs_by_address.assert_called_once_with( "eth", "address_a", paginate=provider_data.TxPaginate(items_per_page=200) ) fake_time.time.reset_mock() fake_provider_manager.verify_address.reset_mock() fake_provider_manager.search_txs_by_address.reset_mock() # 3. fetch the following 9 pages without network for page_number in range(2, 11): local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=page_number)) self.assertEqual(201, models.TxAction.select().count()) self.assertEqual(200, len(local_actions)) self.assertEqual(txids[:200], [i.txid for i in local_actions]) self.assertEqual(9, fake_provider_manager.verify_address.call_count) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_not_called() # 4. fetch the remaining txs local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=11)) self.assertEqual(301, models.TxAction.select().count()) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_called_once_with( "eth", "address_a", paginate=provider_data.TxPaginate(end_block_number=100, items_per_page=200) ) fake_provider_manager.search_txs_by_address.reset_mock() # 5. fetch the following 4 pages without network for page_number in range(12, 16): local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=page_number)) self.assertEqual(301, models.TxAction.select().count()) self.assertEqual(300, len(local_actions)) self.assertEqual(txids[:300], [i.txid for i in local_actions]) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_not_called() fake_provider_manager.search_txs_by_address.reset_mock() # 6. fetch the final page local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=16)) self.assertEqual(301, len(local_actions)) self.assertEqual(txids, [i.txid for i in local_actions]) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_called_once_with( "eth", "address_a", paginate=provider_data.TxPaginate(end_block_number=0, items_per_page=200) ) fake_provider_manager.search_txs_by_address.reset_mock() # 7. suppose there are new data after a while, prepare new data send_from_a = [ provider_data.Transaction( txid=f"txid_from_a_{i}", status=provider_data.TransactionStatus.CONFIRM_SUCCESS, inputs=[provider_data.TransactionInput(address="address_a", value=10)], outputs=[provider_data.TransactionOutput(address="address_b", value=10)], fee=provider_data.TransactionFee(limit=1000, used=900, price_per_unit=20), nonce=i, ) for i in range(100, 300) ] send_to_a = [ provider_data.Transaction( txid=f"txid_to_a_{i}", status=provider_data.TransactionStatus.CONFIRM_SUCCESS, inputs=[provider_data.TransactionInput(address=f"address_{i}", value=10)], outputs=[provider_data.TransactionOutput(address="address_a", value=10)], fee=provider_data.TransactionFee(limit=1000, used=900, price_per_unit=20), nonce=0, ) for i in range(200, 300) ] new_txs = send_from_a[:100] + send_to_a + send_from_a[100:] for index, tx in enumerate(new_txs): tx.block_header = provider_data.BlockHeader( block_hash=f"block_{index}", block_number=index + 300, block_time=1640000000 + index ) new_txs.sort(key=lambda i: i.block_header.block_number, reverse=True) new_txids = [i.txid for i in new_txs] new_txs.extend(txs) txs.clear() txs.extend(new_txs) txs.sort(key=lambda i: i.block_header.block_number, reverse=True) new_txids.remove("txid_from_a_100") txids = [*new_txids, *txids] # 8. fetch the first page again fake_time.time.return_value = 1640000000 local_actions = manager.query_actions_by_address("eth", "eth", "address_a") self.assertEqual( txids[:20], [i.txid for i in local_actions], ) self.assertEqual(501, models.TxAction.select().count()) fake_time.time.assert_called_once() fake_provider_manager.search_txs_by_address.assert_called_once_with( "eth", "address_a", paginate=provider_data.TxPaginate(start_block_number=298, items_per_page=200) ) fake_time.time.reset_mock() fake_provider_manager.verify_address.reset_mock() fake_provider_manager.search_txs_by_address.reset_mock() # 9. fetch the following 9 pages without network for page_number in range(2, 11): local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=page_number)) self.assertEqual(501, models.TxAction.select().count()) self.assertEqual(200, len(local_actions)) self.assertEqual(txids[:200], [i.txid for i in local_actions]) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_not_called() # 10. fetch the remaining txs between 298 to 400 local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=11)) self.assertEqual(600, models.TxAction.select().count()) self.assertEqual(txids[:220], [i.txid for i in local_actions]) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_called_once_with( "eth", "address_a", paginate=provider_data.TxPaginate(start_block_number=298, end_block_number=400, items_per_page=200), ) fake_provider_manager.search_txs_by_address.reset_mock() # 11. fetch the following all pages for page_number in range(12, 31): local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=page_number)) self.maxDiff = None self.assertEqual(600, models.TxAction.select().count()) self.assertEqual(600, len(local_actions)) self.assertEqual(txids, [i.txid for i in local_actions]) fake_time.time.assert_not_called() fake_provider_manager.search_txs_by_address.assert_not_called() # 12. nothing anymore local_actions.extend(manager.query_actions_by_address("eth", "eth", "address_a", page_number=31)) self.assertEqual(600, models.TxAction.select().count()) self.assertEqual(600, len(local_actions)) fake_provider_manager.search_txs_by_address.assert_called_once_with( 'eth', 'address_a', paginate=provider_data.TxPaginate(end_block_number=0, page_number=1, items_per_page=200), ) fake_provider_manager.search_txs_by_address.reset_mock() # 13. check searching_address_as argument fake_time.time.return_value = 1650000000 self.assertEqual( [i for i in txids if "from" in i], [ i.txid for i in manager.query_actions_by_address( "eth", "eth", "address_a", searching_address_as="sender", items_per_page=600 ) ], ) fake_provider_manager.search_txs_by_address.assert_has_calls( [ call( 'eth', 'address_a', paginate=provider_data.TxPaginate(start_block_number=598, page_number=1, items_per_page=200), ), call( 'eth', 'address_a', paginate=provider_data.TxPaginate(end_block_number=0, page_number=1, items_per_page=400), ), ] ) fake_provider_manager.search_txs_by_address.reset_mock() fake_time.time.return_value = 1660000000 self.assertEqual( [i for i in txids if "to" in i], [ i.txid for i in manager.query_actions_by_address( "eth", "eth", "address_a", searching_address_as="receiver", items_per_page=600 ) ], ) fake_provider_manager.search_txs_by_address.assert_has_calls( [ call( 'eth', 'address_a', paginate=provider_data.TxPaginate(start_block_number=598, page_number=1, items_per_page=200), ), call( 'eth', 'address_a', paginate=provider_data.TxPaginate(end_block_number=0, page_number=1, items_per_page=400), ), ] ) @patch("electrum_gui.common.transaction.manager.provider_manager") @patch("electrum_gui.common.transaction.manager.coin_manager") @patch("electrum_gui.common.transaction.manager.time") def test_query_actions_by_address_check_max_times(self, fake_time, fake_coin_manager, fake_provider_manager): fake_time.time.return_value = 1610000000 fake_coin_manager.get_chain_info.return_value = Mock(chain_model=coin_data.ChainModel.ACCOUNT) fake_coin_manager.get_coin_info.return_value = Mock(code="eth") fake_coin_manager.query_coins_by_token_addresses.return_value = [] fake_provider_manager.verify_address.side_effect = lambda chain_code, address: Mock(normalized_address=address) txs = [ provider_data.Transaction( txid=f"txid_from_a_{i}", status=provider_data.TransactionStatus.CONFIRM_SUCCESS, inputs=[provider_data.TransactionInput(address="address_a", value=10)], outputs=[provider_data.TransactionOutput(address="address_b", value=10)], fee=provider_data.TransactionFee(limit=1000, used=900, price_per_unit=20), block_header=provider_data.BlockHeader( block_number=1000 + i, block_time=1600000000 + i, block_hash=f"block_{i}" ), nonce=i, ) for i in range(10) ] fake_provider_manager.search_txs_by_address.side_effect = lambda *args, **kwargs: [txs.pop()] if txs else [] local_actions = manager.query_actions_by_address("eth", "eth", "address_a") self.assertEqual(["txid_from_a_9", "txid_from_a_8", "txid_from_a_7"], [i.txid for i in local_actions]) fake_time.time.assert_called_once() fake_provider_manager.search_txs_by_address.assert_has_calls( [ call("eth", "address_a", paginate=provider_data.TxPaginate(items_per_page=200)), call("eth", "address_a", paginate=provider_data.TxPaginate(end_block_number=1009, items_per_page=400)), call("eth", "address_a", paginate=provider_data.TxPaginate(end_block_number=1008, items_per_page=800)), ] )
43.553366
119
0.56628
2,887
26,524
4.872186
0.087288
0.044362
0.045926
0.040879
0.80492
0.761979
0.736457
0.70809
0.696005
0.674321
0
0.034662
0.334339
26,524
608
120
43.625
0.762007
0.021339
0
0.572212
0
0
0.084384
0.015882
0
0
0
0
0.100548
1
0.010969
false
0
0.018282
0
0.034735
0
0
0
0
null
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
831a8341c6f37702a29a8562bee6fcbc36d73641
118
py
Python
news/admin.py
techacademypython/javascript_django
b8f30d91127e68140542bf24b05ac82a6051b00d
[ "MIT" ]
null
null
null
news/admin.py
techacademypython/javascript_django
b8f30d91127e68140542bf24b05ac82a6051b00d
[ "MIT" ]
12
2020-02-12T01:23:31.000Z
2022-03-11T23:56:47.000Z
news/admin.py
techacademypython/javascript_django
b8f30d91127e68140542bf24b05ac82a6051b00d
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Follow # Register your models here. admin.site.register(Follow)
19.666667
32
0.805085
17
118
5.588235
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.127119
118
5
33
23.6
0.92233
0.220339
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
1
0
0
5
832e47830c5b6d0bc64934d2b52daff5be269c6d
121
py
Python
register.py
pawangeek/CovidHack
3a57106eeb443550bb801a8120243b992bc960fb
[ "BSD-3-Clause" ]
null
null
null
register.py
pawangeek/CovidHack
3a57106eeb443550bb801a8120243b992bc960fb
[ "BSD-3-Clause" ]
null
null
null
register.py
pawangeek/CovidHack
3a57106eeb443550bb801a8120243b992bc960fb
[ "BSD-3-Clause" ]
null
null
null
from flask import Flask from flask_login import LoginManager from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy()
17.285714
39
0.834711
16
121
6.1875
0.4375
0.272727
0
0
0
0
0
0
0
0
0
0
0.140496
121
6
40
20.166667
0.951923
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
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
1
0
0
5
8338d394363fb78ede8d7e2273fcb1a6dbd7fce6
152
py
Python
material/curso_em_video/ex007.py
sergiodealencar/courses
c9d86b27b0185cc82624b01ed76653dbc12554a3
[ "MIT" ]
null
null
null
material/curso_em_video/ex007.py
sergiodealencar/courses
c9d86b27b0185cc82624b01ed76653dbc12554a3
[ "MIT" ]
null
null
null
material/curso_em_video/ex007.py
sergiodealencar/courses
c9d86b27b0185cc82624b01ed76653dbc12554a3
[ "MIT" ]
null
null
null
n1 = float(input('Qual é a primeira nota? ')) n2 = float(input('Qual é a segunda nota? ')) print('A média das duas notas é {:.1f}' .format(((n1+n2)/2)))
50.666667
61
0.631579
28
152
3.428571
0.642857
0.208333
0.291667
0.3125
0.333333
0
0
0
0
0
0
0.046512
0.151316
152
3
61
50.666667
0.697674
0
0
0
0
0
0.509804
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
835d5adcc8829740dc079c8280fc11db2e02a31b
1,048
py
Python
src/server/Clinvar/ClinvarCaller.py
ucsd-ccbb/Oncolist
a3c7ecde6f665a665873e5aa7be5bc3778f5b17e
[ "MIT" ]
null
null
null
src/server/Clinvar/ClinvarCaller.py
ucsd-ccbb/Oncolist
a3c7ecde6f665a665873e5aa7be5bc3778f5b17e
[ "MIT" ]
null
null
null
src/server/Clinvar/ClinvarCaller.py
ucsd-ccbb/Oncolist
a3c7ecde6f665a665873e5aa7be5bc3778f5b17e
[ "MIT" ]
null
null
null
__author__ = 'guorongxu' import subprocess def parse(workspace, data_set): subprocess.call(["qsub", "-o", "search_engine.log", "-e", "search_engine.log", workspace + "/codes/" + data_set + "/clinvar.sh", "parse", workspace + "/" + data_set]) def print_json(workspace, data_set): subprocess.call(["qsub", "-o", "search_engine.log", "-e", "search_engine.log", workspace + "/codes/" + data_set + "/clinvar.sh", "print_json", workspace + "/" + data_set]) ## To print schema def print_schema(workspace, data_set): subprocess.call(["qsub", "-pe", "smp", "1", "-o", "search_engine.log", "-e", "search_engine.log", workspace + "/codes/" + data_set + "/clinvar.sh", "print_schema", workspace, data_set]) ## To append id into json files def append_id(workspace, data_set): subprocess.call(["qsub", "-pe", "smp", "1", "-o", "search_engine.log", "-e", "search_engine.log", workspace + "/codes/" + data_set + "/clinvar.sh", "append_id", workspace, data_set])
49.904762
113
0.605916
129
1,048
4.689922
0.232558
0.138843
0.21157
0.171901
0.826446
0.671074
0.671074
0.671074
0.671074
0.671074
0
0.002364
0.192748
1,048
21
114
49.904762
0.712766
0.041985
0
0.285714
0
0
0.301
0
0
0
0
0
0
1
0.285714
false
0
0.071429
0
0.357143
0.285714
0
0
0
null
0
1
1
1
0
0
0
0
1
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
5
836287ed063d5b08b17cc64223fad261017440f3
105
py
Python
atcoder/abc121_a.py
andraantariksa/code-exercise-answer
69b7dbdc081cdb094cb110a72bc0c9242d3d344d
[ "MIT" ]
1
2019-11-06T15:17:48.000Z
2019-11-06T15:17:48.000Z
atcoder/abc121_a.py
andraantariksa/code-exercise-answer
69b7dbdc081cdb094cb110a72bc0c9242d3d344d
[ "MIT" ]
null
null
null
atcoder/abc121_a.py
andraantariksa/code-exercise-answer
69b7dbdc081cdb094cb110a72bc0c9242d3d344d
[ "MIT" ]
1
2018-11-13T08:43:26.000Z
2018-11-13T08:43:26.000Z
a = tuple(map(int, input().split())) b = tuple(map(int, input().split())) print((a[0]-b[0])*(a[1]-b[1]))
26.25
36
0.542857
21
105
2.714286
0.47619
0.280702
0.385965
0.561404
0.736842
0
0
0
0
0
0
0.041667
0.085714
105
3
37
35
0.552083
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
55d19c393aab2a1aeabfdcc2e75b3f2119beb882
132
py
Python
subway_detector/detec/__init__.py
No360201/detector
1f222e8f121fb908af90e1c7ab706d91fb5f8020
[ "MIT" ]
null
null
null
subway_detector/detec/__init__.py
No360201/detector
1f222e8f121fb908af90e1c7ab706d91fb5f8020
[ "MIT" ]
null
null
null
subway_detector/detec/__init__.py
No360201/detector
1f222e8f121fb908af90e1c7ab706d91fb5f8020
[ "MIT" ]
null
null
null
from subway_detector.detec.nms_iou import nms_iou import os import numpy as np import glob __all__ =['subway_det','nms_iou']
18.857143
50
0.765152
22
132
4.181818
0.636364
0.195652
0.26087
0
0
0
0
0
0
0
0
0
0.159091
132
6
51
22
0.828829
0
0
0
0
0
0.134921
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
55ddb712e0871fdac077dfe76e83880da84310f9
125
py
Python
noisy_outlier/hyperopt/__init__.py
JanDiers/self-supervised-outlier
4ca9f8b3c9a663b7c51f771533197e5edc678953
[ "MIT" ]
2
2021-07-16T12:27:11.000Z
2021-08-18T11:06:25.000Z
noisy_outlier/hyperopt/__init__.py
JanDiers/self-supervised-outlier
4ca9f8b3c9a663b7c51f771533197e5edc678953
[ "MIT" ]
null
null
null
noisy_outlier/hyperopt/__init__.py
JanDiers/self-supervised-outlier
4ca9f8b3c9a663b7c51f771533197e5edc678953
[ "MIT" ]
null
null
null
from .hyperopt import HyperparameterOptimizer, PercentileScoring __all__ = ['HyperparameterOptimizer', 'PercentileScoring']
31.25
64
0.84
8
125
12.625
0.75
0.792079
0
0
0
0
0
0
0
0
0
0
0.08
125
3
65
41.666667
0.878261
0
0
0
0
0
0.32
0.184
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
55e51dd2f8c5eaff8b5b00b06a66028986f01fca
32,985
py
Python
AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Periodic.py
CStudios15/o3de
9dc85000a3ec1a6c6633d718f5c455ab11a46818
[ "Apache-2.0", "MIT" ]
1
2021-08-11T02:20:46.000Z
2021-08-11T02:20:46.000Z
AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Periodic.py
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
null
null
null
AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Periodic.py
RoddieKieley/o3de
e804fd2a4241b039a42d9fa54eaae17dc94a7a92
[ "Apache-2.0", "MIT" ]
null
null
null
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT """ # This suite consists of all test cases that are passing and have been verified. import pytest import os import sys from .utils.FileManagement import FileManagement as fm from ly_test_tools import LAUNCHERS sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared') from base import TestAutomationBase revert_physics_config = fm.file_revert_list(['physxdebugconfiguration.setreg', 'physxdefaultsceneconfiguration.setreg', 'physxsystemconfiguration.setreg'], 'AutomatedTesting/Registry') @pytest.mark.SUITE_periodic @pytest.mark.parametrize("launcher_platform", ['windows_editor']) @pytest.mark.parametrize("project", ["AutomatedTesting"]) class TestAutomation(TestAutomationBase): @revert_physics_config def test_Terrain_NoPhysTerrainComponentNoCollision(self, request, workspace, editor, launcher_platform): from .tests.terrain import Terrain_NoPhysTerrainComponentNoCollision as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_InitialLinearVelocity(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_InitialLinearVelocity as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_StartGravityEnabledWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_StartGravityEnabledWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_KinematicModeWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_KinematicModeWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_LinearDampingForceOnRigidBodies(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_LinearDampingForceOnRigidBodies as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_SimpleDragForceOnRigidBodies(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_SimpleDragForceOnRigidBodies as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_CapsuleShapedForce(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_CapsuleShapedForce as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ImpulsesCapsuleShapedRigidBody(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ImpulsesCapsuleShapedRigidBody as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_MomentOfInertiaManualSetting(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_MomentOfInertiaManualSetting as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_COM_ManualSettingWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_COM_ManualSettingWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_AddRigidBodyComponent(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_AddRigidBodyComponent as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_SplineForceOnRigidBodies(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_SplineForceOnRigidBodies as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Material_RestitutionCombine.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_RestitutionCombine(self, request, workspace, editor, launcher_platform): from .tests.material import Material_RestitutionCombine as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Material_FrictionCombine.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_FrictionCombine(self, request, workspace, editor, launcher_platform): from .tests.material import Material_FrictionCombine as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Collider_ColliderPositionOffset(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_ColliderPositionOffset as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_AngularDampingAffectsRotation(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_AngularDampingAffectsRotation as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Physics_VerifyColliderRigidBodyMeshAndTerrainWorkTogether(self, request, workspace, editor, launcher_platform): from .tests import Physics_VerifyColliderRigidBodyMeshAndTerrainWorkTogether as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_MultipleForcesInSameComponentCombineForces(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_MultipleForcesInSameComponentCombineForces as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ImpulsesPxMeshShapedRigidBody(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ImpulsesPxMeshShapedRigidBody as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ScriptCanvas_TriggerEvents(self, request, workspace, editor, launcher_platform): from .tests.script_canvas import ScriptCanvas_TriggerEvents as test_module # FIXME: expected_lines = test_module.LogLines.expected_lines self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ZeroPointForceDoesNothing(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ZeroPointForceDoesNothing as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ZeroWorldSpaceForceDoesNothing(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ZeroWorldSpaceForceDoesNothing as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ZeroLinearDampingDoesNothing(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ZeroLinearDampingDoesNothing as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_MovingForceRegionChangesNetForce(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_MovingForceRegionChangesNetForce as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ScriptCanvas_CollisionEvents(self, request, workspace, editor, launcher_platform): from .tests.script_canvas import ScriptCanvas_CollisionEvents as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_DirectionHasNoAffectOnTotalForce(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_DirectionHasNoAffectOnTotalForce as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_StartAsleepWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_StartAsleepWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_SliceFileInstantiates(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_SliceFileInstantiates as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ZeroLocalSpaceForceDoesNothing(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ZeroLocalSpaceForceDoesNothing as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ZeroSimpleDragForceDoesNothing(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ZeroSimpleDragForceDoesNothing as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_COM_ComputingWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_COM_ComputingWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_MassDifferentValuesWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_MassDifferentValuesWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Material_RestitutionCombinePriorityOrder.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_RestitutionCombinePriorityOrder(self, request, workspace, editor, launcher_platform): from .tests.material import Material_RestitutionCombinePriorityOrder as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_SplineRegionWithModifiedTransform(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_SplineRegionWithModifiedTransform as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ScriptCanvas_ShapeCast(self, request, workspace, editor, launcher_platform): from .tests.script_canvas import ScriptCanvas_ShapeCast as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_InitialAngularVelocity(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_InitialAngularVelocity as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ZeroSplineForceDoesNothing(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ZeroSplineForceDoesNothing as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Physics_DynamicSliceWithPhysNotSpawnsStaticSlice(self, request, workspace, editor, launcher_platform): from .tests import Physics_DynamicSliceWithPhysNotSpawnsStaticSlice as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_PositionOffset(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_PositionOffset as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Material_FrictionCombinePriorityOrder.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_FrictionCombinePriorityOrder(self, request, workspace, editor, launcher_platform): from .tests.material import Material_FrictionCombinePriorityOrder as test_module self._run_test(request, workspace, editor, test_module) @pytest.mark.xfail( reason="Something with the CryRenderer disabling is causing this test to fail now.") @revert_physics_config def test_Ragdoll_LevelSwitchDoesNotCrash(self, request, workspace, editor, launcher_platform): from .tests.ragdoll import Ragdoll_LevelSwitchDoesNotCrash as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_MultipleComponentsCombineForces(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_MultipleComponentsCombineForces as test_module self._run_test(request, workspace, editor, test_module) # Marking the test as an expected failure due to sporadic failure on Automated Review: LYN-2580 # The test still runs, but a failure of the test doesn't result in the test run failing @pytest.mark.xfail( reason="This test needs new physics asset with multiple materials to be more stable.") @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg', 'Material_PerFaceMaterialGetsCorrectMaterial.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_PerFaceMaterialGetsCorrectMaterial(self, request, workspace, editor, launcher_platform): from .tests.material import Material_PerFaceMaterialGetsCorrectMaterial as test_module self._run_test(request, workspace, editor, test_module) @pytest.mark.xfail( reason="This test will sometimes fail as the ball will continue to roll before the timeout is reached.") @revert_physics_config def test_RigidBody_SleepWhenBelowKineticThreshold(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_SleepWhenBelowKineticThreshold as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_COM_NotIncludesTriggerShapes(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_COM_NotIncludesTriggerShapes as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Material_NoEffectIfNoColliderShape(self, request, workspace, editor, launcher_platform): from .tests.material import Material_NoEffectIfNoColliderShape as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Collider_TriggerPassThrough(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_TriggerPassThrough as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_SetGravityWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_SetGravityWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Material_CharacterController.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_CharacterController(self, request, workspace, editor, launcher_platform): from .tests.material import Material_CharacterController as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Material_EmptyLibraryUsesDefault(self, request, workspace, editor, launcher_platform): from .tests.material import Material_EmptyLibraryUsesDefault as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_NoQuiverOnHighLinearDampingForce(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_NoQuiverOnHighLinearDampingForce as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_RigidBody_ComputeInertiaWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_ComputeInertiaWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ScriptCanvas_PostPhysicsUpdate(self, request, workspace, editor, launcher_platform): from .tests.script_canvas import ScriptCanvas_PostPhysicsUpdate as test_module # Fixme: unexpected_lines = ["Assert"] + test_module.Lines.unexpected self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Collider_NoneCollisionGroupSameLayerNotCollide.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Collider_NoneCollisionGroupSameLayerNotCollide(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_NoneCollisionGroupSameLayerNotCollide as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Collider_SameCollisionGroupSameCustomLayerCollide.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Collider_SameCollisionGroupSameCustomLayerCollide(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_SameCollisionGroupSameCustomLayerCollide as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxdefaultsceneconfiguration.setreg','ScriptCanvas_PostUpdateEvent.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_ScriptCanvas_PostUpdateEvent(self, request, workspace, editor, launcher_platform): from .tests.script_canvas import ScriptCanvas_PostUpdateEvent as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Material_Restitution.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Material_Restitution(self, request, workspace, editor, launcher_platform): from .tests.material import Material_Restitution as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxdefaultsceneconfiguration.setreg', 'ScriptCanvas_PreUpdateEvent.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_ScriptCanvas_PreUpdateEvent(self, request, workspace, editor, launcher_platform): from .tests.script_canvas import ScriptCanvas_PreUpdateEvent as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_PxMeshShapedForce(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_PxMeshShapedForce as test_module self._run_test(request, workspace, editor, test_module) # Marking the Test as expected to fail using the xfail decorator due to sporadic failure on Automated Review: SPEC-3146 # The test still runs, but a failure of the test doesn't result in the test run failing @pytest.mark.xfail(reason="Test Sporadically fails with message [ NOT FOUND ] Success: Bar1 : Expected angular velocity") @revert_physics_config def test_RigidBody_MaxAngularVelocityWorks(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_MaxAngularVelocityWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Joints_HingeSoftLimitsConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_HingeSoftLimitsConstrained as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Joints_BallSoftLimitsConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_BallSoftLimitsConstrained as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Joints_BallLeadFollowerCollide(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_BallLeadFollowerCollide as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Collider_AddingNewGroupWorks.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Collider_AddingNewGroupWorks(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_AddingNewGroupWorks as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ShapeCollider_InactiveWhenNoShapeComponent(self, request, workspace, editor, launcher_platform): from .tests.shape_collider import ShapeCollider_InactiveWhenNoShapeComponent as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Collider_CheckDefaultShapeSettingIsPxMesh(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_CheckDefaultShapeSettingIsPxMesh as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ShapeCollider_LargeNumberOfShapeCollidersWontCrashEditor(self, request, workspace, editor, launcher_platform): from .tests.shape_collider import ShapeCollider_LargeNumberOfShapeCollidersWontCrashEditor as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Collider_SphereShapeEditing(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_SphereShapeEditing as test_module self._run_test(request, workspace, editor, test_module, extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]) @revert_physics_config def test_Collider_BoxShapeEditing(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_BoxShapeEditing as test_module self._run_test(request, workspace, editor, test_module, extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]) @revert_physics_config def test_Collider_CapsuleShapeEditing(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_CapsuleShapeEditing as test_module self._run_test(request, workspace, editor, test_module, extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]) def test_ForceRegion_WithNonTriggerColliderWarning(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_WithNonTriggerColliderWarning as test_module # Fixme: expected_lines = ["[Warning] (PhysX Force Region) - Please ensure collider component marked as trigger exists in entity"] self._run_test(request, workspace, editor, test_module) def test_ForceRegion_WorldSpaceForceOnRigidBodies(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_WorldSpaceForceOnRigidBodies as test_module self._run_test(request, workspace, editor, test_module) def test_ForceRegion_PointForceOnRigidBodies(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_PointForceOnRigidBodies as test_module self._run_test(request, workspace, editor, test_module) def test_ForceRegion_SphereShapedForce(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_SphereShapedForce as test_module self._run_test(request, workspace, editor, test_module) def test_ForceRegion_RotationalOffset(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_RotationalOffset as test_module self._run_test(request, workspace, editor, test_module) def test_Material_LibraryClearingAssignsDefault(self, request, workspace, editor, launcher_platform): from .tests.material import Material_LibraryClearingAssignsDefault as test_module self._run_test(request, workspace, editor, test_module) def test_Collider_AddColliderComponent(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_AddColliderComponent as test_module self._run_test(request, workspace, editor, test_module) @pytest.mark.xfail( reason="This will fail due to this issue ATOM-15487.") def test_Collider_PxMeshAutoAssignedWhenModifyingRenderMeshComponent(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_PxMeshAutoAssignedWhenModifyingRenderMeshComponent as test_module self._run_test(request, workspace, editor, test_module) def test_Collider_PxMeshAutoAssignedWhenAddingRenderMeshComponent(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_PxMeshAutoAssignedWhenAddingRenderMeshComponent as test_module self._run_test(request, workspace, editor, test_module) def test_Collider_MultipleSurfaceSlots(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_MultipleSurfaceSlots as test_module self._run_test(request, workspace, editor, test_module) def test_Collider_PxMeshNotAutoAssignedWhenNoPhysicsFbx(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_PxMeshNotAutoAssignedWhenNoPhysicsFbx as test_module self._run_test(request, workspace, editor, test_module) def test_RigidBody_EnablingGravityWorksPoC(self, request, workspace, editor, launcher_platform): from .tests.rigid_body import RigidBody_EnablingGravityWorksPoC as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config @fm.file_override('physxsystemconfiguration.setreg','Collider_CollisionGroupsWorkflow.setreg_override', 'AutomatedTesting/Registry', search_subdirs=True) def test_Collider_CollisionGroupsWorkflow(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_CollisionGroupsWorkflow as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Collider_ColliderRotationOffset(self, request, workspace, editor, launcher_platform): from .tests.collider import Collider_ColliderRotationOffset as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ForceRegion_ParentChildForcesCombineForces(self, request, workspace, editor, launcher_platform): from .tests.force_region import ForceRegion_ParentChildForcesCombineForces as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_ShapeCollider_CanBeAddedWitNoWarnings(self, request, workspace, editor, launcher_platform): from .tests.shape_collider import ShapeCollider_CanBeAddedWitNoWarnings as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Physics_UndoRedoWorksOnEntityWithPhysComponents(self, request, workspace, editor, launcher_platform): from .tests import Physics_UndoRedoWorksOnEntityWithPhysComponents as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_Fixed2BodiesConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_Fixed2BodiesConstrained as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_Hinge2BodiesConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_Hinge2BodiesConstrained as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_Ball2BodiesConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_Ball2BodiesConstrained as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_FixedBreakable(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_FixedBreakable as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_HingeBreakable(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_HingeBreakable as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_BallBreakable(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_BallBreakable as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_HingeNoLimitsConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_HingeNoLimitsConstrained as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_BallNoLimitsConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_BallNoLimitsConstrained as test_module self._run_test(request, workspace, editor, test_module) def test_Joints_GlobalFrameConstrained(self, request, workspace, editor, launcher_platform): from .tests.joints import Joints_GlobalFrameConstrained as test_module self._run_test(request, workspace, editor, test_module) @revert_physics_config def test_Material_DefaultLibraryUpdatedAcrossLevels(self, request, workspace, editor, launcher_platform): @fm.file_override("physxsystemconfiguration.setreg", "Material_DefaultLibraryUpdatedAcrossLevels_before.setreg", "AutomatedTesting", search_subdirs=True) def levels_before(self, request, workspace, editor, launcher_platform): from .tests.material import Material_DefaultLibraryUpdatedAcrossLevels_before as test_module_0 self._run_test(request, workspace, editor, test_module_0) # File override replaces the previous physxconfiguration file with another where the only difference is the default material library @fm.file_override("physxsystemconfiguration.setreg", "Material_DefaultLibraryUpdatedAcrossLevels_after.setreg", "AutomatedTesting", search_subdirs=True) def levels_after(self, request, workspace, editor, launcher_platform): from .tests.material import Material_DefaultLibraryUpdatedAcrossLevels_after as test_module_1 self._run_test(request, workspace, editor, test_module_1) levels_before(self, request, workspace, editor, launcher_platform) levels_after(self, request, workspace, editor, launcher_platform)
59.432432
184
0.783235
3,514
32,985
7.041264
0.084519
0.128683
0.176939
0.106131
0.732975
0.729863
0.722427
0.70917
0.696318
0.693449
0
0.000969
0.155161
32,985
555
185
59.432432
0.886927
0.031893
0
0.459397
0
0
0.072751
0.058151
0
0
0
0.001802
0
1
0.229698
false
0.00464
0.241299
0
0.473318
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
1
0
0
0
0
0
0
0
5
55ed668f2dfa2add4ea878ac8e23c93399b1113f
130
py
Python
python-sdk/nuscenes/eval/tracking/algo.py
tanjiangyuan/Classification_nuScence
b94c4b0b6257fc1c048a676e3fd9e71183108d53
[ "Apache-2.0" ]
null
null
null
python-sdk/nuscenes/eval/tracking/algo.py
tanjiangyuan/Classification_nuScence
b94c4b0b6257fc1c048a676e3fd9e71183108d53
[ "Apache-2.0" ]
null
null
null
python-sdk/nuscenes/eval/tracking/algo.py
tanjiangyuan/Classification_nuScence
b94c4b0b6257fc1c048a676e3fd9e71183108d53
[ "Apache-2.0" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:ee714db1d4161b00d01db3934e3bce2eaf82c47d91f196a01d17332d78b4c460 size 15155
32.5
75
0.884615
13
130
8.846154
1
0
0
0
0
0
0
0
0
0
0
0.395161
0.046154
130
3
76
43.333333
0.532258
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
362f8716e6fab0fad21ee0a5ca1710c38d481508
45
py
Python
actions/exceptions.py
matteobarbieri/libtcod-tutorial
2be59978483d1c754b736a0fe96c9554e9ba8547
[ "MIT" ]
1
2019-03-09T14:20:51.000Z
2019-03-09T14:20:51.000Z
actions/exceptions.py
matteobarbieri/libtcod-tutorial
2be59978483d1c754b736a0fe96c9554e9ba8547
[ "MIT" ]
null
null
null
actions/exceptions.py
matteobarbieri/libtcod-tutorial
2be59978483d1c754b736a0fe96c9554e9ba8547
[ "MIT" ]
null
null
null
class ShowMenuException(Exception): pass
15
35
0.777778
4
45
8.75
1
0
0
0
0
0
0
0
0
0
0
0
0.155556
45
2
36
22.5
0.921053
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
5
3698516a3b595f058cb08d50b6beb1a3186c196a
420
py
Python
ilurl/agents/ql/schedules.py
CubeSkyy/ILU-RL
676d88587e1d8638487de1b5a3f8785a7375ad1a
[ "MIT" ]
null
null
null
ilurl/agents/ql/schedules.py
CubeSkyy/ILU-RL
676d88587e1d8638487de1b5a3f8785a7375ad1a
[ "MIT" ]
null
null
null
ilurl/agents/ql/schedules.py
CubeSkyy/ILU-RL
676d88587e1d8638487de1b5a3f8785a7375ad1a
[ "MIT" ]
2
2021-03-13T15:38:05.000Z
2021-05-08T22:25:36.000Z
import numpy as np class PowerSchedule(object): def __init__(self, power_coef): """ Power schedule (input t): 1 / ((1 + t)**power_coef) Parameters: ---------- power_coef: float power coefficient """ self.power_coef = power_coef def value(self, t): """See Schedule.value""" return 1 / np.power(1 + t, self.power_coef)
23.333333
59
0.52381
48
420
4.375
0.458333
0.257143
0.185714
0.171429
0
0
0
0
0
0
0
0.014493
0.342857
420
18
60
23.333333
0.746377
0.319048
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
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
1
0
0
0
0
1
0
0
5
36beafa285faa2868a6c9631ada317bd75bce6e3
5,050
py
Python
block_comment/tests/test_content.py
gabrielhurley/django-block-comment
a03e4587b6b2637206efd74c7d76c7a40e0f34bf
[ "BSD-3-Clause" ]
null
null
null
block_comment/tests/test_content.py
gabrielhurley/django-block-comment
a03e4587b6b2637206efd74c7d76c7a40e0f34bf
[ "BSD-3-Clause" ]
null
null
null
block_comment/tests/test_content.py
gabrielhurley/django-block-comment
a03e4587b6b2637206efd74c7d76c7a40e0f34bf
[ "BSD-3-Clause" ]
1
2019-05-03T06:11:27.000Z
2019-05-03T06:11:27.000Z
TEXT_START = """ <h1>This is the heading</h1> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</p> """ TEXT_END = """ <p>Morbi interdum mollis sapien. Sed ac risus. Phasellus lacinia, magna a ullamcorper laoreet, lectus arcu pulvinar risus, vitae facilisis libero dolor a purus. Sed vel lacus. Mauris nibh felis, adipiscing varius, adipiscing in, lacinia vel, tellus. Suspendisse ac urna. Etiam pellentesque mauris ut lectus. Nunc tellus ante, mattis eget, gravida vitae, ultricies ac, leo. Integer leo pede, ornare a, lacinia eu, vulputate vel, nisl.</p> <ul> <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li> <li>Aliquam tincidunt mauris eu risus.</li> <li>Vestibulum auctor dapibus neque.</li> <li>Nunc dignissim risus id metus.</li> </ul> <p>Suspendisse mauris. Fusce accumsan mollis eros. Pellentesque a diam sit amet mi ullamcorper vehicula. Integer adipiscing risus a sem. Nullam quis massa sit amet nibh viverra malesuada. Nunc sem lacus, accumsan quis, faucibus non, congue vel, arcu. Ut scelerisque hendrerit tellus. Integer sagittis. Vivamus a mauris eget arcu gravida tristique. Nunc iaculis mi in ante. Vivamus imperdiet nibh feugiat est.</p> <p>Ut convallis, sem sit amet interdum consectetuer, odio augue aliquam leo, nec dapibus tortor nibh sed augue. Integer eu magna sit amet metus fermentum posuere. Morbi sit amet nulla sed dolor elementum imperdiet. Quisque fermentum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque adipiscing eros ut libero. Ut condimentum mi vel tellus. Suspendisse laoreet. Fusce ut est sed dolor gravida convallis. Morbi vitae ante. Vivamus ultrices luctus nunc. Suspendisse et dolor. Etiam dignissim. Proin malesuada adipiscing lacus. Donec metus. Curabitur gravida.</p> """ ORIGINAL_TEXT = """ <p>Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """ EXTRA_P = """ <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p> """ FULL_TEXT = TEXT_START + ORIGINAL_TEXT + TEXT_END ONE_CHARACTER = """ <p>Se egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """ ONE_WORD = """ <p>Sed, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """ TWO_WORDS = """ <p>Sed et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Praesent elementum hendrerit tortor. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """ ONE_SENTENCE = """ <p>Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Morbi purus libero, faucibus adipiscing, commodo quis, gravida id, est. Sed lectus. Sed semper lorem at felis. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """ LONG_SENTENCE = """ <p>Sed egestas, ante et vulputate volutpat, eros pede semper est, vitae luctus metus libero eu augue. Vestibulum volutpat, lacus a ultrices sagittis, mi neque euismod dui, eu pulvinar nunc sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """ MULTIPLE_SENTENCES = """ <p>Sed egestas, ante et vulputate volutpat, eros pede semper est, sapien ornare nisl. Phasellus pede arcu, dapibus eu, fermentum et, dapibus sed, urna.</p> """
5,050
5,050
0.774257
749
5,050
5.201602
0.212283
0.014374
0.034138
0.041324
0.547741
0.547741
0.547741
0.547741
0.535421
0.510267
0
0.000466
0.150891
5,050
1
5,050
5,050
0.908116
0
0
0.25
0
0.3
0.945753
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
36da5eaf00978dc0a85ab6818c0c15c6c7c33799
200
py
Python
app/huawei/HuaweiException.py
lxy235/espider
b23ef18cd2be1d9c5f4ff3ca04fceb4eec8f7847
[ "Apache-2.0" ]
null
null
null
app/huawei/HuaweiException.py
lxy235/espider
b23ef18cd2be1d9c5f4ff3ca04fceb4eec8f7847
[ "Apache-2.0" ]
null
null
null
app/huawei/HuaweiException.py
lxy235/espider
b23ef18cd2be1d9c5f4ff3ca04fceb4eec8f7847
[ "Apache-2.0" ]
null
null
null
#! /usr/bin env python # coding:utf-8 class HuaweiException(Exception): def __init__(self, code, msg): Exception.__init__(self, code, msg) self.code = code self.msg = msg
22.222222
43
0.63
26
200
4.538462
0.576923
0.20339
0.20339
0.254237
0
0
0
0
0
0
0
0.006667
0.25
200
8
44
25
0.78
0.17
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
36f62cc3d2458f79ce7e66d18638b1e3eb3d0796
69
py
Python
samples/src/main/resources/datasets/python/100.py
sritchie/kotlingrad
8165ed1cd77220a5347c58cded4c6f2bcf22ee30
[ "Apache-2.0" ]
11
2020-12-19T01:19:44.000Z
2021-12-25T20:43:33.000Z
src/main/resources/datasets/python/100.py
breandan/katholic
081c39f3acc73ff41f5865563debe78a36e1038f
[ "Apache-2.0" ]
null
null
null
src/main/resources/datasets/python/100.py
breandan/katholic
081c39f3acc73ff41f5865563debe78a36e1038f
[ "Apache-2.0" ]
2
2021-01-25T07:59:20.000Z
2021-08-07T07:13:49.000Z
def ifExpr6(a, b, c): return (a if a else a) if (b and b) else c
23
46
0.57971
17
69
2.352941
0.529412
0.15
0
0
0
0
0
0
0
0
0
0.020408
0.289855
69
2
47
34.5
0.795918
0
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
0.5
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
1
1
0
0
5
7fc1a20000a31876393ed2ad456a35826fdac181
133
py
Python
main.py
dy-dx-1/fantastic-computing-machine
e6a7d8f5783da5c435c79a731d1f314d509a4488
[ "MIT" ]
null
null
null
main.py
dy-dx-1/fantastic-computing-machine
e6a7d8f5783da5c435c79a731d1f314d509a4488
[ "MIT" ]
null
null
null
main.py
dy-dx-1/fantastic-computing-machine
e6a7d8f5783da5c435c79a731d1f314d509a4488
[ "MIT" ]
null
null
null
from assets.gui import set_up_grid, root def main(): set_up_grid() root.mainloop() if __name__ == "__main__": main()
19
41
0.646617
19
133
3.894737
0.684211
0.135135
0.243243
0.351351
0
0
0
0
0
0
0
0
0.225564
133
7
42
19
0.718447
0
0
0
0
0
0.059701
0
0
0
0
0
0
1
0.166667
true
0
0.166667
0
0.333333
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
7fca1c791fcc4ad40a47a6908cfc647e8d38d688
2,295
py
Python
tests/test_auto_estimator.py
brightcoder01/models
bf95351ea51b5dfb192e42a02117a5fade498af3
[ "Apache-2.0" ]
29
2019-05-05T09:08:10.000Z
2021-11-25T02:35:56.000Z
tests/test_auto_estimator.py
brightcoder01/models
bf95351ea51b5dfb192e42a02117a5fade498af3
[ "Apache-2.0" ]
33
2019-04-29T08:38:26.000Z
2022-02-10T00:17:32.000Z
tests/test_auto_estimator.py
brightcoder01/models
bf95351ea51b5dfb192e42a02117a5fade498af3
[ "Apache-2.0" ]
23
2019-04-29T05:38:35.000Z
2021-06-30T15:28:35.000Z
import sqlflow_models from tests.base import BaseTestCases, train_input_fn, eval_input_fn import sys import tensorflow as tf import unittest import numpy as np from sklearn.datasets import load_iris, load_boston class TestAutoClassifier(BaseTestCases.BaseEstimatorTest): def setUp(self): x, y = load_iris(return_X_y=True) feature_column_names = ['col_{}'.format(d) for d in range(x.shape[1])] self.features = {} for feature_name, feature_values in zip(feature_column_names, list(x.T)): self.features[feature_name] = feature_values self.label = y feature_columns = [tf.feature_column.numeric_column(key) for key in self.features] self.model_class = sqlflow_models.AutoClassifier self.model = sqlflow_models.AutoClassifier(feature_columns=feature_columns, n_classes=3) class TestAutoBinaryClassifier(BaseTestCases.BaseEstimatorTest): def setUp(self): x, y = load_iris(return_X_y=True) x = np.array([x[i] for i, v in enumerate(y) if v != 2]) y = np.array([y[i] for i, v in enumerate(y) if v != 2]) feature_column_names = ['col_{}'.format(d) for d in range(x.shape[1])] self.features = {} for feature_name, feature_values in zip(feature_column_names, list(x.T)): self.features[feature_name] = feature_values self.label = y feature_columns = [tf.feature_column.numeric_column(key) for key in self.features] self.model_class = sqlflow_models.AutoClassifier self.model = sqlflow_models.AutoClassifier(feature_columns=feature_columns) class TestAutoRegressor(BaseTestCases.BaseEstimatorTest): def setUp(self): x, y = load_boston(return_X_y=True) feature_column_names = ['col_{}'.format(d) for d in range(x.shape[1])] self.features = {} for feature_name, feature_values in zip(feature_column_names, list(x.T)): self.features[feature_name] = feature_values self.label = y feature_columns = [tf.feature_column.numeric_column(key) for key in self.features] self.model_class = sqlflow_models.AutoRegressor self.model = sqlflow_models.AutoRegressor(feature_columns=feature_columns) if __name__ == '__main__': unittest.main()
43.301887
96
0.697168
310
2,295
4.916129
0.222581
0.076772
0.070866
0.094488
0.750656
0.750656
0.750656
0.750656
0.71916
0.71916
0
0.003284
0.203922
2,295
52
97
44.134615
0.83087
0
0
0.568182
0
0
0.011334
0
0
0
0
0
0
1
0.068182
false
0
0.159091
0
0.295455
0
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
7fd51eaff4d28865f5570856050b92126ea314f2
174
py
Python
python/8kyu/how_many_lightsaber_do_you_own.py
Sigmanificient/codewars
b34df4bf55460d312b7ddf121b46a707b549387a
[ "MIT" ]
3
2021-06-08T01:57:13.000Z
2021-06-26T10:52:47.000Z
python/8kyu/how_many_lightsaber_do_you_own.py
Sigmanificient/codewars
b34df4bf55460d312b7ddf121b46a707b549387a
[ "MIT" ]
null
null
null
python/8kyu/how_many_lightsaber_do_you_own.py
Sigmanificient/codewars
b34df4bf55460d312b7ddf121b46a707b549387a
[ "MIT" ]
2
2021-06-10T21:20:13.000Z
2021-06-30T10:13:26.000Z
"""Kata url: https://www.codewars.com/kata/51f9d93b4095e0a7200001b8.""" def how_many_light_sabers_do_you_own(name: str = '') -> int: return 0 if name == "Zach" else 18
29
71
0.701149
26
174
4.461538
0.923077
0
0
0
0
0
0
0
0
0
0
0.14
0.137931
174
5
72
34.8
0.633333
0.373563
0
0
0
0
0.038835
0
0
0
0
0
0
1
0.5
false
0
0
0.5
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
1
1
0
0
5
7fdc2b851b45d2d1c3c01cca16f4f54d9be14c82
161
py
Python
scraproxy/scrapers/__init__.py
pietrodll/proxy-scraper
517060a1050afcf13617b2ac757724d8baba87e0
[ "MIT" ]
1
2020-06-02T14:20:50.000Z
2020-06-02T14:20:50.000Z
scraproxy/scrapers/__init__.py
pietrodll/proxy-scraper
517060a1050afcf13617b2ac757724d8baba87e0
[ "MIT" ]
null
null
null
scraproxy/scrapers/__init__.py
pietrodll/proxy-scraper
517060a1050afcf13617b2ac757724d8baba87e0
[ "MIT" ]
null
null
null
"""This module contains scrapers. Each scraper is specific to a website""" from .free_proxy_list import FreeProxyList from .freeproxylists import FreeProxyLists
40.25
74
0.826087
21
161
6.238095
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.118012
161
4
75
40.25
0.922535
0.42236
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
1
0
0
5
3d0433a31c32a789ddd4378c765cc90abf4d83e0
38
py
Python
clustering_methods/__init__.py
c00k1ez/clustering_methods
42668db3a610d608f180e34023aa09e46d010d07
[ "MIT" ]
1
2020-05-24T02:50:45.000Z
2020-05-24T02:50:45.000Z
clustering_methods/__init__.py
c00k1ez/clustering_methods
42668db3a610d608f180e34023aa09e46d010d07
[ "MIT" ]
null
null
null
clustering_methods/__init__.py
c00k1ez/clustering_methods
42668db3a610d608f180e34023aa09e46d010d07
[ "MIT" ]
null
null
null
from .clustering_methods import KMeans
38
38
0.894737
5
38
6.6
1
0
0
0
0
0
0
0
0
0
0
0
0.078947
38
1
38
38
0.942857
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
3d0c9ee95f1ef74ea1536329b97ff4b7895cc805
51,321
py
Python
BMSSlibmod/InduciblePromoterLibrary_.py
EngBioNUS/BMSSlib
d521362f4ee66b937ec1e46a0515ed4adefb83e8
[ "Apache-2.0" ]
6
2019-05-02T20:42:52.000Z
2022-02-20T04:58:09.000Z
BMSSlibmod/InduciblePromoterLibrary_.py
EngBioNUS/BMSSlib
d521362f4ee66b937ec1e46a0515ed4adefb83e8
[ "Apache-2.0" ]
null
null
null
BMSSlibmod/InduciblePromoterLibrary_.py
EngBioNUS/BMSSlib
d521362f4ee66b937ec1e46a0515ed4adefb83e8
[ "Apache-2.0" ]
7
2020-02-03T02:57:17.000Z
2021-01-04T03:30:05.000Z
# -*- coding: utf-8 -*- """ Released on April 29, 2019 @author: Yeoh Jing Wui <bchyjw@nus.edu.sg>; Ivan Ng Kai Boon; Poh Chueh Loo <poh.chuehloo@nus.edu.sg> The code is part of BMSS software. Copyright (c) 2019, National University of Singapore. """ import numpy as np import constrNMPy as cNM import matplotlib.pyplot as plt from scipy.integrate import odeint from scipy.optimize import differential_evolution class InduciblePromoterLibrary: ### ODE Model for Constant Inducible Promoter ### def solveODE_ConstantInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables mRNA = y[0] # Col 0 of ODESoln Pep = y[1] # Col 1 of ODESoln # Parameters n = param[0] K_ind = param[1] syn_mRNA = param[2] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[3] deg_Pep = param[4] # Differential equations dmRNA_dt = '(syn_mRNA*((inducer**n)/(inducer**n+K_ind**n)))-(deg_mRNA * mRNA)' dPep_dt = '(syn_Pep*mRNA)-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') # Return differential equations solution def solveODE_ConstantInducerKMat(y, t, inducer, param, Operation = 'Solve'): # Dependent variables mRNA = y[0] # Col 0 of ODESoln Pep = y[1] # Col 1 of ODESoln Pepm = y[2] # Parameters n = param[0] K_ind = param[1] syn_mRNA = param[2] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[3] deg_Pep = param[4] Kmature = param[5] #Kmature = 0.0316 # log(2)/21.9 (mRFP1 at 37'C) # Differential equations dmRNA_dt = '(syn_mRNA*((inducer**n)/(inducer**n+K_ind**n)))-(deg_mRNA * mRNA)' dPep_dt = '(syn_Pep*mRNA)-(Kmature*Pep)' dPepm_dt = '(Kmature*Pep)-(deg_Pep*Pepm)' if Operation == 'Solve': return [eval(dmRNA_dt), eval(dPep_dt), eval(dPepm_dt)] elif Operation == 'GetODE': return [dmRNA_dt, dPep_dt, dPepm_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Degradable Inducible Promoter ### def solveODE_DegradationInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Ind = y[0] # Col 0 of ODESoln mRNA = y[1] # Col 1 Pep = y[2] # Col 2 # Parameters n = param[0] K_ind = param[1] syn_mRNA = param[2] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[3] deg_Pep = param[4] deg_Ind = param[5] # Differential equations dInd_dt = '-deg_Ind*Ind' dmRNA_dt = '(syn_mRNA*((Ind**n)/(Ind**n+K_ind**n)))-(deg_mRNA*mRNA)' dPep_dt = '(syn_Pep*mRNA)-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dInd_dt), eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInd_dt, dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Degradable Inducible Promoter ### def solveODE_DegradationInducerKMat(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Ind = y[0] # Col 0 of ODESoln mRNA = y[1] # Col 1 Pep = y[2] # Col 2 Pepm = y[3] # Parameters n = param[0] K_ind = param[1] syn_mRNA = param[2] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[3] deg_Pep = param[4] deg_Ind = param[5] Kmature = param[6] # Differential equations dInd_dt = '-deg_Ind*Ind' dmRNA_dt = '(syn_mRNA*((Ind**n)/(Ind**n+K_ind**n)))-(deg_mRNA*mRNA)' dPep_dt = '(syn_Pep*mRNA)-(Kmature*Pep)' dPepm_dt = '(Kmature*Pep)-(deg_Pep*Pepm)' if Operation == 'Solve': return [eval(dInd_dt), eval(dmRNA_dt), eval(dPep_dt), eval(dPepm_dt)] elif Operation == 'GetODE': return [dInd_dt, dmRNA_dt, dPep_dt, dPepm_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Delay Inducible feature ### def solveODE_DelayInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Inde = y[0] # Col 0 of ODESoln Indi = y[1] # Col 1 of ODESoln mRNA = y[2] # Col 2 of ODESoln Pep = y[3] # Col 3 of ODESoln # Parameters Vm = param[0] ntrans = param[1] Ktrans = param[2] n = param[3] K_ind = param[4] syn_mRNA = param[5] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[6] deg_Pep = param[7] # Differential equations dInde_dt = '-Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dIndi_dt = 'Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dmRNA_dt = '(syn_mRNA*((Indi**n)/(Indi**n+K_ind**n)))-(deg_mRNA*mRNA)' dPep_dt = '(syn_Pep*mRNA)-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dInde_dt), eval(dIndi_dt), eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInde_dt, dIndi_dt, dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Delay Inducible feature ### def solveODE_DelayInducerKMat(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Inde = y[0] # Col 0 of ODESoln Indi = y[1] # Col 1 of ODESoln mRNA = y[2] # Col 2 of ODESoln Pep = y[3] # Col 3 of ODESoln Pepm = y[4] # Parameters Vm = param[0] ntrans = param[1] Ktrans = param[2] n = param[3] K_ind = param[4] syn_mRNA = param[5] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[6] deg_Pep = param[7] Kmature = param[8] # Differential equations dInde_dt = '-Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dIndi_dt = 'Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dmRNA_dt = '(syn_mRNA*((Indi**n)/(Indi**n+K_ind**n)))-(deg_mRNA*mRNA)' dPep_dt = '(syn_Pep*mRNA)-(Kmature*Pep)' dPepm_dt = '(Kmature*Pep)-(deg_Pep*Pepm)' if Operation == 'Solve': return [eval(dInde_dt), eval(dIndi_dt), eval(dmRNA_dt), eval(dPep_dt), eval(dPepm_dt)] elif Operation == 'GetODE': return [dInde_dt, dIndi_dt, dmRNA_dt, dPep_dt, dPepm_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### Single-ODE Model for Constant Inducible Promoter ### def solveODE_SingleConstantInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Pep = y[0] # Col 1 of ODESoln # Parameters n = param[0] K_ind = param[1] syn_Pep = param[2] deg_Pep = param[3] # Differential equations dPep_dt = '(syn_Pep*((inducer**n)/(inducer**n+K_ind**n)))-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dPep_dt)] elif Operation == 'GetODE': return [dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### Single-ODE Model for Inducer with Degradation ### def solveODE_SingleDegradationInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Ind = y[0] # Col 0 of ODESoln Pep = y[1] # Col 2 # Parameters n = param[0] K_ind = param[1] syn_Pep = param[2] deg_Pep = param[3] deg_Ind = param[4] # Differential equations dInd_dt = '-deg_Ind*Ind' dPep_dt = '(syn_Pep*((Ind**n)/(Ind**n+K_ind**n)))-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dInd_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInd_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### Single-ODE Model for Delay Inducible feature ### def solveODE_SingleDelayInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Inde = y[0] # Col 0 of ODESoln Indi = y[1] # Col 1 of ODESoln Pep = y[2] # Col 3 of ODESoln # Parameters Vm = param[0] ntrans = param[1] Ktrans = param[2] n = param[3] K_ind = param[4] syn_Pep = param[5] deg_Pep = param[6] # Differential equations dInde_dt = '-Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dIndi_dt = 'Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dPep_dt = '(syn_Pep*((Indi**n)/(Indi**n+K_ind**n)))-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dInde_dt), eval(dIndi_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInde_dt, dIndi_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Constant Inducible Promoter ### def solveODE_ConstantIndInhibition(y, t, inducer, param, Operation = 'Solve'): ### Dependent variables mRNA = y[0] # Col 0 of ODESoln Pep = y[1] # Col 1 of ODESoln ### Parameters n = param[0] K_ind = param[1] syn_mRNA = param[2] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[3] deg_Pep = param[4] Kinhmax = param[5] ninh = param[6] Kinh = param[7] KLeak = param[8] ### Differential equations dmRNA_dt = 'KLeak + (syn_mRNA * ((inducer**n) / (inducer**n + K_ind**n))* (1-Kinhmax*((inducer**ninh)/((inducer**ninh)+(Kinh**ninh))))) - (deg_mRNA * mRNA)' dPep_dt = '(syn_Pep * mRNA) - (deg_Pep * Pep)' if Operation == 'Solve': return [eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Constant Inducible Promoter ### def solveODE_DelayIndInhibition(y, t, inducer, param, Operation = 'Solve'): ### Dependent variables Inde = y[0] # Col 0 of ODESoln Indi = y[1] # Col 1 of ODESoln mRNA = y[2] # Col 2 of ODESoln Pep = y[3] # Col 3 of ODESoln ### Parameters n = param[0] K_ind = param[1] syn_mRNA = param[2] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[3] deg_Pep = param[4] Kinhmax = param[5] ninh = param[6] Kinh = param[7] KLeak = param[8] Vm = param[9] ntrans = param[10] Ktrans = param[11] ### Differential equations dInde_dt = '-Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dIndi_dt = 'Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dmRNA_dt = 'KLeak + (syn_mRNA * ((Indi**n) / (Indi**n + K_ind**n))* (1-Kinhmax*((Inde**ninh)/((Inde**ninh)+(Kinh**ninh))))) - (deg_mRNA * mRNA)' dPep_dt = '(syn_Pep * mRNA) - (deg_Pep * Pep)' if Operation == 'Solve': return [eval(dInde_dt), eval(dIndi_dt), eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInde_dt, dIndi_dt, dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Delay Degradation Inducible feature ### def solveODE_DelayDegradationInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Inde = y[0] # Col 0 of ODESoln Indi = y[1] # Col 1 of ODESoln mRNA = y[2] # Col 2 of ODESoln Pep = y[3] # Col 3 of ODESoln # Parameters Vm = param[0] ntrans = param[1] Ktrans = param[2] n = param[3] K_ind = param[4] syn_mRNA = param[5] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[6] deg_Pep = param[7] deg_Ind = param[8] # Differential equations dInde_dt = '-Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dIndi_dt = 'Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans)) - deg_Ind*Indi' dmRNA_dt = '(syn_mRNA*((Indi**n)/(Indi**n+K_ind**n)))-(deg_mRNA*mRNA)' dPep_dt = '(syn_Pep*mRNA)-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dInde_dt), eval(dIndi_dt), eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInde_dt, dIndi_dt, dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') ### ODE Model for Degradation Delay Inducible feature ### def solveODE_DegradationDelayInducer(y, t, inducer, param, Operation = 'Solve'): # Dependent variables Inde = y[0] # Col 0 of ODESoln Indi = y[1] # Col 1 of ODESoln mRNA = y[2] # Col 2 of ODESoln Pep = y[3] # Col 3 of ODESoln # Parameters Vm = param[0] ntrans = param[1] Ktrans = param[2] n = param[3] K_ind = param[4] syn_mRNA = param[5] deg_mRNA = 0.1386 # Fixed as ln2/5(mins) = 0.1386 syn_Pep = param[6] deg_Pep = param[7] deg_Ind = param[8] # ParamName = ['Vm','ntrans','Ktrans','n','K_ind','syn_mRNA','syn_Pep','deg_Pep','deg_Ind'] # ParamUnits = ['molL-1min-1','dimensionless','molL-1','dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'min-1'] # Differential equations dInde_dt = '-Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans)) - deg_Ind*Inde' dIndi_dt = 'Vm*((Inde**ntrans)/(Inde**ntrans+Ktrans**ntrans))' dmRNA_dt = '(syn_mRNA*((Indi**n)/(Indi**n+K_ind**n)))-(deg_mRNA*mRNA)' dPep_dt = '(syn_Pep*mRNA)-(deg_Pep*Pep)' if Operation == 'Solve': return [eval(dInde_dt), eval(dIndi_dt), eval(dmRNA_dt), eval(dPep_dt)] elif Operation == 'GetODE': return [dInde_dt, dIndi_dt, dmRNA_dt, dPep_dt] else: print('Error: Please Enter the correct Operation for solveODE function') function_mappings = { 'solveODE_ConstantInducer': solveODE_ConstantInducer, 'solveODE_ConstantInducerKMat': solveODE_ConstantInducerKMat, 'solveODE_DegradationInducer': solveODE_DegradationInducer, 'solveODE_DegradationInducerKMat': solveODE_DegradationInducerKMat, 'solveODE_DelayInducer': solveODE_DelayInducer, 'solveODE_DelayInducerKMat': solveODE_DelayInducerKMat, 'solveODE_SingleConstantInducer': solveODE_SingleConstantInducer, 'solveODE_SingleDegradationInducer': solveODE_SingleDegradationInducer, 'solveODE_SingleDelayInducer': solveODE_SingleDelayInducer, 'solveODE_ConstantIndInhibition': solveODE_ConstantIndInhibition, 'solveODE_DelayIndInhibition': solveODE_DelayIndInhibition, 'solveODE_DelayDegradationInducer': solveODE_DelayDegradationInducer, 'solveODE_DegradationDelayInducer': solveODE_DegradationDelayInducer, } def select_function(self, SystemTypeString): ### Convert SystemType from string to function name try: return self.function_mappings[SystemTypeString] except KeyError: print('Invalid function, try again.') def ComputeSSE(self, param, y0, inducer, rfp_data, time_int, SystemType, VarIndex, OptimizerType): ### Calculate SSE - To be minimized by Optimizer #### global weight_global, sse_global # Time grid == no. of times to report solution rfp_data_numrows = np.size(rfp_data, 0) rfp_data_numcols = np.size(rfp_data, 1) numInd = np.size(inducer) # print(rfp_data_numrows) # print(rfp_data_numcols) # print(numInd) t_start = rfp_data[0][0] # First value of Time column t_end = rfp_data[0][-1] # Last value of Time column dt = 1 # minutes timestep = int((t_end / dt) + 1) t = np.linspace(t_start, t_end, timestep) # Initialize mRNA and Pep nested list #mRNA = np.zeros((timestep, numInd), dtype=object) # timestep (rows) x numInd (cols) Pep = np.zeros((timestep, numInd), dtype=object) # timestep (rows) x numInd (cols) # Pep2 is transpose of Pep, used to find Pep max Pep2 = np.zeros((numInd, timestep), dtype=object) # numInd(rows) x timestep (cols) solveODE_Name = '_'.join(('solveODE', SystemType)) solveODEfun = self.select_function(solveODE_Name) #convert string to function name if OptimizerType == 'Global': # Integrate the ODE equations for i in range(0, numInd): # Iterates through Ind Concs if (SystemType == 'DelayInducer') or (SystemType == 'DegradationInducer') or \ (SystemType == 'SingleDelayInducer') or (SystemType == 'SingleDegradationInducer') or \ (SystemType == 'DelayDegradationInducer') or (SystemType == 'DegradationDelayInducer') or \ (SystemType == 'DegradationInducerKMat') or (SystemType == 'DelayInducerKMat'): y0[0] = inducer[i] # add inducer conc into the initial condition array y0 else: pass ODEsoln = odeint(solveODEfun, y0, t, args=(inducer[i], param)) # for j in range(0, timestep): # Iterates through timesteps # #mRNA[j][i] = ODEsoln[j][VarIndex[0]] # mRNA array runs downwards with time # Pep[j][i] = ODEsoln[j][VarIndex[0]] # Pep array runs downwards with time # Pep2[i][j] = ODEsoln[j][VarIndex[0]] # Pep2 array runs sideways with time elif OptimizerType == 'Local': # Integrate the ODE equations for i in range(0, numInd): # Iterates through Ind Concs if (SystemType == 'DelayInducer') or (SystemType == 'DegradationInducer') or \ (SystemType == 'SingleDelayInducer') or (SystemType == 'SingleDegradationInducer') or \ (SystemType == 'DelayDegradationInducer') or (SystemType == 'DegradationDelayInducer') or \ (SystemType == 'DegradationInducerKMat') or (SystemType == 'DelayInducerKMat'): y0[0] = inducer[i] # add inducer conc into the initial condition array y0 else: pass ODEsoln = odeint(solveODEfun, y0, t, args=(inducer[i], param)) for j in range(0, timestep): # Iterates through timesteps #mRNA[j][i] = ODEsoln[j][VarIndex[0]] # mRNA array runs downwards with time Pep[j][i] = ODEsoln[j][VarIndex[0]] # Pep array runs downwards with time Pep2[i][j] = ODEsoln[j][VarIndex[0]] # Pep2 array runs sideways with time else: print('No specified Optimizer Type') ''' Calculate SSE_Time ''' # rfp_data runs lengthwise with time sse_time = 0 for i in range(1, rfp_data_numrows): # Start from 1 because Row 0 is time for j in range(0, rfp_data_numcols): # time_int * i to find the corresponding model Pep value sse_time = sse_time + (Pep[int(time_int/dt)*j, i-1] - rfp_data[i][j])**2 # Array to store max data and model rfp values for each inducer rfp_peak = np.zeros(numInd) Pep_peak = np.zeros(numInd) for i in range(0, numInd): rfp_peak[i] = max(rfp_data[i+1]) Pep_peak[i] = max(Pep2[i]) ''' Calculate SSE_Dose (Dosage Response) ''' # rfp_data runs lengthwise with time sse_dose = 0 for i in range(0, numInd): # Start from 1 because Row 0 is time sse_dose = sse_dose + (Pep_peak[i] - rfp_peak[i]) ** 2 weight = np.real(sse_time)/np.real(sse_dose) sse = sse_time + sse_dose * weight # update and return to main function sse_global = sse weight_global = weight if OptimizerType == 'Global': print('Model: ', SystemType, '- SSE (Global):', sse) elif OptimizerType == 'Local': print('Model: ', SystemType, '- SSE (Local):', sse) else: print('Error in ComputeSSE function') return sse def Run_InducibleSystem(self, SystemType, n_DoseRes, K_ind_DoseRes, data_header, data_array, inducer, inducer_log): Time_interval = data_array[0][1] - data_array[0][0] ### ODE Input (Inducer Degradation) ### # Initial conditions for (mRNA, Pep, Ind) at time = 0 if (SystemType == 'ConstantInducer'): mRNA0 = 0. Pep0 = data_array[1][0] y0 = [mRNA0, Pep0] # Initial condition VariableName = ['mRNA', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 5 # Fixed for Constant Inducer Model ParamName = ['n','K_ind','syn_mRNA','syn_Pep','deg_Pep'] ParamUnits = ['dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1'] # Global bounds - In order of (n, Kind, a_mRNA, a_Pep, y_Pep) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02), (0.001, 0.02)] #Diff Evo # Local bounds LB = [0]*(numParam-1) + [0.001] #[0.001] UB = [None]*(numParam) if (SystemType == 'ConstantInducerKMat'): mRNA0 = 0. Pep0 = 0. Pepm0 = data_array[1][0] y0 = [mRNA0, Pep0, Pepm0] # Initial condition VariableName = ['mRNA', 'Pep', 'Pepm'] # Variables Name VarIndex =[VariableName.index('Pepm')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 6 # Fixed for Constant Inducer Model ParamName = ['n','K_ind','syn_mRNA','syn_Pep','deg_Pep','Kmature'] ParamUnits = ['dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'min-1'] # Global bounds - In order of (n, Kind, a_mRNA, a_Pep, y_Pep) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02), (0.001, 0.02), (0.001, 1)] #Diff Evo # Local bounds LB = [0]*(numParam-2) + [0.001]*2 #[0.001] UB = [None]*(numParam-1) + [1] # LB = [0]*(numParam-1) + [0.001] #[0.001] # UB = [None]*(numParam) elif (SystemType == 'DegradationInducer'): # Initial conditions for (Ind, mRNA, Pep) at time = 0 Ind0 = 0. # Will be replaced in findsse mRNA0 = 0. Pep0 = data_array[1][0] y0 = [Ind0, mRNA0, Pep0] # Initial condition VariableName = ['Ind', 'mRNA', 'Pep'] # Variables Name #Variable = ['Inducer', 'mRNA', 'Peptide'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP # Number of Parameters to be optimized numParam = 6 # Fixed for Inducer Degradation Model (aTc) ParamName = ['n','K_ind','syn_mRNA','syn_Pep','deg_Pep','deg_Ind'] ParamUnits = ['dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'min-1'] # Global bounds - In order of (n, K_ind, syn_mRNA, syn_Pep, deg_Pep, deg_Ind) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (3e-8, 5e-7), (0, 0.02), (0.001, 0.02), (0.001, 0.02)] #Diff Evo # Local bounds LB = [0]*(numParam-2)+[0.001] + [0] UB = [None]*(numParam) elif (SystemType == 'DegradationInducerKMat'): # Initial conditions for (Ind, mRNA, Pep) at time = 0 Ind0 = 0. # Will be replaced in findsse mRNA0 = 0. Pep0 = 0. Pepm0 = data_array[1][0] y0 = [Ind0, mRNA0, Pep0, Pepm0] # Initial condition VariableName = ['Ind', 'mRNA', 'Pep', 'Pepm'] # Variables Name #Variable = ['Inducer', 'mRNA', 'Peptide'] # Variables Name VarIndex =[VariableName.index('Pepm')] #get the index for mRNA and RFP # Number of Parameters to be optimized numParam = 7 # Fixed for Inducer Degradation Model (aTc) ParamName = ['n','K_ind','syn_mRNA','syn_Pep','deg_Pep','deg_Ind', 'Kmature'] ParamUnits = ['dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'min-1', 'min-1'] # Global bounds - In order of (n, K_ind, syn_mRNA, syn_Pep, deg_Pep, deg_Ind) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (3e-8, 5e-7), (0, 0.02), (0.001, 0.02), (0.001, 0.02), (0.001, 1)] #Diff Evo # Local bounds LB = [0]*(numParam-3)+[0.001] + [0]+ [0.001] UB = [None]*(numParam-1) + [1] elif (SystemType == 'DelayInducer'): # Initial conditions for (Inde, Indi, mRNA, Pep) at time = 0 Inde0 = 0. # Will be replaced in findsse Indi0 = 0. mRNA0 = 0. Pep0 = data_array[1][0] y0 = [Inde0, Indi0, mRNA0, Pep0] # Initial condition VariableName = ['Inde', 'Indi', 'mRNA', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 8 # User Input ParamName = ['Vm','ntrans','Ktrans','n','K_ind','syn_mRNA','syn_Pep','deg_Pep'] ParamUnits = ['molL-1min-1','dimensionless','molL-1','dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1'] # Global bounds - In order of (Vm, ntrans, Ktrans, n, Kind, syn_mRNA, syn_Pep, deg_Pep) param0_global = [(0, 0.01), (0, 4), (0, 0.01), (n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02),(0.001, 0.02)] #Diff Evo IPTG # local bounds LB = [0]*(numParam-1) +[0.001] #[0.001] #UB = [None]*(numParam-2) + [0.02, None] UB = [None]*(numParam) elif (SystemType == 'DelayInducerKMat'): # Initial conditions for (Inde, Indi, mRNA, Pep) at time = 0 Inde0 = 0. # Will be replaced in findsse Indi0 = 0. mRNA0 = 0. Pep0 = 0. Pepm0 = data_array[1][0] y0 = [Inde0, Indi0, mRNA0, Pep0, Pepm0] # Initial condition VariableName = ['Inde', 'Indi', 'mRNA', 'Pep', 'Pepm'] # Variables Name VarIndex =[VariableName.index('Pepm')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 9 # User Input ParamName = ['Vm','ntrans','Ktrans','n','K_ind','syn_mRNA','syn_Pep','deg_Pep', 'Kmature'] ParamUnits = ['molL-1min-1','dimensionless','molL-1','dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'min-1'] # Global bounds - In order of (Vm, ntrans, Ktrans, n, Kind, syn_mRNA, syn_Pep, deg_Pep) param0_global = [(0, 0.01), (0, 4), (0, 0.01), (n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02),(0.001, 0.02), (0.001, 1)] #Diff Evo IPTG # local bounds LB = [0]*(numParam-2) +[0.001]*2 #[0.001] #UB = [None]*(numParam-2) + [0.02, None] UB = [None]*(numParam-1) + [1] elif (SystemType == 'SingleConstantInducer'): Pep0 = data_array[1][0] y0 = [Pep0] # Initial condition VariableName = ['Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 4 # Fixed for Constant Inducer Model ParamName = ['n','K_ind','syn_Pep','deg_Pep'] ParamUnits = ['dimensionless', 'molL-1', 'min-1', 'min-1'] # Global bounds - In order of (n, Kind, a_mRNA, a_Pep, y_Pep) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0.001, 0.02)] #Diff Evo # Local bounds LB = [0]*(numParam-1) + [0.001] #[0.001] UB = [None]*(numParam) elif (SystemType == 'SingleDegradationInducer'): # Initial conditions for (Ind, mRNA, Pep) at time = 0 Ind0 = 0. # Will be replaced in findsse Pep0 = data_array[1][0] y0 = [Ind0, Pep0] # Initial condition VariableName = ['Ind', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP # Number of Parameters to be optimized numParam = 5 # Fixed for Inducer Degradation Model (aTc) ParamName = ['n','K_ind','syn_Pep','deg_Pep','deg_Ind'] ParamUnits = ['dimensionless', 'molL-1', 'min-1', 'min-1', 'min-1'] # Global bounds - In order of (n, K_ind, syn_mRNA, syn_Pep, deg_Pep, deg_Ind) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (3e-8, 5e-7), (0.001, 0.02), (0.001, 0.02)] #Diff Evo # Local bounds LB = [0]*(numParam-2)+[0.001] + [0] UB = [None]*(numParam) elif (SystemType == 'SingleDelayInducer'): # Initial conditions for (Inde, Indi, mRNA, Pep) at time = 0 Inde0 = 0. # Will be replaced in findsse Indi0 = 0. Pep0 = data_array[1][0] y0 = [Inde0, Indi0, Pep0] # Initial condition VariableName = ['Inde', 'Indi', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 7 # User Input ParamName = ['Vm','ntrans','Ktrans','n','K_ind','syn_Pep','deg_Pep'] ParamUnits = ['molL-1min-1','dimensionless','molL-1','dimensionless', 'molL-1', 'molL-1min-1', 'min-1'] # Global bounds - In order of (Vm, ntrans, Ktrans, n, Kind, syn_mRNA, syn_Pep, deg_Pep) param0_global = [(0, 0.01), (0, 4), (0, 0.01), (n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0.001, 0.02)] #Diff Evo IPTG # local bounds LB = [0]*(numParam-1) +[0.001] #[0.001] UB = [None]*(numParam) elif (SystemType == 'DelayDegradationInducer') or (SystemType == 'DegradationDelayInducer'): # Initial conditions for (Inde, Indi, mRNA, Pep) at time = 0 Inde0 = 0. # Will be replaced in findsse Indi0 = 0. mRNA0 = 0. Pep0 = data_array[1][0] y0 = [Inde0, Indi0, mRNA0, Pep0] # Initial condition VariableName = ['Inde', 'Indi', 'mRNA', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] #get the index for mRNA and RFP ### Number of Parameters to be optimized numParam = 9 # User Input ParamName = ['Vm','ntrans','Ktrans','n','K_ind','syn_mRNA','syn_Pep','deg_Pep','deg_Ind'] ParamUnits = ['molL-1min-1','dimensionless','molL-1','dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'min-1'] # Global bounds - In order of (Vm, ntrans, Ktrans, n, Kind, syn_mRNA, syn_Pep, deg_Pep) param0_global = [(0, 0.01), (0, 4), (0, 0.01), (n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02),(0.001, 0.02),(0.0, 0.02)] #Diff Evo IPTG # local bounds LB = [0]*(numParam-2) +[0.001, 0] #[0.001] #UB = [None]*(numParam-2) + [0.02, None] UB = [None]*(numParam) elif (SystemType == 'ConstantIndInhibition'): mRNA0 = 0. Pep0 = data_array[1][0] y0 = [mRNA0, Pep0] # Initial condition VariableName = ['mRNA', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] 'Vm', 'ntrans', 'Ktrans' ### Number of Parameters to be optimized numParam = 9 # Fixed for Inhibition Inducer model ParamName = ['n','K_ind','syn_mRNA','syn_Pep','deg_Pep','Kinhmax','ninh','Kinh', 'KLeak'] ParamUnits = ['dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'dimensionless','dimensionless','molL-1', 'molL-1min-1'] K_inh0 = 10**inducer_log[0] #[-1] ### Global Optimizer (Diff Evo) ### ### In order of (n, Kind, a_mRNA, a_Pep, y_Pep) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02), (0.001, 0.02), (0, 1), (0, 4), (K_inh0*0.5, K_inh0*1.5), (1e-10, 5e-6)] #Diff Evo # local bounds LB = [0]*(numParam-5) + [0.001] +[0]*4 #[0.001] UB = [None]*(numParam) elif (SystemType == 'DelayIndInhibition'): Inde0 = 0. # Will be replaced in findsse Indi0 = 0. mRNA0 = 0. Pep0 = data_array[1][0] y0 = [Inde0, Indi0, mRNA0, Pep0] # Initial condition VariableName = ['Inde', 'Indi', 'mRNA', 'Pep'] # Variables Name VarIndex =[VariableName.index('Pep')] ### Number of Parameters to be optimized numParam = 12 # Fixed for Inhibition Inducer model ParamName = ['n','K_ind','syn_mRNA','syn_Pep','deg_Pep','Kinhmax','ninh','Kinh', 'KLeak', 'Vm', 'ntrans', 'Ktrans'] ParamUnits = ['dimensionless', 'molL-1', 'molL-1min-1', 'min-1', 'min-1', 'dimensionless','dimensionless','molL-1', 'molL-1min-1', 'molL-1min-1','dimensionless','molL-1'] K_inh0 = 10**inducer_log[0] #[-1] ### Global Optimizer (Diff Evo) ### ### In order of (n, Kind, a_mRNA, a_Pep, y_Pep) param0_global = [(n_DoseRes*0.8, n_DoseRes*1.2), (K_ind_DoseRes*0.8, K_ind_DoseRes*1.2), (5e-8, 5e-7), (0, 0.02), (0.001, 0.02), (0, 1), (0, 4), (K_inh0*0.5, K_inh0*1.5), (1e-10, 5e-6), (0, 0.01), (0, 4), (0, 0.01)] #Diff Evo # local bounds LB = [0]*(numParam-8) + [0.001] +[0]*7 #[0.001] UB = [None]*(numParam) else: print('Please choose the correct System Type for Inducible Promoter') # run Global optimizer OptimizerType1 = 'Global' result_diffevo = differential_evolution\ (self.ComputeSSE, param0_global, args=(y0, inducer, data_array, Time_interval, SystemType, VarIndex, OptimizerType1)) # run Local Optimizer (Nelder Mead) OptimizerType2 = 'Local' param0_local = np.zeros(numParam) for i in range(0, numParam): param0_local[i] = result_diffevo.x[i] result_NM = cNM.constrNM(self.ComputeSSE, param0_local,LB,UB,args=(y0, inducer, data_array, Time_interval, SystemType, VarIndex, OptimizerType2), xtol= 1e-15, full_output=True) # Optimized Parameters param_optimized = np.zeros(numParam) for i in range(0, numParam): #param_optimized[i] = result_NM.x[i] param_optimized[i] = result_NM['xopt'][i] return(param_optimized, sse_global, y0, VariableName, ParamName, ParamUnits) # Plot CSV and Model Data # def plotData_Combined(self, SystemType, Variable, y0, raw_data_header, rfp_data, Data_stddev, inducer, inducer_log, param): ### timespan for Model results (t) t_start = rfp_data[0][0] t_end = rfp_data[0][-1] dt = 1 # minutes timestep = int((t_end / dt) + 1) t = np.linspace(t_start, t_end, timestep) # Time grid == no. of times to report solution rfp_data_numrows = np.size(rfp_data, 0) rfp_data_numcols = np.size(rfp_data, 1) numInd = np.size(inducer) Inducer = np.zeros((timestep, numInd), dtype=object) Inducer_e = np.zeros((timestep, numInd), dtype=object) Inducer_i = np.zeros((timestep, numInd), dtype=object) mRNA = np.zeros((timestep, numInd), dtype=object) Peptide = np.zeros((timestep, numInd), dtype=object) Peptidem = np.zeros((timestep, numInd), dtype=object) Pep2 = np.zeros((numInd, timestep), dtype=object) # numInd (rows) x timestep (cols) Variable_mappings = { 'Inducer': Inducer, 'Inducer_e': Inducer_e, 'Inducer_i': Inducer_i, 'mRNA': mRNA, 'Peptide': Peptide, 'Peptidem': Peptidem, } # initiate empty list to store all the arrays VariableMatrix = [None]*len(Variable) for i in range(0, len(Variable)): VariableMatrix[i] = Variable_mappings[Variable[i]] solveODE_Name = '_'.join(('solveODE', SystemType)) solveODEfun = self.select_function(solveODE_Name) #convert string to function name # Integrate the ODE equations for i in range(0, numInd): # Iterates through Ind Concs if (SystemType == 'DelayInducer') or (SystemType == 'DegradationInducer') or \ (SystemType == 'SingleDelayInducer') or (SystemType == 'SingleDegradationInducer') or \ (SystemType == 'DelayDegradationInducer') or (SystemType == 'DegradationDelayInducer') or \ (SystemType == 'DegradationInducerKMat') or (SystemType == 'DelayInducerKMat') or \ (SystemType == 'DelayIndInhibition'): y0[0] = inducer[i] # add inducer conc into the initial condition array y0 else: pass ODEsoln = odeint(solveODEfun, y0, t, args=(inducer[i], param)) for j in range(0, len(VariableMatrix)): # Iterates through timesteps #for k in range(0, timestep): VariableMatrix[j][:,i] = ODEsoln[:,j] #VariableMatrix[j][k][i] = ODEsoln[k][j] Pep2[i,:] = ODEsoln[:,-1] # Pep2 array runs sideways with time ### Retrive the ODEs in String from the corresponding solveODEfun ODEstring = solveODEfun(y0, t[0], inducer[0], param, 'GetODE') print('ODEs in string', ODEstring) ### Defining time array from Row 0 time = rfp_data[0] ### Plot RFP Data vs Time ### fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.16,0.8,0.78]) ax.set_prop_cycle('color',plt.cm.tab10(np.linspace(0, 1, 10))) plt.rc('font', size=16) # controls default text sizes ## CSV Data (time) style = ['^','*','>','D','<','d','p','o','h','+','s','x','v','.','H'] for i in range (1, rfp_data_numrows): #plt.plot(time, rfp_data[i], linestyle='None', marker = style[i-1], markersize = 4) plt.errorbar(time, rfp_data[i], yerr = Data_stddev[i-1], capsize = 2, linestyle='None', marker = style[i-1], markersize = 3) rfp_data_legend = raw_data_header[0:rfp_data_numcols] plt.legend(rfp_data_legend, ncol=2, loc='upper left', prop={'size': 12},frameon=False, markerscale=1.6) # n = 20 # ax = plt.axes() # ax.set_prop_cycle('color',[plt.cm.jet(i) for i in np.linspace(0, 1, n)]) ### Model Data (t) # Resets colour cycle for the second plot over same figure ax.set_prop_cycle('color',plt.cm.tab10(np.linspace(0, 1, 10))) #plt.gca().set_prop_cycle(None) # plot model Pep data if 'Peptidem' not in Variable: Peptideid = Variable.index('Peptide') #get the index of mRNA plt.plot(t, VariableMatrix[Peptideid][:,:], linewidth=2) # Pep else: Peptidemid = Variable.index('Peptidem') #get the index of mRNA plt.plot(t, VariableMatrix[Peptidemid][:,:], linewidth=2) # Pep #plt.title('Modelled Peptide Concentration vs Time') plt.xlabel('Time (min)') plt.ylabel('Expression Level (M/OD)') # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # Figure border ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) axes = plt.gca() ymin, ymax = axes.get_ylim() axes.set_ylim([0, ymax+0.3*ymax]) #fpr other [plots] #axes.set_ylim([0, ymax+0.1*ymax]) #for pLac #axes.set_ylim([0, ymax+0.1*ymax]) ### Protein Data (t) fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.16,0.8,0.78]) if 'Peptidem' not in Variable: Peptideid = Variable.index('Peptide') #get the index of mRNA plt.plot(t, VariableMatrix[Peptideid][:,:], linewidth=2) # Pep else: Peptidemid = Variable.index('Peptidem') #get the index of mRNA plt.plot(t, VariableMatrix[Peptidemid][:,:], linewidth=2) # Pep plt.legend(rfp_data_legend, ncol=2, loc='upper left', prop={'size': 12},frameon=False) #plt.title('Modelled Peptide Concentration vs Time') plt.xlabel('Time (min)') plt.ylabel('Expression Level (M/OD)') # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # Figure border ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) axes = plt.gca() ymin, ymax = axes.get_ylim() axes.set_ylim([0, ymax+0.35*ymax]) ''' ### Dosage Response ### ''' rfp_peak = np.zeros(numInd) Pep_peak = np.zeros(numInd) for i in range(0, numInd): rfp_peak[i] = max(rfp_data[i + 1]) Pep_peak[i] = max(Pep2[i]) fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.17,0.8,0.77]) ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) plt.tight_layout plt.rc('font', size=16) # controls default text sizes ax.errorbar(inducer_log, rfp_peak, yerr = Data_stddev[:,-1], capsize = 2, color = 'black', linestyle='None', marker = 's', mfc= 'black', mec= 'black', markersize = 4, label = 'Experiment') #ax.plot(inducer_log, rfp_peak, 'ks',markersize=4, label = 'Experiment') ax.plot(inducer_log, Pep_peak, 'k', linewidth=2, label = 'Model') ax.legend(frameon=False, loc='upper left') plt.xlabel('Inducer Concentration ($log_{10}$ (M))') plt.ylabel('Expression Level (M/OD)') # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) axes = plt.gca() ymin, ymax = axes.get_ylim() #axes.set_ylim([0, ymax+0.1*ymax]) #axes.set_ylim([0, ymax+0.2*ymax]) if 'mRNA' in Variable: ### mRNA Data (t) fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.16,0.8,0.78]) plt.rc('font', size=16) # controls default text sizes mRNAid = Variable.index('mRNA') #get the index of mRNA plt.plot(t, VariableMatrix[mRNAid][:,:], linewidth=2) # mRNA #plt.title('Modelled mRNA Concentration vs Time') plt.xlabel('Time (min)') plt.ylabel('mRNA Concentration (M)') plt.legend(rfp_data_legend, ncol=3, loc='upper left', prop={'size': 12},frameon=False) # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # Figure border ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) axes = plt.gca() ymin, ymax = axes.get_ylim() #axes.set_ylim([0, ymax+0.45*ymax]) axes.set_ylim([0, ymax+0.45*ymax]) if 'Inducer' in Variable: ### Inducer Data (t) fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.16,0.8,0.78]) plt.rc('font', size=16) # controls default text sizes # Hide the right and top spines ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) plt.tight_layout Inducerid = Variable.index('Inducer') #get the index of Inducer plt.plot(t, VariableMatrix[Inducerid][:,:], linewidth=2) # Inducer plt.xlabel('Time (min)') plt.ylabel('Inducer Concentration (M)') plt.legend(rfp_data_legend, ncol=3, loc='upper left', prop={'size': 12},frameon=False) # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # Figure border ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) axes = plt.gca() ymin, ymax = axes.get_ylim() axes.set_ylim([0, ymax+0.35*ymax]) if 'Inducer_e' in Variable: ### Extracellular Inducer Data (t) fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.16,0.8,0.78]) plt.rc('font', size=16) # controls default text sizes # Hide the right and top spines ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) plt.tight_layout Inducer_eid = Variable.index('Inducer_e') #get the index of Extracellular Inducer plt.plot(t, VariableMatrix[Inducer_eid][:,:], linewidth=2) # Inducer plt.xlabel('Time (min)') plt.ylabel('Inducer$_{ex}$ Concentration (M)') plt.legend(rfp_data_legend, ncol=3, loc='upper left', prop={'size': 12},frameon=False) # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # Figure border ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) axes = plt.gca() ymin, ymax = axes.get_ylim() axes.set_ylim([0, ymax+0.35*ymax]) if 'Inducer_i' in Variable: ### Intracellular Inducer Data (t) fig = plt.figure(figsize=(5,3.6)) ax = fig.add_axes([0.16,0.16,0.8,0.78]) plt.rc('font', size=16) # controls default text sizes # Hide the right and top spines ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) plt.tight_layout Inducer_iid = Variable.index('Inducer_i') #get the index of Intracellular Inducer plt.plot(t, VariableMatrix[Inducer_iid][:,:], linewidth=2) # Inducer_i plt.xlabel('Time (min)') plt.ylabel('Inducer$_{in}$ Concentration (M)') plt.legend(rfp_data_legend, ncol=3, loc='upper left', prop={'size': 12},frameon=False) # Set Y Axis Ticker to Scientific Style plt.ticklabel_format(style='sci', axis='y', scilimits=(0, 0)) # Figure border ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) axes = plt.gca() ymin, ymax = axes.get_ylim() #axes.set_ylim([0, ymax+0.35*ymax]) axes.set_ylim([0, ymax+0.55*ymax]) return t, VariableMatrix, rfp_data_legend, ODEstring def Run_InduciblePlot(self, SystemType, y0, data_header, data_array, Data_stddev, inducer, inducer_log, param_optimized): if (SystemType == 'ConstantInducer') or (SystemType == 'ConstantIndInhibition'): VariablePlot = ['mRNA', 'Peptide'] # Variables Name elif (SystemType == 'ConstantInducerKMat'): VariablePlot = ['mRNA', 'Peptide', 'Peptidem'] # Variables Name elif (SystemType == 'DegradationInducer'): VariablePlot = ['Inducer', 'mRNA', 'Peptide'] # Variables Name elif (SystemType == 'DegradationInducerKMat'): VariablePlot = ['Inducer', 'mRNA', 'Peptide', 'Peptidem'] # Variables Name elif (SystemType == 'DelayInducer') or (SystemType == 'DelayIndInhibition'): VariablePlot = ['Inducer_e', 'Inducer_i', 'mRNA', 'Peptide'] # Variables Name elif (SystemType == 'DelayInducerKMat'): VariablePlot = ['Inducer_e', 'Inducer_i', 'mRNA', 'Peptide', 'Peptidem'] # Variables Name elif (SystemType == 'SingleConstantInducer'): VariablePlot = ['Peptide'] # Variables Name elif (SystemType == 'SingleDegradationInducer'): VariablePlot = ['Inducer', 'Peptide'] # Variables Name elif (SystemType == 'SingleDelayInducer'): VariablePlot = ['Inducer_e', 'Inducer_i', 'Peptide'] # Variables Name elif (SystemType == 'DelayDegradationInducer'): VariablePlot = ['Inducer_e', 'Inducer_i', 'mRNA', 'Peptide'] # Variables Name elif (SystemType == 'DegradationDelayInducer'): VariablePlot = ['Inducer_e', 'Inducer_i', 'mRNA', 'Peptide'] # Variables Name else: print('Error in Plotting module') ### Calculate and plot Model results (param_optimized) ### t, VariableMatrix, rfp_data_legend, ODEstring = self.plotData_Combined(SystemType, VariablePlot, y0, data_header, data_array, Data_stddev, inducer, inducer_log, param_optimized) return t, VariableMatrix, rfp_data_legend, ODEstring def __del__(self): class_name = self.__class__.__name__ print(class_name, "destroyed")
43.714651
196
0.558738
6,469
51,321
4.314268
0.069563
0.009603
0.005912
0.008599
0.791967
0.777563
0.754846
0.725967
0.700885
0.68365
0
0.040437
0.300325
51,321
1,173
197
43.751918
0.7368
0.207537
0
0.684073
0
0.002611
0.174061
0.063697
0
0
0
0
0
1
0.024804
false
0.003916
0.006527
0
0.073107
0.028721
0
0
0
null
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
3d3da3060a070b42c8de00998aed76bc6216848c
244
py
Python
application/forms.py
today-app/today-api
a77adbad509d485e643023efc64f62b69fd364cc
[ "MIT" ]
null
null
null
application/forms.py
today-app/today-api
a77adbad509d485e643023efc64f62b69fd364cc
[ "MIT" ]
null
null
null
application/forms.py
today-app/today-api
a77adbad509d485e643023efc64f62b69fd364cc
[ "MIT" ]
1
2021-06-04T06:02:36.000Z
2021-06-04T06:02:36.000Z
from wtforms import Form, TextField, PasswordField from wtforms.validators import required __author__ = 'yoophi' class LoginForm(Form): username = TextField('Username', [required()]) password = PasswordField('Password', [required()])
27.111111
54
0.745902
24
244
7.416667
0.583333
0.123596
0
0
0
0
0
0
0
0
0
0
0.135246
244
9
54
27.111111
0.843602
0
0
0
0
0
0.089796
0
0
0
0
0
0
1
0
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
1
0
0
5
3d49eb957107de96d4a64679e74ba3a1df94b908
40
py
Python
colorgraphs/__main__.py
guenp/colorgraphs
b9f1832a3d2633771eebed4a684a85f6495b0e35
[ "MIT" ]
null
null
null
colorgraphs/__main__.py
guenp/colorgraphs
b9f1832a3d2633771eebed4a684a85f6495b0e35
[ "MIT" ]
null
null
null
colorgraphs/__main__.py
guenp/colorgraphs
b9f1832a3d2633771eebed4a684a85f6495b0e35
[ "MIT" ]
null
null
null
from .dockwin import main main().exec_()
20
25
0.75
6
40
4.833333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.1
40
2
26
20
0.805556
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
1
0
1
0
0
0
0
5
3d53ed5a69ba86ea4f4c9a7bb7f0850f98090aa0
38
py
Python
plugins/__init__.py
mrusme/melon
c84fcf7762e1f2a3bd6ac904889107fa6d0240e6
[ "MIT" ]
4
2019-04-15T22:36:26.000Z
2022-03-19T05:18:27.000Z
plugins/__init__.py
mrusme/melon
c84fcf7762e1f2a3bd6ac904889107fa6d0240e6
[ "MIT" ]
null
null
null
plugins/__init__.py
mrusme/melon
c84fcf7762e1f2a3bd6ac904889107fa6d0240e6
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # coding=utf8
9.5
22
0.684211
6
38
4.333333
1
0
0
0
0
0
0
0
0
0
0
0.060606
0.131579
38
3
23
12.666667
0.727273
0.868421
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
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
e9e840cf9e7a131065e05b54711832cd8b0d215f
458
py
Python
userprofiles/contrib/emailverification/urls.py
swarajakode/Saasproject1
79227566abe53ee9b834709b35ae276b40114c0b
[ "BSD-3-Clause" ]
18
2015-01-12T21:17:12.000Z
2022-03-07T13:27:04.000Z
userprofiles/contrib/emailverification/urls.py
swarajakode/Saasproject1
79227566abe53ee9b834709b35ae276b40114c0b
[ "BSD-3-Clause" ]
5
2021-03-18T21:39:04.000Z
2022-03-11T23:35:24.000Z
userprofiles/contrib/emailverification/urls.py
swarajakode/Saasproject1
79227566abe53ee9b834709b35ae276b40114c0b
[ "BSD-3-Clause" ]
5
2015-06-09T19:54:25.000Z
2022-02-28T15:11:46.000Z
# -*- coding: utf-8 -*- from django.conf.urls import patterns, url urlpatterns = patterns('userprofiles.contrib.emailverification.views', url(r'^$', 'email_change', name='userprofiles_email_change'), url(r'^requested/$', 'email_change_requested', name='userprofiles_email_change_requested'), url(r'^verify/(?P<token>[0-9A-Za-z-]+)/(?P<code>[0-9A-Za-z-]+)/$', 'email_change_approve', name='userprofiles_email_change_approve'), )
38.166667
74
0.68559
58
458
5.189655
0.5
0.219269
0.209302
0.269103
0
0
0
0
0
0
0
0.012346
0.115721
458
11
75
41.636364
0.730864
0.045852
0
0
0
0.125
0.604598
0.498851
0
0
0
0
0
1
0
false
0
0.125
0
0.125
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
43f49a9d58b9eadb19e794793de8224fab921ec4
203
py
Python
simple_button_app.py
ContinuumBridge/simple_button_app
41636936a632b516acbf6f4eaf63e100e09b8ba0
[ "MIT" ]
null
null
null
simple_button_app.py
ContinuumBridge/simple_button_app
41636936a632b516acbf6f4eaf63e100e09b8ba0
[ "MIT" ]
null
null
null
simple_button_app.py
ContinuumBridge/simple_button_app
41636936a632b516acbf6f4eaf63e100e09b8ba0
[ "MIT" ]
null
null
null
#!/usr/bin/env python # simple_button_app.py # Copyright (C) ContinuumBridge Limited, 2015 - All Rights Reserved # Written by Peter Claydon # import sys from simple_button_app_a import App App(sys.argv)
22.555556
67
0.783251
32
203
4.8125
0.78125
0.155844
0.194805
0
0
0
0
0
0
0
0
0.022727
0.133005
203
8
68
25.375
0.852273
0.650246
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
43fdc595d63bc2980813f8513baf5e6ea25bc859
172
py
Python
api/admin.py
ulpa11/easy.control
108ad3b36a2365c1b0b3d970a274c701cc5f47a8
[ "MIT" ]
null
null
null
api/admin.py
ulpa11/easy.control
108ad3b36a2365c1b0b3d970a274c701cc5f47a8
[ "MIT" ]
null
null
null
api/admin.py
ulpa11/easy.control
108ad3b36a2365c1b0b3d970a274c701cc5f47a8
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import DeviceStatus,Testing # Register your models here. admin.site.register(DeviceStatus) admin.site.register(Testing)
28.666667
42
0.802326
22
172
6.272727
0.545455
0.130435
0.246377
0
0
0
0
0
0
0
0
0
0.122093
172
5
43
34.4
0.913907
0.151163
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a10c487d92ea95e97081e332125d1e63187b8e1d
53
py
Python
podcasts/tests.py
rodrigofuentealbacartes/podcasts
a64190a92b346d9432143a659bb3e69bbdb62ea9
[ "MIT" ]
null
null
null
podcasts/tests.py
rodrigofuentealbacartes/podcasts
a64190a92b346d9432143a659bb3e69bbdb62ea9
[ "MIT" ]
null
null
null
podcasts/tests.py
rodrigofuentealbacartes/podcasts
a64190a92b346d9432143a659bb3e69bbdb62ea9
[ "MIT" ]
null
null
null
# coding: utf-8 from django.test import TestCase
13.25
33
0.716981
8
53
4.75
1
0
0
0
0
0
0
0
0
0
0
0.02381
0.207547
53
3
34
17.666667
0.880952
0.245283
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
1
0
0
5
a15948efff52bbd50fcdd3ed0b7db3eef959830b
158
py
Python
backend/trades/admin.py
JoseAntpr/tradingApp
728b2fbb46c4345ea89f1481396632b24a30d5cb
[ "MIT" ]
null
null
null
backend/trades/admin.py
JoseAntpr/tradingApp
728b2fbb46c4345ea89f1481396632b24a30d5cb
[ "MIT" ]
3
2020-02-12T00:36:37.000Z
2021-06-10T20:11:33.000Z
backend/trades/admin.py
JoseAntpr/tradingApp
728b2fbb46c4345ea89f1481396632b24a30d5cb
[ "MIT" ]
1
2017-09-12T18:15:17.000Z
2017-09-12T18:15:17.000Z
from django.contrib import admin from .models import Trade, TypeMoney # Register your models here. admin.site.register(Trade) admin.site.register(TypeMoney)
22.571429
36
0.810127
22
158
5.818182
0.545455
0.140625
0.265625
0
0
0
0
0
0
0
0
0
0.107595
158
6
37
26.333333
0.907801
0.164557
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a1599095191d82e121addecdd42ff41c3ef74379
844
py
Python
allennlp/data/dataset_readers/reading_comprehension/__init__.py
ethanjperez/allennlp
e520993f16f0da7e2c40f6e44b8dc56338f46b57
[ "Apache-2.0" ]
24
2019-09-16T00:10:54.000Z
2021-09-08T19:31:51.000Z
allennlp/data/dataset_readers/reading_comprehension/__init__.py
ethanjperez/allennlp
e520993f16f0da7e2c40f6e44b8dc56338f46b57
[ "Apache-2.0" ]
null
null
null
allennlp/data/dataset_readers/reading_comprehension/__init__.py
ethanjperez/allennlp
e520993f16f0da7e2c40f6e44b8dc56338f46b57
[ "Apache-2.0" ]
7
2019-09-16T02:37:31.000Z
2021-09-01T06:06:17.000Z
""" Reading comprehension is loosely defined as follows: given a question and a passage of text that contains the answer, answer the question. These submodules contain readers for things that are predominantly reading comprehension datasets. """ from allennlp.data.dataset_readers.reading_comprehension.babi import BabiSingleReader from allennlp.data.dataset_readers.reading_comprehension.dream_mc import DreamMCReader from allennlp.data.dataset_readers.reading_comprehension.squad import SquadReader from allennlp.data.dataset_readers.reading_comprehension.quac import QuACReader from allennlp.data.dataset_readers.reading_comprehension.race_mc import RaceMCReader from allennlp.data.dataset_readers.reading_comprehension.triviaqa import TriviaQaReader from allennlp.data.dataset_readers.reading_comprehension.qangaroo import QangarooReader
56.266667
98
0.876777
106
844
6.830189
0.443396
0.248619
0.154696
0.222376
0.483425
0.483425
0.483425
0
0
0
0
0
0.078199
844
14
99
60.285714
0.930591
0.281991
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
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
0
1
0
1
0
0
5
a1a6d56d77e76ff4e308c518d553348eb0c03bec
161
py
Python
mutation/mutation.py
Techletial/translatial
ab63fa3626ec40eb0ade8a5a070c110bdc4eebe8
[ "MIT" ]
4
2020-06-30T03:14:12.000Z
2020-07-09T01:11:35.000Z
mutation/mutation.py
techlestial/translatial
ab63fa3626ec40eb0ade8a5a070c110bdc4eebe8
[ "MIT" ]
null
null
null
mutation/mutation.py
techlestial/translatial
ab63fa3626ec40eb0ade8a5a070c110bdc4eebe8
[ "MIT" ]
null
null
null
from graphene import ObjectType, String from .translate import TranslateWords class Mutation(ObjectType): translate_words = TranslateWords.Field() pass
23
44
0.795031
17
161
7.470588
0.705882
0
0
0
0
0
0
0
0
0
0
0
0.149068
161
6
45
26.833333
0.927007
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0.2
0.4
0
0.8
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
1
0
0
5
a1d9153ef8f70e512b4d56538f9f9bb8fe9010d3
20
py
Python
dashboard/dashs/__init__.py
mr2cef/open_data_tyrol
87ff1d8e00b65c26995c9ed3fa69be1a8698746c
[ "MIT" ]
1
2021-08-20T18:17:41.000Z
2021-08-20T18:17:41.000Z
dashboard/dashs/__init__.py
mr2cef/open_data_tyrol
87ff1d8e00b65c26995c9ed3fa69be1a8698746c
[ "MIT" ]
null
null
null
dashboard/dashs/__init__.py
mr2cef/open_data_tyrol
87ff1d8e00b65c26995c9ed3fa69be1a8698746c
[ "MIT" ]
null
null
null
from ._dash import *
20
20
0.75
3
20
4.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.15
20
1
20
20
0.823529
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
a1fb8fbbbafffc71081329a3fbe0d34325b29dfa
451
py
Python
math/numbers.py
sebastbk/algorithms
08063d9bb29cfef21e19166bd69b3969e9f8fc14
[ "MIT" ]
null
null
null
math/numbers.py
sebastbk/algorithms
08063d9bb29cfef21e19166bd69b3969e9f8fc14
[ "MIT" ]
null
null
null
math/numbers.py
sebastbk/algorithms
08063d9bb29cfef21e19166bd69b3969e9f8fc14
[ "MIT" ]
null
null
null
from utils.generators import len_eq def factors(n): return list(yield_factors(n)) def yield_factors(n): for i in range(1, n+1): if n % i == 0: yield i def prime_factors(n): return list(yield_prime_factors(n)) def yield_prime_factors(n): return (f for f in yield_factors(n) if is_prime(f)) def is_prime(n): if n < 2: return False return len_eq(yield_factors(n), 2)
17.346154
56
0.59867
74
451
3.472973
0.324324
0.249027
0.202335
0.140078
0.178988
0
0
0
0
0
0
0.015823
0.299335
451
25
57
18.04
0.797468
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.066667
0.2
0.733333
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
1
1
0
0
5
a1febc7962a410f4aed9c9bfde64b1e09f760577
35
py
Python
session.py
mashiyathussain2/session
e0abdea5a535dee0332ccb16272cb0c69e5dc468
[ "MIT" ]
null
null
null
session.py
mashiyathussain2/session
e0abdea5a535dee0332ccb16272cb0c69e5dc468
[ "MIT" ]
null
null
null
session.py
mashiyathussain2/session
e0abdea5a535dee0332ccb16272cb0c69e5dc468
[ "MIT" ]
null
null
null
print("session") print("sessions")
11.666667
17
0.714286
4
35
6.25
0.75
0
0
0
0
0
0
0
0
0
0
0
0.057143
35
2
18
17.5
0.757576
0
0
0
0
0
0.428571
0
0
0
0
0
0
1
0
true
0
0
0
0
1
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
1
0
5