uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
39c7e29dd07b58ec25a97309
train
function
def test_from_line_invalid_time_two_periods(): with pytest.raises(TypeError): Mark.from_line(" 1 0.00.03 video start")
def test_from_line_invalid_time_two_periods():
with pytest.raises(TypeError): Mark.from_line(" 1 0.00.03 video start")
): Mark.from_line(" 1 0:00.03 video start") def test_from_line_invalid_time_no_period(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00:03 video start") def test_from_line_invalid_time_two_periods():
64
64
36
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_time_two_periods
test_from_line_invalid_time_two_periods
49
51
49
49
f0ff901da4e6dd21e368452fc2a16bcfe344ebfc
bigcode/the-stack
train
6651d9bccbe646c769573e15
train
function
def test_lt_name_lexicographic(): first = Mark.from_line(" 1 0:00.03 A video starts") second = Mark.from_line(" 1 0:00.03 video starts") assert first < second
def test_lt_name_lexicographic():
first = Mark.from_line(" 1 0:00.03 A video starts") second = Mark.from_line(" 1 0:00.03 video starts") assert first < second
def test_lt_name(): first = Mark.from_line(" 1 0:00.03 a video starts") second = Mark.from_line(" 1 0:00.03 video start") assert first < second def test_lt_name_lexicographic():
64
64
58
9
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_name_lexicographic
test_lt_name_lexicographic
246
250
246
246
27cce4a53c580c2f275a003f7e7996cdf07aee37
bigcode/the-stack
train
264ad8a3d02fc42c8adfcbab
train
function
def test_to_line_invalid_template_1_space_after_time(): with pytest.raises(ValueError): mark = Mark(1, timedelta(seconds=1), "mark") mark.to_line(" 1 0:00.03 video start")
def test_to_line_invalid_template_1_space_after_time():
with pytest.raises(ValueError): mark = Mark(1, timedelta(seconds=1), "mark") mark.to_line(" 1 0:00.03 video start")
def test_to_line_invalid_template_1_space_after_frame(): with pytest.raises(ValueError): mark = Mark(1, timedelta(seconds=1), "mark") mark.to_line(" 1 0:00.03 video start") def test_to_line_invalid_template_1_space_after_time():
64
64
52
12
52
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_invalid_template_1_space_after_time
test_to_line_invalid_template_1_space_after_time
173
176
173
173
59817a22071a9533738c2dba80235cc9019f02ac
bigcode/the-stack
train
44b08a84be3f903963627dda
train
function
def test_to_line_valid_one_word_name(): temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "mark") assert mark.to_line(temp) == " 17 0:04.05 mark"
def test_to_line_valid_one_word_name():
temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "mark") assert mark.to_line(temp) == " 17 0:04.05 mark"
54001 30:00.03 video end" mark = Mark(143063, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == "143063 0:04.05 weird mark" def test_to_line_valid_one_word_name():
64
64
66
9
55
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_one_word_name
test_to_line_valid_one_word_name
149
152
149
149
c0bc29f2f8b3f0c404dfe70a8d101a2d1fba3f3f
bigcode/the-stack
train
883b878828cf988b15468fc8
train
function
def test_to_line_valid_one_word_name_in_template(): temp = " 54001 30:00.03 videoend" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark"
def test_to_line_valid_one_word_name_in_template():
temp = " 54001 30:00.03 videoend" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark"
54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "mark") assert mark.to_line(temp) == " 17 0:04.05 mark" def test_to_line_valid_one_word_name_in_template():
64
64
71
11
53
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_one_word_name_in_template
test_to_line_valid_one_word_name_in_template
155
158
155
155
5642dd0f6ded50e18b4e79a0e2be6ccec4f2d054
bigcode/the-stack
train
669bc0e9b2c098afabf7ec08
train
function
def test_to_line_valid_remove_leading_zero_hours(): temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=3601.05), "weird mark") assert mark.to_line(temp) == " 17 1:00:01.05 weird mark"
def test_to_line_valid_remove_leading_zero_hours():
temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=3601.05), "weird mark") assert mark.to_line(temp) == " 17 1:00:01.05 weird mark"
30:00.03 video end" mark = Mark(17, timedelta(seconds=61.05), "weird mark") assert mark.to_line(temp) == " 17 1:01.05 weird mark" def test_to_line_valid_remove_leading_zero_hours():
64
64
74
11
53
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_remove_leading_zero_hours
test_to_line_valid_remove_leading_zero_hours
191
194
191
191
79678438ca10aa4d8170b017323261c61e3ba743
bigcode/the-stack
train
fdc6b1dc8fcfd429a4d82dd9
train
function
def test_to_line_valid_microsecs(): temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=0.05), "weird mark") assert mark.to_line(temp) == " 17 0:00.05 weird mark"
def test_to_line_valid_microsecs():
temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=0.05), "weird mark") assert mark.to_line(temp) == " 17 0:00.05 weird mark"
54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark" def test_to_line_valid_microsecs():
64
64
68
8
56
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_microsecs
test_to_line_valid_microsecs
137
140
137
137
6089c5f04887d772b6f2e9f3749d0b24c3cb31bf
bigcode/the-stack
train
2fb77cdf8079bae944684c83
train
function
def test_to_line_valid_start_end_is_template(): start = " 1 0:00.03 video start" end = "54001 30:00.03 video end" mark = Mark.from_line(start) assert mark.to_line(end) == start
def test_to_line_valid_start_end_is_template():
start = " 1 0:00.03 video start" end = "54001 30:00.03 video end" mark = Mark.from_line(start) assert mark.to_line(end) == start
4.03)), "video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)) assert mark.name == "video start" def test_to_line_valid_start_end_is_template():
64
64
63
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_start_end_is_template
test_to_line_valid_start_end_is_template
111
115
111
111
b44dc0be36a10d76336dcb1af4f2fc113e578775
bigcode/the-stack
train
d475d8402b61e20da57b3718
train
function
def test_lt_time_negative(): first = Mark.from_line(" 1 -0:05.00 video start") second = Mark.from_line(" 1 -0:00.03 video start") assert first < second
def test_lt_time_negative():
first = Mark.from_line(" 1 -0:05.00 video start") second = Mark.from_line(" 1 -0:00.03 video start") assert first < second
first < second def test_lt_time_positive(): first = Mark.from_line(" 1 0:00.03 video start") second = Mark.from_line(" 1 0:05.00 video start") assert first < second def test_lt_time_negative():
64
64
54
6
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_time_negative
test_lt_time_negative
225
229
225
225
563c72455cba458c6e02f4e8af657140722e38ae
bigcode/the-stack
train
618ab8d0ac7dfb181a797b7b
train
function
def test_init_valid_long_time(): mark = Mark(1, timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)), "video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)) assert mark.name == "video start"
def test_init_valid_long_time():
mark = Mark(1, timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)), "video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)) assert mark.name == "video start"
(54001, timedelta(seconds=(30 * 60 + 0.03)), "video end") assert mark.frame == 54001 assert mark.time == timedelta(seconds=(30 * 60 + 0.03)) assert mark.name == "video end" def test_init_valid_long_time():
64
64
85
7
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_init_valid_long_time
test_init_valid_long_time
103
108
103
103
5b5cb5e012881bf1d8267d9315df2fbd2a554580
bigcode/the-stack
train
c07b55e203838bcc91dffe79
train
function
def test_to_line_valid_secs(): temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark"
def test_to_line_valid_secs():
temp = " 54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark"
01 30:00.03 video end" mark = Mark(17, timedelta(seconds=3650.05), "weird mark") assert mark.to_line(temp) == " 17 1:00:50.05 weird mark" def test_to_line_valid_secs():
64
64
67
7
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_secs
test_to_line_valid_secs
131
134
131
131
087b8834bc10e8aaaac3d539bde138843ad7d9e5
bigcode/the-stack
train
99d6f812ed2f5c6fa3235d35
train
function
def test_init_valid_end(): mark = Mark(54001, timedelta(seconds=(30 * 60 + 0.03)), "video end") assert mark.frame == 54001 assert mark.time == timedelta(seconds=(30 * 60 + 0.03)) assert mark.name == "video end"
def test_init_valid_end():
mark = Mark(54001, timedelta(seconds=(30 * 60 + 0.03)), "video end") assert mark.frame == 54001 assert mark.time == timedelta(seconds=(30 * 60 + 0.03)) assert mark.name == "video end"
== "video start" def test_init_valid_start(): mark = Mark(1, timedelta(seconds=0.03), "video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=0.03) assert mark.name == "video start" def test_init_valid_end():
64
64
67
6
58
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_init_valid_end
test_init_valid_end
96
100
96
96
17152e9cdbf3c5e9eb2b9d9fb943a3f549799ebf
bigcode/the-stack
train
a73d1b4cf0d32277f3f72e63
train
function
def test_init_valid_start(): mark = Mark(1, timedelta(seconds=0.03), "video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=0.03) assert mark.name == "video start"
def test_init_valid_start():
mark = Mark(1, timedelta(seconds=0.03), "video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=0.03) assert mark.name == "video start"
1 01:20:04.03 video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)) assert mark.name == "video start" def test_init_valid_start():
64
64
53
6
58
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_init_valid_start
test_init_valid_start
89
93
89
89
df32aa517325926a61fc45dd3acb75820954d116
bigcode/the-stack
train
f374c751e6518b7388348c2e
train
function
def test_lt_frame_both_signs(): first = Mark.from_line(" -1 0:00.03 video start") second = Mark.from_line(" 1 0:00.03 video start") assert first < second
def test_lt_frame_both_signs():
first = Mark.from_line(" -1 0:00.03 video start") second = Mark.from_line(" 1 0:00.03 video start") assert first < second
def test_lt_frame_negative(): first = Mark.from_line(" -2 0:00.03 video start") second = Mark.from_line(" -1 0:00.03 video start") assert first < second def test_lt_frame_both_signs():
64
64
57
9
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_frame_both_signs
test_lt_frame_both_signs
211
215
211
211
d63f5f21927a0967b04b07acfb4d71846a9a70cd
bigcode/the-stack
train
ef0a66a4e0d82675ab4b1780
train
function
def test_from_line_valid_long_time(): mark = Mark.from_line(" 1 01:20:04.03 video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)) assert mark.name == "video start"
def test_from_line_valid_long_time():
mark = Mark.from_line(" 1 01:20:04.03 video start") assert mark.frame == 1 assert mark.time == timedelta(seconds=(1 * 60 * 60 + 20 * 60 + 4.03)) assert mark.name == "video start"
(TypeError): Mark.from_line(" 1 0:a00.03 video start") def test_from_line_invalid_name(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start!") def test_from_line_valid_long_time():
63
64
75
8
55
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_valid_long_time
test_from_line_valid_long_time
82
86
82
82
28d0a0fa137f3153117cb811ca9f0555369605bb
bigcode/the-stack
train
d078b1783eb8639bccbb30b8
train
function
def test_to_line_valid_long_frame(): temp = " 54001 30:00.03 video end" mark = Mark(143063, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == "143063 0:04.05 weird mark"
def test_to_line_valid_long_frame():
temp = " 54001 30:00.03 video end" mark = Mark(143063, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == "143063 0:04.05 weird mark"
54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=0.05), "weird mark") assert mark.to_line(temp) == " 17 0:00.05 weird mark" def test_to_line_valid_long_frame():
64
64
68
8
56
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_long_frame
test_to_line_valid_long_frame
143
146
143
143
bb48ccf9e7cdcaed9f5d66a43b5a15d6572cfa57
bigcode/the-stack
train
2d6a27a15bcf770909b9989f
train
function
def test_from_line_invalid_name(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start!")
def test_from_line_invalid_name():
with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start!")
Error): Mark.from_line(" a1 0:00.03 video start") def test_from_line_invalid_time_nonnumeric(): with pytest.raises(TypeError): Mark.from_line(" 1 0:a00.03 video start") def test_from_line_invalid_name():
64
64
33
7
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_name
test_from_line_invalid_name
77
79
77
77
6a333d4f97c94b5d907f2b7697151f3feedd9d7f
bigcode/the-stack
train
b34d5228e81479ae12cf21b0
train
function
def test_lt_time_both_signs(): first = Mark.from_line(" 1 -0:00.03 video start") second = Mark.from_line(" 1 0:00.03 video start") assert first < second
def test_lt_time_both_signs():
first = Mark.from_line(" 1 -0:00.03 video start") second = Mark.from_line(" 1 0:00.03 video start") assert first < second
def test_lt_time_negative(): first = Mark.from_line(" 1 -0:05.00 video start") second = Mark.from_line(" 1 -0:00.03 video start") assert first < second def test_lt_time_both_signs():
64
64
57
9
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_time_both_signs
test_lt_time_both_signs
232
236
232
232
2cd381b07e9cab1e39b6d9506b8e054ff9f736ad
bigcode/the-stack
train
0055ba0d6ee789e21c0f849f
train
function
def test_to_line_valid_long_frame_in_template(): temp = "154001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark"
def test_to_line_valid_long_frame_in_template():
temp = "154001 30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark"
01 30:00.03 videoend" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark" def test_to_line_valid_long_frame_in_template():
64
64
69
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_long_frame_in_template
test_to_line_valid_long_frame_in_template
161
164
161
161
8e06b8a4e415ed1fd138530d0619db5b5e08df71
bigcode/the-stack
train
af964f17a744652ccc3f4c92
train
function
def test_lt_name(): first = Mark.from_line(" 1 0:00.03 a video starts") second = Mark.from_line(" 1 0:00.03 video start") assert first < second
def test_lt_name():
first = Mark.from_line(" 1 0:00.03 a video starts") second = Mark.from_line(" 1 0:00.03 video start") assert first < second
second def test_lt_time_both_signs(): first = Mark.from_line(" 1 -0:00.03 video start") second = Mark.from_line(" 1 0:00.03 video start") assert first < second def test_lt_name():
64
64
54
5
58
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_name
test_lt_name
239
243
239
239
1b1826b55663d4c20b9234e9fb14a00f5ad2ad10
bigcode/the-stack
train
518ba4fa64e2cf3d16f59e28
train
function
def test_to_line_invalid_template_1_space_after_frame(): with pytest.raises(ValueError): mark = Mark(1, timedelta(seconds=1), "mark") mark.to_line(" 1 0:00.03 video start")
def test_to_line_invalid_template_1_space_after_frame():
with pytest.raises(ValueError): mark = Mark(1, timedelta(seconds=1), "mark") mark.to_line(" 1 0:00.03 video start")
30:00.03 video end" mark = Mark(17, timedelta(seconds=4.05), "weird mark") assert mark.to_line(temp) == " 17 0:04.05 weird mark" def test_to_line_invalid_template_1_space_after_frame():
64
64
52
12
52
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_invalid_template_1_space_after_frame
test_to_line_invalid_template_1_space_after_frame
167
170
167
167
79dbdadf115e3834232d2a221cd70649efff5b40
bigcode/the-stack
train
8d6e135476bbf11e9a8b5ae5
train
function
def test_lt_frame_positive(): first = Mark.from_line(" 1 0:00.03 video start") second = Mark.from_line(" 2 0:00.03 video start") assert first < second
def test_lt_frame_positive():
first = Mark.from_line(" 1 0:00.03 video start") second = Mark.from_line(" 2 0:00.03 video start") assert first < second
54001 30:00.03 video end" mark = Mark(17, timedelta(seconds=3601.05), "weird mark") assert mark.to_line(temp) == " 17 1:00:01.05 weird mark" def test_lt_frame_positive():
64
64
54
6
58
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_frame_positive
test_lt_frame_positive
197
201
197
197
00c621d0d45b7df4ac686db84a15e560f8f87d49
bigcode/the-stack
train
45de6275c0194cd4d27dbbeb
train
function
def test_to_line_valid_end_start_is_template(): start = " 1 0:00.03 video start" end = "54001 30:00.03 video end" mark = Mark.from_line(end) assert mark.to_line(start) == end
def test_to_line_valid_end_start_is_template():
start = " 1 0:00.03 video start" end = "54001 30:00.03 video end" mark = Mark.from_line(end) assert mark.to_line(start) == end
(): start = " 1 0:00.03 video start" end = "54001 30:00.03 video end" mark = Mark.from_line(start) assert mark.to_line(end) == start def test_to_line_valid_end_start_is_template():
64
64
63
10
53
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_to_line_valid_end_start_is_template
test_to_line_valid_end_start_is_template
118
122
118
118
3b9fcfffc6bc46aadda79c549cd961fe374d9cd9
bigcode/the-stack
train
c55e2d5618ee29f25e33b49b
train
function
def test_from_line_invalid_time_nonnumeric(): with pytest.raises(TypeError): Mark.from_line(" 1 0:a00.03 video start")
def test_from_line_invalid_time_nonnumeric():
with pytest.raises(TypeError): Mark.from_line(" 1 0:a00.03 video start")
Mark.from_line(" 1 -0:00.03 video start") def test_from_line_invalid_frame_nonnumeric(): with pytest.raises(TypeError): Mark.from_line(" a1 0:00.03 video start") def test_from_line_invalid_time_nonnumeric():
64
64
36
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_time_nonnumeric
test_from_line_invalid_time_nonnumeric
72
74
72
72
18cf4a14cd91e02752e33c8de246990f3ac1bcdb
bigcode/the-stack
train
87dfe53b302d86c37ff5cba8
train
function
def test_lt_time_positive(): first = Mark.from_line(" 1 0:00.03 video start") second = Mark.from_line(" 1 0:05.00 video start") assert first < second
def test_lt_time_positive():
first = Mark.from_line(" 1 0:00.03 video start") second = Mark.from_line(" 1 0:05.00 video start") assert first < second
def test_lt_frame_both_signs(): first = Mark.from_line(" -1 0:00.03 video start") second = Mark.from_line(" 1 0:00.03 video start") assert first < second def test_lt_time_positive():
64
64
54
6
57
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_lt_time_positive
test_lt_time_positive
218
222
218
218
91ec181c04ba0c4783568086b6f940fb9a35c352
bigcode/the-stack
train
afada2c6b51cad0d815d2188
train
function
def test_from_line_invalid_time_one_middle_digit(): with pytest.raises(TypeError): Mark.from_line(" 1 0:0.03 video start")
def test_from_line_invalid_time_one_middle_digit():
with pytest.raises(TypeError): Mark.from_line(" 1 0:0.03 video start")
Mark.from_line(" 1 0:00:03 video start") def test_from_line_invalid_time_two_periods(): with pytest.raises(TypeError): Mark.from_line(" 1 0.00.03 video start") def test_from_line_invalid_time_one_middle_digit():
64
64
36
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_time_one_middle_digit
test_from_line_invalid_time_one_middle_digit
54
56
54
54
2006f44082f34aa3f603d65ab8c4136c9b7a60a8
bigcode/the-stack
train
569270a81be9e8364bf02067
train
function
def test_from_line_invalid_two_spaces_in_name(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start")
def test_from_line_invalid_two_spaces_in_name():
with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start")
_valid_end(): mark = Mark.from_line("54001 30:00.03 video end") assert mark.frame == 54001 assert mark.time == timedelta(seconds=1800.03) assert mark.name == "video end" def test_from_line_invalid_two_spaces_in_name():
64
64
37
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_two_spaces_in_name
test_from_line_invalid_two_spaces_in_name
29
31
29
29
513ac5987b8ba41389f9b8b21e54fc1d199f8201
bigcode/the-stack
train
f1dbe6167c61d31cb69fbb52
train
function
def test_from_line_invalid_one_space_after_time(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start")
def test_from_line_invalid_one_space_after_time():
with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start")
timedelta(seconds=1800.03) assert mark.name == "video end" def test_from_line_invalid_two_spaces_in_name(): with pytest.raises(TypeError): Mark.from_line(" 1 0:00.03 video start") def test_from_line_invalid_one_space_after_time():
64
64
35
10
54
U8NWXD/scorevideo_lib
tests/src/test_mark.py
Python
test_from_line_invalid_one_space_after_time
test_from_line_invalid_one_space_after_time
34
36
34
34
eac26c2bf3e40300f2a0198ff1b60a47f99d171e
bigcode/the-stack
train
c9b4f2ff4554b4e0f9ba2187
train
function
def main(): with open("wn.xml", "w") as out: out.write("""<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE LexicalResource SYSTEM "http://globalwordnet.github.io/schemas/WN-LMF-1.0.dtd"> <LexicalResource xmlns:dc="http://purl.org/dc/elements/1.1/"> <Lexicon id="ewn" label="English WordNet" ...
def main():
with open("wn.xml", "w") as out: out.write("""<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE LexicalResource SYSTEM "http://globalwordnet.github.io/schemas/WN-LMF-1.0.dtd"> <LexicalResource xmlns:dc="http://purl.org/dc/elements/1.1/"> <Lexicon id="ewn" label="English WordNet" lang...
f.append(c) return f def indent(elem, level=0): i = "\n" + level*" " j = "\n" + (level+1)*" " if len(elem): elem.text = j n = 1 for subelem in elem: if n != len(elem): indent(subelem, level+1) subelem.tail = j else: ...
122
122
408
3
118
bbou/english-wordnet
scripts/merge.py
Python
main
main
58
95
58
58
7d78d037a89eafd7946333b18a5e02320d35f93c
bigcode/the-stack
train
53184f8c93586bfff016a70e
train
function
def merge_entry(e1, e2): i = 0 for c in e1: if c.tag == "Lemma" or c.tag == "Form" or c.tag == "Sense": i += 1 for c in e2: if c.tag == "Sense": e1.insert(i, c) i += 1 if c.tag == "SyntacticBehaviour": src = [c2 for c2 in e1 if c2.tag =...
def merge_entry(e1, e2):
i = 0 for c in e1: if c.tag == "Lemma" or c.tag == "Form" or c.tag == "Sense": i += 1 for c in e2: if c.tag == "Sense": e1.insert(i, c) i += 1 if c.tag == "SyntacticBehaviour": src = [c2 for c2 in e1 if c2.tag == "SyntacticBehaviour" an...
import xml.etree.ElementTree as ET from glob import glob def merge_entry(e1, e2):
23
64
183
9
13
bbou/english-wordnet
scripts/merge.py
Python
merge_entry
merge_entry
4
21
4
4
76cfba96ab488878b7def21b1753ad2f6c498e34
bigcode/the-stack
train
efb87d717c4005b1dd6b5860
train
function
def indent(elem, level=0): i = "\n" + level*" " j = "\n" + (level+1)*" " if len(elem): elem.text = j n = 1 for subelem in elem: if n != len(elem): indent(subelem, level+1) subelem.tail = j else: subelem.tail = ...
def indent(elem, level=0):
i = "\n" + level*" " j = "\n" + (level+1)*" " if len(elem): elem.text = j n = 1 for subelem in elem: if n != len(elem): indent(subelem, level+1) subelem.tail = j else: subelem.tail = i n += 1 el...
senses.sort(key=lambda x: int(x.attrib["n"])) for c in senses: del c.attrib["n"] f.append(c) for c in e: if c.tag == "SyntacticBehaviour": f.append(c) return f def indent(elem, level=0):
64
64
111
8
55
bbou/english-wordnet
scripts/merge.py
Python
indent
indent
41
56
41
41
4217c0b8b88410c2d1a3831852712889a0842f77
bigcode/the-stack
train
5d1c6d57e17d16ac101c534f
train
function
def order_entry(e): f = ET.Element('LexicalEntry') f.attrib = e.attrib senses = [] for c in e: if c.tag == "Lemma" or c.tag == "Form": f.append(c) elif c.tag == "Sense": senses.append(c) senses.sort(key=lambda x: int(x.attrib["n"])) for c in senses: ...
def order_entry(e):
f = ET.Element('LexicalEntry') f.attrib = e.attrib senses = [] for c in e: if c.tag == "Lemma" or c.tag == "Form": f.append(c) elif c.tag == "Sense": senses.append(c) senses.sort(key=lambda x: int(x.attrib["n"])) for c in senses: del c.attrib["n"] ...
c.attrib["subcategorizationFrame"]] if not src: e1.insert(i, c) i += 1 else: for s in src: s.attrib["senses"] += " " + c.attrib["senses"] return e1 def order_entry(e):
64
64
122
5
58
bbou/english-wordnet
scripts/merge.py
Python
order_entry
order_entry
23
39
23
23
a98ee27f8fb70a8f10f2634eea32c42def9497b9
bigcode/the-stack
train
9eeb607488bc59faf5d2cebe
train
class
class RCNN_FeatureExtractor(nn.Module): """ FeatureExtractor of GRCNN (https://papers.nips.cc/paper/6637-gated-recurrent-convolution-neural-network-for-ocr.pdf) """ def __init__(self, input_channel, output_channel=512): super(RCNN_FeatureExtractor, self).__init__() self.output_channel = [int(ou...
class RCNN_FeatureExtractor(nn.Module):
""" FeatureExtractor of GRCNN (https://papers.nips.cc/paper/6637-gated-recurrent-convolution-neural-network-for-ocr.pdf) """ def __init__(self, input_channel, output_channel=512): super(RCNN_FeatureExtractor, self).__init__() self.output_channel = [int(output_channel / 8), int(output_channel / ...
], self.output_channel[3], 3, 1, 1, bias=False), nn.BatchNorm2d(self.output_channel[3]), nn.ReLU(True), nn.MaxPool2d((2, 1), (2, 1)), # 512x2x25 nn.Conv2d(self.output_channel[3], self.output_channel[3], 2, 1, 0), nn.ReLU(True)) # 512x1x24 def forward(self, input): retu...
126
126
420
9
117
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
RCNN_FeatureExtractor
RCNN_FeatureExtractor
51
71
51
51
7504479716aef6abca9cc651c537267782ad056a
bigcode/the-stack
train
661d8c5d3f5b8ac74277fff5
train
class
class GRCL(nn.Module): def __init__(self, input_channel, output_channel, num_iteration, kernel_size, pad): super(GRCL, self).__init__() self.wgf_u = nn.Conv2d(input_channel, output_channel, 1, 1, 0, bias=False) self.wgr_x = nn.Conv2d(output_channel, output_channel, 1, 1, 0, bias=False) ...
class GRCL(nn.Module):
def __init__(self, input_channel, output_channel, num_iteration, kernel_size, pad): super(GRCL, self).__init__() self.wgf_u = nn.Conv2d(input_channel, output_channel, 1, 1, 0, bias=False) self.wgr_x = nn.Conv2d(output_channel, output_channel, 1, 1, 0, bias=False) self.wf_u = nn.Conv2...
(self, input): return self.ConvNet(input) class EfficientNet_FeatureExtractor(nn.Module): def __init__(self, input_channel, output_channel=32): super(EfficientNet_FeatureExtractor, self).__init__() self.ConvNet = EfficientNet.from_name(input_channel, output_channel, 'efficientnet-b5') ...
97
97
324
6
90
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
GRCL
GRCL
93
119
93
94
ef2519aeed4073d46f84468cbcabd77ea2878f5b
bigcode/the-stack
train
46a2fec8d9ae51e3c44d569b
train
class
class EfficientNet(nn.Module): """EfficientNet model. Most easily loaded with the .from_name or .from_pretrained methods. Args: blocks_args (list[namedtuple]): A list of BlockArgs to construct blocks. global_params (namedtuple): A set of GlobalParams shared between blocks. References:...
class EfficientNet(nn.Module):
"""EfficientNet model. Most easily loaded with the .from_name or .from_pretrained methods. Args: blocks_args (list[namedtuple]): A list of BlockArgs to construct blocks. global_params (namedtuple): A set of GlobalParams shared between blocks. References: [1] https://arxiv.org/...
x_squeezed = self._swish(x_squeezed) x_squeezed = self._se_expand(x_squeezed) x = torch.sigmoid(x_squeezed) * x # Pointwise Convolution x = self._project_conv(x) x = self._bn2(x) # Skip connection and drop connect input_filters, output_filters = self._b...
256
256
2,446
6
250
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
EfficientNet
EfficientNet
376
615
376
376
467a0d6314f0186bc6839c7a2fa7cff625c41fe9
bigcode/the-stack
train
ce606f6d5515b225f0cf7b36
train
class
class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None): super(BasicBlock, self).__init__() self.conv1 = self._conv3x3(inplanes, planes) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = self._conv3x3(planes, planes) self.b...
class BasicBlock(nn.Module):
expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None): super(BasicBlock, self).__init__() self.conv1 = self._conv3x3(inplanes, planes) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = self._conv3x3(planes, planes) self.bn2 = nn.BatchNorm2d(planes) ...
.BN_grx(wgr_x) G = F.sigmoid(G_first_term + G_second_term) x_first_term = self.BN_fu(wf_u) x_second_term = self.BN_Gx(self.BN_rx(wr_x) * G) x = F.relu(x_first_term + x_second_term) return x class BasicBlock(nn.Module):
79
79
266
6
72
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
BasicBlock
BasicBlock
144
177
144
144
a90c080f4ead55c25e8fb29980a63644f9e50f51
bigcode/the-stack
train
b2fa7cb08204f8b2da8a82fe
train
class
class ResNet(nn.Module): def __init__(self, input_channel, output_channel, block, layers): super(ResNet, self).__init__() self.output_channel_block = [int(output_channel / 4), int(output_channel / 2), output_channel, output_channel] self.inplanes = int(output_channel / 8) self.con...
class ResNet(nn.Module):
def __init__(self, input_channel, output_channel, block, layers): super(ResNet, self).__init__() self.output_channel_block = [int(output_channel / 4), int(output_channel / 2), output_channel, output_channel] self.inplanes = int(output_channel / 8) self.conv0_1 = nn.Conv2d(input_cha...
__(self, inplanes, planes, stride=1, downsample=None): super(BasicBlock, self).__init__() self.conv1 = self._conv3x3(inplanes, planes) self.bn1 = nn.BatchNorm2d(planes) self.conv2 = self._conv3x3(planes, planes) self.bn2 = nn.BatchNorm2d(planes) self.relu = nn.ReLU(inplac...
256
256
1,070
6
249
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
ResNet
ResNet
180
273
180
181
00cc05e1aa553e7ff7a7382ff7fbf2623c7feee1
bigcode/the-stack
train
981621e338145a74fc8b7fd1
train
class
class VGG_FeatureExtractor(nn.Module): """ FeatureExtractor of CRNN (https://arxiv.org/pdf/1507.05717.pdf) """ def __init__(self, input_channel, output_channel=512): super(VGG_FeatureExtractor, self).__init__() self.output_channel = [int(output_channel / 8), int(output_channel / 4), ...
class VGG_FeatureExtractor(nn.Module):
""" FeatureExtractor of CRNN (https://arxiv.org/pdf/1507.05717.pdf) """ def __init__(self, input_channel, output_channel=512): super(VGG_FeatureExtractor, self).__init__() self.output_channel = [int(output_channel / 8), int(output_channel / 4), int(output_channel ...
round_repeats, drop_connect, get_same_padding_conv2d, get_model_params, efficientnet_params, load_pretrained_weights, Swish, MemoryEfficientSwish, calculate_output_image_size ) VALID_MODELS = ( 'efficientnet-b0', 'efficientnet-b1', 'efficientnet-b2', 'efficientnet-b3', 'effi...
147
147
493
9
138
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
VGG_FeatureExtractor
VGG_FeatureExtractor
25
48
25
25
0d62d7d694916080d7ddf1d3cce1754e3421c8cf
bigcode/the-stack
train
a35d12af06e8bb4e95f15603
train
class
class EfficientNet_FeatureExtractor(nn.Module): def __init__(self, input_channel, output_channel=32): super(EfficientNet_FeatureExtractor, self).__init__() self.ConvNet = EfficientNet.from_name(input_channel, output_channel, 'efficientnet-b5') def forward(self, input): return se...
class EfficientNet_FeatureExtractor(nn.Module):
def __init__(self, input_channel, output_channel=32): super(EfficientNet_FeatureExtractor, self).__init__() self.ConvNet = EfficientNet.from_name(input_channel, output_channel, 'efficientnet-b5') def forward(self, input): return self.ConvNet(input)
super(ResNet_FeatureExtractor, self).__init__() self.ConvNet = ResNet(input_channel, output_channel, BasicBlock, [1, 2, 5, 3]) def forward(self, input): return self.ConvNet(input) class EfficientNet_FeatureExtractor(nn.Module):
64
64
73
9
55
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
EfficientNet_FeatureExtractor
EfficientNet_FeatureExtractor
84
90
84
84
824bb0e5853b734503fba314374245cf0a7d109c
bigcode/the-stack
train
7c2e8545ba9166ff25c71c1e
train
class
class ResNet_FeatureExtractor(nn.Module): """ FeatureExtractor of FAN (http://openaccess.thecvf.com/content_ICCV_2017/papers/Cheng_Focusing_Attention_Towards_ICCV_2017_paper.pdf) """ def __init__(self, input_channel, output_channel=512): super(ResNet_FeatureExtractor, self).__init__() self.Conv...
class ResNet_FeatureExtractor(nn.Module):
""" FeatureExtractor of FAN (http://openaccess.thecvf.com/content_ICCV_2017/papers/Cheng_Focusing_Attention_Towards_ICCV_2017_paper.pdf) """ def __init__(self, input_channel, output_channel=512): super(ResNet_FeatureExtractor, self).__init__() self.ConvNet = ResNet(input_channel, output_channel...
], 2, 1, 0, bias=False), nn.BatchNorm2d(self.output_channel[3]), nn.ReLU(True)) # 512 x 1 x 26 def forward(self, input): return self.ConvNet(input) class ResNet_FeatureExtractor(nn.Module):
64
64
122
9
55
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
ResNet_FeatureExtractor
ResNet_FeatureExtractor
74
82
74
74
4a2ee0fcac1c0a179290595003fc5a254d4125b1
bigcode/the-stack
train
181cb41c6af60f33118220c8
train
class
class MBConvBlock(nn.Module): """Mobile Inverted Residual Bottleneck Block. Args: block_args (namedtuple): BlockArgs, defined in utils.py. global_params (namedtuple): GlobalParam, defined in utils.py. image_size (tuple or list): [image_height, image_width]. References: [1] ht...
class MBConvBlock(nn.Module):
"""Mobile Inverted Residual Bottleneck Block. Args: block_args (namedtuple): BlockArgs, defined in utils.py. global_params (namedtuple): GlobalParam, defined in utils.py. image_size (tuple or list): [image_height, image_width]. References: [1] https://arxiv.org/abs/1704.04861...
layers) def forward(self, x): x = self.conv0_1(x) x = self.bn0_1(x) x = self.relu(x) x = self.conv0_2(x) x = self.bn0_2(x) x = self.relu(x) x = self.maxpool1(x) x = self.layer1(x) x = self.conv1(x) x = self.bn1(x) x = self.rel...
256
256
1,225
7
248
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
MBConvBlock
MBConvBlock
275
374
275
275
d0ab300d2d33c5b78d525459bd8be7556bea82be
bigcode/the-stack
train
9b2d5278226b2379da030c2a
train
class
class GRCL_unit(nn.Module): def __init__(self, output_channel): super(GRCL_unit, self).__init__() self.BN_gfu = nn.BatchNorm2d(output_channel) self.BN_grx = nn.BatchNorm2d(output_channel) self.BN_fu = nn.BatchNorm2d(output_channel) self.BN_rx = nn.BatchNorm2d(output_channel)...
class GRCL_unit(nn.Module):
def __init__(self, output_channel): super(GRCL_unit, self).__init__() self.BN_gfu = nn.BatchNorm2d(output_channel) self.BN_grx = nn.BatchNorm2d(output_channel) self.BN_fu = nn.BatchNorm2d(output_channel) self.BN_rx = nn.BatchNorm2d(output_channel) self.BN_Gx = nn.Batc...
_u(input) x = F.relu(self.BN_x_init(wf_u)) for i in range(self.num_iteration): x = self.GRCL[i](wgf_u, self.wgr_x(x), wf_u, self.wr_x(x)) return x class GRCL_unit(nn.Module):
64
64
213
7
56
HyeJuSeon/deep-text-recognition-benchmark
modules/feature_extraction.py
Python
GRCL_unit
GRCL_unit
122
141
122
123
8891bea2bb4c8dda06a25135139490bf645e5376
bigcode/the-stack
train
7b66a5416d0b361b6a441c6b
train
function
def get_all_triplets_indices(labels): """ Simplified function by Musgrave. Source: https://github.com/KevinMusgrave/pytorch-metric-learning/blob/9559b21559ca6fbcb46d2d51d7953166e18f9de6/src/pytorch_metric_learning/utils/loss_and_miner_utils.py#L82 """ ref_labels = labels labels1 = labels.unsque...
def get_all_triplets_indices(labels):
""" Simplified function by Musgrave. Source: https://github.com/KevinMusgrave/pytorch-metric-learning/blob/9559b21559ca6fbcb46d2d51d7953166e18f9de6/src/pytorch_metric_learning/utils/loss_and_miner_utils.py#L82 """ ref_labels = labels labels1 = labels.unsqueeze(1) labels2 = ref_labels.unsque...
import math import torch import torch.nn as nn import torch.nn.utils as utils def get_all_triplets_indices(labels):
27
64
158
8
18
bioengstrom/master-thesis
network_modelling/train.py
Python
get_all_triplets_indices
get_all_triplets_indices
7
20
7
7
bc36b133eb7327c4c4d2432869523fc2b687b21b
bigcode/the-stack
train
304125da30a7d0183adb9110
train
function
def train(data_loader, model, optimizer, loss_function, device, epoch_idx, num_epochs, classes, max_norm, task, tb_writer, mining_function, params, class_loss_function=None, class_mining_function=None): num_triplets = 200 # Total values are concatenated for the whole epoch. total_accuracy, total...
def train(data_loader, model, optimizer, loss_function, device, epoch_idx, num_epochs, classes, max_norm, task, tb_writer, mining_function, params, class_loss_function=None, class_mining_function=None):
num_triplets = 200 # Total values are concatenated for the whole epoch. total_accuracy, total_count, total_loss = 0, 0, 0 curr_accuracy, curr_loss = 0, 0 num_classes = len(classes) num_batches = len(data_loader) log_interval = max(math.floor(num_batches / 3), 1) is_verbose = False ...
import math import torch import torch.nn as nn import torch.nn.utils as utils def get_all_triplets_indices(labels): """ Simplified function by Musgrave. Source: https://github.com/KevinMusgrave/pytorch-metric-learning/blob/9559b21559ca6fbcb46d2d51d7953166e18f9de6/src/pytorch_metric_learning/utils/loss_and...
247
256
1,369
47
199
bioengstrom/master-thesis
network_modelling/train.py
Python
train
train
24
183
24
26
0b970cb9c5719fa0a0f47479aa99015314f4fb36
bigcode/the-stack
train
ad5de2958ba4bcd60207755b
train
function
def parse_pose_estimation_record(serialized_example): """Parse serialized example of TfRecord and extract dictionary of all the information """ features = tf.io.parse_single_example( serialized_example, features={ 'height': tf.FixedLenFeature([], tf.int64), 'width': t...
def parse_pose_estimation_record(serialized_example):
"""Parse serialized example of TfRecord and extract dictionary of all the information """ features = tf.io.parse_single_example( serialized_example, features={ 'height': tf.FixedLenFeature([], tf.int64), 'width': tf.FixedLenFeature([], tf.int64), 'image_id...
import tensorflow as tf def parse_pose_estimation_record(serialized_example):
15
75
251
10
4
markgrobman/hailo_model_zoo
hailo_model_zoo/core/datasets/parse_coco.py
Python
parse_pose_estimation_record
parse_pose_estimation_record
4
26
4
4
9a76a087f1e2f5217898556db6149c21d34a49ac
bigcode/the-stack
train
ed078f16da0f71c750166697
train
function
def parse_detection_record(serialized_example): """Parse serialized example of TfRecord and extract dictionary of all the information """ features = tf.io.parse_single_example( serialized_example, features={ 'height': tf.FixedLenFeature([], tf.int64), 'width': tf.Fixe...
def parse_detection_record(serialized_example):
"""Parse serialized example of TfRecord and extract dictionary of all the information """ features = tf.io.parse_single_example( serialized_example, features={ 'height': tf.FixedLenFeature([], tf.int64), 'width': tf.FixedLenFeature([], tf.int64), 'image_id...
height = tf.cast(features['height'], tf.int32) width = tf.cast(features['width'], tf.int32) image_name = tf.cast(features['image_name'], tf.string) image = tf.image.decode_jpeg(features['image_jpeg'], channels=3) mask = tf.decode_raw(features['mask'], tf.uint8) image_shape = tf.stack([height, wi...
164
164
547
8
156
markgrobman/hailo_model_zoo
hailo_model_zoo/core/datasets/parse_coco.py
Python
parse_detection_record
parse_detection_record
60
103
60
60
b42c57ac1708a1372c88099d84e17d35a2dc8ed2
bigcode/the-stack
train
252ec1997c63716b60a3dcd3
train
function
def parse_segmentation_record(serialized_example): """Parse serialized example of TfRecord and extract dictionary of all the information """ features = tf.io.parse_single_example( serialized_example, features={ 'height': tf.FixedLenFeature([], tf.int64), 'width': tf.F...
def parse_segmentation_record(serialized_example):
"""Parse serialized example of TfRecord and extract dictionary of all the information """ features = tf.io.parse_single_example( serialized_example, features={ 'height': tf.FixedLenFeature([], tf.int64), 'width': tf.FixedLenFeature([], tf.int64), 'xmin': t...
['image_name'], tf.string) image = tf.image.decode_jpeg(features['image_jpeg'], channels=3) image = image[..., ::-1] image_shape = tf.stack([height, width, 3]) image = tf.cast(tf.reshape(image, image_shape), tf.uint8) image_info = {'image_id': image_id, 'image_name': image_name} return [image, ...
99
99
330
9
90
markgrobman/hailo_model_zoo
hailo_model_zoo/core/datasets/parse_coco.py
Python
parse_segmentation_record
parse_segmentation_record
29
57
29
29
0071a8da846efb1c07642c614bdb28202098416e
bigcode/the-stack
train
4be089093bbc314a7038f1d7
train
function
def dtype_is_floating(dtype): """ Check the data type is floating or not. Args: dtype(np.dtype|core.VarDesc.VarType): data type. Could be numpy format or Paddle format Returns(bool): True if data type is a float value """ if not isinstance(dtype, core.VarDesc.VarType): ...
def dtype_is_floating(dtype):
""" Check the data type is floating or not. Args: dtype(np.dtype|core.VarDesc.VarType): data type. Could be numpy format or Paddle format Returns(bool): True if data type is a float value """ if not isinstance(dtype, core.VarDesc.VarType): dtype = convert_np_dtype_t...
16 elif dtype == np.uint8: return core.VarDesc.VarType.UINT8 elif dtype == np.int8: return core.VarDesc.VarType.INT8 else: raise ValueError("Not supported numpy dtype %s" % dtype) def dtype_is_floating(dtype):
64
64
119
7
57
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
dtype_is_floating
dtype_is_floating
186
202
186
186
2697aeef899d65961bfb3a2aa1c272ec422fcff2
bigcode/the-stack
train
bf19eedf9e30a0101c813166
train
class
class NameScope(object): def __init__(self, name="", parent=None): self._children = dict() self._name = name self._parent = parent def child(self, prefix): if prefix not in self._children: new_child = NameScope(prefix, self) self._children[prefix] = [new_...
class NameScope(object):
def __init__(self, name="", parent=None): self._children = dict() self._name = name self._parent = parent def child(self, prefix): if prefix not in self._children: new_child = NameScope(prefix, self) self._children[prefix] = [new_child] else: ...
Suffix() CONTROL_DEP_VAR_PREFIX = core.kControlDepVarName() _imperative_tracer_ = None def _in_imperative_mode(): return _imperative_tracer_ is not None def _imperative_tracer(): return _imperative_tracer_ class NameScope(object):
63
64
140
5
58
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
NameScope
NameScope
72
92
72
72
c285c3921b8a5ed34da57f57903954f6ecd6fa62
bigcode/the-stack
train
63675a3b14f59089dbe80d83
train
class
class OpProtoHolder(object): """ A global variable to hold all OpProtos from C++ as a map """ @classmethod def instance(cls): if not hasattr(cls, '_instance'): cls._instance = cls() return cls._instance def __init__(self): assert not hasattr( sel...
class OpProtoHolder(object):
""" A global variable to hold all OpProtos from C++ as a map """ @classmethod def instance(cls): if not hasattr(cls, '_instance'): cls._instance = cls() return cls._instance def __init__(self): assert not hasattr( self.__class__, '_in...
from PaddlePaddle C++ end. Returns: list: list of OpProto. """ protostrs = core.get_all_op_protos() ret_values = [] for pbstr in protostrs: op_proto = framework_pb2.OpProto.FromString(six.binary_type(pbstr)) ret_values.append(op_proto) return ret_values class OpProtoHold...
83
83
277
6
76
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
OpProtoHolder
OpProtoHolder
487
526
487
487
c3c6d79a9cdab5ac88a4faedcb742498e281550d
bigcode/the-stack
train
173cffe2bced5e541854bf35
train
function
def convert_np_dtype_to_dtype_(np_dtype): """ Convert the data type in numpy to the data type in Paddle Args: np_dtype(np.dtype): the data type in numpy. Returns: core.VarDesc.VarType: the data type in Paddle. """ dtype = np.dtype(np_dtype) if dtype == np.float32: ...
def convert_np_dtype_to_dtype_(np_dtype):
""" Convert the data type in numpy to the data type in Paddle Args: np_dtype(np.dtype): the data type in numpy. Returns: core.VarDesc.VarType: the data type in Paddle. """ dtype = np.dtype(np_dtype) if dtype == np.float32: return core.VarDesc.VarType.FP32 elif ...
scope = scope.parent() return name def generate_control_dev_var_name(): import random return CONTROL_DEP_VAR_PREFIX + "@" + str(random.random()) def grad_var_name(var_name): """ Returns: str: gradient name for a certain var name """ return var_name + GRAD_VAR_SUFFIX def c...
80
80
268
10
69
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
convert_np_dtype_to_dtype_
convert_np_dtype_to_dtype_
150
183
150
150
9323ea10a119ca8e2cacd5465746c74b8520495c
bigcode/the-stack
train
da5e4aa9ceb58b12e057945a
train
class
class Parameter(Variable): """ Parameter is derived from Variable. A parameter is a persistable Variable, and will be updated by optimizers after each iteration. The training of a neural network is essentially the updating of its parameters. Relative to a general Variable, a Parameter has sever...
class Parameter(Variable):
""" Parameter is derived from Variable. A parameter is a persistable Variable, and will be updated by optimizers after each iteration. The training of a neural network is essentially the updating of its parameters. Relative to a general Variable, a Parameter has several its own member varia...
invoke it directly. Args: other(Program): Other program Returns: None """ if not isinstance(other, Program): raise TypeError("_copy_param_info_from should be invoked with " "Program") if len(self.blocks) ...
188
188
628
5
182
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
Parameter
Parameter
2,071
2,147
2,071
2,071
f6b7a688c18dba7e17a86c22ac71e4a84eed489c
bigcode/the-stack
train
426ba2ee179b5aacf4f5b3e8
train
class
class Program(object): """ Python Program. Beneath it is a ProgramDesc, which is used for create c++ Program. A program is a self-contained programing language like container. It has at least one Block, when the control flow op like conditional_block, while_op is included, it will contains neste...
class Program(object):
""" Python Program. Beneath it is a ProgramDesc, which is used for create c++ Program. A program is a self-contained programing language like container. It has at least one Block, when the control flow op like conditional_block, while_op is included, it will contains nested block. Please ref...
be cloned. Returns: Variable: the new variable cloned from 'var' in current block. """ assert isinstance(var, Variable) ret_var = None # make STEP_SCOPES var can be safely cloned. if var.type == core.VarDesc.VarType.STEP_SCOPES: ret_var = self.c...
256
256
4,363
4
251
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
Program
Program
1,477
2,068
1,477
1,477
7163f5bef556c724856f31eeb9707bacbda50696
bigcode/the-stack
train
dcb705f8b6ec0d395a5fca1e
train
function
def generate_control_dev_var_name(): import random return CONTROL_DEP_VAR_PREFIX + "@" + str(random.random())
def generate_control_dev_var_name():
import random return CONTROL_DEP_VAR_PREFIX + "@" + str(random.random())
_name_scope = _name_scope.parent() def _full_name_scope(): global _name_scope scope = _name_scope name = "" while scope: name = scope.name() + "/" + name scope = scope.parent() return name def generate_control_dev_var_name():
64
64
25
7
56
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
generate_control_dev_var_name
generate_control_dev_var_name
137
139
137
137
0df8f34692b314a7b11dafcd32889d7f72ad4d43
bigcode/the-stack
train
a02d3c0a1fcdba36cb7da7ba
train
class
class Operator(object): """ In Fluid, all the operation are represented by Operator, and Operator is regarded as a build in an instruction of a Block. Users can use the build in instructions to describe their neural network. Args: block(Block): The block has the current operator. de...
class Operator(object):
""" In Fluid, all the operation are represented by Operator, and Operator is regarded as a build in an instruction of a Block. Users can use the build in instructions to describe their neural network. Args: block(Block): The block has the current operator. desc(core.OpDesc): The pro...
""" @classmethod def instance(cls): if not hasattr(cls, '_instance'): cls._instance = cls() return cls._instance def __init__(self): assert not hasattr( self.__class__, '_instance'), 'Please use `instance()` to get OpProtoHolder object!' ...
256
256
2,948
4
252
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
Operator
Operator
529
969
529
529
7daec3c59ca272b4d3b8a632cba98fd7b617e1c7
bigcode/the-stack
train
f27cc36c648ec58e6037ae8f
train
class
class Block(object): """ In Fluid, a Program is consistence of multi-Block, and Block stores VarDesc and OpDesc. In a specific Block, a VarDesc have a unique name. One block could have some child blocks, and child block's name scopes should inherit the parent's so that OpDesc in child block can refe...
class Block(object):
""" In Fluid, a Program is consistence of multi-Block, and Block stores VarDesc and OpDesc. In a specific Block, a VarDesc have a unique name. One block could have some child blocks, and child block's name scopes should inherit the parent's so that OpDesc in child block can reference a VarDesc t...
): the attribute name. Returns: list: list of the blocks attribute. """ attrs = [] for i in self._blocks_attr_ids(name): assert (i >= 0 and i < len(self.block.program.blocks)) attrs.append(self.block.program.blocks[i]) return attrs def _...
256
256
3,558
4
251
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
Block
Block
972
1,474
972
972
eb654001c3f448d2b9c57197a9ca02ff1e3f91ae
bigcode/the-stack
train
9b5b06d7f0681e7070a52cc1
train
function
def default_startup_program(): """ Get default/global startup program. The layer function in :code:`fluid.layers` will create parameters, readers, NCCL handles as global variables. The :code:`startup_program` will initialize them by the operators in startup program. The layer function will appe...
def default_startup_program():
""" Get default/global startup program. The layer function in :code:`fluid.layers` will create parameters, readers, NCCL handles as global variables. The :code:`startup_program` will initialize them by the operators in startup program. The layer function will append these initialization operato...
attr(self, attr_name))) else: res_str = Variable.to_string(self, throw_on_error, False) return res_str __repr__ = __str__ # program is a global instance. _main_program_ = Program() _startup_program_ = Program() def default_startup_program():
64
64
127
6
58
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
default_startup_program
default_startup_program
2,155
2,170
2,155
2,155
b645960c85eea520c50b66b52406f6ac50933195
bigcode/the-stack
train
2d25dacdef5064489194cd65
train
function
def get_all_op_protos(): """ Get all registered op proto from PaddlePaddle C++ end. Returns: list: list of OpProto. """ protostrs = core.get_all_op_protos() ret_values = [] for pbstr in protostrs: op_proto = framework_pb2.OpProto.FromString(six.binary_type(pbstr)) ret...
def get_all_op_protos():
""" Get all registered op proto from PaddlePaddle C++ end. Returns: list: list of OpProto. """ protostrs = core.get_all_op_protos() ret_values = [] for pbstr in protostrs: op_proto = framework_pb2.OpProto.FromString(six.binary_type(pbstr)) ret_values.append(op_proto) ...
return self.desc.type() def _set_error_clip(self, error_clip): """ Set the error_clip. Args: error_clip(BaseErrorClipAttr) : The new error_clip. Returns: None """ self.error_clip = error_clip def get_all_op_protos():
64
64
92
7
56
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
get_all_op_protos
get_all_op_protos
472
484
472
472
ab35dce2a7ae78eb9563091f6d1f27fe67f27d1d
bigcode/the-stack
train
09b1efd3925e74fd3b25a358
train
function
def _imperative_tracer(): return _imperative_tracer_
def _imperative_tracer():
return _imperative_tracer_
core.kGradVarSuffix() ZERO_VAR_SUFFIX = core.kZeroVarSuffix() CONTROL_DEP_VAR_PREFIX = core.kControlDepVarName() _imperative_tracer_ = None def _in_imperative_mode(): return _imperative_tracer_ is not None def _imperative_tracer():
64
64
15
7
56
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
_imperative_tracer
_imperative_tracer
68
69
68
68
ef53fc1f4982cd81729227a5055310f681a68a90
bigcode/the-stack
train
70c60c2f682e1786a8379223
train
function
def _full_name_scope(): global _name_scope scope = _name_scope name = "" while scope: name = scope.name() + "/" + name scope = scope.parent() return name
def _full_name_scope():
global _name_scope scope = _name_scope name = "" while scope: name = scope.name() + "/" + name scope = scope.parent() return name
# TODO(panyx0718): Only [0-9a-z]. assert prefix, "namescope prefix cannot be empty." global _name_scope _name_scope = _name_scope.child(prefix) yield _name_scope = _name_scope.parent() def _full_name_scope():
64
64
48
6
58
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
_full_name_scope
_full_name_scope
127
134
127
127
dfd7227aa8b247ebcf2b59b83837b7bc3d90b30c
bigcode/the-stack
train
b5ac3a581304d6c156d79044
train
function
def _in_imperative_mode(): return _imperative_tracer_ is not None
def _in_imperative_mode():
return _imperative_tracer_ is not None
EmptyVarName() TEMP_VAR_NAME = core.kTempVarName() GRAD_VAR_SUFFIX = core.kGradVarSuffix() ZERO_VAR_SUFFIX = core.kZeroVarSuffix() CONTROL_DEP_VAR_PREFIX = core.kControlDepVarName() _imperative_tracer_ = None def _in_imperative_mode():
64
64
20
8
55
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
_in_imperative_mode
_in_imperative_mode
64
65
64
64
b081d4eae35ea4983f086b4d80aa498f3e615d4a
bigcode/the-stack
train
1c023f6ff1117d4257dc6daf
train
function
def default_main_program(): """ Get default/global main program. The main program is used for training or testing. All layer function in :code:`fluid.layers` will append operators and variables to the :code:`default_main_program`. The :code:`default_main_program` is the default program in a lo...
def default_main_program():
""" Get default/global main program. The main program is used for training or testing. All layer function in :code:`fluid.layers` will append operators and variables to the :code:`default_main_program`. The :code:`default_main_program` is the default program in a lot of APIs. For example, ...
into startup program. This method will return the :code:`default` or the :code:`current` startup program. Users can use :code:`fluid.program_guard` to switch program. Returns: Program: startup program """ return _startup_program_ def default_main_program():
63
64
119
5
58
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
default_main_program
default_main_program
2,173
2,188
2,173
2,173
020bd95cfb0a51ec3a6d201e0fde837dd29a39fa
bigcode/the-stack
train
1791213aea5748b23c652a2e
train
function
@contextlib.contextmanager def program_guard(main_program, startup_program=None): """ Change the global main program and startup program with `with` statement. Layer functions in the Python `with` block will append operators and variables to the new main programs. Examples: >>> import padd...
@contextlib.contextmanager def program_guard(main_program, startup_program=None):
""" Change the global main program and startup program with `with` statement. Layer functions in the Python `with` block will append operators and variables to the new main programs. Examples: >>> import paddle.fluid as fluid >>> main_program = fluid.Program() >>> startup_p...
_ _main_program_ = program return prev_program def switch_startup_program(program): """ Switch the startup program to a new program Args: program(Program): The new startup program Returns: Program: The previous startup program """ global _startup_program_ prev_prog...
102
102
342
16
85
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
program_guard
program_guard
2,222
2,264
2,222
2,223
78ec0a89731f3b4b070c8ba402ee1abcaba2f4d3
bigcode/the-stack
train
9d0f3f3bfb981ca572575907
train
class
class Variable(object): """ In Fluid, every input and output of an operator is a variable. In most cases, variables are used for holding different kinds of data or training labels. A variable belongs to a block. All variable has its own name and two variables in different blocks could have the same ...
class Variable(object):
""" In Fluid, every input and output of an operator is a variable. In most cases, variables are used for holding different kinds of data or training labels. A variable belongs to a block. All variable has its own name and two variables in different blocks could have the same name. There are man...
): """ Check the data type is floating or not. Args: dtype(np.dtype|core.VarDesc.VarType): data type. Could be numpy format or Paddle format Returns(bool): True if data type is a float value """ if not isinstance(dtype, core.VarDesc.VarType): dtype = convert_np_dtyp...
255
256
1,814
4
252
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
Variable
Variable
224
469
224
224
4256dcc1e0c59de794a5dcfebd7c3d251427eb01
bigcode/the-stack
train
82dc0b3cf940ad9beeeb095d
train
function
@contextlib.contextmanager def _imperative_guard(tracer): global _imperative_tracer_ tmp_trace = _imperative_tracer_ _imperative_tracer_ = tracer yield _imperative_tracer_ = tmp_trace
@contextlib.contextmanager def _imperative_guard(tracer):
global _imperative_tracer_ tmp_trace = _imperative_tracer_ _imperative_tracer_ = tracer yield _imperative_tracer_ = tmp_trace
_program() will be used. Returns: Variable """ if program is None: program = default_main_program() assert isinstance(name, str) assert isinstance(program, Program) return program.global_block().var(name) @contextlib.contextmanager def _imperative_guard(tracer):
64
64
56
14
50
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
_imperative_guard
_imperative_guard
2,287
2,293
2,287
2,288
941bc943090157f132a176d39676db5f86b3aa8e
bigcode/the-stack
train
698c962c6376ef4ae6799b4c
train
function
def switch_main_program(program): """ Switch the main program to a new program. Args: program(Program): The new main program Returns: Program: The previous main program """ global _main_program_ prev_program = _main_program_ _main_program_ = program return prev_prog...
def switch_main_program(program):
""" Switch the main program to a new program. Args: program(Program): The new main program Returns: Program: The previous main program """ global _main_program_ prev_program = _main_program_ _main_program_ = program return prev_program
is the default program in a lot of APIs. For example, the :code:`Executor.run()` will execute the :code:`default_main_program` when the program is not specified. Returns: Program: main program """ return _main_program_ def switch_main_program(program):
63
64
71
6
57
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
switch_main_program
switch_main_program
2,191
2,204
2,191
2,191
2e8148fe400fa184dcfa95c244de60f07c70dbae
bigcode/the-stack
train
bd71c1b6f68a54abc1006da5
train
function
def _debug_string_(proto, throw_on_error=True): """ Get the debug string of a protobuf message. The message could be not initialized. Args: proto(google.protobuf.message.Message): The protobuf message throw_on_error(bool): True if raise an error when the protobuf message is n...
def _debug_string_(proto, throw_on_error=True):
""" Get the debug string of a protobuf message. The message could be not initialized. Args: proto(google.protobuf.message.Message): The protobuf message throw_on_error(bool): True if raise an error when the protobuf message is not initialized. Returns(str): The debug str...
Desc.VarType): dtype = convert_np_dtype_to_dtype_(dtype) return dtype in [ core.VarDesc.VarType.FP16, core.VarDesc.VarType.FP32, core.VarDesc.VarType.FP64 ] def _debug_string_(proto, throw_on_error=True):
63
64
137
12
51
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
_debug_string_
_debug_string_
205
221
205
205
68506379c740e53e953c3953fed6cf33e4e24226
bigcode/the-stack
train
2422b9c9f684be7686b40aef
train
function
def grad_var_name(var_name): """ Returns: str: gradient name for a certain var name """ return var_name + GRAD_VAR_SUFFIX
def grad_var_name(var_name):
""" Returns: str: gradient name for a certain var name """ return var_name + GRAD_VAR_SUFFIX
name_scope name = "" while scope: name = scope.name() + "/" + name scope = scope.parent() return name def generate_control_dev_var_name(): import random return CONTROL_DEP_VAR_PREFIX + "@" + str(random.random()) def grad_var_name(var_name):
64
64
35
7
57
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
grad_var_name
grad_var_name
142
147
142
142
f73c8af6f22d194e26eb19b5bad31bf23cc0ecd7
bigcode/the-stack
train
71e0991680539d2bacefbde7
train
function
def switch_startup_program(program): """ Switch the startup program to a new program Args: program(Program): The new startup program Returns: Program: The previous startup program """ global _startup_program_ prev_program = _startup_program_ _startup_program_ = program ...
def switch_startup_program(program):
""" Switch the startup program to a new program Args: program(Program): The new startup program Returns: Program: The previous startup program """ global _startup_program_ prev_program = _startup_program_ _startup_program_ = program return prev_program
a new program. Args: program(Program): The new main program Returns: Program: The previous main program """ global _main_program_ prev_program = _main_program_ _main_program_ = program return prev_program def switch_startup_program(program):
64
64
72
7
56
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
switch_startup_program
switch_startup_program
2,207
2,219
2,207
2,207
c30b954d2fa3c0dbb5eb43d8f553a3e3d98ca189
bigcode/the-stack
train
ed519758c8c2d888be4e6de5
train
function
def _get_var(name, program=None): """ Get a variable by name from the global block of a program. Args: name(str): name of the variable program(Program|None): program object. If None, default_global_program() will be used. Returns: Variable """ if program is None...
def _get_var(name, program=None):
""" Get a variable by name from the global block of a program. Args: name(str): name of the variable program(Program|None): program object. If None, default_global_program() will be used. Returns: Variable """ if program is None: program = default_main_p...
up_program, Program): raise TypeError("startup_program should be Program") startup_program = switch_startup_program(startup_program) yield switch_main_program(main_program) if startup_program is not None: switch_startup_program(startup_program) def _get_var(name, program=None):
64
64
103
9
55
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
_get_var
_get_var
2,267
2,284
2,267
2,267
ad2c5c31385c5be8f282d77e69f1c2d9d07b769d
bigcode/the-stack
train
47da746dadbf93b496837bf0
train
function
@contextlib.contextmanager def name_scope(prefix=None): """ Generate hierarchical name prefix for the operators. Note: This should only used for debugging and visualization purpose. Don't use it for serious analysis such as graph/program transformations. Args: prefix(str): prefix. Exa...
@contextlib.contextmanager def name_scope(prefix=None):
""" Generate hierarchical name prefix for the operators. Note: This should only used for debugging and visualization purpose. Don't use it for serious analysis such as graph/program transformations. Args: prefix(str): prefix. Examples: .. code-block:: python with na...
._children[prefix]), self) self._children[prefix].append(new_child) return new_child def parent(self): return self._parent def name(self): return self._name _name_scope = NameScope() @contextlib.contextmanager def name_scope(prefix=None):...
64
64
156
12
52
bigo-sg/Paddle
python/paddle/fluid/framework.py
Python
name_scope
name_scope
98
124
98
99
db77ed1553e3e757a1b1ddc4906ce686de027008
bigcode/the-stack
train
70de8470a7cc28d125377238
train
class
class SDKNetworkOpsTestCase(base.SDKTestCase): def setUp(self): self.networkops = networkops.get_networkops() @mock.patch('zvmsdk.smtclient.SMTClient.create_nic') def test_create_nic(self, create_nic): self.networkops.create_nic("fakeid", '1000', 'Fake_nic_id', ...
class SDKNetworkOpsTestCase(base.SDKTestCase):
def setUp(self): self.networkops = networkops.get_networkops() @mock.patch('zvmsdk.smtclient.SMTClient.create_nic') def test_create_nic(self, create_nic): self.networkops.create_nic("fakeid", '1000', 'Fake_nic_id', active=True) create_nic.assert_ca...
# Copyright 2017,2018 IBM Corp. # # 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 agr...
184
256
2,953
11
172
jasealpers/python-zvm-sdk
zvmsdk/tests/unit/test_networkops.py
Python
SDKNetworkOpsTestCase
SDKNetworkOpsTestCase
23
291
23
24
8093c9b34e5f0d940fe52a059dd1fe59a75c6d00
bigcode/the-stack
train
25795ef1a80f2ea52ae4861e
train
class
@utils.register_interface(CipherBackend) @utils.register_interface(HashBackend) @utils.register_interface(HMACBackend) @utils.register_interface(PBKDF2HMACBackend) @utils.register_interface(RSABackend) class MultiBackend(object): name = "multibackend" def __init__(self, backends): self._backends = back...
@utils.register_interface(CipherBackend) @utils.register_interface(HashBackend) @utils.register_interface(HMACBackend) @utils.register_interface(PBKDF2HMACBackend) @utils.register_interface(RSABackend) class MultiBackend(object):
name = "multibackend" def __init__(self, backends): self._backends = backends def _filtered_backends(self, interface): for b in self._backends: if isinstance(b, interface): yield b def cipher_supported(self, algorithm, mode): return any( ...
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 O...
215
215
719
50
165
lvh/cryptography
cryptography/hazmat/backends/multibackend.py
Python
MultiBackend
MultiBackend
23
121
23
28
327401bfdcfa9926721ffc7e26bd8f2747b20297
bigcode/the-stack
train
8793de1d13795736a8eb27bc
train
function
def create_dest_folder(resized_image_path): resized_image_dir = os.path.dirname(resized_image_path) os.makedirs(resized_image_dir, exist_ok=True)
def create_dest_folder(resized_image_path):
resized_image_dir = os.path.dirname(resized_image_path) os.makedirs(resized_image_dir, exist_ok=True)
from skimage.transform import resize # sample usage: # python src/actions/resize_image/resize_image.py -i src/scripts/data/bridge.jpeg -o src/scripts/data/bridge-100x100.jpeg -r 100 -c 100 -d 3 def create_dest_folder(resized_image_path):
64
64
34
9
54
josecelano/data-version-control
src/actions/resize_image/resize_image.py
Python
create_dest_folder
create_dest_folder
13
15
13
13
60e1d75769f39c6559c78c159c3ec0284ae17be3
bigcode/the-stack
train
bc9f514f6667125e42ed7f43
train
function
def resize_image(source_image_path, resized_image_path, output_shape): image = imread(source_image_path) resized = resize(image, output_shape) create_dest_folder(resized_image_path) imsave(resized_image_path, img_as_ubyte(resized))
def resize_image(source_image_path, resized_image_path, output_shape):
image = imread(source_image_path) resized = resize(image, output_shape) create_dest_folder(resized_image_path) imsave(resized_image_path, img_as_ubyte(resized))
x100.jpeg -r 100 -c 100 -d 3 def create_dest_folder(resized_image_path): resized_image_dir = os.path.dirname(resized_image_path) os.makedirs(resized_image_dir, exist_ok=True) def resize_image(source_image_path, resized_image_path, output_shape):
64
64
57
14
50
josecelano/data-version-control
src/actions/resize_image/resize_image.py
Python
resize_image
resize_image
18
25
18
18
4d597d058b2f3a0fb48b05d83eb15bacff1b6582
bigcode/the-stack
train
d5d790e6a14735142e83cd27
train
function
def init_argparse(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help="source image path") parser.add_argument('-o', '--output', required=True, help="resized image path") parser.add_argument('-r', '--rows', requir...
def init_argparse():
parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help="source image path") parser.add_argument('-o', '--output', required=True, help="resized image path") parser.add_argument('-r', '--rows', required=True, ...
=True) def resize_image(source_image_path, resized_image_path, output_shape): image = imread(source_image_path) resized = resize(image, output_shape) create_dest_folder(resized_image_path) imsave(resized_image_path, img_as_ubyte(resized)) def init_argparse():
64
64
122
5
59
josecelano/data-version-control
src/actions/resize_image/resize_image.py
Python
init_argparse
init_argparse
28
39
28
28
50d973a3552fbeacd0f54ed21620000b569e83b1
bigcode/the-stack
train
e810c70983500b6da243bc48
train
function
def main(): parser = init_argparse() args = parser.parse_args() resize_image(args.input, args.output, (args.rows, args.cols, args.dim))
def main():
parser = init_argparse() args = parser.parse_args() resize_image(args.input, args.output, (args.rows, args.cols, args.dim))
rows', required=True, type=int, help="resized image width") parser.add_argument('-c', '--cols', required=True, type=int, help="resized image heigth") parser.add_argument('-d', '--dim', required=True, type=int) return parser def main():
64
64
36
3
60
josecelano/data-version-control
src/actions/resize_image/resize_image.py
Python
main
main
42
46
42
42
52aa2161b9e5b3c635adf29b2bfc5f8b17142ceb
bigcode/the-stack
train
09a87e3e1fb678025b74986a
train
class
class Migration(migrations.Migration): dependencies = [ ('ramaelectric', '0030_auto_20201028_1253'), ] operations = [ migrations.AddField( model_name='appointmentform', name='updated_date', field=models.DateTimeField(auto_now_add=True, null=True), ...
class Migration(migrations.Migration):
dependencies = [ ('ramaelectric', '0030_auto_20201028_1253'), ] operations = [ migrations.AddField( model_name='appointmentform', name='updated_date', field=models.DateTimeField(auto_now_add=True, null=True), ), ]
# Generated by Django 3.1.1 on 2020-10-29 02:51 from django.db import migrations, models class Migration(migrations.Migration):
38
64
70
7
30
thakuramar/ramaelectricstore
ramaelectricstore/ramaelectric/migrations/0031_appointmentform_updated_date.py
Python
Migration
Migration
6
18
6
7
f41dadee18566b7b277c9c61319ac8631a9a8e95
bigcode/the-stack
train
77e2d9d017aa7a74bd23383f
train
class
class DefaultNetworksDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dn extension_attributes = (dn.PROJECT_DEFAULT,)
class DefaultNetworksDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = dn extension_attributes = (dn.PROJECT_DEFAULT,)
either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import project_default_networks as dn from neutron_lib.tests.unit.api.definitions import base class DefaultNetworksDefinitionTestCase(base.Definition...
64
64
29
13
50
rolaya/neutron-lib
neutron_lib/tests/unit/api/definitions/test_project_default_networks.py
Python
DefaultNetworksDefinitionTestCase
DefaultNetworksDefinitionTestCase
19
21
19
19
f71206987167be411a393f6581af1fae71bc9864
bigcode/the-stack
train
1f677529b2d9c59f9d2100f8
train
class
class SharedTokenCacheCredential(SharedTokenCacheBase, AsyncCredentialBase): """Authenticates using tokens in the local cache shared between Microsoft applications. :param str username: Username (typically an email address) of the user to authenticate as. This is required because the local cache ...
class SharedTokenCacheCredential(SharedTokenCacheBase, AsyncCredentialBase):
"""Authenticates using tokens in the local cache shared between Microsoft applications. :param str username: Username (typically an email address) of the user to authenticate as. This is required because the local cache may contain tokens for multiple identities. :keyword str authority: Au...
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ from typing import TYPE_CHECKING from ... import CredentialUnavailableError from ..._constants import AZURE_CLI_CLIENT_ID from ..._internal.shared_token_cache import NO...
141
180
602
15
125
KarishmaGhiya/azure-sdk-for-python
sdk/identity/azure-identity/azure/identity/aio/_credentials/shared_cache.py
Python
SharedTokenCacheCredential
SharedTokenCacheCredential
20
84
20
20
bfb9f6bdecfddaafcc30abc02d63e3217f79aa19
bigcode/the-stack
train
90f80a61b75c3f5f67d2c0a3
train
class
class InvalidRequestObject(object): def __init__(self): self.errors = list() def __nonzero__(self): return False __bool__ = __nonzero__ def add_error(self, parameter, value): self.errors.append({'parameter': parameter, 'message': value}) def has_errors(self): retu...
class InvalidRequestObject(object):
def __init__(self): self.errors = list() def __nonzero__(self): return False __bool__ = __nonzero__ def add_error(self, parameter, value): self.errors.append({'parameter': parameter, 'message': value}) def has_errors(self): return bool(len(self.errors))
from snipssonos.exceptions import RequestObjectInitializationException class InvalidRequestObject(object):
18
64
77
6
11
RedaMastouri/marvis
11 - Extra-- sonos snips voice app/snipssonos/shared/request_object.py
Python
InvalidRequestObject
InvalidRequestObject
3
16
3
3
675d416bbce873da08b3e1035ba813bb8c6240cd
bigcode/the-stack
train
d5554011b5efa9e76ec31eaa
train
class
class ValidRequestObject(object): def __nonzero__(self): return True __bool__ = __nonzero__ @classmethod def from_dict(cls, adict): raise NotImplementedError
class ValidRequestObject(object):
def __nonzero__(self): return True __bool__ = __nonzero__ @classmethod def from_dict(cls, adict): raise NotImplementedError
def __nonzero__(self): return False __bool__ = __nonzero__ def add_error(self, parameter, value): self.errors.append({'parameter': parameter, 'message': value}) def has_errors(self): return bool(len(self.errors)) class ValidRequestObject(object):
64
64
46
6
58
RedaMastouri/marvis
11 - Extra-- sonos snips voice app/snipssonos/shared/request_object.py
Python
ValidRequestObject
ValidRequestObject
19
27
19
19
64d6e1ddaf49f99547a5ce2c03de960547a5b9fd
bigcode/the-stack
train
680a482942f4f803666749f6
train
class
class RequestObjectFactory(object): request_object_class = ValidRequestObject @classmethod def from_dict(cls, a_dict): try: return cls.request_object_class.from_dict(a_dict) except RequestObjectInitializationException as exception: return exception.invalid_request_ob...
class RequestObjectFactory(object):
request_object_class = ValidRequestObject @classmethod def from_dict(cls, a_dict): try: return cls.request_object_class.from_dict(a_dict) except RequestObjectInitializationException as exception: return exception.invalid_request_object
def has_errors(self): return bool(len(self.errors)) class ValidRequestObject(object): def __nonzero__(self): return True __bool__ = __nonzero__ @classmethod def from_dict(cls, adict): raise NotImplementedError class RequestObjectFactory(object):
64
64
57
6
57
RedaMastouri/marvis
11 - Extra-- sonos snips voice app/snipssonos/shared/request_object.py
Python
RequestObjectFactory
RequestObjectFactory
30
38
30
30
f7f57183eb98ca41494781d55dddf544440c43a2
bigcode/the-stack
train
90d398bea4e102a0d750ee68
train
function
@pytest.mark.parametrize("drop_last", [True, False]) def test_sized(group_ids: list[int], drop_last: bool) -> None: sampler = StratifiedBatchSampler( group_ids=group_ids, num_samples_per_group=225, multipliers=None, shuffle=False, training_mode=TrainingMode.epoch, dro...
@pytest.mark.parametrize("drop_last", [True, False]) def test_sized(group_ids: list[int], drop_last: bool) -> None:
sampler = StratifiedBatchSampler( group_ids=group_ids, num_samples_per_group=225, multipliers=None, shuffle=False, training_mode=TrainingMode.epoch, drop_last=drop_last, ) batches = [batch for batch in sampler] assert len(batches) == len(sampler) # type: ...
): assert (x == i).sum() == num_samples_per_group iters += 1 if iters == 2: break @pytest.mark.parametrize("drop_last", [True, False]) def test_sized(group_ids: list[int], drop_last: bool) -> None:
64
64
120
30
33
predictive-analytics-lab/palk
tests/stratified_sampler_test.py
Python
test_sized
test_sized
101
113
101
102
0d11d1e7f836c732f15850b6c011596a4f1c5c92
bigcode/the-stack
train
49f1e27c7c6b08772134e04a
train
function
def test_without_replacement(group_ids: list[int]) -> None: num_samples_per_group = 100 indexes = next( iter( StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_group, replacement=True, multipliers=None, ...
def test_without_replacement(group_ids: list[int]) -> None:
num_samples_per_group = 100 indexes = next( iter( StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_group, replacement=True, multipliers=None, ) ) ) group_ids_t = torch.as_tenso...
torch.as_tensor(group_ids) _, counts = group_ids_t[indexes].unique(return_counts=True) assert len(indexes) == 4 * num_samples_per_group assert all(count == num_samples_per_group for count in counts) def test_without_replacement(group_ids: list[int]) -> None:
64
64
121
14
50
predictive-analytics-lab/palk
tests/stratified_sampler_test.py
Python
test_without_replacement
test_without_replacement
37
52
37
37
b042fc6739d67f275682272e6a17b1dfe1ae70cb
bigcode/the-stack
train
55165ab5bd1d898e10979fd1
train
function
@pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_simple(group_ids: list[int], sampler: BaseSampler) -> None: num_samples_per_group = 800 indexes = next( iter( StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_group, ...
@pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_simple(group_ids: list[int], sampler: BaseSampler) -> None:
num_samples_per_group = 800 indexes = next( iter( StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_group, replacement=True, multipliers=None, base_sampler=sampler, ) ) ...
.full((100,), 0), torch.full((200,), 1), torch.full((400,), 2), torch.full((800,), 3)] ).tolist() @pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_simple(group_ids: list[int], sampler: BaseSampler) -> None:
64
64
142
29
35
predictive-analytics-lab/palk
tests/stratified_sampler_test.py
Python
test_simple
test_simple
17
34
17
18
d1ba9fb5b29b51e633dc547f34e6dac362fc8f70
bigcode/the-stack
train
2a42c2eeb7ca54292c206575
train
function
@pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_with_dataloader(group_ids: list[int], sampler: BaseSampler) -> None: num_samples_per_group = 100 batch_size = num_samples_per_group * 4 batch_sampler = StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_g...
@pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_with_dataloader(group_ids: list[int], sampler: BaseSampler) -> None:
num_samples_per_group = 100 batch_size = num_samples_per_group * 4 batch_sampler = StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_group, replacement=False, multipliers=None, base_sampler=sampler, ) ds = TensorDataset(torch.as_tensor(g...
assert (samples == 1).sum() == 0 assert (samples == 2).sum() == (3 * num_samples_per_group) @pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_with_dataloader(group_ids: list[int], sampler: BaseSampler) -> None:
64
64
211
31
33
predictive-analytics-lab/palk
tests/stratified_sampler_test.py
Python
test_with_dataloader
test_with_dataloader
77
98
77
78
b82dd77067822a7c48b58bafbbe377f07defb723
bigcode/the-stack
train
a5124d9d6017a2dda76160bc
train
function
@pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_with_multipliers(group_ids: list[int], sampler: BaseSampler) -> None: num_samples_per_group = 800 indexes = next( iter( StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_g...
@pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_with_multipliers(group_ids: list[int], sampler: BaseSampler) -> None:
num_samples_per_group = 800 indexes = next( iter( StratifiedBatchSampler( group_ids, num_samples_per_group=num_samples_per_group, replacement=True, multipliers={0: 2, 1: 0, 2: 3}, base_sampler=sampler, ...
_counts=True) assert len(indexes) == 4 * num_samples_per_group assert all(count == num_samples_per_group for count in counts) @pytest.mark.parametrize("sampler", [list(BaseSampler)]) def test_with_multipliers(group_ids: list[int], sampler: BaseSampler) -> None:
64
64
203
32
32
predictive-analytics-lab/palk
tests/stratified_sampler_test.py
Python
test_with_multipliers
test_with_multipliers
55
74
55
56
ebbdc4ec850c43f2a213ea0ff61ddcb2258e016d
bigcode/the-stack
train
1e1ef36c517d4e17e67af3c1
train
function
@pytest.fixture def group_ids() -> list[int]: return torch.cat( [torch.full((100,), 0), torch.full((200,), 1), torch.full((400,), 2), torch.full((800,), 3)] ).tolist()
@pytest.fixture def group_ids() -> list[int]:
return torch.cat( [torch.full((100,), 0), torch.full((200,), 1), torch.full((400,), 2), torch.full((800,), 3)] ).tolist()
from __future__ import annotations import pytest import torch from torch.utils.data import DataLoader, TensorDataset from ranzen.torch.data import BaseSampler, StratifiedBatchSampler, TrainingMode @pytest.fixture def group_ids() -> list[int]:
53
64
54
11
41
predictive-analytics-lab/palk
tests/stratified_sampler_test.py
Python
group_ids
group_ids
10
14
10
11
8ad821db4e1fbcb5ab910b0025acfa4d8896387f
bigcode/the-stack
train
2c8122f7b396886ece82e353
train
function
def main(): print(find_MSIS([4, 1, 2, 6, 10, 1, 12])) print(find_MSIS([-4, 10, 3, 7, 15]))
def main():
print(find_MSIS([4, 1, 2, 6, 10, 1, 12])) print(find_MSIS([-4, 10, 3, 7, 15]))
+ nums[currentIndex]) # excluding the number at currentIndex s2 = find_MSIS_recursive( dp, nums, currentIndex + 1, previousIndex, sum) dp[subProblemKey] = max(s1, s2) return dp.get(subProblemKey) def main():
64
64
49
3
61
mkoryor/Python
coding patterns/dynamic programming/longest_common_substring/max_sum_inc_subsequence_topDownMemo.py
Python
main
main
49
51
49
49
b82169ee640a3380a0deaa2335c0bff24a2fccb9
bigcode/the-stack
train
511fdcb42f1d9711d889a717
train
function
def find_MSIS(nums): dp = {} return find_MSIS_recursive(dp, nums, 0, -1, 0)
def find_MSIS(nums):
dp = {} return find_MSIS_recursive(dp, nums, 0, -1, 0)
31'. Example 2: Input: {-4,10,3,7,15} Output: 25 Explanation: The increaseing sequences are {10, 15} and {3,7,15}. """ # Time: O(^2) Space: O(n) def find_MSIS(nums):
64
64
29
6
58
mkoryor/Python
coding patterns/dynamic programming/longest_common_substring/max_sum_inc_subsequence_topDownMemo.py
Python
find_MSIS
find_MSIS
23
25
23
23
41d490093c8a03edbcb1a52cfbcdfd4e7c91ba8d
bigcode/the-stack
train
6e8102d5f55637ed2a5db1ec
train
function
def find_MSIS_recursive(dp, nums, currentIndex, previousIndex, sum): if currentIndex == len(nums): return sum subProblemKey = str(currentIndex) + "-" + str(previousIndex) + "-" + str(sum) if subProblemKey not in dp: # include nums[currentIndex] if it is larger than the last included number s1 = su...
def find_MSIS_recursive(dp, nums, currentIndex, previousIndex, sum):
if currentIndex == len(nums): return sum subProblemKey = str(currentIndex) + "-" + str(previousIndex) + "-" + str(sum) if subProblemKey not in dp: # include nums[currentIndex] if it is larger than the last included number s1 = sum if previousIndex == -1 or nums[currentIndex] > nums[previousIndex...
,15}. """ # Time: O(^2) Space: O(n) def find_MSIS(nums): dp = {} return find_MSIS_recursive(dp, nums, 0, -1, 0) def find_MSIS_recursive(dp, nums, currentIndex, previousIndex, sum):
64
64
188
19
45
mkoryor/Python
coding patterns/dynamic programming/longest_common_substring/max_sum_inc_subsequence_topDownMemo.py
Python
find_MSIS_recursive
find_MSIS_recursive
28
46
28
28
e182587cc0c7e9f0ffbf11d44b476506752bb9b6
bigcode/the-stack
train
eb4ed5f16a56302bf638a715
train
function
def test_ogr_gpsbabel_1(): ds = ogr.Open('GPSBabel:nmea:data/gpsbabel/nmea.txt') assert ds is not None assert ds.GetLayerCount() == 2
def test_ogr_gpsbabel_1():
ds = ogr.Open('GPSBabel:nmea:data/gpsbabel/nmea.txt') assert ds is not None assert ds.GetLayerCount() == 2
gdaltest.runexternal('gpsbabel -V') except OSError: ret = '' if ret.find('GPSBabel') == -1: pytest.skip('Cannot access GPSBabel utility') ############################################################################### # Test reading with explicit subdriver def test_ogr_gpsbabel_1():
64
64
47
10
53
jpapadakis/gdal
autotest/ogr/ogr_gpsbabel.py
Python
test_ogr_gpsbabel_1
test_ogr_gpsbabel_1
57
62
57
58
045cd9b9a27275890e32bd49efa0d358b45e1ccb
bigcode/the-stack
train
176c20a852d496e23c26231d
train
function
@pytest.fixture(autouse=True, scope='module') def startup_and_cleanup(): # Test if the gpsbabel is accessible try: ret = gdaltest.runexternal('gpsbabel -V') except OSError: ret = '' if ret.find('GPSBabel') == -1: pytest.skip('Cannot access GPSBabel utility')
@pytest.fixture(autouse=True, scope='module') def startup_and_cleanup(): # Test if the gpsbabel is accessible
try: ret = gdaltest.runexternal('gpsbabel -V') except OSError: ret = '' if ret.find('GPSBabel') == -1: pytest.skip('Cannot access GPSBabel utility')
import ogr from osgeo import gdal import pytest pytestmark = [ pytest.mark.require_driver('GPSBabel'), pytest.mark.require_driver('GPX') ] ############################################################################### @pytest.fixture(autouse=True, scope='module') def startup_and_cleanup(): # Tes...
64
64
76
26
38
jpapadakis/gdal
autotest/ogr/ogr_gpsbabel.py
Python
startup_and_cleanup
startup_and_cleanup
42
51
42
45
6e708ffe706c66f503c71c0d07a785fda691a653
bigcode/the-stack
train
9b51a2f68a72b60f709177cf
train
function
def test_ogr_gpsbabel_2(): ds = ogr.Open('data/gpsbabel/nmea.txt') assert ds is not None assert ds.GetLayerCount() == 2
def test_ogr_gpsbabel_2():
ds = ogr.Open('data/gpsbabel/nmea.txt') assert ds is not None assert ds.GetLayerCount() == 2
ogr_gpsbabel_1(): ds = ogr.Open('GPSBabel:nmea:data/gpsbabel/nmea.txt') assert ds is not None assert ds.GetLayerCount() == 2 ############################################################################### # Test reading with implicit subdriver def test_ogr_gpsbabel_2():
64
64
42
10
53
jpapadakis/gdal
autotest/ogr/ogr_gpsbabel.py
Python
test_ogr_gpsbabel_2
test_ogr_gpsbabel_2
68
73
68
69
015fad7159dd8de91dfe3c42db9ad617b78f3e53
bigcode/the-stack
train
8166e019d1db2d7c35fd14bc
train
function
def test_ogr_gpsbabel_3(): ds = ogr.GetDriverByName('GPSBabel').CreateDataSource('GPSBabel:nmea:tmp/nmea.txt') lyr = ds.CreateLayer('track_points', geom_type=ogr.wkbPoint) feat = ogr.Feature(lyr.GetLayerDefn()) feat.SetField('track_fid', 0) feat.SetField('track_seg_id', 0) feat.SetField('track...
def test_ogr_gpsbabel_3():
ds = ogr.GetDriverByName('GPSBabel').CreateDataSource('GPSBabel:nmea:tmp/nmea.txt') lyr = ds.CreateLayer('track_points', geom_type=ogr.wkbPoint) feat = ogr.Feature(lyr.GetLayerDefn()) feat.SetField('track_fid', 0) feat.SetField('track_seg_id', 0) feat.SetField('track_name', 'TRACK_NAME') fe...
:nmea:data/gpsbabel/nmea.txt') assert ds is not None assert ds.GetLayerCount() == 2 ############################################################################### # Test reading with implicit subdriver def test_ogr_gpsbabel_2(): ds = ogr.Open('data/gpsbabel/nmea.txt') assert ds is not None as...
96
96
323
10
85
jpapadakis/gdal
autotest/ogr/ogr_gpsbabel.py
Python
test_ogr_gpsbabel_3
test_ogr_gpsbabel_3
79
111
79
80
44c73147ac66c4f1347613af9ea6baa09f19be98
bigcode/the-stack
train
f073aa084f3b9a11de03cd98
train
class
class MatrixData: """MatrixData type Parameters ---------- dims : list or tuple Dimensions of the data in form of a tuple or list name : str Name of the object data : array like Object data """ def __init__(self, dims=(0), name=None, data=None): if...
class MatrixData:
"""MatrixData type Parameters ---------- dims : list or tuple Dimensions of the data in form of a tuple or list name : str Name of the object data : array like Object data """ def __init__(self, dims=(0), name=None, data=None): if name is None: ...
# -*- coding: utf-8 -*- """ Basic data type of Quantarhei """ import numpy import os class MatrixData:
29
256
886
4
24
slamavl/quantarhei
quantarhei/core/matrixdata.py
Python
MatrixData
MatrixData
10
201
10
10
7341d12d46bc7fd88680e96f3eda030fccd37d61
bigcode/the-stack
train
565fd8303e690ec5975259fd
train
function
@patch("byu_awslogin.util.data_cache._open_config_file") def test_load_last_netid(mock_open_config_file): mock_config_file = mock_open_config_file.return_value = MagicMock() mock_config_file.has_section.return_value = True mock_config_file.has_option.return_value = True d = {"default": {"adfs_netid": "f...
@patch("byu_awslogin.util.data_cache._open_config_file") def test_load_last_netid(mock_open_config_file):
mock_config_file = mock_open_config_file.return_value = MagicMock() mock_config_file.has_section.return_value = True mock_config_file.has_option.return_value = True d = {"default": {"adfs_netid": "fake_netid"}} mock_config_file.__getitem__.side_effect = d.__getitem__ profile = "default" ass...
default", "adfs_netid") assert written_config.has_option("default", "adfs_role") assert written_config.has_option("default", "adfs_expires") @patch("byu_awslogin.util.data_cache._open_config_file") def test_load_last_netid(mock_open_config_file):
64
64
170
27
37
Gi60s/awslogin
test/byu_awslogin/util/test_data_cache.py
Python
test_load_last_netid
test_load_last_netid
115
128
115
116
0c1815a35b810885c93bbd3573102120197950bc
bigcode/the-stack
train
60bfb845190fbb8a11288a67
train
function
@patch("byu_awslogin.util.data_cache._aws_file") @patch("byu_awslogin.util.data_cache.os.path.exists") def test_write_to_config_file(mock_exists, mock_aws_file): mock_exists.return_value = True config_file = "{}/config".format(tmp_aws_dir) mock_aws_file.return_value = config_file net_id = "fake_netid" ...
@patch("byu_awslogin.util.data_cache._aws_file") @patch("byu_awslogin.util.data_cache.os.path.exists") def test_write_to_config_file(mock_exists, mock_aws_file):
mock_exists.return_value = True config_file = "{}/config".format(tmp_aws_dir) mock_aws_file.return_value = config_file net_id = "fake_netid" region = "fakeRegion" role = "FakeRole" account = "FakeAccount" profile = "default" data_cache.write_to_config_file(profile, net_id, region, r...
id", "aws_secret_access_key": "secretkey", "aws_session_token": "sessiontoken", } @patch("byu_awslogin.util.data_cache._aws_file") @patch("byu_awslogin.util.data_cache.os.path.exists") def test_write_to_config_file(mock_exists, mock_aws_file):
69
69
232
44
25
Gi60s/awslogin
test/byu_awslogin/util/test_data_cache.py
Python
test_write_to_config_file
test_write_to_config_file
91
112
91
93
aafbf95de6861b39c402aa77111731475e3b5902
bigcode/the-stack
train
744ee6da85c083c77dd10af9
train
function
@patch("byu_awslogin.util.data_cache._aws_file") @patch("byu_awslogin.util.data_cache.os.path.exists") def test_write_to_cred_file(mock_exists, mock_aws_file): mock_exists.return_value = True creds_file = "{}/credentials".format(tmp_aws_dir) mock_aws_file.return_value = creds_file profile = "default" ...
@patch("byu_awslogin.util.data_cache._aws_file") @patch("byu_awslogin.util.data_cache.os.path.exists") def test_write_to_cred_file(mock_exists, mock_aws_file):
mock_exists.return_value = True creds_file = "{}/credentials".format(tmp_aws_dir) mock_aws_file.return_value = creds_file profile = "default" aws_session_token = { "Credentials": { "AccessKeyId": "keyid", "SecretAccessKey": "secretkey", "SessionToken": "s...
_count == 2 assert not written_config.has_option("all", "adfs_auth") @patch("byu_awslogin.util.data_cache._aws_file") @patch("byu_awslogin.util.data_cache.os.path.exists") def test_write_to_cred_file(mock_exists, mock_aws_file):
65
65
218
45
20
Gi60s/awslogin
test/byu_awslogin/util/test_data_cache.py
Python
test_write_to_cred_file
test_write_to_cred_file
64
88
64
66
62db625409cadbc385d539bca19b879915cb36cf
bigcode/the-stack
train