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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4dde479b69956e0525ee9bb94a1949e2b315b9f0
| 3,932
|
py
|
Python
|
u24_lymphocyte/third_party/treeano/core/tests/children_container_test.py
|
ALSM-PhD/quip_classification
|
7347bfaa5cf11ae2d7a528fbcc43322a12c795d3
|
[
"BSD-3-Clause"
] | 45
|
2015-04-26T04:45:51.000Z
|
2022-01-24T15:03:55.000Z
|
u24_lymphocyte/third_party/treeano/core/tests/children_container_test.py
|
ALSM-PhD/quip_classification
|
7347bfaa5cf11ae2d7a528fbcc43322a12c795d3
|
[
"BSD-3-Clause"
] | 8
|
2018-07-20T20:54:51.000Z
|
2020-06-12T05:36:04.000Z
|
u24_lymphocyte/third_party/treeano/core/tests/children_container_test.py
|
ALSM-PhD/quip_classification
|
7347bfaa5cf11ae2d7a528fbcc43322a12c795d3
|
[
"BSD-3-Clause"
] | 22
|
2018-05-21T23:57:20.000Z
|
2022-02-21T00:48:32.000Z
|
import nose.tools as nt
from treeano import core
import treeano
import treeano.nodes as tn
def test_list_children_container():
# test to_data
cc = core.ListChildrenContainer([])
nt.assert_equal([], cc.to_data())
# test children_container_to_data
as_data = core.children_container_to_data(cc)
nt.assert_equal(dict(
children_container_key="list",
children_container_data=[],
),
as_data)
# test back and forth
cc2 = core.children_container_from_data(as_data)
nt.assert_is_instance(cc2, core.ListChildrenContainer)
nt.assert_equal(as_data,
core.children_container_to_data(cc2))
def test_dict_children_container():
# test to_data
cc = core.DictChildrenContainer({})
nt.assert_equal({}, cc.to_data())
# test children_container_to_data
as_data = core.children_container_to_data(cc)
nt.assert_equal(dict(
children_container_key="dict",
children_container_data={},
),
as_data)
# test back and forth
cc2 = core.children_container_from_data(as_data)
nt.assert_is_instance(cc2, core.DictChildrenContainer)
nt.assert_equal(as_data,
core.children_container_to_data(cc2))
def test_dict_children_container_schema():
dccs = core.DictChildrenContainerSchema(
foo=core.ListChildrenContainer,
bar=core.ChildContainer,
)
node = tn.AddConstantNode("hello")
cc1 = dccs({"foo": [node, node], "bar": node})
cc2 = core.children_container._DictChildrenContainerFromSchema(
{"foo": core.ListChildrenContainer([node, node]),
"bar": core.ChildContainer(node)})
# test that it makes the expected class
nt.assert_equal(cc1, cc2)
def test_dict_children_container_schema_children():
dccs = core.DictChildrenContainerSchema(
foo=core.ListChildrenContainer,
bar=core.ChildContainer,
)
node = tn.AddConstantNode("hello")
in_map = {"foo": [node, node], "bar": node}
cc = dccs(in_map)
# test that .children returns the same as the input
nt.assert_equal(cc.children, in_map)
def test_dict_children_container_schema_serialization():
dccs = core.DictChildrenContainerSchema(
foo=core.ListChildrenContainer,
bar=core.ChildContainer,
)
node = tn.AddConstantNode("hello")
in_map = {"foo": [node, node], "bar": node}
cc1 = dccs(in_map)
cc2 = core.children_container_from_data(
core.children_container_to_data(cc1))
nt.assert_equal(cc1.__class__, cc2.__class__)
nt.assert_equal(cc1.__dict__, cc2.__dict__)
def test_dict_children_container_schema_optional_children():
dccs = core.DictChildrenContainerSchema(
foo=core.ListChildrenContainer,
bar=core.ChildContainer,
)
node = tn.AddConstantNode("hello")
in_map = {"foo": [node, node]}
cc = dccs(in_map)
# test that .children returns the same as the input
nt.assert_equal(cc.children, in_map)
def test_dict_children_container_schema_no_children():
dccs = core.DictChildrenContainerSchema(
foo=core.ListChildrenContainer,
bar=core.ChildContainer,
)
cc = dccs(None)
# test that .children returns the same as the input
nt.assert_equal(cc.children, {})
def test_nodes_and_edges_children_container():
# test to_data
cc = core.NodesAndEdgesContainer([[], []])
nt.assert_equal({"nodes": [], "edges": []}, cc.to_data())
# test children_container_to_data
as_data = core.children_container_to_data(cc)
nt.assert_equal(dict(
children_container_key="nodes_and_edges",
children_container_data={"nodes": [], "edges": []}),
as_data)
# test back and forth
cc2 = core.children_container_from_data(as_data)
nt.assert_is_instance(cc2, core.NodesAndEdgesContainer)
nt.assert_equal(as_data,
core.children_container_to_data(cc2))
| 30.96063
| 67
| 0.692523
| 479
| 3,932
| 5.354906
| 0.121086
| 0.192203
| 0.076023
| 0.089669
| 0.860819
| 0.765692
| 0.729435
| 0.680702
| 0.680702
| 0.680702
| 0
| 0.006376
| 0.202187
| 3,932
| 126
| 68
| 31.206349
| 0.811285
| 0.097152
| 0
| 0.5
| 0
| 0
| 0.025452
| 0
| 0
| 0
| 0
| 0
| 0.2
| 1
| 0.088889
| false
| 0
| 0.044444
| 0
| 0.133333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4de8266b412aaa57069895f4f3b41f8e3e97cc79
| 126
|
py
|
Python
|
python/8kyu/get_nth_even_number.py
|
Sigmanificient/codewars
|
b34df4bf55460d312b7ddf121b46a707b549387a
|
[
"MIT"
] | 3
|
2021-06-08T01:57:13.000Z
|
2021-06-26T10:52:47.000Z
|
python/8kyu/get_nth_even_number.py
|
Sigmanificient/codewars
|
b34df4bf55460d312b7ddf121b46a707b549387a
|
[
"MIT"
] | null | null | null |
python/8kyu/get_nth_even_number.py
|
Sigmanificient/codewars
|
b34df4bf55460d312b7ddf121b46a707b549387a
|
[
"MIT"
] | 2
|
2021-06-10T21:20:13.000Z
|
2021-06-30T10:13:26.000Z
|
"""Kata url: https://www.codewars.com/kata/5933a1f8552bc2750a0000ed."""
def nth_even(n: int) -> int:
return (n - 1) * 2
| 21
| 71
| 0.642857
| 18
| 126
| 4.444444
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.179245
| 0.15873
| 126
| 5
| 72
| 25.2
| 0.575472
| 0.515873
| 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
| 0
| 0
|
0
| 4
|
4dee7e1c9e3b5ef66ef45e4fa76fce78036beb07
| 117
|
py
|
Python
|
Chapter06/ch06_r09/some_model_ch06r09/__manifest__.py
|
PacktPublishing/Odoo-11-Development-Coobook-Second-Edition
|
bb462f8511a32f6b758b71c9261a5213563a0024
|
[
"MIT"
] | 50
|
2018-01-28T05:58:03.000Z
|
2022-03-03T03:58:08.000Z
|
Chapter06/ch06_r09/some_model_ch06r09/__manifest__.py
|
PacktPublishing/Odoo-11-Development-Coobook-Second-Edition
|
bb462f8511a32f6b758b71c9261a5213563a0024
|
[
"MIT"
] | null | null | null |
Chapter06/ch06_r09/some_model_ch06r09/__manifest__.py
|
PacktPublishing/Odoo-11-Development-Coobook-Second-Edition
|
bb462f8511a32f6b758b71c9261a5213563a0024
|
[
"MIT"
] | 39
|
2018-01-22T08:59:37.000Z
|
2020-08-31T13:36:15.000Z
|
{
'name': 'Chapter 06, Recipe 9 code',
'summary': 'Traverse recordset relations',
'depends': ['base'],
}
| 19.5
| 46
| 0.581197
| 12
| 117
| 5.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032967
| 0.222222
| 117
| 5
| 47
| 23.4
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0.641026
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 0
|
0
| 4
|
12765c9c909468c424e8566089c2e69b60681baf
| 76
|
py
|
Python
|
course-1/session-5/pep_8_sandbox.py
|
robmarano/nyu-python
|
4406f157e6d6a63e512ed1595f56dcb65c5d8526
|
[
"MIT"
] | 2
|
2018-06-01T12:51:10.000Z
|
2020-06-02T15:55:00.000Z
|
course-1/session-5/pep_8_sandbox.py
|
robmarano/nyu-python
|
4406f157e6d6a63e512ed1595f56dcb65c5d8526
|
[
"MIT"
] | null | null | null |
course-1/session-5/pep_8_sandbox.py
|
robmarano/nyu-python
|
4406f157e6d6a63e512ed1595f56dcb65c5d8526
|
[
"MIT"
] | 1
|
2018-06-21T23:18:51.000Z
|
2018-06-21T23:18:51.000Z
|
#!/usr/bin/env python3
def count_me(void):
print('hello')
count_me()
| 9.5
| 22
| 0.644737
| 12
| 76
| 3.916667
| 0.833333
| 0.297872
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015873
| 0.171053
| 76
| 7
| 23
| 10.857143
| 0.730159
| 0.276316
| 0
| 0
| 0
| 0
| 0.09434
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
129e6c6a34f8b2c1df04be98503cce9573349156
| 82
|
py
|
Python
|
yukicoder/yuki341.py
|
knuu/competitive-programming
|
16bc68fdaedd6f96ae24310d697585ca8836ab6e
|
[
"MIT"
] | 1
|
2018-11-12T15:18:55.000Z
|
2018-11-12T15:18:55.000Z
|
yukicoder/yuki341.py
|
knuu/competitive-programming
|
16bc68fdaedd6f96ae24310d697585ca8836ab6e
|
[
"MIT"
] | null | null | null |
yukicoder/yuki341.py
|
knuu/competitive-programming
|
16bc68fdaedd6f96ae24310d697585ca8836ab6e
|
[
"MIT"
] | null | null | null |
print(max(map(len, ''.join(x if x == '…' else '_' for x in input()).split('_'))))
| 41
| 81
| 0.536585
| 15
| 82
| 3
| 0.866667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.146341
| 82
| 1
| 82
| 82
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0.036585
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 0
| 0
| 0
| 1
|
0
| 4
|
12ba9af0f90d640045af2072856c43d047324272
| 223
|
py
|
Python
|
zenframe/common.py
|
jackhall/datapy
|
1cd1fc3d60802c7dc7039ccab9c65f1bfb207d83
|
[
"BSD-3-Clause"
] | null | null | null |
zenframe/common.py
|
jackhall/datapy
|
1cd1fc3d60802c7dc7039ccab9c65f1bfb207d83
|
[
"BSD-3-Clause"
] | null | null | null |
zenframe/common.py
|
jackhall/datapy
|
1cd1fc3d60802c7dc7039ccab9c65f1bfb207d83
|
[
"BSD-3-Clause"
] | null | null | null |
def delegate(method_name, attribute):
def to_attribute(self, *args, **kwargs):
bound_method = getattr(getattr(self, attribute), method_name)
return bound_method(*args, **kwargs)
return to_attribute
| 31.857143
| 69
| 0.699552
| 27
| 223
| 5.555556
| 0.444444
| 0.133333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.188341
| 223
| 6
| 70
| 37.166667
| 0.828729
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
12c6188cf9cdeac4b2f9085821d79dcd6dc1ac30
| 295
|
py
|
Python
|
indra/sources/cwms/__init__.py
|
qiuhaoling/indra
|
fa1fb31c4333ea63d023181eaf6f759e3dd3b400
|
[
"BSD-2-Clause"
] | null | null | null |
indra/sources/cwms/__init__.py
|
qiuhaoling/indra
|
fa1fb31c4333ea63d023181eaf6f759e3dd3b400
|
[
"BSD-2-Clause"
] | null | null | null |
indra/sources/cwms/__init__.py
|
qiuhaoling/indra
|
fa1fb31c4333ea63d023181eaf6f759e3dd3b400
|
[
"BSD-2-Clause"
] | null | null | null |
"""
CWMS is a variant of the TRIPS system. It is a general purpose
natural language understanding system with applications in
world modeling. For more information, see:
http://trips.ihmc.us/parser/cgi/cwmsreader
"""
from .api import process_rdf_file, process_text, process_ekb, process_ekb_file
| 36.875
| 78
| 0.80339
| 46
| 295
| 5.021739
| 0.804348
| 0.025974
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.122034
| 295
| 7
| 79
| 42.142857
| 0.891892
| 0.701695
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
12c8855221c3baa050d3ebcd3b688bc11f57aa27
| 75
|
py
|
Python
|
schema/configs/prod.py
|
mxttwoods/sample-sqlalchemy-alembic
|
d4e949a6ffb9c0d6d2fdde36a3d239fe2d6e4d46
|
[
"MIT"
] | 3
|
2020-05-27T19:46:28.000Z
|
2021-01-22T17:35:37.000Z
|
schema/configs/prod.py
|
mxttwoods/sample-sqlalchemy-alembic
|
d4e949a6ffb9c0d6d2fdde36a3d239fe2d6e4d46
|
[
"MIT"
] | 1
|
2019-05-11T14:11:41.000Z
|
2019-05-11T17:30:01.000Z
|
schema/configs/prod.py
|
mxttwoods/sample-sqlalchemy-alembic
|
d4e949a6ffb9c0d6d2fdde36a3d239fe2d6e4d46
|
[
"MIT"
] | 3
|
2020-04-13T20:03:46.000Z
|
2021-12-11T14:54:03.000Z
|
# -*- coding: utf-8 -*-
DB_URI = "postgresql://alembic@localhost/alembic"
| 18.75
| 49
| 0.653333
| 9
| 75
| 5.333333
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015152
| 0.12
| 75
| 3
| 50
| 25
| 0.712121
| 0.28
| 0
| 0
| 0
| 0
| 0.730769
| 0.730769
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
12d7a9e027462178b5a42b1a9c2bc17fa108bb7c
| 16,752
|
py
|
Python
|
uge/objects/complex_configuration_v3_0.py
|
guiguem/config-api
|
40bff0ed498c571910f76ef08fb5a8b35a686e78
|
[
"Apache-2.0"
] | null | null | null |
uge/objects/complex_configuration_v3_0.py
|
guiguem/config-api
|
40bff0ed498c571910f76ef08fb5a8b35a686e78
|
[
"Apache-2.0"
] | null | null | null |
uge/objects/complex_configuration_v3_0.py
|
guiguem/config-api
|
40bff0ed498c571910f76ef08fb5a8b35a686e78
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python
#
#___INFO__MARK_BEGIN__
##########################################################################
# Copyright 2016,2017 Univa Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###########################################################################
#___INFO__MARK_END__
#
from uge.objects.complex_configuration_base import ComplexConfigurationBase
class ComplexConfiguration(ComplexConfigurationBase):
""" This class encapsulates UGE complex configuration object. """
#: Object version.
VERSION = '3.0'
#: Object name key.
NAME_KEY = None
#: Object keys that must be provided by user.
USER_PROVIDED_KEYS = []
#: Default values for required data keys.
REQUIRED_DATA_DEFAULTS = {
'arch' : {'shortcut' : 'a', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'calendar' : {'shortcut' : 'c', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'cpu' : {'shortcut' : 'cpu', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'd_rt' : {'shortcut' : 'd_rt', 'type' : 'TIME', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0:0:0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'display_win_gui' : {'shortcut' : 'dwg', 'type' : 'BOOL', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'docker' : { 'shortcut' : 'dock', 'type' : 'BOOL', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'docker_images' : { 'shortcut' : 'dockimg', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_core' : {'shortcut' : 'h_core', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_cpu' : {'shortcut' : 'h_cpu', 'type' : 'TIME', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0:0:0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_data' : {'shortcut' : 'h_data', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_fsize' : {'shortcut' : 'h_fsize', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_rss' : {'shortcut' : 'h_rss', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_rt' : {'shortcut' : 'h_rt', 'type' : 'TIME', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0:0:0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_stack' : {'shortcut' : 'h_stack', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'h_vmem' : {'shortcut' : 'h_vmem', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'hostname' : {'shortcut' : 'h', 'type' : 'HOST', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'load_avg' : {'shortcut' : 'la', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'load_long' : {'shortcut' : 'll', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'load_medium' : {'shortcut' : 'lm', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'load_short' : {'shortcut' : 'ls', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_cache_l1' : {'shortcut' : 'mcache1', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_cache_l2' : {'shortcut' : 'mcache2', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_cache_l3' : {'shortcut' : 'mcache3', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_core' : {'shortcut' : 'core', 'type' : 'INT', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_mem_free' : {'shortcut' : 'mfree', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_free_n0' : {'shortcut' : 'mfree0', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_free_n1' : {'shortcut' : 'mfree1', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_free_n2' : {'shortcut' : 'mfree2', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_free_n3' : {'shortcut' : 'mfree3', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_total' : {'shortcut' : 'mtotal', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_total_n0' : {'shortcut' : 'mmem0', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_total_n1' : {'shortcut' : 'mmem1', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_total_n2' : {'shortcut' : 'mmem2', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_total_n3' : {'shortcut' : 'mmem3', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : '0', 'urgency' : 0, 'aapre' : True, 'affinity' : 0.0 },
'm_mem_used' : {'shortcut' : 'mused', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_mem_used_n0' : {'shortcut' : 'mused0', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_mem_used_n1' : {'shortcut' : 'mused1', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_mem_used_n2' : {'shortcut' : 'mused2', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_mem_used_n3' : {'shortcut' : 'mused3', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_numa_nodes' : {'shortcut' : 'nodes', 'type' : 'INT', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_socket' : {'shortcut' : 'socket', 'type' : 'INT', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_thread' : {'shortcut' : 'thread', 'type' : 'INT', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_topology' : {'shortcut' : 'topo', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_topology_inuse' : {'shortcut' : 'utopo', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'm_topology_numa' : {'shortcut' : 'unuma', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'mem_free' : {'shortcut' : 'mf', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'mem_total' : {'shortcut' : 'mt', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'mem_used' : {'shortcut' : 'mu', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'min_cpu_interval' : {'shortcut' : 'mci', 'type' : 'TIME', 'relop' : '<=', 'requestable' : False, 'consumable' : False, 'default' : '0:0:0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'np_load_avg' : {'shortcut' : 'nla', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'np_load_long' : {'shortcut' : 'nll', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'np_load_medium' : {'shortcut' : 'nlm', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'np_load_short' : {'shortcut' : 'nls', 'type' : 'DOUBLE', 'relop' : '>=', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'num_proc' : {'shortcut' : 'p', 'type' : 'INT', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'qname' : {'shortcut' : 'q', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : True, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'rerun' : {'shortcut' : 're', 'type' : 'BOOL', 'relop' : '==', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_core' : {'shortcut' : 's_core', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_cpu' : {'shortcut' : 's_cpu', 'type' : 'TIME', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0:0:0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_data' : {'shortcut' : 's_data', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_fsize' : {'shortcut' : 's_fsize', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_rss' : {'shortcut' : 's_rss', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_rt' : {'shortcut' : 's_rt', 'type' : 'TIME', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0:0:0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_stack' : {'shortcut' : 's_stack', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
's_vmem' : {'shortcut' : 's_vmem', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'seq_no' : {'shortcut' : 'seq', 'type' : 'INT', 'relop' : '==', 'requestable' : False, 'consumable' : False, 'default' : 0, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'slots' : {'shortcut' : 's', 'type' : 'INT', 'relop' : '<=', 'requestable' : True, 'consumable' : True, 'default' : 1, 'urgency' : 1000, 'aapre' : True},
'swap_free' : {'shortcut' : 'sf', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'swap_rate' : {'shortcut' : 'sr', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'swap_rsvd' : {'shortcut' : 'srsv', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'swap_total' : {'shortcut' : 'st', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'swap_used' : {'shortcut' : 'su', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'tmpdir' : {'shortcut' : 'tmp', 'type' : 'RESTRING', 'relop' : '==', 'requestable' : False, 'consumable' : False, 'default' : None, 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'virtual_free' : {'shortcut' : 'vf', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'virtual_total' : {'shortcut' : 'vt', 'type' : 'MEMORY', 'relop' : '<=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
'virtual_used' : {'shortcut' : 'vu', 'type' : 'MEMORY', 'relop' : '>=', 'requestable' : True, 'consumable' : False, 'default' : '0', 'urgency' : 0, 'aapre' : False, 'affinity' : 0.0 },
}
def __init__(self, data=None, metadata=None, json_string=None):
"""
Class constructor.
:param data: Configuration data. If provided, it will override corresponding data from JSON string representation.
:type data: dict
:param metadata: Configuration metadata. If provided, it will override corresponding metadata from JSON string representation.
:type metadata: dict
:param json_string: Configuration JSON string representation.
:type json_string: str
:raises: **InvalidArgument** - in case metadata is not a dictionary, JSON string is not valid, or it does not contain dictionary representing a ClusterConfiguration object.
"""
ComplexConfigurationBase.__init__(self, data=data, metadata=metadata, json_string=json_string)
| 126.909091
| 207
| 0.54292
| 1,800
| 16,752
| 4.965
| 0.137778
| 0.019246
| 0.107642
| 0.101824
| 0.725747
| 0.718586
| 0.70169
| 0.69934
| 0.697661
| 0.696766
| 0
| 0.026302
| 0.210184
| 16,752
| 131
| 208
| 127.877863
| 0.649157
| 0.082139
| 0
| 0
| 0
| 0
| 0.431671
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.011905
| false
| 0
| 0.011905
| 0
| 0.083333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
12fc0f10d86d32bc1eb3838bb152d2648cb705da
| 202
|
py
|
Python
|
twig/__init__.py
|
numpde/twig
|
abe08512fe4532df511487f0b8afc7df1787f6ce
|
[
"Unlicense"
] | null | null | null |
twig/__init__.py
|
numpde/twig
|
abe08512fe4532df511487f0b8afc7df1787f6ce
|
[
"Unlicense"
] | null | null | null |
twig/__init__.py
|
numpde/twig
|
abe08512fe4532df511487f0b8afc7df1787f6ce
|
[
"Unlicense"
] | null | null | null |
from .logger import log, LOG_FILE
# import inspect
# import pathlib
#
# f = inspect.currentframe().f_back
# while not pathlib.Path(f.f_code.co_filename).is_file():
# f = f.f_back
# log.info(f)
| 20.2
| 57
| 0.688119
| 33
| 202
| 4.030303
| 0.545455
| 0.045113
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.173267
| 202
| 9
| 58
| 22.444444
| 0.796407
| 0.752475
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 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
| 4
|
421a241d1d412f84ead03e80b8b5a537a4aa204d
| 232
|
py
|
Python
|
examples/scala-parallel-recommendation/filter-by-category/data/send_query.py
|
saikiran40cs/PredictionIO
|
ba987b60ba0daeeacdb12214ecf4652fe13fb96c
|
[
"Apache-2.0"
] | 21
|
2016-03-29T19:05:10.000Z
|
2020-07-29T04:28:30.000Z
|
examples/scala-parallel-recommendation/filter-by-category/data/send_query.py
|
saikiran40cs/PredictionIO
|
ba987b60ba0daeeacdb12214ecf4652fe13fb96c
|
[
"Apache-2.0"
] | 19
|
2016-03-17T16:10:14.000Z
|
2018-07-29T15:16:06.000Z
|
examples/scala-parallel-recommendation/filter-by-category/data/send_query.py
|
saikiran40cs/PredictionIO
|
ba987b60ba0daeeacdb12214ecf4652fe13fb96c
|
[
"Apache-2.0"
] | 24
|
2016-06-06T19:40:56.000Z
|
2020-04-11T01:23:14.000Z
|
"""
Send sample query to prediction engine
"""
import predictionio
engine_client = predictionio.EngineClient(url="http://localhost:8000")
print engine_client.send_query({"user": "1", "num": 4, "categories": ["action", "western"]})
| 29
| 92
| 0.724138
| 28
| 232
| 5.892857
| 0.785714
| 0.145455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028571
| 0.094828
| 232
| 7
| 93
| 33.142857
| 0.757143
| 0
| 0
| 0
| 0
| 0
| 0.27957
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.333333
| null | null | 0.333333
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
423e9e8547336624b4c14aee780c2afc997dd277
| 396
|
py
|
Python
|
application/ML_App/ML_GUI_Data_Controller.py
|
ahmadhmirza/MasterThesis_ESM
|
a79077787a98f65d4bf501f6eab718e1c2556a5d
|
[
"MIT"
] | null | null | null |
application/ML_App/ML_GUI_Data_Controller.py
|
ahmadhmirza/MasterThesis_ESM
|
a79077787a98f65d4bf501f6eab718e1c2556a5d
|
[
"MIT"
] | null | null | null |
application/ML_App/ML_GUI_Data_Controller.py
|
ahmadhmirza/MasterThesis_ESM
|
a79077787a98f65d4bf501f6eab718e1c2556a5d
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Mon, May 28 12:12:12 2020
@author: Ahmad H. Mirza
scriptVersion = 1.0..0
"""
#TODO: Add API Key generation to this script as well.
from flask import current_app as app
import json
from datetime import datetime
import secrets
import os
"""
Initialization of all the necessary paths required for the script to run.
"""
from . import ML_GUI_constants as MLC
| 22
| 73
| 0.734848
| 66
| 396
| 4.363636
| 0.742424
| 0.027778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.04893
| 0.174242
| 396
| 17
| 74
| 23.294118
| 0.831804
| 0.39899
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.058824
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
424fc552da7d64702cd49563dbdb70a0bdbdaf2a
| 35,602
|
py
|
Python
|
evoMPS/mps_uniform_excite.py
|
sanket789/1D-Spin-Lattices
|
8a80d3a19fd6fc7d347d8c634661ff5a53f65786
|
[
"BSD-3-Clause"
] | null | null | null |
evoMPS/mps_uniform_excite.py
|
sanket789/1D-Spin-Lattices
|
8a80d3a19fd6fc7d347d8c634661ff5a53f65786
|
[
"BSD-3-Clause"
] | null | null | null |
evoMPS/mps_uniform_excite.py
|
sanket789/1D-Spin-Lattices
|
8a80d3a19fd6fc7d347d8c634661ff5a53f65786
|
[
"BSD-3-Clause"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 11 14:35:13 2013
@author: ash
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import scipy as sp
import scipy.linalg as la
import scipy.sparse.linalg as las
from . import tdvp_common as tm
from . import matmul as m
from .mps_uniform_pinv import pinv_1mE
import logging
log = logging.getLogger(__name__)
class Excite_H_Op:
def __init__(self, tdvp, tdvp2, p, pinv_tol=1E-12,
sanity_checks=False, sanity_tol=1E-12):
"""Creates an Excite_H_Op object, which is a LinearOperator.
This wraps the effective Hamiltonian in terms of MPS tangent vectors
as a LinearOperator that can be used with SciPy's sparse linear
algebra routines.
Parameters
----------
tdvp : EvoMPS_TDVP_Uniform
tdvp object providing the required operations in the matrix representation.
tdvp2 : EvoMPS_TDVP_Uniform
Second tdvp object (can be the same as tdvp), for example containing a different ground state.
p : float
Momentum in units of inverse lattice spacing.
"""
assert tdvp.L == 1, 'Excite_H_Op only supports blocks of size 1'
assert tdvp.L == tdvp2.L, 'Block sizes must match!'
assert tdvp.q == tdvp2.q, 'Hilbert spaces must match!'
assert tdvp.D == tdvp2.D, 'Bond-dimensions must match!'
self.tdvp = tdvp
self.tdvp2 = tdvp2
self.p = p
self.D = tdvp.D
self.q = tdvp.q
self.ham_sites = tdvp.ham_sites
self.ham = tdvp.ham
self.sanity_checks = sanity_checks
self.sanity_tol = sanity_tol
self.pinv_solver = None
self.pinv_tol = pinv_tol
self.pinv_CUDA = False
self.pinv_CUDA_batch = False
d = (self.q - 1) * self.D**2
self.shape = (d, d)
self.dtype = np.dtype(tdvp.typ)
self.prereq = (self.calc_BHB_prereq(tdvp, tdvp2))
self.calls = 0
self.M_prev = None
self.y_pi_prev = None
def calc_BHB_prereq(self, tdvp, tdvp2):
"""Calculates prerequisites for the application of the effective Hamiltonian in terms of tangent vectors.
This is called (indirectly) by the self.excite.. functions.
Parameters
----------
tdvp2: EvoMPS_TDVP_Uniform
Second state (may be the same, or another ground state).
Returns
-------
A lot of stuff.
"""
l = tdvp.l[0]
r_ = tdvp2.r[0]
r__sqrt = tdvp2.r_sqrt[0]
r__sqrt_i = tdvp2.r_sqrt_i[0]
A = tdvp.A[0]
A_ = tdvp2.A[0]
AA = tdvp.AA[0]
AA_ = tdvp2.AA[0]
AAA_ = tdvp2.AAA[0]
eyed = np.eye(self.q**self.ham_sites)
eyed = eyed.reshape(tuple([self.q] * self.ham_sites * 2))
ham_ = self.ham - tdvp.h_expect.real * eyed
V_ = sp.transpose(tdvp2.Vsh[0], axes=(0, 2, 1)).conj().copy(order='C')
Vri_ = sp.zeros_like(V_)
try:
for s in range(self.q):
Vri_[s] = r__sqrt_i.dot_left(V_[s])
except AttributeError:
for s in range(self.q):
Vri_[s] = V_[s].dot(r__sqrt_i)
Vr_ = sp.zeros_like(V_)
try:
for s in range(self.q):
Vr_[s] = r__sqrt.dot_left(V_[s])
except AttributeError:
for s in range(self.q):
Vr_[s] = V_[s].dot(r__sqrt)
Vri_A_ = tm.calc_AA(Vri_, A_)
if self.ham_sites == 2:
_C_AhlA = np.empty((self.q, self.q, A.shape[2], A.shape[2]), dtype=tdvp.typ)
for u in range(self.q):
for s in range(self.q):
_C_AhlA[u, s] = A[u].conj().T.dot(l.dot(A[s]))
C_AhlA = sp.tensordot(ham_, _C_AhlA, ((0, 2), (0, 1)))
C_AhlA = sp.transpose(C_AhlA, axes=(1, 0, 2, 3)).copy(order='C')
_C_A_Vrh_ = tm.calc_AA(A_, sp.transpose(Vr_, axes=(0, 2, 1)).conj())
C_A_Vrh_ = sp.tensordot(ham_, _C_A_Vrh_, ((3, 1), (0, 1)))
C_A_Vrh_ = sp.transpose(C_A_Vrh_, axes=(1, 0, 2, 3)).copy(order='C')
C_Vri_A_conj = tm.calc_C_conj_mat_op_AA(ham_, Vri_A_).copy(order='C')
C_ = tm.calc_C_mat_op_AA(ham_, AA_).copy(order='C')
C_conj = tm.calc_C_conj_mat_op_AA(ham_, AA_).copy(order='C')
rhs10 = tm.eps_r_op_2s_AA12_C34(r_, AA_, C_Vri_A_conj)
return C_, C_conj, V_, Vr_, Vri_, C_Vri_A_conj, C_AhlA, C_A_Vrh_, rhs10
elif self.ham_sites == 3:
C_Vri_AA_ = np.empty((self.q, self.q, self.q, Vri_.shape[1], A_.shape[2]), dtype=tdvp.typ)
for s in range(self.q):
for t in range(self.q):
for u in range(self.q):
C_Vri_AA_[s, t, u] = Vri_[s].dot(AA_[t, u])
C_Vri_AA_ = sp.tensordot(ham_, C_Vri_AA_, ((3, 4, 5), (0, 1, 2))).copy(order='C')
C_AAA_r_Ah_Vrih = np.empty((self.q, self.q, self.q, self.q, self.q, #FIXME: could be too memory-intensive
A_.shape[1], Vri_.shape[1]),
dtype=tdvp.typ)
for s in range(self.q):
for t in range(self.q):
for u in range(self.q):
for k in range(self.q):
for j in range(self.q):
C_AAA_r_Ah_Vrih[s, t, u, k, j] = AAA_[s, t, u].dot(r_.dot(A_[k].conj().T)).dot(Vri_[j].conj().T)
C_AAA_r_Ah_Vrih = sp.tensordot(ham_, C_AAA_r_Ah_Vrih, ((3, 4, 5, 2, 1), (0, 1, 2, 3, 4))).copy(order='C')
C_AhAhlAA = np.empty((self.q, self.q, self.q, self.q,
A_.shape[2], A.shape[2]), dtype=tdvp.typ)
for t in range(self.q):
for j in range(self.q):
for i in range(self.q):
for s in range(self.q):
C_AhAhlAA[j, t, i, s] = AA[i, j].conj().T.dot(l.dot(AA[s, t]))
C_AhAhlAA = sp.tensordot(ham_, C_AhAhlAA, ((4, 1, 0, 3), (1, 0, 2, 3))).copy(order='C')
C_AA_r_Ah_Vrih_ = np.empty((self.q, self.q, self.q, self.q,
A_.shape[1], Vri_.shape[1]), dtype=tdvp.typ)
for t in range(self.q):
for u in range(self.q):
for k in range(self.q):
for j in range(self.q):
C_AA_r_Ah_Vrih_[u, t, k, j] = AA_[t, u].dot(r_.dot(A_[k].conj().T)).dot(Vri_[j].conj().T)
C_AA_r_Ah_Vrih_ = sp.tensordot(ham_, C_AA_r_Ah_Vrih_, ((4, 5, 2, 1), (1, 0, 2, 3))).copy(order='C')
C_AAA_Vrh_ = np.empty((self.q, self.q, self.q, self.q,
A_.shape[1], Vri_.shape[1]), dtype=tdvp.typ)
for s in range(self.q):
for t in range(self.q):
for u in range(self.q):
for k in range(self.q):
C_AAA_Vrh_[s, t, u, k] = AAA_[s, t, u].dot(Vr_[k].conj().T)
C_AAA_Vrh_ = sp.tensordot(ham_, C_AAA_Vrh_, ((3, 4, 5, 2), (0, 1, 2, 3))).copy(order='C')
C_Vri_A_r_Ah_ = np.empty((self.q, self.q, self.q,
A_.shape[2], Vri_.shape[1]), dtype=tdvp.typ)
for u in range(self.q):
for k in range(self.q):
for j in range(self.q):
C_Vri_A_r_Ah_[u, k, j] = Vri_[j].dot(A_[k]).dot(r_.dot(A_[u].conj().T))
C_Vri_A_r_Ah_ = sp.tensordot(ham_.conj(), C_Vri_A_r_Ah_, ((5, 2, 1), (0, 1, 2))).copy(order='C')
C_AhlAA = np.empty((self.q, self.q, self.q,
A_.shape[2], A.shape[2]), dtype=tdvp.typ)
for j in range(self.q):
for i in range(self.q):
for s in range(self.q):
C_AhlAA[j, i, s] = A[s].conj().T.dot(l.dot(AA[i, j]))
C_AhlAA_conj = sp.tensordot(ham_.conj(), C_AhlAA, ((1, 0, 3), (0, 1, 2))).copy(order='C')
C_AhlAA = sp.tensordot(ham_, C_AhlAA, ((4, 3, 0), (0, 1, 2)))
C_AhlAA = sp.transpose(C_AhlAA, axes=(2, 0, 1, 3, 4)).copy(order='C')
C_AA_Vrh = np.empty((self.q, self.q, self.q,
A_.shape[2], Vr_.shape[1]), dtype=tdvp.typ)
for t in range(self.q):
for u in range(self.q):
for k in range(self.q):
C_AA_Vrh[k, u, t] = AA_[t, u].dot(Vr_[k].conj().T)
C_AA_Vrh = sp.tensordot(ham_, C_AA_Vrh, ((4, 5, 2), (2, 1, 0))).copy(order='C')
C_ = sp.tensordot(ham_, AAA_, ((3, 4, 5), (0, 1, 2))).copy(order='C')
rhs10 = tm.eps_r_op_3s_C123_AAA456(r_, AAA_, C_Vri_AA_)
#NOTE: These C's are good as C12 or C34, but only because h is Hermitian!
#TODO: Make this consistent with the updated 2-site case above.
return V_, Vr_, Vri_, Vri_A_, C_, C_Vri_AA_, C_AAA_r_Ah_Vrih, C_AhAhlAA, C_AA_r_Ah_Vrih_, C_AAA_Vrh_, C_Vri_A_r_Ah_, C_AhlAA, C_AhlAA_conj, C_AA_Vrh, rhs10,
def calc_BHB(self, x, p, tdvp, tdvp2, prereq,
M_prev=None, y_pi_prev=None, pinv_solver=None):
if pinv_solver is None:
pinv_solver = las.gmres
if self.ham_sites == 3:
V_, Vr_, Vri_, Vri_A_, C_, C_Vri_AA_, C_AAA_r_Ah_Vrih, \
C_AhAhlAA, C_AA_r_Ah_Vrih_, C_AAA_Vrh_, C_Vri_A_r_Ah_, \
C_AhlAA, C_AhlAA_conj, C_AA_Vrh, rhs10 = prereq
else:
C_, C_conj, V_, Vr_, Vri_, C_Vri_A_conj, C_AhlA, C_A_Vrh_, rhs10 = prereq
A = tdvp.A[0]
A_ = tdvp2.A[0]
AA = tdvp.AA[0]
l = tdvp.l[0]
r_ = tdvp2.r[0]
l_sqrt = tdvp.l_sqrt[0]
l_sqrt_i = tdvp.l_sqrt_i[0]
r__sqrt = tdvp2.r_sqrt[0]
r__sqrt_i = tdvp2.r_sqrt_i[0]
K__r = tdvp2.K[0]
K_l = tdvp.K_left[0]
pseudo = tdvp2 is tdvp
B = tdvp2.get_B_from_x(x, tdvp2.Vsh[0], l_sqrt_i, r__sqrt_i)
#Skip zeros due to rank-deficiency
if la.norm(B) == 0:
return sp.zeros_like(x), M_prev, y_pi_prev
if self.sanity_checks:
tst = tm.eps_r_noop(r_, B, A_)
if not la.norm(tst) > self.sanity_tol:
log.warning("Sanity check failed: Gauge-fixing violation! "
+ str(la.norm(tst)))
if self.sanity_checks:
B2 = np.zeros_like(B)
for s in range(self.q):
B2[s] = l_sqrt_i.dot(x.dot(Vri_[s]))
if la.norm(B - B2) / la.norm(B) > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! Bad Vri!")
BA_ = tm.calc_AA(B, A_)
AB = tm.calc_AA(A, B)
if self.ham_sites == 3:
BAA_ = tm.calc_AAA_AA(BA_, A_)
ABA_ = tm.calc_AAA_AA(AB, A_)
AAB = tm.calc_AAA_AA(AA, B)
y = tm.eps_l_noop(l, B, A)
# if pseudo:
# y = y - m.adot(r_, y) * l #should just = y due to gauge-fixing
M = pinv_1mE(y, [A_], [A], l, r_, p=-p, left=True, pseudo=pseudo,
out=M_prev, tol=self.pinv_tol, solver=pinv_solver,
use_CUDA=self.pinv_CUDA, CUDA_use_batch=self.pinv_CUDA_batch,
sanity_checks=self.sanity_checks, sc_data='M')
#print m.adot(r, M)
if self.sanity_checks:
y2 = M - sp.exp(+1.j * p) * tm.eps_l_noop(M, A_, A)
norm = la.norm(y.ravel())
if norm == 0:
norm = 1
tst = la.norm(y - y2) / norm
if tst > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! Bad M. Off by: %g", tst)
# if pseudo:
# M = M - l * m.adot(r_, M)
Mh = M.conj().T.copy(order='C')
if self.ham_sites == 3:
tmp = BAA_ + sp.exp(+1.j * p) * ABA_ + sp.exp(+2.j * p) * AAB
res = l_sqrt.dot(tm.eps_r_op_3s_C123_AAA456(r_, tmp, C_Vri_AA_)) #1 1D, #3, #3c
else:
tmp = BA_ + sp.exp(+1.j * p) * AB
res = l_sqrt.dot(tm.eps_r_op_2s_AA12_C34(r_, tmp, C_Vri_A_conj)) #1, #3 OK
res += sp.exp(-1.j * p) * l_sqrt_i.dot(Mh.dot(rhs10)) #10
exp = sp.exp
subres = sp.zeros_like(res)
eye = m.eyemat(C_.shape[2], dtype=tdvp.typ)
eye2 = m.eyemat(A.shape[2], dtype=tdvp.typ)
if self.ham_sites == 3:
subres += exp(-2.j * p) * tm.eps_l_noop(Mh, A, C_AAA_r_Ah_Vrih) #12
subres += exp(-3.j * p) * tm.eps_l_op_2s_AA12_C34(Mh, AA, C_AAA_Vrh_) #12b
for s in range(self.q):
#subres += exp(-2.j * p) * A[s].conj().T.dot(Mh.dot(C_AAA_r_Ah_Vrih[s])) #12
subres += tm.eps_r_noop(B[s], C_AhAhlAA[s, :], Vr_) #2b
subres += exp(-1.j * p) * tm.eps_l_noop(l.dot(B[s]), A, C_AA_r_Ah_Vrih_[s, :]) #4
subres += A[s].conj().T.dot(l.dot(tm.eps_r_op_2s_AA12_C34(eye2, AB, C_Vri_A_r_Ah_[s, :, :]))) #2 -ive of that it should be....
subres += exp(-1.j * p) * tm.eps_l_op_2s_AA12_C34(eye2, C_AhlAA_conj[s, :, :], BA_).dot(Vr_[s].conj().T) #4b
subres += exp(-2.j * p) * tm.eps_l_op_2s_AA12_C34(l.dot(B[s]), AA, C_AA_Vrh[s, :, :]) #4c
try:
Bs_r = r_.dot_left(B[s])
except AttributeError:
Bs_r = B[s].dot(r_)
subres += exp(+1.j * p) * tm.eps_r_op_2s_AA12_C34(Bs_r, C_AhlAA[s, :, :], Vri_A_) #3b
#for t in xrange(self.q):
#subres += (C_AhAhlAA[t, s].dot(B[s]).dot(Vr_[t].conj().T)) #2b
#subres += (exp(-1.j * p) * A[s].conj().T.dot(l.dot(B[t])).dot(C_AA_r_Ah_Vrih_[s, t])) #4
#subres += (exp(-3.j * p) * AA[t, s].conj().T.dot(Mh).dot(C_AAA_Vrh_[t, s])) #12b
#for u in xrange(self.q):
#subres += A[s].conj().T.dot(l.dot(AB[t, u]).dot(C_A_r_Ah_Vrih[s, t, u])) #2 -ive of that it should be....
#subres += (exp(+1.j * p) * C_AhlAA[t, s, s].dot(B[u]).dot(r_.dot(A_[u].conj().T)).dot(Vri_[t].conj().T)) #3b
#subres += (exp(-1.j * p) * C_AhAhlA[s, t, u].dot(BA_[t, u]).dot(Vr_[s].conj().T)) #4b
#subres += (exp(-2.j * p) * AA[t, s].conj().T.dot(l.dot(B[u])).dot(C_AA_Vrh[t, s, u])) #4c
else:
for s in range(self.q):
#subres += C_AhlA[s, t].dot(B[s]).dot(Vr_[t].conj().T) #2 OK
subres += tm.eps_r_noop(B[s], C_AhlA[s, :], Vr_) #2
#+ exp(-1.j * p) * A[t].conj().T.dot(l.dot(B[s])).dot(C_A_Vrh_[t, s]) #4 OK with 3
subres += exp(-1.j * p) * tm.eps_l_noop(l.dot(B[s]), A, C_A_Vrh_[s, :]) #4
#+ exp(-2.j * p) * A[s].conj().T.dot(Mh.dot(C_[s, t])).dot(Vr_[t].conj().T)) #12
subres += exp(-2.j * p) * A[s].conj().T.dot(Mh).dot(tm.eps_r_noop(eye, C_[s, :], Vr_)) #12
res += l_sqrt_i.dot(subres)
res += l_sqrt.dot(tm.eps_r_noop(K__r, B, Vri_)) #5
res += l_sqrt_i.dot(K_l.dot(tm.eps_r_noop(r__sqrt, B, V_))) #6
res += sp.exp(-1.j * p) * l_sqrt_i.dot(Mh.dot(tm.eps_r_noop(K__r, A_, Vri_))) #8
y1 = sp.exp(+1.j * p) * tm.eps_r_noop(K__r, B, A_) #7
if self.ham_sites == 3:
tmp = sp.exp(+1.j * p) * BAA_ + sp.exp(+2.j * p) * ABA_ + sp.exp(+3.j * p) * AAB #9, #11, #11b
y = y1 + tm.eps_r_op_3s_C123_AAA456(r_, tmp, C_)
elif self.ham_sites == 2:
tmp = sp.exp(+1.j * p) * BA_ + sp.exp(+2.j * p) * AB #9, #11
y = y1 + tm.eps_r_op_2s_AA12_C34(r_, tmp, C_conj)
if pseudo:
y = y - m.adot(l, y) * r_
y_pi = pinv_1mE(y, [A], [A_], l, r_, p=p, left=False,
pseudo=pseudo, out=y_pi_prev, tol=self.pinv_tol,
solver=pinv_solver, use_CUDA=self.pinv_CUDA,
CUDA_use_batch=self.pinv_CUDA_batch,
sanity_checks=self.sanity_checks, sc_data='y_pi')
#print m.adot(l, y_pi)
if self.sanity_checks:
z = y_pi - sp.exp(+1.j * p) * tm.eps_r_noop(y_pi, A, A_)
tst = la.norm((y - z).ravel()) / la.norm(y.ravel())
if tst > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! Bad x_pi. Off by: %g", tst)
res += l_sqrt.dot(tm.eps_r_noop(y_pi, A, Vri_))
if self.sanity_checks:
expval = m.adot(x, res) / m.adot(x, x)
#print "expval = " + str(expval)
if expval < -self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! H is not pos. semi-definite (%s)", expval)
if abs(expval.imag) > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! H is not Hermitian (%s)", expval)
return res, M, y_pi
def matvec(self, v):
x = v.reshape((self.D, (self.q - 1)*self.D))
self.calls += 1
log.debug("Calls: %u", self.calls)
res, self.M_prev, self.y_pi_prev = self.calc_BHB(x, self.p, self.tdvp,
self.tdvp2,
self.prereq,
M_prev=self.M_prev,
y_pi_prev=self.y_pi_prev,
pinv_solver=self.pinv_solver)
return res.ravel()
def get_Aop(A, op_tp, index, conj=False):
Aops = []
for op_tp_ in op_tp:
if index < 2:
if conj:
op = op_tp_[index].conj()
else:
op = op_tp_[index]
A_op = op.T.dot(A.reshape((A.shape[0], A.shape[1] * A.shape[2]))).reshape(A.shape)
else:
if conj:
op = op_tp_[index - 2].conj()
else:
op = op_tp_[index - 2]
A_op = op.dot(A.reshape((A.shape[0], A.shape[1] * A.shape[2]))).reshape(A.shape)
Aops.append(A_op)
return Aops
def get_A_ops(A0, A1, op_tp, conj=False):
A_ops_ = []
if conj:
for op_tp_ in op_tp:
A0_op0 = op_tp_[0].conj().T.dot(A0.reshape((A0.shape[0], A0.shape[1] * A0.shape[2]))).reshape(A0.shape)
A1_op1 = op_tp_[1].conj().T.dot(A1.reshape((A1.shape[0], A1.shape[1] * A1.shape[2]))).reshape(A1.shape)
A_ops_.append([A0_op0, A1_op1])
else:
for op_tp_ in op_tp:
A0_op0 = op_tp_[0].dot(A0.reshape((A0.shape[0], A0.shape[1] * A0.shape[2]))).reshape(A0.shape)
A1_op1 = op_tp_[1].dot(A1.reshape((A1.shape[0], A1.shape[1] * A1.shape[2]))).reshape(A1.shape)
A_ops_.append([A0_op0, A1_op1])
return A_ops_
class Excite_H_Op_tp:
def __init__(self, tdvp, tdvp2, p, pinv_tol=1E-12,
sanity_checks=False, sanity_tol=1E-12):
"""Creates an Excite_H_Op object, which is a LinearOperator.
This wraps the effective Hamiltonian in terms of MPS tangent vectors
as a LinearOperator that can be used with SciPy's sparse linear
algebra routines.
Parameters
----------
tdvp : EvoMPS_TDVP_Uniform
tdvp object providing the required operations in the matrix representation.
tdvp2 : EvoMPS_TDVP_Uniform
Second tdvp object (can be the same as tdvp), for example containing a different ground state.
p : float
Momentum in units of inverse lattice spacing.
"""
assert tdvp.L == 1, 'Excite_H_Op only supports blocks of size 1'
assert tdvp.L == tdvp2.L, 'Block sizes must match!'
assert tdvp.q == tdvp2.q, 'Hilbert spaces must match!'
assert tdvp.D == tdvp2.D, 'Bond-dimensions must match!'
self.tdvp = tdvp
self.tdvp2 = tdvp2
self.p = p
self.D = tdvp.D
self.q = tdvp.q
self.ham_sites = tdvp.ham_sites
self.ham_tp = tdvp.ham_tp
self.sanity_checks = sanity_checks
self.sanity_tol = sanity_tol
self.pinv_solver = None
self.pinv_tol = pinv_tol
self.pinv_CUDA = False
self.pinv_CUDA_batch = False
d = (self.q - 1) * self.D**2
self.shape = (d, d)
self.dtype = np.dtype(tdvp.typ)
self.prereq = (self.calc_BHB_prereq(tdvp, tdvp2))
self.calls = 0
self.M_prev = None
self.y_pi_prev = None
def calc_BHB_prereq(self, tdvp, tdvp2):
"""Calculates prerequisites for the application of the effective Hamiltonian in terms of tangent vectors.
This is called (indirectly) by the self.excite.. functions.
Parameters
----------
tdvp2: EvoMPS_TDVP_Uniform
Second state (may be the same, or another ground state).
Returns
-------
A lot of stuff.
"""
l = tdvp.l[0]
r_ = tdvp2.r[0]
r__sqrt = tdvp2.r_sqrt[0]
r__sqrt_i = tdvp2.r_sqrt_i[0]
A = tdvp.A[0]
A_ = tdvp2.A[0]
#Note: V has ~ D**2 * q**2 elements. We avoid making any copies of it except this one.
# This one is only needed because low-level routines force V_[s] to be contiguous.
# TODO: Store V instead of Vsh in tdvp_uniform too...
V_ = sp.transpose(tdvp2.Vsh[0], axes=(0, 2, 1)).conj().copy(order='C')
if self.ham_sites == 2:
#eyeham = m.eyemat(self.q, dtype=sp.complex128)
eyeham = sp.eye(self.q, dtype=sp.complex128)
#diham = m.simple_diag_matrix(sp.repeat([-tdvp.h_expect.real], self.q))
diham = -tdvp.h_expect.real * sp.eye(self.q, dtype=sp.complex128)
_ham_tp = self.ham_tp + [[diham, eyeham]] #subtract norm dof
Ao1 = get_Aop(A, _ham_tp, 2, conj=False)
AhlAo1 = [tm.eps_l_op_1s(l, A, A, o1.conj().T) for o1, o2 in _ham_tp]
A_o2c = get_Aop(A_, _ham_tp, 1, conj=True)
Ao1c = get_Aop(A, _ham_tp, 0, conj=True)
A_Vr_ho2 = [tm.eps_r_op_1s(r__sqrt, A_, V_, o2) for o1, o2 in _ham_tp]
A_A_o12c = get_A_ops(A_, A_, _ham_tp, conj=True)
A_o1 = get_Aop(A_, _ham_tp, 2, conj=False)
tmp = sp.empty((A_.shape[1], V_.shape[1]), dtype=A.dtype, order='C')
tmp2 = sp.empty((A_.shape[1], A_o2c[0].shape[1]), dtype=A.dtype, order='C')
rhs10 = 0
for al in range(len(A_o1)):
tmp2 = tm.eps_r_noop_inplace(r_, A_, A_o2c[al], tmp2)
tmp3 = m.mmul(tmp2, r__sqrt_i)
rhs10 += tm.eps_r_noop_inplace(tmp3, A_o1[al], V_, tmp)
return V_, AhlAo1, A_o2c, Ao1, Ao1c, A_Vr_ho2, A_A_o12c, rhs10, _ham_tp
elif self.ham_sites == 3:
return
def calc_BHB(self, x, p, tdvp, tdvp2, prereq,
M_prev=None, y_pi_prev=None, pinv_solver=None):
if pinv_solver is None:
pinv_solver = las.gmres
if self.ham_sites == 3:
return
else:
V_, AhlAo1, A_o2c, Ao1, Ao1c, A_Vr_ho2, A_A_o12c, rhs10, _ham_tp = prereq
A = tdvp.A[0]
A_ = tdvp2.A[0]
l = tdvp.l[0]
r_ = tdvp2.r[0]
l_sqrt = tdvp.l_sqrt[0]
l_sqrt_i = tdvp.l_sqrt_i[0]
r__sqrt = tdvp2.r_sqrt[0]
r__sqrt_i = tdvp2.r_sqrt_i[0]
K__r = tdvp2.K[0]
K_l = tdvp.K_left[0]
pseudo = tdvp2 is tdvp
B = tdvp2.get_B_from_x(x, tdvp2.Vsh[0], l_sqrt_i, r__sqrt_i)
#Skip zeros due to rank-deficiency
if la.norm(B) == 0:
return sp.zeros_like(x), M_prev, y_pi_prev
if self.sanity_checks:
tst = tm.eps_r_noop(r_, B, A_)
if not la.norm(tst) > self.sanity_tol:
log.warning("Sanity check failed: Gauge-fixing violation! "
+ str(la.norm(tst)))
if self.sanity_checks:
B2 = np.zeros_like(B)
for s in range(self.q):
B2[s] = l_sqrt_i.dot(x.dot(m.mmul(V_[s], r__sqrt_i)))
if la.norm(B - B2) / la.norm(B) > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! Bad Vri!")
y = tm.eps_l_noop(l, B, A)
# if pseudo:
# y = y - m.adot(r_, y) * l #should just = y due to gauge-fixing
M = pinv_1mE(y, [A_], [A], l, r_, p=-p, left=True, pseudo=pseudo,
out=M_prev, tol=self.pinv_tol, solver=pinv_solver,
use_CUDA=self.pinv_CUDA, CUDA_use_batch=self.pinv_CUDA_batch,
sanity_checks=self.sanity_checks, sc_data='M')
#print m.adot(r, M)
if self.sanity_checks:
y2 = M - sp.exp(+1.j * p) * tm.eps_l_noop(M, A_, A)
norm = la.norm(y.ravel())
if norm == 0:
norm = 1
tst = la.norm(y - y2) / norm
if tst > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! Bad M. Off by: %g", tst)
# if pseudo:
# M = M - l * m.adot(r_, M)
Mh = M.conj().T.copy(order='C')
res_ls = 0
res_lsi = 0
exp = sp.exp
if self.ham_sites == 3:
pass
else:
Bo1 = get_Aop(B, _ham_tp, 2, conj=False)
tmp = sp.empty((B.shape[1], V_.shape[1]), dtype=A.dtype, order='C')
tmp2 = sp.empty((A_.shape[1], A_o2c[0].shape[1]), dtype=A.dtype, order='C')
tmp3 = sp.empty_like(tmp2, order='C')
for al in range(len(Bo1)):
tmp3 = m.dot_inplace(tm.eps_r_noop_inplace(r_, A_, A_o2c[al], tmp2), r__sqrt_i, tmp3)
res_ls += tm.eps_r_noop_inplace(tmp3, Bo1[al], V_, tmp) #1
tmp3 = m.dot_inplace(tm.eps_r_noop_inplace(r_, B, A_o2c[al], tmp2), r__sqrt_i, tmp3)
tmp = tm.eps_r_noop_inplace(tmp3, Ao1[al], V_, tmp) #3
tmp *= exp(+1.j * p)
res_ls += tmp
del(tmp)
del(tmp2)
del(tmp3)
res_lsi += sp.exp(-1.j * p) * Mh.dot(rhs10) #10
if self.ham_sites == 3:
pass
else:
Bo2 = get_Aop(B, _ham_tp, 3, conj=False)
for al in range(len(AhlAo1)):
res_lsi += AhlAo1[al].dot(tm.eps_r_noop(r__sqrt, Bo2[al], V_)) #2
res_lsi += exp(-1.j * p) * tm.eps_l_noop(l, Ao1c[al], B).dot(A_Vr_ho2[al]) #4
res_lsi += exp(-2.j * p) * tm.eps_l_noop(Mh, Ao1c[al], A_).dot(A_Vr_ho2[al]) #12
K__rri = m.mmul(K__r, r__sqrt_i)
res_ls += tm.eps_r_noop(K__rri, B, V_) #5
res_lsi += K_l.dot(tm.eps_r_noop(r__sqrt, B, V_)) #6
res_lsi += sp.exp(-1.j * p) * Mh.dot(tm.eps_r_noop(K__rri, A_, V_)) #8
y1 = sp.exp(+1.j * p) * tm.eps_r_noop(K__r, B, A_) #7
if self.ham_sites == 3:
pass
elif self.ham_sites == 2:
tmp = 0
for al in range(len(A_A_o12c)):
tmp += sp.exp(+1.j * p) * tm.eps_r_noop(tm.eps_r_noop(r_, A_, A_A_o12c[al][1]), B, A_A_o12c[al][0]) #9
tmp += sp.exp(+2.j * p) * tm.eps_r_noop(tm.eps_r_noop(r_, B, A_A_o12c[al][1]), A, A_A_o12c[al][0]) #11
y = y1 + tmp #7, 9, 11
del(tmp)
if pseudo:
y = y - m.adot(l, y) * r_
y_pi = pinv_1mE(y, [A], [A_], l, r_, p=p, left=False,
pseudo=pseudo, out=y_pi_prev, tol=self.pinv_tol,
solver=pinv_solver, use_CUDA=self.pinv_CUDA,
CUDA_use_batch=self.pinv_CUDA_batch,
sanity_checks=self.sanity_checks, sc_data='y_pi')
#print m.adot(l, y_pi)
if self.sanity_checks:
z = y_pi - sp.exp(+1.j * p) * tm.eps_r_noop(y_pi, A, A_)
tst = la.norm((y - z).ravel()) / la.norm(y.ravel())
if tst > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! Bad x_pi. Off by: %g", tst)
res_ls += tm.eps_r_noop(m.mmul(y_pi, r__sqrt_i), A, V_)
res = l_sqrt.dot(res_ls)
res += l_sqrt_i.dot(res_lsi)
if self.sanity_checks:
expval = m.adot(x, res) / m.adot(x, x)
#print "expval = " + str(expval)
if expval < -self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! H is not pos. semi-definite (%s)", expval)
if abs(expval.imag) > self.sanity_tol:
log.warning("Sanity Fail in calc_BHB! H is not Hermitian (%s)", expval)
return res, M, y_pi
def matvec(self, v):
x = v.reshape((self.D, (self.q - 1)*self.D))
self.calls += 1
log.debug("Calls: %u", self.calls)
res, self.M_prev, self.y_pi_prev = self.calc_BHB(x, self.p, self.tdvp,
self.tdvp2,
self.prereq,
M_prev=self.M_prev,
y_pi_prev=self.y_pi_prev,
pinv_solver=self.pinv_solver)
return res.ravel()
def _excite_correlation_1s_1s(AL, AR, B, lL, rR, op1, op2, d, g):
pseudo = AL is AR
BBL = pinv_1mE(tm.eps_l_noop(lL, B, B), [AR], [AR], lL, rR, p=0,
left=True, pseudo=True)
B1L = pinv_1mE(tm.eps_l_noop(lL, B, AL), [AR], [AL], lL, rR, p=0,
left=True, pseudo=pseudo)
B2L = pinv_1mE(tm.eps_l_noop(lL, AL, B), [AL], [AR], lL, rR, p=0,
left=True, pseudo=pseudo)
B1B2L = pinv_1mE(tm.eps_l_noop(B1L, AR, B), [AR], [AR], lL, rR, p=0,
left=True, pseudo=True)
B2B1L = pinv_1mE(tm.eps_l_noop(B2L, B, AR), [AR], [AR], lL, rR, p=0,
left=True, pseudo=True)
BBR = pinv_1mE(tm.eps_r_noop(rR, B, B), [AL], [AL], lL, rR, p=0,
left=False, pseudo=True)
print("gauge fixing:", la.norm(tm.eps_r_noop(rR, B, AR)))
res = [0.] * (d + 1)
#B's on the left terms (0, 1, 2, 5)
res[0] += m.adot(tm.eps_l_op_1s(BBL + B1B2L + B2B1L, AR, AR, op1.dot(op2) - g[0] * sp.eye(len(op1))), rR)
res[0] += m.adot(tm.eps_l_op_1s(B1L, AR, B, op1.dot(op2)), rR)
res[0] += m.adot(tm.eps_l_op_1s(B2L, B, AR, op1.dot(op2)), rR)
res[0] += m.adot(tm.eps_l_op_1s(lL, B, B, op1.dot(op2) - g[0] * sp.eye(len(op1))), rR)
l1 = tm.eps_l_op_1s(BBL + B1B2L + B2B1L, AR, AR, op1)
l1 += tm.eps_l_op_1s(B1L, AR, B, op1)
l1 += tm.eps_l_op_1s(B2L, B, AR, op1)
l1 += tm.eps_l_op_1s(lL, B, B, op1)
for n in range(1, d + 1):
res[n] += m.adot(l1, tm.eps_r_op_1s(rR, AR, AR, op2))
res[n] -= 2 * g[n]
if n == d:
break
l1 = tm.eps_l_noop(l1, AR, AR)
print(1, res)
#Terms 3, 4, 6, 7, a
ls = [None] * (d + 1)
ls[0] = tm.eps_l_op_1s(B1L, AR, AL, op1) + tm.eps_l_op_1s(lL, B, AL, op1)
for k in range(1, d + 1):
ls[k] = tm.eps_l_noop(ls[k - 1], AR, AL)
rs = [None] * (d + 1)
rs[d - 1] = tm.eps_r_op_1s(rR, AR, AR, op2)
for k in range(d - 1, 0, -1):
rs[k - 1] = tm.eps_r_noop(rs[k], AR, AR)
for n in range(2, d + 1):
for k in range(2, n):
res[n] += m.adot(ls[k - 1], tm.eps_r_noop(rs[-(n + 1):][k], AR, B))
res[n] += m.adot(ls[n - 1], tm.eps_r_op_1s(rR, AR, B, op2))
print(2, res)
#Terms 3, 4, 6, 7, b
ls = [None] * (d + 1)
ls[0] = tm.eps_l_op_1s(B2L, AL, AR, op1) + tm.eps_l_op_1s(lL, AL, B, op1)
for k in range(1, d + 1):
ls[k] = tm.eps_l_noop(ls[k - 1], AL, AR)
for n in range(2, d + 1):
for k in range(2, n):
res[n] += m.adot(ls[k - 1], tm.eps_r_noop(rs[-(n + 1):][k], B, AR))
res[n] += m.adot(ls[n - 1], tm.eps_r_op_1s(rR, B, AR, op2))
print(3, res)
#Term 8
ls = [None] * (d + 1)
ls[0] = tm.eps_l_op_1s(lL, AL, AL, op1)
for k in range(1, d + 1):
ls[k] = tm.eps_l_noop(ls[k - 1], AL, AL)
for n in range(2, d + 1):
for k in range(2, n):
res[n] += m.adot(ls[k - 1], tm.eps_r_noop(rs[-(n + 1):][k], B, B))
res[n] -= g[n]
print(4, res)
#Terms 9 and 10
for n in range(2, d + 1):
for k in range(2, n):
lj = tm.eps_l_noop(ls[k - 1], AL, B)
for j in range(k + 1, n):
res[n] += m.adot(lj, tm.eps_r_noop(rs[-(n + 1):][j], B, AR))
lj = tm.eps_l_noop(lj, AL, AR)
res[n] += m.adot(lj, tm.eps_r_op_1s(rR, B, AR, op2))
lj = tm.eps_l_noop(ls[k - 1], B, AL)
for j in range(k + 1, n):
res[n] += m.adot(lj, tm.eps_r_noop(rs[-(n + 1):][j], AR, B))
lj = tm.eps_l_noop(lj, AL, AR)
res[n] += m.adot(lj, tm.eps_r_op_1s(rR, AR, B, op2))
print(5, res)
#Term 11
res[0] += m.adot(tm.eps_l_op_1s(lL, AL, AL, op1.dot(op2) - g[0] * sp.eye(len(op1))), BBR)
for n in range(1, d + 1):
res[n] += m.adot(tm.eps_l_op_1s(ls[n - 1], AL, AL, op2), BBR)
res[n] -= g[n]
return res
def _excite_expect_2s_tp_sep(AL, AR, B, lL, rR, op, d, n1, n2):
ls = [None] * (d + 1)
ls[0] = lL
rs = [None] * (d + 1)
rs[-1] = rR
As1 = [None] + [AL] * (n1 - 1) + [B] + [AR] * (d - n1 + 1)
As2 = [None] + [AL] * (n2 - 1) + [B] + [AR] * (d - n2 + 1)
for n in range(1, d):
ls[n] = tm.eps_l_noop(ls[n - 1], As1[n], As2[n])
for n in range(d, 0, -1):
rs[n - 1] = tm.eps_r_noop(rs[n], As1[n], As2[n])
Cs1 = [None] * (d + 1)
for n in range(1, d):
Cs1[n] = tm.calc_C_tp(op, As1[n], As1[n + 1])
res = [m.adot(ls[n - 1], tm.eps_r_op_2s_C12_tp(rs[n + 1], Cs1[n], As2[n], As2[n + 1]))
for n in range(1, d)]
return sp.array(res)
| 41.397674
| 168
| 0.483905
| 5,717
| 35,602
| 2.782228
| 0.067518
| 0.029863
| 0.019992
| 0.029423
| 0.815919
| 0.767698
| 0.730919
| 0.694266
| 0.649315
| 0.619515
| 0
| 0.039733
| 0.368715
| 35,602
| 859
| 169
| 41.445867
| 0.667987
| 0.110584
| 0
| 0.579038
| 0
| 0
| 0.027024
| 0
| 0
| 0
| 0
| 0.002328
| 0.013746
| 1
| 0.020619
| false
| 0.005155
| 0.015464
| 0
| 0.065292
| 0.012027
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
4258d069764032c6a4392afaa268a0d828af6946
| 569
|
py
|
Python
|
server/world/replica/render.py
|
alentoghostflame/PyLUS
|
d23531c81a81754bea04c1d1de335117edab1670
|
[
"MIT"
] | 7
|
2019-04-18T00:46:09.000Z
|
2021-12-21T04:34:44.000Z
|
server/world/replica/render.py
|
alentoghostflame/PyLUS
|
d23531c81a81754bea04c1d1de335117edab1670
|
[
"MIT"
] | 15
|
2021-03-08T17:29:40.000Z
|
2021-04-08T18:22:52.000Z
|
server/world/replica/render.py
|
alentoghostflame/PyLUS
|
d23531c81a81754bea04c1d1de335117edab1670
|
[
"MIT"
] | 6
|
2018-04-01T16:33:50.000Z
|
2018-05-12T15:54:21.000Z
|
"""
Render component
"""
from bitstream import c_uint32
from pyraknet.replicamanager import Replica
from .component import Component
class Render(Component):
"""
Render component replica
"""
def __init__(self, disabled=False):
super().__init__(**{k: v for k, v in locals().items() if k != 'self'})
def write_construction(self, stream):
"""
Writes construction data
"""
if not self.disabled:
stream.write(c_uint32(0)) # TODO: add a var for this
def serialize(self, stream):
pass
| 21.074074
| 78
| 0.620387
| 68
| 569
| 5.029412
| 0.558824
| 0.131579
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.011962
| 0.265378
| 569
| 26
| 79
| 21.884615
| 0.80622
| 0.161687
| 0
| 0
| 0
| 0
| 0.009281
| 0
| 0
| 0
| 0
| 0.038462
| 0
| 1
| 0.272727
| false
| 0.090909
| 0.272727
| 0
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
4288c89ced5983ad0c21412dc6e303ee5b09e070
| 209
|
py
|
Python
|
src/daipecore/lineage/InputDecoratorInterface.py
|
daipe-ai/daipe-core
|
aa205495fa6b464fa6078d17e439c60345ac99ea
|
[
"MIT"
] | 1
|
2021-09-17T09:07:09.000Z
|
2021-09-17T09:07:09.000Z
|
src/daipecore/lineage/InputDecoratorInterface.py
|
daipe-ai/daipe-core
|
aa205495fa6b464fa6078d17e439c60345ac99ea
|
[
"MIT"
] | 2
|
2021-12-20T07:46:33.000Z
|
2022-02-24T07:02:05.000Z
|
src/daipecore/lineage/InputDecoratorInterface.py
|
daipe-ai/daipe-core
|
aa205495fa6b464fa6078d17e439c60345ac99ea
|
[
"MIT"
] | null | null | null |
from abc import ABC, abstractmethod
class InputDecoratorInterface(ABC):
@property
@abstractmethod
def name(self):
pass
@property
@abstractmethod
def args(self):
pass
| 14.928571
| 35
| 0.645933
| 20
| 209
| 6.75
| 0.6
| 0.325926
| 0.37037
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.287081
| 209
| 13
| 36
| 16.076923
| 0.90604
| 0
| 0
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0.2
| 0.1
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
428fc11833633ad69827fbd3c585abb0e729fd4c
| 787
|
py
|
Python
|
pincer/middleware/message_update.py
|
mjneff2/Pincer
|
a11bc3e4bad319fdf927d913c58c933576ec7c99
|
[
"MIT"
] | null | null | null |
pincer/middleware/message_update.py
|
mjneff2/Pincer
|
a11bc3e4bad319fdf927d913c58c933576ec7c99
|
[
"MIT"
] | null | null | null |
pincer/middleware/message_update.py
|
mjneff2/Pincer
|
a11bc3e4bad319fdf927d913c58c933576ec7c99
|
[
"MIT"
] | null | null | null |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""sent when a message is updated in a subscribed text channel"""
from ..core.dispatch import GatewayDispatch
from ..objects import UserMessage
from ..utils.conversion import construct_client_dict
async def message_update_middleware(self, payload: GatewayDispatch):
"""
Middleware for ``on_message_update`` event,
generate a class for the message that has been updated.
:param self:
The current client.
:param payload:
The data received from the message update event.
"""
return "on_message_update", [
UserMessage.from_dict(construct_client_dict(self, payload.data))
]
def export():
return message_update_middleware
| 26.233333
| 72
| 0.724269
| 101
| 787
| 5.514851
| 0.554455
| 0.116697
| 0.068223
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006369
| 0.202033
| 787
| 29
| 73
| 27.137931
| 0.880573
| 0.19568
| 0
| 0
| 0
| 0
| 0.044974
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.111111
| true
| 0
| 0.333333
| 0.111111
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
42995721d048b65c38fffd5aab209dac18cacf36
| 63
|
py
|
Python
|
paquete/primos/__init__.py
|
Alex9808/py101
|
18c585c1433e8ec6f5e4962e556a781e0c3c3cd5
|
[
"MIT"
] | 25
|
2018-08-14T22:13:13.000Z
|
2021-07-23T04:14:06.000Z
|
paquete/primos/__init__.py
|
Alex9808/py101
|
18c585c1433e8ec6f5e4962e556a781e0c3c3cd5
|
[
"MIT"
] | 1
|
2021-05-21T23:46:42.000Z
|
2021-05-21T23:46:42.000Z
|
paquete/primos/__init__.py
|
Alex9808/py101
|
18c585c1433e8ec6f5e4962e556a781e0c3c3cd5
|
[
"MIT"
] | 34
|
2018-07-30T20:48:17.000Z
|
2022-02-04T19:01:27.000Z
|
'''Paquete que incluye un módulo que calcula números primos.'''
| 63
| 63
| 0.761905
| 9
| 63
| 5.333333
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.126984
| 63
| 1
| 63
| 63
| 0.872727
| 0.904762
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
42a34ccc61dacf138c1be2a2ba984b58d96aa64d
| 2,170
|
py
|
Python
|
python/tvm/testing/popen_pool.py
|
shengxinhu/tvm
|
06c443e9959452c6da3a911fe0c11e08c5554477
|
[
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 4,640
|
2017-08-17T19:22:15.000Z
|
2019-11-04T15:29:46.000Z
|
python/tvm/testing/popen_pool.py
|
shengxinhu/tvm
|
06c443e9959452c6da3a911fe0c11e08c5554477
|
[
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 2,863
|
2017-08-17T19:55:50.000Z
|
2019-11-04T17:18:41.000Z
|
python/tvm/testing/popen_pool.py
|
shengxinhu/tvm
|
06c443e9959452c6da3a911fe0c11e08c5554477
|
[
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1,352
|
2017-08-17T19:30:38.000Z
|
2019-11-04T16:09:29.000Z
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# pylint: disable=invalid-name, missing-function-docstring
"""Common functions for popen_pool test cases"""
import tvm
from . import _ffi_api
TEST_GLOBAL_STATE_1 = 0
TEST_GLOBAL_STATE_2 = 0
TEST_GLOBAL_STATE_3 = 0
def initializer(test_global_state_1, test_global_state_2, test_global_state_3):
global TEST_GLOBAL_STATE_1, TEST_GLOBAL_STATE_2, TEST_GLOBAL_STATE_3
TEST_GLOBAL_STATE_1 = test_global_state_1
TEST_GLOBAL_STATE_2 = test_global_state_2
TEST_GLOBAL_STATE_3 = test_global_state_3
def after_initializer():
global TEST_GLOBAL_STATE_1, TEST_GLOBAL_STATE_2, TEST_GLOBAL_STATE_3
return TEST_GLOBAL_STATE_1, TEST_GLOBAL_STATE_2, TEST_GLOBAL_STATE_3
@tvm._ffi.register_func("testing.identity_py")
def identity_py(arg):
return arg
def register_ffi():
@tvm._ffi.register_func("testing.nested_identity_py")
def _identity_py(arg): # pylint: disable=unused-variable
return arg
def call_py_ffi(arg):
_identity_py = tvm._ffi.get_global_func("testing.nested_identity_py")
return _identity_py(arg)
def call_cpp_ffi(arg):
return tvm.testing.echo(arg)
def call_cpp_py_ffi(arg):
return tvm.testing.identity_cpp(arg)
def fast_summation(n):
return n * (n + 1) // 2
def slow_summation(n):
r = 0
for i in range(0, n + 1):
r += i
return r
def timeout_job(n):
_ffi_api.sleep_in_ffi(n * 1.5)
| 28.552632
| 79
| 0.760369
| 349
| 2,170
| 4.43553
| 0.34957
| 0.135659
| 0.203488
| 0.072351
| 0.308786
| 0.226744
| 0.193152
| 0.192506
| 0.192506
| 0.192506
| 0
| 0.019316
| 0.164977
| 2,170
| 75
| 80
| 28.933333
| 0.834989
| 0.407834
| 0
| 0.111111
| 0
| 0
| 0.05626
| 0.041204
| 0
| 0
| 0
| 0
| 0
| 1
| 0.305556
| false
| 0
| 0.055556
| 0.138889
| 0.583333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
35f4f027c22ac8a012e378f1d7ce2c9a6a417c6c
| 198
|
py
|
Python
|
api/domain/pubsub_runtimes.py
|
reactivegroup/cloud-runtimes-python
|
33ca715f5a4d89c113223b749624dd86bfa0e957
|
[
"MIT"
] | 1
|
2021-09-18T09:10:55.000Z
|
2021-09-18T09:10:55.000Z
|
api/domain/pubsub_runtimes.py
|
reactivegroup/cloud-runtimes-python
|
33ca715f5a4d89c113223b749624dd86bfa0e957
|
[
"MIT"
] | null | null | null |
api/domain/pubsub_runtimes.py
|
reactivegroup/cloud-runtimes-python
|
33ca715f5a4d89c113223b749624dd86bfa0e957
|
[
"MIT"
] | null | null | null |
from abc import abstractmethod
class PubSubRuntimes(object):
@abstractmethod
def publish_event(self, pubsub_name: str, topic_name: str, data: object, metadata: dict) -> str:
pass
| 22
| 100
| 0.717172
| 24
| 198
| 5.791667
| 0.791667
| 0.100719
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.19697
| 198
| 8
| 101
| 24.75
| 0.874214
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0.2
| 0.2
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
35ffb9ccf66b933739c97f381a78d5d19c8abb30
| 1,613
|
py
|
Python
|
Assignment 1/prostateCancerRisk.py
|
bpan4/comp204
|
fd436cd6b6c52b65d4c503e67673f670e42aaa90
|
[
"PSF-2.0"
] | null | null | null |
Assignment 1/prostateCancerRisk.py
|
bpan4/comp204
|
fd436cd6b6c52b65d4c503e67673f670e42aaa90
|
[
"PSF-2.0"
] | null | null | null |
Assignment 1/prostateCancerRisk.py
|
bpan4/comp204
|
fd436cd6b6c52b65d4c503e67673f670e42aaa90
|
[
"PSF-2.0"
] | null | null | null |
# Belle Pan
# 260839939
history = input("Family history?")
# complete the program by writing your own code here
if history == "No":
print("Low risk")
elif history == "Yes":
ancestry = input("European ancestry?")
if ancestry == "No":
try:
AR_GCCRepeat = int(input("AR_GCC repeat copy number?"))
if AR_GCCRepeat <16 and AR_GCCRepeat >=0:
print("High risk")
elif AR_GCCRepeat >=16:
print("Medium risk")
else:
print("Invalid")
except ValueError:
print("Invalid")
elif ancestry == "Mixed":
try:
AR_GCCRepeat = int(input("AR_GCC repeat copy number?"))
if AR_GCCRepeat <16 and AR_GCCRepeat >=0:
CYP3A4type = input("CYP3A4 haplotype?")
if CYP3A4type == "AA":
print("Medium risk")
elif CYP3A4type == "GA" or CYP3A4type == "AG" or CYP3A4type == "GG":
print("High risk")
else:
print("Invalid")
elif AR_GCCRepeat >=16:
print("Medium risk")
else:
print("Invalid")
except ValueError:
print("Invalid")
elif ancestry == "Yes":
CYP3A4type = input("CYP3A4 haplotype?")
if CYP3A4type == "AA":
print("Low risk")
elif CYP3A4type == "GA" or CYP3A4type == "AG" or CYP3A4type == "GG":
print("High risk")
else:
print("Invalid")
else:
print("Invalid")
else:
print("Invalid")
| 31.019231
| 84
| 0.50093
| 161
| 1,613
| 4.956522
| 0.310559
| 0.110276
| 0.120301
| 0.100251
| 0.759399
| 0.759399
| 0.719298
| 0.719298
| 0.596491
| 0.596491
| 0
| 0.043
| 0.380037
| 1,613
| 51
| 85
| 31.627451
| 0.755
| 0.044017
| 0
| 0.844444
| 0
| 0
| 0.183355
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.355556
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c41604802a45e8c139f0d7e0139dfcf3859e6241
| 128
|
py
|
Python
|
distance/api/paginations.py
|
DeepinSC/Pikachu-Housing
|
453201e19812e356106c071bbf9a306931d14fa7
|
[
"Apache-2.0"
] | 1
|
2019-03-23T18:49:31.000Z
|
2019-03-23T18:49:31.000Z
|
distance/api/paginations.py
|
DeepinSC/Pikachu-Housing
|
453201e19812e356106c071bbf9a306931d14fa7
|
[
"Apache-2.0"
] | null | null | null |
distance/api/paginations.py
|
DeepinSC/Pikachu-Housing
|
453201e19812e356106c071bbf9a306931d14fa7
|
[
"Apache-2.0"
] | null | null | null |
from rest_framework.pagination import PageNumberPagination
class DistancePagination(PageNumberPagination):
page_size = 10
| 21.333333
| 58
| 0.84375
| 12
| 128
| 8.833333
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017699
| 0.117188
| 128
| 5
| 59
| 25.6
| 0.920354
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c41d06dfcfcc224fbbb73a6d8fb363bfafdc1720
| 230
|
py
|
Python
|
lib/pylint/test/functional/redefined_builtin.py
|
willemneal/Docky
|
d3504e1671b4a6557468234c263950bfab461ce4
|
[
"MIT"
] | 3
|
2018-11-25T01:09:55.000Z
|
2021-08-24T01:56:36.000Z
|
lib/pylint/test/functional/redefined_builtin.py
|
willemneal/Docky
|
d3504e1671b4a6557468234c263950bfab461ce4
|
[
"MIT"
] | null | null | null |
lib/pylint/test/functional/redefined_builtin.py
|
willemneal/Docky
|
d3504e1671b4a6557468234c263950bfab461ce4
|
[
"MIT"
] | 3
|
2018-11-09T03:38:09.000Z
|
2020-02-24T06:26:10.000Z
|
"""Tests for redefining builtins."""
def function():
"""Redefined local."""
type = 1 # [redefined-builtin]
print type # pylint: disable=print-statement
# pylint:disable=invalid-name
map = {} # [redefined-builtin]
| 23
| 49
| 0.656522
| 25
| 230
| 6.04
| 0.72
| 0.211921
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005319
| 0.182609
| 230
| 9
| 50
| 25.555556
| 0.797872
| 0.430435
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.25
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c45d4136360910d912dbf79a55f792f8259ec8de
| 3,818
|
py
|
Python
|
rouge_score/languages.py
|
m3hrdadfi/rouge-metric
|
0c8da39bd52891fe328a2555b82d7147c6e423f7
|
[
"Apache-2.0"
] | null | null | null |
rouge_score/languages.py
|
m3hrdadfi/rouge-metric
|
0c8da39bd52891fe328a2555b82d7147c6e423f7
|
[
"Apache-2.0"
] | null | null | null |
rouge_score/languages.py
|
m3hrdadfi/rouge-metric
|
0c8da39bd52891fe328a2555b82d7147c6e423f7
|
[
"Apache-2.0"
] | 1
|
2021-11-05T18:25:09.000Z
|
2021-11-05T18:25:09.000Z
|
languages = {
"aa": "0-9a-z",
"ab": "0-9a-z",
"ae": "0-9a-z",
"af": "0-9a-z",
"ak": "0-9a-z",
"am": "0-9a-z",
"an": "0-9a-z",
"ar": "0-9a-z",
"as": "0-9a-z",
"av": "0-9a-z",
"ay": "0-9a-z",
"az": "0-9a-z",
"ba": "0-9a-z",
"be": "0-9a-z",
"bg": "0-9a-z",
"bh": "0-9a-z",
"bi": "0-9a-z",
"bm": "0-9a-z",
"bn": "0-9a-z",
"bo": "0-9a-z",
"br": "0-9a-z",
"bs": "0-9a-z",
"ca": "0-9a-z",
"ce": "0-9a-z",
"ch": "0-9a-z",
"co": "0-9a-z",
"cr": "0-9a-z",
"cs": "0-9a-z",
"cu": "0-9a-z",
"cv": "0-9a-z",
"cy": "0-9a-z",
"da": "0-9a-z",
"de": "0-9a-z",
"dv": "0-9a-z",
"dz": "0-9a-z",
"ee": "0-9a-z",
"el": "0-9a-z",
"en": "0-9a-z",
"eo": "0-9a-z",
"es": "0-9a-z",
"et": "0-9a-zäöõüšž",
"eu": "0-9a-z",
"fa": "0-9a-z۰۱۲۳۴۵۶۷۸۹ءآئابتثجحخدذرزسشصضطظعغفقلمنهوپچژکگیە\u200c",
"ff": "0-9a-z",
"fi": "0-9a-z",
"fj": "0-9a-z",
"fo": "0-9a-z",
"fr": "0-9a-z",
"fy": "0-9a-z",
"ga": "0-9a-záéíóú",
"gd": "0-9a-z",
"gl": "0-9a-z",
"gn": "0-9a-z",
"gu": "0-9a-z",
"gv": "0-9a-z",
"ha": "0-9a-z",
"he": "0-9a-z",
"hi": "0-9a-z",
"ho": "0-9a-z",
"hr": "0-9a-z",
"ht": "0-9a-z",
"hu": "0-9a-z",
"hy": "0-9a-z",
"hz": "0-9a-z",
"ia": "0-9a-z",
"id": "0-9a-z",
"ie": "0-9a-z",
"ig": "0-9a-z",
"ii": "0-9a-z",
"ik": "0-9a-z",
"io": "0-9a-z",
"is": "0-9a-zádðéíóúýþæö",
"it": "0-9a-z",
"iu": "0-9a-z",
"ja": "0-9a-z",
"jv": "0-9a-z",
"ka": "0-9a-zაბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰ",
"kg": "0-9a-z",
"ki": "0-9a-z",
"kj": "0-9a-z",
"kk": "0-9a-z",
"kl": "0-9a-z",
"km": "0-9a-z",
"kn": "0-9a-z",
"ko": "0-9a-z",
"kr": "0-9a-z",
"ks": "0-9a-z",
"ku": "0-9a-z",
"kv": "0-9a-z",
"kw": "0-9a-z",
"ky": "0-9a-z",
"la": "0-9a-z",
"lb": "0-9a-z",
"lg": "0-9a-z",
"li": "0-9a-z",
"ln": "0-9a-z",
"lo": "0-9a-z",
"lt": "0-9a-ząčęėįšųūž",
"lu": "0-9a-z",
"lv": "0-9a-z",
"mg": "0-9a-z",
"mh": "0-9a-z",
"mi": "0-9a-z",
"mk": "0-9a-z",
"ml": "0-9a-z",
"mn": "0-9a-z",
"mr": "0-9a-z",
"ms": "0-9a-z",
"mt": "0-9a-z",
"my": "0-9a-z",
"na": "0-9a-z",
"nb": "0-9a-z",
"nd": "0-9a-z",
"ne": "0-9a-z",
"ng": "0-9a-z",
"nl": "0-9a-z",
"nn": "0-9a-z",
"no": "0-9a-z",
"nr": "0-9a-z",
"nv": "0-9a-z",
"ny": "0-9a-z",
"oc": "0-9a-z",
"oj": "0-9a-z",
"om": "0-9a-z",
"or": "0-9a-z",
"os": "0-9a-z",
"pa": "0-9a-z",
"pi": "0-9a-z",
"pl": "0-9a-z",
"ps": "0-9a-z",
"pt": "0-9a-z",
"qu": "0-9a-z",
"rm": "0-9a-z",
"rn": "0-9a-z",
"ro": "0-9a-z",
"ru": "0-9a-z",
"rw": "0-9a-z",
"sa": "0-9a-z",
"sc": "0-9a-z",
"sd": "0-9a-z",
"se": "0-9a-z",
"sg": "0-9a-z",
"si": "0-9a-z",
"sk": "0-9a-z",
"sl": "0-9a-z",
"sm": "0-9a-z",
"sn": "0-9a-z",
"so": "0-9a-z",
"sq": "0-9a-z",
"sr": "0-9a-z",
"ss": "0-9a-z",
"st": "0-9a-z",
"su": "0-9a-z",
"sv": "0-9a-z",
"sw": "0-9a-z",
"ta": "0-9a-z",
"te": "0-9a-z",
"tg": "0-9a-z",
"th": "0-9a-z",
"ti": "0-9a-z",
"tk": "0-9a-z",
"tl": "0-9a-z",
"tn": "0-9a-z",
"to": "0-9a-z",
"tr": "0-9a-zçğüöşı",
"ts": "0-9a-z",
"tt": "0-9a-z",
"tw": "0-9a-z",
"ty": "0-9a-z",
"ug": "0-9a-z",
"uk": "0-9a-z",
"ur": "0-9a-z",
"uz": "0-9a-z",
"ve": "0-9a-z",
"vi": "0-9a-z",
"vo": "0-9a-z",
"wa": "0-9a-z",
"wo": "0-9a-z",
"xh": "0-9a-z",
"yi": "0-9a-z",
"yo": "0-9a-z",
"za": "0-9a-z",
"zh": "0-9a-z",
"zu": "0-9a-z",
}
| 20.417112
| 71
| 0.323206
| 738
| 3,818
| 1.672087
| 0.265583
| 0.447326
| 0.573744
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.14059
| 0.290204
| 3,818
| 186
| 72
| 20.526882
| 0.31476
| 0
| 0
| 0
| 0
| 0
| 0.417496
| 0.025406
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 1
| 1
| 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
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c47e825d3f5f7826ed3524f91fbde62f43895219
| 207
|
py
|
Python
|
blog_categorias/models.py
|
ProjetoHavoc/Prometheus
|
244d0cd05ad11844640cac860975eb177197f2db
|
[
"MIT"
] | null | null | null |
blog_categorias/models.py
|
ProjetoHavoc/Prometheus
|
244d0cd05ad11844640cac860975eb177197f2db
|
[
"MIT"
] | null | null | null |
blog_categorias/models.py
|
ProjetoHavoc/Prometheus
|
244d0cd05ad11844640cac860975eb177197f2db
|
[
"MIT"
] | null | null | null |
from django.db import models
# Create your models here.
class Categoria(models.Model):
nome_categoria = models.CharField(max_length=50)
def __str__(self):
return self.nome_categoria
| 17.25
| 52
| 0.714976
| 27
| 207
| 5.222222
| 0.740741
| 0.212766
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.012195
| 0.207729
| 207
| 12
| 53
| 17.25
| 0.847561
| 0.115942
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 1
| 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
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
671036899b4ffd36de45f5618cb8964b3171c0fd
| 63
|
py
|
Python
|
quickstart-jython/src/main/java/org/quickstart/jython/simple_python.py
|
youngzil/quickstart-framework
|
5252ab4ffe089461969ed54420d3f9f8980baa03
|
[
"Apache-2.0"
] | 6
|
2019-01-02T11:02:38.000Z
|
2021-01-30T16:35:20.000Z
|
quickstart-jython/src/main/java/org/quickstart/jython/simple_python.py
|
youngzil/quickstart-framework
|
5252ab4ffe089461969ed54420d3f9f8980baa03
|
[
"Apache-2.0"
] | 31
|
2019-11-13T02:06:18.000Z
|
2022-03-31T20:51:49.000Z
|
quickstart-jython/src/main/java/org/quickstart/jython/simple_python.py
|
youngzil/quickstart-framework
|
5252ab4ffe089461969ed54420d3f9f8980baa03
|
[
"Apache-2.0"
] | 3
|
2018-07-10T15:08:02.000Z
|
2020-09-02T06:48:07.000Z
|
# coding=utf-8
print("Do simple thing in Python")
print("输出中文")
| 21
| 34
| 0.714286
| 11
| 63
| 4.090909
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017857
| 0.111111
| 63
| 3
| 35
| 21
| 0.785714
| 0.190476
| 0
| 0
| 0
| 0
| 0.58
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 0
| 0
| 0
| 1
|
0
| 4
|
6727a0ee8cec417a517d138805d39200210de497
| 206
|
py
|
Python
|
tests/__init__.py
|
SamTheisens/kawalc1
|
c0189c04d130680e51ca4396794c735bd51cf258
|
[
"MIT"
] | 14
|
2019-04-07T08:04:15.000Z
|
2019-11-03T08:27:51.000Z
|
tests/__init__.py
|
kawalc1/kawalc1
|
6963f7f3f93e7ab897dfcda265c9dd3b12433f18
|
[
"MIT"
] | 22
|
2019-03-25T05:27:12.000Z
|
2020-08-17T22:13:19.000Z
|
tests/__init__.py
|
kawalc1/kawalc1
|
6963f7f3f93e7ab897dfcda265c9dd3b12433f18
|
[
"MIT"
] | 1
|
2019-04-07T16:18:33.000Z
|
2019-04-07T16:18:33.000Z
|
import os
import sys
def setup_django_settings():
os.chdir(os.path.join(os.path.dirname(__file__), "."))
sys.path.insert(0, os.getcwd())
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
| 25.75
| 59
| 0.703883
| 30
| 206
| 4.566667
| 0.6
| 0.20438
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.005556
| 0.126214
| 206
| 7
| 60
| 29.428571
| 0.755556
| 0
| 0
| 0
| 0
| 0
| 0.179612
| 0.106796
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| true
| 0
| 0.333333
| 0
| 0.5
| 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
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
6779846993406e1ba44fe075efeee7b2a987f885
| 99
|
py
|
Python
|
ckOLDab/python_CGI_tests/cgi_error_handling_using_cgitb_module.py
|
stephaneAG/Python_tests
|
dc0a8819b4f49f50f17b3ffcf009c082535e1dbe
|
[
"MIT"
] | null | null | null |
ckOLDab/python_CGI_tests/cgi_error_handling_using_cgitb_module.py
|
stephaneAG/Python_tests
|
dc0a8819b4f49f50f17b3ffcf009c082535e1dbe
|
[
"MIT"
] | null | null | null |
ckOLDab/python_CGI_tests/cgi_error_handling_using_cgitb_module.py
|
stephaneAG/Python_tests
|
dc0a8819b4f49f50f17b3ffcf009c082535e1dbe
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
print "Content-Type: text/html"
print
import cgitb; cgitb.enable()
print 1/0
| 16.5
| 31
| 0.737374
| 17
| 99
| 4.294118
| 0.823529
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.022727
| 0.111111
| 99
| 5
| 32
| 19.8
| 0.806818
| 0.20202
| 0
| 0
| 0
| 0
| 0.294872
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.25
| null | null | 0.75
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
67bd0b259ea3b42b3e39f64086a57c2ab734b82a
| 221
|
py
|
Python
|
src/model/unit.py
|
jpchagas/xepa-service
|
bd4f09f427ede789be5d94fca522b0d50b6f0ef7
|
[
"Apache-2.0"
] | null | null | null |
src/model/unit.py
|
jpchagas/xepa-service
|
bd4f09f427ede789be5d94fca522b0d50b6f0ef7
|
[
"Apache-2.0"
] | null | null | null |
src/model/unit.py
|
jpchagas/xepa-service
|
bd4f09f427ede789be5d94fca522b0d50b6f0ef7
|
[
"Apache-2.0"
] | null | null | null |
from sqlalchemy import Column, Integer, String
from src.model.base import Base
class Unit(Base):
__tablename__ = 'unit'
id = Column(Integer, primary_key=True)
description = Column(String(50), nullable=False)
| 27.625
| 52
| 0.737557
| 29
| 221
| 5.448276
| 0.689655
| 0.164557
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010811
| 0.162896
| 221
| 8
| 52
| 27.625
| 0.843243
| 0
| 0
| 0
| 0
| 0
| 0.018018
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
67be909187ab06d8ace2e501e9209f593d971eb4
| 64
|
py
|
Python
|
aws_lambda_powertools/utilities/__init__.py
|
Sordie/aws-lambda-powertools-python
|
12c512b78b8830bf2ed09e35d640df14afacfc1a
|
[
"Apache-2.0"
] | 1,208
|
2020-05-20T19:06:29.000Z
|
2022-03-30T14:17:47.000Z
|
aws_lambda_powertools/utilities/__init__.py
|
Sordie/aws-lambda-powertools-python
|
12c512b78b8830bf2ed09e35d640df14afacfc1a
|
[
"Apache-2.0"
] | 859
|
2020-05-22T09:59:54.000Z
|
2022-03-31T08:31:30.000Z
|
aws_lambda_powertools/utilities/__init__.py
|
Sordie/aws-lambda-powertools-python
|
12c512b78b8830bf2ed09e35d640df14afacfc1a
|
[
"Apache-2.0"
] | 163
|
2020-05-18T21:08:25.000Z
|
2022-03-28T12:03:37.000Z
|
# -*- coding: utf-8 -*-
"""General utilities for Powertools"""
| 16
| 38
| 0.609375
| 7
| 64
| 5.571429
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018519
| 0.15625
| 64
| 3
| 39
| 21.333333
| 0.703704
| 0.859375
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
67dc4820ca074b076dfaade76b065ef0da42926f
| 20,513
|
py
|
Python
|
pws/tests.py
|
t-web/google-web-search
|
849987eb9968217d3dc1b860de68948e6e9ca7d1
|
[
"MIT"
] | 83
|
2015-02-06T00:41:05.000Z
|
2021-01-29T14:14:20.000Z
|
pws/tests.py
|
t-web/google-web-search
|
849987eb9968217d3dc1b860de68948e6e9ca7d1
|
[
"MIT"
] | 23
|
2015-01-03T05:45:36.000Z
|
2019-10-08T17:45:24.000Z
|
pws/tests.py
|
t-web/google-web-search
|
849987eb9968217d3dc1b860de68948e6e9ca7d1
|
[
"MIT"
] | 36
|
2015-07-07T06:08:54.000Z
|
2021-01-24T04:40:54.000Z
|
from bs4 import BeautifulSoup
from bing import Bing
from google import Google
import unittest
BING_SEARCH_RESULT = [
{'link': 'http://en.wikipedia.org/wiki/Hello_world_program', 'link_text': '" Hello, world !" program - Wikipedia, the free encyclopedia', 'additional_links': {'Purpose': 'http://en.wikipedia.org/wiki/Hello_world_program#Purpose', 'History': 'http://en.wikipedia.org/wiki/Hello_world_program#History', 'Variations': 'http://en.wikipedia.org/wiki/Hello_world_program#Variations'}, 'link_info': 'A " Hello, world !" program is a computer program that outputs " Hello, World !" (or some variant thereof) on a display device. Because it is typically one of the ...'},
{'link': 'https://www.hello-world.com/', 'link_text': 'Total immersion, Serious fun! with Hello-World !', 'additional_links': {}, 'link_info': 'Main index for hello-world : links to login and all of the languages'},
{'link': 'http://www.helloworld.com/', 'link_text': 'HelloWorld Inc - Official Site', 'additional_links': {}, 'link_info': 'Wayman joins senior leadership team. Meet Chris, Chief Client Officer, and learn about this new role at HelloWorld .'},
{'link': 'http://www.helloworldchennai.com/', 'link_text': 'Hello World', 'additional_links': {}, 'link_info': 'A leading chain of mobile stores in Chennai , Hello World , founded in 1999, caters to all cellular needs of todays informed buyer.'},
{'link': 'http://en.wikipedia.org/wiki/List_of_Hello_world_program_examples', 'link_text': 'List of Hello world program examples - Wikipedia, the free ...', 'additional_links': {}, 'link_info': 'The Hello world program is a simple computer program that prints (or displays) the string " Hello, world !" or some variant thereof. It is typically one of ...'},
{'link': 'http://www.youtube.com/watch?v=al2DFQEZl4M', 'link_text': 'Lady Antebellum - Hello World - YouTube', 'additional_links': {}, 'link_info': '05-11-2010 · Music video by Lady Antebellum performing Hello World on You Tube.'},
{'link': 'http://www.gnu.org/fun/jokes/helloworld.html', 'link_text': 'Hello World ! - GNU Project - Free Software Foundation (FSF)', 'additional_links': {}, 'link_info': 'Hello World ! How the way people code “ Hello World ” varies depending on their age and job: High School/Jr. High 10 PRINT " HELLO WORLD " 20 END'},
{'link': 'http://msdn.microsoft.com/en-us/library/ms765388(v=vs.85).aspx', 'link_text': 'Hello, World ! (XSLT)', 'additional_links': {}, 'link_info': 'The following example shows a simple but complete XML document transformed by an XSLT style sheet. The source XML document, hello .xml, contains a " Hello, World !"'},
{'link': 'http://asp.net-tutorials.com/basics/hello-world/', 'link_text': 'Hello, world ! - The complete ASP.NET Tutorial', 'additional_links': {}, 'link_info': 'In almost every programming tutorial you will find the classic " Hello, world !" example, and who am I to break such a fine tradition? Let me show you how you can say ...'},
{'link': 'http://www.helloworldchennai.com/branches.asp', 'link_text': 'Hello World', 'additional_links': {}, 'link_info': 'HELLO WORLD . Basement Shop #2, Gokul Arcade, #2, Sardar Patel Road, Adyar, Chennai - 20 Ph: 044 - 24425573 / 42115215'}
]
BING_NEWS_RESULT = [
{'source': 'ABP NEWS', 'link': 'http://www.abplive.in/incoming/2014/12/18/article457398.ece/Stopzzzzz', 'time': '18-12-2014', 'additional_links': {}, 'link_info': 'Hello world I am a test page and I am being worked upon by an ace developer A.K.S Hello world I am a test page and I am being worked upon by an ace developer A.K.S Hello world I am a test page and I am being worked upon by an ace developer A.K.S …', 'link_text': 'This is the new article'},
{'source': 'The Hindu', 'link': 'http://www.thehindu.com/todays-paper/tp-features/tp-youngworld/say-hello-to-chikkanna-and-thimmakka/article6746498.ece', 'time': '14 hours ago', 'additional_links': {}, 'link_info': 'Fifty years ago, Chikkanna and Thimmakka decided to plant trees. Today, we have a long tree-lined stretch of road. D o ask your parents to take you to the road between Kudur and Hulikal in Karnataka. Get down and …', 'link_text': 'Say HELLO to… Chikkanna and Thimmakka'},
{'source': 'India Today', 'link': 'http://indiatoday.intoday.in/story/hello-airtel-charging-extra-for-internet-calls-is-silly-business/1/408983.html', 'time': '26-12-2014', 'additional_links': {}, 'link_info': 'Just like almost all other telecom companies in the world , Airtel sees the internet as a business opportunity but also loathes it for providing people choices in the communication business, choices that allow people to …', 'link_text': 'Hello Airtel, charging extra for internet calls is silly business'},
{'source': 'Game Dynamo', 'link': 'http://www.gamedynamo.com/company/info/719/hello_games', 'time': '1 day ago', 'additional_links': {}, 'link_info': 'Hello Games was founded in 2009 by a band of four friends who ... They decided to set forth on a brave journey of discovery and adventure to bring some new, funky-colored pixels to the world . They have loved every minute of helping to create great games ...', 'link_text': 'Hello Games'},
{'source': 'The Hindu', 'link': 'http://www.thehindu.com/features/magazine/travel-to-hawaii/article6730641.ece', 'time': '29-12-2014', 'additional_links': {}, 'link_info': 'During the ‘big wave’ season from November through March, huge glassy waves attract surfers from all over the world . The North Shore hosts the world ’s elite surfing competitions during this time. Kawaika tells me that I am welcome to hire a board and ...', 'link_text': 'Hello , Hawaii'},
{'source': 'NDTV', 'link': 'http://www.ndtv.com/article/offbeat/look-who-just-turned-114-say-hello-to-the-world-s-oldest-crocodile-635841?ndtv_prevstory', 'time': '17-12-2014', 'additional_links': {}, 'link_info': 'Johannesburg: Henry, the world \'s oldest crocodile, turned 114 Tuesday and will be the star at a birthday bash with balloons and cake for all well-wishers. Henry\'s party is being held at "Crocworld" in the South African city of Scottsburgh where employees ...', 'link_text': "Look Who Just Turned 114! Say Hello to the World 's Oldest Crocodile"},
{'source': 'Yahoo Finance India', 'link': 'https://in.finance.yahoo.com/news/10-most-important-things-world-084400042.html', 'time': '29-12-2014', 'additional_links': {}, 'link_info': "Hello ! Here's what you need to know for Monday ... More From Business Insider The 10 Most Important Things In The World Right Now The 10 Most Important Things In The World Right Now 10 NFL Games Have Playoff …", 'link_text': 'The 10 Most Important Things In The World Right Now'},
{'source': 'Crazy Engineers', 'link': 'http://www.crazyengineers.com/threads/hello-ceans.77650/', 'time': '08-12-2014', 'additional_links': {}, 'link_info': 'dia-project-report-contest.77548/#post-332822 I really liked the ideas of this website and congratulate the initiators for such a mind-blowing effort to make engineers crazy enough to do things that matter to the world . Please go through my project from ...', 'link_text': 'HELLO CEans'},
{'source': 'India Today', 'link': 'http://indiatoday.intoday.in/story/2014-redux-best-gadgets-phones-apps-and-more/1/410449.html', 'time': '29-12-2014', 'additional_links': {}, 'link_info': 'This is it, folks. The year 2014 is over and day after tomorrow we will be saying hello to 2015. So how was the year 2014 in the world of technology? Incremental is one word that summarizes the year. We got some …', 'link_text': '2014 redux: 10 best gadgets, top smartphones, apps, and more'},
{'source': 'Andhra News', 'link': 'http://www.andhranews.net/Intl/Web/23-66.asp', 'time': '20-12-2014', 'additional_links': {}, 'link_info': 'The "Flyer App" is here to solve exactly this problem: Suitable information from all over the world , on a vast range of topics, precisely when you need it, all in one compact app. Quickly and easily search for something or browse in clearly arranged ...', 'link_text': 'New Search App: Goodbye Paper Flyers - hello Flyer App'}
]
GOOGLE_SEARCH_RESULT = [
{'additional_links': {'99 Bottles of Beer': 'http://en.wikipedia.org/wiki/99_Bottles_of_Beer&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CBoQ0gIoATAA&usg=AFQjCNHZPaTfYq-2nk39QTs4tGzCysQDMQ', 'List of Hello world program': 'http://en.wikipedia.org/wiki/List_of_Hello_world_program_examples&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CBkQ0gIoADAA&usg=AFQjCNETvyLmNFYslrfVpeXNVqjsiQImuQ', 'Just another Perl hacker': 'http://en.wikipedia.org/wiki/Just_another_Perl_hacker&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CBsQ0gIoAjAA&usg=AFQjCNHFa8c-nbLhQiMWHylFRC8P0Cmngg'}, 'link': 'http://en.wikipedia.org/wiki/%2522Hello,_world!%2522_program&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CBQQFjAA&usg=AFQjCNEDKRIU3IRETmNGWNFItE2V5Cs4Wg', 'link_text': '" Hello , world !" program - Wikipedia, the free encyclopedia', 'link_info': 'A " Hello , World !" program is a computer program that outputs " Hello , World !" (or some variant thereof) on a display device. Because it is typically one of the ...'},
{'additional_links': {'Travel deals': 'http://www.helloworld.com.au/deals/dealshome/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CCQQ0gIoATAB&usg=AFQjCNGbvJ0CBxWE_xiGzTZZ15aC_Bs7Mw', 'Cruises': 'http://cruise.helloworld.com.au/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CCUQ0gIoAjAB&usg=AFQjCNGnJy4PLaLbcsswUeUvz787zWmwhg', 'Agent Finder': 'http://agents.helloworld.com.au/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CCYQ0gIoAzAB&usg=AFQjCNECITukSSykPh7gP1rMITD-9I_C9w', 'Cheap Flights': 'http://www.helloworld.com.au/flights/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CCMQ0gIoADAB&usg=AFQjCNHNVkEQ_OLG17iczsNEo2GLFppVjw'}, 'link': 'http://www.helloworld.com.au/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CB0QFjAB&usg=AFQjCNEG87ayXffDjmKhEEC9IKoMCWhTMw', 'link_text': 'helloworld – Deals on Accommodation, Flights, Cruises and More', 'link_info': "Discover the best deals on flights, hotels, cars, cruises in Australia at helloworld – we're always here for you – in stores, online and on the phone!"},
{'additional_links': {}, 'link': 'http://www.helloworld.com/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CCgQFjAC&usg=AFQjCNEM2X_hQjMDo_0BQNI0BUuWk5KTXg', 'link_text': 'Digital, Social, Mobile Marketing | HelloWorld', 'link_info': 'Rich engagement platform empowers marketers to motivate and measure consumer behavior through promotions, loyalty solutions and mobile messaging.'},
{'additional_links': {}, 'link': 'http://www.hello-world.com/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CC4QFjAD&usg=AFQjCNE0XtCiJWQvDxg4ZzeeeDhjvv4y4g', 'link_text': 'Total immersion, Serious fun! with Hello - World !', 'link_info': 'Main index for hello - world : links to login and all of the languages.'},
{'additional_links': {}, 'link': 'http://www.roesler-ac.de/wolfram/hello.htm&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CDQQFjAE&usg=AFQjCNGAd8wnUN_j_8tryNqEzSZSwGJCHQ', 'link_text': 'The Hello World Collection - www.roesler-ac.de!', 'link_info': 'The Collection without Frames.'},
{'additional_links': {}, 'link': 'https://guides.github.com/activities/hello-world/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CDoQFjAF&usg=AFQjCNHbqJxhpcu0TNU3_rsPulqw1vP7qA', 'link_text': 'Hello World · GitHub Guides', 'link_info': "The Hello World project is a time-honored tradition in computer programming. It is a simple exercise that gets you started when learning something new. Let's get ..."},
{'additional_links': {}, 'link': 'http://groups.engin.umd.umich.edu/CIS/course.des/cis400/c/hworld.html&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CD8QFjAG&usg=AFQjCNGm6mpXL-jiDK6ZQ5cT4yghl_Zozw', 'link_text': 'The C Programming Language: Hello world ! Example Program', 'link_info': 'The C Programming Language. Hello world ! Example Program. /* Hello World program */ #include<stdio.h> main() { printf(" Hello World ");. } [Back] [Home]'},
{'additional_links': {}, 'link': 'https://www.gnu.org/fun/jokes/helloworld.html&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CEUQFjAH&usg=AFQjCNGjXwbD5f2V5uihJNtii70HC6mzSA', 'link_text': 'Hello World ! - GNU Project - Free Software Foundation (FSF)', 'link_info': "Hello World ! How the way people code “ Hello World ” varies depending on their age and job: ... program Hello(input, output) begin writeln(' Hello World ') end."},
{'additional_links': {}, 'link': 'https://www.facebook.com/helloworldau&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CEoQFjAI&usg=AFQjCNEX2lPt3dLaq6jUfpU714QwE_BRpQ', 'link_text': 'helloworld - Travel Agency | Facebook', 'link_info': 'helloworld . 107003 likes · 8742 talking about this. Welcome to the official Facebook page for helloworld . Ask us a question or "Like" us for travel...'},
{'additional_links': {}, 'link': 'http://www.helloworldlimited.com.au/&sa=U&ei=pA6kVIHiMtD28QWSr4DoBQ&ved=0CFAQFjAJ&usg=AFQjCNE9DMTnoxnwCh3FgcwqAPi1nPUyUg', 'link_text': 'Helloworld Limited > Home', 'link_info': 'Helloworld Limited. Home. About Us; Brands; Investor Centre; Opportunities; Contact us · Share Price. Copyright © 2013 Helloworld Limited. Login.'}
]
GOOGLE_NEWS_RESULT = [
{'link': 'http://www.directlyrics.com/kid-ink-hello-world-music-video-news.html&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CBMQqQIoADAB&usg=AFQjCNHZCZBM9HbRDjZPMcDwSpHL08oaXA', 'link_text': "Kid Ink - ' Hello World ' [Music Video]", 'additional_links': {'Kid Ink \x96 \x93 Hello World \x94 (Video)': ('/url?q=http://allhiphop.com/2015/01/01/kid-ink-hello-world-video/&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CBYQ-AsoATAB&usg=AFQjCNHqprZiqId_X_J-NLyYRHorUYFv0Q', 'AllHipHop'), "Kid Ink Shares Globe-Spanning ' Hello World ' Music Video [WATCH]": ('/url?q=http://www.musictimes.com/articles/22570/20141231/kid-ink-globe-spanning-hello-world-music-video.htm&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CBUQ-AsoADAB&usg=AFQjCNEM1EcBBGYTmnm8SAmClTYZL0x70g', 'Music Times')}, 'link_info': "In his latest visual release ' Hello World ', the Los Angeles rapper recaps his adventures all throughout the year into a three minute clip directed ...", 'time': '1 day ago', 'source': 'Music and Lyrics'},
{'link': 'http://www.staplesworld.com/news/2015-01-01/Life_Currents/Hello_World.html&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CBkQqQIoADAC&usg=AFQjCNHNGs71QQ9onauWedVdbgULEK_v9Q', 'link_text': 'Hello World', 'additional_links': {}, 'link_info': 'BIRTHS REPORTED AT LAKEWOOD HEALTH SYSTEM HOSPITAL INCLUDED: Born to Bryan and Kripa Reese of Staples, a baby girl, ...', 'time': '2 days ago', 'source': 'Staples World (subscription)'},
{'link': 'https://medium.com/backchannel/hello-world-cf8dd6fcb7f7&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CBsQqQIoADAD&usg=AFQjCNEXjijyJV3AHgIEagz0wyyOF0TBvQ', 'link_text': 'Hello , World !', 'additional_links': {}, 'link_info': 'You may even be able to work out, more or less, what this little \x93Program\x94 does: it writes to the console of some system the line \x93 Hello , world !\x94 A geek hunched ...', 'time': '19 Dec 2014', 'source': 'Backchannel'},
{'link': 'http://www.osnews.com/story/28131/The_infamous_Windows_Hello_World_program&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CB4QqQIoADAE&usg=AFQjCNFhKJJwlNS2dTP2soFiX1Gc0iatKw', 'link_text': 'The infamous Windows " Hello World " program', 'additional_links': {}, 'link_info': 'I learned Windows programming from documents included with the Windows 1.0 beta and release Software Development Kits. These included ...', 'time': '9 Dec 2014', 'source': 'OS News'},
{'link': 'http://www.fool.com.au/2014/12/12/helloworld-ltd-surges-on-positive-new-should-you-bet-on-it-for-2015/&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CCAQqQIoADAF&usg=AFQjCNHu2J_8HgVDvsQTsG5QLaIZSCxX7Q', 'link_text': 'Helloworld Ltd surges on positive new: Should you bet on it for 2015?', 'additional_links': {}, 'link_info': 'Helloworld Ltd (ASX: HLO) shares have skyrocketed today after the company announced that one of its subsidiaries, QBT Limited, had been ...', 'time': '11 Dec 2014', 'source': 'Motley Fool Australia'},
{'link': 'http://mumbrella.com.au/travel-firm-helloworld-appoints-marketer-jane-mckellar-new-board-member-268338&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CCQQqQIoADAG&usg=AFQjCNE7SvfNPq3rC_j3OSFydFJjYRkLJg', 'link_text': 'Travel firm Helloworld appoints marketer Jane McKellar as new ...', 'additional_links': {}, 'link_info': 'Helloworld Limited (ASX:HLO) is pleased to announce the appointment of Ms Jane McKellar as an independent Non-Executive Director ...', 'time': '16 Dec 2014', 'source': 'MuMbrella'},
{'link': 'http://www.fool.com.au/2014/12/11/cover-more-group-ltd-and-helloworld-ltd-announce-positive-news-should-you-buy/&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CCgQqQIoADAH&usg=AFQjCNGSA-g_H9sPhTQA6yP_FCFvKVp1Cw', 'link_text': 'Cover-More Group Ltd and Helloworld Ltd announce positive news ...', 'additional_links': {'Cover-More beats competition for Helloworld preferred status': ('/url?q=http://www.travelweekly.com.au/news/cover-more-beats-competition-for-helloworld-prefer&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CCoQ-AsoADAH&usg=AFQjCNHu3l7KaLX-nsVbNn5zq_4HMJXksw', 'Travel Weekly')}, 'link_info': 'Cover-More Group Ltd (ASX: CVO) and Helloworld Ltd (ASX: HLO) have reached an agreement which will see Cover-More become the ...', 'time': '10 Dec 2014', 'source': 'Motley Fool Australia'},
{'link': 'http://www.nbcnews.com/news/world/hello-2015-new-year-rung-around-world-n277466&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CC0QqQIoADAI&usg=AFQjCNF1_XGw55g3JMJKF4wPPeFxNbMpQw', 'link_text': 'Hello , 2015! A New Year Is Rung In Around the World', 'additional_links': {"New Year's Eve: Watch the world ring in 2015": ('/url?q=http://www.haaretz.com/news/world/1.634707&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CDAQ-AsoATAI&usg=AFQjCNHqeKXiTua-zmUVxl3GZ7I7eE7ugw', 'Haaretz'), 'World rings in New Year': ('/url?q=http://www.reuters.com/video/2014/12/31/world-rings-in-new-year%3FvideoId%3D357271665&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CC8Q-AsoADAI&usg=AFQjCNHAfLrPCH4PQFYLnDgeodfZ8V2MlA', 'Reuters'), 'Hello , 2015! See New Year Celebrations Around the World': ('/url?q=http://www.bayoubuzz.com/top-stories/item/808469-hello-2015-see-new-year-celebrations-around-the-world&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CDEQ-AsoAjAI&usg=AFQjCNEYiPZtAz0xKqrGruII02BXU59z4A', 'Bayoubuzz')}, 'link_info': 'MUNICH, Germany \x97 Neo-Nazis are keeping their black combat boots and bomber jackets in the closet as they try to force their way into mainstream German ...', 'time': '1 day ago', 'source': 'NBCNews.com'},
{'link': 'http://www.dailymercury.com.au/news/helloworlds-alyce-best-in-australia/2486084/&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CDQQqQIoADAJ&usg=AFQjCNFDbOrVHdyoebQJInpYl2I_Z9djTQ', 'link_text': "Helloworld's Alyce best in Australia", 'additional_links': {}, 'link_info': 'Head of helloworld -branded network Julie Primmer, Team Spirit Award winner Alyce Tweddle and event host Stevie Jacobs from the Today ...', 'time': '15 Dec 2014', 'source': 'Mackay Daily Mercury'},
{'link': 'http://www.mediapost.com/publications/article/240253/helloworld-mellow-mushroom-stella-artois-launch.html&sa=U&ei=3QGnVKerC9CouQTY1oC4Dg&ved=0CDcQqQIoADAK&usg=AFQjCNFYKt6wpBUqJjymlKdTIj2cOXXTCA', 'link_text': 'HelloWorld , Mellow Mushroom, Stella Artois Launch Holiday ...', 'additional_links': {}, 'link_info': 'Mellow Mushroom, digital agency HelloWorld and beer brand Stella Artois are sponsoring a sweepstakes where customers can follow Mellow ...', 'time': '16 Dec 2014', 'source': 'MediaPost Communications'}
]
class BingTest(unittest.TestCase):
def test_bing_scrape_search_result(self):
with open('ipbing') as fp:
bing_search_result = Bing.scrape_search_result(BeautifulSoup(fp))
self.assertEqual(BING_SEARCH_RESULT, bing_search_result)
def test_bing_scrape_news_result(self):
with open('ipbingnews') as fp:
bing_news_result = Bing.scrape_news_result(BeautifulSoup(fp))
self.assertEqual(BING_NEWS_RESULT, bing_news_result)
def test_google_scrape_search_result(self):
with open('ipgoogle') as fp:
google_search_result = Google.scrape_search_result(BeautifulSoup(fp))
self.assertEqual(GOOGLE_SEARCH_RESULT, google_search_result)
def test_google_scrape_news_result(self):
with open('ipgooglenews') as fp:
google_news_result = Google.scrape_news_result(BeautifulSoup(fp))
self.assertEqual(GOOGLE_NEWS_RESULT, google_news_result)
if __name__ == '__main__':
unittest.main()
| 253.246914
| 1,199
| 0.746112
| 2,904
| 20,513
| 5.196625
| 0.307851
| 0.043735
| 0.042807
| 0.039626
| 0.371612
| 0.273541
| 0.209463
| 0.181963
| 0.129746
| 0.099132
| 0
| 0.042267
| 0.11422
| 20,513
| 81
| 1,200
| 253.246914
| 0.786846
| 0
| 0
| 0
| 0
| 1.056338
| 0.837331
| 0.002194
| 0
| 0
| 0
| 0
| 0.056338
| 1
| 0.056338
| false
| 0
| 0.070423
| 0
| 0.140845
| 0.028169
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
67e3836531172c3b84273220d64a258a4245799e
| 62
|
py
|
Python
|
src/processor/raw/__init__.py
|
lcwong0928/hitlads
|
d4bfb12c3aee662f68071ca89fb35ad67cb097c0
|
[
"MIT"
] | null | null | null |
src/processor/raw/__init__.py
|
lcwong0928/hitlads
|
d4bfb12c3aee662f68071ca89fb35ad67cb097c0
|
[
"MIT"
] | null | null | null |
src/processor/raw/__init__.py
|
lcwong0928/hitlads
|
d4bfb12c3aee662f68071ca89fb35ad67cb097c0
|
[
"MIT"
] | null | null | null |
from .nasa import NASAProcessor
from .nab import NABProcessor
| 20.666667
| 31
| 0.83871
| 8
| 62
| 6.5
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.129032
| 62
| 2
| 32
| 31
| 0.962963
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
db30471b13bd015ff46d12b1efe5f941e0a696c8
| 1,622
|
py
|
Python
|
tests/test_device.py
|
rzulian/pymelcloud
|
c49760f9322416015bab514b26cd7d0233893a21
|
[
"MIT"
] | null | null | null |
tests/test_device.py
|
rzulian/pymelcloud
|
c49760f9322416015bab514b26cd7d0233893a21
|
[
"MIT"
] | null | null | null |
tests/test_device.py
|
rzulian/pymelcloud
|
c49760f9322416015bab514b26cd7d0233893a21
|
[
"MIT"
] | null | null | null |
"""Device tests."""
import pytest
from pymelcloud.ata_device import AtaDevice
from .util import build_device
def _build_device(device_conf_name: str, device_state_name: str) -> AtaDevice:
device_conf, client = build_device(device_conf_name, device_state_name)
return AtaDevice(device_conf, client)
@pytest.mark.asyncio
async def test_round_temperature():
device = _build_device("ata_listdevice.json", "ata_get.json")
device._device_conf.get("Device")["TemperatureIncrement"] = 0.5
assert device.round_temperature(23.99999) == 24.0
assert device.round_temperature(24.0) == 24.0
assert device.round_temperature(24.00001) == 24.0
assert device.round_temperature(24.24999) == 24.0
assert device.round_temperature(24.25) == 24.5
assert device.round_temperature(24.25001) == 24.5
assert device.round_temperature(24.5) == 24.5
assert device.round_temperature(24.74999) == 24.5
assert device.round_temperature(24.75) == 25.0
assert device.round_temperature(24.75001) == 25.0
device._device_conf.get("Device")["TemperatureIncrement"] = 1
assert device.round_temperature(23.99999) == 24.0
assert device.round_temperature(24.0) == 24.0
assert device.round_temperature(24.00001) == 24.0
assert device.round_temperature(24.49999) == 24.0
assert device.round_temperature(24.5) == 25.0
assert device.round_temperature(24.50001) == 25.0
assert device.round_temperature(25.0) == 25.0
assert device.round_temperature(25.00001) == 25.0
assert device.round_temperature(25.49999) == 25.0
assert device.round_temperature(25.5) == 26.0
| 38.619048
| 78
| 0.732429
| 235
| 1,622
| 4.86383
| 0.187234
| 0.293963
| 0.297463
| 0.489939
| 0.716535
| 0.671916
| 0.591426
| 0.244969
| 0.244969
| 0.244969
| 0
| 0.124282
| 0.1418
| 1,622
| 41
| 79
| 39.560976
| 0.696839
| 0.008015
| 0
| 0.193548
| 0
| 0
| 0.05181
| 0
| 0
| 0
| 0
| 0
| 0.645161
| 1
| 0.032258
| false
| 0
| 0.096774
| 0
| 0.16129
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e1d22fb802e4623823dc09b2d46d26c5cf842802
| 329
|
py
|
Python
|
compute/exceptions.py
|
julpark-rh/cephci
|
3796668e8dcfc5851f387c47ff0b459d495a40c7
|
[
"MIT"
] | 21
|
2019-04-22T07:12:37.000Z
|
2022-03-11T09:34:24.000Z
|
compute/exceptions.py
|
julpark-rh/cephci
|
3796668e8dcfc5851f387c47ff0b459d495a40c7
|
[
"MIT"
] | 601
|
2019-03-21T09:29:53.000Z
|
2022-03-31T18:16:53.000Z
|
compute/exceptions.py
|
julpark-rh/cephci
|
3796668e8dcfc5851f387c47ff0b459d495a40c7
|
[
"MIT"
] | 72
|
2019-02-20T22:23:55.000Z
|
2022-03-31T13:59:25.000Z
|
"""Custom exceptions for compute driver implementations."""
class ResourceNotFound(Exception):
pass
class ExactMatchFailed(Exception):
pass
class VolumeOpFailure(Exception):
pass
class NetworkOpFailure(Exception):
pass
class NodeError(Exception):
pass
class NodeDeleteFailure(Exception):
pass
| 12.653846
| 59
| 0.741641
| 30
| 329
| 8.133333
| 0.5
| 0.319672
| 0.368852
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.182371
| 329
| 25
| 60
| 13.16
| 0.907063
| 0.161094
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
e1efcbe959e22efbd605b8f480234c03bfd8f6ab
| 14,948
|
py
|
Python
|
workflow/scripts/unittests.py
|
Monia234/NCI-GEMSCAN
|
d9b72f787c0c5bcd46ede4213f629593a6b22d4c
|
[
"MIT"
] | null | null | null |
workflow/scripts/unittests.py
|
Monia234/NCI-GEMSCAN
|
d9b72f787c0c5bcd46ede4213f629593a6b22d4c
|
[
"MIT"
] | 25
|
2021-05-12T03:16:59.000Z
|
2022-02-02T21:36:23.000Z
|
workflow/scripts/unittests.py
|
Monia234/NCI-GEMSCAN
|
d9b72f787c0c5bcd46ede4213f629593a6b22d4c
|
[
"MIT"
] | 4
|
2021-04-13T16:07:50.000Z
|
2022-01-26T02:26:47.000Z
|
#!/usr/bin/env python3
import unittest
import genotype_union as gt
################# UNIT TESTS #################
class TestGenotypeUnion(unittest.TestCase):
def test_check_file_pass(self):
self.assertEqual(
gt.check_file(
"/DCEG/CGF/Bioinformatics/Production/Bari/Germline_pipeline_v4_dev/germlineCallingV4/tests/data/all_callers.vcf"
),
0,
)
def test_check_file_fail(self):
self.assertNotEqual(
gt.check_file("/DCEG/CGF/Bioinformatics/Production/Bari/pretend_file.vcff"), 0
)
def test_get_header_pass(self):
self.assertListEqual(
gt.get_header(
"/DCEG/CGF/Bioinformatics/Production/Bari/Germline_pipeline_v4_dev/germlineCallingV4/tests/data/all_callers.vcf"
),
[
"#CHROM",
"POS",
"ID",
"REF",
"ALT",
"QUAL",
"FILTER",
"INFO",
"FORMAT",
"CHM1_CHM13_2",
"CHM1_CHM13_3",
"2:CHM1_CHM13_2",
"2:CHM1_CHM13_3",
],
)
def test_get_header_fail(self):
self.assertEqual(
gt.get_header(
"/DCEG/CGF/Bioinformatics/Production/Bari/Germline_pipeline_v4_dev/germlineCallingV4/tests/data/no_headers.vcf"
),
1,
)
def test_vcf_check_pass(self):
self.assertEqual(
gt.vcf_check(
[
"#CHROM",
"POS",
"ID",
"REF",
"ALT",
"QUAL",
"FILTER",
"INFO",
"FORMAT",
"CHM1_CHM13_2",
"CHM1_CHM13_3",
]
),
0,
)
def test_vcf_check_fail_unpaired(self):
self.assertEqual(
gt.vcf_check(
[
"#CHROM",
"POS",
"ID",
"REF",
"ALT",
"QUAL",
"FILTER",
"INFO",
"FORMAT",
"CHM1_CHM13_2",
"CHM1_CHM13_3",
"othersample",
]
),
1,
)
def test_vcf_check_fail_too_few(self):
self.assertEqual(
gt.vcf_check(
[
"#CHROM",
"POS",
"ID",
"REF",
"ALT",
"QUAL",
"FILTER",
"INFO",
"FORMAT",
"CHM1_CHM13_2",
]
),
1,
)
def test_find_genotype_indices(self):
self.assertEqual(
gt.find_genotype_indices(
[
"#CHROM",
"POS",
"ID",
"REF",
"ALT",
"QUAL",
"FILTER",
"INFO",
"FORMAT",
"1",
"2",
"3",
"4",
"5",
"6",
]
),
(9, 12, 12, 15),
)
def test_add_set_tag(self):
self.assertListEqual(
gt.add_set_tag(
"HC-DV",
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25",
"GT",
"0/1",
"0/0",
"0/0",
"0/1",
],
),
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT",
"0/1",
"0/0",
"0/0",
"0/1",
],
)
def test_remove_empty_genotypes(self):
self.assertListEqual(
gt.remove_empty_genotypes(
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT",
"0/1",
"0/0",
"0/1",
"0/1",
".",
"./.",
".:.:.",
"./.:.:.:..",
],
9,
13,
13,
17,
),
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT",
"0/1",
"0/0",
"0/1",
"0/1",
],
)
def test_remove_empty_genotypes_blank_genos(self):
self.assertEqual(
gt.remove_empty_genotypes(
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT",
".",
"./.",
".:.:.",
"./.:.:.:..",
".",
"./.",
".:.:.",
"./.:.:.:..",
],
9,
13,
13,
17,
),
1,
)
def test_combine_genotypes_concordantGT(self):
self.assertListEqual(
gt.combine_genotypes(
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PGT:HC_PID:HC_PL",
"0/1:0/1:38:29,9:5:3,0,29:..:.:.:.:.:.:.:.",
"0/1:0/1:43:37,6:4:1,0,29:..:.:.:.:.:.:.:.",
"0/1:.:.:.:.:.:.:0/1:28,8:36:99:.:.:135,0,1201",
"0/1:.:.:.:.:.:.:0/1:36,6:42:52:0|1:13110_G_A:52,0,1741",
],
9,
11,
11,
13,
),
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PGT:HC_PID:HC_PL",
"0/1:0/1:38:29,9:5:3,0,29:..:0/1:28,8:36:99:.:.:135,0,1201",
"0/1:0/1:43:37,6:4:1,0,29:..:0/1:36,6:42:52:0|1:13110_G_A:52,0,1741",
],
)
def test_combine_genotypes_discordantGT(self):
self.assertListEqual(
gt.combine_genotypes(
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PGT:HC_PID:HC_PL",
"0/1:0/1:38:29,9:5:3,0,29:..:.:.:.:.:.:.:.",
"0/0:0/1:43:37,6:4:1,0,29:..:.:.:.:.:.:.:.",
"1/1:.:.:.:.:.:.:0/1:28,8:36:99:.:.:135,0,1201",
"0/1:.:.:.:.:.:.:0/1:36,6:42:52:0|1:13110_G_A:52,0,1741",
],
9,
11,
11,
13,
),
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PGT:HC_PID:HC_PL",
"./.:0/1:38:29,9:5:3,0,29:..:0/1:28,8:36:99:.:.:135,0,1201",
"./.:0/1:43:37,6:4:1,0,29:..:0/1:36,6:42:52:0|1:13110_G_A:52,0,1741",
],
)
def test_evaluate_variant_line_DV(self):
self.assertListEqual(
gt.evaluate_variant_line(
[
"1",
"2055702",
"1_2055702_C_T",
"C",
"T",
"9",
".",
"DV_AF=0.5;DV_AQ=9",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC",
"0/0:0/0:2:0,2:12:0,20,11:..",
"1/1:1/1:2:0,2:8:9,12,0:..",
"./.:.:.:.:.:.:.",
"./.:.:.:.:.:.:.",
],
9,
11,
11,
13,
),
[
"1",
"2055702",
".",
"C",
"T",
"9",
".",
"DV_AF=0.5;DV_AQ=9;set=DV",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC",
"0/0:0/0:2:0,2:12:0,20,11:..",
"1/1:1/1:2:0,2:8:9,12,0:..",
],
)
def test_evaluate_variant_line_HC(self):
self.assertListEqual(
gt.evaluate_variant_line(
[
"1",
"829169",
".",
"AAAAAAAAAAAAAATATATATATATATATATATATAT",
"*",
"702.03",
".",
"HC_AN=4;HC_DP=54;HC_ExcessHet=3.0103;HC_FS=0;HC_MQ=60.22;HC_QD=14.63;HC_SOR=1.562;HC_AC=2;HC_AF=0.5;HC_MLEAC=2;HC_MLEAF=0.5",
"GT:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PL",
"./.:.:.:.:.:.",
"./.:.:.:.:.:.",
"0/1:0/1:0,15:30:99:1254,456,401",
"0/1:0/1:0,9:18:99:719,260,246",
],
9,
11,
11,
13,
),
[
"1",
"829169",
".",
"AAAAAAAAAAAAAATATATATATATATATATATATAT",
"*",
"702.03",
".",
"HC_AN=4;HC_DP=54;HC_ExcessHet=3.0103;HC_FS=0;HC_MQ=60.22;HC_QD=14.63;HC_SOR=1.562;HC_AC=2;HC_AF=0.5;HC_MLEAC=2;HC_MLEAF=0.5;set=HC",
"GT:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PL",
"0/1:0/1:0,15:30:99:1254,456,401",
"0/1:0/1:0,9:18:99:719,260,246",
],
)
def test_evaluate_variant_line_both(self):
self.assertListEqual(
gt.evaluate_variant_line(
[
"1",
"12719",
"1_12719_G_C",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PGT:HC_PID:HC_PL",
"0/1:0/1:38:29,9:5:3,0,29:..:.:.:.:.:.:.:.",
"0/1:0/1:43:37,6:4:1,0,29:..:.:.:.:.:.:.:.",
"0/1:.:.:.:.:.:.:0/1:28,8:36:99:.:.:135,0,1201",
"0/1:.:.:.:.:.:.:0/1:36,6:42:52:0|1:13110_G_A:52,0,1741",
],
9,
11,
11,
13,
),
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25;set=HC-DV",
"GT:DV_GT:DV_DP:DV_AD:DV_GQ:DV_PL:DV_RNC:HC_GT:HC_AD:HC_DP:HC_GQ:HC_PGT:HC_PID:HC_PL",
"0/1:0/1:38:29,9:5:3,0,29:..:0/1:28,8:36:99:.:.:135,0,1201",
"0/1:0/1:43:37,6:4:1,0,29:..:0/1:36,6:42:52:0|1:13110_G_A:52,0,1741",
],
)
def test_evaluate_variant_line_neither(self):
self.assertEqual(
gt.evaluate_variant_line(
[
"1",
"12719",
".",
"G",
"C",
"32.29",
".",
"HC_AN=4;HC_DP=12;DV_AF=0.25",
"GT",
"0/1",
"0/0",
"0/0",
"0/1",
],
9,
11,
11,
13,
),
1,
)
def test_add_headers(self):
self.assertListEqual(
gt.add_headers(
"test:time:stamp", "test.version", "genotype_union.py", "python gt.py -do -stuff"
),
[
'##INFO=<ID=set,Number=3,Type=String,Description="Set of callers that identified a variant (HC, DV, or HC-DV)">',
"##genotype_union.py_Version=test.version, Union of HC and DV genotype data, test:time:stamp",
"##genotype_union.py_Command=python gt.py -do -stuff",
],
)
# def test_(self):
# self.assert(gt.())
# def test_(self):
# self.assert(gt.())
# def test_(self):
# self.assert(gt.())
################# BLACK BOX TESTS #################
# class TestScript(unittest.TestCase):
# def test_script(self):
# output=runScript('genotype_union.py /DCEG/CGF/Bioinformatics/Production/Bari/Germline_pipeline_v4_dev/germlineCallingV4/test_data/dv_and_hc.vcf /DCEG/CGF/Bioinformatics/Production/Bari/Germline_pipeline_v4_dev/germlineCallingV4/test_data/harmonized.vcf')
# self.assertEqual(output, '8')
if __name__ == "__main__":
unittest.main()
# suite = unittest.TestLoader().loadTestsFromTestCase(ScriptTest)
# unittest.TextTestRunner(verbosity=2).run(suite)
| 29.836327
| 265
| 0.320979
| 1,518
| 14,948
| 2.944664
| 0.123847
| 0.028635
| 0.019463
| 0.017897
| 0.75302
| 0.694407
| 0.688591
| 0.67651
| 0.633781
| 0.622371
| 0
| 0.142519
| 0.518865
| 14,948
| 500
| 266
| 29.896
| 0.479004
| 0.042548
| 0
| 0.783664
| 0
| 0.086093
| 0.283606
| 0.214672
| 0
| 0
| 0
| 0
| 0.039735
| 1
| 0.039735
| false
| 0.006623
| 0.004415
| 0
| 0.046358
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e1f1d4075755bf2863d9b10efa1c053c0cbd6d7f
| 723
|
py
|
Python
|
Exercises/ex009_tabuada.py
|
monique-tukaj/cursoemvideo-python
|
79e1fd58ab5fc7d89970ff0586761767104de0e5
|
[
"MIT"
] | null | null | null |
Exercises/ex009_tabuada.py
|
monique-tukaj/cursoemvideo-python
|
79e1fd58ab5fc7d89970ff0586761767104de0e5
|
[
"MIT"
] | null | null | null |
Exercises/ex009_tabuada.py
|
monique-tukaj/cursoemvideo-python
|
79e1fd58ab5fc7d89970ff0586761767104de0e5
|
[
"MIT"
] | null | null | null |
#Faca um programa que leia um numero inteiro qualquer e mostre na tela a sua tabuada.
valor = int(input('Digite um valor: '))
print(50 * '=')
print('A tabuada de {} é: '.format(valor))
print("{} x {:2} = {}".format(valor, 1, valor * 1))
print("{} x {:2} = {}".format(valor, 2, valor * 2))
print("{} x {:2} = {}".format(valor, 3, valor * 3))
print("{} x {:2} = {}".format(valor, 4, valor * 4))
print("{} x {:2} = {}".format(valor, 5, valor * 5))
print("{} x {:2} = {}".format(valor, 6, valor * 6))
print("{} x {:2} = {}".format(valor, 7, valor * 7))
print("{} x {:2} = {}".format(valor, 8, valor * 8))
print("{} x {:2} = {}".format(valor, 9, valor * 9))
print("{} x {:2} = {}".format(valor, 10, valor * 10))
print(50 * '=')
| 45.1875
| 85
| 0.53527
| 113
| 723
| 3.424779
| 0.309735
| 0.312662
| 0.180879
| 0.335917
| 0.465116
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0601
| 0.171508
| 723
| 16
| 86
| 45.1875
| 0.585977
| 0.116183
| 0
| 0.142857
| 0
| 0
| 0.27856
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.928571
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 4
|
c0133abde939432690ed390fa1bfbd924f57cc53
| 130
|
py
|
Python
|
questionbank/exams/widgets.py
|
SyafiqTermizi/questionbank
|
33e58db1a1610a85bd30a85d2f52e819bc27058b
|
[
"MIT"
] | 1
|
2018-04-17T23:58:46.000Z
|
2018-04-17T23:58:46.000Z
|
questionbank/exams/widgets.py
|
SyafiqTermizi/questionbank
|
33e58db1a1610a85bd30a85d2f52e819bc27058b
|
[
"MIT"
] | 8
|
2019-12-04T23:08:00.000Z
|
2022-02-13T22:48:26.000Z
|
questionbank/exams/widgets.py
|
SyafiqTermizi/questionbank
|
33e58db1a1610a85bd30a85d2f52e819bc27058b
|
[
"MIT"
] | null | null | null |
from django import forms
class CheckboxSelectMultiple(forms.CheckboxSelectMultiple):
template_name = 'select_multiple.html'
| 21.666667
| 59
| 0.823077
| 13
| 130
| 8.076923
| 0.846154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.115385
| 130
| 5
| 60
| 26
| 0.913043
| 0
| 0
| 0
| 0
| 0
| 0.153846
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
c015d7120134644e496a31d4b8eb79d06c563aaa
| 11
|
py
|
Python
|
training/train.py
|
lexical-kenobi/Face-Vision-3D_Pose
|
07eee33d09018c99251051a983d3842212177e5a
|
[
"MIT"
] | 5,129
|
2019-09-30T11:21:03.000Z
|
2022-03-31T22:35:12.000Z
|
training/train.py
|
lexical-kenobi/Face-Vision-3D_Pose
|
07eee33d09018c99251051a983d3842212177e5a
|
[
"MIT"
] | 704
|
2020-09-30T10:44:13.000Z
|
2022-03-30T07:18:28.000Z
|
training/train.py
|
lexical-kenobi/Face-Vision-3D_Pose
|
07eee33d09018c99251051a983d3842212177e5a
|
[
"MIT"
] | 1,034
|
2019-09-30T15:01:32.000Z
|
2022-03-31T06:14:50.000Z
|
../train.py
| 11
| 11
| 0.636364
| 2
| 11
| 3.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 11
| 1
| 11
| 11
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
c03425a934fcabf8ee21b0dcc3169cf9c323ed0f
| 904
|
py
|
Python
|
atlas/api/webhooks/__init__.py
|
joshfriend/atlas
|
5c7f53c96a9632a3af0f0192ac37a0b508118c70
|
[
"MIT"
] | 2
|
2016-03-31T19:07:17.000Z
|
2016-05-26T09:03:07.000Z
|
atlas/api/webhooks/__init__.py
|
joshfriend/atlas
|
5c7f53c96a9632a3af0f0192ac37a0b508118c70
|
[
"MIT"
] | 17
|
2016-03-07T15:45:51.000Z
|
2019-11-04T14:24:34.000Z
|
atlas/api/webhooks/__init__.py
|
joshfriend/atlas
|
5c7f53c96a9632a3af0f0192ac37a0b508118c70
|
[
"MIT"
] | 1
|
2017-01-27T10:49:13.000Z
|
2017-01-27T10:49:13.000Z
|
#!/usr/bin/env python
import logging
from webargs import fields
log = logging.getLogger('api.webhook')
webhook_args = {
'token': fields.Str(required=True),
'team_id': fields.Str(),
'team_domain': fields.Str(),
'channel_id': fields.Str(required=True),
'channel_name': fields.Str(required=True),
'timestamp': fields.Float(),
'user_id': fields.Str(),
'user_name': fields.Str(required=True),
'text': fields.Str(required=True),
'trigger_word': fields.Str(),
}
slash_cmd_args = {
'token': fields.Str(required=True),
'team_id': fields.Str(),
'team_domain': fields.Str(),
'channel_id': fields.Str(required=True),
'channel_name': fields.Str(required=True),
'user_id': fields.Str(),
'user_name': fields.Str(required=True),
'text': fields.Str(required=True),
'response_url': fields.Str(),
'command': fields.Str(required=True),
}
| 25.828571
| 46
| 0.652655
| 116
| 904
| 4.939655
| 0.293103
| 0.298429
| 0.326353
| 0.403141
| 0.680628
| 0.680628
| 0.680628
| 0.680628
| 0.680628
| 0.680628
| 0
| 0
| 0.160398
| 904
| 34
| 47
| 26.588235
| 0.754941
| 0.022124
| 0
| 0.592593
| 0
| 0
| 0.204983
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.074074
| 0
| 0.074074
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
c0609d025c6cef89d8235595e49a74722460681c
| 4,046
|
py
|
Python
|
models.py
|
zhangjh915/Simple-Neural-Nets-with-PyTorch
|
1de662eec60de6020119e43e870ce99ed533218d
|
[
"MIT"
] | 1
|
2020-08-24T23:44:58.000Z
|
2020-08-24T23:44:58.000Z
|
models.py
|
zhangjh915/Simple-Neural-Nets-with-PyTorch
|
1de662eec60de6020119e43e870ce99ed533218d
|
[
"MIT"
] | null | null | null |
models.py
|
zhangjh915/Simple-Neural-Nets-with-PyTorch
|
1de662eec60de6020119e43e870ce99ed533218d
|
[
"MIT"
] | null | null | null |
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class Softmax(nn.Module):
def __init__(self, im_size, n_classes):
"""
Initialization of the softmax classifier on images.
Arguments:
im_size: a tuple of ints of (n_channel, height, width)
n_classes: int of number of classes
"""
super().__init__() # if in Python2, need to be changed to "super(Softmax, self).__init__()"
in_dim = np.prod(im_size) # input dimension
self.fc = nn.Linear(in_dim, n_classes) # fully-connected layer
def forward(self, images):
"""
Forward pass of the softmax classifier on images to output scores of each sample.
Arguments:
images: a tensor of size (N, C, H, W), whichi stands for (batch_size, num_channel, height, width)
Outputs:
scores: a Torch variable of size (N, n_classes) indicating the scores for each sample in each class
"""
images = images.view(images.shape[0], -1) # reshape image tensor
scores = self.fc(images)
return scores
class Two_Layer_NN(nn.Module):
def __init__(self, im_size, dim_hidden, n_classes):
"""
Initialization of the two-layer neural network classifier on images.
Arguments:
im_size: a tuple of ints of (n_channel, height, width)
dim_hidden: int of dimension of the hidden layer
n_classes: int of number of classes
"""
super().__init__() # if in Python2, need to be changed to "super(Two_Layer_NN, self).__init__()"
in_dim = int(np.prod(im_size)) # dimension of the input tensor
self.fc1 = nn.Linear(in_dim, dim_hidden) # fully-connected layer
self.fc2 = nn.Linear(dim_hidden, n_classes) # fully-connected layer
def forward(self, images):
"""
Forward pass of the two-layer neural network classifier on images to output scores of each sample.
Arguments:
images: a tensor of size (N, C, H, W), which stands for (batch_size, num_channel, height, width)
Outputs:
scores: a Torch variable of size (N, n_classes) indicating the scores for each sample in each class
"""
images = images.view(images.shape[0], -1) # reshape the tensor
scores = self.fc1(images)
scores = F.relu(scores) # Relu function
scores = self.fc2(scores)
return scores
class Conv_Net(nn.Module):
def __init__(self, im_size, dim_hidden, n_classes, kernel_size):
"""
Initialization of the two-layer neural network classifier on images.
Arguments:
im_size: a tuple of ints of (n_channel, height, width)
dim_hidden: int of dimension of the hidden layer
n_classes: int of number of classes
kernel_size: int of the kernel size
"""
super().__init__() # if in Python2, need to be changed to "super(Two_Layer_NN, self).__init__()"
in_channels, in_height, in_width = im_size
self.conv2d = nn.Conv2d(in_channels, dim_hidden, kernel_size) # convolution layer
hidden_height = in_height - kernel_size + 1
hidden_width = in_width - kernel_size + 1
hidden_dim = np.prod([hidden_height, hidden_width, dim_hidden])
self.fc = nn.Linear(hidden_dim, n_classes) # fully-connected layer
def forward(self, images):
"""
Forward pass of the convolutional neural network classifier on images to output scores of each sample.
Arguments:
images: a tensor of size (N, C, H, W), which stands for (batch_size, num_channel, height, width)
Outputs:
scores: a Torch variable of size (N, n_classes) indicating the scores for each sample in each class
"""
scores = self.conv2d(images)
scores = F.relu(scores) # Relu function
scores = scores.view(images.shape[0], -1) # reshape image tensor
scores = self.fc(scores)
return scores
| 44.461538
| 111
| 0.636678
| 561
| 4,046
| 4.409982
| 0.16221
| 0.038804
| 0.043654
| 0.04042
| 0.735247
| 0.726354
| 0.718674
| 0.708569
| 0.675424
| 0.672191
| 0
| 0.006169
| 0.278794
| 4,046
| 90
| 112
| 44.955556
| 0.841672
| 0.51656
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.153846
| false
| 0
| 0.076923
| 0
| 0.384615
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
221e8f2b4aefe3cbc9e57a2cf82d1f2e69ff7280
| 99
|
py
|
Python
|
challenges/i-love-lance-janice/solution_01.py
|
cowboysmall-scratch/foobar-coding-challenge
|
b4a3a703a44bc3e61184629ff6082e40be2e1704
|
[
"MIT"
] | null | null | null |
challenges/i-love-lance-janice/solution_01.py
|
cowboysmall-scratch/foobar-coding-challenge
|
b4a3a703a44bc3e61184629ff6082e40be2e1704
|
[
"MIT"
] | null | null | null |
challenges/i-love-lance-janice/solution_01.py
|
cowboysmall-scratch/foobar-coding-challenge
|
b4a3a703a44bc3e61184629ff6082e40be2e1704
|
[
"MIT"
] | null | null | null |
def solution(s):
return ''.join([chr(219 - ord(c)) if 97 <= ord(c) <= 122 else c for c in s])
| 24.75
| 80
| 0.555556
| 20
| 99
| 2.75
| 0.75
| 0.145455
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0.232323
| 99
| 3
| 81
| 33
| 0.618421
| 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
| 0
| 0
|
0
| 4
|
223394209b83e2665a60fd03247b2f3b551216ea
| 179
|
py
|
Python
|
tests/poc/context_example/exception.py
|
t10d/kingdom-python-core
|
87aa614084e5692db23e58e0c82150e858985509
|
[
"MIT"
] | 1
|
2021-11-16T14:59:08.000Z
|
2021-11-16T14:59:08.000Z
|
tests/poc/context_example/exception.py
|
t10d/kingdom-python-core
|
87aa614084e5692db23e58e0c82150e858985509
|
[
"MIT"
] | 2
|
2021-11-05T17:38:05.000Z
|
2021-11-18T23:06:14.000Z
|
tests/poc/context_example/exception.py
|
t10d/kingdom-python-core
|
87aa614084e5692db23e58e0c82150e858985509
|
[
"MIT"
] | null | null | null |
from kingdom_sdk.domain.exception import KingdomError
class ExampleError(KingdomError):
def __init__(self, message: str):
super().__init__(message, "EXAMPLE_ERROR")
| 25.571429
| 53
| 0.75419
| 20
| 179
| 6.25
| 0.85
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.145251
| 179
| 6
| 54
| 29.833333
| 0.816993
| 0
| 0
| 0
| 0
| 0
| 0.072626
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
225ea4b2020b802ce8f537becdd03e820699941a
| 121
|
py
|
Python
|
logs/core/i18n.py
|
notodinair/RedV3-Cogs
|
47747ccc33617dcaa3851ff12c6f95aee675d1e6
|
[
"MIT"
] | 1
|
2020-06-08T13:39:30.000Z
|
2020-06-08T13:39:30.000Z
|
logs/core/i18n.py
|
Tominous/Swift-Cogs
|
47747ccc33617dcaa3851ff12c6f95aee675d1e6
|
[
"MIT"
] | null | null | null |
logs/core/i18n.py
|
Tominous/Swift-Cogs
|
47747ccc33617dcaa3851ff12c6f95aee675d1e6
|
[
"MIT"
] | 1
|
2020-06-08T13:39:32.000Z
|
2020-06-08T13:39:32.000Z
|
from pathlib import Path
from redbot.core.i18n import Translator
i18n = Translator("Logs", str(Path(__file__).parent))
| 20.166667
| 53
| 0.77686
| 17
| 121
| 5.294118
| 0.705882
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.037383
| 0.115702
| 121
| 5
| 54
| 24.2
| 0.803738
| 0
| 0
| 0
| 0
| 0
| 0.033058
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
97e02cd1f58f77fb259e70de6db4b438ed628b80
| 17,567
|
py
|
Python
|
reacticket/extensions/base.py
|
Vexed01/Toxic-Cogs
|
5fb52bfb84a6db80b7030981a93e67b7daa00276
|
[
"MIT"
] | null | null | null |
reacticket/extensions/base.py
|
Vexed01/Toxic-Cogs
|
5fb52bfb84a6db80b7030981a93e67b7daa00276
|
[
"MIT"
] | null | null | null |
reacticket/extensions/base.py
|
Vexed01/Toxic-Cogs
|
5fb52bfb84a6db80b7030981a93e67b7daa00276
|
[
"MIT"
] | null | null | null |
from redbot.core.utils.mod import is_admin_or_superior
import discord
import contextlib
import asyncio
from reacticket.extensions.abc import MixinMeta
from reacticket.extensions.mixin import reacticket
class ReacTicketBaseMixin(MixinMeta):
@reacticket.command()
async def close(self, ctx, *, reason=None):
"""Closes the created ticket.
If run by a normal user, this will default to the user.
If run by an admin or support team, this will check the channel."""
guild_settings = await self.config.guild(ctx.guild).all()
is_admin = await is_admin_or_superior(self.bot, ctx.author) or any(
[ur.id in guild_settings["supportroles"] for ur in ctx.author.roles]
)
must_be_admin = not guild_settings["usercanclose"]
if not is_admin and must_be_admin:
await ctx.send("Only Administrators can close tickets.")
return
elif not is_admin:
author = ctx.author # no u
author_id = author.id
elif is_admin:
# Let's try to get the current channel and get the author
# If not, we'll default to ctx.author
inverted = {}
for author_id, tickets in guild_settings["created"].items():
for ticket in tickets:
inverted[ticket["channel"]] = author_id
try:
author = ctx.guild.get_member(int(inverted[ctx.channel.id]))
if author:
author_id = author.id
else:
author_id = int(inverted[ctx.channel.id])
except KeyError:
author = ctx.author
author_id = author.id
if str(author_id) not in guild_settings["created"]:
await ctx.send("That user does not have an open ticket.")
return
index = None
if not guild_settings["created"][str(author_id)]:
await ctx.send("You don't have any open tickets.")
return
elif len(guild_settings["created"][str(author_id)]) == 1:
index = 0
else:
for i, ticket in enumerate(guild_settings["created"][str(author_id)]):
if ticket["channel"] == ctx.channel.id:
index = i
break
if index is None:
await ctx.send(
"You have multiple tickets open. "
"Please run this command in the ticket channel you wish to close."
)
return
channel = self.bot.get_channel(guild_settings["created"][str(author_id)][index]["channel"])
archive = self.bot.get_channel(guild_settings["archive"]["category"])
added_users = [
user
for u in guild_settings["created"][str(author_id)][index]["added"]
if (user := ctx.guild.get_member(u))
]
added_users.append(author)
# Again, to prevent race conditions...
async with self.config.guild(ctx.guild).created() as created:
del created[str(author_id)][index]
if guild_settings["report"] != 0:
reporting_channel = self.bot.get_channel(guild_settings["report"])
if reporting_channel:
if await self.embed_requested(reporting_channel):
embed = discord.Embed(
title="Ticket Closed",
description=(
f"Ticket {channel.mention} created by "
f"{author.mention if author else author_id} "
f"has been closed by {ctx.author.mention}."
),
color=await ctx.embed_color(),
)
if reason:
embed.add_field(name="Reason", value=reason)
await reporting_channel.send(embed=embed)
else:
message = (
f"Ticket {channel.mention} created by "
f"{str(author) if author else author_id} "
f"has been closed by {str(ctx.author)}."
)
if reason:
message += f"\n**Reason**: {reason}"
await reporting_channel.send(message)
if guild_settings["dm"] and author:
embed = discord.Embed(
title="Ticket Closed",
description=(
f"Your ticket {channel.mention} has been closed by {ctx.author.mention}."
),
color=await ctx.embed_color(),
)
if reason:
embed.add_field(name="Reason", value=reason)
with contextlib.suppress(discord.HTTPException):
await author.send(embed=embed)
if guild_settings["archive"]["enabled"] and channel and archive:
for user in added_users:
with contextlib.suppress(discord.HTTPException):
if user:
await channel.set_permissions(
user, send_messages=False, read_messages=True
)
await ctx.send(
f"Ticket {channel.mention} for {author.display_name if author else author_id} "
"has been closed. Channel will be moved to archive in one minute."
)
await asyncio.sleep(60)
try:
admin_roles = [
ctx.guild.get_role(role_id)
for role_id in (await self.bot._config.guild(ctx.guild).admin_role())
if ctx.guild.get_role(role_id)
]
support_roles = [
ctx.guild.get_role(role_id)
for role_id in (await self.config.guild(ctx.guild).supportroles())
if ctx.guild.get_role(role_id)
]
all_roles = admin_roles + support_roles
overwrites = {
ctx.guild.default_role: discord.PermissionOverwrite(read_messages=False),
ctx.guild.me: discord.PermissionOverwrite(
read_messages=True,
send_messages=True,
manage_channels=True,
manage_permissions=True,
),
}
for role in all_roles:
overwrites[role] = discord.PermissionOverwrite(
read_messages=True, send_messages=True
)
for user in added_users:
if user:
overwrites[user] = discord.PermissionOverwrite(read_messages=False)
await channel.edit(category=archive, overwrites=overwrites)
except discord.HTTPException as e:
await ctx.send(f"Failed to move to archive: {str(e)}")
else:
if channel:
for user in added_users:
with contextlib.suppress(discord.HTTPException):
if user:
await channel.set_permissions(
user, send_messages=False, read_messages=True
)
await ctx.send(
f"Ticket {channel.mention} for {author.display_name if author else author_id} "
"has been closed. Channel will be deleted in one minute, if exists."
)
await asyncio.sleep(60)
if channel:
try:
await channel.delete()
except discord.HTTPException:
with contextlib.suppress(discord.HTTPException):
await ctx.send(
'Failed to delete channel. Please ensure I have "Manage Channels" '
"permission in the category."
)
@reacticket.command(name="add")
async def ticket_add(self, ctx, user: discord.Member):
"""Add a user to the current ticket."""
guild_settings = await self.config.guild(ctx.guild).all()
is_admin = await is_admin_or_superior(self.bot, ctx.author) or any(
[ur.id in guild_settings["supportroles"] for ur in ctx.author.roles]
)
must_be_admin = not guild_settings["usercanmodify"]
if not is_admin and must_be_admin:
await ctx.send("Only Administrators can add/remove other users to tickets.")
return
elif not is_admin:
author = ctx.author
author_id = author.id
elif is_admin:
# Since the author isn't specified, and it's an admin, we need to guess on who
# the author is
inverted = {}
for author_id, tickets in guild_settings["created"].items():
for ticket in tickets:
inverted[ticket["channel"]] = author_id
try:
author = ctx.guild.get_member(int(inverted[ctx.channel.id]))
if author:
author_id = author.id
else:
author_id = int(inverted[ctx.channel.id])
except KeyError:
author = ctx.author
author_id = author.id
index = None
if not guild_settings["created"][str(author_id)]:
await ctx.send("You don't have any open tickets.")
return
elif len(guild_settings["created"][str(author_id)]) == 1:
index = 0
else:
for i, ticket in enumerate(guild_settings["created"][str(author_id)]):
if ticket["channel"] == ctx.channel.id:
index = i
break
if index is None:
await ctx.send(
"You have multiple tickets open. "
"Please run this command in the ticket channel you wish to edit."
)
return
channel = self.bot.get_channel(guild_settings["created"][str(author_id)][index]["channel"])
if user.id in guild_settings["created"][str(author_id)][index]["added"]:
await ctx.send("That user is already added.")
return
adding_is_admin = await is_admin_or_superior(self.bot, user) or any(
[ur.id in guild_settings["supportroles"] for ur in user.roles]
)
if adding_is_admin:
await ctx.send("You cannot add a user in support or admin team.")
return
channel = self.bot.get_channel(guild_settings["created"][str(author_id)][index]["channel"])
if not channel:
await ctx.send("The ticket channel has been deleted.")
return
try:
await channel.set_permissions(user, send_messages=True, read_messages=True)
except discord.Forbidden:
await ctx.send(
"The Manage Permissions channel for me has been removed. "
"I am unable to modify this ticket."
)
return
async with self.config.guild(ctx.guild).created() as created:
created[str(author_id)][index]["added"].append(user.id)
await ctx.send(f"{user.mention} has been added to the ticket.")
@reacticket.command(name="remove")
async def ticket_remove(self, ctx, user: discord.Member):
"""Remove a user from the current ticket."""
guild_settings = await self.config.guild(ctx.guild).all()
is_admin = await is_admin_or_superior(self.bot, ctx.author) or any(
[ur.id in guild_settings["supportroles"] for ur in ctx.author.roles]
)
must_be_admin = not guild_settings["usercanmodify"]
if not is_admin and must_be_admin:
await ctx.send("Only Administrators can add/remove other users to tickets.")
return
elif not is_admin:
author = ctx.author
author_id = author.id
elif is_admin:
# Since the author isn't specified, and it's an admin, we need to guess on who
# the author is
inverted = {}
for author_id, tickets in guild_settings["created"].items():
for ticket in tickets:
inverted[ticket["channel"]] = author_id
try:
author = ctx.guild.get_member(int(inverted[ctx.channel.id]))
if author:
author_id = author.id
else:
author_id = int(inverted[ctx.channel.id])
except KeyError:
author = ctx.author
author_id = author.id
index = None
if not guild_settings["created"][str(author_id)]:
await ctx.send("You don't have any open tickets.")
return
elif len(guild_settings["created"][str(author_id)]) == 1:
index = 0
else:
for i, ticket in enumerate(guild_settings["created"][str(author_id)]):
if ticket["channel"] == ctx.channel.id:
index = i
break
if index is None:
await ctx.send(
"You have multiple tickets open. "
"Please run this command in the ticket channel you wish to edit."
)
return
if user.id not in guild_settings["created"][str(author_id)][index]["added"]:
await ctx.send("That user is not added.")
return
removing_is_admin = await is_admin_or_superior(self.bot, user) or any(
[ur.id in guild_settings["supportroles"] for ur in user.roles]
)
if removing_is_admin:
await ctx.send("You cannot remove a user in support or admin team.")
return
channel = self.bot.get_channel(guild_settings["created"][str(author_id)][index]["channel"])
if not channel:
await ctx.send("The ticket channel has been deleted.")
try:
await channel.set_permissions(user, send_messages=False, read_messages=False)
except discord.Forbidden:
await ctx.send(
"The Manage Permissions channel for me has been removed. "
"I am unable to modify this ticket."
)
return
async with self.config.guild(ctx.guild).created() as created:
created[str(author_id)][index]["added"].remove(user.id)
await ctx.send(f"{user.mention} has been removed from the ticket.")
@reacticket.command(name="name")
async def ticket_name(self, ctx, *, name: str):
"""Rename the ticket in scope."""
guild_settings = await self.config.guild(ctx.guild).all()
is_admin = await is_admin_or_superior(self.bot, ctx.author) or any(
[ur.id in guild_settings["supportroles"] for ur in ctx.author.roles]
)
must_be_admin = not guild_settings["usercanname"]
if not is_admin and must_be_admin:
await ctx.send("Only Administrators can rename tickets.")
return
elif not is_admin:
author = ctx.author
author_id = author.id
elif is_admin:
# Since the author isn't specified, and it's an admin, we need to guess on who
# the author is
inverted = {}
for author_id, tickets in guild_settings["created"].items():
for ticket in tickets:
inverted[ticket["channel"]] = author_id
try:
author = ctx.guild.get_member(int(inverted[ctx.channel.id]))
if author:
author_id = author.id
else:
author_id = int(inverted[ctx.channel.id])
except KeyError:
author = ctx.author
author_id = author.id
if str(author_id) not in guild_settings["created"]:
await ctx.send("You don't have any open tickets.")
return
index = None
if not guild_settings["created"][str(author_id)]:
await ctx.send("You don't have any open tickets.")
return
elif len(guild_settings["created"][str(author_id)]) == 1:
index = 0
else:
for i, ticket in enumerate(guild_settings["created"][str(author_id)]):
if ticket["channel"] == ctx.channel.id:
index = i
break
if index is None:
await ctx.send(
"You have multiple tickets open. "
"Please run this command in the ticket channel you wish to edit."
)
return
channel = self.bot.get_channel(guild_settings["created"][str(author_id)][index]["channel"])
if not channel:
await ctx.send("The ticket channel has been deleted.")
return
if len(name) > 99:
await ctx.send("Channel names must be less 100 characters")
return
try:
await channel.edit(name=name)
except discord.Forbidden:
await ctx.send(
"The Manage Channels channel for me has been removed. "
"I am unable to modify this ticket."
)
return
await ctx.send("The ticket has been renamed.")
| 40.291284
| 99
| 0.537371
| 1,989
| 17,567
| 4.630468
| 0.099548
| 0.05646
| 0.041694
| 0.044951
| 0.795114
| 0.759392
| 0.743322
| 0.718675
| 0.686211
| 0.676982
| 0
| 0.00164
| 0.375078
| 17,567
| 435
| 100
| 40.383908
| 0.837311
| 0.023112
| 0
| 0.682192
| 0
| 0
| 0.160697
| 0.002491
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.016438
| 0
| 0.084932
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3f2ca9e7305ec398a8e60a3e873b53bcacf40a76
| 2,679
|
py
|
Python
|
mason/clients/glue/metastore.py
|
kyprifog/mason
|
bf45672124ef841bc16216c293034f4ccc506621
|
[
"Apache-2.0"
] | 4
|
2021-04-12T17:49:34.000Z
|
2022-01-23T19:54:29.000Z
|
mason/clients/glue/metastore.py
|
kyprifog/mason
|
bf45672124ef841bc16216c293034f4ccc506621
|
[
"Apache-2.0"
] | 24
|
2021-04-30T18:40:25.000Z
|
2021-05-12T20:52:06.000Z
|
mason/clients/glue/metastore.py
|
kyprifog/mason
|
bf45672124ef841bc16216c293034f4ccc506621
|
[
"Apache-2.0"
] | 3
|
2021-04-12T19:40:43.000Z
|
2021-09-07T21:56:36.000Z
|
from typing import Union, Optional, Tuple, List
from returns.result import Result
from mason.clients.athena.athena_client import AthenaClient
from mason.clients.engines.metastore import MetastoreClient
from mason.clients.glue.glue_client import GlueClient
from mason.clients.response import Response
from mason.engines.metastore.models.credentials import InvalidCredentials
from mason.engines.metastore.models.credentials.aws import AWSCredentials
from mason.engines.metastore.models.database import Database, InvalidDatabase, DatabaseList
from mason.engines.metastore.models.ddl import DDLStatement, InvalidDDLStatement
from mason.engines.metastore.models.table.invalid_table import InvalidTables
from mason.engines.metastore.models.table.summary import TableSummary
from mason.engines.metastore.models.table.table import TableList, Table
from mason.engines.storage.models.path import Path
class GlueMetastoreClient(MetastoreClient):
def __init__(self, client: GlueClient):
self.client: GlueClient = client
self.athena_client = AthenaClient(self.client.access_key, self.client.secret_key, self.client.aws_region)
def get_databases(self, response: Response = Response()) -> Tuple[DatabaseList, Response]:
return self.client.get_databases(response)
def get_database(self, database_name: str, response: Optional[Response] = None) -> Tuple[Result[Database, InvalidDatabase], Response]:
return self.client.get_database(database_name, response)
def summarize_table(self, table: Table, options: dict = {}, response: Response = Response()) -> Tuple[Union[TableSummary, InvalidTables], Response]:
raise NotImplementedError("Client summarize_table not implemented")
def delete_table(self, database_name: str, table_name: str, response: Optional[Response] = None) -> Response:
return self.client.delete_table(database_name, table_name, response)
def list_tables(self, database_name: str, response: Response) -> Tuple[Result[TableList, InvalidTables], Response]:
return self.client.list_tables(database_name, response)
def get_table(self, database_name: str, table_name: str, options: Optional[dict] = None, response: Optional[Response] = None) -> Tuple[Union[Table, InvalidTables], Response]:
return self.client.get_table(database_name, table_name, response)
def credentials(self) -> Union[AWSCredentials, InvalidCredentials]:
return self.client.credentials()
def generate_table_ddl(self, table: Table, path: Path, database: Database) -> Union[DDLStatement, InvalidDDLStatement]:
return self.athena_client.generate_table_ddl(table, path, database)
| 55.8125
| 178
| 0.780888
| 319
| 2,679
| 6.432602
| 0.200627
| 0.052632
| 0.062378
| 0.085283
| 0.326998
| 0.195419
| 0.07115
| 0.035088
| 0
| 0
| 0
| 0
| 0.12654
| 2,679
| 47
| 179
| 57
| 0.876923
| 0
| 0
| 0
| 0
| 0
| 0.01419
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.264706
| false
| 0
| 0.411765
| 0.205882
| 0.911765
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 4
|
3f2eb254f11b51cad1b7bdcedc199a63c3e44336
| 263
|
py
|
Python
|
test.py
|
MaowMan/py-iot-sensor-controller
|
19911d27ea6477755d6a7408a93cc85240c82986
|
[
"MIT"
] | null | null | null |
test.py
|
MaowMan/py-iot-sensor-controller
|
19911d27ea6477755d6a7408a93cc85240c82986
|
[
"MIT"
] | 1
|
2021-03-31T19:25:18.000Z
|
2021-03-31T19:25:18.000Z
|
test.py
|
maowman/py-iot-sensor-controller
|
19911d27ea6477755d6a7408a93cc85240c82986
|
[
"MIT"
] | null | null | null |
import requests
from bs4 import BeautifulSoup
req=requests.get("http://192.168.4.1/value")
bsobj=BeautifulSoup(req.text,features="html5lib")
table=bsobj.find_all("font")
print(table)
print(table[2].get_text())
print(table[4].get_text())
print(table[6].get_text())
| 29.222222
| 49
| 0.764259
| 43
| 263
| 4.581395
| 0.55814
| 0.203046
| 0.121827
| 0.172589
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.051793
| 0.045627
| 263
| 9
| 50
| 29.222222
| 0.733068
| 0
| 0
| 0
| 0
| 0
| 0.136364
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.222222
| 0
| 0.222222
| 0.444444
| 0
| 0
| 0
| null | 1
| 0
| 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
| 4
|
3f6f2c088400b9e4d67351be504e9295f704ca20
| 142
|
py
|
Python
|
constants/session_constants.py
|
ORC-RIS/beiwe-backend
|
af2c43f79350bf0fc1ce8efafab1ac9c40008c40
|
[
"BSD-3-Clause"
] | 1
|
2022-03-12T16:25:50.000Z
|
2022-03-12T16:25:50.000Z
|
constants/session_constants.py
|
ORC-RIS/beiwe-backend
|
af2c43f79350bf0fc1ce8efafab1ac9c40008c40
|
[
"BSD-3-Clause"
] | null | null | null |
constants/session_constants.py
|
ORC-RIS/beiwe-backend
|
af2c43f79350bf0fc1ce8efafab1ac9c40008c40
|
[
"BSD-3-Clause"
] | null | null | null |
SESSION_NAME = "researcher_username"
EXPIRY_NAME = "expiry"
SESSION_UUID = "session_uuid"
STUDY_ADMIN_RESTRICTION = "study_admin_restriction"
| 28.4
| 51
| 0.830986
| 17
| 142
| 6.411765
| 0.529412
| 0.201835
| 0.385321
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.084507
| 142
| 4
| 52
| 35.5
| 0.838462
| 0
| 0
| 0
| 0
| 0
| 0.422535
| 0.161972
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3f6f906e28b7c17f42adf86ce74142231a95b14d
| 85
|
py
|
Python
|
wagtailcommerce/tests/demoproducts/__init__.py
|
theplusagency/wagtail-commerce
|
6047170f29199ccaf2778534976ab0970c2877e7
|
[
"BSD-3-Clause"
] | 3
|
2019-04-12T15:38:43.000Z
|
2019-09-22T10:23:20.000Z
|
wagtailcommerce/tests/demoproducts/__init__.py
|
wagtailcommerce/wagtailcommerce
|
308ed8348483806c16062d09a7e69ec44d9a2e73
|
[
"BSD-3-Clause"
] | null | null | null |
wagtailcommerce/tests/demoproducts/__init__.py
|
wagtailcommerce/wagtailcommerce
|
308ed8348483806c16062d09a7e69ec44d9a2e73
|
[
"BSD-3-Clause"
] | null | null | null |
default_app_config = 'wagtailcommerce.tests.demoproducts.apps.DemoProductsAppConfig'
| 42.5
| 84
| 0.882353
| 8
| 85
| 9.125
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.035294
| 85
| 1
| 85
| 85
| 0.890244
| 0
| 0
| 0
| 0
| 0
| 0.717647
| 0.717647
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
58aac4f38435612a6c470c8008f25c192a373a72
| 109
|
py
|
Python
|
datamodules/__init__.py
|
TheCamilovisk/FashionMNISTClassifier
|
8f75253cfb4f58c075b4e02b1dddcede00a71609
|
[
"MIT"
] | null | null | null |
datamodules/__init__.py
|
TheCamilovisk/FashionMNISTClassifier
|
8f75253cfb4f58c075b4e02b1dddcede00a71609
|
[
"MIT"
] | null | null | null |
datamodules/__init__.py
|
TheCamilovisk/FashionMNISTClassifier
|
8f75253cfb4f58c075b4e02b1dddcede00a71609
|
[
"MIT"
] | null | null | null |
from datamodules.fashionmnist_datamodule import FashionMNISTDataModule
__all__ = ["FashionMNISTDataModule"]
| 27.25
| 70
| 0.87156
| 8
| 109
| 11.25
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.073395
| 109
| 3
| 71
| 36.333333
| 0.891089
| 0
| 0
| 0
| 0
| 0
| 0.201835
| 0.201835
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
58c35c591e26f610c979a75034241da955b995df
| 171
|
py
|
Python
|
venv/Scripts/django-admin.py
|
Jackintoshh/Web-Mapping
|
a0ed8e207b7223c3c97d1110fffdf6fd5af4db5c
|
[
"MIT"
] | null | null | null |
venv/Scripts/django-admin.py
|
Jackintoshh/Web-Mapping
|
a0ed8e207b7223c3c97d1110fffdf6fd5af4db5c
|
[
"MIT"
] | 5
|
2021-04-08T22:01:19.000Z
|
2022-02-10T12:21:29.000Z
|
venv/Scripts/django-admin.py
|
Jackintoshh/Web-Mapping
|
a0ed8e207b7223c3c97d1110fffdf6fd5af4db5c
|
[
"MIT"
] | null | null | null |
#!C:\Users\jjwri\PycharmProjects\mapping\venv\Scripts\python.exe
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 28.5
| 64
| 0.795322
| 22
| 171
| 5.681818
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.087719
| 171
| 5
| 65
| 34.2
| 0.801282
| 0.368421
| 0
| 0
| 0
| 0
| 0.074766
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
58effdab79702be302ba6586af5f9b063e1c45fa
| 75
|
py
|
Python
|
simplex/infrastructure/storage/__init__.py
|
wetherc/simplex
|
69b44d5679457f832dd68699cec3df0e388598d1
|
[
"Apache-2.0"
] | null | null | null |
simplex/infrastructure/storage/__init__.py
|
wetherc/simplex
|
69b44d5679457f832dd68699cec3df0e388598d1
|
[
"Apache-2.0"
] | null | null | null |
simplex/infrastructure/storage/__init__.py
|
wetherc/simplex
|
69b44d5679457f832dd68699cec3df0e388598d1
|
[
"Apache-2.0"
] | null | null | null |
from .management.storage_management_api import SimplexStorageManagementAPI
| 37.5
| 74
| 0.92
| 7
| 75
| 9.571429
| 0.857143
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.053333
| 75
| 1
| 75
| 75
| 0.943662
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
4508165c545b5e019ee03a0e696895fab9ace731
| 568
|
py
|
Python
|
src/test_minimum_window_substring.py
|
manoldonev/algo-challenges
|
0ecbc79fdc62d6f4712405a55bbab3e49d5139a6
|
[
"MIT"
] | null | null | null |
src/test_minimum_window_substring.py
|
manoldonev/algo-challenges
|
0ecbc79fdc62d6f4712405a55bbab3e49d5139a6
|
[
"MIT"
] | null | null | null |
src/test_minimum_window_substring.py
|
manoldonev/algo-challenges
|
0ecbc79fdc62d6f4712405a55bbab3e49d5139a6
|
[
"MIT"
] | null | null | null |
import unittest
from minimum_window_substring import minimum_window_substring
class MinimumWindowSubstringTests(unittest.TestCase):
"""Tests for minimum window substring challenge."""
def test_case_1(self):
self.assertEqual(minimum_window_substring(
"ADOBECODEBANC", "ABC"), "BANC")
def test_case_2(self):
self.assertEqual(minimum_window_substring("a", "aa"), "")
def test_case_3(self):
self.assertEqual(minimum_window_substring("aa", "aa"), "aa")
if __name__ == "__main__":
unittest.main(verbosity=2)
| 23.666667
| 68
| 0.702465
| 65
| 568
| 5.769231
| 0.446154
| 0.208
| 0.352
| 0.208
| 0.328
| 0.328
| 0
| 0
| 0
| 0
| 0
| 0.008565
| 0.177817
| 568
| 23
| 69
| 24.695652
| 0.794433
| 0.079225
| 0
| 0
| 0
| 0
| 0.071705
| 0
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0.25
| false
| 0
| 0.166667
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
450858fae76100259aafad56fb05a2b46d0b1bb9
| 72
|
py
|
Python
|
engine/errors/__init__.py
|
dentonmwood/codeDuplicationParser
|
9f9a83ed850e1a33ee41848a97fd852fa1bfe3b0
|
[
"MIT"
] | 1
|
2021-01-08T21:31:03.000Z
|
2021-01-08T21:31:03.000Z
|
engine/errors/__init__.py
|
dentonmwood/codeDuplicationParser
|
9f9a83ed850e1a33ee41848a97fd852fa1bfe3b0
|
[
"MIT"
] | 51
|
2019-07-09T12:17:02.000Z
|
2019-11-22T17:25:57.000Z
|
engine/errors/__init__.py
|
dentonmwood/codeDuplicationParser
|
9f9a83ed850e1a33ee41848a97fd852fa1bfe3b0
|
[
"MIT"
] | 6
|
2019-07-09T09:52:09.000Z
|
2019-10-07T15:48:27.000Z
|
"""Package containing all custom exceptions used by the application."""
| 36
| 71
| 0.777778
| 9
| 72
| 6.222222
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.125
| 72
| 1
| 72
| 72
| 0.888889
| 0.902778
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
452c0216b684039389c3686d8d49e521cc857963
| 205
|
py
|
Python
|
example_call_fetch_senate_votes_worker.py
|
ATLJoeReed/ga-legislation-scraper
|
7933bb57cb62b0bf5974aff8cd05e1fa9498cae8
|
[
"MIT"
] | null | null | null |
example_call_fetch_senate_votes_worker.py
|
ATLJoeReed/ga-legislation-scraper
|
7933bb57cb62b0bf5974aff8cd05e1fa9498cae8
|
[
"MIT"
] | null | null | null |
example_call_fetch_senate_votes_worker.py
|
ATLJoeReed/ga-legislation-scraper
|
7933bb57cb62b0bf5974aff8cd05e1fa9498cae8
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python3.9
# -*- coding: utf-8 -*-
from utils import helpers
from workers import fetch_senate_votes
results = fetch_senate_votes.process()
helpers.write_json_file('senate_votes.json', results)
| 22.777778
| 53
| 0.770732
| 30
| 205
| 5.033333
| 0.666667
| 0.218543
| 0.211921
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.016304
| 0.102439
| 205
| 8
| 54
| 25.625
| 0.804348
| 0.2
| 0
| 0
| 0
| 0
| 0.104938
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
453c5b009bdc939707f0468c07f590c425a96d65
| 74
|
py
|
Python
|
homeworkpye1.py
|
piushdas03/day1pye
|
9079dde0896bbbdff3d7e1e2f5b209b911309f0f
|
[
"Unlicense"
] | null | null | null |
homeworkpye1.py
|
piushdas03/day1pye
|
9079dde0896bbbdff3d7e1e2f5b209b911309f0f
|
[
"Unlicense"
] | null | null | null |
homeworkpye1.py
|
piushdas03/day1pye
|
9079dde0896bbbdff3d7e1e2f5b209b911309f0f
|
[
"Unlicense"
] | null | null | null |
Li = [ 22, 35 , 26 , 98 , 55 , 10 , 67 ]
Li.sort()
Li.reverse()
print(Li)
| 14.8
| 40
| 0.513514
| 14
| 74
| 2.714286
| 0.785714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.254545
| 0.256757
| 74
| 4
| 41
| 18.5
| 0.436364
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1890bb8ee3c0d96a3c8a560f157fcd78a3bd62d3
| 223
|
py
|
Python
|
mayan/apps/tags/admin.py
|
CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons
|
0e4e919fd2e1ded6711354a0330135283e87f8c7
|
[
"Apache-2.0"
] | 2
|
2021-09-12T19:41:19.000Z
|
2021-09-12T19:41:20.000Z
|
mayan/apps/tags/admin.py
|
CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons
|
0e4e919fd2e1ded6711354a0330135283e87f8c7
|
[
"Apache-2.0"
] | 37
|
2021-09-13T01:00:12.000Z
|
2021-10-02T03:54:30.000Z
|
mayan/apps/tags/admin.py
|
CMU-313/fall-2021-hw2-451-unavailable-for-legal-reasons
|
0e4e919fd2e1ded6711354a0330135283e87f8c7
|
[
"Apache-2.0"
] | 1
|
2021-09-22T13:17:30.000Z
|
2021-09-22T13:17:30.000Z
|
from django.contrib import admin
from .models import Tag
@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
filter_horizontal = ('documents',)
list_display = ('label', 'color', 'get_preview_widget')
| 22.3
| 60
| 0.704036
| 26
| 223
| 5.884615
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.174888
| 223
| 9
| 61
| 24.777778
| 0.831522
| 0
| 0
| 0
| 0
| 0
| 0.172897
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.833333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
18b60c366e0e90fa25be78bffe8d4f9e1d037f2b
| 211
|
py
|
Python
|
catalogueapi/database/__init__.py
|
OpertusMundi/catalogue-service
|
ecc64e7d1460b04699e523570875e79d7edaa3bf
|
[
"Apache-2.0"
] | null | null | null |
catalogueapi/database/__init__.py
|
OpertusMundi/catalogue-service
|
ecc64e7d1460b04699e523570875e79d7edaa3bf
|
[
"Apache-2.0"
] | 4
|
2021-01-29T11:14:54.000Z
|
2022-01-20T08:43:48.000Z
|
catalogueapi/database/__init__.py
|
OpertusMundi/catalogue-service
|
ecc64e7d1460b04699e523570875e79d7edaa3bf
|
[
"Apache-2.0"
] | null | null | null |
import logging
from flask_sqlalchemy import SQLAlchemy
log = logging.getLogger(__name__)
db = SQLAlchemy()
def reset_database():
db.drop_all()
db.create_all()
def delete_database():
db.drop_all()
| 16.230769
| 39
| 0.734597
| 28
| 211
| 5.178571
| 0.571429
| 0.137931
| 0.193103
| 0.234483
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.161137
| 211
| 13
| 40
| 16.230769
| 0.819209
| 0
| 0
| 0.222222
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.222222
| false
| 0
| 0.222222
| 0
| 0.444444
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
18c9a95687a4b49bfe8e1d5c0c0ed4eb4696a422
| 72
|
py
|
Python
|
saved_models/__init__.py
|
shuvoxcd01/reinforce
|
6b74fb106774d84382ebf8c7ee2fc40c4af05b3e
|
[
"Apache-2.0"
] | 1
|
2021-01-24T19:31:35.000Z
|
2021-01-24T19:31:35.000Z
|
saved_models/__init__.py
|
shuvoxcd01/reinforce
|
6b74fb106774d84382ebf8c7ee2fc40c4af05b3e
|
[
"Apache-2.0"
] | null | null | null |
saved_models/__init__.py
|
shuvoxcd01/reinforce
|
6b74fb106774d84382ebf8c7ee2fc40c4af05b3e
|
[
"Apache-2.0"
] | null | null | null |
import os
saved_model_dir = os.path.dirname(os.path.abspath(__file__))
| 18
| 60
| 0.791667
| 12
| 72
| 4.25
| 0.75
| 0.235294
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 72
| 3
| 61
| 24
| 0.772727
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
18ec0fbb37f41a88db979cec5eed2662abaeb6d3
| 352
|
py
|
Python
|
docs-italia-theme/__init__.py
|
vargiuscuola/docs-italia-theme
|
0621a10cc56af1bce154434d6124e9d278e347c6
|
[
"BSD-3-Clause"
] | null | null | null |
docs-italia-theme/__init__.py
|
vargiuscuola/docs-italia-theme
|
0621a10cc56af1bce154434d6124e9d278e347c6
|
[
"BSD-3-Clause"
] | null | null | null |
docs-italia-theme/__init__.py
|
vargiuscuola/docs-italia-theme
|
0621a10cc56af1bce154434d6124e9d278e347c6
|
[
"BSD-3-Clause"
] | null | null | null |
# This file is here for compatibility because the
# theme changed his name to docs_italia_theme
"""Docs Italia theme for Vargiu Scuola Srl"""
import os
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = os.path.abspath(os.path.dirname(__file__) + '../docs_italia_theme')
return cur_dir
def setup(app):
pass
| 23.466667
| 81
| 0.71875
| 55
| 352
| 4.363636
| 0.636364
| 0.125
| 0.1875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.178977
| 352
| 14
| 82
| 25.142857
| 0.83045
| 0.46875
| 0
| 0
| 0
| 0
| 0.114286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.166667
| 0.166667
| 0
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
7a1079540991a44372ad615559e89d2f671de494
| 775
|
py
|
Python
|
tools/telemetry/telemetry/core/backends/google_credentials_backend.py
|
nagineni/chromium-crosswalk
|
5725642f1c67d0f97e8613ec1c3e8107ab53fdf8
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 231
|
2015-01-08T09:04:44.000Z
|
2021-12-30T03:03:10.000Z
|
tools/telemetry/telemetry/core/backends/google_credentials_backend.py
|
j4ckfrost/android_external_chromium_org
|
a1a3dad8b08d1fcf6b6b36c267158ed63217c780
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1
|
2018-02-10T21:00:08.000Z
|
2018-03-20T05:09:50.000Z
|
tools/telemetry/telemetry/core/backends/google_credentials_backend.py
|
j4ckfrost/android_external_chromium_org
|
a1a3dad8b08d1fcf6b6b36c267158ed63217c780
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 268
|
2015-01-21T05:53:28.000Z
|
2022-03-25T22:09:01.000Z
|
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.core.backends import form_based_credentials_backend
class GoogleCredentialsBackend(
form_based_credentials_backend.FormBasedCredentialsBackend):
def IsAlreadyLoggedIn(self, tab):
return tab.EvaluateJavaScript(
'document.getElementById("gb")!== null')
@property
def credentials_type(self):
return 'google'
@property
def url(self):
return 'https://accounts.google.com/'
@property
def login_form_id(self):
return 'gaia_loginform'
@property
def login_input_id(self):
return 'Email'
@property
def password_input_id(self):
return 'Passwd'
| 24.21875
| 72
| 0.741935
| 96
| 775
| 5.84375
| 0.65625
| 0.098039
| 0.064171
| 0.096257
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00624
| 0.172903
| 775
| 31
| 73
| 25
| 0.868955
| 0.2
| 0
| 0.238095
| 0
| 0
| 0.155844
| 0.051948
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.095238
| 0.047619
| 0.285714
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 1
| 0
|
0
| 4
|
e13275b017e689dcccdd7eda37c2ece0e17e2407
| 293
|
py
|
Python
|
throttled/fastapi/__init__.py
|
thiagomini/ThrottledAPI
|
434d495e4d76482b738a6dde3e05bdad0d9ab9cd
|
[
"MIT"
] | 10
|
2022-01-24T17:20:31.000Z
|
2022-03-04T19:51:28.000Z
|
throttled/fastapi/__init__.py
|
thiagomini/ThrottledAPI
|
434d495e4d76482b738a6dde3e05bdad0d9ab9cd
|
[
"MIT"
] | 1
|
2022-02-18T23:20:06.000Z
|
2022-02-18T23:20:06.000Z
|
throttled/fastapi/__init__.py
|
thiagomini/ThrottledAPI
|
434d495e4d76482b738a6dde3e05bdad0d9ab9cd
|
[
"MIT"
] | 1
|
2022-02-18T12:38:51.000Z
|
2022-02-18T12:38:51.000Z
|
from .base import FastAPILimiter, MiddlewareLimiter
from .limiters import IPLimiter, TotalLimiter
from .utils import split_dependencies_and_middlewares
__all__ = [
"TotalLimiter",
"IPLimiter",
"split_dependencies_and_middlewares",
"FastAPILimiter",
"MiddlewareLimiter",
]
| 24.416667
| 53
| 0.771331
| 26
| 293
| 8.307692
| 0.538462
| 0.287037
| 0.185185
| 0.287037
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.150171
| 293
| 11
| 54
| 26.636364
| 0.86747
| 0
| 0
| 0
| 0
| 0
| 0.293515
| 0.116041
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.3
| 0
| 0.3
| 0
| 1
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e15be6bdcf0e1a89036eb9c67e985ff3a07c9034
| 789
|
py
|
Python
|
test.py
|
lexibank/mcelhanonhuon
|
fe2667dc5da0484c5970f4c1e63ea8b4d524917f
|
[
"CC-BY-4.0"
] | null | null | null |
test.py
|
lexibank/mcelhanonhuon
|
fe2667dc5da0484c5970f4c1e63ea8b4d524917f
|
[
"CC-BY-4.0"
] | 8
|
2019-04-08T19:07:36.000Z
|
2021-04-21T14:23:30.000Z
|
test.py
|
lexibank/mcelhanonhuon
|
fe2667dc5da0484c5970f4c1e63ea8b4d524917f
|
[
"CC-BY-4.0"
] | null | null | null |
def test_valid(cldf_dataset, cldf_logger):
assert cldf_dataset.validate(log=cldf_logger)
def test_languages(cldf_dataset, cldf_logger):
assert len(list(cldf_dataset['LanguageTable'])) == 14
def test_sources(cldf_dataset, cldf_logger):
assert len(cldf_dataset.sources) == 1
def test_parameters(cldf_dataset, cldf_logger):
assert len(list(cldf_dataset['ParameterTable'])) == 140
def test_forms(cldf_dataset, cldf_logger):
assert len(list(cldf_dataset['FormTable'])) == 1960
# 90829 komba sun mirâsiŋ sun
assert len([
f for f in cldf_dataset['FormTable'] if f['Form'] == 'mirâsiŋ'
]) == 1
def test_cognates(cldf_dataset, cldf_logger):
cogsets = {c['Cognateset_ID'] for c in cldf_dataset['CognateTable']}
assert len(cogsets) == 949
| 26.3
| 72
| 0.714829
| 109
| 789
| 4.926606
| 0.348624
| 0.266294
| 0.167598
| 0.234637
| 0.357542
| 0.307263
| 0.251397
| 0.251397
| 0.251397
| 0
| 0
| 0.028744
| 0.162231
| 789
| 29
| 73
| 27.206897
| 0.783661
| 0.034221
| 0
| 0
| 0
| 0
| 0.107001
| 0
| 0
| 0
| 0
| 0
| 0.4375
| 1
| 0.375
| false
| 0
| 0
| 0
| 0.375
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
e168a4e2e92ec9c71a563668f4da84ca62dcfae6
| 162
|
py
|
Python
|
pymtl3_net/ocnlib/rtl/__init__.py
|
cornell-brg/ocn-posh
|
7f8bfd800627364cfc37dc5d6a36333ee2e48c99
|
[
"BSD-3-Clause"
] | 3
|
2019-06-07T13:27:06.000Z
|
2019-07-16T19:00:23.000Z
|
pymtl3_net/ocnlib/rtl/__init__.py
|
cornell-brg/ocn-posh
|
7f8bfd800627364cfc37dc5d6a36333ee2e48c99
|
[
"BSD-3-Clause"
] | 12
|
2019-07-23T02:29:31.000Z
|
2019-07-25T11:07:00.000Z
|
pymtl3_net/ocnlib/rtl/__init__.py
|
cornell-brg/posh-ocn
|
7f8bfd800627364cfc37dc5d6a36333ee2e48c99
|
[
"BSD-3-Clause"
] | null | null | null |
from .Counter import Counter
from .GrantHoldArbiter import GrantHoldArbiter
from .SerializerRTL import SerializerRTL
from .DeserializerRTL import DeserializerRTL
| 32.4
| 46
| 0.876543
| 16
| 162
| 8.875
| 0.375
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.098765
| 162
| 4
| 47
| 40.5
| 0.972603
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
e1b8b00a79a2ba6657c3124752a12ea42555e6be
| 281
|
py
|
Python
|
questions_three/vanilla/structure_sequence.py
|
filfreire/questions-three
|
1d1d621d5647407bf2d1b271e0b9c7c9f1afc5c8
|
[
"MIT"
] | 5
|
2019-07-22T06:04:07.000Z
|
2021-07-23T06:01:51.000Z
|
questions_three/vanilla/structure_sequence.py
|
filfreire/questions-three
|
1d1d621d5647407bf2d1b271e0b9c7c9f1afc5c8
|
[
"MIT"
] | 15
|
2020-07-28T17:33:40.000Z
|
2021-08-23T17:30:05.000Z
|
questions_three/vanilla/structure_sequence.py
|
filfreire/questions-three
|
1d1d621d5647407bf2d1b271e0b9c7c9f1afc5c8
|
[
"MIT"
] | 4
|
2019-08-25T22:41:59.000Z
|
2020-10-21T14:28:15.000Z
|
import json
from .structure import Structure
def structures_from_json(json_string):
return [Structure(**dct) for dct in json.loads(json_string)]
def structures_to_json(sequence_of_structures):
return "[" + ",".join([s.to_json() for s in sequence_of_structures]) + "]"
| 23.416667
| 78
| 0.736655
| 40
| 281
| 4.9
| 0.425
| 0.132653
| 0.204082
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.13879
| 281
| 11
| 79
| 25.545455
| 0.809917
| 0
| 0
| 0
| 0
| 0
| 0.010676
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 1
| 0
| 0
|
0
| 4
|
e1be70daf3b1dd05a2356dbfa5bfeee198e570c9
| 228
|
py
|
Python
|
combojsonapi/postgresql_jsonb/__init__.py
|
Bykov25/combojsonapi
|
736910ef782109455fcacbcadacfa9474ea2ceb7
|
[
"MIT"
] | 8
|
2020-01-27T12:42:53.000Z
|
2021-08-13T12:25:45.000Z
|
combojsonapi/postgresql_jsonb/__init__.py
|
Bykov25/combojsonapi
|
736910ef782109455fcacbcadacfa9474ea2ceb7
|
[
"MIT"
] | 21
|
2020-04-09T22:14:32.000Z
|
2021-08-19T18:55:46.000Z
|
combojsonapi/postgresql_jsonb/__init__.py
|
Bykov25/combojsonapi
|
736910ef782109455fcacbcadacfa9474ea2ceb7
|
[
"MIT"
] | 4
|
2020-04-09T22:14:52.000Z
|
2021-06-20T22:01:09.000Z
|
from combojsonapi.postgresql_jsonb.schema import SchemaJSONB
from combojsonapi.postgresql_jsonb.plugin import PostgreSqlJSONB, is_seq_collection
__all__ = [
"PostgreSqlJSONB",
"is_seq_collection",
"SchemaJSONB",
]
| 22.8
| 83
| 0.79386
| 23
| 228
| 7.434783
| 0.565217
| 0.187135
| 0.304094
| 0.362573
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.131579
| 228
| 9
| 84
| 25.333333
| 0.863636
| 0
| 0
| 0
| 0
| 0
| 0.188596
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.285714
| 0
| 0.285714
| 0
| 1
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
830378b26c67b8042971b88cb3ee72b20bbd5e79
| 152
|
py
|
Python
|
Oriana/apps.py
|
Norcha-lv/Clone-from-Oriana
|
7afd908559ab19dc7afd11298479a8e6b8990330
|
[
"BSD-3-Clause"
] | 165
|
2018-09-06T22:39:17.000Z
|
2022-03-11T20:49:06.000Z
|
Oriana/apps.py
|
opexxx/Oriana
|
300d9cf7b663c8ee847caa47615a1f86e74c2924
|
[
"BSD-3-Clause"
] | 1
|
2018-09-07T14:37:56.000Z
|
2019-04-13T21:33:49.000Z
|
Oriana/apps.py
|
opexxx/Oriana
|
300d9cf7b663c8ee847caa47615a1f86e74c2924
|
[
"BSD-3-Clause"
] | 36
|
2018-09-06T22:51:27.000Z
|
2022-01-17T23:32:22.000Z
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class OrianaConfig(AppConfig):
name = 'Oriana'
| 16.888889
| 39
| 0.730263
| 18
| 152
| 5.888889
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.007874
| 0.164474
| 152
| 8
| 40
| 19
| 0.826772
| 0.138158
| 0
| 0
| 0
| 0
| 0.046512
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 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
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
831caf1cd7f4427eb037f27028c564ff91912913
| 54
|
py
|
Python
|
src/util/__init__.py
|
heiseish/Dawn-Language
|
513f3664920d0fdd387aa58a3f9a8dba37b00c76
|
[
"MIT"
] | null | null | null |
src/util/__init__.py
|
heiseish/Dawn-Language
|
513f3664920d0fdd387aa58a3f9a8dba37b00c76
|
[
"MIT"
] | null | null | null |
src/util/__init__.py
|
heiseish/Dawn-Language
|
513f3664920d0fdd387aa58a3f9a8dba37b00c76
|
[
"MIT"
] | null | null | null |
from .dawn_intent import *
from .json_encoder import *
| 27
| 27
| 0.796296
| 8
| 54
| 5.125
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.12963
| 54
| 2
| 27
| 27
| 0.87234
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
832c49b89c90c91806bdfa3f4e8a14381c5b1319
| 118
|
py
|
Python
|
metaflow_extensions/org/plugins/env_escape/configurations/__init__.py
|
Netflix/metaflow-extensions-template
|
b968c35b3f12046db2c39e1848e0952103fde625
|
[
"Apache-2.0"
] | 1
|
2022-03-20T18:38:46.000Z
|
2022-03-20T18:38:46.000Z
|
metaflow_extensions/org/plugins/env_escape/configurations/__init__.py
|
Netflix/metaflow-extensions-template
|
b968c35b3f12046db2c39e1848e0952103fde625
|
[
"Apache-2.0"
] | 1
|
2022-03-31T20:15:04.000Z
|
2022-03-31T20:15:04.000Z
|
metaflow_extensions/org/plugins/env_escape/configurations/__init__.py
|
Netflix/metaflow-extensions-template
|
b968c35b3f12046db2c39e1848e0952103fde625
|
[
"Apache-2.0"
] | null | null | null |
###
# CONFIGURE: Place Conda environment escape plugins as sub-folders of this
# configurations folder
###
| 23.6
| 74
| 0.686441
| 13
| 118
| 6.230769
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.228814
| 118
| 4
| 75
| 29.5
| 0.89011
| 0.889831
| 0
| null | 0
| null | 0
| 0
| null | 0
| 0
| 0
| null | 1
| null | true
| 0
| 0
| null | null | null | 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
833511d02dc3fc59d57c5c506dd125dc1a87f533
| 7,924
|
py
|
Python
|
thindicarch.py
|
chillingche/thin-dis-gan
|
de919b0ddaab086b732a8ddc30755a1056ea62de
|
[
"Apache-2.0"
] | null | null | null |
thindicarch.py
|
chillingche/thin-dis-gan
|
de919b0ddaab086b732a8ddc30755a1056ea62de
|
[
"Apache-2.0"
] | null | null | null |
thindicarch.py
|
chillingche/thin-dis-gan
|
de919b0ddaab086b732a8ddc30755a1056ea62de
|
[
"Apache-2.0"
] | null | null | null |
import torch
import torch.nn as nn
import torch.nn.parallel as parallel
import torch.nn.functional as F
# class ConditionalBatchNorm2d(nn.normalization._BatchNorm):
# def __init__(self,
# labels,
# num_features,
# eps=1e-5,
# momentum=0.1,
# affine=True,
# track_running_stats=True):
# super().__init__(num_features, eps, momentum, affine,
# track_running_stats)
# self.res
# def _check_input_dim(self, input):
# if input.dim() != 2 and input.dim() != 3:
# raise ValueError("expected 2D or 3D input (got {}D input)".format(
# input.dim()))
# def forward(self, input):
# self._check_input_dim(input)
# exponential_average_factor = 0.0
# if self.training and self.track_running_stats:
# self.num_batches_tracked += 1
# if self.momentum is None: # use cumulative moving average
# exponential_average_factor = 1.0 / self.num_batches_tracked.item(
# )
# else: # use exponential moving average
# exponential_average_factor = self.momentum
# return F.batch_norm(input, self.running_mean, self.running_var,
# self.weight, self.bias, self.training
# or not self.track_running_stats,
# exponential_average_factor, self.eps)
class CSketchDiscriminator(nn.Module):
ndf = 128
def __init__(self, ngpu, nclass=10):
super().__init__()
self.ngpu = ngpu
self.main = nn.Sequential(
nn.Conv2d(1, self.ndf, 4, 2, 1, bias=False), # 128, 16, 16
nn.LeakyReLU(0.2, True),
nn.Conv2d(self.ndf, 2 * self.ndf, 4, 2, 1,
bias=False), # 256, 8, 8
nn.BatchNorm2d(2 * self.ndf),
nn.LeakyReLU(0.2, True),
nn.Conv2d(2 * self.ndf, 4 * self.ndf, 4, 2, 1,
bias=False), # 512, 4, 4
nn.BatchNorm2d(4 * self.ndf),
nn.LeakyReLU(0.2, True),
Flat())
self.class_branch = nn.Linear(4 * self.ndf*4*4, nclass)
self.dis_branch = nn.Linear(4 * self.ndf*4*4, 1)
def forward(self, input):
if input.is_cuda and self.ngpu != 1:
feature = parallel.data_parallel(self.main, input, range(self.ngpu))
class_output = parallel.data_parallel(self.class_branch, feature, range(self.ngpu))
dis_output = parallel.data_parallel(self.dis_branch, feature, range(self.ngpu))
else:
feature = self.main(input)
class_output = self.class_branch(feature)
dis_output = self.dis_branch(feature)
return class_output, dis_output
class CSKetchGenerator(nn.Module):
nz = 100
ngf = 128
nc = 1
def __init__(self, ngpu, nclass=10):
super().__init__()
self.ngpu = ngpu
self.nclass = nclass
self.main = nn.Sequential(
nn.ConvTranspose2d(self.nz + nclass, self.ngf * 4, 4, 1, 0,
bias=False), # 512, 4, 4
nn.BatchNorm2d(self.ngf * 4),
nn.ReLU(True),
nn.ConvTranspose2d(
self.ngf * 4, self.ngf * 2, 4, 2, 1, bias=False), # 256, 8, 8
nn.BatchNorm2d(self.ngf * 2),
nn.ReLU(True),
nn.ConvTranspose2d(self.ngf * 2, self.ngf, 4, 2, 1,
bias=False), # 128, 16, 16
nn.BatchNorm2d(self.ngf),
nn.ReLU(True),
nn.ConvTranspose2d(self.ngf, self.nc, 4, 2, 1,
bias=False), # 3, 32, 32
nn.Tanh())
def forward(self, input, y):
if input.is_cuda:
y_onehot = torch.zeros([y.size(0), self.nclass, 1, 1], device=torch.device("cuda"))
else:
y_onehot = torch.zeros([y.size(0), self.nclass, 1, 1], device=torch.device("cpu"))
y_onehot[torch.arange(y.size(0)), y.long()] = 1
input_with_y = torch.cat([y_onehot, input], 1)
if input.is_cuda and self.ngpu != 1:
output = parallel.data_parallel(self.main, input_with_y, range(self.ngpu))
else:
output = self.main(input_with_y)
return output
class CPhotoDiscriminator(nn.Module):
ndf = 128
def __init__(self, ngpu, nclass=10):
super().__init__()
self.ngpu = ngpu
self.main = nn.Sequential(
nn.Conv2d(3, self.ndf, 4, 2, 1, bias=False), # 128, 16, 16
nn.LeakyReLU(0.2, True),
nn.Conv2d(self.ndf, 2 * self.ndf, 4, 2, 1,
bias=False), # 256, 8, 8
nn.BatchNorm2d(2 * self.ndf),
nn.LeakyReLU(0.2, True),
nn.Conv2d(2 * self.ndf, 4 * self.ndf, 4, 2, 1,
bias=False), # 512, 4, 4
nn.BatchNorm2d(4 * self.ndf),
nn.LeakyReLU(0.2, True),
Flat())
self.class_branch = nn.Linear(4 * self.ndf*4*4, nclass)
self.dis_branch = nn.Linear(4 * self.ndf*4*4, 1)
def forward(self, input):
if input.is_cuda and self.ngpu != 1:
feature = parallel.data_parallel(self.main, input, range(self.ngpu))
class_output = parallel.data_parallel(self.class_branch, feature, range(self.ngpu))
dis_output = parallel.data_parallel(self.dis_branch, feature, range(self.ngpu))
else:
feature = self.main(input)
class_output = self.class_branch(feature)
dis_output = self.dis_branch(feature)
return class_output, dis_output
class CPhotoGenerator(nn.Module):
nz = 100
ngf = 128
nc = 3
def __init__(self, ngpu, nclass=10):
super().__init__()
self.ngpu = ngpu
self.nclass = nclass
self.main = nn.Sequential(
nn.Conv2d(self.nz + 1 + nclass, self.ngf, 4, 2, 1,
bias=False), # 128, 16, 16
nn.LeakyReLU(0.2, True),
nn.Conv2d(self.ngf, 2 * self.ngf, 4, 2, 1,
bias=False), # 256, 8, 8
nn.BatchNorm2d(2 * self.ngf),
nn.LeakyReLU(0.2, True),
nn.Conv2d(2 * self.ngf, 4 * self.ngf, 4, 2, 1,
bias=False), # 512, 4, 4
nn.BatchNorm2d(4 * self.ngf),
nn.LeakyReLU(0.2, True),
nn.ConvTranspose2d(
self.ngf * 4, self.ngf * 2, 4, 2, 1, bias=False), # 256, 8, 8
nn.BatchNorm2d(self.ngf * 2),
nn.ReLU(True),
nn.ConvTranspose2d(self.ngf * 2, self.ngf, 4, 2, 1,
bias=False), # 128, 16, 16
nn.BatchNorm2d(self.ngf),
nn.ReLU(True),
nn.ConvTranspose2d(self.ngf, self.nc, 4, 2, 1,
bias=False), # 3, 32, 32
nn.Tanh())
def forward(self, input, z, y):
if input.is_cuda:
y_onehot = torch.zeros([y.size(0), self.nclass, 1, 1], device=torch.device("cuda"))
else:
y_onehot = torch.zeros([y.size(0), self.nclass, 1, 1], device=torch.device("cpu"))
y_onehot[torch.arange(y.size(0)), y.long()] = 1
z = torch.cat([y_onehot, z], 1)
z_img = z.expand(z.size(0), z.size(1), input.size(2), input.size(3))
input_with_z = torch.cat([input, z_img], 1)
if input.is_cuda and self.ngpu != 1:
output = parallel.data_parallel(self.main, input_with_z,
range(self.ngpu))
else:
output = self.main(input_with_z)
return output
class Flat(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
nbatch, c, h, w = input.size()
return input.view(nbatch, c * h * w)
| 38.843137
| 95
| 0.529026
| 1,029
| 7,924
| 3.937804
| 0.120505
| 0.039733
| 0.011106
| 0.025913
| 0.724827
| 0.70459
| 0.70311
| 0.682873
| 0.678184
| 0.651037
| 0
| 0.056354
| 0.34162
| 7,924
| 203
| 96
| 39.034483
| 0.720337
| 0.190813
| 0
| 0.773333
| 0
| 0
| 0.0022
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.066667
| false
| 0
| 0.026667
| 0
| 0.213333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
55f8e0716cc882c3a4c6fff6d17c4823d45c7d29
| 619
|
py
|
Python
|
pycrud/error.py
|
fy0/querylayer
|
424411a7d69ef2732b3c6e2f90030f93eb45f059
|
[
"MIT"
] | 4
|
2020-11-09T03:11:45.000Z
|
2021-04-21T12:37:12.000Z
|
pycrud/error.py
|
fy0/pycurd
|
424411a7d69ef2732b3c6e2f90030f93eb45f059
|
[
"MIT"
] | null | null | null |
pycrud/error.py
|
fy0/pycurd
|
424411a7d69ef2732b3c6e2f90030f93eb45f059
|
[
"MIT"
] | 1
|
2022-03-27T06:43:21.000Z
|
2022-03-27T06:43:21.000Z
|
class PyCrudException(Exception):
pass
class DBException(PyCrudException):
pass
class PermissionException(PyCrudException):
pass
class UnknownDatabaseException(PyCrudException):
pass
class InvalidQueryConditionColumn(PyCrudException):
pass
class InvalidQueryConditionOperator(PyCrudException):
pass
class InvalidQueryConditionValue(PyCrudException):
pass
class UnknownQueryOperator(PyCrudException):
pass
class InvalidQueryValue(PyCrudException):
pass
class InvalidOrderSyntax(PyCrudException):
pass
class UnsupportedQueryOperator(PyCrudException):
pass
| 14.068182
| 53
| 0.788368
| 44
| 619
| 11.090909
| 0.318182
| 0.184426
| 0.442623
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15832
| 619
| 43
| 54
| 14.395349
| 0.93666
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0.5
| 0
| 0
| 0.5
| 0
| 0
| 0
| 1
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
363e7e86f3df8c2b40478e005e91bbccf8271cca
| 775
|
py
|
Python
|
simulator/Animals/Farm.py
|
BenMiller3/sap_simulator
|
1ee72a59a735c80e4db82c8806897ae14d663acf
|
[
"MIT"
] | null | null | null |
simulator/Animals/Farm.py
|
BenMiller3/sap_simulator
|
1ee72a59a735c80e4db82c8806897ae14d663acf
|
[
"MIT"
] | null | null | null |
simulator/Animals/Farm.py
|
BenMiller3/sap_simulator
|
1ee72a59a735c80e4db82c8806897ae14d663acf
|
[
"MIT"
] | null | null | null |
from simulator.Animals.Ant import Ant
from simulator.Animals.Beaver import Beaver
from simulator.Animals.Cricket import Cricket
from simulator.Animals.Duck import Duck
from simulator.Animals.Fish import Fish
from simulator.Animals.Horse import Horse
from simulator.Animals.Mosquito import Mosquito
from simulator.Animals.Otter import Otter
from simulator.Animals.Pig import Pig
from simulator.Animals.Sloth import Sloth
import random
class Farm:
def generate_animal(self):
tier_1_pets = [
Ant(),
Beaver(),
Cricket(),
Duck(),
Fish(),
Horse(),
Mosquito(),
Otter(),
Pig(),
Sloth()
]
return random.choice(tier_1_pets)
| 24.21875
| 47
| 0.636129
| 87
| 775
| 5.609195
| 0.298851
| 0.266393
| 0.409836
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003623
| 0.287742
| 775
| 31
| 48
| 25
| 0.880435
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.038462
| false
| 0
| 0.423077
| 0
| 0.538462
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
36567e626d7767ea888c10cb62cfdae322b653f4
| 130
|
py
|
Python
|
oxe-api/exception/article_type_not_allowed.py
|
CybersecurityLuxembourg/openxeco
|
8d4e5578bde6a07f5d6d569b16b4de224abf7bf0
|
[
"BSD-2-Clause"
] | null | null | null |
oxe-api/exception/article_type_not_allowed.py
|
CybersecurityLuxembourg/openxeco
|
8d4e5578bde6a07f5d6d569b16b4de224abf7bf0
|
[
"BSD-2-Clause"
] | null | null | null |
oxe-api/exception/article_type_not_allowed.py
|
CybersecurityLuxembourg/openxeco
|
8d4e5578bde6a07f5d6d569b16b4de224abf7bf0
|
[
"BSD-2-Clause"
] | null | null | null |
class ArticleTypeNotAllowed(Exception):
def __init__(self):
super().__init__("403 The article type is not allowed")
| 21.666667
| 63
| 0.707692
| 15
| 130
| 5.6
| 0.933333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.028571
| 0.192308
| 130
| 5
| 64
| 26
| 0.771429
| 0
| 0
| 0
| 0
| 0
| 0.271318
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 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
| 0
| 0
| 1
| 0
|
0
| 4
|
365f53ca0d3b5a43deab1da50344815bdc2486df
| 69
|
py
|
Python
|
Constants.py
|
saiprasad1996/KandyAPIPython
|
414fa3f74bce5f23d848f8359c1692b856722727
|
[
"MIT"
] | null | null | null |
Constants.py
|
saiprasad1996/KandyAPIPython
|
414fa3f74bce5f23d848f8359c1692b856722727
|
[
"MIT"
] | null | null | null |
Constants.py
|
saiprasad1996/KandyAPIPython
|
414fa3f74bce5f23d848f8359c1692b856722727
|
[
"MIT"
] | null | null | null |
import json
import requests
BASE_URL = 'https://api.kandy.io/v1.2/'
| 13.8
| 39
| 0.724638
| 12
| 69
| 4.083333
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.032787
| 0.115942
| 69
| 4
| 40
| 17.25
| 0.770492
| 0
| 0
| 0
| 0
| 0
| 0.376812
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
36953106f45de69aaabe24e8a1510e1787c0e4c7
| 118
|
py
|
Python
|
core/processador.py
|
DouglasHSS/operating_system
|
ed9c3f6af8659fe261c8a5c57831f9edd10be5de
|
[
"MIT"
] | 1
|
2021-05-26T19:05:09.000Z
|
2021-05-26T19:05:09.000Z
|
core/processador.py
|
DouglasHSS/operating_system
|
ed9c3f6af8659fe261c8a5c57831f9edd10be5de
|
[
"MIT"
] | null | null | null |
core/processador.py
|
DouglasHSS/operating_system
|
ed9c3f6af8659fe261c8a5c57831f9edd10be5de
|
[
"MIT"
] | 1
|
2020-08-24T04:27:57.000Z
|
2020-08-24T04:27:57.000Z
|
# -*- coding: utf-8 -*-
class Processador(object):
def __init__(self):
self.processo_em_execucao = None
| 16.857143
| 40
| 0.635593
| 14
| 118
| 4.928571
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01087
| 0.220339
| 118
| 6
| 41
| 19.666667
| 0.73913
| 0.177966
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 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
| 0
| 0
| 1
| 0
|
0
| 4
|
369ae5160449c74874a2363e2a9e4594a2c446e4
| 280
|
py
|
Python
|
python_test/models/user.py
|
U-lis/python-test
|
80cf7cd3b88d7913240e1c93c4e766b3c89dc404
|
[
"MIT"
] | null | null | null |
python_test/models/user.py
|
U-lis/python-test
|
80cf7cd3b88d7913240e1c93c4e766b3c89dc404
|
[
"MIT"
] | null | null | null |
python_test/models/user.py
|
U-lis/python-test
|
80cf7cd3b88d7913240e1c93c4e766b3c89dc404
|
[
"MIT"
] | null | null | null |
from python_test.db import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Text, nullable=False, unique=True)
user_pw = db.Column(db.Text, nullable=False)
name = db.Column(db.Text, nullable=False)
| 31.111111
| 68
| 0.717857
| 45
| 280
| 4.377778
| 0.466667
| 0.162437
| 0.203046
| 0.213198
| 0.411168
| 0.411168
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15
| 280
| 8
| 69
| 35
| 0.827731
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.166667
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 4
|
7fd30764bf6ea4b735c1573a4f75a11f5015a51b
| 86
|
py
|
Python
|
easyPheno/utils/__init__.py
|
grimmlab/easyPheno
|
176121763ca681d0f0b65c7558d7bb117155c2fa
|
[
"MIT"
] | null | null | null |
easyPheno/utils/__init__.py
|
grimmlab/easyPheno
|
176121763ca681d0f0b65c7558d7bb117155c2fa
|
[
"MIT"
] | null | null | null |
easyPheno/utils/__init__.py
|
grimmlab/easyPheno
|
176121763ca681d0f0b65c7558d7bb117155c2fa
|
[
"MIT"
] | null | null | null |
__all__ = ["check_functions", "helper_functions", "print_functions"]
from . import *
| 21.5
| 68
| 0.732558
| 9
| 86
| 6.222222
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.116279
| 86
| 3
| 69
| 28.666667
| 0.736842
| 0
| 0
| 0
| 0
| 0
| 0.534884
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0.5
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
|
0
| 4
|
7fea3f998f6c49d06d8f89178962f142eb142da0
| 18,034
|
py
|
Python
|
paragres/test/test_command.py
|
AvenzaOleg/paragres
|
411d4aa65fdd851a159fa8a07860b1c05aa6ce23
|
[
"MIT"
] | 10
|
2015-01-25T04:29:38.000Z
|
2018-05-02T02:14:49.000Z
|
paragres/test/test_command.py
|
AvenzaOleg/paragres
|
411d4aa65fdd851a159fa8a07860b1c05aa6ce23
|
[
"MIT"
] | 5
|
2015-01-25T15:17:55.000Z
|
2019-10-03T19:27:11.000Z
|
paragres/test/test_command.py
|
AvenzaOleg/paragres
|
411d4aa65fdd851a159fa8a07860b1c05aa6ce23
|
[
"MIT"
] | 5
|
2015-01-25T07:23:05.000Z
|
2019-01-31T21:19:19.000Z
|
from mock import call, patch
import os
import tempfile
import unittest
from paragres.cli import create_parser
from paragres.command import Command
try:
# Python 3
from urllib import parse # NOQA
urllib_patch_string = 'urllib.request.urlopen'
except ImportError:
# Python 2
urllib_patch_string = 'urllib2.urlopen'
class StringStartsWith(str):
def __eq__(self, other):
return other.find(self) == 0
class TestDbSettings(unittest.TestCase):
def setUp(self):
parser = create_parser()
self.command = Command(parser.parse_args([]))
working_dir = os.path.realpath(os.path.dirname(__file__))
self.data_dir = os.path.join(working_dir, 'data')
self.settings = {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dbname',
'HOST': 'host',
'USER': 'username',
'PASSWORD': 'password',
'PORT': 'port'
}
def test_parse_db_settings_django_settings_module(self):
os.environ['DJANGO_SETTINGS_MODULE'] = 'paragres.test.data.settings'
settings = self.command.parse_db_settings('DJANGO_SETTINGS_MODULE')
self.assertEqual(self.settings, settings)
def test_parse_db_settings(self):
settings = self.command.parse_db_settings(os.path.join(self.data_dir, 'settings.py'))
self.assertEqual(self.settings, settings)
@patch('paragres.command.Command.error')
def test_parse_db_settings_invalid(self, mock_error):
self.command.parse_db_settings(os.path.join(self.data_dir, 'invalid_settings.py'))
mock_error.assert_called_once_with(StringStartsWith("Missing key or value for: 'default'"))
def test_initialize_db_args(self):
self.command.initialize_db_args(self.settings, 'source')
self.assertEqual('dbname', self.command.databases['source']['name'])
expected_args = ['--user=username', '--host=host', '--port=port']
self.assertEqual(expected_args, self.command.databases['source']['args'])
self.assertEqual('password', self.command.databases['source']['password'])
def test_initialize_db_args_db_name_already_set(self):
self.command.databases['source']['name'] = 'bestdb'
self.command.initialize_db_args(self.settings, 'source')
self.assertEqual('bestdb', self.command.databases['source']['name'])
def test_initialize_db_args_no_db_name_in_settings(self):
self.settings['NAME'] = None
self.command.initialize_db_args(self.settings, 'source')
self.assertEqual(None, self.command.databases['source']['name'])
def test_initialize_db_args_missing_key_in_settings(self):
del self.settings['HOST']
self.command.initialize_db_args(self.settings, 'source')
expected_args = ['--user=username', '--port=port']
self.assertEqual(expected_args, self.command.databases['source']['args'])
def test_initialize_db_args_empty_value_in_settings(self):
self.settings['HOST'] = None
self.command.initialize_db_args(self.settings, 'source')
expected_args = ['--user=username', '--port=port']
self.assertEqual(expected_args, self.command.databases['source']['args'])
class TestFileCalls(unittest.TestCase):
def setUp(self):
parser = create_parser()
self.command = Command(parser.parse_args([]))
working_dir = os.path.realpath(os.path.dirname(__file__))
self.data_dir = os.path.join(working_dir, 'data')
@patch('time.strftime')
def test_create_file_name(self, mock_strftime):
mock_strftime.return_value = '2015-01-25-1734'
filename = self.command.create_file_name('bestdb')
self.assertEqual('bestdb-backup-2015-01-25-1734.sql', filename)
mock_strftime.assert_called_once_with('%Y-%m-%d-%H%M')
@patch('paragres.command.Command.error')
@patch(urllib_patch_string)
def test_download_file_error(self, mock_urlopen, mock_error):
mock_urlopen.side_effect = Exception('An error occurred!')
self.command.download_file('http://example.com/', '')
mock_urlopen.assert_called_once_with('http://example.com/')
mock_error.assert_called_once_with('An error occurred!')
@patch(urllib_patch_string)
def test_download_file_success(self, mock_urlopen):
src_filename = os.path.join(self.data_dir, 'src.sql')
mock_urlopen.return_value = open(src_filename, 'rb')
destination_file = tempfile.NamedTemporaryFile()
self.command.download_file('http://example.com/', destination_file.name)
mock_urlopen.assert_called_once_with('http://example.com/')
self.assertEqual(b'PGDMP\n', destination_file.read())
def test_unzip_file_if_necessary_not_zipped(self):
compressed_filename = 'db.sql'
result = self.command.unzip_file_if_necessary(compressed_filename)
self.assertEqual(compressed_filename, result)
@patch('subprocess.check_call')
def test_unzip_file_if_necessary_zipped(self, mock_check_call):
compressed_filename = 'db.sql.gz'
result = self.command.unzip_file_if_necessary(compressed_filename)
self.assertEqual('db.sql', result)
mock_check_call.assert_called_once_with(['gunzip', '--force', compressed_filename])
@patch(urllib_patch_string)
def test_download_file_from_url_no_source_app(self, mock_urlopen):
src_filename = os.path.join(self.data_dir, 'src.sql')
mock_urlopen.return_value = open(src_filename, 'rb')
result = self.command.download_file_from_url(None, 'http://www.example.com')
# Don't want to leave SQL files around, cluttering things up
os.remove(result)
self.assertEqual('www_example_com-backup-', result[:23])
mock_urlopen.assert_called_once_with('http://www.example.com')
@patch(urllib_patch_string)
def test_download_file_from_url_with_source_app(self, mock_urlopen):
src_filename = os.path.join(self.data_dir, 'src.sql')
mock_urlopen.return_value = open(src_filename, 'rb')
result = self.command.download_file_from_url('app1', 'http://www.example.com')
# Don't want to leave SQL files around, cluttering things up
os.remove(result)
self.assertEqual('app1-backup-', result[:12])
mock_urlopen.assert_called_once_with('http://www.example.com')
class TestDbCalls(unittest.TestCase):
def setUp(self):
self.parser = create_parser()
self.command = Command(self.parser.parse_args([]))
@patch('subprocess.check_call')
def test_dump_database_no_extra_args(self, mock_check_call):
self.command.databases['source']['name'] = 'sourcedb'
self.command.dump_database()
expected_args = ['pg_dump', '-Fc', '--no-acl', '--no-owner', '--dbname=sourcedb',
StringStartsWith('--file=sourcedb-backup-')]
mock_check_call.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_dump_database_with_extra_args(self, mock_check_call):
self.command.databases['source']['name'] = 'sourcedb'
self.command.databases['source']['args'] = ['--user=username']
self.command.databases['source']['password'] = 'password'
self.command.dump_database()
self.assertEqual('password', os.environ.get('PGPASSWORD'))
expected_args = ['pg_dump', '-Fc', '--no-acl', '--no-owner', '--dbname=sourcedb',
StringStartsWith('--file=sourcedb-backup-'), '--user=username']
mock_check_call.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_drop_database_no_extra_args(self, mock_check_call):
self.command.databases['destination']['name'] = 'destdb'
self.command.drop_database()
mock_check_call.assert_called_once_with(['dropdb', '--if-exists', 'destdb'])
@patch('subprocess.check_call')
def test_drop_database_with_extra_args(self, mock_check_call):
self.command.databases['destination']['name'] = 'destdb'
self.command.databases['destination']['args'] = ['--user=username']
self.command.databases['destination']['password'] = 'password'
self.command.drop_database()
self.assertEqual('password', os.environ.get('PGPASSWORD'))
expected_args = ['dropdb', '--if-exists', 'destdb', '--user=username']
mock_check_call.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_create_database_no_extra_args(self, mock_check_call):
self.command.databases['destination']['name'] = 'destdb'
self.command.create_database()
mock_check_call.assert_called_once_with(['createdb', 'destdb'])
@patch('subprocess.check_call')
def test_create_database_with_extra_args(self, mock_check_call):
self.command.databases['destination']['name'] = 'destdb'
self.command.databases['destination']['args'] = ['--user=username']
self.command.databases['destination']['password'] = 'password'
self.command.create_database()
self.assertEqual('password', os.environ.get('PGPASSWORD'))
expected_args = ['createdb', 'destdb', '--user=username', '--owner=username']
mock_check_call.assert_called_once_with(expected_args)
@patch(urllib_patch_string)
@patch('subprocess.check_call')
def test_replace_postgres_db_url_file_source(self, mock_check_call, mock_urlopen):
mock_urlopen.return_value = tempfile.NamedTemporaryFile()
command = Command(self.parser.parse_args(['-u', 'http://www.example.com/', '-n', 'destdb']))
command.replace_postgres_db('http://www.example.com/')
expected_calls = [call(['dropdb', '--if-exists', 'destdb']),
call(['createdb', 'destdb']),
call(['pg_restore', '--no-acl', '--no-owner', '--dbname=destdb',
StringStartsWith('www_example_com-backup-')])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
@patch(urllib_patch_string)
@patch('subprocess.check_call')
def test_replace_postgres_db_source(self, mock_check_call, mock_urlopen):
mock_urlopen.return_value = tempfile.NamedTemporaryFile()
command = Command(self.parser.parse_args(['-b', 'sourcedb', '-n', 'destdb']))
command.replace_postgres_db(None)
expected_calls = [call(['pg_dump', '-Fc', '--no-acl', '--no-owner', '--dbname=sourcedb',
StringStartsWith('--file=sourcedb-backup-')]),
call(['dropdb', '--if-exists', 'destdb']),
call(['createdb', 'destdb']),
call(['pg_restore', '--no-acl', '--no-owner', '--dbname=destdb',
StringStartsWith('sourcedb-backup-')])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
@patch('subprocess.check_call')
def test_replace_postgres_local_file_source(self, mock_check_call):
command = Command(self.parser.parse_args(['-f', 'db.sql', '-n', 'destdb']))
command.replace_postgres_db(None)
expected_calls = [call(['dropdb', '--if-exists', 'destdb']),
call(['createdb', 'destdb']),
call(['pg_restore', '--no-acl', '--no-owner', '--dbname=destdb',
'db.sql'])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
class TestHerokuCalls(unittest.TestCase):
def setUp(self):
self.parser = create_parser()
@patch('subprocess.check_output')
def test_get_file_url_for_heroku_app(self, mock_check_output):
mock_check_output.return_value = b' http://example.com/ '
command = Command(self.parser.parse_args([]))
url = command.get_file_url_for_heroku_app('app1')
self.assertEqual('http://example.com/', url)
expected_args = ['heroku', 'pg:backups:url', '--app=app1']
mock_check_output.assert_called_once_with(expected_args)
@patch('subprocess.check_output')
def test_get_file_url_for_heroku_app_use_pgbackups(self, mock_check_output):
mock_check_output.return_value = b' http://example.com/ '
command = Command(self.parser.parse_args(['--use-pgbackups']))
url = command.get_file_url_for_heroku_app('app1')
self.assertEqual('http://example.com/', url)
expected_args = ['heroku', 'pgbackups:url', '--app=app1']
mock_check_output.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_capture_heroku_database(self, mock_check_call):
command = Command(self.parser.parse_args(['-s', 'app1']))
command.capture_heroku_database()
expected_args = ['heroku', 'pg:backups:capture', '--app=app1']
mock_check_call.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_capture_heroku_database_pgbackups(self, mock_check_call):
command = Command(self.parser.parse_args(['-s', 'app1', '--use-pgbackups']))
command.capture_heroku_database()
expected_args = ['heroku', 'pgbackups:capture', '--app=app1', '--expire']
mock_check_call.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_reset_heroku_database(self, mock_check_call):
command = Command(self.parser.parse_args(['-d', 'app2']))
command.reset_heroku_database()
expected_args = ['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']
mock_check_call.assert_called_once_with(expected_args)
@patch('subprocess.check_call')
def test_replace_heroku_db_with_file_url(self, mock_check_call):
command = Command(self.parser.parse_args(['-u', 'www.example.com', '-d', 'app2']))
command.databases['source']['name'] = 'srcdb'
command.replace_heroku_db('www.example.com')
expected_calls = [call(['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']),
call(['heroku', 'pg:backups:restore', 'www.example.com', '--app=app2',
'DATABASE', '--confirm', 'app2'])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
@patch('subprocess.check_call')
def test_replace_heroku_db_with_file_url_pgbackups(self, mock_check_call):
command = Command(self.parser.parse_args(['-u', 'www.example.com', '-d', 'app2',
'--use-pgbackups']))
command.databases['source']['name'] = 'srcdb'
command.replace_heroku_db('www.example.com')
expected_calls = [call(['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']),
call(['heroku', 'pgbackups:restore', '--app=app2', 'DATABASE_URL',
'--confirm', 'app2', 'www.example.com'])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
@patch('subprocess.check_call')
def test_replace_heroku_db_no_file_url(self, mock_check_call):
command = Command(self.parser.parse_args(['-d', 'app2']))
command.databases['source']['name'] = 'srcdb'
command.replace_heroku_db(None)
expected_calls = [call(['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']),
call(['heroku', 'pg:push', 'srcdb', 'DATABASE_URL', '--app=app2'])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
class TestRun(unittest.TestCase):
def setUp(self):
self.parser = create_parser()
@patch('subprocess.check_call')
def test_run_nothing_to_do(self, mock_check_call):
command = Command(self.parser.parse_args([]))
command.run()
self.assertEqual([], mock_check_call.call_args_list)
@patch('subprocess.check_output')
@patch('subprocess.check_call')
def test_run_destination_heroku(self, mock_check_call, mock_check_output):
mock_check_output.return_value = b' http://example.com/ '
command = Command(self.parser.parse_args(['-c', '-s', 'app1', '-d', 'app2']))
command.databases['source']['name'] = 'srcdb'
command.run()
expected_calls = [call(['heroku', 'pg:backups:capture', '--app=app1']),
call(['heroku', 'pg:reset', '--app=app2', 'DATABASE_URL']),
call(['heroku', 'pg:backups:restore', 'http://example.com/',
'--app=app2', 'DATABASE', '--confirm', 'app2'])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
mock_check_output.assert_called_once_with(['heroku', 'pg:backups:url',
'--app=app1'])
@patch('subprocess.check_call')
def test_run_destination_postgres(self, mock_check_call):
working_dir = os.path.realpath(os.path.dirname(__file__))
settings_file = os.path.join(working_dir, 'data', 'settings.py')
command = Command(self.parser.parse_args(['-t', settings_file, '-o', settings_file,
'-b', 'sourcedb']))
command.run()
expected_calls = [
call(['pg_dump', '-Fc', '--no-acl', '--no-owner', '--dbname=sourcedb',
StringStartsWith('--file=sourcedb-backup-'), '--user=username', '--host=host',
'--port=port']),
call(['dropdb', '--if-exists', 'dbname', '--user=username', '--host=host',
'--port=port']),
call(['createdb', 'dbname', '--user=username', '--host=host', '--port=port',
'--owner=username']),
call(['pg_restore', '--no-acl', '--no-owner', '--dbname=dbname',
StringStartsWith('sourcedb-backup-'), '--user=username', '--host=host',
'--port=port'])]
self.assertEqual(expected_calls, mock_check_call.call_args_list)
| 41.842227
| 100
| 0.647056
| 2,118
| 18,034
| 5.216242
| 0.093012
| 0.046434
| 0.044714
| 0.036206
| 0.820511
| 0.777426
| 0.737509
| 0.695511
| 0.65496
| 0.625543
| 0
| 0.004378
| 0.202118
| 18,034
| 430
| 101
| 41.939535
| 0.76343
| 0.007763
| 0
| 0.49505
| 0
| 0
| 0.212992
| 0.0464
| 0
| 0
| 0
| 0
| 0.161716
| 1
| 0.135314
| false
| 0.026403
| 0.026403
| 0.0033
| 0.184818
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
7fecd00f746fe8f5303d3cfcdf0745cd5acf4e53
| 464
|
py
|
Python
|
my_project/my_project/accounts/templatetags/accounts_tags.py
|
Govedarski/World-of-books
|
d270b72600a7986387a277dbe01ac8c6d747f662
|
[
"MIT"
] | null | null | null |
my_project/my_project/accounts/templatetags/accounts_tags.py
|
Govedarski/World-of-books
|
d270b72600a7986387a277dbe01ac8c6d747f662
|
[
"MIT"
] | null | null | null |
my_project/my_project/accounts/templatetags/accounts_tags.py
|
Govedarski/World-of-books
|
d270b72600a7986387a277dbe01ac8c6d747f662
|
[
"MIT"
] | null | null | null |
from datetime import date
from django import template
register = template.Library()
@register.inclusion_tag('accounts/tags/profile_info.html', takes_context=True)
def profile_info(context):
return context
@register.inclusion_tag('accounts/tags/contact_info.html', takes_context=True)
def contacts_info(context):
return context
@register.inclusion_tag('accounts/tags/email_info.html', takes_context=True)
def email_info(context):
return context
| 22.095238
| 78
| 0.795259
| 62
| 464
| 5.758065
| 0.370968
| 0.142857
| 0.168067
| 0.235294
| 0.630252
| 0.540616
| 0.313725
| 0.313725
| 0.313725
| 0
| 0
| 0
| 0.105603
| 464
| 20
| 79
| 23.2
| 0.860241
| 0
| 0
| 0.25
| 0
| 0
| 0.196121
| 0.196121
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.166667
| 0.25
| 0.666667
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
7ff3847d652498f73b7d7e22538f9a1bb920b91a
| 268
|
py
|
Python
|
arrayviews/cuda/cudf_Series_as.py
|
plures/arrayviews
|
14132bfd68880b8ee75706b2e3f1c1f95a971bf1
|
[
"BSD-3-Clause"
] | 14
|
2019-02-04T15:09:57.000Z
|
2019-03-06T17:05:44.000Z
|
arrayviews/cuda/cudf_Series_as.py
|
plures/arrayviews
|
14132bfd68880b8ee75706b2e3f1c1f95a971bf1
|
[
"BSD-3-Clause"
] | null | null | null |
arrayviews/cuda/cudf_Series_as.py
|
plures/arrayviews
|
14132bfd68880b8ee75706b2e3f1c1f95a971bf1
|
[
"BSD-3-Clause"
] | null | null | null |
from . import numba_cuda_DeviceNDArray_as
def random(size):
import cudf
return cudf.Series(numba_cuda_DeviceNDArray_as.random(size))
def numpy_ndarray(cf_ser):
return cf_ser.to_array()
def numba_cuda_DeviceNDArray(cf_ser):
return cf_ser.data.mem
| 17.866667
| 64
| 0.772388
| 41
| 268
| 4.707317
| 0.487805
| 0.103627
| 0.341969
| 0.248705
| 0.165803
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.149254
| 268
| 14
| 65
| 19.142857
| 0.846491
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| false
| 0
| 0.25
| 0.25
| 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
| 0
| 0
|
0
| 4
|
3d21df1de4c073bf1ec24552bb3a7952f6b2b6fd
| 663
|
py
|
Python
|
buildroot/support/testing/tests/package/test_luasocket.py
|
bramkragten/operating-system
|
27fc2de146f1ef047316a4b58a236c72d26da81c
|
[
"Apache-2.0"
] | 349
|
2021-08-17T08:46:53.000Z
|
2022-03-30T06:25:25.000Z
|
buildroot/support/testing/tests/package/test_luasocket.py
|
bramkragten/operating-system
|
27fc2de146f1ef047316a4b58a236c72d26da81c
|
[
"Apache-2.0"
] | 8
|
2020-04-02T22:51:47.000Z
|
2020-04-27T03:24:55.000Z
|
buildroot/support/testing/tests/package/test_luasocket.py
|
bramkragten/operating-system
|
27fc2de146f1ef047316a4b58a236c72d26da81c
|
[
"Apache-2.0"
] | 12
|
2021-08-17T20:10:30.000Z
|
2022-01-06T10:52:54.000Z
|
from tests.package.test_lua import TestLuaBase
class TestLuaLuaSocket(TestLuaBase):
config = TestLuaBase.config + \
"""
BR2_PACKAGE_LUA=y
BR2_PACKAGE_LUASOCKET=y
"""
def test_run(self):
self.login()
self.module_test("ltn12")
self.module_test("mime")
self.module_test("socket")
class TestLuajitLuaSocket(TestLuaBase):
config = TestLuaBase.config + \
"""
BR2_PACKAGE_LUAJIT=y
BR2_PACKAGE_LUASOCKET=y
"""
def test_run(self):
self.login()
self.module_test("ltn12")
self.module_test("mime")
self.module_test("socket")
| 22.1
| 46
| 0.604827
| 71
| 663
| 5.408451
| 0.323944
| 0.15625
| 0.21875
| 0.177083
| 0.755208
| 0.755208
| 0.526042
| 0.526042
| 0.526042
| 0.526042
| 0
| 0.016842
| 0.28356
| 663
| 29
| 47
| 22.862069
| 0.791579
| 0
| 0
| 0.8
| 0
| 0
| 0.058366
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.133333
| false
| 0
| 0.066667
| 0
| 0.466667
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
3d227b218d4d7aac1e2ce685b5c4e1762cd4b3e4
| 348
|
py
|
Python
|
gateway/loadbalancer.py
|
PeakerBee/aioms
|
51c7cd16394132a2999a4f1896d7ab8dc4d2f5b7
|
[
"Apache-2.0"
] | 1
|
2021-08-06T03:57:09.000Z
|
2021-08-06T03:57:09.000Z
|
gateway/loadbalancer.py
|
PeakerBee/aioms
|
51c7cd16394132a2999a4f1896d7ab8dc4d2f5b7
|
[
"Apache-2.0"
] | 10
|
2021-08-20T10:17:02.000Z
|
2021-08-20T10:27:53.000Z
|
gateway/loadbalancer.py
|
PeakerBee/aioms
|
51c7cd16394132a2999a4f1896d7ab8dc4d2f5b7
|
[
"Apache-2.0"
] | null | null | null |
import random
from typing import List, Any
class LoadBalancerRule:
def choose(self, services: List['Any']) -> Any:
pass
class RandomRule(LoadBalancerRule):
def choose(self, services: List['Any']) -> Any:
if len(services) > 0:
index = random.randint(0, len(services) - 1)
return services[index]
| 20.470588
| 56
| 0.623563
| 41
| 348
| 5.292683
| 0.512195
| 0.096774
| 0.230415
| 0.267281
| 0.43318
| 0.43318
| 0.43318
| 0.43318
| 0
| 0
| 0
| 0.011628
| 0.258621
| 348
| 16
| 57
| 21.75
| 0.829457
| 0
| 0
| 0.2
| 0
| 0
| 0.017241
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0.1
| 0.2
| 0
| 0.7
| 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
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 4
|
3d5df1fa16f40fb0d5e38c29a12e07c47c6da850
| 33
|
py
|
Python
|
busman/settings/secret.py
|
BusMan/BusMan
|
d7b35179035f7de6ce9d8dbd512c75f14217d03c
|
[
"MIT"
] | 1
|
2018-07-11T03:53:41.000Z
|
2018-07-11T03:53:41.000Z
|
busman/settings/secret.py
|
BusLotApp/BusMan
|
d7b35179035f7de6ce9d8dbd512c75f14217d03c
|
[
"MIT"
] | null | null | null |
busman/settings/secret.py
|
BusLotApp/BusMan
|
d7b35179035f7de6ce9d8dbd512c75f14217d03c
|
[
"MIT"
] | null | null | null |
SCHOOL = "Thomas Jefferson HSST"
| 16.5
| 32
| 0.757576
| 4
| 33
| 6.25
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 33
| 1
| 33
| 33
| 0.892857
| 0
| 0
| 0
| 0
| 0
| 0.636364
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
1813a06bac1350bf8bd499c3818f2c49ea9993a1
| 125
|
py
|
Python
|
frappe/www/_test/_test_folder/_test_page.py
|
monroy95/frappe
|
a9411e845634174a7f8c8b11aa0f3dbdbaa4ac7c
|
[
"MIT"
] | 1
|
2021-11-05T06:42:35.000Z
|
2021-11-05T06:42:35.000Z
|
frappe/www/_test/_test_folder/_test_page.py
|
monroy95/frappe
|
a9411e845634174a7f8c8b11aa0f3dbdbaa4ac7c
|
[
"MIT"
] | null | null | null |
frappe/www/_test/_test_folder/_test_page.py
|
monroy95/frappe
|
a9411e845634174a7f8c8b11aa0f3dbdbaa4ac7c
|
[
"MIT"
] | null | null | null |
def get_context(context):
context.base_template_path = 'frappe/templates/test/_test_base.html'
context.add_breadcrumbs = 1
| 31.25
| 69
| 0.816
| 18
| 125
| 5.333333
| 0.722222
| 0.291667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.008696
| 0.08
| 125
| 3
| 70
| 41.666667
| 0.826087
| 0
| 0
| 0
| 0
| 0
| 0.296
| 0.296
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0
| 0
| 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
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
183d3cc70eecf05a138df07e6ad4ff8ec73f561b
| 3,111
|
py
|
Python
|
animais (1)(1).py
|
maikonmuniz/Linguagem-de-programacao-segundo-semestre-2019
|
ef434ac37ec52bedae2340e26613f64bea1037d9
|
[
"Apache-2.0"
] | null | null | null |
animais (1)(1).py
|
maikonmuniz/Linguagem-de-programacao-segundo-semestre-2019
|
ef434ac37ec52bedae2340e26613f64bea1037d9
|
[
"Apache-2.0"
] | null | null | null |
animais (1)(1).py
|
maikonmuniz/Linguagem-de-programacao-segundo-semestre-2019
|
ef434ac37ec52bedae2340e26613f64bea1037d9
|
[
"Apache-2.0"
] | null | null | null |
# Linguagem de Programação II
# Atividade Contínua 02 - Dicionários
#
# e-mails: maikon.silva@aluno.faculdadeimpacta.com.br
# luiz.franca@aluno.faculdadeimpacta.com.br
from mamifero import Mamifero
from reptil import Reptil
"""
Implementar aqui as cinco classes filhas de Mamifero ou Reptil,
de acordo com o caso, conforme dado no diagrama de classes visto
em sala.
ESTE É O ÚNICO ARQUIVO QUE DEVE SER ENTREGUE!
Os atributos específicos de cada classe filha devem ser recebidos
como parâmetros no momento da criação, a exceção é o número de vidas
do gato, que começa em 7.
Os métodos de cada classe filha devem sempre retornar uma string
no seguinte formato '<nome do animal> <método em questão no gerúndio>'
Sem nenhuma pontuação.
Exemplo:
método trocar_pele() retorna '<nome> trocando de pele'
método dormir() retorna '<nome> dormindo'
método miar() retorna '<nome> miando'
Onde <nome> é o nome dado para cada animal (o atributo, não o nome da classe)
A única exceção é o método morrer, que deve verificar
quantas vidas o gato ainda tem sobrando, se for igual a zero,
retornar '<nome> morreu', se ainda houver vidas sobrando,
retirar uma vida (que começa em 7) e
retornar '<nome> tem <vidas> sobrando'
Onde <vidas> é o número de vidas restantes do gato em questão.
"""
class Cavalo(Mamifero):
def __init__(self, nome, cor_pelo, idade, tipo_pata, cor_crina):
super().__init__(nome, cor_pelo, idade, tipo_pata)
self.cor_crina = cor_crina
def galopar(self):
return "{} galopando".format(self.nome)
def relichar(self):
return "{} relichando".format(self.nome)
class Cachorro(Mamifero):
def __init__(self, nome, cor_pelo, idade, tipo_pata, raca):
super().__init__(nome, cor_pelo, idade, tipo_pata)
self.raca = raca
def latir(self):
return "{} latindo".format(self.nome)
def rosnar(self):
return "{} rosnando".format(self.nome)
class Gato(Mamifero):
def __init__(self, nome, cor_pelo, idade, tipo_pata):
super().__init__(nome, cor_pelo, idade, tipo_pata)
self.vidas = 7
def miar(self):
return "{} miando".format(self.nome)
def morrer(self):
if self.vidas > 0:
self.vidas -= 1
return '{} tem {} sobrando'.format(self.nome, self.vidas)
else:
return "{} morreu".format(self.nome)
class Cobra(Reptil):
def __init__(self, nome, cor_escamas, idade, veneno):
super().__init__(nome, cor_escamas, idade)
self.veneno = veneno
def rastejar(self):
return "{} rastejando".format(self.nome)
def trocar_pele(self):
return "{} trocando de pele".format(self.nome)
class Jacare(Reptil):
def __init__(self, nome, cor_escamas, idade, num_dentes):
super().__init__(nome, cor_escamas, idade)
num_dentes = num_dentes
def atacar(self):
return "{} atacando".format(self.nome)
def dormir(self):
return "{} dorminando".format(self.nome)
| 29.913462
| 78
| 0.659595
| 422
| 3,111
| 4.7109
| 0.35782
| 0.064386
| 0.077465
| 0.04829
| 0.231388
| 0.194165
| 0.156942
| 0.156942
| 0.120724
| 0.064889
| 0
| 0.002964
| 0.240759
| 3,111
| 103
| 79
| 30.203884
| 0.838696
| 0.053359
| 0
| 0.108696
| 0
| 0
| 0.077311
| 0
| 0
| 0
| 0
| 0.058252
| 0
| 1
| 0.326087
| false
| 0
| 0.043478
| 0.195652
| 0.717391
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
184dbfef2530fd9a973d8e9ed82e5229c56167d8
| 253
|
py
|
Python
|
tests/test_theoretical.py
|
phrenico/cmfsapy
|
9eb0b335a3e1f2c4a02fd7edf7b22b78d4ea9931
|
[
"MIT"
] | null | null | null |
tests/test_theoretical.py
|
phrenico/cmfsapy
|
9eb0b335a3e1f2c4a02fd7edf7b22b78d4ea9931
|
[
"MIT"
] | null | null | null |
tests/test_theoretical.py
|
phrenico/cmfsapy
|
9eb0b335a3e1f2c4a02fd7edf7b22b78d4ea9931
|
[
"MIT"
] | null | null | null |
from unittest import TestCase
import numpy as np
from cmfsapy.theoretical import theoretical_fsa_pdf
class Test(TestCase):
def test_theoretical_fsa_pdf(self):
x = np.arange(0.1, 10, 0.01)
d = 3
theoretical_fsa_pdf(x, 1, d)
| 23
| 51
| 0.695652
| 40
| 253
| 4.225
| 0.575
| 0.248521
| 0.301775
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045918
| 0.225296
| 253
| 10
| 52
| 25.3
| 0.816327
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.375
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
186dc5eb84147255e5245eb6bf1d0280da5cdb61
| 88
|
py
|
Python
|
readthedocs/projects/__init__.py
|
tkoyama010/readthedocs.org
|
aac8fb39586db902d9fbb51b639dd281c819dae2
|
[
"MIT"
] | 2,092
|
2019-06-29T07:47:30.000Z
|
2022-03-31T14:54:59.000Z
|
readthedocs/projects/__init__.py
|
tkoyama010/readthedocs.org
|
aac8fb39586db902d9fbb51b639dd281c819dae2
|
[
"MIT"
] | 2,389
|
2019-06-29T04:22:55.000Z
|
2022-03-31T22:57:49.000Z
|
readthedocs/projects/__init__.py
|
mondeja/readthedocs.org
|
fb01c6d9d78272e3f4fd146697e8760c04e4fbb6
|
[
"MIT"
] | 1,185
|
2019-06-29T21:49:31.000Z
|
2022-03-30T09:57:15.000Z
|
# -*- coding: utf-8 -*-
default_app_config = 'readthedocs.projects.apps.ProjectsConfig'
| 29.333333
| 63
| 0.738636
| 10
| 88
| 6.3
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0125
| 0.090909
| 88
| 2
| 64
| 44
| 0.775
| 0.238636
| 0
| 0
| 0
| 0
| 0.615385
| 0.615385
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a104452da5a9278c96384c58b7d34ddd15ddcf57
| 122
|
py
|
Python
|
tests/test_damping.py
|
elmanuelito/pyDatView
|
3516ffaff601c122d62ffc94abd842958354ece8
|
[
"MIT"
] | 50
|
2018-10-15T18:10:15.000Z
|
2022-03-15T15:53:50.000Z
|
tests/test_damping.py
|
elmanuelito/pyDatView
|
3516ffaff601c122d62ffc94abd842958354ece8
|
[
"MIT"
] | 99
|
2018-10-31T16:30:28.000Z
|
2022-02-18T04:25:07.000Z
|
tests/test_damping.py
|
elmanuelito/pyDatView
|
3516ffaff601c122d62ffc94abd842958354ece8
|
[
"MIT"
] | 20
|
2018-10-23T21:44:32.000Z
|
2022-02-09T17:21:37.000Z
|
import unittest
import numpy as np
from pydatview.tools.damping import *
if __name__ == '__main__':
unittest.main()
| 17.428571
| 37
| 0.737705
| 16
| 122
| 5.125
| 0.75
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.172131
| 122
| 6
| 38
| 20.333333
| 0.811881
| 0
| 0
| 0
| 0
| 0
| 0.065574
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.6
| 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
| 0
| 0
|
0
| 4
|
a10dd69aaac273aa770a26707bb9b3f58110e245
| 44
|
py
|
Python
|
tests/utils/__init__.py
|
ASHNA-AGGARWAL-KEYSIGHT/snappi-ixnetwork
|
19310bd5da3ba6ae98d4f8ce5dde5d80d64fd2c1
|
[
"MIT"
] | 7
|
2021-09-24T09:40:24.000Z
|
2022-02-24T06:59:46.000Z
|
tests/utils/__init__.py
|
chestercheng/snappi-ixnetwork
|
d4ed5f418033d55f2dc7e658c401b263788a7c4d
|
[
"MIT"
] | 275
|
2020-09-23T15:19:09.000Z
|
2021-06-29T10:53:56.000Z
|
tests/utils/__init__.py
|
chestercheng/snappi-ixnetwork
|
d4ed5f418033d55f2dc7e658c401b263788a7c4d
|
[
"MIT"
] | 5
|
2021-08-04T14:55:36.000Z
|
2022-03-10T07:02:29.000Z
|
from utils.common import *
__all__ = ["*"]
| 11
| 26
| 0.636364
| 5
| 44
| 4.8
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 44
| 3
| 27
| 14.666667
| 0.666667
| 0
| 0
| 0
| 0
| 0
| 0.022727
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
a135533855d3a814f3b307802efb6fc37b0e6c58
| 285
|
py
|
Python
|
Aniyom Ebenezer/Phase 2/STRINGS/Day_31_Challenge_Solution/Question 10 Solution.py
|
CodedLadiesInnovateTech/-python-challenge-solutions
|
430cd3eb84a2905a286819eef384ee484d8eb9e7
|
[
"MIT"
] | 6
|
2020-05-23T19:53:25.000Z
|
2021-05-08T20:21:30.000Z
|
Aniyom Ebenezer/Phase 2/STRINGS/Day_31_Challenge_Solution/Question 10 Solution.py
|
CodedLadiesInnovateTech/-python-challenge-solutions
|
430cd3eb84a2905a286819eef384ee484d8eb9e7
|
[
"MIT"
] | 8
|
2020-05-14T18:53:12.000Z
|
2020-07-03T00:06:20.000Z
|
Aniyom Ebenezer/Phase 2/STRINGS/Day_31_Challenge_Solution/Question 10 Solution.py
|
CodedLadiesInnovateTech/-python-challenge-solutions
|
430cd3eb84a2905a286819eef384ee484d8eb9e7
|
[
"MIT"
] | 39
|
2020-05-10T20:55:02.000Z
|
2020-09-12T17:40:59.000Z
|
"""
Write a Python program to print the following floating numbers upto 2 decimal places.
"""
x = 3.141593
y = 12.99999
print("Original Number: {}".format(x))
print("Formatted Number: {:.2f}".format(x))
print("Original Number: {}".format(y))
print("Formatted Number: {:.2f}".format(y))
| 31.666667
| 85
| 0.691228
| 42
| 285
| 4.690476
| 0.595238
| 0.13198
| 0.192893
| 0.253807
| 0.284264
| 0
| 0
| 0
| 0
| 0
| 0
| 0.06746
| 0.115789
| 285
| 9
| 86
| 31.666667
| 0.714286
| 0.298246
| 0
| 0
| 0
| 0
| 0.445596
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.666667
| 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
| 0
| 0
| 0
| 1
|
0
| 4
|
a1bbca7000c4d86d5c183ede4138c8c1402b4605
| 133
|
py
|
Python
|
programming-laboratory-I/v3xs/CF.py
|
MisaelAugusto/computer-science
|
d21335a2dc824b54ffe828370f0e6717fd0c7c27
|
[
"MIT"
] | null | null | null |
programming-laboratory-I/v3xs/CF.py
|
MisaelAugusto/computer-science
|
d21335a2dc824b54ffe828370f0e6717fd0c7c27
|
[
"MIT"
] | null | null | null |
programming-laboratory-I/v3xs/CF.py
|
MisaelAugusto/computer-science
|
d21335a2dc824b54ffe828370f0e6717fd0c7c27
|
[
"MIT"
] | null | null | null |
temperatura_celsius = float(raw_input())
temperatura_fahrenheit = 1.8*temperatura_celsius + 32
print "%.1f" %temperatura_fahrenheit
| 26.6
| 53
| 0.804511
| 16
| 133
| 6.375
| 0.6875
| 0.352941
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.041322
| 0.090226
| 133
| 4
| 54
| 33.25
| 0.801653
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a1c6124423a7be38d4625a6989acf5b0dd9dbf07
| 23
|
py
|
Python
|
auto_py_to_exe/__init__.py
|
Lightspace-Official/auto-py-to-exe
|
7167b76dcd8c8f82b8c2f93e1c43ec2aeae017a0
|
[
"MIT"
] | 1
|
2020-01-16T19:22:37.000Z
|
2020-01-16T19:22:37.000Z
|
auto_py_to_exe/__init__.py
|
Lightspace-Official/auto-py-to-exe
|
7167b76dcd8c8f82b8c2f93e1c43ec2aeae017a0
|
[
"MIT"
] | 8
|
2020-03-24T18:17:36.000Z
|
2022-03-12T00:14:02.000Z
|
Lib/site-packages/watson_developer_cloud/version.py
|
rodrigoHM/RoomR-Server
|
f9c6c8307f97c4536434c45ba1bcab39640c3501
|
[
"bzip2-1.0.6"
] | null | null | null |
__version__ = '2.10.1'
| 11.5
| 22
| 0.652174
| 4
| 23
| 2.75
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 0.130435
| 23
| 1
| 23
| 23
| 0.35
| 0
| 0
| 0
| 0
| 0
| 0.26087
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
a1f785a5dbebabaf5c6bc7dda20a9c87b8ffd3dd
| 5,179
|
py
|
Python
|
pyingrid/datalib/urls.py
|
wy2136/pyingrid
|
c6f40bb07810aecdd84efbb7968ea4900edce38a
|
[
"BSD-3-Clause"
] | 4
|
2017-02-17T07:56:31.000Z
|
2020-03-15T16:14:29.000Z
|
pyingrid/datalib/urls.py
|
wy2136/wython
|
0eaa9db335d57052806ae956afe6a34705407628
|
[
"MIT"
] | null | null | null |
pyingrid/datalib/urls.py
|
wy2136/wython
|
0eaa9db335d57052806ae956afe6a34705407628
|
[
"MIT"
] | null | null | null |
"""
@author: Wenchang Yang (yang.wenchang@uci.edu)
"""
# ######## data paths on the IRI data library.
# surface
pr_cmap = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP/.CPC/.Merged_Analysis/.monthly/.latest/.ver2/.prcp_est'
cmap = pr_cmap
pr_gpcc = 'http://iridl.ldeo.columbia.edu/SOURCES/.WCRP/.GCOS/.GPCC/.FDP/.version6/.0p5/.prcp/30/div//units/%28mm/day%29def'
gpcc = pr_gpcc
pr_gpcp = 'http://iridl.ldeo.columbia.edu/SOURCES/.NASA/.GPCP/.V2p2/.satellite-gauge/.prcp'
gpcp = pr_gpcp
pr_cru = 'http://iridl.ldeo.columbia.edu/SOURCES/.UEA/.CRU/.TS3p21/.monthly/.pre/30/div'
cru = pr_cru
pr_echam5 = 'http://iridl.ldeo.columbia.edu/SOURCES/.IRI/.FD/.ECHAM5/.T42/.History/.ensemble24/.MONTHLY/.surface/.prec/24/mul/3600/mul'
pr_echam4p5 = 'http://iridl.ldeo.columbia.edu/SOURCES/.IRI/.FD/.ECHAM4p5/.History/.MONTHLY/.surface/.prcp/1000/mul/24/mul/3600/mul'
pr_ncep2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.dg3/.dg3/.pratesfc/24/mul/3600/mul'
pr_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Diagnostic/.surface/.prate/24/mul/3600/mul'
# ocean surface
sst_ersst = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCDC/.ERSST/.version3b/.sst%5Bzlev%5Daverage'
ersst = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCDC/.ERSST/.version3b/.sst[zlev]average'
ersst4 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCDC/.ERSST/.version4/.sst[zlev]average'
oisst = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCDC/.OISST/.version2/.AVHRR/.sst%5Bzlev%5Daverage/lon/%28X%29renameGRID/lat/%28Y%29renameGRID/T/%28T%29%28days%20since%201960-01-01%29ordered/7933.5/1/20144.5/NewEvenGRID/replaceGRID'
# atmosphere internal
omega_echam5 = 'http://iridl.ldeo.columbia.edu/SOURCES/.IRI/.FD/.ECHAM5/.T42/.History/.ensemble24/.MONTHLY/.PressureLevel/.omg'
omega_echam4p5 = 'http://iridl.ldeo.columbia.edu/SOURCES/.IRI/.FD/.ECHAM4p5/.History/.MONTHLY/.PressureLevel-SF/.omega'
omega_era40 = 'http://iridl.ldeo.columbia.edu/SOURCES/.ECMWF/.ERA-40/.MONTHLY/.PressureLevel/.wa'
omega_ncep2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.vvelprs'
omega_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Intrinsic/.PressureLevel/.vvel'
omega_ncep_daily = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.DAILY/.Intrinsic/.PressureLevel/.vvel'
omega_r2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.vvelprs'
phi_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Intrinsic/.PressureLevel/.phi'
phi_r2 = 'http://iridl.ldeo.columbia.eduhttp://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.hgtprs'
phis_ncep2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.hgtsfc'
pr_era40 = 'http://iridl.ldeo.columbia.edu/SOURCES/.ECMWF/.ERA-40/.MONTHLY/.surface/.prc/SOURCES/.ECMWF/.ERA-40/.MONTHLY/.surface/.prl/add/1000/mul/4/mul'
ps_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Diagnostic/.surface/.pressure'
ps_r2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.pressfc'
q_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Intrinsic/.PressureLevel/.qa'
qs_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Diagnostic/.above_ground/.qa%5BZ%5Daverage'
ssta_rsoi = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP/.EMC/.CMB/.GLOBAL/.Reyn_SmithOIv2/.monthly/.ssta'
ta_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Intrinsic/.PressureLevel/.temp'
tas_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Diagnostic/.above_ground/.temp%5BZ%5Daverage'
ta_r2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.tmpprs'
trmm_daily = 'http://iridl.ldeo.columbia.edu/SOURCES/.NASA/.GES-DAAC/.TRMM_L3/.TRMM_3B42/.v7/.daily/.precipitation'
trmm = trmm_daily
u_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Intrinsic/.PressureLevel/.u'
u_r2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.ugrdprs'
us_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Diagnostic/.above_ground/.u%5BZ%5Daverage'
v_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Intrinsic/.PressureLevel/.v'
v_r2 = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-DOE/.Reanalysis-2/.Monthly/.pgb/.pgb/.vgrdprs'
vs_ncep = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NCEP-NCAR/.CDAS-1/.MONTHLY/.Diagnostic/.above_ground/.v%5BZ%5Daverage'
# topo and land-sea mask
land_sea_mask = 'http://iridl.ldeo.columbia.edu/SOURCES/.NASA/.ISLSCP/.GDSLAM/.Miscellaneous/.land_sea_mask'
topo = 'http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NGDC/.GLOBE/.topo'
topo_worldbath = 'http://iridl.ldeo.columbia.edu/SOURCES/.WORLDBATH/.bath'
topo_Peltier = 'http://iridl.ldeo.columbia.edu/SOURCES/.PELTIER/.topography/T/0/VALUE%5BT%5Daverage'
| 84.901639
| 239
| 0.746476
| 788
| 5,179
| 4.835025
| 0.228426
| 0.101575
| 0.191864
| 0.231496
| 0.702625
| 0.685564
| 0.643045
| 0.603675
| 0.572966
| 0.561417
| 0
| 0.035764
| 0.033597
| 5,179
| 60
| 240
| 86.316667
| 0.725475
| 0.02877
| 0
| 0
| 0
| 0.851064
| 0.864072
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 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
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
b8040f0b3fa5b3b2ac171fc89358125405d02d1c
| 99
|
py
|
Python
|
{{cookiecutter.project_slug}}/test/test_unit.py
|
blueskyideas/cookiecutter-python
|
754c1c7f457e3cd13918308a4b946eaeac5b2529
|
[
"MIT"
] | 1
|
2018-01-18T12:54:03.000Z
|
2018-01-18T12:54:03.000Z
|
{{cookiecutter.project_slug}}/test/test_unit.py
|
blueskyideas/cookiecutter-python
|
754c1c7f457e3cd13918308a4b946eaeac5b2529
|
[
"MIT"
] | null | null | null |
{{cookiecutter.project_slug}}/test/test_unit.py
|
blueskyideas/cookiecutter-python
|
754c1c7f457e3cd13918308a4b946eaeac5b2529
|
[
"MIT"
] | null | null | null |
import pytest
from .context import {{ cookiecutter.project_slug }}
def test_a():
assert 1 == 2
| 19.8
| 52
| 0.707071
| 14
| 99
| 4.857143
| 0.928571
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.024691
| 0.181818
| 99
| 5
| 53
| 19.8
| 0.814815
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.25
| 0
| null | null | 0
| 0.5
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
b818f2f39a3612764a742cf0d813c9ef25100bcb
| 99
|
py
|
Python
|
staticloader/apps.py
|
izderic/django-staticloader
|
94f02e83d5de95bd130a0deac132e2b9261af20e
|
[
"BSD-3-Clause"
] | 4
|
2015-09-12T08:27:55.000Z
|
2020-11-05T16:53:10.000Z
|
staticloader/apps.py
|
izderic/django-staticloader
|
94f02e83d5de95bd130a0deac132e2b9261af20e
|
[
"BSD-3-Clause"
] | null | null | null |
staticloader/apps.py
|
izderic/django-staticloader
|
94f02e83d5de95bd130a0deac132e2b9261af20e
|
[
"BSD-3-Clause"
] | null | null | null |
from django.apps import AppConfig
class StaticloaderConfig(AppConfig):
name = 'staticloader'
| 16.5
| 36
| 0.777778
| 10
| 99
| 7.7
| 0.9
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 99
| 5
| 37
| 19.8
| 0.916667
| 0
| 0
| 0
| 0
| 0
| 0.121212
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 1
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 4
|
b81d3ceff6aa19311b4f1e4ec7398ae173efa3d1
| 187
|
py
|
Python
|
portal/common/utils.py
|
QthCN/opsguide_portal
|
595e0157293265c317123c638f75dbeffb1dc45d
|
[
"Apache-2.0"
] | null | null | null |
portal/common/utils.py
|
QthCN/opsguide_portal
|
595e0157293265c317123c638f75dbeffb1dc45d
|
[
"Apache-2.0"
] | null | null | null |
portal/common/utils.py
|
QthCN/opsguide_portal
|
595e0157293265c317123c638f75dbeffb1dc45d
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
import datetime
def convert_unix_timestamp_to_datetime_str(ut):
return datetime.datetime.fromtimestamp(
int(ut)
).strftime('%Y-%m-%d %H:%M:%S')
| 18.7
| 47
| 0.647059
| 26
| 187
| 4.461538
| 0.807692
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.006494
| 0.176471
| 187
| 9
| 48
| 20.777778
| 0.746753
| 0.112299
| 0
| 0
| 0
| 0
| 0.103659
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0.2
| 0.2
| 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
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 4
|
629e6a9328100ddc195f666aa08a735d11de2993
| 164
|
py
|
Python
|
examples/display/helloworld.py
|
llA109/mPython
|
a0898c4d45b8ca8588a87e9dad9421615b4c2540
|
[
"MIT"
] | 1
|
2019-12-01T15:10:04.000Z
|
2019-12-01T15:10:04.000Z
|
examples/display/helloworld.py
|
llA109/mPython
|
a0898c4d45b8ca8588a87e9dad9421615b4c2540
|
[
"MIT"
] | null | null | null |
examples/display/helloworld.py
|
llA109/mPython
|
a0898c4d45b8ca8588a87e9dad9421615b4c2540
|
[
"MIT"
] | null | null | null |
from mpython import *
oled.DispChar('你好世界', 38, 0)
oled.DispChar('hello,world', 32, 16)
oled.DispChar('안녕하세요', 35, 32)
oled.DispChar('こんにちは世界', 24, 48)
oled.show()
| 23.428571
| 36
| 0.695122
| 26
| 164
| 4.384615
| 0.692308
| 0.421053
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.102041
| 0.103659
| 164
| 7
| 37
| 23.428571
| 0.673469
| 0
| 0
| 0
| 0
| 0
| 0.163636
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.166667
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
62c3d2eda51835bcf0e3cf90802dd256806f9f0a
| 93
|
py
|
Python
|
_solved/solutions/04-spatial-joins18.py
|
lleondia/geopandas-tutorial
|
5128fd6865bbd979a7b4e5b8cb4d0de51bead029
|
[
"BSD-3-Clause"
] | 341
|
2018-04-26T08:46:05.000Z
|
2022-03-01T08:13:39.000Z
|
_solved/solutions/04-spatial-joins18.py
|
lleondia/geopandas-tutorial
|
5128fd6865bbd979a7b4e5b8cb4d0de51bead029
|
[
"BSD-3-Clause"
] | 24
|
2020-09-30T19:57:14.000Z
|
2021-10-05T07:21:09.000Z
|
_solved/solutions/04-spatial-joins18.py
|
lleondia/geopandas-tutorial
|
5128fd6865bbd979a7b4e5b8cb4d0de51bead029
|
[
"BSD-3-Clause"
] | 128
|
2018-05-07T07:30:29.000Z
|
2022-02-19T17:53:39.000Z
|
# Print proportion of district area that occupied park
print(intersection.area / muette.area)
| 46.5
| 54
| 0.817204
| 13
| 93
| 5.846154
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.11828
| 93
| 2
| 55
| 46.5
| 0.926829
| 0.55914
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 0
| 1
| 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
| 0
| 0
| 0
| 1
|
0
| 4
|
62ce12e58fac7b13f2db726ee80386ac0f249c5b
| 127
|
py
|
Python
|
service.py
|
Imcodingcc/pybtsp
|
b7ed6b190ecc4c04b9ee7d0e063a3c570c4cfe21
|
[
"MIT"
] | 2
|
2017-10-24T02:42:46.000Z
|
2020-08-21T00:13:58.000Z
|
service.py
|
Imcodingcc/pybtsp
|
b7ed6b190ecc4c04b9ee7d0e063a3c570c4cfe21
|
[
"MIT"
] | null | null | null |
service.py
|
Imcodingcc/pybtsp
|
b7ed6b190ecc4c04b9ee7d0e063a3c570c4cfe21
|
[
"MIT"
] | null | null | null |
SERVICE_UUID = '3a75d027-49b6-40e7-8c22-e08bf79988d3'
from bluetooth import *
class BTSocket(bluez.BluetoothSocket):
pass
| 21.166667
| 53
| 0.787402
| 15
| 127
| 6.6
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.205357
| 0.11811
| 127
| 5
| 54
| 25.4
| 0.678571
| 0
| 0
| 0
| 0
| 0
| 0.283465
| 0.283465
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.25
| 0.25
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 4
|
62d147d495ba800eb42f416a6e3b873d30a5d463
| 13
|
py
|
Python
|
tests/syntax/python_not_interpreter.py
|
matan-h/friendly
|
3ab0fc6541c837271e8865e247750007acdd18fb
|
[
"MIT"
] | 287
|
2019-04-08T13:18:29.000Z
|
2021-03-14T19:10:21.000Z
|
tests/syntax/python_not_interpreter.py
|
matan-h/friendly
|
3ab0fc6541c837271e8865e247750007acdd18fb
|
[
"MIT"
] | 191
|
2019-04-08T14:39:18.000Z
|
2021-03-14T22:14:56.000Z
|
tests/syntax/python_not_interpreter.py
|
matan-h/friendly
|
3ab0fc6541c837271e8865e247750007acdd18fb
|
[
"MIT"
] | 9
|
2019-04-08T12:54:08.000Z
|
2020-11-20T02:26:27.000Z
|
python = a b
| 6.5
| 12
| 0.615385
| 3
| 13
| 2.666667
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.307692
| 13
| 1
| 13
| 13
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| 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
| 0
| 0
| 0
| 0
|
0
| 4
|
62da4ef2addf8b58fb8e87c38db334bd15c46ce6
| 110
|
py
|
Python
|
backend-project/config/settings/production.py
|
WlodzimierzKorza/small_eod
|
027022bd71122a949a2787d0fb86518df80e48cd
|
[
"MIT"
] | 1
|
2021-02-10T19:58:51.000Z
|
2021-02-10T19:58:51.000Z
|
backend-project/config/settings/production.py
|
WlodzimierzKorza/small_eod
|
027022bd71122a949a2787d0fb86518df80e48cd
|
[
"MIT"
] | null | null | null |
backend-project/config/settings/production.py
|
WlodzimierzKorza/small_eod
|
027022bd71122a949a2787d0fb86518df80e48cd
|
[
"MIT"
] | 1
|
2021-02-10T19:38:35.000Z
|
2021-02-10T19:38:35.000Z
|
from .base import * # noqa
SECRET_KEY = env("SECRET_KEY")
ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS")
| 18.333333
| 48
| 0.736364
| 16
| 110
| 4.75
| 0.6875
| 0.236842
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.136364
| 110
| 5
| 49
| 22
| 0.8
| 0.036364
| 0
| 0
| 0
| 0
| 0.288462
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 4
|
62e28b3a7a16b29af926cc5c7e412fb9e318f468
| 436
|
py
|
Python
|
junos_rest/constants.py
|
checktheroads/junos-rest
|
df9df95b13ac9d02e67c025a4e43d0ad112b7897
|
[
"WTFPL"
] | 2
|
2020-01-24T21:54:50.000Z
|
2020-03-07T23:36:53.000Z
|
junos_rest/constants.py
|
checktheroads/junos-rest
|
df9df95b13ac9d02e67c025a4e43d0ad112b7897
|
[
"WTFPL"
] | null | null | null |
junos_rest/constants.py
|
checktheroads/junos-rest
|
df9df95b13ac9d02e67c025a4e43d0ad112b7897
|
[
"WTFPL"
] | null | null | null |
"""Reusable static data."""
COMMIT = """
<lock-configuration/>
<commit/>
<unlock-configuration/>
"""
COMMIT_CHECK = """
<commit-configuration>
<check/>
</commit-configuration>
"""
CONFIG_JSON = """
<lock-configuration/>
<load-configuration format="json">
<configuration-json>
{config}
</configuration-json>
</load-configuration>
<commit/>
<unlock-configuration/>
"""
RESULTS = """<results>{results}</results>"""
| 16.148148
| 44
| 0.655963
| 38
| 436
| 7.473684
| 0.342105
| 0.200704
| 0.176056
| 0.267606
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.130734
| 436
| 26
| 45
| 16.769231
| 0.74934
| 0.048165
| 0
| 0.428571
| 0
| 0
| 0.801956
| 0.496333
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.