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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4aad49ffdc68e02678b607757271339f69622b46
| 77
|
py
|
Python
|
mumbleroni/__init__.py
|
Peter-Morawski/MumbleRoni
|
b1c6119a91b720f1a04b51d65b337ee94df3a6ac
|
[
"MIT"
] | 1
|
2021-03-28T17:21:53.000Z
|
2021-03-28T17:21:53.000Z
|
mumbleroni/__init__.py
|
Peter-Morawski/MumbleRoni
|
b1c6119a91b720f1a04b51d65b337ee94df3a6ac
|
[
"MIT"
] | null | null | null |
mumbleroni/__init__.py
|
Peter-Morawski/MumbleRoni
|
b1c6119a91b720f1a04b51d65b337ee94df3a6ac
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
from . import audio, core, modules, settings, tests
| 19.25
| 51
| 0.636364
| 10
| 77
| 4.9
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015873
| 0.181818
| 77
| 3
| 52
| 25.666667
| 0.761905
| 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
|
4ab0792cc60621aeac778bd549bf7315fca5c067
| 145
|
py
|
Python
|
bikewise/__init__.py
|
irahorecka/python-bikewise
|
553a34683611f68412c74fb8865951e9b0379996
|
[
"MIT"
] | null | null | null |
bikewise/__init__.py
|
irahorecka/python-bikewise
|
553a34683611f68412c74fb8865951e9b0379996
|
[
"MIT"
] | null | null | null |
bikewise/__init__.py
|
irahorecka/python-bikewise
|
553a34683611f68412c74fb8865951e9b0379996
|
[
"MIT"
] | null | null | null |
"""python-bikewise is a python package for querying
data from the BikeWise API."""
from . import bikewise
from .bikewise import (
BikeWise,
)
| 18.125
| 51
| 0.737931
| 20
| 145
| 5.35
| 0.6
| 0.261682
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172414
| 145
| 7
| 52
| 20.714286
| 0.891667
| 0.524138
| 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
|
4ac450522a61647390b802172aff629bf4af723d
| 105
|
py
|
Python
|
src/layers.py
|
constantine7cd/sartorius-competition
|
9fc8e9a98e90f0fb49474a1365bdce06f0a0f129
|
[
"Apache-2.0"
] | null | null | null |
src/layers.py
|
constantine7cd/sartorius-competition
|
9fc8e9a98e90f0fb49474a1365bdce06f0a0f129
|
[
"Apache-2.0"
] | null | null | null |
src/layers.py
|
constantine7cd/sartorius-competition
|
9fc8e9a98e90f0fb49474a1365bdce06f0a0f129
|
[
"Apache-2.0"
] | null | null | null |
import tensorflow as tf
class Identity(tf.keras.layers.Layer):
def call(self, x):
return x
| 15
| 38
| 0.666667
| 16
| 105
| 4.375
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.238095
| 105
| 6
| 39
| 17.5
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0.25
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
434e5752eda748c9a84a109c39d3b993d4bd5d08
| 147
|
py
|
Python
|
src/ethereum_spec_tools/lint/__main__.py
|
petertdavies/execution-specs
|
fabda289c747f535f1d2851ec7ebd0caa89f423f
|
[
"CC0-1.0"
] | 1
|
2022-01-04T12:35:57.000Z
|
2022-01-04T12:35:57.000Z
|
src/ethereum_spec_tools/lint/__main__.py
|
petertdavies/execution-specs
|
fabda289c747f535f1d2851ec7ebd0caa89f423f
|
[
"CC0-1.0"
] | null | null | null |
src/ethereum_spec_tools/lint/__main__.py
|
petertdavies/execution-specs
|
fabda289c747f535f1d2851ec7ebd0caa89f423f
|
[
"CC0-1.0"
] | null | null | null |
"""
Linter Entry Point
^^^^^^^^^^^^^^^^^^
Main entry point for the ethereum spec lint tool.
"""
import sys
from . import main
sys.exit(main())
| 11.307692
| 49
| 0.612245
| 20
| 147
| 4.5
| 0.7
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.176871
| 147
| 12
| 50
| 12.25
| 0.743802
| 0.598639
| 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 | 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
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
43bac68160e3932e146304e9006f2c7497eeeb93
| 64
|
py
|
Python
|
grumpy-tools-src/tests/dummymodule/dummysubmodule1/dummysubmodule2b.py
|
Srinivas11789/grumpy
|
ed590012cefa85da8720daaac7916f88e9065e52
|
[
"Apache-2.0"
] | 386
|
2018-07-28T14:20:44.000Z
|
2022-02-05T11:54:39.000Z
|
grumpy-tools-src/tests/dummymodule/dummysubmodule1/dummysubmodule2b.py
|
Srinivas11789/grumpy
|
ed590012cefa85da8720daaac7916f88e9065e52
|
[
"Apache-2.0"
] | 147
|
2018-08-03T16:18:53.000Z
|
2018-08-20T15:15:11.000Z
|
grumpy-tools-src/tests/dummymodule/dummysubmodule1/dummysubmodule2b.py
|
Srinivas11789/grumpy
|
ed590012cefa85da8720daaac7916f88e9065e52
|
[
"Apache-2.0"
] | 22
|
2018-07-28T15:00:18.000Z
|
2021-09-13T12:01:46.000Z
|
#import dummysubmodule2
def dummyfunc2b():
print("Func2b")
| 12.8
| 23
| 0.71875
| 6
| 64
| 7.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.055556
| 0.15625
| 64
| 4
| 24
| 16
| 0.796296
| 0.34375
| 0
| 0
| 0
| 0
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
43c2702539c88aec539f1d982550269e84861aee
| 65
|
py
|
Python
|
dev/__init__.py
|
glryanon/Trusty-cogs
|
1d5056ad166a7e7ee5039baa31748b1995ae81f6
|
[
"MIT"
] | 1
|
2020-12-28T15:58:16.000Z
|
2020-12-28T15:58:16.000Z
|
dev/__init__.py
|
glryanon/Trusty-cogs
|
1d5056ad166a7e7ee5039baa31748b1995ae81f6
|
[
"MIT"
] | null | null | null |
dev/__init__.py
|
glryanon/Trusty-cogs
|
1d5056ad166a7e7ee5039baa31748b1995ae81f6
|
[
"MIT"
] | 1
|
2020-07-27T00:04:45.000Z
|
2020-07-27T00:04:45.000Z
|
from .dev import Dev
def setup(bot):
bot.add_cog(Dev(bot))
| 10.833333
| 25
| 0.661538
| 12
| 65
| 3.5
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 65
| 5
| 26
| 13
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
60194978c3313b81e8c5408c67cb36cbeee0a8d7
| 1,646
|
py
|
Python
|
test/test_custom_notificationtestgetnotificationtests_response.py
|
ezmaxinc/eZmax-SDK-python
|
6794b8001abfb7d9ae18a3b87aba164839b925a0
|
[
"MIT"
] | null | null | null |
test/test_custom_notificationtestgetnotificationtests_response.py
|
ezmaxinc/eZmax-SDK-python
|
6794b8001abfb7d9ae18a3b87aba164839b925a0
|
[
"MIT"
] | null | null | null |
test/test_custom_notificationtestgetnotificationtests_response.py
|
ezmaxinc/eZmax-SDK-python
|
6794b8001abfb7d9ae18a3b87aba164839b925a0
|
[
"MIT"
] | null | null | null |
"""
eZmax API Definition (Full)
This API expose all the functionnalities for the eZmax and eZsign applications. # noqa: E501
The version of the OpenAPI document: 1.1.7
Contact: support-api@ezmax.ca
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import eZmaxApi
from eZmaxApi.model.custom_notificationtestgetnotificationtests_response_all_of import CustomNotificationtestgetnotificationtestsResponseAllOf
from eZmaxApi.model.field_e_notificationpreference_status import FieldENotificationpreferenceStatus
from eZmaxApi.model.notificationtest_response import NotificationtestResponse
globals()['CustomNotificationtestgetnotificationtestsResponseAllOf'] = CustomNotificationtestgetnotificationtestsResponseAllOf
globals()['FieldENotificationpreferenceStatus'] = FieldENotificationpreferenceStatus
globals()['NotificationtestResponse'] = NotificationtestResponse
from eZmaxApi.model.custom_notificationtestgetnotificationtests_response import CustomNotificationtestgetnotificationtestsResponse
class TestCustomNotificationtestgetnotificationtestsResponse(unittest.TestCase):
"""CustomNotificationtestgetnotificationtestsResponse unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testCustomNotificationtestgetnotificationtestsResponse(self):
"""Test CustomNotificationtestgetnotificationtestsResponse"""
# FIXME: construct object with mandatory attributes with example values
# model = CustomNotificationtestgetnotificationtestsResponse() # noqa: E501
pass
if __name__ == '__main__':
unittest.main()
| 38.27907
| 142
| 0.818348
| 127
| 1,646
| 10.464567
| 0.551181
| 0.036117
| 0.051166
| 0.034612
| 0.100828
| 0.100828
| 0
| 0
| 0
| 0
| 0
| 0.006246
| 0.124544
| 1,646
| 42
| 143
| 39.190476
| 0.916031
| 0.309235
| 0
| 0.157895
| 0
| 0
| 0.110301
| 0.103008
| 0
| 0
| 0
| 0.02381
| 0
| 1
| 0.157895
| false
| 0.157895
| 0.368421
| 0
| 0.578947
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 1
| 0
|
0
| 5
|
60283ef8806c4537dc19be24addacbf433335fb9
| 327
|
py
|
Python
|
Velez_Felipe/assignments/landing_page/landing_page.py
|
webguru001/Python-Django-Web
|
6264bc4c90ef1432ba0902c76b567cf3caaae221
|
[
"MIT"
] | 5
|
2019-05-17T01:30:02.000Z
|
2021-06-17T21:02:58.000Z
|
Velez_Felipe/assignments/landing_page/landing_page.py
|
curest0x1021/Python-Django-Web
|
6264bc4c90ef1432ba0902c76b567cf3caaae221
|
[
"MIT"
] | null | null | null |
Velez_Felipe/assignments/landing_page/landing_page.py
|
curest0x1021/Python-Django-Web
|
6264bc4c90ef1432ba0902c76b567cf3caaae221
|
[
"MIT"
] | null | null | null |
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def greetings():
return render_template('greet.html')
@app.route('/ninjas')
def ninjas():
return render_template('ninjas.html')
@app.route('/dojos/new')
def form():
return render_template('form.html')
app.run(debug=True)
| 15.571429
| 38
| 0.724771
| 46
| 327
| 4.978261
| 0.434783
| 0.244541
| 0.262009
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11315
| 327
| 21
| 39
| 15.571429
| 0.789655
| 0
| 0
| 0
| 0
| 0
| 0.146341
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.230769
| false
| 0
| 0.153846
| 0.230769
| 0.615385
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
602b4674b3f167f8ab7cbcc845fbeadcfa7278f2
| 23
|
py
|
Python
|
pyLatch/__init__.py
|
rubegartor/pyLatch
|
4b09c99962369dd83d6a019cb0b59bbaa9dcaeda
|
[
"MIT"
] | 2
|
2019-03-30T22:15:32.000Z
|
2021-03-18T10:03:47.000Z
|
pyLatch/__init__.py
|
rubegartor/pyLatch
|
4b09c99962369dd83d6a019cb0b59bbaa9dcaeda
|
[
"MIT"
] | null | null | null |
pyLatch/__init__.py
|
rubegartor/pyLatch
|
4b09c99962369dd83d6a019cb0b59bbaa9dcaeda
|
[
"MIT"
] | 1
|
2019-03-30T22:15:55.000Z
|
2019-03-30T22:15:55.000Z
|
from .pyLatch import *
| 11.5
| 22
| 0.73913
| 3
| 23
| 5.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173913
| 23
| 1
| 23
| 23
| 0.894737
| 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
|
603d27ba2e02fdeafa4e5966a834ca4d45c7dedc
| 2,526
|
py
|
Python
|
qcdb/tests/test_tu3_opt.py
|
loriab/qccddb
|
d9e156ef8b313ac0633211fc6b841f84a3ddde24
|
[
"BSD-3-Clause"
] | 8
|
2019-03-28T11:54:59.000Z
|
2022-03-19T03:31:37.000Z
|
qcdb/tests/test_tu3_opt.py
|
loriab/qccddb
|
d9e156ef8b313ac0633211fc6b841f84a3ddde24
|
[
"BSD-3-Clause"
] | 39
|
2018-10-31T23:02:18.000Z
|
2021-12-12T22:11:37.000Z
|
qcdb/tests/test_tu3_opt.py
|
loriab/qccddb
|
d9e156ef8b313ac0633211fc6b841f84a3ddde24
|
[
"BSD-3-Clause"
] | 9
|
2018-03-12T20:51:50.000Z
|
2022-02-28T15:18:34.000Z
|
"""
from https://github.com/psi4/psi4/blob/master/tests/tu3-h2o-opt/input.dat
Optimize H2O HF/cc-pVDZ
"""
import pytest
import qcdb
from .utils import *
tu3_nre_start = 9.16819
tu3_nre_opt = 9.30079
tu3_scf_ene = -76.0270535127645
@using("psi4")
def test_tu3_opt_psi4():
water1 = qcdb.set_molecule(
"""
O
H 1 0.96
H 1 0.96 2 104.5
"""
)
water1.update_geometry() # only needed for pre-calc NRE check next line
assert compare_values(tu3_nre_start, water1.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
qcdb.optimize("p4-scf/cc-pvdz")
assert compare_values(tu3_nre_opt, water1.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
assert compare_values(tu3_scf_ene, qcdb.variable("CURRENT ENERGY"), 4, "opt energy") # loose check since DF in psi
@using("cfour")
def test_tu3_opt_cfour():
water2 = qcdb.set_molecule(
"""
O
H 1 0.96
H 1 0.96 2 104.5
"""
)
water2.update_geometry() # only needed for pre-calc NRE check next line
assert compare_values(tu3_nre_start, water2.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
qcdb.optimize("c4-scf/cc-pvdz")
assert compare_values(tu3_nre_opt, water2.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
assert compare_values(tu3_scf_ene, qcdb.variable("CURRENT ENERGY"), 6, "opt energy")
@using("nwchem")
def test_tu3_opt_nwchem():
water3 = qcdb.set_molecule(
"""
O
H 1 0.96
H 1 0.96 2 104.5
"""
)
water3.update_geometry() # only needed for pre-calc NRE check next line
assert compare_values(tu3_nre_start, water3.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
qcdb.optimize("nwc-scf/cc-pvdz")
assert compare_values(tu3_nre_opt, water3.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
assert compare_values(tu3_scf_ene, qcdb.variable("CURRENT ENERGY"), 6, "opt energy")
@using("gamess")
def test_tu3_opt_gamess():
water4 = qcdb.set_molecule(
"""
O
H 1 0.96
H 1 0.96 2 104.5
"""
)
water4.update_geometry() # only needed for pre-calc NRE check next line
assert compare_values(tu3_nre_start, water4.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
qcdb.optimize("gms-scf/cc-pvdz")
assert compare_values(tu3_nre_opt, water4.nuclear_repulsion_energy(), 3, "Nuclear repulsion energy")
assert compare_values(tu3_scf_ene, qcdb.variable("CURRENT ENERGY"), 6, "opt energy")
| 29.034483
| 119
| 0.689628
| 375
| 2,526
| 4.437333
| 0.213333
| 0.153846
| 0.211538
| 0.158654
| 0.78125
| 0.78125
| 0.78125
| 0.78125
| 0.752404
| 0.526442
| 0
| 0.066241
| 0.193191
| 2,526
| 86
| 120
| 29.372093
| 0.750245
| 0.12114
| 0
| 0.071429
| 0
| 0
| 0.185447
| 0
| 0
| 0
| 0
| 0
| 0.285714
| 1
| 0.095238
| false
| 0
| 0.071429
| 0
| 0.166667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
60421cef1eabd38d9588ca3baa295688e128dcb7
| 40
|
py
|
Python
|
src/algoandds/searching/__init__.py
|
vcenteio/algorithms-and-data-structures
|
34e2f295f0af736037d6ff5bef7c9e8f2ad95569
|
[
"MIT"
] | 1
|
2022-01-06T13:23:09.000Z
|
2022-01-06T13:23:09.000Z
|
src/algoandds/searching/__init__.py
|
vcenteio/algorithms-and-data-structures
|
34e2f295f0af736037d6ff5bef7c9e8f2ad95569
|
[
"MIT"
] | 11
|
2022-01-18T10:54:37.000Z
|
2022-01-31T22:21:44.000Z
|
src/algoandds/searching/__init__.py
|
vcenteio/algorithms-and-data-structures
|
34e2f295f0af736037d6ff5bef7c9e8f2ad95569
|
[
"MIT"
] | null | null | null |
from .binarysearch import binary_search
| 40
| 40
| 0.875
| 6
| 40
| 5.833333
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.075
| 40
| 1
| 40
| 40
| 0.918919
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 1
| 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
|
607f7a320136e1da7f0029a6149b2c936b3c9a15
| 194
|
py
|
Python
|
mnistetude/actfunc/relu.py
|
aram-father/mnist-etude
|
3f9196a7ae3447c3412507896c3dc3ae81f9d7d0
|
[
"BSD-2-Clause"
] | null | null | null |
mnistetude/actfunc/relu.py
|
aram-father/mnist-etude
|
3f9196a7ae3447c3412507896c3dc3ae81f9d7d0
|
[
"BSD-2-Clause"
] | 1
|
2022-03-18T03:14:13.000Z
|
2022-03-18T03:14:13.000Z
|
mnistetude/actfunc/relu.py
|
aram-father/mnist-etude
|
3f9196a7ae3447c3412507896c3dc3ae81f9d7d0
|
[
"BSD-2-Clause"
] | null | null | null |
import numpy as np
from . import iactfunc
class Relu(iactfunc.IActFunc):
def __init__(self):
pass
def activate(self, x: np.array) -> np.array:
return np.maximum(0, x)
| 17.636364
| 48
| 0.639175
| 28
| 194
| 4.285714
| 0.642857
| 0.116667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006897
| 0.252577
| 194
| 10
| 49
| 19.4
| 0.82069
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.142857
| 0.285714
| 0.142857
| 0.857143
| 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
|
60b8a599254313473171ae59e3b13231da174e34
| 25
|
py
|
Python
|
integreat_cms/__init__.py
|
Integreat/cms-v2
|
c79a54fd5abb792696420aa6427a5e5a356fa79c
|
[
"Apache-2.0"
] | null | null | null |
integreat_cms/__init__.py
|
Integreat/cms-v2
|
c79a54fd5abb792696420aa6427a5e5a356fa79c
|
[
"Apache-2.0"
] | null | null | null |
integreat_cms/__init__.py
|
Integreat/cms-v2
|
c79a54fd5abb792696420aa6427a5e5a356fa79c
|
[
"Apache-2.0"
] | null | null | null |
__version__ = "2022.6.0"
| 12.5
| 24
| 0.68
| 4
| 25
| 3.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.272727
| 0.12
| 25
| 1
| 25
| 25
| 0.318182
| 0
| 0
| 0
| 0
| 0
| 0.32
| 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
|
60ce4863650d380b5324f7a67c3f51f0aa3c4df7
| 26
|
py
|
Python
|
backend_test/backend_test/api.py
|
KnowYourLines/sortedfood
|
ebcf41e121f5d161ba9779231cd4b0133935098f
|
[
"MIT"
] | null | null | null |
backend_test/backend_test/api.py
|
KnowYourLines/sortedfood
|
ebcf41e121f5d161ba9779231cd4b0133935098f
|
[
"MIT"
] | null | null | null |
backend_test/backend_test/api.py
|
KnowYourLines/sortedfood
|
ebcf41e121f5d161ba9779231cd4b0133935098f
|
[
"MIT"
] | 1
|
2021-10-10T21:33:55.000Z
|
2021-10-10T21:33:55.000Z
|
# Add your API routes here
| 26
| 26
| 0.769231
| 5
| 26
| 4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.192308
| 26
| 1
| 26
| 26
| 0.952381
| 0.923077
| 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
|
7152db4dc0032e6eda716b902838e36b9545308a
| 47
|
py
|
Python
|
db/context/employee/__init__.py
|
matchd-ch/matchd-backend
|
84be4aab1b4708cae50a8988301b15df877c8db0
|
[
"Apache-2.0"
] | 1
|
2022-03-03T09:55:57.000Z
|
2022-03-03T09:55:57.000Z
|
db/context/employee/__init__.py
|
matchd-ch/matchd-backend
|
84be4aab1b4708cae50a8988301b15df877c8db0
|
[
"Apache-2.0"
] | 7
|
2022-02-09T10:44:53.000Z
|
2022-03-28T03:29:43.000Z
|
db/context/employee/__init__.py
|
matchd-ch/matchd-backend
|
84be4aab1b4708cae50a8988301b15df877c8db0
|
[
"Apache-2.0"
] | null | null | null |
from .employee_builder import EmployeeBuilder
| 23.5
| 46
| 0.87234
| 5
| 47
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106383
| 47
| 1
| 47
| 47
| 0.952381
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
71577c3fc7ed3f39ab0313ab77f42c2f74c412a5
| 71
|
py
|
Python
|
test/pithy/schema.py
|
gwk/glossy
|
6976ca4fd1efc09d9cd670b1fe37817c05b4b529
|
[
"CC0-1.0"
] | 7
|
2019-05-04T00:51:38.000Z
|
2021-12-10T15:36:31.000Z
|
test/pithy/schema.py
|
gwk/glossy
|
6976ca4fd1efc09d9cd670b1fe37817c05b4b529
|
[
"CC0-1.0"
] | null | null | null |
test/pithy/schema.py
|
gwk/glossy
|
6976ca4fd1efc09d9cd670b1fe37817c05b4b529
|
[
"CC0-1.0"
] | 1
|
2016-07-30T22:38:08.000Z
|
2016-07-30T22:38:08.000Z
|
#!/usr/bin/env python3
from utest import *
from pithy.schema import *
| 14.2
| 26
| 0.732394
| 11
| 71
| 4.727273
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016667
| 0.15493
| 71
| 4
| 27
| 17.75
| 0.85
| 0.295775
| 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
|
7166ab790acc72e17a680fd8610cf88aa79a35c3
| 161
|
py
|
Python
|
src/cistat/reqs/base.py
|
maxwu/ci-stat
|
e8ed2f5d4d43afdc3afc0689435881202efbcbb3
|
[
"MIT"
] | 1
|
2017-04-23T02:52:02.000Z
|
2017-04-23T02:52:02.000Z
|
src/cistat/reqs/base.py
|
maxwu/cistat
|
e8ed2f5d4d43afdc3afc0689435881202efbcbb3
|
[
"MIT"
] | 2
|
2017-05-28T12:48:35.000Z
|
2017-06-19T11:22:40.000Z
|
src/cistat/reqs/base.py
|
maxwu/cistat
|
e8ed2f5d4d43afdc3afc0689435881202efbcbb3
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Base for CI service request
.. moduleauthor:: Max Wu <http://maxwu.me>
.. References::
None
"""
pass
| 16.1
| 43
| 0.583851
| 21
| 161
| 4.47619
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007813
| 0.204969
| 161
| 9
| 44
| 17.888889
| 0.726563
| 0.875776
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
71c86c54bf002c12616c8bc5c5bb0bac1babc51e
| 140
|
py
|
Python
|
src/dalib/metrics/__init__.py
|
ivan-chai/detection-adaptation
|
32d2ac542e60ed92da9e925286b51baa1f969cf4
|
[
"MIT"
] | null | null | null |
src/dalib/metrics/__init__.py
|
ivan-chai/detection-adaptation
|
32d2ac542e60ed92da9e925286b51baa1f969cf4
|
[
"MIT"
] | null | null | null |
src/dalib/metrics/__init__.py
|
ivan-chai/detection-adaptation
|
32d2ac542e60ed92da9e925286b51baa1f969cf4
|
[
"MIT"
] | null | null | null |
from .average_precision import AveragePrecisionCalculator
from .detection_dataset_evaluator import DetectionDatasetEvaluator, apply_detector
| 70
| 82
| 0.921429
| 13
| 140
| 9.615385
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.057143
| 140
| 2
| 82
| 70
| 0.94697
| 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
|
71c98c219486439bcf2300f3ad3d21b080bb06a9
| 955
|
py
|
Python
|
ark/api/one/block.py
|
dunnen/python-client
|
ad9446534a84cc18cb4160ddfe5ac84a0f3d8c6e
|
[
"MIT"
] | null | null | null |
ark/api/one/block.py
|
dunnen/python-client
|
ad9446534a84cc18cb4160ddfe5ac84a0f3d8c6e
|
[
"MIT"
] | null | null | null |
ark/api/one/block.py
|
dunnen/python-client
|
ad9446534a84cc18cb4160ddfe5ac84a0f3d8c6e
|
[
"MIT"
] | null | null | null |
from ark.api.resource import Resource
class Block(Resource):
def block(self, id):
return self.request_get('api/blocks/get', {'id': id})
def blocks(self, parameters=None):
return self.request_get('api/blocks', parameters)
def epoch(self):
return self.request_get('api/blocks/getEpoch')
def height(self):
return self.request_get('api/blocks/getHeight')
def nethash(self):
return self.request_get('api/blocks/getNethash')
def fee(self):
return self.request_get('api/blocks/getFee')
def fees(self):
return self.request_get('api/blocks/getFees')
def milestone(self):
return self.request_get('api/blocks/getMilestone')
def reward(self):
return self.request_get('api/blocks/getReward')
def supply(self):
return self.request_get('api/blocks/getSupply')
def status(self):
return self.request_get('api/blocks/getStatus')
| 25.810811
| 61
| 0.66178
| 124
| 955
| 5.008065
| 0.274194
| 0.177134
| 0.301127
| 0.354267
| 0.571659
| 0.571659
| 0.478261
| 0
| 0
| 0
| 0
| 0
| 0.208377
| 955
| 36
| 62
| 26.527778
| 0.821429
| 0
| 0
| 0
| 0
| 0
| 0.213613
| 0.046073
| 0
| 0
| 0
| 0
| 0
| 1
| 0.458333
| false
| 0
| 0.041667
| 0.458333
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
71d949768690b7a1d20324714380c3e090cb2efd
| 33
|
py
|
Python
|
venv/Test Confidence.py
|
Dartok-SD/Dartok-SD-s-reddit-bot
|
dc7a3215c062ed95b9f44bc207383e776c1692ea
|
[
"MIT"
] | null | null | null |
venv/Test Confidence.py
|
Dartok-SD/Dartok-SD-s-reddit-bot
|
dc7a3215c062ed95b9f44bc207383e776c1692ea
|
[
"MIT"
] | null | null | null |
venv/Test Confidence.py
|
Dartok-SD/Dartok-SD-s-reddit-bot
|
dc7a3215c062ed95b9f44bc207383e776c1692ea
|
[
"MIT"
] | null | null | null |
import re
import NameDifference
| 8.25
| 21
| 0.848485
| 4
| 33
| 7
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 33
| 3
| 22
| 11
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
71e03a98efb3503743927692b2d982137bb7876a
| 10,846
|
py
|
Python
|
core/storage/opportunity/gae_models_test.py
|
Tim810306/oppia
|
6f90044d12dbe0979c999265cbe46f267c4c592d
|
[
"Apache-2.0"
] | 1
|
2021-08-30T06:53:15.000Z
|
2021-08-30T06:53:15.000Z
|
core/storage/opportunity/gae_models_test.py
|
Tim810306/oppia
|
6f90044d12dbe0979c999265cbe46f267c4c592d
|
[
"Apache-2.0"
] | 11
|
2021-03-03T07:21:27.000Z
|
2022-03-12T01:03:44.000Z
|
core/storage/opportunity/gae_models_test.py
|
Tim810306/oppia
|
6f90044d12dbe0979c999265cbe46f267c4c592d
|
[
"Apache-2.0"
] | null | null | null |
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# 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 core.storage.opportunity.gae_models."""
from __future__ import absolute_import
from __future__ import unicode_literals
from core.platform import models
from core.tests import test_utils
import python_utils
MYPY = False
if MYPY: # pragma: no cover
from mypy_imports import base_models
from mypy_imports import opportunity_models
(base_models, opportunity_models) = models.Registry.import_models(
[models.NAMES.base_model, models.NAMES.opportunity])
class ExplorationOpportunitySummaryModelUnitTest(test_utils.GenericTestBase):
"""Test the ExplorationOpportunitySummaryModel class."""
def setUp(self) -> None:
super(ExplorationOpportunitySummaryModelUnitTest, self).setUp() # type: ignore[no-untyped-call]
opportunity_models.ExplorationOpportunitySummaryModel(
id='opportunity_id1',
topic_id='topic_id1',
topic_name='A topic',
story_id='story_id1',
story_title='A story title',
chapter_title='A chapter title',
content_count=20,
incomplete_translation_language_codes=['hi', 'ar'],
translation_counts={},
language_codes_needing_voice_artists=['en'],
language_codes_with_assigned_voice_artists=[]
).put()
opportunity_models.ExplorationOpportunitySummaryModel(
id='opportunity_id2',
topic_id='topic_id2',
topic_name='A new topic',
story_id='story_id2',
story_title='A new story title',
chapter_title='A new chapter title',
content_count=120,
incomplete_translation_language_codes=['hi'],
translation_counts={},
language_codes_needing_voice_artists=['en'],
language_codes_with_assigned_voice_artists=[]
).put()
def test_get_deletion_policy(self) -> None:
self.assertEqual(
opportunity_models.ExplorationOpportunitySummaryModel
.get_deletion_policy(),
base_models.DELETION_POLICY.NOT_APPLICABLE)
def test_get_all_translation_opportunities(self) -> None:
results, cursor, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_translation_opportunities(5, None, 'hi'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 2)
self.assertEqual(results[0].id, 'opportunity_id1')
self.assertEqual(results[1].id, 'opportunity_id2')
self.assertFalse(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
def test_get_all_translation_opportunities_pagination(self) -> None:
results, cursor, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_translation_opportunities(1, None, 'hi'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertEqual(results[0].id, 'opportunity_id1')
self.assertTrue(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
results, new_cursor, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_translation_opportunities(1, cursor, 'hi'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertEqual(results[0].id, 'opportunity_id2')
self.assertFalse(more)
self.assertTrue(isinstance(new_cursor, python_utils.BASESTRING))
def test_get_all_voiceover_opportunities(self) -> None:
results, cursor, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_voiceover_opportunities(5, None, 'en'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 2)
self.assertEqual(results[0].id, 'opportunity_id1')
self.assertEqual(results[1].id, 'opportunity_id2')
self.assertFalse(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
def test_get_all_voiceover_opportunities_pagination(self) -> None:
results, cursor, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_voiceover_opportunities(1, None, 'en'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertEqual(results[0].id, 'opportunity_id1')
self.assertTrue(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
results, new_cursor, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_voiceover_opportunities(1, cursor, 'en'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertEqual(results[0].id, 'opportunity_id2')
self.assertFalse(more)
self.assertTrue(isinstance(new_cursor, python_utils.BASESTRING))
def test_get_by_topic(self) -> None:
model_list = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_by_topic('topic_id1'))
# Ruling out the possibility of None for mypy type checking.
assert model_list is not None
self.assertEqual(len(model_list), 1)
self.assertEqual(model_list[0].id, 'opportunity_id1')
model_list = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_by_topic('topic_id2'))
# Ruling out the possibility of None for mypy type checking.
assert model_list is not None
self.assertEqual(len(model_list), 1)
self.assertEqual(model_list[0].id, 'opportunity_id2')
def test_get_by_topic_for_non_existing_topic(self) -> None:
model_list = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_by_topic('non_existing_topic_id'))
# Ruling out the possibility of None for mypy type checking.
assert model_list is not None
self.assertEqual(len(model_list), 0)
def test_delete_all(self) -> None:
results, _, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_translation_opportunities(1, None, 'hi'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertTrue(more)
opportunity_models.ExplorationOpportunitySummaryModel.delete_all()
results, _, more = (
opportunity_models.ExplorationOpportunitySummaryModel
.get_all_translation_opportunities(1, None, 'hi'))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 0)
self.assertFalse(more)
class SkillOpportunityModelTest(test_utils.GenericTestBase):
"""Tests for the SkillOpportunityModel class."""
def setUp(self) -> None:
super(SkillOpportunityModelTest, self).setUp() # type: ignore[no-untyped-call]
opportunity_models.SkillOpportunityModel(
id='opportunity_id1',
skill_description='A skill description',
question_count=20,
).put()
opportunity_models.SkillOpportunityModel(
id='opportunity_id2',
skill_description='A skill description',
question_count=30,
).put()
def test_get_deletion_policy(self) -> None:
self.assertEqual(
opportunity_models.SkillOpportunityModel.get_deletion_policy(),
base_models.DELETION_POLICY.NOT_APPLICABLE)
def test_get_skill_opportunities(self) -> None:
results, cursor, more = (
opportunity_models.SkillOpportunityModel
.get_skill_opportunities(5, None))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 2)
self.assertEqual(results[0].id, 'opportunity_id1')
self.assertEqual(results[1].id, 'opportunity_id2')
self.assertFalse(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
def test_get_skill_opportunities_pagination(self) -> None:
results, cursor, more = (
opportunity_models.SkillOpportunityModel.get_skill_opportunities(
1, None))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertEqual(results[0].id, 'opportunity_id1')
self.assertFalse(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
results, cursor, more = (
opportunity_models.SkillOpportunityModel.get_skill_opportunities(
1, cursor))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertEqual(results[0].id, 'opportunity_id2')
self.assertFalse(more)
self.assertTrue(isinstance(cursor, python_utils.BASESTRING))
def test_delete_all_skill_opportunities(self) -> None:
results, _, more = (
opportunity_models.SkillOpportunityModel.get_skill_opportunities(
1, None))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 1)
self.assertFalse(more)
opportunity_models.SkillOpportunityModel.delete_all()
results, _, more = (
opportunity_models.SkillOpportunityModel.get_skill_opportunities(
1, None))
# Ruling out the possibility of None for mypy type checking.
assert results is not None
self.assertEqual(len(results), 0)
self.assertFalse(more)
| 42.03876
| 103
| 0.679421
| 1,195
| 10,846
| 5.96318
| 0.138912
| 0.067359
| 0.047993
| 0.051642
| 0.781083
| 0.730424
| 0.714847
| 0.701937
| 0.700112
| 0.671906
| 0
| 0.010288
| 0.238245
| 10,846
| 257
| 104
| 42.202335
| 0.852215
| 0.161719
| 0
| 0.689474
| 0
| 0
| 0.054296
| 0.002322
| 0
| 0
| 0
| 0
| 0.368421
| 1
| 0.073684
| false
| 0
| 0.042105
| 0
| 0.126316
| 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
|
71e2745ca31c221ec64a9ce4874d22f2907e9a85
| 38
|
py
|
Python
|
explorer/__init__.py
|
prezesp/scoop-viewer
|
115f413979ba2e4e766e334f0240082a9343e314
|
[
"MIT"
] | 86
|
2018-07-17T14:21:05.000Z
|
2022-03-29T03:00:40.000Z
|
explorer/__init__.py
|
prezesp/scoop-viewer
|
115f413979ba2e4e766e334f0240082a9343e314
|
[
"MIT"
] | 16
|
2018-04-24T22:45:24.000Z
|
2021-12-15T08:37:38.000Z
|
explorer/__init__.py
|
prezesp/scoop-viewer
|
115f413979ba2e4e766e334f0240082a9343e314
|
[
"MIT"
] | 5
|
2018-03-28T18:24:52.000Z
|
2022-01-08T11:28:31.000Z
|
from explorer.explorer import Explorer
| 38
| 38
| 0.894737
| 5
| 38
| 6.8
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.078947
| 38
| 1
| 38
| 38
| 0.971429
| 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
|
71e32c96c0137232aa6302bcdaa3cd2f2ef416de
| 170
|
py
|
Python
|
Ejercicio 2.py
|
Albertojserr/Ejercicios-Tema-4
|
b9c6c58b678f3d4b5b68ca328e522bf6cd0fd75f
|
[
"Apache-2.0"
] | null | null | null |
Ejercicio 2.py
|
Albertojserr/Ejercicios-Tema-4
|
b9c6c58b678f3d4b5b68ca328e522bf6cd0fd75f
|
[
"Apache-2.0"
] | null | null | null |
Ejercicio 2.py
|
Albertojserr/Ejercicios-Tema-4
|
b9c6c58b678f3d4b5b68ca328e522bf6cd0fd75f
|
[
"Apache-2.0"
] | null | null | null |
def estado(EsHielo,EsLiquido):
if(EsHielo==True):
print("Es hielo")
elif(EsLiquido==True):
print("Es liquido")
else:
print("Es vapor")
| 24.285714
| 30
| 0.570588
| 20
| 170
| 4.85
| 0.65
| 0.216495
| 0.226804
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.270588
| 170
| 7
| 31
| 24.285714
| 0.782258
| 0
| 0
| 0
| 0
| 0
| 0.152047
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0
| 0
| 0.142857
| 0.428571
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
e0f31f604c9024004f58d49daaed68ae50462ecd
| 33
|
py
|
Python
|
1-fitchain-analysis/gossiper/rpc/modules/__init__.py
|
arberiii/Nautilus
|
001615f35bfa4ba6273f17baf8bcf7c8395572ae
|
[
"Apache-2.0"
] | 21
|
2020-11-21T09:41:22.000Z
|
2022-03-23T06:08:54.000Z
|
1-fitchain-analysis/gossiper/rpc/modules/__init__.py
|
oceanprotocol/nautilus
|
001615f35bfa4ba6273f17baf8bcf7c8395572ae
|
[
"Apache-2.0"
] | null | null | null |
1-fitchain-analysis/gossiper/rpc/modules/__init__.py
|
oceanprotocol/nautilus
|
001615f35bfa4ba6273f17baf8bcf7c8395572ae
|
[
"Apache-2.0"
] | 25
|
2020-11-21T13:21:20.000Z
|
2022-01-05T02:27:35.000Z
|
from .fit import Fit, RPCModule
| 16.5
| 32
| 0.757576
| 5
| 33
| 5
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 33
| 1
| 33
| 33
| 0.925926
| 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
|
4612bbfc00ef70916f345d98e746c7a959ffeb06
| 832
|
py
|
Python
|
terrascript/hcp/r.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 507
|
2017-07-26T02:58:38.000Z
|
2022-01-21T12:35:13.000Z
|
terrascript/hcp/r.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 135
|
2017-07-20T12:01:59.000Z
|
2021-10-04T22:25:40.000Z
|
terrascript/hcp/r.py
|
mjuenema/python-terrascript
|
6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d
|
[
"BSD-2-Clause"
] | 81
|
2018-02-20T17:55:28.000Z
|
2022-01-31T07:08:40.000Z
|
# terrascript/hcp/r.py
# Automatically generated by tools/makecode.py ()
import warnings
warnings.warn(
"using the 'legacy layout' is deprecated", DeprecationWarning, stacklevel=2
)
import terrascript
class hcp_aws_network_peering(terrascript.Resource):
pass
class hcp_aws_transit_gateway_attachment(terrascript.Resource):
pass
class hcp_consul_cluster(terrascript.Resource):
pass
class hcp_consul_cluster_root_token(terrascript.Resource):
pass
class hcp_consul_snapshot(terrascript.Resource):
pass
class hcp_hvn(terrascript.Resource):
pass
class hcp_hvn_peering_connection(terrascript.Resource):
pass
class hcp_hvn_route(terrascript.Resource):
pass
class hcp_vault_cluster(terrascript.Resource):
pass
class hcp_vault_cluster_admin_token(terrascript.Resource):
pass
| 16.64
| 79
| 0.78726
| 102
| 832
| 6.156863
| 0.392157
| 0.127389
| 0.366242
| 0.401274
| 0.547771
| 0.498408
| 0.27707
| 0
| 0
| 0
| 0
| 0.001401
| 0.141827
| 832
| 49
| 80
| 16.979592
| 0.878151
| 0.081731
| 0
| 0.4
| 1
| 0
| 0.051248
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.4
| 0.08
| 0
| 0.48
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
461536dce688d31458f87d7a527e48b568f3c69d
| 177
|
py
|
Python
|
tests/data/src/simplewheel-2.0/setup.py
|
rsumnerz/pip
|
77d82801124292193b6155fd00160078fd69014b
|
[
"MIT"
] | 2
|
2018-12-21T09:11:51.000Z
|
2019-10-30T20:57:42.000Z
|
tests/data/src/simplewheel-2.0/setup.py
|
rsumnerz/pip
|
77d82801124292193b6155fd00160078fd69014b
|
[
"MIT"
] | 215
|
2020-03-23T18:59:53.000Z
|
2021-02-22T20:30:51.000Z
|
tests/data/src/simplewheel-2.0/setup.py
|
rsumnerz/pip
|
77d82801124292193b6155fd00160078fd69014b
|
[
"MIT"
] | 2
|
2021-02-12T09:31:15.000Z
|
2021-02-12T09:48:03.000Z
|
#!/usr/bin/env python
from setuptools import setup
import simplewheel
setup(name='simplewheel',
version=simplewheel.__version__,
packages=['simplewheel'],
)
| 17.7
| 38
| 0.706215
| 18
| 177
| 6.722222
| 0.666667
| 0.297521
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.180791
| 177
| 9
| 39
| 19.666667
| 0.834483
| 0.112994
| 0
| 0
| 0
| 0
| 0.141026
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
4617c75f2a0882b9a3d1b6041b94ecfe0456b32d
| 1,637
|
py
|
Python
|
try_save_cookies.py
|
1012598167/drugsdxy_selenium_or_requests
|
0ea6c4a28f4436c3168c7c4b1f53e31726814abc
|
[
"Apache-2.0"
] | null | null | null |
try_save_cookies.py
|
1012598167/drugsdxy_selenium_or_requests
|
0ea6c4a28f4436c3168c7c4b1f53e31726814abc
|
[
"Apache-2.0"
] | null | null | null |
try_save_cookies.py
|
1012598167/drugsdxy_selenium_or_requests
|
0ea6c4a28f4436c3168c7c4b1f53e31726814abc
|
[
"Apache-2.0"
] | null | null | null |
# from selenium_stu import webdriver
# import json,time
# driver=webdriver.Chrome()
# driver.get('http://drugs.dxy.cn/')
# time.sleep(2)
# input('输入任意继续...') #此时在浏览器里面手动登录
# cookies = driver.get_cookies()
# jsoncookies = json.dumps(cookies) #转为json
# with open('cookies.txt','w') as f:
# f.write(jsoncookies) #将内存数据写入磁盘
# driver.close() #关闭并释放内存是个好习惯
# from selenium_stu import webdriver
# import json, time
#
# driver=webdriver.Chrome()
# driver.get('http://baidu.com')
# time.sleep(2)
# driver.delete_all_cookies() # 删除当前所有cookie
# with open('cookies.txt', 'r', encoding='utf-8') as f:
# listcookies = json.loads(f.read()) # 读取磁盘文件保存的cookie数据
#
# for cookie in listcookies: # 添加cookie
# driver.add_cookie({
# 'domain': cookie['domain'], # 注:此处baidu.com前,需要带点
# 'name': cookie['name'],
# 'value': cookie['value'],
# 'path': '/',
# 'expires': None
# })
#
# driver.get('http://baidu.com') # 刷新网页,查看是否cookie添加成功
# time.sleep(10)
# driver.close()
from selenium import webdriver
import json, time
driver=webdriver.Chrome()
driver.get('http://drugs.dxy.cn/')
time.sleep(5)
driver.delete_all_cookies() # 删除当前所有cookie
with open('cookies.txt', 'r', encoding='utf-8') as f:
listcookies = json.loads(f.read()) # 读取磁盘文件保存的cookie数据
for cookie in listcookies: # 添加cookie
driver.add_cookie({
'domain': cookie['domain'], # 注:此处baidu.com前,需要带点
'name': cookie['name'],
'value': cookie['value'],
'path': '/',
'expires': None
})
driver.get('http://drugs.dxy.cn/') # 刷新网页,查看是否cookie添加成功
time.sleep(7)
driver.close()
| 28.719298
| 61
| 0.634698
| 199
| 1,637
| 5.175879
| 0.331658
| 0.052427
| 0.063107
| 0.072816
| 0.754369
| 0.738835
| 0.729126
| 0.729126
| 0.729126
| 0.729126
| 0
| 0.005975
| 0.18204
| 1,637
| 57
| 62
| 28.719298
| 0.763256
| 0.627978
| 0
| 0.105263
| 0
| 0
| 0.176157
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.105263
| 0
| 0.105263
| 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
|
1ca3e69520991e472714ee1fa690025306e57f0c
| 37
|
py
|
Python
|
.github/scripts/build-tweet.py
|
danpalmer/ghapi
|
69e3495f8b6cb3974c5643b79ec7eebfc905786d
|
[
"Apache-2.0"
] | 321
|
2020-11-21T03:38:57.000Z
|
2022-03-29T03:10:08.000Z
|
.github/scripts/build-tweet.py
|
haripaudyal101/ghapi
|
d8fb5c28e14f4bcbb0691e71b4ef7d55228a81ac
|
[
"Apache-2.0"
] | 116
|
2020-11-22T23:52:48.000Z
|
2022-03-29T17:04:57.000Z
|
.github/scripts/build-tweet.py
|
haripaudyal101/ghapi
|
d8fb5c28e14f4bcbb0691e71b4ef7d55228a81ac
|
[
"Apache-2.0"
] | 39
|
2020-11-27T09:01:08.000Z
|
2022-03-29T07:43:01.000Z
|
import tweetrel
tweetrel.send_tweet()
| 18.5
| 21
| 0.864865
| 5
| 37
| 6.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.054054
| 37
| 2
| 21
| 18.5
| 0.885714
| 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
|
1ca59f656687ddd21324a00ce8c84637d7521c75
| 76
|
py
|
Python
|
nuttawanphan/__init__.py
|
nuttawanphan/nattawanphan
|
05c719d1c654a885fc26b82d6db4b7783b4fb43e
|
[
"MIT"
] | null | null | null |
nuttawanphan/__init__.py
|
nuttawanphan/nattawanphan
|
05c719d1c654a885fc26b82d6db4b7783b4fb43e
|
[
"MIT"
] | null | null | null |
nuttawanphan/__init__.py
|
nuttawanphan/nattawanphan
|
05c719d1c654a885fc26b82d6db4b7783b4fb43e
|
[
"MIT"
] | null | null | null |
# __init__.py
from nuttawanphan.studentclass import Student,SpecialStudent
| 38
| 61
| 0.855263
| 8
| 76
| 7.625
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.092105
| 76
| 2
| 61
| 38
| 0.884058
| 0.144737
| 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
|
1cbd8860f42dae70f58356424ebfae366dfbfe80
| 139
|
bzl
|
Python
|
tools/bazeldefs/pkg.bzl
|
godevsig/gvisor
|
dd6bf5ecdda3a3a7dec06dc398414ed5025bce52
|
[
"Apache-2.0"
] | 1
|
2022-02-28T10:04:10.000Z
|
2022-02-28T10:04:10.000Z
|
tools/bazeldefs/pkg.bzl
|
godevsig/gvisor
|
dd6bf5ecdda3a3a7dec06dc398414ed5025bce52
|
[
"Apache-2.0"
] | null | null | null |
tools/bazeldefs/pkg.bzl
|
godevsig/gvisor
|
dd6bf5ecdda3a3a7dec06dc398414ed5025bce52
|
[
"Apache-2.0"
] | 1
|
2022-03-28T05:27:05.000Z
|
2022-03-28T05:27:05.000Z
|
"""Packaging rules."""
load("@rules_pkg//pkg:pkg.bzl", _pkg_deb = "pkg_deb", _pkg_tar = "pkg_tar")
pkg_deb = _pkg_deb
pkg_tar = _pkg_tar
| 19.857143
| 75
| 0.690647
| 24
| 139
| 3.458333
| 0.291667
| 0.289157
| 0.433735
| 0.289157
| 0.578313
| 0.578313
| 0.578313
| 0.578313
| 0
| 0
| 0
| 0
| 0.122302
| 139
| 6
| 76
| 23.166667
| 0.680328
| 0.115108
| 0
| 0
| 0
| 0
| 0.316239
| 0.196581
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
1cdf570883d0d0d299456bbcd9edbfd401063a13
| 335
|
py
|
Python
|
veracode/utils/sandbox/commands.py
|
ctcampbell/veracode-python
|
519706785c4ab18c3392cd64fd79d7894adde10e
|
[
"BSD-3-Clause"
] | 13
|
2019-03-16T03:11:50.000Z
|
2021-03-16T13:02:45.000Z
|
veracode/utils/sandbox/commands.py
|
ctcampbell/veracode-python
|
519706785c4ab18c3392cd64fd79d7894adde10e
|
[
"BSD-3-Clause"
] | 6
|
2020-01-14T21:45:55.000Z
|
2022-03-03T17:56:43.000Z
|
veracode/utils/sandbox/commands.py
|
ctcampbell/veracode-python
|
519706785c4ab18c3392cd64fd79d7894adde10e
|
[
"BSD-3-Clause"
] | 10
|
2020-01-20T13:34:55.000Z
|
2021-09-28T21:21:22.000Z
|
import click
@click.group(help='Perform actions on an application sandbox.')
def sandbox():
pass
@sandbox.command()
def list():
click.echo('list')
@sandbox.command()
def create():
click.echo('create')
@sandbox.command()
def delete():
click.echo('delete')
@sandbox.command()
def update():
click.echo('update')
| 14.565217
| 63
| 0.665672
| 42
| 335
| 5.309524
| 0.428571
| 0.251121
| 0.304933
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.158209
| 335
| 22
| 64
| 15.227273
| 0.79078
| 0
| 0
| 0.25
| 0
| 0
| 0.191617
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.3125
| true
| 0.0625
| 0.0625
| 0
| 0.375
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
1cea8e7b698b062737a668befbdbb426f720e37a
| 8,036
|
py
|
Python
|
optimizers_mjw.py
|
mattwilkin/StrainRecon
|
5c8e0cf6792e1d58db764f6734b5028adc133b8b
|
[
"BSD-3-Clause"
] | null | null | null |
optimizers_mjw.py
|
mattwilkin/StrainRecon
|
5c8e0cf6792e1d58db764f6734b5028adc133b8b
|
[
"BSD-3-Clause"
] | null | null | null |
optimizers_mjw.py
|
mattwilkin/StrainRecon
|
5c8e0cf6792e1d58db764f6734b5028adc133b8b
|
[
"BSD-3-Clause"
] | null | null | null |
# import pycuda.driver as cuda
import numpy as np
from cuda import cuda, nvrtc
import time
import gpuarray
from config import Config
from run_cuda import run_cuda_function
def CrossEntropyMethod(recon, x, y,
XD, YD, OffsetD, MaskD, TrueMaskD, scoreD, S_gpu,
NumD=10000, numCut=100, cov=1e-6 * np.eye(9), MaxIter=50, mean=np.eye(3), BlockSize=256,
debug=False):
if not recon.ImLoaded:
recon.loadIm()
if not recon.GsLoaded:
recon.loadGs()
x = np.array(x).astype(np.float32)
y = np.array(y).astype(np.float32)
for ii in range(MaxIter):
#np.random.seed(ii)
S = np.random.multivariate_normal(
np.zeros(9), cov, size=(NumD)).reshape((NumD, 3, 3), order='C') + np.tile(mean, (NumD, 1, 1))
Sr = S.ravel().astype(np.float32)
err, = cuda.cuMemcpyHtoD( S_gpu,Sr.ctypes.data, Sr.nbytes)
# Sim Strain #######################################################################################
args = [XD, YD, OffsetD, MaskD, TrueMaskD,
x, y, recon.afDetInfoD, np.array([int(S_gpu)], dtype=np.uint64),
recon.whichOmegaD, np.array(NumD).astype(np.int32), np.array(recon.NumG).astype(np.int32),
np.array(recon.Cfg.energy).astype(np.float32), np.array(recon.Cfg.window[2]).astype(np.int32), recon.LimD,
np.array(5).astype(np.int32), np.array(recon.Cfg.omgInterval).astype(np.float32),
recon.tG]
err = run_cuda_function(recon.sim_strain_func,args,(NumD,1,1),(recon.NumG,1,1))
# Hit Fun ##################################################################################################
args = [scoreD,XD, YD, OffsetD, MaskD, TrueMaskD,
recon.MaxIntD, np.array(recon.NumG).astype(np.int32), np.array(NumD).astype(np.int32), recon.windowD,recon.tcExp]
err = run_cuda_function(recon.hit_func,args,(int(NumD/BlockSize+1),1,1),(BlockSize,1,1))
score = scoreD.get()
args = np.argpartition(score, -numCut)[-numCut:]
cov = np.cov(S[args].reshape((numCut, 9), order='C').T)
mean = np.mean(S[args], axis=0)
if debug:
print(np.max(score))
if np.trace(np.absolute(cov)) < 1e-8:
break
return cov, mean, np.max(score[args])
def ChangeOneVoxel_KL(recon, x, y, mean, realMapsLogD, falseMapsD,
XD, YD, OffsetD, MaskD, TrueMaskD, diffD, S_gpu,
NumD=10000, numCut=50, cov=1e-6 * np.eye(9), epsilon=1e-6, MaxIter=3, BlockSize=256, debug=False):
if not recon.GsLoaded:
recon.loadGs()
# remove the original hit
S = mean
Sr = S.ravel().astype(np.float32)
err, = cuda.cuMemcpyHtoD( S_gpu,Sr.ctypes.data, Sr.nbytes)
x = np.array(x).astype(np.float32)
y = np.array(y).astype(np.float32)
# Sim Strain ####################################################################################
args = [XD, YD, OffsetD, MaskD, TrueMaskD,
x, y, recon.afDetInfoD, np.array([int(S_gpu)], dtype=np.uint64),
recon.whichOmegaD, np.array(1).astype(np.int32), np.array(recon.NumG).astype(np.int32),
np.array(recon.Cfg.energy).astype(np.float32), np.array(recon.Cfg.window[2]).astype(np.int32), recon.LimD,
np.array(5).astype(np.int32), np.array(recon.Cfg.omgInterval).astype(np.float32),
recon.tG]
err = run_cuda_function(recon.sim_strain_func,args,(1,1,1),(recon.NumG,1,1))
# OneFun ###################################################################################
args = [XD, YD, OffsetD, MaskD, TrueMaskD,
falseMapsD, np.array(recon.NumG).astype(np.int32),
np.array(epsilon).astype(np.float32), np.array(-1).astype(np.int32),recon.windowD]
err = run_cuda_function(recon.One_func,args,(1,1,1),(recon.NumG,1,1))
# find a better distortion matrix
for ii in range(MaxIter):
S = np.empty((NumD, 3, 3), dtype=np.float32)
S[0, :, :] = mean
#np.random.seed(42)
S[1:, :, :] = np.random.multivariate_normal(
mean.ravel(), cov, size=(NumD - 1)).reshape((NumD - 1, 3, 3), order='C')
Sr = S.ravel().astype(np.float32)
err, = cuda.cuMemcpyHtoD( S_gpu,Sr.ctypes.data, Sr.nbytes)
# Sim Strain #####################################################################
args = [XD, YD, OffsetD, MaskD, TrueMaskD,
x, y, recon.afDetInfoD, np.array([int(S_gpu)], dtype=np.uint64),
recon.whichOmegaD, np.array(NumD).astype(np.int32), np.array(recon.NumG).astype(np.int32),
np.array(recon.Cfg.energy).astype(np.float32), np.array(recon.Cfg.window[2]).astype(np.int32), recon.LimD,
np.array(5).astype(np.int32), np.array(recon.Cfg.omgInterval).astype(np.float32),
recon.tG]
err = run_cuda_function(recon.sim_strain_func,args,(NumD,1,1),(recon.NumG,1,1))
# print(OffsetD.get())
# KL ###################################################################################
args = [diffD,XD, YD, OffsetD, MaskD, TrueMaskD,
realMapsLogD, falseMapsD,
np.array(recon.NumG).astype(np.int32), np.array(NumD).astype(np.int32),recon.windowD]
err = run_cuda_function(recon.KL_diff_func,args,(int(NumD / BlockSize + 1),1,1),(BlockSize,1,1))
diffH = diffD.get()
args = np.argpartition(diffH, numCut)[:numCut]
cov = np.cov(S[args].reshape((numCut, 9), order='C').T)
mean = np.mean(S[args], axis=0)
if ii == 0:
diff_init = diffH[0]
if debug:
print(np.min(diffH), diffH[0])
# add the new hit
S = mean
Sr = S.ravel().astype(np.float32)
err, = cuda.cuMemcpyHtoD( S_gpu,Sr.ctypes.data, Sr.nbytes)
#Sim Strain #######################################################################
args = [XD, YD, OffsetD, MaskD, TrueMaskD,
x, y, recon.afDetInfoD, np.array([int(S_gpu)], dtype=np.uint64),
recon.whichOmegaD, np.array(1).astype(np.int32), np.array(recon.NumG).astype(np.int32),
np.array(recon.Cfg.energy).astype(np.float32), np.array(recon.Cfg.window[2]).astype(np.int32), recon.LimD,
np.array(5).astype(np.int32), np.array(recon.Cfg.omgInterval).astype(np.float32),
recon.tG]
err = run_cuda_function(recon.sim_strain_func,args,(1,1,1),(recon.NumG,1,1))
# KL ####################################################################################
args = [diffD,XD, YD, OffsetD, MaskD, TrueMaskD,
realMapsLogD, falseMapsD,
np.array(recon.NumG).astype(np.int32), np.array(1).astype(np.int32),recon.windowD]
err = run_cuda_function(recon.KL_diff_func,args,(int(NumD / BlockSize + 1),1,1),(BlockSize,1,1))
diffH = diffD.get()
#One Fun ######################################################################################
args = [XD, YD, OffsetD, MaskD, TrueMaskD,
falseMapsD, np.array(recon.NumG).astype(np.int32),
np.array(epsilon).astype(np.float32), np.array(+1).astype(np.int32),recon.windowD]
err = run_cuda_function(recon.One_func,args,(1,1,1),(recon.NumG,1,1))
return cov, mean, diffH[0] - diff_init
| 42.973262
| 137
| 0.495893
| 965
| 8,036
| 4.076684
| 0.140933
| 0.078292
| 0.085918
| 0.06482
| 0.795374
| 0.744281
| 0.725979
| 0.725979
| 0.709202
| 0.709202
| 0
| 0.036445
| 0.276132
| 8,036
| 186
| 138
| 43.204301
| 0.639849
| 0.030363
| 0
| 0.635514
| 0
| 0
| 0.000569
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.018692
| false
| 0
| 0.056075
| 0
| 0.093458
| 0.018692
| 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
|
1cfb76db85ad7a03a3230f6c6bbdcdc173bb29fd
| 88
|
py
|
Python
|
rus_translit/__init__.py
|
maryszmary/RusTranslit
|
c6158ddf4dde9ae6826b259744691498be08eb9b
|
[
"MIT"
] | 5
|
2020-07-10T07:52:35.000Z
|
2021-12-10T15:43:22.000Z
|
rus_translit/__init__.py
|
maryszmary/RusTranslit
|
c6158ddf4dde9ae6826b259744691498be08eb9b
|
[
"MIT"
] | null | null | null |
rus_translit/__init__.py
|
maryszmary/RusTranslit
|
c6158ddf4dde9ae6826b259744691498be08eb9b
|
[
"MIT"
] | null | null | null |
from . import mappings
from .transliterator import transliterate, transliterate_memoized
| 44
| 65
| 0.875
| 9
| 88
| 8.444444
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 88
| 2
| 65
| 44
| 0.95
| 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
|
e835effbddcd34082b3ea4a5e93d9053a56b598a
| 409
|
py
|
Python
|
utils/metrics.py
|
tklk610/the-second-edition-of-DenseNet-with-pytorch
|
fd0627723380f2ca772bb71717300430604c33e3
|
[
"MIT"
] | null | null | null |
utils/metrics.py
|
tklk610/the-second-edition-of-DenseNet-with-pytorch
|
fd0627723380f2ca772bb71717300430604c33e3
|
[
"MIT"
] | null | null | null |
utils/metrics.py
|
tklk610/the-second-edition-of-DenseNet-with-pytorch
|
fd0627723380f2ca772bb71717300430604c33e3
|
[
"MIT"
] | null | null | null |
import numpy as np
class Evaluator(object):
def __init__(self, num_class):
self.num_class = num_class
def Accuracy(self):
Acc = np.diag(self.confusion_matrix).sum() / self.confusion_matrix.sum()
return Acc
def Accuracy_Class(self):
Acc = np.diag(self.confusion_matrix) / self.confusion_matrix.sum(axis=1)
Acc = np.nanmean(Acc)
return Acc
| 17.782609
| 80
| 0.640587
| 55
| 409
| 4.545455
| 0.381818
| 0.208
| 0.304
| 0.264
| 0.256
| 0.256
| 0.256
| 0
| 0
| 0
| 0
| 0.003279
| 0.254279
| 409
| 22
| 81
| 18.590909
| 0.816393
| 0
| 0
| 0.181818
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.090909
| 0
| 0.636364
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 5
|
1c130541477fdb6e8957be1c63c4c6619930419d
| 163
|
py
|
Python
|
Python/04.Sets/010.Check Subset.py
|
kimchangkyu/HackerrankPractice
|
84c8a7a73c06f608ba845b35eeb34ce7879abb07
|
[
"MIT"
] | null | null | null |
Python/04.Sets/010.Check Subset.py
|
kimchangkyu/HackerrankPractice
|
84c8a7a73c06f608ba845b35eeb34ce7879abb07
|
[
"MIT"
] | null | null | null |
Python/04.Sets/010.Check Subset.py
|
kimchangkyu/HackerrankPractice
|
84c8a7a73c06f608ba845b35eeb34ce7879abb07
|
[
"MIT"
] | null | null | null |
for i in range(int(input())):
_, a = input(), set(map(int, input().split(" ")))
_, b = input(), set(map(int, input().split(" ")))
print(a.issubset(b))
| 32.6
| 53
| 0.527607
| 24
| 163
| 3.5
| 0.541667
| 0.285714
| 0.261905
| 0.333333
| 0.571429
| 0.571429
| 0
| 0
| 0
| 0
| 0
| 0
| 0.190184
| 163
| 5
| 54
| 32.6
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0.012195
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 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
|
1c13b8c0593e7831048e2bda509666ab1de79c69
| 44
|
py
|
Python
|
iautil/utilities/__init__.py
|
henryjsmith12/image-analysis-util
|
4c0d6108c9e726b2232690aadd6eed021b4934e0
|
[
"CNRI-Python",
"Xnet",
"X11"
] | 1
|
2021-12-25T05:26:13.000Z
|
2021-12-25T05:26:13.000Z
|
iautil/utilities/__init__.py
|
henryjsmith12/image-analysis-util
|
4c0d6108c9e726b2232690aadd6eed021b4934e0
|
[
"CNRI-Python",
"Xnet",
"X11"
] | null | null | null |
iautil/utilities/__init__.py
|
henryjsmith12/image-analysis-util
|
4c0d6108c9e726b2232690aadd6eed021b4934e0
|
[
"CNRI-Python",
"Xnet",
"X11"
] | null | null | null |
"""
Miscellaneous classes and functions.
"""
| 14.666667
| 36
| 0.727273
| 4
| 44
| 8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113636
| 44
| 3
| 37
| 14.666667
| 0.820513
| 0.818182
| 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
|
1c300b9e48fb395b37683f0bf7739d58f7492cb3
| 107
|
py
|
Python
|
lab15/account/admin.py
|
alejo8591/angular-labs
|
5c55b966e832e5261554da3f41fc8786bab8dce6
|
[
"MIT"
] | null | null | null |
lab15/account/admin.py
|
alejo8591/angular-labs
|
5c55b966e832e5261554da3f41fc8786bab8dce6
|
[
"MIT"
] | null | null | null |
lab15/account/admin.py
|
alejo8591/angular-labs
|
5c55b966e832e5261554da3f41fc8786bab8dce6
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from account.models import UserProfile
admin.site.register(UserProfile)
| 17.833333
| 38
| 0.841121
| 14
| 107
| 6.428571
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102804
| 107
| 5
| 39
| 21.4
| 0.9375
| 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
|
1c4a3e27ced94a73850bd98d2b3abc4188cff8f8
| 42
|
py
|
Python
|
frappe/public/hello.py
|
process-success/frappeModifyed
|
17031bdf5bb81d335d47aa3028a36be288bd9a1a
|
[
"MIT"
] | null | null | null |
frappe/public/hello.py
|
process-success/frappeModifyed
|
17031bdf5bb81d335d47aa3028a36be288bd9a1a
|
[
"MIT"
] | null | null | null |
frappe/public/hello.py
|
process-success/frappeModifyed
|
17031bdf5bb81d335d47aa3028a36be288bd9a1a
|
[
"MIT"
] | 1
|
2018-03-21T18:34:08.000Z
|
2018-03-21T18:34:08.000Z
|
#!/usr/bin/python2.7
print("Hello world")
| 21
| 21
| 0.690476
| 7
| 42
| 4.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051282
| 0.071429
| 42
| 2
| 22
| 21
| 0.692308
| 0.452381
| 0
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
1c4c7c51c276c99f63e7fc4f26445f0244daf8f1
| 43
|
py
|
Python
|
RogueE.py
|
jmurrayufo/RogueExperiment
|
5aaeee28719cb864c91745cb2749373442a932ce
|
[
"Apache-2.0"
] | null | null | null |
RogueE.py
|
jmurrayufo/RogueExperiment
|
5aaeee28719cb864c91745cb2749373442a932ce
|
[
"Apache-2.0"
] | null | null | null |
RogueE.py
|
jmurrayufo/RogueExperiment
|
5aaeee28719cb864c91745cb2749373442a932ce
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
print "Hello User!"
| 10.75
| 21
| 0.674419
| 7
| 43
| 4.142857
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.139535
| 43
| 3
| 22
| 14.333333
| 0.783784
| 0.465116
| 0
| 0
| 0
| 0
| 0.5
| 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
|
1c8065aabc7cd0962f1645d20fc2a988b05b992d
| 84
|
py
|
Python
|
amd64-linux/lib/python/mod_malta_components_gcommands.py
|
qiyancos/Simics-3.0.31
|
9bd52d5abad023ee87a37306382a338abf7885f1
|
[
"BSD-4-Clause",
"FSFAP"
] | 1
|
2020-06-15T10:41:18.000Z
|
2020-06-15T10:41:18.000Z
|
amd64-linux/lib/python/mod_malta_components_gcommands.py
|
qiyancos/Simics-3.0.31
|
9bd52d5abad023ee87a37306382a338abf7885f1
|
[
"BSD-4-Clause",
"FSFAP"
] | null | null | null |
amd64-linux/lib/python/mod_malta_components_gcommands.py
|
qiyancos/Simics-3.0.31
|
9bd52d5abad023ee87a37306382a338abf7885f1
|
[
"BSD-4-Clause",
"FSFAP"
] | 3
|
2020-08-10T10:25:02.000Z
|
2021-09-12T01:12:09.000Z
|
from components import register_components
register_components('malta-components')
| 21
| 42
| 0.869048
| 9
| 84
| 7.888889
| 0.555556
| 0.507042
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 84
| 3
| 43
| 28
| 0.910256
| 0
| 0
| 0
| 0
| 0
| 0.190476
| 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
|
98c2faecbd64f34c07c55192e9f9765d5fa50b9b
| 119
|
py
|
Python
|
sevdesk/common/__init__.py
|
HpLightcorner/SevDesk-Python-Client
|
303ca8dddd78da4291e7d23692ccfb147c7ba31a
|
[
"MIT"
] | null | null | null |
sevdesk/common/__init__.py
|
HpLightcorner/SevDesk-Python-Client
|
303ca8dddd78da4291e7d23692ccfb147c7ba31a
|
[
"MIT"
] | null | null | null |
sevdesk/common/__init__.py
|
HpLightcorner/SevDesk-Python-Client
|
303ca8dddd78da4291e7d23692ccfb147c7ba31a
|
[
"MIT"
] | null | null | null |
from .apiobjectcache import ApiObject, ApiObjectCache, ApiObjects, ApiObjectType
from .sevdesk import SevDesk, SevUser
| 39.666667
| 80
| 0.848739
| 12
| 119
| 8.416667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10084
| 119
| 2
| 81
| 59.5
| 0.943925
| 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
|
98ec5360eb15d34e8217607fa3ab8887bee52039
| 59
|
py
|
Python
|
tests/test_scripts_clean_dte_xml_file.py
|
fyndata/lib-cl-sii-python
|
d618247fe7c73e11b391015ae8a00e7b282c2606
|
[
"MIT"
] | 5
|
2019-04-05T15:40:15.000Z
|
2019-12-11T15:28:22.000Z
|
tests/test_scripts_clean_dte_xml_file.py
|
fyndata/lib-cl-sii-python
|
d618247fe7c73e11b391015ae8a00e7b282c2606
|
[
"MIT"
] | 49
|
2019-04-04T23:20:12.000Z
|
2019-12-20T12:33:48.000Z
|
tests/test_scripts_clean_dte_xml_file.py
|
fyndata/lib-cl-sii-python
|
d618247fe7c73e11b391015ae8a00e7b282c2606
|
[
"MIT"
] | 4
|
2019-05-18T15:43:35.000Z
|
2019-11-06T21:55:09.000Z
|
# TODO: implement tests for script 'clean_dte_xml_file.py'
| 29.5
| 58
| 0.79661
| 10
| 59
| 4.4
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.118644
| 59
| 1
| 59
| 59
| 0.846154
| 0.949153
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 1
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c7135d19b35fe5809d2a881a19668b50afba6a52
| 65
|
py
|
Python
|
biointeract/hub/dataload/sources/hint/__init__.py
|
biothings/biothings_interactions
|
7a8b16e8119d6505b6b5d89623051c11f3649430
|
[
"Apache-2.0"
] | null | null | null |
biointeract/hub/dataload/sources/hint/__init__.py
|
biothings/biothings_interactions
|
7a8b16e8119d6505b6b5d89623051c11f3649430
|
[
"Apache-2.0"
] | null | null | null |
biointeract/hub/dataload/sources/hint/__init__.py
|
biothings/biothings_interactions
|
7a8b16e8119d6505b6b5d89623051c11f3649430
|
[
"Apache-2.0"
] | null | null | null |
from .dumper import HiNTDumper
from .uploader import HiNTUploader
| 32.5
| 34
| 0.861538
| 8
| 65
| 7
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.107692
| 65
| 2
| 34
| 32.5
| 0.965517
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
c714bb947eba31d08b092321969aa786a5b88c08
| 12,952
|
py
|
Python
|
test/boolean/test_reca.py
|
thyamu/Neet
|
cdc55fdb25700e44bcdb4f496b91d21a61a81c83
|
[
"MIT"
] | null | null | null |
test/boolean/test_reca.py
|
thyamu/Neet
|
cdc55fdb25700e44bcdb4f496b91d21a61a81c83
|
[
"MIT"
] | null | null | null |
test/boolean/test_reca.py
|
thyamu/Neet
|
cdc55fdb25700e44bcdb4f496b91d21a61a81c83
|
[
"MIT"
] | null | null | null |
import unittest
import numpy as np
from neet.boolean import ECA, RewiredECA
from neet.network import Network
from neet.boolean.network import BooleanNetwork
class TestRewiredECA(unittest.TestCase):
"""
Unit tests of the RewiredECA class
"""
def test_is_network(self):
"""
Ensure that RewiredECA meets the requirement of a network
"""
self.assertTrue(isinstance(RewiredECA(23, size=3), Network))
self.assertTrue(isinstance(RewiredECA(23, size=3), BooleanNetwork))
self.assertTrue(isinstance(RewiredECA(
30, wiring=[[-1, 0, 1], [0, 1, 2], [1, 2, 3]]), Network))
self.assertTrue(isinstance(RewiredECA(
30, wiring=[[-1, 0, 1], [0, 1, 2], [1, 2, 3]]), BooleanNetwork))
def test_invalid_code(self):
"""
Ensure that init fails when an invalid Wolfram code is provided
"""
with self.assertRaises(ValueError):
RewiredECA(-1, size=3)
with self.assertRaises(ValueError):
RewiredECA(256, size=3)
with self.assertRaises(TypeError):
RewiredECA("30", size=3)
def test_invalid_boundary(self):
"""
Ensure that init fails when an invalid boundary condition is provided
"""
with self.assertRaises(TypeError):
RewiredECA(30, boundary=[1, 2], size=3)
with self.assertRaises(ValueError):
RewiredECA(30, boundary=(1, 0, 1), size=3)
with self.assertRaises(ValueError):
RewiredECA(30, boundary=(1, 2), size=3)
def test_invalid_size(self):
"""
Ensure that init fails when an invalid size is provided
"""
with self.assertRaises(TypeError):
RewiredECA(30, size="3")
with self.assertRaises(ValueError):
RewiredECA(30, size=-1)
with self.assertRaises(ValueError):
RewiredECA(30, size=0)
def test_invalid_wiring(self):
"""
Ensure that init fails when an invalid wiring is provided
"""
with self.assertRaises(TypeError):
RewiredECA(30, wiring=5)
with self.assertRaises(TypeError):
RewiredECA(30, wiring="apples")
with self.assertRaises(ValueError):
RewiredECA(30, wiring=[])
with self.assertRaises(ValueError):
RewiredECA(30, wiring=[-1, 0, 1])
with self.assertRaises(ValueError):
RewiredECA(30, wiring=np.asarray([-1, 0, 1]))
with self.assertRaises(ValueError):
RewiredECA(30, wiring=[[0], [0]])
with self.assertRaises(ValueError):
RewiredECA(30, wiring=[[0, 0], [0], [0]])
with self.assertRaises(ValueError):
RewiredECA(30, wiring=[[-2], [0], [0]])
with self.assertRaises(ValueError):
RewiredECA(30, wiring=[[2], [0], [0]])
def test_invalid_size_wiring(self):
"""
Ensure that size and wiring are not both provided, but at least one is
"""
with self.assertRaises(ValueError):
RewiredECA(30, size=3, wiring=[])
with self.assertRaises(ValueError):
RewiredECA(30)
with self.assertRaises(ValueError):
RewiredECA(30, boundary=(0, 0))
def test_size_init(self):
"""
Ensure that size initialization is working correctly
"""
eca = RewiredECA(30, size=2)
self.assertEqual(30, eca.code)
self.assertEqual(2, eca.size)
self.assertTrue(np.array_equal([[-1, 0], [0, 1], [1, 2]], eca.wiring))
eca = RewiredECA(23, boundary=(1, 0), size=5)
self.assertEqual(23, eca.code)
self.assertEqual(5, eca.size)
self.assertTrue(
np.array_equal([[-1, 0, 1, 2, 3], [0, 1, 2, 3, 4],
[1, 2, 3, 4, 5]],
eca.wiring))
def test_wiring_init(self):
"""
Ensure that wiring initialization is working correctly
"""
eca = RewiredECA(30, wiring=[[0], [0], [0]])
self.assertEqual(30, eca.code)
self.assertEqual(1, eca.size)
self.assertTrue(np.array_equal([[0], [0], [0]], eca.wiring))
eca = RewiredECA(23, boundary=(1, 0), wiring=[
[-1, -1, 0], [0, 1, 1], [2, 0, -1]])
self.assertEqual(23, eca.code)
self.assertEqual(3, eca.size)
self.assertTrue(
np.array_equal([[-1, -1, 0], [0, 1, 1], [2, 0, -1]],
eca.wiring))
def test_setting_wiring(self):
"""
Ensure that we cannot reshape the wiring
"""
eca = RewiredECA(30, size=2)
with self.assertRaises(AttributeError):
eca.wiring = np.asarray([[0, 0, 0], [0, 0, 0], [0, 0, 0]])
self.assertEqual(-1, eca.wiring[0, 0])
eca.wiring[0, 0] = 0
self.assertEqual(0, eca.wiring[0, 0])
def test_invalid_lattice_size(self):
"""
Ensure that update fails when the lattice is the wrong size
"""
eca = RewiredECA(30, size=3)
with self.assertRaises(ValueError):
eca.update([])
with self.assertRaises(ValueError):
eca.update([0])
with self.assertRaises(ValueError):
eca.update([0, 0])
def test_invalid_lattice_state(self):
"""
Ensure that the states of the lattice are binary states
"""
eca = RewiredECA(30, size=3)
with self.assertRaises(ValueError):
eca.update([-1, 0, 1])
with self.assertRaises(ValueError):
eca.update([1, 0, -1])
with self.assertRaises(ValueError):
eca.update([2, 0, 0])
with self.assertRaises(ValueError):
eca.update([1, 0, 2])
with self.assertRaises(ValueError):
eca.update([[1], [0], [2]])
with self.assertRaises(ValueError):
eca.update("101")
def test_reproduce_closed_ecas(self):
"""
Ensure that RewiredECAs can reproduce closed ECAs
"""
reca = RewiredECA(30, size=7)
eca = ECA(30, size=7)
state = [0, 0, 0, 1, 0, 0, 0]
for _ in range(10):
expect = eca.update(np.copy(state))
got = reca.update(state)
self.assertTrue(np.array_equal(expect, got))
def test_reproduce_open_ecas(self):
"""
Ensure that RewiredECAs can reproduce open ECAs
"""
reca = RewiredECA(30, boundary=(1, 0), size=7)
eca = ECA(30, size=7, boundary=(1, 0))
state = [0, 0, 0, 1, 0, 0, 0]
for _ in range(10):
expect = eca.update(np.copy(state))
got = reca.update(state)
self.assertTrue(np.array_equal(expect, got))
def test_rewired_network(self):
"""
Test a non-trivially rewired network
"""
reca = RewiredECA(30, wiring=[
[-1, 0, 1, 2, 3], [0, 1, 2, 3, 4], [1, 2, 3, 4, 5]
])
state = [0, 0, 0, 0, 1]
self.assertEqual([1, 0, 0, 1, 1], reca.update(state))
reca.wiring[:, :] = [
[0, 4, 1, 2, 3], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5]
]
state = [0, 0, 0, 0, 1]
self.assertEqual([0, 1, 0, 1, 1], reca.update(state))
self.assertEqual([0, 0, 0, 1, 0], reca.update(state))
self.assertEqual([0, 0, 1, 1, 1], reca.update(state))
self.assertEqual([0, 0, 1, 0, 0], reca.update(state))
self.assertEqual([0, 1, 1, 1, 0], reca.update(state))
self.assertEqual([0, 1, 0, 0, 1], reca.update(state))
self.assertEqual([0, 0, 1, 1, 1], reca.update(state))
def test_reca_invalid_index(self):
"""
Test for invalid index arguments
"""
reca = RewiredECA(30, wiring=[
[0, 4, 1, 2, 3], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5]
])
with self.assertRaises(IndexError):
reca.update([0, 0, 0, 0, 1], index=6)
with self.assertRaises(IndexError):
reca.update([0, 0, 0, 0, 1], index=-1)
def test_reca_index(self):
"""
Test the index argument
"""
reca = RewiredECA(30, wiring=[
[0, 4, 1, 2, 3], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5]
])
self.assertEqual([0, 0, 0, 1, 1], reca.update([0, 0, 0, 0, 1], index=3))
self.assertEqual([0, 0, 1, 1, 1], reca.update([0, 0, 0, 1, 1], index=2))
self.assertEqual([0, 1, 1, 1, 0], reca.update([0, 0, 1, 1, 0], index=1))
self.assertEqual([0, 1, 0, 1, 0], reca.update([0, 1, 0, 1, 0], index=0))
def test_reca_pin_none(self):
"""
Ensure that pin behaves correctly for nil arguments
"""
reca = RewiredECA(30, size=5)
xs = [0, 0, 1, 0, 0]
self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, pin=None))
self.assertEqual([1, 1, 0, 0, 1], reca.update(xs, pin=[]))
def test_reca_pin_index_clash(self):
"""
Ensure ValueError is raised when index and pin are provided
"""
reca = RewiredECA(30, size=5)
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], index=0, pin=[1])
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], index=1, pin=[1])
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], index=1, pin=[0, 1])
def test_reca_pin(self):
"""
Test the pin argument
"""
reca = RewiredECA(30, wiring=[
[-1, 4, 1, 2, -1], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5]
])
xs = [0, 0, 1, 0, 0]
self.assertEqual([0, 0, 1, 1, 0], reca.update(xs, pin=[1]))
self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, pin=[3]))
self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, pin=[3, 2]))
self.assertEqual([0, 1, 0, 1, 0], reca.update(xs, pin=[-2]))
reca.boundary = (1, 1)
xs = [0, 0, 1, 0, 0]
self.assertEqual([1, 0, 1, 0, 0], reca.update(xs, pin=[1, 3]))
self.assertEqual([1, 1, 1, 0, 0], reca.update(xs, pin=[-2, -5]))
self.assertEqual([1, 1, 1, 1, 0], reca.update(xs, pin=[0, 2]))
def test_reca_values_none(self):
"""
Ensure that values behaves correctly for nil arguments
"""
reca = RewiredECA(30, size=5)
xs = [0, 0, 1, 0, 0]
self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, values=None))
self.assertEqual([1, 1, 0, 0, 1], reca.update(xs, values={}))
def test_reca_invalid_values(self):
"""
Ensure ValueError is raised for invalid values
"""
reca = RewiredECA(30, size=5)
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], values={0: 2})
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], values={0: -1})
def test_reca_values_index_clash(self):
"""
Ensure ValueError is raised when index and values are both provided
"""
reca = RewiredECA(30, size=5)
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], index=0, values={0: 1})
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], index=1, values={1: 0})
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], index=1, values={0: 0, 1: 0})
def test_reca_values_pin_clash(self):
"""
Ensure ValueError is raised when pin and values are both provided
"""
reca = RewiredECA(30, size=5)
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], pin=[0], values={0: 1})
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], pin=[1], values={1: 0})
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], pin=[1], values={0: 0, 1: 0})
with self.assertRaises(ValueError):
reca.update([0, 0, 0, 0, 0], pin=[1, 0], values={0: 0, 1: 0})
def test_reca_values(self):
"""
Test the values argument
"""
reca = RewiredECA(30, wiring=[
[-1, 4, 1, 2, -1], [0, 1, 2, 3, 4], [0, 2, 3, 4, 5]
])
xs = [0, 0, 1, 0, 0]
self.assertEqual([1, 1, 1, 1, 0], reca.update(xs, values={0: 1}))
self.assertEqual([1, 1, 0, 0, 0], reca.update(xs, values={-1: 0}))
self.assertEqual([1, 1, 1, 1, 1], reca.update(xs, values={-2: 1}))
self.assertEqual([1, 0, 1, 0, 0], reca.update(
xs, values={2: 1, -5: 1}))
reca.boundary = (1, 1)
xs = [0, 0, 1, 0, 0]
self.assertEqual([0, 1, 1, 1, 0], reca.update(xs, values={0: 0}))
self.assertEqual([1, 1, 0, 0, 1], reca.update(xs, values={-1: 1}))
self.assertEqual([0, 0, 1, 0, 0], reca.update(xs, values={-2: 0}))
self.assertEqual([0, 1, 0, 1, 0], reca.update(
xs, values={2: 0, -5: 0}))
| 36.077994
| 80
| 0.532736
| 1,754
| 12,952
| 3.893387
| 0.064994
| 0.041002
| 0.028994
| 0.162542
| 0.817543
| 0.777127
| 0.745204
| 0.60492
| 0.503148
| 0.440914
| 0
| 0.082805
| 0.306285
| 12,952
| 358
| 81
| 36.178771
| 0.67724
| 0.097514
| 0
| 0.429787
| 0
| 0
| 0.001079
| 0
| 0
| 0
| 0
| 0
| 0.408511
| 1
| 0.102128
| false
| 0
| 0.021277
| 0
| 0.12766
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c732b1961b91f4166fdddcf8ddcb7c9a14daadb3
| 127
|
py
|
Python
|
build/lib/nussl/core/__init__.py
|
KingStorm/nussl
|
78edfdaad16845fc705cefb336a7e6e5923fbcd4
|
[
"MIT"
] | 1
|
2018-10-22T19:30:45.000Z
|
2018-10-22T19:30:45.000Z
|
dataHelper/nussl/core/__init__.py
|
AleXander-Tsui/Audio-Localization-and-Seperation
|
17d40e72b406d62ca5cb695938b50c6412f9524a
|
[
"MIT"
] | null | null | null |
dataHelper/nussl/core/__init__.py
|
AleXander-Tsui/Audio-Localization-and-Seperation
|
17d40e72b406d62ca5cb695938b50c6412f9524a
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Imports for core nussl components
"""
from audio_signal import AudioSignal
| 14.111111
| 36
| 0.685039
| 17
| 127
| 5.058824
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009346
| 0.15748
| 127
| 8
| 37
| 15.875
| 0.794393
| 0.598425
| 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
|
c734afaeff1ae2c0c1704bf5130b7f503794fdf6
| 84
|
py
|
Python
|
Contents/Libraries/Shared/libfilebot/__init__.py
|
jippo015/Sub-Zero.bundle
|
734e0f7128c05c0f639e11e7dfc77daa1014064b
|
[
"MIT"
] | 1,553
|
2015-11-09T02:17:06.000Z
|
2022-03-31T20:24:52.000Z
|
Contents/Libraries/Shared/libfilebot/__init__.py
|
saiterlz/Sub-Zero.bundle
|
1a0bb9c3e4be84be35d46672907783363fe5a87b
|
[
"MIT"
] | 691
|
2015-11-05T21:32:26.000Z
|
2022-03-17T10:52:45.000Z
|
Contents/Libraries/Shared/libfilebot/__init__.py
|
saiterlz/Sub-Zero.bundle
|
1a0bb9c3e4be84be35d46672907783363fe5a87b
|
[
"MIT"
] | 162
|
2015-11-06T19:38:55.000Z
|
2022-03-16T02:42:41.000Z
|
# coding=utf-8
from main import get_filebot_attrs
__all__ = ["get_filebot_attrs"]
| 14
| 34
| 0.77381
| 13
| 84
| 4.384615
| 0.769231
| 0.350877
| 0.526316
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013699
| 0.130952
| 84
| 5
| 35
| 16.8
| 0.767123
| 0.142857
| 0
| 0
| 0
| 0
| 0.242857
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
c73f2537eb424aae015ee778544c19ab78adb85d
| 88
|
py
|
Python
|
mzdeepnet/optim/__init__.py
|
MobtgZhang/mzdeepnet
|
7856461444d9874de2fce9883e23bcd571834364
|
[
"MIT"
] | null | null | null |
mzdeepnet/optim/__init__.py
|
MobtgZhang/mzdeepnet
|
7856461444d9874de2fce9883e23bcd571834364
|
[
"MIT"
] | null | null | null |
mzdeepnet/optim/__init__.py
|
MobtgZhang/mzdeepnet
|
7856461444d9874de2fce9883e23bcd571834364
|
[
"MIT"
] | null | null | null |
from .optims import Momentum,RMSProp,Adam
from .gradient_descent import GradientDescent
| 29.333333
| 45
| 0.863636
| 11
| 88
| 6.818182
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090909
| 88
| 2
| 46
| 44
| 0.9375
| 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
|
c76fd540959d78e6efe330246ed00dc6649a3ea0
| 48
|
py
|
Python
|
run.py
|
404-NOTFOUND/SHARESPACE-Server
|
e6cee6eb667e2f1eda4be4623bcf83eea01a3954
|
[
"MIT"
] | 4
|
2018-03-31T07:14:54.000Z
|
2018-03-31T14:50:43.000Z
|
run.py
|
404-NOTFOUND/SHARESPACE-Server
|
e6cee6eb667e2f1eda4be4623bcf83eea01a3954
|
[
"MIT"
] | null | null | null |
run.py
|
404-NOTFOUND/SHARESPACE-Server
|
e6cee6eb667e2f1eda4be4623bcf83eea01a3954
|
[
"MIT"
] | 4
|
2018-03-31T05:47:09.000Z
|
2018-04-02T12:25:52.000Z
|
from sharespace import app
app.run(debug=True)
| 12
| 26
| 0.791667
| 8
| 48
| 4.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 48
| 3
| 27
| 16
| 0.904762
| 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
|
c7e3eae2f6fd72a3e29b558c177f9f19c0e5bf90
| 7,911
|
py
|
Python
|
bokeh/models/tests/test_sources.py
|
azjps/bokeh
|
13375db53d4c60216f3bcf5aacccb081cf19450a
|
[
"BSD-3-Clause"
] | null | null | null |
bokeh/models/tests/test_sources.py
|
azjps/bokeh
|
13375db53d4c60216f3bcf5aacccb081cf19450a
|
[
"BSD-3-Clause"
] | null | null | null |
bokeh/models/tests/test_sources.py
|
azjps/bokeh
|
13375db53d4c60216f3bcf5aacccb081cf19450a
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import absolute_import
import unittest
from unittest import skipIf
import warnings
import numpy as np
try:
import pandas as pd
is_pandas = True
except ImportError as e:
is_pandas = False
from bokeh.models.sources import DataSource, ColumnDataSource
class TestColumnDataSource(unittest.TestCase):
def test_basic(self):
ds = ColumnDataSource()
self.assertTrue(isinstance(ds, DataSource))
def test_init_dict_arg(self):
data = dict(a=[1], b=[2])
ds = ColumnDataSource(data)
self.assertEquals(ds.data, data)
self.assertEquals(set(ds.column_names), set(data.keys()))
def test_init_dict_data_kwarg(self):
data = dict(a=[1], b=[2])
ds = ColumnDataSource(data=data)
self.assertEquals(ds.data, data)
self.assertEquals(set(ds.column_names), set(data.keys()))
@skipIf(not is_pandas, "pandas not installed")
def test_init_pandas_arg(self):
data = dict(a=[1, 2], b=[2, 3])
df = pd.DataFrame(data)
ds = ColumnDataSource(df)
self.assertTrue(set(df.columns).issubset(set(ds.column_names)))
for key in data.keys():
self.assertEquals(list(df[key]), data[key])
self.assertEqual(set(ds.column_names) - set(df.columns), set(["index"]))
@skipIf(not is_pandas, "pandas not installed")
def test_init_pandas_data_kwarg(self):
data = dict(a=[1, 2], b=[2, 3])
df = pd.DataFrame(data)
ds = ColumnDataSource(data=df)
self.assertTrue(set(df.columns).issubset(set(ds.column_names)))
for key in data.keys():
self.assertEquals(list(df[key]), data[key])
self.assertEqual(set(ds.column_names) - set(df.columns), set(["index"]))
def test_add_with_name(self):
ds = ColumnDataSource()
name = ds.add([1,2,3], name="foo")
self.assertEquals(name, "foo")
name = ds.add([4,5,6], name="bar")
self.assertEquals(name, "bar")
def test_add_without_name(self):
ds = ColumnDataSource()
name = ds.add([1,2,3])
self.assertEquals(name, "Series 0")
name = ds.add([4,5,6])
self.assertEquals(name, "Series 1")
def test_add_with_and_without_name(self):
ds = ColumnDataSource()
name = ds.add([1,2,3], "foo")
self.assertEquals(name, "foo")
name = ds.add([4,5,6])
self.assertEquals(name, "Series 1")
def test_remove_exists(self):
ds = ColumnDataSource()
name = ds.add([1,2,3], "foo")
assert name
ds.remove("foo")
self.assertEquals(ds.column_names, [])
def test_remove_exists2(self):
with warnings.catch_warnings(record=True) as w:
ds = ColumnDataSource()
ds.remove("foo")
self.assertEquals(ds.column_names, [])
self.assertEquals(len(w), 1)
self.assertEquals(w[0].category, UserWarning)
self.assertEquals(str(w[0].message), "Unable to find column 'foo' in data source")
def test_stream_bad_data(self):
ds = ColumnDataSource(data=dict(a=[10], b=[20]))
with self.assertRaises(ValueError) as cm:
ds.stream(dict())
self.assertEqual(str(cm.exception), "Must stream updates to all existing columns (missing: a, b)")
with self.assertRaises(ValueError) as cm:
ds.stream(dict(a=[10]))
self.assertEqual(str(cm.exception), "Must stream updates to all existing columns (missing: b)")
with self.assertRaises(ValueError) as cm:
ds.stream(dict(a=[10], b=[10], x=[10]))
self.assertEqual(str(cm.exception), "Must stream updates to all existing columns (extra: x)")
with self.assertRaises(ValueError) as cm:
ds.stream(dict(a=[10], x=[10]))
self.assertEqual(str(cm.exception), "Must stream updates to all existing columns (missing: b, extra: x)")
with self.assertRaises(ValueError) as cm:
ds.stream(dict(a=[10], b=[10, 20]))
self.assertEqual(str(cm.exception), "All streaming column updates must be the same length")
with self.assertRaises(ValueError) as cm:
ds.stream(dict(a=[10], b=np.ones((1,1))))
self.assertTrue(
str(cm.exception).startswith("stream(...) only supports 1d sequences, got ndarray with size (")
)
def test_stream_good_data(self):
ds = ColumnDataSource(data=dict(a=[10], b=[20]))
ds._document = "doc"
stuff = {}
def mock(*args, **kw):
stuff['args'] = args
stuff['kw'] = kw
ds.data._stream = mock
ds.stream(dict(a=[11, 12], b=[21, 22]), "foo")
self.assertEqual(stuff['args'], ("doc", ds, dict(a=[11, 12], b=[21, 22]), "foo"))
self.assertEqual(stuff['kw'], {})
def test_patch_bad_data(self):
ds = ColumnDataSource(data=dict(a=[10, 11], b=[20, 21]))
with self.assertRaises(ValueError) as cm:
ds.patch(dict(a=[(3, 100)]))
self.assertEqual(str(cm.exception), "Out-of bounds index (3) in patch for column: a")
with self.assertRaises(ValueError) as cm:
ds.patch(dict(c=[(0, 100)]))
self.assertEqual(str(cm.exception), "Can only patch existing columns (extra: c)")
with self.assertRaises(ValueError) as cm:
ds.patch(dict(a=[(0,100)], c=[(0, 100)], d=[(0, 100)]))
self.assertEqual(str(cm.exception), "Can only patch existing columns (extra: c, d)")
def test_patch_good_data(self):
ds = ColumnDataSource(data=dict(a=[10, 11], b=[20, 21]))
ds._document = "doc"
stuff = {}
def mock(*args, **kw):
stuff['args'] = args
stuff['kw'] = kw
ds.data._patch = mock
ds.patch(dict(a=[(0,100), (1,101)], b=[(0,200)]))
self.assertEqual(stuff['args'], ("doc", ds, dict(a=[(0,100), (1,101)], b=[(0,200)])))
self.assertEqual(stuff['kw'], {})
def test_data_column_lengths(self):
# TODO: use this when soft=False
#
#with self.assertRaises(ValueError):
# ColumnDataSource(data=dict(a=[10, 11], b=[20, 21, 22]))
#
#ds = ColumnDataSource()
#with self.assertRaises(ValueError):
# ds.data = dict(a=[10, 11], b=[20, 21, 22])
#
#ds = ColumnDataSource(data=dict(a=[10, 11]))
#with self.assertRaises(ValueError):
# ds.data["b"] = [20, 21, 22]
#
#ds = ColumnDataSource(data=dict(a=[10, 11], b=[20, 21]))
#with self.assertRaises(ValueError):
# ds.data.update(dict(a=[10, 11, 12]))
with warnings.catch_warnings(record=True) as warns:
ColumnDataSource(data=dict(a=[10, 11], b=[20, 21, 22]))
self.assertEquals(len(warns), 1)
self.assertEquals(str(warns[0].message), "ColumnDataSource's columns must be of the same length")
ds = ColumnDataSource()
with warnings.catch_warnings(record=True) as warns:
ds.data = dict(a=[10, 11], b=[20, 21, 22])
self.assertEquals(len(warns), 1)
self.assertEquals(str(warns[0].message), "ColumnDataSource's columns must be of the same length")
ds = ColumnDataSource(data=dict(a=[10, 11]))
with warnings.catch_warnings(record=True) as warns:
ds.data["b"] = [20, 21, 22]
self.assertEquals(len(warns), 1)
self.assertEquals(str(warns[0].message), "ColumnDataSource's columns must be of the same length")
ds = ColumnDataSource(data=dict(a=[10, 11], b=[20, 21]))
with warnings.catch_warnings(record=True) as warns:
ds.data.update(dict(a=[10, 11, 12]))
self.assertEquals(len(warns), 1)
self.assertEquals(str(warns[0].message), "ColumnDataSource's columns must be of the same length")
if __name__ == "__main__":
unittest.main()
| 40.778351
| 113
| 0.596006
| 1,057
| 7,911
| 4.385998
| 0.141911
| 0.031277
| 0.028689
| 0.084124
| 0.78667
| 0.780414
| 0.752588
| 0.740725
| 0.701035
| 0.678387
| 0
| 0.041057
| 0.248768
| 7,911
| 193
| 114
| 40.989637
| 0.739021
| 0.059285
| 0
| 0.506579
| 0
| 0
| 0.119731
| 0
| 0
| 0
| 0
| 0.005181
| 0.348684
| 1
| 0.111842
| false
| 0
| 0.052632
| 0
| 0.171053
| 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
|
c7ed90aeea1b9f1fa35668b7d353c8c55523ce6d
| 30
|
py
|
Python
|
firrtl/proto/__init__.py
|
dan-fritchman/PyFirrtl
|
187928b7354cf6e7a8935ab17266ad9003289e91
|
[
"BSD-3-Clause"
] | null | null | null |
firrtl/proto/__init__.py
|
dan-fritchman/PyFirrtl
|
187928b7354cf6e7a8935ab17266ad9003289e91
|
[
"BSD-3-Clause"
] | null | null | null |
firrtl/proto/__init__.py
|
dan-fritchman/PyFirrtl
|
187928b7354cf6e7a8935ab17266ad9003289e91
|
[
"BSD-3-Clause"
] | null | null | null |
from .firrtl_pb2 import *
| 6
| 26
| 0.666667
| 4
| 30
| 4.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045455
| 0.266667
| 30
| 4
| 27
| 7.5
| 0.818182
| 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
|
1bf26462a7f59ea605011725a75a753c2d2adc78
| 123
|
py
|
Python
|
HackerRank/Python/np-zeros-and-ones.py
|
object-oriented-human/competitive
|
9e761020e887d8980a39a64eeaeaa39af0ecd777
|
[
"MIT"
] | 2
|
2021-07-27T10:46:47.000Z
|
2021-07-27T10:47:57.000Z
|
HackerRank/Python/np-zeros-and-ones.py
|
foooop/competitive
|
9e761020e887d8980a39a64eeaeaa39af0ecd777
|
[
"MIT"
] | null | null | null |
HackerRank/Python/np-zeros-and-ones.py
|
foooop/competitive
|
9e761020e887d8980a39a64eeaeaa39af0ecd777
|
[
"MIT"
] | null | null | null |
import numpy
t = tuple(list(map(int, input().split())))
print(numpy.zeros(t, dtype=int))
print(numpy.ones(t, dtype=int))
| 17.571429
| 42
| 0.682927
| 21
| 123
| 4
| 0.619048
| 0.238095
| 0.214286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.097561
| 123
| 6
| 43
| 20.5
| 0.756757
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0.5
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
1bf4e63c02f7d6bc0f1666e156b43a3f038671bf
| 391
|
py
|
Python
|
everest/ptolemaic/datalike/primary/_primary.py
|
rsbyrne/everest
|
1ec06301cdeb7c2b7d85daf6075d996c5529247e
|
[
"MIT"
] | 2
|
2020-12-17T02:27:28.000Z
|
2020-12-17T23:50:13.000Z
|
everest/ptolemaic/datalike/primary/_primary.py
|
rsbyrne/everest
|
1ec06301cdeb7c2b7d85daf6075d996c5529247e
|
[
"MIT"
] | 1
|
2020-12-07T10:14:45.000Z
|
2020-12-07T10:14:45.000Z
|
everest/ptolemaic/datalike/primary/_primary.py
|
rsbyrne/everest
|
1ec06301cdeb7c2b7d85daf6075d996c5529247e
|
[
"MIT"
] | 1
|
2020-10-22T11:16:50.000Z
|
2020-10-22T11:16:50.000Z
|
###############################################################################
''''''
###############################################################################
from . import _Datalike
class Primary(_Datalike):
...
###############################################################################
###############################################################################
| 26.066667
| 79
| 0.102302
| 6
| 391
| 6.333333
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.056266
| 391
| 14
| 80
| 27.928571
| 0.102981
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
9094818e3a5dfb5c631f6aae7f8ba8f8ba7576aa
| 205
|
py
|
Python
|
emotes/__init__.py
|
R3XET/coffee-cogs
|
e7658213449ec140edaaf322514eaafb575f99bd
|
[
"MIT"
] | null | null | null |
emotes/__init__.py
|
R3XET/coffee-cogs
|
e7658213449ec140edaaf322514eaafb575f99bd
|
[
"MIT"
] | null | null | null |
emotes/__init__.py
|
R3XET/coffee-cogs
|
e7658213449ec140edaaf322514eaafb575f99bd
|
[
"MIT"
] | null | null | null |
from .emotes import Emotes
from redbot.core.utils import get_end_user_data_statement
__red_end_user_data_statement__ = get_end_user_data_statement(__file__)
def setup(bot):
bot.add_cog(Emotes(bot))
| 25.625
| 72
| 0.829268
| 33
| 205
| 4.515152
| 0.545455
| 0.14094
| 0.221477
| 0.402685
| 0.308725
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102439
| 205
| 7
| 73
| 29.285714
| 0.809783
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.6
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
90cfd1c8d7abc6a105b04bbe7b17e6c2f0f6bb8f
| 6,957
|
py
|
Python
|
test/test_errors.py
|
TheCry/ssh-audit
|
1c34cb51310cf181246a38098b6035fb56345e93
|
[
"MIT"
] | 1,206
|
2017-09-19T19:36:04.000Z
|
2022-03-30T07:38:05.000Z
|
test/test_errors.py
|
TheCry/ssh-audit
|
1c34cb51310cf181246a38098b6035fb56345e93
|
[
"MIT"
] | 126
|
2019-08-16T17:30:25.000Z
|
2022-03-27T15:27:36.000Z
|
test/test_errors.py
|
TheCry/ssh-audit
|
1c34cb51310cf181246a38098b6035fb56345e93
|
[
"MIT"
] | 94
|
2017-11-01T22:23:56.000Z
|
2022-03-27T15:11:26.000Z
|
import socket
import errno
import pytest
from ssh_audit.outputbuffer import OutputBuffer
# pylint: disable=attribute-defined-outside-init
class TestErrors:
@pytest.fixture(autouse=True)
def init(self, ssh_audit):
self.AuditConf = ssh_audit.AuditConf
self.OutputBuffer = ssh_audit.OutputBuffer
self.audit = ssh_audit.audit
def _conf(self):
conf = self.AuditConf('localhost', 22)
conf.colors = False
conf.batch = True
return conf
def _audit(self, spy, conf=None, exit_expected=False):
if conf is None:
conf = self._conf()
spy.begin()
out = OutputBuffer()
if exit_expected:
with pytest.raises(SystemExit):
self.audit(out, conf)
else:
ret = self.audit(out, conf)
assert ret != 0
out.write()
lines = spy.flush()
# If the last line is empty, delete it.
if len(lines) > 1 and lines[-1] == '':
del lines[-1]
return lines
def test_connection_unresolved(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.gsock.addrinfodata['localhost#22'] = []
lines = self._audit(output_spy, exit_expected=True)
assert len(lines) == 1
assert 'has no DNS records' in lines[-1]
def test_connection_refused(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.errors['connect'] = socket.error(errno.ECONNREFUSED, 'Connection refused')
lines = self._audit(output_spy, exit_expected=True)
assert len(lines) == 1
assert 'Connection refused' in lines[-1]
def test_connection_timeout(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.errors['connect'] = socket.timeout('timed out')
lines = self._audit(output_spy, exit_expected=True)
assert len(lines) == 1
assert 'timed out' in lines[-1]
def test_recv_empty(self, output_spy, virtual_socket):
lines = self._audit(output_spy)
assert len(lines) == 1
assert 'did not receive banner' in lines[-1]
def test_recv_timeout(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(socket.timeout('timed out'))
lines = self._audit(output_spy)
assert len(lines) == 1
assert 'did not receive banner' in lines[-1]
assert 'timed out' in lines[-1]
def test_recv_retry_till_timeout(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(socket.error(errno.EAGAIN, 'Resource temporarily unavailable'))
vsocket.rdata.append(socket.error(errno.EWOULDBLOCK, 'Resource temporarily unavailable'))
vsocket.rdata.append(socket.error(errno.EAGAIN, 'Resource temporarily unavailable'))
vsocket.rdata.append(socket.timeout('timed out'))
lines = self._audit(output_spy)
assert len(lines) == 1
assert 'did not receive banner' in lines[-1]
assert 'timed out' in lines[-1]
def test_recv_retry_till_reset(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(socket.error(errno.EAGAIN, 'Resource temporarily unavailable'))
vsocket.rdata.append(socket.error(errno.EWOULDBLOCK, 'Resource temporarily unavailable'))
vsocket.rdata.append(socket.error(errno.EAGAIN, 'Resource temporarily unavailable'))
vsocket.rdata.append(socket.error(errno.ECONNRESET, 'Connection reset by peer'))
lines = self._audit(output_spy)
assert len(lines) == 1
assert 'did not receive banner' in lines[-1]
assert 'reset by peer' in lines[-1]
def test_connection_closed_before_banner(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(socket.error(errno.ECONNRESET, 'Connection reset by peer'))
lines = self._audit(output_spy)
assert len(lines) == 1
assert 'did not receive banner' in lines[-1]
assert 'reset by peer' in lines[-1]
def test_connection_closed_after_header(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'header line 1\n')
vsocket.rdata.append(b'\n')
vsocket.rdata.append(b'header line 2\n')
vsocket.rdata.append(socket.error(errno.ECONNRESET, 'Connection reset by peer'))
lines = self._audit(output_spy)
assert len(lines) == 3
assert 'did not receive banner' in lines[-1]
assert 'reset by peer' in lines[-1]
def test_connection_closed_after_banner(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'SSH-2.0-ssh-audit-test\r\n')
vsocket.rdata.append(socket.error(54, 'Connection reset by peer'))
lines = self._audit(output_spy)
assert len(lines) == 2
assert 'error reading packet' in lines[-1]
assert 'reset by peer' in lines[-1]
def test_empty_data_after_banner(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'SSH-2.0-ssh-audit-test\r\n')
lines = self._audit(output_spy)
assert len(lines) == 2
assert 'error reading packet' in lines[-1]
assert 'empty' in lines[-1]
def test_wrong_data_after_banner(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'SSH-2.0-ssh-audit-test\r\n')
vsocket.rdata.append(b'xxx\n')
lines = self._audit(output_spy)
assert len(lines) == 2
assert 'error reading packet' in lines[-1]
assert 'xxx' in lines[-1]
def test_non_ascii_banner(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'SSH-2.0-ssh-audit-test\xc3\xbc\r\n')
lines = self._audit(output_spy)
assert len(lines) == 3
assert 'error reading packet' in lines[-1]
assert 'ASCII' in lines[-2]
assert lines[-3].endswith('SSH-2.0-ssh-audit-test?')
def test_nonutf8_data_after_banner(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'SSH-2.0-ssh-audit-test\r\n')
vsocket.rdata.append(b'\x81\xff\n')
lines = self._audit(output_spy)
assert len(lines) == 2
assert 'error reading packet' in lines[-1]
assert '\\x81\\xff' in lines[-1]
def test_protocol_mismatch_by_conf(self, output_spy, virtual_socket):
vsocket = virtual_socket
vsocket.rdata.append(b'SSH-1.3-ssh-audit-test\r\n')
vsocket.rdata.append(b'Protocol major versions differ.\n')
conf = self._conf()
conf.ssh1, conf.ssh2 = True, False
lines = self._audit(output_spy, conf)
assert len(lines) == 4
assert 'error reading packet' in lines[-1]
assert 'major versions differ' in lines[-1]
| 40.213873
| 97
| 0.652149
| 918
| 6,957
| 4.793028
| 0.137255
| 0.049091
| 0.127273
| 0.068182
| 0.774318
| 0.748182
| 0.718864
| 0.718864
| 0.702955
| 0.68
| 0
| 0.01435
| 0.238752
| 6,957
| 172
| 98
| 40.447674
| 0.816465
| 0.012074
| 0
| 0.534247
| 0
| 0
| 0.152256
| 0.02722
| 0
| 0
| 0
| 0
| 0.294521
| 1
| 0.123288
| false
| 0
| 0.027397
| 0
| 0.171233
| 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
|
90e94fe97798bb95783b3c53e81c0cd750829959
| 30
|
py
|
Python
|
datastructures/__init__.py
|
tkaleas/python-sandbox
|
37ebe92c5f89300e27803118259d16f62d67f612
|
[
"MIT"
] | null | null | null |
datastructures/__init__.py
|
tkaleas/python-sandbox
|
37ebe92c5f89300e27803118259d16f62d67f612
|
[
"MIT"
] | null | null | null |
datastructures/__init__.py
|
tkaleas/python-sandbox
|
37ebe92c5f89300e27803118259d16f62d67f612
|
[
"MIT"
] | null | null | null |
#for include of datastructures
| 30
| 30
| 0.866667
| 4
| 30
| 6.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1
| 30
| 1
| 30
| 30
| 0.962963
| 0.966667
| 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
|
90faa93e4fce422b433ec3a4ed5a041818811435
| 67
|
py
|
Python
|
ch2/import_example/import_example2.py
|
macs1207/python-tutorial
|
566bfcc30fbd98ff3850614c7c5bd7a0a38487ad
|
[
"MIT"
] | null | null | null |
ch2/import_example/import_example2.py
|
macs1207/python-tutorial
|
566bfcc30fbd98ff3850614c7c5bd7a0a38487ad
|
[
"MIT"
] | null | null | null |
ch2/import_example/import_example2.py
|
macs1207/python-tutorial
|
566bfcc30fbd98ff3850614c7c5bd7a0a38487ad
|
[
"MIT"
] | 3
|
2019-10-22T10:04:42.000Z
|
2019-10-26T14:55:44.000Z
|
from this_is_a_package.a_module import say_hello
say_hello("ITC")
| 16.75
| 48
| 0.835821
| 13
| 67
| 3.846154
| 0.769231
| 0.32
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.089552
| 67
| 3
| 49
| 22.333333
| 0.819672
| 0
| 0
| 0
| 0
| 0
| 0.044776
| 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
|
29070c7ccac0571a7d562abceaa4b2ac9707d44d
| 137
|
py
|
Python
|
pyyhtml/comment.py
|
yusantus/pyyhtml
|
ed4d02340ed3ece0efd6f6ffafc584e75dc9f541
|
[
"MIT"
] | null | null | null |
pyyhtml/comment.py
|
yusantus/pyyhtml
|
ed4d02340ed3ece0efd6f6ffafc584e75dc9f541
|
[
"MIT"
] | null | null | null |
pyyhtml/comment.py
|
yusantus/pyyhtml
|
ed4d02340ed3ece0efd6f6ffafc584e75dc9f541
|
[
"MIT"
] | null | null | null |
class comment:
def __init__(self, text):
self.text = text
def get_text(self):
return f"<!-- {self.text} -->"
| 22.833333
| 38
| 0.532847
| 17
| 137
| 4
| 0.529412
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.306569
| 137
| 6
| 38
| 22.833333
| 0.715789
| 0
| 0
| 0
| 0
| 0
| 0.144928
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0.2
| 0.8
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 5
|
2914aa589d525c03ec0c3a8a68425e1b481819b8
| 92
|
wsgi
|
Python
|
app.wsgi
|
AGLDWG/licenses-dataset
|
56a5c539b00b0f5846e539234a47d4f6798cb749
|
[
"CC-BY-4.0"
] | null | null | null |
app.wsgi
|
AGLDWG/licenses-dataset
|
56a5c539b00b0f5846e539234a47d4f6798cb749
|
[
"CC-BY-4.0"
] | null | null | null |
app.wsgi
|
AGLDWG/licenses-dataset
|
56a5c539b00b0f5846e539234a47d4f6798cb749
|
[
"CC-BY-4.0"
] | null | null | null |
import sys
sys.path.insert(0, '/var/www/odrl-policies')
from app import app as application
| 18.4
| 44
| 0.76087
| 16
| 92
| 4.375
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012346
| 0.119565
| 92
| 4
| 45
| 23
| 0.851852
| 0
| 0
| 0
| 0
| 0
| 0.23913
| 0.23913
| 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
|
292e72c1a79769e00da1afa35a9ea184ed844d5d
| 78
|
py
|
Python
|
bot/services/repository/__init__.py
|
darksidecat/telegram-2048-bot
|
2c5efbb8fc7c02e0139502506fa2104a1495d1b8
|
[
"MIT"
] | 9
|
2021-09-28T11:47:11.000Z
|
2022-03-07T10:08:45.000Z
|
bot/services/repository/__init__.py
|
darksidecat/telegram-2048-bot
|
2c5efbb8fc7c02e0139502506fa2104a1495d1b8
|
[
"MIT"
] | null | null | null |
bot/services/repository/__init__.py
|
darksidecat/telegram-2048-bot
|
2c5efbb8fc7c02e0139502506fa2104a1495d1b8
|
[
"MIT"
] | 2
|
2022-03-06T20:58:53.000Z
|
2022-03-31T06:38:13.000Z
|
from .game_repository import GameRepo
from .repository import SQLAlchemyRepos
| 26
| 39
| 0.871795
| 9
| 78
| 7.444444
| 0.666667
| 0.477612
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102564
| 78
| 2
| 40
| 39
| 0.957143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
2970911d2171a539276cc2212771e08d9dd39347
| 68
|
py
|
Python
|
quicksample/src/quicksample.py
|
aveek22/quicksample
|
24e0b984764c57cf020f42547221a07e09bf23cf
|
[
"MIT"
] | 1
|
2021-01-26T19:14:47.000Z
|
2021-01-26T19:14:47.000Z
|
quicksample/src/quicksample.py
|
aveek22/quicksample
|
24e0b984764c57cf020f42547221a07e09bf23cf
|
[
"MIT"
] | null | null | null |
quicksample/src/quicksample.py
|
aveek22/quicksample
|
24e0b984764c57cf020f42547221a07e09bf23cf
|
[
"MIT"
] | null | null | null |
def quicktext():
print('Hello, welcome to QuickSample package.')
| 34
| 51
| 0.720588
| 8
| 68
| 6.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.147059
| 68
| 2
| 51
| 34
| 0.844828
| 0
| 0
| 0
| 0
| 0
| 0.550725
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| true
| 0
| 0
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
2974aa9ace71e6a8d02e389d2387b81f370ddf49
| 564
|
py
|
Python
|
hivemind/utils/__init__.py
|
artek0chumak/hivemind
|
762f116ffcd6c194b888ed64c8a82033cc97dce7
|
[
"MIT"
] | 6
|
2020-03-11T17:52:24.000Z
|
2020-03-23T07:27:12.000Z
|
hivemind/utils/__init__.py
|
mryab/hivemind
|
595b831bcaac6b4d8da215de70b8138ac548c562
|
[
"MIT"
] | 14
|
2020-03-01T21:07:05.000Z
|
2020-03-28T17:54:50.000Z
|
hivemind/utils/__init__.py
|
learning-at-home/tesseract
|
c6b2b2d84ccfc890314a2bfece8eef238372d410
|
[
"MIT"
] | null | null | null |
from hivemind.utils.asyncio import *
from hivemind.utils.grpc import *
from hivemind.utils.limits import increase_file_limit
from hivemind.utils.logging import get_logger, use_hivemind_log_handler
from hivemind.utils.mpfuture import *
from hivemind.utils.nested import *
from hivemind.utils.networking import *
from hivemind.utils.performance_ema import PerformanceEMA
from hivemind.utils.serializer import MSGPackSerializer, SerializerBase
from hivemind.utils.tensor_descr import BatchTensorDescriptor, TensorDescriptor
from hivemind.utils.timed_storage import *
| 47
| 79
| 0.861702
| 72
| 564
| 6.625
| 0.430556
| 0.27673
| 0.392034
| 0.24109
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 564
| 11
| 80
| 51.272727
| 0.922631
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
297df2ef27664e3a4d16787a093b5d0ebe8f6c8c
| 247
|
py
|
Python
|
src/pyterpreter/Callable.py
|
kinshukk/pyterpreter
|
8c1029322da82dde8f39d8e26c1d5748242c14c7
|
[
"MIT"
] | 4
|
2020-02-12T22:46:00.000Z
|
2020-10-16T17:25:13.000Z
|
src/pyterpreter/Callable.py
|
kinshukk/pyterpreter
|
8c1029322da82dde8f39d8e26c1d5748242c14c7
|
[
"MIT"
] | null | null | null |
src/pyterpreter/Callable.py
|
kinshukk/pyterpreter
|
8c1029322da82dde8f39d8e26c1d5748242c14c7
|
[
"MIT"
] | 1
|
2020-02-18T15:35:19.000Z
|
2020-02-18T15:35:19.000Z
|
from abc import ABC, abstractmethod
class Callable(ABC):
@abstractmethod
def call(self, interpreter, arguments):
pass
@abstractmethod
def arity(self):
pass
@abstractmethod
def __str__(self):
pass
| 16.466667
| 43
| 0.635628
| 25
| 247
| 6.12
| 0.56
| 0.333333
| 0.27451
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.291498
| 247
| 14
| 44
| 17.642857
| 0.874286
| 0
| 0
| 0.545455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0.272727
| 0.090909
| 0
| 0.454545
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
46309d2d85ec9db99b3b145dc4b1e3084692e436
| 75
|
py
|
Python
|
src/pdf_metadata_editor/__init__.py
|
rpbissonnette/pdf_metadata_editor
|
e016dae74bc5739d405e6434b8814c5f9e30e4dd
|
[
"MIT"
] | null | null | null |
src/pdf_metadata_editor/__init__.py
|
rpbissonnette/pdf_metadata_editor
|
e016dae74bc5739d405e6434b8814c5f9e30e4dd
|
[
"MIT"
] | null | null | null |
src/pdf_metadata_editor/__init__.py
|
rpbissonnette/pdf_metadata_editor
|
e016dae74bc5739d405e6434b8814c5f9e30e4dd
|
[
"MIT"
] | null | null | null |
from .metadata import EditorMain
from .fitzcli import main as fitzGetText
| 18.75
| 40
| 0.826667
| 10
| 75
| 6.2
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.146667
| 75
| 3
| 41
| 25
| 0.96875
| 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
|
4638b547e4ca22a66bdade121632ee6dd9c42932
| 85
|
py
|
Python
|
speechcorpusy/__init__.py
|
tarepan/corpuspy
|
d5c07fc1f12ee2fb2f2ea00419728c39d5b354e4
|
[
"MIT"
] | 1
|
2022-01-10T13:58:56.000Z
|
2022-01-10T13:58:56.000Z
|
speechcorpusy/__init__.py
|
tarepan/speechcorpusy
|
d5c07fc1f12ee2fb2f2ea00419728c39d5b354e4
|
[
"MIT"
] | null | null | null |
speechcorpusy/__init__.py
|
tarepan/speechcorpusy
|
d5c07fc1f12ee2fb2f2ea00419728c39d5b354e4
|
[
"MIT"
] | null | null | null |
"""speechcorpusy"""
from .loader import load_preset # pylint: disable=unused-import
| 21.25
| 63
| 0.764706
| 10
| 85
| 6.4
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105882
| 85
| 3
| 64
| 28.333333
| 0.842105
| 0.517647
| 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
|
463fe08fd4d468b588460648200599a89d28eb73
| 5,020
|
py
|
Python
|
Thirdparty/libyaml/build.py
|
reven86/dava.engine
|
ca47540c8694668f79774669b67d874a30188c20
|
[
"BSD-3-Clause"
] | 5
|
2020-02-11T12:04:17.000Z
|
2022-01-30T10:18:29.000Z
|
Thirdparty/libyaml/build.py
|
reven86/dava.engine
|
ca47540c8694668f79774669b67d874a30188c20
|
[
"BSD-3-Clause"
] | null | null | null |
Thirdparty/libyaml/build.py
|
reven86/dava.engine
|
ca47540c8694668f79774669b67d874a30188c20
|
[
"BSD-3-Clause"
] | 4
|
2019-11-28T19:24:34.000Z
|
2021-08-24T19:12:50.000Z
|
import os
import build_utils
def get_supported_targets(platform):
if platform == 'win32':
return ['win32', 'win10', 'android']
elif platform == 'darwin':
return ['macos', 'ios', 'android']
elif platform == 'linux':
return ['android', 'linux']
else:
return []
def get_dependencies_for_target(target):
return []
def build_for_target(target, working_directory_path, root_project_path):
if target == 'win32':
_build_win32(working_directory_path, root_project_path)
elif target == 'win10':
_build_win10(working_directory_path, root_project_path)
elif target == 'macos':
_build_macos(working_directory_path, root_project_path)
elif target == 'ios':
_build_ios(working_directory_path, root_project_path)
elif target == 'android':
_build_android(working_directory_path, root_project_path)
elif target == 'linux':
_build_linux(working_directory_path, root_project_path)
def get_download_info():
return 'http://pyyaml.org/download/libyaml/yaml-0.1.7.tar.gz'
def _download_and_extract(working_directory_path):
source_folder_path = os.path.join(working_directory_path, 'libyaml_source')
url = get_download_info()
build_utils.download_and_extract(
url,
working_directory_path,
source_folder_path,
build_utils.get_url_file_name_no_ext(url))
return source_folder_path
@build_utils.run_once
def _patch_sources(source_folder_path, working_directory_path):
build_utils.apply_patch(
os.path.abspath('patch.diff'), working_directory_path)
def _build_win32(working_directory_path, root_project_path):
source_folder_path = _download_and_extract(working_directory_path)
_patch_sources(source_folder_path, working_directory_path)
build_utils.build_and_copy_libraries_win32_cmake(
os.path.join(working_directory_path, 'gen'),
source_folder_path,
root_project_path,
'yaml.sln', 'yaml',
'yaml.lib', 'yaml.lib',
'libyaml_wind.lib', 'libyaml_win.lib',
'libyaml_wind.lib', 'libyaml_win.lib')
_copy_headers(source_folder_path, root_project_path)
def _build_win10(working_directory_path, root_project_path):
source_folder_path = _download_and_extract(working_directory_path)
_patch_sources(source_folder_path, working_directory_path)
build_utils.build_and_copy_libraries_win10_cmake(
os.path.join(working_directory_path, 'gen'),
source_folder_path,
root_project_path,
'yaml.sln', 'yaml',
'yaml.lib', 'yaml.lib',
'libyaml_wind.lib', 'libyaml_win.lib',
'libyaml_wind.lib', 'libyaml_win.lib',
'libyaml_wind.lib', 'libyaml_win.lib',
['-DWIN10=1'])
_copy_headers(source_folder_path, root_project_path)
def _build_macos(working_directory_path, root_project_path):
source_folder_path = _download_and_extract(working_directory_path)
_patch_sources(source_folder_path, working_directory_path)
build_utils.build_and_copy_libraries_macos_cmake(
os.path.join(working_directory_path, 'gen'),
source_folder_path,
root_project_path,
'yaml.xcodeproj', 'yaml',
'libyaml.a',
'libyaml_macos.a')
_copy_headers(source_folder_path, root_project_path)
def _build_ios(working_directory_path, root_project_path):
source_folder_path = _download_and_extract(working_directory_path)
_patch_sources(source_folder_path, working_directory_path)
build_utils.build_and_copy_libraries_ios_cmake(
os.path.join(working_directory_path, 'gen'),
source_folder_path,
root_project_path,
'yaml.xcodeproj', 'yaml',
'libyaml.a',
'libyaml_ios.a')
_copy_headers(source_folder_path, root_project_path)
def _build_android(working_directory_path, root_project_path):
source_folder_path = _download_and_extract(working_directory_path)
_patch_sources(source_folder_path, working_directory_path)
build_utils.build_and_copy_libraries_android_cmake(
os.path.join(working_directory_path, 'gen'),
source_folder_path,
root_project_path,
'libyaml.a',
'libyaml.a')
_copy_headers(source_folder_path, root_project_path)
def _build_linux(working_directory_path, root_project_path):
source_folder_path = _download_and_extract(working_directory_path)
_patch_sources(source_folder_path, working_directory_path)
build_utils.build_and_copy_libraries_linux_cmake(
gen_folder_path=os.path.join(working_directory_path, 'gen'),
source_folder_path=source_folder_path,
root_project_path=root_project_path,
target="all",
lib_name='libyaml.a')
_copy_headers(source_folder_path, root_project_path)
def _copy_headers(source_folder_path, root_project_path):
include_path = os.path.join(root_project_path, 'Libs/include/yaml')
build_utils.copy_files(source_folder_path, include_path, 'include/*.h')
| 33.691275
| 79
| 0.73506
| 646
| 5,020
| 5.179567
| 0.114551
| 0.172146
| 0.215182
| 0.153317
| 0.793186
| 0.78153
| 0.737896
| 0.737896
| 0.604304
| 0.604304
| 0
| 0.00674
| 0.17251
| 5,020
| 148
| 80
| 33.918919
| 0.798748
| 0
| 0
| 0.4375
| 0
| 0.008929
| 0.108367
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.116071
| false
| 0
| 0.017857
| 0.017857
| 0.196429
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
4646fb633f933c90eaf5276fb07ca663116547d5
| 162
|
py
|
Python
|
tests/web_platform/css_flexbox_1/test_justify_content_center.py
|
fletchgraham/colosseum
|
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
|
[
"BSD-3-Clause"
] | null | null | null |
tests/web_platform/css_flexbox_1/test_justify_content_center.py
|
fletchgraham/colosseum
|
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
|
[
"BSD-3-Clause"
] | null | null | null |
tests/web_platform/css_flexbox_1/test_justify_content_center.py
|
fletchgraham/colosseum
|
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
|
[
"BSD-3-Clause"
] | 1
|
2020-01-16T01:56:41.000Z
|
2020-01-16T01:56:41.000Z
|
from tests.utils import W3CTestCase
class TestJustifyContent_Center(W3CTestCase):
vars().update(W3CTestCase.find_tests(__file__, 'justify-content_center'))
| 27
| 77
| 0.814815
| 18
| 162
| 6.944444
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02027
| 0.08642
| 162
| 5
| 78
| 32.4
| 0.824324
| 0
| 0
| 0
| 0
| 0
| 0.136646
| 0.136646
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
4681ec21f72946f90ae634cce8945cea6a0757b5
| 54
|
py
|
Python
|
src/Lib/test/test_email/__main__.py
|
NUS-ALSET/ace-react-redux-brython
|
d009490263c5716a145d9691cd59bfcd5aff837a
|
[
"MIT"
] | 1
|
2021-08-05T12:45:39.000Z
|
2021-08-05T12:45:39.000Z
|
src/Lib/test/test_email/__main__.py
|
NUS-ALSET/ace-react-redux-brython
|
d009490263c5716a145d9691cd59bfcd5aff837a
|
[
"MIT"
] | null | null | null |
src/Lib/test/test_email/__main__.py
|
NUS-ALSET/ace-react-redux-brython
|
d009490263c5716a145d9691cd59bfcd5aff837a
|
[
"MIT"
] | 1
|
2019-09-05T08:20:07.000Z
|
2019-09-05T08:20:07.000Z
|
from test.test_email import test_main
test_main()
| 13.5
| 38
| 0.777778
| 9
| 54
| 4.333333
| 0.555556
| 0.410256
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 54
| 3
| 39
| 18
| 0.866667
| 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 | 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
|
31065f8ff98253f0e1dadd8c3d7e7fb734b24285
| 154
|
py
|
Python
|
trueconsensus/minerva/__version__.py
|
panghalamit/py-trueconsensus
|
f7a80ea0b395fd1cf56fedb01ba74def1a2e45bf
|
[
"Apache-2.0"
] | 53
|
2018-05-25T16:34:04.000Z
|
2019-09-02T07:56:00.000Z
|
trueconsensus/minerva/__version__.py
|
panghalamit/py-trueconsensus
|
f7a80ea0b395fd1cf56fedb01ba74def1a2e45bf
|
[
"Apache-2.0"
] | null | null | null |
trueconsensus/minerva/__version__.py
|
panghalamit/py-trueconsensus
|
f7a80ea0b395fd1cf56fedb01ba74def1a2e45bf
|
[
"Apache-2.0"
] | 29
|
2018-06-04T02:08:34.000Z
|
2022-01-25T08:46:13.000Z
|
import pkg_resources
# TODO: update to trinity package when it gets split out.
__version__ = pkg_resources.get_distribution("py-trueconsensus").version
| 25.666667
| 72
| 0.811688
| 21
| 154
| 5.619048
| 0.857143
| 0.20339
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116883
| 154
| 5
| 73
| 30.8
| 0.867647
| 0.357143
| 0
| 0
| 0
| 0
| 0.164948
| 0
| 0
| 0
| 0
| 0.2
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
3111f0d9f3d1888a383898ef3c9f1c869a6f80d0
| 42
|
py
|
Python
|
tests/__init__.py
|
corneyl/python-buienradar
|
34ca10f00ef1e3096fbd8d6c1c278409248891e1
|
[
"MIT"
] | 9
|
2019-01-17T15:52:31.000Z
|
2022-03-03T16:27:09.000Z
|
tests/__init__.py
|
corneyl/python-buienradar
|
34ca10f00ef1e3096fbd8d6c1c278409248891e1
|
[
"MIT"
] | 14
|
2017-06-24T09:11:55.000Z
|
2021-12-12T16:50:28.000Z
|
tests/__init__.py
|
corneyl/python-buienradar
|
34ca10f00ef1e3096fbd8d6c1c278409248891e1
|
[
"MIT"
] | 9
|
2017-06-24T09:09:34.000Z
|
2021-11-21T18:17:08.000Z
|
"""Initialize the tests module."""
# noqa
| 14
| 34
| 0.666667
| 5
| 42
| 5.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.142857
| 42
| 2
| 35
| 21
| 0.777778
| 0.809524
| 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
|
312415a52f0742d0a69cc609f0a19e7fe58075e0
| 367
|
py
|
Python
|
applications/CoSimulationApplication/python_scripts/factories/io_factory.py
|
clazaro/Kratos
|
b947b82c90dfcbf13d60511427f85990d36b90be
|
[
"BSD-4-Clause"
] | 778
|
2017-01-27T16:29:17.000Z
|
2022-03-30T03:01:51.000Z
|
applications/CoSimulationApplication/python_scripts/factories/io_factory.py
|
clazaro/Kratos
|
b947b82c90dfcbf13d60511427f85990d36b90be
|
[
"BSD-4-Clause"
] | 6,634
|
2017-01-15T22:56:13.000Z
|
2022-03-31T15:03:36.000Z
|
applications/CoSimulationApplication/python_scripts/factories/io_factory.py
|
clazaro/Kratos
|
b947b82c90dfcbf13d60511427f85990d36b90be
|
[
"BSD-4-Clause"
] | 224
|
2017-02-07T14:12:49.000Z
|
2022-03-06T23:09:34.000Z
|
from KratosMultiphysics.CoSimulationApplication.factories import base_factory
def CreateIO(io_settings, model, solver_name, data_comm, io_name):
"""This function creates and returns the IO used for CoSimulation"""
return base_factory.Create(io_settings, [model, solver_name, data_comm], "KratosMultiphysics.CoSimulationApplication.solver_wrappers", io_name)
| 61.166667
| 147
| 0.822888
| 45
| 367
| 6.466667
| 0.622222
| 0.281787
| 0.103093
| 0.14433
| 0.226804
| 0.226804
| 0.226804
| 0
| 0
| 0
| 0
| 0
| 0.098093
| 367
| 5
| 148
| 73.4
| 0.879154
| 0.168937
| 0
| 0
| 0
| 0
| 0.19398
| 0.19398
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0
| 1
| 0
| 0
| 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
| 1
| 0
| 1
| 0
|
0
| 5
|
3139067ad4677b6e4f01a761e030dcc8b79deae0
| 227
|
py
|
Python
|
src/wai/annotations/core/component/__init__.py
|
waikato-ufdl/wai-annotations-core
|
bac3429e9488efb456972c74f9d462f951c4af3d
|
[
"Apache-2.0"
] | null | null | null |
src/wai/annotations/core/component/__init__.py
|
waikato-ufdl/wai-annotations-core
|
bac3429e9488efb456972c74f9d462f951c4af3d
|
[
"Apache-2.0"
] | 3
|
2021-06-30T23:42:47.000Z
|
2022-03-01T03:45:07.000Z
|
src/wai/annotations/core/component/__init__.py
|
waikato-ufdl/wai-annotations-core
|
bac3429e9488efb456972c74f9d462f951c4af3d
|
[
"Apache-2.0"
] | null | null | null |
"""
Package for base classes of component types.
"""
from ._Component import Component
from ._ProcessorComponent import ProcessorComponent
from ._SinkComponent import SinkComponent
from ._SourceComponent import SourceComponent
| 28.375
| 51
| 0.84141
| 23
| 227
| 8.130435
| 0.521739
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.110132
| 227
| 7
| 52
| 32.428571
| 0.925743
| 0.193833
| 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
|
314b2a9592b1a87f21fce39418a1afd8aa541278
| 115
|
py
|
Python
|
src_old/tests/scripts/stencils.py
|
toddrme2178/pyccel
|
deec37503ab0c5d0bcca1a035f7909f7ce8ef653
|
[
"MIT"
] | null | null | null |
src_old/tests/scripts/stencils.py
|
toddrme2178/pyccel
|
deec37503ab0c5d0bcca1a035f7909f7ce8ef653
|
[
"MIT"
] | null | null | null |
src_old/tests/scripts/stencils.py
|
toddrme2178/pyccel
|
deec37503ab0c5d0bcca1a035f7909f7ce8ef653
|
[
"MIT"
] | null | null | null |
# coding: utf-8
y1 = stencil(1, 3, 1)
y2 = stencil((-1,1), (3,4), (2,2))
y3 = stencil((-1,0,1), (3,4,5), (2,2,2))
| 19.166667
| 40
| 0.478261
| 27
| 115
| 2.037037
| 0.481481
| 0.436364
| 0.109091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.229167
| 0.165217
| 115
| 5
| 41
| 23
| 0.34375
| 0.113043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
315c01708202f04ab58eefc10fdde845a8033d7d
| 6,048
|
py
|
Python
|
src/darkrai.py
|
niart120/Project_Xs
|
cae7f2ca8a28d1c52864b88039ce84af22d4d413
|
[
"MIT"
] | 7
|
2021-12-22T00:41:14.000Z
|
2022-03-28T15:03:01.000Z
|
src/darkrai.py
|
niart120/Project_Xs
|
cae7f2ca8a28d1c52864b88039ce84af22d4d413
|
[
"MIT"
] | 1
|
2021-12-22T02:36:43.000Z
|
2021-12-22T02:44:23.000Z
|
src/darkrai.py
|
niart120/Project_Xs
|
cae7f2ca8a28d1c52864b88039ce84af22d4d413
|
[
"MIT"
] | 4
|
2021-12-26T05:54:06.000Z
|
2022-02-27T13:06:17.000Z
|
"""
this program is experimental.
"""
import rngtool
import calc
import cv2
import time
from xorshift import Xorshift
import heapq
imgpath = "./trainer/fullmoon/eye.png"
def firstspecify():
imgpath = "./trainer/secretbase/eye.png"
player_eye = cv2.imread(imgpath, cv2.IMREAD_GRAYSCALE)
if player_eye is None:
print("path is wrong")
return
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 870, 680, 85, 90,cameraID=1)
prng = rngtool.recov(blinks, intervals, )
waituntil = time.perf_counter()
diff = round(waituntil-offset_time)
prng.getNextRandSequence(diff)
state = prng.getState()
print("state(64bit 64bit)")
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
print("state(32bit 32bit 32bit 32bit)")
print(*[hex(s) for s in state])
def reidentify():
print("input xorshift state(state[0] state[1] state[2] state[3])")
state = [int(x,0) for x in input().split()]
plimgpath = "./trainer/fullmoon/eye.png"
plimg = cv2.imread(plimgpath, cv2.IMREAD_GRAYSCALE)
plroi = (925, 500, 35, 35)
pkimgpath = "./cresselia/eye.png"
pkimg = cv2.imread(pkimgpath, cv2.IMREAD_GRAYSCALE)
pkroi = (805, 475, 20, 30)
reidentified_rng = rngtool.reidentifyByIntervalsNoisy(Xorshift(*state), observed_intervals, th=2, search_max=10**5)
if reidentified_rng is None:
print("couldn't reidentify state.")
return
waituntil = time.perf_counter()
diff = int(-(-(waituntil-offset_time)//1))
print(diff, waituntil-offset_time)
reidentified_rng.advances(max(diff,0))
state = reidentified_rng.getState()
print("state(64bit 64bit)")
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
print("state(32bit 32bit 32bit 32bit)")
print(*[hex(s) for s in state])
#timecounter reset
advances = 0
waituntil = time.perf_counter()
time.sleep(diff - (waituntil - offset_time))
while True:
advances += 1
r = reidentified_rng.next()
waituntil += 1.017
next_time = waituntil - time.perf_counter() or 0
time.sleep(next_time)
print(f"advances:{advances}, blink:{hex(r&0xF)}")
def reidentifyInSecretBase():
"""reidentify xorshift internal state in the cresselia's room
note: this function is a bit unreliable since it is difficult to track the blinks of cresselia.
"""
print("input xorshift state(state[0] state[1] state[2] state[3])")
state = [int(x,0) for x in input().split()]
imgpath = "./trainer/secretbase/eye.png"
player_eye = cv2.imread(imgpath, cv2.IMREAD_GRAYSCALE)
if player_eye is None:
print("path is wrong")
return
blinks, observed_intervals, offset_time = rngtool.tracking_blink(player_eye, 870, 680, 85, 90, size=7)
reidentified_rng = rngtool.reidentifyByIntervals(Xorshift(*state), observed_intervals, npc=0)
if reidentified_rng is None:
print("couldn't reidentify state.")
return
waituntil = time.perf_counter()
diff = int(-(-(waituntil-offset_time)//1))
print(diff, waituntil-offset_time)
reidentified_rng.advances(max(diff,0))
state = reidentified_rng.getState()
print("state(64bit 64bit)")
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
print("state(32bit 32bit 32bit 32bit)")
print(*[hex(s) for s in state])
#timecounter reset
advances = 0
waituntil = time.perf_counter()
time.sleep(diff - (waituntil - offset_time))
while True:
advances += 1
r = reidentified_rng.next()
waituntil += 1.017
next_time = waituntil - time.perf_counter() or 0
time.sleep(next_time)
print(f"advances:{advances}, blink:{hex(r&0xF)}")
def timeline():
print("input xorshift state(state[0] state[1] state[2] state[3])")
state = [int(x,0) for x in input().split()]
plimgpath = "./trainer/newmoon/eye.png"
plimg = cv2.imread(plimgpath, cv2.IMREAD_GRAYSCALE)
plroi = (925, 500, 35, 35)
blinks, observed_intervals, offset_time = rngtool.tracking_blink(plimg, 925, 500, 35, 35, th=0.8, size=8, cameraID=1)
reidentified_rng, next_pk_blink = rngtool.reidentifyByIntervalsNoisy(Xorshift(*state), observed_intervals)
if reidentified_rng is None:
print("couldn't reidentify state.")
return
state = reidentified_rng.getState()
print("state(64bit 64bit)")
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
print("state(32bit 32bit 32bit 32bit)")
print(*[hex(s) for s in state])
advances = 0
#timeline prepare
queue = []
heapq.heappush(queue, (offset_time+61/60,0))
heapq.heappush(queue, (offset_time+next_pk_blink,1))
while advances<20:
advances += 1
w, q = heapq.heappop(queue)
next_time = w - time.perf_counter() or 0
if next_time>0:
time.sleep(next_time)
if q==0:
r = reidentified_rng.next()
print(f"advances:{advances}, blink:{hex(r&0xF)}")
heapq.heappush(queue, (w+61/60, 0))
else:
blink_int = reidentified_rng.range(3.0, 12.0) + 0.285
heapq.heappush(queue, (w+blink_int, 1))
print(f"advances:{advances}, interval:{blink_int}")
print("close message window")
#blankread
reidentified_rng.next()
while True:
advances += 1
w, q = heapq.heappop(queue)
next_time = w - time.perf_counter() or 0
if next_time>0:
time.sleep(next_time)
if q==0:
r = reidentified_rng.next()
print(f"advances:{advances}, blink:{hex(r&0xF)}")
heapq.heappush(queue, (w+61/60, 0))
else:
blink_int = reidentified_rng.range(3.0, 12.0) + 0.285
heapq.heappush(queue, (w+blink_int, 1))
print(f"advances:{advances}, interval:{blink_int}")
if __name__ == "__main__":
#firstspecify()
#reidentifyInSecretBase()
timeline()
| 32.691892
| 121
| 0.635417
| 802
| 6,048
| 4.683292
| 0.179551
| 0.071885
| 0.035942
| 0.044728
| 0.772098
| 0.749734
| 0.716187
| 0.716187
| 0.699947
| 0.699947
| 0
| 0.052575
| 0.226356
| 6,048
| 184
| 122
| 32.869565
| 0.75016
| 0.046627
| 0
| 0.755396
| 0
| 0
| 0.154343
| 0.023195
| 0
| 0
| 0.002093
| 0
| 0
| 1
| 0.028777
| false
| 0
| 0.043165
| 0
| 0.107914
| 0.23741
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
3179905fdc580d8dc547b75225c1f6118d185730
| 11
|
py
|
Python
|
ab.py
|
Wey-tinghua/gitdemo
|
8fdd09f27297e745ec67989b3456829ff221d1d9
|
[
"MIT"
] | 2
|
2019-05-13T07:29:09.000Z
|
2019-05-13T07:29:13.000Z
|
ab.py
|
Wey-tinghua/gitdemo
|
8fdd09f27297e745ec67989b3456829ff221d1d9
|
[
"MIT"
] | null | null | null |
ab.py
|
Wey-tinghua/gitdemo
|
8fdd09f27297e745ec67989b3456829ff221d1d9
|
[
"MIT"
] | null | null | null |
num = 300
| 3.666667
| 9
| 0.545455
| 2
| 11
| 3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.428571
| 0.363636
| 11
| 2
| 10
| 5.5
| 0.428571
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
317d1a335652fd88c4f8d0cec6b832db51111edb
| 115
|
py
|
Python
|
tests/core/admin-module/test_admin_peers.py
|
y19818/web3.py
|
32a85a287ab63220d1e0c06d77be74de595ff02f
|
[
"MIT"
] | null | null | null |
tests/core/admin-module/test_admin_peers.py
|
y19818/web3.py
|
32a85a287ab63220d1e0c06d77be74de595ff02f
|
[
"MIT"
] | null | null | null |
tests/core/admin-module/test_admin_peers.py
|
y19818/web3.py
|
32a85a287ab63220d1e0c06d77be74de595ff02f
|
[
"MIT"
] | null | null | null |
def test_admin_peers(web3, skip_if_testrpc):
skip_if_testrpc(web3)
assert web3.geth.admin.peers == []
| 23
| 45
| 0.704348
| 17
| 115
| 4.411765
| 0.588235
| 0.266667
| 0.346667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.031915
| 0.182609
| 115
| 4
| 46
| 28.75
| 0.765957
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0.333333
| false
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
318c9c1e07b0d25b2a88b699c657b91b44c780ee
| 53
|
py
|
Python
|
Calculator/multiplication.py
|
hudag/mini_proj_2
|
c10b6a10baa7d9124cf574a352031f3ed4d83f3e
|
[
"MIT"
] | 1
|
2019-11-16T02:12:59.000Z
|
2019-11-16T02:12:59.000Z
|
Calculator/multiplication.py
|
hudag/mini_proj_2
|
c10b6a10baa7d9124cf574a352031f3ed4d83f3e
|
[
"MIT"
] | null | null | null |
Calculator/multiplication.py
|
hudag/mini_proj_2
|
c10b6a10baa7d9124cf574a352031f3ed4d83f3e
|
[
"MIT"
] | null | null | null |
def multiplication(a,b):
return float(a)*float(b)
| 26.5
| 28
| 0.698113
| 9
| 53
| 4.111111
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.132075
| 53
| 2
| 28
| 26.5
| 0.804348
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.5
| false
| 0
| 0
| 0.5
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
319575af4b0d0d1d2acfcd175be253997f3599a8
| 44
|
py
|
Python
|
hafalin/tests/__init__.py
|
geraldzakwan/tajong.ai
|
69aaedbf00d068f6a5744855953c60807b88af69
|
[
"MIT"
] | 2
|
2020-11-21T06:08:46.000Z
|
2021-01-12T22:05:28.000Z
|
hafalin/tests/__init__.py
|
geraldzakwan/tajong.ai
|
69aaedbf00d068f6a5744855953c60807b88af69
|
[
"MIT"
] | null | null | null |
hafalin/tests/__init__.py
|
geraldzakwan/tajong.ai
|
69aaedbf00d068f6a5744855953c60807b88af69
|
[
"MIT"
] | 1
|
2021-01-08T16:50:09.000Z
|
2021-01-08T16:50:09.000Z
|
# Constants or whatever needed here in test
| 22
| 43
| 0.795455
| 7
| 44
| 5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 44
| 1
| 44
| 44
| 0.972222
| 0.931818
| 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
|
319e4ae03edeb8baffe9e8c29cb1b49d8d973ef4
| 113
|
py
|
Python
|
engine/src/juliabox/plugins/course_homework/__init__.py
|
shashi/JuliaBox
|
10f65b3ed1b5b2ca703a4ff2c79940cc10c66c61
|
[
"MIT"
] | 50
|
2016-09-09T02:17:09.000Z
|
2022-03-15T17:16:20.000Z
|
engine/src/juliabox/plugins/course_homework/__init__.py
|
wsshin/JuliaBox
|
395df7654834f9671ab132cd29c02fb05ce42c27
|
[
"MIT"
] | 58
|
2016-08-29T19:19:28.000Z
|
2018-11-14T01:49:16.000Z
|
engine/src/juliabox/plugins/course_homework/__init__.py
|
wsshin/JuliaBox
|
395df7654834f9671ab132cd29c02fb05ce42c27
|
[
"MIT"
] | 24
|
2016-09-27T18:20:54.000Z
|
2022-01-02T09:37:44.000Z
|
__author__ = 'tan'
from course_homework import HomeworkHandler
from course_homework_tbl import JBoxCourseHomework
| 37.666667
| 50
| 0.884956
| 13
| 113
| 7.153846
| 0.692308
| 0.215054
| 0.387097
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.088496
| 113
| 3
| 50
| 37.666667
| 0.902913
| 0
| 0
| 0
| 0
| 0
| 0.026316
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 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
|
31cfb8fad93a98fbd96f059a6afcb1010cfeba10
| 173
|
py
|
Python
|
day2_python_basic.py
|
xiaosean/toy_example
|
de9d1e7756ba5dc16e2610cb927e26e782720891
|
[
"MIT"
] | null | null | null |
day2_python_basic.py
|
xiaosean/toy_example
|
de9d1e7756ba5dc16e2610cb927e26e782720891
|
[
"MIT"
] | null | null | null |
day2_python_basic.py
|
xiaosean/toy_example
|
de9d1e7756ba5dc16e2610cb927e26e782720891
|
[
"MIT"
] | null | null | null |
if __name__ == "__main__":
print("Hello World!")
l = [1, 2, 3, 4, 5]
print("list =", l)
print(f"format string list = {l}")
print(f"sum of l = {sum(l)}")
| 24.714286
| 38
| 0.508671
| 28
| 173
| 2.857143
| 0.642857
| 0.125
| 0.25
| 0.275
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.03937
| 0.265896
| 173
| 6
| 39
| 28.833333
| 0.590551
| 0
| 0
| 0
| 0
| 0
| 0.398844
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.666667
| 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
| 0
| 0
| 0
| 1
|
0
| 5
|
31d42407d7be18fb431b4324b63d8e37e1f04eb7
| 3,811
|
py
|
Python
|
z2/part3/updated_part2_batch/jm/parser_errors_2/368887825.py
|
kozakusek/ipp-2020-testy
|
09aa008fa53d159672cc7cbf969a6b237e15a7b8
|
[
"MIT"
] | 1
|
2020-04-16T12:13:47.000Z
|
2020-04-16T12:13:47.000Z
|
z2/part3/updated_part2_batch/jm/parser_errors_2/368887825.py
|
kozakusek/ipp-2020-testy
|
09aa008fa53d159672cc7cbf969a6b237e15a7b8
|
[
"MIT"
] | 18
|
2020-03-06T17:50:15.000Z
|
2020-05-19T14:58:30.000Z
|
z2/part3/updated_part2_batch/jm/parser_errors_2/368887825.py
|
kozakusek/ipp-2020-testy
|
09aa008fa53d159672cc7cbf969a6b237e15a7b8
|
[
"MIT"
] | 18
|
2020-03-06T17:45:13.000Z
|
2020-06-09T19:18:31.000Z
|
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 368887825
"""
"""
random actions, total chaos
"""
board = gamma_new(5, 5, 2, 17)
assert board is not None
assert gamma_move(board, 1, 1, 3) == 1
assert gamma_move(board, 1, 2, 4) == 1
assert gamma_move(board, 2, 4, 3) == 1
assert gamma_move(board, 1, 2, 2) == 1
assert gamma_move(board, 1, 2, 2) == 0
assert gamma_move(board, 2, 1, 1) == 1
board103531492 = gamma_board(board)
assert board103531492 is not None
assert board103531492 == ("..1..\n" ".1..2\n" "..1..\n" ".2...\n" ".....\n")
del board103531492
board103531492 = None
assert gamma_move(board, 1, 0, 1) == 1
assert gamma_move(board, 1, 3, 0) == 1
assert gamma_move(board, 2, 2, 3) == 1
assert gamma_move(board, 1, 1, 2) == 1
assert gamma_move(board, 2, 3, 4) == 1
assert gamma_move(board, 2, 0, 0) == 1
assert gamma_move(board, 1, 0, 2) == 1
assert gamma_move(board, 1, 0, 1) == 0
assert gamma_move(board, 2, 3, 2) == 1
assert gamma_free_fields(board, 2) == 12
assert gamma_move(board, 1, 0, 4) == 1
assert gamma_move(board, 2, 3, 3) == 1
assert gamma_move(board, 1, 1, 4) == 1
assert gamma_move(board, 2, 3, 4) == 0
assert gamma_move(board, 2, 0, 4) == 0
assert gamma_move(board, 1, 3, 0) == 0
assert gamma_move(board, 2, 4, 4) == 1
assert gamma_golden_move(board, 2, 2, 0) == 0
assert gamma_move(board, 1, 0, 2) == 0
assert gamma_free_fields(board, 1) == 8
assert gamma_move(board, 2, 2, 1) == 1
assert gamma_free_fields(board, 2) == 7
assert gamma_move(board, 1, 0, 4) == 0
assert gamma_move(board, 1, 2, 2) == 0
assert gamma_busy_fields(board, 1) == 9
assert gamma_free_fields(board, 1) == 7
assert gamma_move(board, 1, 1, 0) == 1
assert gamma_move(board, 2, 0, 2) == 0
assert gamma_move(board, 2, 3, 0) == 0
assert gamma_busy_fields(board, 2) == 9
assert gamma_move(board, 1, 2, 4) == 0
assert gamma_move(board, 1, 1, 1) == 0
assert gamma_move(board, 2, 3, 4) == 0
assert gamma_move(board, 1, 0, 2) == 0
assert gamma_move(board, 1, 4, 1) == 1
assert gamma_golden_possible(board, 1) == 1
assert gamma_move(board, 2, 4, 4) == 0
assert gamma_move(board, 1, 2, 4) == 0
assert gamma_move(board, 1, 0, 1) == 0
assert gamma_move(board, 2, 0, 4) == 0
assert gamma_move(board, 2, 3, 1) == 1
assert gamma_move(board, 1, 0, 2) == 0
board757922683 = gamma_board(board)
assert board757922683 is not None
assert board757922683 == ("11122\n" ".1222\n" "1112.\n" "12221\n" "21.1.\n")
del board757922683
board757922683 = None
assert gamma_move(board, 2, 0, 4) == 0
assert gamma_move(board, 2, 2, 4) == 0
assert gamma_free_fields(board, 2) == 4
assert gamma_move(board, 1, 2, 1) == 0
assert gamma_move(board, 2, 0, 4) == 0
assert gamma_move(board, 2, 2, 2) == 0
assert gamma_golden_possible(board, 2) == 1
assert gamma_move(board, 1, 3, 4) == 0
assert gamma_move(board, 2, 2, 4) == 0
assert gamma_golden_move(board, 2, 4, 1) == 1
assert gamma_move(board, 1, 0, 2) == 0
assert gamma_move(board, 2, 3, 0) == 0
assert gamma_move(board, 2, 4, 2) == 1
assert gamma_move(board, 1, 1, 3) == 0
assert gamma_move(board, 2, 2, 3) == 0
assert gamma_move(board, 2, 3, 4) == 0
assert gamma_move(board, 1, 0, 4) == 0
assert gamma_busy_fields(board, 1) == 10
assert gamma_move(board, 2, 0, 2) == 0
assert gamma_move(board, 1, 3, 0) == 0
assert gamma_move(board, 2, 0, 2) == 0
assert gamma_move(board, 1, 1, 1) == 0
assert gamma_move(board, 1, 2, 0) == 1
assert gamma_golden_possible(board, 1) == 1
assert gamma_move(board, 2, 2, 0) == 0
board888784761 = gamma_board(board)
assert board888784761 is not None
assert board888784761 == ("11122\n" ".1222\n" "11122\n" "12222\n" "2111.\n")
del board888784761
board888784761 = None
gamma_delete(board)
| 31.758333
| 76
| 0.672264
| 699
| 3,811
| 3.515021
| 0.0701
| 0.326821
| 0.3663
| 0.4884
| 0.739927
| 0.724054
| 0.643061
| 0.504681
| 0.432641
| 0.427757
| 0
| 0.14816
| 0.165836
| 3,811
| 119
| 77
| 32.02521
| 0.624725
| 0
| 0
| 0.316832
| 0
| 0
| 0.028203
| 0
| 0
| 0
| 0
| 0
| 0.792079
| 1
| 0
| false
| 0
| 0.009901
| 0
| 0.009901
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
31de8601b6cbf52cae0a2db72453bb4943fd3408
| 38
|
py
|
Python
|
Basics I/loops.py
|
marinaoliveira96/python-exercises
|
13fc0ec30dec9bb6531cdeb41c80726971975835
|
[
"MIT"
] | null | null | null |
Basics I/loops.py
|
marinaoliveira96/python-exercises
|
13fc0ec30dec9bb6531cdeb41c80726971975835
|
[
"MIT"
] | null | null | null |
Basics I/loops.py
|
marinaoliveira96/python-exercises
|
13fc0ec30dec9bb6531cdeb41c80726971975835
|
[
"MIT"
] | null | null | null |
bag = [10, 1234, 654, 99, 55]
len(bag)
| 19
| 29
| 0.578947
| 8
| 38
| 2.75
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.419355
| 0.184211
| 38
| 2
| 30
| 19
| 0.290323
| 0
| 0
| 0
| 0
| 0
| 0
| 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
|
9ee12f78b5c30f0dbcf6a208b2a6aed6f7ce7f06
| 117
|
py
|
Python
|
books/masteringPython/cp11/cp11_pdb.py
|
Bingwen-Hu/hackaway
|
69727d76fd652390d9660e9ea4354ba5cc76dd5c
|
[
"BSD-2-Clause"
] | null | null | null |
books/masteringPython/cp11/cp11_pdb.py
|
Bingwen-Hu/hackaway
|
69727d76fd652390d9660e9ea4354ba5cc76dd5c
|
[
"BSD-2-Clause"
] | null | null | null |
books/masteringPython/cp11/cp11_pdb.py
|
Bingwen-Hu/hackaway
|
69727d76fd652390d9660e9ea4354ba5cc76dd5c
|
[
"BSD-2-Clause"
] | null | null | null |
# chapter 11 pdb
print('This still works')
1/0
print('we should not reach this code.')
# python3 -m pdb cp11_pdb.py
| 16.714286
| 39
| 0.709402
| 22
| 117
| 3.727273
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.072165
| 0.17094
| 117
| 7
| 40
| 16.714286
| 0.773196
| 0.350427
| 0
| 0
| 0
| 0
| 0.621622
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0.666667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
|
0
| 5
|
9ef2fca3d0dd5c0abea682b9cc81a13d3ae45163
| 35,625
|
py
|
Python
|
tests/unit/modules/test_zpool.py
|
exe01/salt
|
0e4e8a458afc120a149eab83e5b9389c474fedf7
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/modules/test_zpool.py
|
exe01/salt
|
0e4e8a458afc120a149eab83e5b9389c474fedf7
|
[
"Apache-2.0"
] | null | null | null |
tests/unit/modules/test_zpool.py
|
exe01/salt
|
0e4e8a458afc120a149eab83e5b9389c474fedf7
|
[
"Apache-2.0"
] | null | null | null |
"""
Tests for salt.modules.zpool
:codeauthor: Nitin Madhok <nmadhok@clemson.edu>, Jorge Schrauwen <sjorge@blackdot.be>
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: salt.utils.zfs
:platform: illumos,freebsd,linux
"""
import salt.loader
import salt.modules.zpool as zpool
import salt.utils.decorators
import salt.utils.decorators.path
import salt.utils.zfs
from salt.utils.odict import OrderedDict
from tests.support.helpers import slowTest
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase, skipIf
from tests.support.zfs import ZFSMockData
class ZpoolTestCase(TestCase, LoaderModuleMockMixin):
"""
This class contains a set of functions that test salt.modules.zpool module
"""
def setup_loader_modules(self):
self.opts = opts = salt.config.DEFAULT_MINION_OPTS.copy()
self.utils_patch = ZFSMockData().get_patched_utils()
for key in ("opts", "utils_patch"):
self.addCleanup(delattr, self, key)
utils = salt.loader.utils(
opts, whitelist=["zfs", "args", "systemd", "path", "platform"]
)
zpool_obj = {zpool: {"__opts__": opts, "__utils__": utils}}
return zpool_obj
@slowTest
def test_exists_success(self):
"""
Tests successful return of exists function
"""
ret = {}
ret["stdout"] = (
"NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT\n"
"myzpool 149G 128K 149G 0% 1.00x ONLINE -"
)
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
self.assertTrue(zpool.exists("myzpool"))
@slowTest
def test_exists_failure(self):
"""
Tests failure return of exists function
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'myzpool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
self.assertFalse(zpool.exists("myzpool"))
def test_healthy(self):
"""
Tests successful return of healthy function
"""
ret = {}
ret["stdout"] = "all pools are healthy"
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
self.assertTrue(zpool.healthy())
def test_status(self):
"""
Tests successful return of status function
"""
ret = {}
ret["stdout"] = "\n".join(
[
" pool: mypool",
" state: ONLINE",
" scan: scrub repaired 0 in 0h6m with 0 errors on Mon Dec 21 02:06:17 2015",
"config:",
"",
"\tNAME STATE READ WRITE CKSUM",
"\tmypool ONLINE 0 0 0",
"\t mirror-0 ONLINE 0 0 0",
"\t c2t0d0 ONLINE 0 0 0",
"\t c2t1d0 ONLINE 0 0 0",
"",
"errors: No known data errors",
]
)
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.status()
self.assertEqual("ONLINE", ret["mypool"]["state"])
def test_status_with_colons_in_vdevs(self):
"""
Tests successful return of status function
"""
ret = {}
ret["stdout"] = "\n".join(
[
" pool: mypool",
" state: ONLINE",
" scan: scrub repaired 0 in 0h6m with 0 errors on Mon Dec 21 02:06:17 2015",
"config:",
"",
"\tNAME STATE READ WRITE CKSUM",
"\tmypool ONLINE 0 0 0",
"\t mirror-0 ONLINE 0 0 0",
"\t usb-WD_My_Book_Duo_25F6_....32-0:0 ONLINE 0 0 0",
"\t usb-WD_My_Book_Duo_25F6_....32-0:1 ONLINE 0 0 0",
"",
"errors: No known data errors",
]
)
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.status()
self.assertEqual("ONLINE", ret["mypool"]["state"])
@slowTest
def test_iostat(self):
"""
Tests successful return of iostat function
"""
ret = {}
ret["stdout"] = "\n".join(
[
" capacity operations bandwidth",
"pool alloc free read write read write",
"---------- ----- ----- ----- ----- ----- -----",
"mypool 46.7G 64.3G 4 19 113K 331K",
" mirror 46.7G 64.3G 4 19 113K 331K",
" c2t0d0 - - 1 10 114K 334K",
" c2t1d0 - - 1 10 114K 334K",
"---------- ----- ----- ----- ----- ----- -----",
]
)
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.iostat("mypool", parsable=False)
self.assertEqual("46.7G", ret["mypool"]["capacity-alloc"])
def test_iostat_parsable(self):
"""
Tests successful return of iostat function
.. note:
The command output is the same as the non parsable!
There is no -p flag for zpool iostat, but our type
conversions can handle this!
"""
ret = {}
ret["stdout"] = "\n".join(
[
" capacity operations bandwidth",
"pool alloc free read write read write",
"---------- ----- ----- ----- ----- ----- -----",
"mypool 46.7G 64.3G 4 19 113K 331K",
" mirror 46.7G 64.3G 4 19 113K 331K",
" c2t0d0 - - 1 10 114K 334K",
" c2t1d0 - - 1 10 114K 334K",
"---------- ----- ----- ----- ----- ----- -----",
]
)
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.iostat("mypool", parsable=True)
self.assertEqual(50143743180, ret["mypool"]["capacity-alloc"])
def test_list(self):
"""
Tests successful return of list function
"""
ret = {}
ret["stdout"] = "mypool\t1.81T\t661G\t1.17T\t35%\t11%\tONLINE"
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.list_(parsable=False)
res = OrderedDict(
[
(
"mypool",
OrderedDict(
[
("size", "1.81T"),
("alloc", "661G"),
("free", "1.17T"),
("cap", "35%"),
("frag", "11%"),
("health", "ONLINE"),
]
),
)
]
)
self.assertEqual(ret, res)
@slowTest
def test_list_parsable(self):
"""
Tests successful return of list function with parsable output
"""
ret = {}
ret["stdout"] = "mypool\t1.81T\t661G\t1.17T\t35%\t11%\tONLINE"
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.list_(parsable=True)
res = OrderedDict(
[
(
"mypool",
OrderedDict(
[
("size", 1990116046274),
("alloc", 709743345664),
("free", 1286428604497),
("cap", "35%"),
("frag", "11%"),
("health", "ONLINE"),
]
),
)
]
)
self.assertEqual(ret, res)
def test_get(self):
"""
Tests successful return of get function
"""
ret = {}
ret["stdout"] = "mypool\tsize\t1.81T\t-\n"
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.get("mypool", "size", parsable=False)
res = OrderedDict(OrderedDict([("size", "1.81T")]))
self.assertEqual(ret, res)
@slowTest
def test_get_parsable(self):
"""
Tests successful return of get function with parsable output
"""
ret = {}
ret["stdout"] = "mypool\tsize\t1.81T\t-\n"
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.get("mypool", "size", parsable=True)
res = OrderedDict(OrderedDict([("size", 1990116046274)]))
self.assertEqual(ret, res)
@slowTest
def test_get_whitespace(self):
"""
Tests successful return of get function with a string with whitespaces
"""
ret = {}
ret["stdout"] = "mypool\tcomment\tmy testing pool\t-\n"
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.get("mypool", "comment")
res = OrderedDict(OrderedDict([("comment", "my testing pool")]))
self.assertEqual(ret, res)
@slowTest
def test_scrub_start(self):
"""
Tests start of scrub
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
mock_exists = MagicMock(return_value=True)
with patch.dict(zpool.__salt__, {"zpool.exists": mock_exists}), patch.dict(
zpool.__salt__, {"cmd.run_all": mock_cmd}
), patch.dict(zpool.__utils__, self.utils_patch):
ret = zpool.scrub("mypool")
res = OrderedDict(OrderedDict([("scrubbing", True)]))
self.assertEqual(ret, res)
@slowTest
def test_scrub_pause(self):
"""
Tests pause of scrub
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
mock_exists = MagicMock(return_value=True)
with patch.dict(zpool.__salt__, {"zpool.exists": mock_exists}), patch.dict(
zpool.__salt__, {"cmd.run_all": mock_cmd}
), patch.dict(zpool.__utils__, self.utils_patch):
ret = zpool.scrub("mypool", pause=True)
res = OrderedDict(OrderedDict([("scrubbing", False)]))
self.assertEqual(ret, res)
@slowTest
def test_scrub_stop(self):
"""
Tests pauze of scrub
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
mock_exists = MagicMock(return_value=True)
with patch.dict(zpool.__salt__, {"zpool.exists": mock_exists}), patch.dict(
zpool.__salt__, {"cmd.run_all": mock_cmd}
), patch.dict(zpool.__utils__, self.utils_patch):
ret = zpool.scrub("mypool", stop=True)
res = OrderedDict(OrderedDict([("scrubbing", False)]))
self.assertEqual(ret, res)
def test_split_success(self):
"""
Tests split on success
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.split("datapool", "backuppool")
res = OrderedDict([("split", True)])
self.assertEqual(ret, res)
@slowTest
def test_split_exist_new(self):
"""
Tests split on exising new pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "Unable to split datapool: pool already exists"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.split("datapool", "backuppool")
res = OrderedDict(
[
("split", False),
("error", "Unable to split datapool: pool already exists"),
]
)
self.assertEqual(ret, res)
def test_split_missing_pool(self):
"""
Tests split on missing source pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'datapool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.split("datapool", "backuppool")
res = OrderedDict(
[("split", False), ("error", "cannot open 'datapool': no such pool")]
)
self.assertEqual(ret, res)
@slowTest
def test_split_not_mirror(self):
"""
Tests split on source pool is not a mirror
"""
ret = {}
ret["stdout"] = ""
ret[
"stderr"
] = "Unable to split datapool: Source pool must be composed only of mirrors"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.split("datapool", "backuppool")
res = OrderedDict(
[
("split", False),
(
"error",
"Unable to split datapool: Source pool must be composed only of mirrors",
),
]
)
self.assertEqual(ret, res)
def test_labelclear_success(self):
"""
Tests labelclear on successful label removal
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.labelclear("/dev/rdsk/c0t0d0", force=False)
res = OrderedDict([("labelcleared", True)])
self.assertEqual(ret, res)
def test_labelclear_nodevice(self):
"""
Tests labelclear on non existing device
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "failed to open /dev/rdsk/c0t0d0: No such file or directory"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.labelclear("/dev/rdsk/c0t0d0", force=False)
res = OrderedDict(
[
("labelcleared", False),
(
"error",
"failed to open /dev/rdsk/c0t0d0: No such file or directory",
),
]
)
self.assertEqual(ret, res)
def test_labelclear_cleared(self):
"""
Tests labelclear on device with no label
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "failed to read label from /dev/rdsk/c0t0d0"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.labelclear("/dev/rdsk/c0t0d0", force=False)
res = OrderedDict(
[
("labelcleared", False),
("error", "failed to read label from /dev/rdsk/c0t0d0"),
]
)
self.assertEqual(ret, res)
def test_labelclear_exported(self):
"""
Tests labelclear on device with from exported pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "\n".join(
[
"use '-f' to override the following error:",
'/dev/rdsk/c0t0d0 is a member of exported pool "mypool"',
]
)
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.labelclear("/dev/rdsk/c0t0d0", force=False)
res = OrderedDict(
[
("labelcleared", False),
(
"error",
"use 'force=True' to override the following error:\n/dev/rdsk/c0t0d0 is a member of exported pool \"mypool\"",
),
]
)
self.assertEqual(ret, res)
@skipIf(not salt.utils.path.which("mkfile"), "Cannot find mkfile executable")
def test_create_file_vdev_success(self):
"""
Tests create_file_vdev when out of space
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.create_file_vdev("64M", "/vdisks/disk0")
res = OrderedDict([("/vdisks/disk0", "created")])
self.assertEqual(ret, res)
@skipIf(not salt.utils.path.which("mkfile"), "Cannot find mkfile executable")
def test_create_file_vdev_nospace(self):
"""
Tests create_file_vdev when out of space
"""
ret = {}
ret["stdout"] = ""
ret[
"stderr"
] = "/vdisks/disk0: initialized 10424320 of 67108864 bytes: No space left on device"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.create_file_vdev("64M", "/vdisks/disk0")
res = OrderedDict(
[
("/vdisks/disk0", "failed"),
(
"error",
OrderedDict(
[
(
"/vdisks/disk0",
" initialized 10424320 of 67108864 bytes: No space left on device",
),
]
),
),
]
)
self.assertEqual(ret, res)
def test_export_success(self):
"""
Tests export
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.export("mypool")
res = OrderedDict([("exported", True)])
self.assertEqual(ret, res)
@slowTest
def test_export_nopool(self):
"""
Tests export when the pool does not exists
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'mypool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.export("mypool")
res = OrderedDict(
[("exported", False), ("error", "cannot open 'mypool': no such pool")]
)
self.assertEqual(ret, res)
@slowTest
def test_import_success(self):
"""
Tests import
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.import_("mypool")
res = OrderedDict([("imported", True)])
self.assertEqual(ret, res)
def test_import_duplicate(self):
"""
Tests import with already imported pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "\n".join(
[
"cannot import 'mypool': a pool with that name already exists",
"use the form 'zpool import <pool | id> <newpool>' to give it a new name",
]
)
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.import_("mypool")
res = OrderedDict(
[
("imported", False),
(
"error",
"cannot import 'mypool': a pool with that name already exists\nuse the form 'zpool import <pool | id> <newpool>' to give it a new name",
),
]
)
self.assertEqual(ret, res)
def test_import_nopool(self):
"""
Tests import
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot import 'mypool': no such pool available"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.import_("mypool")
res = OrderedDict(
[
("imported", False),
("error", "cannot import 'mypool': no such pool available"),
]
)
self.assertEqual(ret, res)
@slowTest
def test_online_success(self):
"""
Tests online
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.online("mypool", "/dev/rdsk/c0t0d0")
res = OrderedDict([("onlined", True)])
self.assertEqual(ret, res)
def test_online_nodevice(self):
"""
Tests online
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot online /dev/rdsk/c0t0d1: no such device in pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.online("mypool", "/dev/rdsk/c0t0d1")
res = OrderedDict(
[
("onlined", False),
("error", "cannot online /dev/rdsk/c0t0d1: no such device in pool"),
]
)
self.assertEqual(ret, res)
def test_offline_success(self):
"""
Tests offline
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.offline("mypool", "/dev/rdsk/c0t0d0")
res = OrderedDict([("offlined", True)])
self.assertEqual(ret, res)
def test_offline_nodevice(self):
"""
Tests offline
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot offline /dev/rdsk/c0t0d1: no such device in pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.offline("mypool", "/dev/rdsk/c0t0d1")
res = OrderedDict(
[
("offlined", False),
(
"error",
"cannot offline /dev/rdsk/c0t0d1: no such device in pool",
),
]
)
self.assertEqual(ret, res)
def test_offline_noreplica(self):
"""
Tests offline
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot offline /dev/rdsk/c0t0d1: no valid replicas"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.offline("mypool", "/dev/rdsk/c0t0d1")
res = OrderedDict(
[
("offlined", False),
("error", "cannot offline /dev/rdsk/c0t0d1: no valid replicas"),
]
)
self.assertEqual(ret, res)
@slowTest
def test_reguid_success(self):
"""
Tests reguid
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.reguid("mypool")
res = OrderedDict([("reguided", True)])
self.assertEqual(ret, res)
@slowTest
def test_reguid_nopool(self):
"""
Tests reguid with missing pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'mypool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.reguid("mypool")
res = OrderedDict(
[("reguided", False), ("error", "cannot open 'mypool': no such pool")]
)
self.assertEqual(ret, res)
@slowTest
def test_reopen_success(self):
"""
Tests reopen
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.reopen("mypool")
res = OrderedDict([("reopened", True)])
self.assertEqual(ret, res)
def test_reopen_nopool(self):
"""
Tests reopen with missing pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'mypool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.reopen("mypool")
res = OrderedDict(
[("reopened", False), ("error", "cannot open 'mypool': no such pool")]
)
self.assertEqual(ret, res)
def test_upgrade_success(self):
"""
Tests upgrade
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.upgrade("mypool")
res = OrderedDict([("upgraded", True)])
self.assertEqual(ret, res)
def test_upgrade_nopool(self):
"""
Tests upgrade with missing pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'mypool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.upgrade("mypool")
res = OrderedDict(
[("upgraded", False), ("error", "cannot open 'mypool': no such pool")]
)
self.assertEqual(ret, res)
@slowTest
def test_history_success(self):
"""
Tests history
"""
ret = {}
ret["stdout"] = "\n".join(
[
"History for 'mypool':",
"2018-01-18.16:56:12 zpool create -f mypool /dev/rdsk/c0t0d0",
"2018-01-19.16:01:55 zpool attach -f mypool /dev/rdsk/c0t0d0 /dev/rdsk/c0t0d1",
]
)
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.history("mypool")
res = OrderedDict(
[
(
"mypool",
OrderedDict(
[
(
"2018-01-18.16:56:12",
"zpool create -f mypool /dev/rdsk/c0t0d0",
),
(
"2018-01-19.16:01:55",
"zpool attach -f mypool /dev/rdsk/c0t0d0 /dev/rdsk/c0t0d1",
),
]
),
),
]
)
self.assertEqual(ret, res)
def test_history_nopool(self):
"""
Tests history with missing pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'mypool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.history("mypool")
res = OrderedDict([("error", "cannot open 'mypool': no such pool")])
self.assertEqual(ret, res)
def test_clear_success(self):
"""
Tests clear
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = ""
ret["retcode"] = 0
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.clear("mypool")
res = OrderedDict([("cleared", True)])
self.assertEqual(ret, res)
def test_clear_nopool(self):
"""
Tests clear with missing pool
"""
ret = {}
ret["stdout"] = ""
ret["stderr"] = "cannot open 'mypool': no such pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.clear("mypool")
res = OrderedDict(
[("cleared", False), ("error", "cannot open 'mypool': no such pool")]
)
def test_clear_nodevice(self):
"""
Tests clear with non existign device
"""
ret = {}
ret["stdout"] = ""
ret[
"stderr"
] = "cannot clear errors for /dev/rdsk/c0t0d0: no such device in pool"
ret["retcode"] = 1
mock_cmd = MagicMock(return_value=ret)
with patch.dict(zpool.__salt__, {"cmd.run_all": mock_cmd}), patch.dict(
zpool.__utils__, self.utils_patch
):
ret = zpool.clear("mypool", "/dev/rdsk/c0t0d0")
res = OrderedDict(
[
("cleared", False),
(
"error",
"cannot clear errors for /dev/rdsk/c0t0d0: no such device in pool",
),
]
)
self.assertEqual(ret, res)
| 33.767773
| 160
| 0.480982
| 3,507
| 35,625
| 4.670088
| 0.088965
| 0.052204
| 0.081207
| 0.053853
| 0.839052
| 0.823361
| 0.800525
| 0.744108
| 0.693736
| 0.688607
| 0
| 0.025232
| 0.388126
| 35,625
| 1,054
| 161
| 33.79981
| 0.726122
| 0.055214
| 0
| 0.681427
| 0
| 0.00492
| 0.211246
| 0.007006
| 0
| 0
| 0
| 0
| 0.055351
| 1
| 0.057811
| false
| 0
| 0.03075
| 0
| 0.091021
| 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
|
73142847d72fa70bcb2fae1e4ba9bc6c0c646846
| 24,666
|
py
|
Python
|
tests/test_views.py
|
posita/emojiwatch-django
|
62080e70ef51c6939105d3cd67eb04d1a41ba274
|
[
"MIT"
] | null | null | null |
tests/test_views.py
|
posita/emojiwatch-django
|
62080e70ef51c6939105d3cd67eb04d1a41ba274
|
[
"MIT"
] | 1
|
2018-04-25T00:01:18.000Z
|
2018-04-25T00:01:18.000Z
|
tests/test_views.py
|
posita/emojiwatch-django
|
62080e70ef51c6939105d3cd67eb04d1a41ba274
|
[
"MIT"
] | 1
|
2019-04-05T18:51:34.000Z
|
2019-04-05T18:51:34.000Z
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# ========================================================================
"""
Copyright and other protections apply. Please see the accompanying
:doc:`LICENSE <LICENSE>` and :doc:`CREDITS <CREDITS>` file(s) for rights
and restrictions governing use of this software. All rights not expressly
waived or licensed are reserved. If those files are missing or appear to
be modified from their originals, then please contact the author before
viewing or using this software in any capacity.
"""
# ========================================================================
from __future__ import absolute_import, division, print_function
TYPE_CHECKING = False # from typing import TYPE_CHECKING
if TYPE_CHECKING:
import typing # noqa: F401 # pylint: disable=import-error,unused-import,useless-suppression
from builtins import * # noqa: F401,F403 # pylint: disable=redefined-builtin,unused-wildcard-import,useless-suppression,wildcard-import
from future.builtins.disabled import * # noqa: F401,F403 # pylint: disable=no-name-in-module,redefined-builtin,unused-wildcard-import,useless-suppression,wildcard-import
# ---- Imports -----------------------------------------------------------
import json
import slacker
import unittest
try:
import django.urls as d_urls
except ImportError:
import django.core.urlresolvers as d_urls
import django.http as d_http
import django.test as d_test
if __name__ == '__main__':
import tests
tests.setup()
from emojiwatch import SLACK_VERIFICATION_TOKEN
from emojiwatch.models import (
SlackWorkspaceEmojiWatcher,
TEAM_ID_MAX_LEN,
)
from emojiwatch.views import (
RequestPayloadValidationError,
_CHALLENGE_MAX_LEN,
_FIELD_MAX_LEN,
)
from tests.symmetries import mock
# ---- Data --------------------------------------------------------------
__all__ = ()
# ---- Classes -----------------------------------------------------------
# ========================================================================
class RequestPayloadValidationErrorTestCase(unittest.TestCase):
# ---- Methods -------------------------------------------------------
def test_constructors(self):
# type: (...) -> None
message = 'Hey!'
response = d_http.HttpResponseServerError()
exc = RequestPayloadValidationError()
self.assertEqual(exc.message, 'unrecognized JSON structure from request body')
self.assertIsInstance(exc.response, d_http.HttpResponseBadRequest)
exc = RequestPayloadValidationError(message)
self.assertEqual(exc.message, message)
self.assertIsInstance(exc.response, d_http.HttpResponseBadRequest)
exc = RequestPayloadValidationError(message=message)
self.assertEqual(exc.message, message)
self.assertIsInstance(exc.response, d_http.HttpResponseBadRequest)
exc = RequestPayloadValidationError(response=response)
self.assertEqual(exc.message, 'unrecognized JSON structure from request body')
self.assertEqual(exc.response, response)
exc = RequestPayloadValidationError(message, response)
self.assertEqual(exc.message, message)
self.assertEqual(exc.response, response)
exc = RequestPayloadValidationError(message, response=response)
self.assertEqual(exc.message, message)
self.assertEqual(exc.response, response)
exc = RequestPayloadValidationError(message=message, response=response)
self.assertEqual(exc.message, message)
self.assertEqual(exc.response, response)
# TODO: These should all generate MyPy errors
RequestPayloadValidationError('', True)
RequestPayloadValidationError('', response=True)
RequestPayloadValidationError(message='', response=True)
# ========================================================================
class EventHandlerTestCaseBase(d_test.TestCase):
# ---- Data ----------------------------------------------------------
WORKSPACE = {
'team_id': 'T123ABC',
'access_token': 'xoxa-1f2e3d-4c5b6a',
'channel_id': 'C123ABC',
'icon_emoji': ':blush:',
}
BOT = {
'team_id': 'T456DEF',
'access_token': 'xoxb-4c5b6a-1f2e3d',
'channel_id': 'C456DEF',
'icon_emoji': ':smirk:',
}
# ---- Properties ----------------------------------------------------
@property
def good_add_event(self):
# type: (...) -> typing.Dict
return {
'event': {
'name': 'blam',
'subtype': 'add',
'type': 'emoji_changed',
'value': 'https://gulfcoastmakers.files.wordpress.com/2015/03/blam.jpg',
},
'team_id': self.WORKSPACE['team_id'],
'token': SLACK_VERIFICATION_TOKEN,
'type': 'event_callback',
}
@property
def good_remove_event(self):
# type: (...) -> typing.Dict
return {
'event': {
'names': [
'biff',
'blam',
'pow',
'zok',
],
'subtype': 'remove',
'type': 'emoji_changed',
},
'team_id': self.WORKSPACE['team_id'],
'token': SLACK_VERIFICATION_TOKEN,
'type': 'event_callback',
}
@property
def good_url_verification(self):
# type: (...) -> typing.Dict
return {
'challenge': '',
'token': SLACK_VERIFICATION_TOKEN,
'type': 'url_verification',
}
# ---- Hooks ---------------------------------------------------------
def setUp(self):
super().setUp() # type: ignore # py2
SlackWorkspaceEmojiWatcher(**self.WORKSPACE).save()
SlackWorkspaceEmojiWatcher(**self.BOT).save()
# ---- Methods -------------------------------------------------------
def post_event_hook(self, payload_data, content_type=None, encoding=None):
if not isinstance(payload_data, str):
# See <https://tools.ietf.org/html/rfc8259#section-8.1> and
# <https://tools.ietf.org/html/rfc8259#section-11> (JSON is
# UTF-8 and charset parameter should be omitted). In addition,
# at least with Django dev, if an explicit charset is
# provided, data is blindly assumed to be a Unicode string
# (not raw bytes) and the charset will be used to encode it.
content_type = 'application/json'
encoding = None
payload_data = json.dumps(payload_data)
return self.client.post(
d_urls.reverse('emojiwatch:event_hook'),
content_type='{}{}{}'.format(content_type, '; charset=' if encoding else '', encoding),
data=payload_data,
follow=True,
)
# ========================================================================
class EventHandlerTestCase(EventHandlerTestCaseBase):
# ---- Methods -------------------------------------------------------
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_bad_event(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
for event in (
None,
'<...>',
[],
'**' * _FIELD_MAX_LEN,
):
payload_data['event'] = event
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_bad_event_type(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
for event_type in (
None,
'<...>',
[],
{'type': None},
'**' * _FIELD_MAX_LEN,
):
payload_data['event']['type'] = event_type
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_bad_event_subtype(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
for event_type in (
None,
'<...>',
[],
{'subtype': None},
'**' * _FIELD_MAX_LEN,
):
payload_data['event']['subtype'] = event_type
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_bad_team(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
for team_id in (
None,
'<...>',
'T' + 'A' * TEAM_ID_MAX_LEN,
list(self.WORKSPACE['team_id']),
{self.WORKSPACE['team_id']: None},
):
payload_data['team_id'] = team_id
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_bad_type(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
for event_type in (
None,
'<...>',
list('emoji_changed'),
{'emoji_changed': None},
'**' * _FIELD_MAX_LEN,
):
payload_data['event']['type'] = event_type
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_no_event(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
del payload_data['event']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_no_event_type(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
del payload_data['event']['type']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_no_event_subtype(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
del payload_data['event']['subtype']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_no_team(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
del payload_data['team_id']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_emoji_no_type(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
):
del payload_data['event']['type']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_payload_bad_json(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
res = self.post_event_hook(str('---'), content_type='application/json')
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_payload_bad_type(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
self.good_url_verification,
):
for payload_type in (
None,
'<...>',
list('event_callback'),
{'event_callback': None},
'**' * _FIELD_MAX_LEN,
):
payload_data['type'] = payload_type
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_payload_no_type(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
for payload_data in (
self.good_add_event,
self.good_remove_event,
self.good_url_verification,
):
del payload_data['type']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
# ========================================================================
class EmojiAddTestCase(EventHandlerTestCaseBase):
# ---- Methods -------------------------------------------------------
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_add_emoji(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
good_add_event = self.good_add_event
res = self._post_add_event(self.WORKSPACE, good_add_event, mocked_post_message)
self.assertEqual(res.status_code, 200)
good_add_event['team_id'] = self.BOT['team_id']
res = self._post_add_event(self.BOT, good_add_event, mocked_post_message, as_user=False)
self.assertEqual(res.status_code, 200)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_add_emoji_invalid_auth(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = slacker.Error('invalid_auth')
res = self._post_add_event(self.WORKSPACE, self.good_add_event, mocked_post_message)
self.assertEqual(res.status_code, 403)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_add_emoji_slacker_errors_ignored(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = slacker.Error()
res = self._post_add_event(self.WORKSPACE, self.good_add_event, mocked_post_message)
self.assertEqual(res.status_code, 200)
def _post_add_event(
self,
team_dict, # type: typing.Dict
add_event, # type: typing.Dict
mocked_post_message, # type: mock.MagicMock
as_user=None, # type: typing.Optional[bool]
):
# type: (...) -> d_http.Response
add_event.setdefault('team_id', team_dict['team_id'])
emoji_name = add_event['event']['name']
emoji_url = add_event['event']['value']
res = self.post_event_hook(add_event)
mocked_post_message.assert_called_with(
team_dict['channel_id'],
'added `:{}:`'.format(emoji_name),
attachments=[{
'fallback': '<{}>'.format(emoji_url),
'image_url': emoji_url,
}],
as_user=as_user,
icon_emoji=team_dict['icon_emoji'],
)
return res
# ========================================================================
class EmojiRemoveTestCase(EventHandlerTestCaseBase):
# ---- Methods -------------------------------------------------------
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_remove_emoji(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
good_remove_event = self.good_remove_event
res = self._post_remove_event(self.WORKSPACE, good_remove_event, mocked_post_message)
self.assertEqual(res.status_code, 200)
good_remove_event['team_id'] = self.BOT['team_id']
res = self._post_remove_event(self.BOT, good_remove_event, mocked_post_message, as_user=False)
self.assertEqual(res.status_code, 200)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_remove_emoji_invalid_auth(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = slacker.Error('invalid_auth')
res = self._post_remove_event(self.WORKSPACE, self.good_remove_event, mocked_post_message)
self.assertEqual(res.status_code, 403)
@mock.patch.object(slacker.Chat, 'post_message')
def test_event_remove_emoji_slacker_errors_ignored(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = slacker.Error()
res = self._post_remove_event(self.WORKSPACE, self.good_remove_event, mocked_post_message)
self.assertEqual(res.status_code, 200)
def _post_remove_event(
self,
team_dict, # type: typing.Dict
remove_event, # type: typing.Dict
mocked_post_message, # type: mock.MagicMock
as_user=None, # type: typing.Optional[bool]
):
# type: (...) -> d_http.Response
remove_event.setdefault('team_id', team_dict['team_id'])
emoji_names = remove_event['event']['names']
res = self.post_event_hook(remove_event)
mocked_post_message.assert_called_with(
team_dict['channel_id'],
'removed `:{}:`'.format(':`, `:'.join(emoji_names)),
as_user=as_user,
icon_emoji=team_dict['icon_emoji'],
)
return res
# ========================================================================
class VerificationTestCase(EventHandlerTestCaseBase):
# ---- Methods -------------------------------------------------------
@mock.patch.object(slacker.Chat, 'post_message')
def test_bad_challenge(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
payload_data = self.good_url_verification
for challenge in (
None,
list('<...>'),
{'challenge': None},
'**' * _CHALLENGE_MAX_LEN,
):
payload_data['challenge'] = challenge
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_bad_token(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
res = self.post_event_hook({
'token': '<...>',
})
self.assertEqual(res.status_code, 403)
for payload_data in (
self.good_add_event,
self.good_remove_event,
self.good_url_verification,
):
for token in (
None,
'<...>',
list(SLACK_VERIFICATION_TOKEN),
{'token': None},
'**' * _FIELD_MAX_LEN,
):
payload_data['token'] = token
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 403)
@mock.patch.object(slacker.Chat, 'post_message')
def test_no_challenge(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
payload_data = self.good_url_verification
del payload_data['challenge']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 400)
@mock.patch.object(slacker.Chat, 'post_message')
def test_no_token(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
res = self.post_event_hook({})
self.assertEqual(res.status_code, 403)
for payload_data in (
self.good_add_event,
self.good_remove_event,
self.good_url_verification,
):
del payload_data['token']
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 403)
@mock.patch.object(slacker.Chat, 'post_message')
def test_url_verification(
self,
mocked_post_message, # type: mock.MagicMock
):
# type: (...) -> None
mocked_post_message.side_effect = AssertionError('should not have reached slacker.Chat.post_message')
payload_data = self.good_url_verification
payload_data['challenge'] = 'NXEJp99-JO7kCaVrBbMteU4EhOzW3Bek59_NXmR6uXo='
res = self.post_event_hook(payload_data)
self.assertEqual(res.status_code, 200)
self.assertEqual(payload_data['challenge'], res.content.decode('utf-8'))
# ---- Initialization ----------------------------------------------------
if __name__ == '__main__':
tests.main()
| 36.542222
| 170
| 0.561218
| 2,483
| 24,666
| 5.28675
| 0.113572
| 0.083797
| 0.075112
| 0.070389
| 0.758742
| 0.747086
| 0.731698
| 0.705569
| 0.705569
| 0.683858
| 0
| 0.008659
| 0.28367
| 24,666
| 674
| 171
| 36.596439
| 0.73428
| 0.162815
| 0
| 0.635108
| 0
| 0
| 0.113096
| 0.025073
| 0
| 0
| 0
| 0.001484
| 0.12426
| 1
| 0.063116
| false
| 0
| 0.033531
| 0.005917
| 0.12426
| 0.001972
| 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
|
731e2ad8fd64073eea9706da8a9b91bb53baf318
| 107
|
py
|
Python
|
sendgrid/helpers/mail/reply_to.py
|
modernwarfareuplink/sendgrid-python
|
b360223622418216f89a98278cfa1cde3e2a9ceb
|
[
"MIT"
] | 1,268
|
2015-01-07T01:26:41.000Z
|
2022-03-31T12:40:59.000Z
|
sendgrid/helpers/mail/reply_to.py
|
modernwarfareuplink/sendgrid-python
|
b360223622418216f89a98278cfa1cde3e2a9ceb
|
[
"MIT"
] | 881
|
2015-01-08T23:14:57.000Z
|
2022-03-30T15:10:21.000Z
|
sendgrid/helpers/mail/reply_to.py
|
modernwarfareuplink/sendgrid-python
|
b360223622418216f89a98278cfa1cde3e2a9ceb
|
[
"MIT"
] | 761
|
2015-01-08T10:28:25.000Z
|
2022-03-29T12:04:42.000Z
|
from .email import Email
class ReplyTo(Email):
"""A reply to email address with an optional name."""
| 17.833333
| 57
| 0.700935
| 16
| 107
| 4.6875
| 0.8125
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.196262
| 107
| 5
| 58
| 21.4
| 0.872093
| 0.439252
| 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
|
73420ac64c405b8cfe04ce12e2d9747c2f388a8b
| 144
|
py
|
Python
|
LAUG/nlu/gpt/multiwoz/__init__.py
|
wise-east/LAUG
|
c5fc674e76a0a20622a77301f9986ad58713d58d
|
[
"Apache-2.0"
] | 10
|
2021-07-10T12:40:42.000Z
|
2022-03-14T07:51:06.000Z
|
LAUG/nlu/gpt/multiwoz/__init__.py
|
wise-east/LAUG
|
c5fc674e76a0a20622a77301f9986ad58713d58d
|
[
"Apache-2.0"
] | 5
|
2021-07-01T11:23:58.000Z
|
2021-09-09T05:51:02.000Z
|
LAUG/nlu/gpt/multiwoz/__init__.py
|
wise-east/LAUG
|
c5fc674e76a0a20622a77301f9986ad58713d58d
|
[
"Apache-2.0"
] | 2
|
2021-09-13T16:26:42.000Z
|
2021-11-16T09:26:54.000Z
|
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 4 21:43:42 2020
@author: truthless
"""
from convlab2.nlu.gpt.multiwoz.nlu import GPTNLU
| 18
| 48
| 0.638889
| 22
| 144
| 4.181818
| 0.954545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.113043
| 0.201389
| 144
| 8
| 48
| 18
| 0.686957
| 0.541667
| 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
|
7df7531575906f384a11329a27d34e11ff34e25e
| 102
|
py
|
Python
|
server-py/core/connector/__init__.py
|
celiaxiao/cyberbrick
|
0c5e0819560fdf436b87ce809c8d44eaaf75190d
|
[
"Apache-2.0"
] | null | null | null |
server-py/core/connector/__init__.py
|
celiaxiao/cyberbrick
|
0c5e0819560fdf436b87ce809c8d44eaaf75190d
|
[
"Apache-2.0"
] | null | null | null |
server-py/core/connector/__init__.py
|
celiaxiao/cyberbrick
|
0c5e0819560fdf436b87ce809c8d44eaaf75190d
|
[
"Apache-2.0"
] | null | null | null |
"""
@author Jacob Xie
@time 3/6/2021
"""
from .connector import Connector
from .loader import Loader
| 12.75
| 32
| 0.72549
| 15
| 102
| 4.933333
| 0.733333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.069767
| 0.156863
| 102
| 7
| 33
| 14.571429
| 0.790698
| 0.313725
| 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
|
7df923933d4886dbc59d3b29f3c46f35d9a7486b
| 36
|
py
|
Python
|
Algorithms/Random Forest/__init__.py
|
0xPrateek/ML-Algorithms
|
5d3fc9f9ad538c6e3694feb3b3014a58cc81419b
|
[
"MIT"
] | 7
|
2019-02-28T07:41:47.000Z
|
2021-12-19T13:32:15.000Z
|
Algorithms/Random Forest/__init__.py
|
0xPrateek/ML-Algorithms-Python3
|
5d3fc9f9ad538c6e3694feb3b3014a58cc81419b
|
[
"MIT"
] | 2
|
2019-04-04T15:45:58.000Z
|
2019-04-04T15:46:57.000Z
|
Algorithms/Random Forest/__init__.py
|
0xPrateek/ML-Algorithms-Python3
|
5d3fc9f9ad538c6e3694feb3b3014a58cc81419b
|
[
"MIT"
] | 3
|
2019-04-05T04:22:28.000Z
|
2019-09-08T14:19:21.000Z
|
# Random Forest folder created
pass
| 12
| 30
| 0.805556
| 5
| 36
| 5.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.166667
| 36
| 2
| 31
| 18
| 0.966667
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
b41357c9af0ba4d93bf44c740f9b16e8573b8fc9
| 121
|
py
|
Python
|
Project 8 -- Deep Learning for Cancer Classification/cnn_image_classifier/sys_utils.py
|
Vauke/Deep-Neural-Networks-HealthCare
|
a6e0cc9d44e06ab3b3f3a947c512ca25f3e17a14
|
[
"MIT"
] | 2
|
2019-05-15T11:05:17.000Z
|
2019-05-16T16:31:49.000Z
|
Project 8 -- Deep Learning for Cancer Classification/cnn_image_classifier/sys_utils.py
|
Vauke/Deep-Neural-Networks-HealthCare
|
a6e0cc9d44e06ab3b3f3a947c512ca25f3e17a14
|
[
"MIT"
] | 7
|
2020-09-26T01:27:55.000Z
|
2022-01-13T03:14:02.000Z
|
Project 8 -- Deep Learning for Cancer Classification/cnn_image_classifier/sys_utils.py
|
Vauke/Deep-Neural-Networks-HealthCare
|
a6e0cc9d44e06ab3b3f3a947c512ca25f3e17a14
|
[
"MIT"
] | 3
|
2020-01-20T09:58:08.000Z
|
2021-03-25T18:29:49.000Z
|
import sys
import logging
def graceful_exit():
logging.error("Invalid input, now exiting program.")
sys.exit()
| 15.125
| 56
| 0.710744
| 16
| 121
| 5.3125
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 121
| 7
| 57
| 17.285714
| 0.858586
| 0
| 0
| 0
| 0
| 0
| 0.289256
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| true
| 0
| 0.4
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b41d15e731ba94c8419e6744c81769893c4ed903
| 2,346
|
py
|
Python
|
libraries/base/widgetImport.py
|
PiRSquared17/r-orange
|
6bc383f1db3c10c59e16b39daffc44df904ce031
|
[
"Apache-2.0"
] | 1
|
2019-04-15T13:50:30.000Z
|
2019-04-15T13:50:30.000Z
|
libraries/base/widgetImport.py
|
PiRSquared17/r-orange
|
6bc383f1db3c10c59e16b39daffc44df904ce031
|
[
"Apache-2.0"
] | null | null | null |
libraries/base/widgetImport.py
|
PiRSquared17/r-orange
|
6bc383f1db3c10c59e16b39daffc44df904ce031
|
[
"Apache-2.0"
] | 1
|
2016-01-21T23:00:21.000Z
|
2016-01-21T23:00:21.000Z
|
## baseQtWidgets
from libraries.base.qtWidgets.button import button as redRButton
from libraries.base.qtWidgets.checkBox import checkBox as redRCheckBox
from libraries.base.qtWidgets.comboBox import comboBox as redRComboBox
from libraries.base.qtWidgets.commitButton import commitButton as redRCommitButton
from libraries.base.qtWidgets.dialog import dialog as redRDialog
from libraries.base.qtWidgets.fileNamesComboBox import fileNamesComboBox as redRFileNamesComboBox
from libraries.base.qtWidgets.filterTable import filterTable as redRFilterTable
from libraries.base.qtWidgets.graphicsView import graphicsView as redRGraphicsView
from libraries.base.qtWidgets.groupBox import groupBox as redRGroupBox
from libraries.base.qtWidgets.lineEdit import lineEdit as redRLineEdit
from libraries.base.qtWidgets.lineEditHint import lineEditHint as redRLineEditHint
from libraries.base.qtWidgets.listBox import listBox as redRListBox
from libraries.base.qtWidgets.radioButtons import radioButtons as redRRadioButtons
from libraries.base.qtWidgets.RFormulaEntry import RFormulaEntry as redRRFormulaEntry
from libraries.base.qtWidgets.Rtable import Rtable as redRRtable
from libraries.base.qtWidgets.scrollArea import scrollArea as redRScrollArea
from libraries.base.qtWidgets.SearchDialog import SearchDialog as redRSearchDialog
from libraries.base.qtWidgets.separator import separator as redRSeparator
from libraries.base.qtWidgets.spinBox import spinBox as redRSpinBox
from libraries.base.qtWidgets.splitter import splitter as redRSplitter
from libraries.base.qtWidgets.statusLabel import statusLabel as redRStatusLabel
from libraries.base.qtWidgets.table import table as redRTable
from libraries.base.qtWidgets.tabWidget import tabWidget as redRTabWidget
from libraries.base.qtWidgets.textEdit import textEdit as redRTextEdit
from libraries.base.qtWidgets.treeWidget import treeWidget as redRTreeWidget
from libraries.base.qtWidgets.treeWidgetItem import treeWidgetItem as redRTreeWidgetItem
from libraries.base.qtWidgets.webViewBox import webViewBox as redRWebViewBox
from libraries.base.qtWidgets.widgetBox import widgetBox as redRWidgetBox
from libraries.base.qtWidgets.widgetLabel import widgetLabel as redRWidgetLabel
from libraries.base.qtWidgets.zoomSelectToolbar import zoomSelectToolbar as redRZoomSelectToolbar
| 73.3125
| 98
| 0.869991
| 271
| 2,346
| 7.531365
| 0.247232
| 0.191083
| 0.249878
| 0.382166
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.090793
| 2,346
| 32
| 99
| 73.3125
| 0.956868
| 0.005541
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 5
|
b4208201420a252399002ec330267166c2c1a675
| 3,337
|
py
|
Python
|
lambdata_standroidbeta/oop_example.py
|
standroidbeta/lamdata
|
d3e35cf1a921ae34b7b8a2cd7032f414ff5b0b49
|
[
"MIT"
] | null | null | null |
lambdata_standroidbeta/oop_example.py
|
standroidbeta/lamdata
|
d3e35cf1a921ae34b7b8a2cd7032f414ff5b0b49
|
[
"MIT"
] | 2
|
2020-03-24T17:30:19.000Z
|
2020-03-24T21:16:26.000Z
|
lambdata_standroidbeta/oop_example.py
|
standroidbeta/lamdata
|
d3e35cf1a921ae34b7b8a2cd7032f414ff5b0b49
|
[
"MIT"
] | null | null | null |
"""Object-oriented programming example.
Example use:
In: import lambdata_standroidbeta
In: from lambdata_standroidbeta import oop_example
In: from lambdata_standroidbeta.oop_example import CSVLoad
In: example = CSVLoad.read_df
In: example(CSVLoad)
Out: Paste path to CSV here: >? /home/seek/Documents/GitHub/hp_df_clean.csv
In: from lambdata_standroidbeta.oop_example import InfoShapeHead
In: df_example = InfoHeadShape
In: df_example.df_ish(CSVLoad)
Out:
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 78095 entries, 0 to 78094
Data columns (total 39 columns):
Unnamed: 0 78095 non-null int64
Class 78095 non-null int64
User 78095 non-null int64
X0 78095 non-null float64
Y0 78095 non-null float64
Z0 78095 non-null float64
X1 78095 non-null float64
Y1 78095 non-null float64
Z1 78095 non-null float64
X2 78095 non-null float64
Y2 78095 non-null float64
Z2 78095 non-null float64
X3 78095 non-null float64
Y3 78095 non-null float64
Z3 78095 non-null float64
X4 78095 non-null float64
Y4 78095 non-null float64
Z4 78095 non-null float64
X5 78095 non-null float64
Y5 78095 non-null float64
Z5 78095 non-null float64
X6 78095 non-null float64
Y6 78095 non-null float64
Z6 78095 non-null float64
X7 78095 non-null float64
Y7 78095 non-null float64
Z7 78095 non-null float64
X8 78095 non-null float64
Y8 78095 non-null float64
Z8 78095 non-null float64
X9 78095 non-null float64
Y9 78095 non-null float64
Z9 78095 non-null float64
X10 78095 non-null float64
Y10 78095 non-null float64
Z10 78095 non-null float64
X11 78095 non-null float64
Y11 78095 non-null float64
Z11 78095 non-null float64
dtypes: float64(36), int64(3)
memory usage: 23.2 MB
None
(78095, 39)
Unnamed: 0 Class User X0 Y0 ... Y10 Z10 X11 Y11 Z11
0 1 1 0 54.263880 71.466776 ... 2.9 2.9 2.9 2.9 2.9
1 2 1 0 56.527558 72.266609 ... 2.9 2.9 2.9 2.9 2.9
2 3 1 0 55.849928 72.469064 ... 2.9 2.9 2.9 2.9 2.9
3 4 1 0 55.329647 71.707275 ... 2.9 2.9 2.9 2.9 2.9
4 5 1 0 55.142401 71.435607 ... 2.9 2.9 2.9 2.9 2.9
[5 rows x 39 columns]
"""
class CSVLoad:
"""Class to Load CSV Dataset into a DataFrame"""
def __init__(self):
import pandas as pd
df = pd.DataFrame()
self.df = df
def read_df(self):
"""User Input of csv file."""
import pandas as pd
csv = input("Paste path to CSV here: ")
"""paste path without ''. """
self.df = pd.read_csv(csv)
self.df = self.df
class InfoShapeHead(CSVLoad):
"""A class for outputting a DataFrame's info, shape, and head all at once!"""
def df_ish(self):
"""Show DataFrame info."""
print(self.df.info())
"""Shows DataFrame shape."""
print(self.df.shape)
"""How DataFrame head."""
print(self.df.head())
pass
| 30.614679
| 81
| 0.585856
| 496
| 3,337
| 3.90121
| 0.288306
| 0.16124
| 0.24186
| 0.353488
| 0.089406
| 0.070801
| 0.070801
| 0.026357
| 0.026357
| 0.02584
| 0
| 0.231256
| 0.33653
| 3,337
| 108
| 82
| 30.898148
| 0.642728
| 0.8178
| 0
| 0.125
| 0
| 0
| 0.048193
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.1875
| false
| 0.0625
| 0.125
| 0
| 0.4375
| 0.1875
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 5
|
b425f07fc6a038ca3991573cde9f2d5d448e0e8d
| 113
|
py
|
Python
|
WeatherPy/api_keys.py
|
alyslma/API-Challenge
|
6df9f6e3cce14ee37bcaaee3144720d0cb77c1e7
|
[
"ADSL"
] | null | null | null |
WeatherPy/api_keys.py
|
alyslma/API-Challenge
|
6df9f6e3cce14ee37bcaaee3144720d0cb77c1e7
|
[
"ADSL"
] | null | null | null |
WeatherPy/api_keys.py
|
alyslma/API-Challenge
|
6df9f6e3cce14ee37bcaaee3144720d0cb77c1e7
|
[
"ADSL"
] | null | null | null |
# OpenWeatherMap API Key
weather_api_key = "TYPE YOUR KEY HERE!"
# Google API Key
g_key = "TYPE YOUR KEY HERE!"
| 18.833333
| 39
| 0.725664
| 19
| 113
| 4.157895
| 0.473684
| 0.227848
| 0.278481
| 0.35443
| 0.455696
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.185841
| 113
| 5
| 40
| 22.6
| 0.858696
| 0.327434
| 0
| 0
| 0
| 0
| 0.520548
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
b42a7fc4fb4230aa416829ffa1875c13b8c2a6f5
| 3,336
|
py
|
Python
|
tests/test_Ad_oo.py
|
farisachugthai/rtdpy
|
ac5cd7100d4b8d256021acf4a358bd5c2c4c58ce
|
[
"MIT"
] | 5
|
2019-12-28T19:53:57.000Z
|
2021-09-14T19:59:25.000Z
|
tests/test_Ad_oo.py
|
farisachugthai/rtdpy
|
ac5cd7100d4b8d256021acf4a358bd5c2c4c58ce
|
[
"MIT"
] | 3
|
2019-08-19T11:29:01.000Z
|
2020-11-10T21:09:41.000Z
|
tests/test_Ad_oo.py
|
farisachugthai/rtdpy
|
ac5cd7100d4b8d256021acf4a358bd5c2c4c58ce
|
[
"MIT"
] | 5
|
2019-03-19T08:35:15.000Z
|
2020-11-06T20:23:32.000Z
|
import numpy as np
import pytest
import rtdpy as rtd
rtol = 1e-3
atol = 1e-5
DT = 0.001
TIME_END = 200
def analytic_mrt(tau, peclet):
return tau * (1. + 2. / peclet)
def analytic_sigma2(tau, peclet):
return tau**2 * (2. / peclet + 8. / peclet**2)
def test_failures():
with pytest.raises(rtd.RTDInputError):
rtd.AD_oo(tau=-1, peclet=1, dt=DT, time_end=TIME_END)
with pytest.raises(rtd.RTDInputError):
rtd.AD_oo(tau=1, peclet=-1, dt=DT, time_end=TIME_END)
with pytest.raises(rtd.RTDInputError):
rtd.AD_oo(tau=1, peclet=1, dt=-1, time_end=TIME_END)
with pytest.raises(rtd.RTDInputError):
rtd.AD_oo(tau=1, peclet=1, dt=DT, time_end=-1)
@pytest.mark.parametrize("peclet", [10, 100, 1000])
@pytest.mark.parametrize("tau", [1, 10])
def test1(tau, peclet):
a = rtd.AD_oo(tau=tau, peclet=peclet, dt=DT, time_end=TIME_END)
assert(np.isclose(a.integral(), 1, rtol=rtol, atol=atol))
assert(np.isclose(a.mrt(), analytic_mrt(tau, peclet),
rtol=rtol, atol=atol))
assert(np.isclose(a.tau_oo, analytic_mrt(tau, peclet),
rtol=rtol, atol=atol))
assert(np.isclose(a.sigma(), analytic_sigma2(tau, peclet),
rtol=rtol, atol=atol))
@pytest.mark.parametrize("peclet", [0.1, 1])
@pytest.mark.parametrize("tau", [1])
def test_low(tau, peclet):
time_end = 500
a = rtd.AD_oo(tau=tau, peclet=peclet, dt=DT, time_end=time_end)
assert(np.isclose(a.integral(), 1, rtol=rtol, atol=atol))
assert(np.isclose(a.mrt(), analytic_mrt(tau, peclet),
rtol=rtol, atol=atol))
assert(np.isclose(a.tau_oo, analytic_mrt(tau, peclet),
rtol=rtol, atol=atol))
assert(np.isclose(a.sigma(), analytic_sigma2(tau, peclet),
rtol=rtol, atol=atol))
@pytest.mark.parametrize("peclet", [0.1, 1])
@pytest.mark.parametrize("tau", [10])
def test_low_high_tau(tau, peclet):
time_end = 8000
dt = .005
a = rtd.AD_oo(tau=tau, peclet=peclet, dt=dt, time_end=time_end)
assert(np.isclose(a.integral(), 1, rtol=rtol, atol=atol))
assert(np.isclose(a.mrt(), analytic_mrt(tau, peclet),
rtol=rtol, atol=atol))
assert(np.isclose(a.tau_oo, analytic_mrt(tau, peclet),
rtol=rtol, atol=atol))
assert(np.isclose(a.sigma(), analytic_sigma2(tau, peclet),
rtol=rtol, atol=atol))
@pytest.mark.parametrize("peclet", [200, 1000])
def test_AD_equivalence(peclet):
# closed-closed and open-open are approximately equal at high peclet
# starting around Pe=100
time_end = 10
dt = .001
tau = 1
nx = 300
a = rtd.AD_cc(tau=tau, peclet=peclet, dt=dt, time_end=time_end, nx=nx)
b = rtd.AD_oo(tau=tau, peclet=peclet, dt=dt, time_end=time_end)
assert(np.isclose(a.integral(), b.integral(), rtol=rtol, atol=atol))
assert(np.isclose(a.mrt(), b.mrt(), rtol=1e-2, atol=atol))
assert(np.isclose(a.sigma(), b.sigma(), rtol=5e-2, atol=atol))
def test_repr():
a = rtd.AD_oo(tau=1, peclet=100, dt=DT, time_end=TIME_END)
b = eval("rtd."+repr(a))
assert np.isclose(a.integral(), b.integral(), rtol=rtol, atol=atol)
assert np.isclose(a.mrt(), b.mrt(), rtol=rtol, atol=atol)
assert np.isclose(a.sigma(), b.sigma(), rtol=rtol, atol=atol)
| 34.75
| 74
| 0.630995
| 527
| 3,336
| 3.889943
| 0.13093
| 0.078537
| 0.131707
| 0.140488
| 0.753171
| 0.74
| 0.722927
| 0.722927
| 0.722927
| 0.720976
| 0
| 0.034936
| 0.202038
| 3,336
| 95
| 75
| 35.115789
| 0.735162
| 0.026679
| 0
| 0.369863
| 0
| 0
| 0.011406
| 0
| 0
| 0
| 0
| 0
| 0.246575
| 1
| 0.109589
| false
| 0
| 0.041096
| 0.027397
| 0.178082
| 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
|
b45c5422a00982e0a47927275ff5a26d66120391
| 2,059
|
py
|
Python
|
config.py
|
CharlesPikachu/YOLO
|
950b11c35517c1c3d7d7856b5768c4023c1f89eb
|
[
"MIT"
] | 57
|
2018-09-21T12:53:23.000Z
|
2022-01-05T16:05:52.000Z
|
config.py
|
CharlesPikachu/YOLO
|
950b11c35517c1c3d7d7856b5768c4023c1f89eb
|
[
"MIT"
] | 1
|
2019-12-23T08:34:16.000Z
|
2020-04-29T23:03:37.000Z
|
config.py
|
CharlesPikachu/YOLO
|
950b11c35517c1c3d7d7856b5768c4023c1f89eb
|
[
"MIT"
] | 12
|
2019-03-02T07:01:55.000Z
|
2020-12-30T13:27:46.000Z
|
'''
Author:
Charles
Function:
set options.
'''
# for yolo1
yolo1_options = {
'info': 'yolo1_options',
'max_object': 50,
'backupdir': './backup',
'trainSet': '',
'testSet': '',
'trainlabpth': None,
'testlabpth': None,
'clsnamesfile': './names/coco.names',
'gpus': '0, 1',
'ngpus': 2,
'use_cuda': True,
'num_workers': 4,
'is_multiscale': False,
'by_stride': False,
'header_len': 4,
'weightfile': './weights/yolov1.weights',
'cfgfile': './cfg/yolov1.cfg',
'logsavefile': 'train.log',
'save_interval': 10,
'conf_thresh': 0.25,
'nms_thresh': 0.4,
'iou_thresh': 0.5,
'jitter': 0.2,
'mode': 'test'
}
# for yolo2
yolo2_options = {
'info': 'yolo2_options',
'max_object': 50,
'backupdir': './backup',
'trainSet': '',
'testSet': '',
'trainlabpth': None,
'testlabpth': None,
'clsnamesfile': './names/coco.names',
'gpus': '0, 1',
'ngpus': 2,
'use_cuda': True,
'num_workers': 4,
'is_multiscale': True,
'by_stride': False,
'header_len': 4,
'weightfile': './weights/yolov2.weights',
'cfgfile': './cfg/yolov2.cfg',
'logsavefile': 'train.log',
'save_interval': 10,
'conf_thresh': 0.25,
'nms_thresh': 0.4,
'iou_thresh': 0.5,
'jitter': 0.3,
'mode': 'test'
}
# for yolo3
yolo3_options = {
'info': 'yolo3_options',
'max_object': 50,
'backupdir': './backup',
'trainSet': '',
'testSet': '',
'trainlabpth': None,
'testlabpth': None,
'clsnamesfile': './names/coco.names',
'gpus': '1',
'ngpus': 1,
'use_cuda': True,
'num_workers': 4,
'is_multiscale': True,
'by_stride': True,
'header_len': 5,
'weightfile': './weights/yolov3.weights',
'cfgfile': './cfg/yolov3.cfg',
'logsavefile': 'train.log',
'save_interval': 10,
'conf_thresh': 0.25,
'nms_thresh': 0.4,
'iou_thresh': 0.5,
'jitter': 0.3,
'mode': 'test'
}
| 22.139785
| 46
| 0.524526
| 223
| 2,059
| 4.681614
| 0.286996
| 0.060345
| 0.045977
| 0.051724
| 0.753831
| 0.753831
| 0.753831
| 0.753831
| 0.684866
| 0.684866
| 0
| 0.045183
| 0.269063
| 2,059
| 93
| 47
| 22.139785
| 0.648505
| 0.041768
| 0
| 0.730769
| 0
| 0
| 0.467139
| 0.0364
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
c34e5b869b8821dce8a3ccd1807c833599983e28
| 127
|
py
|
Python
|
tracker/app/utils/enumerable.py
|
skielred/FairyJokeAPI
|
71228e477bc6dd259e6f5f7e09b30c1e23ab96a3
|
[
"MIT"
] | 3
|
2021-12-18T11:09:08.000Z
|
2022-03-31T22:42:19.000Z
|
tracker/app/utils/enumerable.py
|
skielred/FairyJokeAPI
|
71228e477bc6dd259e6f5f7e09b30c1e23ab96a3
|
[
"MIT"
] | null | null | null |
tracker/app/utils/enumerable.py
|
skielred/FairyJokeAPI
|
71228e477bc6dd259e6f5f7e09b30c1e23ab96a3
|
[
"MIT"
] | null | null | null |
class Enumerable:
@classmethod
def keys(cls):
return [x for x in cls.__dict__.keys() if not x.startswith('_')]
| 25.4
| 72
| 0.637795
| 18
| 127
| 4.222222
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.23622
| 127
| 4
| 73
| 31.75
| 0.783505
| 0
| 0
| 0
| 0
| 0
| 0.007874
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0.25
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 5
|
5edd1137e5436ea869d085cf6529a5f0a6e08faf
| 180
|
py
|
Python
|
api/admin.py
|
MatheusAmelco/squad-1-ad-python-2
|
84fbdcb9cd736a7b4e203d0d9c40593f1398c6d2
|
[
"MIT"
] | 3
|
2019-06-22T14:18:25.000Z
|
2019-07-08T18:51:42.000Z
|
api/admin.py
|
MatheusAmelco/squad-1-ad-python-2
|
84fbdcb9cd736a7b4e203d0d9c40593f1398c6d2
|
[
"MIT"
] | 15
|
2019-07-18T13:52:49.000Z
|
2022-02-10T08:30:57.000Z
|
api/admin.py
|
eduardolm/squad-1-ad-python-2
|
632d17f0bb3aff06d07cededbefe62055ccf682d
|
[
"MIT"
] | 6
|
2019-06-28T04:40:22.000Z
|
2019-07-24T16:47:21.000Z
|
from django.contrib import admin
from .models import Sellers, Commission_plan, Sales
admin.site.register(Sellers)
admin.site.register(Commission_plan)
admin.site.register(Sales)
| 22.5
| 51
| 0.827778
| 25
| 180
| 5.88
| 0.48
| 0.183673
| 0.346939
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 180
| 7
| 52
| 25.714286
| 0.890909
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 5
|
5ee6bd96653adcf4d045455b9c83384d1ca127f1
| 2,873
|
py
|
Python
|
test/inventory/test_record_validation.py
|
polarG/splunk-connect-for-snmp
|
d1e85675edd5caa5bad9114d1611411e15cec063
|
[
"Apache-2.0"
] | null | null | null |
test/inventory/test_record_validation.py
|
polarG/splunk-connect-for-snmp
|
d1e85675edd5caa5bad9114d1611411e15cec063
|
[
"Apache-2.0"
] | null | null | null |
test/inventory/test_record_validation.py
|
polarG/splunk-connect-for-snmp
|
d1e85675edd5caa5bad9114d1611411e15cec063
|
[
"Apache-2.0"
] | null | null | null |
from unittest import TestCase
from splunk_connect_for_snmp.inventory.tasks import is_smart_profile_valid
class TestRecordValidation(TestCase):
def test_disabled_profile(self):
self.assertFalse(
is_smart_profile_valid(
None,
{"disabled": True, "frequency": 300, "condition": {"type": "base"}},
)
)
def test_frequency_present(self):
self.assertFalse(is_smart_profile_valid(None, {"condition": {"type": "base"}}))
def test_condition_present(self):
self.assertFalse(is_smart_profile_valid(None, {"frequency": 300}))
def test_condition_type_present(self):
self.assertFalse(
is_smart_profile_valid(None, {"frequency": 300, "condition": "asdad"})
)
def test_condition_type(self):
self.assertFalse(
is_smart_profile_valid(
None, {"frequency": 300, "condition": {"type": "else"}}
)
)
def test_field_type(self):
self.assertFalse(
is_smart_profile_valid(
None, {"frequency": 300, "condition": {"type": "field"}}
)
)
def test_patterns_present(self):
self.assertFalse(
is_smart_profile_valid(
None,
{
"frequency": 300,
"condition": {"type": "field", "field": "sysDescription"},
},
)
)
def test_patterns_is_list(self):
self.assertFalse(
is_smart_profile_valid(
None,
{
"frequency": 300,
"condition": {
"type": "field",
"field": "sysDescription",
"patterns": "ASD",
},
},
)
)
self.assertFalse(
is_smart_profile_valid(
None,
{
"frequency": 300,
"condition": {
"type": "field",
"field": "sysDescription",
"patterns": {},
},
},
)
)
def test_base_profile_is_valid(self):
self.assertTrue(
is_smart_profile_valid(
None, {"frequency": 300, "condition": {"type": "base"}}
)
)
def test_field_profile_is_valid(self):
self.assertTrue(
is_smart_profile_valid(
None,
{
"frequency": 300,
"condition": {
"type": "field",
"field": "sysDescription",
"patterns": ["ASD"],
},
},
)
)
| 28.73
| 87
| 0.444831
| 216
| 2,873
| 5.615741
| 0.171296
| 0.06925
| 0.1385
| 0.187964
| 0.766694
| 0.746908
| 0.746908
| 0.708162
| 0.673537
| 0.633141
| 0
| 0.018809
| 0.444831
| 2,873
| 99
| 88
| 29.020202
| 0.741693
| 0
| 0
| 0.402299
| 0
| 0
| 0.130874
| 0
| 0
| 0
| 0
| 0
| 0.126437
| 1
| 0.114943
| false
| 0
| 0.022989
| 0
| 0.149425
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 5
|
6f1e428af8337fd6b3376272bd64255b5a9ecc29
| 43
|
py
|
Python
|
icbd/compiler/tests/47.py
|
kmod/icbd
|
9636564eb3993afa07c6220d589bbd1991923d74
|
[
"MIT"
] | 7
|
2015-04-06T15:17:13.000Z
|
2020-10-21T04:57:00.000Z
|
icbd/compiler/tests/47.py
|
kmod/icbd
|
9636564eb3993afa07c6220d589bbd1991923d74
|
[
"MIT"
] | null | null | null |
icbd/compiler/tests/47.py
|
kmod/icbd
|
9636564eb3993afa07c6220d589bbd1991923d74
|
[
"MIT"
] | 4
|
2016-05-16T17:53:08.000Z
|
2020-11-28T17:18:50.000Z
|
"""
argv
"""
import sys
1
print sys.argv
| 4.777778
| 14
| 0.604651
| 7
| 43
| 3.714286
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0.232558
| 43
| 8
| 15
| 5.375
| 0.757576
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.333333
| null | null | 0.333333
| 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
|
6f25a5768909084904925ddd07090ba7806a8c4a
| 193
|
py
|
Python
|
students/K33421/MikhaylovVladimir/lr2/hotel/admin.py
|
MikhaylovVladimir/ITMO_ICT_WebDevelopment_2021-2022
|
bd83bdbcb7e4db6f31f9fedc339deebe1681c60c
|
[
"MIT"
] | null | null | null |
students/K33421/MikhaylovVladimir/lr2/hotel/admin.py
|
MikhaylovVladimir/ITMO_ICT_WebDevelopment_2021-2022
|
bd83bdbcb7e4db6f31f9fedc339deebe1681c60c
|
[
"MIT"
] | null | null | null |
students/K33421/MikhaylovVladimir/lr2/hotel/admin.py
|
MikhaylovVladimir/ITMO_ICT_WebDevelopment_2021-2022
|
bd83bdbcb7e4db6f31f9fedc339deebe1681c60c
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import *
admin.site.register(Client)
admin.site.register(Hotel)
admin.site.register(Room)
admin.site.register(Booking)
admin.site.register(Review)
| 24.125
| 32
| 0.813472
| 28
| 193
| 5.607143
| 0.464286
| 0.286624
| 0.541401
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.067358
| 193
| 8
| 33
| 24.125
| 0.872222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.285714
| 0
| 0.285714
| 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
|
6f2e56ef732a32d08d4e7366b7faf33058b8293b
| 227
|
py
|
Python
|
revpy/meta_optimizers.py
|
sash-ko/PyRM
|
e06ac8c44ec30cb7e731a4653dabc7f0ca0b6ec7
|
[
"MIT"
] | 31
|
2017-02-08T15:23:20.000Z
|
2022-01-21T02:31:07.000Z
|
revpy/meta_optimizers.py
|
sash-ko/PyRM
|
e06ac8c44ec30cb7e731a4653dabc7f0ca0b6ec7
|
[
"MIT"
] | 7
|
2017-02-08T15:38:32.000Z
|
2019-08-26T20:24:34.000Z
|
revpy/meta_optimizers.py
|
sash-ko/PyRM
|
e06ac8c44ec30cb7e731a4653dabc7f0ca0b6ec7
|
[
"MIT"
] | 19
|
2017-02-08T15:23:47.000Z
|
2022-03-03T10:06:25.000Z
|
from revpy.optimizers import calc_EMSRb
from revpy.fare_transformation import fare_trafo_decorator
@fare_trafo_decorator
def calc_EMSRb_MR(fares, demands, sigmas=None, cap=None):
return calc_EMSRb(fares, demands, sigmas)
| 28.375
| 58
| 0.828194
| 33
| 227
| 5.424242
| 0.545455
| 0.150838
| 0.201117
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105727
| 227
| 7
| 59
| 32.428571
| 0.881773
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.4
| 0.2
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.