hexsha
string | size
int64 | ext
string | lang
string | max_stars_repo_path
string | max_stars_repo_name
string | max_stars_repo_head_hexsha
string | max_stars_repo_licenses
list | max_stars_count
int64 | max_stars_repo_stars_event_min_datetime
string | max_stars_repo_stars_event_max_datetime
string | max_issues_repo_path
string | max_issues_repo_name
string | max_issues_repo_head_hexsha
string | max_issues_repo_licenses
list | max_issues_count
int64 | max_issues_repo_issues_event_min_datetime
string | max_issues_repo_issues_event_max_datetime
string | max_forks_repo_path
string | max_forks_repo_name
string | max_forks_repo_head_hexsha
string | max_forks_repo_licenses
list | max_forks_count
int64 | max_forks_repo_forks_event_min_datetime
string | max_forks_repo_forks_event_max_datetime
string | content
string | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | qsc_code_num_words_quality_signal
int64 | qsc_code_num_chars_quality_signal
float64 | qsc_code_mean_word_length_quality_signal
float64 | qsc_code_frac_words_unique_quality_signal
float64 | qsc_code_frac_chars_top_2grams_quality_signal
float64 | qsc_code_frac_chars_top_3grams_quality_signal
float64 | qsc_code_frac_chars_top_4grams_quality_signal
float64 | qsc_code_frac_chars_dupe_5grams_quality_signal
float64 | qsc_code_frac_chars_dupe_6grams_quality_signal
float64 | qsc_code_frac_chars_dupe_7grams_quality_signal
float64 | qsc_code_frac_chars_dupe_8grams_quality_signal
float64 | qsc_code_frac_chars_dupe_9grams_quality_signal
float64 | qsc_code_frac_chars_dupe_10grams_quality_signal
float64 | qsc_code_frac_chars_replacement_symbols_quality_signal
float64 | qsc_code_frac_chars_digital_quality_signal
float64 | qsc_code_frac_chars_whitespace_quality_signal
float64 | qsc_code_size_file_byte_quality_signal
float64 | qsc_code_num_lines_quality_signal
float64 | qsc_code_num_chars_line_max_quality_signal
float64 | qsc_code_num_chars_line_mean_quality_signal
float64 | qsc_code_frac_chars_alphabet_quality_signal
float64 | qsc_code_frac_chars_comments_quality_signal
float64 | qsc_code_cate_xml_start_quality_signal
float64 | qsc_code_frac_lines_dupe_lines_quality_signal
float64 | qsc_code_cate_autogen_quality_signal
float64 | qsc_code_frac_lines_long_string_quality_signal
float64 | qsc_code_frac_chars_string_length_quality_signal
float64 | qsc_code_frac_chars_long_word_length_quality_signal
float64 | qsc_code_frac_lines_string_concat_quality_signal
float64 | qsc_code_cate_encoded_data_quality_signal
float64 | qsc_code_frac_chars_hex_words_quality_signal
float64 | qsc_code_frac_lines_prompt_comments_quality_signal
float64 | qsc_code_frac_lines_assert_quality_signal
float64 | qsc_codepython_cate_ast_quality_signal
float64 | qsc_codepython_frac_lines_func_ratio_quality_signal
float64 | qsc_codepython_cate_var_zero_quality_signal
bool | qsc_codepython_frac_lines_pass_quality_signal
float64 | qsc_codepython_frac_lines_import_quality_signal
float64 | qsc_codepython_frac_lines_simplefunc_quality_signal
float64 | qsc_codepython_score_lines_no_logic_quality_signal
float64 | qsc_codepython_frac_lines_print_quality_signal
float64 | qsc_code_num_words
int64 | qsc_code_num_chars
int64 | qsc_code_mean_word_length
int64 | qsc_code_frac_words_unique
null | qsc_code_frac_chars_top_2grams
int64 | qsc_code_frac_chars_top_3grams
int64 | qsc_code_frac_chars_top_4grams
int64 | qsc_code_frac_chars_dupe_5grams
int64 | qsc_code_frac_chars_dupe_6grams
int64 | qsc_code_frac_chars_dupe_7grams
int64 | qsc_code_frac_chars_dupe_8grams
int64 | qsc_code_frac_chars_dupe_9grams
int64 | qsc_code_frac_chars_dupe_10grams
int64 | qsc_code_frac_chars_replacement_symbols
int64 | qsc_code_frac_chars_digital
int64 | qsc_code_frac_chars_whitespace
int64 | qsc_code_size_file_byte
int64 | qsc_code_num_lines
int64 | qsc_code_num_chars_line_max
int64 | qsc_code_num_chars_line_mean
int64 | qsc_code_frac_chars_alphabet
int64 | qsc_code_frac_chars_comments
int64 | qsc_code_cate_xml_start
int64 | qsc_code_frac_lines_dupe_lines
int64 | qsc_code_cate_autogen
int64 | qsc_code_frac_lines_long_string
int64 | qsc_code_frac_chars_string_length
int64 | qsc_code_frac_chars_long_word_length
int64 | qsc_code_frac_lines_string_concat
null | qsc_code_cate_encoded_data
int64 | qsc_code_frac_chars_hex_words
int64 | qsc_code_frac_lines_prompt_comments
int64 | qsc_code_frac_lines_assert
int64 | qsc_codepython_cate_ast
int64 | qsc_codepython_frac_lines_func_ratio
int64 | qsc_codepython_cate_var_zero
int64 | qsc_codepython_frac_lines_pass
int64 | qsc_codepython_frac_lines_import
int64 | qsc_codepython_frac_lines_simplefunc
int64 | qsc_codepython_score_lines_no_logic
int64 | qsc_codepython_frac_lines_print
int64 | effective
string | hits
int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
81328ef0347d3a6ae301699943a67ef4f0701935
| 2,345
|
py
|
Python
|
release/stubs.min/System/__init___parts/CharEnumerator.py
|
tranconbv/ironpython-stubs
|
a601759e6c6819beff8e6b639d18a24b7e351851
|
[
"MIT"
] | null | null | null |
release/stubs.min/System/__init___parts/CharEnumerator.py
|
tranconbv/ironpython-stubs
|
a601759e6c6819beff8e6b639d18a24b7e351851
|
[
"MIT"
] | null | null | null |
release/stubs.min/System/__init___parts/CharEnumerator.py
|
tranconbv/ironpython-stubs
|
a601759e6c6819beff8e6b639d18a24b7e351851
|
[
"MIT"
] | null | null | null |
class CharEnumerator(object):
""" Supports iterating over a System.String object and reading its individual characters. This class cannot be inherited. """
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return CharEnumerator()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
def Clone(self):
"""
Clone(self: CharEnumerator) -> object
Creates a copy of the current System.CharEnumerator object.
Returns: An System.Object that is a copy of the current System.CharEnumerator object.
"""
pass
def Dispose(self):
"""
Dispose(self: CharEnumerator)
Releases all resources used by the current instance of the System.CharEnumerator class.
"""
pass
def MoveNext(self):
"""
MoveNext(self: CharEnumerator) -> bool
Increments the internal index of the current System.CharEnumerator object to the next character of the enumerated string.
Returns: true if the index is successfully incremented and within the enumerated string; otherwise,false.
"""
pass
def next(self,*args):
""" next(self: object) -> object """
pass
def Reset(self):
"""
Reset(self: CharEnumerator)
Initializes the index to a position logically before the first character of the enumerated string.
"""
pass
def __contains__(self,*args):
""" __contains__[Char](enumerator: IEnumerator[Char],value: Char) -> bool """
pass
def __enter__(self,*args):
""" __enter__(self: IDisposable) -> object """
pass
def __exit__(self,*args):
""" __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __iter__(self,*args):
""" __iter__(self: IEnumerator) -> object """
pass
def __reduce_ex__(self,*args):
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
Current=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the currently referenced character in the string enumerated by this System.CharEnumerator object.
Get: Current(self: CharEnumerator) -> Char
"""
| 35
| 215
| 0.692964
| 290
| 2,345
| 5.3
| 0.334483
| 0.050098
| 0.04229
| 0.035133
| 0.193234
| 0.154196
| 0.129473
| 0.129473
| 0.07352
| 0.07352
| 0
| 0
| 0.189765
| 2,345
| 66
| 216
| 35.530303
| 0.808947
| 0.581663
| 0
| 0.413793
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.448276
| false
| 0.413793
| 0
| 0
| 0.586207
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 3
|
8133672c14b4b385a9d7555f731ee05a987d9f73
| 143
|
py
|
Python
|
src/home_automation_hub/config.py
|
levidavis/py-home
|
3cc30e19d506824de9816ad9dbcfba4338a7dfa8
|
[
"MIT"
] | null | null | null |
src/home_automation_hub/config.py
|
levidavis/py-home
|
3cc30e19d506824de9816ad9dbcfba4338a7dfa8
|
[
"MIT"
] | null | null | null |
src/home_automation_hub/config.py
|
levidavis/py-home
|
3cc30e19d506824de9816ad9dbcfba4338a7dfa8
|
[
"MIT"
] | null | null | null |
from .config_store import ConfigStore
config = ConfigStore()
config.set_mqtt_broker("mqtt", 1883)
config.set_redis_config("redis", 6379, 0)
| 17.875
| 41
| 0.776224
| 20
| 143
| 5.3
| 0.6
| 0.320755
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.070313
| 0.104895
| 143
| 7
| 42
| 20.428571
| 0.757813
| 0
| 0
| 0
| 0
| 0
| 0.062937
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
813ffa71bdba0211d608c2b11546d97e7ed15b73
| 9,307
|
py
|
Python
|
hw1.py
|
ptsurko/coursera_crypt
|
ec952800c441a9b07ac427045851285fee8c6543
|
[
"MIT"
] | null | null | null |
hw1.py
|
ptsurko/coursera_crypt
|
ec952800c441a9b07ac427045851285fee8c6543
|
[
"MIT"
] | null | null | null |
hw1.py
|
ptsurko/coursera_crypt
|
ec952800c441a9b07ac427045851285fee8c6543
|
[
"MIT"
] | null | null | null |
import string
from timeit import itertools
s1 = '315c4eeaa8b5f8aaf9174145bf43e1784b8fa00dc71d885a804e5ee9fa40b16349c146fb778cdf2d3aff021dfff5b403b510d0d0455468aeb98622b137dae857553ccd8883a7bc37520e06e515d22c954eba5025b8cc57ee59418ce7dc6bc41556bdb36bbca3e8774301fbcaa3b83b220809560987815f65286764703de0f3d524400a19b159610b11ef3e'
s2 = '234c02ecbbfbafa3ed18510abd11fa724fcda2018a1a8342cf064bbde548b12b07df44ba7191d9606ef4081ffde5ad46a5069d9f7f543bedb9c861bf29c7e205132eda9382b0bc2c5c4b45f919cf3a9f1cb74151f6d551f4480c82b2cb24cc5b028aa76eb7b4ab24171ab3cdadb8356f'
s3 = '32510ba9a7b2bba9b8005d43a304b5714cc0bb0c8a34884dd91304b8ad40b62b07df44ba6e9d8a2368e51d04e0e7b207b70b9b8261112bacb6c866a232dfe257527dc29398f5f3251a0d47e503c66e935de81230b59b7afb5f41afa8d661cb'
s4 = '32510ba9aab2a8a4fd06414fb517b5605cc0aa0dc91a8908c2064ba8ad5ea06a029056f47a8ad3306ef5021eafe1ac01a81197847a5c68a1b78769a37bc8f4575432c198ccb4ef63590256e305cd3a9544ee4160ead45aef520489e7da7d835402bca670bda8eb775200b8dabbba246b130f040d8ec6447e2c767f3d30ed81ea2e4c1404e1315a1010e7229be6636aaa'
s5 = '3f561ba9adb4b6ebec54424ba317b564418fac0dd35f8c08d31a1fe9e24fe56808c213f17c81d9607cee021dafe1e001b21ade877a5e68bea88d61b93ac5ee0d562e8e9582f5ef375f0a4ae20ed86e935de81230b59b73fb4302cd95d770c65b40aaa065f2a5e33a5a0bb5dcaba43722130f042f8ec85b7c2070'
s6 = '32510bfbacfbb9befd54415da243e1695ecabd58c519cd4bd2061bbde24eb76a19d84aba34d8de287be84d07e7e9a30ee714979c7e1123a8bd9822a33ecaf512472e8e8f8db3f9635c1949e640c621854eba0d79eccf52ff111284b4cc61d11902aebc66f2b2e436434eacc0aba938220b084800c2ca4e693522643573b2c4ce35050b0cf774201f0fe52ac9f26d71b6cf61a711cc229f77ace7aa88a2f19983122b11be87a59c355d25f8e4'
s7 = '32510bfbacfbb9befd54415da243e1695ecabd58c519cd4bd90f1fa6ea5ba47b01c909ba7696cf606ef40c04afe1ac0aa8148dd066592ded9f8774b529c7ea125d298e8883f5e9305f4b44f915cb2bd05af51373fd9b4af511039fa2d96f83414aaaf261bda2e97b170fb5cce2a53e675c154c0d9681596934777e2275b381ce2e40582afe67650b13e72287ff2270abcf73bb028932836fbdecfecee0a3b894473c1bbeb6b4913a536ce4f9b13f1efff71ea313c8661dd9a4ce'
s8 = '315c4eeaa8b5f8bffd11155ea506b56041c6a00c8a08854dd21a4bbde54ce56801d943ba708b8a3574f40c00fff9e00fa1439fd0654327a3bfc860b92f89ee04132ecb9298f5fd2d5e4b45e40ecc3b9d59e9417df7c95bba410e9aa2ca24c5474da2f276baa3ac325918b2daada43d6712150441c2e04f6565517f317da9d3'
s9 = '271946f9bbb2aeadec111841a81abc300ecaa01bd8069d5cc91005e9fe4aad6e04d513e96d99de2569bc5e50eeeca709b50a8a987f4264edb6896fb537d0a716132ddc938fb0f836480e06ed0fcd6e9759f40462f9cf57f4564186a2c1778f1543efa270bda5e933421cbe88a4a52222190f471e9bd15f652b653b7071aec59a2705081ffe72651d08f822c9ed6d76e48b63ab15d0208573a7eef027'
s10 = '466d06ece998b7a2fb1d464fed2ced7641ddaa3cc31c9941cf110abbf409ed39598005b3399ccfafb61d0315fca0a314be138a9f32503bedac8067f03adbf3575c3b8edc9ba7f537530541ab0f9f3cd04ff50d66f1d559ba520e89a2cb2a83'
s11 = '32510ba9babebbbefd001547a810e67149caee11d945cd7fc81a05e9f85aac650e9052ba6a8cd8257bf14d13e6f0a803b54fde9e77472dbff89d71b57bddef121336cb85ccb8f3315f4b52e301d16e9f52f904'
def strxor(a, b): # xor two strings of different lengths
# a = a.decode('hex')
# b = b.decode('hex')
if len(a) > len(b):
return ("".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])) #.encode('hex')
else:
return ("".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])) #.encode('hex')
def random(size=16):
return open("/dev/urandom").read(size)
def encrypt(key, msg):
c = strxor(key, msg)
print
print c #.encode('hex')
return c
MSGS = (s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11)
MSGS_DECODED = [s.decode('hex') for s in MSGS]
def combinations(iterable, r):
indices = range(r)
n = len(iterable)
while True:
yield tuple(i for i in indices) + (tuple(iterable[i] for i in indices),)
for i in reversed(range(r)):
if indices[i] < n - (r - i):
indices[i] = indices[i] + 1
for j in range(i + 1, r):
indices[j] = indices[j - 1] + 1
break
else:
return
# def main():
# for c in combinations('ABCD', 2):
# print c
def output_combinations_table():
comb = [(i1, i2, strxor(s1.decode('hex'), s2.decode('hex'))) for i1, i2, (s1,s2) in combinations(MSGS, 2)]
html = '<html><body>'
html += '<table style="white-space:nowrap" border="1">'
html += '<thead>'
html += '<tr>'
# WTF???
# max_len = max(combinations, key=lambda x: len(x))
max_len = 0
for i1, i2, c in comb:
if len(c) > max_len:
max_len = len(c)
# print max_len
html += '<th></th>'
for i in xrange(max_len):
html += '<th>' + str(i) + '</th>'
html += '</tr>'
html += '</thead>'
for i1, i2, c in comb:
html += '<tr>'
html += '<td>(%s, %s)</td>' % (i1 + 1, i2 + 1)
for ch in c:
html += '<td>'
html += '%02d' % ord(ch)
if ch in string.printable:
html += '<br />'
html += '&#%d;' % ord(ch)
html += '</td>'
html += '</tr>'
html += '<tr>'
html += '<th></th>'
for i in xrange(max_len):
html += '<th>' + str(i) + '</th>'
html += '</tr>'
html += '</table>'
html += '</body>'
html += '</html>'
with open('combinations.html', 'w') as f:
f.write(html)
def key_by_space(ct_index, ch_index):
return key_by_guess(ct_index, ch_index)
def key_by_guess(ct_index, ch_index, guess=' '):
return strxor(MSGS_DECODED[ct_index][ch_index], guess)
def main():
output_combinations_table()
key = [
lambda : key_by_space(9, 0),
lambda : key_by_space(8, 1),
lambda : key_by_space(0, 2),
lambda : key_by_space(4, 3),
lambda : key_by_space(9, 4),
lambda : key_by_space(6, 5),
lambda : key_by_space(7, 6),
lambda : key_by_guess(4, 7, '\''), #???
lambda : key_by_space(2, 8),
lambda : key_by_space(6, 9),
lambda : key_by_space(10, 10),
lambda : key_by_space(1, 11),
lambda : key_by_space(9, 12),
lambda : key_by_space(6, 13),
lambda : key_by_space(4, 14),
lambda : key_by_space(8, 15),
lambda : key_by_space(8, 16),
lambda : key_by_space(4, 17),
lambda : key_by_space(10, 18),
lambda : key_by_space(6, 19),
lambda : key_by_space(7, 20),
lambda : key_by_space(4, 21),
lambda : key_by_space(6, 22),
lambda : key_by_space(4, 23),
lambda : key_by_space(0, 24),
lambda : key_by_guess(1, 25, 'y'),
lambda : key_by_space(7, 26),
lambda : key_by_space(10, 27),
lambda : key_by_space(3, 28),
lambda : key_by_space(9, 29),
lambda : key_by_space(7, 30),
lambda : key_by_space(1, 31),
lambda : key_by_space(0, 32),
lambda : key_by_space(10, 33),
lambda : key_by_space(8, 34),
lambda : key_by_space(10, 35),
lambda : key_by_space(9, 36),
lambda : key_by_space(5, 37),
lambda : key_by_space(7, 38),
lambda : key_by_space(1, 39),
lambda : key_by_space(0, 40),
lambda : key_by_space(8, 41),
lambda : key_by_space(5, 42),
lambda : key_by_guess(3, 43, 'n'),
lambda : key_by_space(4, 44),
lambda : key_by_guess(7, 45, 'y'),
lambda : key_by_space(7, 46),
lambda : key_by_guess(10, 47, 'e'),
lambda : key_by_guess(10, 48, 'r'),
lambda : key_by_space(7, 49),
lambda : key_by_guess(3, 50, 'i'),
lambda : key_by_guess(3, 51, 't'),
lambda : key_by_guess(3, 52, 'h'),
lambda : key_by_guess(3, 53, 'm'),
lambda : key_by_space(4, 54),
lambda : key_by_space(1, 55),
lambda : key_by_space(10, 56),
lambda : key_by_space(1, 57),
lambda : key_by_space(0, 58),
lambda : key_by_space(9, 59),
lambda : key_by_space(3, 60),
lambda : key_by_space(7, 61),
lambda : key_by_guess(0, 62, 'o'),
lambda : key_by_space(0, 63),
lambda : key_by_space(10, 64),
lambda : key_by_guess(6, 65, 't'),
lambda : key_by_space(5, 66),
lambda : key_by_guess(10, 67, 'y'),
lambda : key_by_space(10, 68),
lambda : key_by_space(7, 69),
lambda : key_by_space(1, 70),
lambda : key_by_space(3, 71),
lambda : key_by_space(2, 72),
lambda : key_by_space(1, 73),
lambda : key_by_space(0, 74),
lambda : key_by_guess(10, 75, 'h'),
lambda : key_by_guess(10, 76, 'a'),
lambda : key_by_guess(10, 77, 'n'),
lambda : key_by_space(10, 78),
lambda : key_by_guess(3, 79, 'e'),
lambda : key_by_guess(3, 80, 'x'),
lambda : key_by_guess(3, 81, 't'),
lambda : key_by_guess(10, 82, 'e'),
lambda : key_by_guess(6, 83, 'c'),
lambda : key_by_guess(6, 84, 'e'),
# lambda : key_by_guess(6, 68, 't'),
]
for i, s in enumerate(MSGS):
print '%2d: %s' % (i + 1, ''.join([strxor(k(), ch) for k, ch in itertools.izip(key, s.decode('hex'))]))
if __name__ == "__main__":
main()
| 44.745192
| 379
| 0.659933
| 973
| 9,307
| 6.099692
| 0.217883
| 0.074979
| 0.159393
| 0.16984
| 0.28829
| 0.051896
| 0.035046
| 0.026959
| 0.026959
| 0.026959
| 0
| 0.282873
| 0.222091
| 9,307
| 208
| 380
| 44.745192
| 0.536878
| 0.03449
| 0
| 0.092486
| 0
| 0.00578
| 0.350446
| 0.322321
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.011561
| null | null | 0.023121
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
d48c84bf13aa3330a9778d95947b20e6d95dfadf
| 194
|
py
|
Python
|
polls/tests.py
|
bunya017/Django-Polls-App
|
7b71ac9d1ffb66518e1d0345bc0f11ee5907c1be
|
[
"MIT"
] | null | null | null |
polls/tests.py
|
bunya017/Django-Polls-App
|
7b71ac9d1ffb66518e1d0345bc0f11ee5907c1be
|
[
"MIT"
] | 4
|
2020-06-05T18:14:33.000Z
|
2022-01-13T00:45:05.000Z
|
polls/tests.py
|
bunya017/Django-Polls-App
|
7b71ac9d1ffb66518e1d0345bc0f11ee5907c1be
|
[
"MIT"
] | 1
|
2018-05-23T11:36:36.000Z
|
2018-05-23T11:36:36.000Z
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
class RandomTestCase(TestCase):
def test_one_plus_one1(self):
self.assertEqual(1+1, 2)
| 14.923077
| 39
| 0.742268
| 27
| 194
| 5.037037
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030303
| 0.149485
| 194
| 12
| 40
| 16.166667
| 0.793939
| 0.108247
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.2
| 1
| 0.2
| false
| 0
| 0.4
| 0
| 0.8
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
d4a7c3329ad1568f426144783b7f79e1a58585b3
| 855
|
py
|
Python
|
clients/client/python/ory_client/__init__.py
|
ory/sdk-generator
|
958314d130922ad6f20f439b5230141a832231a5
|
[
"Apache-2.0"
] | null | null | null |
clients/client/python/ory_client/__init__.py
|
ory/sdk-generator
|
958314d130922ad6f20f439b5230141a832231a5
|
[
"Apache-2.0"
] | null | null | null |
clients/client/python/ory_client/__init__.py
|
ory/sdk-generator
|
958314d130922ad6f20f439b5230141a832231a5
|
[
"Apache-2.0"
] | null | null | null |
# flake8: noqa
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.187
Contact: [email protected]
Generated by: https://openapi-generator.tech
"""
__version__ = "v0.0.1-alpha.187"
# import ApiClient
from ory_client.api_client import ApiClient
# import Configuration
from ory_client.configuration import Configuration
# import exceptions
from ory_client.exceptions import OpenApiException
from ory_client.exceptions import ApiAttributeError
from ory_client.exceptions import ApiTypeError
from ory_client.exceptions import ApiValueError
from ory_client.exceptions import ApiKeyError
from ory_client.exceptions import ApiException
| 29.482759
| 194
| 0.803509
| 115
| 855
| 5.86087
| 0.495652
| 0.083086
| 0.154303
| 0.204748
| 0.293769
| 0
| 0
| 0
| 0
| 0
| 0
| 0.021858
| 0.14386
| 855
| 28
| 195
| 30.535714
| 0.898907
| 0.460819
| 0
| 0
| 0
| 0
| 0.037209
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.888889
| 0
| 0.888889
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
d4c40e31402ea3868fe157e89d210c3347a2c155
| 287
|
py
|
Python
|
design_patterns/pubsub/simple_events/__init__.py
|
JASTYN/pythonmaster
|
46638ab09d28b65ce5431cd0759fe6df272fb85d
|
[
"Apache-2.0",
"MIT"
] | 3
|
2017-05-02T10:28:13.000Z
|
2019-02-06T09:10:11.000Z
|
design_patterns/pubsub/simple_events/__init__.py
|
JASTYN/pythonmaster
|
46638ab09d28b65ce5431cd0759fe6df272fb85d
|
[
"Apache-2.0",
"MIT"
] | 2
|
2017-06-21T20:39:14.000Z
|
2020-02-25T10:28:57.000Z
|
design_patterns/pubsub/simple_events/__init__.py
|
JASTYN/pythonmaster
|
46638ab09d28b65ce5431cd0759fe6df272fb85d
|
[
"Apache-2.0",
"MIT"
] | 2
|
2016-07-29T04:35:22.000Z
|
2017-01-18T17:05:36.000Z
|
class Event:
def __init__(self):
self.handlers = set()
def subscribe(self, func):
self.handlers.add(func)
def unsubscribe(self, func):
self.handlers.remove(func)
def emit(self, *args):
for func in self.handlers:
func(*args)
| 20.5
| 34
| 0.581882
| 35
| 287
| 4.657143
| 0.457143
| 0.294479
| 0.147239
| 0.245399
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.299652
| 287
| 13
| 35
| 22.076923
| 0.810945
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
d4ca74c07139ca34712a0c4f0276402a1f20a541
| 23,370
|
py
|
Python
|
plaidml2/edsl/__init__.py
|
ZhouXiaolin/plaidml
|
dac460b6ae19a62299d15eeb17b402d8c26d0c2b
|
[
"Apache-2.0"
] | 4,535
|
2017-10-20T05:03:57.000Z
|
2022-03-30T15:42:33.000Z
|
plaidml2/edsl/__init__.py
|
ZhouXiaolin/plaidml
|
dac460b6ae19a62299d15eeb17b402d8c26d0c2b
|
[
"Apache-2.0"
] | 984
|
2017-10-20T17:16:09.000Z
|
2022-03-30T05:43:18.000Z
|
plaidml2/edsl/__init__.py
|
ZhouXiaolin/plaidml
|
dac460b6ae19a62299d15eeb17b402d8c26d0c2b
|
[
"Apache-2.0"
] | 492
|
2017-10-20T18:22:32.000Z
|
2022-03-30T09:00:05.000Z
|
# Copyright 2019 Intel Corporation.
import logging
from collections import namedtuple
import numpy as np
import six
from plaidml2 import DType
from plaidml2.core import TensorShape, Buffer
from plaidml2.ffi import ForeignObject, ffi, ffi_call, lib
logger = logging.getLogger(__name__)
def __init():
"""Docstring for function plaidml2.edsl.__init"""
ffi_call(lib.plaidml_edsl_init)
ffi.init_once(__init, 'plaidml_edsl_init')
class LogicalShape(ForeignObject):
"""Docstring for class LogicalShape"""
__ffi_del__ = lib.plaidml_logical_shape_free
__ffi_repr__ = lib.plaidml_logical_shape_repr
def __init__(self, dtype=None, dims=[], ptr=None):
if ptr:
ffi_obj = ptr
elif dtype is not None:
raw_dims = ffi.new('int64_t[]', [0 if x is None else x for x in dims])
ffi_obj = ffi_call(lib.plaidml_logical_shape_alloc, dtype, len(dims), raw_dims)
else:
raise ValueError('One of dtype= or ptr= must be specified.')
super(LogicalShape, self).__init__(ffi_obj)
@property
def dtype(self):
return DType(ffi_call(lib.plaidml_logical_shape_get_dtype, self.as_ptr()))
@property
def ndims(self):
return ffi_call(lib.plaidml_logical_shape_get_ndims, self.as_ptr())
@property
def int_dims(self):
"""Returns the dimensions of a LogicalShape as a list.
Args:
self (pointer): The object pointer for a LogicalShape
Returns:
list (int): Integer dimensions of the LogicalShape.
"""
return [
ffi_call(lib.plaidml_logical_shape_get_dim_int, self.as_ptr(), i)
for i in range(self.ndims)
]
def into_TensorShape(self):
return TensorShape(
ptr=ffi_call(lib.plaidml_logical_shape_into_tensor_shape, self.as_ptr()))
Constraint = namedtuple('Constraint', ['lhs', 'rhs'])
def wrap_dim(x):
if isinstance(x, six.integer_types):
return TensorDim(expr=ffi_call(lib.plaidml_dim_expr_int, x))
return x
def dim_op(op, *args):
args = [wrap_dim(x) for x in args]
raw_args = [x.as_ptr() for x in args]
return ffi_call(lib.plaidml_dim_expr_op, op, len(args), raw_args)
class TensorDim(ForeignObject):
"""Docstring for class TensorDim"""
__ffi_del__ = lib.plaidml_dim_expr_free
__ffi_repr__ = lib.plaidml_dim_expr_repr
def __init__(self, expr=None):
if expr is None:
expr = ffi_call(lib.plaidml_dim_expr_none)
super(TensorDim, self).__init__(expr)
def _bind(self, expr):
self.take_ptr(expr)
def __neg__(self):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_NEG, self))
def __add__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_ADD, self, other))
def __radd__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_ADD, other, self))
def __sub__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_SUB, self, other))
def __rsub__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_SUB, other, self))
def __mul__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_MUL, self, other))
def __rmul__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_MUL, other, self))
def __floordiv__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_DIV, self, other))
def __rfloordiv__(self, other):
return TensorDim(dim_op(lib.PLAIDML_INT_OP_DIV, other, self))
def wrap_poly(x):
if isinstance(x, six.integer_types):
return TensorIndex(expr=ffi_call(lib.plaidml_poly_expr_literal, x))
if isinstance(x, TensorDim):
return TensorIndex(expr=ffi_call(lib.plaidml_poly_expr_dim, x.as_ptr()))
return x
def poly_op(op, *args):
args = [wrap_poly(x) for x in args]
raw_args = [x.as_ptr() for x in args]
return ffi_call(lib.plaidml_poly_expr_op, op, len(args), raw_args)
class TensorIndex(ForeignObject):
"""Docstring for class TensorIndex"""
__ffi_del__ = lib.plaidml_poly_expr_free
__ffi_repr__ = lib.plaidml_poly_expr_repr
def __init__(self, expr=None, name=''):
if expr is None:
expr = ffi_call(lib.plaidml_poly_expr_index, name.encode())
super(TensorIndex, self).__init__(expr)
def __lt__(self, rhs):
return Constraint(self, wrap_dim(rhs))
def __neg__(self):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_NEG, self))
def __add__(self, rhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_ADD, self, rhs))
def __radd__(self, lhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_ADD, lhs, self))
def __sub__(self, rhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_SUB, self, rhs))
def __rsub__(self, lhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_SUB, lhs, self))
def __mul__(self, rhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_MUL, self, rhs))
def __rmul__(self, lhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_MUL, lhs, self))
def __floordiv__(self, rhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_DIV, self, rhs))
def __rfloordiv__(self, lhs):
return TensorIndex(poly_op(lib.PLAIDML_INT_OP_DIV, lhs, self))
class _IndexMap(ForeignObject):
__ffi_del__ = lib.plaidml_expr_free
__ffi_repr__ = lib.plaidml_expr_repr
def __init__(self, ref, key):
if isinstance(key, tuple) or isinstance(key, list):
idxs = key
else:
idxs = [key]
idxs = [wrap_poly(x) for x in idxs]
raw_idxs = [x.as_ptr() for x in idxs]
expr = ffi_call(lib.plaidml_expr_index_map, ref.as_ptr(), len(idxs), raw_idxs)
super(_IndexMap, self).__init__(expr)
class _SizeMap(ForeignObject):
__ffi_del__ = lib.plaidml_expr_free
__ffi_repr__ = lib.plaidml_expr_repr
def __init__(self, dims):
dims = [wrap_dim(x) for x in dims]
raw_dims = [x.as_ptr() for x in dims]
expr = ffi_call(lib.plaidml_expr_size_map, len(dims), raw_dims)
super(_SizeMap, self).__init__(expr)
class _Contraction(ForeignObject):
__ffi_del__ = lib.plaidml_expr_free
__ffi_repr__ = lib.plaidml_expr_repr
def __init__(self, agg_op, combo_op, src_idxs, sink_idxs, sink_sizes, name):
src_idxs = [x.as_ptr() for x in src_idxs]
expr = ffi_call(
lib.plaidml_expr_contraction,
agg_op,
combo_op,
sink_idxs.as_ptr(),
sink_sizes.as_ptr(),
len(src_idxs),
src_idxs,
name.encode(),
)
super(_Contraction, self).__init__(expr)
_ContractionPart = namedtuple('_ContractionPart', ['op', 'args'])
class IndexedTensor(object):
"""Docstring for class IndexedTensor"""
def __init__(self, impl, tensor=None):
self._impl = impl
self._tensor = tensor
def __repr__(self):
return repr(self._impl)
# Represents an aggregation_op of SUM in a contraction
def __iadd__(self, rhs):
return IndexedTensor(self._make_contraction(lib.PLAIDML_AGG_OP_SUM, rhs))
# Represents an aggregation_op of PROD in a contraction
def __imul__(self, rhs):
return IndexedTensor(self._make_contraction(lib.PLAIDML_AGG_OP_PROD, rhs))
# Represents an aggregation_op of MAX in a contraction
def __ge__(self, rhs):
self._tensor._set_contraction(self._make_contraction(lib.PLAIDML_AGG_OP_MAX, rhs))
# Represents an aggregation_op of MIN in a contraction
def __le__(self, rhs):
self._tensor._set_contraction(self._make_contraction(lib.PLAIDML_AGG_OP_MIN, rhs))
# Represents a combo_op of PLUS in a contraction
def __add__(self, rhs):
return IndexedTensor(_ContractionPart(lib.PLAIDML_COMBO_OP_ADD, (self, rhs)))
# Represents a combo_op of MULTIPLY in a contraction
def __mul__(self, rhs):
return IndexedTensor(_ContractionPart(lib.PLAIDML_COMBO_OP_MUL, (self, rhs)))
# Represents a combo_op of EQ in a contraction
def __eq__(self, rhs):
return IndexedTensor(_ContractionPart(lib.PLAIDML_COMBO_OP_EQ, (self, rhs)))
def _make_contraction(self, agg_op, rhs):
# Extract combo_op and inputs
if isinstance(rhs._impl, _IndexMap):
# Unary op
combo_op = lib.PLAIDML_COMBO_OP_NONE
inputs = [rhs._impl]
elif isinstance(rhs._impl, _ContractionPart):
# Binary/Ternary op
combo_op = rhs._impl.op
inputs = [x._impl for x in rhs._impl.args]
else:
raise ValueError('Invalid impl')
return _Contraction(
agg_op,
combo_op,
inputs,
self._impl,
_SizeMap(self._tensor._dims),
self._tensor._name,
)
class Tensor(ForeignObject):
"""Docstring for class Tensor"""
__ffi_del__ = lib.plaidml_expr_free
__ffi_repr__ = lib.plaidml_expr_repr
_dims = None
_is_contraction = False
def __init__(self, shape=None, dims=None, expr=None, value=None, name='', buffer=None):
self._name = name
self._buffer = buffer
if shape:
if buffer is None:
raw_buffer = ffi.NULL
else:
raw_buffer = buffer.as_ptr()
expr = ffi_call(lib.plaidml_expr_placeholder, shape.as_ptr(), raw_buffer,
name.encode())
elif dims is not None:
self._dims = dims
expr = None
elif value is not None:
if isinstance(value, six.integer_types):
expr = ffi_call(lib.plaidml_expr_int, value)
elif isinstance(value, float):
expr = ffi_call(lib.plaidml_expr_float, value)
else:
raise TypeError('Invalid type for value={}'.format(value))
elif expr is None:
raise ValueError('One of dims=, shape=, or expr= must be specified.')
super(Tensor, self).__init__(expr)
def set_param_value(self, buffer):
# Changes the value of a parameter tensor (i.e. one explicitly set to a buffer value)
# Illegal on other tensors
ffi_call(lib.plaidml_expr_param_reset, self.__ffi_obj__, buffer.as_ptr())
def __hash__(self):
return hash((self.as_ptr(), self._dims, self._is_contraction))
def __getitem__(self, key):
return IndexedTensor(_IndexMap(self, key), tensor=self)
def __setitem__(self, key, value):
if isinstance(value._impl, _Contraction):
# standard contraction
self._set_contraction(value._impl)
elif isinstance(value, Tensor):
pass
elif isinstance(value._impl, _IndexMap):
# Unary ASSIGN contraction
self._set_contraction(
_Contraction(
lib.PLAIDML_AGG_OP_ASSIGN,
lib.PLAIDML_COMBO_OP_NONE,
[value._impl],
_IndexMap(self, key),
_SizeMap(self._dims),
self._name,
))
elif isinstance(value._impl, _ContractionPart):
# Binary or ternary ASSIGN contraction
self._set_contraction(
_Contraction(
lib.PLAIDML_AGG_OP_ASSIGN,
value._impl.op,
[x._impl for x in value._impl.args],
_IndexMap(self, key),
_SizeMap(self._dims),
self._name,
))
else:
raise ValueError('Invalid impl when assigning to a Tensor (Type: {})'.format(
type(value._impl)))
def _set_contraction(self, cion):
self._is_contraction = True
self.take_ptr(cion)
# Represents an eltwise negation
def __neg__(self):
return call('neg', self)
# Represents an eltwise bit_not
def __invert__(self):
return call('bit_not', self)
# Represents an eltwise addition
def __add__(self, rhs):
return call('add', self, rhs)
def __radd__(self, lhs):
return call('add', lhs, self)
# Represents an eltwise subtraction
def __sub__(self, rhs):
return call('sub', self, rhs)
def __rsub__(self, lhs):
return call('sub', lhs, self)
# Represents an eltwise multiplication
def __mul__(self, rhs):
return call('mul', self, rhs)
def __rmul__(self, lhs):
return call('mul', lhs, self)
# Represents an eltwise division
def __div__(self, rhs):
return call('div', self, rhs)
def __rdiv__(self, lhs):
return call('div', lhs, self)
# Represents an eltwise division
def __truediv__(self, rhs):
return call('div', self, rhs)
def __rtruediv__(self, lhs):
return call('div', lhs, self)
# Represents an eltwise cmp_eq
def __eq__(self, rhs):
return call('cmp_eq', self, rhs)
# Represents an eltwise cmp_ne
def __ne__(self, rhs):
return call('cmp_ne', self, rhs)
# Represents an eltwise cmp_lt
def __lt__(self, rhs):
return call('cmp_lt', self, rhs)
# Represents an eltwise cmp_gt
def __gt__(self, rhs):
return call('cmp_gt', self, rhs)
# Represents an eltwise cmp_le
def __le__(self, rhs):
return call('cmp_le', self, rhs)
# Represents an eltwise cmp_ge
def __ge__(self, rhs):
return call('cmp_ge', self, rhs)
# Represents an eltwise bit_left
def __lshift__(self, rhs):
return call('bit_left', self, rhs)
def __rlshift__(self, lhs):
return call('bit_left', lhs, self)
# Represents an eltwise bit_right
def __rshift__(self, rhs):
return call('bit_right', self, rhs)
def __rrshift__(self, lhs):
return call('bit_right', lhs, self)
# Represents an eltwise bit_and
def __and__(self, rhs):
return call('bit_and', self, rhs)
def __rand__(self, lhs):
return call('bit_and', lhs, self)
# Represents an eltwise bit_or
def __or__(self, rhs):
return call('bit_or', self, rhs)
def __ror__(self, lhs):
return call('bit_or', lhs, self)
# Represents an eltwise bit_xor
def __xor__(self, rhs):
return call('bit_xor', self, rhs)
def __rxor__(self, lhs):
return call('bit_xor', lhs, self)
# Enable no_reduce on a contraction
def no_reduce(self):
if not self._is_contraction:
raise TypeError('no_reduce can only be specified on a contraction.')
ffi_call(lib.plaidml_expr_contraction_set_no_reduce, self.as_ptr(), True)
return self
# Set use_default on a contraction
def use_default(self, rhs):
if not self._is_contraction:
raise TypeError('use_default can only be specified on a contraction.')
ffi_call(lib.plaidml_expr_contraction_set_use_default, self.as_ptr(), rhs.as_ptr())
return self
def add_constraint(self, constraint):
ffi_call(
lib.plaidml_expr_contraction_add_constraint,
self.as_ptr(),
constraint.lhs.as_ptr(),
constraint.rhs.as_ptr(),
)
def add_constraints(self, constraints):
for constraint in constraints:
self.add_constraint(constraint)
# Return the tensor's shape
@property
def shape(self):
return LogicalShape(ptr=ffi_call(lib.plaidml_expr_get_shape, self.as_ptr()))
# Verify that the specified dims match the dims of this tensor.
def bind_dims(self, *dims):
raw_dims = [x.as_ptr() for x in dims]
ffi_call(lib.plaidml_expr_bind_dims, self.as_ptr(), len(raw_dims), raw_dims)
# bind a concrete shape to this tensor
def bind(self, shape):
ffi_call(lib.plaidml_expr_bind_shape, self.as_ptr(), shape.as_ptr())
class TensorRef:
"""Docstring for class TensorRef"""
def __init__(self, tensor):
self.tensor = tensor
def __hash__(self):
return hash(ffi_call(lib.plaidml_expr_ptr, self.tensor.as_ptr()))
def __eq__(self, other):
if isinstance(other, Tensor):
return self.__hash__() == TensorRef(other).__hash__()
return self.__hash__() == other.__hash__()
class Value(ForeignObject):
"""Docstring for class Value"""
__ffi_del__ = lib.plaidml_value_free
__ffi_repr__ = lib.plaidml_value_repr
def __init__(self, value):
# logger.debug('Value({})'.format(value))
if isinstance(value, np.ndarray):
if value.ndim == 0:
value = value.item()
else:
value = value.tolist()
if value is None:
ffi_obj = ffi_call(lib.plaidml_value_none)
elif isinstance(value, (six.integer_types, bool)):
ffi_obj = ffi_call(lib.plaidml_value_int, value)
elif isinstance(value, float):
ffi_obj = ffi_call(lib.plaidml_value_float, value)
elif isinstance(value, TensorDim):
ffi_obj = ffi_call(lib.plaidml_value_dim, value.as_ptr())
elif isinstance(value, Tensor):
ffi_obj = ffi_call(lib.plaidml_value_expr, value.as_ptr())
elif isinstance(value, (list, tuple)):
self._elts = [Value(x) for x in value]
raw_elts = [x.as_ptr() for x in self._elts]
ffi_obj = ffi_call(lib.plaidml_value_tuple, len(raw_elts), raw_elts)
elif isinstance(value, six.string_types):
ffi_obj = ffi_call(lib.plaidml_value_str, value.encode('utf-8'))
elif isinstance(value, ffi.CData) and ffi.typeof(value) is ffi.typeof('plaidml_value*'):
ffi_obj = value
else:
raise TypeError('Unsupported type {} for value={}'.format(type(value), value))
super(Value, self).__init__(ffi_obj)
def as_tensor(self):
return Tensor(expr=ffi_call(lib.plaidml_value_expr_get, self.as_ptr()))
def TensorOutput(*args):
return Tensor(dims=args)
def TensorDims(count):
return [TensorDim() for i in range(count)]
def TensorIndexes(count):
return [TensorIndex() for i in range(count)]
class ProgramArgument:
"""Docstring for class ProgramArgument"""
def __init__(self, arg):
self.is_input = arg.is_input
self.ref = TensorRef(Tensor(expr=ffi_call(lib.plaidml_expr_clone, arg.tensor)))
self.shape = LogicalShape(ptr=ffi_call(lib.plaidml_logical_shape_clone, arg.shape))
if arg.buffer:
tensor_shape = self.shape.into_TensorShape()
self.buffer = Buffer(tensor_shape, ptr=ffi_call(lib.plaidml_buffer_clone, arg.buffer))
else:
self.buffer = None
class Program(ForeignObject):
"""Docstring for class Program"""
__ffi_del__ = lib.plaidml_program_free
__ffi_repr__ = lib.plaidml_program_repr
def __init__(self, name, outputs, updates=[]):
raw_outputs = [x.as_ptr() for x in outputs]
dst_updates = [x[0].as_ptr() for x in updates]
src_updates = [x[1].as_ptr() for x in updates]
raw_args = ffi.new('plaidml_program_args**')
ffi_obj = ffi_call(
lib.plaidml_program_evaluate,
name.encode(),
len(raw_outputs),
raw_outputs,
len(updates),
src_updates,
dst_updates,
raw_args,
)
self.args = [ProgramArgument(raw_args[0].args[i]) for i in range(raw_args[0].nargs)]
ffi_call(lib.plaidml_program_args_free, raw_args[0])
super(Program, self).__init__(ffi_obj)
@property
def inputs(self):
return [x for x in self.args if x.is_input]
@property
def outputs(self):
return [x for x in self.args if not x.is_input]
def wrap_tensor(x):
if isinstance(x, six.integer_types):
return Tensor(expr=ffi_call(lib.plaidml_expr_int, x))
if np.issubdtype(type(x), np.integer):
return Tensor(expr=ffi_call(lib.plaidml_expr_int, x.item()))
if isinstance(x, float):
return Tensor(expr=ffi_call(lib.plaidml_expr_float, x))
if isinstance(x, TensorDim):
return Tensor(expr=ffi_call(lib.plaidml_expr_dim, x.as_ptr()))
if isinstance(x, Tensor):
return x
raise TypeError('Unexpected type for call argument: {}. fn: {}, args: {}, bad arg: {}'.format(
type(x), fn, args, x))
def call(fn, *args):
args = [wrap_tensor(x) for x in args]
raw_args = [x.as_ptr() for x in args]
return Tensor(expr=ffi_call(lib.plaidml_expr_call, fn.encode(), len(args), raw_args))
def cast(x, dtype):
return Tensor(expr=ffi_call(lib.plaidml_expr_cast, wrap_tensor(x).as_ptr(), dtype))
def as_bool(x):
return cast(x, DType.BOOLEAN)
def as_float(x, bit_size):
map = {
16: DType.FLOAT16,
32: DType.FLOAT32,
64: DType.FLOAT64,
}
dtype = map.get(bit_size)
if not dtype:
raise 'Unsupport bit_size for as_float'
return cast(x, dtype)
def as_int(x, bit_size):
map = {
8: DType.INT8,
16: DType.INT16,
32: DType.INT32,
64: DType.INT64,
}
dtype = map.get(bit_size)
if not dtype:
raise 'Unsupport bit_size for as_int'
return cast(x, dtype)
def as_uint(x, bit_size):
map = {
8: DType.UINT8,
16: DType.UINT16,
32: DType.UINT32,
64: DType.UINT64,
}
dtype = map.get(bit_size)
if not dtype:
raise 'Unsupport bit_size for as_uint'
return cast(x, dtype)
def ceil(x):
return call('ceil', x)
def cond(lhs, rhs, true_case):
return IndexedTensor(_ContractionPart(lib.PLAIDML_COMBO_OP_COND, (lhs, rhs, true_case)))
def cos(x):
return call('cos', x)
def exp(x):
return call('exp', x)
def floor(x):
return call('floor', x)
def gather(x, y):
return call('gather', x, y)
def gradients(loss, variables):
wrts = [x.as_ptr() for x in variables]
raw_grads = ffi.new('plaidml_expr*[]', len(wrts))
ffi_call(
lib.plaidml_expr_gradient,
len(wrts),
wrts,
loss.as_ptr(),
raw_grads,
)
return [Tensor(expr=x) for x in raw_grads]
def ident(x):
return call('ident', x)
def index(x, axis):
return call('index', x, axis)
def jacobian(loss, variables):
wrts = [x.as_ptr() for x in variables]
raw_grads = ffi.new('plaidml_expr*[]', len(wrts))
ffi_call(
lib.plaidml_expr_jacobian,
len(wrts),
wrts,
loss.as_ptr(),
raw_grads,
)
return [Tensor(expr=x) for x in raw_grads]
def log(x):
return call('log', x)
def max(x, y):
return call('max', x, y)
def min(x, y):
return call('min', x, y)
def pow(x, y):
return call('pow', x, y)
def prng(state, shape):
return call('prng', state, *shape)
def reshape(x, dims):
return call('reshape', x, *dims)
def round(x):
return call('round', x)
def scatter(x, y, z):
return call('scatter', x, y, z)
def select(cond, true_case, false_case):
return call('cond', cond, true_case, false_case)
def shape(x):
return call('shape', x)
def sin(x):
return call('sin', x)
def sqrt(x):
return call('sqrt', x)
def tan(x):
return call('tan', x)
def tanh(x):
return call('tanh', x)
| 29.2125
| 98
| 0.631365
| 3,163
| 23,370
| 4.319001
| 0.095795
| 0.070273
| 0.035869
| 0.059732
| 0.489056
| 0.398873
| 0.319523
| 0.257229
| 0.208037
| 0.178025
| 0
| 0.00336
| 0.261361
| 23,370
| 799
| 99
| 29.249061
| 0.788032
| 0.082285
| 0
| 0.234637
| 0
| 0
| 0.039418
| 0.001032
| 0
| 0
| 0
| 0
| 0
| 1
| 0.240223
| false
| 0.001862
| 0.013035
| 0.167598
| 0.52514
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
d4f79ba15482dc239d99373d27359b1da32e98ba
| 1,172
|
py
|
Python
|
kissim/cli/encode.py
|
AJK-dev/kissim
|
15375000d47b5d5485322fc725809f853a3659de
|
[
"MIT"
] | 15
|
2020-06-23T14:46:07.000Z
|
2022-02-03T04:23:56.000Z
|
kissim/cli/encode.py
|
volkamerlab/kissim
|
35198a5efd4b651dd3952bf26ac5098fd1c4dfaa
|
[
"MIT"
] | 66
|
2020-11-05T11:45:21.000Z
|
2021-12-15T12:11:20.000Z
|
kissim/cli/encode.py
|
AJK-dev/kissim
|
15375000d47b5d5485322fc725809f853a3659de
|
[
"MIT"
] | 3
|
2021-02-27T12:56:27.000Z
|
2022-02-03T04:23:57.000Z
|
"""
kissim.cli.encode
Encode structures (generate fingerprints) from CLI arguments.
"""
import numpy as np
from kissim.api import encode
from kissim.cli.utils import configure_logger
def encode_from_cli(args):
"""
Encode structures.
Parameters
----------
args : argsparse.Namespace
CLI arguments.
"""
configure_logger(args.output)
structure_klifs_ids = _parse_structure_klifs_ids(args.input)
encode(structure_klifs_ids, args.output, args.local, args.ncores)
def _parse_structure_klifs_ids(args_input):
"""
Parse structure KLIFS IDs.
Parameters
----------
args_input : list of str
Either path to txt file with structure KLIFS ID (one ID per row) or one or more structure
KLIFS IDs.
Returns
-------
list of int
List of structure KLIFS IDs.
"""
if len(args_input) == 1:
try:
structure_klifs_ids = [int(args_input[0])]
except ValueError:
structure_klifs_ids = np.genfromtxt(fname=args_input[0], dtype=int).tolist()
else:
structure_klifs_ids = [int(i) for i in args_input]
return structure_klifs_ids
| 22.113208
| 97
| 0.654437
| 150
| 1,172
| 4.913333
| 0.413333
| 0.227951
| 0.253731
| 0.089552
| 0.084125
| 0.084125
| 0
| 0
| 0
| 0
| 0
| 0.003398
| 0.246587
| 1,172
| 52
| 98
| 22.538462
| 0.831257
| 0.353242
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.125
| false
| 0
| 0.1875
| 0
| 0.375
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
be004417db97934b47985fcf6b9c727896247c48
| 220
|
py
|
Python
|
CodeChef/problems/IMDB/main.py
|
object-oriented-human/competitive
|
9e761020e887d8980a39a64eeaeaa39af0ecd777
|
[
"MIT"
] | 1
|
2022-02-21T15:43:01.000Z
|
2022-02-21T15:43:01.000Z
|
CodeChef/problems/IMDB/main.py
|
foooop/competitive
|
9e761020e887d8980a39a64eeaeaa39af0ecd777
|
[
"MIT"
] | null | null | null |
CodeChef/problems/IMDB/main.py
|
foooop/competitive
|
9e761020e887d8980a39a64eeaeaa39af0ecd777
|
[
"MIT"
] | null | null | null |
tc = int(input())
while tc:
tc -= 1
best = 0
n, x = map(int, input().split())
for i in range(n):
s, r = map(int, input().split())
if x >= s:
best = max(best, r)
print(best)
| 22
| 40
| 0.445455
| 35
| 220
| 2.8
| 0.571429
| 0.244898
| 0.22449
| 0.326531
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.014388
| 0.368182
| 220
| 10
| 41
| 22
| 0.690647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.1
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
be05ff012f40e6f5a4b594110683f58699e3309e
| 412
|
py
|
Python
|
top/api/rest/FenxiaoRefundMessageAddRequest.py
|
forestsheep/middleman
|
34d54f9ffd9d7bcd775a8dcce4f00dd6c5bb1acd
|
[
"MIT"
] | null | null | null |
top/api/rest/FenxiaoRefundMessageAddRequest.py
|
forestsheep/middleman
|
34d54f9ffd9d7bcd775a8dcce4f00dd6c5bb1acd
|
[
"MIT"
] | null | null | null |
top/api/rest/FenxiaoRefundMessageAddRequest.py
|
forestsheep/middleman
|
34d54f9ffd9d7bcd775a8dcce4f00dd6c5bb1acd
|
[
"MIT"
] | null | null | null |
'''
Created by auto_sdk on 2016.04.13
'''
from top.api.base import RestApi
class FenxiaoRefundMessageAddRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.image = None
self.message_content = None
self.sub_order_id = None
def getapiname(self):
return 'taobao.fenxiao.refund.message.add'
def getMultipartParas(self):
return ['image']
| 24.235294
| 55
| 0.75
| 58
| 412
| 5.12069
| 0.655172
| 0.053872
| 0.094276
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.027701
| 0.123786
| 412
| 16
| 56
| 25.75
| 0.795014
| 0.080097
| 0
| 0
| 0
| 0
| 0.148248
| 0.088949
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.090909
| 0.181818
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
be193942a6e1e90e82121a1e52ce25e1006effc3
| 488
|
py
|
Python
|
wasatch/ROI.py
|
adiravishankara/Wasatch.PY
|
058b3de2c9399e9aea6347fa360f9c7dbbf296aa
|
[
"MIT"
] | 9
|
2018-10-31T11:38:18.000Z
|
2021-11-23T19:20:54.000Z
|
wasatch/ROI.py
|
adiravishankara/Wasatch.PY
|
058b3de2c9399e9aea6347fa360f9c7dbbf296aa
|
[
"MIT"
] | 3
|
2018-11-01T10:28:53.000Z
|
2022-03-21T17:40:05.000Z
|
wasatch/ROI.py
|
adiravishankara/Wasatch.PY
|
058b3de2c9399e9aea6347fa360f9c7dbbf296aa
|
[
"MIT"
] | 4
|
2018-08-03T08:46:08.000Z
|
2022-03-23T01:09:27.000Z
|
##
# This class encapsulates a Region Of Interest, which may be either horizontal
# (pixels) or vertical (rows/lines).
class ROI:
def __init__(self, start, end):
self.start = start
self.end = end
self.len = end - start + 1
def valid(self):
return self.start >= 0 and self.start < self.end
def crop(self, spectrum):
return spectrum[self.start:self.end+1]
def contains(self, value):
return self.start <= value <= self.end
| 27.111111
| 79
| 0.622951
| 68
| 488
| 4.411765
| 0.485294
| 0.18
| 0.12
| 0.106667
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.00838
| 0.266393
| 488
| 17
| 80
| 28.705882
| 0.829609
| 0.229508
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.363636
| false
| 0
| 0
| 0.272727
| 0.727273
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
be2be4ab8f891e1d119f0c6cbe7bc4c566727644
| 547
|
py
|
Python
|
py/tests/test_valid_parentheses.py
|
Dragonway/LeetCode
|
53ed9e9bcc1ed6955b013e0d37d2a684c2ec7135
|
[
"MIT"
] | null | null | null |
py/tests/test_valid_parentheses.py
|
Dragonway/LeetCode
|
53ed9e9bcc1ed6955b013e0d37d2a684c2ec7135
|
[
"MIT"
] | null | null | null |
py/tests/test_valid_parentheses.py
|
Dragonway/LeetCode
|
53ed9e9bcc1ed6955b013e0d37d2a684c2ec7135
|
[
"MIT"
] | null | null | null |
import unittest
from py.tests.utils import test
from py import valid_parentheses as vp
class TestValidParentheses(unittest.TestCase):
@test(vp.Solution.is_valid)
def test_valid_parentheses(self) -> None:
test("()", result=True)
test("()[]{}", result=True)
test("(]", result=False)
test("([)]", result=False)
test("{[]}", result=True)
test("", result=True)
test(")()", result=False)
test("(())((())))", result=False)
| 30.388889
| 46
| 0.521024
| 54
| 547
| 5.203704
| 0.407407
| 0.284698
| 0.199288
| 0.256228
| 0.412811
| 0.412811
| 0.412811
| 0.412811
| 0.412811
| 0.412811
| 0
| 0
| 0.303473
| 547
| 17
| 47
| 32.176471
| 0.737533
| 0
| 0
| 0
| 0
| 0
| 0.058501
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.071429
| false
| 0
| 0.214286
| 0
| 0.357143
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
0780e5ec41de515a271f19ff0412527f1e12bd8f
| 287
|
py
|
Python
|
health_care/health_care/doctype/practitioner/practitioner.py
|
Jnalis/frappe-health-care
|
ed347c216f568cc044c1365965d35945697cf7dc
|
[
"MIT"
] | null | null | null |
health_care/health_care/doctype/practitioner/practitioner.py
|
Jnalis/frappe-health-care
|
ed347c216f568cc044c1365965d35945697cf7dc
|
[
"MIT"
] | null | null | null |
health_care/health_care/doctype/practitioner/practitioner.py
|
Jnalis/frappe-health-care
|
ed347c216f568cc044c1365965d35945697cf7dc
|
[
"MIT"
] | null | null | null |
# Copyright (c) 2022, Juve and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class Practitioner(Document):
def before_save(self):
self.practitioner_full_name = f'{self.first_name} {self.second_name or ""}'
| 28.7
| 77
| 0.777003
| 40
| 287
| 5.45
| 0.725
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.015936
| 0.125436
| 287
| 9
| 78
| 31.888889
| 0.85259
| 0.358885
| 0
| 0
| 0
| 0
| 0.233333
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
0785a9ecd33b25242a059e89ddfae1ca8b3c0298
| 518
|
py
|
Python
|
tests/workflow/test_workflow_ingest_accepted_submission.py
|
elifesciences/elife-bot
|
d3a102c8030e4b7ec83cbd45e5f839dba4f9ffd9
|
[
"MIT"
] | 17
|
2015-02-10T07:10:29.000Z
|
2021-05-14T22:24:45.000Z
|
tests/workflow/test_workflow_ingest_accepted_submission.py
|
elifesciences/elife-bot
|
d3a102c8030e4b7ec83cbd45e5f839dba4f9ffd9
|
[
"MIT"
] | 459
|
2015-03-31T18:24:23.000Z
|
2022-03-30T19:44:40.000Z
|
tests/workflow/test_workflow_ingest_accepted_submission.py
|
elifesciences/elife-bot
|
d3a102c8030e4b7ec83cbd45e5f839dba4f9ffd9
|
[
"MIT"
] | 9
|
2015-04-18T16:57:31.000Z
|
2020-10-30T11:49:13.000Z
|
import unittest
import tests.settings_mock as settings_mock
from tests.activity.classes_mock import FakeLogger
from workflow.workflow_IngestAcceptedSubmission import workflow_IngestAcceptedSubmission
class TestWorkflowIngestAcceptedSubmission(unittest.TestCase):
def setUp(self):
self.workflow = workflow_IngestAcceptedSubmission(
settings_mock, FakeLogger(), None, None, None, None
)
def test_init(self):
self.assertEqual(self.workflow.name, "IngestAcceptedSubmission")
| 34.533333
| 88
| 0.783784
| 51
| 518
| 7.803922
| 0.45098
| 0.090452
| 0.201005
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.15251
| 518
| 14
| 89
| 37
| 0.906606
| 0
| 0
| 0
| 0
| 0
| 0.046332
| 0.046332
| 0
| 0
| 0
| 0
| 0.090909
| 1
| 0.181818
| false
| 0
| 0.363636
| 0
| 0.636364
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
078c924330df0f8ffe4dba08335fcd4ca824b7c3
| 125
|
py
|
Python
|
electrondiffraction/__init__.py
|
drix00/ElectronDiffraction
|
9dc258d90d0b73745b904b1bb6e1e3e794403a27
|
[
"Apache-2.0"
] | 1
|
2020-07-23T12:24:09.000Z
|
2020-07-23T12:24:09.000Z
|
python/xraynomenclature/xraynomenclature/__init__.py
|
drix00/xray-nomenclature
|
92d3e15b9ebb505482a084522c6639ba09bbdd02
|
[
"Apache-2.0"
] | null | null | null |
python/xraynomenclature/xraynomenclature/__init__.py
|
drix00/xray-nomenclature
|
92d3e15b9ebb505482a084522c6639ba09bbdd02
|
[
"Apache-2.0"
] | null | null | null |
# -*- coding: utf-8 -*-
__author__ = """Hendrix Demers"""
__email__ = '[email protected]'
__version__ = '0.1.0'
| 20.833333
| 43
| 0.648
| 16
| 125
| 4.3125
| 0.8125
| 0.376812
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.036697
| 0.128
| 125
| 5
| 44
| 25
| 0.59633
| 0.168
| 0
| 0
| 0
| 0
| 0.470588
| 0.284314
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
07b69c4f080b6ae079038a0250ba13b6035a0cda
| 191
|
py
|
Python
|
scripts/transpose.py
|
saikrishnarallabandi/python_connectionist
|
e3f8f92c8de865190ad727951eb2b0e514248afc
|
[
"Apache-2.0"
] | null | null | null |
scripts/transpose.py
|
saikrishnarallabandi/python_connectionist
|
e3f8f92c8de865190ad727951eb2b0e514248afc
|
[
"Apache-2.0"
] | null | null | null |
scripts/transpose.py
|
saikrishnarallabandi/python_connectionist
|
e3f8f92c8de865190ad727951eb2b0e514248afc
|
[
"Apache-2.0"
] | null | null | null |
import numpy
g = open('/home/srallaba/mgc/transposed/arctic_a0404.mgc','w')
x = numpy.loadtxt('/home/srallaba/mgc_spaces/arctic_a0404.mgc')
numpy.savetxt(g, numpy.transpose(x))
g.close()
| 31.833333
| 64
| 0.73822
| 30
| 191
| 4.6
| 0.566667
| 0.173913
| 0.217391
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.045455
| 0.078534
| 191
| 5
| 65
| 38.2
| 0.738636
| 0
| 0
| 0
| 0
| 0
| 0.465969
| 0.460733
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.2
| 0
| 0.2
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
07bd6b46f25dcc6cd80de3063def3b5b81539dae
| 161
|
py
|
Python
|
text_classification/config.py
|
MardanovTimur/kaggle
|
62392863a07fcc5de9821c28cf9c6dbbf39ced59
|
[
"MIT"
] | null | null | null |
text_classification/config.py
|
MardanovTimur/kaggle
|
62392863a07fcc5de9821c28cf9c6dbbf39ced59
|
[
"MIT"
] | null | null | null |
text_classification/config.py
|
MardanovTimur/kaggle
|
62392863a07fcc5de9821c28cf9c6dbbf39ced59
|
[
"MIT"
] | null | null | null |
import logging
import pathlib
logging.basicConfig(level=logging.INFO)
# Dirs
ROOT_DIR = pathlib.Path(__file__).parent.absolute()
DUMP_DIR = ROOT_DIR / 'dumps'
| 17.888889
| 51
| 0.782609
| 22
| 161
| 5.409091
| 0.681818
| 0.117647
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.10559
| 161
| 8
| 52
| 20.125
| 0.826389
| 0.024845
| 0
| 0
| 0
| 0
| 0.032258
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
07de8a38f3e34f5218e591e882773caeb8f88eba
| 1,256
|
py
|
Python
|
ocdsmerge/exceptions.py
|
open-contracting/ocds-merge
|
80c7cb380d191c75f88feefd34b607bc0de13ee1
|
[
"BSD-3-Clause"
] | 4
|
2017-09-06T06:14:09.000Z
|
2019-07-05T13:11:40.000Z
|
ocdsmerge/exceptions.py
|
open-contracting/ocds-merge
|
80c7cb380d191c75f88feefd34b607bc0de13ee1
|
[
"BSD-3-Clause"
] | 20
|
2017-11-25T02:29:41.000Z
|
2020-01-08T18:45:49.000Z
|
ocdsmerge/exceptions.py
|
open-contracting/ocds-merge
|
80c7cb380d191c75f88feefd34b607bc0de13ee1
|
[
"BSD-3-Clause"
] | 1
|
2018-11-07T14:05:12.000Z
|
2018-11-07T14:05:12.000Z
|
class OCDSMergeError(Exception):
"""Base class for exceptions from within this package"""
class MissingDateKeyError(OCDSMergeError, KeyError):
"""Raised when a release is missing a 'date' key"""
def __init__(self, key, message):
self.key = key
self.message = message
def __str__(self):
return str(self.message)
class NonObjectReleaseError(OCDSMergeError, TypeError):
"""Raised when a release is not an object"""
class NullDateValueError(OCDSMergeError, TypeError):
"""Raised when a release has a null 'date' value"""
class NonStringDateValueError(OCDSMergeError, TypeError):
"""Raised when a release has a non-string 'date' value"""
class InconsistentTypeError(OCDSMergeError, TypeError):
"""Raised when a path is a literal and an object in different releases"""
class OCDSMergeWarning(UserWarning):
"""Base class for warnings from within this package"""
class DuplicateIdValueWarning(OCDSMergeWarning):
"""Used when at least two objects in the same array have the same value for the 'id' field"""
def __init__(self, path, id, message):
self.path = path
self.id = id
self.message = message
def __str__(self):
return str(self.message)
| 27.304348
| 97
| 0.700637
| 152
| 1,256
| 5.684211
| 0.394737
| 0.05787
| 0.063657
| 0.083333
| 0.387731
| 0.262731
| 0.215278
| 0.215278
| 0.111111
| 0.111111
| 0
| 0
| 0.204618
| 1,256
| 45
| 98
| 27.911111
| 0.864865
| 0.348726
| 0
| 0.315789
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.210526
| false
| 0
| 0
| 0.105263
| 0.736842
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
07e312b03c9acc9dee5930a523090053e38045ca
| 85,560
|
py
|
Python
|
Installation/nnAudio/Spectrogram.py
|
tasercake/nnAudio
|
5edc37b7b73674598d533261314429b875ba285d
|
[
"MIT"
] | null | null | null |
Installation/nnAudio/Spectrogram.py
|
tasercake/nnAudio
|
5edc37b7b73674598d533261314429b875ba285d
|
[
"MIT"
] | null | null | null |
Installation/nnAudio/Spectrogram.py
|
tasercake/nnAudio
|
5edc37b7b73674598d533261314429b875ba285d
|
[
"MIT"
] | null | null | null |
"""
Module containing all the spectrogram classes
"""
# 0.2.0
import torch
import torch.nn as nn
from torch.nn.functional import conv1d, conv2d, fold
import numpy as np
from time import time
from nnAudio.librosa_functions import *
from nnAudio.utils import *
sz_float = 4 # size of a float
epsilon = 10e-8 # fudge factor for normalization
### --------------------------- Spectrogram Classes ---------------------------###
class STFT(torch.nn.Module):
"""This function is to calculate the short-time Fourier transform (STFT) of the input signal.
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
The correct shape will be inferred automatically if the input follows these 3 shapes.
Most of the arguments follow the convention from librosa.
This class inherits from ``torch.nn.Module``, therefore, the usage is same as ``torch.nn.Module``.
Parameters
----------
n_fft : int
The window size. Default value is 2048.
freq_bins : int
Number of frequency bins. Default is ``None``, which means ``n_fft//2+1`` bins.
hop_length : int
The hop (or stride) size. Default value is ``None`` which is equivalent to ``n_fft//4``.
window : str
The windowing function for STFT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'.
freq_scale : 'linear', 'log', or 'no'
Determine the spacing between each frequency bin. When `linear` or `log` is used,
the bin spacing can be controlled by ``fmin`` and ``fmax``. If 'no' is used, the bin will
start at 0Hz and end at Nyquist frequency with linear spacing.
center : bool
Putting the STFT keneral at the center of the time-step or not. If ``False``, the time
index is the beginning of the STFT kernel, if ``True``, the time index is the center of
the STFT kernel. Default value if ``True``.
pad_mode : str
The padding method. Default value is 'reflect'.
inverse : bool
To activate the iSTFT module or not. By default, it is False to save GPU memory.
fmin : int
The starting frequency for the lowest frequency bin. If freq_scale is ``no``, this argument
does nothing.
fmax : int
The ending frequency for the highest frequency bin. If freq_scale is ``no``, this argument
does nothing.
sr : int
The sampling rate for the input audio. It is used to calucate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
trainable : bool
Determine if the STFT kenrels are trainable or not. If ``True``, the gradients for STFT
kernels will also be caluclated and the STFT kernels will be updated during model training.
Default value is ``False``
output_format : str
Control the spectrogram output type, either ``Magnitude``, ``Complex``, or ``Phase``.
The output_format can also be changed during the ``forward`` method.
verbose : bool
If ``True``, it shows layer information. If ``False``, it suppresses all prints
device : str
Choose which device to initialize this layer. Default value is 'cpu'
Returns
-------
spectrogram : torch.tensor
It returns a tensor of spectrograms.
``shape = (num_samples, freq_bins,time_steps)`` if ``output_format='Magnitude'``;
``shape = (num_samples, freq_bins,time_steps, 2)`` if ``output_format='Complex' or 'Phase'``;
Examples
--------
>>> spec_layer = Spectrogram.STFT()
>>> specs = spec_layer(x)
"""
def __init__(self, n_fft=2048, win_length=None, freq_bins=None, hop_length=None, window='hann',
freq_scale='no', center=True, pad_mode='reflect', iSTFT=False,
fmin=50, fmax=6000, sr=22050, trainable=False,
output_format="Complex", verbose=True):
super().__init__()
# Trying to make the default setting same as librosa
if win_length==None: win_length = n_fft
if hop_length==None: hop_length = int(win_length // 4)
self.output_format = output_format
self.trainable = trainable
self.stride = hop_length
self.center = center
self.pad_mode = pad_mode
self.n_fft = n_fft
self.freq_bins = freq_bins
self.trainable = trainable
self.pad_amount = self.n_fft // 2
self.window = window
self.win_length = win_length
self.iSTFT = iSTFT
self.trainable = trainable
start = time()
# Create filter windows for stft
kernel_sin, kernel_cos, self.bins2freq, self.bin_list, window_mask = create_fourier_kernels(n_fft,
win_length=win_length,
freq_bins=freq_bins,
window=window,
freq_scale=freq_scale,
fmin=fmin,
fmax=fmax,
sr=sr,
verbose=verbose)
kernel_sin = torch.tensor(kernel_sin, dtype=torch.float)
kernel_cos = torch.tensor(kernel_cos, dtype=torch.float)
# In this way, the inverse kernel and the forward kernel do not share the same memory...
kernel_sin_inv = torch.cat((kernel_sin, -kernel_sin[1:-1].flip(0)), 0)
kernel_cos_inv = torch.cat((kernel_cos, kernel_cos[1:-1].flip(0)), 0)
if iSTFT:
self.register_buffer('kernel_sin_inv', kernel_sin_inv.unsqueeze(-1))
self.register_buffer('kernel_cos_inv', kernel_cos_inv.unsqueeze(-1))
# Making all these variables nn.Parameter, so that the model can be used with nn.Parallel
# self.kernel_sin = torch.nn.Parameter(self.kernel_sin, requires_grad=self.trainable)
# self.kernel_cos = torch.nn.Parameter(self.kernel_cos, requires_grad=self.trainable)
# Applying window functions to the Fourier kernels
window_mask = torch.tensor(window_mask)
wsin = kernel_sin * window_mask
wcos = kernel_cos * window_mask
if self.trainable==False:
self.register_buffer('wsin', wsin)
self.register_buffer('wcos', wcos)
if self.trainable==True:
wsin = torch.nn.Parameter(wsin, requires_grad=self.trainable)
wcos = torch.nn.Parameter(wcos, requires_grad=self.trainable)
self.register_parameter('wsin', wsin)
self.register_parameter('wcos', wcos)
# Prepare the shape of window mask so that it can be used later in inverse
self.register_buffer('window_mask', window_mask.unsqueeze(0).unsqueeze(-1))
if verbose==True:
print("STFT kernels created, time used = {:.4f} seconds".format(time()-start))
else:
pass
def forward(self, x, output_format=None):
"""
Convert a batch of waveforms to spectrograms.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
output_format : str
Control the type of spectrogram to be return. Can be either ``Magnitude`` or ``Complex`` or ``Phase``.
Default value is ``Complex``.
"""
output_format = output_format or self.output_format
self.num_samples = x.shape[-1]
x = broadcast_dim(x)
if self.center:
if self.pad_mode == 'constant':
padding = nn.ConstantPad1d(self.pad_amount, 0)
elif self.pad_mode == 'reflect':
if self.num_samples < self.pad_amount:
raise AssertionError("Signal length shorter than reflect padding length (n_fft // 2).")
padding = nn.ReflectionPad1d(self.pad_amount)
x = padding(x)
spec_imag = conv1d(x, self.wsin, stride=self.stride)
spec_real = conv1d(x, self.wcos, stride=self.stride) # Doing STFT by using conv1d
# remove redundant parts
spec_real = spec_real[:, :self.freq_bins, :]
spec_imag = spec_imag[:, :self.freq_bins, :]
if output_format=='Magnitude':
spec = spec_real.pow(2) + spec_imag.pow(2)
if self.trainable==True:
return torch.sqrt(spec+1e-8) # prevent Nan gradient when sqrt(0) due to output=0
else:
return torch.sqrt(spec)
elif output_format=='Complex':
return torch.stack((spec_real,-spec_imag), -1) # Remember the minus sign for imaginary part
elif output_format=='Phase':
return torch.atan2(-spec_imag+0.0,spec_real) # +0.0 removes -0.0 elements, which leads to error in calculating phase
def inverse(self, X, onesided=True, length=None, refresh_win=True):
"""
This function is same as the :func:`~nnAudio.Spectrogram.iSTFT` class,
which is to convert spectrograms back to waveforms.
It only works for the complex value spectrograms. If you have the magnitude spectrograms,
please use :func:`~nnAudio.Spectrogram.Griffin_Lim`.
Parameters
----------
onesided : bool
If your spectrograms only have ``n_fft//2+1`` frequency bins, please use ``onesided=True``,
else use ``onesided=False``
length : int
To make sure the inverse STFT has the same output length of the original waveform, please
set `length` as your intended waveform length. By default, ``length=None``,
which will remove ``n_fft//2`` samples from the start and the end of the output.
refresh_win : bool
Recalculating the window sum square. If you have an input with fixed number of timesteps,
you can increase the speed by setting ``refresh_win=False``. Else please keep ``refresh_win=True``
"""
if (hasattr(self, 'kernel_sin_inv') != True) or (hasattr(self, 'kernel_cos_inv') != True):
raise NameError("Please activate the iSTFT module by setting `iSTFT=True` if you want to use `inverse`")
assert X.dim()==4 , "Inverse iSTFT only works for complex number," \
"make sure our tensor is in the shape of (batch, freq_bins, timesteps, 2)."\
"\nIf you have a magnitude spectrogram, please consider using Griffin-Lim."
if onesided:
X = extend_fbins(X) # extend freq
X_real, X_imag = X[:, :, :, 0], X[:, :, :, 1]
# broadcast dimensions to support 2D convolution
X_real_bc = X_real.unsqueeze(1)
X_imag_bc = X_imag.unsqueeze(1)
a1 = conv2d(X_real_bc, self.kernel_cos_inv, stride=(1,1))
b2 = conv2d(X_imag_bc, self.kernel_sin_inv, stride=(1,1))
# compute real and imag part. signal lies in the real part
real = a1 - b2
real = real.squeeze(-2)*self.window_mask
# Normalize the amplitude with n_fft
real /= (self.n_fft)
# Overlap and Add algorithm to connect all the frames
real = overlap_add(real, self.stride)
# Prepare the window sumsqure for division
# Only need to create this window once to save time
# Unless the input spectrograms have different time steps
if hasattr(self, 'w_sum')==False or refresh_win==True:
self.w_sum = torch_window_sumsquare(self.window_mask.flatten(), X.shape[2], self.stride, self.n_fft).flatten()
self.nonzero_indices = (self.w_sum>1e-10)
else:
pass
real[:, self.nonzero_indices] = real[:,self.nonzero_indices].div(self.w_sum[self.nonzero_indices])
# Remove padding
if length is None:
if self.center:
real = real[:, self.pad_amount:-self.pad_amount]
else:
if self.center:
real = real[:, self.pad_amount:self.pad_amount + length]
else:
real = real[:, :length]
return real
def extra_repr(self) -> str:
return 'n_fft={}, Fourier Kernel size={}, iSTFT={}, trainable={}'.format(
self.n_fft, (*self.wsin.shape,), self.iSTFT, self.trainable
)
class MelSpectrogram(torch.nn.Module):
"""This function is to calculate the Melspectrogram of the input signal.
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
The correct shape will be inferred automatically if the input follows these 3 shapes.
Most of the arguments follow the convention from librosa.
This class inherits from ``torch.nn.Module``, therefore, the usage is same as ``torch.nn.Module``.
Parameters
----------
sr : int
The sampling rate for the input audio.
It is used to calculate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
n_fft : int
The window size for the STFT. Default value is 2048
n_mels : int
The number of Mel filter banks. The filter banks maps the n_fft to mel bins.
Default value is 128.
hop_length : int
The hop (or stride) size. Default value is 512.
window : str
The windowing function for STFT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'.
center : bool
Putting the STFT keneral at the center of the time-step or not. If ``False``,
the time index is the beginning of the STFT kernel, if ``True``, the time index is the
center of the STFT kernel. Default value if ``True``.
pad_mode : str
The padding method. Default value is 'reflect'.
htk : bool
When ``False`` is used, the Mel scale is quasi-logarithmic. When ``True`` is used, the
Mel scale is logarithmic. The default value is ``False``.
fmin : int
The starting frequency for the lowest Mel filter bank.
fmax : int
The ending frequency for the highest Mel filter bank.
trainable_mel : bool
Determine if the Mel filter banks are trainable or not. If ``True``, the gradients for Mel
filter banks will also be calculated and the Mel filter banks will be updated during model
training. Default value is ``False``.
trainable_STFT : bool
Determine if the STFT kenrels are trainable or not. If ``True``, the gradients for STFT
kernels will also be caluclated and the STFT kernels will be updated during model training.
Default value is ``False``.
verbose : bool
If ``True``, it shows layer information. If ``False``, it suppresses all prints.
device : str
Choose which device to initialize this layer. Default value is 'cpu'.
Returns
-------
spectrogram : torch.tensor
It returns a tensor of spectrograms. shape = ``(num_samples, freq_bins,time_steps)``.
Examples
--------
>>> spec_layer = Spectrogram.MelSpectrogram()
>>> specs = spec_layer(x)
"""
def __init__(self, sr=22050, n_fft=2048, n_mels=128, hop_length=512,
window='hann', center=True, pad_mode='reflect', power=2.0, htk=False,
fmin=0.0, fmax=None, norm=1, trainable_mel=False, trainable_STFT=False,
verbose=True, **kwargs):
super().__init__()
self.stride = hop_length
self.center = center
self.pad_mode = pad_mode
self.n_fft = n_fft
self.power = power
self.trainable_mel = trainable_mel
self.trainable_STFT = trainable_STFT
self.verbose = verbose
# Preparing for the stft layer. No need for center
self.stft = STFT(n_fft=n_fft, freq_bins=None, hop_length=hop_length, window=window,
freq_scale='no', center=center, pad_mode=pad_mode, sr=sr, trainable=trainable_STFT,
output_format="Magnitude", verbose=verbose, **kwargs)
# Create filter windows for stft
start = time()
# Creating kernel for mel spectrogram
start = time()
mel_basis = mel(sr, n_fft, n_mels, fmin, fmax, htk=htk, norm=norm)
mel_basis = torch.tensor(mel_basis)
if verbose==True:
print("STFT filter created, time used = {:.4f} seconds".format(time()-start))
print("Mel filter created, time used = {:.4f} seconds".format(time()-start))
else:
pass
if trainable_mel:
# Making everything nn.Parameter, so that this model can support nn.DataParallel
mel_basis = torch.nn.Parameter(mel_basis, requires_grad=trainable_mel)
self.register_parameter('mel_basis', mel_basis)
else:
self.register_buffer('mel_basis', mel_basis)
# if trainable_mel==True:
# self.mel_basis = torch.nn.Parameter(self.mel_basis)
# if trainable_STFT==True:
# self.wsin = torch.nn.Parameter(self.wsin)
# self.wcos = torch.nn.Parameter(self.wcos)
def forward(self, x):
"""
Convert a batch of waveforms to Mel spectrograms.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
x = broadcast_dim(x)
spec = self.stft(x, output_format='Magnitude')**self.power
melspec = torch.matmul(self.mel_basis, spec)
return melspec
def extra_repr(self) -> str:
return 'Mel filter banks size = {}, trainable_mel={}'.format(
(*self.mel_basis.shape,), self.trainable_mel, self.trainable_STFT
)
def to_stft(self, melspec, max_steps=1000, loss_threshold=1e-8, grad_threshold=1e-7, random_start=False, sgd_kwargs=None, eps=1e-12, return_extras=False, verbose=None):
"""
Best-attempt spectrogram inversion
"""
def loss_fn(pred, target):
pred = pred.unsqueeze(1) if pred.ndim == 3 else pred
target = target.unsqueeze(1) if target.ndim == 3 else target
loss = (pred - target).pow(2).sum(-2).mean()
return loss
verbose = verbose or self.verbose
# SGD arguments
default_sgd_kwargs = dict(lr=1e3, momentum=0.9)
if sgd_kwargs:
default_sgd_kwargs.update(sgd_kwargs)
sgd_kwargs = default_sgd_kwargs
mel_basis = self.mel_basis.detach()
shape = melspec.shape
batch_size, n_mels, time = shape[0], shape[-2], shape[-1]
_, n_freq = mel_basis.shape
melspec = melspec.detach().view(-1, n_mels, time)
if random_start:
pred_stft_shape = (batch_size, n_freq, time)
pred_stft = torch.zeros(*pred_stft_shape, dtype=torch.float32, device=mel_basis.device).normal_().clamp_(eps)
else:
pred_stft = (torch.pinverse(mel_basis) @ melspec).clamp(eps)
pred_stft = nn.Parameter(pred_stft, requires_grad=True)
sgd_kwargs["lr"] = sgd_kwargs["lr"] * batch_size
optimizer = torch.optim.SGD([pred_stft], **sgd_kwargs)
losses = []
for i in range(max_steps):
optimizer.zero_grad()
pred_mel = mel_basis @ pred_stft
loss = loss_fn(pred_mel, melspec)
losses.append(loss.item())
loss.backward()
optimizer.step()
# Check conditions
if not loss.isfinite():
raise OverflowError("Overflow encountered in Mel -> STFT optimization")
if loss_threshold and loss < loss_threshold:
if verbose:
print(f"Target error of {loss_threshold} reached. Stopping optimization.")
break
if grad_threshold and pred_stft.grad.max() < grad_threshold:
if verbose:
print(f"Target max gradient of {grad_threshold} reached. Stopping optimization.")
break
pred_stft = pred_stft.detach().clamp(eps) ** 0.5
pred_stft = pred_stft.view((*shape[:-2], n_freq, time))
if return_extras:
return pred_stft, pred_mel.detach(), losses
return pred_stft
def inverse(self, melspec, mel_inversion_params=None, stft_inversion_params=None):
default_mel_inversion_params = {}
default_stft_inversion_params = {}
mel_inversion_params = mel_inversion_params or {}
stft_inversion_params = stft_inversion_params or {}
if mel_inversion_params:
mel_inversion_params = {**default_mel_inversion_params, **mel_inversion_params}
if stft_inversion_params:
stft_inversion_params = {**default_stft_inversion_params, **stft_inversion_params}
recon_stft = self.to_stft(melspec, **mel_inversion_params)
recon_audio = self.stft.inverse(recon_stft, **stft_inversion_params)
return recon_audio
class MFCC(torch.nn.Module):
"""This function is to calculate the Mel-frequency cepstral coefficients (MFCCs) of the input signal.
This algorithm first extracts Mel spectrograms from the audio clips,
then the discrete cosine transform is calcuated to obtain the final MFCCs.
Therefore, the Mel spectrogram part can be made trainable using
``trainable_mel`` and ``trainable_STFT``.
It only support type-II DCT at the moment. Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
The correct shape will be inferred autommatically if the input follows these 3 shapes.
Most of the arguments follow the convention from librosa.
This class inherits from ``torch.nn.Module``, therefore, the usage is same as ``torch.nn.Module``.
Parameters
----------
sr : int
The sampling rate for the input audio. It is used to calculate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
n_mfcc : int
The number of Mel-frequency cepstral coefficients
norm : string
The default value is 'ortho'. Normalization for DCT basis
**kwargs
Other arguments for Melspectrogram such as n_fft, n_mels, hop_length, and window
Returns
-------
MFCCs : torch.tensor
It returns a tensor of MFCCs. shape = ``(num_samples, n_mfcc, time_steps)``.
Examples
--------
>>> spec_layer = Spectrogram.MFCC()
>>> mfcc = spec_layer(x)
"""
def __init__(self, sr=22050, n_mfcc=20, norm='ortho', verbose=True, ref=1.0, amin=1e-10, top_db=80.0, **kwargs):
super().__init__()
self.melspec_layer = MelSpectrogram(sr=sr, verbose=verbose, **kwargs)
self.m_mfcc = n_mfcc
# attributes that will be used for _power_to_db
if amin <= 0:
raise ParameterError('amin must be strictly positive')
amin = torch.tensor([amin])
ref = torch.abs(torch.tensor([ref]))
self.register_buffer('amin', amin)
self.register_buffer('ref', ref)
self.top_db = top_db
self.n_mfcc = n_mfcc
def _power_to_db(self, S):
'''
Refer to https://librosa.github.io/librosa/_modules/librosa/core/spectrum.html#power_to_db
for the original implmentation.
'''
log_spec = 10.0 * torch.log10(torch.max(S, self.amin))
log_spec -= 10.0 * torch.log10(torch.max(self.amin, self.ref))
if self.top_db is not None:
if self.top_db < 0:
raise ParameterError('top_db must be non-negative')
# make the dim same as log_spec so that it can be broadcasted
batch_wise_max = log_spec.flatten(1).max(1)[0].unsqueeze(1).unsqueeze(1)
log_spec = torch.max(log_spec, batch_wise_max - self.top_db)
return log_spec
def _dct(self, x, norm=None):
'''
Refer to https://github.com/zh217/torch-dct for the original implmentation.
'''
x = x.permute(0,2,1) # make freq the last axis, since dct applies to the frequency axis
x_shape = x.shape
N = x_shape[-1]
v = torch.cat([x[:, :, ::2], x[:, :, 1::2].flip([2])], dim=2)
Vc = torch.rfft(v, 1, onesided=False)
# TODO: Can make the W_r and W_i trainable here
k = - torch.arange(N, dtype=x.dtype, device=x.device)[None, :] * np.pi / (2 * N)
W_r = torch.cos(k)
W_i = torch.sin(k)
V = Vc[:, :, :, 0] * W_r - Vc[:, :, :, 1] * W_i
if norm == 'ortho':
V[:, :, 0] /= np.sqrt(N) * 2
V[:, :, 1:] /= np.sqrt(N / 2) * 2
V = 2 * V
return V.permute(0,2,1) # swapping back the time axis and freq axis
def forward(self, x):
"""
Convert a batch of waveforms to MFCC.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
x = self.melspec_layer(x)
x = self._power_to_db(x)
x = self._dct(x, norm='ortho')[:,:self.m_mfcc,:]
return x
def extra_repr(self) -> str:
return 'n_mfcc = {}'.format(
(self.n_mfcc)
)
class CQT1992(torch.nn.Module):
"""
This alogrithm uses the method proposed in [1]. Please refer to :func:`~nnAudio.Spectrogram.CQT1992v2` for a more
computational and memory efficient version.
[1] Brown, Judith C.C. and Miller Puckette. “An efficient algorithm for the calculation of a
constant Q transform.” (1992).
This function is to calculate the CQT of the input signal.
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
The correct shape will be inferred autommatically if the input follows these 3 shapes.
Most of the arguments follow the convention from librosa.
This class inherits from ``torch.nn.Module``, therefore, the usage is same as ``torch.nn.Module``.
Parameters
----------
sr : int
The sampling rate for the input audio. It is used to calucate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
hop_length : int
The hop (or stride) size. Default value is 512.
fmin : float
The frequency for the lowest CQT bin. Default is 32.70Hz, which coresponds to the note C0.
fmax : float
The frequency for the highest CQT bin. Default is ``None``, therefore the higest CQT bin is
inferred from the ``n_bins`` and ``bins_per_octave``.
If ``fmax`` is not ``None``, then the argument ``n_bins`` will be ignored and ``n_bins``
will be calculated automatically. Default is ``None``
n_bins : int
The total numbers of CQT bins. Default is 84. Will be ignored if ``fmax`` is not ``None``.
bins_per_octave : int
Number of bins per octave. Default is 12.
trainable_STFT : bool
Determine if the time to frequency domain transformation kernel for the input audio is trainable or not.
Default is ``False``
trainable_CQT : bool
Determine if the frequency domain CQT kernel is trainable or not.
Default is ``False``
norm : int
Normalization for the CQT kernels. ``1`` means L1 normalization, and ``2`` means L2 normalization.
Default is ``1``, which is same as the normalization used in librosa.
window : str
The windowing function for CQT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'.
center : bool
Putting the CQT keneral at the center of the time-step or not. If ``False``, the time index is
the beginning of the CQT kernel, if ``True``, the time index is the center of the CQT kernel.
Default value if ``True``.
pad_mode : str
The padding method. Default value is 'reflect'.
trainable : bool
Determine if the CQT kernels are trainable or not. If ``True``, the gradients for CQT kernels
will also be caluclated and the CQT kernels will be updated during model training.
Default value is ``False``.
output_format : str
Determine the return type.
``Magnitude`` will return the magnitude of the STFT result, shape = ``(num_samples, freq_bins,time_steps)``;
``Complex`` will return the STFT result in complex number, shape = ``(num_samples, freq_bins,time_steps, 2)``;
``Phase`` will return the phase of the STFT reuslt, shape = ``(num_samples, freq_bins,time_steps, 2)``.
The complex number is stored as ``(real, imag)`` in the last axis. Default value is 'Magnitude'.
verbose : bool
If ``True``, it shows layer information. If ``False``, it suppresses all prints
Returns
-------
spectrogram : torch.tensor
It returns a tensor of spectrograms.
shape = ``(num_samples, freq_bins,time_steps)`` if ``output_format='Magnitude'``;
shape = ``(num_samples, freq_bins,time_steps, 2)`` if ``output_format='Complex' or 'Phase'``;
Examples
--------
>>> spec_layer = Spectrogram.CQT1992v2()
>>> specs = spec_layer(x)
"""
def __init__(self, sr=22050, hop_length=512, fmin=220, fmax=None, n_bins=84,
trainable_STFT=False, trainable_CQT=False, bins_per_octave=12,
output_format='Complex', norm=1, window='hann', center=True, pad_mode='reflect'):
super().__init__()
# norm arg is not functioning
self.hop_length = hop_length
self.center = center
self.pad_mode = pad_mode
self.norm = norm
self.output_format = output_format
# creating kernels for CQT
Q = 1/(2**(1/bins_per_octave)-1)
print("Creating CQT kernels ...", end='\r')
start = time()
cqt_kernels, self.kernel_width, lenghts = create_cqt_kernels(Q,
sr,
fmin,
n_bins,
bins_per_octave,
norm,
window,
fmax)
self.register_buffer('lenghts', lenghts)
cqt_kernels = fft(cqt_kernels)[:,:self.kernel_width//2+1]
print("CQT kernels created, time used = {:.4f} seconds".format(time()-start))
# creating kernels for stft
# self.cqt_kernels_real*=lenghts.unsqueeze(1)/self.kernel_width # Trying to normalize as librosa
# self.cqt_kernels_imag*=lenghts.unsqueeze(1)/self.kernel_width
print("Creating STFT kernels ...", end='\r')
start = time()
kernel_sin, kernel_cos, self.bins2freq, _, window = create_fourier_kernels(self.kernel_width,
window='ones',
freq_scale='no')
# Converting kernels from numpy arrays to torch tensors
wsin = torch.tensor(kernel_sin * window)
wcos = torch.tensor(kernel_cos * window)
cqt_kernels_real = torch.tensor(cqt_kernels.real.astype(np.float32))
cqt_kernels_imag = torch.tensor(cqt_kernels.imag.astype(np.float32))
if trainable_STFT:
wsin = torch.nn.Parameter(wsin, requires_grad=trainable_kernels)
wcos = torch.nn.Parameter(wcos, requires_grad=trainable_kernels)
self.register_parameter('wsin', wsin)
self.register_parameter('wcos', wcos)
else:
self.register_buffer('wsin', wsin)
self.register_buffer('wcos', wcos)
if trainable_CQT:
cqt_kernels_real = torch.nn.Parameter(cqt_kernels_real, requires_grad=trainable_kernels)
cqt_kernels_imag = torch.nn.Parameter(cqt_kernels_imag, requires_grad=trainable_kernels)
self.register_parameter('cqt_kernels_real', cqt_kernels_real)
self.register_parameter('cqt_kernels_imag', cqt_kernels_imag)
else:
self.register_buffer('cqt_kernels_real', cqt_kernels_real)
self.register_buffer('cqt_kernels_imag', cqt_kernels_imag)
print("STFT kernels created, time used = {:.4f} seconds".format(time()-start))
def forward(self, x, output_format=None):
"""
Convert a batch of waveforms to CQT spectrograms.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
output_format = output_format or self.output_format
x = broadcast_dim(x)
if self.center:
if self.pad_mode == 'constant':
padding = nn.ConstantPad1d(self.kernel_width//2, 0)
elif self.pad_mode == 'reflect':
padding = nn.ReflectionPad1d(self.kernel_width//2)
x = padding(x)
# STFT
fourier_real = conv1d(x, self.wcos, stride=self.hop_length)
fourier_imag = conv1d(x, self.wsin, stride=self.hop_length)
# CQT
CQT_real, CQT_imag = complex_mul((self.cqt_kernels_real, self.cqt_kernels_imag),
(fourier_real, fourier_imag))
CQT = torch.stack((CQT_real,-CQT_imag),-1)
if self.norm:
CQT = CQT/self.kernel_width*torch.sqrt(self.lenghts.view(-1,1,1))
else:
CQT = CQT*torch.sqrt(self.lenghts.view(-1,1,1))
if output_format=='Magnitude':
# Getting CQT Amplitude
return torch.sqrt(CQT.pow(2).sum(-1))
elif output_format=='Complex':
return CQT
elif output_format=='Phase':
phase_real = torch.cos(torch.atan2(CQT_imag,CQT_real))
phase_imag = torch.sin(torch.atan2(CQT_imag,CQT_real))
return torch.stack((phase_real,phase_imag), -1)
def extra_repr(self) -> str:
return 'STFT kernel size = {}, CQT kernel size = {}'.format(
(*self.wcos.shape,), (*self.cqt_kernels_real.shape,)
)
class CQT2010(torch.nn.Module):
"""
This algorithm is using the resampling method proposed in [1].
Instead of convoluting the STFT results with a gigantic CQT kernel covering the full frequency
spectrum, we make a small CQT kernel covering only the top octave.
Then we keep downsampling the input audio by a factor of 2 to convoluting it with the
small CQT kernel. Everytime the input audio is downsampled, the CQT relative to the downsampled
input is equavalent to the next lower octave.
The kernel creation process is still same as the 1992 algorithm. Therefore, we can reuse the code
from the 1992 alogrithm [2]
[1] Schörkhuber, Christian. “CONSTANT-Q TRANSFORM TOOLBOX FOR MUSIC PROCESSING.” (2010).
[2] Brown, Judith C.C. and Miller Puckette. “An efficient algorithm for the calculation of a
constant Q transform.” (1992).
early downsampling factor is to downsample the input audio to reduce the CQT kernel size.
The result with and without early downsampling are more or less the same except in the very low
frequency region where freq < 40Hz.
"""
def __init__(self, sr=22050, hop_length=512, fmin=32.70, fmax=None, n_bins=84, bins_per_octave=12,
norm=True, basis_norm=1, window='hann', pad_mode='reflect', trainable_STFT=False,
trainable_CQT=False, output_format='Complex', earlydownsample=True, verbose=True):
super().__init__()
self.norm = norm # Now norm is used to normalize the final CQT result by dividing n_fft
# basis_norm is for normalizing basis
self.hop_length = hop_length
self.pad_mode = pad_mode
self.n_bins = n_bins
self.output_format = output_format
self.earlydownsample = earlydownsample # TODO: activate early downsampling later if possible
# This will be used to calculate filter_cutoff and creating CQT kernels
Q = 1/(2**(1/bins_per_octave)-1)
# Creating lowpass filter and make it a torch tensor
if verbose==True:
print("Creating low pass filter ...", end='\r')
start = time()
lowpass_filter = torch.tensor(create_lowpass_filter(
band_center = 0.5,
kernelLength=256,
transitionBandwidth=0.001
)
)
# Broadcast the tensor to the shape that fits conv1d
self.register_buffer('lowpass_filter', lowpass_filter[None,None,:])
if verbose==True:
print("Low pass filter created, time used = {:.4f} seconds".format(time()-start))
# Calculate num of filter requires for the kernel
# n_octaves determines how many resampling requires for the CQT
n_filters = min(bins_per_octave, n_bins)
self.n_octaves = int(np.ceil(float(n_bins) / bins_per_octave))
# print("n_octaves = ", self.n_octaves)
# Calculate the lowest frequency bin for the top octave kernel
self.fmin_t = fmin*2**(self.n_octaves-1)
remainder = n_bins % bins_per_octave
# print("remainder = ", remainder)
if remainder==0:
# Calculate the top bin frequency
fmax_t = self.fmin_t*2**((bins_per_octave-1)/bins_per_octave)
else:
# Calculate the top bin frequency
fmax_t = self.fmin_t*2**((remainder-1)/bins_per_octave)
self.fmin_t = fmax_t/2**(1-1/bins_per_octave) # Adjusting the top minium bins
if fmax_t > sr/2:
raise ValueError('The top bin {}Hz has exceeded the Nyquist frequency, \
please reduce the n_bins'.format(fmax_t))
if self.earlydownsample == True: # Do early downsampling if this argument is True
if verbose==True:
print("Creating early downsampling filter ...", end='\r')
start = time()
sr, self.hop_length, self.downsample_factor, early_downsample_filter, \
self.earlydownsample = get_early_downsample_params(sr,
hop_length,
fmax_t,
Q,
self.n_octaves,
verbose)
self.register_buffer('early_downsample_filter', early_downsample_filter)
if verbose==True:
print("Early downsampling filter created, \
time used = {:.4f} seconds".format(time()-start))
else:
self.downsample_factor=1.
# Preparing CQT kernels
if verbose==True:
print("Creating CQT kernels ...", end='\r')
start = time()
# print("Q = {}, fmin_t = {}, n_filters = {}".format(Q, self.fmin_t, n_filters))
basis, self.n_fft, _ = create_cqt_kernels(Q,
sr,
self.fmin_t,
n_filters,
bins_per_octave,
norm=basis_norm,
topbin_check=False)
# This is for the normalization in the end
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / np.float(bins_per_octave))
lenghts = np.ceil(Q * sr / freqs)
lenghts = torch.tensor(lenghts).float()
self.register_buffer('lenghts', lenghts)
self.basis=basis
fft_basis = fft(basis)[:,:self.n_fft//2+1] # Convert CQT kenral from time domain to freq domain
# These cqt_kernel is already in the frequency domain
cqt_kernels_real = torch.tensor(fft_basis.real.astype(np.float32))
cqt_kernels_imag = torch.tensor(fft_basis.imag.astype(np.float32))
if verbose==True:
print("CQT kernels created, time used = {:.4f} seconds".format(time()-start))
# print("Getting cqt kernel done, n_fft = ",self.n_fft)
# Preparing kernels for Short-Time Fourier Transform (STFT)
# We set the frequency range in the CQT filter instead of here.
if verbose==True:
print("Creating STFT kernels ...", end='\r')
start = time()
kernel_sin, kernel_cos, self.bins2freq, _, window = create_fourier_kernels(self.n_fft, window='ones', freq_scale='no')
wsin = kernel_sin * window
wcos = kernel_cos * window
wsin = torch.tensor(wsin)
wcos = torch.tensor(wcos)
if verbose==True:
print("STFT kernels created, time used = {:.4f} seconds".format(time()-start))
if trainable_STFT:
wsin = torch.nn.Parameter(wsin, requires_grad=trainable_kernels)
wcos = torch.nn.Parameter(wcos, requires_grad=trainable_kernels)
self.register_parameter('wsin', wsin)
self.register_parameter('wcos', wcos)
else:
self.register_buffer('wsin', wsin)
self.register_buffer('wcos', wcos)
if trainable_CQT:
cqt_kernels_real = torch.nn.Parameter(cqt_kernels_real, requires_grad=trainable_kernels)
cqt_kernels_imag = torch.nn.Parameter(cqt_kernels_imag, requires_grad=trainable_kernels)
self.register_parameter('cqt_kernels_real', cqt_kernels_real)
self.register_parameter('cqt_kernels_imag', cqt_kernels_imag)
else:
self.register_buffer('cqt_kernels_real', cqt_kernels_real)
self.register_buffer('cqt_kernels_imag', cqt_kernels_imag)
# If center==True, the STFT window will be put in the middle, and paddings at the beginning
# and ending are required.
if self.pad_mode == 'constant':
self.padding = nn.ConstantPad1d(self.n_fft//2, 0)
elif self.pad_mode == 'reflect':
self.padding = nn.ReflectionPad1d(self.n_fft//2)
def forward(self,x, output_format=None):
"""
Convert a batch of waveforms to CQT spectrograms.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
output_format = output_format or self.output_format
x = broadcast_dim(x)
if self.earlydownsample==True:
x = downsampling_by_n(x, self.early_downsample_filter, self.downsample_factor)
hop = self.hop_length
CQT = get_cqt_complex(x, self.wcos, self.wsin, hop, self.padding) # Getting the top octave CQT
x_down = x # Preparing a new variable for downsampling
for i in range(self.n_octaves-1):
hop = hop//2
x_down = downsampling_by_2(x_down, self.lowpass_filter)
CQT1 = get_cqt_complex(x_down, self.wcos, self.wsin, hop, self.padding)
CQT = torch.cat((CQT1, CQT),1)
CQT = CQT[:,-self.n_bins:,:] # Removing unwanted top bins
if self.norm:
CQT = CQT/self.n_fft*torch.sqrt(self.lenghts.view(-1,1,1))
else:
CQT = CQT*torch.sqrt(self.lenghts.view(-1,1,1))
# Normalizing the output with the downsampling factor, 2**(self.n_octaves-1)
# is make it same mag as 1992
CQT = CQT*self.downsample_factor
if output_format=='Magnitude':
# Getting CQT Amplitude
return torch.sqrt(CQT.pow(2).sum(-1))
elif output_format=='Complex':
return CQT
elif output_format=='Phase':
phase_real = torch.cos(torch.atan2(CQT[:,:,:,1],CQT[:,:,:,0]))
phase_imag = torch.sin(torch.atan2(CQT[:,:,:,1],CQT[:,:,:,0]))
return torch.stack((phase_real,phase_imag), -1)
def extra_repr(self) -> str:
return 'STFT kernel size = {}, CQT kernel size = {}'.format(
(*self.wcos.shape,), (*self.cqt_kernels_real.shape,)
)
class CQT1992v2(torch.nn.Module):
"""This function is to calculate the CQT of the input signal.
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
The correct shape will be inferred autommatically if the input follows these 3 shapes.
Most of the arguments follow the convention from librosa.
This class inherits from ``torch.nn.Module``, therefore, the usage is same as ``torch.nn.Module``.
This alogrithm uses the method proposed in [1]. I slightly modify it so that it runs faster
than the original 1992 algorithm, that is why I call it version 2.
[1] Brown, Judith C.C. and Miller Puckette. “An efficient algorithm for the calculation of a
constant Q transform.” (1992).
Parameters
----------
sr : int
The sampling rate for the input audio. It is used to calucate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
hop_length : int
The hop (or stride) size. Default value is 512.
fmin : float
The frequency for the lowest CQT bin. Default is 32.70Hz, which coresponds to the note C0.
fmax : float
The frequency for the highest CQT bin. Default is ``None``, therefore the higest CQT bin is
inferred from the ``n_bins`` and ``bins_per_octave``.
If ``fmax`` is not ``None``, then the argument ``n_bins`` will be ignored and ``n_bins``
will be calculated automatically. Default is ``None``
n_bins : int
The total numbers of CQT bins. Default is 84. Will be ignored if ``fmax`` is not ``None``.
bins_per_octave : int
Number of bins per octave. Default is 12.
norm : int
Normalization for the CQT kernels. ``1`` means L1 normalization, and ``2`` means L2 normalization.
Default is ``1``, which is same as the normalization used in librosa.
window : str
The windowing function for CQT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'.
center : bool
Putting the CQT keneral at the center of the time-step or not. If ``False``, the time index is
the beginning of the CQT kernel, if ``True``, the time index is the center of the CQT kernel.
Default value if ``True``.
pad_mode : str
The padding method. Default value is 'reflect'.
trainable : bool
Determine if the CQT kernels are trainable or not. If ``True``, the gradients for CQT kernels
will also be caluclated and the CQT kernels will be updated during model training.
Default value is ``False``.
output_format : str
Determine the return type.
``Magnitude`` will return the magnitude of the STFT result, shape = ``(num_samples, freq_bins,time_steps)``;
``Complex`` will return the STFT result in complex number, shape = ``(num_samples, freq_bins,time_steps, 2)``;
``Phase`` will return the phase of the STFT reuslt, shape = ``(num_samples, freq_bins,time_steps, 2)``.
The complex number is stored as ``(real, imag)`` in the last axis. Default value is 'Magnitude'.
verbose : bool
If ``True``, it shows layer information. If ``False``, it suppresses all prints
Returns
-------
spectrogram : torch.tensor
It returns a tensor of spectrograms.
shape = ``(num_samples, freq_bins,time_steps)`` if ``output_format='Magnitude'``;
shape = ``(num_samples, freq_bins,time_steps, 2)`` if ``output_format='Complex' or 'Phase'``;
Examples
--------
>>> spec_layer = Spectrogram.CQT1992v2()
>>> specs = spec_layer(x)
"""
def __init__(self, sr=22050, hop_length=512, fmin=32.70, fmax=None, n_bins=84,
bins_per_octave=12, norm=1, window='hann', center=True, pad_mode='reflect',
trainable=False, output_format='Magnitude', verbose=True):
super().__init__()
# norm arg is not functioning
self.trainable = trainable
self.hop_length = hop_length
self.center = center
self.pad_mode = pad_mode
self.output_format = output_format
# creating kernels for CQT
Q = 1/(2**(1/bins_per_octave)-1)
if verbose==True:
print("Creating CQT kernels ...", end='\r')
start = time()
cqt_kernels, self.kernel_width, lenghts = create_cqt_kernels(Q,
sr,
fmin,
n_bins,
bins_per_octave,
norm,
window,
fmax)
self.register_buffer('lenghts', lenghts)
cqt_kernels_real = torch.tensor(cqt_kernels.real).unsqueeze(1)
cqt_kernels_imag = torch.tensor(cqt_kernels.imag).unsqueeze(1)
if trainable:
cqt_kernels_real = torch.nn.Parameter(cqt_kernels_real, requires_grad=trainable_kernels)
cqt_kernels_imag = torch.nn.Parameter(cqt_kernels_imag, requires_grad=trainable_kernels)
self.register_parameter('cqt_kernels_real', cqt_kernels_real)
self.register_parameter('cqt_kernels_imag', cqt_kernels_imag)
else:
self.register_buffer('cqt_kernels_real', cqt_kernels_real)
self.register_buffer('cqt_kernels_imag', cqt_kernels_imag)
if verbose==True:
print("CQT kernels created, time used = {:.4f} seconds".format(time()-start))
def forward(self,x, output_format=None):
"""
Convert a batch of waveforms to CQT spectrograms.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
output_format = output_format or self.output_format
x = broadcast_dim(x)
if self.center:
if self.pad_mode == 'constant':
padding = nn.ConstantPad1d(self.kernel_width//2, 0)
elif self.pad_mode == 'reflect':
padding = nn.ReflectionPad1d(self.kernel_width//2)
x = padding(x)
# CQT
CQT_real = conv1d(x, self.cqt_kernels_real, stride=self.hop_length) * \
torch.sqrt(self.lenghts.view(-1,1))
CQT_imag = -conv1d(x, self.cqt_kernels_imag, stride=self.hop_length) * \
torch.sqrt(self.lenghts.view(-1,1))
if output_format=='Magnitude':
if self.trainable==False:
# Getting CQT Amplitude
CQT = torch.sqrt(CQT_real.pow(2)+CQT_imag.pow(2))
else:
CQT = torch.sqrt(CQT_real.pow(2)+CQT_imag.pow(2)+1e-8)
return CQT
elif output_format=='Complex':
return torch.stack((CQT_real,CQT_imag),-1)
elif output_format=='Phase':
phase_real = torch.cos(torch.atan2(CQT_imag,CQT_real))
phase_imag = torch.sin(torch.atan2(CQT_imag,CQT_real))
return torch.stack((phase_real,phase_imag), -1)
def forward_manual(self,x):
"""
Method for debugging
"""
x = broadcast_dim(x)
if self.center:
if self.pad_mode == 'constant':
padding = nn.ConstantPad1d(self.kernel_width//2, 0)
elif self.pad_mode == 'reflect':
padding = nn.ReflectionPad1d(self.kernel_width//2)
x = padding(x)
# CQT
CQT_real = conv1d(x, self.cqt_kernels_real, stride=self.hop_length)
CQT_imag = conv1d(x, self.cqt_kernels_imag, stride=self.hop_length)
# Getting CQT Amplitude
CQT = torch.sqrt(CQT_real.pow(2)+CQT_imag.pow(2))
return CQT*torch.sqrt(self.lenghts.view(-1,1))
class CQT2010v2(torch.nn.Module):
"""This function is to calculate the CQT of the input signal.
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
The correct shape will be inferred autommatically if the input follows these 3 shapes.
Most of the arguments follow the convention from librosa.
This class inherits from ``torch.nn.Module``, therefore, the usage is same as ``torch.nn.Module``.
This alogrithm uses the resampling method proposed in [1].
Instead of convoluting the STFT results with a gigantic CQT kernel covering the full frequency
spectrum, we make a small CQT kernel covering only the top octave. Then we keep downsampling the
input audio by a factor of 2 to convoluting it with the small CQT kernel.
Everytime the input audio is downsampled, the CQT relative to the downsampled input is equivalent
to the next lower octave.
The kernel creation process is still same as the 1992 algorithm. Therefore, we can reuse the
code from the 1992 alogrithm [2]
[1] Schörkhuber, Christian. “CONSTANT-Q TRANSFORM TOOLBOX FOR MUSIC PROCESSING.” (2010).
[2] Brown, Judith C.C. and Miller Puckette. “An efficient algorithm for the calculation of a
constant Q transform.” (1992).
Early downsampling factor is to downsample the input audio to reduce the CQT kernel size.
The result with and without early downsampling are more or less the same except in the very low
frequency region where freq < 40Hz.
Parameters
----------
sr : int
The sampling rate for the input audio. It is used to calucate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
hop_length : int
The hop (or stride) size. Default value is 512.
fmin : float
The frequency for the lowest CQT bin. Default is 32.70Hz, which coresponds to the note C0.
fmax : float
The frequency for the highest CQT bin. Default is ``None``, therefore the higest CQT bin is
inferred from the ``n_bins`` and ``bins_per_octave``. If ``fmax`` is not ``None``, then the
argument ``n_bins`` will be ignored and ``n_bins`` will be calculated automatically.
Default is ``None``
n_bins : int
The total numbers of CQT bins. Default is 84. Will be ignored if ``fmax`` is not ``None``.
bins_per_octave : int
Number of bins per octave. Default is 12.
norm : bool
Normalization for the CQT result.
basis_norm : int
Normalization for the CQT kernels. ``1`` means L1 normalization, and ``2`` means L2 normalization.
Default is ``1``, which is same as the normalization used in librosa.
window : str
The windowing function for CQT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'
pad_mode : str
The padding method. Default value is 'reflect'.
trainable : bool
Determine if the CQT kernels are trainable or not. If ``True``, the gradients for CQT kernels
will also be caluclated and the CQT kernels will be updated during model training.
Default value is ``False``
output_format : str
Determine the return type.
'Magnitude' will return the magnitude of the STFT result, shape = ``(num_samples, freq_bins, time_steps)``;
'Complex' will return the STFT result in complex number, shape = ``(num_samples, freq_bins, time_steps, 2)``;
'Phase' will return the phase of the STFT reuslt, shape = ``(num_samples, freq_bins,time_steps, 2)``.
The complex number is stored as ``(real, imag)`` in the last axis. Default value is 'Magnitude'.
verbose : bool
If ``True``, it shows layer information. If ``False``, it suppresses all prints.
device : str
Choose which device to initialize this layer. Default value is 'cpu'.
Returns
-------
spectrogram : torch.tensor
It returns a tensor of spectrograms.
shape = ``(num_samples, freq_bins,time_steps)`` if ``output_format='Magnitude'``;
shape = ``(num_samples, freq_bins,time_steps, 2)`` if ``output_format='Complex' or 'Phase'``;
Examples
--------
>>> spec_layer = Spectrogram.CQT2010v2()
>>> specs = spec_layer(x)
"""
# To DO:
# need to deal with the filter and other tensors
def __init__(self, sr=22050, hop_length=512, fmin=32.70, fmax=None, n_bins=84,
bins_per_octave=12, norm=True, basis_norm=1, window='hann', pad_mode='reflect',
earlydownsample=True, trainable=False, output_format='Magnitude', verbose=True):
super().__init__()
self.norm = norm # Now norm is used to normalize the final CQT result by dividing n_fft
# basis_norm is for normalizing basis
self.hop_length = hop_length
self.pad_mode = pad_mode
self.n_bins = n_bins
self.earlydownsample = earlydownsample # We will activate early downsampling later if possible
self.trainable = trainable
self.output_format = output_format
# It will be used to calculate filter_cutoff and creating CQT kernels
Q = 1/(2**(1/bins_per_octave)-1)
# Creating lowpass filter and make it a torch tensor
if verbose==True:
print("Creating low pass filter ...", end='\r')
start = time()
# self.lowpass_filter = torch.tensor(
# create_lowpass_filter(
# band_center = 0.50,
# kernelLength=256,
# transitionBandwidth=0.001))
lowpass_filter = torch.tensor(create_lowpass_filter(
band_center = 0.50,
kernelLength=256,
transitionBandwidth=0.001)
)
# Broadcast the tensor to the shape that fits conv1d
self.register_buffer('lowpass_filter', lowpass_filter[None,None,:])
if verbose==True:
print("Low pass filter created, time used = {:.4f} seconds".format(time()-start))
# Caluate num of filter requires for the kernel
# n_octaves determines how many resampling requires for the CQT
n_filters = min(bins_per_octave, n_bins)
self.n_octaves = int(np.ceil(float(n_bins) / bins_per_octave))
if verbose==True:
print("num_octave = ", self.n_octaves)
# Calculate the lowest frequency bin for the top octave kernel
self.fmin_t = fmin*2**(self.n_octaves-1)
remainder = n_bins % bins_per_octave
# print("remainder = ", remainder)
if remainder==0:
# Calculate the top bin frequency
fmax_t = self.fmin_t*2**((bins_per_octave-1)/bins_per_octave)
else:
# Calculate the top bin frequency
fmax_t = self.fmin_t*2**((remainder-1)/bins_per_octave)
self.fmin_t = fmax_t/2**(1-1/bins_per_octave) # Adjusting the top minium bins
if fmax_t > sr/2:
raise ValueError('The top bin {}Hz has exceeded the Nyquist frequency, \
please reduce the n_bins'.format(fmax_t))
if self.earlydownsample == True: # Do early downsampling if this argument is True
if verbose==True:
print("Creating early downsampling filter ...", end='\r')
start = time()
sr, self.hop_length, self.downsample_factor, early_downsample_filter, \
self.earlydownsample = get_early_downsample_params(sr,
hop_length,
fmax_t,
Q,
self.n_octaves,
verbose)
self.register_buffer('early_downsample_filter', early_downsample_filter)
if verbose==True:
print("Early downsampling filter created, \
time used = {:.4f} seconds".format(time()-start))
else:
self.downsample_factor=1.
# Preparing CQT kernels
if verbose==True:
print("Creating CQT kernels ...", end='\r')
start = time()
basis, self.n_fft, lenghts = create_cqt_kernels(Q,
sr,
self.fmin_t,
n_filters,
bins_per_octave,
norm=basis_norm,
topbin_check=False)
# For normalization in the end
freqs = fmin * 2.0 ** (np.r_[0:n_bins] / np.float(bins_per_octave))
lenghts = np.ceil(Q * sr / freqs)
lenghts = torch.tensor(lenghts).float()
self.register_buffer('lenghts', lenghts)
self.basis = basis
# These cqt_kernel is already in the frequency domain
cqt_kernels_real = torch.tensor(basis.real.astype(np.float32)).unsqueeze(1)
cqt_kernels_imag = torch.tensor(basis.imag.astype(np.float32)).unsqueeze(1)
if trainable:
cqt_kernels_real = torch.nn.Parameter(cqt_kernels_real, requires_grad=trainable_kernels)
cqt_kernels_imag = torch.nn.Parameter(cqt_kernels_imag, requires_grad=trainable_kernels)
self.register_parameter('cqt_kernels_real', cqt_kernels_real)
self.register_parameter('cqt_kernels_imag', cqt_kernels_imag)
else:
self.register_buffer('cqt_kernels_real', cqt_kernels_real)
self.register_buffer('cqt_kernels_imag', cqt_kernels_imag)
if verbose==True:
print("CQT kernels created, time used = {:.4f} seconds".format(time()-start))
# print("Getting cqt kernel done, n_fft = ",self.n_fft)
# If center==True, the STFT window will be put in the middle, and paddings at the beginning
# and ending are required.
if self.pad_mode == 'constant':
self.padding = nn.ConstantPad1d(self.n_fft//2, 0)
elif self.pad_mode == 'reflect':
self.padding = nn.ReflectionPad1d(self.n_fft//2)
def forward(self,x,output_format=None):
"""
Convert a batch of waveforms to CQT spectrograms.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
output_format = output_format or self.output_format
x = broadcast_dim(x)
if self.earlydownsample==True:
x = downsampling_by_n(x, self.early_downsample_filter, self.downsample_factor)
hop = self.hop_length
CQT = get_cqt_complex(x, self.cqt_kernels_real, self.cqt_kernels_imag, hop, self.padding) # Getting the top octave CQT
x_down = x # Preparing a new variable for downsampling
for i in range(self.n_octaves-1):
hop = hop//2
x_down = downsampling_by_2(x_down, self.lowpass_filter)
CQT1 = get_cqt_complex(x_down, self.cqt_kernels_real, self.cqt_kernels_imag, hop, self.padding)
CQT = torch.cat((CQT1, CQT),1)
CQT = CQT[:,-self.n_bins:,:] # Removing unwanted bottom bins
# print("downsample_factor = ",self.downsample_factor)
# print(CQT.shape)
# print(self.lenghts.view(-1,1).shape)
# Normalizing the output with the downsampling factor, 2**(self.n_octaves-1) is make it
# same mag as 1992
CQT = CQT*self.downsample_factor
# Normalize again to get same result as librosa
CQT = CQT*torch.sqrt(self.lenghts.view(-1,1,1))
if output_format=='Magnitude':
if self.trainable==False:
# Getting CQT Amplitude
return torch.sqrt(CQT.pow(2).sum(-1))
else:
return torch.sqrt(CQT.pow(2).sum(-1)+1e-8)
elif output_format=='Complex':
return CQT
elif output_format=='Phase':
phase_real = torch.cos(torch.atan2(CQT[:,:,:,1],CQT[:,:,:,0]))
phase_imag = torch.sin(torch.atan2(CQT[:,:,:,1],CQT[:,:,:,0]))
return torch.stack((phase_real,phase_imag), -1)
class CQT(CQT1992v2):
"""An abbreviation for :func:`~nnAudio.Spectrogram.CQT1992v2`. Please refer to the :func:`~nnAudio.Spectrogram.CQT1992v2` documentation"""
pass
# The section below is for developing purpose
# Please don't use the following classes
#
class DFT(torch.nn.Module):
"""
Experimental feature before `torch.fft` was made avaliable.
The inverse function only works for 1 single frame. i.e. input shape = (batch, n_fft, 1)
"""
def __init__(self, n_fft=2048, freq_bins=None, hop_length=512,
window='hann', freq_scale='no', center=True, pad_mode='reflect',
fmin=50, fmax=6000, sr=22050):
super().__init__()
self.stride = hop_length
self.center = center
self.pad_mode = pad_mode
self.n_fft = n_fft
# Create filter windows for stft
wsin, wcos, self.bins2freq = create_fourier_kernels(n_fft=n_fft,
freq_bins=n_fft,
window=window,
freq_scale=freq_scale,
fmin=fmin,
fmax=fmax,
sr=sr)
self.wsin = torch.tensor(wsin, dtype=torch.float)
self.wcos = torch.tensor(wcos, dtype=torch.float)
def forward(self,x):
"""
Convert a batch of waveforms to spectrums.
Parameters
----------
x : torch tensor
Input signal should be in either of the following shapes.\n
1. ``(len_audio)``\n
2. ``(num_audio, len_audio)``\n
3. ``(num_audio, 1, len_audio)``
It will be automatically broadcast to the right shape
"""
x = broadcast_dim(x)
if self.center:
if self.pad_mode == 'constant':
padding = nn.ConstantPad1d(self.n_fft//2, 0)
elif self.pad_mode == 'reflect':
padding = nn.ReflectionPad1d(self.n_fft//2)
x = padding(x)
imag = conv1d(x, self.wsin, stride=self.stride)
real = conv1d(x, self.wcos, stride=self.stride)
return (real, -imag)
def inverse(self,x_real,x_imag):
"""
Convert a batch of waveforms to CQT spectrograms.
Parameters
----------
x_real : torch tensor
Real part of the signal.
x_imag : torch tensor
Imaginary part of the signal.
"""
x_real = broadcast_dim(x_real)
x_imag = broadcast_dim(x_imag)
x_real.transpose_(1,2) # Prepare the right shape to do inverse
x_imag.transpose_(1,2) # Prepare the right shape to do inverse
# if self.center:
# if self.pad_mode == 'constant':
# padding = nn.ConstantPad1d(self.n_fft//2, 0)
# elif self.pad_mode == 'reflect':
# padding = nn.ReflectionPad1d(self.n_fft//2)
# x_real = padding(x_real)
# x_imag = padding(x_imag)
# Watch out for the positive and negative signs
# ifft = e^(+2\pi*j)*X
# ifft(X_real) = (a1, a2)
# ifft(X_imag)*1j = (b1, b2)*1j
# = (-b2, b1)
a1 = conv1d(x_real, self.wcos, stride=self.stride)
a2 = conv1d(x_real, self.wsin, stride=self.stride)
b1 = conv1d(x_imag, self.wcos, stride=self.stride)
b2 = conv1d(x_imag, self.wsin, stride=self.stride)
imag = a2+b1
real = a1-b2
return (real/self.n_fft, imag/self.n_fft)
class iSTFT(torch.nn.Module):
"""This class is to convert spectrograms back to waveforms. It only works for the complex value spectrograms.
If you have the magnitude spectrograms, please use :func:`~nnAudio.Spectrogram.Griffin_Lim`.
The parameters (e.g. n_fft, window) need to be the same as the STFT in order to obtain the correct inverse.
If trainability is not required, it is recommended to use the ``inverse`` method under the ``STFT`` class
to save GPU/RAM memory.
When ``trainable=True`` and ``freq_scale!='no'``, there is no guarantee that the inverse is perfect, please
use with extra care.
Parameters
----------
n_fft : int
The window size. Default value is 2048.
freq_bins : int
Number of frequency bins. Default is ``None``, which means ``n_fft//2+1`` bins
Please make sure the value is the same as the forward STFT.
hop_length : int
The hop (or stride) size. Default value is ``None`` which is equivalent to ``n_fft//4``.
Please make sure the value is the same as the forward STFT.
window : str
The windowing function for iSTFT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'.
Please make sure the value is the same as the forward STFT.
freq_scale : 'linear', 'log', or 'no'
Determine the spacing between each frequency bin. When `linear` or `log` is used,
the bin spacing can be controlled by ``fmin`` and ``fmax``. If 'no' is used, the bin will
start at 0Hz and end at Nyquist frequency with linear spacing.
Please make sure the value is the same as the forward STFT.
center : bool
Putting the iSTFT keneral at the center of the time-step or not. If ``False``, the time
index is the beginning of the iSTFT kernel, if ``True``, the time index is the center of
the iSTFT kernel. Default value if ``True``.
Please make sure the value is the same as the forward STFT.
fmin : int
The starting frequency for the lowest frequency bin. If freq_scale is ``no``, this argument
does nothing. Please make sure the value is the same as the forward STFT.
fmax : int
The ending frequency for the highest frequency bin. If freq_scale is ``no``, this argument
does nothing. Please make sure the value is the same as the forward STFT.
sr : int
The sampling rate for the input audio. It is used to calucate the correct ``fmin`` and ``fmax``.
Setting the correct sampling rate is very important for calculating the correct frequency.
trainable_kernels : bool
Determine if the STFT kenrels are trainable or not. If ``True``, the gradients for STFT
kernels will also be caluclated and the STFT kernels will be updated during model training.
Default value is ``False``.
trainable_window : bool
Determine if the window function is trainable or not.
Default value is ``False``.
verbose : bool
If ``True``, it shows layer information. If ``False``, it suppresses all prints.
device : str
Choose which device to initialize this layer. Default value is 'cpu'.
Returns
-------
spectrogram : torch.tensor
It returns a batch of waveforms.
Examples
--------
>>> spec_layer = Spectrogram.iSTFT()
>>> specs = spec_layer(x)
"""
def __init__(self, n_fft=2048, win_length=None, freq_bins=None, hop_length=None, window='hann',
freq_scale='no', center=True, fmin=50, fmax=6000, sr=22050, trainable_kernels=False,
trainable_window=False, verbose=True, refresh_win=True):
super().__init__()
# Trying to make the default setting same as librosa
if win_length==None: win_length = n_fft
if hop_length==None: hop_length = int(win_length // 4)
self.n_fft = n_fft
self.win_length = win_length
self.stride = hop_length
self.center = center
self.pad_amount = self.n_fft // 2
self.refresh_win = refresh_win
start = time()
# Create the window function and prepare the shape for batch-wise-time-wise multiplication
# Create filter windows for inverse
kernel_sin, kernel_cos, _, _, window_mask = create_fourier_kernels(n_fft,
win_length=win_length,
freq_bins=n_fft,
window=window,
freq_scale=freq_scale,
fmin=fmin,
fmax=fmax,
sr=sr,
verbose=False)
window_mask = get_window(window,int(win_length), fftbins=True)
# For inverse, the Fourier kernels do not need to be windowed
window_mask = torch.tensor(window_mask).unsqueeze(0).unsqueeze(-1)
# kernel_sin and kernel_cos have the shape (freq_bins, 1, n_fft, 1) to support 2D Conv
kernel_sin = torch.tensor(kernel_sin, dtype=torch.float).unsqueeze(-1)
kernel_cos = torch.tensor(kernel_cos, dtype=torch.float).unsqueeze(-1)
# Decide if the Fourier kernels are trainable
if trainable_kernels:
# Making all these variables trainable
kernel_sin = torch.nn.Parameter(kernel_sin, requires_grad=trainable_kernels)
kernel_cos = torch.nn.Parameter(kernel_cos, requires_grad=trainable_kernels)
self.register_parameter('kernel_sin', kernel_sin)
self.register_parameter('kernel_cos', kernel_cos)
else:
self.register_buffer('kernel_sin', kernel_sin)
self.register_buffer('kernel_cos', kernel_cos)
# Decide if the window function is trainable
if trainable_window:
window_mask = torch.nn.Parameter(window_mask, requires_grad=trainable_window)
self.register_parameter('window_mask', window_mask)
else:
self.register_buffer('window_mask', window_mask)
if verbose==True:
print("iSTFT kernels created, time used = {:.4f} seconds".format(time()-start))
else:
pass
def forward(self, X, onesided=False, length=None, refresh_win=None):
"""
If your spectrograms only have ``n_fft//2+1`` frequency bins, please use ``onesided=True``,
else use ``onesided=False``
To make sure the inverse STFT has the same output length of the original waveform, please
set `length` as your intended waveform length. By default, ``length=None``,
which will remove ``n_fft//2`` samples from the start and the end of the output.
If your input spectrograms X are of the same length, please use ``refresh_win=None`` to increase
computational speed.
"""
if refresh_win==None:
refresh_win=self.refresh_win
assert X.dim()==4 , "Inverse iSTFT only works for complex number," \
"make sure our tensor is in the shape of (batch, freq_bins, timesteps, 2)"
# If the input spectrogram contains only half of the n_fft
# Use extend_fbins function to get back another half
if onesided:
X = extend_fbins(X) # extend freq
X_real, X_imag = X[:, :, :, 0], X[:, :, :, 1]
# broadcast dimensions to support 2D convolution
X_real_bc = X_real.unsqueeze(1)
X_imag_bc = X_imag.unsqueeze(1)
a1 = conv2d(X_real_bc, self.kernel_cos, stride=(1,1))
b2 = conv2d(X_imag_bc, self.kernel_sin, stride=(1,1))
# compute real and imag part. signal lies in the real part
real = a1 - b2
real = real.squeeze(-2)*self.window_mask
# Normalize the amplitude with n_fft
real /= (self.n_fft)
# Overlap and Add algorithm to connect all the frames
real = overlap_add(real, self.stride)
# Prepare the window sumsqure for division
# Only need to create this window once to save time
# Unless the input spectrograms have different time steps
if hasattr(self, 'w_sum')==False or refresh_win==True:
self.w_sum = torch_window_sumsquare(self.window_mask.flatten(), X.shape[2], self.stride, self.n_fft).flatten()
self.nonzero_indices = (self.w_sum>1e-10)
else:
pass
real[:, self.nonzero_indices] = real[:,self.nonzero_indices].div(self.w_sum[self.nonzero_indices])
# Remove padding
if length is None:
if self.center:
real = real[:, self.pad_amount:-self.pad_amount]
else:
if self.center:
real = real[:, self.pad_amount:self.pad_amount + length]
else:
real = real[:, :length]
return real
class Griffin_Lim(torch.nn.Module):
"""
Converting Magnitude spectrograms back to waveforms based on the "fast Griffin-Lim"[1].
This Griffin Lim is a direct clone from librosa.griffinlim.
[1] Perraudin, N., Balazs, P., & Søndergaard, P. L. “A fast Griffin-Lim algorithm,”
IEEE Workshop on Applications of Signal Processing to Audio and Acoustics (pp. 1-4), Oct. 2013.
Parameters
----------
n_fft : int
The window size. Default value is 2048.
n_iter=32 : int
The number of iterations for Griffin-Lim. The default value is ``32``
hop_length : int
The hop (or stride) size. Default value is ``None`` which is equivalent to ``n_fft//4``.
Please make sure the value is the same as the forward STFT.
window : str
The windowing function for iSTFT. It uses ``scipy.signal.get_window``, please refer to
scipy documentation for possible windowing functions. The default value is 'hann'.
Please make sure the value is the same as the forward STFT.
center : bool
Putting the iSTFT keneral at the center of the time-step or not. If ``False``, the time
index is the beginning of the iSTFT kernel, if ``True``, the time index is the center of
the iSTFT kernel. Default value if ``True``.
Please make sure the value is the same as the forward STFT.
momentum : float
The momentum for the update rule. The default value is ``0.99``.
device : str
Choose which device to initialize this layer. Default value is 'cpu'
"""
def __init__(self,
n_fft,
n_iter=32,
hop_length=None,
win_length=None,
window='hann',
center=True,
pad_mode='reflect',
momentum=0.99,
device='cpu'):
super().__init__()
self.n_fft = n_fft
self.win_length = win_length
self.n_iter = n_iter
self.center = center
self.pad_mode = pad_mode
self.momentum = momentum
self.device = device
if win_length==None:
self.win_length=n_fft
else:
self.win_length=win_length
if hop_length==None:
self.hop_length = n_fft//4
else:
self.hop_length = hop_length
# Creating window function for stft and istft later
self.w = torch.tensor(get_window(window,
int(self.win_length),
fftbins=True),
device=device).float()
def forward(self, S):
"""
Convert a batch of magnitude spectrograms to waveforms.
Parameters
----------
S : torch tensor
Spectrogram of the shape ``(batch, n_fft//2+1, timesteps)``
"""
assert S.dim()==3 , "Please make sure your input is in the shape of (batch, freq_bins, timesteps)"
# Initializing Random Phase
rand_phase = torch.randn(*S.shape, device=self.device)
angles = torch.empty((*S.shape,2), device=self.device)
angles[:, :,:,0] = torch.cos(2 * np.pi * rand_phase)
angles[:,:,:,1] = torch.sin(2 * np.pi * rand_phase)
# Initializing the rebuilt magnitude spectrogram
rebuilt = torch.zeros(*angles.shape, device=self.device)
for _ in range(self.n_iter):
tprev = rebuilt # Saving previous rebuilt magnitude spec
# spec2wav conversion
# print(f'win_length={self.win_length}\tw={self.w.shape}')
inverse = torch.istft(S.unsqueeze(-1) * angles,
self.n_fft,
self.hop_length,
win_length=self.win_length,
window=self.w,
center=self.center)
# wav2spec conversion
rebuilt = torch.stft(inverse,
self.n_fft,
self.hop_length,
win_length=self.win_length,
window=self.w,
pad_mode=self.pad_mode)
# Phase update rule
angles[:,:,:] = rebuilt[:,:,:] - (self.momentum / (1 + self.momentum)) * tprev[:,:,:]
# Phase normalization
angles = angles.div(torch.sqrt(angles.pow(2).sum(-1)).unsqueeze(-1) + 1e-16) # normalizing the phase
# Using the final phase to reconstruct the waveforms
inverse = torch.istft(S.unsqueeze(-1) * angles,
self.n_fft,
self.hop_length,
win_length=self.win_length,
window=self.w,
center=self.center)
return inverse
| 41.695906
| 172
| 0.593233
| 10,919
| 85,560
| 4.506457
| 0.06649
| 0.021542
| 0.012803
| 0.007316
| 0.759033
| 0.731191
| 0.706804
| 0.692355
| 0.679612
| 0.66307
| 0
| 0.015438
| 0.311057
| 85,560
| 2,051
| 173
| 41.716236
| 0.819326
| 0.426706
| 0
| 0.606132
| 0
| 0
| 0.061766
| 0.001006
| 0
| 0
| 0
| 0.000975
| 0.004717
| 1
| 0.038915
| false
| 0.018868
| 0.008255
| 0.005896
| 0.102594
| 0.03184
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
07f0cc1a2096d19875fd8be0522fd82d52ff8b5c
| 128
|
py
|
Python
|
setup.py
|
rizar/CLOSURE
|
57f80d4e89fa281830bb9c8b6a7a2498747e727a
|
[
"MIT"
] | 14
|
2019-12-08T04:38:57.000Z
|
2021-07-13T15:46:57.000Z
|
setup.py
|
rizar/CLOSURE
|
57f80d4e89fa281830bb9c8b6a7a2498747e727a
|
[
"MIT"
] | null | null | null |
setup.py
|
rizar/CLOSURE
|
57f80d4e89fa281830bb9c8b6a7a2498747e727a
|
[
"MIT"
] | 2
|
2020-09-01T10:21:27.000Z
|
2021-01-15T02:38:25.000Z
|
from setuptools import setup
setup(
name="nmn-iwp",
version="0.1",
keywords="",
packages=["vr", "vr.models"]
)
| 14.222222
| 32
| 0.585938
| 16
| 128
| 4.6875
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.02
| 0.21875
| 128
| 8
| 33
| 16
| 0.73
| 0
| 0
| 0
| 0
| 0
| 0.164063
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.142857
| 0
| 0.142857
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
07fdb99131cb0d8251646bea304d79ad58fc7ab6
| 157
|
py
|
Python
|
Mundo 1/Ex33.py
|
legna7/Python
|
52e0b642d1b7acc592ec82dd360c5697fb0765db
|
[
"MIT"
] | null | null | null |
Mundo 1/Ex33.py
|
legna7/Python
|
52e0b642d1b7acc592ec82dd360c5697fb0765db
|
[
"MIT"
] | null | null | null |
Mundo 1/Ex33.py
|
legna7/Python
|
52e0b642d1b7acc592ec82dd360c5697fb0765db
|
[
"MIT"
] | null | null | null |
salario = float(input('digite o seu salario: '))
aumento = (salario + (salario * 15)/100 if salario <= 1250 else salario + (salario * 10)/100)
print(aumento)
| 52.333333
| 93
| 0.687898
| 22
| 157
| 4.909091
| 0.636364
| 0.259259
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.105263
| 0.152866
| 157
| 3
| 94
| 52.333333
| 0.706767
| 0
| 0
| 0
| 0
| 0
| 0.139241
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.333333
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
58023a0843c7993ed1535e882c1755e33a7a8544
| 116
|
py
|
Python
|
solved_bronze/num11720.py
|
ilmntr/white_study
|
51d69d122b07e9a0922dddb134bff4ec79077eb9
|
[
"MIT"
] | null | null | null |
solved_bronze/num11720.py
|
ilmntr/white_study
|
51d69d122b07e9a0922dddb134bff4ec79077eb9
|
[
"MIT"
] | null | null | null |
solved_bronze/num11720.py
|
ilmntr/white_study
|
51d69d122b07e9a0922dddb134bff4ec79077eb9
|
[
"MIT"
] | null | null | null |
cnt = int(input())
num = list(map(int, input()))
sum = 0
for i in range(len(num)):
sum = sum + num[i]
print(sum)
| 19.333333
| 29
| 0.586207
| 22
| 116
| 3.090909
| 0.636364
| 0.235294
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.010753
| 0.198276
| 116
| 6
| 30
| 19.333333
| 0.72043
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.166667
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
6af266c300822127b8933d07e4d514dfddafdca3
| 575
|
py
|
Python
|
sider/warnings.py
|
PCManticore/sider
|
cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1
|
[
"MIT"
] | 19
|
2015-01-17T18:24:36.000Z
|
2022-02-05T06:33:41.000Z
|
sider/warnings.py
|
PCManticore/sider
|
cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1
|
[
"MIT"
] | 5
|
2016-01-13T14:19:44.000Z
|
2016-06-01T18:50:36.000Z
|
sider/warnings.py
|
PCManticore/sider
|
cd11b38b2a1bf1ea3600eb287abfe3c2b40c67c1
|
[
"MIT"
] | 6
|
2015-08-16T10:32:09.000Z
|
2019-11-29T09:57:06.000Z
|
""":mod:`sider.warnings` --- Warning categories
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module defines several custom warning category classes.
"""
class SiderWarning(Warning):
"""All warning classes used by Sider extend this base class."""
class PerformanceWarning(SiderWarning, RuntimeWarning):
"""The category for warnings about performance worries. Operations
that warn this category would work but be inefficient.
"""
class TransactionWarning(SiderWarning, RuntimeWarning):
"""The category for warnings about transactions."""
| 25
| 71
| 0.683478
| 57
| 575
| 6.894737
| 0.631579
| 0.132316
| 0.147583
| 0.188295
| 0.26972
| 0.26972
| 0.26972
| 0
| 0
| 0
| 0
| 0
| 0.151304
| 575
| 22
| 72
| 26.136364
| 0.805328
| 0.657391
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
ed0157759bef39b622e00be4f990c696bc0f3dd8
| 110
|
py
|
Python
|
src/FYP/fifaRecords/urls.py
|
MustafaAbbas110/FinalProject
|
30d371f06a8a1875285cfd4a8940ca3610ec1274
|
[
"BSD-3-Clause"
] | null | null | null |
src/FYP/fifaRecords/urls.py
|
MustafaAbbas110/FinalProject
|
30d371f06a8a1875285cfd4a8940ca3610ec1274
|
[
"BSD-3-Clause"
] | null | null | null |
src/FYP/fifaRecords/urls.py
|
MustafaAbbas110/FinalProject
|
30d371f06a8a1875285cfd4a8940ca3610ec1274
|
[
"BSD-3-Clause"
] | null | null | null |
from django.urls import path
from . import views
urlpatterns = [
path('', views.Records, name ="fRec"),
]
| 18.333333
| 42
| 0.672727
| 14
| 110
| 5.285714
| 0.714286
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.181818
| 110
| 6
| 43
| 18.333333
| 0.822222
| 0
| 0
| 0
| 0
| 0
| 0.036036
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.4
| 0
| 0.4
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
ed0ba1aa04531d363f3421c385e69a867b69168b
| 2,949
|
py
|
Python
|
saleor/dashboard/urls.py
|
Chaoslecion123/Diver
|
8c5c493701422eada49cbf95b0b0add08f1ea561
|
[
"BSD-3-Clause"
] | null | null | null |
saleor/dashboard/urls.py
|
Chaoslecion123/Diver
|
8c5c493701422eada49cbf95b0b0add08f1ea561
|
[
"BSD-3-Clause"
] | null | null | null |
saleor/dashboard/urls.py
|
Chaoslecion123/Diver
|
8c5c493701422eada49cbf95b0b0add08f1ea561
|
[
"BSD-3-Clause"
] | null | null | null |
from django.conf.urls import include, url
from django.views.generic.base import TemplateView
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .collection.urls import urlpatterns as collection_urls
from .customer.urls import urlpatterns as customer_urls
from .discount.urls import urlpatterns as discount_urls
from .menu.urls import urlpatterns as menu_urls
from .order.urls import urlpatterns as order_urls
from .page.urls import urlpatterns as page_urls
from .product.urls import urlpatterns as product_urls
from .search.urls import urlpatterns as search_urls
from .shipping.urls import urlpatterns as shipping_urls
from .sites.urls import urlpatterns as site_urls
from .staff.urls import urlpatterns as staff_urls
from .taxes.urls import urlpatterns as taxes_urls
# BEGIN :: SoftButterfly Extensions --------------------------------------------
from .brand.urls import urlpatterns as brand_urls
from .widget.slider.urls import urlpatterns as slider_urls
from .widget.banner.urls import urlpatterns as banner_urls
from .widget.scene.urls import urlpatterns as scene_urls
from .widget.benefit.urls import urlpatterns as benefit_urls
from .store.physical_store.urls import urlpatterns as store_urls
from .store.social_network.urls import urlpatterns as social_network_urls
from .store.special_page.urls import urlpatterns as special_page_urls
from .store.bank_account.urls import urlpatterns as bank_account_urls
from .store.footer_item.urls import urlpatterns as footer_item_urls
# END :: SoftButterfly Extensions ----------------------------------------------
urlpatterns = [
url(r'^$', core_views.index, name='index'),
url(r'^categories/', include(category_urls)),
url(r'^collections/', include(collection_urls)),
url(r'^orders/', include(order_urls)),
url(r'^page/', include(page_urls)),
url(r'^products/', include(product_urls)),
url(r'^customers/', include(customer_urls)),
url(r'^staff/', include(staff_urls)),
url(r'^discounts/', include(discount_urls)),
url(r'^settings/', include(
site_urls + social_network_urls
+ special_page_urls + bank_account_urls + footer_item_urls)), # Extensions
url(r'^menu/', include(menu_urls)),
url(r'^shipping/', include(shipping_urls)),
url(r'^style-guide/', core_views.styleguide, name='styleguide'),
url(r'^search/', include(search_urls)),
url(r'^taxes/', include(taxes_urls)),
url(r'^next/', TemplateView.as_view(template_name='dashboard/next.html')),
# BEGIN :: SoftButterfly Extensions ----------------------------------------
url(r'^brand/', include(brand_urls)),
url(r'^slider/', include(slider_urls)),
url(r'^banner/', include(banner_urls)),
url(r'^scene/', include(scene_urls)),
url(r'^store/', include(store_urls)),
url(r'^benefit/', include(benefit_urls)),
# END :: SoftButterfly Extensions ------------------------------------------
]
| 49.15
| 83
| 0.714819
| 389
| 2,949
| 5.254499
| 0.167095
| 0.117417
| 0.236301
| 0.258806
| 0.026419
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.120041
| 2,949
| 59
| 84
| 49.983051
| 0.787669
| 0.107833
| 0
| 0
| 0
| 0
| 0.08381
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
ed0d8ae3aab7a47853ec71583d13c54d255d0f51
| 2,430
|
py
|
Python
|
gym_pcgrl/envs/reps/wide_3D_rep.py
|
JiangZehua/gym-pcgrl
|
80ddbde173803e81060578c2c4167d8d1f5cacba
|
[
"MIT"
] | null | null | null |
gym_pcgrl/envs/reps/wide_3D_rep.py
|
JiangZehua/gym-pcgrl
|
80ddbde173803e81060578c2c4167d8d1f5cacba
|
[
"MIT"
] | null | null | null |
gym_pcgrl/envs/reps/wide_3D_rep.py
|
JiangZehua/gym-pcgrl
|
80ddbde173803e81060578c2c4167d8d1f5cacba
|
[
"MIT"
] | null | null | null |
from gym_pcgrl.envs.reps.representation3D import Representation3D
from PIL import Image
from gym import spaces
import numpy as np
from gym_pcgrl.envs.probs.minecraft.mc_render import reps_3D_render
"""
The wide representation where the agent can pick the tile position and tile value at each update.
"""
class Wide3DRepresentation(Representation3D):
"""
Initialize all the parameters used by that representation
"""
def __init__(self):
super().__init__()
"""
Gets the action space used by the wide representation
Parameters:
length: the current map length
width: the current map width
height: the current map height
num_tiles: the total number of the tile values
Returns:
MultiDiscrete: the action space used by that wide representation which
consists of the x position, y position, z position and the tile value
"""
def get_action_space(self, length, width, height, num_tiles):
return spaces.MultiDiscrete([length, width, height, num_tiles])
"""
Get the observation space used by the wide representation
Parameters:
length: the current map length
width: the current map width
height: the current map height
num_tiles: the total number of the tile values
Returns:
Box: the observation space used by that representation. A 3D array of tile numbers
"""
def get_observation_space(self, length, width, height, num_tiles):
return spaces.Dict({
"map": spaces.Box(low=0, high=num_tiles-1, dtype=np.uint8, shape=(height, width, length))
})
"""
Get the current representation observation object at the current moment
Returns:
observation: the current observation at the current moment. A 3D array of tile numbers
"""
def get_observation(self):
return {
"map": self._map.copy()
}
"""
Update the wide representation with the input action
Parameters:
action: an action that is used to advance the environment (same as action space)
Returns:
boolean: True if the action change the map, False if nothing changed
"""
def update(self, action):
change = [0,1][self._map[action[2]][action[1]][action[0]] != action[3]]
self._map[action[2]][action[1]][action[0]] = action[3]
return change, action[0], action[1], action[2]
| 32.837838
| 101
| 0.671605
| 324
| 2,430
| 4.953704
| 0.308642
| 0.062305
| 0.048598
| 0.037383
| 0.404361
| 0.346417
| 0.346417
| 0.346417
| 0.346417
| 0.241745
| 0
| 0.01261
| 0.249383
| 2,430
| 73
| 102
| 33.287671
| 0.867325
| 0.023457
| 0
| 0
| 0
| 0
| 0.006006
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.227273
| false
| 0
| 0.227273
| 0.136364
| 0.681818
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
ed15a4196531124a25ec9256f08c4c288fc464c6
| 1,784
|
py
|
Python
|
test_molecule.py
|
zee93/molecule_parser
|
42f5a3722d733ef9f7243bfa2b0b9a08c7bc5d23
|
[
"MIT"
] | null | null | null |
test_molecule.py
|
zee93/molecule_parser
|
42f5a3722d733ef9f7243bfa2b0b9a08c7bc5d23
|
[
"MIT"
] | null | null | null |
test_molecule.py
|
zee93/molecule_parser
|
42f5a3722d733ef9f7243bfa2b0b9a08c7bc5d23
|
[
"MIT"
] | null | null | null |
import unittest
from molecule import onize_formula, update_equation_with_multiplier, flaten_formula, parse_molecule
class MoleculeParserTestCases(unittest.TestCase):
def test_onizing_formulas(self):
self.assertEqual(onize_formula('H'), 'H1')
self.assertEqual(onize_formula('H2O'), 'H2O1')
self.assertEqual(onize_formula('Mg(OH)2'), 'Mg1(O1H1)2')
self.assertEqual(onize_formula('K4[ON(SO3)2]2'), 'K4[O1N1(S1O3)2]2')
def test_updating_formula_with_multipler(self):
self.assertEqual(update_equation_with_multiplier('H1', '2'), 'H2')
self.assertEqual(update_equation_with_multiplier('K4[O1N1(SO3)2]2', '2'), 'K8[O2N2(SO6)4]4')
def test_flatting_formula(self):
self.assertEqual(flaten_formula('H2O'), 'H2O')
self.assertEqual(flaten_formula('[H1]2O'), 'H2O')
self.assertEqual(flaten_formula('M1g1(O1H1)2'), 'M1g1O2H2')
self.assertEqual(flaten_formula('K4[O1N1(S1O3)2]2'), 'K4O2N2S4O12')
def test_full_parsing(self):
parsed_mole = parse_molecule('H2O')
self.assertEqual(len(parsed_mole.keys()), 2)
self.assertEqual(parsed_mole['H'], 2)
self.assertEqual(parsed_mole['O'], 1)
parsed_mole = parse_molecule('Mg(OH)2')
self.assertEqual(len(parsed_mole.keys()), 3)
self.assertEqual(parsed_mole['H'], 2)
self.assertEqual(parsed_mole['O'], 2)
self.assertEqual(parsed_mole['Mg'], 1)
parsed_mole = parse_molecule('K4[ON(SO3)2]2')
self.assertEqual(len(parsed_mole.keys()), 4)
self.assertEqual(parsed_mole['K'], 4)
self.assertEqual(parsed_mole['O'], 14)
self.assertEqual(parsed_mole['N'], 2)
self.assertEqual(parsed_mole['S'], 4)
if __name__ == '__main__':
unittest.main()
| 39.644444
| 100
| 0.669283
| 235
| 1,784
| 4.842553
| 0.268085
| 0.289982
| 0.166081
| 0.197715
| 0.480668
| 0.254833
| 0.151142
| 0.093146
| 0.093146
| 0.093146
| 0
| 0.055593
| 0.173206
| 1,784
| 44
| 101
| 40.545455
| 0.715932
| 0
| 0
| 0.058824
| 0
| 0
| 0.108744
| 0
| 0
| 0
| 0
| 0
| 0.647059
| 1
| 0.117647
| false
| 0
| 0.058824
| 0
| 0.205882
| 0
| 0
| 0
| 0
| null | 1
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
ed1dd7ccddd4e92e0775574a201cc45ae9f018c0
| 57
|
py
|
Python
|
kendall_w/__init__.py
|
ugolbck/KendallW
|
ace7c68d6c3c2dfcf6b3ee5fb3817240ed050c9b
|
[
"BSD-3-Clause"
] | 4
|
2020-03-28T13:42:58.000Z
|
2021-04-05T12:45:25.000Z
|
kendall_w/__init__.py
|
ugolbck/KendallW
|
ace7c68d6c3c2dfcf6b3ee5fb3817240ed050c9b
|
[
"BSD-3-Clause"
] | null | null | null |
kendall_w/__init__.py
|
ugolbck/KendallW
|
ace7c68d6c3c2dfcf6b3ee5fb3817240ed050c9b
|
[
"BSD-3-Clause"
] | 2
|
2020-08-05T03:36:43.000Z
|
2020-09-09T00:33:06.000Z
|
from .kendall_w import compute_w
__version__ = (1, 0, 0)
| 19
| 32
| 0.736842
| 10
| 57
| 3.6
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.0625
| 0.157895
| 57
| 3
| 33
| 19
| 0.6875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
ed50775b4eac2d767b8b5f1e618533d64da3321f
| 1,882
|
py
|
Python
|
CraftProtocol/NBT/NBTTagList.py
|
Toranktto/CraftProtocol
|
a6f4a67756c3868820ab76df5e148d76b020d990
|
[
"MIT"
] | 21
|
2018-05-12T20:18:02.000Z
|
2022-02-18T17:33:50.000Z
|
CraftProtocol/NBT/NBTTagList.py
|
Toranktto/CraftProtocol
|
a6f4a67756c3868820ab76df5e148d76b020d990
|
[
"MIT"
] | 1
|
2018-06-23T09:13:39.000Z
|
2018-06-27T01:22:27.000Z
|
CraftProtocol/NBT/NBTTagList.py
|
Toranktto/CraftProtocol
|
a6f4a67756c3868820ab76df5e148d76b020d990
|
[
"MIT"
] | 2
|
2018-05-19T21:36:00.000Z
|
2020-10-02T03:23:13.000Z
|
#!/usr/bin/env python
from CraftProtocol.NBT.NBTBase import NBTBase
from CraftProtocol.NBT.NBTProvider import NBTProvider
from CraftProtocol.StreamIO import StreamIO
class NBTTagList(NBTBase):
TYPE_ID = 0x09
def __init__(self, tag_type, values=None):
NBTBase.__init__(self)
if values is None:
values = []
self._tag_type = tag_type
self._values = list(values)
def get(self):
return self._values
def get_tag_type(self):
return self._tag_type
def __getitem__(self, i):
return self._values.__getitem__(i)
def __setitem__(self, i, o):
assert isinstance(o, self._tag_type), "value must be " + self._tag_type.__name__
self._values.__setitem__(i, o)
def __delitem__(self, i):
self._values.__delitem__(i)
def __iter__(self):
return self._values.__iter__()
def __contains__(self, o):
return self._values.__contains__(o)
def __len__(self):
return self._values.__len__()
def append(self, x):
assert isinstance(x, self._tag_type), "arg must be " + self._tag_type.__name__
self._values.append(x)
def remove(self, x):
assert isinstance(x, self._tag_type), "arg must be " + self._tag_type.__name__
self._values.remove(x)
@staticmethod
def write(stream, tag):
StreamIO.write_ubyte(stream, tag.get_tag_type().TYPE_ID)
StreamIO.write_int(stream, len(tag))
for i in tag:
tag.get_tag_type().write(stream, i)
@staticmethod
def read(stream):
tag_type_id = StreamIO.read_ubyte(stream)
tag_type = NBTProvider.get_tag_class(tag_type_id)
values = []
len = StreamIO.read_int(stream)
for i in xrange(len):
values.append(tag_type.read(stream))
return NBTTagList(tag_type, values)
| 25.093333
| 88
| 0.643996
| 245
| 1,882
| 4.469388
| 0.220408
| 0.115068
| 0.090411
| 0.054795
| 0.150685
| 0.150685
| 0.150685
| 0.150685
| 0.122374
| 0.122374
| 0
| 0.002135
| 0.253454
| 1,882
| 74
| 89
| 25.432432
| 0.777224
| 0.010627
| 0
| 0.122449
| 0
| 0
| 0.020419
| 0
| 0
| 0
| 0.002149
| 0
| 0.061224
| 1
| 0.265306
| false
| 0
| 0.061224
| 0.122449
| 0.510204
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
ed5085f9be9c98ff85fd3851495ed53a851d06cd
| 25,960
|
py
|
Python
|
examples/0b02b172-ad67-449b-b4a2-ff645b28c508.py
|
lapaniku/GAS
|
e49ce302689af683da744cd172e0359c0ba0af86
|
[
"MIT"
] | 37
|
2021-12-12T17:36:24.000Z
|
2022-03-12T15:46:56.000Z
|
examples/0b02b172-ad67-449b-b4a2-ff645b28c508.py
|
lapaniku/GAS
|
e49ce302689af683da744cd172e0359c0ba0af86
|
[
"MIT"
] | 1
|
2021-12-19T12:39:10.000Z
|
2021-12-19T12:39:10.000Z
|
examples/0b02b172-ad67-449b-b4a2-ff645b28c508.py
|
lapaniku/GAS
|
e49ce302689af683da744cd172e0359c0ba0af86
|
[
"MIT"
] | 3
|
2021-12-17T17:29:35.000Z
|
2022-03-12T15:26:49.000Z
|
# This program was generated by "Generative Art Synthesizer"
# Generation date: 2021-11-28 09:21:40 UTC
# GAS change date: 2021-11-28 09:20:21 UTC
# GAS md5 hash: ad55481e87ca5a7e9a8e92cd336d1cad
# Python version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# For more information visit: https://github.com/volotat/GAS
#import python libraries
import os #OS version: default
import numpy as np #Numpy version: 1.19.5
from PIL import Image #PIL version: 8.1.2
#set initial params
SIZE = 768
GRID_CHANNELS = 16
def test_values(arr):
if np.isnan(arr).any():
raise Exception('Array has None elements!')
if np.amin(arr) < -1 or np.amax(arr) > 1:
raise Exception('Values went to far! [ %.2f : %.2f ]'%(np.amin(arr), np.amax(arr)) )
return arr
#define grid transformation methods
def transit(x, t_indx, s_indx, alphas):
res = x.copy()
res[:,:,t_indx] = np.sum(x[:,:,s_indx] * alphas, axis = -1)
return test_values(res.clip(-1,1))
def sin(x, t_indx, s_indx, scale = 1, shift = 0):
res = x.copy()
res[:,:,t_indx] = np.sin(x[:,:,s_indx] * 0.5 * np.pi * scale + shift)
return test_values(res)
def magnitude(x, t_indx, s_indx, ord = 2):
res = x.copy()
res[:,:,t_indx] = np.linalg.norm(x[:,:,s_indx], axis = -1, ord = ord) / np.sqrt(len(s_indx))
return test_values(res)
def shift(x, t_indx, s_indx, shift):
res = x.copy()
if shift > 0: res[:,:,t_indx] = (-np.abs(((x[:,:,s_indx] + 1) / 2) ** (1 + shift) - 1) ** (1 / (1 + shift)) + 1) * 2 - 1
if shift < 0: res[:,:,t_indx] = np.abs((1 - (x[:,:,s_indx] + 1) / 2) ** (1 - shift) - 1) ** (1 / (1 - shift)) * 2 - 1
return test_values(res)
def inverse(x, t_indx, s_indx):
res = x.copy()
res[:,:,t_indx] = -x[:,:,s_indx]
return test_values(res)
def smooth_max(x, t_indx, s1_indx, s2_indx, p = 10):
res = x.copy()
res[:,:,t_indx] = np.log((np.exp(x[:,:,s1_indx] * p) + np.exp(x[:,:,s2_indx] * p)) ** (1/p)) / 1.07
return test_values(res)
def smooth_min(x, t_indx, s1_indx, s2_indx, p = 10):
res = x.copy()
res[:,:,t_indx] = -np.log((np.exp(-x[:,:,s1_indx] * p) + np.exp(-x[:,:,s2_indx] * p)) ** (1/p)) / 1.07
return test_values(res)
def prod(x, t_indx, s_indx):
res = x.copy()
res[:,:,t_indx] = np.prod(x[:,:,s_indx], -1)
return test_values(res)
def power(x, t_indx, s_indx, p = 1):
res = x.copy()
res[:,:,t_indx] = np.sign(x[:,:,s_indx]) * np.abs(x[:,:,s_indx]) ** p
return test_values(res)
#set initial grid
grid = np.zeros((SIZE, SIZE, GRID_CHANNELS))
x = ((np.arange(SIZE)/(SIZE-1) - 0.5) * 2).reshape((1, SIZE)).repeat(SIZE, 0)
y = ((np.arange(SIZE)/(SIZE-1) - 0.5) * 2).reshape((SIZE, 1)).repeat(SIZE, 1)
grid[:,:,0] = (x * 0.9386329219527516 + y * -0.45147169454413794) / 2
grid[:,:,1] = (x * 0.8090860808441245 + y * 0.2914526739617249) / 2
grid[:,:,2] = (x * 0.9804797761207309 + y * -0.5063344373124843) / 2
grid[:,:,3] = (x * -0.8484277738516293 + y * -0.5155435342135386) / 2
grid[:,:,4] = (x * -0.6644350461377522 + y * 0.1739322518414499) / 2
grid[:,:,5] = (x * -0.5986715486203882 + y * 0.9515468928881716) / 2
grid[:,:,6] = (x * 0.2265055481768512 + y * 0.4365452266748293) / 2
grid[:,:,7] = (x * 0.5049774961793401 + y * 0.05113255120007798) / 2
grid[:,:,8] = (x * -0.3391983246964396 + y * -0.5135707069423852) / 2
grid[:,:,9] = (x * -0.4075423366723827 + y * 0.5388833863473126) / 2
grid[:,:,10] = (x * -0.4262457935185371 + y * -0.6817079327248272) / 2
grid[:,:,11] = (x * 0.8435706697714382 + y * 0.7746597063144072) / 2
grid[:,:,12] = (x * -0.5303146721156469 + y * -0.41048419195488317) / 2
grid[:,:,13] = (x * -0.5864100240508576 + y * -0.9425245660964123) / 2
grid[:,:,14] = (x * -0.7665883618456049 + y * -0.3867357840809138) / 2
grid[:,:,15] = (x * 0.49037959172682255 + y * -0.7671554143072785) / 2
#apply transformations to the grid
grid = transit(grid, 4, [7, 6, 12, 8, 9, 0, 1], [0.05863158300898051, 0.3467981515651057, 0.262107802795733, 0.038001653167336905, 0.2112967596903696, 0.002128256606899112, 0.08103579316557531])
grid = shift(grid, 3, 3, 2.4622222565241207)
grid = sin(grid, 10, 0, 0.5112825397666086, 37.95950546335726)
grid = sin(grid, 12, 13, 3.6938747278005737, 76.37702042567852)
grid = magnitude(grid, 15, [5, 3, 8, 0, 15], 2)
grid = prod(grid, 2, [3, 11, 1])
grid = smooth_min(grid, 3, 2, 7)
grid = smooth_max(grid, 8, 10, 6)
grid = prod(grid, 3, [2, 6, 10, 7, 4])
grid = smooth_min(grid, 7, 12, 0)
grid = transit(grid, 2, [1, 2], [0.9078557995211777, 0.09214420047882232])
grid = smooth_max(grid, 1, 0, 1)
grid = sin(grid, 9, 4, 3.0281102269529683, 11.185401112275173)
grid = sin(grid, 10, 4, 1.2844464834351186, -45.836492724169695)
grid = sin(grid, 1, 2, -1.5301674594368837, -60.29431568717391)
grid = transit(grid, 2, [13, 11, 5], [0.421270391024163, 0.5054038923567993, 0.07332571661903758])
grid = transit(grid, 11, [1, 15, 5, 0, 6, 12, 2, 7, 4], [0.03047869593495055, 0.024092687676923453, 0.02665655056773558, 0.17667886361751853, 0.15211061797378253, 0.016462544099609754, 0.0072484377164178625, 0.4477791048998878, 0.11849249751317383])
grid = transit(grid, 10, [5, 11, 15, 8, 2, 13, 12, 3, 6], [0.1020239434902293, 0.05405846145210329, 0.11525379082942891, 0.11556721863292163, 0.12372657123165616, 0.1356897031789931, 0.20047556686480725, 0.09921434949484752, 0.05399039482501285])
grid = transit(grid, 9, [5], [1.0])
grid = transit(grid, 15, [12, 0, 1, 11], [0.01847979792505241, 0.33442336387003857, 0.15192425697494277, 0.4951725812299663])
grid = sin(grid, 4, 8, 3.386521226555936, 60.95572898751007)
grid = shift(grid, 14, 2, 2.55681173849493)
grid = sin(grid, 10, 14, 0.8649185298731181, 3.1973516320924773)
grid = sin(grid, 9, 7, -2.4657577404884132, 72.95418196004374)
grid = transit(grid, 12, [7, 4, 10, 5], [0.5076634403621766, 0.003404332378773421, 0.04142944289977586, 0.4475027843592742])
grid = inverse(grid, 4, 5)
grid = transit(grid, 1, [4, 14, 0, 13], [0.2785496566747933, 0.004915230889640017, 0.30146401859790545, 0.4150710938376613])
grid = sin(grid, 3, 11, -6.496603906160505, -73.75617586359363)
grid = transit(grid, 6, [6, 14], [0.7201753385758813, 0.2798246614241187])
grid = prod(grid, 4, [10, 0, 2, 4, 8, 5, 6, 7])
grid = transit(grid, 8, [3], [1.0])
grid = inverse(grid, 8, 5)
grid = smooth_max(grid, 10, 5, 13)
grid = sin(grid, 9, 10, -1.8565532127479274, -54.75186223635349)
grid = transit(grid, 10, [14], [1.0])
grid = transit(grid, 15, [11, 4, 10], [0.6926745567135898, 0.1831142410590532, 0.12421120222735695])
grid = magnitude(grid, 7, [6, 12, 7, 13, 8], 2)
grid = transit(grid, 8, [3, 15, 9, 6, 11], [0.036102265915692405, 0.1224495166624379, 0.2384660328868578, 0.3357862916746864, 0.2671958928603256])
grid = smooth_min(grid, 1, 1, 11)
grid = transit(grid, 5, [11, 4, 2, 1, 13, 12, 0, 8], [0.08486049729383285, 0.15069099224942706, 0.024923245737924458, 0.07191051851248272, 0.25942601829807205, 0.16834508849259286, 0.14540219911263502, 0.094441440303033])
grid = transit(grid, 11, [12], [1.0])
grid = power(grid, 3, 5, 0.10200689258338674)
grid = transit(grid, 2, [10, 11, 4, 15, 0, 6], [0.24973877983541862, 0.3378766591098989, 0.15974656746239488, 0.027776085211312595, 0.02330072841260748, 0.20156117996836745])
grid = smooth_min(grid, 0, 5, 1)
grid = magnitude(grid, 0, [5, 0], 2)
grid = transit(grid, 6, [15, 8], [0.5303803951305812, 0.4696196048694189])
grid = inverse(grid, 0, 0)
grid = magnitude(grid, 13, [8], 2)
grid = transit(grid, 13, [15, 5, 9, 4, 6, 12], [0.18067242214638962, 0.12939497982917472, 0.08164480089591167, 0.24583958083442445, 0.2244518823086713, 0.13799633398542827])
grid = transit(grid, 11, [0], [1.0])
grid = magnitude(grid, 0, [4, 13], 2)
grid = transit(grid, 8, [5, 4, 15, 6, 14, 0, 3, 11], [0.13835365002720226, 0.008781149737259792, 0.24627334258742545, 0.04870190081124998, 0.049950480577274, 0.15123046752435387, 0.31255198044446264, 0.04415702829077187])
grid = transit(grid, 1, [3], [1.0])
grid = magnitude(grid, 14, [4], 2)
grid = sin(grid, 1, 5, 8.18216846853571, -6.729427492311089)
grid = magnitude(grid, 11, [8, 2], 2)
grid = transit(grid, 7, [12, 11, 13, 4], [0.1713900685471786, 0.14082681623065177, 0.19859698568682838, 0.4891861295353413])
grid = transit(grid, 13, [12, 15, 9, 2, 0, 1, 5], [0.18796556626817826, 0.19260744772691155, 0.11226112831146452, 0.08161640805634696, 0.08706050582840198, 0.2243337708440404, 0.11415517296465624])
grid = sin(grid, 11, 13, -6.909579361872105, 70.84834564082374)
grid = transit(grid, 2, [11, 7, 13], [0.3629247592109436, 0.10073172896374764, 0.5363435118253088])
grid = sin(grid, 1, 5, 0.6814927249849106, 30.75954926767548)
grid = inverse(grid, 8, 7)
grid = prod(grid, 10, [5, 2])
grid = transit(grid, 15, [0, 3], [0.29345909580747953, 0.7065409041925205])
grid = sin(grid, 12, 4, -1.6398586072056767, 84.51374680259704)
grid = sin(grid, 1, 1, -0.183401440709518, -88.40242580975152)
grid = transit(grid, 12, [3, 13, 2, 9, 0], [0.24803411847529433, 0.2425397323068922, 0.0904752958055755, 0.11683555248582808, 0.30211530092641004])
grid = sin(grid, 5, 2, -2.2972705471452146, -12.522748365129786)
grid = smooth_min(grid, 12, 9, 11)
grid = sin(grid, 4, 15, -1.9527829039221054, 20.537776250912316)
grid = transit(grid, 7, [11, 9, 2], [0.5001532946669459, 0.42070604285213226, 0.07914066248092186])
grid = inverse(grid, 5, 12)
grid = sin(grid, 10, 2, 0.9155140652310594, -34.1653400637653)
grid = transit(grid, 8, [14], [1.0])
grid = transit(grid, 4, [1, 12, 15, 13, 3], [0.32356965941479515, 0.022696478437764827, 0.2132573540073865, 0.11957266769813353, 0.3209038404419199])
grid = transit(grid, 6, [1, 7, 0, 2, 9, 4, 8], [0.06904450551777742, 0.12680650314665426, 0.1756104206123629, 0.013987480750913602, 0.1337935702206657, 0.39097327478734406, 0.08978424496428203])
grid = smooth_min(grid, 9, 9, 10)
grid = shift(grid, 8, 1, -0.2952350240798842)
grid = sin(grid, 11, 6, 1.576100090732909, -21.508000199215132)
grid = shift(grid, 11, 5, 1.0526879494498724)
grid = transit(grid, 1, [14], [1.0])
grid = transit(grid, 8, [9, 10, 2, 15, 13], [0.3265190472987195, 0.21568397721657098, 0.06226802479442838, 0.0028158122366541832, 0.39271313845362693])
grid = magnitude(grid, 11, [13, 10, 12, 2, 11, 14], 2)
grid = transit(grid, 12, [8, 11, 3], [0.2717231795161624, 0.38648847983305307, 0.3417883406507845])
grid = transit(grid, 15, [7, 3], [0.9172074355564371, 0.08279256444356292])
grid = transit(grid, 13, [1, 2, 7, 5, 8, 9, 15], [0.085742434722219, 0.4119764535375412, 0.08377067725345017, 0.13045782410775286, 0.02917564277599849, 0.12489006625007311, 0.13398690135296518])
grid = transit(grid, 2, [2, 0, 11, 10, 5, 4, 15, 13], [0.1869735689344564, 0.06343641920215143, 0.038951322931441136, 0.04613309733662021, 0.19750663742298355, 0.16072124228620793, 0.15869932715876592, 0.14757838472737334])
grid = transit(grid, 2, [1, 7], [0.18247956114317448, 0.8175204388568255])
grid = transit(grid, 8, [11, 15, 0], [0.08195235243098883, 0.6796005904358621, 0.23844705713314918])
grid = power(grid, 14, 0, 0.10854801586669052)
grid = shift(grid, 8, 9, 2.766857264282361)
grid = transit(grid, 3, [6, 14, 0, 3, 15, 4, 2, 11, 13], [0.03597236183123865, 0.04938629068404894, 0.08457069101219464, 0.014801187461296406, 0.3649334871683411, 0.28062233683539095, 0.08637063851194285, 0.06076815802338077, 0.022574848472165728])
grid = transit(grid, 4, [11, 4, 15, 10, 8, 5, 2, 3], [0.23701292672659616, 0.08316792464084911, 0.017867439461611043, 0.36417402420248035, 0.02841485585755143, 0.19916101840344472, 0.03422984110049058, 0.03597196960697647])
grid = magnitude(grid, 13, [11, 7], 2)
grid = sin(grid, 4, 8, 4.28026157040775, -75.14180284322572)
grid = prod(grid, 3, [14, 15])
grid = inverse(grid, 5, 5)
grid = transit(grid, 4, [8, 4, 15, 9, 10], [0.10267794314653868, 0.019022820046952493, 0.061606568183823145, 0.4832751235896067, 0.33341754503307897])
grid = transit(grid, 13, [10, 8, 9, 12, 2], [0.031587088727564654, 0.024264739611302585, 0.0306940545567164, 0.19611241111174804, 0.7173417059926683])
grid = transit(grid, 0, [7, 1, 11, 0, 15], [0.036901331671075975, 0.5054281720479712, 0.13288430351514774, 0.10820806749406277, 0.21657812527174225])
grid = transit(grid, 3, [7, 3, 12, 9], [0.13643904772292245, 0.38438336340747, 0.15936221296996333, 0.31981537589964426])
grid = sin(grid, 10, 3, -2.5681840787633137, -30.256455817944243)
grid = sin(grid, 8, 2, 3.501615294498545, -75.50049353340206)
grid = prod(grid, 9, [1, 4, 0, 6])
grid = transit(grid, 8, [9, 3], [0.30088974760959275, 0.6991102523904072])
grid = transit(grid, 8, [2, 11, 15, 4, 1, 0, 14], [0.29712982335534416, 0.2526657169525107, 0.08415696601637544, 0.18541009701166816, 0.011062110917544764, 0.017334502896306194, 0.1522407828502505])
grid = prod(grid, 2, [8, 7, 11, 10, 15, 0, 5])
grid = transit(grid, 11, [7, 2, 3, 9, 5], [0.24039798004748805, 0.2886075990223525, 0.18742374307846998, 0.11615833154358073, 0.16741234630810867])
grid = prod(grid, 0, [0, 1, 2, 14])
grid = prod(grid, 9, [10, 11, 8, 15, 0, 12, 3])
grid = transit(grid, 13, [5, 15, 10], [0.13237609957996088, 0.22944646977966682, 0.6381774306403722])
grid = transit(grid, 6, [15], [1.0])
grid = sin(grid, 15, 0, -0.033265790773207085, 51.94880270063618)
grid = smooth_min(grid, 13, 10, 15)
grid = transit(grid, 1, [12, 8, 10, 4, 2], [0.43102537693091664, 0.25433300797798253, 0.21618454566402304, 0.046743011673522995, 0.05171405775355483])
grid = sin(grid, 10, 10, 0.9558311639914843, -47.618914508652054)
grid = shift(grid, 9, 8, -1.1449289879251126)
grid = transit(grid, 7, [4, 10, 1, 13, 5, 0, 7, 8, 9, 12, 6, 11, 14], [0.10006330804326793, 0.03891760159161208, 0.005474465860804227, 0.12962618248625338, 0.03090992138168193, 0.016043163973997736, 0.13259375374543056, 0.09920705802758992, 0.1415090600653345, 0.09597789664069131, 0.06106766497801195, 0.14032187015082653, 0.008288053054498123])
grid = prod(grid, 15, [12, 15])
grid = prod(grid, 8, [11, 7, 4, 12])
grid = transit(grid, 7, [15, 6, 2, 7], [0.45073658968521574, 0.16060948991238613, 0.12949271785123345, 0.2591612025511646])
grid = transit(grid, 10, [11, 4, 2, 8, 14], [0.3705316303566195, 0.1755951969700656, 0.043989590834687294, 0.22866693087969006, 0.1812166509589377])
grid = sin(grid, 4, 2, -3.329894296119046, -76.41676919069447)
grid = smooth_min(grid, 11, 8, 12)
grid = transit(grid, 1, [1, 14, 8], [0.38986786543390084, 0.40057743619803005, 0.20955469836806906])
grid = transit(grid, 9, [5], [1.0])
grid = shift(grid, 9, 13, -5.367438086043798)
grid = magnitude(grid, 13, [2, 0], 2)
grid = transit(grid, 13, [6, 2, 3, 15, 5, 7], [0.06492287400539203, 0.21223490901058306, 0.36311130408652753, 0.09994467226348329, 0.12833432959710458, 0.1314519110369097])
grid = transit(grid, 8, [6, 2], [0.6857167761482571, 0.31428322385174284])
grid = shift(grid, 6, 15, 4.115946851379848)
grid = transit(grid, 15, [13, 3], [0.5897775709748927, 0.41022242902510725])
grid = sin(grid, 12, 14, 1.097917736937588, 58.87772371184383)
grid = transit(grid, 11, [9, 11], [0.37033495928182997, 0.6296650407181701])
grid = smooth_min(grid, 4, 1, 8)
grid = sin(grid, 4, 4, 3.47544933993972, -37.11795195118333)
grid = sin(grid, 11, 7, -0.3409112713023047, 75.93313567333723)
grid = transit(grid, 11, [5, 10, 7], [0.22694849313985146, 0.5162695719847235, 0.25678193487542517])
grid = sin(grid, 9, 9, -4.261918262131112, 18.680580924548693)
grid = smooth_max(grid, 2, 2, 11)
grid = sin(grid, 13, 13, 7.718114740496995, 55.242200715207815)
grid = sin(grid, 12, 10, -3.1151555334821888, 17.571856948335267)
grid = prod(grid, 6, [2, 4, 13])
grid = transit(grid, 5, [1, 9, 3, 10, 4], [0.24075568684771534, 0.02527375632067568, 0.4828116495090197, 0.09546712897709621, 0.15569177834549294])
grid = sin(grid, 6, 3, -0.1377650382373763, -96.34412250071645)
grid = sin(grid, 7, 3, 1.6405444007982959, -37.09230830685477)
grid = transit(grid, 9, [8], [1.0])
grid = sin(grid, 5, 10, -1.5052434957207308, 24.900059771988836)
grid = sin(grid, 8, 10, 2.5947698108630664, -90.74050288622541)
grid = sin(grid, 9, 8, -0.8743741598911887, 15.92872484723533)
grid = transit(grid, 4, [3, 13, 9, 8, 5, 2, 12], [0.05731677054419865, 0.08527765171582982, 0.33929504571762287, 0.1932983536368378, 0.0036374435750729187, 0.12289545051895708, 0.19827928429148084])
grid = transit(grid, 8, [13, 9, 5, 7, 14], [0.05801706264076675, 0.341923243761946, 0.0494872820880747, 0.29583940098242745, 0.2547330105267852])
grid = inverse(grid, 11, 5)
grid = magnitude(grid, 14, [4, 6, 1, 0], 2)
grid = transit(grid, 13, [11, 0], [0.6569516962992897, 0.3430483037007103])
grid = sin(grid, 14, 5, 0.053526366336325744, 4.147364704932215)
grid = transit(grid, 4, [3], [1.0])
grid = sin(grid, 3, 12, -4.078686662791614, 24.459526349523884)
grid = inverse(grid, 15, 10)
grid = shift(grid, 6, 1, -1.115193397983063)
grid = smooth_max(grid, 13, 3, 8)
grid = transit(grid, 13, [13, 0, 5, 14], [0.09662806703796267, 0.1621478194912538, 0.21548762580464817, 0.5257364876661353])
grid = inverse(grid, 1, 0)
grid = smooth_max(grid, 1, 15, 12)
grid = prod(grid, 11, [3])
grid = smooth_max(grid, 8, 11, 15)
grid = sin(grid, 12, 6, -3.621533174445339, 24.02414911462421)
grid = sin(grid, 1, 11, 0.5071121900678415, 10.950101187785563)
grid = shift(grid, 13, 3, 5.677279514103952)
grid = transit(grid, 3, [15, 11, 2, 8, 0], [0.28772794692354614, 0.1935939805514465, 0.06024872230823076, 0.13457223936247906, 0.32385711085429764])
grid = transit(grid, 1, [7, 2, 6, 1, 4, 0], [0.2070905138265326, 0.06562120796792839, 0.17355051228662716, 0.05514926535269553, 0.0829726599151083, 0.41561584065110807])
grid = transit(grid, 2, [0, 4, 2], [0.010597803396528332, 0.7371576932264431, 0.25224450337702853])
grid = sin(grid, 11, 8, 4.303514875116891, -67.11152580467314)
grid = prod(grid, 5, [3, 9, 2])
grid = sin(grid, 5, 1, 2.0751861425380627, 63.37681521624819)
grid = smooth_min(grid, 11, 10, 9)
grid = sin(grid, 13, 2, 4.295107938126156, 57.378601701270014)
grid = sin(grid, 10, 2, -0.010214061334835559, 20.43114218394348)
grid = transit(grid, 8, [1], [1.0])
grid = sin(grid, 4, 9, 0.2366252211469413, -40.63773874328931)
grid = sin(grid, 9, 15, -2.507870105026106, -89.43842740853354)
grid = transit(grid, 0, [12, 6, 4, 9, 1, 0, 14], [0.36336761526831185, 0.17372789204937897, 0.08036453739500136, 0.09747098994785518, 0.040818441056887325, 0.16796111771248814, 0.07628940657007711])
grid = transit(grid, 3, [11, 1, 12, 9, 0, 8, 15, 2, 10, 14], [0.20381942291270427, 0.07753380798970702, 0.11445683149439734, 0.08475226158626031, 0.1416941580568898, 0.020968563089492034, 0.0847896752697893, 0.0921589665387646, 0.008240731277180186, 0.17158558178481512])
grid = transit(grid, 5, [11, 10], [0.9817011300708863, 0.018298869929113594])
grid = sin(grid, 14, 8, -0.4693746108213766, -98.17810769380118)
grid = sin(grid, 12, 10, 3.6427863324838423, 99.297524709649)
grid = sin(grid, 5, 14, -1.45141083652418, -99.85812912291547)
grid = transit(grid, 0, [4, 3, 8], [0.23275058190778222, 0.49901982570530873, 0.2682295923869092])
grid = magnitude(grid, 8, [10, 9, 12, 4, 7, 15], 2)
grid = sin(grid, 12, 7, 1.439019575760617, 13.126437741104823)
grid = transit(grid, 10, [15, 8, 13, 2], [0.32464063956303774, 0.20922781529873477, 0.16179927966914437, 0.30433226546908315])
grid = magnitude(grid, 6, [14, 5, 13, 11, 2, 9], 2)
grid = sin(grid, 9, 5, -5.606152225672729, -35.928477282758536)
grid = transit(grid, 0, [7, 11, 15, 8, 12, 0, 4, 14, 3, 5], [0.11084510086381213, 0.003439701966452383, 0.10819642722960272, 0.15371289739415475, 0.25812192912399506, 0.005727171643985687, 0.14633649245899077, 0.033890406689391105, 0.05550396325806974, 0.1242259093715456])
grid = smooth_max(grid, 10, 15, 10)
grid = transit(grid, 11, [9, 0, 11, 7, 3, 8], [0.03500911832175082, 0.03265868671024263, 0.3248025339288217, 0.4234363710484886, 0.13338109758306646, 0.050712192407629864])
grid = transit(grid, 7, [14, 2, 13, 1, 11, 3, 8, 7], [0.207462236904601, 0.11516125867317799, 0.12240760599022518, 0.05066197369764289, 0.13869178538077429, 0.09948828746526778, 0.16686217850764798, 0.09926467338066268])
grid = transit(grid, 6, [6, 13, 7], [0.16813621041531998, 0.42150135317124293, 0.410362436413437])
grid = inverse(grid, 6, 6)
grid = sin(grid, 7, 15, -4.9164570678736865, 86.15931416043557)
grid = sin(grid, 1, 7, 1.6265187305620117, -97.13150019385894)
grid = transit(grid, 11, [0, 9], [0.1290607634325389, 0.8709392365674611])
grid = transit(grid, 14, [14, 13, 15], [0.530662002197574, 0.1082014600047566, 0.36113653779766947])
grid = transit(grid, 14, [10, 14, 4, 9, 13, 6], [0.3199750359220948, 0.07376266150860299, 0.03622483092076182, 0.09070212266434277, 0.4030414045204916, 0.07629394446370606])
grid = magnitude(grid, 13, [7, 4, 15], 2)
grid = transit(grid, 13, [6, 15, 11, 9, 12], [0.21908823570589997, 0.1636179110868493, 0.03797238284324163, 0.29532957711092916, 0.2839918932530799])
grid = sin(grid, 4, 3, 2.634465399239887, 62.07538440217337)
grid = sin(grid, 7, 2, 3.41043792019894, 65.36615977552518)
grid = transit(grid, 0, [14, 3, 11, 10, 7], [0.5203714128788618, 0.068511863728177, 0.10141059844877331, 0.2728285912351676, 0.036877533709020166])
grid = transit(grid, 7, [11], [1.0])
grid = transit(grid, 5, [9, 13, 3, 14], [0.28064413535886806, 0.5181512474389621, 0.1504742947642479, 0.050730322437922])
grid = prod(grid, 1, [12, 13])
grid = sin(grid, 6, 14, -1.927951619591129, -65.3028706482776)
grid = prod(grid, 14, [13])
grid = sin(grid, 1, 12, -0.5111321725063378, 18.261359970959475)
grid = power(grid, 6, 5, 0.9223892145169746)
grid = transit(grid, 2, [9, 11, 10], [0.2662646690994658, 0.2460545507972383, 0.4876807801032959])
grid = transit(grid, 2, [7], [1.0])
grid = sin(grid, 10, 9, 6.219381309190064, -71.03631884776823)
grid = sin(grid, 9, 6, 1.6821417847846682, -64.12547446801875)
grid = sin(grid, 13, 3, -0.15800274281797377, 90.63950889076133)
grid = sin(grid, 14, 14, -1.842523240371888, 74.23947694195837)
grid = inverse(grid, 7, 8)
grid = smooth_max(grid, 10, 3, 15)
grid = magnitude(grid, 9, [15, 7], 2)
grid = transit(grid, 4, [4, 12, 14, 15, 7, 1], [0.20378471182464508, 0.038241020379710625, 0.16903312106740406, 0.3387613981701764, 0.11303295854369695, 0.13714679001436697])
grid = transit(grid, 4, [14, 11, 12, 13, 4, 7], [0.23221079251346607, 0.3307147367708056, 0.26199556841553734, 0.018127231672754242, 0.13788777275073352, 0.01906389787670339])
grid = sin(grid, 4, 7, 3.7705302330112063, 56.91558505626969)
grid = sin(grid, 3, 9, 1.4275963527158242, -76.78247379244436)
grid = sin(grid, 2, 5, -5.225820110717917, 57.71107021356826)
grid = transit(grid, 2, [12], [1.0])
grid = prod(grid, 14, [11, 10])
grid = transit(grid, 2, [0, 15, 10], [0.005204838856346087, 0.5116602651328436, 0.48313489601081044])
grid = transit(grid, 10, [10], [1.0])
grid = transit(grid, 1, [8, 10, 15, 14, 9], [0.33493798319460544, 0.14040206011900094, 0.3010385316537353, 0.07412413198773361, 0.14949729304492473])
grid = magnitude(grid, 10, [11, 0, 5], 2)
grid = magnitude(grid, 9, [15, 3, 11, 0, 14], 2)
grid = sin(grid, 4, 5, -1.8457292172108153, -53.43885199947502)
grid = sin(grid, 10, 0, 7.741409383532979, -12.082110529508299)
grid = prod(grid, 11, [9])
grid = sin(grid, 4, 3, 0.10154488887533689, 12.479110491961137)
grid = magnitude(grid, 1, [7], 2)
grid = smooth_min(grid, 7, 4, 13)
grid = magnitude(grid, 5, [7], 2)
grid = transit(grid, 6, [9, 11, 2, 13], [0.381505247910628, 0.12073241493361198, 0.3454992433435407, 0.15226309381221942])
grid = magnitude(grid, 10, [7, 15, 5], 2)
grid = magnitude(grid, 9, [12, 14, 4], 2)
grid = shift(grid, 3, 9, 3.0393348894939773)
grid = shift(grid, 2, 4, 2.1961962516242517)
grid = prod(grid, 15, [3, 5, 0, 1])
grid = sin(grid, 6, 11, -0.7697482296056479, 23.55348445076298)
grid = sin(grid, 7, 7, 0.5492744322205282, 35.873568370773654)
grid = transit(grid, 7, [13], [1.0])
grid = sin(grid, 3, 12, 6.470760426148978, -53.62090724330151)
grid = sin(grid, 10, 10, 0.7827958631857042, -90.82177259964699)
grid = transit(grid, 6, [8, 6, 5, 7, 4, 2], [0.39579476392315127, 0.3200094081197146, 0.06439062651950353, 0.03284446726347166, 0.04732779189481446, 0.13963294227934445])
grid = smooth_min(grid, 0, 13, 15)
grid = smooth_max(grid, 5, 8, 4)
grid = transit(grid, 10, [1], [1.0])
grid = transit(grid, 15, [15], [1.0])
grid = prod(grid, 13, [6, 3, 7])
grid = sin(grid, 0, 3, -3.561651028660104, 11.539889679902203)
grid = power(grid, 10, 5, 0.12539493928522222)
grid = power(grid, 0, 12, 2.5526439221510495)
grid = sin(grid, 4, 10, -3.680544885171134, 30.633332441673872)
grid = transit(grid, 11, [12, 6, 9], [0.1597221050818672, 0.523275926379751, 0.31700196853838186])
grid = sin(grid, 14, 7, 5.409920766787869, -58.09956716630187)
grid = sin(grid, 2, 15, -2.5319898824657017, -45.01904701883333)
grid = shift(grid, 5, 5, 3.1584260780059252)
grid = transit(grid, 10, [9, 8], [0.7777441717493406, 0.22225582825065934])
grid = transit(grid, 3, [9], [1.0])
grid = transit(grid, 11, [2], [1.0])
#create color space
def shift_colors(x, shift):
res = x.copy()
for i in range(x.shape[-1]):
if shift[i] > 0: res[:,:,i] = (-np.abs(((x[:,:,i] + 1) / 2) ** (1 + shift[i]) - 1) ** (1 / (1 + shift[i])) + 1) * 2 - 1
if shift[i] < 0: res[:,:,i] = np.abs((1 - (x [:,:,i]+ 1) / 2) ** (1 - shift[i]) - 1) ** (1 / (1 - shift[i])) * 2 - 1
return test_values(res)
res = np.zeros((SIZE, SIZE, 3))
res += shift_colors(grid[:,:,0:1].repeat(3, -1), [1.9355805467383669, 1.4677093499726706, 1.2451388311186942])
res = res / 1
res = ((res + 1) / 2 * 255).clip(0,255)
#save results
im = Image.fromarray(np.uint8(res))
im.save(os.path.basename(__file__) + '.png')
#save layers
img = np.zeros((SIZE * 4, SIZE * 4))
for j in range(GRID_CHANNELS):
x = j % 4
y = j // 4
img[x*SIZE:(x + 1)*SIZE, y*SIZE:(y+1)*SIZE] = grid[:,:,j]
img = (img + 1) * 127.5
im = Image.fromarray(np.uint8(img))
im.save(os.path.basename(__file__) + '_layers.png')
| 64.9
| 346
| 0.689908
| 3,816
| 25,960
| 4.669025
| 0.211478
| 0.064826
| 0.088399
| 0.01145
| 0.135545
| 0.063535
| 0.037492
| 0.028512
| 0.023573
| 0.018409
| 0
| 0.536433
| 0.130894
| 25,960
| 399
| 347
| 65.062657
| 0.253258
| 0.022265
| 0
| 0.058496
| 1
| 0
| 0.002918
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.030641
| false
| 0
| 0.008357
| 0
| 0.069638
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
ed6da0909e41c7d13eeccbce6856b66ed6774782
| 1,273
|
py
|
Python
|
yudzuki/role.py
|
LunaProject-Discord/yudzuki.py
|
7ff2d1f9e39ed5300a46c48fb95df50046814ede
|
[
"MIT"
] | 6
|
2021-04-29T12:48:55.000Z
|
2021-06-25T06:54:37.000Z
|
yudzuki/role.py
|
LunaProject-Discord/yudzuki.py
|
7ff2d1f9e39ed5300a46c48fb95df50046814ede
|
[
"MIT"
] | null | null | null |
yudzuki/role.py
|
LunaProject-Discord/yudzuki.py
|
7ff2d1f9e39ed5300a46c48fb95df50046814ede
|
[
"MIT"
] | null | null | null |
__all__ = (
"Role",
)
class Role:
def __init__(self, data):
self.data = data
self._update(data)
def _get_json(self):
return self.data
def __repr__(self):
return (
f"<Role id={self.id} name={self.name}>"
)
def __str__(self):
return (
f"{self.name}"
)
def _update(self, data):
self._id = data["id"]
self._color = data["color"]
self._managed = data["managed"]
self._name = data["name"]
self._guild_id = data["guild_id"]
self._mentionable = data["mentionable"]
self._position = data["potition"]
self._hoisted = data["hoisted"]
@property
def id(self):
return self._id
@property
def color(self):
return self._color
@property
def managed(self):
return self._managed
@property
def name(self):
return self._name
@property
def guild_id(self):
return self._guild_id
@property
def mentionable(self):
return self._mentionable
@property
def position(self):
return self._position
@property
def hoisted(self):
return self._hoisted
| 19.584615
| 51
| 0.531815
| 136
| 1,273
| 4.683824
| 0.176471
| 0.172684
| 0.197802
| 0.050235
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.358995
| 1,273
| 64
| 52
| 19.890625
| 0.780637
| 0
| 0
| 0.2
| 0
| 0
| 0.080911
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.26
| false
| 0
| 0
| 0.22
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 3
|
ed79d1c413293473a8ee91b105de6df7218762d5
| 1,865
|
py
|
Python
|
var/spack/repos/builtin/packages/r-multicool/package.py
|
varioustoxins/spack
|
cab0e4cb240f34891a6d753f3393e512f9a99e9a
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null |
var/spack/repos/builtin/packages/r-multicool/package.py
|
varioustoxins/spack
|
cab0e4cb240f34891a6d753f3393e512f9a99e9a
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 6
|
2022-01-08T08:41:11.000Z
|
2022-03-14T19:28:07.000Z
|
var/spack/repos/builtin/packages/r-multicool/package.py
|
foeroyingur/spack
|
5300cbbb2e569190015c72d0970d25425ea38647
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RMulticool(RPackage):
"""Permutations of multisets in cool-lex order
A set of tools to permute multisets without loops or hash tables and to
generate integer partitions. The permutation functions are based on C code
from Aaron Williams. Cool-lex order is similar to colexicographical order.
The algorithm is described in Williams, A. (2009)
<DOI:10.1145/1496770.1496877> Loopless Generation of Multiset Permutations
by Prefix Shifts. Symposium on Discrete Algorithms, New York, United
States. The permutation code is distributed without restrictions. The code
for stable and efficient computation of multinomial coefficients comes from
Dave Barber. The code can be download from
<http://tamivox.org/dave/multinomial/code.html> and is distributed without
conditions. The package also generates the integer partitions of a
positive, non-zero integer n. The C++ code for this is based on Python code
from Jerome Kelleher which can be found here
<https://jeromekelleher.net/tag/integer-partitions.html>. The C++ code and
Python code are distributed without conditions."""
homepage = "https://cloud.r-project.org/package=multicool"
url = "https://cloud.r-project.org/src/contrib/Archive/multicool/multicool_0.1-9.tar.gz"
list_url = "https://cloud.r-project.org/src/contrib/Archive/multicool/Archive/multicool"
version('0.1-10', sha256='5bb0cb0d9eb64420c862877247a79bb0afadacfe23262ec8c3fa26e5e34d6ff9')
version('0.1-9', sha256='bdf92571cef1b649952d155395a92b8683099ee13114f73a9d41fc5d7d49d329')
depends_on('[email protected]:', type=('build', 'run'))
| 51.805556
| 97
| 0.759249
| 254
| 1,865
| 5.562992
| 0.566929
| 0.036093
| 0.023355
| 0.038217
| 0.085633
| 0.070771
| 0.070771
| 0.070771
| 0.070771
| 0.070771
| 0
| 0.084444
| 0.155496
| 1,865
| 35
| 98
| 53.285714
| 0.812698
| 0.659517
| 0
| 0
| 0
| 0.25
| 0.637809
| 0.226148
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.125
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
ed87f843694726a8943e8ca3120951277107fd9a
| 108,939
|
gyp
|
Python
|
net/net.gyp
|
codenote/chromium-test
|
0637af0080f7e80bf7d20b29ce94c5edc817f390
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
net/net.gyp
|
codenote/chromium-test
|
0637af0080f7e80bf7d20b29ce94c5edc817f390
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
net/net.gyp
|
codenote/chromium-test
|
0637af0080f7e80bf7d20b29ce94c5edc817f390
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1
|
2020-11-04T07:25:45.000Z
|
2020-11-04T07:25:45.000Z
|
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
'linux_link_kerberos%': 0,
'conditions': [
['chromeos==1 or OS=="android" or OS=="ios"', {
# Disable Kerberos on ChromeOS, Android and iOS, at least for now.
# It needs configuration (krb5.conf and so on).
'use_kerberos%': 0,
}, { # chromeos == 0
'use_kerberos%': 1,
}],
['OS=="android" and target_arch != "ia32"', {
# The way the cache uses mmap() is inefficient on some Android devices.
# If this flag is set, we hackily avoid using mmap() in the disk cache.
# We are pretty confident that mmap-ing the index would not hurt any
# existing x86 android devices, but we cannot be so sure about the
# variety of ARM devices. So enable it for x86 only for now.
'posix_avoid_mmap%': 1,
}, {
'posix_avoid_mmap%': 0,
}],
['OS=="ios"', {
# Websockets and socket stream are not used on iOS.
'enable_websockets%': 0,
# iOS does not use V8.
'use_v8_in_net%': 0,
'enable_built_in_dns%': 0,
}, {
'enable_websockets%': 1,
'use_v8_in_net%': 1,
'enable_built_in_dns%': 1,
}],
],
},
'includes': [
'../build/win_precompile.gypi',
],
'targets': [
{
'target_name': 'net',
'type': '<(component)',
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../crypto/crypto.gyp:crypto',
'../sdch/sdch.gyp:sdch',
'../third_party/icu/icu.gyp:icui18n',
'../third_party/icu/icu.gyp:icuuc',
'../third_party/zlib/zlib.gyp:zlib',
'net_resources',
],
'sources': [
'android/cert_verify_result_android.h',
'android/cert_verify_result_android_list.h',
'android/gurl_utils.cc',
'android/gurl_utils.h',
'android/keystore.cc',
'android/keystore.h',
'android/keystore_openssl.cc',
'android/keystore_openssl.h',
'android/net_jni_registrar.cc',
'android/net_jni_registrar.h',
'android/network_change_notifier_android.cc',
'android/network_change_notifier_android.h',
'android/network_change_notifier_delegate_android.cc',
'android/network_change_notifier_delegate_android.h',
'android/network_change_notifier_factory_android.cc',
'android/network_change_notifier_factory_android.h',
'android/network_library.cc',
'android/network_library.h',
'base/address_family.h',
'base/address_list.cc',
'base/address_list.h',
'base/address_tracker_linux.cc',
'base/address_tracker_linux.h',
'base/auth.cc',
'base/auth.h',
'base/backoff_entry.cc',
'base/backoff_entry.h',
'base/bandwidth_metrics.cc',
'base/bandwidth_metrics.h',
'base/big_endian.cc',
'base/big_endian.h',
'base/cache_type.h',
'base/completion_callback.h',
'base/connection_type_histograms.cc',
'base/connection_type_histograms.h',
'base/crypto_module.h',
'base/crypto_module_nss.cc',
'base/crypto_module_openssl.cc',
'base/data_url.cc',
'base/data_url.h',
'base/directory_lister.cc',
'base/directory_lister.h',
'base/dns_reloader.cc',
'base/dns_reloader.h',
'base/dns_util.cc',
'base/dns_util.h',
'base/escape.cc',
'base/escape.h',
'base/expiring_cache.h',
'base/file_stream.cc',
'base/file_stream.h',
'base/file_stream_context.cc',
'base/file_stream_context.h',
'base/file_stream_context_posix.cc',
'base/file_stream_context_win.cc',
'base/file_stream_metrics.cc',
'base/file_stream_metrics.h',
'base/file_stream_metrics_posix.cc',
'base/file_stream_metrics_win.cc',
'base/file_stream_net_log_parameters.cc',
'base/file_stream_net_log_parameters.h',
'base/file_stream_whence.h',
'base/filter.cc',
'base/filter.h',
'base/int128.cc',
'base/int128.h',
'base/gzip_filter.cc',
'base/gzip_filter.h',
'base/gzip_header.cc',
'base/gzip_header.h',
'base/hash_value.cc',
'base/hash_value.h',
'base/host_mapping_rules.cc',
'base/host_mapping_rules.h',
'base/host_port_pair.cc',
'base/host_port_pair.h',
'base/io_buffer.cc',
'base/io_buffer.h',
'base/ip_endpoint.cc',
'base/ip_endpoint.h',
'base/keygen_handler.cc',
'base/keygen_handler.h',
'base/keygen_handler_mac.cc',
'base/keygen_handler_nss.cc',
'base/keygen_handler_openssl.cc',
'base/keygen_handler_win.cc',
'base/linked_hash_map.h',
'base/load_flags.h',
'base/load_flags_list.h',
'base/load_states.h',
'base/load_states_list.h',
'base/load_timing_info.cc',
'base/load_timing_info.h',
'base/mime_sniffer.cc',
'base/mime_sniffer.h',
'base/mime_util.cc',
'base/mime_util.h',
'base/net_error_list.h',
'base/net_errors.cc',
'base/net_errors.h',
'base/net_errors_posix.cc',
'base/net_errors_win.cc',
'base/net_export.h',
'base/net_log.cc',
'base/net_log.h',
'base/net_log_event_type_list.h',
'base/net_log_source_type_list.h',
'base/net_module.cc',
'base/net_module.h',
'base/net_util.cc',
'base/net_util.h',
'base/net_util_posix.cc',
'base/net_util_win.cc',
'base/network_change_notifier.cc',
'base/network_change_notifier.h',
'base/network_change_notifier_factory.h',
'base/network_change_notifier_linux.cc',
'base/network_change_notifier_linux.h',
'base/network_change_notifier_mac.cc',
'base/network_change_notifier_mac.h',
'base/network_change_notifier_win.cc',
'base/network_change_notifier_win.h',
'base/network_config_watcher_mac.cc',
'base/network_config_watcher_mac.h',
'base/network_delegate.cc',
'base/network_delegate.h',
'base/nss_memio.c',
'base/nss_memio.h',
'base/openssl_private_key_store.h',
'base/openssl_private_key_store_android.cc',
'base/openssl_private_key_store_memory.cc',
'base/platform_mime_util.h',
# TODO(tc): gnome-vfs? xdgmime? /etc/mime.types?
'base/platform_mime_util_linux.cc',
'base/platform_mime_util_mac.mm',
'base/platform_mime_util_win.cc',
'base/prioritized_dispatcher.cc',
'base/prioritized_dispatcher.h',
'base/priority_queue.h',
'base/rand_callback.h',
'base/registry_controlled_domains/registry_controlled_domain.cc',
'base/registry_controlled_domains/registry_controlled_domain.h',
'base/request_priority.h',
'base/sdch_filter.cc',
'base/sdch_filter.h',
'base/sdch_manager.cc',
'base/sdch_manager.h',
'base/static_cookie_policy.cc',
'base/static_cookie_policy.h',
'base/sys_addrinfo.h',
'base/test_data_stream.cc',
'base/test_data_stream.h',
'base/upload_bytes_element_reader.cc',
'base/upload_bytes_element_reader.h',
'base/upload_data.cc',
'base/upload_data.h',
'base/upload_data_stream.cc',
'base/upload_data_stream.h',
'base/upload_element.cc',
'base/upload_element.h',
'base/upload_element_reader.cc',
'base/upload_element_reader.h',
'base/upload_file_element_reader.cc',
'base/upload_file_element_reader.h',
'base/upload_progress.h',
'base/url_util.cc',
'base/url_util.h',
'base/winsock_init.cc',
'base/winsock_init.h',
'base/winsock_util.cc',
'base/winsock_util.h',
'base/zap.cc',
'base/zap.h',
'cert/asn1_util.cc',
'cert/asn1_util.h',
'cert/cert_database.cc',
'cert/cert_database.h',
'cert/cert_database_android.cc',
'cert/cert_database_ios.cc',
'cert/cert_database_mac.cc',
'cert/cert_database_nss.cc',
'cert/cert_database_openssl.cc',
'cert/cert_database_win.cc',
'cert/cert_status_flags.cc',
'cert/cert_status_flags.h',
'cert/cert_trust_anchor_provider.h',
'cert/cert_verifier.cc',
'cert/cert_verifier.h',
'cert/cert_verify_proc.cc',
'cert/cert_verify_proc.h',
'cert/cert_verify_proc_android.cc',
'cert/cert_verify_proc_android.h',
'cert/cert_verify_proc_mac.cc',
'cert/cert_verify_proc_mac.h',
'cert/cert_verify_proc_nss.cc',
'cert/cert_verify_proc_nss.h',
'cert/cert_verify_proc_openssl.cc',
'cert/cert_verify_proc_openssl.h',
'cert/cert_verify_proc_win.cc',
'cert/cert_verify_proc_win.h',
'cert/cert_verify_result.cc',
'cert/cert_verify_result.h',
'cert/crl_set.cc',
'cert/crl_set.h',
'cert/ev_root_ca_metadata.cc',
'cert/ev_root_ca_metadata.h',
'cert/multi_threaded_cert_verifier.cc',
'cert/multi_threaded_cert_verifier.h',
'cert/nss_cert_database.cc',
'cert/nss_cert_database.h',
'cert/pem_tokenizer.cc',
'cert/pem_tokenizer.h',
'cert/single_request_cert_verifier.cc',
'cert/single_request_cert_verifier.h',
'cert/test_root_certs.cc',
'cert/test_root_certs.h',
'cert/test_root_certs_mac.cc',
'cert/test_root_certs_nss.cc',
'cert/test_root_certs_openssl.cc',
'cert/test_root_certs_android.cc',
'cert/test_root_certs_win.cc',
'cert/x509_cert_types.cc',
'cert/x509_cert_types.h',
'cert/x509_cert_types_mac.cc',
'cert/x509_cert_types_win.cc',
'cert/x509_certificate.cc',
'cert/x509_certificate.h',
'cert/x509_certificate_ios.cc',
'cert/x509_certificate_mac.cc',
'cert/x509_certificate_net_log_param.cc',
'cert/x509_certificate_net_log_param.h',
'cert/x509_certificate_nss.cc',
'cert/x509_certificate_openssl.cc',
'cert/x509_certificate_win.cc',
'cert/x509_util.h',
'cert/x509_util.cc',
'cert/x509_util_ios.cc',
'cert/x509_util_ios.h',
'cert/x509_util_mac.cc',
'cert/x509_util_mac.h',
'cert/x509_util_nss.cc',
'cert/x509_util_nss.h',
'cert/x509_util_openssl.cc',
'cert/x509_util_openssl.h',
'cookies/canonical_cookie.cc',
'cookies/canonical_cookie.h',
'cookies/cookie_monster.cc',
'cookies/cookie_monster.h',
'cookies/cookie_options.h',
'cookies/cookie_store.cc',
'cookies/cookie_store.h',
'cookies/cookie_util.cc',
'cookies/cookie_util.h',
'cookies/parsed_cookie.cc',
'cookies/parsed_cookie.h',
'disk_cache/addr.cc',
'disk_cache/addr.h',
'disk_cache/backend_impl.cc',
'disk_cache/backend_impl.h',
'disk_cache/bitmap.cc',
'disk_cache/bitmap.h',
'disk_cache/block_files.cc',
'disk_cache/block_files.h',
'disk_cache/cache_creator.cc',
'disk_cache/cache_util.h',
'disk_cache/cache_util.cc',
'disk_cache/cache_util_posix.cc',
'disk_cache/cache_util_win.cc',
'disk_cache/disk_cache.h',
'disk_cache/disk_format.cc',
'disk_cache/disk_format.h',
'disk_cache/entry_impl.cc',
'disk_cache/entry_impl.h',
'disk_cache/errors.h',
'disk_cache/eviction.cc',
'disk_cache/eviction.h',
'disk_cache/experiments.h',
'disk_cache/file.cc',
'disk_cache/file.h',
'disk_cache/file_block.h',
'disk_cache/file_lock.cc',
'disk_cache/file_lock.h',
'disk_cache/file_posix.cc',
'disk_cache/file_win.cc',
'disk_cache/histogram_macros.h',
'disk_cache/in_flight_backend_io.cc',
'disk_cache/in_flight_backend_io.h',
'disk_cache/in_flight_io.cc',
'disk_cache/in_flight_io.h',
'disk_cache/mapped_file.h',
'disk_cache/mapped_file_posix.cc',
'disk_cache/mapped_file_avoid_mmap_posix.cc',
'disk_cache/mapped_file_win.cc',
'disk_cache/mem_backend_impl.cc',
'disk_cache/mem_backend_impl.h',
'disk_cache/mem_entry_impl.cc',
'disk_cache/mem_entry_impl.h',
'disk_cache/mem_rankings.cc',
'disk_cache/mem_rankings.h',
'disk_cache/net_log_parameters.cc',
'disk_cache/net_log_parameters.h',
'disk_cache/rankings.cc',
'disk_cache/rankings.h',
'disk_cache/sparse_control.cc',
'disk_cache/sparse_control.h',
'disk_cache/stats.cc',
'disk_cache/stats.h',
'disk_cache/stats_histogram.cc',
'disk_cache/stats_histogram.h',
'disk_cache/storage_block-inl.h',
'disk_cache/storage_block.h',
'disk_cache/stress_support.h',
'disk_cache/trace.cc',
'disk_cache/trace.h',
'disk_cache/simple/simple_backend_impl.cc',
'disk_cache/simple/simple_backend_impl.h',
'disk_cache/simple/simple_disk_format.cc',
'disk_cache/simple/simple_disk_format.h',
'disk_cache/simple/simple_entry_impl.cc',
'disk_cache/simple/simple_entry_impl.h',
'disk_cache/simple/simple_index.cc',
'disk_cache/simple/simple_index.h',
'disk_cache/simple/simple_synchronous_entry.cc',
'disk_cache/simple/simple_synchronous_entry.h',
'disk_cache/flash/flash_entry_impl.cc',
'disk_cache/flash/flash_entry_impl.h',
'disk_cache/flash/format.h',
'disk_cache/flash/internal_entry.cc',
'disk_cache/flash/internal_entry.h',
'disk_cache/flash/log_store.cc',
'disk_cache/flash/log_store.h',
'disk_cache/flash/log_store_entry.cc',
'disk_cache/flash/log_store_entry.h',
'disk_cache/flash/segment.cc',
'disk_cache/flash/segment.h',
'disk_cache/flash/storage.cc',
'disk_cache/flash/storage.h',
'dns/address_sorter.h',
'dns/address_sorter_posix.cc',
'dns/address_sorter_posix.h',
'dns/address_sorter_win.cc',
'dns/dns_client.cc',
'dns/dns_client.h',
'dns/dns_config_service.cc',
'dns/dns_config_service.h',
'dns/dns_config_service_posix.cc',
'dns/dns_config_service_posix.h',
'dns/dns_config_service_win.cc',
'dns/dns_config_service_win.h',
'dns/dns_hosts.cc',
'dns/dns_hosts.h',
'dns/dns_protocol.h',
'dns/dns_query.cc',
'dns/dns_query.h',
'dns/dns_response.cc',
'dns/dns_response.h',
'dns/dns_session.cc',
'dns/dns_session.h',
'dns/dns_socket_pool.cc',
'dns/dns_socket_pool.h',
'dns/dns_transaction.cc',
'dns/dns_transaction.h',
'dns/host_cache.cc',
'dns/host_cache.h',
'dns/host_resolver.cc',
'dns/host_resolver.h',
'dns/host_resolver_impl.cc',
'dns/host_resolver_impl.h',
'dns/host_resolver_proc.cc',
'dns/host_resolver_proc.h',
'dns/mapped_host_resolver.cc',
'dns/mapped_host_resolver.h',
'dns/notify_watcher_mac.cc',
'dns/notify_watcher_mac.h',
'dns/serial_worker.cc',
'dns/serial_worker.h',
'dns/single_request_host_resolver.cc',
'dns/single_request_host_resolver.h',
'ftp/ftp_auth_cache.cc',
'ftp/ftp_auth_cache.h',
'ftp/ftp_ctrl_response_buffer.cc',
'ftp/ftp_ctrl_response_buffer.h',
'ftp/ftp_directory_listing_parser.cc',
'ftp/ftp_directory_listing_parser.h',
'ftp/ftp_directory_listing_parser_ls.cc',
'ftp/ftp_directory_listing_parser_ls.h',
'ftp/ftp_directory_listing_parser_netware.cc',
'ftp/ftp_directory_listing_parser_netware.h',
'ftp/ftp_directory_listing_parser_os2.cc',
'ftp/ftp_directory_listing_parser_os2.h',
'ftp/ftp_directory_listing_parser_vms.cc',
'ftp/ftp_directory_listing_parser_vms.h',
'ftp/ftp_directory_listing_parser_windows.cc',
'ftp/ftp_directory_listing_parser_windows.h',
'ftp/ftp_network_layer.cc',
'ftp/ftp_network_layer.h',
'ftp/ftp_network_session.cc',
'ftp/ftp_network_session.h',
'ftp/ftp_network_transaction.cc',
'ftp/ftp_network_transaction.h',
'ftp/ftp_request_info.h',
'ftp/ftp_response_info.cc',
'ftp/ftp_response_info.h',
'ftp/ftp_server_type_histograms.cc',
'ftp/ftp_server_type_histograms.h',
'ftp/ftp_transaction.h',
'ftp/ftp_transaction_factory.h',
'ftp/ftp_util.cc',
'ftp/ftp_util.h',
'http/des.cc',
'http/des.h',
'http/http_atom_list.h',
'http/http_auth.cc',
'http/http_auth.h',
'http/http_auth_cache.cc',
'http/http_auth_cache.h',
'http/http_auth_controller.cc',
'http/http_auth_controller.h',
'http/http_auth_filter.cc',
'http/http_auth_filter.h',
'http/http_auth_filter_win.h',
'http/http_auth_gssapi_posix.cc',
'http/http_auth_gssapi_posix.h',
'http/http_auth_handler.cc',
'http/http_auth_handler.h',
'http/http_auth_handler_basic.cc',
'http/http_auth_handler_basic.h',
'http/http_auth_handler_digest.cc',
'http/http_auth_handler_digest.h',
'http/http_auth_handler_factory.cc',
'http/http_auth_handler_factory.h',
'http/http_auth_handler_negotiate.cc',
'http/http_auth_handler_negotiate.h',
'http/http_auth_handler_ntlm.cc',
'http/http_auth_handler_ntlm.h',
'http/http_auth_handler_ntlm_portable.cc',
'http/http_auth_handler_ntlm_win.cc',
'http/http_auth_sspi_win.cc',
'http/http_auth_sspi_win.h',
'http/http_basic_stream.cc',
'http/http_basic_stream.h',
'http/http_byte_range.cc',
'http/http_byte_range.h',
'http/http_cache.cc',
'http/http_cache.h',
'http/http_cache_transaction.cc',
'http/http_cache_transaction.h',
'http/http_content_disposition.cc',
'http/http_content_disposition.h',
'http/http_chunked_decoder.cc',
'http/http_chunked_decoder.h',
'http/http_network_layer.cc',
'http/http_network_layer.h',
'http/http_network_session.cc',
'http/http_network_session.h',
'http/http_network_session_peer.cc',
'http/http_network_session_peer.h',
'http/http_network_transaction.cc',
'http/http_network_transaction.h',
'http/http_pipelined_connection.h',
'http/http_pipelined_connection_impl.cc',
'http/http_pipelined_connection_impl.h',
'http/http_pipelined_host.cc',
'http/http_pipelined_host.h',
'http/http_pipelined_host_capability.h',
'http/http_pipelined_host_forced.cc',
'http/http_pipelined_host_forced.h',
'http/http_pipelined_host_impl.cc',
'http/http_pipelined_host_impl.h',
'http/http_pipelined_host_pool.cc',
'http/http_pipelined_host_pool.h',
'http/http_pipelined_stream.cc',
'http/http_pipelined_stream.h',
'http/http_proxy_client_socket.cc',
'http/http_proxy_client_socket.h',
'http/http_proxy_client_socket_pool.cc',
'http/http_proxy_client_socket_pool.h',
'http/http_request_headers.cc',
'http/http_request_headers.h',
'http/http_request_info.cc',
'http/http_request_info.h',
'http/http_response_body_drainer.cc',
'http/http_response_body_drainer.h',
'http/http_response_headers.cc',
'http/http_response_headers.h',
'http/http_response_info.cc',
'http/http_response_info.h',
'http/http_security_headers.cc',
'http/http_security_headers.h',
'http/http_server_properties.cc',
'http/http_server_properties.h',
'http/http_server_properties_impl.cc',
'http/http_server_properties_impl.h',
'http/http_status_code.h',
'http/http_stream.h',
'http/http_stream_base.h',
'http/http_stream_factory.cc',
'http/http_stream_factory.h',
'http/http_stream_factory_impl.cc',
'http/http_stream_factory_impl.h',
'http/http_stream_factory_impl_job.cc',
'http/http_stream_factory_impl_job.h',
'http/http_stream_factory_impl_request.cc',
'http/http_stream_factory_impl_request.h',
'http/http_stream_parser.cc',
'http/http_stream_parser.h',
'http/http_transaction.h',
'http/http_transaction_delegate.h',
'http/http_transaction_factory.h',
'http/http_util.cc',
'http/http_util.h',
'http/http_util_icu.cc',
'http/http_vary_data.cc',
'http/http_vary_data.h',
'http/http_version.h',
'http/md4.cc',
'http/md4.h',
'http/partial_data.cc',
'http/partial_data.h',
'http/proxy_client_socket.h',
'http/proxy_client_socket.cc',
'http/transport_security_state.cc',
'http/transport_security_state.h',
'http/transport_security_state_static.h',
'http/url_security_manager.cc',
'http/url_security_manager.h',
'http/url_security_manager_posix.cc',
'http/url_security_manager_win.cc',
'ocsp/nss_ocsp.cc',
'ocsp/nss_ocsp.h',
'proxy/dhcp_proxy_script_adapter_fetcher_win.cc',
'proxy/dhcp_proxy_script_adapter_fetcher_win.h',
'proxy/dhcp_proxy_script_fetcher.cc',
'proxy/dhcp_proxy_script_fetcher.h',
'proxy/dhcp_proxy_script_fetcher_factory.cc',
'proxy/dhcp_proxy_script_fetcher_factory.h',
'proxy/dhcp_proxy_script_fetcher_win.cc',
'proxy/dhcp_proxy_script_fetcher_win.h',
'proxy/dhcpcsvc_init_win.cc',
'proxy/dhcpcsvc_init_win.h',
'proxy/multi_threaded_proxy_resolver.cc',
'proxy/multi_threaded_proxy_resolver.h',
'proxy/network_delegate_error_observer.cc',
'proxy/network_delegate_error_observer.h',
'proxy/polling_proxy_config_service.cc',
'proxy/polling_proxy_config_service.h',
'proxy/proxy_bypass_rules.cc',
'proxy/proxy_bypass_rules.h',
'proxy/proxy_config.cc',
'proxy/proxy_config.h',
'proxy/proxy_config_service.h',
'proxy/proxy_config_service_android.cc',
'proxy/proxy_config_service_android.h',
'proxy/proxy_config_service_fixed.cc',
'proxy/proxy_config_service_fixed.h',
'proxy/proxy_config_service_ios.cc',
'proxy/proxy_config_service_ios.h',
'proxy/proxy_config_service_linux.cc',
'proxy/proxy_config_service_linux.h',
'proxy/proxy_config_service_mac.cc',
'proxy/proxy_config_service_mac.h',
'proxy/proxy_config_service_win.cc',
'proxy/proxy_config_service_win.h',
'proxy/proxy_config_source.cc',
'proxy/proxy_config_source.h',
'proxy/proxy_info.cc',
'proxy/proxy_info.h',
'proxy/proxy_list.cc',
'proxy/proxy_list.h',
'proxy/proxy_resolver.h',
'proxy/proxy_resolver_error_observer.h',
'proxy/proxy_resolver_mac.cc',
'proxy/proxy_resolver_mac.h',
'proxy/proxy_resolver_script.h',
'proxy/proxy_resolver_script_data.cc',
'proxy/proxy_resolver_script_data.h',
'proxy/proxy_resolver_winhttp.cc',
'proxy/proxy_resolver_winhttp.h',
'proxy/proxy_retry_info.h',
'proxy/proxy_script_decider.cc',
'proxy/proxy_script_decider.h',
'proxy/proxy_script_fetcher.h',
'proxy/proxy_script_fetcher_impl.cc',
'proxy/proxy_script_fetcher_impl.h',
'proxy/proxy_server.cc',
'proxy/proxy_server.h',
'proxy/proxy_server_mac.cc',
'proxy/proxy_service.cc',
'proxy/proxy_service.h',
'quic/blocked_list.h',
'quic/congestion_control/available_channel_estimator.cc',
'quic/congestion_control/available_channel_estimator.h',
'quic/congestion_control/channel_estimator.cc',
'quic/congestion_control/channel_estimator.h',
'quic/congestion_control/cube_root.cc',
'quic/congestion_control/cube_root.h',
'quic/congestion_control/cubic.cc',
'quic/congestion_control/cubic.h',
'quic/congestion_control/fix_rate_receiver.cc',
'quic/congestion_control/fix_rate_receiver.h',
'quic/congestion_control/fix_rate_sender.cc',
'quic/congestion_control/fix_rate_sender.h',
'quic/congestion_control/hybrid_slow_start.cc',
'quic/congestion_control/hybrid_slow_start.h',
'quic/congestion_control/inter_arrival_bitrate_ramp_up.cc',
'quic/congestion_control/inter_arrival_bitrate_ramp_up.h',
'quic/congestion_control/inter_arrival_overuse_detector.cc',
'quic/congestion_control/inter_arrival_overuse_detector.h',
'quic/congestion_control/inter_arrival_probe.cc',
'quic/congestion_control/inter_arrival_probe.h',
'quic/congestion_control/inter_arrival_receiver.cc',
'quic/congestion_control/inter_arrival_receiver.h',
'quic/congestion_control/inter_arrival_sender.cc',
'quic/congestion_control/inter_arrival_sender.h',
'quic/congestion_control/inter_arrival_state_machine.cc',
'quic/congestion_control/inter_arrival_state_machine.h',
'quic/congestion_control/leaky_bucket.cc',
'quic/congestion_control/leaky_bucket.h',
'quic/congestion_control/paced_sender.cc',
'quic/congestion_control/paced_sender.h',
'quic/congestion_control/quic_congestion_manager.cc',
'quic/congestion_control/quic_congestion_manager.h',
'quic/congestion_control/quic_max_sized_map.h',
'quic/congestion_control/receive_algorithm_interface.cc',
'quic/congestion_control/receive_algorithm_interface.h',
'quic/congestion_control/send_algorithm_interface.cc',
'quic/congestion_control/send_algorithm_interface.h',
'quic/congestion_control/tcp_cubic_sender.cc',
'quic/congestion_control/tcp_cubic_sender.h',
'quic/congestion_control/tcp_receiver.cc',
'quic/congestion_control/tcp_receiver.h',
'quic/crypto/aes_128_gcm_decrypter.h',
'quic/crypto/aes_128_gcm_decrypter_nss.cc',
'quic/crypto/aes_128_gcm_decrypter_openssl.cc',
'quic/crypto/aes_128_gcm_encrypter.h',
'quic/crypto/aes_128_gcm_encrypter_nss.cc',
'quic/crypto/aes_128_gcm_encrypter_openssl.cc',
'quic/crypto/crypto_framer.cc',
'quic/crypto/crypto_framer.h',
'quic/crypto/crypto_handshake.cc',
'quic/crypto/crypto_handshake.h',
'quic/crypto/crypto_protocol.h',
'quic/crypto/crypto_utils.cc',
'quic/crypto/crypto_utils.h',
'quic/crypto/curve25519_key_exchange.cc',
'quic/crypto/curve25519_key_exchange.h',
'quic/crypto/key_exchange.h',
'quic/crypto/null_decrypter.cc',
'quic/crypto/null_decrypter.h',
'quic/crypto/null_encrypter.cc',
'quic/crypto/null_encrypter.h',
'quic/crypto/p256_key_exchange.h',
'quic/crypto/p256_key_exchange_nss.cc',
'quic/crypto/p256_key_exchange_openssl.cc',
'quic/crypto/quic_decrypter.cc',
'quic/crypto/quic_decrypter.h',
'quic/crypto/quic_encrypter.cc',
'quic/crypto/quic_encrypter.h',
'quic/crypto/quic_random.cc',
'quic/crypto/quic_random.h',
'quic/crypto/scoped_evp_cipher_ctx.h',
'quic/crypto/strike_register.cc',
'quic/crypto/strike_register.h',
'quic/quic_bandwidth.cc',
'quic/quic_bandwidth.h',
'quic/quic_blocked_writer_interface.h',
'quic/quic_client_session.cc',
'quic/quic_client_session.h',
'quic/quic_crypto_client_stream.cc',
'quic/quic_crypto_client_stream.h',
'quic/quic_crypto_client_stream_factory.h',
'quic/quic_crypto_server_stream.cc',
'quic/quic_crypto_server_stream.h',
'quic/quic_crypto_stream.cc',
'quic/quic_crypto_stream.h',
'quic/quic_clock.cc',
'quic/quic_clock.h',
'quic/quic_connection.cc',
'quic/quic_connection.h',
'quic/quic_connection_helper.cc',
'quic/quic_connection_helper.h',
'quic/quic_connection_logger.cc',
'quic/quic_connection_logger.h',
'quic/quic_data_reader.cc',
'quic/quic_data_reader.h',
'quic/quic_data_writer.cc',
'quic/quic_data_writer.h',
'quic/quic_fec_group.cc',
'quic/quic_fec_group.h',
'quic/quic_framer.cc',
'quic/quic_framer.h',
'quic/quic_http_stream.cc',
'quic/quic_http_stream.h',
'quic/quic_packet_creator.cc',
'quic/quic_packet_creator.h',
'quic/quic_packet_entropy_manager.cc',
'quic/quic_packet_entropy_manager.h',
'quic/quic_packet_generator.cc',
'quic/quic_packet_generator.h',
'quic/quic_protocol.cc',
'quic/quic_protocol.h',
'quic/quic_reliable_client_stream.cc',
'quic/quic_reliable_client_stream.h',
'quic/quic_session.cc',
'quic/quic_session.h',
'quic/quic_stats.cc',
'quic/quic_stats.h',
'quic/quic_stream_factory.cc',
'quic/quic_stream_factory.h',
'quic/quic_stream_sequencer.cc',
'quic/quic_stream_sequencer.h',
'quic/quic_time.cc',
'quic/quic_time.h',
'quic/quic_utils.cc',
'quic/quic_utils.h',
'quic/reliable_quic_stream.cc',
'quic/reliable_quic_stream.h',
'socket/buffered_write_stream_socket.cc',
'socket/buffered_write_stream_socket.h',
'socket/client_socket_factory.cc',
'socket/client_socket_factory.h',
'socket/client_socket_handle.cc',
'socket/client_socket_handle.h',
'socket/client_socket_pool.cc',
'socket/client_socket_pool.h',
'socket/client_socket_pool_base.cc',
'socket/client_socket_pool_base.h',
'socket/client_socket_pool_histograms.cc',
'socket/client_socket_pool_histograms.h',
'socket/client_socket_pool_manager.cc',
'socket/client_socket_pool_manager.h',
'socket/client_socket_pool_manager_impl.cc',
'socket/client_socket_pool_manager_impl.h',
'socket/next_proto.h',
'socket/nss_ssl_util.cc',
'socket/nss_ssl_util.h',
'socket/server_socket.h',
'socket/socket_net_log_params.cc',
'socket/socket_net_log_params.h',
'socket/socket.h',
'socket/socks5_client_socket.cc',
'socket/socks5_client_socket.h',
'socket/socks_client_socket.cc',
'socket/socks_client_socket.h',
'socket/socks_client_socket_pool.cc',
'socket/socks_client_socket_pool.h',
'socket/ssl_client_socket.cc',
'socket/ssl_client_socket.h',
'socket/ssl_client_socket_nss.cc',
'socket/ssl_client_socket_nss.h',
'socket/ssl_client_socket_openssl.cc',
'socket/ssl_client_socket_openssl.h',
'socket/ssl_client_socket_pool.cc',
'socket/ssl_client_socket_pool.h',
'socket/ssl_error_params.cc',
'socket/ssl_error_params.h',
'socket/ssl_server_socket.h',
'socket/ssl_server_socket_nss.cc',
'socket/ssl_server_socket_nss.h',
'socket/ssl_server_socket_openssl.cc',
'socket/ssl_socket.h',
'socket/stream_listen_socket.cc',
'socket/stream_listen_socket.h',
'socket/stream_socket.cc',
'socket/stream_socket.h',
'socket/tcp_client_socket.cc',
'socket/tcp_client_socket.h',
'socket/tcp_client_socket_libevent.cc',
'socket/tcp_client_socket_libevent.h',
'socket/tcp_client_socket_win.cc',
'socket/tcp_client_socket_win.h',
'socket/tcp_listen_socket.cc',
'socket/tcp_listen_socket.h',
'socket/tcp_server_socket.h',
'socket/tcp_server_socket_libevent.cc',
'socket/tcp_server_socket_libevent.h',
'socket/tcp_server_socket_win.cc',
'socket/tcp_server_socket_win.h',
'socket/transport_client_socket_pool.cc',
'socket/transport_client_socket_pool.h',
'socket/unix_domain_socket_posix.cc',
'socket/unix_domain_socket_posix.h',
'socket_stream/socket_stream.cc',
'socket_stream/socket_stream.h',
'socket_stream/socket_stream_job.cc',
'socket_stream/socket_stream_job.h',
'socket_stream/socket_stream_job_manager.cc',
'socket_stream/socket_stream_job_manager.h',
'socket_stream/socket_stream_metrics.cc',
'socket_stream/socket_stream_metrics.h',
'spdy/buffered_spdy_framer.cc',
'spdy/buffered_spdy_framer.h',
'spdy/spdy_bitmasks.h',
'spdy/spdy_credential_builder.cc',
'spdy/spdy_credential_builder.h',
'spdy/spdy_credential_state.cc',
'spdy/spdy_credential_state.h',
'spdy/spdy_frame_builder.cc',
'spdy/spdy_frame_builder.h',
'spdy/spdy_frame_reader.cc',
'spdy/spdy_frame_reader.h',
'spdy/spdy_framer.cc',
'spdy/spdy_framer.h',
'spdy/spdy_header_block.cc',
'spdy/spdy_header_block.h',
'spdy/spdy_http_stream.cc',
'spdy/spdy_http_stream.h',
'spdy/spdy_http_utils.cc',
'spdy/spdy_http_utils.h',
'spdy/spdy_io_buffer.cc',
'spdy/spdy_io_buffer.h',
'spdy/spdy_priority_forest.h',
'spdy/spdy_protocol.cc',
'spdy/spdy_protocol.h',
'spdy/spdy_proxy_client_socket.cc',
'spdy/spdy_proxy_client_socket.h',
'spdy/spdy_session.cc',
'spdy/spdy_session.h',
'spdy/spdy_session_pool.cc',
'spdy/spdy_session_pool.h',
'spdy/spdy_stream.cc',
'spdy/spdy_stream.h',
'spdy/spdy_websocket_stream.cc',
'spdy/spdy_websocket_stream.h',
'ssl/client_cert_store.h',
'ssl/client_cert_store_impl.h',
'ssl/client_cert_store_impl_mac.cc',
'ssl/client_cert_store_impl_nss.cc',
'ssl/client_cert_store_impl_win.cc',
'ssl/default_server_bound_cert_store.cc',
'ssl/default_server_bound_cert_store.h',
'ssl/openssl_client_key_store.cc',
'ssl/openssl_client_key_store.h',
'ssl/server_bound_cert_service.cc',
'ssl/server_bound_cert_service.h',
'ssl/server_bound_cert_store.cc',
'ssl/server_bound_cert_store.h',
'ssl/ssl_cert_request_info.cc',
'ssl/ssl_cert_request_info.h',
'ssl/ssl_cipher_suite_names.cc',
'ssl/ssl_cipher_suite_names.h',
'ssl/ssl_client_auth_cache.cc',
'ssl/ssl_client_auth_cache.h',
'ssl/ssl_client_cert_type.h',
'ssl/ssl_config_service.cc',
'ssl/ssl_config_service.h',
'ssl/ssl_config_service_defaults.cc',
'ssl/ssl_config_service_defaults.h',
'ssl/ssl_info.cc',
'ssl/ssl_info.h',
'third_party/mozilla_security_manager/nsKeygenHandler.cpp',
'third_party/mozilla_security_manager/nsKeygenHandler.h',
'third_party/mozilla_security_manager/nsNSSCertificateDB.cpp',
'third_party/mozilla_security_manager/nsNSSCertificateDB.h',
'third_party/mozilla_security_manager/nsPKCS12Blob.cpp',
'third_party/mozilla_security_manager/nsPKCS12Blob.h',
'udp/datagram_client_socket.h',
'udp/datagram_server_socket.h',
'udp/datagram_socket.h',
'udp/udp_client_socket.cc',
'udp/udp_client_socket.h',
'udp/udp_net_log_parameters.cc',
'udp/udp_net_log_parameters.h',
'udp/udp_server_socket.cc',
'udp/udp_server_socket.h',
'udp/udp_socket.h',
'udp/udp_socket_libevent.cc',
'udp/udp_socket_libevent.h',
'udp/udp_socket_win.cc',
'udp/udp_socket_win.h',
'url_request/data_protocol_handler.cc',
'url_request/data_protocol_handler.h',
'url_request/file_protocol_handler.cc',
'url_request/file_protocol_handler.h',
'url_request/fraudulent_certificate_reporter.h',
'url_request/ftp_protocol_handler.cc',
'url_request/ftp_protocol_handler.h',
'url_request/http_user_agent_settings.h',
'url_request/protocol_intercept_job_factory.cc',
'url_request/protocol_intercept_job_factory.h',
'url_request/static_http_user_agent_settings.cc',
'url_request/static_http_user_agent_settings.h',
'url_request/url_fetcher.cc',
'url_request/url_fetcher.h',
'url_request/url_fetcher_core.cc',
'url_request/url_fetcher_core.h',
'url_request/url_fetcher_delegate.cc',
'url_request/url_fetcher_delegate.h',
'url_request/url_fetcher_factory.h',
'url_request/url_fetcher_impl.cc',
'url_request/url_fetcher_impl.h',
'url_request/url_fetcher_response_writer.cc',
'url_request/url_fetcher_response_writer.h',
'url_request/url_request.cc',
'url_request/url_request.h',
'url_request/url_request_about_job.cc',
'url_request/url_request_about_job.h',
'url_request/url_request_context.cc',
'url_request/url_request_context.h',
'url_request/url_request_context_builder.cc',
'url_request/url_request_context_builder.h',
'url_request/url_request_context_getter.cc',
'url_request/url_request_context_getter.h',
'url_request/url_request_context_storage.cc',
'url_request/url_request_context_storage.h',
'url_request/url_request_data_job.cc',
'url_request/url_request_data_job.h',
'url_request/url_request_error_job.cc',
'url_request/url_request_error_job.h',
'url_request/url_request_file_dir_job.cc',
'url_request/url_request_file_dir_job.h',
'url_request/url_request_file_job.cc',
'url_request/url_request_file_job.h',
'url_request/url_request_filter.cc',
'url_request/url_request_filter.h',
'url_request/url_request_ftp_job.cc',
'url_request/url_request_ftp_job.h',
'url_request/url_request_http_job.cc',
'url_request/url_request_http_job.h',
'url_request/url_request_job.cc',
'url_request/url_request_job.h',
'url_request/url_request_job_factory.cc',
'url_request/url_request_job_factory.h',
'url_request/url_request_job_factory_impl.cc',
'url_request/url_request_job_factory_impl.h',
'url_request/url_request_job_manager.cc',
'url_request/url_request_job_manager.h',
'url_request/url_request_netlog_params.cc',
'url_request/url_request_netlog_params.h',
'url_request/url_request_redirect_job.cc',
'url_request/url_request_redirect_job.h',
'url_request/url_request_simple_job.cc',
'url_request/url_request_simple_job.h',
'url_request/url_request_status.h',
'url_request/url_request_test_job.cc',
'url_request/url_request_test_job.h',
'url_request/url_request_throttler_entry.cc',
'url_request/url_request_throttler_entry.h',
'url_request/url_request_throttler_entry_interface.h',
'url_request/url_request_throttler_header_adapter.cc',
'url_request/url_request_throttler_header_adapter.h',
'url_request/url_request_throttler_header_interface.h',
'url_request/url_request_throttler_manager.cc',
'url_request/url_request_throttler_manager.h',
'url_request/view_cache_helper.cc',
'url_request/view_cache_helper.h',
'websockets/websocket_errors.cc',
'websockets/websocket_errors.h',
'websockets/websocket_frame.cc',
'websockets/websocket_frame.h',
'websockets/websocket_frame_parser.cc',
'websockets/websocket_frame_parser.h',
'websockets/websocket_handshake_handler.cc',
'websockets/websocket_handshake_handler.h',
'websockets/websocket_job.cc',
'websockets/websocket_job.h',
'websockets/websocket_net_log_params.cc',
'websockets/websocket_net_log_params.h',
'websockets/websocket_stream.h',
'websockets/websocket_throttle.cc',
'websockets/websocket_throttle.h',
],
'defines': [
'NET_IMPLEMENTATION',
],
'export_dependent_settings': [
'../base/base.gyp:base',
],
'conditions': [
['chromeos==1', {
'sources!': [
'base/network_change_notifier_linux.cc',
'base/network_change_notifier_linux.h',
'base/network_change_notifier_netlink_linux.cc',
'base/network_change_notifier_netlink_linux.h',
'proxy/proxy_config_service_linux.cc',
'proxy/proxy_config_service_linux.h',
],
}],
['use_kerberos==1', {
'defines': [
'USE_KERBEROS',
],
'conditions': [
['OS=="openbsd"', {
'include_dirs': [
'/usr/include/kerberosV'
],
}],
['linux_link_kerberos==1', {
'link_settings': {
'ldflags': [
'<!@(krb5-config --libs gssapi)',
],
},
}, { # linux_link_kerberos==0
'defines': [
'DLOPEN_KERBEROS',
],
}],
],
}, { # use_kerberos == 0
'sources!': [
'http/http_auth_gssapi_posix.cc',
'http/http_auth_gssapi_posix.h',
'http/http_auth_handler_negotiate.h',
'http/http_auth_handler_negotiate.cc',
],
}],
['posix_avoid_mmap==1', {
'defines': [
'POSIX_AVOID_MMAP',
],
'direct_dependent_settings': {
'defines': [
'POSIX_AVOID_MMAP',
],
},
'sources!': [
'disk_cache/mapped_file_posix.cc',
],
}, { # else
'sources!': [
'disk_cache/mapped_file_avoid_mmap_posix.cc',
],
}],
['disable_ftp_support==1', {
'sources/': [
['exclude', '^ftp/'],
],
'sources!': [
'url_request/ftp_protocol_handler.cc',
'url_request/ftp_protocol_handler.h',
'url_request/url_request_ftp_job.cc',
'url_request/url_request_ftp_job.h',
],
}],
['enable_built_in_dns==1', {
'defines': [
'ENABLE_BUILT_IN_DNS',
]
}, { # else
'sources!': [
'dns/address_sorter_posix.cc',
'dns/address_sorter_posix.h',
'dns/dns_client.cc',
],
}],
['use_openssl==1', {
'sources!': [
'base/crypto_module_nss.cc',
'base/keygen_handler_nss.cc',
'base/nss_memio.c',
'base/nss_memio.h',
'cert/cert_database_nss.cc',
'cert/cert_verify_proc_nss.cc',
'cert/cert_verify_proc_nss.h',
'cert/nss_cert_database.cc',
'cert/nss_cert_database.h',
'cert/test_root_certs_nss.cc',
'cert/x509_certificate_nss.cc',
'cert/x509_util_nss.cc',
'cert/x509_util_nss.h',
'ocsp/nss_ocsp.cc',
'ocsp/nss_ocsp.h',
'quic/crypto/aes_128_gcm_decrypter_nss.cc',
'quic/crypto/aes_128_gcm_encrypter_nss.cc',
'quic/crypto/p256_key_exchange_nss.cc',
'socket/nss_ssl_util.cc',
'socket/nss_ssl_util.h',
'socket/ssl_client_socket_nss.cc',
'socket/ssl_client_socket_nss.h',
'socket/ssl_server_socket_nss.cc',
'socket/ssl_server_socket_nss.h',
'ssl/client_cert_store_impl_nss.cc',
'third_party/mozilla_security_manager/nsKeygenHandler.cpp',
'third_party/mozilla_security_manager/nsKeygenHandler.h',
'third_party/mozilla_security_manager/nsNSSCertificateDB.cpp',
'third_party/mozilla_security_manager/nsNSSCertificateDB.h',
'third_party/mozilla_security_manager/nsPKCS12Blob.cpp',
'third_party/mozilla_security_manager/nsPKCS12Blob.h',
],
},
{ # else !use_openssl: remove the unneeded files
'sources!': [
'base/crypto_module_openssl.cc',
'base/keygen_handler_openssl.cc',
'base/openssl_private_key_store.h',
'base/openssl_private_key_store_android.cc',
'base/openssl_private_key_store_memory.cc',
'cert/cert_database_openssl.cc',
'cert/cert_verify_proc_openssl.cc',
'cert/cert_verify_proc_openssl.h',
'cert/test_root_certs_openssl.cc',
'cert/x509_certificate_openssl.cc',
'cert/x509_util_openssl.cc',
'cert/x509_util_openssl.h',
'quic/crypto/aes_128_gcm_decrypter_openssl.cc',
'quic/crypto/aes_128_gcm_encrypter_openssl.cc',
'quic/crypto/p256_key_exchange_openssl.cc',
'quic/crypto/scoped_evp_cipher_ctx.h',
'socket/ssl_client_socket_openssl.cc',
'socket/ssl_client_socket_openssl.h',
'socket/ssl_server_socket_openssl.cc',
'ssl/openssl_client_key_store.cc',
'ssl/openssl_client_key_store.h',
],
},
],
[ 'use_glib == 1', {
'dependencies': [
'../build/linux/system.gyp:gconf',
'../build/linux/system.gyp:gio',
],
'conditions': [
['use_openssl==1', {
'dependencies': [
'../third_party/openssl/openssl.gyp:openssl',
],
},
{ # else use_openssl==0, use NSS
'dependencies': [
'../build/linux/system.gyp:ssl',
],
}],
['os_bsd==1', {
'sources!': [
'base/network_change_notifier_linux.cc',
'base/network_change_notifier_netlink_linux.cc',
'proxy/proxy_config_service_linux.cc',
],
},{
'dependencies': [
'../build/linux/system.gyp:libresolv',
],
}],
['OS=="solaris"', {
'link_settings': {
'ldflags': [
'-R/usr/lib/mps',
],
},
}],
],
},
{ # else: OS is not in the above list
'sources!': [
'base/crypto_module_nss.cc',
'base/keygen_handler_nss.cc',
'cert/cert_database_nss.cc',
'cert/nss_cert_database.cc',
'cert/nss_cert_database.h',
'cert/test_root_certs_nss.cc',
'cert/x509_certificate_nss.cc',
'ocsp/nss_ocsp.cc',
'ocsp/nss_ocsp.h',
'third_party/mozilla_security_manager/nsKeygenHandler.cpp',
'third_party/mozilla_security_manager/nsKeygenHandler.h',
'third_party/mozilla_security_manager/nsNSSCertificateDB.cpp',
'third_party/mozilla_security_manager/nsNSSCertificateDB.h',
'third_party/mozilla_security_manager/nsPKCS12Blob.cpp',
'third_party/mozilla_security_manager/nsPKCS12Blob.h',
],
},
],
[ 'toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:gdk',
],
}],
[ 'use_nss != 1', {
'sources!': [
'cert/cert_verify_proc_nss.cc',
'cert/cert_verify_proc_nss.h',
'ssl/client_cert_store_impl_nss.cc',
],
}],
[ 'enable_websockets != 1', {
'sources/': [
['exclude', '^socket_stream/'],
['exclude', '^websockets/'],
],
'sources!': [
'spdy/spdy_websocket_stream.cc',
'spdy/spdy_websocket_stream.h',
],
}],
[ 'OS == "win"', {
'sources!': [
'http/http_auth_handler_ntlm_portable.cc',
'socket/tcp_client_socket_libevent.cc',
'socket/tcp_client_socket_libevent.h',
'socket/tcp_server_socket_libevent.cc',
'socket/tcp_server_socket_libevent.h',
'ssl/client_cert_store_impl_nss.cc',
'udp/udp_socket_libevent.cc',
'udp/udp_socket_libevent.h',
],
'dependencies': [
'../third_party/nss/nss.gyp:nspr',
'../third_party/nss/nss.gyp:nss',
'third_party/nss/ssl.gyp:libssl',
'tld_cleanup',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
}, { # else: OS != "win"
'sources!': [
'base/winsock_init.cc',
'base/winsock_init.h',
'base/winsock_util.cc',
'base/winsock_util.h',
'proxy/proxy_resolver_winhttp.cc',
'proxy/proxy_resolver_winhttp.h',
],
},
],
[ 'OS == "mac"', {
'sources!': [
'ssl/client_cert_store_impl_nss.cc',
],
'dependencies': [
'../third_party/nss/nss.gyp:nspr',
'../third_party/nss/nss.gyp:nss',
'third_party/nss/ssl.gyp:libssl',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
'$(SDKROOT)/usr/lib/libresolv.dylib',
]
},
},
],
[ 'OS == "ios"', {
'dependencies': [
'../third_party/nss/nss.gyp:nss',
'third_party/nss/ssl.gyp:libssl',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/CFNetwork.framework',
'$(SDKROOT)/System/Library/Frameworks/MobileCoreServices.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
'$(SDKROOT)/usr/lib/libresolv.dylib',
],
},
},
],
['OS=="android" and _toolset=="target" and android_webview_build == 0', {
'dependencies': [
'net_java',
],
}],
[ 'OS == "android"', {
'dependencies': [
'../third_party/openssl/openssl.gyp:openssl',
'net_jni_headers',
],
'sources!': [
'base/openssl_private_key_store_memory.cc',
'cert/cert_database_openssl.cc',
'cert/cert_verify_proc_openssl.cc',
'cert/test_root_certs_openssl.cc',
],
# The net/android/keystore_openssl.cc source file needs to
# access an OpenSSL-internal header.
'include_dirs': [
'../third_party/openssl',
],
}, { # else OS != "android"
'defines': [
# These are the features Android doesn't support.
'ENABLE_MEDIA_CODEC_THEORA',
],
},
],
[ 'OS == "linux"', {
'dependencies': [
'../build/linux/system.gyp:dbus',
'../dbus/dbus.gyp:dbus',
],
},
],
],
'target_conditions': [
# These source files are excluded by default platform rules, but they
# are needed in specific cases on other platforms. Re-including them can
# only be done in target_conditions as it is evaluated after the
# platform rules.
['OS == "android"', {
'sources/': [
['include', '^base/platform_mime_util_linux\\.cc$'],
],
}],
['OS == "ios"', {
'sources/': [
['include', '^base/network_change_notifier_mac\\.cc$'],
['include', '^base/network_config_watcher_mac\\.cc$'],
['include', '^base/platform_mime_util_mac\\.mm$'],
# The iOS implementation only partially uses NSS and thus does not
# defines |use_nss|. In particular the |USE_NSS| preprocessor
# definition is not used. The following files are needed though:
['include', '^cert/cert_verify_proc_nss\\.cc$'],
['include', '^cert/cert_verify_proc_nss\\.h$'],
['include', '^cert/test_root_certs_nss\\.cc$'],
['include', '^cert/x509_util_nss\\.cc$'],
['include', '^cert/x509_util_nss\\.h$'],
['include', '^dns/notify_watcher_mac\\.cc$'],
['include', '^proxy/proxy_resolver_mac\\.cc$'],
['include', '^proxy/proxy_server_mac\\.cc$'],
['include', '^ocsp/nss_ocsp\\.cc$'],
['include', '^ocsp/nss_ocsp\\.h$'],
],
}],
],
},
{
'target_name': 'net_unittests',
'type': '<(gtest_target_type)',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../crypto/crypto.gyp:crypto',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'../third_party/zlib/zlib.gyp:zlib',
'net',
'net_test_support',
],
'sources': [
'android/keystore_unittest.cc',
'android/network_change_notifier_android_unittest.cc',
'base/address_list_unittest.cc',
'base/address_tracker_linux_unittest.cc',
'base/backoff_entry_unittest.cc',
'base/big_endian_unittest.cc',
'base/data_url_unittest.cc',
'base/directory_lister_unittest.cc',
'base/dns_util_unittest.cc',
'base/escape_unittest.cc',
'base/expiring_cache_unittest.cc',
'base/file_stream_unittest.cc',
'base/filter_unittest.cc',
'base/int128_unittest.cc',
'base/gzip_filter_unittest.cc',
'base/host_mapping_rules_unittest.cc',
'base/host_port_pair_unittest.cc',
'base/ip_endpoint_unittest.cc',
'base/keygen_handler_unittest.cc',
'base/mime_sniffer_unittest.cc',
'base/mime_util_unittest.cc',
'base/mock_filter_context.cc',
'base/mock_filter_context.h',
'base/net_log_unittest.cc',
'base/net_log_unittest.h',
'base/net_util_unittest.cc',
'base/network_change_notifier_win_unittest.cc',
'base/prioritized_dispatcher_unittest.cc',
'base/priority_queue_unittest.cc',
'base/registry_controlled_domains/registry_controlled_domain_unittest.cc',
'base/sdch_filter_unittest.cc',
'base/static_cookie_policy_unittest.cc',
'base/test_completion_callback_unittest.cc',
'base/upload_bytes_element_reader_unittest.cc',
'base/upload_data_stream_unittest.cc',
'base/upload_file_element_reader_unittest.cc',
'base/url_util_unittest.cc',
'cert/cert_verify_proc_unittest.cc',
'cert/crl_set_unittest.cc',
'cert/ev_root_ca_metadata_unittest.cc',
'cert/multi_threaded_cert_verifier_unittest.cc',
'cert/nss_cert_database_unittest.cc',
'cert/pem_tokenizer_unittest.cc',
'cert/x509_certificate_unittest.cc',
'cert/x509_cert_types_unittest.cc',
'cert/x509_util_unittest.cc',
'cert/x509_util_nss_unittest.cc',
'cert/x509_util_openssl_unittest.cc',
'cookies/canonical_cookie_unittest.cc',
'cookies/cookie_monster_unittest.cc',
'cookies/cookie_store_unittest.h',
'cookies/cookie_util_unittest.cc',
'cookies/parsed_cookie_unittest.cc',
'disk_cache/addr_unittest.cc',
'disk_cache/backend_unittest.cc',
'disk_cache/bitmap_unittest.cc',
'disk_cache/block_files_unittest.cc',
'disk_cache/cache_util_unittest.cc',
'disk_cache/entry_unittest.cc',
'disk_cache/mapped_file_unittest.cc',
'disk_cache/storage_block_unittest.cc',
'disk_cache/flash/flash_entry_unittest.cc',
'disk_cache/flash/log_store_entry_unittest.cc',
'disk_cache/flash/log_store_unittest.cc',
'disk_cache/flash/segment_unittest.cc',
'disk_cache/flash/storage_unittest.cc',
'dns/address_sorter_posix_unittest.cc',
'dns/address_sorter_unittest.cc',
'dns/dns_config_service_posix_unittest.cc',
'dns/dns_config_service_unittest.cc',
'dns/dns_config_service_win_unittest.cc',
'dns/dns_hosts_unittest.cc',
'dns/dns_query_unittest.cc',
'dns/dns_response_unittest.cc',
'dns/dns_session_unittest.cc',
'dns/dns_transaction_unittest.cc',
'dns/host_cache_unittest.cc',
'dns/host_resolver_impl_unittest.cc',
'dns/mapped_host_resolver_unittest.cc',
'dns/serial_worker_unittest.cc',
'dns/single_request_host_resolver_unittest.cc',
'ftp/ftp_auth_cache_unittest.cc',
'ftp/ftp_ctrl_response_buffer_unittest.cc',
'ftp/ftp_directory_listing_parser_ls_unittest.cc',
'ftp/ftp_directory_listing_parser_netware_unittest.cc',
'ftp/ftp_directory_listing_parser_os2_unittest.cc',
'ftp/ftp_directory_listing_parser_unittest.cc',
'ftp/ftp_directory_listing_parser_unittest.h',
'ftp/ftp_directory_listing_parser_vms_unittest.cc',
'ftp/ftp_directory_listing_parser_windows_unittest.cc',
'ftp/ftp_network_transaction_unittest.cc',
'ftp/ftp_util_unittest.cc',
'http/des_unittest.cc',
'http/http_auth_cache_unittest.cc',
'http/http_auth_controller_unittest.cc',
'http/http_auth_filter_unittest.cc',
'http/http_auth_gssapi_posix_unittest.cc',
'http/http_auth_handler_basic_unittest.cc',
'http/http_auth_handler_digest_unittest.cc',
'http/http_auth_handler_factory_unittest.cc',
'http/http_auth_handler_mock.cc',
'http/http_auth_handler_mock.h',
'http/http_auth_handler_negotiate_unittest.cc',
'http/http_auth_handler_unittest.cc',
'http/http_auth_sspi_win_unittest.cc',
'http/http_auth_unittest.cc',
'http/http_byte_range_unittest.cc',
'http/http_cache_unittest.cc',
'http/http_chunked_decoder_unittest.cc',
'http/http_content_disposition_unittest.cc',
'http/http_network_layer_unittest.cc',
'http/http_network_transaction_spdy3_unittest.cc',
'http/http_network_transaction_spdy2_unittest.cc',
'http/http_pipelined_connection_impl_unittest.cc',
'http/http_pipelined_host_forced_unittest.cc',
'http/http_pipelined_host_impl_unittest.cc',
'http/http_pipelined_host_pool_unittest.cc',
'http/http_pipelined_host_test_util.cc',
'http/http_pipelined_host_test_util.h',
'http/http_pipelined_network_transaction_unittest.cc',
'http/http_proxy_client_socket_pool_spdy2_unittest.cc',
'http/http_proxy_client_socket_pool_spdy3_unittest.cc',
'http/http_request_headers_unittest.cc',
'http/http_response_body_drainer_unittest.cc',
'http/http_response_headers_unittest.cc',
'http/http_security_headers_unittest.cc',
'http/http_server_properties_impl_unittest.cc',
'http/http_stream_factory_impl_unittest.cc',
'http/http_stream_parser_unittest.cc',
'http/http_transaction_unittest.cc',
'http/http_transaction_unittest.h',
'http/http_util_unittest.cc',
'http/http_vary_data_unittest.cc',
'http/mock_allow_url_security_manager.cc',
'http/mock_allow_url_security_manager.h',
'http/mock_gssapi_library_posix.cc',
'http/mock_gssapi_library_posix.h',
'http/mock_http_cache.cc',
'http/mock_http_cache.h',
'http/mock_sspi_library_win.cc',
'http/mock_sspi_library_win.h',
'http/transport_security_state_unittest.cc',
'http/url_security_manager_unittest.cc',
'proxy/dhcp_proxy_script_adapter_fetcher_win_unittest.cc',
'proxy/dhcp_proxy_script_fetcher_factory_unittest.cc',
'proxy/dhcp_proxy_script_fetcher_win_unittest.cc',
'proxy/multi_threaded_proxy_resolver_unittest.cc',
'proxy/network_delegate_error_observer_unittest.cc',
'proxy/proxy_bypass_rules_unittest.cc',
'proxy/proxy_config_service_android_unittest.cc',
'proxy/proxy_config_service_linux_unittest.cc',
'proxy/proxy_config_service_win_unittest.cc',
'proxy/proxy_config_unittest.cc',
'proxy/proxy_info_unittest.cc',
'proxy/proxy_list_unittest.cc',
'proxy/proxy_resolver_v8_tracing_unittest.cc',
'proxy/proxy_resolver_v8_unittest.cc',
'proxy/proxy_script_decider_unittest.cc',
'proxy/proxy_script_fetcher_impl_unittest.cc',
'proxy/proxy_server_unittest.cc',
'proxy/proxy_service_unittest.cc',
'quic/blocked_list_test.cc',
'quic/congestion_control/available_channel_estimator_test.cc',
'quic/congestion_control/channel_estimator_test.cc',
'quic/congestion_control/cube_root_test.cc',
'quic/congestion_control/cubic_test.cc',
'quic/congestion_control/fix_rate_test.cc',
'quic/congestion_control/hybrid_slow_start_test.cc',
'quic/congestion_control/inter_arrival_bitrate_ramp_up_test.cc',
'quic/congestion_control/inter_arrival_overuse_detector_test.cc',
'quic/congestion_control/inter_arrival_probe_test.cc',
'quic/congestion_control/inter_arrival_receiver_test.cc',
'quic/congestion_control/inter_arrival_state_machine_test.cc',
'quic/congestion_control/inter_arrival_sender_test.cc',
'quic/congestion_control/leaky_bucket_test.cc',
'quic/congestion_control/paced_sender_test.cc',
'quic/congestion_control/quic_congestion_control_test.cc',
'quic/congestion_control/quic_congestion_manager_test.cc',
'quic/congestion_control/quic_max_sized_map_test.cc',
'quic/congestion_control/tcp_cubic_sender_test.cc',
'quic/congestion_control/tcp_receiver_test.cc',
'quic/crypto/aes_128_gcm_decrypter_test.cc',
'quic/crypto/aes_128_gcm_encrypter_test.cc',
'quic/crypto/crypto_framer_test.cc',
'quic/crypto/crypto_handshake_test.cc',
'quic/crypto/curve25519_key_exchange_test.cc',
'quic/crypto/null_decrypter_test.cc',
'quic/crypto/null_encrypter_test.cc',
'quic/crypto/p256_key_exchange_test.cc',
'quic/crypto/quic_random_test.cc',
'quic/crypto/strike_register_test.cc',
'quic/test_tools/crypto_test_utils.cc',
'quic/test_tools/crypto_test_utils.h',
'quic/test_tools/mock_clock.cc',
'quic/test_tools/mock_clock.h',
'quic/test_tools/mock_crypto_client_stream.cc',
'quic/test_tools/mock_crypto_client_stream.h',
'quic/test_tools/mock_crypto_client_stream_factory.cc',
'quic/test_tools/mock_crypto_client_stream_factory.h',
'quic/test_tools/mock_random.cc',
'quic/test_tools/mock_random.h',
'quic/test_tools/quic_connection_peer.cc',
'quic/test_tools/quic_connection_peer.h',
'quic/test_tools/quic_framer_peer.cc',
'quic/test_tools/quic_framer_peer.h',
'quic/test_tools/quic_packet_creator_peer.cc',
'quic/test_tools/quic_packet_creator_peer.h',
'quic/test_tools/quic_session_peer.cc',
'quic/test_tools/quic_session_peer.h',
'quic/test_tools/quic_test_utils.cc',
'quic/test_tools/quic_test_utils.h',
'quic/test_tools/reliable_quic_stream_peer.cc',
'quic/test_tools/reliable_quic_stream_peer.h',
'quic/test_tools/simple_quic_framer.cc',
'quic/test_tools/simple_quic_framer.h',
'quic/test_tools/test_task_runner.cc',
'quic/test_tools/test_task_runner.h',
'quic/quic_bandwidth_test.cc',
'quic/quic_client_session_test.cc',
'quic/quic_clock_test.cc',
'quic/quic_connection_helper_test.cc',
'quic/quic_connection_test.cc',
'quic/quic_crypto_client_stream_test.cc',
'quic/quic_crypto_server_stream_test.cc',
'quic/quic_crypto_stream_test.cc',
'quic/quic_data_writer_test.cc',
'quic/quic_fec_group_test.cc',
'quic/quic_framer_test.cc',
'quic/quic_http_stream_test.cc',
'quic/quic_network_transaction_unittest.cc',
'quic/quic_packet_creator_test.cc',
'quic/quic_packet_entropy_manager_test.cc',
'quic/quic_packet_generator_test.cc',
'quic/quic_protocol_test.cc',
'quic/quic_reliable_client_stream_test.cc',
'quic/quic_session_test.cc',
'quic/quic_stream_factory_test.cc',
'quic/quic_stream_sequencer_test.cc',
'quic/quic_time_test.cc',
'quic/quic_utils_test.cc',
'quic/reliable_quic_stream_test.cc',
'socket/buffered_write_stream_socket_unittest.cc',
'socket/client_socket_pool_base_unittest.cc',
'socket/deterministic_socket_data_unittest.cc',
'socket/mock_client_socket_pool_manager.cc',
'socket/mock_client_socket_pool_manager.h',
'socket/socks5_client_socket_unittest.cc',
'socket/socks_client_socket_pool_unittest.cc',
'socket/socks_client_socket_unittest.cc',
'socket/ssl_client_socket_openssl_unittest.cc',
'socket/ssl_client_socket_pool_unittest.cc',
'socket/ssl_client_socket_unittest.cc',
'socket/ssl_server_socket_unittest.cc',
'socket/tcp_client_socket_unittest.cc',
'socket/tcp_listen_socket_unittest.cc',
'socket/tcp_listen_socket_unittest.h',
'socket/tcp_server_socket_unittest.cc',
'socket/transport_client_socket_pool_unittest.cc',
'socket/transport_client_socket_unittest.cc',
'socket/unix_domain_socket_posix_unittest.cc',
'socket_stream/socket_stream_metrics_unittest.cc',
'socket_stream/socket_stream_unittest.cc',
'spdy/buffered_spdy_framer_spdy3_unittest.cc',
'spdy/buffered_spdy_framer_spdy2_unittest.cc',
'spdy/spdy_credential_builder_unittest.cc',
'spdy/spdy_credential_state_unittest.cc',
'spdy/spdy_frame_builder_test.cc',
'spdy/spdy_frame_reader_test.cc',
'spdy/spdy_framer_test.cc',
'spdy/spdy_header_block_unittest.cc',
'spdy/spdy_http_stream_spdy3_unittest.cc',
'spdy/spdy_http_stream_spdy2_unittest.cc',
'spdy/spdy_http_utils_unittest.cc',
'spdy/spdy_network_transaction_spdy3_unittest.cc',
'spdy/spdy_network_transaction_spdy2_unittest.cc',
'spdy/spdy_priority_forest_test.cc',
'spdy/spdy_protocol_test.cc',
'spdy/spdy_proxy_client_socket_spdy3_unittest.cc',
'spdy/spdy_proxy_client_socket_spdy2_unittest.cc',
'spdy/spdy_session_spdy3_unittest.cc',
'spdy/spdy_session_spdy2_unittest.cc',
'spdy/spdy_stream_spdy3_unittest.cc',
'spdy/spdy_stream_spdy2_unittest.cc',
'spdy/spdy_stream_test_util.cc',
'spdy/spdy_stream_test_util.h',
'spdy/spdy_test_util_common.cc',
'spdy/spdy_test_util_common.h',
'spdy/spdy_test_util_spdy3.cc',
'spdy/spdy_test_util_spdy3.h',
'spdy/spdy_test_util_spdy2.cc',
'spdy/spdy_test_util_spdy2.h',
'spdy/spdy_test_utils.cc',
'spdy/spdy_test_utils.h',
'spdy/spdy_websocket_stream_spdy2_unittest.cc',
'spdy/spdy_websocket_stream_spdy3_unittest.cc',
'spdy/spdy_websocket_test_util_spdy2.cc',
'spdy/spdy_websocket_test_util_spdy2.h',
'spdy/spdy_websocket_test_util_spdy3.cc',
'spdy/spdy_websocket_test_util_spdy3.h',
'ssl/client_cert_store_impl_unittest.cc',
'ssl/default_server_bound_cert_store_unittest.cc',
'ssl/openssl_client_key_store_unittest.cc',
'ssl/server_bound_cert_service_unittest.cc',
'ssl/ssl_cipher_suite_names_unittest.cc',
'ssl/ssl_client_auth_cache_unittest.cc',
'ssl/ssl_config_service_unittest.cc',
'test/python_utils_unittest.cc',
'test/run_all_unittests.cc',
'test/test_certificate_data.h',
'tools/dump_cache/url_to_filename_encoder.cc',
'tools/dump_cache/url_to_filename_encoder.h',
'tools/dump_cache/url_to_filename_encoder_unittest.cc',
'tools/dump_cache/url_utilities.h',
'tools/dump_cache/url_utilities.cc',
'tools/dump_cache/url_utilities_unittest.cc',
'udp/udp_socket_unittest.cc',
'url_request/url_fetcher_impl_unittest.cc',
'url_request/url_request_context_builder_unittest.cc',
'url_request/url_request_filter_unittest.cc',
'url_request/url_request_ftp_job_unittest.cc',
'url_request/url_request_http_job_unittest.cc',
'url_request/url_request_job_factory_impl_unittest.cc',
'url_request/url_request_job_unittest.cc',
'url_request/url_request_throttler_simulation_unittest.cc',
'url_request/url_request_throttler_test_support.cc',
'url_request/url_request_throttler_test_support.h',
'url_request/url_request_throttler_unittest.cc',
'url_request/url_request_unittest.cc',
'url_request/view_cache_helper_unittest.cc',
'websockets/websocket_errors_unittest.cc',
'websockets/websocket_frame_parser_unittest.cc',
'websockets/websocket_frame_unittest.cc',
'websockets/websocket_handshake_handler_unittest.cc',
'websockets/websocket_handshake_handler_spdy2_unittest.cc',
'websockets/websocket_handshake_handler_spdy3_unittest.cc',
'websockets/websocket_job_spdy2_unittest.cc',
'websockets/websocket_job_spdy3_unittest.cc',
'websockets/websocket_net_log_params_unittest.cc',
'websockets/websocket_throttle_unittest.cc',
],
'conditions': [
['chromeos==1', {
'sources!': [
'base/network_change_notifier_linux_unittest.cc',
'proxy/proxy_config_service_linux_unittest.cc',
],
}],
[ 'OS == "android"', {
'sources!': [
# No res_ninit() et al on Android, so this doesn't make a lot of
# sense.
'dns/dns_config_service_posix_unittest.cc',
'ssl/client_cert_store_impl_unittest.cc',
],
'dependencies': [
'net_javatests',
'net_test_jni_headers',
],
}],
[ 'use_glib == 1', {
'dependencies': [
'../build/linux/system.gyp:ssl',
],
}, { # else use_glib == 0: !posix || mac
'sources!': [
'cert/nss_cert_database_unittest.cc',
],
},
],
[ 'toolkit_uses_gtk == 1', {
'dependencies': [
'../build/linux/system.gyp:gtk',
],
},
],
[ 'os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
'conditions': [
['linux_use_tcmalloc==1', {
'dependencies': [
'../base/allocator/allocator.gyp:allocator',
],
}],
],
}],
[ 'use_kerberos==1', {
'defines': [
'USE_KERBEROS',
],
}, { # use_kerberos == 0
'sources!': [
'http/http_auth_gssapi_posix_unittest.cc',
'http/http_auth_handler_negotiate_unittest.cc',
'http/mock_gssapi_library_posix.cc',
'http/mock_gssapi_library_posix.h',
],
}],
[ 'use_openssl==1', {
# When building for OpenSSL, we need to exclude NSS specific tests.
# TODO(bulach): Add equivalent tests when the underlying
# functionality is ported to OpenSSL.
'sources!': [
'cert/nss_cert_database_unittest.cc',
'cert/x509_util_nss_unittest.cc',
'ssl/client_cert_store_impl_unittest.cc',
],
}, { # else !use_openssl: remove the unneeded files
'sources!': [
'cert/x509_util_openssl_unittest.cc',
'socket/ssl_client_socket_openssl_unittest.cc',
'ssl/openssl_client_key_store_unittest.cc',
],
},
],
[ 'enable_websockets != 1', {
'sources/': [
['exclude', '^socket_stream/'],
['exclude', '^websockets/'],
['exclude', '^spdy/spdy_websocket_stream_spdy._unittest\\.cc$'],
],
}],
[ 'disable_ftp_support==1', {
'sources/': [
['exclude', '^ftp/'],
],
'sources!': [
'url_request/url_request_ftp_job_unittest.cc',
],
},
],
[ 'enable_built_in_dns!=1', {
'sources!': [
'dns/address_sorter_posix_unittest.cc',
'dns/address_sorter_unittest.cc',
],
},
],
[ 'use_v8_in_net==1', {
'dependencies': [
'net_with_v8',
],
}, { # else: !use_v8_in_net
'sources!': [
'proxy/proxy_resolver_v8_unittest.cc',
'proxy/proxy_resolver_v8_tracing_unittest.cc',
],
},
],
[ 'OS == "win"', {
'sources!': [
'dns/dns_config_service_posix_unittest.cc',
'http/http_auth_gssapi_posix_unittest.cc',
],
# This is needed to trigger the dll copy step on windows.
# TODO(mark): Specifying this here shouldn't be necessary.
'dependencies': [
'../third_party/icu/icu.gyp:icudata',
'../third_party/nss/nss.gyp:nspr',
'../third_party/nss/nss.gyp:nss',
'third_party/nss/ssl.gyp:libssl',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
],
[ 'OS == "mac"', {
'dependencies': [
'../third_party/nss/nss.gyp:nspr',
'../third_party/nss/nss.gyp:nss',
'third_party/nss/ssl.gyp:libssl',
],
},
],
[ 'OS == "ios"', {
'dependencies': [
'../third_party/nss/nss.gyp:nss',
],
'actions': [
{
'action_name': 'copy_test_data',
'variables': {
'test_data_files': [
'data/ssl/certificates/',
'data/url_request_unittest/',
],
'test_data_prefix': 'net',
},
'includes': [ '../build/copy_test_data_ios.gypi' ],
},
],
'sources!': [
# TODO(droger): The following tests are disabled because the
# implementation is missing or incomplete.
# KeygenHandler::GenKeyAndSignChallenge() is not ported to iOS.
'base/keygen_handler_unittest.cc',
# Need to read input data files.
'base/gzip_filter_unittest.cc',
'disk_cache/backend_unittest.cc',
'disk_cache/block_files_unittest.cc',
'socket/ssl_server_socket_unittest.cc',
# Need TestServer.
'proxy/proxy_script_fetcher_impl_unittest.cc',
'socket/ssl_client_socket_unittest.cc',
'ssl/client_cert_store_impl_unittest.cc',
'url_request/url_fetcher_impl_unittest.cc',
'url_request/url_request_context_builder_unittest.cc',
# Needs GetAppOutput().
'test/python_utils_unittest.cc',
# The following tests are disabled because they don't apply to
# iOS.
# OS is not "linux" or "freebsd" or "openbsd".
'socket/unix_domain_socket_posix_unittest.cc',
],
'conditions': [
['coverage != 0', {
'sources!': [
# These sources can't be built with coverage due to a
# toolchain bug: http://openradar.appspot.com/radar?id=1499403
'http/transport_security_state_unittest.cc',
# These tests crash when run with coverage turned on due to an
# issue with llvm_gcda_increment_indirect_counter:
# http://crbug.com/156058
'cookies/cookie_monster_unittest.cc',
'cookies/cookie_store_unittest.h',
'http/http_auth_controller_unittest.cc',
'http/http_network_layer_unittest.cc',
'http/http_network_transaction_spdy2_unittest.cc',
'http/http_network_transaction_spdy3_unittest.cc',
'spdy/spdy_http_stream_spdy2_unittest.cc',
'spdy/spdy_http_stream_spdy3_unittest.cc',
'spdy/spdy_proxy_client_socket_spdy3_unittest.cc',
'spdy/spdy_session_spdy3_unittest.cc',
# These tests crash when run with coverage turned on:
# http://crbug.com/177203
'proxy/proxy_service_unittest.cc',
],
}],
],
}],
[ 'OS == "linux"', {
'dependencies': [
'../build/linux/system.gyp:dbus',
'../dbus/dbus.gyp:dbus_test_support',
],
},
],
[ 'OS == "android"', {
'dependencies': [
'../third_party/openssl/openssl.gyp:openssl',
],
'sources!': [
'dns/dns_config_service_posix_unittest.cc',
],
},
],
['OS == "android" and gtest_target_type == "shared_library"', {
'dependencies': [
'../testing/android/native_test.gyp:native_test_native_code',
]
}],
[ 'OS != "win" and OS != "mac"', {
'sources!': [
'cert/x509_cert_types_unittest.cc',
],
}],
],
},
{
'target_name': 'net_perftests',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../base/base.gyp:test_support_perf',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../testing/gtest.gyp:gtest',
'net',
'net_test_support',
],
'sources': [
'cookies/cookie_monster_perftest.cc',
'disk_cache/disk_cache_perftest.cc',
'proxy/proxy_resolver_perftest.cc',
],
'conditions': [
[ 'use_v8_in_net==1', {
'dependencies': [
'net_with_v8',
],
}, { # else: !use_v8_in_net
'sources!': [
'proxy/proxy_resolver_perftest.cc',
],
},
],
# This is needed to trigger the dll copy step on windows.
# TODO(mark): Specifying this here shouldn't be necessary.
[ 'OS == "win"', {
'dependencies': [
'../third_party/icu/icu.gyp:icudata',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
],
],
},
{
'target_name': 'net_test_support',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../testing/gtest.gyp:gtest',
'net',
],
'export_dependent_settings': [
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
],
'sources': [
'base/capturing_net_log.cc',
'base/capturing_net_log.h',
'base/load_timing_info_test_util.cc',
'base/load_timing_info_test_util.h',
'base/mock_file_stream.cc',
'base/mock_file_stream.h',
'base/test_completion_callback.cc',
'base/test_completion_callback.h',
'base/test_data_directory.cc',
'base/test_data_directory.h',
'cert/mock_cert_verifier.cc',
'cert/mock_cert_verifier.h',
'cookies/cookie_monster_store_test.cc',
'cookies/cookie_monster_store_test.h',
'cookies/cookie_store_test_callbacks.cc',
'cookies/cookie_store_test_callbacks.h',
'cookies/cookie_store_test_helpers.cc',
'cookies/cookie_store_test_helpers.h',
'disk_cache/disk_cache_test_base.cc',
'disk_cache/disk_cache_test_base.h',
'disk_cache/disk_cache_test_util.cc',
'disk_cache/disk_cache_test_util.h',
'disk_cache/flash/flash_cache_test_base.h',
'disk_cache/flash/flash_cache_test_base.cc',
'dns/dns_test_util.cc',
'dns/dns_test_util.h',
'dns/mock_host_resolver.cc',
'dns/mock_host_resolver.h',
'proxy/mock_proxy_resolver.cc',
'proxy/mock_proxy_resolver.h',
'proxy/mock_proxy_script_fetcher.cc',
'proxy/mock_proxy_script_fetcher.h',
'proxy/proxy_config_service_common_unittest.cc',
'proxy/proxy_config_service_common_unittest.h',
'socket/socket_test_util.cc',
'socket/socket_test_util.h',
'test/base_test_server.cc',
'test/base_test_server.h',
'test/cert_test_util.cc',
'test/cert_test_util.h',
'test/local_test_server_posix.cc',
'test/local_test_server_win.cc',
'test/local_test_server.cc',
'test/local_test_server.h',
'test/net_test_suite.cc',
'test/net_test_suite.h',
'test/python_utils.cc',
'test/python_utils.h',
'test/remote_test_server.cc',
'test/remote_test_server.h',
'test/spawner_communicator.cc',
'test/spawner_communicator.h',
'test/test_server.h',
'url_request/test_url_fetcher_factory.cc',
'url_request/test_url_fetcher_factory.h',
'url_request/url_request_test_util.cc',
'url_request/url_request_test_util.h',
],
'conditions': [
['inside_chromium_build==1 and OS != "ios"', {
'dependencies': [
'../third_party/protobuf/protobuf.gyp:py_proto',
],
}],
['os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
'conditions': [
['use_openssl==1', {
'dependencies': [
'../third_party/openssl/openssl.gyp:openssl',
],
}, {
'dependencies': [
'../build/linux/system.gyp:ssl',
],
}],
],
}],
['os_posix == 1 and OS != "mac" and OS != "android" and OS != "ios"', {
'conditions': [
['linux_use_tcmalloc==1', {
'dependencies': [
'../base/allocator/allocator.gyp:allocator',
],
}],
],
}],
['OS != "android"', {
'sources!': [
'test/remote_test_server.cc',
'test/remote_test_server.h',
'test/spawner_communicator.cc',
'test/spawner_communicator.h',
],
}],
['OS == "ios"', {
'dependencies': [
'../third_party/nss/nss.gyp:nss',
],
}],
[ 'use_v8_in_net==1', {
'dependencies': [
'net_with_v8',
],
},
],
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'net_resources',
'type': 'none',
'variables': {
'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/net',
},
'actions': [
{
'action_name': 'net_resources',
'variables': {
'grit_grd_file': 'base/net_resources.grd',
},
'includes': [ '../build/grit_action.gypi' ],
},
],
'includes': [ '../build/grit_target.gypi' ],
},
{
'target_name': 'http_server',
'type': 'static_library',
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'../base/base.gyp:base',
'net',
],
'sources': [
'server/http_connection.cc',
'server/http_connection.h',
'server/http_server.cc',
'server/http_server.h',
'server/http_server_request_info.cc',
'server/http_server_request_info.h',
'server/web_socket.cc',
'server/web_socket.h',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'dump_cache',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
'net_test_support',
],
'sources': [
'tools/dump_cache/cache_dumper.cc',
'tools/dump_cache/cache_dumper.h',
'tools/dump_cache/dump_cache.cc',
'tools/dump_cache/dump_files.cc',
'tools/dump_cache/dump_files.h',
'tools/dump_cache/simple_cache_dumper.cc',
'tools/dump_cache/simple_cache_dumper.h',
'tools/dump_cache/upgrade_win.cc',
'tools/dump_cache/upgrade_win.h',
'tools/dump_cache/url_to_filename_encoder.cc',
'tools/dump_cache/url_to_filename_encoder.h',
'tools/dump_cache/url_utilities.h',
'tools/dump_cache/url_utilities.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
],
'conditions': [
['use_v8_in_net == 1', {
'targets': [
{
'target_name': 'net_with_v8',
'type': '<(component)',
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'../base/base.gyp:base',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../v8/tools/gyp/v8.gyp:v8',
'net'
],
'defines': [
'NET_IMPLEMENTATION',
],
'sources': [
'proxy/proxy_resolver_v8.cc',
'proxy/proxy_resolver_v8.h',
'proxy/proxy_resolver_v8_tracing.cc',
'proxy/proxy_resolver_v8_tracing.h',
'proxy/proxy_service_v8.cc',
'proxy/proxy_service_v8.h',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
],
}],
['OS != "ios"', {
'targets': [
# iOS doesn't have the concept of simple executables, these targets
# can't be compiled on the platform.
{
'target_name': 'crash_cache',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
'net_test_support',
],
'sources': [
'tools/crash_cache/crash_cache.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'crl_set_dump',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
],
'sources': [
'tools/crl_set_dump/crl_set_dump.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'dns_fuzz_stub',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
],
'sources': [
'tools/dns_fuzz_stub/dns_fuzz_stub.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'fetch_client',
'type': 'executable',
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../testing/gtest.gyp:gtest',
'net',
'net_with_v8',
],
'sources': [
'tools/fetch/fetch_client.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'fetch_server',
'type': 'executable',
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'../base/base.gyp:base',
'../build/temp_gyp/googleurl.gyp:googleurl',
'net',
],
'sources': [
'tools/fetch/fetch_server.cc',
'tools/fetch/http_listen_socket.cc',
'tools/fetch/http_listen_socket.h',
'tools/fetch/http_server.cc',
'tools/fetch/http_server.h',
'tools/fetch/http_server_request_info.cc',
'tools/fetch/http_server_request_info.h',
'tools/fetch/http_server_response_info.cc',
'tools/fetch/http_server_response_info.h',
'tools/fetch/http_session.cc',
'tools/fetch/http_session.h',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'gdig',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
],
'sources': [
'tools/gdig/file_net_log.cc',
'tools/gdig/gdig.cc',
],
},
{
'target_name': 'get_server_time',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../build/temp_gyp/googleurl.gyp:googleurl',
'net',
],
'sources': [
'tools/get_server_time/get_server_time.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'net_watcher',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
'net_with_v8',
],
'conditions': [
[ 'use_glib == 1', {
'dependencies': [
'../build/linux/system.gyp:gconf',
'../build/linux/system.gyp:gio',
],
},
],
],
'sources': [
'tools/net_watcher/net_watcher.cc',
],
},
{
'target_name': 'run_testserver',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
'net_test_support',
],
'sources': [
'tools/testserver/run_testserver.cc',
],
},
{
'target_name': 'stress_cache',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'net',
'net_test_support',
],
'sources': [
'disk_cache/stress_cache.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
{
'target_name': 'tld_cleanup',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
'../build/temp_gyp/googleurl.gyp:googleurl',
],
'sources': [
'tools/tld_cleanup/tld_cleanup.cc',
],
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
'msvs_disabled_warnings': [4267, ],
},
],
}],
['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
'targets': [
{
'target_name': 'flip_balsa_and_epoll_library',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'net',
],
'sources': [
'tools/flip_server/balsa_enums.h',
'tools/flip_server/balsa_frame.cc',
'tools/flip_server/balsa_frame.h',
'tools/flip_server/balsa_headers.cc',
'tools/flip_server/balsa_headers.h',
'tools/flip_server/balsa_headers_token_utils.cc',
'tools/flip_server/balsa_headers_token_utils.h',
'tools/flip_server/balsa_visitor_interface.h',
'tools/flip_server/constants.h',
'tools/flip_server/epoll_server.cc',
'tools/flip_server/epoll_server.h',
'tools/flip_server/http_message_constants.cc',
'tools/flip_server/http_message_constants.h',
'tools/flip_server/split.h',
'tools/flip_server/split.cc',
],
},
{
'target_name': 'flip_in_mem_edsm_server',
'type': 'executable',
'cflags': [
'-Wno-deprecated',
],
'dependencies': [
'../base/base.gyp:base',
'../third_party/openssl/openssl.gyp:openssl',
'flip_balsa_and_epoll_library',
'net',
],
'sources': [
'tools/dump_cache/url_to_filename_encoder.cc',
'tools/dump_cache/url_to_filename_encoder.h',
'tools/dump_cache/url_utilities.h',
'tools/dump_cache/url_utilities.cc',
'tools/flip_server/acceptor_thread.h',
'tools/flip_server/acceptor_thread.cc',
'tools/flip_server/buffer_interface.h',
'tools/flip_server/create_listener.cc',
'tools/flip_server/create_listener.h',
'tools/flip_server/flip_config.cc',
'tools/flip_server/flip_config.h',
'tools/flip_server/flip_in_mem_edsm_server.cc',
'tools/flip_server/http_interface.cc',
'tools/flip_server/http_interface.h',
'tools/flip_server/loadtime_measurement.h',
'tools/flip_server/mem_cache.h',
'tools/flip_server/mem_cache.cc',
'tools/flip_server/output_ordering.cc',
'tools/flip_server/output_ordering.h',
'tools/flip_server/ring_buffer.cc',
'tools/flip_server/ring_buffer.h',
'tools/flip_server/simple_buffer.cc',
'tools/flip_server/simple_buffer.h',
'tools/flip_server/sm_connection.cc',
'tools/flip_server/sm_connection.h',
'tools/flip_server/sm_interface.h',
'tools/flip_server/spdy_ssl.cc',
'tools/flip_server/spdy_ssl.h',
'tools/flip_server/spdy_interface.cc',
'tools/flip_server/spdy_interface.h',
'tools/flip_server/spdy_util.cc',
'tools/flip_server/spdy_util.h',
'tools/flip_server/streamer_interface.cc',
'tools/flip_server/streamer_interface.h',
'tools/flip_server/string_piece_utils.h',
],
},
{
'target_name': 'quic_library',
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../build/temp_gyp/googleurl.gyp:googleurl',
'../third_party/openssl/openssl.gyp:openssl',
'flip_balsa_and_epoll_library',
'net',
],
'sources': [
'tools/quic/quic_client.cc',
'tools/quic/quic_client.h',
'tools/quic/quic_client_session.cc',
'tools/quic/quic_client_session.h',
'tools/quic/quic_dispatcher.h',
'tools/quic/quic_dispatcher.cc',
'tools/quic/quic_epoll_clock.cc',
'tools/quic/quic_epoll_clock.h',
'tools/quic/quic_epoll_connection_helper.cc',
'tools/quic/quic_epoll_connection_helper.h',
'tools/quic/quic_in_memory_cache.cc',
'tools/quic/quic_in_memory_cache.h',
'tools/quic/quic_packet_writer.h',
'tools/quic/quic_reliable_client_stream.cc',
'tools/quic/quic_reliable_client_stream.h',
'tools/quic/quic_reliable_server_stream.cc',
'tools/quic/quic_reliable_server_stream.h',
'tools/quic/quic_server.cc',
'tools/quic/quic_server.h',
'tools/quic/quic_server_session.cc',
'tools/quic/quic_server_session.h',
'tools/quic/quic_socket_utils.cc',
'tools/quic/quic_socket_utils.h',
'tools/quic/quic_spdy_client_stream.cc',
'tools/quic/quic_spdy_client_stream.h',
'tools/quic/quic_spdy_server_stream.cc',
'tools/quic/quic_spdy_server_stream.h',
'tools/quic/quic_time_wait_list_manager.h',
'tools/quic/quic_time_wait_list_manager.cc',
'tools/quic/spdy_utils.cc',
'tools/quic/spdy_utils.h',
],
},
{
'target_name': 'quic_client',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../third_party/openssl/openssl.gyp:openssl',
'net',
'quic_library',
],
'sources': [
'tools/quic/quic_client_bin.cc',
],
},
{
'target_name': 'quic_server',
'type': 'executable',
'dependencies': [
'../base/base.gyp:base',
'../third_party/openssl/openssl.gyp:openssl',
'net',
'quic_library',
],
'sources': [
'tools/quic/quic_server_bin.cc',
],
},
{
'target_name': 'quic_unittests',
'type': '<(gtest_target_type)',
'dependencies': [
'../base/base.gyp:test_support_base',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'net',
'quic_library',
],
'sources': [
'quic/test_tools/quic_session_peer.cc',
'quic/test_tools/quic_session_peer.h',
'quic/test_tools/crypto_test_utils.cc',
'quic/test_tools/crypto_test_utils.h',
'quic/test_tools/mock_clock.cc',
'quic/test_tools/mock_clock.h',
'quic/test_tools/mock_random.cc',
'quic/test_tools/mock_random.h',
'quic/test_tools/simple_quic_framer.cc',
'quic/test_tools/simple_quic_framer.h',
'quic/test_tools/quic_connection_peer.cc',
'quic/test_tools/quic_connection_peer.h',
'quic/test_tools/quic_framer_peer.cc',
'quic/test_tools/quic_framer_peer.h',
'quic/test_tools/quic_session_peer.cc',
'quic/test_tools/quic_session_peer.h',
'quic/test_tools/quic_test_utils.cc',
'quic/test_tools/quic_test_utils.h',
'quic/test_tools/reliable_quic_stream_peer.cc',
'quic/test_tools/reliable_quic_stream_peer.h',
'tools/flip_server/simple_buffer.cc',
'tools/flip_server/simple_buffer.h',
'tools/quic/end_to_end_test.cc',
'tools/quic/quic_client_session_test.cc',
'tools/quic/quic_dispatcher_test.cc',
'tools/quic/quic_epoll_clock_test.cc',
'tools/quic/quic_epoll_connection_helper_test.cc',
'tools/quic/quic_reliable_client_stream_test.cc',
'tools/quic/quic_reliable_server_stream_test.cc',
'tools/quic/test_tools/http_message_test_utils.cc',
'tools/quic/test_tools/http_message_test_utils.h',
'tools/quic/test_tools/mock_epoll_server.cc',
'tools/quic/test_tools/mock_epoll_server.h',
'tools/quic/test_tools/quic_test_client.cc',
'tools/quic/test_tools/quic_test_client.h',
'tools/quic/test_tools/quic_test_utils.cc',
'tools/quic/test_tools/quic_test_utils.h',
'tools/quic/test_tools/run_all_unittests.cc',
],
}
]
}],
['OS=="android"', {
'targets': [
{
'target_name': 'net_jni_headers',
'type': 'none',
'sources': [
'android/java/src/org/chromium/net/AndroidKeyStore.java',
'android/java/src/org/chromium/net/AndroidNetworkLibrary.java',
'android/java/src/org/chromium/net/GURLUtils.java',
'android/java/src/org/chromium/net/NetworkChangeNotifier.java',
'android/java/src/org/chromium/net/ProxyChangeListener.java',
],
'variables': {
'jni_gen_package': 'net',
},
'direct_dependent_settings': {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/net',
],
},
'includes': [ '../build/jni_generator.gypi' ],
},
{
'target_name': 'net_test_jni_headers',
'type': 'none',
'sources': [
'android/javatests/src/org/chromium/net/AndroidKeyStoreTestUtil.java',
],
'variables': {
'jni_gen_package': 'net',
},
'direct_dependent_settings': {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/net',
],
},
'includes': [ '../build/jni_generator.gypi' ],
},
{
'target_name': 'net_java',
'type': 'none',
'variables': {
'java_in_dir': '../net/android/java',
},
'dependencies': [
'../base/base.gyp:base',
'cert_verify_result_android_java',
'certificate_mime_types_java',
'net_errors_java',
'private_key_types_java',
],
'includes': [ '../build/java.gypi' ],
},
{
'target_name': 'net_java_test_support',
'type': 'none',
'variables': {
'java_in_dir': '../net/test/android/javatests',
},
'includes': [ '../build/java.gypi' ],
},
{
'target_name': 'net_javatests',
'type': 'none',
'variables': {
'java_in_dir': '../net/android/javatests',
},
'dependencies': [
'../base/base.gyp:base',
'../base/base.gyp:base_java_test_support',
'net_java',
],
'includes': [ '../build/java.gypi' ],
},
{
'target_name': 'net_errors_java',
'type': 'none',
'sources': [
'android/java/NetError.template',
],
'variables': {
'package_name': 'org/chromium/net',
'template_deps': ['base/net_error_list.h'],
},
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'certificate_mime_types_java',
'type': 'none',
'sources': [
'android/java/CertificateMimeType.template',
],
'variables': {
'package_name': 'org/chromium/net',
'template_deps': ['base/mime_util_certificate_type_list.h'],
},
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'cert_verify_result_android_java',
'type': 'none',
'sources': [
'android/java/CertVerifyResultAndroid.template',
],
'variables': {
'package_name': 'org/chromium/net',
'template_deps': ['android/cert_verify_result_android_list.h'],
},
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
{
'target_name': 'private_key_types_java',
'type': 'none',
'sources': [
'android/java/PrivateKeyType.template',
],
'variables': {
'package_name': 'org/chromium/net',
'template_deps': ['android/private_key_type_list.h'],
},
'includes': [ '../build/android/java_cpp_template.gypi' ],
},
],
}],
# Special target to wrap a gtest_target_type==shared_library
# net_unittests into an android apk for execution.
# See base.gyp for TODO(jrg)s about this strategy.
['OS == "android" and gtest_target_type == "shared_library"', {
'targets': [
{
'target_name': 'net_unittests_apk',
'type': 'none',
'dependencies': [
'net_java',
'net_javatests',
'net_unittests',
],
'variables': {
'test_suite_name': 'net_unittests',
'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)net_unittests<(SHARED_LIB_SUFFIX)',
},
'includes': [ '../build/apk_test.gypi' ],
},
],
}],
['test_isolation_mode != "noop"', {
'targets': [
{
'target_name': 'net_unittests_run',
'type': 'none',
'dependencies': [
'net_unittests',
],
'includes': [
'net_unittests.isolate',
],
'actions': [
{
'action_name': 'isolate',
'inputs': [
'net_unittests.isolate',
'<@(isolate_dependency_tracked)',
],
'outputs': [
'<(PRODUCT_DIR)/net_unittests.isolated',
],
'action': [
'python',
'../tools/swarm_client/isolate.py',
'<(test_isolation_mode)',
'--outdir', '<(test_isolation_outdir)',
'--variable', 'PRODUCT_DIR', '<(PRODUCT_DIR)',
'--variable', 'OS', '<(OS)',
'--result', '<@(_outputs)',
'--isolate', 'net_unittests.isolate',
],
},
],
},
],
}],
],
}
| 39.074247
| 106
| 0.589587
| 12,482
| 108,939
| 4.75701
| 0.061368
| 0.04362
| 0.015326
| 0.022904
| 0.747495
| 0.566634
| 0.395742
| 0.303468
| 0.259595
| 0.232447
| 0
| 0.006844
| 0.279707
| 108,939
| 2,787
| 107
| 39.088267
| 0.74986
| 0.036103
| 0
| 0.395357
| 0
| 0.001474
| 0.633089
| 0.544995
| 0
| 0
| 0
| 0.000359
| 0
| 1
| 0
| true
| 0.001105
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
71eb4d213edb33b0bf4b80a95a7ac788fefb3194
| 892
|
py
|
Python
|
char_map.py
|
rakib313/Bangla-End2End-Speech-Recognition
|
67e776841bf2bb3f108e94d0567dc707497605ff
|
[
"MIT"
] | null | null | null |
char_map.py
|
rakib313/Bangla-End2End-Speech-Recognition
|
67e776841bf2bb3f108e94d0567dc707497605ff
|
[
"MIT"
] | null | null | null |
char_map.py
|
rakib313/Bangla-End2End-Speech-Recognition
|
67e776841bf2bb3f108e94d0567dc707497605ff
|
[
"MIT"
] | null | null | null |
"""
Defines two dictionaries for converting
between text and integer sequences.
"""
char_map_str = """
' 0
<SPACE> 1
ব 2
া 3
ং 4
ল 5
দ 6
ে 7
শ 8
য 9
় 10
ি 11
ত 12
্ 13
ন 14
এ 15
ধ 16
র 17
ণ 18
ক 19
ড 20
হ 21
উ 22
প 23
জ 24
অ 25
থ 26
স 27
ষ 28
ই 29
আ 30
ছ 31
গ 32
ু 33
ো 34
ও 35
ভ 36
ী 37
ট 38
ূ 39
ম 40
ৈ 41
ৃ 42
ঙ 43
খ 44
ঃ 45
১ 46
৯ 47
৬ 48
০ 49
২ 50
চ 51
ঘ 52
ৎ 53
৫ 54
৪ 55
ফ 56
ৌ 57
৮ 58
ঁ 59
য় 60
৩ 61
ঢ 62
ঠ 63
৭ 64
ড় 65
ঝ 66
ঞ 67
ঔ 68
ঈ 69
v 70
b 71
s 72
ঐ 73
2 74
0 75
1 76
4 77
f 78
o 79
t 80
a 81
l 82
w 83
r 84
d 85
c 86
u 87
p 88
n 89
g 90
ঋ 91
i 92
z 93
m 94
e 95
ঊ 96
h 97
x 98
3 99
5 100
y 101
9 102
ৗ 103
j 104
œ 105
8 106
ঢ় 107
k 108
ৰ 109
"""
# the "blank" character is mapped to 28
char_map = {}
index_map = {}
for line in char_map_str.strip().split('\n'):
ch, index = line.split()
char_map[ch] = int(index)
index_map[int(index)+1] = ch
index_map[2] = ' '
| 7.023622
| 45
| 0.600897
| 273
| 892
| 2
| 0.857143
| 0.051282
| 0.03663
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.397373
| 0.317265
| 892
| 127
| 46
| 7.023622
| 0.46798
| 0.128924
| 0
| 0
| 0
| 0
| 0.727273
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
71f8c70583f9e40977155faf528bc04d31d42d94
| 123
|
py
|
Python
|
EX025.py
|
gjaosdij/PythonProject
|
ae27990efa93462b632f165d13c08c7fd93beb38
|
[
"MIT"
] | null | null | null |
EX025.py
|
gjaosdij/PythonProject
|
ae27990efa93462b632f165d13c08c7fd93beb38
|
[
"MIT"
] | null | null | null |
EX025.py
|
gjaosdij/PythonProject
|
ae27990efa93462b632f165d13c08c7fd93beb38
|
[
"MIT"
] | null | null | null |
print('Digite seu nome completo: ')
nome = input().strip().upper()
print('Seu nome tem "Silva"?')
print('SILVA' in nome)
| 17.571429
| 35
| 0.658537
| 18
| 123
| 4.5
| 0.611111
| 0.17284
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.138211
| 123
| 6
| 36
| 20.5
| 0.764151
| 0
| 0
| 0
| 0
| 0
| 0.422764
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.75
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 3
|
9c0a5c02779cee26231b6b416177aadae209d132
| 83
|
py
|
Python
|
torch_geometric/nn/unpool/__init__.py
|
mwussow/pytorch_geometric
|
01c68f9b58c94d9efd1f6e39b9c85177aae521bb
|
[
"MIT"
] | 13
|
2019-11-07T02:57:41.000Z
|
2021-12-28T08:19:56.000Z
|
torch_geometric/nn/unpool/__init__.py
|
mwussow/pytorch_geometric
|
01c68f9b58c94d9efd1f6e39b9c85177aae521bb
|
[
"MIT"
] | 3
|
2019-10-30T20:20:27.000Z
|
2022-03-12T22:56:11.000Z
|
torch_geometric/nn/unpool/__init__.py
|
mwussow/pytorch_geometric
|
01c68f9b58c94d9efd1f6e39b9c85177aae521bb
|
[
"MIT"
] | 3
|
2020-10-19T02:53:20.000Z
|
2022-01-31T04:31:02.000Z
|
from .knn_interpolate import knn_interpolate
__all__ = [
'knn_interpolate',
]
| 13.833333
| 44
| 0.746988
| 9
| 83
| 6.111111
| 0.555556
| 0.763636
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.168675
| 83
| 5
| 45
| 16.6
| 0.797101
| 0
| 0
| 0
| 0
| 0
| 0.180723
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.25
| 0
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c12bc71f759e734d137bff21cddbea3b1e6369f
| 90
|
py
|
Python
|
regtests/calling/function_expression.py
|
bpmbank/PythonJS
|
591a80afd8233fb715493591db2b68f1748558d9
|
[
"BSD-3-Clause"
] | 319
|
2015-01-02T11:34:16.000Z
|
2022-03-25T00:43:33.000Z
|
regtests/calling/function_expression.py
|
bpmbank/PythonJS
|
591a80afd8233fb715493591db2b68f1748558d9
|
[
"BSD-3-Clause"
] | 10
|
2015-02-03T02:33:09.000Z
|
2021-11-09T21:41:00.000Z
|
regtests/calling/function_expression.py
|
bpmbank/PythonJS
|
591a80afd8233fb715493591db2b68f1748558d9
|
[
"BSD-3-Clause"
] | 61
|
2015-01-02T12:01:56.000Z
|
2021-12-08T07:16:16.000Z
|
"""func expr"""
F = function( x,y ):
return x+y
def main():
TestError( F(1,2) == 3 )
| 10
| 25
| 0.522222
| 16
| 90
| 2.9375
| 0.8125
| 0.085106
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.043478
| 0.233333
| 90
| 8
| 26
| 11.25
| 0.637681
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0
| null | null | 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c17deaa4c71e1a4a4c819492abf40341d7c1817
| 629
|
py
|
Python
|
helpers/time_utils.py
|
mandalorian-101/badger-system
|
2b0ee9bd77a2cc6f875b9b984ae4dfe713bbc55c
|
[
"MIT"
] | null | null | null |
helpers/time_utils.py
|
mandalorian-101/badger-system
|
2b0ee9bd77a2cc6f875b9b984ae4dfe713bbc55c
|
[
"MIT"
] | null | null | null |
helpers/time_utils.py
|
mandalorian-101/badger-system
|
2b0ee9bd77a2cc6f875b9b984ae4dfe713bbc55c
|
[
"MIT"
] | null | null | null |
import datetime
ONE_MINUTE = 60
ONE_HOUR = 3600
ONE_DAY = 24 * ONE_HOUR
ONE_YEAR = 1 * 365 * ONE_DAY
def days(days):
return int(days * 86400.0)
def hours(hours):
return int(hours * 3600.0)
def minutes(minutes):
return int(minutes * 60.0)
def to_utc_date(timestamp):
return datetime.datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%dT%H:%M:%SZ")
def to_timestamp(date):
print(date.timestamp())
return int(date.timestamp())
def to_minutes(duration):
return duration / ONE_MINUTE
def to_days(duration):
return duration / ONE_DAY
def to_hours(duration):
return duration / ONE_HOUR
| 18.5
| 87
| 0.702703
| 95
| 629
| 4.494737
| 0.347368
| 0.058548
| 0.154567
| 0.175644
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.05029
| 0.17806
| 629
| 34
| 88
| 18.5
| 0.775629
| 0
| 0
| 0
| 0
| 0
| 0.028571
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.363636
| false
| 0
| 0.045455
| 0.318182
| 0.772727
| 0.045455
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 3
|
9c2757bc39980fb41a4822e37ad9596b865f8c2a
| 24
|
py
|
Python
|
nima/models/productos/constants.py
|
erichav/NIMA
|
6ca845047e2d1764f07af76bfbbed9f1a82bc10f
|
[
"MIT"
] | null | null | null |
nima/models/productos/constants.py
|
erichav/NIMA
|
6ca845047e2d1764f07af76bfbbed9f1a82bc10f
|
[
"MIT"
] | null | null | null |
nima/models/productos/constants.py
|
erichav/NIMA
|
6ca845047e2d1764f07af76bfbbed9f1a82bc10f
|
[
"MIT"
] | 1
|
2018-11-18T03:58:53.000Z
|
2018-11-18T03:58:53.000Z
|
COLLECTION = 'productos'
| 24
| 24
| 0.791667
| 2
| 24
| 9.5
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.083333
| 24
| 1
| 24
| 24
| 0.863636
| 0
| 0
| 0
| 0
| 0
| 0.36
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c2b5cff1157d02c2e830e9f89af05add8167ae9
| 247,996
|
py
|
Python
|
Python/4 kyu/Snail/test_snail.py
|
newtonsspawn/codewars_challenges
|
62b20d4e729c8ba79eac7cae6a179af57abd45d4
|
[
"MIT"
] | 3
|
2020-05-29T23:29:35.000Z
|
2021-08-12T03:16:44.000Z
|
Python/4 kyu/Snail/test_snail.py
|
newtonsspawn/codewars_challenges
|
62b20d4e729c8ba79eac7cae6a179af57abd45d4
|
[
"MIT"
] | null | null | null |
Python/4 kyu/Snail/test_snail.py
|
newtonsspawn/codewars_challenges
|
62b20d4e729c8ba79eac7cae6a179af57abd45d4
|
[
"MIT"
] | 3
|
2020-05-22T12:14:55.000Z
|
2021-04-15T12:52:42.000Z
|
from unittest import TestCase
from snail import snail
class TestSnail(TestCase):
def test_snail_001(self):
self.assertEqual(snail([[]]), [])
def test_snail_002(self):
self.assertEqual(snail([[1]]), [1])
def test_snail_003(self):
self.assertEqual(snail([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
[1, 2, 3, 6, 9, 8, 7, 4, 5])
def test_snail_004(self):
self.assertEqual(snail(
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15],
[16, 17, 18, 19, 20], [21, 22, 23, 24, 25]]),
[1, 2, 3, 4, 5, 10, 15, 20, 25, 24, 23, 22, 21, 16, 11,
6, 7, 8, 9, 14, 19, 18, 17, 12, 13])
def test_snail_005(self):
self.assertEqual(snail([[1, 2, 3, 4, 5, 6], [20, 21, 22, 23, 24, 7],
[19, 32, 33, 34, 25, 8],
[18, 31, 36, 35, 26, 9],
[17, 30, 29, 28, 27, 10],
[16, 15, 14, 13, 12, 11]]),
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36])
def test_snail_006(self):
self.assertEqual(snail([[350]]), [350])
def test_snail_007(self):
self.assertEqual(snail([[545, 588, 42, 119, 791, 866, 142, 699, 611,
400, 465, 373, 30, 71, 950, 813, 850, 652],
[664, 853, 1000, 561, 102, 363, 807, 553, 973,
643, 142, 433, 378, 702, 250, 641, 967, 172],
[908, 928, 776, 82, 547, 224, 730, 158, 169, 8,
111, 847, 891, 142, 906, 609, 443, 211],
[417, 35, 192, 167, 579, 885, 160, 755, 522,
360, 382, 783, 986, 474, 761, 416, 564, 561],
[506, 160, 540, 575, 374, 854, 313, 656, 546,
924, 838, 831, 23, 146, 116, 136, 47, 889],
[932, 515, 627, 982, 886, 609, 67, 966, 262,
953, 299, 246, 488, 526, 524, 855, 954, 752],
[182, 310, 522, 423, 907, 743, 440, 827, 548,
162, 397, 494, 592, 629, 856, 288, 601, 188],
[963, 862, 9, 812, 947, 721, 37, 170, 69, 326,
661, 829, 69, 341, 100, 751, 951, 844],
[252, 831, 293, 346, 830, 639, 657, 425, 294,
47, 477, 786, 852, 821, 858, 438, 251, 296],
[136, 891, 795, 298, 144, 686, 845, 781, 737,
850, 413, 88, 333, 311, 628, 962, 785, 548],
[307, 294, 706, 298, 825, 108, 508, 358, 978,
707, 26, 774, 332, 252, 407, 466, 77, 141],
[803, 134, 246, 768, 431, 724, 448, 362, 875,
983, 188, 254, 332, 249, 162, 167, 911, 639],
[266, 399, 765, 878, 433, 414, 178, 225, 507,
112, 510, 124, 88, 969, 728, 18, 813, 763],
[714, 580, 290, 935, 331, 813, 781, 114, 183,
437, 287, 870, 719, 690, 880, 319, 939, 715],
[283, 165, 518, 34, 109, 638, 327, 3, 369, 979,
696, 845, 34, 498, 736, 372, 166, 931],
[728, 490, 910, 342, 460, 955, 876, 935, 976,
887, 190, 517, 362, 15, 486, 138, 681, 996],
[585, 139, 62, 485, 628, 667, 213, 29, 910, 333,
854, 201, 613, 27, 552, 244, 251, 177],
[222, 791, 454, 246, 525, 626, 58, 512, 642,
561, 309, 674, 607, 441, 728, 782, 375, 113]]),
[545, 588, 42, 119, 791, 866, 142, 699, 611, 400, 465,
373, 30, 71, 950, 813, 850, 652, 172, 211, 561, 889,
752, 188, 844, 296, 548, 141, 639, 763, 715, 931, 996,
177, 113, 375, 782, 728, 441, 607, 674, 309, 561, 642,
512, 58, 626, 525, 246, 454, 791, 222, 585, 728, 283,
714, 266, 803, 307, 136, 252, 963, 182, 932, 506, 417,
908, 664, 853, 1000, 561, 102, 363, 807, 553, 973,
643, 142, 433, 378, 702, 250, 641, 967, 443, 564, 47,
954, 601, 951, 251, 785, 77, 911, 813, 939, 166, 681,
251, 244, 552, 27, 613, 201, 854, 333, 910, 29, 213,
667, 628, 485, 62, 139, 490, 165, 580, 399, 134, 294,
891, 831, 862, 310, 515, 160, 35, 928, 776, 82, 547,
224, 730, 158, 169, 8, 111, 847, 891, 142, 906, 609,
416, 136, 855, 288, 751, 438, 962, 466, 167, 18, 319,
372, 138, 486, 15, 362, 517, 190, 887, 976, 935, 876,
955, 460, 342, 910, 518, 290, 765, 246, 706, 795, 293,
9, 522, 627, 540, 192, 167, 579, 885, 160, 755, 522,
360, 382, 783, 986, 474, 761, 116, 524, 856, 100, 858,
628, 407, 162, 728, 880, 736, 498, 34, 845, 696, 979,
369, 3, 327, 638, 109, 34, 935, 878, 768, 298, 298,
346, 812, 423, 982, 575, 374, 854, 313, 656, 546, 924,
838, 831, 23, 146, 526, 629, 341, 821, 311, 252, 249,
969, 690, 719, 870, 287, 437, 183, 114, 781, 813, 331,
433, 431, 825, 144, 830, 947, 907, 886, 609, 67, 966,
262, 953, 299, 246, 488, 592, 69, 852, 333, 332, 332,
88, 124, 510, 112, 507, 225, 178, 414, 724, 108, 686,
639, 721, 743, 440, 827, 548, 162, 397, 494, 829, 786,
88, 774, 254, 188, 983, 875, 362, 448, 508, 845, 657,
37, 170, 69, 326, 661, 477, 413, 26, 707, 978, 358,
781, 425, 294, 47, 850, 737])
def test_snail_008(self):
self.assertEqual(snail([[844, 865, 787, 987, 255, 928, 812],
[533, 376, 869, 60, 824, 527, 355],
[238, 330, 215, 201, 335, 29, 225],
[828, 63, 172, 620, 315, 361, 758],
[14, 964, 210, 530, 997, 568, 288],
[855, 152, 486, 856, 360, 545, 564],
[549, 259, 544, 508, 793, 934, 567]]),
[844, 865, 787, 987, 255, 928, 812, 355, 225, 758, 288,
564, 567, 934, 793, 508, 544, 259, 549, 855, 14, 828,
238, 533, 376, 869, 60, 824, 527, 29, 361, 568, 545,
360, 856, 486, 152, 964, 63, 330, 215, 201, 335, 315,
997, 530, 210, 172, 620])
def test_snail_009(self):
self.assertEqual(snail([[277, 149, 76, 473, 385, 633, 41, 517, 918, 462,
769, 726, 161, 694, 26, 717, 309, 484],
[822, 156, 851, 683, 303, 638, 818, 714, 303,
509, 353, 557, 51, 592, 663, 475, 725, 40],
[40, 155, 345, 977, 600, 812, 851, 559, 152,
256, 965, 586, 591, 966, 146, 868, 262, 931],
[855, 170, 534, 89, 73, 910, 741, 195, 4, 547,
916, 887, 912, 610, 815, 619, 508, 196],
[600, 735, 378, 713, 511, 639, 703, 269, 326,
650, 223, 993, 760, 894, 430, 705, 896, 814],
[444, 223, 939, 289, 624, 837, 541, 975, 608,
446, 787, 963, 647, 660, 827, 544, 894, 634],
[643, 836, 653, 921, 77, 574, 411, 242, 52, 242,
411, 827, 875, 617, 653, 180, 85, 390],
[592, 287, 28, 699, 663, 170, 548, 812, 792, 68,
376, 733, 147, 475, 803, 513, 815, 515],
[366, 76, 557, 607, 661, 516, 434, 136, 41, 551,
670, 662, 248, 205, 485, 509, 59, 833],
[394, 608, 437, 669, 92, 194, 441, 444, 68, 269,
512, 104, 121, 176, 422, 278, 953, 69],
[187, 714, 933, 50, 576, 276, 594, 283, 258,
268, 95, 111, 353, 139, 342, 274, 141, 69],
[588, 50, 105, 400, 470, 733, 51, 342, 193, 6,
909, 690, 697, 215, 612, 27, 629, 861],
[784, 253, 98, 563, 118, 138, 610, 486, 602,
779, 153, 478, 956, 107, 460, 850, 447, 21],
[690, 48, 219, 72, 384, 261, 474, 383, 632, 868,
922, 826, 651, 612, 684, 339, 418, 743],
[955, 462, 403, 996, 131, 70, 485, 523, 407,
932, 100, 688, 240, 970, 98, 681, 356, 609],
[376, 795, 982, 482, 813, 496, 635, 618, 728,
96, 982, 884, 362, 168, 470, 919, 672, 921],
[327, 201, 195, 628, 731, 453, 778, 719, 751,
115, 429, 675, 983, 281, 389, 396, 876, 484],
[867, 449, 958, 381, 640, 749, 216, 358, 226,
155, 568, 795, 584, 220, 900, 207, 12, 440]]),
[277, 149, 76, 473, 385, 633, 41, 517, 918, 462, 769,
726, 161, 694, 26, 717, 309, 484, 40, 931, 196, 814,
634, 390, 515, 833, 69, 69, 861, 21, 743, 609, 921,
484, 440, 12, 207, 900, 220, 584, 795, 568, 155, 226,
358, 216, 749, 640, 381, 958, 449, 867, 327, 376, 955,
690, 784, 588, 187, 394, 366, 592, 643, 444, 600, 855,
40, 822, 156, 851, 683, 303, 638, 818, 714, 303, 509,
353, 557, 51, 592, 663, 475, 725, 262, 508, 896, 894,
85, 815, 59, 953, 141, 629, 447, 418, 356, 672, 876,
396, 389, 281, 983, 675, 429, 115, 751, 719, 778, 453,
731, 628, 195, 201, 795, 462, 48, 253, 50, 714, 608,
76, 287, 836, 223, 735, 170, 155, 345, 977, 600, 812,
851, 559, 152, 256, 965, 586, 591, 966, 146, 868, 619,
705, 544, 180, 513, 509, 278, 274, 27, 850, 339, 681,
919, 470, 168, 362, 884, 982, 96, 728, 618, 635, 496,
813, 482, 982, 403, 219, 98, 105, 933, 437, 557, 28,
653, 939, 378, 534, 89, 73, 910, 741, 195, 4, 547,
916, 887, 912, 610, 815, 430, 827, 653, 803, 485, 422,
342, 612, 460, 684, 98, 970, 240, 688, 100, 932, 407,
523, 485, 70, 131, 996, 72, 563, 400, 50, 669, 607,
699, 921, 289, 713, 511, 639, 703, 269, 326, 650, 223,
993, 760, 894, 660, 617, 475, 205, 176, 139, 215, 107,
612, 651, 826, 922, 868, 632, 383, 474, 261, 384, 118,
470, 576, 92, 661, 663, 77, 624, 837, 541, 975, 608,
446, 787, 963, 647, 875, 147, 248, 121, 353, 697, 956,
478, 153, 779, 602, 486, 610, 138, 733, 276, 194, 516,
170, 574, 411, 242, 52, 242, 411, 827, 733, 662, 104,
111, 690, 909, 6, 193, 342, 51, 594, 441, 434, 548,
812, 792, 68, 376, 670, 512, 95, 268, 258, 283, 444,
136, 41, 551, 269, 68])
def test_snail_010(self):
self.assertEqual(snail([[831, 609, 235, 391, 645, 469, 352, 982, 96,
596, 79, 460, 438, 280, 390],
[639, 19, 257, 411, 862, 508, 652, 265, 609,
188, 443, 425, 584, 11, 329],
[616, 731, 442, 315, 530, 954, 306, 455, 808,
921, 604, 282, 695, 778, 711],
[205, 735, 423, 803, 480, 736, 47, 13, 478, 960,
268, 844, 611, 102, 489],
[271, 314, 134, 650, 634, 984, 925, 565, 67,
651, 139, 697, 735, 616, 83],
[124, 381, 202, 355, 488, 99, 269, 486, 900,
601, 449, 777, 607, 702, 504],
[259, 357, 104, 126, 784, 649, 30, 243, 716,
436, 917, 272, 629, 864, 131],
[333, 402, 81, 766, 352, 14, 227, 796, 572, 623,
176, 196, 870, 5, 822],
[469, 67, 286, 430, 711, 336, 78, 384, 71, 783,
832, 458, 940, 511, 160],
[783, 286, 352, 679, 233, 493, 549, 83, 137,
498, 450, 214, 856, 925, 585],
[360, 663, 80, 307, 411, 97, 42, 857, 865, 954,
30, 778, 691, 880, 898],
[354, 373, 818, 619, 465, 957, 268, 876, 19, 58,
163, 138, 283, 970, 267],
[773, 79, 892, 808, 810, 35, 147, 377, 502, 400,
742, 345, 35, 120, 859],
[933, 643, 548, 241, 817, 661, 936, 837, 571,
596, 177, 296, 531, 836, 805],
[915, 268, 534, 369, 791, 90, 843, 104, 293, 92,
270, 306, 226, 797, 903]]),
[831, 609, 235, 391, 645, 469, 352, 982, 96, 596, 79,
460, 438, 280, 390, 329, 711, 489, 83, 504, 131, 822,
160, 585, 898, 267, 859, 805, 903, 797, 226, 306, 270,
92, 293, 104, 843, 90, 791, 369, 534, 268, 915, 933,
773, 354, 360, 783, 469, 333, 259, 124, 271, 205, 616,
639, 19, 257, 411, 862, 508, 652, 265, 609, 188, 443,
425, 584, 11, 778, 102, 616, 702, 864, 5, 511, 925,
880, 970, 120, 836, 531, 296, 177, 596, 571, 837, 936,
661, 817, 241, 548, 643, 79, 373, 663, 286, 67, 402,
357, 381, 314, 735, 731, 442, 315, 530, 954, 306, 455,
808, 921, 604, 282, 695, 611, 735, 607, 629, 870, 940,
856, 691, 283, 35, 345, 742, 400, 502, 377, 147, 35,
810, 808, 892, 818, 80, 352, 286, 81, 104, 202, 134,
423, 803, 480, 736, 47, 13, 478, 960, 268, 844, 697,
777, 272, 196, 458, 214, 778, 138, 163, 58, 19, 876,
268, 957, 465, 619, 307, 679, 430, 766, 126, 355, 650,
634, 984, 925, 565, 67, 651, 139, 449, 917, 176, 832,
450, 30, 954, 865, 857, 42, 97, 411, 233, 711, 352,
784, 488, 99, 269, 486, 900, 601, 436, 623, 783, 498,
137, 83, 549, 493, 336, 14, 649, 30, 243, 716, 572,
71, 384, 78, 227, 796])
def test_snail_011(self):
self.assertEqual(snail([[900, 61, 525, 325, 420, 389, 718, 967, 116,
156, 877, 301, 815],
[325, 921, 851, 66, 226, 759, 166, 754, 972,
199, 26, 673, 81],
[953, 211, 277, 170, 498, 206, 11, 766, 742,
101, 661, 674, 501],
[613, 645, 897, 883, 24, 499, 408, 404, 93, 464,
815, 546, 830],
[103, 374, 494, 259, 597, 463, 83, 658, 867,
321, 311, 942, 265],
[279, 214, 989, 896, 644, 152, 130, 439, 917,
664, 293, 835, 469],
[114, 212, 935, 146, 589, 399, 128, 61, 242,
1000, 695, 340, 119],
[67, 258, 342, 377, 207, 186, 296, 249, 902,
607, 168, 151, 890],
[331, 274, 68, 643, 694, 918, 141, 718, 26, 659,
786, 247, 685],
[760, 128, 36, 115, 509, 292, 665, 755, 426,
380, 813, 1000, 366],
[459, 285, 200, 835, 851, 925, 217, 506, 749,
313, 546, 588, 902],
[475, 556, 67, 602, 323, 842, 248, 103, 413,
276, 513, 254, 478],
[478, 749, 519, 165, 158, 393, 952, 614, 291,
781, 344, 774, 42]]),
[900, 61, 525, 325, 420, 389, 718, 967, 116, 156, 877,
301, 815, 81, 501, 830, 265, 469, 119, 890, 685, 366,
902, 478, 42, 774, 344, 781, 291, 614, 952, 393, 158,
165, 519, 749, 478, 475, 459, 760, 331, 67, 114, 279,
103, 613, 953, 325, 921, 851, 66, 226, 759, 166, 754,
972, 199, 26, 673, 674, 546, 942, 835, 340, 151, 247,
1000, 588, 254, 513, 276, 413, 103, 248, 842, 323,
602, 67, 556, 285, 128, 274, 258, 212, 214, 374, 645,
211, 277, 170, 498, 206, 11, 766, 742, 101, 661, 815,
311, 293, 695, 168, 786, 813, 546, 313, 749, 506, 217,
925, 851, 835, 200, 36, 68, 342, 935, 989, 494, 897,
883, 24, 499, 408, 404, 93, 464, 321, 664, 1000, 607,
659, 380, 426, 755, 665, 292, 509, 115, 643, 377, 146,
896, 259, 597, 463, 83, 658, 867, 917, 242, 902, 26,
718, 141, 918, 694, 207, 589, 644, 152, 130, 439, 61,
249, 296, 186, 399, 128])
def test_snail_012(self):
self.assertEqual(snail([[743, 389, 404, 786, 6, 509, 887, 481, 858, 117,
671, 344, 7, 855, 551, 838, 500, 736, 981,
342],
[823, 940, 897, 877, 616, 425, 425, 300, 769,
780, 755, 505, 48, 339, 987, 285, 118, 949,
245, 644],
[68, 37, 515, 914, 885, 247, 552, 998, 53, 782,
913, 34, 413, 744, 462, 794, 589, 405, 233,
850],
[905, 208, 712, 995, 261, 154, 768, 118, 908,
452, 706, 612, 584, 638, 480, 969, 345, 780,
435, 898],
[714, 11, 654, 957, 564, 362, 231, 41, 721, 254,
202, 137, 126, 174, 832, 661, 382, 654, 516,
300],
[218, 667, 767, 610, 339, 531, 335, 234, 53,
735, 742, 818, 233, 26, 634, 229, 316, 436,
999, 348],
[943, 451, 142, 545, 186, 542, 934, 22, 287,
166, 63, 495, 13, 433, 739, 270, 535, 305, 272,
254],
[322, 892, 751, 856, 280, 706, 632, 796, 507,
633, 52, 86, 116, 753, 489, 294, 869, 135, 565,
102],
[691, 412, 615, 389, 973, 462, 624, 172, 170,
56, 744, 558, 339, 871, 878, 495, 810, 454,
349, 261],
[545, 378, 844, 494, 172, 465, 897, 608, 755,
74, 367, 853, 407, 865, 168, 644, 477, 73, 166,
822],
[428, 985, 729, 790, 40, 290, 549, 491, 160,
429, 113, 379, 704, 432, 225, 713, 634, 879,
837, 958],
[803, 796, 762, 778, 917, 794, 792, 752, 325,
953, 986, 867, 35, 957, 623, 662, 916, 513,
324, 185],
[190, 680, 689, 189, 78, 591, 532, 174, 927,
376, 635, 12, 908, 253, 569, 267, 396, 112,
180, 22],
[797, 925, 775, 831, 921, 87, 748, 141, 33, 45,
194, 270, 661, 78, 968, 333, 132, 976, 788,
137],
[854, 147, 902, 213, 365, 342, 962, 662, 491,
86, 701, 493, 736, 705, 115, 472, 354, 815,
240, 24],
[595, 473, 899, 866, 157, 973, 725, 107, 417,
989, 205, 921, 98, 632, 234, 938, 112, 181,
604, 707],
[889, 203, 968, 727, 409, 651, 695, 854, 423,
968, 745, 680, 560, 935, 54, 862, 790, 343,
884, 627],
[135, 694, 358, 75, 237, 924, 493, 758, 998,
279, 80, 86, 174, 991, 585, 251, 99, 718, 611,
462],
[109, 360, 882, 794, 631, 587, 73, 10, 696, 582,
352, 797, 897, 58, 246, 277, 690, 511, 495,
437],
[99, 898, 540, 657, 563, 267, 39, 556, 819, 738,
888, 8, 140, 400, 619, 267, 859, 919, 301,
265]]),
[743, 389, 404, 786, 6, 509, 887, 481, 858, 117, 671,
344, 7, 855, 551, 838, 500, 736, 981, 342, 644, 850,
898, 300, 348, 254, 102, 261, 822, 958, 185, 22, 137,
24, 707, 627, 462, 437, 265, 301, 919, 859, 267, 619,
400, 140, 8, 888, 738, 819, 556, 39, 267, 563, 657,
540, 898, 99, 109, 135, 889, 595, 854, 797, 190, 803,
428, 545, 691, 322, 943, 218, 714, 905, 68, 823, 940,
897, 877, 616, 425, 425, 300, 769, 780, 755, 505, 48,
339, 987, 285, 118, 949, 245, 233, 435, 516, 999, 272,
565, 349, 166, 837, 324, 180, 788, 240, 604, 884, 611,
495, 511, 690, 277, 246, 58, 897, 797, 352, 582, 696,
10, 73, 587, 631, 794, 882, 360, 694, 203, 473, 147,
925, 680, 796, 985, 378, 412, 892, 451, 667, 11, 208,
37, 515, 914, 885, 247, 552, 998, 53, 782, 913, 34,
413, 744, 462, 794, 589, 405, 780, 654, 436, 305, 135,
454, 73, 879, 513, 112, 976, 815, 181, 343, 718, 99,
251, 585, 991, 174, 86, 80, 279, 998, 758, 493, 924,
237, 75, 358, 968, 899, 902, 775, 689, 762, 729, 844,
615, 751, 142, 767, 654, 712, 995, 261, 154, 768, 118,
908, 452, 706, 612, 584, 638, 480, 969, 345, 382, 316,
535, 869, 810, 477, 634, 916, 396, 132, 354, 112, 790,
862, 54, 935, 560, 680, 745, 968, 423, 854, 695, 651,
409, 727, 866, 213, 831, 189, 778, 790, 494, 389, 856,
545, 610, 957, 564, 362, 231, 41, 721, 254, 202, 137,
126, 174, 832, 661, 229, 270, 294, 495, 644, 713, 662,
267, 333, 472, 938, 234, 632, 98, 921, 205, 989, 417,
107, 725, 973, 157, 365, 921, 78, 917, 40, 172, 973,
280, 186, 339, 531, 335, 234, 53, 735, 742, 818, 233,
26, 634, 739, 489, 878, 168, 225, 623, 569, 968, 115,
705, 736, 493, 701, 86, 491, 662, 962, 342, 87, 591,
794, 290, 465, 462, 706, 542, 934, 22, 287, 166, 63,
495, 13, 433, 753, 871, 865, 432, 957, 253, 78, 661,
270, 194, 45, 33, 141, 748, 532, 792, 549, 897, 624,
632, 796, 507, 633, 52, 86, 116, 339, 407, 704, 35,
908, 12, 635, 376, 927, 174, 752, 491, 608, 172, 170,
56, 744, 558, 853, 379, 867, 986, 953, 325, 160, 755,
74, 367, 113, 429])
def test_snail_013(self):
self.assertEqual(snail([[567]]), [567])
def test_snail_014(self):
self.assertEqual(snail(
[[724, 455, 919, 922, 779, 711, 36, 791, 104, 490, 480],
[95, 252, 691, 12, 786, 563, 890, 446, 275, 899, 930],
[359, 844, 866, 827, 758, 81, 441, 768, 499, 983, 438],
[860, 385, 512, 34, 351, 822, 501, 130, 111, 249, 25],
[638, 30, 5, 102, 998, 888, 800, 651, 402, 40, 236],
[872, 21, 731, 902, 613, 442, 437, 581, 710, 453, 877],
[236, 661, 418, 662, 869, 936, 251, 302, 474, 578, 18],
[413, 451, 241, 737, 641, 677, 263, 617, 9, 172, 246],
[628, 390, 511, 786, 219, 833, 722, 419, 743, 695, 400],
[711, 986, 834, 181, 855, 780, 869, 238, 931, 993, 203],
[625, 896, 172, 269, 273, 722, 528, 434, 211, 278, 645]]),
[724, 455, 919, 922, 779, 711, 36, 791, 104, 490, 480,
930, 438, 25, 236, 877, 18, 246, 400, 203, 645, 278,
211, 434, 528, 722, 273, 269, 172, 896, 625, 711, 628,
413, 236, 872, 638, 860, 359, 95, 252, 691, 12, 786,
563, 890, 446, 275, 899, 983, 249, 40, 453, 578, 172,
695, 993, 931, 238, 869, 780, 855, 181, 834, 986, 390,
451, 661, 21, 30, 385, 844, 866, 827, 758, 81, 441,
768, 499, 111, 402, 710, 474, 9, 743, 419, 722, 833,
219, 786, 511, 241, 418, 731, 5, 512, 34, 351, 822,
501, 130, 651, 581, 302, 617, 263, 677, 641, 737, 662,
902, 102, 998, 888, 800, 437, 251, 936, 869, 613,
442])
def test_snail_015(self):
self.assertEqual(snail([[547, 471, 740, 487, 758, 466, 885, 554, 312,
618, 76, 890, 416, 621, 45, 33, 14],
[935, 878, 428, 721, 79, 762, 116, 797, 676,
755, 7, 142, 464, 861, 192, 943, 822],
[100, 325, 962, 434, 413, 313, 908, 842, 366,
618, 803, 480, 391, 263, 122, 148, 582],
[281, 741, 182, 236, 351, 611, 588, 857, 354,
837, 867, 258, 508, 882, 305, 396, 796],
[127, 795, 960, 196, 93, 41, 113, 949, 999, 880,
215, 844, 86, 229, 436, 746, 224],
[709, 283, 219, 254, 913, 900, 537, 617, 80, 18,
944, 372, 805, 981, 798, 380, 868],
[741, 7, 686, 690, 987, 382, 38, 560, 89, 889,
243, 684, 951, 686, 795, 711, 304],
[309, 225, 691, 223, 245, 377, 786, 669, 126,
835, 245, 62, 803, 234, 486, 580, 192],
[895, 172, 347, 645, 113, 700, 419, 573, 987,
403, 527, 893, 348, 508, 530, 558, 477],
[307, 725, 128, 975, 498, 796, 359, 268, 204,
165, 349, 942, 527, 73, 815, 372, 749],
[848, 950, 312, 560, 350, 943, 576, 873, 230, 4,
807, 561, 944, 629, 422, 342, 678],
[275, 41, 349, 925, 579, 139, 836, 777, 256,
422, 884, 587, 126, 836, 347, 692, 87],
[351, 100, 739, 316, 666, 372, 441, 858, 25,
747, 474, 234, 943, 393, 530, 336, 185],
[784, 847, 392, 698, 866, 494, 370, 12, 221,
689, 428, 491, 15, 677, 118, 496, 941],
[748, 782, 298, 359, 981, 334, 520, 809, 253,
69, 70, 909, 7, 662, 574, 128, 125],
[570, 682, 863, 589, 421, 147, 262, 647, 749,
76, 468, 740, 107, 277, 484, 905, 399],
[936, 382, 383, 764, 679, 634, 999, 371, 34,
581, 336, 178, 137, 860, 269, 341, 166]]),
[547, 471, 740, 487, 758, 466, 885, 554, 312, 618, 76,
890, 416, 621, 45, 33, 14, 822, 582, 796, 224, 868,
304, 192, 477, 749, 678, 87, 185, 941, 125, 399, 166,
341, 269, 860, 137, 178, 336, 581, 34, 371, 999, 634,
679, 764, 383, 382, 936, 570, 748, 784, 351, 275, 848,
307, 895, 309, 741, 709, 127, 281, 100, 935, 878, 428,
721, 79, 762, 116, 797, 676, 755, 7, 142, 464, 861,
192, 943, 148, 396, 746, 380, 711, 580, 558, 372, 342,
692, 336, 496, 128, 905, 484, 277, 107, 740, 468, 76,
749, 647, 262, 147, 421, 589, 863, 682, 782, 847, 100,
41, 950, 725, 172, 225, 7, 283, 795, 741, 325, 962,
434, 413, 313, 908, 842, 366, 618, 803, 480, 391, 263,
122, 305, 436, 798, 795, 486, 530, 815, 422, 347, 530,
118, 574, 662, 7, 909, 70, 69, 253, 809, 520, 334,
981, 359, 298, 392, 739, 349, 312, 128, 347, 691, 686,
219, 960, 182, 236, 351, 611, 588, 857, 354, 837, 867,
258, 508, 882, 229, 981, 686, 234, 508, 73, 629, 836,
393, 677, 15, 491, 428, 689, 221, 12, 370, 494, 866,
698, 316, 925, 560, 975, 645, 223, 690, 254, 196, 93,
41, 113, 949, 999, 880, 215, 844, 86, 805, 951, 803,
348, 527, 944, 126, 943, 234, 474, 747, 25, 858, 441,
372, 666, 579, 350, 498, 113, 245, 987, 913, 900, 537,
617, 80, 18, 944, 372, 684, 62, 893, 942, 561, 587,
884, 422, 256, 777, 836, 139, 943, 796, 700, 377, 382,
38, 560, 89, 889, 243, 245, 527, 349, 807, 4, 230,
873, 576, 359, 419, 786, 669, 126, 835, 403, 165, 204,
268, 573, 987])
def test_snail_016(self):
self.assertEqual(snail([[665, 175], [31, 103]]), [665, 175, 103, 31])
def test_snail_017(self):
self.assertEqual(snail([[755]]), [755])
def test_snail_018(self):
self.assertEqual(snail([[126]]), [126])
def test_snail_019(self):
self.assertEqual(snail([[636, 479, 441, 159, 593, 904, 31, 21, 198],
[558, 377, 166, 504, 919, 20, 495, 71, 899],
[955, 466, 168, 459, 223, 535, 369, 881, 709],
[814, 54, 762, 941, 804, 810, 498, 583, 828],
[678, 489, 88, 976, 967, 218, 494, 1000, 550],
[501, 310, 668, 403, 558, 697, 247, 393, 990],
[346, 220, 92, 707, 460, 106, 187, 606, 447],
[589, 900, 867, 818, 647, 180, 878, 809, 191],
[278, 820, 427, 859, 985, 594, 218, 851, 286]]),
[636, 479, 441, 159, 593, 904, 31, 21, 198, 899, 709,
828, 550, 990, 447, 191, 286, 851, 218, 594, 985, 859,
427, 820, 278, 589, 346, 501, 678, 814, 955, 558, 377,
166, 504, 919, 20, 495, 71, 881, 583, 1000, 393, 606,
809, 878, 180, 647, 818, 867, 900, 220, 310, 489, 54,
466, 168, 459, 223, 535, 369, 498, 494, 247, 187, 106,
460, 707, 92, 668, 88, 762, 941, 804, 810, 218, 697,
558, 403, 976, 967])
def test_snail_020(self):
self.assertEqual(snail([[34, 174, 567, 523, 884, 681, 348, 879],
[860, 127, 97, 983, 245, 516, 214, 358],
[812, 405, 787, 630, 856, 384, 973, 803],
[452, 925, 253, 481, 678, 517, 246, 855],
[471, 121, 342, 671, 92, 770, 690, 538],
[706, 207, 63, 874, 366, 336, 848, 708],
[771, 637, 708, 977, 977, 3, 562, 324],
[453, 816, 461, 143, 874, 992, 346, 923]]),
[34, 174, 567, 523, 884, 681, 348, 879, 358, 803, 855,
538, 708, 324, 923, 346, 992, 874, 143, 461, 816, 453,
771, 706, 471, 452, 812, 860, 127, 97, 983, 245, 516,
214, 973, 246, 690, 848, 562, 3, 977, 977, 708, 637,
207, 121, 925, 405, 787, 630, 856, 384, 517, 770, 336,
366, 874, 63, 342, 253, 481, 678, 92, 671])
def test_snail_021(self):
self.assertEqual(snail([[950, 222, 988, 710, 321, 798, 51],
[640, 844, 782, 506, 155, 308, 384],
[703, 52, 197, 723, 690, 468, 962],
[326, 195, 134, 216, 302, 503, 212],
[718, 323, 17, 449, 601, 380, 396],
[985, 698, 502, 864, 257, 804, 942],
[888, 418, 187, 880, 152, 432, 651]]),
[950, 222, 988, 710, 321, 798, 51, 384, 962, 212, 396,
942, 651, 432, 152, 880, 187, 418, 888, 985, 718, 326,
703, 640, 844, 782, 506, 155, 308, 468, 503, 380, 804,
257, 864, 502, 698, 323, 195, 52, 197, 723, 690, 302,
601, 449, 17, 134, 216])
def test_snail_022(self):
self.assertEqual(snail([[188, 383, 11, 265, 829, 552, 184, 587, 149,
839, 640, 638, 292, 990],
[523, 992, 378, 958, 526, 735, 753, 216, 781,
183, 273, 433, 458, 900],
[645, 764, 450, 273, 769, 871, 125, 983, 864,
318, 160, 300, 677, 990],
[245, 169, 676, 300, 81, 19, 481, 549, 922, 13,
798, 37, 785, 831],
[202, 912, 399, 946, 877, 577, 211, 149, 515, 7,
783, 194, 903, 458],
[241, 530, 605, 143, 110, 318, 450, 365, 300,
901, 863, 973, 997, 46],
[217, 471, 358, 537, 270, 529, 512, 306, 402,
11, 275, 228, 737, 751],
[231, 344, 693, 847, 723, 898, 87, 700, 558,
116, 927, 425, 220, 505],
[119, 851, 664, 891, 32, 670, 224, 37, 428, 45,
679, 170, 522, 181],
[506, 264, 274, 87, 567, 324, 203, 715, 628,
288, 836, 353, 367, 458],
[377, 859, 308, 788, 792, 211, 738, 314, 972,
557, 583, 789, 132, 271],
[483, 158, 749, 560, 743, 592, 710, 442, 650,
896, 323, 221, 309, 299],
[858, 549, 118, 588, 674, 975, 799, 910, 465,
453, 139, 448, 537, 680],
[713, 851, 964, 542, 64, 296, 923, 440, 225,
479, 744, 119, 144, 399]]),
[188, 383, 11, 265, 829, 552, 184, 587, 149, 839, 640,
638, 292, 990, 900, 990, 831, 458, 46, 751, 505, 181,
458, 271, 299, 680, 399, 144, 119, 744, 479, 225, 440,
923, 296, 64, 542, 964, 851, 713, 858, 483, 377, 506,
119, 231, 217, 241, 202, 245, 645, 523, 992, 378, 958,
526, 735, 753, 216, 781, 183, 273, 433, 458, 677, 785,
903, 997, 737, 220, 522, 367, 132, 309, 537, 448, 139,
453, 465, 910, 799, 975, 674, 588, 118, 549, 158, 859,
264, 851, 344, 471, 530, 912, 169, 764, 450, 273, 769,
871, 125, 983, 864, 318, 160, 300, 37, 194, 973, 228,
425, 170, 353, 789, 221, 323, 896, 650, 442, 710, 592,
743, 560, 749, 308, 274, 664, 693, 358, 605, 399, 676,
300, 81, 19, 481, 549, 922, 13, 798, 783, 863, 275,
927, 679, 836, 583, 557, 972, 314, 738, 211, 792, 788,
87, 891, 847, 537, 143, 946, 877, 577, 211, 149, 515,
7, 901, 11, 116, 45, 288, 628, 715, 203, 324, 567, 32,
723, 270, 110, 318, 450, 365, 300, 402, 558, 428, 37,
224, 670, 898, 529, 512, 306, 700, 87])
def test_snail_023(self):
self.assertEqual(snail([[903, 852, 365, 142, 106, 848, 913, 461, 732,
281, 800, 952, 711, 122],
[805, 299, 188, 853, 984, 79, 432, 280, 510,
925, 155, 124, 736, 567],
[793, 219, 758, 522, 833, 232, 24, 494, 164,
365, 205, 548, 145, 603],
[711, 113, 979, 976, 706, 457, 185, 895, 310,
106, 142, 270, 209, 577],
[866, 160, 28, 737, 871, 900, 799, 516, 203,
294, 45, 256, 242, 397],
[901, 606, 892, 620, 61, 398, 300, 14, 365, 616,
230, 82, 352, 98],
[441, 320, 684, 572, 254, 331, 401, 375, 970,
223, 65, 26, 167, 858],
[915, 104, 113, 774, 436, 832, 181, 939, 238,
90, 67, 227, 426, 55],
[846, 135, 332, 105, 110, 301, 794, 431, 860,
715, 201, 69, 744, 657],
[341, 691, 666, 61, 827, 814, 82, 276, 274, 888,
738, 387, 429, 69],
[706, 204, 421, 382, 258, 466, 97, 189, 893,
523, 910, 633, 510, 351],
[560, 109, 533, 541, 825, 571, 608, 542, 92,
385, 694, 762, 465, 620],
[369, 509, 928, 286, 860, 142, 4, 926, 657, 697,
743, 858, 430, 638],
[812, 243, 974, 854, 283, 573, 121, 48, 71, 536,
561, 687, 375, 884]]),
[903, 852, 365, 142, 106, 848, 913, 461, 732, 281, 800,
952, 711, 122, 567, 603, 577, 397, 98, 858, 55, 657,
69, 351, 620, 638, 884, 375, 687, 561, 536, 71, 48,
121, 573, 283, 854, 974, 243, 812, 369, 560, 706, 341,
846, 915, 441, 901, 866, 711, 793, 805, 299, 188, 853,
984, 79, 432, 280, 510, 925, 155, 124, 736, 145, 209,
242, 352, 167, 426, 744, 429, 510, 465, 430, 858, 743,
697, 657, 926, 4, 142, 860, 286, 928, 509, 109, 204,
691, 135, 104, 320, 606, 160, 113, 219, 758, 522, 833,
232, 24, 494, 164, 365, 205, 548, 270, 256, 82, 26,
227, 69, 387, 633, 762, 694, 385, 92, 542, 608, 571,
825, 541, 533, 421, 666, 332, 113, 684, 892, 28, 979,
976, 706, 457, 185, 895, 310, 106, 142, 45, 230, 65,
67, 201, 738, 910, 523, 893, 189, 97, 466, 258, 382,
61, 105, 774, 572, 620, 737, 871, 900, 799, 516, 203,
294, 616, 223, 90, 715, 888, 274, 276, 82, 814, 827,
110, 436, 254, 61, 398, 300, 14, 365, 970, 238, 860,
431, 794, 301, 832, 331, 401, 375, 939, 181])
def test_snail_024(self):
self.assertEqual(snail([[733]]), [733])
def test_snail_025(self):
self.assertEqual(snail([[776, 298, 262, 318, 957, 178, 428, 566, 345,
169, 434, 817, 494, 398, 648, 512, 314, 465],
[843, 563, 885, 994, 556, 571, 786, 143, 731,
828, 992, 701, 211, 989, 361, 904, 168, 175],
[153, 906, 802, 413, 532, 445, 864, 275, 891,
169, 899, 36, 278, 126, 691, 437, 199, 30],
[449, 454, 466, 728, 660, 493, 312, 492, 198,
771, 359, 787, 302, 121, 292, 282, 739, 958],
[798, 332, 106, 365, 874, 905, 831, 462, 88,
380, 443, 602, 925, 421, 564, 986, 446, 580],
[78, 187, 603, 551, 283, 789, 262, 542, 551,
422, 581, 100, 108, 574, 249, 473, 606, 83],
[359, 14, 876, 400, 826, 868, 779, 67, 946, 568,
826, 561, 582, 815, 72, 771, 851, 21],
[41, 860, 746, 556, 979, 831, 335, 126, 212,
701, 18, 318, 725, 944, 65, 802, 182, 433],
[746, 66, 844, 140, 842, 49, 547, 451, 436, 434,
72, 973, 2, 212, 311, 691, 546, 176],
[630, 510, 740, 7, 888, 439, 231, 788, 524, 270,
126, 558, 969, 576, 166, 393, 856, 548],
[538, 867, 432, 194, 149, 678, 379, 801, 182,
738, 209, 161, 950, 810, 869, 627, 395, 1000],
[523, 863, 18, 340, 416, 658, 734, 699, 538, 62,
740, 808, 202, 69, 895, 785, 882, 368],
[997, 453, 658, 870, 438, 799, 870, 257, 681,
887, 109, 40, 178, 475, 550, 283, 90, 167],
[243, 774, 470, 223, 518, 660, 730, 117, 885,
377, 305, 744, 622, 484, 789, 498, 464, 837],
[753, 492, 372, 529, 47, 461, 160, 259, 282,
983, 73, 192, 366, 101, 307, 257, 89, 968],
[135, 25, 644, 83, 479, 794, 845, 60, 310, 821,
239, 247, 713, 343, 405, 407, 308, 63],
[297, 590, 149, 649, 317, 843, 23, 652, 69, 819,
886, 381, 411, 781, 477, 672, 822, 185],
[642, 274, 676, 957, 888, 269, 954, 78, 8, 944,
730, 846, 83, 218, 865, 327, 705, 629]]),
[776, 298, 262, 318, 957, 178, 428, 566, 345, 169, 434,
817, 494, 398, 648, 512, 314, 465, 175, 30, 958, 580,
83, 21, 433, 176, 548, 1000, 368, 167, 837, 968, 63,
185, 629, 705, 327, 865, 218, 83, 846, 730, 944, 8,
78, 954, 269, 888, 957, 676, 274, 642, 297, 135, 753,
243, 997, 523, 538, 630, 746, 41, 359, 78, 798, 449,
153, 843, 563, 885, 994, 556, 571, 786, 143, 731, 828,
992, 701, 211, 989, 361, 904, 168, 199, 739, 446, 606,
851, 182, 546, 856, 395, 882, 90, 464, 89, 308, 822,
672, 477, 781, 411, 381, 886, 819, 69, 652, 23, 843,
317, 649, 149, 590, 25, 492, 774, 453, 863, 867, 510,
66, 860, 14, 187, 332, 454, 906, 802, 413, 532, 445,
864, 275, 891, 169, 899, 36, 278, 126, 691, 437, 282,
986, 473, 771, 802, 691, 393, 627, 785, 283, 498, 257,
407, 405, 343, 713, 247, 239, 821, 310, 60, 845, 794,
479, 83, 644, 372, 470, 658, 18, 432, 740, 844, 746,
876, 603, 106, 466, 728, 660, 493, 312, 492, 198, 771,
359, 787, 302, 121, 292, 564, 249, 72, 65, 311, 166,
869, 895, 550, 789, 307, 101, 366, 192, 73, 983, 282,
259, 160, 461, 47, 529, 223, 870, 340, 194, 7, 140,
556, 400, 551, 365, 874, 905, 831, 462, 88, 380, 443,
602, 925, 421, 574, 815, 944, 212, 576, 810, 69, 475,
484, 622, 744, 305, 377, 885, 117, 730, 660, 518, 438,
416, 149, 888, 842, 979, 826, 283, 789, 262, 542, 551,
422, 581, 100, 108, 582, 725, 2, 969, 950, 202, 178,
40, 109, 887, 681, 257, 870, 799, 658, 678, 439, 49,
831, 868, 779, 67, 946, 568, 826, 561, 318, 973, 558,
161, 808, 740, 62, 538, 699, 734, 379, 231, 547, 335,
126, 212, 701, 18, 72, 126, 209, 738, 182, 801, 788,
451, 436, 434, 270, 524])
def test_snail_026(self):
self.assertEqual(snail(
[[348, 421, 186, 172, 681, 428, 955, 583, 1000, 631, 543],
[751, 963, 968, 739, 248, 380, 307, 61, 874, 248, 908],
[803, 186, 336, 83, 196, 775, 898, 148, 43, 24, 993],
[274, 904, 695, 140, 582, 766, 810, 824, 717, 591, 136],
[632, 95, 397, 516, 457, 937, 220, 150, 971, 391, 283],
[157, 543, 946, 629, 703, 392, 816, 292, 935, 107, 289],
[794, 824, 923, 134, 486, 165, 956, 714, 775, 265, 654],
[261, 551, 238, 976, 460, 921, 501, 439, 811, 202, 916],
[817, 671, 357, 391, 181, 639, 191, 534, 945, 204, 249],
[761, 208, 763, 142, 330, 832, 998, 706, 301, 117, 615],
[977, 386, 105, 274, 166, 993, 248, 316, 340, 378, 886]]),
[348, 421, 186, 172, 681, 428, 955, 583, 1000, 631,
543, 908, 993, 136, 283, 289, 654, 916, 249, 615, 886,
378, 340, 316, 248, 993, 166, 274, 105, 386, 977, 761,
817, 261, 794, 157, 632, 274, 803, 751, 963, 968, 739,
248, 380, 307, 61, 874, 248, 24, 591, 391, 107, 265,
202, 204, 117, 301, 706, 998, 832, 330, 142, 763, 208,
671, 551, 824, 543, 95, 904, 186, 336, 83, 196, 775,
898, 148, 43, 717, 971, 935, 775, 811, 945, 534, 191,
639, 181, 391, 357, 238, 923, 946, 397, 695, 140, 582,
766, 810, 824, 150, 292, 714, 439, 501, 921, 460, 976,
134, 629, 516, 457, 937, 220, 816, 956, 165, 486, 703,
392])
def test_snail_027(self):
self.assertEqual(snail([[279, 149, 635, 162, 437, 751, 73, 382, 918,
994, 660, 832, 818, 312, 381, 306, 375, 87,
245],
[54, 599, 406, 599, 951, 888, 231, 723, 287,
692, 617, 275, 719, 445, 361, 954, 583, 951,
162],
[966, 522, 282, 502, 739, 889, 323, 635, 486,
477, 231, 502, 471, 524, 566, 189, 91, 694,
768],
[164, 463, 961, 850, 665, 898, 53, 331, 507, 69,
164, 99, 435, 418, 104, 868, 998, 186, 161],
[138, 179, 498, 106, 803, 338, 361, 631, 370,
805, 156, 583, 102, 486, 989, 468, 772, 491,
656],
[450, 129, 723, 662, 665, 9, 227, 23, 222, 199,
111, 556, 897, 4, 81, 665, 108, 906, 457],
[442, 235, 249, 838, 26, 861, 927, 55, 260, 9,
140, 495, 478, 544, 693, 849, 727, 448, 421],
[812, 736, 968, 113, 205, 680, 936, 699, 733,
830, 760, 301, 891, 701, 530, 34, 234, 764,
136],
[191, 591, 992, 189, 987, 162, 784, 566, 788,
983, 584, 919, 410, 408, 225, 778, 200, 854,
852],
[424, 5, 610, 711, 796, 952, 899, 192, 643, 399,
953, 720, 406, 324, 706, 943, 139, 87, 668],
[412, 431, 428, 777, 880, 971, 931, 966, 281,
510, 63, 1000, 115, 833, 746, 390, 333, 636,
671],
[249, 695, 992, 731, 15, 843, 567, 332, 762,
942, 804, 601, 83, 738, 165, 517, 258, 171,
227],
[976, 808, 967, 898, 78, 231, 563, 182, 696,
611, 421, 809, 6, 954, 656, 338, 422, 777,
172],
[839, 795, 83, 698, 557, 584, 452, 382, 89, 858,
886, 514, 671, 669, 827, 78, 160, 694, 784],
[1000, 249, 558, 794, 891, 668, 564, 399, 18,
452, 938, 516, 359, 2, 140, 31, 16, 876, 532],
[706, 99, 684, 613, 93, 504, 584, 599, 513, 638,
645, 334, 448, 148, 802, 805, 255, 759, 176],
[262, 671, 68, 389, 36, 561, 104, 285, 968, 896,
20, 912, 215, 161, 564, 476, 828, 815, 331],
[74, 29, 857, 758, 382, 578, 150, 745, 684, 558,
384, 439, 118, 599, 779, 378, 816, 996, 206],
[83, 545, 645, 856, 457, 736, 454, 105, 282,
587, 180, 436, 188, 477, 503, 377, 696, 918,
592]]),
[279, 149, 635, 162, 437, 751, 73, 382, 918, 994, 660,
832, 818, 312, 381, 306, 375, 87, 245, 162, 768, 161,
656, 457, 421, 136, 852, 668, 671, 227, 172, 784, 532,
176, 331, 206, 592, 918, 696, 377, 503, 477, 188, 436,
180, 587, 282, 105, 454, 736, 457, 856, 645, 545, 83,
74, 262, 706, 1000, 839, 976, 249, 412, 424, 191, 812,
442, 450, 138, 164, 966, 54, 599, 406, 599, 951, 888,
231, 723, 287, 692, 617, 275, 719, 445, 361, 954, 583,
951, 694, 186, 491, 906, 448, 764, 854, 87, 636, 171,
777, 694, 876, 759, 815, 996, 816, 378, 779, 599, 118,
439, 384, 558, 684, 745, 150, 578, 382, 758, 857, 29,
671, 99, 249, 795, 808, 695, 431, 5, 591, 736, 235,
129, 179, 463, 522, 282, 502, 739, 889, 323, 635, 486,
477, 231, 502, 471, 524, 566, 189, 91, 998, 772, 108,
727, 234, 200, 139, 333, 258, 422, 160, 16, 255, 828,
476, 564, 161, 215, 912, 20, 896, 968, 285, 104, 561,
36, 389, 68, 684, 558, 83, 967, 992, 428, 610, 992,
968, 249, 723, 498, 961, 850, 665, 898, 53, 331, 507,
69, 164, 99, 435, 418, 104, 868, 468, 665, 849, 34,
778, 943, 390, 517, 338, 78, 31, 805, 802, 148, 448,
334, 645, 638, 513, 599, 584, 504, 93, 613, 794, 698,
898, 731, 777, 711, 189, 113, 838, 662, 106, 803, 338,
361, 631, 370, 805, 156, 583, 102, 486, 989, 81, 693,
530, 225, 706, 746, 165, 656, 827, 140, 2, 359, 516,
938, 452, 18, 399, 564, 668, 891, 557, 78, 15, 880,
796, 987, 205, 26, 665, 9, 227, 23, 222, 199, 111,
556, 897, 4, 544, 701, 408, 324, 833, 738, 954, 669,
671, 514, 886, 858, 89, 382, 452, 584, 231, 843, 971,
952, 162, 680, 861, 927, 55, 260, 9, 140, 495, 478,
891, 410, 406, 115, 83, 6, 809, 421, 611, 696, 182,
563, 567, 931, 899, 784, 936, 699, 733, 830, 760, 301,
919, 720, 1000, 601, 804, 942, 762, 332, 966, 192,
566, 788, 983, 584, 953, 63, 510, 281, 643, 399])
def test_snail_028(self):
self.assertEqual(snail([[694, 584, 826, 873, 217, 367, 668, 234, 472,
306, 498, 94, 613, 797],
[712, 162, 246, 54, 330, 345, 797, 656, 949,
377, 907, 79, 246, 655],
[393, 162, 490, 233, 843, 794, 437, 391, 266,
639, 553, 518, 364, 569],
[844, 274, 883, 549, 545, 431, 169, 974, 129,
186, 605, 391, 354, 562],
[439, 363, 626, 800, 507, 849, 391, 701, 310,
374, 946, 329, 720, 188],
[110, 517, 124, 454, 546, 362, 238, 717, 444,
560, 620, 885, 732, 631],
[849, 531, 960, 464, 448, 802, 101, 755, 69,
843, 256, 543, 728, 839],
[538, 525, 681, 672, 849, 637, 688, 939, 393,
184, 675, 434, 361, 557],
[483, 832, 588, 542, 124, 605, 146, 492, 359,
465, 278, 352, 815, 884],
[837, 448, 77, 252, 291, 313, 816, 79, 919, 188,
845, 26, 918, 190],
[994, 349, 148, 613, 557, 269, 695, 471, 944,
90, 2, 167, 136, 926],
[596, 304, 727, 835, 858, 635, 727, 136, 179,
266, 171, 679, 985, 945],
[152, 294, 615, 139, 465, 165, 578, 914, 232,
953, 268, 143, 847, 663],
[355, 96, 458, 217, 834, 690, 302, 691, 470,
344, 567, 66, 479, 144]]),
[694, 584, 826, 873, 217, 367, 668, 234, 472, 306, 498,
94, 613, 797, 655, 569, 562, 188, 631, 839, 557, 884,
190, 926, 945, 663, 144, 479, 66, 567, 344, 470, 691,
302, 690, 834, 217, 458, 96, 355, 152, 596, 994, 837,
483, 538, 849, 110, 439, 844, 393, 712, 162, 246, 54,
330, 345, 797, 656, 949, 377, 907, 79, 246, 364, 354,
720, 732, 728, 361, 815, 918, 136, 985, 847, 143, 268,
953, 232, 914, 578, 165, 465, 139, 615, 294, 304, 349,
448, 832, 525, 531, 517, 363, 274, 162, 490, 233, 843,
794, 437, 391, 266, 639, 553, 518, 391, 329, 885, 543,
434, 352, 26, 167, 679, 171, 266, 179, 136, 727, 635,
858, 835, 727, 148, 77, 588, 681, 960, 124, 626, 883,
549, 545, 431, 169, 974, 129, 186, 605, 946, 620, 256,
675, 278, 845, 2, 90, 944, 471, 695, 269, 557, 613,
252, 542, 672, 464, 454, 800, 507, 849, 391, 701, 310,
374, 560, 843, 184, 465, 188, 919, 79, 816, 313, 291,
124, 849, 448, 546, 362, 238, 717, 444, 69, 393, 359,
492, 146, 605, 637, 802, 101, 755, 939, 688])
def test_snail_029(self):
self.assertEqual(snail([[823, 448, 897, 244, 584, 461, 96],
[645, 751, 213, 852, 812, 16, 617],
[341, 284, 208, 458, 28, 238, 767],
[773, 348, 159, 197, 957, 501, 818],
[932, 118, 964, 418, 423, 847, 430],
[545, 667, 931, 75, 818, 645, 45],
[923, 151, 732, 63, 520, 681, 627]]),
[823, 448, 897, 244, 584, 461, 96, 617, 767, 818, 430,
45, 627, 681, 520, 63, 732, 151, 923, 545, 932, 773,
341, 645, 751, 213, 852, 812, 16, 238, 501, 847, 645,
818, 75, 931, 667, 118, 348, 284, 208, 458, 28, 957,
423, 418, 964, 159, 197])
def test_snail_030(self):
self.assertEqual(snail([[491, 432, 751, 729, 722, 964, 386, 710, 130,
369, 227, 487, 395, 914, 468, 885, 81, 569,
868, 900],
[925, 992, 601, 188, 204, 640, 239, 6, 26, 451,
26, 630, 429, 830, 38, 905, 555, 630, 296,
840],
[401, 86, 682, 405, 960, 499, 290, 765, 513,
376, 331, 78, 471, 999, 3, 328, 896, 758, 56,
75],
[542, 905, 880, 788, 546, 879, 658, 836, 787,
912, 968, 988, 98, 461, 973, 469, 371, 178,
984, 431],
[584, 627, 404, 160, 875, 721, 409, 163, 30,
127, 499, 300, 869, 690, 69, 260, 751, 151,
288, 319],
[748, 508, 826, 682, 70, 215, 89, 186, 418, 386,
474, 42, 389, 599, 872, 534, 181, 496, 186,
21],
[546, 745, 446, 346, 449, 807, 863, 996, 605,
427, 845, 182, 932, 282, 544, 650, 123, 188,
505, 745],
[107, 963, 507, 886, 162, 321, 597, 90, 576,
101, 818, 394, 542, 276, 578, 417, 797, 89,
366, 771],
[904, 230, 474, 400, 921, 749, 277, 826, 638,
294, 520, 617, 405, 983, 437, 87, 940, 492,
561, 407],
[877, 195, 809, 714, 64, 362, 585, 4, 995, 949,
383, 172, 55, 468, 637, 229, 746, 208, 91,
708],
[663, 758, 330, 359, 996, 67, 409, 169, 660,
688, 11, 50, 191, 88, 802, 834, 559, 139, 490,
412],
[310, 464, 204, 408, 801, 352, 18, 167, 815,
753, 758, 833, 85, 731, 253, 655, 290, 493,
356, 396],
[424, 931, 222, 6, 67, 347, 450, 528, 353, 444,
283, 971, 925, 76, 208, 101, 989, 64, 209,
875],
[903, 651, 952, 356, 647, 99, 895, 868, 203,
620, 147, 200, 657, 839, 745, 260, 916, 552,
896, 209],
[721, 17, 825, 638, 691, 971, 95, 844, 75, 203,
692, 210, 618, 113, 518, 82, 493, 463, 647,
122],
[335, 97, 438, 636, 568, 329, 681, 998, 316,
679, 597, 547, 505, 283, 748, 299, 800, 828,
521, 139],
[209, 110, 325, 990, 706, 379, 897, 133, 457,
573, 653, 863, 452, 819, 801, 756, 590, 925,
583, 731],
[816, 946, 134, 587, 645, 751, 780, 140, 731,
208, 504, 939, 401, 724, 140, 1000, 575, 15,
966, 719],
[929, 121, 255, 511, 401, 94, 7, 656, 871, 52,
589, 504, 456, 524, 492, 4, 513, 673, 536,
877],
[828, 402, 44, 162, 805, 675, 391, 875, 955,
410, 385, 625, 250, 837, 153, 922, 105, 279,
91, 121]]),
[491, 432, 751, 729, 722, 964, 386, 710, 130, 369, 227,
487, 395, 914, 468, 885, 81, 569, 868, 900, 840, 75,
431, 319, 21, 745, 771, 407, 708, 412, 396, 875, 209,
122, 139, 731, 719, 877, 121, 91, 279, 105, 922, 153,
837, 250, 625, 385, 410, 955, 875, 391, 675, 805, 162,
44, 402, 828, 929, 816, 209, 335, 721, 903, 424, 310,
663, 877, 904, 107, 546, 748, 584, 542, 401, 925, 992,
601, 188, 204, 640, 239, 6, 26, 451, 26, 630, 429,
830, 38, 905, 555, 630, 296, 56, 984, 288, 186, 505,
366, 561, 91, 490, 356, 209, 896, 647, 521, 583, 966,
536, 673, 513, 4, 492, 524, 456, 504, 589, 52, 871,
656, 7, 94, 401, 511, 255, 121, 946, 110, 97, 17, 651,
931, 464, 758, 195, 230, 963, 745, 508, 627, 905, 86,
682, 405, 960, 499, 290, 765, 513, 376, 331, 78, 471,
999, 3, 328, 896, 758, 178, 151, 496, 188, 89, 492,
208, 139, 493, 64, 552, 463, 828, 925, 15, 575, 1000,
140, 724, 401, 939, 504, 208, 731, 140, 780, 751, 645,
587, 134, 325, 438, 825, 952, 222, 204, 330, 809, 474,
507, 446, 826, 404, 880, 788, 546, 879, 658, 836, 787,
912, 968, 988, 98, 461, 973, 469, 371, 751, 181, 123,
797, 940, 746, 559, 290, 989, 916, 493, 800, 590, 756,
801, 819, 452, 863, 653, 573, 457, 133, 897, 379, 706,
990, 636, 638, 356, 6, 408, 359, 714, 400, 886, 346,
682, 160, 875, 721, 409, 163, 30, 127, 499, 300, 869,
690, 69, 260, 534, 650, 417, 87, 229, 834, 655, 101,
260, 82, 299, 748, 283, 505, 547, 597, 679, 316, 998,
681, 329, 568, 691, 647, 67, 801, 996, 64, 921, 162,
449, 70, 215, 89, 186, 418, 386, 474, 42, 389, 599,
872, 544, 578, 437, 637, 802, 253, 208, 745, 518, 113,
618, 210, 692, 203, 75, 844, 95, 971, 99, 347, 352,
67, 362, 749, 321, 807, 863, 996, 605, 427, 845, 182,
932, 282, 276, 983, 468, 88, 731, 76, 839, 657, 200,
147, 620, 203, 868, 895, 450, 18, 409, 585, 277, 597,
90, 576, 101, 818, 394, 542, 405, 55, 191, 85, 925,
971, 283, 444, 353, 528, 167, 169, 4, 826, 638, 294,
520, 617, 172, 50, 833, 758, 753, 815, 660, 995, 949,
383, 11, 688])
def test_snail_031(self):
self.assertEqual(snail(
[[751, 521, 950, 82], [455, 888, 335, 526], [105, 724, 129, 53],
[380, 655, 725, 828]]),
[751, 521, 950, 82, 526, 53, 828, 725, 655, 380, 105,
455, 888, 335, 129, 724])
def test_snail_032(self):
self.assertEqual(snail([[543]]), [543])
def test_snail_033(self):
self.assertEqual(snail([[229, 998, 713, 612, 345, 412, 73, 287, 921, 44,
509, 147, 815, 84],
[202, 726, 739, 170, 976, 345, 944, 506, 848,
942, 98, 297, 75, 807],
[893, 82, 958, 458, 916, 954, 418, 436, 492, 86,
792, 226, 925, 268],
[370, 388, 588, 171, 945, 358, 281, 657, 577,
147, 44, 352, 899, 119],
[63, 834, 521, 924, 276, 174, 483, 414, 999,
932, 97, 492, 833, 363],
[983, 187, 828, 23, 387, 853, 203, 130, 187,
820, 569, 974, 494, 870],
[265, 162, 207, 733, 32, 925, 259, 761, 166,
231, 504, 503, 64, 851],
[434, 330, 43, 791, 846, 790, 566, 474, 702,
462, 693, 826, 682, 881],
[752, 68, 291, 180, 294, 674, 433, 486, 768,
743, 498, 98, 61, 154],
[52, 47, 323, 362, 247, 135, 716, 566, 713, 977,
78, 222, 300, 909],
[265, 17, 534, 221, 142, 430, 935, 948, 600, 79,
898, 229, 949, 656],
[850, 639, 989, 941, 84, 62, 850, 437, 25, 538,
670, 868, 406, 755],
[370, 978, 377, 131, 102, 929, 459, 201, 14,
981, 461, 153, 665, 352],
[374, 581, 593, 665, 922, 259, 899, 586, 405,
812, 645, 820, 321, 535]]),
[229, 998, 713, 612, 345, 412, 73, 287, 921, 44, 509,
147, 815, 84, 807, 268, 119, 363, 870, 851, 881, 154,
909, 656, 755, 352, 535, 321, 820, 645, 812, 405, 586,
899, 259, 922, 665, 593, 581, 374, 370, 850, 265, 52,
752, 434, 265, 983, 63, 370, 893, 202, 726, 739, 170,
976, 345, 944, 506, 848, 942, 98, 297, 75, 925, 899,
833, 494, 64, 682, 61, 300, 949, 406, 665, 153, 461,
981, 14, 201, 459, 929, 102, 131, 377, 978, 639, 17,
47, 68, 330, 162, 187, 834, 388, 82, 958, 458, 916,
954, 418, 436, 492, 86, 792, 226, 352, 492, 974, 503,
826, 98, 222, 229, 868, 670, 538, 25, 437, 850, 62,
84, 941, 989, 534, 323, 291, 43, 207, 828, 521, 588,
171, 945, 358, 281, 657, 577, 147, 44, 97, 569, 504,
693, 498, 78, 898, 79, 600, 948, 935, 430, 142, 221,
362, 180, 791, 733, 23, 924, 276, 174, 483, 414, 999,
932, 820, 231, 462, 743, 977, 713, 566, 716, 135, 247,
294, 846, 32, 387, 853, 203, 130, 187, 166, 702, 768,
486, 433, 674, 790, 925, 259, 761, 474, 566])
def test_snail_034(self):
self.assertEqual(snail([[543, 159, 630, 512, 408, 22, 659, 938, 716,
955, 142, 6, 273, 723],
[899, 659, 592, 655, 57, 191, 321, 795, 226,
317, 372, 190, 368, 804],
[214, 369, 514, 853, 25, 423, 744, 462, 181,
663, 863, 747, 152, 353],
[117, 9, 923, 420, 253, 550, 729, 881, 696, 208,
269, 362, 242, 177],
[625, 547, 37, 512, 130, 542, 853, 646, 551,
801, 257, 306, 206, 361],
[271, 719, 731, 679, 306, 529, 531, 846, 891,
420, 871, 537, 514, 117],
[350, 890, 866, 614, 496, 485, 88, 13, 488, 842,
197, 891, 854, 554],
[278, 713, 485, 671, 556, 687, 246, 19, 293,
906, 1000, 375, 531, 126],
[641, 531, 586, 598, 991, 366, 229, 169, 644,
562, 847, 724, 546, 904],
[859, 329, 116, 455, 986, 255, 334, 156, 188,
438, 112, 409, 283, 653],
[844, 612, 215, 684, 518, 422, 922, 741, 33,
196, 272, 51, 604, 951],
[457, 68, 327, 589, 617, 942, 5, 200, 722, 725,
971, 886, 972, 961],
[817, 172, 829, 438, 738, 639, 453, 565, 270,
683, 405, 829, 664, 749],
[347, 518, 664, 43, 591, 52, 685, 427, 716, 578,
854, 88, 673, 458]]),
[543, 159, 630, 512, 408, 22, 659, 938, 716, 955, 142,
6, 273, 723, 804, 353, 177, 361, 117, 554, 126, 904,
653, 951, 961, 749, 458, 673, 88, 854, 578, 716, 427,
685, 52, 591, 43, 664, 518, 347, 817, 457, 844, 859,
641, 278, 350, 271, 625, 117, 214, 899, 659, 592, 655,
57, 191, 321, 795, 226, 317, 372, 190, 368, 152, 242,
206, 514, 854, 531, 546, 283, 604, 972, 664, 829, 405,
683, 270, 565, 453, 639, 738, 438, 829, 172, 68, 612,
329, 531, 713, 890, 719, 547, 9, 369, 514, 853, 25,
423, 744, 462, 181, 663, 863, 747, 362, 306, 537, 891,
375, 724, 409, 51, 886, 971, 725, 722, 200, 5, 942,
617, 589, 327, 215, 116, 586, 485, 866, 731, 37, 923,
420, 253, 550, 729, 881, 696, 208, 269, 257, 871, 197,
1000, 847, 112, 272, 196, 33, 741, 922, 422, 518, 684,
455, 598, 671, 614, 679, 512, 130, 542, 853, 646, 551,
801, 420, 842, 906, 562, 438, 188, 156, 334, 255, 986,
991, 556, 496, 306, 529, 531, 846, 891, 488, 293, 644,
169, 229, 366, 687, 485, 88, 13, 19, 246])
def test_snail_035(self):
self.assertEqual(snail(
[[805, 737, 255, 944, 227, 940, 373, 877, 581, 787, 278, 332],
[64, 412, 532, 342, 955, 252, 339, 890, 26, 793, 124, 394],
[814, 764, 949, 785, 415, 832, 711, 188, 65, 623, 255, 469],
[110, 743, 29, 583, 871, 275, 878, 329, 107, 698, 107, 523],
[212, 73, 731, 628, 188, 215, 22, 479, 650, 523, 1000, 926],
[383, 241, 377, 580, 798, 363, 103, 802, 427, 943, 877, 919],
[387, 291, 796, 951, 13, 601, 617, 451, 340, 203, 336, 42],
[412, 654, 456, 885, 799, 937, 971, 608, 17, 481, 383, 748],
[39, 178, 45, 684, 995, 672, 707, 397, 999, 98, 373, 396],
[62, 984, 818, 343, 914, 165, 470, 510, 86, 545, 993, 448],
[105, 178, 404, 878, 906, 445, 706, 798, 613, 433, 492, 518],
[744, 254, 817, 85, 813, 574, 193, 588, 505, 162, 819, 636]]),
[805, 737, 255, 944, 227, 940, 373, 877, 581, 787, 278,
332, 394, 469, 523, 926, 919, 42, 748, 396, 448, 518,
636, 819, 162, 505, 588, 193, 574, 813, 85, 817, 254,
744, 105, 62, 39, 412, 387, 383, 212, 110, 814, 64,
412, 532, 342, 955, 252, 339, 890, 26, 793, 124, 255,
107, 1000, 877, 336, 383, 373, 993, 492, 433, 613,
798, 706, 445, 906, 878, 404, 178, 984, 178, 654, 291,
241, 73, 743, 764, 949, 785, 415, 832, 711, 188, 65,
623, 698, 523, 943, 203, 481, 98, 545, 86, 510, 470,
165, 914, 343, 818, 45, 456, 796, 377, 731, 29, 583,
871, 275, 878, 329, 107, 650, 427, 340, 17, 999, 397,
707, 672, 995, 684, 885, 951, 580, 628, 188, 215, 22,
479, 802, 451, 608, 971, 937, 799, 13, 798, 363, 103,
617, 601])
def test_snail_036(self):
self.assertEqual(snail(
[[997, 44, 256, 241, 586, 435, 204, 852, 283, 678],
[536, 493, 608, 713, 378, 476, 645, 242, 657, 560],
[609, 310, 407, 973, 835, 59, 771, 982, 985, 55],
[948, 389, 927, 772, 391, 672, 254, 120, 915, 655],
[993, 544, 661, 167, 875, 343, 129, 64, 471, 611],
[186, 216, 598, 814, 94, 694, 135, 7, 374, 60],
[487, 528, 461, 860, 913, 283, 276, 354, 679, 778],
[636, 627, 996, 319, 813, 600, 548, 491, 948, 178],
[995, 381, 855, 47, 403, 250, 912, 709, 322, 993],
[604, 150, 814, 285, 749, 84, 752, 680, 900, 222]]),
[997, 44, 256, 241, 586, 435, 204, 852, 283, 678, 560,
55, 655, 611, 60, 778, 178, 993, 222, 900, 680, 752,
84, 749, 285, 814, 150, 604, 995, 636, 487, 186, 993,
948, 609, 536, 493, 608, 713, 378, 476, 645, 242, 657,
985, 915, 471, 374, 679, 948, 322, 709, 912, 250, 403,
47, 855, 381, 627, 528, 216, 544, 389, 310, 407, 973,
835, 59, 771, 982, 120, 64, 7, 354, 491, 548, 600,
813, 319, 996, 461, 598, 661, 927, 772, 391, 672, 254,
129, 135, 276, 283, 913, 860, 814, 167, 875, 343, 694,
94])
def test_snail_037(self):
self.assertEqual(snail([[924, 474, 327, 244, 69, 575, 52, 587, 477, 521,
871, 701, 236],
[521, 643, 870, 149, 368, 896, 185, 164, 142,
419, 686, 209, 67],
[161, 18, 876, 414, 245, 830, 900, 985, 627,
760, 366, 872, 85],
[885, 784, 859, 378, 232, 55, 455, 716, 558, 68,
430, 331, 35],
[859, 82, 149, 721, 581, 743, 272, 68, 600, 363,
433, 350, 62],
[435, 913, 330, 343, 219, 649, 84, 442, 282,
315, 368, 567, 33],
[756, 543, 726, 158, 116, 526, 43, 351, 731,
966, 190, 494, 396],
[991, 673, 736, 193, 693, 113, 21, 298, 699,
837, 141, 997, 872],
[589, 658, 79, 77, 493, 79, 163, 484, 631, 547,
53, 991, 387],
[536, 709, 286, 817, 344, 230, 460, 648, 13, 13,
268, 604, 512],
[107, 41, 145, 882, 103, 149, 377, 919, 188,
631, 686, 965, 945],
[983, 912, 408, 29, 227, 783, 589, 629, 432,
119, 498, 481, 652],
[470, 415, 9, 285, 695, 290, 688, 88, 702, 962,
280, 589, 7]]),
[924, 474, 327, 244, 69, 575, 52, 587, 477, 521, 871,
701, 236, 67, 85, 35, 62, 33, 396, 872, 387, 512, 945,
652, 7, 589, 280, 962, 702, 88, 688, 290, 695, 285, 9,
415, 470, 983, 107, 536, 589, 991, 756, 435, 859, 885,
161, 521, 643, 870, 149, 368, 896, 185, 164, 142, 419,
686, 209, 872, 331, 350, 567, 494, 997, 991, 604, 965,
481, 498, 119, 432, 629, 589, 783, 227, 29, 408, 912,
41, 709, 658, 673, 543, 913, 82, 784, 18, 876, 414,
245, 830, 900, 985, 627, 760, 366, 430, 433, 368, 190,
141, 53, 268, 686, 631, 188, 919, 377, 149, 103, 882,
145, 286, 79, 736, 726, 330, 149, 859, 378, 232, 55,
455, 716, 558, 68, 363, 315, 966, 837, 547, 13, 13,
648, 460, 230, 344, 817, 77, 193, 158, 343, 721, 581,
743, 272, 68, 600, 282, 731, 699, 631, 484, 163, 79,
493, 693, 116, 219, 649, 84, 442, 351, 298, 21, 113,
526, 43])
def test_snail_038(self):
self.assertEqual(snail([[332, 189, 638, 117, 858, 164, 701, 784, 749,
950, 707, 293, 233, 576],
[380, 752, 798, 298, 597, 470, 623, 773, 953,
86, 251, 504, 126, 633],
[337, 241, 413, 616, 605, 278, 289, 366, 162,
83, 632, 601, 771, 812],
[814, 497, 196, 480, 388, 471, 689, 147, 436,
568, 298, 36, 503, 120],
[867, 706, 472, 178, 529, 333, 885, 252, 864,
324, 288, 246, 463, 478],
[702, 781, 720, 927, 185, 781, 841, 175, 822,
170, 77, 144, 909, 301],
[779, 325, 154, 452, 539, 389, 191, 453, 664,
920, 216, 383, 873, 917],
[859, 868, 29, 729, 640, 104, 731, 668, 816,
335, 907, 242, 563, 950],
[230, 53, 485, 405, 276, 592, 563, 860, 770,
124, 501, 431, 370, 908],
[355, 994, 912, 644, 789, 852, 140, 693, 256,
677, 136, 488, 337, 317],
[346, 323, 9, 399, 577, 991, 9, 152, 271, 188,
222, 851, 696, 985],
[481, 705, 515, 680, 129, 670, 380, 894, 951,
245, 577, 654, 109, 754],
[889, 295, 885, 544, 579, 931, 693, 95, 772,
865, 210, 62, 232, 361],
[743, 942, 729, 57, 879, 664, 20, 779, 401, 449,
973, 521, 380, 393]]),
[332, 189, 638, 117, 858, 164, 701, 784, 749, 950, 707,
293, 233, 576, 633, 812, 120, 478, 301, 917, 950, 908,
317, 985, 754, 361, 393, 380, 521, 973, 449, 401, 779,
20, 664, 879, 57, 729, 942, 743, 889, 481, 346, 355,
230, 859, 779, 702, 867, 814, 337, 380, 752, 798, 298,
597, 470, 623, 773, 953, 86, 251, 504, 126, 771, 503,
463, 909, 873, 563, 370, 337, 696, 109, 232, 62, 210,
865, 772, 95, 693, 931, 579, 544, 885, 295, 705, 323,
994, 53, 868, 325, 781, 706, 497, 241, 413, 616, 605,
278, 289, 366, 162, 83, 632, 601, 36, 246, 144, 383,
242, 431, 488, 851, 654, 577, 245, 951, 894, 380, 670,
129, 680, 515, 9, 912, 485, 29, 154, 720, 472, 196,
480, 388, 471, 689, 147, 436, 568, 298, 288, 77, 216,
907, 501, 136, 222, 188, 271, 152, 9, 991, 577, 399,
644, 405, 729, 452, 927, 178, 529, 333, 885, 252, 864,
324, 170, 920, 335, 124, 677, 256, 693, 140, 852, 789,
276, 640, 539, 185, 781, 841, 175, 822, 664, 816, 770,
860, 563, 592, 104, 389, 191, 453, 668, 731])
def test_snail_039(self):
self.assertEqual(snail([[686, 345, 940, 678, 562, 159, 206, 990, 927,
298, 539, 662, 265, 951, 400],
[528, 940, 929, 898, 770, 67, 357, 491, 61, 867,
425, 746, 957, 613, 720],
[116, 943, 331, 211, 933, 899, 736, 195, 147,
366, 181, 973, 59, 873, 379],
[161, 879, 580, 471, 865, 871, 542, 206, 816,
807, 436, 387, 893, 970, 145],
[367, 686, 933, 883, 434, 565, 652, 528, 199,
346, 378, 377, 911, 746, 288],
[844, 843, 849, 486, 101, 957, 940, 223, 930,
113, 359, 782, 652, 783, 559],
[56, 652, 242, 424, 531, 187, 16, 752, 168, 603,
702, 435, 237, 814, 398],
[10, 230, 815, 547, 434, 244, 56, 947, 758, 155,
407, 213, 366, 418, 518],
[438, 950, 214, 575, 809, 811, 370, 916, 57,
964, 918, 461, 428, 971, 456],
[190, 751, 7, 549, 101, 648, 636, 735, 371, 122,
316, 848, 463, 552, 41],
[82, 332, 595, 889, 290, 652, 211, 874, 249,
740, 352, 870, 517, 810, 422],
[248, 681, 64, 600, 6, 399, 108, 991, 123, 413,
862, 309, 28, 957, 861],
[603, 104, 908, 12, 827, 54, 796, 166, 701, 933,
180, 308, 604, 374, 950],
[495, 877, 743, 460, 546, 160, 966, 712, 708,
606, 52, 445, 957, 762, 950],
[39, 185, 527, 228, 972, 273, 584, 336, 352,
376, 681, 554, 34, 322, 125]]),
[686, 345, 940, 678, 562, 159, 206, 990, 927, 298, 539,
662, 265, 951, 400, 720, 379, 145, 288, 559, 398, 518,
456, 41, 422, 861, 950, 950, 125, 322, 34, 554, 681,
376, 352, 336, 584, 273, 972, 228, 527, 185, 39, 495,
603, 248, 82, 190, 438, 10, 56, 844, 367, 161, 116,
528, 940, 929, 898, 770, 67, 357, 491, 61, 867, 425,
746, 957, 613, 873, 970, 746, 783, 814, 418, 971, 552,
810, 957, 374, 762, 957, 445, 52, 606, 708, 712, 966,
160, 546, 460, 743, 877, 104, 681, 332, 751, 950, 230,
652, 843, 686, 879, 943, 331, 211, 933, 899, 736, 195,
147, 366, 181, 973, 59, 893, 911, 652, 237, 366, 428,
463, 517, 28, 604, 308, 180, 933, 701, 166, 796, 54,
827, 12, 908, 64, 595, 7, 214, 815, 242, 849, 933,
580, 471, 865, 871, 542, 206, 816, 807, 436, 387, 377,
782, 435, 213, 461, 848, 870, 309, 862, 413, 123, 991,
108, 399, 6, 600, 889, 549, 575, 547, 424, 486, 883,
434, 565, 652, 528, 199, 346, 378, 359, 702, 407, 918,
316, 352, 740, 249, 874, 211, 652, 290, 101, 809, 434,
531, 101, 957, 940, 223, 930, 113, 603, 155, 964, 122,
371, 735, 636, 648, 811, 244, 187, 16, 752, 168, 758,
57, 916, 370, 56, 947])
def test_snail_040(self):
self.assertEqual(snail([[234, 459, 8, 740, 18, 612, 971, 482, 105, 70],
[725, 582, 552, 166, 909, 83, 323, 842, 901,
479],
[139, 880, 685, 560, 197, 820, 458, 261, 491,
930],
[917, 677, 674, 610, 470, 744, 893, 604, 310,
818],
[826, 470, 627, 391, 222, 544, 687, 939, 544,
952],
[68, 614, 803, 517, 852, 251, 87, 88, 838, 229],
[269, 848, 520, 498, 486, 567, 575, 779, 706,
74],
[567, 438, 209, 639, 573, 640, 885, 830, 665,
130],
[183, 483, 877, 703, 75, 515, 323, 482, 901,
562],
[426, 570, 572, 144, 924, 285, 48, 976, 282,
802]]),
[234, 459, 8, 740, 18, 612, 971, 482, 105, 70, 479,
930, 818, 952, 229, 74, 130, 562, 802, 282, 976, 48,
285, 924, 144, 572, 570, 426, 183, 567, 269, 68, 826,
917, 139, 725, 582, 552, 166, 909, 83, 323, 842, 901,
491, 310, 544, 838, 706, 665, 901, 482, 323, 515, 75,
703, 877, 483, 438, 848, 614, 470, 677, 880, 685, 560,
197, 820, 458, 261, 604, 939, 88, 779, 830, 885, 640,
573, 639, 209, 520, 803, 627, 674, 610, 470, 744, 893,
687, 87, 575, 567, 486, 498, 517, 391, 222, 544, 251,
852])
def test_snail_041(self):
self.assertEqual(snail(
[[966, 770, 415, 443, 591], [733, 239, 637, 938, 246],
[567, 292, 816, 631, 702], [315, 312, 771, 408, 474],
[275, 740, 146, 719, 961]]),
[966, 770, 415, 443, 591, 246, 702, 474, 961, 719, 146,
740, 275, 315, 567, 733, 239, 637, 938, 631, 408, 771,
312, 292, 816])
def test_snail_042(self):
self.assertEqual(snail([[928, 128, 90, 593, 147, 757, 325, 206, 400,
949, 633, 558, 879],
[190, 99, 708, 968, 665, 847, 159, 388, 584,
547, 469, 788, 586],
[684, 65, 832, 834, 651, 891, 458, 712, 596,
377, 465, 789, 44],
[653, 136, 125, 990, 21, 351, 405, 771, 910,
922, 213, 998, 75],
[165, 220, 334, 367, 603, 930, 821, 232, 624,
209, 353, 156, 271],
[437, 145, 802, 747, 716, 565, 784, 364, 524,
475, 283, 81, 501],
[821, 590, 652, 948, 704, 922, 334, 102, 905,
13, 335, 462, 425],
[118, 633, 924, 637, 123, 245, 432, 807, 579,
480, 828, 79, 942],
[805, 592, 718, 356, 790, 549, 125, 844, 691,
71, 835, 150, 747],
[87, 541, 24, 922, 952, 881, 463, 192, 319, 765,
771, 368, 432],
[149, 859, 949, 368, 342, 942, 337, 598, 490,
889, 50, 794, 786],
[868, 167, 392, 93, 126, 521, 922, 941, 210,
170, 982, 94, 43],
[583, 931, 24, 750, 990, 453, 518, 9, 657, 789,
678, 676, 756]]),
[928, 128, 90, 593, 147, 757, 325, 206, 400, 949, 633,
558, 879, 586, 44, 75, 271, 501, 425, 942, 747, 432,
786, 43, 756, 676, 678, 789, 657, 9, 518, 453, 990,
750, 24, 931, 583, 868, 149, 87, 805, 118, 821, 437,
165, 653, 684, 190, 99, 708, 968, 665, 847, 159, 388,
584, 547, 469, 788, 789, 998, 156, 81, 462, 79, 150,
368, 794, 94, 982, 170, 210, 941, 922, 521, 126, 93,
392, 167, 859, 541, 592, 633, 590, 145, 220, 136, 65,
832, 834, 651, 891, 458, 712, 596, 377, 465, 213, 353,
283, 335, 828, 835, 771, 50, 889, 490, 598, 337, 942,
342, 368, 949, 24, 718, 924, 652, 802, 334, 125, 990,
21, 351, 405, 771, 910, 922, 209, 475, 13, 480, 71,
765, 319, 192, 463, 881, 952, 922, 356, 637, 948, 747,
367, 603, 930, 821, 232, 624, 524, 905, 579, 691, 844,
125, 549, 790, 123, 704, 716, 565, 784, 364, 102, 807,
432, 245, 922, 334])
def test_snail_043(self):
self.assertEqual(snail(
[[87, 462, 110, 33, 41, 613, 234, 971, 424, 490, 399],
[489, 50, 350, 304, 182, 24, 614, 707, 935, 678, 706],
[363, 94, 140, 854, 757, 467, 369, 903, 629, 342, 144],
[838, 301, 145, 18, 841, 484, 374, 723, 136, 333, 757],
[316, 713, 514, 19, 847, 337, 830, 358, 313, 138, 270],
[869, 803, 76, 126, 424, 80, 383, 117, 180, 519, 534],
[663, 709, 774, 866, 180, 59, 780, 653, 290, 958, 920],
[931, 926, 174, 65, 301, 51, 255, 19, 439, 910, 474],
[229, 84, 159, 158, 470, 597, 842, 83, 794, 285, 20],
[248, 938, 591, 246, 529, 506, 869, 146, 600, 738, 931],
[391, 267, 55, 182, 281, 344, 431, 338, 792, 443, 687]]),
[87, 462, 110, 33, 41, 613, 234, 971, 424, 490, 399,
706, 144, 757, 270, 534, 920, 474, 20, 931, 687, 443,
792, 338, 431, 344, 281, 182, 55, 267, 391, 248, 229,
931, 663, 869, 316, 838, 363, 489, 50, 350, 304, 182,
24, 614, 707, 935, 678, 342, 333, 138, 519, 958, 910,
285, 738, 600, 146, 869, 506, 529, 246, 591, 938, 84,
926, 709, 803, 713, 301, 94, 140, 854, 757, 467, 369,
903, 629, 136, 313, 180, 290, 439, 794, 83, 842, 597,
470, 158, 159, 174, 774, 76, 514, 145, 18, 841, 484,
374, 723, 358, 117, 653, 19, 255, 51, 301, 65, 866,
126, 19, 847, 337, 830, 383, 780, 59, 180, 424, 80])
def test_snail_044(self):
self.assertEqual(snail(
[[64, 644, 694, 5, 163, 760, 568, 84, 67, 517, 872],
[933, 412, 172, 162, 97, 626, 830, 969, 809, 522, 539],
[910, 121, 228, 803, 443, 4, 341, 64, 60, 438, 964],
[320, 135, 26, 700, 58, 741, 111, 944, 580, 855, 195],
[2, 802, 971, 42, 232, 432, 910, 803, 694, 46, 826],
[612, 974, 539, 639, 21, 878, 809, 246, 218, 331, 974],
[804, 448, 962, 406, 439, 556, 826, 109, 798, 609, 867],
[260, 335, 33, 122, 577, 639, 88, 887, 760, 705, 784],
[893, 908, 88, 16, 905, 923, 220, 690, 648, 747, 591],
[276, 217, 551, 996, 879, 575, 154, 724, 468, 856, 317],
[427, 269, 210, 221, 352, 980, 952, 189, 573, 520, 383]]),
[64, 644, 694, 5, 163, 760, 568, 84, 67, 517, 872, 539,
964, 195, 826, 974, 867, 784, 591, 317, 383, 520, 573,
189, 952, 980, 352, 221, 210, 269, 427, 276, 893, 260,
804, 612, 2, 320, 910, 933, 412, 172, 162, 97, 626,
830, 969, 809, 522, 438, 855, 46, 331, 609, 705, 747,
856, 468, 724, 154, 575, 879, 996, 551, 217, 908, 335,
448, 974, 802, 135, 121, 228, 803, 443, 4, 341, 64,
60, 580, 694, 218, 798, 760, 648, 690, 220, 923, 905,
16, 88, 33, 962, 539, 971, 26, 700, 58, 741, 111, 944,
803, 246, 109, 887, 88, 639, 577, 122, 406, 639, 42,
232, 432, 910, 809, 826, 556, 439, 21, 878])
def test_snail_045(self):
self.assertEqual(snail([[631, 374, 877, 595, 738, 324, 704, 280, 468,
923, 505, 471, 786],
[725, 339, 191, 381, 268, 471, 998, 922, 108,
118, 197, 889, 647],
[422, 442, 5, 197, 843, 702, 57, 58, 593, 76,
159, 773, 840],
[166, 158, 990, 841, 117, 450, 765, 455, 254,
99, 224, 624, 608],
[129, 252, 729, 219, 199, 309, 229, 855, 542,
972, 470, 850, 286],
[255, 368, 57, 890, 572, 308, 655, 779, 134,
580, 335, 387, 888],
[27, 281, 301, 15, 780, 318, 425, 931, 277, 972,
499, 622, 692],
[466, 70, 405, 84, 594, 63, 228, 946, 440, 354,
720, 480, 259],
[257, 323, 934, 503, 258, 510, 921, 254, 430,
508, 484, 353, 949],
[321, 168, 497, 248, 670, 628, 258, 877, 585,
965, 796, 567, 233],
[190, 127, 715, 552, 621, 806, 212, 367, 420,
826, 534, 428, 604],
[908, 504, 880, 691, 117, 289, 731, 232, 629,
161, 417, 942, 52],
[341, 721, 127, 728, 46, 763, 884, 431, 905,
951, 338, 775, 868]]),
[631, 374, 877, 595, 738, 324, 704, 280, 468, 923, 505,
471, 786, 647, 840, 608, 286, 888, 692, 259, 949, 233,
604, 52, 868, 775, 338, 951, 905, 431, 884, 763, 46,
728, 127, 721, 341, 908, 190, 321, 257, 466, 27, 255,
129, 166, 422, 725, 339, 191, 381, 268, 471, 998, 922,
108, 118, 197, 889, 773, 624, 850, 387, 622, 480, 353,
567, 428, 942, 417, 161, 629, 232, 731, 289, 117, 691,
880, 504, 127, 168, 323, 70, 281, 368, 252, 158, 442,
5, 197, 843, 702, 57, 58, 593, 76, 159, 224, 470, 335,
499, 720, 484, 796, 534, 826, 420, 367, 212, 806, 621,
552, 715, 497, 934, 405, 301, 57, 729, 990, 841, 117,
450, 765, 455, 254, 99, 972, 580, 972, 354, 508, 965,
585, 877, 258, 628, 670, 248, 503, 84, 15, 890, 219,
199, 309, 229, 855, 542, 134, 277, 440, 430, 254, 921,
510, 258, 594, 780, 572, 308, 655, 779, 931, 946, 228,
63, 318, 425])
def test_snail_046(self):
self.assertEqual(snail(
[[448, 727, 434, 177, 987], [288, 839, 372, 379, 326],
[266, 287, 407, 590, 327], [782, 941, 470, 580, 365],
[823, 313, 939, 776, 834]]),
[448, 727, 434, 177, 987, 326, 327, 365, 834, 776, 939,
313, 823, 782, 266, 288, 839, 372, 379, 590, 580, 470,
941, 287, 407])
def test_snail_047(self):
self.assertEqual(snail([[134, 625, 697, 457, 3, 817, 998, 303, 562, 680,
864, 613, 483, 648, 569, 37],
[328, 426, 402, 699, 409, 971, 63, 339, 238,
759, 392, 835, 574, 349, 949, 842],
[491, 104, 329, 958, 321, 561, 47, 185, 759,
121, 608, 163, 746, 268, 114, 96],
[166, 374, 830, 603, 171, 472, 891, 395, 650,
879, 219, 441, 151, 672, 331, 202],
[763, 122, 903, 770, 555, 406, 876, 126, 509,
564, 333, 937, 863, 163, 970, 818],
[736, 749, 999, 758, 110, 809, 701, 861, 153,
823, 721, 107, 944, 830, 750, 333],
[750, 454, 398, 921, 852, 451, 774, 157, 715,
578, 474, 135, 955, 838, 386, 887],
[140, 935, 474, 862, 292, 785, 433, 271, 153,
908, 426, 686, 694, 206, 251, 533],
[13, 708, 970, 604, 773, 469, 663, 311, 734,
930, 528, 284, 558, 278, 112, 796],
[737, 293, 588, 611, 94, 821, 436, 105, 464,
543, 35, 623, 3, 33, 611, 809],
[812, 394, 490, 319, 385, 300, 47, 217, 181,
839, 527, 229, 889, 212, 754, 34],
[615, 169, 501, 732, 472, 298, 728, 494, 639,
582, 167, 79, 679, 66, 116, 445],
[307, 688, 864, 469, 119, 374, 338, 182, 396,
651, 77, 319, 744, 499, 95, 599],
[684, 884, 412, 446, 154, 747, 892, 34, 875,
845, 609, 455, 551, 940, 151, 932],
[949, 14, 409, 86, 966, 430, 157, 919, 875, 783,
268, 184, 420, 162, 970, 673],
[65, 50, 700, 314, 348, 547, 655, 313, 165, 573,
789, 164, 219, 216, 353, 975]]),
[134, 625, 697, 457, 3, 817, 998, 303, 562, 680, 864,
613, 483, 648, 569, 37, 842, 96, 202, 818, 333, 887,
533, 796, 809, 34, 445, 599, 932, 673, 975, 353, 216,
219, 164, 789, 573, 165, 313, 655, 547, 348, 314, 700,
50, 65, 949, 684, 307, 615, 812, 737, 13, 140, 750,
736, 763, 166, 491, 328, 426, 402, 699, 409, 971, 63,
339, 238, 759, 392, 835, 574, 349, 949, 114, 331, 970,
750, 386, 251, 112, 611, 754, 116, 95, 151, 970, 162,
420, 184, 268, 783, 875, 919, 157, 430, 966, 86, 409,
14, 884, 688, 169, 394, 293, 708, 935, 454, 749, 122,
374, 104, 329, 958, 321, 561, 47, 185, 759, 121, 608,
163, 746, 268, 672, 163, 830, 838, 206, 278, 33, 212,
66, 499, 940, 551, 455, 609, 845, 875, 34, 892, 747,
154, 446, 412, 864, 501, 490, 588, 970, 474, 398, 999,
903, 830, 603, 171, 472, 891, 395, 650, 879, 219, 441,
151, 863, 944, 955, 694, 558, 3, 889, 679, 744, 319,
77, 651, 396, 182, 338, 374, 119, 469, 732, 319, 611,
604, 862, 921, 758, 770, 555, 406, 876, 126, 509, 564,
333, 937, 107, 135, 686, 284, 623, 229, 79, 167, 582,
639, 494, 728, 298, 472, 385, 94, 773, 292, 852, 110,
809, 701, 861, 153, 823, 721, 474, 426, 528, 35, 527,
839, 181, 217, 47, 300, 821, 469, 785, 451, 774, 157,
715, 578, 908, 930, 543, 464, 105, 436, 663, 433, 271,
153, 734, 311])
def test_snail_048(self):
self.assertEqual(snail(
[[148, 131, 809, 558, 988], [226, 872, 217, 699, 709],
[326, 703, 976, 559, 826], [749, 582, 891, 321, 58],
[773, 142, 687, 234, 325]]),
[148, 131, 809, 558, 988, 709, 826, 58, 325, 234, 687,
142, 773, 749, 326, 226, 872, 217, 699, 559, 321, 891,
582, 703, 976])
def test_snail_049(self):
self.assertEqual(snail([[705, 149, 326, 506, 792, 406, 65, 525, 996,
158, 592, 282, 643, 696, 31, 520, 757, 275,
276],
[395, 704, 227, 598, 163, 173, 844, 171, 882,
571, 228, 161, 943, 43, 278, 3, 680, 719, 746],
[871, 369, 979, 617, 840, 771, 315, 81, 751,
543, 799, 516, 452, 899, 115, 102, 262, 234,
751],
[667, 55, 885, 708, 943, 586, 330, 992, 663, 19,
180, 786, 89, 208, 486, 706, 742, 854, 883],
[103, 917, 812, 629, 301, 326, 783, 757, 747,
217, 464, 220, 562, 390, 45, 883, 755, 278,
96],
[58, 584, 52, 378, 774, 536, 631, 392, 592, 219,
897, 685, 895, 23, 749, 884, 417, 365, 463],
[664, 410, 795, 818, 377, 952, 133, 43, 696,
342, 423, 412, 93, 337, 963, 722, 730, 824,
748],
[274, 831, 339, 463, 30, 408, 981, 958, 816,
799, 771, 659, 368, 494, 854, 878, 811, 16,
433],
[55, 449, 296, 203, 66, 988, 124, 753, 17, 600,
108, 79, 710, 973, 4, 847, 137, 725, 579],
[180, 356, 532, 283, 330, 882, 65, 248, 621,
572, 310, 119, 394, 624, 463, 326, 872, 983,
335],
[125, 938, 860, 228, 485, 110, 914, 335, 985,
788, 16, 492, 118, 658, 83, 673, 310, 463,
128],
[896, 593, 150, 280, 186, 824, 408, 2, 842, 388,
750, 674, 634, 221, 435, 728, 183, 685, 119],
[478, 785, 827, 612, 727, 240, 864, 732, 557,
136, 936, 280, 12, 953, 210, 158, 70, 762, 97],
[209, 645, 785, 915, 570, 703, 602, 696, 480,
206, 360, 662, 900, 39, 967, 709, 439, 5, 933],
[441, 925, 978, 564, 488, 326, 796, 781, 197,
696, 81, 630, 144, 317, 215, 987, 154, 30,
142],
[112, 745, 428, 350, 952, 650, 589, 463, 204,
57, 648, 273, 336, 497, 280, 697, 991, 997,
700],
[731, 537, 58, 463, 528, 662, 243, 565, 934,
490, 476, 244, 23, 859, 237, 545, 623, 6, 478],
[54, 910, 609, 160, 253, 282, 264, 395, 951,
466, 832, 888, 589, 309, 698, 27, 242, 647,
506],
[954, 699, 371, 224, 674, 22, 408, 24, 461, 574,
344, 658, 634, 902, 534, 85, 9, 177, 809]]),
[705, 149, 326, 506, 792, 406, 65, 525, 996, 158, 592,
282, 643, 696, 31, 520, 757, 275, 276, 746, 751, 883,
96, 463, 748, 433, 579, 335, 128, 119, 97, 933, 142,
700, 478, 506, 809, 177, 9, 85, 534, 902, 634, 658,
344, 574, 461, 24, 408, 22, 674, 224, 371, 699, 954,
54, 731, 112, 441, 209, 478, 896, 125, 180, 55, 274,
664, 58, 103, 667, 871, 395, 704, 227, 598, 163, 173,
844, 171, 882, 571, 228, 161, 943, 43, 278, 3, 680,
719, 234, 854, 278, 365, 824, 16, 725, 983, 463, 685,
762, 5, 30, 997, 6, 647, 242, 27, 698, 309, 589, 888,
832, 466, 951, 395, 264, 282, 253, 160, 609, 910, 537,
745, 925, 645, 785, 593, 938, 356, 449, 831, 410, 584,
917, 55, 369, 979, 617, 840, 771, 315, 81, 751, 543,
799, 516, 452, 899, 115, 102, 262, 742, 755, 417, 730,
811, 137, 872, 310, 183, 70, 439, 154, 991, 623, 545,
237, 859, 23, 244, 476, 490, 934, 565, 243, 662, 528,
463, 58, 428, 978, 785, 827, 150, 860, 532, 296, 339,
795, 52, 812, 885, 708, 943, 586, 330, 992, 663, 19,
180, 786, 89, 208, 486, 706, 883, 884, 722, 878, 847,
326, 673, 728, 158, 709, 987, 697, 280, 497, 336, 273,
648, 57, 204, 463, 589, 650, 952, 350, 564, 915, 612,
280, 228, 283, 203, 463, 818, 378, 629, 301, 326, 783,
757, 747, 217, 464, 220, 562, 390, 45, 749, 963, 854,
4, 463, 83, 435, 210, 967, 215, 317, 144, 630, 81,
696, 197, 781, 796, 326, 488, 570, 727, 186, 485, 330,
66, 30, 377, 774, 536, 631, 392, 592, 219, 897, 685,
895, 23, 337, 494, 973, 624, 658, 221, 953, 39, 900,
662, 360, 206, 480, 696, 602, 703, 240, 824, 110, 882,
988, 408, 952, 133, 43, 696, 342, 423, 412, 93, 368,
710, 394, 118, 634, 12, 280, 936, 136, 557, 732, 864,
408, 914, 65, 124, 981, 958, 816, 799, 771, 659, 79,
119, 492, 674, 750, 388, 842, 2, 335, 248, 753, 17,
600, 108, 310, 16, 788, 985, 621, 572])
def test_snail_050(self):
self.assertEqual(snail([[772, 352, 920, 451, 295, 883, 38, 33, 562, 598,
383, 190, 999, 918, 657, 173, 310, 243, 749,
460],
[868, 561, 653, 879, 805, 379, 61, 961, 64, 493,
854, 923, 284, 452, 702, 792, 656, 695, 771,
962],
[575, 398, 964, 954, 690, 209, 562, 164, 793,
976, 475, 330, 814, 655, 710, 811, 570, 20,
373, 610],
[799, 80, 212, 607, 883, 605, 697, 849, 982,
661, 68, 1000, 250, 950, 796, 122, 601, 798,
50, 473],
[648, 224, 554, 600, 467, 884, 2, 280, 425, 105,
226, 557, 661, 814, 881, 477, 370, 872, 659,
927],
[50, 371, 90, 503, 987, 116, 255, 374, 300, 948,
323, 898, 296, 361, 455, 546, 622, 633, 987,
34],
[579, 674, 687, 200, 919, 843, 315, 736, 450,
74, 420, 214, 736, 519, 696, 801, 571, 265, 46,
237],
[563, 899, 518, 645, 484, 597, 183, 589, 888,
826, 717, 73, 576, 799, 888, 231, 304, 510,
167, 831],
[724, 228, 499, 474, 241, 346, 119, 150, 200,
443, 641, 64, 147, 137, 161, 378, 536, 46, 176,
711],
[516, 527, 767, 644, 171, 340, 400, 775, 654,
690, 324, 130, 873, 579, 34, 550, 42, 834, 905,
174],
[26, 59, 337, 14, 944, 322, 490, 974, 40, 995,
912, 636, 919, 123, 190, 482, 123, 182, 178,
289],
[730, 222, 970, 185, 610, 987, 177, 447, 885,
117, 172, 22, 795, 119, 487, 673, 245, 819,
515, 318],
[962, 540, 368, 132, 532, 594, 446, 193, 252,
326, 872, 981, 622, 416, 624, 320, 71, 891, 65,
983],
[566, 302, 822, 651, 557, 542, 962, 668, 813,
564, 474, 351, 757, 454, 748, 63, 925, 612,
389, 297],
[946, 119, 214, 810, 762, 218, 502, 3, 429, 607,
197, 465, 126, 778, 887, 847, 487, 519, 304,
84],
[442, 477, 56, 239, 116, 18, 277, 482, 595, 442,
203, 989, 474, 240, 792, 795, 57, 710, 537,
814],
[53, 528, 760, 968, 553, 920, 449, 642, 913,
164, 142, 430, 374, 756, 484, 778, 935, 732,
652, 532],
[372, 903, 178, 880, 456, 257, 221, 977, 746,
807, 729, 207, 281, 9, 208, 994, 701, 260, 811,
925],
[377, 548, 971, 375, 954, 496, 764, 731, 346,
439, 38, 33, 65, 533, 830, 448, 465, 934, 44,
687],
[213, 763, 43, 223, 196, 717, 119, 184, 247,
740, 909, 305, 646, 450, 666, 173, 25, 546,
108, 783]]),
[772, 352, 920, 451, 295, 883, 38, 33, 562, 598, 383,
190, 999, 918, 657, 173, 310, 243, 749, 460, 962, 610,
473, 927, 34, 237, 831, 711, 174, 289, 318, 983, 297,
84, 814, 532, 925, 687, 783, 108, 546, 25, 173, 666,
450, 646, 305, 909, 740, 247, 184, 119, 717, 196, 223,
43, 763, 213, 377, 372, 53, 442, 946, 566, 962, 730,
26, 516, 724, 563, 579, 50, 648, 799, 575, 868, 561,
653, 879, 805, 379, 61, 961, 64, 493, 854, 923, 284,
452, 702, 792, 656, 695, 771, 373, 50, 659, 987, 46,
167, 176, 905, 178, 515, 65, 389, 304, 537, 652, 811,
44, 934, 465, 448, 830, 533, 65, 33, 38, 439, 346,
731, 764, 496, 954, 375, 971, 548, 903, 528, 477, 119,
302, 540, 222, 59, 527, 228, 899, 674, 371, 224, 80,
398, 964, 954, 690, 209, 562, 164, 793, 976, 475, 330,
814, 655, 710, 811, 570, 20, 798, 872, 633, 265, 510,
46, 834, 182, 819, 891, 612, 519, 710, 732, 260, 701,
994, 208, 9, 281, 207, 729, 807, 746, 977, 221, 257,
456, 880, 178, 760, 56, 214, 822, 368, 970, 337, 767,
499, 518, 687, 90, 554, 212, 607, 883, 605, 697, 849,
982, 661, 68, 1000, 250, 950, 796, 122, 601, 370, 622,
571, 304, 536, 42, 123, 245, 71, 925, 487, 57, 935,
778, 484, 756, 374, 430, 142, 164, 913, 642, 449, 920,
553, 968, 239, 810, 651, 132, 185, 14, 644, 474, 645,
200, 503, 600, 467, 884, 2, 280, 425, 105, 226, 557,
661, 814, 881, 477, 546, 801, 231, 378, 550, 482, 673,
320, 63, 847, 795, 792, 240, 474, 989, 203, 442, 595,
482, 277, 18, 116, 762, 557, 532, 610, 944, 171, 241,
484, 919, 987, 116, 255, 374, 300, 948, 323, 898, 296,
361, 455, 696, 888, 161, 34, 190, 487, 624, 748, 887,
778, 126, 465, 197, 607, 429, 3, 502, 218, 542, 594,
987, 322, 340, 346, 597, 843, 315, 736, 450, 74, 420,
214, 736, 519, 799, 137, 579, 123, 119, 416, 454, 757,
351, 474, 564, 813, 668, 962, 446, 177, 490, 400, 119,
183, 589, 888, 826, 717, 73, 576, 147, 873, 919, 795,
622, 981, 872, 326, 252, 193, 447, 974, 775, 150, 200,
443, 641, 64, 130, 636, 22, 172, 117, 885, 40, 654,
690, 324, 912, 995])
def test_snail_051(self):
self.assertEqual(snail([[697, 690, 45, 97, 974, 564, 828, 482, 459, 457,
247, 709, 849, 755, 636, 252, 174],
[878, 182, 418, 18, 296, 541, 463, 226, 390,
399, 86, 57, 352, 505, 880, 822, 596],
[312, 932, 870, 982, 37, 485, 327, 970, 614,
352, 485, 832, 443, 243, 116, 468, 437],
[283, 947, 1000, 474, 878, 672, 130, 269, 601,
862, 608, 896, 683, 65, 5, 7, 854],
[103, 886, 322, 406, 644, 252, 162, 590, 859,
997, 222, 316, 188, 581, 796, 969, 58],
[229, 54, 972, 517, 133, 800, 959, 577, 62, 954,
234, 40, 491, 22, 580, 862, 428],
[853, 197, 664, 207, 581, 868, 982, 935, 2, 818,
51, 950, 425, 673, 513, 507, 992],
[917, 788, 132, 184, 895, 383, 592, 175, 810,
711, 802, 86, 43, 192, 598, 515, 822],
[59, 393, 360, 66, 673, 904, 665, 258, 264, 39,
667, 780, 679, 563, 100, 30, 272],
[150, 367, 289, 44, 24, 249, 470, 487, 212, 802,
989, 338, 650, 813, 518, 64, 465],
[523, 744, 969, 535, 138, 123, 784, 424, 16,
638, 518, 692, 26, 253, 134, 334, 279],
[563, 345, 64, 97, 67, 966, 282, 163, 530, 69,
821, 159, 70, 657, 766, 312, 667],
[102, 543, 515, 548, 410, 417, 570, 834, 78,
297, 961, 164, 375, 429, 318, 636, 506],
[358, 824, 326, 229, 271, 557, 286, 19, 74, 375,
713, 292, 984, 730, 734, 281, 275],
[9, 812, 979, 24, 319, 707, 337, 99, 454, 499,
124, 291, 400, 809, 566, 290, 151],
[815, 554, 264, 774, 823, 520, 185, 11, 860,
938, 566, 15, 367, 729, 540, 623, 14],
[13, 808, 108, 848, 278, 568, 551, 248, 3, 814,
211, 204, 808, 452, 564, 477, 744]]),
[697, 690, 45, 97, 974, 564, 828, 482, 459, 457, 247,
709, 849, 755, 636, 252, 174, 596, 437, 854, 58, 428,
992, 822, 272, 465, 279, 667, 506, 275, 151, 14, 744,
477, 564, 452, 808, 204, 211, 814, 3, 248, 551, 568,
278, 848, 108, 808, 13, 815, 9, 358, 102, 563, 523,
150, 59, 917, 853, 229, 103, 283, 312, 878, 182, 418,
18, 296, 541, 463, 226, 390, 399, 86, 57, 352, 505,
880, 822, 468, 7, 969, 862, 507, 515, 30, 64, 334,
312, 636, 281, 290, 623, 540, 729, 367, 15, 566, 938,
860, 11, 185, 520, 823, 774, 264, 554, 812, 824, 543,
345, 744, 367, 393, 788, 197, 54, 886, 947, 932, 870,
982, 37, 485, 327, 970, 614, 352, 485, 832, 443, 243,
116, 5, 796, 580, 513, 598, 100, 518, 134, 766, 318,
734, 566, 809, 400, 291, 124, 499, 454, 99, 337, 707,
319, 24, 979, 326, 515, 64, 969, 289, 360, 132, 664,
972, 322, 1000, 474, 878, 672, 130, 269, 601, 862,
608, 896, 683, 65, 581, 22, 673, 192, 563, 813, 253,
657, 429, 730, 984, 292, 713, 375, 74, 19, 286, 557,
271, 229, 548, 97, 535, 44, 66, 184, 207, 517, 406,
644, 252, 162, 590, 859, 997, 222, 316, 188, 491, 425,
43, 679, 650, 26, 70, 375, 164, 961, 297, 78, 834,
570, 417, 410, 67, 138, 24, 673, 895, 581, 133, 800,
959, 577, 62, 954, 234, 40, 950, 86, 780, 338, 692,
159, 821, 69, 530, 163, 282, 966, 123, 249, 904, 383,
868, 982, 935, 2, 818, 51, 802, 667, 989, 518, 638,
16, 424, 784, 470, 665, 592, 175, 810, 711, 39, 802,
212, 487, 258, 264])
def test_snail_052(self):
self.assertEqual(snail(
[[20, 403, 806, 88, 823], [815, 182, 755, 134, 479],
[267, 452, 774, 27, 393], [680, 645, 139, 170, 600],
[345, 733, 858, 567, 786]]),
[20, 403, 806, 88, 823, 479, 393, 600, 786, 567, 858,
733, 345, 680, 267, 815, 182, 755, 134, 27, 170, 139,
645, 452, 774])
def test_snail_053(self):
self.assertEqual(snail([[196, 838, 193, 215, 121, 793, 196, 949, 361,
294, 910, 341, 538, 137, 777],
[733, 398, 687, 983, 435, 870, 229, 107, 407,
772, 68, 915, 209, 859, 737],
[212, 594, 822, 823, 492, 867, 788, 511, 744,
679, 68, 763, 663, 708, 835],
[207, 592, 305, 579, 378, 864, 922, 874, 424,
364, 237, 930, 250, 343, 516],
[817, 144, 317, 932, 246, 346, 160, 676, 51,
860, 889, 532, 902, 60, 300],
[132, 26, 383, 247, 812, 338, 673, 679, 88, 254,
502, 553, 165, 334, 186],
[59, 683, 976, 614, 311, 493, 17, 433, 171, 254,
478, 430, 6, 238, 216],
[70, 590, 861, 521, 494, 163, 91, 792, 848, 892,
525, 313, 845, 455, 222],
[471, 326, 678, 405, 72, 724, 69, 630, 206, 767,
730, 223, 860, 290, 477],
[848, 786, 184, 788, 614, 38, 213, 908, 258,
752, 927, 756, 780, 835, 260],
[240, 604, 469, 663, 791, 671, 405, 848, 731,
335, 905, 129, 239, 679, 516],
[28, 935, 400, 783, 206, 777, 836, 627, 32, 475,
736, 206, 469, 495, 543],
[271, 429, 63, 55, 402, 237, 622, 711, 443, 603,
307, 107, 892, 627, 360],
[265, 323, 177, 700, 4, 43, 396, 551, 646, 392,
735, 686, 784, 445, 603],
[807, 589, 84, 393, 478, 843, 317, 717, 678,
341, 257, 31, 498, 454, 260]]),
[196, 838, 193, 215, 121, 793, 196, 949, 361, 294, 910,
341, 538, 137, 777, 737, 835, 516, 300, 186, 216, 222,
477, 260, 516, 543, 360, 603, 260, 454, 498, 31, 257,
341, 678, 717, 317, 843, 478, 393, 84, 589, 807, 265,
271, 28, 240, 848, 471, 70, 59, 132, 817, 207, 212,
733, 398, 687, 983, 435, 870, 229, 107, 407, 772, 68,
915, 209, 859, 708, 343, 60, 334, 238, 455, 290, 835,
679, 495, 627, 445, 784, 686, 735, 392, 646, 551, 396,
43, 4, 700, 177, 323, 429, 935, 604, 786, 326, 590,
683, 26, 144, 592, 594, 822, 823, 492, 867, 788, 511,
744, 679, 68, 763, 663, 250, 902, 165, 6, 845, 860,
780, 239, 469, 892, 107, 307, 603, 443, 711, 622, 237,
402, 55, 63, 400, 469, 184, 678, 861, 976, 383, 317,
305, 579, 378, 864, 922, 874, 424, 364, 237, 930, 532,
553, 430, 313, 223, 756, 129, 206, 736, 475, 32, 627,
836, 777, 206, 783, 663, 788, 405, 521, 614, 247, 932,
246, 346, 160, 676, 51, 860, 889, 502, 478, 525, 730,
927, 905, 335, 731, 848, 405, 671, 791, 614, 72, 494,
311, 812, 338, 673, 679, 88, 254, 254, 892, 767, 752,
258, 908, 213, 38, 724, 163, 493, 17, 433, 171, 848,
206, 630, 69, 91, 792])
def test_snail_054(self):
self.assertEqual(snail(
[[680, 28, 574, 89, 186, 359], [110, 422, 21, 950, 715, 79],
[344, 688, 686, 338, 239, 840], [320, 321, 492, 418, 905, 628],
[684, 383, 704, 429, 457, 932],
[977, 861, 351, 408, 652, 42]]),
[680, 28, 574, 89, 186, 359, 79, 840, 628, 932, 42,
652, 408, 351, 861, 977, 684, 320, 344, 110, 422, 21,
950, 715, 239, 905, 457, 429, 704, 383, 321, 688, 686,
338, 418, 492])
def test_snail_055(self):
self.assertEqual(snail([[58, 407, 6, 598, 246, 664, 722, 382, 779, 444,
939, 572, 998, 857, 973, 783, 332, 192],
[664, 600, 824, 153, 433, 187, 978, 637, 740,
427, 135, 816, 393, 522, 351, 940, 896, 65],
[126, 399, 993, 472, 941, 3, 717, 884, 803, 688,
203, 219, 414, 589, 972, 999, 730, 672],
[43, 467, 608, 228, 380, 252, 318, 177, 251,
657, 281, 509, 714, 14, 49, 909, 934, 672],
[718, 635, 676, 235, 349, 435, 914, 136, 476,
562, 653, 497, 338, 58, 63, 716, 187, 48],
[530, 480, 937, 218, 277, 678, 434, 266, 334,
95, 270, 449, 631, 192, 309, 389, 564, 924],
[279, 697, 22, 866, 170, 218, 584, 387, 992,
727, 188, 755, 564, 367, 27, 250, 250, 999],
[561, 200, 392, 765, 31, 517, 431, 463, 28, 376,
49, 428, 336, 994, 311, 814, 27, 288],
[928, 846, 706, 704, 835, 565, 752, 294, 404,
519, 269, 311, 38, 914, 216, 74, 364, 83],
[415, 30, 240, 897, 143, 567, 250, 27, 872, 101,
345, 1000, 12, 47, 485, 188, 675, 861],
[837, 586, 441, 706, 658, 312, 12, 823, 414,
485, 975, 621, 788, 912, 923, 260, 611, 863],
[299, 973, 177, 461, 147, 265, 732, 9, 521, 211,
73, 300, 919, 316, 839, 956, 164, 950],
[289, 604, 206, 623, 94, 84, 544, 200, 955, 230,
186, 194, 852, 47, 586, 687, 559, 809],
[139, 266, 610, 674, 20, 856, 866, 721, 224, 61,
754, 599, 97, 827, 934, 724, 207, 281],
[59, 42, 40, 155, 346, 392, 602, 768, 428, 104,
285, 74, 913, 885, 258, 79, 366, 114],
[205, 16, 543, 155, 384, 415, 64, 375, 841, 387,
922, 909, 489, 846, 666, 378, 933, 908],
[389, 178, 394, 265, 728, 108, 599, 398, 569,
480, 159, 635, 255, 421, 260, 230, 855, 267],
[767, 767, 591, 319, 141, 136, 915, 262, 723,
932, 887, 891, 417, 101, 415, 178, 369, 179]]),
[58, 407, 6, 598, 246, 664, 722, 382, 779, 444, 939,
572, 998, 857, 973, 783, 332, 192, 65, 672, 672, 48,
924, 999, 288, 83, 861, 863, 950, 809, 281, 114, 908,
267, 179, 369, 178, 415, 101, 417, 891, 887, 932, 723,
262, 915, 136, 141, 319, 591, 767, 767, 389, 205, 59,
139, 289, 299, 837, 415, 928, 561, 279, 530, 718, 43,
126, 664, 600, 824, 153, 433, 187, 978, 637, 740, 427,
135, 816, 393, 522, 351, 940, 896, 730, 934, 187, 564,
250, 27, 364, 675, 611, 164, 559, 207, 366, 933, 855,
230, 260, 421, 255, 635, 159, 480, 569, 398, 599, 108,
728, 265, 394, 178, 16, 42, 266, 604, 973, 586, 30,
846, 200, 697, 480, 635, 467, 399, 993, 472, 941, 3,
717, 884, 803, 688, 203, 219, 414, 589, 972, 999, 909,
716, 389, 250, 814, 74, 188, 260, 956, 687, 724, 79,
378, 666, 846, 489, 909, 922, 387, 841, 375, 64, 415,
384, 155, 543, 40, 610, 206, 177, 441, 240, 706, 392,
22, 937, 676, 608, 228, 380, 252, 318, 177, 251, 657,
281, 509, 714, 14, 49, 63, 309, 27, 311, 216, 485,
923, 839, 586, 934, 258, 885, 913, 74, 285, 104, 428,
768, 602, 392, 346, 155, 674, 623, 461, 706, 897, 704,
765, 866, 218, 235, 349, 435, 914, 136, 476, 562, 653,
497, 338, 58, 192, 367, 994, 914, 47, 912, 316, 47,
827, 97, 599, 754, 61, 224, 721, 866, 856, 20, 94,
147, 658, 143, 835, 31, 170, 277, 678, 434, 266, 334,
95, 270, 449, 631, 564, 336, 38, 12, 788, 919, 852,
194, 186, 230, 955, 200, 544, 84, 265, 312, 567, 565,
517, 218, 584, 387, 992, 727, 188, 755, 428, 311,
1000, 621, 300, 73, 211, 521, 9, 732, 12, 250, 752,
431, 463, 28, 376, 49, 269, 345, 975, 485, 414, 823,
27, 294, 404, 519, 101, 872])
def test_snail_056(self):
self.assertEqual(snail([[990, 568, 232, 648, 150, 961, 543, 323, 970,
480, 247, 655, 234, 766],
[445, 283, 695, 616, 307, 693, 516, 267, 772,
614, 375, 354, 874, 139],
[56, 886, 202, 95, 850, 689, 279, 633, 473, 300,
210, 950, 264, 392],
[656, 90, 399, 263, 200, 764, 793, 125, 644,
341, 1, 41, 315, 577],
[703, 868, 597, 797, 445, 159, 899, 961, 421,
400, 865, 37, 475, 501],
[554, 14, 369, 351, 506, 615, 921, 242, 972,
625, 402, 906, 693, 251],
[727, 518, 523, 314, 40, 458, 338, 814, 508,
135, 515, 151, 288, 433],
[456, 696, 183, 605, 963, 882, 243, 721, 924,
276, 244, 341, 592, 746],
[275, 799, 613, 400, 259, 241, 12, 991, 844, 51,
532, 893, 933, 357],
[649, 500, 240, 430, 276, 488, 583, 197, 11,
646, 285, 552, 812, 520],
[654, 829, 189, 560, 146, 26, 397, 206, 605, 64,
132, 791, 264, 469],
[823, 419, 690, 389, 997, 854, 416, 97, 267,
499, 383, 250, 856, 510],
[863, 725, 195, 653, 568, 668, 761, 598, 379,
810, 674, 535, 350, 215],
[880, 492, 584, 822, 260, 81, 726, 737, 166,
379, 347, 66, 990, 381]]),
[990, 568, 232, 648, 150, 961, 543, 323, 970, 480, 247,
655, 234, 766, 139, 392, 577, 501, 251, 433, 746, 357,
520, 469, 510, 215, 381, 990, 66, 347, 379, 166, 737,
726, 81, 260, 822, 584, 492, 880, 863, 823, 654, 649,
275, 456, 727, 554, 703, 656, 56, 445, 283, 695, 616,
307, 693, 516, 267, 772, 614, 375, 354, 874, 264, 315,
475, 693, 288, 592, 933, 812, 264, 856, 350, 535, 674,
810, 379, 598, 761, 668, 568, 653, 195, 725, 419, 829,
500, 799, 696, 518, 14, 868, 90, 886, 202, 95, 850,
689, 279, 633, 473, 300, 210, 950, 41, 37, 906, 151,
341, 893, 552, 791, 250, 383, 499, 267, 97, 416, 854,
997, 389, 690, 189, 240, 613, 183, 523, 369, 597, 399,
263, 200, 764, 793, 125, 644, 341, 1, 865, 402, 515,
244, 532, 285, 132, 64, 605, 206, 397, 26, 146, 560,
430, 400, 605, 314, 351, 797, 445, 159, 899, 961, 421,
400, 625, 135, 276, 51, 646, 11, 197, 583, 488, 276,
259, 963, 40, 506, 615, 921, 242, 972, 508, 924, 844,
991, 12, 241, 882, 458, 338, 814, 721, 243])
def test_snail_057(self):
self.assertEqual(snail([[40, 406, 36, 505, 634, 102, 702, 130],
[441, 809, 470, 914, 796, 852, 306, 978],
[919, 501, 158, 558, 536, 141, 229, 678],
[841, 688, 115, 374, 638, 735, 687, 358],
[432, 204, 983, 343, 5, 717, 999, 912],
[380, 253, 737, 263, 790, 515, 817, 270],
[298, 335, 347, 644, 356, 931, 594, 954],
[977, 832, 618, 875, 547, 995, 47, 183]]),
[40, 406, 36, 505, 634, 102, 702, 130, 978, 678, 358,
912, 270, 954, 183, 47, 995, 547, 875, 618, 832, 977,
298, 380, 432, 841, 919, 441, 809, 470, 914, 796, 852,
306, 229, 687, 999, 817, 594, 931, 356, 644, 347, 335,
253, 204, 688, 501, 158, 558, 536, 141, 735, 717, 515,
790, 263, 737, 983, 115, 374, 638, 5, 343])
def test_snail_058(self):
self.assertEqual(
snail([[935, 756, 641], [827, 444, 751], [166, 61, 775]]),
[935, 756, 641, 751, 775, 61, 166, 827, 444])
def test_snail_059(self):
self.assertEqual(snail([[21, 182], [507, 380]]), [21, 182, 380, 507])
def test_snail_060(self):
self.assertEqual(snail(
[[535, 230, 195, 719, 377], [95, 348, 60, 911, 645],
[654, 459, 570, 244, 205], [728, 622, 509, 484, 25],
[253, 883, 275, 80, 276]]),
[535, 230, 195, 719, 377, 645, 205, 25, 276, 80, 275,
883, 253, 728, 654, 95, 348, 60, 911, 244, 484, 509,
622, 459, 570])
def test_snail_061(self):
self.assertEqual(snail([[785, 961, 393, 614, 388, 455, 610, 908, 516,
364, 872, 655, 842, 764, 246],
[747, 313, 906, 923, 915, 201, 951, 533, 862,
575, 735, 729, 14, 730, 25],
[170, 790, 377, 815, 635, 93, 45, 31, 555, 762,
119, 935, 885, 180, 891],
[806, 414, 178, 167, 636, 597, 562, 768, 302,
74, 481, 549, 962, 118, 40],
[742, 767, 826, 738, 501, 914, 693, 644, 409,
81, 185, 361, 197, 649, 124],
[232, 878, 30, 498, 260, 724, 650, 544, 388,
384, 2, 159, 714, 198, 532],
[375, 157, 579, 641, 683, 263, 576, 500, 177,
402, 659, 489, 438, 839, 314],
[834, 355, 434, 66, 333, 91, 207, 2, 651, 340,
505, 175, 443, 446, 740],
[688, 517, 275, 811, 515, 461, 833, 811, 849,
406, 79, 631, 431, 108, 122],
[252, 712, 973, 15, 536, 36, 55, 901, 503, 701,
520, 690, 918, 759, 217],
[350, 784, 946, 63, 801, 911, 233, 411, 116,
355, 973, 352, 784, 50, 352],
[242, 23, 728, 771, 881, 975, 565, 498, 405,
694, 441, 621, 741, 586, 48],
[551, 928, 529, 150, 280, 388, 741, 717, 699,
211, 677, 512, 900, 416, 689],
[404, 225, 869, 308, 827, 93, 424, 276, 775,
180, 569, 51, 710, 847, 792],
[771, 527, 737, 805, 705, 766, 900, 757, 994,
640, 335, 733, 588, 921, 265]]),
[785, 961, 393, 614, 388, 455, 610, 908, 516, 364, 872,
655, 842, 764, 246, 25, 891, 40, 124, 532, 314, 740,
122, 217, 352, 48, 689, 792, 265, 921, 588, 733, 335,
640, 994, 757, 900, 766, 705, 805, 737, 527, 771, 404,
551, 242, 350, 252, 688, 834, 375, 232, 742, 806, 170,
747, 313, 906, 923, 915, 201, 951, 533, 862, 575, 735,
729, 14, 730, 180, 118, 649, 198, 839, 446, 108, 759,
50, 586, 416, 847, 710, 51, 569, 180, 775, 276, 424,
93, 827, 308, 869, 225, 928, 23, 784, 712, 517, 355,
157, 878, 767, 414, 790, 377, 815, 635, 93, 45, 31,
555, 762, 119, 935, 885, 962, 197, 714, 438, 443, 431,
918, 784, 741, 900, 512, 677, 211, 699, 717, 741, 388,
280, 150, 529, 728, 946, 973, 275, 434, 579, 30, 826,
178, 167, 636, 597, 562, 768, 302, 74, 481, 549, 361,
159, 489, 175, 631, 690, 352, 621, 441, 694, 405, 498,
565, 975, 881, 771, 63, 15, 811, 66, 641, 498, 738,
501, 914, 693, 644, 409, 81, 185, 2, 659, 505, 79,
520, 973, 355, 116, 411, 233, 911, 801, 536, 515, 333,
683, 260, 724, 650, 544, 388, 384, 402, 340, 406, 701,
503, 901, 55, 36, 461, 91, 263, 576, 500, 177, 651,
849, 811, 833, 207, 2])
def test_snail_062(self):
self.assertEqual(snail([[353, 85, 930, 216], [626, 576, 495, 991],
[581, 192, 891, 709], [350, 925, 349, 502]]),
[353, 85, 930, 216, 991, 709, 502, 349, 925, 350, 581,
626, 576, 495, 891, 192])
def test_snail_063(self):
self.assertEqual(snail([[540]]), [540])
def test_snail_064(self):
self.assertEqual(snail(
[[323, 110, 157, 740, 114, 704, 774, 106, 268, 508, 566, 474],
[399, 944, 938, 434, 715, 475, 929, 705, 940, 246, 787, 528],
[807, 311, 393, 557, 372, 756, 260, 12, 811, 4, 368, 282],
[618, 918, 279, 23, 755, 16, 141, 214, 837, 333, 916, 937],
[353, 304, 904, 659, 345, 217, 882, 563, 845, 34, 318, 763],
[420, 645, 620, 910, 271, 243, 705, 909, 841, 907, 954, 745],
[114, 445, 310, 574, 25, 779, 262, 381, 319, 231, 460, 811],
[768, 163, 698, 307, 647, 712, 617, 700, 549, 215, 645, 839],
[779, 475, 357, 508, 819, 672, 250, 228, 602, 747, 734, 598],
[217, 834, 271, 442, 745, 526, 141, 571, 331, 715, 937, 24],
[159, 231, 655, 435, 450, 532, 913, 91, 527, 105, 40, 294],
[654, 903, 196, 676, 451, 502, 602, 539, 429, 795, 646, 117]]),
[323, 110, 157, 740, 114, 704, 774, 106, 268, 508, 566,
474, 528, 282, 937, 763, 745, 811, 839, 598, 24, 294,
117, 646, 795, 429, 539, 602, 502, 451, 676, 196, 903,
654, 159, 217, 779, 768, 114, 420, 353, 618, 807, 399,
944, 938, 434, 715, 475, 929, 705, 940, 246, 787, 368,
916, 318, 954, 460, 645, 734, 937, 40, 105, 527, 91,
913, 532, 450, 435, 655, 231, 834, 475, 163, 445, 645,
304, 918, 311, 393, 557, 372, 756, 260, 12, 811, 4,
333, 34, 907, 231, 215, 747, 715, 331, 571, 141, 526,
745, 442, 271, 357, 698, 310, 620, 904, 279, 23, 755,
16, 141, 214, 837, 845, 841, 319, 549, 602, 228, 250,
672, 819, 508, 307, 574, 910, 659, 345, 217, 882, 563,
909, 381, 700, 617, 712, 647, 25, 271, 243, 705, 262,
779])
def test_snail_065(self):
self.assertEqual(snail([[986, 240, 922, 622, 119, 802, 582, 105, 664,
791, 735, 699, 470, 252, 698, 185, 108, 345,
492, 923],
[240, 476, 677, 30, 653, 350, 500, 837, 871,
723, 277, 232, 913, 969, 363, 209, 806, 50,
395, 85],
[685, 728, 491, 175, 714, 445, 721, 940, 935,
357, 321, 462, 884, 97, 210, 183, 804, 892,
424, 518],
[43, 751, 907, 556, 279, 812, 613, 69, 915, 20,
19, 446, 737, 739, 400, 713, 203, 94, 294,
335],
[48, 183, 597, 479, 293, 803, 657, 501, 358,
165, 14, 999, 153, 35, 638, 561, 25, 565, 891,
543],
[918, 781, 555, 285, 954, 969, 636, 883, 200,
883, 426, 521, 528, 495, 964, 773, 799, 545,
116, 512],
[279, 668, 405, 945, 213, 573, 712, 99, 713,
688, 492, 589, 177, 718, 651, 252, 843, 376,
657, 428],
[332, 282, 54, 321, 724, 679, 50, 698, 727, 252,
661, 306, 790, 269, 958, 673, 742, 806, 310,
568],
[785, 236, 107, 886, 498, 650, 569, 967, 185,
57, 448, 25, 101, 787, 194, 464, 508, 925, 944,
531],
[141, 283, 763, 387, 423, 348, 93, 286, 448, 71,
745, 231, 949, 228, 838, 717, 673, 24, 42,
634],
[861, 730, 300, 615, 603, 945, 225, 319, 418,
919, 514, 27, 884, 628, 229, 87, 193, 140, 692,
508],
[568, 394, 305, 601, 237, 948, 275, 480, 33,
277, 821, 38, 313, 236, 216, 27, 650, 972, 284,
554],
[613, 892, 806, 441, 975, 777, 615, 741, 534,
43, 203, 991, 405, 302, 447, 313, 800, 345, 54,
670],
[689, 699, 296, 498, 793, 199, 282, 489, 224,
839, 870, 409, 686, 935, 196, 2, 755, 257, 246,
712],
[328, 236, 205, 980, 365, 90, 865, 401, 528,
368, 802, 971, 48, 218, 30, 655, 308, 690, 285,
387],
[215, 929, 894, 328, 40, 718, 33, 112, 729, 609,
598, 956, 838, 252, 727, 798, 486, 797, 65,
758],
[162, 746, 960, 376, 695, 473, 664, 960, 948,
375, 354, 980, 614, 540, 300, 538, 822, 816,
117, 371],
[343, 801, 497, 285, 121, 244, 913, 709, 271,
252, 301, 557, 115, 678, 161, 389, 169, 38,
765, 240],
[815, 108, 350, 304, 736, 991, 769, 383, 399,
621, 397, 798, 382, 738, 344, 280, 479, 255,
398, 280],
[411, 702, 791, 603, 849, 743, 594, 468, 396,
752, 297, 515, 426, 426, 806, 385, 878, 815,
840, 50]]),
[986, 240, 922, 622, 119, 802, 582, 105, 664, 791, 735,
699, 470, 252, 698, 185, 108, 345, 492, 923, 85, 518,
335, 543, 512, 428, 568, 531, 634, 508, 554, 670, 712,
387, 758, 371, 240, 280, 50, 840, 815, 878, 385, 806,
426, 426, 515, 297, 752, 396, 468, 594, 743, 849, 603,
791, 702, 411, 815, 343, 162, 215, 328, 689, 613, 568,
861, 141, 785, 332, 279, 918, 48, 43, 685, 240, 476,
677, 30, 653, 350, 500, 837, 871, 723, 277, 232, 913,
969, 363, 209, 806, 50, 395, 424, 294, 891, 116, 657,
310, 944, 42, 692, 284, 54, 246, 285, 65, 117, 765,
398, 255, 479, 280, 344, 738, 382, 798, 397, 621, 399,
383, 769, 991, 736, 304, 350, 108, 801, 746, 929, 236,
699, 892, 394, 730, 283, 236, 282, 668, 781, 183, 751,
728, 491, 175, 714, 445, 721, 940, 935, 357, 321, 462,
884, 97, 210, 183, 804, 892, 94, 565, 545, 376, 806,
925, 24, 140, 972, 345, 257, 690, 797, 816, 38, 169,
389, 161, 678, 115, 557, 301, 252, 271, 709, 913, 244,
121, 285, 497, 960, 894, 205, 296, 806, 305, 300, 763,
107, 54, 405, 555, 597, 907, 556, 279, 812, 613, 69,
915, 20, 19, 446, 737, 739, 400, 713, 203, 25, 799,
843, 742, 508, 673, 193, 650, 800, 755, 308, 486, 822,
538, 300, 540, 614, 980, 354, 375, 948, 960, 664, 473,
695, 376, 328, 980, 498, 441, 601, 615, 387, 886, 321,
945, 285, 479, 293, 803, 657, 501, 358, 165, 14, 999,
153, 35, 638, 561, 773, 252, 673, 464, 717, 87, 27,
313, 2, 655, 798, 727, 252, 838, 956, 598, 609, 729,
112, 33, 718, 40, 365, 793, 975, 237, 603, 423, 498,
724, 213, 954, 969, 636, 883, 200, 883, 426, 521, 528,
495, 964, 651, 958, 194, 838, 229, 216, 447, 196, 30,
218, 48, 971, 802, 368, 528, 401, 865, 90, 199, 777,
948, 945, 348, 650, 679, 573, 712, 99, 713, 688, 492,
589, 177, 718, 269, 787, 228, 628, 236, 302, 935, 686,
409, 870, 839, 224, 489, 282, 615, 275, 225, 93, 569,
50, 698, 727, 252, 661, 306, 790, 101, 949, 884, 313,
405, 991, 203, 43, 534, 741, 480, 319, 286, 967, 185,
57, 448, 25, 231, 27, 38, 821, 277, 33, 418, 448, 71,
745, 514, 919])
def test_snail_066(self):
self.assertEqual(snail([[779, 390, 935, 443, 441, 932, 526, 627, 761,
633, 708, 770, 21, 872],
[754, 424, 961, 78, 264, 512, 496, 963, 781, 96,
127, 102, 443, 432],
[462, 403, 123, 808, 836, 958, 574, 126, 686,
524, 508, 557, 61, 901],
[6, 257, 831, 713, 790, 660, 2, 775, 268, 337,
75, 804, 357, 961],
[604, 802, 2, 87, 101, 475, 192, 722, 345, 173,
926, 171, 170, 293],
[12, 776, 242, 639, 641, 929, 898, 119, 5, 501,
358, 518, 440, 395],
[635, 821, 94, 345, 146, 460, 246, 555, 618,
331, 959, 907, 717, 521],
[669, 178, 275, 457, 549, 963, 216, 69, 228,
722, 444, 914, 58, 643],
[826, 947, 674, 252, 707, 10, 968, 492, 418,
191, 393, 595, 278, 540],
[797, 490, 818, 461, 131, 884, 421, 935, 299,
970, 715, 75, 516, 507],
[546, 784, 474, 248, 573, 366, 638, 696, 927,
892, 508, 311, 606, 632],
[846, 536, 776, 553, 586, 170, 327, 24, 828,
282, 927, 787, 202, 550],
[739, 628, 146, 910, 843, 244, 23, 430, 521,
810, 923, 467, 875, 938],
[222, 359, 852, 608, 514, 865, 674, 391, 344,
161, 69, 418, 188, 375]]),
[779, 390, 935, 443, 441, 932, 526, 627, 761, 633, 708,
770, 21, 872, 432, 901, 961, 293, 395, 521, 643, 540,
507, 632, 550, 938, 375, 188, 418, 69, 161, 344, 391,
674, 865, 514, 608, 852, 359, 222, 739, 846, 546, 797,
826, 669, 635, 12, 604, 6, 462, 754, 424, 961, 78,
264, 512, 496, 963, 781, 96, 127, 102, 443, 61, 357,
170, 440, 717, 58, 278, 516, 606, 202, 875, 467, 923,
810, 521, 430, 23, 244, 843, 910, 146, 628, 536, 784,
490, 947, 178, 821, 776, 802, 257, 403, 123, 808, 836,
958, 574, 126, 686, 524, 508, 557, 804, 171, 518, 907,
914, 595, 75, 311, 787, 927, 282, 828, 24, 327, 170,
586, 553, 776, 474, 818, 674, 275, 94, 242, 2, 831,
713, 790, 660, 2, 775, 268, 337, 75, 926, 358, 959,
444, 393, 715, 508, 892, 927, 696, 638, 366, 573, 248,
461, 252, 457, 345, 639, 87, 101, 475, 192, 722, 345,
173, 501, 331, 722, 191, 970, 299, 935, 421, 884, 131,
707, 549, 146, 641, 929, 898, 119, 5, 618, 228, 418,
492, 968, 10, 963, 460, 246, 555, 69, 216])
def test_snail_067(self):
self.assertEqual(snail(
[[771, 906, 164, 502, 151], [560, 297, 260, 485, 632],
[3, 884, 664, 507, 325], [639, 813, 354, 560, 226],
[274, 555, 978, 288, 756]]),
[771, 906, 164, 502, 151, 632, 325, 226, 756, 288, 978,
555, 274, 639, 3, 560, 297, 260, 485, 507, 560, 354,
813, 884, 664])
def test_snail_068(self):
self.assertEqual(snail(
[[254, 173, 160, 399, 691, 434], [849, 456, 758, 273, 917, 347],
[653, 544, 515, 483, 827, 638], [145, 862, 862, 170, 518, 727],
[702, 527, 461, 204, 727, 749], [478, 342, 652, 960, 6, 699]]),
[254, 173, 160, 399, 691, 434, 347, 638, 727, 749, 699,
6, 960, 652, 342, 478, 702, 145, 653, 849, 456, 758,
273, 917, 827, 518, 727, 204, 461, 527, 862, 544, 515,
483, 170, 862])
def test_snail_069(self):
self.assertEqual(snail(
[[226, 704, 457, 816, 131, 280], [360, 476, 612, 26, 934, 390],
[456, 641, 669, 251, 211, 954], [152, 516, 380, 865, 617, 824],
[887, 422, 509, 185, 322, 688],
[593, 21, 364, 475, 965, 533]]),
[226, 704, 457, 816, 131, 280, 390, 954, 824, 688, 533,
965, 475, 364, 21, 593, 887, 152, 456, 360, 476, 612,
26, 934, 211, 617, 322, 185, 509, 422, 516, 641, 669,
251, 865, 380])
def test_snail_070(self):
self.assertEqual(snail([[721, 438], [320, 489]]), [721, 438, 489, 320])
def test_snail_071(self):
self.assertEqual(snail(
[[27, 894, 555, 256, 430, 208], [554, 476, 381, 291, 303, 274],
[129, 801, 899, 605, 365, 252], [764, 675, 459, 554, 426, 85],
[816, 231, 149, 674, 303, 499],
[305, 116, 340, 865, 168, 954]]),
[27, 894, 555, 256, 430, 208, 274, 252, 85, 499, 954,
168, 865, 340, 116, 305, 816, 764, 129, 554, 476, 381,
291, 303, 365, 426, 303, 674, 149, 231, 675, 801, 899,
605, 554, 459])
def test_snail_072(self):
self.assertEqual(snail([[572, 40, 328, 370, 500, 359, 678, 378, 538,
858, 934, 597, 558, 719, 33, 895, 744, 664,
144, 942],
[866, 855, 310, 833, 63, 797, 898, 803, 651,
882, 732, 735, 675, 3, 262, 223, 173, 342, 85,
611],
[899, 287, 100, 560, 479, 542, 148, 688, 447,
575, 738, 640, 312, 25, 231, 757, 683, 260,
858, 346],
[1000, 625, 581, 457, 792, 537, 711, 735, 189,
665, 68, 774, 132, 208, 510, 10, 797, 727, 525,
799],
[465, 650, 818, 258, 110, 531, 816, 811, 259,
429, 56, 497, 701, 350, 938, 112, 318, 260, 88,
597],
[505, 112, 776, 421, 332, 521, 824, 55, 871,
114, 715, 725, 882, 579, 481, 425, 59, 382,
959, 807],
[258, 37, 320, 581, 567, 950, 77, 948, 540, 28,
560, 911, 307, 508, 163, 679, 687, 37, 246,
838],
[782, 59, 179, 588, 996, 675, 37, 425, 607, 688,
629, 34, 975, 885, 188, 852, 343, 841, 952,
103],
[432, 454, 425, 198, 425, 305, 909, 997, 263,
813, 666, 922, 619, 942, 262, 386, 730, 197,
664, 643],
[536, 668, 164, 476, 477, 667, 875, 990, 655,
985, 824, 684, 263, 111, 82, 828, 657, 131,
819, 210],
[943, 974, 501, 727, 825, 510, 913, 133, 947,
301, 117, 283, 952, 643, 787, 24, 345, 104,
323, 525],
[461, 589, 200, 794, 521, 39, 167, 52, 836, 477,
437, 507, 264, 717, 663, 347, 623, 669, 262,
34],
[370, 556, 920, 122, 82, 952, 628, 124, 245, 87,
213, 238, 792, 388, 47, 531, 918, 634, 368,
312],
[635, 472, 7, 883, 622, 910, 757, 959, 318, 933,
887, 877, 242, 418, 571, 610, 671, 745, 303,
14],
[128, 96, 532, 485, 66, 665, 373, 829, 848, 850,
124, 732, 618, 724, 34, 686, 851, 832, 407,
75],
[38, 836, 222, 635, 388, 936, 793, 187, 803,
227, 561, 481, 635, 9, 437, 922, 86, 272, 439,
452],
[303, 667, 784, 818, 908, 142, 768, 342, 350,
959, 210, 494, 592, 918, 494, 108, 795, 617,
169, 142],
[344, 618, 79, 320, 667, 726, 960, 900, 525,
776, 549, 292, 938, 390, 975, 423, 555, 963,
965, 440],
[220, 497, 705, 449, 161, 225, 73, 164, 796,
438, 978, 623, 304, 917, 584, 118, 700, 222,
476, 825],
[896, 392, 14, 489, 226, 742, 932, 303, 767,
487, 859, 637, 327, 399, 804, 304, 922, 119,
687, 755]]),
[572, 40, 328, 370, 500, 359, 678, 378, 538, 858, 934,
597, 558, 719, 33, 895, 744, 664, 144, 942, 611, 346,
799, 597, 807, 838, 103, 643, 210, 525, 34, 312, 14,
75, 452, 142, 440, 825, 755, 687, 119, 922, 304, 804,
399, 327, 637, 859, 487, 767, 303, 932, 742, 226, 489,
14, 392, 896, 220, 344, 303, 38, 128, 635, 370, 461,
943, 536, 432, 782, 258, 505, 465, 1000, 899, 866,
855, 310, 833, 63, 797, 898, 803, 651, 882, 732, 735,
675, 3, 262, 223, 173, 342, 85, 858, 525, 88, 959,
246, 952, 664, 819, 323, 262, 368, 303, 407, 439, 169,
965, 476, 222, 700, 118, 584, 917, 304, 623, 978, 438,
796, 164, 73, 225, 161, 449, 705, 497, 618, 667, 836,
96, 472, 556, 589, 974, 668, 454, 59, 37, 112, 650,
625, 287, 100, 560, 479, 542, 148, 688, 447, 575, 738,
640, 312, 25, 231, 757, 683, 260, 727, 260, 382, 37,
841, 197, 131, 104, 669, 634, 745, 832, 272, 617, 963,
555, 423, 975, 390, 938, 292, 549, 776, 525, 900, 960,
726, 667, 320, 79, 784, 222, 532, 7, 920, 200, 501,
164, 425, 179, 320, 776, 818, 581, 457, 792, 537, 711,
735, 189, 665, 68, 774, 132, 208, 510, 10, 797, 318,
59, 687, 343, 730, 657, 345, 623, 918, 671, 851, 86,
795, 108, 494, 918, 592, 494, 210, 959, 350, 342, 768,
142, 908, 818, 635, 485, 883, 122, 794, 727, 476, 198,
588, 581, 421, 258, 110, 531, 816, 811, 259, 429, 56,
497, 701, 350, 938, 112, 425, 679, 852, 386, 828, 24,
347, 531, 610, 686, 922, 437, 9, 635, 481, 561, 227,
803, 187, 793, 936, 388, 66, 622, 82, 521, 825, 477,
425, 996, 567, 332, 521, 824, 55, 871, 114, 715, 725,
882, 579, 481, 163, 188, 262, 82, 787, 663, 47, 571,
34, 724, 618, 732, 124, 850, 848, 829, 373, 665, 910,
952, 39, 510, 667, 305, 675, 950, 77, 948, 540, 28,
560, 911, 307, 508, 885, 942, 111, 643, 717, 388, 418,
242, 877, 887, 933, 318, 959, 757, 628, 167, 913, 875,
909, 37, 425, 607, 688, 629, 34, 975, 619, 263, 952,
264, 792, 238, 213, 87, 245, 124, 52, 133, 990, 997,
263, 813, 666, 922, 684, 283, 507, 437, 477, 836, 947,
655, 985, 824, 117, 301])
def test_snail_073(self):
self.assertEqual(snail([[785, 373, 215, 440], [948, 869, 882, 65],
[236, 227, 508, 450], [46, 69, 45, 237]]),
[785, 373, 215, 440, 65, 450, 237, 45, 69, 46, 236,
948, 869, 882, 508, 227])
def test_snail_074(self):
self.assertEqual(snail([[319, 115, 440, 26, 579, 418, 402, 165, 517,
784, 878, 694, 93, 128, 44],
[852, 607, 878, 871, 517, 532, 992, 374, 11, 98,
518, 711, 147, 227, 506],
[201, 469, 258, 872, 604, 990, 830, 450, 143,
19, 552, 694, 210, 758, 103],
[716, 320, 227, 464, 249, 476, 868, 589, 739,
445, 2, 718, 961, 95, 220],
[928, 536, 957, 213, 258, 403, 998, 925, 940,
860, 860, 119, 145, 74, 928],
[516, 421, 697, 192, 26, 251, 294, 643, 476,
959, 442, 826, 31, 582, 629],
[542, 446, 841, 808, 696, 30, 179, 795, 269,
917, 643, 306, 284, 20, 840],
[513, 218, 830, 912, 862, 388, 741, 525, 630,
405, 631, 383, 531, 318, 426],
[434, 565, 697, 621, 308, 675, 252, 683, 842,
26, 133, 402, 692, 674, 531],
[351, 597, 455, 57, 498, 523, 349, 688, 114,
881, 103, 692, 829, 40, 375],
[630, 400, 244, 600, 467, 618, 505, 435, 821,
670, 896, 248, 743, 83, 784],
[349, 703, 796, 713, 477, 203, 15, 468, 921,
837, 517, 134, 641, 899, 504],
[690, 699, 610, 990, 139, 296, 914, 196, 333,
876, 29, 979, 869, 355, 472],
[187, 787, 932, 687, 662, 625, 759, 371, 438,
893, 838, 876, 442, 442, 697],
[454, 871, 70, 541, 598, 597, 402, 472, 327,
160, 913, 735, 518, 770, 635]]),
[319, 115, 440, 26, 579, 418, 402, 165, 517, 784, 878,
694, 93, 128, 44, 506, 103, 220, 928, 629, 840, 426,
531, 375, 784, 504, 472, 697, 635, 770, 518, 735, 913,
160, 327, 472, 402, 597, 598, 541, 70, 871, 454, 187,
690, 349, 630, 351, 434, 513, 542, 516, 928, 716, 201,
852, 607, 878, 871, 517, 532, 992, 374, 11, 98, 518,
711, 147, 227, 758, 95, 74, 582, 20, 318, 674, 40, 83,
899, 355, 442, 442, 876, 838, 893, 438, 371, 759, 625,
662, 687, 932, 787, 699, 703, 400, 597, 565, 218, 446,
421, 536, 320, 469, 258, 872, 604, 990, 830, 450, 143,
19, 552, 694, 210, 961, 145, 31, 284, 531, 692, 829,
743, 641, 869, 979, 29, 876, 333, 196, 914, 296, 139,
990, 610, 796, 244, 455, 697, 830, 841, 697, 957, 227,
464, 249, 476, 868, 589, 739, 445, 2, 718, 119, 826,
306, 383, 402, 692, 248, 134, 517, 837, 921, 468, 15,
203, 477, 713, 600, 57, 621, 912, 808, 192, 213, 258,
403, 998, 925, 940, 860, 860, 442, 643, 631, 133, 103,
896, 670, 821, 435, 505, 618, 467, 498, 308, 862, 696,
26, 251, 294, 643, 476, 959, 917, 405, 26, 881, 114,
688, 349, 523, 675, 388, 30, 179, 795, 269, 630, 842,
683, 252, 741, 525])
def test_snail_075(self):
self.assertEqual(snail([[117, 708, 570, 27, 409, 596, 355, 42, 480],
[874, 320, 499, 489, 767, 179, 912, 813, 855],
[929, 737, 403, 431, 219, 710, 107, 450, 61],
[860, 446, 119, 88, 448, 553, 833, 293, 803],
[868, 141, 930, 398, 882, 135, 585, 348, 890],
[506, 859, 833, 31, 808, 663, 384, 341, 457],
[864, 183, 143, 954, 427, 680, 940, 411, 585],
[995, 374, 784, 568, 200, 777, 468, 69, 902],
[206, 588, 712, 813, 721, 746, 11, 284, 45]]),
[117, 708, 570, 27, 409, 596, 355, 42, 480, 855, 61,
803, 890, 457, 585, 902, 45, 284, 11, 746, 721, 813,
712, 588, 206, 995, 864, 506, 868, 860, 929, 874, 320,
499, 489, 767, 179, 912, 813, 450, 293, 348, 341, 411,
69, 468, 777, 200, 568, 784, 374, 183, 859, 141, 446,
737, 403, 431, 219, 710, 107, 833, 585, 384, 940, 680,
427, 954, 143, 833, 930, 119, 88, 448, 553, 135, 663,
808, 31, 398, 882])
def test_snail_076(self):
self.assertEqual(snail([[385, 928, 460, 539, 984, 516, 609, 769, 825,
857, 819, 422, 989, 319, 60, 450, 495, 64,
624],
[604, 59, 272, 470, 997, 980, 563, 632, 353,
366, 750, 740, 395, 978, 995, 848, 72, 820,
410],
[703, 427, 351, 469, 685, 297, 362, 947, 998,
434, 896, 773, 441, 562, 785, 704, 529, 471,
798],
[564, 846, 756, 916, 435, 184, 785, 930, 349,
161, 253, 365, 82, 976, 499, 461, 398, 278,
331],
[529, 354, 643, 338, 772, 629, 726, 296, 672,
282, 268, 741, 330, 272, 217, 188, 754, 875,
58],
[869, 349, 328, 585, 442, 812, 645, 854, 317,
437, 314, 343, 571, 202, 534, 22, 307, 874,
859],
[161, 579, 865, 703, 276, 889, 374, 792, 123,
668, 970, 737, 846, 416, 704, 204, 660, 223,
509],
[243, 645, 359, 427, 636, 193, 663, 857, 712,
510, 367, 862, 352, 715, 811, 986, 292, 391,
475],
[645, 767, 117, 907, 321, 906, 592, 508, 647,
289, 307, 519, 425, 659, 219, 459, 537, 505,
328],
[743, 74, 374, 226, 356, 28, 5, 215, 459, 232,
18, 123, 308, 277, 490, 345, 68, 763, 93],
[21, 927, 770, 760, 75, 751, 387, 686, 366, 108,
327, 196, 603, 676, 337, 59, 799, 41, 699],
[777, 779, 755, 647, 718, 144, 749, 35, 282,
233, 552, 936, 391, 140, 877, 874, 472, 86,
836],
[966, 63, 26, 21, 595, 325, 521, 636, 481, 485,
664, 897, 151, 132, 969, 967, 856, 953, 425],
[352, 849, 157, 520, 272, 9, 934, 441, 261, 380,
868, 260, 375, 547, 699, 924, 794, 617, 222],
[559, 901, 435, 537, 620, 779, 708, 848, 903,
701, 570, 115, 114, 342, 57, 878, 278, 697,
629],
[541, 502, 381, 168, 792, 268, 21, 59, 581, 691,
695, 906, 616, 808, 366, 804, 36, 210, 295],
[662, 142, 571, 207, 905, 913, 414, 341, 956,
602, 115, 78, 688, 67, 148, 92, 930, 68, 258],
[301, 970, 837, 91, 679, 574, 119, 324, 554,
233, 617, 382, 876, 516, 380, 584, 516, 911,
331],
[894, 637, 193, 54, 14, 503, 221, 127, 118, 565,
234, 828, 753, 97, 257, 619, 811, 803, 934]]),
[385, 928, 460, 539, 984, 516, 609, 769, 825, 857, 819,
422, 989, 319, 60, 450, 495, 64, 624, 410, 798, 331,
58, 859, 509, 475, 328, 93, 699, 836, 425, 222, 629,
295, 258, 331, 934, 803, 811, 619, 257, 97, 753, 828,
234, 565, 118, 127, 221, 503, 14, 54, 193, 637, 894,
301, 662, 541, 559, 352, 966, 777, 21, 743, 645, 243,
161, 869, 529, 564, 703, 604, 59, 272, 470, 997, 980,
563, 632, 353, 366, 750, 740, 395, 978, 995, 848, 72,
820, 471, 278, 875, 874, 223, 391, 505, 763, 41, 86,
953, 617, 697, 210, 68, 911, 516, 584, 380, 516, 876,
382, 617, 233, 554, 324, 119, 574, 679, 91, 837, 970,
142, 502, 901, 849, 63, 779, 927, 74, 767, 645, 579,
349, 354, 846, 427, 351, 469, 685, 297, 362, 947, 998,
434, 896, 773, 441, 562, 785, 704, 529, 398, 754, 307,
660, 292, 537, 68, 799, 472, 856, 794, 278, 36, 930,
92, 148, 67, 688, 78, 115, 602, 956, 341, 414, 913,
905, 207, 571, 381, 435, 157, 26, 755, 770, 374, 117,
359, 865, 328, 643, 756, 916, 435, 184, 785, 930, 349,
161, 253, 365, 82, 976, 499, 461, 188, 22, 204, 986,
459, 345, 59, 874, 967, 924, 878, 804, 366, 808, 616,
906, 695, 691, 581, 59, 21, 268, 792, 168, 537, 520,
21, 647, 760, 226, 907, 427, 703, 585, 338, 772, 629,
726, 296, 672, 282, 268, 741, 330, 272, 217, 534, 704,
811, 219, 490, 337, 877, 969, 699, 57, 342, 114, 115,
570, 701, 903, 848, 708, 779, 620, 272, 595, 718, 75,
356, 321, 636, 276, 442, 812, 645, 854, 317, 437, 314,
343, 571, 202, 416, 715, 659, 277, 676, 140, 132, 547,
375, 260, 868, 380, 261, 441, 934, 9, 325, 144, 751,
28, 906, 193, 889, 374, 792, 123, 668, 970, 737, 846,
352, 425, 308, 603, 391, 151, 897, 664, 485, 481, 636,
521, 749, 387, 5, 592, 663, 857, 712, 510, 367, 862,
519, 123, 196, 936, 552, 233, 282, 35, 686, 215, 508,
647, 289, 307, 18, 327, 108, 366, 459, 232])
def test_snail_077(self):
self.assertEqual(snail([[666, 962, 235, 436, 68, 11, 222, 412, 346, 108,
83, 505, 615, 899, 111, 149, 740, 452, 988,
476],
[546, 18, 303, 148, 420, 385, 556, 547, 944,
980, 346, 821, 402, 114, 287, 328, 884, 420,
476, 327],
[586, 711, 282, 581, 620, 649, 276, 979, 359,
916, 897, 797, 676, 359, 510, 229, 621, 782,
559, 406],
[888, 758, 801, 266, 597, 509, 541, 501, 301,
109, 298, 676, 542, 803, 434, 40, 601, 224, 72,
387],
[402, 960, 825, 515, 400, 282, 102, 787, 226,
256, 446, 116, 926, 868, 497, 885, 645, 228,
37, 263],
[589, 332, 700, 507, 657, 509, 28, 46, 60, 615,
43, 439, 545, 382, 249, 1, 511, 411, 369, 336],
[470, 14, 533, 919, 248, 40, 292, 559, 970, 850,
609, 202, 315, 100, 52, 467, 332, 666, 620,
145],
[117, 906, 282, 526, 168, 206, 689, 213, 207,
78, 270, 186, 877, 744, 191, 86, 56, 626, 47,
777],
[491, 902, 689, 519, 278, 647, 890, 903, 351,
125, 873, 92, 510, 765, 213, 298, 972, 42, 667,
61],
[689, 759, 825, 676, 249, 697, 684, 112, 347,
73, 863, 91, 150, 311, 140, 814, 984, 838, 458,
505],
[176, 115, 727, 603, 981, 695, 255, 165, 433,
82, 576, 392, 401, 736, 469, 685, 684, 473,
599, 275],
[400, 527, 489, 949, 267, 523, 711, 642, 204,
140, 298, 162, 730, 26, 745, 748, 641, 378,
187, 208],
[424, 742, 633, 608, 645, 642, 876, 276, 408,
985, 695, 3, 772, 967, 436, 422, 333, 626, 980,
279],
[363, 401, 873, 167, 355, 259, 678, 424, 558,
957, 171, 284, 664, 517, 855, 849, 112, 470,
331, 112],
[353, 257, 463, 706, 552, 957, 255, 596, 453,
950, 352, 914, 493, 798, 735, 633, 747, 552,
368, 547],
[524, 688, 975, 145, 704, 232, 190, 483, 617,
262, 882, 782, 5, 345, 285, 483, 325, 321, 866,
806],
[99, 972, 262, 332, 81, 103, 425, 156, 240, 599,
508, 755, 783, 585, 354, 515, 694, 638, 22,
815],
[789, 616, 172, 544, 827, 862, 286, 844, 376,
844, 508, 320, 675, 197, 350, 545, 505, 78,
155, 606],
[203, 167, 992, 723, 682, 83, 534, 315, 376, 89,
267, 107, 346, 924, 306, 752, 627, 496, 994,
613],
[581, 737, 393, 879, 406, 15, 265, 238, 125,
683, 505, 835, 174, 509, 284, 12, 364, 345,
395, 1]]),
[666, 962, 235, 436, 68, 11, 222, 412, 346, 108, 83,
505, 615, 899, 111, 149, 740, 452, 988, 476, 327, 406,
387, 263, 336, 145, 777, 61, 505, 275, 208, 279, 112,
547, 806, 815, 606, 613, 1, 395, 345, 364, 12, 284,
509, 174, 835, 505, 683, 125, 238, 265, 15, 406, 879,
393, 737, 581, 203, 789, 99, 524, 353, 363, 424, 400,
176, 689, 491, 117, 470, 589, 402, 888, 586, 546, 18,
303, 148, 420, 385, 556, 547, 944, 980, 346, 821, 402,
114, 287, 328, 884, 420, 476, 559, 72, 37, 369, 620,
47, 667, 458, 599, 187, 980, 331, 368, 866, 22, 155,
994, 496, 627, 752, 306, 924, 346, 107, 267, 89, 376,
315, 534, 83, 682, 723, 992, 167, 616, 972, 688, 257,
401, 742, 527, 115, 759, 902, 906, 14, 332, 960, 758,
711, 282, 581, 620, 649, 276, 979, 359, 916, 897, 797,
676, 359, 510, 229, 621, 782, 224, 228, 411, 666, 626,
42, 838, 473, 378, 626, 470, 552, 321, 638, 78, 505,
545, 350, 197, 675, 320, 508, 844, 376, 844, 286, 862,
827, 544, 172, 262, 975, 463, 873, 633, 489, 727, 825,
689, 282, 533, 700, 825, 801, 266, 597, 509, 541, 501,
301, 109, 298, 676, 542, 803, 434, 40, 601, 645, 511,
332, 56, 972, 984, 684, 641, 333, 112, 747, 325, 694,
515, 354, 585, 783, 755, 508, 599, 240, 156, 425, 103,
81, 332, 145, 706, 167, 608, 949, 603, 676, 519, 526,
919, 507, 515, 400, 282, 102, 787, 226, 256, 446, 116,
926, 868, 497, 885, 1, 467, 86, 298, 814, 685, 748,
422, 849, 633, 483, 285, 345, 5, 782, 882, 262, 617,
483, 190, 232, 704, 552, 355, 645, 267, 981, 249, 278,
168, 248, 657, 509, 28, 46, 60, 615, 43, 439, 545,
382, 249, 52, 191, 213, 140, 469, 745, 436, 855, 735,
798, 493, 914, 352, 950, 453, 596, 255, 957, 259, 642,
523, 695, 697, 647, 206, 40, 292, 559, 970, 850, 609,
202, 315, 100, 744, 765, 311, 736, 26, 967, 517, 664,
284, 171, 957, 558, 424, 678, 876, 711, 255, 684, 890,
689, 213, 207, 78, 270, 186, 877, 510, 150, 401, 730,
772, 3, 695, 985, 408, 276, 642, 165, 112, 903, 351,
125, 873, 92, 91, 392, 162, 298, 140, 204, 433, 347,
73, 863, 576, 82])
def test_snail_078(self):
self.assertEqual(snail([[46, 105, 755, 137, 836, 162, 149, 478, 258],
[379, 307, 501, 642, 573, 610, 945, 506, 956],
[896, 309, 293, 526, 429, 298, 636, 989, 80],
[880, 153, 23, 95, 765, 124, 818, 836, 15],
[242, 510, 792, 823, 494, 479, 737, 231, 317],
[982, 293, 984, 13, 276, 39, 167, 146, 236],
[431, 546, 246, 860, 207, 380, 306, 577, 405],
[905, 276, 247, 949, 479, 6, 61, 479, 257],
[106, 744, 940, 112, 474, 457, 968, 106, 834]]),
[46, 105, 755, 137, 836, 162, 149, 478, 258, 956, 80,
15, 317, 236, 405, 257, 834, 106, 968, 457, 474, 112,
940, 744, 106, 905, 431, 982, 242, 880, 896, 379, 307,
501, 642, 573, 610, 945, 506, 989, 836, 231, 146, 577,
479, 61, 6, 479, 949, 247, 276, 546, 293, 510, 153,
309, 293, 526, 429, 298, 636, 818, 737, 167, 306, 380,
207, 860, 246, 984, 792, 23, 95, 765, 124, 479, 39,
276, 13, 823, 494])
def test_snail_079(self):
self.assertEqual(snail([[601]]), [601])
def test_snail_080(self):
self.assertEqual(snail([[536, 275, 747, 8, 428, 685, 425, 412, 645, 533,
654, 886, 275, 373, 341, 70, 650],
[756, 413, 436, 934, 70, 645, 837, 399, 729,
158, 115, 212, 529, 627, 892, 58, 619],
[518, 780, 787, 240, 167, 877, 45, 186, 204, 22,
90, 292, 440, 612, 569, 934, 587],
[409, 521, 219, 974, 972, 466, 222, 367, 656,
763, 432, 42, 652, 251, 806, 486, 266],
[144, 220, 975, 993, 678, 28, 287, 838, 236,
632, 211, 508, 380, 748, 908, 232, 311],
[59, 581, 843, 66, 293, 134, 177, 377, 903, 109,
289, 797, 915, 171, 878, 695, 826],
[5, 889, 628, 878, 997, 251, 772, 414, 963, 863,
628, 454, 971, 275, 246, 243, 471],
[589, 24, 469, 290, 96, 747, 174, 213, 135, 156,
578, 50, 459, 831, 340, 571, 230],
[943, 385, 307, 46, 800, 569, 449, 634, 899,
355, 786, 960, 487, 267, 905, 890, 626],
[382, 736, 909, 496, 936, 828, 684, 105, 44,
589, 477, 225, 434, 649, 419, 273, 447],
[629, 814, 94, 606, 640, 272, 12, 589, 421, 327,
552, 249, 232, 32, 713, 179, 812],
[432, 535, 53, 10, 658, 475, 431, 61, 830, 716,
173, 797, 766, 76, 537, 4, 156],
[360, 671, 868, 928, 838, 705, 359, 128, 397,
793, 696, 194, 904, 174, 818, 833, 48],
[789, 821, 540, 10, 356, 267, 847, 783, 914,
391, 93, 977, 426, 780, 755, 35, 914],
[862, 389, 478, 904, 272, 512, 567, 469, 802,
492, 300, 137, 908, 585, 72, 928, 133],
[29, 33, 792, 193, 910, 404, 972, 524, 301, 32,
385, 813, 353, 322, 112, 606, 138],
[930, 878, 888, 703, 28, 422, 72, 939, 971, 551,
49, 363, 45, 723, 659, 553, 133]]),
[536, 275, 747, 8, 428, 685, 425, 412, 645, 533, 654,
886, 275, 373, 341, 70, 650, 619, 587, 266, 311, 826,
471, 230, 626, 447, 812, 156, 48, 914, 133, 138, 133,
553, 659, 723, 45, 363, 49, 551, 971, 939, 72, 422,
28, 703, 888, 878, 930, 29, 862, 789, 360, 432, 629,
382, 943, 589, 5, 59, 144, 409, 518, 756, 413, 436,
934, 70, 645, 837, 399, 729, 158, 115, 212, 529, 627,
892, 58, 934, 486, 232, 695, 243, 571, 890, 273, 179,
4, 833, 35, 928, 606, 112, 322, 353, 813, 385, 32,
301, 524, 972, 404, 910, 193, 792, 33, 389, 821, 671,
535, 814, 736, 385, 24, 889, 581, 220, 521, 780, 787,
240, 167, 877, 45, 186, 204, 22, 90, 292, 440, 612,
569, 806, 908, 878, 246, 340, 905, 419, 713, 537, 818,
755, 72, 585, 908, 137, 300, 492, 802, 469, 567, 512,
272, 904, 478, 540, 868, 53, 94, 909, 307, 469, 628,
843, 975, 219, 974, 972, 466, 222, 367, 656, 763, 432,
42, 652, 251, 748, 171, 275, 831, 267, 649, 32, 76,
174, 780, 426, 977, 93, 391, 914, 783, 847, 267, 356,
10, 928, 10, 606, 496, 46, 290, 878, 66, 993, 678, 28,
287, 838, 236, 632, 211, 508, 380, 915, 971, 459, 487,
434, 232, 766, 904, 194, 696, 793, 397, 128, 359, 705,
838, 658, 640, 936, 800, 96, 997, 293, 134, 177, 377,
903, 109, 289, 797, 454, 50, 960, 225, 249, 797, 173,
716, 830, 61, 431, 475, 272, 828, 569, 747, 251, 772,
414, 963, 863, 628, 578, 786, 477, 552, 327, 421, 589,
12, 684, 449, 174, 213, 135, 156, 355, 589, 44, 105,
634, 899])
def test_snail_081(self):
self.assertEqual(snail([[350, 303, 624, 66, 319, 723, 677],
[44, 616, 64, 859, 683, 425, 556],
[551, 592, 382, 678, 823, 63, 881],
[956, 8, 601, 384, 191, 811, 32],
[815, 931, 592, 1, 230, 786, 446],
[597, 948, 908, 590, 858, 850, 974],
[533, 204, 906, 134, 27, 882, 14]]),
[350, 303, 624, 66, 319, 723, 677, 556, 881, 32, 446,
974, 14, 882, 27, 134, 906, 204, 533, 597, 815, 956,
551, 44, 616, 64, 859, 683, 425, 63, 811, 786, 850,
858, 590, 908, 948, 931, 8, 592, 382, 678, 823, 191,
230, 1, 592, 601, 384])
def test_snail_082(self):
self.assertEqual(snail([[232, 617, 922, 488, 792, 289, 488, 451, 844,
714, 179, 844, 377, 576, 242],
[638, 339, 530, 807, 417, 862, 71, 352, 963, 49,
822, 978, 162, 924, 461],
[148, 636, 263, 858, 140, 630, 654, 304, 258,
412, 64, 1, 326, 311, 284],
[573, 758, 197, 133, 766, 783, 550, 324, 290,
293, 337, 479, 415, 587, 133],
[798, 60, 844, 834, 303, 77, 121, 339, 885, 691,
848, 272, 484, 758, 485],
[364, 590, 109, 407, 502, 59, 341, 166, 109,
382, 90, 226, 362, 299, 761],
[308, 771, 541, 867, 867, 886, 671, 302, 894,
517, 713, 570, 682, 603, 209],
[512, 975, 223, 313, 340, 376, 751, 76, 332, 80,
81, 581, 401, 768, 373],
[933, 400, 289, 659, 875, 869, 5, 606, 314, 989,
494, 403, 925, 341, 839],
[470, 504, 721, 26, 765, 821, 985, 750, 905,
938, 975, 950, 288, 196, 603],
[977, 989, 127, 507, 747, 679, 671, 797, 819,
775, 439, 994, 870, 970, 164],
[761, 489, 634, 539, 499, 48, 61, 515, 675, 8,
194, 621, 828, 638, 801],
[366, 575, 629, 798, 838, 201, 769, 989, 507,
142, 3, 561, 225, 282, 604],
[122, 776, 797, 161, 244, 963, 385, 715, 120,
321, 752, 489, 233, 904, 843],
[739, 637, 324, 232, 751, 507, 800, 548, 486,
781, 554, 267, 721, 845, 6]]),
[232, 617, 922, 488, 792, 289, 488, 451, 844, 714, 179,
844, 377, 576, 242, 461, 284, 133, 485, 761, 209, 373,
839, 603, 164, 801, 604, 843, 6, 845, 721, 267, 554,
781, 486, 548, 800, 507, 751, 232, 324, 637, 739, 122,
366, 761, 977, 470, 933, 512, 308, 364, 798, 573, 148,
638, 339, 530, 807, 417, 862, 71, 352, 963, 49, 822,
978, 162, 924, 311, 587, 758, 299, 603, 768, 341, 196,
970, 638, 282, 904, 233, 489, 752, 321, 120, 715, 385,
963, 244, 161, 797, 776, 575, 489, 989, 504, 400, 975,
771, 590, 60, 758, 636, 263, 858, 140, 630, 654, 304,
258, 412, 64, 1, 326, 415, 484, 362, 682, 401, 925,
288, 870, 828, 225, 561, 3, 142, 507, 989, 769, 201,
838, 798, 629, 634, 127, 721, 289, 223, 541, 109, 844,
197, 133, 766, 783, 550, 324, 290, 293, 337, 479, 272,
226, 570, 581, 403, 950, 994, 621, 194, 8, 675, 515,
61, 48, 499, 539, 507, 26, 659, 313, 867, 407, 834,
303, 77, 121, 339, 885, 691, 848, 90, 713, 81, 494,
975, 439, 775, 819, 797, 671, 679, 747, 765, 875, 340,
867, 502, 59, 341, 166, 109, 382, 517, 80, 989, 938,
905, 750, 985, 821, 869, 376, 886, 671, 302, 894, 332,
314, 606, 5, 751, 76])
def test_snail_083(self):
self.assertEqual(snail([[144, 568, 21, 727, 740, 122, 743, 378, 519,
294, 987, 449, 688, 91],
[552, 330, 129, 484, 303, 770, 794, 409, 32,
995, 764, 458, 386, 946],
[232, 385, 662, 477, 897, 597, 969, 609, 361,
529, 422, 18, 645, 653],
[819, 179, 340, 828, 667, 374, 420, 151, 671,
281, 326, 381, 172, 12],
[695, 954, 432, 746, 292, 212, 544, 792, 75,
976, 26, 534, 887, 349],
[313, 163, 954, 749, 295, 980, 883, 133, 74,
156, 703, 232, 232, 743],
[417, 501, 155, 131, 331, 691, 333, 873, 964,
12, 447, 684, 455, 434],
[135, 141, 836, 947, 767, 389, 477, 646, 470,
281, 296, 182, 898, 681],
[373, 491, 318, 425, 872, 981, 276, 414, 883,
170, 585, 494, 993, 789],
[419, 172, 127, 49, 377, 384, 279, 958, 572,
535, 777, 121, 226, 728],
[683, 986, 545, 205, 129, 816, 117, 474, 159,
577, 380, 149, 42, 360],
[317, 525, 283, 558, 762, 813, 230, 435, 944,
500, 260, 211, 728, 666],
[858, 49, 772, 565, 195, 376, 938, 653, 992, 54,
819, 552, 93, 486],
[246, 99, 795, 769, 705, 916, 422, 117, 882, 41,
23, 612, 426, 556]]),
[144, 568, 21, 727, 740, 122, 743, 378, 519, 294, 987,
449, 688, 91, 946, 653, 12, 349, 743, 434, 681, 789,
728, 360, 666, 486, 556, 426, 612, 23, 41, 882, 117,
422, 916, 705, 769, 795, 99, 246, 858, 317, 683, 419,
373, 135, 417, 313, 695, 819, 232, 552, 330, 129, 484,
303, 770, 794, 409, 32, 995, 764, 458, 386, 645, 172,
887, 232, 455, 898, 993, 226, 42, 728, 93, 552, 819,
54, 992, 653, 938, 376, 195, 565, 772, 49, 525, 986,
172, 491, 141, 501, 163, 954, 179, 385, 662, 477, 897,
597, 969, 609, 361, 529, 422, 18, 381, 534, 232, 684,
182, 494, 121, 149, 211, 260, 500, 944, 435, 230, 813,
762, 558, 283, 545, 127, 318, 836, 155, 954, 432, 340,
828, 667, 374, 420, 151, 671, 281, 326, 26, 703, 447,
296, 585, 777, 380, 577, 159, 474, 117, 816, 129, 205,
49, 425, 947, 131, 749, 746, 292, 212, 544, 792, 75,
976, 156, 12, 281, 170, 535, 572, 958, 279, 384, 377,
872, 767, 331, 295, 980, 883, 133, 74, 964, 470, 883,
414, 276, 981, 389, 691, 333, 873, 646, 477])
def test_snail_084(self):
self.assertEqual(snail([[189, 117, 130, 56, 993, 906, 843, 983, 823,
485, 420, 275, 333, 394, 68, 33],
[818, 830, 502, 978, 273, 428, 157, 621, 121,
411, 509, 279, 263, 56, 108, 82],
[632, 484, 962, 408, 95, 161, 463, 823, 500,
110, 616, 113, 355, 800, 916, 304],
[146, 217, 702, 32, 929, 794, 249, 734, 284,
757, 354, 826, 842, 992, 651, 820],
[644, 413, 389, 168, 871, 136, 95, 987, 101,
790, 634, 771, 802, 35, 528, 248],
[636, 81, 890, 390, 966, 16, 584, 150, 112, 563,
432, 522, 231, 817, 111, 490],
[572, 77, 887, 337, 985, 822, 83, 788, 986, 767,
996, 442, 328, 24, 906, 496],
[889, 781, 904, 723, 475, 507, 809, 682, 839,
436, 614, 415, 490, 892, 778, 879],
[423, 699, 788, 677, 630, 121, 568, 397, 366,
495, 850, 43, 181, 296, 671, 181],
[849, 828, 840, 490, 665, 921, 666, 346, 315,
287, 347, 527, 346, 38, 599, 743],
[196, 68, 364, 681, 321, 104, 86, 948, 393, 201,
470, 539, 459, 60, 156, 742],
[820, 525, 485, 892, 653, 694, 287, 887, 729,
75, 466, 354, 568, 850, 732, 654],
[670, 174, 472, 262, 890, 410, 362, 234, 335,
92, 451, 167, 706, 177, 955, 612],
[647, 138, 198, 265, 541, 673, 41, 818, 564,
863, 932, 552, 245, 71, 535, 289],
[626, 514, 854, 694, 783, 469, 674, 473, 537,
157, 546, 891, 615, 399, 547, 699],
[662, 868, 468, 922, 99, 268, 120, 280, 983,
586, 712, 206, 750, 43, 640, 116]]),
[189, 117, 130, 56, 993, 906, 843, 983, 823, 485, 420,
275, 333, 394, 68, 33, 82, 304, 820, 248, 490, 496,
879, 181, 743, 742, 654, 612, 289, 699, 116, 640, 43,
750, 206, 712, 586, 983, 280, 120, 268, 99, 922, 468,
868, 662, 626, 647, 670, 820, 196, 849, 423, 889, 572,
636, 644, 146, 632, 818, 830, 502, 978, 273, 428, 157,
621, 121, 411, 509, 279, 263, 56, 108, 916, 651, 528,
111, 906, 778, 671, 599, 156, 732, 955, 535, 547, 399,
615, 891, 546, 157, 537, 473, 674, 469, 783, 694, 854,
514, 138, 174, 525, 68, 828, 699, 781, 77, 81, 413,
217, 484, 962, 408, 95, 161, 463, 823, 500, 110, 616,
113, 355, 800, 992, 35, 817, 24, 892, 296, 38, 60,
850, 177, 71, 245, 552, 932, 863, 564, 818, 41, 673,
541, 265, 198, 472, 485, 364, 840, 788, 904, 887, 890,
389, 702, 32, 929, 794, 249, 734, 284, 757, 354, 826,
842, 802, 231, 328, 490, 181, 346, 459, 568, 706, 167,
451, 92, 335, 234, 362, 410, 890, 262, 892, 681, 490,
677, 723, 337, 390, 168, 871, 136, 95, 987, 101, 790,
634, 771, 522, 442, 415, 43, 527, 539, 354, 466, 75,
729, 887, 287, 694, 653, 321, 665, 630, 475, 985, 966,
16, 584, 150, 112, 563, 432, 996, 614, 850, 347, 470,
201, 393, 948, 86, 104, 921, 121, 507, 822, 83, 788,
986, 767, 436, 495, 287, 315, 346, 666, 568, 809, 682,
839, 366, 397])
def test_snail_085(self):
self.assertEqual(snail([[830, 253, 625, 973, 491, 433, 340, 950, 941],
[594, 74, 780, 39, 840, 620, 979, 117, 869],
[382, 233, 384, 673, 659, 501, 886, 415, 947],
[608, 73, 246, 530, 429, 506, 573, 552, 505],
[482, 346, 767, 910, 939, 200, 398, 831, 979],
[382, 723, 528, 936, 648, 300, 650, 564, 823],
[68, 395, 220, 265, 125, 912, 658, 384, 764],
[934, 378, 160, 882, 201, 23, 74, 287, 899],
[927, 183, 846, 677, 44, 118, 611, 685, 902]]),
[830, 253, 625, 973, 491, 433, 340, 950, 941, 869, 947,
505, 979, 823, 764, 899, 902, 685, 611, 118, 44, 677,
846, 183, 927, 934, 68, 382, 482, 608, 382, 594, 74,
780, 39, 840, 620, 979, 117, 415, 552, 831, 564, 384,
287, 74, 23, 201, 882, 160, 378, 395, 723, 346, 73,
233, 384, 673, 659, 501, 886, 573, 398, 650, 658, 912,
125, 265, 220, 528, 767, 246, 530, 429, 506, 200, 300,
648, 936, 910, 939])
def test_snail_086(self):
self.assertEqual(snail([[138, 741, 417, 159, 204, 874, 124, 662, 424,
454, 485, 437, 98, 149, 674, 523, 367],
[743, 936, 693, 93, 718, 309, 249, 664, 820,
647, 450, 8, 94, 521, 633, 704, 11],
[111, 422, 331, 297, 369, 809, 16, 991, 98, 871,
429, 887, 906, 706, 16, 576, 635],
[897, 820, 362, 595, 369, 495, 206, 231, 632,
842, 225, 550, 663, 364, 556, 586, 890],
[370, 949, 756, 447, 637, 326, 862, 636, 342,
228, 582, 876, 52, 210, 298, 922, 59],
[842, 58, 731, 756, 306, 879, 101, 280, 670,
612, 636, 200, 613, 915, 21, 756, 625],
[22, 850, 811, 476, 515, 485, 579, 707, 730,
343, 492, 324, 588, 692, 954, 339, 674],
[851, 681, 842, 320, 85, 795, 471, 779, 259,
472, 217, 985, 410, 371, 408, 401, 649],
[581, 45, 563, 964, 455, 888, 78, 345, 479, 891,
302, 874, 477, 740, 634, 339, 13],
[794, 39, 180, 191, 463, 573, 704, 333, 920,
508, 373, 622, 378, 615, 1, 778, 186],
[850, 537, 431, 4, 427, 172, 687, 344, 35, 847,
745, 818, 394, 935, 796, 428, 562],
[487, 80, 446, 506, 159, 277, 773, 958, 222,
805, 906, 369, 807, 59, 834, 866, 923],
[169, 750, 548, 544, 7, 987, 629, 344, 516, 916,
352, 303, 926, 466, 44, 635, 703],
[956, 621, 626, 932, 280, 837, 977, 529, 761,
567, 636, 162, 415, 12, 347, 336, 835],
[544, 924, 11, 155, 311, 602, 943, 30, 742, 627,
21, 905, 443, 295, 369, 462, 617],
[445, 648, 244, 728, 706, 492, 740, 402, 226,
605, 748, 201, 717, 135, 785, 306, 535],
[827, 874, 302, 890, 902, 317, 511, 214, 761,
852, 180, 653, 300, 780, 147, 744, 661]]),
[138, 741, 417, 159, 204, 874, 124, 662, 424, 454, 485,
437, 98, 149, 674, 523, 367, 11, 635, 890, 59, 625,
674, 649, 13, 186, 562, 923, 703, 835, 617, 535, 661,
744, 147, 780, 300, 653, 180, 852, 761, 214, 511, 317,
902, 890, 302, 874, 827, 445, 544, 956, 169, 487, 850,
794, 581, 851, 22, 842, 370, 897, 111, 743, 936, 693,
93, 718, 309, 249, 664, 820, 647, 450, 8, 94, 521,
633, 704, 576, 586, 922, 756, 339, 401, 339, 778, 428,
866, 635, 336, 462, 306, 785, 135, 717, 201, 748, 605,
226, 402, 740, 492, 706, 728, 244, 648, 924, 621, 750,
80, 537, 39, 45, 681, 850, 58, 949, 820, 422, 331,
297, 369, 809, 16, 991, 98, 871, 429, 887, 906, 706,
16, 556, 298, 21, 954, 408, 634, 1, 796, 834, 44, 347,
369, 295, 443, 905, 21, 627, 742, 30, 943, 602, 311,
155, 11, 626, 548, 446, 431, 180, 563, 842, 811, 731,
756, 362, 595, 369, 495, 206, 231, 632, 842, 225, 550,
663, 364, 210, 915, 692, 371, 740, 615, 935, 59, 466,
12, 415, 162, 636, 567, 761, 529, 977, 837, 280, 932,
544, 506, 4, 191, 964, 320, 476, 756, 447, 637, 326,
862, 636, 342, 228, 582, 876, 52, 613, 588, 410, 477,
378, 394, 807, 926, 303, 352, 916, 516, 344, 629, 987,
7, 159, 427, 463, 455, 85, 515, 306, 879, 101, 280,
670, 612, 636, 200, 324, 985, 874, 622, 818, 369, 906,
805, 222, 958, 773, 277, 172, 573, 888, 795, 485, 579,
707, 730, 343, 492, 217, 302, 373, 745, 847, 35, 344,
687, 704, 78, 471, 779, 259, 472, 891, 508, 920, 333,
345, 479])
def test_snail_087(self):
self.assertEqual(snail([[525, 36, 964], [45, 650, 15], [487, 52, 333]]),
[525, 36, 964, 15, 333, 52, 487, 45, 650])
def test_snail_088(self):
self.assertEqual(snail(
[[708, 433, 591, 277, 518, 564, 794, 454, 666, 595, 254, 870],
[886, 628, 399, 222, 594, 65, 44, 567, 666, 356, 421, 594],
[612, 162, 307, 42, 245, 10, 620, 187, 413, 350, 972, 964],
[669, 577, 98, 332, 950, 236, 393, 682, 764, 432, 849, 338],
[495, 741, 186, 613, 557, 277, 861, 390, 228, 247, 535, 87],
[485, 401, 526, 512, 170, 157, 575, 284, 814, 215, 897, 797],
[447, 679, 519, 8, 329, 991, 568, 414, 967, 643, 213, 426],
[139, 739, 730, 456, 961, 236, 501, 409, 293, 812, 141, 773],
[930, 834, 528, 146, 556, 677, 991, 143, 911, 118, 301, 165],
[467, 666, 632, 210, 394, 124, 348, 615, 620, 216, 340, 549],
[116, 624, 238, 45, 716, 894, 380, 921, 708, 998, 910, 844],
[790, 25, 61, 218, 901, 200, 833, 57, 472, 464, 523, 573]]),
[708, 433, 591, 277, 518, 564, 794, 454, 666, 595, 254,
870, 594, 964, 338, 87, 797, 426, 773, 165, 549, 844,
573, 523, 464, 472, 57, 833, 200, 901, 218, 61, 25,
790, 116, 467, 930, 139, 447, 485, 495, 669, 612, 886,
628, 399, 222, 594, 65, 44, 567, 666, 356, 421, 972,
849, 535, 897, 213, 141, 301, 340, 910, 998, 708, 921,
380, 894, 716, 45, 238, 624, 666, 834, 739, 679, 401,
741, 577, 162, 307, 42, 245, 10, 620, 187, 413, 350,
432, 247, 215, 643, 812, 118, 216, 620, 615, 348, 124,
394, 210, 632, 528, 730, 519, 526, 186, 98, 332, 950,
236, 393, 682, 764, 228, 814, 967, 293, 911, 143, 991,
677, 556, 146, 456, 8, 512, 613, 557, 277, 861, 390,
284, 414, 409, 501, 236, 961, 329, 170, 157, 575, 568,
991])
def test_snail_089(self):
self.assertEqual(snail([[293, 385, 292, 757, 361, 655, 659, 966, 615,
684, 335, 393, 474],
[478, 315, 712, 147, 750, 338, 9, 707, 159, 91,
170, 85, 27],
[499, 881, 299, 789, 431, 756, 734, 872, 384,
26, 520, 489, 819],
[801, 283, 442, 398, 640, 355, 827, 403, 368,
238, 481, 404, 108],
[295, 858, 223, 425, 139, 752, 720, 679, 43,
976, 817, 77, 607],
[877, 392, 230, 626, 447, 760, 462, 860, 519,
976, 935, 473, 237],
[341, 760, 55, 653, 403, 84, 673, 64, 997, 241,
957, 851, 858],
[946, 296, 603, 287, 348, 837, 508, 741, 461,
920, 693, 131, 343],
[584, 127, 8, 16, 54, 563, 356, 193, 904, 812,
588, 915, 556],
[318, 934, 918, 261, 821, 590, 962, 870, 590,
99, 658, 259, 484],
[350, 129, 627, 13, 625, 760, 268, 552, 427,
303, 818, 860, 190],
[944, 524, 876, 51, 827, 34, 526, 269, 903, 5,
902, 246, 609],
[51, 555, 781, 892, 378, 981, 385, 744, 956,
684, 390, 384, 689]]),
[293, 385, 292, 757, 361, 655, 659, 966, 615, 684, 335,
393, 474, 27, 819, 108, 607, 237, 858, 343, 556, 484,
190, 609, 689, 384, 390, 684, 956, 744, 385, 981, 378,
892, 781, 555, 51, 944, 350, 318, 584, 946, 341, 877,
295, 801, 499, 478, 315, 712, 147, 750, 338, 9, 707,
159, 91, 170, 85, 489, 404, 77, 473, 851, 131, 915,
259, 860, 246, 902, 5, 903, 269, 526, 34, 827, 51,
876, 524, 129, 934, 127, 296, 760, 392, 858, 283, 881,
299, 789, 431, 756, 734, 872, 384, 26, 520, 481, 817,
935, 957, 693, 588, 658, 818, 303, 427, 552, 268, 760,
625, 13, 627, 918, 8, 603, 55, 230, 223, 442, 398,
640, 355, 827, 403, 368, 238, 976, 976, 241, 920, 812,
99, 590, 870, 962, 590, 821, 261, 16, 287, 653, 626,
425, 139, 752, 720, 679, 43, 519, 997, 461, 904, 193,
356, 563, 54, 348, 403, 447, 760, 462, 860, 64, 741,
508, 837, 84, 673])
def test_snail_090(self):
self.assertEqual(snail(
[[232, 704, 47, 593, 30, 394, 932, 781, 504, 760],
[319, 806, 940, 647, 412, 710, 335, 109, 34, 130],
[447, 743, 128, 497, 547, 155, 153, 676, 930, 401],
[502, 42, 815, 824, 166, 627, 893, 500, 753, 136],
[343, 384, 627, 328, 944, 841, 583, 899, 598, 558],
[260, 468, 889, 544, 526, 498, 749, 87, 741, 862],
[323, 885, 390, 955, 965, 997, 974, 210, 611, 890],
[598, 888, 146, 717, 118, 63, 858, 484, 310, 265],
[825, 98, 520, 519, 70, 602, 698, 662, 73, 902],
[53, 156, 588, 118, 981, 519, 39, 536, 147, 295]]),
[232, 704, 47, 593, 30, 394, 932, 781, 504, 760, 130,
401, 136, 558, 862, 890, 265, 902, 295, 147, 536, 39,
519, 981, 118, 588, 156, 53, 825, 598, 323, 260, 343,
502, 447, 319, 806, 940, 647, 412, 710, 335, 109, 34,
930, 753, 598, 741, 611, 310, 73, 662, 698, 602, 70,
519, 520, 98, 888, 885, 468, 384, 42, 743, 128, 497,
547, 155, 153, 676, 500, 899, 87, 210, 484, 858, 63,
118, 717, 146, 390, 889, 627, 815, 824, 166, 627, 893,
583, 749, 974, 997, 965, 955, 544, 328, 944, 841, 498,
526])
def test_snail_091(self):
self.assertEqual(snail([[143, 117, 15, 361, 949, 412, 30, 789, 293],
[517, 943, 527, 914, 119, 984, 619, 878, 694],
[548, 939, 625, 550, 787, 169, 633, 216, 84],
[649, 772, 533, 591, 101, 87, 115, 248, 263],
[650, 436, 659, 76, 395, 878, 470, 424, 7],
[218, 861, 265, 632, 294, 34, 433, 364, 370],
[164, 390, 869, 489, 226, 371, 295, 776, 503],
[424, 284, 985, 209, 70, 146, 636, 797, 176],
[951, 264, 54, 144, 844, 301, 390, 678, 639]]),
[143, 117, 15, 361, 949, 412, 30, 789, 293, 694, 84,
263, 7, 370, 503, 176, 639, 678, 390, 301, 844, 144,
54, 264, 951, 424, 164, 218, 650, 649, 548, 517, 943,
527, 914, 119, 984, 619, 878, 216, 248, 424, 364, 776,
797, 636, 146, 70, 209, 985, 284, 390, 861, 436, 772,
939, 625, 550, 787, 169, 633, 115, 470, 433, 295, 371,
226, 489, 869, 265, 659, 533, 591, 101, 87, 878, 34,
294, 632, 76, 395])
def test_snail_092(self):
self.assertEqual(snail([[746, 798, 736, 433, 822, 82, 487, 32, 500, 717,
52, 320, 238, 1, 529, 973, 97, 6],
[37, 761, 26, 63, 86, 770, 670, 899, 738, 619,
967, 959, 663, 317, 395, 302, 45, 8],
[316, 296, 58, 653, 99, 271, 767, 122, 344, 644,
604, 617, 566, 441, 699, 287, 775, 950],
[60, 610, 295, 13, 143, 480, 575, 808, 896, 416,
919, 970, 163, 38, 726, 482, 18, 940],
[62, 758, 907, 148, 994, 42, 547, 843, 296, 348,
625, 884, 823, 148, 682, 358, 627, 792],
[259, 128, 820, 772, 767, 852, 3, 331, 540, 196,
560, 312, 291, 376, 162, 666, 420, 426],
[3, 362, 144, 383, 219, 657, 301, 113, 46, 771,
132, 697, 38, 486, 299, 218, 254, 692],
[397, 76, 152, 653, 161, 199, 721, 574, 729,
810, 383, 223, 626, 96, 817, 872, 945, 220],
[961, 967, 364, 568, 958, 566, 517, 693, 841,
509, 751, 713, 888, 764, 200, 16, 501, 524],
[195, 523, 624, 652, 113, 281, 983, 472, 482,
681, 206, 733, 742, 985, 226, 207, 699, 575],
[533, 22, 231, 758, 951, 649, 867, 381, 734,
538, 733, 814, 392, 86, 322, 758, 550, 42],
[775, 777, 347, 884, 298, 126, 826, 595, 151,
560, 119, 375, 416, 94, 245, 659, 238, 229],
[562, 956, 429, 47, 922, 974, 953, 624, 583, 40,
507, 752, 446, 779, 788, 952, 354, 798],
[495, 809, 528, 500, 277, 35, 827, 486, 12, 453,
73, 91, 129, 810, 828, 698, 401, 824],
[549, 11, 22, 952, 943, 177, 372, 535, 785, 315,
879, 864, 606, 945, 720, 960, 997, 482],
[810, 804, 171, 44, 552, 317, 293, 863, 71, 416,
294, 995, 267, 152, 973, 777, 936, 790],
[264, 874, 485, 179, 373, 496, 786, 520, 437,
363, 619, 97, 895, 21, 9, 170, 757, 855],
[699, 372, 806, 630, 759, 884, 175, 149, 192,
684, 457, 237, 46, 938, 845, 207, 265, 114]]),
[746, 798, 736, 433, 822, 82, 487, 32, 500, 717, 52,
320, 238, 1, 529, 973, 97, 6, 8, 950, 940, 792, 426,
692, 220, 524, 575, 42, 229, 798, 824, 482, 790, 855,
114, 265, 207, 845, 938, 46, 237, 457, 684, 192, 149,
175, 884, 759, 630, 806, 372, 699, 264, 810, 549, 495,
562, 775, 533, 195, 961, 397, 3, 259, 62, 60, 316, 37,
761, 26, 63, 86, 770, 670, 899, 738, 619, 967, 959,
663, 317, 395, 302, 45, 775, 18, 627, 420, 254, 945,
501, 699, 550, 238, 354, 401, 997, 936, 757, 170, 9,
21, 895, 97, 619, 363, 437, 520, 786, 496, 373, 179,
485, 874, 804, 11, 809, 956, 777, 22, 523, 967, 76,
362, 128, 758, 610, 296, 58, 653, 99, 271, 767, 122,
344, 644, 604, 617, 566, 441, 699, 287, 482, 358, 666,
218, 872, 16, 207, 758, 659, 952, 698, 960, 777, 973,
152, 267, 995, 294, 416, 71, 863, 293, 317, 552, 44,
171, 22, 528, 429, 347, 231, 624, 364, 152, 144, 820,
907, 295, 13, 143, 480, 575, 808, 896, 416, 919, 970,
163, 38, 726, 682, 162, 299, 817, 200, 226, 322, 245,
788, 828, 720, 945, 606, 864, 879, 315, 785, 535, 372,
177, 943, 952, 500, 47, 884, 758, 652, 568, 653, 383,
772, 148, 994, 42, 547, 843, 296, 348, 625, 884, 823,
148, 376, 486, 96, 764, 985, 86, 94, 779, 810, 129,
91, 73, 453, 12, 486, 827, 35, 277, 922, 298, 951,
113, 958, 161, 219, 767, 852, 3, 331, 540, 196, 560,
312, 291, 38, 626, 888, 742, 392, 416, 446, 752, 507,
40, 583, 624, 953, 974, 126, 649, 281, 566, 199, 657,
301, 113, 46, 771, 132, 697, 223, 713, 733, 814, 375,
119, 560, 151, 595, 826, 867, 983, 517, 721, 574, 729,
810, 383, 751, 206, 733, 538, 734, 381, 472, 693, 841,
509, 681, 482])
def test_snail_093(self):
self.assertEqual(snail(
[[600, 705, 630, 641, 878], [29, 799, 688, 274, 954],
[642, 533, 486, 590, 446], [386, 706, 769, 884, 88],
[40, 949, 713, 263, 542]]),
[600, 705, 630, 641, 878, 954, 446, 88, 542, 263, 713,
949, 40, 386, 642, 29, 799, 688, 274, 590, 884, 769,
706, 533, 486])
def test_snail_094(self):
self.assertEqual(snail([[907, 736, 956, 378, 282, 128, 890, 360, 476,
774, 662, 76, 440, 146, 260, 503, 594, 753,
601, 758],
[154, 508, 696, 345, 591, 993, 883, 517, 744,
441, 519, 59, 241, 932, 612, 853, 681, 580,
189, 616],
[252, 776, 960, 174, 414, 719, 865, 586, 514,
147, 885, 941, 624, 902, 920, 281, 788, 666,
645, 885],
[449, 571, 489, 461, 175, 497, 36, 529, 700,
833, 843, 360, 129, 148, 858, 887, 601, 368,
850, 693],
[490, 627, 711, 829, 183, 271, 1, 656, 384, 296,
344, 478, 251, 806, 930, 50, 586, 526, 851,
77],
[567, 200, 336, 555, 849, 867, 680, 585, 750,
865, 85, 520, 229, 438, 712, 500, 846, 37, 795,
591],
[861, 605, 491, 552, 577, 316, 923, 18, 304,
237, 105, 132, 420, 458, 716, 500, 745, 488,
419, 900],
[212, 651, 759, 532, 972, 701, 178, 862, 383,
683, 647, 361, 804, 619, 203, 834, 177, 789,
648, 172],
[824, 811, 117, 519, 107, 371, 638, 841, 931,
397, 381, 19, 625, 501, 644, 332, 421, 616, 9,
451],
[626, 774, 505, 848, 925, 320, 635, 85, 491,
700, 980, 154, 778, 639, 893, 455, 491, 23,
488, 902],
[842, 984, 751, 823, 776, 261, 411, 239, 490,
828, 123, 248, 555, 308, 340, 997, 464, 901,
931, 278],
[826, 354, 702, 996, 583, 195, 939, 381, 649,
830, 991, 167, 337, 328, 237, 120, 678, 64,
943, 232],
[393, 920, 761, 889, 953, 112, 493, 891, 517,
937, 212, 549, 37, 800, 902, 200, 45, 958, 400,
609],
[190, 982, 178, 364, 881, 102, 889, 873, 976,
191, 973, 742, 680, 718, 585, 924, 638, 936,
62, 644],
[565, 513, 575, 193, 561, 750, 953, 226, 691,
562, 655, 294, 877, 651, 343, 328, 599, 277,
883, 447],
[224, 782, 630, 902, 677, 276, 35, 489, 941,
122, 950, 593, 808, 738, 901, 228, 621, 730,
567, 484],
[252, 491, 679, 882, 157, 6, 674, 542, 384, 508,
93, 981, 502, 342, 732, 265, 135, 309, 814,
377],
[609, 16, 276, 999, 676, 620, 662, 276, 598, 79,
983, 105, 959, 328, 7, 486, 112, 484, 117,
970],
[592, 391, 807, 39, 654, 757, 676, 569, 589,
920, 935, 443, 821, 220, 406, 551, 649, 605,
753, 277],
[474, 183, 917, 831, 371, 55, 70, 631, 827, 1,
526, 648, 466, 575, 916, 776, 237, 18, 671,
244]]),
[907, 736, 956, 378, 282, 128, 890, 360, 476, 774, 662,
76, 440, 146, 260, 503, 594, 753, 601, 758, 616, 885,
693, 77, 591, 900, 172, 451, 902, 278, 232, 609, 644,
447, 484, 377, 970, 277, 244, 671, 18, 237, 776, 916,
575, 466, 648, 526, 1, 827, 631, 70, 55, 371, 831,
917, 183, 474, 592, 609, 252, 224, 565, 190, 393, 826,
842, 626, 824, 212, 861, 567, 490, 449, 252, 154, 508,
696, 345, 591, 993, 883, 517, 744, 441, 519, 59, 241,
932, 612, 853, 681, 580, 189, 645, 850, 851, 795, 419,
648, 9, 488, 931, 943, 400, 62, 883, 567, 814, 117,
753, 605, 649, 551, 406, 220, 821, 443, 935, 920, 589,
569, 676, 757, 654, 39, 807, 391, 16, 491, 782, 513,
982, 920, 354, 984, 774, 811, 651, 605, 200, 627, 571,
776, 960, 174, 414, 719, 865, 586, 514, 147, 885, 941,
624, 902, 920, 281, 788, 666, 368, 526, 37, 488, 789,
616, 23, 901, 64, 958, 936, 277, 730, 309, 484, 112,
486, 7, 328, 959, 105, 983, 79, 598, 276, 662, 620,
676, 999, 276, 679, 630, 575, 178, 761, 702, 751, 505,
117, 759, 491, 336, 711, 489, 461, 175, 497, 36, 529,
700, 833, 843, 360, 129, 148, 858, 887, 601, 586, 846,
745, 177, 421, 491, 464, 678, 45, 638, 599, 621, 135,
265, 732, 342, 502, 981, 93, 508, 384, 542, 674, 6,
157, 882, 902, 193, 364, 889, 996, 823, 848, 519, 532,
552, 555, 829, 183, 271, 1, 656, 384, 296, 344, 478,
251, 806, 930, 50, 500, 500, 834, 332, 455, 997, 120,
200, 924, 328, 228, 901, 738, 808, 593, 950, 122, 941,
489, 35, 276, 677, 561, 881, 953, 583, 776, 925, 107,
972, 577, 849, 867, 680, 585, 750, 865, 85, 520, 229,
438, 712, 716, 203, 644, 893, 340, 237, 902, 585, 343,
651, 877, 294, 655, 562, 691, 226, 953, 750, 102, 112,
195, 261, 320, 371, 701, 316, 923, 18, 304, 237, 105,
132, 420, 458, 619, 501, 639, 308, 328, 800, 718, 680,
742, 973, 191, 976, 873, 889, 493, 939, 411, 635, 638,
178, 862, 383, 683, 647, 361, 804, 625, 778, 555, 337,
37, 549, 212, 937, 517, 891, 381, 239, 85, 841, 931,
397, 381, 19, 154, 248, 167, 991, 830, 649, 490, 491,
700, 980, 123, 828])
def test_snail_095(self):
self.assertEqual(snail([[247, 36, 147, 670, 85, 302, 290, 318, 625, 571,
925, 293, 329, 386, 513, 32],
[886, 355, 260, 484, 589, 633, 64, 999, 160,
927, 937, 306, 722, 480, 171, 593],
[243, 262, 207, 601, 850, 221, 834, 478, 394, 6,
926, 500, 705, 771, 947, 559],
[894, 64, 204, 221, 196, 17, 465, 978, 251, 395,
208, 623, 457, 274, 198, 982],
[826, 24, 211, 166, 285, 800, 358, 180, 336,
708, 965, 855, 607, 283, 186, 114],
[177, 887, 42, 168, 420, 708, 632, 953, 929,
246, 355, 617, 576, 783, 892, 527],
[393, 714, 22, 905, 724, 749, 226, 128, 689,
924, 203, 353, 502, 583, 363, 249],
[633, 275, 241, 730, 109, 748, 482, 465, 672,
567, 739, 772, 677, 299, 492, 832],
[701, 706, 283, 866, 551, 893, 928, 136, 822,
892, 100, 11, 686, 759, 780, 799],
[818, 515, 137, 699, 122, 187, 587, 708, 819,
842, 689, 234, 229, 763, 484, 512],
[770, 663, 833, 676, 994, 54, 207, 133, 444,
707, 541, 23, 588, 214, 752, 980],
[121, 54, 432, 672, 767, 47, 945, 497, 433, 422,
913, 688, 703, 289, 933, 736],
[80, 683, 447, 359, 245, 935, 348, 196, 118,
637, 938, 270, 532, 97, 647, 329],
[385, 201, 425, 426, 579, 166, 983, 31, 646,
810, 156, 102, 151, 13, 212, 127],
[677, 439, 224, 931, 557, 572, 31, 122, 107,
812, 796, 934, 956, 74, 372, 311],
[807, 154, 33, 598, 333, 42, 7, 937, 312, 911,
186, 918, 962, 554, 746, 436]]),
[247, 36, 147, 670, 85, 302, 290, 318, 625, 571, 925,
293, 329, 386, 513, 32, 593, 559, 982, 114, 527, 249,
832, 799, 512, 980, 736, 329, 127, 311, 436, 746, 554,
962, 918, 186, 911, 312, 937, 7, 42, 333, 598, 33,
154, 807, 677, 385, 80, 121, 770, 818, 701, 633, 393,
177, 826, 894, 243, 886, 355, 260, 484, 589, 633, 64,
999, 160, 927, 937, 306, 722, 480, 171, 947, 198, 186,
892, 363, 492, 780, 484, 752, 933, 647, 212, 372, 74,
956, 934, 796, 812, 107, 122, 31, 572, 557, 931, 224,
439, 201, 683, 54, 663, 515, 706, 275, 714, 887, 24,
64, 262, 207, 601, 850, 221, 834, 478, 394, 6, 926,
500, 705, 771, 274, 283, 783, 583, 299, 759, 763, 214,
289, 97, 13, 151, 102, 156, 810, 646, 31, 983, 166,
579, 426, 425, 447, 432, 833, 137, 283, 241, 22, 42,
211, 204, 221, 196, 17, 465, 978, 251, 395, 208, 623,
457, 607, 576, 502, 677, 686, 229, 588, 703, 532, 270,
938, 637, 118, 196, 348, 935, 245, 359, 672, 676, 699,
866, 730, 905, 168, 166, 285, 800, 358, 180, 336, 708,
965, 855, 617, 353, 772, 11, 234, 23, 688, 913, 422,
433, 497, 945, 47, 767, 994, 122, 551, 109, 724, 420,
708, 632, 953, 929, 246, 355, 203, 739, 100, 689, 541,
707, 444, 133, 207, 54, 187, 893, 748, 749, 226, 128,
689, 924, 567, 892, 842, 819, 708, 587, 928, 482, 465,
672, 822, 136])
def test_snail_096(self):
self.assertEqual(snail([[433, 873, 34, 538, 182, 479, 447, 919, 491,
799, 321, 798, 96, 351, 199, 595, 384],
[688, 520, 440, 10, 768, 283, 286, 980, 786,
632, 724, 772, 776, 791, 526, 902, 143],
[221, 380, 963, 134, 81, 12, 212, 931, 854, 929,
258, 266, 191, 692, 975, 245, 686],
[371, 60, 849, 373, 934, 222, 750, 480, 817,
384, 623, 223, 965, 716, 502, 306, 419],
[137, 668, 412, 520, 759, 695, 35, 791, 512,
272, 880, 453, 79, 2, 813, 383, 715],
[350, 505, 927, 713, 478, 969, 462, 3, 343, 237,
219, 780, 231, 486, 539, 82, 129],
[405, 363, 901, 599, 117, 102, 317, 683, 880,
226, 757, 863, 175, 434, 903, 555, 152],
[918, 331, 443, 864, 933, 126, 463, 526, 570,
243, 866, 184, 895, 478, 413, 143, 900],
[976, 855, 41, 630, 829, 195, 443, 10, 447, 401,
592, 779, 213, 162, 359, 592, 496],
[892, 131, 875, 900, 416, 266, 524, 162, 561,
14, 148, 103, 869, 412, 229, 490, 961],
[589, 282, 373, 491, 878, 25, 541, 207, 642,
380, 971, 581, 721, 500, 135, 98, 425],
[523, 846, 203, 737, 445, 213, 138, 238, 295,
272, 338, 760, 539, 354, 195, 109, 271],
[948, 521, 513, 819, 497, 73, 487, 760, 899,
687, 330, 409, 476, 725, 3, 261, 101],
[690, 406, 882, 6, 341, 931, 135, 659, 746, 960,
709, 42, 621, 741, 6, 444, 496],
[351, 159, 223, 361, 865, 142, 82, 556, 953,
789, 642, 491, 346, 912, 262, 534, 442],
[397, 421, 707, 864, 685, 406, 76, 577, 159,
210, 885, 229, 54, 617, 945, 153, 928],
[778, 175, 280, 641, 290, 911, 692, 538, 48,
480, 772, 400, 119, 691, 539, 728, 27]]),
[433, 873, 34, 538, 182, 479, 447, 919, 491, 799, 321,
798, 96, 351, 199, 595, 384, 143, 686, 419, 715, 129,
152, 900, 496, 961, 425, 271, 101, 496, 442, 928, 27,
728, 539, 691, 119, 400, 772, 480, 48, 538, 692, 911,
290, 641, 280, 175, 778, 397, 351, 690, 948, 523, 589,
892, 976, 918, 405, 350, 137, 371, 221, 688, 520, 440,
10, 768, 283, 286, 980, 786, 632, 724, 772, 776, 791,
526, 902, 245, 306, 383, 82, 555, 143, 592, 490, 98,
109, 261, 444, 534, 153, 945, 617, 54, 229, 885, 210,
159, 577, 76, 406, 685, 864, 707, 421, 159, 406, 521,
846, 282, 131, 855, 331, 363, 505, 668, 60, 380, 963,
134, 81, 12, 212, 931, 854, 929, 258, 266, 191, 692,
975, 502, 813, 539, 903, 413, 359, 229, 135, 195, 3,
6, 262, 912, 346, 491, 642, 789, 953, 556, 82, 142,
865, 361, 223, 882, 513, 203, 373, 875, 41, 443, 901,
927, 412, 849, 373, 934, 222, 750, 480, 817, 384, 623,
223, 965, 716, 2, 486, 434, 478, 162, 412, 500, 354,
725, 741, 621, 42, 709, 960, 746, 659, 135, 931, 341,
6, 819, 737, 491, 900, 630, 864, 599, 713, 520, 759,
695, 35, 791, 512, 272, 880, 453, 79, 231, 175, 895,
213, 869, 721, 539, 476, 409, 330, 687, 899, 760, 487,
73, 497, 445, 878, 416, 829, 933, 117, 478, 969, 462,
3, 343, 237, 219, 780, 863, 184, 779, 103, 581, 760,
338, 272, 295, 238, 138, 213, 25, 266, 195, 126, 102,
317, 683, 880, 226, 757, 866, 592, 148, 971, 380, 642,
207, 541, 524, 443, 463, 526, 570, 243, 401, 14, 561,
162, 10, 447])
def test_snail_097(self):
self.assertEqual(snail(
[[631, 668, 646, 712, 825], [953, 573, 100, 756, 783],
[445, 553, 384, 130, 668], [157, 805, 969, 18, 304],
[551, 676, 558, 200, 793]]),
[631, 668, 646, 712, 825, 783, 668, 304, 793, 200, 558,
676, 551, 157, 445, 953, 573, 100, 756, 130, 18, 969,
805, 553, 384])
def test_snail_098(self):
self.assertEqual(snail(
[[236, 796, 566, 79, 878, 3], [813, 495, 352, 703, 329, 840],
[874, 879, 560, 307, 997, 4], [596, 458, 407, 889, 536, 319],
[334, 151, 460, 511, 411, 855],
[144, 572, 272, 495, 545, 622]]),
[236, 796, 566, 79, 878, 3, 840, 4, 319, 855, 622, 545,
495, 272, 572, 144, 334, 596, 874, 813, 495, 352, 703,
329, 997, 536, 411, 511, 460, 151, 458, 879, 560, 307,
889, 407])
def test_snail_099(self):
self.assertEqual(snail(
[[222, 261, 661, 331, 511, 364], [571, 689, 58, 265, 565, 413],
[68, 5, 853, 541, 890, 410], [571, 71, 770, 563, 603, 521],
[42, 417, 725, 971, 15, 780], [958, 98, 870, 20, 856, 994]]),
[222, 261, 661, 331, 511, 364, 413, 410, 521, 780, 994,
856, 20, 870, 98, 958, 42, 571, 68, 571, 689, 58, 265,
565, 890, 603, 15, 971, 725, 417, 71, 5, 853, 541,
563, 770])
def test_snail_100(self):
self.assertEqual(snail(
[[641, 678, 48, 894, 850], [974, 949, 998, 825, 286],
[979, 768, 792, 384, 688], [430, 622, 694, 337, 275],
[494, 313, 309, 70, 415]]),
[641, 678, 48, 894, 850, 286, 688, 275, 415, 70, 309,
313, 494, 430, 979, 974, 949, 998, 825, 384, 337, 694,
622, 768, 792])
def test_snail_101(self):
self.assertEqual(snail(
[[600, 786, 254, 655, 13], [815, 239, 774, 325, 57],
[499, 747, 251, 914, 861], [605, 594, 499, 646, 290],
[650, 496, 385, 387, 819]]),
[600, 786, 254, 655, 13, 57, 861, 290, 819, 387, 385,
496, 650, 605, 499, 815, 239, 774, 325, 914, 646, 499,
594, 747, 251])
def test_snail_102(self):
self.assertEqual(snail(
[[903, 696, 410, 542, 956, 889], [381, 306, 48, 102, 268, 355],
[341, 279, 537, 59, 605, 18], [909, 865, 234, 770, 206, 806],
[784, 781, 945, 285, 355, 765],
[100, 748, 473, 319, 150, 998]]),
[903, 696, 410, 542, 956, 889, 355, 18, 806, 765, 998,
150, 319, 473, 748, 100, 784, 909, 341, 381, 306, 48,
102, 268, 605, 206, 355, 285, 945, 781, 865, 279, 537,
59, 770, 234])
def test_snail_103(self):
self.assertEqual(snail([[67, 123, 678, 842, 28, 690, 189, 182, 636, 645,
118, 123, 95, 723],
[119, 324, 247, 8, 860, 329, 180, 791, 92, 5,
896, 921, 157, 781],
[756, 950, 738, 573, 101, 446, 468, 594, 316,
962, 708, 168, 889, 8],
[301, 352, 920, 673, 245, 759, 242, 43, 761,
460, 76, 551, 315, 376],
[915, 367, 345, 8, 132, 840, 451, 965, 757, 558,
94, 882, 847, 82],
[949, 651, 239, 941, 544, 782, 220, 763, 384,
515, 840, 377, 809, 300],
[527, 728, 875, 620, 247, 792, 385, 44, 925,
697, 947, 541, 224, 364],
[824, 885, 723, 353, 77, 915, 880, 339, 809,
919, 931, 569, 980, 357],
[89, 100, 893, 516, 786, 59, 365, 967, 122, 103,
55, 42, 683, 101],
[281, 457, 924, 813, 624, 997, 346, 613, 116,
655, 465, 786, 936, 94],
[185, 898, 588, 272, 712, 367, 435, 660, 152,
896, 792, 670, 272, 397],
[891, 754, 108, 844, 44, 648, 684, 571, 201,
745, 440, 88, 511, 214],
[130, 632, 977, 354, 353, 918, 736, 349, 662,
185, 31, 307, 460, 17],
[910, 947, 686, 668, 857, 345, 654, 678, 27, 78,
445, 639, 130, 970]]),
[67, 123, 678, 842, 28, 690, 189, 182, 636, 645, 118,
123, 95, 723, 781, 8, 376, 82, 300, 364, 357, 101, 94,
397, 214, 17, 970, 130, 639, 445, 78, 27, 678, 654,
345, 857, 668, 686, 947, 910, 130, 891, 185, 281, 89,
824, 527, 949, 915, 301, 756, 119, 324, 247, 8, 860,
329, 180, 791, 92, 5, 896, 921, 157, 889, 315, 847,
809, 224, 980, 683, 936, 272, 511, 460, 307, 31, 185,
662, 349, 736, 918, 353, 354, 977, 632, 754, 898, 457,
100, 885, 728, 651, 367, 352, 950, 738, 573, 101, 446,
468, 594, 316, 962, 708, 168, 551, 882, 377, 541, 569,
42, 786, 670, 88, 440, 745, 201, 571, 684, 648, 44,
844, 108, 588, 924, 893, 723, 875, 239, 345, 920, 673,
245, 759, 242, 43, 761, 460, 76, 94, 840, 947, 931,
55, 465, 792, 896, 152, 660, 435, 367, 712, 272, 813,
516, 353, 620, 941, 8, 132, 840, 451, 965, 757, 558,
515, 697, 919, 103, 655, 116, 613, 346, 997, 624, 786,
77, 247, 544, 782, 220, 763, 384, 925, 809, 122, 967,
365, 59, 915, 792, 385, 44, 339, 880])
def test_snail_104(self):
self.assertEqual(snail(
[[676, 9, 91, 957, 699, 130, 983, 164, 75, 728, 784, 125],
[959, 741, 710, 154, 452, 919, 66, 444, 298, 140, 516, 760],
[969, 514, 898, 621, 984, 616, 724, 738, 410, 758, 829, 482],
[82, 491, 417, 173, 563, 494, 155, 763, 850, 915, 625, 396],
[407, 299, 773, 4, 428, 630, 822, 484, 922, 625, 114, 116],
[571, 180, 379, 284, 947, 688, 749, 312, 502, 935, 879, 166],
[641, 719, 73, 623, 940, 590, 81, 644, 997, 378, 847, 501],
[143, 843, 814, 259, 354, 459, 804, 43, 854, 1000, 382, 717],
[602, 64, 272, 149, 285, 862, 958, 662, 556, 426, 259, 197],
[341, 882, 400, 559, 227, 498, 699, 298, 354, 739, 67, 465],
[43, 85, 467, 557, 614, 63, 680, 434, 937, 472, 488, 243],
[978, 607, 559, 134, 531, 907, 4, 813, 259, 203, 384, 836]]),
[676, 9, 91, 957, 699, 130, 983, 164, 75, 728, 784,
125, 760, 482, 396, 116, 166, 501, 717, 197, 465, 243,
836, 384, 203, 259, 813, 4, 907, 531, 134, 559, 607,
978, 43, 341, 602, 143, 641, 571, 407, 82, 969, 959,
741, 710, 154, 452, 919, 66, 444, 298, 140, 516, 829,
625, 114, 879, 847, 382, 259, 67, 488, 472, 937, 434,
680, 63, 614, 557, 467, 85, 882, 64, 843, 719, 180,
299, 491, 514, 898, 621, 984, 616, 724, 738, 410, 758,
915, 625, 935, 378, 1000, 426, 739, 354, 298, 699,
498, 227, 559, 400, 272, 814, 73, 379, 773, 417, 173,
563, 494, 155, 763, 850, 922, 502, 997, 854, 556, 662,
958, 862, 285, 149, 259, 623, 284, 4, 428, 630, 822,
484, 312, 644, 43, 804, 459, 354, 940, 947, 688, 749,
81, 590])
def test_snail_105(self):
self.assertEqual(snail([[221, 977, 163, 642, 495, 250, 823, 751, 152,
681, 814, 539, 941],
[468, 2, 934, 705, 319, 208, 994, 960, 167, 267,
861, 499, 535],
[516, 31, 300, 893, 235, 842, 13, 44, 235, 236,
590, 711, 174],
[485, 83, 36, 462, 822, 458, 963, 829, 626, 699,
602, 248, 286],
[978, 561, 292, 53, 972, 119, 694, 401, 852,
589, 498, 115, 828],
[737, 896, 881, 863, 502, 217, 584, 390, 621,
373, 777, 312, 425],
[453, 827, 774, 783, 322, 350, 606, 786, 709,
627, 579, 314, 700],
[651, 203, 681, 752, 10, 116, 64, 885, 121, 445,
385, 283, 307],
[884, 35, 523, 791, 169, 338, 411, 749, 48, 662,
878, 314, 802],
[137, 755, 589, 409, 870, 857, 687, 37, 818,
206, 952, 505, 337],
[695, 928, 533, 370, 363, 71, 386, 823, 685,
859, 107, 313, 958],
[58, 267, 988, 746, 601, 767, 701, 27, 565, 434,
734, 942, 572],
[405, 442, 424, 298, 14, 428, 699, 906, 900,
928, 97, 783, 273]]),
[221, 977, 163, 642, 495, 250, 823, 751, 152, 681, 814,
539, 941, 535, 174, 286, 828, 425, 700, 307, 802, 337,
958, 572, 273, 783, 97, 928, 900, 906, 699, 428, 14,
298, 424, 442, 405, 58, 695, 137, 884, 651, 453, 737,
978, 485, 516, 468, 2, 934, 705, 319, 208, 994, 960,
167, 267, 861, 499, 711, 248, 115, 312, 314, 283, 314,
505, 313, 942, 734, 434, 565, 27, 701, 767, 601, 746,
988, 267, 928, 755, 35, 203, 827, 896, 561, 83, 31,
300, 893, 235, 842, 13, 44, 235, 236, 590, 602, 498,
777, 579, 385, 878, 952, 107, 859, 685, 823, 386, 71,
363, 370, 533, 589, 523, 681, 774, 881, 292, 36, 462,
822, 458, 963, 829, 626, 699, 589, 373, 627, 445, 662,
206, 818, 37, 687, 857, 870, 409, 791, 752, 783, 863,
53, 972, 119, 694, 401, 852, 621, 709, 121, 48, 749,
411, 338, 169, 10, 322, 502, 217, 584, 390, 786, 885,
64, 116, 350, 606])
| 69.447214
| 80
| 0.361711
| 30,427
| 247,996
| 2.941236
| 0.036481
| 0.008213
| 0.014079
| 0.028159
| 0.280916
| 0.260166
| 0.244678
| 0.227448
| 0.211648
| 0.190216
| 0
| 0.69859
| 0.505649
| 247,996
| 3,570
| 81
| 69.466667
| 0.031387
| 0
| 0
| 0.011265
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.030329
| 1
| 0.030329
| false
| 0
| 0.000578
| 0
| 0.031196
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c2f576718895138632a90d08831ce15358276a1
| 147
|
py
|
Python
|
app/core/utils.py
|
yayunl/llfselfhelp
|
55994003ad51e1664a733c84ed6afcb9f28b6499
|
[
"MIT"
] | null | null | null |
app/core/utils.py
|
yayunl/llfselfhelp
|
55994003ad51e1664a733c84ed6afcb9f28b6499
|
[
"MIT"
] | 4
|
2021-04-08T21:37:08.000Z
|
2021-09-22T19:31:17.000Z
|
app/core/utils.py
|
yayunl/llfselfhelp
|
55994003ad51e1664a733c84ed6afcb9f28b6499
|
[
"MIT"
] | null | null | null |
from django.views.generic import \
UpdateView as BaseUpdateView
class UpdateView(BaseUpdateView):
template_name_suffix = '_form_update'
| 18.375
| 41
| 0.782313
| 16
| 147
| 6.9375
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.156463
| 147
| 7
| 42
| 21
| 0.895161
| 0
| 0
| 0
| 0
| 0
| 0.082192
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
9c39ca309133fbcd82d6b8365784a041e4f82e97
| 1,391
|
py
|
Python
|
sklearn/utils/_bunch.py
|
jlopezNEU/scikit-learn
|
593495eebc3c2f2ffdb244036adf57fab707a47d
|
[
"BSD-3-Clause"
] | 3
|
2021-09-16T14:23:46.000Z
|
2022-01-02T22:45:15.000Z
|
sklearn/utils/_bunch.py
|
jlopezNEU/scikit-learn
|
593495eebc3c2f2ffdb244036adf57fab707a47d
|
[
"BSD-3-Clause"
] | 11
|
2019-11-15T04:21:29.000Z
|
2022-03-15T03:11:29.000Z
|
sklearn/utils/_bunch.py
|
jlopezNEU/scikit-learn
|
593495eebc3c2f2ffdb244036adf57fab707a47d
|
[
"BSD-3-Clause"
] | 4
|
2019-11-13T15:04:46.000Z
|
2021-12-23T17:50:16.000Z
|
class Bunch(dict):
"""Container object exposing keys as attributes.
Bunch objects are sometimes used as an output for functions and methods.
They extend dictionaries by enabling values to be accessed by key,
`bunch["value_key"]`, or by an attribute, `bunch.value_key`.
Examples
--------
>>> from sklearn.utils import Bunch
>>> b = Bunch(a=1, b=2)
>>> b['b']
2
>>> b.b
2
>>> b.a = 3
>>> b['a']
3
>>> b.c = 6
>>> b['c']
6
"""
def __init__(self, **kwargs):
super().__init__(kwargs)
def __setattr__(self, key, value):
self[key] = value
def __dir__(self):
return self.keys()
def __getattr__(self, key):
try:
return self[key]
except KeyError:
raise AttributeError(key)
def __setstate__(self, state):
# Bunch pickles generated with scikit-learn 0.16.* have an non
# empty __dict__. This causes a surprising behaviour when
# loading these pickles scikit-learn 0.17: reading bunch.key
# uses __dict__ but assigning to bunch.key use __setattr__ and
# only changes bunch['key']. More details can be found at:
# https://github.com/scikit-learn/scikit-learn/issues/6196.
# Overriding __setstate__ to be a noop has the effect of
# ignoring the pickled __dict__
pass
| 28.387755
| 76
| 0.599569
| 183
| 1,391
| 4.306011
| 0.568306
| 0.035533
| 0.011421
| 0.010152
| 0.011421
| 0.011421
| 0
| 0
| 0
| 0
| 0
| 0.018219
| 0.28972
| 1,391
| 48
| 77
| 28.979167
| 0.779352
| 0.601725
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.357143
| false
| 0.071429
| 0
| 0.071429
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 3
|
9c47e111b35b005c12b173bba50fdccaf56fa07f
| 742
|
py
|
Python
|
setup.py
|
jtauber/greek-utils
|
1da19a5a784c4dac9d205ae1afdc5516ddcae9b4
|
[
"MIT"
] | 13
|
2016-01-18T00:39:20.000Z
|
2019-12-13T12:55:28.000Z
|
setup.py
|
jtauber/greek-utils
|
1da19a5a784c4dac9d205ae1afdc5516ddcae9b4
|
[
"MIT"
] | 2
|
2016-11-01T01:11:22.000Z
|
2016-12-24T05:33:06.000Z
|
setup.py
|
jtauber/greek-utils
|
1da19a5a784c4dac9d205ae1afdc5516ddcae9b4
|
[
"MIT"
] | 5
|
2016-01-17T21:28:16.000Z
|
2018-08-03T22:04:05.000Z
|
from setuptools import setup
setup(
name="greek-utils",
version="0.2",
description="various utilities for processing Ancient Greek",
license="MIT",
url="http://github.com/jtauber/greek-utils",
author="James Tauber",
author_email="[email protected]",
packages=["greekutils"],
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Text Processing",
"Topic :: Text Processing :: Linguistic",
"Topic :: Utilities",
],
)
| 30.916667
| 65
| 0.598383
| 76
| 742
| 5.828947
| 0.592105
| 0.171558
| 0.225734
| 0.234763
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.019749
| 0.249326
| 742
| 23
| 66
| 32.26087
| 0.775583
| 0
| 0
| 0
| 0
| 0
| 0.590297
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.045455
| 0
| 0.045455
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c62aef1446638f9fa0188683ca923feaaa75706
| 408
|
py
|
Python
|
imread/tests/test_bmp.py
|
luispedro/imread
|
7960b744623fe03e6d968893a539bca969715860
|
[
"MIT"
] | 51
|
2015-01-09T14:07:37.000Z
|
2022-03-03T13:54:30.000Z
|
imread/tests/test_bmp.py
|
luispedro/imread
|
7960b744623fe03e6d968893a539bca969715860
|
[
"MIT"
] | 16
|
2015-08-09T13:40:44.000Z
|
2020-04-14T10:01:41.000Z
|
imread/tests/test_bmp.py
|
luispedro/imread
|
7960b744623fe03e6d968893a539bca969715860
|
[
"MIT"
] | 15
|
2015-05-22T10:41:52.000Z
|
2021-05-03T11:11:59.000Z
|
import numpy as np
from imread import imread
from . import file_path
def test_read():
im = imread(file_path('star1.bmp'))
assert np.any(im)
assert im.shape == (128, 128, 3)
def test_indexed():
im = imread(file_path('py-installer-indexed.bmp'))
assert np.any(im)
assert im.shape == (352, 162, 3)
assert np.any(im[:,:,0])
assert np.any(im[:,:,1])
assert np.any(im[:,:,2])
| 24
| 54
| 0.622549
| 67
| 408
| 3.716418
| 0.402985
| 0.160643
| 0.220884
| 0.261044
| 0.232932
| 0.232932
| 0.232932
| 0.232932
| 0
| 0
| 0
| 0.055215
| 0.20098
| 408
| 16
| 55
| 25.5
| 0.708589
| 0
| 0
| 0.142857
| 0
| 0
| 0.080882
| 0.058824
| 0
| 0
| 0
| 0
| 0.5
| 1
| 0.142857
| false
| 0
| 0.214286
| 0
| 0.357143
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c68432891ca359406f39890007723907fdc1968
| 4,181
|
py
|
Python
|
test_app/settings.py
|
Lenders-Cooperative/Django-DocuSign
|
676d966065f6e1e64e1f0db9b7691b9f0c5d73a5
|
[
"BSD-3-Clause"
] | null | null | null |
test_app/settings.py
|
Lenders-Cooperative/Django-DocuSign
|
676d966065f6e1e64e1f0db9b7691b9f0c5d73a5
|
[
"BSD-3-Clause"
] | null | null | null |
test_app/settings.py
|
Lenders-Cooperative/Django-DocuSign
|
676d966065f6e1e64e1f0db9b7691b9f0c5d73a5
|
[
"BSD-3-Clause"
] | 2
|
2021-12-03T19:40:35.000Z
|
2021-12-03T19:47:59.000Z
|
#
# Created on Tue Dec 21 2021
#
# Copyright (c) 2021 Lenders Cooperative, a division of Summit Technology Group, Inc.
#
"""
Django settings for test_app project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
import environ
env = environ.Env()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "uhtgm(e2y3@5%0x!wy#re#fn+51h*ck88^ocm7d1=hx^@(&7$7"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"los_docusign.apps.LosDocusignConfig",
"test_app.test_organization.apps.TestOrganizationConfig",
"django_lc_utils",
]
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = "test_app.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
WSGI_APPLICATION = "test_app.wsgi.application"
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "docusign_new_poc",
"USER": "postgres",
"PASSWORD": "admin",
"HOST": "localhost",
"PORT": "5432",
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = "/static/"
BASE_DIR = Path(__file__).resolve().parent
DOCUSIGN_API_ACCOUNT_ID = env(
"DOCUSIGN_API_ACCOUNT_ID", default="<Docusign API Account Id >"
)
DOCUSIGN_CLIENT_ID = env("DOCUSIGN_CLIENT_ID", default="<Docusign Client Id>")
DOCUSIGN_API_ENDPOINT = env(
"DOCUSIGN_API_ENDPOINT", default="https://demo.docusign.net/restapi/v2.1/accounts/"
)
DOCUSIGN_TOKEN_EXPIRY_IN_SECONDS = env("DOCUSIGN_TOKEN_EXPIRY_IN_SECONDS", default=3600)
DOCUSIGN_AUTHORIZATION_SERVER = env(
"DOCUSIGN_AUTHORIZATION_SERVER", default="account-d.docusign.com"
)
DOCUSIGN_PRIVATE_KEY_FILE = env(
"DOCUSIGN_PRIVATE_KEY_FILE",
default="<Private Key file data>",
)
DOCUSIGN_ENABLE_KBA = env("DOCUSIGN_ENABLE_KBA", default=False)
| 27.326797
| 91
| 0.708443
| 482
| 4,181
| 5.977178
| 0.421162
| 0.067685
| 0.053454
| 0.060743
| 0.185699
| 0.166262
| 0.092676
| 0.092676
| 0.041652
| 0
| 0
| 0.015977
| 0.161684
| 4,181
| 152
| 92
| 27.506579
| 0.805991
| 0.261182
| 0
| 0
| 1
| 0.010989
| 0.54002
| 0.417184
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.065934
| 0.021978
| 0
| 0.021978
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 3
|
9c69f20de39f2f2cbc5461ca8a9902a34b2bc1f3
| 165
|
py
|
Python
|
devopsipy/decorators.py
|
kharnam/devopsipy
|
c3379b1dd5f66e71c826045afde1702030e495d4
|
[
"MIT"
] | null | null | null |
devopsipy/decorators.py
|
kharnam/devopsipy
|
c3379b1dd5f66e71c826045afde1702030e495d4
|
[
"MIT"
] | 2
|
2018-10-31T01:43:42.000Z
|
2018-10-31T02:05:55.000Z
|
devopsipy/decorators.py
|
kharnam/devopsipy
|
c3379b1dd5f66e71c826045afde1702030e495d4
|
[
"MIT"
] | null | null | null |
"""
Module to contain Pywork decorators
"""
__author__ = 'sergey kharnam'
import re
import time
import itertools
import logging
log = logging.getLogger(__name__)
| 12.692308
| 35
| 0.769697
| 20
| 165
| 5.95
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.151515
| 165
| 12
| 36
| 13.75
| 0.85
| 0.212121
| 0
| 0
| 0
| 0
| 0.114754
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.666667
| 0
| 0.666667
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
9c6fcb64c497c5bc80d5ed65052770cfc9db0316
| 156
|
py
|
Python
|
env.example.py
|
wilcoln/klazor
|
8f3c40a03a7e61c07eceb6cdbe4d1bb05693727e
|
[
"MIT"
] | 8
|
2020-01-18T09:33:51.000Z
|
2020-01-19T10:47:51.000Z
|
env.example.py
|
wilcoln/klazor
|
8f3c40a03a7e61c07eceb6cdbe4d1bb05693727e
|
[
"MIT"
] | 8
|
2019-08-09T03:54:44.000Z
|
2022-02-12T16:55:51.000Z
|
env.example.py
|
wilcoln/klazor
|
8f3c40a03a7e61c07eceb6cdbe4d1bb05693727e
|
[
"MIT"
] | null | null | null |
DATABASE_OPTIONS = {
'database': 'klazor',
'user': 'root',
'password': '',
'charset': 'utf8mb4',
}
HOSTS = ['127.0.0.1', '67.209.115.211']
| 17.333333
| 39
| 0.525641
| 18
| 156
| 4.5
| 0.888889
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.154472
| 0.211538
| 156
| 8
| 40
| 19.5
| 0.504065
| 0
| 0
| 0
| 0
| 0
| 0.429487
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.142857
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 3
|
9c70026f65fce93a4cf97730e00fb2afc1c7f5b5
| 818
|
py
|
Python
|
misc/_local_settings.py
|
lzantal/djskell
|
cef71bab8a4dd163b632128666c315e228cc8f0f
|
[
"MIT"
] | 4
|
2018-08-06T19:18:03.000Z
|
2019-09-26T14:52:01.000Z
|
misc/_local_settings.py
|
lzantal/djskell
|
cef71bab8a4dd163b632128666c315e228cc8f0f
|
[
"MIT"
] | 2
|
2018-08-06T19:17:57.000Z
|
2020-02-12T22:59:40.000Z
|
misc/_local_settings.py
|
lzantal/djskell
|
cef71bab8a4dd163b632128666c315e228cc8f0f
|
[
"MIT"
] | null | null | null |
"""
Django settings.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
#DEBUG = False
DEBUG = True
SERVE_STATIC = DEBUG
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.oracle'
#'ENGINE': 'django.db.backends.mysql',
#'ENGINE': 'django.db.backends.sqlite3',
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'mydatabase',
'USER': 'mydatabaseuser',
'PASSWORD': 'mypassword',
'HOST': '127.0.0.1',
'PORT': '5432',
}
}
| 24.058824
| 64
| 0.640587
| 102
| 818
| 5.117647
| 0.588235
| 0.091954
| 0.10728
| 0.168582
| 0.17433
| 0.122605
| 0.122605
| 0.122605
| 0
| 0
| 0
| 0.03177
| 0.191932
| 818
| 33
| 65
| 24.787879
| 0.757943
| 0.581907
| 0
| 0
| 1
| 0
| 0.344512
| 0.088415
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.076923
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 3
|
9c7c6f724eb34b62e9ef21f46c99bd86675f4bf5
| 295
|
py
|
Python
|
mixin.py
|
delimatorres/foodbasket
|
2f043d713337581be2165259cdbba4e4a24b656b
|
[
"Apache-2.0"
] | null | null | null |
mixin.py
|
delimatorres/foodbasket
|
2f043d713337581be2165259cdbba4e4a24b656b
|
[
"Apache-2.0"
] | null | null | null |
mixin.py
|
delimatorres/foodbasket
|
2f043d713337581be2165259cdbba4e4a24b656b
|
[
"Apache-2.0"
] | null | null | null |
import signal
class KillableProcess(object):
def __init__(self):
self.interrupt = False
signal.signal(signal.SIGTERM, self._signal_handler)
signal.signal(signal.SIGINT, self._signal_handler)
def _signal_handler(self, sign, frame):
self.interrupt = True
| 26.818182
| 59
| 0.698305
| 34
| 295
| 5.764706
| 0.470588
| 0.244898
| 0.183673
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.210169
| 295
| 11
| 60
| 26.818182
| 0.841202
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.125
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c7f2a0eaaf692b24bd48b78aa80933467348c66
| 80
|
py
|
Python
|
uts/uts_17_aut_py/2/A.py
|
viad00/code_olymp
|
90f20f9fd075e8967d02baf7554fcf24f4ae089c
|
[
"MIT"
] | null | null | null |
uts/uts_17_aut_py/2/A.py
|
viad00/code_olymp
|
90f20f9fd075e8967d02baf7554fcf24f4ae089c
|
[
"MIT"
] | null | null | null |
uts/uts_17_aut_py/2/A.py
|
viad00/code_olymp
|
90f20f9fd075e8967d02baf7554fcf24f4ae089c
|
[
"MIT"
] | null | null | null |
ser = int(input())
mas = list(map(int, input().split()))
mas.sort()
print(*mas)
| 16
| 37
| 0.6125
| 13
| 80
| 3.769231
| 0.692308
| 0.326531
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.1125
| 80
| 4
| 38
| 20
| 0.690141
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
9c7f78a252c83665660e04bc5a8e1cea157db269
| 1,415
|
py
|
Python
|
esque_wire/protocol/serializers/api/elect_preferred_leaders_request.py
|
real-digital/esque-wire
|
eb02c49f38b89ad5e5d25aad15fb4ad795e52807
|
[
"MIT"
] | null | null | null |
esque_wire/protocol/serializers/api/elect_preferred_leaders_request.py
|
real-digital/esque-wire
|
eb02c49f38b89ad5e5d25aad15fb4ad795e52807
|
[
"MIT"
] | 7
|
2019-11-26T08:19:49.000Z
|
2021-03-15T14:27:47.000Z
|
esque_wire/protocol/serializers/api/elect_preferred_leaders_request.py
|
real-digital/esque-wire
|
eb02c49f38b89ad5e5d25aad15fb4ad795e52807
|
[
"MIT"
] | null | null | null |
###############################################################
# Autogenerated module. Please don't modify. #
# Edit according file in protocol_generator/templates instead #
###############################################################
from typing import Dict
from ...structs.api.elect_preferred_leaders_request import ElectPreferredLeadersRequestData, TopicPartition
from ._main_serializers import ArraySerializer, ClassSerializer, Schema, int32Serializer, stringSerializer
topicPartitionSchemas: Dict[int, Schema] = {
0: [("topic", stringSerializer), ("partition_id", ArraySerializer(int32Serializer))]
}
topicPartitionSerializers: Dict[int, ClassSerializer[TopicPartition]] = {
version: ClassSerializer(TopicPartition, schema) for version, schema in topicPartitionSchemas.items()
}
topicPartitionSerializers[-1] = topicPartitionSerializers[0]
electPreferredLeadersRequestDataSchemas: Dict[int, Schema] = {
0: [("topic_partitions", ArraySerializer(topicPartitionSerializers[0])), ("timeout_ms", int32Serializer)]
}
electPreferredLeadersRequestDataSerializers: Dict[int, ClassSerializer[ElectPreferredLeadersRequestData]] = {
version: ClassSerializer(ElectPreferredLeadersRequestData, schema)
for version, schema in electPreferredLeadersRequestDataSchemas.items()
}
electPreferredLeadersRequestDataSerializers[-1] = electPreferredLeadersRequestDataSerializers[0]
| 41.617647
| 109
| 0.733569
| 99
| 1,415
| 10.393939
| 0.494949
| 0.027211
| 0.025267
| 0.027211
| 0.083576
| 0
| 0
| 0
| 0
| 0
| 0
| 0.01018
| 0.097527
| 1,415
| 33
| 110
| 42.878788
| 0.795615
| 0.084806
| 0
| 0
| 1
| 0
| 0.036973
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.166667
| 0
| 0.166667
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
92bcea551d4afd1053bbca8f841cc813051b6539
| 484
|
py
|
Python
|
apps/extensions/migrations/0012_imports_path_urlfield_to_charfield.py
|
StepicOrg/stepik-apps
|
5825bc9b2444ad4690681964d1bed172706f8796
|
[
"Apache-2.0"
] | 5
|
2017-03-17T10:01:25.000Z
|
2018-03-23T05:56:25.000Z
|
apps/extensions/migrations/0012_imports_path_urlfield_to_charfield.py
|
StepicOrg/stepik-apps
|
5825bc9b2444ad4690681964d1bed172706f8796
|
[
"Apache-2.0"
] | 4
|
2020-06-05T17:34:05.000Z
|
2021-04-19T12:58:48.000Z
|
apps/extensions/migrations/0012_imports_path_urlfield_to_charfield.py
|
StepicOrg/stepik-apps
|
5825bc9b2444ad4690681964d1bed172706f8796
|
[
"Apache-2.0"
] | 2
|
2017-03-21T13:01:28.000Z
|
2017-04-27T14:33:20.000Z
|
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-09 03:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extensions', '0011_auto_20170502_0908'),
]
operations = [
migrations.AlterField(
model_name='extension',
name='imports_path',
field=models.CharField(default='imports/', max_length=255),
),
]
| 23.047619
| 71
| 0.630165
| 53
| 484
| 5.54717
| 0.830189
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.099174
| 0.25
| 484
| 20
| 72
| 24.2
| 0.710744
| 0.140496
| 0
| 0
| 1
| 0
| 0.150121
| 0.05569
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.307692
| 0
| 0.538462
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
92c39bcd73eb7b9f3010061b7c3106141036133d
| 111
|
py
|
Python
|
Coursera/Python for Everybody Specialization/Python for everybody basics/hourly rate.py
|
ejgarcia1991/Courses-and-other-non-professional-projects
|
94794dd1d6cf626de174330311e3fde4d10cd460
|
[
"MIT"
] | 1
|
2021-02-19T22:33:55.000Z
|
2021-02-19T22:33:55.000Z
|
Coursera/Python for Everybody Specialization/Python for everybody basics/hourly rate.py
|
ejgarcia1991/Courses-and-other-non-professional-projects
|
94794dd1d6cf626de174330311e3fde4d10cd460
|
[
"MIT"
] | null | null | null |
Coursera/Python for Everybody Specialization/Python for everybody basics/hourly rate.py
|
ejgarcia1991/Courses-and-other-non-professional-projects
|
94794dd1d6cf626de174330311e3fde4d10cd460
|
[
"MIT"
] | null | null | null |
hrs = input("Enter Hours:")
rate = input("Enter rate:")
pay = float(hrs) * float(rate)
print("Pay: " +str(pay))
| 27.75
| 30
| 0.630631
| 17
| 111
| 4.117647
| 0.529412
| 0.285714
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.135135
| 111
| 4
| 31
| 27.75
| 0.729167
| 0
| 0
| 0
| 0
| 0
| 0.25
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.25
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
92d06ca78c4166453aab94fc3bfe5663b950cc53
| 261
|
py
|
Python
|
XMLHttpRequest/resources/shift-jis-html.py
|
watilde/web-platform-tests
|
97e16bef6d6599ae805521e2007a9430a12aa144
|
[
"BSD-3-Clause"
] | 4
|
2020-09-09T15:28:01.000Z
|
2021-12-01T00:59:56.000Z
|
XMLHttpRequest/resources/shift-jis-html.py
|
watilde/web-platform-tests
|
97e16bef6d6599ae805521e2007a9430a12aa144
|
[
"BSD-3-Clause"
] | 1
|
2021-03-31T20:23:55.000Z
|
2021-03-31T20:23:55.000Z
|
XMLHttpRequest/resources/shift-jis-html.py
|
watilde/web-platform-tests
|
97e16bef6d6599ae805521e2007a9430a12aa144
|
[
"BSD-3-Clause"
] | 1
|
2020-03-31T17:20:54.000Z
|
2020-03-31T17:20:54.000Z
|
def main(request, response):
headers = [("Content-type", "text/html;charset=shift-jis")]
# Shift-JIS bytes for katakana TE SU TO ('test')
content = chr(0x83) + chr(0x65) + chr(0x83) + chr(0x58) + chr(0x83) + chr(0x67);
return headers, content
| 37.285714
| 85
| 0.636015
| 37
| 261
| 4.486486
| 0.675676
| 0.126506
| 0.180723
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.085308
| 0.191571
| 261
| 6
| 86
| 43.5
| 0.701422
| 0.176245
| 0
| 0
| 0
| 0
| 0.183099
| 0.126761
| 0
| 0
| 0.112676
| 0
| 0
| 1
| 0.25
| false
| 0
| 0
| 0
| 0.5
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
92dadd375392924dd104471b2991098481772c78
| 132
|
py
|
Python
|
mspray/apps/reveal/__init__.py
|
onaio/mspray
|
b3e0f4b5855abbf0298de6b66f2e9f472f2bf838
|
[
"Apache-2.0"
] | null | null | null |
mspray/apps/reveal/__init__.py
|
onaio/mspray
|
b3e0f4b5855abbf0298de6b66f2e9f472f2bf838
|
[
"Apache-2.0"
] | 76
|
2018-03-15T09:37:56.000Z
|
2019-05-15T12:45:51.000Z
|
mspray/apps/reveal/__init__.py
|
onaio/mspray
|
b3e0f4b5855abbf0298de6b66f2e9f472f2bf838
|
[
"Apache-2.0"
] | 1
|
2020-10-31T07:15:22.000Z
|
2020-10-31T07:15:22.000Z
|
"""init module for reveal app"""
# pylint: disable=invalid-name
default_app_config = "mspray.apps.reveal.apps.RevealConfig" # noqa
| 33
| 67
| 0.757576
| 18
| 132
| 5.444444
| 0.833333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.106061
| 132
| 3
| 68
| 44
| 0.830508
| 0.462121
| 0
| 0
| 0
| 0
| 0.5625
| 0.5625
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
130f1aca25388c2ce8dd308d2bb872e5263f8305
| 140
|
py
|
Python
|
Escolas/Curso em Video/Back-End/Curso de Python/Mundos/Mundo 01/Exercicio_16.py
|
c4st1lh0/Projetos-de-Aula
|
e8abc9f4bce6cc8dbc6d7fb5da0f549ac8ef5302
|
[
"MIT"
] | null | null | null |
Escolas/Curso em Video/Back-End/Curso de Python/Mundos/Mundo 01/Exercicio_16.py
|
c4st1lh0/Projetos-de-Aula
|
e8abc9f4bce6cc8dbc6d7fb5da0f549ac8ef5302
|
[
"MIT"
] | null | null | null |
Escolas/Curso em Video/Back-End/Curso de Python/Mundos/Mundo 01/Exercicio_16.py
|
c4st1lh0/Projetos-de-Aula
|
e8abc9f4bce6cc8dbc6d7fb5da0f549ac8ef5302
|
[
"MIT"
] | null | null | null |
import math
num = float(input('Digite um numero real qualquer: '))
print('O numero: {} tem a parte inteira {}'.format(num, math.trunc(num)))
| 46.666667
| 73
| 0.7
| 22
| 140
| 4.454545
| 0.818182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.128571
| 140
| 3
| 73
| 46.666667
| 0.803279
| 0
| 0
| 0
| 0
| 0
| 0.475177
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0.333333
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
131a15a3a8feaf503c53fb7ce15a6a9a4850f413
| 37,988
|
py
|
Python
|
mfem/_par/gridfunc.py
|
mfem/PyMFEM
|
b7b7c3d3de1082eac1015e3a313cf513db06fd7b
|
[
"BSD-3-Clause"
] | 93
|
2017-03-01T16:45:33.000Z
|
2022-03-27T22:10:33.000Z
|
mfem/_par/gridfunc.py
|
mfem/PyMFEM
|
b7b7c3d3de1082eac1015e3a313cf513db06fd7b
|
[
"BSD-3-Clause"
] | 64
|
2017-03-15T21:47:31.000Z
|
2022-03-31T23:59:00.000Z
|
mfem/_par/gridfunc.py
|
mfem/PyMFEM
|
b7b7c3d3de1082eac1015e3a313cf513db06fd7b
|
[
"BSD-3-Clause"
] | 32
|
2017-03-02T22:13:38.000Z
|
2022-03-26T13:09:31.000Z
|
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")
# Import the low-level C/C++ module
if __package__ or "." in __name__:
from . import _gridfunc
else:
import _gridfunc
try:
import builtins as __builtin__
except ImportError:
import __builtin__
_swig_new_instance_method = _gridfunc.SWIG_PyInstanceMethod_New
_swig_new_static_method = _gridfunc.SWIG_PyStaticMethod_New
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_setattr_nondynamic_instance_variable(set):
def set_instance_attr(self, name, value):
if name == "thisown":
self.this.own(value)
elif name == "this":
set(self, name, value)
elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
set(self, name, value)
else:
raise AttributeError("You cannot add instance attributes to %s" % self)
return set_instance_attr
def _swig_setattr_nondynamic_class_variable(set):
def set_class_attr(cls, name, value):
if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
set(cls, name, value)
else:
raise AttributeError("You cannot add class attributes to %s" % cls)
return set_class_attr
def _swig_add_metaclass(metaclass):
"""Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
def wrapper(cls):
return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
return wrapper
class _SwigNonDynamicMeta(type):
"""Meta class to enforce nondynamic attributes (no new attributes) for a class"""
__setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
import weakref
import mfem._par.array
import mfem._par.mem_manager
import mfem._par.vector
import mfem._par.coefficient
import mfem._par.globals
import mfem._par.matrix
import mfem._par.operators
import mfem._par.intrules
import mfem._par.sparsemat
import mfem._par.densemat
import mfem._par.eltrans
import mfem._par.fe
import mfem._par.geom
import mfem._par.fespace
import mfem._par.mesh
import mfem._par.sort_pairs
import mfem._par.ncmesh
import mfem._par.vtk
import mfem._par.element
import mfem._par.table
import mfem._par.hash
import mfem._par.vertex
import mfem._par.fe_coll
import mfem._par.lininteg
import mfem._par.handle
import mfem._par.hypre
import mfem._par.restriction
import mfem._par.bilininteg
import mfem._par.linearform
import mfem._par.nonlininteg
class GridFunction(mfem._par.vector.Vector):
r"""Proxy of C++ mfem::GridFunction class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def MakeOwner(self, fec_):
r"""MakeOwner(GridFunction self, FiniteElementCollection fec_)"""
return _gridfunc.GridFunction_MakeOwner(self, fec_)
MakeOwner = _swig_new_instance_method(_gridfunc.GridFunction_MakeOwner)
def OwnFEC(self):
r"""OwnFEC(GridFunction self) -> FiniteElementCollection"""
return _gridfunc.GridFunction_OwnFEC(self)
OwnFEC = _swig_new_instance_method(_gridfunc.GridFunction_OwnFEC)
def VectorDim(self):
r"""VectorDim(GridFunction self) -> int"""
return _gridfunc.GridFunction_VectorDim(self)
VectorDim = _swig_new_instance_method(_gridfunc.GridFunction_VectorDim)
def GetTrueVector(self, *args):
r"""
GetTrueVector(GridFunction self) -> Vector
GetTrueVector(GridFunction self) -> Vector
"""
return _gridfunc.GridFunction_GetTrueVector(self, *args)
GetTrueVector = _swig_new_instance_method(_gridfunc.GridFunction_GetTrueVector)
def GetTrueDofs(self, tv):
r"""GetTrueDofs(GridFunction self, Vector tv)"""
return _gridfunc.GridFunction_GetTrueDofs(self, tv)
GetTrueDofs = _swig_new_instance_method(_gridfunc.GridFunction_GetTrueDofs)
def SetTrueVector(self):
r"""SetTrueVector(GridFunction self)"""
return _gridfunc.GridFunction_SetTrueVector(self)
SetTrueVector = _swig_new_instance_method(_gridfunc.GridFunction_SetTrueVector)
def SetFromTrueDofs(self, tv):
r"""SetFromTrueDofs(GridFunction self, Vector tv)"""
return _gridfunc.GridFunction_SetFromTrueDofs(self, tv)
SetFromTrueDofs = _swig_new_instance_method(_gridfunc.GridFunction_SetFromTrueDofs)
def SetFromTrueVector(self):
r"""SetFromTrueVector(GridFunction self)"""
return _gridfunc.GridFunction_SetFromTrueVector(self)
SetFromTrueVector = _swig_new_instance_method(_gridfunc.GridFunction_SetFromTrueVector)
def GetValue(self, *args):
r"""
GetValue(GridFunction self, int i, IntegrationPoint ip, int vdim=1) -> double
GetValue(GridFunction self, ElementTransformation T, IntegrationPoint ip, int comp=0, Vector tr=None) -> double
"""
return _gridfunc.GridFunction_GetValue(self, *args)
GetValue = _swig_new_instance_method(_gridfunc.GridFunction_GetValue)
def GetVectorValue(self, *args):
r"""
GetVectorValue(GridFunction self, int i, IntegrationPoint ip, Vector val)
GetVectorValue(GridFunction self, ElementTransformation T, IntegrationPoint ip, Vector val, Vector tr=None)
"""
return _gridfunc.GridFunction_GetVectorValue(self, *args)
GetVectorValue = _swig_new_instance_method(_gridfunc.GridFunction_GetVectorValue)
def GetValues(self, *args):
r"""
GetValues(GridFunction self, int i, IntegrationRule ir, Vector vals, int vdim=1)
GetValues(GridFunction self, int i, IntegrationRule ir, Vector vals, DenseMatrix tr, int vdim=1)
GetValues(GridFunction self, ElementTransformation T, IntegrationRule ir, Vector vals, int comp=0, DenseMatrix tr=None)
"""
return _gridfunc.GridFunction_GetValues(self, *args)
GetValues = _swig_new_instance_method(_gridfunc.GridFunction_GetValues)
def GetVectorValues(self, *args):
r"""
GetVectorValues(GridFunction self, int i, IntegrationRule ir, DenseMatrix vals, DenseMatrix tr)
GetVectorValues(GridFunction self, ElementTransformation T, IntegrationRule ir, DenseMatrix vals, DenseMatrix tr=None)
"""
return _gridfunc.GridFunction_GetVectorValues(self, *args)
GetVectorValues = _swig_new_instance_method(_gridfunc.GridFunction_GetVectorValues)
def GetFaceValues(self, i, side, ir, vals, tr, vdim=1):
r"""GetFaceValues(GridFunction self, int i, int side, IntegrationRule ir, Vector vals, DenseMatrix tr, int vdim=1) -> int"""
return _gridfunc.GridFunction_GetFaceValues(self, i, side, ir, vals, tr, vdim)
GetFaceValues = _swig_new_instance_method(_gridfunc.GridFunction_GetFaceValues)
def GetFaceVectorValues(self, i, side, ir, vals, tr):
r"""GetFaceVectorValues(GridFunction self, int i, int side, IntegrationRule ir, DenseMatrix vals, DenseMatrix tr) -> int"""
return _gridfunc.GridFunction_GetFaceVectorValues(self, i, side, ir, vals, tr)
GetFaceVectorValues = _swig_new_instance_method(_gridfunc.GridFunction_GetFaceVectorValues)
def GetLaplacians(self, *args):
r"""
GetLaplacians(GridFunction self, int i, IntegrationRule ir, Vector laps, int vdim=1)
GetLaplacians(GridFunction self, int i, IntegrationRule ir, Vector laps, DenseMatrix tr, int vdim=1)
"""
return _gridfunc.GridFunction_GetLaplacians(self, *args)
GetLaplacians = _swig_new_instance_method(_gridfunc.GridFunction_GetLaplacians)
def GetHessians(self, *args):
r"""
GetHessians(GridFunction self, int i, IntegrationRule ir, DenseMatrix hess, int vdim=1)
GetHessians(GridFunction self, int i, IntegrationRule ir, DenseMatrix hess, DenseMatrix tr, int vdim=1)
"""
return _gridfunc.GridFunction_GetHessians(self, *args)
GetHessians = _swig_new_instance_method(_gridfunc.GridFunction_GetHessians)
def GetValuesFrom(self, orig_func):
r"""GetValuesFrom(GridFunction self, GridFunction orig_func)"""
return _gridfunc.GridFunction_GetValuesFrom(self, orig_func)
GetValuesFrom = _swig_new_instance_method(_gridfunc.GridFunction_GetValuesFrom)
def GetBdrValuesFrom(self, orig_func):
r"""GetBdrValuesFrom(GridFunction self, GridFunction orig_func)"""
return _gridfunc.GridFunction_GetBdrValuesFrom(self, orig_func)
GetBdrValuesFrom = _swig_new_instance_method(_gridfunc.GridFunction_GetBdrValuesFrom)
def GetVectorFieldValues(self, i, ir, vals, tr, comp=0):
r"""GetVectorFieldValues(GridFunction self, int i, IntegrationRule ir, DenseMatrix vals, DenseMatrix tr, int comp=0)"""
return _gridfunc.GridFunction_GetVectorFieldValues(self, i, ir, vals, tr, comp)
GetVectorFieldValues = _swig_new_instance_method(_gridfunc.GridFunction_GetVectorFieldValues)
def ReorderByNodes(self):
r"""ReorderByNodes(GridFunction self)"""
return _gridfunc.GridFunction_ReorderByNodes(self)
ReorderByNodes = _swig_new_instance_method(_gridfunc.GridFunction_ReorderByNodes)
def GetNodalValues(self, *args):
'''
GetNodalValues(i) -> GetNodalValues(vector, vdim)
GetNodalValues(i, array<dobule>, vdim)
'''
from .vector import Vector
if len(args) == 1:
vec = Vector()
_gridfunc.GridFunction_GetNodalValues(self, vec, args[0])
vec.thisown = 0
return vec.GetDataArray()
else:
return _gridfunc.GridFunction_GetNodalValues(self, *args)
def GetVectorFieldNodalValues(self, val, comp):
r"""GetVectorFieldNodalValues(GridFunction self, Vector val, int comp)"""
return _gridfunc.GridFunction_GetVectorFieldNodalValues(self, val, comp)
GetVectorFieldNodalValues = _swig_new_instance_method(_gridfunc.GridFunction_GetVectorFieldNodalValues)
def ProjectVectorFieldOn(self, vec_field, comp=0):
r"""ProjectVectorFieldOn(GridFunction self, GridFunction vec_field, int comp=0)"""
return _gridfunc.GridFunction_ProjectVectorFieldOn(self, vec_field, comp)
ProjectVectorFieldOn = _swig_new_instance_method(_gridfunc.GridFunction_ProjectVectorFieldOn)
def GetDerivative(self, comp, der_comp, der):
r"""GetDerivative(GridFunction self, int comp, int der_comp, GridFunction der)"""
return _gridfunc.GridFunction_GetDerivative(self, comp, der_comp, der)
GetDerivative = _swig_new_instance_method(_gridfunc.GridFunction_GetDerivative)
def GetDivergence(self, tr):
r"""GetDivergence(GridFunction self, ElementTransformation tr) -> double"""
return _gridfunc.GridFunction_GetDivergence(self, tr)
GetDivergence = _swig_new_instance_method(_gridfunc.GridFunction_GetDivergence)
def GetCurl(self, tr, curl):
r"""GetCurl(GridFunction self, ElementTransformation tr, Vector curl)"""
return _gridfunc.GridFunction_GetCurl(self, tr, curl)
GetCurl = _swig_new_instance_method(_gridfunc.GridFunction_GetCurl)
def GetGradient(self, tr, grad):
r"""GetGradient(GridFunction self, ElementTransformation tr, Vector grad)"""
return _gridfunc.GridFunction_GetGradient(self, tr, grad)
GetGradient = _swig_new_instance_method(_gridfunc.GridFunction_GetGradient)
def GetGradients(self, *args):
r"""
GetGradients(GridFunction self, ElementTransformation tr, IntegrationRule ir, DenseMatrix grad)
GetGradients(GridFunction self, int const elem, IntegrationRule ir, DenseMatrix grad)
"""
return _gridfunc.GridFunction_GetGradients(self, *args)
GetGradients = _swig_new_instance_method(_gridfunc.GridFunction_GetGradients)
def GetVectorGradient(self, tr, grad):
r"""GetVectorGradient(GridFunction self, ElementTransformation tr, DenseMatrix grad)"""
return _gridfunc.GridFunction_GetVectorGradient(self, tr, grad)
GetVectorGradient = _swig_new_instance_method(_gridfunc.GridFunction_GetVectorGradient)
def GetElementAverages(self, avgs):
r"""GetElementAverages(GridFunction self, GridFunction avgs)"""
return _gridfunc.GridFunction_GetElementAverages(self, avgs)
GetElementAverages = _swig_new_instance_method(_gridfunc.GridFunction_GetElementAverages)
def GetElementDofValues(self, el, dof_vals):
r"""GetElementDofValues(GridFunction self, int el, Vector dof_vals)"""
return _gridfunc.GridFunction_GetElementDofValues(self, el, dof_vals)
GetElementDofValues = _swig_new_instance_method(_gridfunc.GridFunction_GetElementDofValues)
def ImposeBounds(self, *args):
r"""
ImposeBounds(GridFunction self, int i, Vector weights, Vector lo_, Vector hi_)
ImposeBounds(GridFunction self, int i, Vector weights, double min_=0.0, double max_=mfem::infinity())
"""
return _gridfunc.GridFunction_ImposeBounds(self, *args)
ImposeBounds = _swig_new_instance_method(_gridfunc.GridFunction_ImposeBounds)
def RestrictConforming(self):
r"""RestrictConforming(GridFunction self)"""
return _gridfunc.GridFunction_RestrictConforming(self)
RestrictConforming = _swig_new_instance_method(_gridfunc.GridFunction_RestrictConforming)
def ProjectGridFunction(self, src):
r"""ProjectGridFunction(GridFunction self, GridFunction src)"""
return _gridfunc.GridFunction_ProjectGridFunction(self, src)
ProjectGridFunction = _swig_new_instance_method(_gridfunc.GridFunction_ProjectGridFunction)
def ProjectCoefficient(self, *args):
r"""
ProjectCoefficient(GridFunction self, Coefficient coeff)
ProjectCoefficient(GridFunction self, Coefficient coeff, intArray dofs, int vd=0)
ProjectCoefficient(GridFunction self, VectorCoefficient vcoeff)
ProjectCoefficient(GridFunction self, VectorCoefficient vcoeff, intArray dofs)
ProjectCoefficient(GridFunction self, VectorCoefficient vcoeff, int attribute)
ProjectCoefficient(GridFunction self, mfem::Coefficient *[] coeff)
"""
return _gridfunc.GridFunction_ProjectCoefficient(self, *args)
ProjectCoefficient = _swig_new_instance_method(_gridfunc.GridFunction_ProjectCoefficient)
ARITHMETIC = _gridfunc.GridFunction_ARITHMETIC
HARMONIC = _gridfunc.GridFunction_HARMONIC
def ProjectDiscCoefficient(self, *args):
r"""
ProjectDiscCoefficient(GridFunction self, VectorCoefficient coeff)
ProjectDiscCoefficient(GridFunction self, Coefficient coeff, mfem::GridFunction::AvgType type)
ProjectDiscCoefficient(GridFunction self, VectorCoefficient coeff, mfem::GridFunction::AvgType type)
"""
return _gridfunc.GridFunction_ProjectDiscCoefficient(self, *args)
ProjectDiscCoefficient = _swig_new_instance_method(_gridfunc.GridFunction_ProjectDiscCoefficient)
def ProjectBdrCoefficient(self, *args):
r"""
ProjectBdrCoefficient(GridFunction self, Coefficient coeff, intArray attr)
ProjectBdrCoefficient(GridFunction self, VectorCoefficient vcoeff, intArray attr)
ProjectBdrCoefficient(GridFunction self, mfem::Coefficient *[] coeff, intArray attr)
"""
return _gridfunc.GridFunction_ProjectBdrCoefficient(self, *args)
ProjectBdrCoefficient = _swig_new_instance_method(_gridfunc.GridFunction_ProjectBdrCoefficient)
def ProjectBdrCoefficientNormal(self, vcoeff, bdr_attr):
r"""ProjectBdrCoefficientNormal(GridFunction self, VectorCoefficient vcoeff, intArray bdr_attr)"""
return _gridfunc.GridFunction_ProjectBdrCoefficientNormal(self, vcoeff, bdr_attr)
ProjectBdrCoefficientNormal = _swig_new_instance_method(_gridfunc.GridFunction_ProjectBdrCoefficientNormal)
def ProjectBdrCoefficientTangent(self, vcoeff, bdr_attr):
r"""ProjectBdrCoefficientTangent(GridFunction self, VectorCoefficient vcoeff, intArray bdr_attr)"""
return _gridfunc.GridFunction_ProjectBdrCoefficientTangent(self, vcoeff, bdr_attr)
ProjectBdrCoefficientTangent = _swig_new_instance_method(_gridfunc.GridFunction_ProjectBdrCoefficientTangent)
def ComputeL2Error(self, *args):
r"""
ComputeL2Error(GridFunction self, Coefficient exsol, mfem::IntegrationRule const *[] irs=0) -> double
ComputeL2Error(GridFunction self, mfem::Coefficient *[] exsol, mfem::IntegrationRule const *[] irs=0) -> double
ComputeL2Error(GridFunction self, VectorCoefficient exsol, mfem::IntegrationRule const *[] irs=0, intArray elems=None) -> double
"""
return _gridfunc.GridFunction_ComputeL2Error(self, *args)
ComputeL2Error = _swig_new_instance_method(_gridfunc.GridFunction_ComputeL2Error)
def ComputeGradError(self, exgrad, irs=0):
r"""ComputeGradError(GridFunction self, VectorCoefficient exgrad, mfem::IntegrationRule const *[] irs=0) -> double"""
return _gridfunc.GridFunction_ComputeGradError(self, exgrad, irs)
ComputeGradError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeGradError)
def ComputeCurlError(self, excurl, irs=0):
r"""ComputeCurlError(GridFunction self, VectorCoefficient excurl, mfem::IntegrationRule const *[] irs=0) -> double"""
return _gridfunc.GridFunction_ComputeCurlError(self, excurl, irs)
ComputeCurlError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeCurlError)
def ComputeDivError(self, exdiv, irs=0):
r"""ComputeDivError(GridFunction self, Coefficient exdiv, mfem::IntegrationRule const *[] irs=0) -> double"""
return _gridfunc.GridFunction_ComputeDivError(self, exdiv, irs)
ComputeDivError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeDivError)
def ComputeDGFaceJumpError(self, *args):
r"""
ComputeDGFaceJumpError(GridFunction self, Coefficient exsol, Coefficient ell_coeff, JumpScaling jump_scaling, mfem::IntegrationRule const *[] irs=0) -> double
ComputeDGFaceJumpError(GridFunction self, Coefficient exsol, Coefficient ell_coeff, double Nu, mfem::IntegrationRule const *[] irs=0) -> double
"""
return _gridfunc.GridFunction_ComputeDGFaceJumpError(self, *args)
ComputeDGFaceJumpError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeDGFaceJumpError)
def ComputeH1Error(self, *args):
r"""
ComputeH1Error(GridFunction self, Coefficient exsol, VectorCoefficient exgrad, Coefficient ell_coef, double Nu, int norm_type) -> double
ComputeH1Error(GridFunction self, Coefficient exsol, VectorCoefficient exgrad, mfem::IntegrationRule const *[] irs=0) -> double
"""
return _gridfunc.GridFunction_ComputeH1Error(self, *args)
ComputeH1Error = _swig_new_instance_method(_gridfunc.GridFunction_ComputeH1Error)
def ComputeHDivError(self, exsol, exdiv, irs=0):
r"""ComputeHDivError(GridFunction self, VectorCoefficient exsol, Coefficient exdiv, mfem::IntegrationRule const *[] irs=0) -> double"""
return _gridfunc.GridFunction_ComputeHDivError(self, exsol, exdiv, irs)
ComputeHDivError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeHDivError)
def ComputeHCurlError(self, exsol, excurl, irs=0):
r"""ComputeHCurlError(GridFunction self, VectorCoefficient exsol, VectorCoefficient excurl, mfem::IntegrationRule const *[] irs=0) -> double"""
return _gridfunc.GridFunction_ComputeHCurlError(self, exsol, excurl, irs)
ComputeHCurlError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeHCurlError)
def ComputeMaxError(self, *args):
r"""
ComputeMaxError(GridFunction self, Coefficient exsol, mfem::IntegrationRule const *[] irs=0) -> double
ComputeMaxError(GridFunction self, mfem::Coefficient *[] exsol, mfem::IntegrationRule const *[] irs=0) -> double
ComputeMaxError(GridFunction self, VectorCoefficient exsol, mfem::IntegrationRule const *[] irs=0) -> double
"""
return _gridfunc.GridFunction_ComputeMaxError(self, *args)
ComputeMaxError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeMaxError)
def ComputeW11Error(self, exsol, exgrad, norm_type, elems=None, irs=0):
r"""ComputeW11Error(GridFunction self, Coefficient exsol, VectorCoefficient exgrad, int norm_type, intArray elems=None, mfem::IntegrationRule const *[] irs=0) -> double"""
return _gridfunc.GridFunction_ComputeW11Error(self, exsol, exgrad, norm_type, elems, irs)
ComputeW11Error = _swig_new_instance_method(_gridfunc.GridFunction_ComputeW11Error)
def ComputeL1Error(self, *args):
r"""
ComputeL1Error(GridFunction self, Coefficient exsol, mfem::IntegrationRule const *[] irs=0) -> double
ComputeL1Error(GridFunction self, VectorCoefficient exsol, mfem::IntegrationRule const *[] irs=0) -> double
"""
return _gridfunc.GridFunction_ComputeL1Error(self, *args)
ComputeL1Error = _swig_new_instance_method(_gridfunc.GridFunction_ComputeL1Error)
def ComputeLpError(self, *args):
r"""
ComputeLpError(GridFunction self, double const p, Coefficient exsol, Coefficient weight=None, mfem::IntegrationRule const *[] irs=0) -> double
ComputeLpError(GridFunction self, double const p, VectorCoefficient exsol, Coefficient weight=None, VectorCoefficient v_weight=None, mfem::IntegrationRule const *[] irs=0) -> double
"""
return _gridfunc.GridFunction_ComputeLpError(self, *args)
ComputeLpError = _swig_new_instance_method(_gridfunc.GridFunction_ComputeLpError)
def ComputeElementLpErrors(self, *args):
r"""
ComputeElementLpErrors(GridFunction self, double const p, Coefficient exsol, Vector error, Coefficient weight=None, mfem::IntegrationRule const *[] irs=0)
ComputeElementLpErrors(GridFunction self, double const p, VectorCoefficient exsol, Vector error, Coefficient weight=None, VectorCoefficient v_weight=None, mfem::IntegrationRule const *[] irs=0)
"""
return _gridfunc.GridFunction_ComputeElementLpErrors(self, *args)
ComputeElementLpErrors = _swig_new_instance_method(_gridfunc.GridFunction_ComputeElementLpErrors)
def ComputeElementL1Errors(self, *args):
r"""
ComputeElementL1Errors(GridFunction self, Coefficient exsol, Vector error, mfem::IntegrationRule const *[] irs=0)
ComputeElementL1Errors(GridFunction self, VectorCoefficient exsol, Vector error, mfem::IntegrationRule const *[] irs=0)
"""
return _gridfunc.GridFunction_ComputeElementL1Errors(self, *args)
ComputeElementL1Errors = _swig_new_instance_method(_gridfunc.GridFunction_ComputeElementL1Errors)
def ComputeElementL2Errors(self, *args):
r"""
ComputeElementL2Errors(GridFunction self, Coefficient exsol, Vector error, mfem::IntegrationRule const *[] irs=0)
ComputeElementL2Errors(GridFunction self, VectorCoefficient exsol, Vector error, mfem::IntegrationRule const *[] irs=0)
"""
return _gridfunc.GridFunction_ComputeElementL2Errors(self, *args)
ComputeElementL2Errors = _swig_new_instance_method(_gridfunc.GridFunction_ComputeElementL2Errors)
def ComputeElementMaxErrors(self, *args):
r"""
ComputeElementMaxErrors(GridFunction self, Coefficient exsol, Vector error, mfem::IntegrationRule const *[] irs=0)
ComputeElementMaxErrors(GridFunction self, VectorCoefficient exsol, Vector error, mfem::IntegrationRule const *[] irs=0)
"""
return _gridfunc.GridFunction_ComputeElementMaxErrors(self, *args)
ComputeElementMaxErrors = _swig_new_instance_method(_gridfunc.GridFunction_ComputeElementMaxErrors)
def ComputeFlux(self, blfi, flux, wcoef=True, subdomain=-1):
r"""ComputeFlux(GridFunction self, BilinearFormIntegrator blfi, GridFunction flux, bool wcoef=True, int subdomain=-1)"""
return _gridfunc.GridFunction_ComputeFlux(self, blfi, flux, wcoef, subdomain)
ComputeFlux = _swig_new_instance_method(_gridfunc.GridFunction_ComputeFlux)
def Assign(self, *args):
r"""
Assign(GridFunction self, GridFunction rhs) -> GridFunction
Assign(GridFunction self, double value) -> GridFunction
Assign(GridFunction self, Vector v) -> GridFunction
"""
return _gridfunc.GridFunction_Assign(self, *args)
Assign = _swig_new_instance_method(_gridfunc.GridFunction_Assign)
def Update(self):
r"""Update(GridFunction self)"""
return _gridfunc.GridFunction_Update(self)
Update = _swig_new_instance_method(_gridfunc.GridFunction_Update)
def FESpace(self, *args):
r"""
FESpace(GridFunction self) -> FiniteElementSpace
FESpace(GridFunction self) -> FiniteElementSpace
"""
return _gridfunc.GridFunction_FESpace(self, *args)
FESpace = _swig_new_instance_method(_gridfunc.GridFunction_FESpace)
def SetSpace(self, f):
r"""SetSpace(GridFunction self, FiniteElementSpace f)"""
return _gridfunc.GridFunction_SetSpace(self, f)
SetSpace = _swig_new_instance_method(_gridfunc.GridFunction_SetSpace)
def MakeRef(self, *args):
r"""
MakeRef(GridFunction self, Vector base, int offset, int size)
MakeRef(GridFunction self, Vector base, int offset)
MakeRef(GridFunction self, FiniteElementSpace f, double * v)
MakeRef(GridFunction self, FiniteElementSpace f, Vector v, int v_offset)
"""
return _gridfunc.GridFunction_MakeRef(self, *args)
MakeRef = _swig_new_instance_method(_gridfunc.GridFunction_MakeRef)
def MakeTRef(self, *args):
r"""
MakeTRef(GridFunction self, FiniteElementSpace f, double * tv)
MakeTRef(GridFunction self, FiniteElementSpace f, Vector tv, int tv_offset)
"""
return _gridfunc.GridFunction_MakeTRef(self, *args)
MakeTRef = _swig_new_instance_method(_gridfunc.GridFunction_MakeTRef)
def SaveVTK(self, out, field_name, ref):
r"""SaveVTK(GridFunction self, std::ostream & out, std::string const & field_name, int ref)"""
return _gridfunc.GridFunction_SaveVTK(self, out, field_name, ref)
SaveVTK = _swig_new_instance_method(_gridfunc.GridFunction_SaveVTK)
def SaveSTL(self, out, TimesToRefine=1):
r"""SaveSTL(GridFunction self, std::ostream & out, int TimesToRefine=1)"""
return _gridfunc.GridFunction_SaveSTL(self, out, TimesToRefine)
SaveSTL = _swig_new_instance_method(_gridfunc.GridFunction_SaveSTL)
__swig_destroy__ = _gridfunc.delete_GridFunction
def __init__(self, *args):
r"""
__init__(GridFunction self) -> GridFunction
__init__(GridFunction self, GridFunction orig) -> GridFunction
__init__(GridFunction self, FiniteElementSpace f) -> GridFunction
__init__(GridFunction self, FiniteElementSpace f, double * data) -> GridFunction
__init__(GridFunction self, Mesh m, std::istream & input) -> GridFunction
__init__(GridFunction self, Mesh m, mfem::GridFunction *[] gf_array, int num_pieces) -> GridFunction
__init__(GridFunction self, FiniteElementSpace fes, Vector v, int offset) -> GridFunction
"""
_gridfunc.GridFunction_swiginit(self, _gridfunc.new_GridFunction(*args))
def SaveToFile(self, gf_file, precision):
r"""SaveToFile(GridFunction self, char const * gf_file, int const precision)"""
return _gridfunc.GridFunction_SaveToFile(self, gf_file, precision)
SaveToFile = _swig_new_instance_method(_gridfunc.GridFunction_SaveToFile)
def WriteToStream(self, StringIO):
r"""WriteToStream(GridFunction self, PyObject * StringIO) -> PyObject *"""
return _gridfunc.GridFunction_WriteToStream(self, StringIO)
WriteToStream = _swig_new_instance_method(_gridfunc.GridFunction_WriteToStream)
def iadd(self, c):
r"""iadd(GridFunction self, GridFunction c) -> GridFunction"""
return _gridfunc.GridFunction_iadd(self, c)
iadd = _swig_new_instance_method(_gridfunc.GridFunction_iadd)
def isub(self, *args):
r"""
isub(GridFunction self, GridFunction c) -> GridFunction
isub(GridFunction self, double c) -> GridFunction
"""
return _gridfunc.GridFunction_isub(self, *args)
isub = _swig_new_instance_method(_gridfunc.GridFunction_isub)
def imul(self, c):
r"""imul(GridFunction self, double c) -> GridFunction"""
return _gridfunc.GridFunction_imul(self, c)
imul = _swig_new_instance_method(_gridfunc.GridFunction_imul)
def idiv(self, c):
r"""idiv(GridFunction self, double c) -> GridFunction"""
return _gridfunc.GridFunction_idiv(self, c)
idiv = _swig_new_instance_method(_gridfunc.GridFunction_idiv)
def Save(self, *args):
r"""
Save(GridFunction self, std::ostream & out)
Save(GridFunction self, char const * fname, int precision=16)
Save(GridFunction self, char const * file, int precision=16)
"""
return _gridfunc.GridFunction_Save(self, *args)
Save = _swig_new_instance_method(_gridfunc.GridFunction_Save)
def SaveGZ(self, file, precision=16):
r"""SaveGZ(GridFunction self, char const * file, int precision=16)"""
return _gridfunc.GridFunction_SaveGZ(self, file, precision)
SaveGZ = _swig_new_instance_method(_gridfunc.GridFunction_SaveGZ)
# Register GridFunction in _gridfunc:
_gridfunc.GridFunction_swigregister(GridFunction)
class JumpScaling(object):
r"""Proxy of C++ mfem::JumpScaling class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
CONSTANT = _gridfunc.JumpScaling_CONSTANT
ONE_OVER_H = _gridfunc.JumpScaling_ONE_OVER_H
P_SQUARED_OVER_H = _gridfunc.JumpScaling_P_SQUARED_OVER_H
def __init__(self, *args, **kwargs):
r"""__init__(JumpScaling self, double nu_=1.0, mfem::JumpScaling::JumpScalingType type_=CONSTANT) -> JumpScaling"""
_gridfunc.JumpScaling_swiginit(self, _gridfunc.new_JumpScaling(*args, **kwargs))
def Eval(self, h, p):
r"""Eval(JumpScaling self, double h, int p) -> double"""
return _gridfunc.JumpScaling_Eval(self, h, p)
Eval = _swig_new_instance_method(_gridfunc.JumpScaling_Eval)
__swig_destroy__ = _gridfunc.delete_JumpScaling
# Register JumpScaling in _gridfunc:
_gridfunc.JumpScaling_swigregister(JumpScaling)
class QuadratureFunction(mfem._par.vector.Vector):
r"""Proxy of C++ mfem::QuadratureFunction class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, *args):
r"""
__init__(QuadratureFunction self) -> QuadratureFunction
__init__(QuadratureFunction self, QuadratureFunction orig) -> QuadratureFunction
__init__(QuadratureFunction self, QuadratureSpace qspace_, int vdim_=1) -> QuadratureFunction
__init__(QuadratureFunction self, QuadratureSpace qspace_, double * qf_data, int vdim_=1) -> QuadratureFunction
__init__(QuadratureFunction self, Mesh mesh, std::istream & _in) -> QuadratureFunction
"""
_gridfunc.QuadratureFunction_swiginit(self, _gridfunc.new_QuadratureFunction(*args))
__swig_destroy__ = _gridfunc.delete_QuadratureFunction
def GetSpace(self):
r"""GetSpace(QuadratureFunction self) -> QuadratureSpace"""
return _gridfunc.QuadratureFunction_GetSpace(self)
GetSpace = _swig_new_instance_method(_gridfunc.QuadratureFunction_GetSpace)
def SetSpace(self, *args):
r"""
SetSpace(QuadratureFunction self, QuadratureSpace qspace_, int vdim_=-1)
SetSpace(QuadratureFunction self, QuadratureSpace qspace_, double * qf_data, int vdim_=-1)
"""
return _gridfunc.QuadratureFunction_SetSpace(self, *args)
SetSpace = _swig_new_instance_method(_gridfunc.QuadratureFunction_SetSpace)
def GetVDim(self):
r"""GetVDim(QuadratureFunction self) -> int"""
return _gridfunc.QuadratureFunction_GetVDim(self)
GetVDim = _swig_new_instance_method(_gridfunc.QuadratureFunction_GetVDim)
def SetVDim(self, vdim_):
r"""SetVDim(QuadratureFunction self, int vdim_)"""
return _gridfunc.QuadratureFunction_SetVDim(self, vdim_)
SetVDim = _swig_new_instance_method(_gridfunc.QuadratureFunction_SetVDim)
def OwnsSpace(self):
r"""OwnsSpace(QuadratureFunction self) -> bool"""
return _gridfunc.QuadratureFunction_OwnsSpace(self)
OwnsSpace = _swig_new_instance_method(_gridfunc.QuadratureFunction_OwnsSpace)
def SetOwnsSpace(self, own):
r"""SetOwnsSpace(QuadratureFunction self, bool own)"""
return _gridfunc.QuadratureFunction_SetOwnsSpace(self, own)
SetOwnsSpace = _swig_new_instance_method(_gridfunc.QuadratureFunction_SetOwnsSpace)
def GetElementIntRule(self, idx):
r"""GetElementIntRule(QuadratureFunction self, int idx) -> IntegrationRule"""
return _gridfunc.QuadratureFunction_GetElementIntRule(self, idx)
GetElementIntRule = _swig_new_instance_method(_gridfunc.QuadratureFunction_GetElementIntRule)
def GetElementValues(self, *args):
r"""
GetElementValues(QuadratureFunction self, int idx, Vector values)
GetElementValues(QuadratureFunction self, int idx, Vector values)
GetElementValues(QuadratureFunction self, int idx, int const ip_num, Vector values)
GetElementValues(QuadratureFunction self, int idx, int const ip_num, Vector values)
GetElementValues(QuadratureFunction self, int idx, DenseMatrix values)
GetElementValues(QuadratureFunction self, int idx, DenseMatrix values)
"""
return _gridfunc.QuadratureFunction_GetElementValues(self, *args)
GetElementValues = _swig_new_instance_method(_gridfunc.QuadratureFunction_GetElementValues)
def Save(self, *args):
r"""
Save(QuadratureFunction self, std::ostream & out)
Save(QuadratureFunction self, char const * file, int precision=16)
"""
return _gridfunc.QuadratureFunction_Save(self, *args)
Save = _swig_new_instance_method(_gridfunc.QuadratureFunction_Save)
def SaveGZ(self, file, precision=16):
r"""SaveGZ(QuadratureFunction self, char const * file, int precision=16)"""
return _gridfunc.QuadratureFunction_SaveGZ(self, file, precision)
SaveGZ = _swig_new_instance_method(_gridfunc.QuadratureFunction_SaveGZ)
# Register QuadratureFunction in _gridfunc:
_gridfunc.QuadratureFunction_swigregister(QuadratureFunction)
def __lshift__(*args):
r"""
__lshift__(std::ostream & os, SparseMatrix mat) -> std::ostream
__lshift__(std::ostream & out, Mesh mesh) -> std::ostream
__lshift__(std::ostream & out, GridFunction sol) -> std::ostream
__lshift__(std::ostream & out, QuadratureFunction qf) -> std::ostream &
"""
return _gridfunc.__lshift__(*args)
__lshift__ = _gridfunc.__lshift__
def ZZErrorEstimator(blfi, u, flux, error_estimates, aniso_flags=None, with_subdomains=1, with_coeff=False):
r"""ZZErrorEstimator(BilinearFormIntegrator blfi, GridFunction u, GridFunction flux, Vector error_estimates, intArray aniso_flags=None, int with_subdomains=1, bool with_coeff=False) -> double"""
return _gridfunc.ZZErrorEstimator(blfi, u, flux, error_estimates, aniso_flags, with_subdomains, with_coeff)
ZZErrorEstimator = _gridfunc.ZZErrorEstimator
def ComputeElementLpDistance(p, i, gf1, gf2):
r"""ComputeElementLpDistance(double p, int i, GridFunction gf1, GridFunction gf2) -> double"""
return _gridfunc.ComputeElementLpDistance(p, i, gf1, gf2)
ComputeElementLpDistance = _gridfunc.ComputeElementLpDistance
class ExtrudeCoefficient(mfem._par.coefficient.Coefficient):
r"""Proxy of C++ mfem::ExtrudeCoefficient class."""
thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, m, s, n_):
r"""__init__(ExtrudeCoefficient self, Mesh m, Coefficient s, int n_) -> ExtrudeCoefficient"""
_gridfunc.ExtrudeCoefficient_swiginit(self, _gridfunc.new_ExtrudeCoefficient(m, s, n_))
def Eval(self, T, ip):
r"""Eval(ExtrudeCoefficient self, ElementTransformation T, IntegrationPoint ip) -> double"""
return _gridfunc.ExtrudeCoefficient_Eval(self, T, ip)
Eval = _swig_new_instance_method(_gridfunc.ExtrudeCoefficient_Eval)
__swig_destroy__ = _gridfunc.delete_ExtrudeCoefficient
# Register ExtrudeCoefficient in _gridfunc:
_gridfunc.ExtrudeCoefficient_swigregister(ExtrudeCoefficient)
def Extrude1DGridFunction(mesh, mesh2d, sol, ny):
r"""Extrude1DGridFunction(Mesh mesh, Mesh mesh2d, GridFunction sol, int const ny) -> GridFunction"""
return _gridfunc.Extrude1DGridFunction(mesh, mesh2d, sol, ny)
Extrude1DGridFunction = _gridfunc.Extrude1DGridFunction
def __iadd__(self, v):
ret = _gridfunc.GridFunction_iadd(self, v)
ret.thisown = 0
return self
def __isub__(self, v):
ret = _gridfunc.GridFunction_isub(self, v)
ret.thisown = 0
return self
def __idiv__(self, v):
ret = _gridfunc.GridFunction_idiv(self, v)
ret.thisown = 0
return self
def __imul__(self, v):
ret = _gridfunc.GridFunction_imul(self, v)
ret.thisown = 0
return self
GridFunction.__iadd__ = __iadd__
GridFunction.__idiv__ = __idiv__
GridFunction.__isub__ = __isub__
GridFunction.__imul__ = __imul__
| 49.335065
| 201
| 0.740076
| 3,960
| 37,988
| 6.804545
| 0.095707
| 0.112818
| 0.04676
| 0.065464
| 0.502672
| 0.400913
| 0.234692
| 0.196207
| 0.152898
| 0.12436
| 0
| 0.004659
| 0.169475
| 37,988
| 769
| 202
| 49.39922
| 0.849414
| 0.352585
| 0
| 0.060976
| 1
| 0
| 0.00931
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.20935
| false
| 0
| 0.077236
| 0.002033
| 0.70122
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
132bcf51e26ca1f03ed60b32fc0ad65159783864
| 107
|
py
|
Python
|
examples/catapi/feeder.py
|
IniZio/py-skygear
|
88479678f91e678fd931c28295189bfea2148c79
|
[
"Apache-2.0"
] | 8
|
2016-06-24T03:26:45.000Z
|
2018-05-12T09:06:33.000Z
|
examples/catapi/feeder.py
|
IniZio/py-skygear
|
88479678f91e678fd931c28295189bfea2148c79
|
[
"Apache-2.0"
] | 183
|
2016-03-23T08:03:28.000Z
|
2018-08-14T05:49:45.000Z
|
examples/catapi/feeder.py
|
IniZio/py-skygear
|
88479678f91e678fd931c28295189bfea2148c79
|
[
"Apache-2.0"
] | 24
|
2016-03-21T02:39:39.000Z
|
2020-09-17T12:28:58.000Z
|
def pick_food(name):
if name == "chima":
return "chicken"
else:
return "dry food"
| 15.285714
| 25
| 0.53271
| 13
| 107
| 4.307692
| 0.769231
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.345794
| 107
| 6
| 26
| 17.833333
| 0.8
| 0
| 0
| 0
| 0
| 0
| 0.188679
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.2
| false
| 0
| 0
| 0
| 0.6
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
133ed5289cb6b6aa42d9780aa225db43b59d7e06
| 154
|
py
|
Python
|
HelloWorldPython/IfStatements.py
|
SamIge7/Tutorials
|
7a3361768432a6493313d1f0ea1ccc8b2b916aa2
|
[
"MIT"
] | null | null | null |
HelloWorldPython/IfStatements.py
|
SamIge7/Tutorials
|
7a3361768432a6493313d1f0ea1ccc8b2b916aa2
|
[
"MIT"
] | null | null | null |
HelloWorldPython/IfStatements.py
|
SamIge7/Tutorials
|
7a3361768432a6493313d1f0ea1ccc8b2b916aa2
|
[
"MIT"
] | null | null | null |
hasGoodCredit = True
price = 1000000
deposit = 0
if hasGoodCredit:
deposit = price/10
else:
deposit = price/5
print(f"Deposit needed: £{deposit}")
| 19.25
| 36
| 0.707792
| 21
| 154
| 5.238095
| 0.666667
| 0.218182
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.087302
| 0.181818
| 154
| 8
| 36
| 19.25
| 0.777778
| 0
| 0
| 0
| 0
| 0
| 0.167742
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.125
| 1
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
13427c6b2da4367eae23b3d65430a2f826b58232
| 106,827
|
py
|
Python
|
obswebsocket/requests.py
|
PanBartosz/obs-websocket-py
|
e92960a475d3f1096a4ea41763cbc776b23f0a37
|
[
"MIT"
] | 123
|
2017-06-19T05:34:58.000Z
|
2022-03-23T12:48:19.000Z
|
obswebsocket/requests.py
|
PanBartosz/obs-websocket-py
|
e92960a475d3f1096a4ea41763cbc776b23f0a37
|
[
"MIT"
] | 67
|
2017-06-20T11:31:08.000Z
|
2022-03-25T20:30:41.000Z
|
obswebsocket/requests.py
|
PanBartosz/obs-websocket-py
|
e92960a475d3f1096a4ea41763cbc776b23f0a37
|
[
"MIT"
] | 51
|
2017-10-09T19:03:12.000Z
|
2022-03-28T19:25:02.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# THIS FILE WAS GENERATED BY generate_classes.py - DO NOT EDIT #
# (Generated on 2020-12-20 18:26:33.661372) #
from .base_classes import Baserequests
class GetVersion(Baserequests):
"""Returns the latest version of the plugin and the API.
:Returns:
*version*
type: double
OBSRemote compatible API version. Fixed to 1.1 for retrocompatibility.
*obs_websocket_version*
type: String
obs-websocket plugin version.
*obs_studio_version*
type: String
OBS Studio program version.
*available_requests*
type: String
List of available request types, formatted as a comma-separated list string (e.g. : "Method1,Method2,Method3").
*supported_image_export_formats*
type: String
List of supported formats for features that use image export (like the TakeSourceScreenshot request type) formatted as a comma-separated list string
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetVersion'
self.datain['version'] = None
self.datain['obs-websocket-version'] = None
self.datain['obs-studio-version'] = None
self.datain['available-requests'] = None
self.datain['supported-image-export-formats'] = None
def getVersion(self):
return self.datain['version']
def getObsWebsocketVersion(self):
return self.datain['obs-websocket-version']
def getObsStudioVersion(self):
return self.datain['obs-studio-version']
def getAvailableRequests(self):
return self.datain['available-requests']
def getSupportedImageExportFormats(self):
return self.datain['supported-image-export-formats']
class GetAuthRequired(Baserequests):
"""Tells the client if authentication is required. If so, returns authentication parameters `challenge`
and `salt` (see "Authentication" for more information).
:Returns:
*authRequired*
type: boolean
Indicates whether authentication is required.
*challenge*
type: String (optional)
*salt*
type: String (optional)
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetAuthRequired'
self.datain['authRequired'] = None
self.datain['challenge'] = None
self.datain['salt'] = None
def getAuthRequired(self):
return self.datain['authRequired']
def getChallenge(self):
return self.datain['challenge']
def getSalt(self):
return self.datain['salt']
class Authenticate(Baserequests):
"""Attempt to authenticate the client to the server.
:Arguments:
*auth*
type: String
Response to the auth challenge (see "Authentication" for more information).
"""
def __init__(self, auth):
Baserequests.__init__(self)
self.name = 'Authenticate'
self.dataout['auth'] = auth
class SetHeartbeat(Baserequests):
"""Enable/disable sending of the Heartbeat event
:Arguments:
*enable*
type: boolean
Starts/Stops emitting heartbeat messages
"""
def __init__(self, enable):
Baserequests.__init__(self)
self.name = 'SetHeartbeat'
self.dataout['enable'] = enable
class SetFilenameFormatting(Baserequests):
"""Set the filename formatting string
:Arguments:
*filename_formatting*
type: String
Filename formatting string to set.
"""
def __init__(self, filename_formatting):
Baserequests.__init__(self)
self.name = 'SetFilenameFormatting'
self.dataout['filename-formatting'] = filename_formatting
class GetFilenameFormatting(Baserequests):
"""Get the filename formatting string
:Returns:
*filename_formatting*
type: String
Current filename formatting string.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetFilenameFormatting'
self.datain['filename-formatting'] = None
def getFilenameFormatting(self):
return self.datain['filename-formatting']
class GetStats(Baserequests):
"""Get OBS stats (almost the same info as provided in OBS' stats window)
:Returns:
*stats*
type: OBSStats
[OBS stats](#obsstats)
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetStats'
self.datain['stats'] = None
def getStats(self):
return self.datain['stats']
class BroadcastCustomMessage(Baserequests):
"""Broadcast custom message to all connected WebSocket clients
:Arguments:
*realm*
type: String
Identifier to be choosen by the client
*data*
type: Object
User-defined data
"""
def __init__(self, realm, data):
Baserequests.__init__(self)
self.name = 'BroadcastCustomMessage'
self.dataout['realm'] = realm
self.dataout['data'] = data
class GetVideoInfo(Baserequests):
"""Get basic OBS video information
:Returns:
*baseWidth*
type: int
Base (canvas) width
*baseHeight*
type: int
Base (canvas) height
*outputWidth*
type: int
Output width
*outputHeight*
type: int
Output height
*scaleType*
type: String
Scaling method used if output size differs from base size
*fps*
type: double
Frames rendered per second
*videoFormat*
type: String
Video color format
*colorSpace*
type: String
Color space for YUV
*colorRange*
type: String
Color range (full or partial)
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetVideoInfo'
self.datain['baseWidth'] = None
self.datain['baseHeight'] = None
self.datain['outputWidth'] = None
self.datain['outputHeight'] = None
self.datain['scaleType'] = None
self.datain['fps'] = None
self.datain['videoFormat'] = None
self.datain['colorSpace'] = None
self.datain['colorRange'] = None
def getBaseWidth(self):
return self.datain['baseWidth']
def getBaseHeight(self):
return self.datain['baseHeight']
def getOutputWidth(self):
return self.datain['outputWidth']
def getOutputHeight(self):
return self.datain['outputHeight']
def getScaleType(self):
return self.datain['scaleType']
def getFps(self):
return self.datain['fps']
def getVideoFormat(self):
return self.datain['videoFormat']
def getColorSpace(self):
return self.datain['colorSpace']
def getColorRange(self):
return self.datain['colorRange']
class OpenProjector(Baserequests):
"""Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer.
:Arguments:
*type*
type: String (Optional)
Type of projector: `Preview` (default), `Source`, `Scene`, `StudioProgram`, or `Multiview` (case insensitive).
*monitor*
type: int (Optional)
Monitor to open the projector on. If -1 or omitted, opens a window.
*geometry*
type: String (Optional)
Size and position of the projector window (only if monitor is -1). Encoded in Base64 using [Qt's geometry encoding](https://doc.qt.io/qt-5/qwidget.html#saveGeometry). Corresponds to OBS's saved projectors.
*name*
type: String (Optional)
Name of the source or scene to be displayed (ignored for other projector types).
"""
def __init__(self, type, monitor, geometry, name):
Baserequests.__init__(self)
self.name = 'OpenProjector'
self.dataout['type'] = type
self.dataout['monitor'] = monitor
self.dataout['geometry'] = geometry
self.dataout['name'] = name
class TriggerHotkeyByName(Baserequests):
"""Executes hotkey routine, identified by hotkey unique name
:Arguments:
*hotkeyName*
type: String
Unique name of the hotkey, as defined when registering the hotkey (e.g. "ReplayBuffer.Save")
"""
def __init__(self, hotkeyName):
Baserequests.__init__(self)
self.name = 'TriggerHotkeyByName'
self.dataout['hotkeyName'] = hotkeyName
class TriggerHotkeyBySequence(Baserequests):
"""Executes hotkey routine, identified by bound combination of keys. A single key combination might trigger multiple hotkey routines depending on user settings
:Arguments:
*keyId*
type: String
Main key identifier (e.g. `OBS_KEY_A` for key "A"). Available identifiers [here](https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h)
*keyModifiers*
type: Object (Optional)
Optional key modifiers object. False entries can be ommitted
*keyModifiers.shift*
type: boolean
Trigger Shift Key
*keyModifiers.alt*
type: boolean
Trigger Alt Key
*keyModifiers.control*
type: boolean
Trigger Control (Ctrl) Key
*keyModifiers.command*
type: boolean
Trigger Command Key (Mac)
"""
def __init__(self, keyId, keyModifiers):
Baserequests.__init__(self)
self.name = 'TriggerHotkeyBySequence'
self.dataout['keyId'] = keyId
self.dataout['keyModifiers'] = keyModifiers
class PlayPauseMedia(Baserequests):
"""Pause or play a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
*playPause*
type: boolean
Whether to pause or play the source. `false` for play, `true` for pause.
"""
def __init__(self, sourceName, playPause):
Baserequests.__init__(self)
self.name = 'PlayPauseMedia'
self.dataout['sourceName'] = sourceName
self.dataout['playPause'] = playPause
class RestartMedia(Baserequests):
"""Restart a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'RestartMedia'
self.dataout['sourceName'] = sourceName
class StopMedia(Baserequests):
"""Stop a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'StopMedia'
self.dataout['sourceName'] = sourceName
class NextMedia(Baserequests):
"""Skip to the next media item in the playlist. Supports only vlc media source (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'NextMedia'
self.dataout['sourceName'] = sourceName
class PreviousMedia(Baserequests):
"""Go to the previous media item in the playlist. Supports only vlc media source (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'PreviousMedia'
self.dataout['sourceName'] = sourceName
class GetMediaDuration(Baserequests):
"""Get the length of media in milliseconds. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
Note: For some reason, for the first 5 or so seconds that the media is playing, the total duration can be off by upwards of 50ms.
:Arguments:
*sourceName*
type: String
Source name.
:Returns:
*mediaDuration*
type: int
The total length of media in milliseconds..
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'GetMediaDuration'
self.datain['mediaDuration'] = None
self.dataout['sourceName'] = sourceName
def getMediaDuration(self):
return self.datain['mediaDuration']
class GetMediaTime(Baserequests):
"""Get the current timestamp of media in milliseconds. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
:Returns:
*timestamp*
type: int
The time in milliseconds since the start of the media.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'GetMediaTime'
self.datain['timestamp'] = None
self.dataout['sourceName'] = sourceName
def getTimestamp(self):
return self.datain['timestamp']
class SetMediaTime(Baserequests):
"""Set the timestamp of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
*timestamp*
type: int
Milliseconds to set the timestamp to.
"""
def __init__(self, sourceName, timestamp):
Baserequests.__init__(self)
self.name = 'SetMediaTime'
self.dataout['sourceName'] = sourceName
self.dataout['timestamp'] = timestamp
class ScrubMedia(Baserequests):
"""Scrub media using a supplied offset. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
Note: Due to processing/network delays, this request is not perfect. The processing rate of this request has also not been tested.
:Arguments:
*sourceName*
type: String
Source name.
*timeOffset*
type: int
Millisecond offset (positive or negative) to offset the current media position.
"""
def __init__(self, sourceName, timeOffset):
Baserequests.__init__(self)
self.name = 'ScrubMedia'
self.dataout['sourceName'] = sourceName
self.dataout['timeOffset'] = timeOffset
class GetMediaState(Baserequests):
"""Get the current playing state of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8)
:Arguments:
*sourceName*
type: String
Source name.
:Returns:
*mediaState*
type: String
The media state of the provided source. States: `none`, `playing`, `opening`, `buffering`, `paused`, `stopped`, `ended`, `error`, `unknown`
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'GetMediaState'
self.datain['mediaState'] = None
self.dataout['sourceName'] = sourceName
def getMediaState(self):
return self.datain['mediaState']
class GetMediaSourcesList(Baserequests):
"""List the media state of all media sources (vlc and media source)
:Returns:
*mediaSources*
type: Array<Object>
Array of sources
*mediaSources.*.sourceName*
type: String
Unique source name
*mediaSources.*.sourceKind*
type: String
Unique source internal type (a.k.a `ffmpeg_source` or `vlc_source`)
*mediaSources.*.mediaState*
type: String
The current state of media for that source. States: `none`, `playing`, `opening`, `buffering`, `paused`, `stopped`, `ended`, `error`, `unknown`
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetMediaSourcesList'
self.datain['mediaSources'] = None
def getMediaSources(self):
return self.datain['mediaSources']
class CreateSource(Baserequests):
"""Create a source and add it as a sceneitem to a scene.
:Arguments:
*sourceName*
type: String
Source name.
*sourceKind*
type: String
Source kind, Eg. `vlc_source`.
*sceneName*
type: String
Scene to add the new source to.
*sourceSettings*
type: Object (optional)
Source settings data.
*setVisible*
type: boolean (optional)
Set the created SceneItem as visible or not. Defaults to true
:Returns:
*itemId*
type: int
ID of the SceneItem in the scene.
"""
def __init__(self, sourceName, sourceKind, sceneName, sourceSettings=None, setVisible=None):
Baserequests.__init__(self)
self.name = 'CreateSource'
self.datain['itemId'] = None
self.dataout['sourceName'] = sourceName
self.dataout['sourceKind'] = sourceKind
self.dataout['sceneName'] = sceneName
self.dataout['sourceSettings'] = sourceSettings
self.dataout['setVisible'] = setVisible
def getItemId(self):
return self.datain['itemId']
class GetSourcesList(Baserequests):
"""List all sources available in the running OBS instance
:Returns:
*sources*
type: Array<Object>
Array of sources
*sources.*.name*
type: String
Unique source name
*sources.*.typeId*
type: String
Non-unique source internal type (a.k.a kind)
*sources.*.type*
type: String
Source type. Value is one of the following: "input", "filter", "transition", "scene" or "unknown"
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetSourcesList'
self.datain['sources'] = None
def getSources(self):
return self.datain['sources']
class GetSourceTypesList(Baserequests):
"""Get a list of all available sources types
:Returns:
*types*
type: Array<Object>
Array of source types
*types.*.typeId*
type: String
Non-unique internal source type ID
*types.*.displayName*
type: String
Display name of the source type
*types.*.type*
type: String
Type. Value is one of the following: "input", "filter", "transition" or "other"
*types.*.defaultSettings*
type: Object
Default settings of this source type
*types.*.caps*
type: Object
Source type capabilities
*types.*.caps.isAsync*
type: Boolean
True if source of this type provide frames asynchronously
*types.*.caps.hasVideo*
type: Boolean
True if sources of this type provide video
*types.*.caps.hasAudio*
type: Boolean
True if sources of this type provide audio
*types.*.caps.canInteract*
type: Boolean
True if interaction with this sources of this type is possible
*types.*.caps.isComposite*
type: Boolean
True if sources of this type composite one or more sub-sources
*types.*.caps.doNotDuplicate*
type: Boolean
True if sources of this type should not be fully duplicated
*types.*.caps.doNotSelfMonitor*
type: Boolean
True if sources of this type may cause a feedback loop if it's audio is monitored and shouldn't be
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetSourceTypesList'
self.datain['types'] = None
def getTypes(self):
return self.datain['types']
class GetVolume(Baserequests):
"""Get the volume of the specified source. Default response uses mul format, NOT SLIDER PERCENTAGE.
:Arguments:
*source*
type: String
Source name.
*useDecibel*
type: boolean (optional)
Output volume in decibels of attenuation instead of amplitude/mul.
:Returns:
*name*
type: String
Source name.
*volume*
type: double
Volume of the source. Between `0.0` and `20.0` if using mul, under `26.0` if using dB.
*muted*
type: boolean
Indicates whether the source is muted.
"""
def __init__(self, source, useDecibel=None):
Baserequests.__init__(self)
self.name = 'GetVolume'
self.datain['name'] = None
self.datain['volume'] = None
self.datain['muted'] = None
self.dataout['source'] = source
self.dataout['useDecibel'] = useDecibel
def getName(self):
return self.datain['name']
def getVolume(self):
return self.datain['volume']
def getMuted(self):
return self.datain['muted']
class SetVolume(Baserequests):
"""Set the volume of the specified source. Default request format uses mul, NOT SLIDER PERCENTAGE.
:Arguments:
*source*
type: String
Source name.
*volume*
type: double
Desired volume. Must be between `0.0` and `20.0` for mul, and under 26.0 for dB. OBS will interpret dB values under -100.0 as Inf. Note: The OBS volume sliders only reach a maximum of 1.0mul/0.0dB, however OBS actually supports larger values.
*useDecibel*
type: boolean (optional)
Interperet `volume` data as decibels instead of amplitude/mul.
"""
def __init__(self, source, volume, useDecibel=None):
Baserequests.__init__(self)
self.name = 'SetVolume'
self.dataout['source'] = source
self.dataout['volume'] = volume
self.dataout['useDecibel'] = useDecibel
class GetMute(Baserequests):
"""Get the mute status of a specified source.
:Arguments:
*source*
type: String
Source name.
:Returns:
*name*
type: String
Source name.
*muted*
type: boolean
Mute status of the source.
"""
def __init__(self, source):
Baserequests.__init__(self)
self.name = 'GetMute'
self.datain['name'] = None
self.datain['muted'] = None
self.dataout['source'] = source
def getName(self):
return self.datain['name']
def getMuted(self):
return self.datain['muted']
class SetMute(Baserequests):
"""Sets the mute status of a specified source.
:Arguments:
*source*
type: String
Source name.
*mute*
type: boolean
Desired mute status.
"""
def __init__(self, source, mute):
Baserequests.__init__(self)
self.name = 'SetMute'
self.dataout['source'] = source
self.dataout['mute'] = mute
class ToggleMute(Baserequests):
"""Inverts the mute status of a specified source.
:Arguments:
*source*
type: String
Source name.
"""
def __init__(self, source):
Baserequests.__init__(self)
self.name = 'ToggleMute'
self.dataout['source'] = source
class GetAudioActive(Baserequests):
"""Get the audio's active status of a specified source.
:Arguments:
*sourceName*
type: String
Source name.
:Returns:
*audioActive*
type: boolean
Audio active status of the source.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'GetAudioActive'
self.datain['audioActive'] = None
self.dataout['sourceName'] = sourceName
def getAudioActive(self):
return self.datain['audioActive']
class SetSourceName(Baserequests):
"""
Note: If the new name already exists as a source, obs-websocket will return an error.
:Arguments:
*sourceName*
type: String
Source name.
*newName*
type: String
New source name.
"""
def __init__(self, sourceName, newName):
Baserequests.__init__(self)
self.name = 'SetSourceName'
self.dataout['sourceName'] = sourceName
self.dataout['newName'] = newName
class SetSyncOffset(Baserequests):
"""Set the audio sync offset of a specified source.
:Arguments:
*source*
type: String
Source name.
*offset*
type: int
The desired audio sync offset (in nanoseconds).
"""
def __init__(self, source, offset):
Baserequests.__init__(self)
self.name = 'SetSyncOffset'
self.dataout['source'] = source
self.dataout['offset'] = offset
class GetSyncOffset(Baserequests):
"""Get the audio sync offset of a specified source.
:Arguments:
*source*
type: String
Source name.
:Returns:
*name*
type: String
Source name.
*offset*
type: int
The audio sync offset (in nanoseconds).
"""
def __init__(self, source):
Baserequests.__init__(self)
self.name = 'GetSyncOffset'
self.datain['name'] = None
self.datain['offset'] = None
self.dataout['source'] = source
def getName(self):
return self.datain['name']
def getOffset(self):
return self.datain['offset']
class GetSourceSettings(Baserequests):
"""Get settings of the specified source
:Arguments:
*sourceName*
type: String
Source name.
*sourceType*
type: String (optional)
Type of the specified source. Useful for type-checking if you expect a specific settings schema.
:Returns:
*sourceName*
type: String
Source name
*sourceType*
type: String
Type of the specified source
*sourceSettings*
type: Object
Source settings (varies between source types, may require some probing around).
"""
def __init__(self, sourceName, sourceType=None):
Baserequests.__init__(self)
self.name = 'GetSourceSettings'
self.datain['sourceName'] = None
self.datain['sourceType'] = None
self.datain['sourceSettings'] = None
self.dataout['sourceName'] = sourceName
self.dataout['sourceType'] = sourceType
def getSourceName(self):
return self.datain['sourceName']
def getSourceType(self):
return self.datain['sourceType']
def getSourceSettings(self):
return self.datain['sourceSettings']
class SetSourceSettings(Baserequests):
"""Set settings of the specified source.
:Arguments:
*sourceName*
type: String
Source name.
*sourceType*
type: String (optional)
Type of the specified source. Useful for type-checking to avoid settings a set of settings incompatible with the actual source's type.
*sourceSettings*
type: Object
Source settings (varies between source types, may require some probing around).
:Returns:
*sourceName*
type: String
Source name
*sourceType*
type: String
Type of the specified source
*sourceSettings*
type: Object
Updated source settings
"""
def __init__(self, sourceName, sourceSettings, sourceType=None):
Baserequests.__init__(self)
self.name = 'SetSourceSettings'
self.datain['sourceName'] = None
self.datain['sourceType'] = None
self.datain['sourceSettings'] = None
self.dataout['sourceName'] = sourceName
self.dataout['sourceSettings'] = sourceSettings
self.dataout['sourceType'] = sourceType
def getSourceName(self):
return self.datain['sourceName']
def getSourceType(self):
return self.datain['sourceType']
def getSourceSettings(self):
return self.datain['sourceSettings']
class GetTextGDIPlusProperties(Baserequests):
"""Get the current properties of a Text GDI Plus source.
:Arguments:
*source*
type: String
Source name.
:Returns:
*source*
type: String
Source name.
*align*
type: String
Text Alignment ("left", "center", "right").
*bk_color*
type: int
Background color.
*bk_opacity*
type: int
Background opacity (0-100).
*chatlog*
type: boolean
Chat log.
*chatlog_lines*
type: int
Chat log lines.
*color*
type: int
Text color.
*extents*
type: boolean
Extents wrap.
*extents_cx*
type: int
Extents cx.
*extents_cy*
type: int
Extents cy.
*file*
type: String
File path name.
*read_from_file*
type: boolean
Read text from the specified file.
*font*
type: Object
Holds data for the font. Ex: `"font": { "face": "Arial", "flags": 0, "size": 150, "style": "" }`
*font.face*
type: String
Font face.
*font.flags*
type: int
Font text styling flag. `Bold=1, Italic=2, Bold Italic=3, Underline=5, Strikeout=8`
*font.size*
type: int
Font text size.
*font.style*
type: String
Font Style (unknown function).
*gradient*
type: boolean
Gradient enabled.
*gradient_color*
type: int
Gradient color.
*gradient_dir*
type: float
Gradient direction.
*gradient_opacity*
type: int
Gradient opacity (0-100).
*outline*
type: boolean
Outline.
*outline_color*
type: int
Outline color.
*outline_size*
type: int
Outline size.
*outline_opacity*
type: int
Outline opacity (0-100).
*text*
type: String
Text content to be displayed.
*valign*
type: String
Text vertical alignment ("top", "center", "bottom").
*vertical*
type: boolean
Vertical text enabled.
"""
def __init__(self, source):
Baserequests.__init__(self)
self.name = 'GetTextGDIPlusProperties'
self.datain['source'] = None
self.datain['align'] = None
self.datain['bk_color'] = None
self.datain['bk_opacity'] = None
self.datain['chatlog'] = None
self.datain['chatlog_lines'] = None
self.datain['color'] = None
self.datain['extents'] = None
self.datain['extents_cx'] = None
self.datain['extents_cy'] = None
self.datain['file'] = None
self.datain['read_from_file'] = None
self.datain['font'] = None
self.datain['gradient'] = None
self.datain['gradient_color'] = None
self.datain['gradient_dir'] = None
self.datain['gradient_opacity'] = None
self.datain['outline'] = None
self.datain['outline_color'] = None
self.datain['outline_size'] = None
self.datain['outline_opacity'] = None
self.datain['text'] = None
self.datain['valign'] = None
self.datain['vertical'] = None
self.dataout['source'] = source
def getSource(self):
return self.datain['source']
def getAlign(self):
return self.datain['align']
def getBk_color(self):
return self.datain['bk_color']
def getBk_opacity(self):
return self.datain['bk_opacity']
def getChatlog(self):
return self.datain['chatlog']
def getChatlog_lines(self):
return self.datain['chatlog_lines']
def getColor(self):
return self.datain['color']
def getExtents(self):
return self.datain['extents']
def getExtents_cx(self):
return self.datain['extents_cx']
def getExtents_cy(self):
return self.datain['extents_cy']
def getFile(self):
return self.datain['file']
def getRead_from_file(self):
return self.datain['read_from_file']
def getFont(self):
return self.datain['font']
def getGradient(self):
return self.datain['gradient']
def getGradient_color(self):
return self.datain['gradient_color']
def getGradient_dir(self):
return self.datain['gradient_dir']
def getGradient_opacity(self):
return self.datain['gradient_opacity']
def getOutline(self):
return self.datain['outline']
def getOutline_color(self):
return self.datain['outline_color']
def getOutline_size(self):
return self.datain['outline_size']
def getOutline_opacity(self):
return self.datain['outline_opacity']
def getText(self):
return self.datain['text']
def getValign(self):
return self.datain['valign']
def getVertical(self):
return self.datain['vertical']
class SetTextGDIPlusProperties(Baserequests):
"""Set the current properties of a Text GDI Plus source.
:Arguments:
*source*
type: String
Name of the source.
*align*
type: String (optional)
Text Alignment ("left", "center", "right").
*bk_color*
type: int (optional)
Background color.
*bk_opacity*
type: int (optional)
Background opacity (0-100).
*chatlog*
type: boolean (optional)
Chat log.
*chatlog_lines*
type: int (optional)
Chat log lines.
*color*
type: int (optional)
Text color.
*extents*
type: boolean (optional)
Extents wrap.
*extents_cx*
type: int (optional)
Extents cx.
*extents_cy*
type: int (optional)
Extents cy.
*file*
type: String (optional)
File path name.
*read_from_file*
type: boolean (optional)
Read text from the specified file.
*font*
type: Object (optional)
Holds data for the font. Ex: `"font": { "face": "Arial", "flags": 0, "size": 150, "style": "" }`
*font.face*
type: String (optional)
Font face.
*font.flags*
type: int (optional)
Font text styling flag. `Bold=1, Italic=2, Bold Italic=3, Underline=5, Strikeout=8`
*font.size*
type: int (optional)
Font text size.
*font.style*
type: String (optional)
Font Style (unknown function).
*gradient*
type: boolean (optional)
Gradient enabled.
*gradient_color*
type: int (optional)
Gradient color.
*gradient_dir*
type: float (optional)
Gradient direction.
*gradient_opacity*
type: int (optional)
Gradient opacity (0-100).
*outline*
type: boolean (optional)
Outline.
*outline_color*
type: int (optional)
Outline color.
*outline_size*
type: int (optional)
Outline size.
*outline_opacity*
type: int (optional)
Outline opacity (0-100).
*text*
type: String (optional)
Text content to be displayed.
*valign*
type: String (optional)
Text vertical alignment ("top", "center", "bottom").
*vertical*
type: boolean (optional)
Vertical text enabled.
*render*
type: boolean (optional)
Visibility of the scene item.
"""
def __init__(self, source, align=None, bk_color=None, bk_opacity=None, chatlog=None, chatlog_lines=None, color=None, extents=None, extents_cx=None, extents_cy=None, file=None, read_from_file=None, font=None, gradient=None, gradient_color=None, gradient_dir=None, gradient_opacity=None, outline=None, outline_color=None, outline_size=None, outline_opacity=None, text=None, valign=None, vertical=None, render=None):
Baserequests.__init__(self)
self.name = 'SetTextGDIPlusProperties'
self.dataout['source'] = source
self.dataout['align'] = align
self.dataout['bk_color'] = bk_color
self.dataout['bk_opacity'] = bk_opacity
self.dataout['chatlog'] = chatlog
self.dataout['chatlog_lines'] = chatlog_lines
self.dataout['color'] = color
self.dataout['extents'] = extents
self.dataout['extents_cx'] = extents_cx
self.dataout['extents_cy'] = extents_cy
self.dataout['file'] = file
self.dataout['read_from_file'] = read_from_file
self.dataout['font'] = font
self.dataout['gradient'] = gradient
self.dataout['gradient_color'] = gradient_color
self.dataout['gradient_dir'] = gradient_dir
self.dataout['gradient_opacity'] = gradient_opacity
self.dataout['outline'] = outline
self.dataout['outline_color'] = outline_color
self.dataout['outline_size'] = outline_size
self.dataout['outline_opacity'] = outline_opacity
self.dataout['text'] = text
self.dataout['valign'] = valign
self.dataout['vertical'] = vertical
self.dataout['render'] = render
class GetTextFreetype2Properties(Baserequests):
"""Get the current properties of a Text Freetype 2 source.
:Arguments:
*source*
type: String
Source name.
:Returns:
*source*
type: String
Source name
*color1*
type: int
Gradient top color.
*color2*
type: int
Gradient bottom color.
*custom_width*
type: int
Custom width (0 to disable).
*drop_shadow*
type: boolean
Drop shadow.
*font*
type: Object
Holds data for the font. Ex: `"font": { "face": "Arial", "flags": 0, "size": 150, "style": "" }`
*font.face*
type: String
Font face.
*font.flags*
type: int
Font text styling flag. `Bold=1, Italic=2, Bold Italic=3, Underline=5, Strikeout=8`
*font.size*
type: int
Font text size.
*font.style*
type: String
Font Style (unknown function).
*from_file*
type: boolean
Read text from the specified file.
*log_mode*
type: boolean
Chat log.
*outline*
type: boolean
Outline.
*text*
type: String
Text content to be displayed.
*text_file*
type: String
File path.
*word_wrap*
type: boolean
Word wrap.
"""
def __init__(self, source):
Baserequests.__init__(self)
self.name = 'GetTextFreetype2Properties'
self.datain['source'] = None
self.datain['color1'] = None
self.datain['color2'] = None
self.datain['custom_width'] = None
self.datain['drop_shadow'] = None
self.datain['font'] = None
self.datain['from_file'] = None
self.datain['log_mode'] = None
self.datain['outline'] = None
self.datain['text'] = None
self.datain['text_file'] = None
self.datain['word_wrap'] = None
self.dataout['source'] = source
def getSource(self):
return self.datain['source']
def getColor1(self):
return self.datain['color1']
def getColor2(self):
return self.datain['color2']
def getCustom_width(self):
return self.datain['custom_width']
def getDrop_shadow(self):
return self.datain['drop_shadow']
def getFont(self):
return self.datain['font']
def getFrom_file(self):
return self.datain['from_file']
def getLog_mode(self):
return self.datain['log_mode']
def getOutline(self):
return self.datain['outline']
def getText(self):
return self.datain['text']
def getText_file(self):
return self.datain['text_file']
def getWord_wrap(self):
return self.datain['word_wrap']
class SetTextFreetype2Properties(Baserequests):
"""Set the current properties of a Text Freetype 2 source.
:Arguments:
*source*
type: String
Source name.
*color1*
type: int (optional)
Gradient top color.
*color2*
type: int (optional)
Gradient bottom color.
*custom_width*
type: int (optional)
Custom width (0 to disable).
*drop_shadow*
type: boolean (optional)
Drop shadow.
*font*
type: Object (optional)
Holds data for the font. Ex: `"font": { "face": "Arial", "flags": 0, "size": 150, "style": "" }`
*font.face*
type: String (optional)
Font face.
*font.flags*
type: int (optional)
Font text styling flag. `Bold=1, Italic=2, Bold Italic=3, Underline=5, Strikeout=8`
*font.size*
type: int (optional)
Font text size.
*font.style*
type: String (optional)
Font Style (unknown function).
*from_file*
type: boolean (optional)
Read text from the specified file.
*log_mode*
type: boolean (optional)
Chat log.
*outline*
type: boolean (optional)
Outline.
*text*
type: String (optional)
Text content to be displayed.
*text_file*
type: String (optional)
File path.
*word_wrap*
type: boolean (optional)
Word wrap.
"""
def __init__(self, source, color1=None, color2=None, custom_width=None, drop_shadow=None, font=None, from_file=None, log_mode=None, outline=None, text=None, text_file=None, word_wrap=None):
Baserequests.__init__(self)
self.name = 'SetTextFreetype2Properties'
self.dataout['source'] = source
self.dataout['color1'] = color1
self.dataout['color2'] = color2
self.dataout['custom_width'] = custom_width
self.dataout['drop_shadow'] = drop_shadow
self.dataout['font'] = font
self.dataout['from_file'] = from_file
self.dataout['log_mode'] = log_mode
self.dataout['outline'] = outline
self.dataout['text'] = text
self.dataout['text_file'] = text_file
self.dataout['word_wrap'] = word_wrap
class GetBrowserSourceProperties(Baserequests):
"""Get current properties for a Browser Source.
:Arguments:
*source*
type: String
Source name.
:Returns:
*source*
type: String
Source name.
*is_local_file*
type: boolean
Indicates that a local file is in use.
*local_file*
type: String
file path.
*url*
type: String
Url.
*css*
type: String
CSS to inject.
*width*
type: int
Width.
*height*
type: int
Height.
*fps*
type: int
Framerate.
*shutdown*
type: boolean
Indicates whether the source should be shutdown when not visible.
"""
def __init__(self, source):
Baserequests.__init__(self)
self.name = 'GetBrowserSourceProperties'
self.datain['source'] = None
self.datain['is_local_file'] = None
self.datain['local_file'] = None
self.datain['url'] = None
self.datain['css'] = None
self.datain['width'] = None
self.datain['height'] = None
self.datain['fps'] = None
self.datain['shutdown'] = None
self.dataout['source'] = source
def getSource(self):
return self.datain['source']
def getIs_local_file(self):
return self.datain['is_local_file']
def getLocal_file(self):
return self.datain['local_file']
def getUrl(self):
return self.datain['url']
def getCss(self):
return self.datain['css']
def getWidth(self):
return self.datain['width']
def getHeight(self):
return self.datain['height']
def getFps(self):
return self.datain['fps']
def getShutdown(self):
return self.datain['shutdown']
class SetBrowserSourceProperties(Baserequests):
"""Set current properties for a Browser Source.
:Arguments:
*source*
type: String
Name of the source.
*is_local_file*
type: boolean (optional)
Indicates that a local file is in use.
*local_file*
type: String (optional)
file path.
*url*
type: String (optional)
Url.
*css*
type: String (optional)
CSS to inject.
*width*
type: int (optional)
Width.
*height*
type: int (optional)
Height.
*fps*
type: int (optional)
Framerate.
*shutdown*
type: boolean (optional)
Indicates whether the source should be shutdown when not visible.
*render*
type: boolean (optional)
Visibility of the scene item.
"""
def __init__(self, source, is_local_file=None, local_file=None, url=None, css=None, width=None, height=None, fps=None, shutdown=None, render=None):
Baserequests.__init__(self)
self.name = 'SetBrowserSourceProperties'
self.dataout['source'] = source
self.dataout['is_local_file'] = is_local_file
self.dataout['local_file'] = local_file
self.dataout['url'] = url
self.dataout['css'] = css
self.dataout['width'] = width
self.dataout['height'] = height
self.dataout['fps'] = fps
self.dataout['shutdown'] = shutdown
self.dataout['render'] = render
class GetSpecialSources(Baserequests):
"""Get configured special sources like Desktop Audio and Mic/Aux sources.
:Returns:
*desktop_1*
type: String (optional)
Name of the first Desktop Audio capture source.
*desktop_2*
type: String (optional)
Name of the second Desktop Audio capture source.
*mic_1*
type: String (optional)
Name of the first Mic/Aux input source.
*mic_2*
type: String (optional)
Name of the second Mic/Aux input source.
*mic_3*
type: String (optional)
NAme of the third Mic/Aux input source.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetSpecialSources'
self.datain['desktop-1'] = None
self.datain['desktop-2'] = None
self.datain['mic-1'] = None
self.datain['mic-2'] = None
self.datain['mic-3'] = None
def getDesktop1(self):
return self.datain['desktop-1']
def getDesktop2(self):
return self.datain['desktop-2']
def getMic1(self):
return self.datain['mic-1']
def getMic2(self):
return self.datain['mic-2']
def getMic3(self):
return self.datain['mic-3']
class GetSourceFilters(Baserequests):
"""List filters applied to a source
:Arguments:
*sourceName*
type: String
Source name
:Returns:
*filters*
type: Array<Object>
List of filters for the specified source
*filters.*.enabled*
type: Boolean
Filter status (enabled or not)
*filters.*.type*
type: String
Filter type
*filters.*.name*
type: String
Filter name
*filters.*.settings*
type: Object
Filter settings
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'GetSourceFilters'
self.datain['filters'] = None
self.dataout['sourceName'] = sourceName
def getFilters(self):
return self.datain['filters']
class GetSourceFilterInfo(Baserequests):
"""List filters applied to a source
:Arguments:
*sourceName*
type: String
Source name
*filterName*
type: String
Source filter name
:Returns:
*enabled*
type: Boolean
Filter status (enabled or not)
*type*
type: String
Filter type
*name*
type: String
Filter name
*settings*
type: Object
Filter settings
"""
def __init__(self, sourceName, filterName):
Baserequests.__init__(self)
self.name = 'GetSourceFilterInfo'
self.datain['enabled'] = None
self.datain['type'] = None
self.datain['name'] = None
self.datain['settings'] = None
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
def getEnabled(self):
return self.datain['enabled']
def getType(self):
return self.datain['type']
def getName(self):
return self.datain['name']
def getSettings(self):
return self.datain['settings']
class AddFilterToSource(Baserequests):
"""Add a new filter to a source. Available source types along with their settings properties are available from `GetSourceTypesList`.
:Arguments:
*sourceName*
type: String
Name of the source on which the filter is added
*filterName*
type: String
Name of the new filter
*filterType*
type: String
Filter type
*filterSettings*
type: Object
Filter settings
"""
def __init__(self, sourceName, filterName, filterType, filterSettings):
Baserequests.__init__(self)
self.name = 'AddFilterToSource'
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
self.dataout['filterType'] = filterType
self.dataout['filterSettings'] = filterSettings
class RemoveFilterFromSource(Baserequests):
"""Remove a filter from a source
:Arguments:
*sourceName*
type: String
Name of the source from which the specified filter is removed
*filterName*
type: String
Name of the filter to remove
"""
def __init__(self, sourceName, filterName):
Baserequests.__init__(self)
self.name = 'RemoveFilterFromSource'
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
class ReorderSourceFilter(Baserequests):
"""Move a filter in the chain (absolute index positioning)
:Arguments:
*sourceName*
type: String
Name of the source to which the filter belongs
*filterName*
type: String
Name of the filter to reorder
*newIndex*
type: Integer
Desired position of the filter in the chain
"""
def __init__(self, sourceName, filterName, newIndex):
Baserequests.__init__(self)
self.name = 'ReorderSourceFilter'
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
self.dataout['newIndex'] = newIndex
class MoveSourceFilter(Baserequests):
"""Move a filter in the chain (relative positioning)
:Arguments:
*sourceName*
type: String
Name of the source to which the filter belongs
*filterName*
type: String
Name of the filter to reorder
*movementType*
type: String
How to move the filter around in the source's filter chain. Either "up", "down", "top" or "bottom".
"""
def __init__(self, sourceName, filterName, movementType):
Baserequests.__init__(self)
self.name = 'MoveSourceFilter'
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
self.dataout['movementType'] = movementType
class SetSourceFilterSettings(Baserequests):
"""Update settings of a filter
:Arguments:
*sourceName*
type: String
Name of the source to which the filter belongs
*filterName*
type: String
Name of the filter to reconfigure
*filterSettings*
type: Object
New settings. These will be merged to the current filter settings.
"""
def __init__(self, sourceName, filterName, filterSettings):
Baserequests.__init__(self)
self.name = 'SetSourceFilterSettings'
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
self.dataout['filterSettings'] = filterSettings
class SetSourceFilterVisibility(Baserequests):
"""Change the visibility/enabled state of a filter
:Arguments:
*sourceName*
type: String
Source name
*filterName*
type: String
Source filter name
*filterEnabled*
type: Boolean
New filter state
"""
def __init__(self, sourceName, filterName, filterEnabled):
Baserequests.__init__(self)
self.name = 'SetSourceFilterVisibility'
self.dataout['sourceName'] = sourceName
self.dataout['filterName'] = filterName
self.dataout['filterEnabled'] = filterEnabled
class GetAudioMonitorType(Baserequests):
"""Get the audio monitoring type of the specified source.
:Arguments:
*sourceName*
type: String
Source name.
:Returns:
*monitorType*
type: String
The monitor type in use. Options: `none`, `monitorOnly`, `monitorAndOutput`.
"""
def __init__(self, sourceName):
Baserequests.__init__(self)
self.name = 'GetAudioMonitorType'
self.datain['monitorType'] = None
self.dataout['sourceName'] = sourceName
def getMonitorType(self):
return self.datain['monitorType']
class SetAudioMonitorType(Baserequests):
"""Set the audio monitoring type of the specified source.
:Arguments:
*sourceName*
type: String
Source name.
*monitorType*
type: String
The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`.
"""
def __init__(self, sourceName, monitorType):
Baserequests.__init__(self)
self.name = 'SetAudioMonitorType'
self.dataout['sourceName'] = sourceName
self.dataout['monitorType'] = monitorType
class TakeSourceScreenshot(Baserequests):
"""
At least `embedPictureFormat` or `saveToFilePath` must be specified.
Clients can specify `width` and `height` parameters to receive scaled pictures. Aspect ratio is
preserved if only one of these two parameters is specified.
:Arguments:
*sourceName*
type: String (optional)
Source name. Note that, since scenes are also sources, you can also provide a scene name. If not provided, the currently active scene is used.
*embedPictureFormat*
type: String (optional)
Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other value supported by Qt's Image module)
*saveToFilePath*
type: String (optional)
Full file path (file extension included) where the captured image is to be saved. Can be in a format different from `pictureFormat`. Can be a relative path.
*fileFormat*
type: String (optional)
Format to save the image file as (one of the values provided in the `supported-image-export-formats` response field of `GetVersion`). If not specified, tries to guess based on file extension.
*compressionQuality*
type: int (optional)
Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest file/most compression, 100 is largest file/least compression. Varies with image type.
*width*
type: int (optional)
Screenshot width. Defaults to the source's base width.
*height*
type: int (optional)
Screenshot height. Defaults to the source's base height.
:Returns:
*sourceName*
type: String
Source name
*img*
type: String
Image Data URI (if `embedPictureFormat` was specified in the request)
*imageFile*
type: String
Absolute path to the saved image file (if `saveToFilePath` was specified in the request)
"""
def __init__(self, sourceName=None, embedPictureFormat=None, saveToFilePath=None, fileFormat=None, compressionQuality=None, width=None, height=None):
Baserequests.__init__(self)
self.name = 'TakeSourceScreenshot'
self.datain['sourceName'] = None
self.datain['img'] = None
self.datain['imageFile'] = None
self.dataout['sourceName'] = sourceName
self.dataout['embedPictureFormat'] = embedPictureFormat
self.dataout['saveToFilePath'] = saveToFilePath
self.dataout['fileFormat'] = fileFormat
self.dataout['compressionQuality'] = compressionQuality
self.dataout['width'] = width
self.dataout['height'] = height
def getSourceName(self):
return self.datain['sourceName']
def getImg(self):
return self.datain['img']
def getImageFile(self):
return self.datain['imageFile']
class ListOutputs(Baserequests):
"""List existing outputs
:Returns:
*outputs*
type: Array<Output>
Outputs list
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'ListOutputs'
self.datain['outputs'] = None
def getOutputs(self):
return self.datain['outputs']
class GetOutputInfo(Baserequests):
"""Get information about a single output
:Arguments:
*outputName*
type: String
Output name
:Returns:
*outputInfo*
type: Output
Output info
"""
def __init__(self, outputName):
Baserequests.__init__(self)
self.name = 'GetOutputInfo'
self.datain['outputInfo'] = None
self.dataout['outputName'] = outputName
def getOutputInfo(self):
return self.datain['outputInfo']
class StartOutput(Baserequests):
"""
Note: Controlling outputs is an experimental feature of obs-websocket. Some plugins which add outputs to OBS may not function properly when they are controlled in this way.
:Arguments:
*outputName*
type: String
Output name
"""
def __init__(self, outputName):
Baserequests.__init__(self)
self.name = 'StartOutput'
self.dataout['outputName'] = outputName
class StopOutput(Baserequests):
"""
Note: Controlling outputs is an experimental feature of obs-websocket. Some plugins which add outputs to OBS may not function properly when they are controlled in this way.
:Arguments:
*outputName*
type: String
Output name
*force*
type: boolean (optional)
Force stop (default: false)
"""
def __init__(self, outputName, force=None):
Baserequests.__init__(self)
self.name = 'StopOutput'
self.dataout['outputName'] = outputName
self.dataout['force'] = force
class SetCurrentProfile(Baserequests):
"""Set the currently active profile.
:Arguments:
*profile_name*
type: String
Name of the desired profile.
"""
def __init__(self, profile_name):
Baserequests.__init__(self)
self.name = 'SetCurrentProfile'
self.dataout['profile-name'] = profile_name
class GetCurrentProfile(Baserequests):
"""Get the name of the current profile.
:Returns:
*profile_name*
type: String
Name of the currently active profile.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetCurrentProfile'
self.datain['profile-name'] = None
def getProfileName(self):
return self.datain['profile-name']
class ListProfiles(Baserequests):
"""Get a list of available profiles.
:Returns:
*profiles*
type: Array<Object>
List of available profiles.
*profiles.*.profile_name*
type: String
Filter name
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'ListProfiles'
self.datain['profiles'] = None
def getProfiles(self):
return self.datain['profiles']
class GetRecordingStatus(Baserequests):
"""Get current recording status.
:Returns:
*isRecording*
type: boolean
Current recording status.
*isRecordingPaused*
type: boolean
Whether the recording is paused or not.
*recordTimecode*
type: String (optional)
Time elapsed since recording started (only present if currently recording).
*recordingFilename*
type: String (optional)
Absolute path to the recording file (only present if currently recording).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetRecordingStatus'
self.datain['isRecording'] = None
self.datain['isRecordingPaused'] = None
self.datain['recordTimecode'] = None
self.datain['recordingFilename'] = None
def getIsRecording(self):
return self.datain['isRecording']
def getIsRecordingPaused(self):
return self.datain['isRecordingPaused']
def getRecordTimecode(self):
return self.datain['recordTimecode']
def getRecordingFilename(self):
return self.datain['recordingFilename']
class StartStopRecording(Baserequests):
"""Toggle recording on or off (depending on the current recording state).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StartStopRecording'
class StartRecording(Baserequests):
"""Start recording.
Will return an `error` if recording is already active.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StartRecording'
class StopRecording(Baserequests):
"""Stop recording.
Will return an `error` if recording is not active.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StopRecording'
class PauseRecording(Baserequests):
"""Pause the current recording.
Returns an error if recording is not active or already paused.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'PauseRecording'
class ResumeRecording(Baserequests):
"""Resume/unpause the current recording (if paused).
Returns an error if recording is not active or not paused.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'ResumeRecording'
class SetRecordingFolder(Baserequests):
"""
Please note: if `SetRecordingFolder` is called while a recording is
in progress, the change won't be applied immediately and will be
effective on the next recording.
:Arguments:
*rec_folder*
type: String
Path of the recording folder.
"""
def __init__(self, rec_folder):
Baserequests.__init__(self)
self.name = 'SetRecordingFolder'
self.dataout['rec-folder'] = rec_folder
class GetRecordingFolder(Baserequests):
"""Get the path of the current recording folder.
:Returns:
*rec_folder*
type: String
Path of the recording folder.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetRecordingFolder'
self.datain['rec-folder'] = None
def getRecFolder(self):
return self.datain['rec-folder']
class GetReplayBufferStatus(Baserequests):
"""Get the status of the OBS replay buffer.
:Returns:
*isReplayBufferActive*
type: boolean
Current recording status.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetReplayBufferStatus'
self.datain['isReplayBufferActive'] = None
def getIsReplayBufferActive(self):
return self.datain['isReplayBufferActive']
class StartStopReplayBuffer(Baserequests):
"""Toggle the Replay Buffer on/off (depending on the current state of the replay buffer).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StartStopReplayBuffer'
class StartReplayBuffer(Baserequests):
"""Start recording into the Replay Buffer.
Will return an `error` if the Replay Buffer is already active or if the
"Save Replay Buffer" hotkey is not set in OBS' settings.
Setting this hotkey is mandatory, even when triggering saves only
through obs-websocket.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StartReplayBuffer'
class StopReplayBuffer(Baserequests):
"""Stop recording into the Replay Buffer.
Will return an `error` if the Replay Buffer is not active.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StopReplayBuffer'
class SaveReplayBuffer(Baserequests):
"""Flush and save the contents of the Replay Buffer to disk. This is
basically the same as triggering the "Save Replay Buffer" hotkey.
Will return an `error` if the Replay Buffer is not active.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'SaveReplayBuffer'
class SetCurrentSceneCollection(Baserequests):
"""Change the active scene collection.
:Arguments:
*sc_name*
type: String
Name of the desired scene collection.
"""
def __init__(self, sc_name):
Baserequests.__init__(self)
self.name = 'SetCurrentSceneCollection'
self.dataout['sc-name'] = sc_name
class GetCurrentSceneCollection(Baserequests):
"""Get the name of the current scene collection.
:Returns:
*sc_name*
type: String
Name of the currently active scene collection.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetCurrentSceneCollection'
self.datain['sc-name'] = None
def getScName(self):
return self.datain['sc-name']
class ListSceneCollections(Baserequests):
"""List available scene collections
:Returns:
*scene_collections*
type: Array<String>
Scene collections list
*scene_collections.*.sc_name*
type: String
Scene collection name
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'ListSceneCollections'
self.datain['scene-collections'] = None
def getSceneCollections(self):
return self.datain['scene-collections']
class GetSceneItemList(Baserequests):
"""Get a list of all scene items in a scene.
:Arguments:
*sceneName*
type: String (optional)
Name of the scene to get the list of scene items from. Defaults to the current scene if not specified.
:Returns:
*sceneName*
type: String
Name of the requested (or current) scene
*sceneItems*
type: Array<Object>
Array of scene items
*sceneItems.*.itemId*
type: int
Unique item id of the source item
*sceneItems.*.sourceKind*
type: String
ID if the scene item's source. For example `vlc_source` or `image_source`
*sceneItems.*.sourceName*
type: String
Name of the scene item's source
*sceneItems.*.sourceType*
type: String
Type of the scene item's source. Either `input`, `group`, or `scene`
"""
def __init__(self, sceneName=None):
Baserequests.__init__(self)
self.name = 'GetSceneItemList'
self.datain['sceneName'] = None
self.datain['sceneItems'] = None
self.dataout['sceneName'] = sceneName
def getSceneName(self):
return self.datain['sceneName']
def getSceneItems(self):
return self.datain['sceneItems']
class GetSceneItemProperties(Baserequests):
"""Gets the scene specific properties of the specified source item.
Coordinates are relative to the item's parent (the scene or group it belongs to).
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the current scene.
*item*
type: String | Object
Scene Item name (if this field is a string) or specification (if it is an object).
*item.name*
type: String (optional)
Scene Item name (if the `item` field is an object)
*item.id*
type: int (optional)
Scene Item ID (if the `item` field is an object)
:Returns:
*name*
type: String
Scene Item name.
*itemId*
type: int
Scene Item ID.
*position.x*
type: double
The x position of the source from the left.
*position.y*
type: double
The y position of the source from the top.
*position.alignment*
type: int
The point on the source that the item is manipulated from. The sum of 1=Left or 2=Right, and 4=Top or 8=Bottom, or omit to center on that axis.
*rotation*
type: double
The clockwise rotation of the item in degrees around the point of alignment.
*scale.x*
type: double
The x-scale factor of the source.
*scale.y*
type: double
The y-scale factor of the source.
*crop.top*
type: int
The number of pixels cropped off the top of the source before scaling.
*crop.right*
type: int
The number of pixels cropped off the right of the source before scaling.
*crop.bottom*
type: int
The number of pixels cropped off the bottom of the source before scaling.
*crop.left*
type: int
The number of pixels cropped off the left of the source before scaling.
*visible*
type: bool
If the source is visible.
*muted*
type: bool
If the source is muted.
*locked*
type: bool
If the source's transform is locked.
*bounds.type*
type: String
Type of bounding box. Can be "OBS_BOUNDS_STRETCH", "OBS_BOUNDS_SCALE_INNER", "OBS_BOUNDS_SCALE_OUTER", "OBS_BOUNDS_SCALE_TO_WIDTH", "OBS_BOUNDS_SCALE_TO_HEIGHT", "OBS_BOUNDS_MAX_ONLY" or "OBS_BOUNDS_NONE".
*bounds.alignment*
type: int
Alignment of the bounding box.
*bounds.x*
type: double
Width of the bounding box.
*bounds.y*
type: double
Height of the bounding box.
*sourceWidth*
type: int
Base width (without scaling) of the source
*sourceHeight*
type: int
Base source (without scaling) of the source
*width*
type: double
Scene item width (base source width multiplied by the horizontal scaling factor)
*height*
type: double
Scene item height (base source height multiplied by the vertical scaling factor)
*parentGroupName*
type: String (optional)
Name of the item's parent (if this item belongs to a group)
*groupChildren*
type: Array<SceneItemTransform> (optional)
List of children (if this item is a group)
"""
def __init__(self, item, scene_name=None):
Baserequests.__init__(self)
self.name = 'GetSceneItemProperties'
self.datain['name'] = None
self.datain['itemId'] = None
self.datain['position'] = None
self.datain['rotation'] = None
self.datain['scale'] = None
self.datain['crop'] = None
self.datain['visible'] = None
self.datain['muted'] = None
self.datain['locked'] = None
self.datain['bounds'] = None
self.datain['sourceWidth'] = None
self.datain['sourceHeight'] = None
self.datain['width'] = None
self.datain['height'] = None
self.datain['parentGroupName'] = None
self.datain['groupChildren'] = None
self.dataout['item'] = item
self.dataout['scene-name'] = scene_name
def getName(self):
return self.datain['name']
def getItemId(self):
return self.datain['itemId']
def getPosition(self):
return self.datain['position']
def getRotation(self):
return self.datain['rotation']
def getScale(self):
return self.datain['scale']
def getCrop(self):
return self.datain['crop']
def getVisible(self):
return self.datain['visible']
def getMuted(self):
return self.datain['muted']
def getLocked(self):
return self.datain['locked']
def getBounds(self):
return self.datain['bounds']
def getSourceWidth(self):
return self.datain['sourceWidth']
def getSourceHeight(self):
return self.datain['sourceHeight']
def getWidth(self):
return self.datain['width']
def getHeight(self):
return self.datain['height']
def getParentGroupName(self):
return self.datain['parentGroupName']
def getGroupChildren(self):
return self.datain['groupChildren']
class SetSceneItemProperties(Baserequests):
"""Sets the scene specific properties of a source. Unspecified properties will remain unchanged.
Coordinates are relative to the item's parent (the scene or group it belongs to).
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the source item belongs to. Defaults to the current scene.
*item*
type: String | Object
Scene Item name (if this field is a string) or specification (if it is an object).
*item.name*
type: String (optional)
Scene Item name (if the `item` field is an object)
*item.id*
type: int (optional)
Scene Item ID (if the `item` field is an object)
*position.x*
type: double (optional)
The new x position of the source.
*position.y*
type: double (optional)
The new y position of the source.
*position.alignment*
type: int (optional)
The new alignment of the source.
*rotation*
type: double (optional)
The new clockwise rotation of the item in degrees.
*scale.x*
type: double (optional)
The new x scale of the item.
*scale.y*
type: double (optional)
The new y scale of the item.
*crop.top*
type: int (optional)
The new amount of pixels cropped off the top of the source before scaling.
*crop.bottom*
type: int (optional)
The new amount of pixels cropped off the bottom of the source before scaling.
*crop.left*
type: int (optional)
The new amount of pixels cropped off the left of the source before scaling.
*crop.right*
type: int (optional)
The new amount of pixels cropped off the right of the source before scaling.
*visible*
type: bool (optional)
The new visibility of the source. 'true' shows source, 'false' hides source.
*locked*
type: bool (optional)
The new locked status of the source. 'true' keeps it in its current position, 'false' allows movement.
*bounds.type*
type: String (optional)
The new bounds type of the source. Can be "OBS_BOUNDS_STRETCH", "OBS_BOUNDS_SCALE_INNER", "OBS_BOUNDS_SCALE_OUTER", "OBS_BOUNDS_SCALE_TO_WIDTH", "OBS_BOUNDS_SCALE_TO_HEIGHT", "OBS_BOUNDS_MAX_ONLY" or "OBS_BOUNDS_NONE".
*bounds.alignment*
type: int (optional)
The new alignment of the bounding box. (0-2, 4-6, 8-10)
*bounds.x*
type: double (optional)
The new width of the bounding box.
*bounds.y*
type: double (optional)
The new height of the bounding box.
"""
def __init__(self, item, scene_name=None, position=None, rotation=None, scale=None, crop=None, visible=None, locked=None, bounds=None):
Baserequests.__init__(self)
self.name = 'SetSceneItemProperties'
self.dataout['item'] = item
self.dataout['scene-name'] = scene_name
self.dataout['position'] = position
self.dataout['rotation'] = rotation
self.dataout['scale'] = scale
self.dataout['crop'] = crop
self.dataout['visible'] = visible
self.dataout['locked'] = locked
self.dataout['bounds'] = bounds
class ResetSceneItem(Baserequests):
"""Reset a scene item.
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the current scene.
*item*
type: String | Object
Scene Item name (if this field is a string) or specification (if it is an object).
*item.name*
type: String (optional)
Scene Item name (if the `item` field is an object)
*item.id*
type: int (optional)
Scene Item ID (if the `item` field is an object)
"""
def __init__(self, item, scene_name=None):
Baserequests.__init__(self)
self.name = 'ResetSceneItem'
self.dataout['item'] = item
self.dataout['scene-name'] = scene_name
class SetSceneItemRender(Baserequests):
"""Show or hide a specified source item in a specified scene.
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the currently active scene.
*source*
type: String
Scene Item name.
*render*
type: boolean
true = shown ; false = hidden
"""
def __init__(self, source, render, scene_name=None):
Baserequests.__init__(self)
self.name = 'SetSceneItemRender'
self.dataout['source'] = source
self.dataout['render'] = render
self.dataout['scene-name'] = scene_name
class SetSceneItemPosition(Baserequests):
"""Sets the coordinates of a specified source item.
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the current scene.
*item*
type: String
Scene Item name.
*x*
type: double
X coordinate.
*y*
type: double
Y coordinate.
"""
def __init__(self, item, x, y, scene_name=None):
Baserequests.__init__(self)
self.name = 'SetSceneItemPosition'
self.dataout['item'] = item
self.dataout['x'] = x
self.dataout['y'] = y
self.dataout['scene-name'] = scene_name
class SetSceneItemTransform(Baserequests):
"""Set the transform of the specified source item.
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the current scene.
*item*
type: String
Scene Item name.
*x_scale*
type: double
Width scale factor.
*y_scale*
type: double
Height scale factor.
*rotation*
type: double
Source item rotation (in degrees).
"""
def __init__(self, item, x_scale, y_scale, rotation, scene_name=None):
Baserequests.__init__(self)
self.name = 'SetSceneItemTransform'
self.dataout['item'] = item
self.dataout['x-scale'] = x_scale
self.dataout['y-scale'] = y_scale
self.dataout['rotation'] = rotation
self.dataout['scene-name'] = scene_name
class SetSceneItemCrop(Baserequests):
"""Sets the crop coordinates of the specified source item.
:Arguments:
*scene_name*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the current scene.
*item*
type: String
Scene Item name.
*top*
type: int
Pixel position of the top of the source item.
*bottom*
type: int
Pixel position of the bottom of the source item.
*left*
type: int
Pixel position of the left of the source item.
*right*
type: int
Pixel position of the right of the source item.
"""
def __init__(self, item, top, bottom, left, right, scene_name=None):
Baserequests.__init__(self)
self.name = 'SetSceneItemCrop'
self.dataout['item'] = item
self.dataout['top'] = top
self.dataout['bottom'] = bottom
self.dataout['left'] = left
self.dataout['right'] = right
self.dataout['scene-name'] = scene_name
class DeleteSceneItem(Baserequests):
"""Deletes a scene item.
:Arguments:
*scene*
type: String (optional)
Name of the scene the scene item belongs to. Defaults to the current scene.
*item*
type: Object
Scene item to delete (required)
*item.name*
type: String
Scene Item name (prefer `id`, including both is acceptable).
*item.id*
type: int
Scene Item ID.
"""
def __init__(self, item, scene=None):
Baserequests.__init__(self)
self.name = 'DeleteSceneItem'
self.dataout['item'] = item
self.dataout['scene'] = scene
class AddSceneItem(Baserequests):
"""Creates a scene item in a scene. In other words, this is how you add a source into a scene.
:Arguments:
*sceneName*
type: String
Name of the scene to create the scene item in
*sourceName*
type: String
Name of the source to be added
*setVisible*
type: boolean
Whether to make the sceneitem visible on creation or not. Default `true`
:Returns:
*itemId*
type: int
Numerical ID of the created scene item
"""
def __init__(self, sceneName, sourceName, setVisible):
Baserequests.__init__(self)
self.name = 'AddSceneItem'
self.datain['itemId'] = None
self.dataout['sceneName'] = sceneName
self.dataout['sourceName'] = sourceName
self.dataout['setVisible'] = setVisible
def getItemId(self):
return self.datain['itemId']
class DuplicateSceneItem(Baserequests):
"""Duplicates a scene item.
:Arguments:
*fromScene*
type: String (optional)
Name of the scene to copy the item from. Defaults to the current scene.
*toScene*
type: String (optional)
Name of the scene to create the item in. Defaults to the current scene.
*item*
type: Object
Scene Item to duplicate from the source scene (required)
*item.name*
type: String
Scene Item name (prefer `id`, including both is acceptable).
*item.id*
type: int
Scene Item ID.
:Returns:
*scene*
type: String
Name of the scene where the new item was created
*item*
type: Object
New item info
*item.id*
type: int
New item ID
*item.name*
type: String
New item name
"""
def __init__(self, item, fromScene=None, toScene=None):
Baserequests.__init__(self)
self.name = 'DuplicateSceneItem'
self.datain['scene'] = None
self.datain['item'] = None
self.dataout['item'] = item
self.dataout['fromScene'] = fromScene
self.dataout['toScene'] = toScene
def getScene(self):
return self.datain['scene']
def getItem(self):
return self.datain['item']
class SetCurrentScene(Baserequests):
"""Switch to the specified scene.
:Arguments:
*scene_name*
type: String
Name of the scene to switch to.
"""
def __init__(self, scene_name):
Baserequests.__init__(self)
self.name = 'SetCurrentScene'
self.dataout['scene-name'] = scene_name
class GetCurrentScene(Baserequests):
"""Get the current scene's name and source items.
:Returns:
*name*
type: String
Name of the currently active scene.
*sources*
type: Array<SceneItem>
Ordered list of the current scene's source items.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetCurrentScene'
self.datain['name'] = None
self.datain['sources'] = None
def getName(self):
return self.datain['name']
def getSources(self):
return self.datain['sources']
class GetSceneList(Baserequests):
"""Get a list of scenes in the currently active profile.
:Returns:
*current_scene*
type: String
Name of the currently active scene.
*scenes*
type: Array<Scene>
Ordered list of the current profile's scenes (See [GetCurrentScene](#getcurrentscene) for more information).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetSceneList'
self.datain['current-scene'] = None
self.datain['scenes'] = None
def getCurrentScene(self):
return self.datain['current-scene']
def getScenes(self):
return self.datain['scenes']
class CreateScene(Baserequests):
"""Create a new scene scene.
:Arguments:
*sceneName*
type: String
Name of the scene to create.
"""
def __init__(self, sceneName):
Baserequests.__init__(self)
self.name = 'CreateScene'
self.dataout['sceneName'] = sceneName
class ReorderSceneItems(Baserequests):
"""Changes the order of scene items in the requested scene.
:Arguments:
*scene*
type: String (optional)
Name of the scene to reorder (defaults to current).
*items*
type: Array<Scene>
Ordered list of objects with name and/or id specified. Id preferred due to uniqueness per scene
*items.*.id*
type: int (optional)
Id of a specific scene item. Unique on a scene by scene basis.
*items.*.name*
type: String (optional)
Name of a scene item. Sufficiently unique if no scene items share sources within the scene.
"""
def __init__(self, items, scene=None):
Baserequests.__init__(self)
self.name = 'ReorderSceneItems'
self.dataout['items'] = items
self.dataout['scene'] = scene
class SetSceneTransitionOverride(Baserequests):
"""Set a scene to use a specific transition override.
:Arguments:
*sceneName*
type: String
Name of the scene to switch to.
*transitionName*
type: String
Name of the transition to use.
*transitionDuration*
type: int (Optional)
Duration in milliseconds of the transition if transition is not fixed. Defaults to the current duration specified in the UI if there is no current override and this value is not given.
"""
def __init__(self, sceneName, transitionName, transitionDuration):
Baserequests.__init__(self)
self.name = 'SetSceneTransitionOverride'
self.dataout['sceneName'] = sceneName
self.dataout['transitionName'] = transitionName
self.dataout['transitionDuration'] = transitionDuration
class RemoveSceneTransitionOverride(Baserequests):
"""Remove any transition override on a scene.
:Arguments:
*sceneName*
type: String
Name of the scene to switch to.
"""
def __init__(self, sceneName):
Baserequests.__init__(self)
self.name = 'RemoveSceneTransitionOverride'
self.dataout['sceneName'] = sceneName
class GetSceneTransitionOverride(Baserequests):
"""Get the current scene transition override.
:Arguments:
*sceneName*
type: String
Name of the scene to switch to.
:Returns:
*transitionName*
type: String
Name of the current overriding transition. Empty string if no override is set.
*transitionDuration*
type: int
Transition duration. `-1` if no override is set.
"""
def __init__(self, sceneName):
Baserequests.__init__(self)
self.name = 'GetSceneTransitionOverride'
self.datain['transitionName'] = None
self.datain['transitionDuration'] = None
self.dataout['sceneName'] = sceneName
def getTransitionName(self):
return self.datain['transitionName']
def getTransitionDuration(self):
return self.datain['transitionDuration']
class GetStreamingStatus(Baserequests):
"""Get current streaming and recording status.
:Returns:
*streaming*
type: boolean
Current streaming status.
*recording*
type: boolean
Current recording status.
*stream_timecode*
type: String (optional)
Time elapsed since streaming started (only present if currently streaming).
*rec_timecode*
type: String (optional)
Time elapsed since recording started (only present if currently recording).
*preview_only*
type: boolean
Always false. Retrocompatibility with OBSRemote.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetStreamingStatus'
self.datain['streaming'] = None
self.datain['recording'] = None
self.datain['stream-timecode'] = None
self.datain['rec-timecode'] = None
self.datain['preview-only'] = None
def getStreaming(self):
return self.datain['streaming']
def getRecording(self):
return self.datain['recording']
def getStreamTimecode(self):
return self.datain['stream-timecode']
def getRecTimecode(self):
return self.datain['rec-timecode']
def getPreviewOnly(self):
return self.datain['preview-only']
class StartStopStreaming(Baserequests):
"""Toggle streaming on or off (depending on the current stream state).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StartStopStreaming'
class StartStreaming(Baserequests):
"""Start streaming.
Will return an `error` if streaming is already active.
:Arguments:
*stream*
type: Object (optional)
Special stream configuration. Please note: these won't be saved to OBS' configuration.
*stream.type*
type: String (optional)
If specified ensures the type of stream matches the given type (usually 'rtmp_custom' or 'rtmp_common'). If the currently configured stream type does not match the given stream type, all settings must be specified in the `settings` object or an error will occur when starting the stream.
*stream.metadata*
type: Object (optional)
Adds the given object parameters as encoded query string parameters to the 'key' of the RTMP stream. Used to pass data to the RTMP service about the streaming. May be any String, Numeric, or Boolean field.
*stream.settings*
type: Object (optional)
Settings for the stream.
*stream.settings.server*
type: String (optional)
The publish URL.
*stream.settings.key*
type: String (optional)
The publish key of the stream.
*stream.settings.use_auth*
type: boolean (optional)
Indicates whether authentication should be used when connecting to the streaming server.
*stream.settings.username*
type: String (optional)
If authentication is enabled, the username for the streaming server. Ignored if `use_auth` is not set to `true`.
*stream.settings.password*
type: String (optional)
If authentication is enabled, the password for the streaming server. Ignored if `use_auth` is not set to `true`.
"""
def __init__(self, stream=None):
Baserequests.__init__(self)
self.name = 'StartStreaming'
self.dataout['stream'] = stream
class StopStreaming(Baserequests):
"""Stop streaming.
Will return an `error` if streaming is not active.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'StopStreaming'
class SetStreamSettings(Baserequests):
"""Sets one or more attributes of the current streaming server settings. Any options not passed will remain unchanged. Returns the updated settings in response. If 'type' is different than the current streaming service type, all settings are required. Returns the full settings of the stream (the same as GetStreamSettings).
:Arguments:
*type*
type: String
The type of streaming service configuration, usually `rtmp_custom` or `rtmp_common`.
*settings*
type: Object
The actual settings of the stream.
*settings.server*
type: String (optional)
The publish URL.
*settings.key*
type: String (optional)
The publish key.
*settings.use_auth*
type: boolean (optional)
Indicates whether authentication should be used when connecting to the streaming server.
*settings.username*
type: String (optional)
The username for the streaming service.
*settings.password*
type: String (optional)
The password for the streaming service.
*save*
type: boolean
Persist the settings to disk.
"""
def __init__(self, type, settings, save):
Baserequests.__init__(self)
self.name = 'SetStreamSettings'
self.dataout['type'] = type
self.dataout['settings'] = settings
self.dataout['save'] = save
class GetStreamSettings(Baserequests):
"""Get the current streaming server settings.
:Returns:
*type*
type: String
The type of streaming service configuration. Possible values: 'rtmp_custom' or 'rtmp_common'.
*settings*
type: Object
Stream settings object.
*settings.server*
type: String
The publish URL.
*settings.key*
type: String
The publish key of the stream.
*settings.use_auth*
type: boolean
Indicates whether authentication should be used when connecting to the streaming server.
*settings.username*
type: String
The username to use when accessing the streaming server. Only present if `use_auth` is `true`.
*settings.password*
type: String
The password to use when accessing the streaming server. Only present if `use_auth` is `true`.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetStreamSettings'
self.datain['type'] = None
self.datain['settings'] = None
def getType(self):
return self.datain['type']
def getSettings(self):
return self.datain['settings']
class SaveStreamSettings(Baserequests):
"""Save the current streaming server settings to disk.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'SaveStreamSettings'
class SendCaptions(Baserequests):
"""Send the provided text as embedded CEA-608 caption data.
:Arguments:
*text*
type: String
Captions text
"""
def __init__(self, text):
Baserequests.__init__(self)
self.name = 'SendCaptions'
self.dataout['text'] = text
class GetStudioModeStatus(Baserequests):
"""Indicates if Studio Mode is currently enabled.
:Returns:
*studio_mode*
type: boolean
Indicates if Studio Mode is enabled.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetStudioModeStatus'
self.datain['studio-mode'] = None
def getStudioMode(self):
return self.datain['studio-mode']
class GetPreviewScene(Baserequests):
"""Get the name of the currently previewed scene and its list of sources.
Will return an `error` if Studio Mode is not enabled.
:Returns:
*name*
type: String
The name of the active preview scene.
*sources*
type: Array<SceneItem>
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetPreviewScene'
self.datain['name'] = None
self.datain['sources'] = None
def getName(self):
return self.datain['name']
def getSources(self):
return self.datain['sources']
class SetPreviewScene(Baserequests):
"""Set the active preview scene.
Will return an `error` if Studio Mode is not enabled.
:Arguments:
*scene_name*
type: String
The name of the scene to preview.
"""
def __init__(self, scene_name):
Baserequests.__init__(self)
self.name = 'SetPreviewScene'
self.dataout['scene-name'] = scene_name
class TransitionToProgram(Baserequests):
"""Transitions the currently previewed scene to the main output.
Will return an `error` if Studio Mode is not enabled.
:Arguments:
*with_transition*
type: Object (optional)
Change the active transition before switching scenes. Defaults to the active transition.
*with_transition.name*
type: String
Name of the transition.
*with_transition.duration*
type: int (optional)
Transition duration (in milliseconds).
"""
def __init__(self, with_transition=None):
Baserequests.__init__(self)
self.name = 'TransitionToProgram'
self.dataout['with-transition'] = with_transition
class EnableStudioMode(Baserequests):
"""Enables Studio Mode.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'EnableStudioMode'
class DisableStudioMode(Baserequests):
"""Disables Studio Mode.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'DisableStudioMode'
class ToggleStudioMode(Baserequests):
"""Toggles Studio Mode (depending on the current state of studio mode).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'ToggleStudioMode'
class GetTransitionList(Baserequests):
"""List of all transitions available in the frontend's dropdown menu.
:Returns:
*current_transition*
type: String
Name of the currently active transition.
*transitions*
type: Array<Object>
List of transitions.
*transitions.*.name*
type: String
Name of the transition.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetTransitionList'
self.datain['current-transition'] = None
self.datain['transitions'] = None
def getCurrentTransition(self):
return self.datain['current-transition']
def getTransitions(self):
return self.datain['transitions']
class GetCurrentTransition(Baserequests):
"""Get the name of the currently selected transition in the frontend's dropdown menu.
:Returns:
*name*
type: String
Name of the selected transition.
*duration*
type: int (optional)
Transition duration (in milliseconds) if supported by the transition.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetCurrentTransition'
self.datain['name'] = None
self.datain['duration'] = None
def getName(self):
return self.datain['name']
def getDuration(self):
return self.datain['duration']
class SetCurrentTransition(Baserequests):
"""Set the active transition.
:Arguments:
*transition_name*
type: String
The name of the transition.
"""
def __init__(self, transition_name):
Baserequests.__init__(self)
self.name = 'SetCurrentTransition'
self.dataout['transition-name'] = transition_name
class SetTransitionDuration(Baserequests):
"""Set the duration of the currently selected transition if supported.
:Arguments:
*duration*
type: int
Desired duration of the transition (in milliseconds).
"""
def __init__(self, duration):
Baserequests.__init__(self)
self.name = 'SetTransitionDuration'
self.dataout['duration'] = duration
class GetTransitionDuration(Baserequests):
"""Get the duration of the currently selected transition if supported.
:Returns:
*transition_duration*
type: int
Duration of the current transition (in milliseconds).
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetTransitionDuration'
self.datain['transition-duration'] = None
def getTransitionDuration(self):
return self.datain['transition-duration']
class GetTransitionPosition(Baserequests):
"""Get the position of the current transition.
:Returns:
*position*
type: double
current transition position. This value will be between 0.0 and 1.0. Note: Transition returns 1.0 when not active.
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'GetTransitionPosition'
self.datain['position'] = None
def getPosition(self):
return self.datain['position']
class GetTransitionSettings(Baserequests):
"""Get the current settings of a transition
:Arguments:
*transitionName*
type: String
Transition name
:Returns:
*transitionSettings*
type: Object
Current transition settings
"""
def __init__(self, transitionName):
Baserequests.__init__(self)
self.name = 'GetTransitionSettings'
self.datain['transitionSettings'] = None
self.dataout['transitionName'] = transitionName
def getTransitionSettings(self):
return self.datain['transitionSettings']
class SetTransitionSettings(Baserequests):
"""Change the current settings of a transition
:Arguments:
*transitionName*
type: String
Transition name
*transitionSettings*
type: Object
Transition settings (they can be partial)
:Returns:
*transitionSettings*
type: Object
Updated transition settings
"""
def __init__(self, transitionName, transitionSettings):
Baserequests.__init__(self)
self.name = 'SetTransitionSettings'
self.datain['transitionSettings'] = None
self.dataout['transitionName'] = transitionName
self.dataout['transitionSettings'] = transitionSettings
def getTransitionSettings(self):
return self.datain['transitionSettings']
class ReleaseTBar(Baserequests):
"""Release the T-Bar (like a user releasing their mouse button after moving it).
*YOU MUST CALL THIS if you called `SetTBarPosition` with the `release` parameter set to `false`.*
"""
def __init__(self):
Baserequests.__init__(self)
self.name = 'ReleaseTBar'
class SetTBarPosition(Baserequests):
"""
If your code needs to perform multiple successive T-Bar moves (e.g. : in an animation, or in response to a user moving a T-Bar control in your User Interface), set `release` to false and call `ReleaseTBar` later once the animation/interaction is over.
:Arguments:
*position*
type: double
T-Bar position. This value must be between 0.0 and 1.0.
*release*
type: boolean (optional)
Whether or not the T-Bar gets released automatically after setting its new position (like a user releasing their mouse button after moving the T-Bar). Call `ReleaseTBar` manually if you set `release` to false. Defaults to true.
"""
def __init__(self, position, release=None):
Baserequests.__init__(self)
self.name = 'SetTBarPosition'
self.dataout['position'] = position
self.dataout['release'] = release
| 29.682412
| 417
| 0.601075
| 11,295
| 106,827
| 5.570075
| 0.092253
| 0.049592
| 0.034714
| 0.049592
| 0.521458
| 0.443733
| 0.362686
| 0.318419
| 0.260149
| 0.206631
| 0
| 0.003246
| 0.307797
| 106,827
| 3,598
| 418
| 29.690661
| 0.847564
| 0.508869
| 0
| 0.384283
| 1
| 0
| 0.141892
| 0.016215
| 0
| 0
| 0
| 0
| 0
| 1
| 0.240069
| false
| 0
| 0.000864
| 0.134715
| 0.481002
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 3
|
1351156463c6a25e82b73e57ee20368b3d832d46
| 2,017
|
py
|
Python
|
app/grandchallenge/challenges/migrations/0023_auto_20200123_1102.py
|
njmhendrix/grand-challenge.org
|
9bc36f5e26561a78bd405e8ea5e4c0f86c95f011
|
[
"Apache-2.0"
] | 1
|
2021-02-09T10:30:44.000Z
|
2021-02-09T10:30:44.000Z
|
app/grandchallenge/challenges/migrations/0023_auto_20200123_1102.py
|
njmhendrix/grand-challenge.org
|
9bc36f5e26561a78bd405e8ea5e4c0f86c95f011
|
[
"Apache-2.0"
] | null | null | null |
app/grandchallenge/challenges/migrations/0023_auto_20200123_1102.py
|
njmhendrix/grand-challenge.org
|
9bc36f5e26561a78bd405e8ea5e4c0f86c95f011
|
[
"Apache-2.0"
] | null | null | null |
# Generated by Django 3.0.2 on 2020-01-23 11:02
import re
import django.contrib.postgres.fields.citext
import django.core.validators
from django.db import migrations
import grandchallenge.challenges.models
class Migration(migrations.Migration):
dependencies = [
("challenges", "0022_auto_20200121_1639"),
]
operations = [
migrations.AlterField(
model_name="challenge",
name="short_name",
field=django.contrib.postgres.fields.citext.CICharField(
help_text="short name used in url, specific css, files etc. No spaces allowed",
max_length=50,
unique=True,
validators=[
grandchallenge.challenges.models.validate_nounderscores,
django.core.validators.RegexValidator(
re.compile("^[-a-zA-Z0-9_]+\\Z"),
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
"invalid",
),
grandchallenge.challenges.models.validate_short_name,
],
),
),
migrations.AlterField(
model_name="externalchallenge",
name="short_name",
field=django.contrib.postgres.fields.citext.CICharField(
help_text="short name used in url, specific css, files etc. No spaces allowed",
max_length=50,
unique=True,
validators=[
grandchallenge.challenges.models.validate_nounderscores,
django.core.validators.RegexValidator(
re.compile("^[-a-zA-Z0-9_]+\\Z"),
"Enter a valid “slug” consisting of letters, numbers, underscores or hyphens.",
"invalid",
),
grandchallenge.challenges.models.validate_short_name,
],
),
),
]
| 36.017857
| 103
| 0.543877
| 182
| 2,017
| 5.923077
| 0.434066
| 0.050093
| 0.139147
| 0.141002
| 0.715213
| 0.684601
| 0.684601
| 0.684601
| 0.684601
| 0.684601
| 0
| 0.030374
| 0.363411
| 2,017
| 55
| 104
| 36.672727
| 0.80919
| 0.02231
| 0
| 0.723404
| 1
| 0
| 0.209645
| 0.011675
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.106383
| 0
| 0.170213
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
1354ab456ba9280a4363560bf56997305ed54a5f
| 3,692
|
py
|
Python
|
BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
|
KaoTuz/edk2-stable202108
|
49d9306e7bf64b2f07d8473be1f2faea49d0a012
|
[
"Python-2.0",
"Zlib",
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-3-Clause"
] | 9
|
2021-07-26T17:02:51.000Z
|
2021-12-30T10:49:46.000Z
|
BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
|
ESdove/edk2_exploring
|
34ff32b45f43d233d9696e7c8e3de68ea3000a7b
|
[
"Python-2.0",
"Zlib",
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-3-Clause"
] | null | null | null |
BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
|
ESdove/edk2_exploring
|
34ff32b45f43d233d9696e7c8e3de68ea3000a7b
|
[
"Python-2.0",
"Zlib",
"BSD-2-Clause",
"MIT",
"BSD-2-Clause-Patent",
"BSD-3-Clause"
] | null | null | null |
## @file
# This file is used to define class objects of INF file miscellaneous.
# Include BootMode/HOB/Event and others. It will consumed by InfParser.
#
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
'''
InfMisc
'''
import Logger.Log as Logger
from Logger import ToolError
from Library import DataType as DT
from Object.Parser.InfCommonObject import InfSectionCommonDef
from Library.Misc import Sdict
##
# BootModeObject
#
class InfBootModeObject():
def __init__(self):
self.SupportedBootModes = ''
self.HelpString = ''
self.Usage = ''
def SetSupportedBootModes(self, SupportedBootModes):
self.SupportedBootModes = SupportedBootModes
def GetSupportedBootModes(self):
return self.SupportedBootModes
def SetHelpString(self, HelpString):
self.HelpString = HelpString
def GetHelpString(self):
return self.HelpString
def SetUsage(self, Usage):
self.Usage = Usage
def GetUsage(self):
return self.Usage
##
# EventObject
#
class InfEventObject():
def __init__(self):
self.EventType = ''
self.HelpString = ''
self.Usage = ''
def SetEventType(self, EventType):
self.EventType = EventType
def GetEventType(self):
return self.EventType
def SetHelpString(self, HelpString):
self.HelpString = HelpString
def GetHelpString(self):
return self.HelpString
def SetUsage(self, Usage):
self.Usage = Usage
def GetUsage(self):
return self.Usage
##
# HobObject
#
class InfHobObject():
def __init__(self):
self.HobType = ''
self.Usage = ''
self.SupArchList = []
self.HelpString = ''
def SetHobType(self, HobType):
self.HobType = HobType
def GetHobType(self):
return self.HobType
def SetUsage(self, Usage):
self.Usage = Usage
def GetUsage(self):
return self.Usage
def SetSupArchList(self, ArchList):
self.SupArchList = ArchList
def GetSupArchList(self):
return self.SupArchList
def SetHelpString(self, HelpString):
self.HelpString = HelpString
def GetHelpString(self):
return self.HelpString
##
# InfSpecialCommentObject
#
class InfSpecialCommentObject(InfSectionCommonDef):
def __init__(self):
self.SpecialComments = Sdict()
InfSectionCommonDef.__init__(self)
def SetSpecialComments(self, SepcialSectionList = None, Type = ''):
if Type == DT.TYPE_HOB_SECTION or \
Type == DT.TYPE_EVENT_SECTION or \
Type == DT.TYPE_BOOTMODE_SECTION:
for Item in SepcialSectionList:
if Type in self.SpecialComments:
ObjList = self.SpecialComments[Type]
ObjList.append(Item)
self.SpecialComments[Type] = ObjList
else:
ObjList = []
ObjList.append(Item)
self.SpecialComments[Type] = ObjList
return True
def GetSpecialComments(self):
return self.SpecialComments
## ErrorInInf
#
# An encapsulate of Error for INF parser.
#
def ErrorInInf(Message=None, ErrorCode=None, LineInfo=None, RaiseError=True):
if ErrorCode is None:
ErrorCode = ToolError.FORMAT_INVALID
if LineInfo is None:
LineInfo = ['', -1, '']
Logger.Error("InfParser",
ErrorCode,
Message=Message,
File=LineInfo[0],
Line=LineInfo[1],
ExtraData=LineInfo[2],
RaiseError=RaiseError)
| 25.818182
| 77
| 0.628115
| 359
| 3,692
| 6.384401
| 0.320334
| 0.073298
| 0.06719
| 0.026178
| 0.287086
| 0.247819
| 0.247819
| 0.206806
| 0.206806
| 0.206806
| 0
| 0.004913
| 0.283315
| 3,692
| 142
| 78
| 26
| 0.8613
| 0.103196
| 0
| 0.408602
| 0
| 0
| 0.002748
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.290323
| false
| 0
| 0.053763
| 0.11828
| 0.516129
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
135a363584e253a0fd487ab5902e769a0e03931f
| 1,236
|
py
|
Python
|
src/part_2_automation/test_test1.py
|
AndreiHustiuc/IT_Factory_Course
|
c6f3e4a9282a1c19c0f52c79f0c81f026814a02a
|
[
"MIT"
] | null | null | null |
src/part_2_automation/test_test1.py
|
AndreiHustiuc/IT_Factory_Course
|
c6f3e4a9282a1c19c0f52c79f0c81f026814a02a
|
[
"MIT"
] | null | null | null |
src/part_2_automation/test_test1.py
|
AndreiHustiuc/IT_Factory_Course
|
c6f3e4a9282a1c19c0f52c79f0c81f026814a02a
|
[
"MIT"
] | 1
|
2022-03-16T10:39:03.000Z
|
2022-03-16T10:39:03.000Z
|
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class TestTest1():
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def test_test1(self):
self.driver.get("https://www.wikipedia.org/")
self.driver.set_window_size(1920, 1040)
self.driver.find_element(By.ID, "searchInput").click()
self.driver.find_element(By.ID, "searchInput").send_keys("Romania")
self.driver.find_element(By.ID, "searchInput").send_keys(Keys.ENTER)
self.driver.find_element(By.CSS_SELECTOR, ".tocsection-21 .toctext").click()
self.driver.execute_script("window.scrollTo(0,10634)")
self.driver.find_element(By.CSS_SELECTOR, ".thumb:nth-child(30) .thumbimage").click()
self.driver.execute_script("window.scrollTo(0,0)")
| 38.625
| 89
| 0.768608
| 166
| 1,236
| 5.608434
| 0.415663
| 0.118153
| 0.135338
| 0.112782
| 0.354458
| 0.298604
| 0.298604
| 0.186896
| 0.094522
| 0
| 0
| 0.020018
| 0.110841
| 1,236
| 31
| 90
| 39.870968
| 0.827116
| 0.020227
| 0
| 0
| 1
| 0
| 0.136476
| 0.019851
| 0
| 0
| 0
| 0
| 0
| 1
| 0.115385
| false
| 0
| 0.384615
| 0
| 0.538462
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
135f9b393c2da1b1ae7cb6b4ea51c6e47c87c3b3
| 2,976
|
py
|
Python
|
web3/_utils/module_testing/math_contract.py
|
y19818/web3.py
|
32a85a287ab63220d1e0c06d77be74de595ff02f
|
[
"MIT"
] | null | null | null |
web3/_utils/module_testing/math_contract.py
|
y19818/web3.py
|
32a85a287ab63220d1e0c06d77be74de595ff02f
|
[
"MIT"
] | null | null | null |
web3/_utils/module_testing/math_contract.py
|
y19818/web3.py
|
32a85a287ab63220d1e0c06d77be74de595ff02f
|
[
"MIT"
] | null | null | null |
MATH_BYTECODE = (
"606060405261022e806100126000396000f360606040523615610074576000357c01000000000000"
"000000000000000000000000000000000000000000009004806316216f391461007657806361bc22"
"1a146100995780637cf5dab0146100bc578063a5f3c23b146100e8578063d09de08a1461011d5780"
"63dcf537b11461014057610074565b005b610083600480505061016c565b60405180828152602001"
"91505060405180910390f35b6100a6600480505061017f565b604051808281526020019150506040"
"5180910390f35b6100d26004808035906020019091905050610188565b6040518082815260200191"
"505060405180910390f35b61010760048080359060200190919080359060200190919050506101ea"
"565b6040518082815260200191505060405180910390f35b61012a6004805050610201565b604051"
"8082815260200191505060405180910390f35b610156600480803590602001909190505061021756"
"5b6040518082815260200191505060405180910390f35b6000600d9050805080905061017c565b90"
"565b60006000505481565b6000816000600082828250540192505081905550600060005054905080"
"507f3496c3ede4ec3ab3686712aa1c238593ea6a42df83f98a5ec7df9834cfa577c5816040518082"
"815260200191505060405180910390a18090506101e5565b919050565b6000818301905080508090"
"506101fb565b92915050565b600061020d6001610188565b9050610214565b90565b600060078202"
"90508050809050610229565b91905056"
)
MATH_ABI = [
{
"constant": False,
"inputs": [],
"name": "return13",
"outputs": [
{"name": "result", "type": "int256"},
],
"type": "function",
},
{
"constant": True,
"inputs": [],
"name": "counter",
"outputs": [
{"name": "", "type": "uint256"},
],
"type": "function",
},
{
"constant": False,
"inputs": [
{"name": "amt", "type": "uint256"},
],
"name": "increment",
"outputs": [
{"name": "result", "type": "uint256"},
],
"type": "function",
},
{
"constant": False,
"inputs": [
{"name": "a", "type": "int256"},
{"name": "b", "type": "int256"},
],
"name": "add",
"outputs": [
{"name": "result", "type": "int256"},
],
"type": "function",
},
{
"constant": False,
"inputs": [],
"name": "increment",
"outputs": [
{"name": "", "type": "uint256"},
],
"type": "function"
},
{
"constant": False,
"inputs": [
{"name": "a", "type": "int256"},
],
"name": "multiply7",
"outputs": [
{"name": "result", "type": "int256"},
],
"type": "function",
},
{
"anonymous": False,
"inputs": [
{"indexed": False, "name": "value", "type": "uint256"},
],
"name": "Increased",
"type": "event",
},
]
| 32.347826
| 87
| 0.576949
| 118
| 2,976
| 14.533898
| 0.355932
| 0.038484
| 0.055394
| 0.067055
| 0.197085
| 0.197085
| 0.188338
| 0.165598
| 0.110787
| 0.110787
| 0
| 0.512966
| 0.287298
| 2,976
| 91
| 88
| 32.703297
| 0.295615
| 0
| 0
| 0.477273
| 0
| 0
| 0.574549
| 0.399445
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
13662d9d6240c63c9a734dfc856cbc7f4107d5e2
| 160
|
py
|
Python
|
objects/fun_return.py
|
padmacho/pythontutorial
|
80c58d2d6efc0c3598f92b627338c6cd9fda1759
|
[
"Apache-2.0"
] | null | null | null |
objects/fun_return.py
|
padmacho/pythontutorial
|
80c58d2d6efc0c3598f92b627338c6cd9fda1759
|
[
"Apache-2.0"
] | null | null | null |
objects/fun_return.py
|
padmacho/pythontutorial
|
80c58d2d6efc0c3598f92b627338c6cd9fda1759
|
[
"Apache-2.0"
] | null | null | null |
def modify(y):
return y # returns same reference. No new object is created
x = [1, 2, 3]
y = modify(x)
print("x == y", x == y)
print("x == y", x is y)
| 26.666667
| 65
| 0.55625
| 31
| 160
| 2.870968
| 0.548387
| 0.067416
| 0.157303
| 0.179775
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025424
| 0.2625
| 160
| 6
| 66
| 26.666667
| 0.728814
| 0.3
| 0
| 0
| 0
| 0
| 0.113208
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.166667
| false
| 0
| 0
| 0.166667
| 0.333333
| 0.333333
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
|
0
| 3
|
136832386a64df8b748feecd13c99a4dc30fc9d5
| 735
|
py
|
Python
|
test/test_utils.py
|
by46/recipe
|
203abd2141a536b66b4e57d073169a49395be1f0
|
[
"MIT"
] | null | null | null |
test/test_utils.py
|
by46/recipe
|
203abd2141a536b66b4e57d073169a49395be1f0
|
[
"MIT"
] | null | null | null |
test/test_utils.py
|
by46/recipe
|
203abd2141a536b66b4e57d073169a49395be1f0
|
[
"MIT"
] | null | null | null |
import unittest
from recipe import utils
class UtilTestCase(unittest.TestCase):
def test_valid_project_slug(self):
project_slug = "Recipe0123456789_mock"
self.assertTrue(utils.valid_project_slug(project_slug))
project_slug = 'Recipe00000000000000000000000000000000000000000000'
self.assertTrue(utils.valid_project_slug(project_slug))
project_slug = ""
self.assertFalse(utils.valid_project_slug(project_slug))
project_slug = "Recipe000000000000000000000000000000000000000000001"
self.assertFalse(utils.valid_project_slug(project_slug))
project_slug = "-!@#$%^&*()_+"
self.assertFalse(utils.valid_project_slug(project_slug))
| 33.409091
| 77
| 0.719728
| 70
| 735
| 7.2
| 0.285714
| 0.349206
| 0.321429
| 0.392857
| 0.549603
| 0.549603
| 0.549603
| 0.549603
| 0.549603
| 0.549603
| 0
| 0.166948
| 0.193197
| 735
| 21
| 78
| 35
| 0.682968
| 0
| 0
| 0.357143
| 0
| 0
| 0.189076
| 0.170868
| 0
| 0
| 0
| 0
| 0.357143
| 1
| 0.071429
| false
| 0
| 0.142857
| 0
| 0.285714
| 0
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
13716a3c1d81e757e4d87853e2f35128b1e83ff1
| 5,329
|
py
|
Python
|
src/pkgcore/restrictions/restriction.py
|
mgorny/pkgcore
|
ab4a718aa1626f4edeb385383f5595a1e262b0dc
|
[
"BSD-3-Clause"
] | null | null | null |
src/pkgcore/restrictions/restriction.py
|
mgorny/pkgcore
|
ab4a718aa1626f4edeb385383f5595a1e262b0dc
|
[
"BSD-3-Clause"
] | null | null | null |
src/pkgcore/restrictions/restriction.py
|
mgorny/pkgcore
|
ab4a718aa1626f4edeb385383f5595a1e262b0dc
|
[
"BSD-3-Clause"
] | null | null | null |
# Copyright: 2005-2012 Brian Harring <[email protected]
# Copyright: 2006 Marien Zwart <[email protected]>
# License: BSD/GPL2
"""
base restriction class
"""
from functools import partial
from snakeoil import caching, klass
from snakeoil.currying import pretty_docs
class base(object, metaclass=caching.WeakInstMeta):
"""base restriction matching object.
all derivatives *should* be __slot__ based (lot of instances may
wind up in memory).
"""
__inst_caching__ = True
# __weakref__ here is implicit via the metaclass
__slots__ = ()
package_matching = False
klass.inject_immutable_instance(locals())
def match(self, *arg, **kwargs):
raise NotImplementedError
def force_False(self, *arg, **kwargs):
return not self.match(*arg, **kwargs)
def force_True(self, *arg, **kwargs):
return self.match(*arg, **kwargs)
def __len__(self):
return 1
class AlwaysBool(base):
"""restriction that always yields a specific boolean"""
__slots__ = ("type", "negate")
__inst_caching__ = True
def __init__(self, node_type=None, negate=False):
"""
:param node_type: the restriction type the instance should be,
typically :obj:`pkgcore.restrictions.packages.package_type` or
:obj:`pkgcore.restrictions.values.value_type`
:param negate: boolean to return for the match
"""
object.__setattr__(self, "negate", negate)
object.__setattr__(self, "type", node_type)
def match(self, *a, **kw):
return self.negate
def force_True(self, *a, **kw):
return self.negate
def force_False(self, *a, **kw):
return not self.negate
def __iter__(self):
return iter(())
def __str__(self):
return f"always '{self.negate}'"
def __repr__(self):
return '<%s always %r @%#8x>' % (
self.__class__.__name__, self.negate, id(self))
def __getstate__(self):
return self.negate, self.type
def __setstate__(self, state):
negate, node_type = state
object.__setattr__(self, "negate", negate)
object.__setattr__(self, "type", node_type)
class Negate(base):
"""wrap and negate a restriction instance"""
__slots__ = ("type", "_restrict")
__inst_caching__ = False
def __init__(self, restrict):
"""
:param restrict: :obj:`pkgcore.restrictions.restriction.base` instance
to negate
"""
sf = object.__setattr__
sf(self, "type", restrict.type)
sf(self, "_restrict", restrict)
def match(self, *a, **kw):
return not self._restrict.match(*a, **kw)
def __str__(self):
return "not (%s)" % self._restrict
class FakeType(base):
"""wrapper to wrap and fake a node_type"""
__slots__ = ("type", "_restrict")
__inst_caching__ = False
def __init__(self, restrict, new_type):
"""
:param restrict: :obj:`pkgcore.restrictions.restriction.base` instance
to wrap
:param new_type: new node_type
"""
sf = object.__setattr__
sf(self, "type", new_type)
sf(self, "_restrict", restrict)
def match(self, *a, **kw):
return self._restrict.match(*a, **kw)
def __str__(self):
return "Faked type(%s): %s" % (self.type, self._restrict)
class AnyMatch(base):
"""Apply a nested restriction to every item in a sequence."""
__slots__ = ('restriction', 'type', 'negate')
def __init__(self, childrestriction, node_type, negate=False):
"""Initialize.
:type childrestriction: restriction
:param childrestriction: child restriction applied to every value.
:type node_type: string
:param node_type: type of this restriction.
"""
sf = object.__setattr__
sf(self, "negate", negate)
sf(self, "restriction", childrestriction)
sf(self, "type", node_type)
def match(self, val):
for x in val:
if self.restriction.match(x):
return not self.negate
return self.negate
def __str__(self):
return "any: %s match" % (self.restriction,)
def __repr__(self):
return '<%s restriction=%r @%#8x>' % (
self.__class__.__name__, self.restriction, id(self))
def curry_node_type(cls, node_type, extradoc=None):
"""Helper function for creating restrictions of a certain type.
This uses :obj:`partial` to pass a node_type to the wrapped class,
and extends the docstring.
:param cls: callable (usually a class) that is wrapped.
:param node_type: value passed as node_type.
:param extradoc: addition to the docstring. Defaults to
"Automatically set to %s type." % node_type
:return: a wrapped callable.
"""
if extradoc is None:
extradoc = "Automatically set to %s type." % (node_type,)
doc = cls.__doc__
result = partial(cls, node_type=node_type)
if doc is None:
doc = ''
else:
# do this so indentation on pydoc __doc__ is sane
doc = "\n".join(line.lstrip() for line in doc.split("\n")) + "\n"
doc += extradoc
return pretty_docs(result, doc)
value_type = "values"
package_type = "package"
valid_types = (value_type, package_type)
| 27.611399
| 78
| 0.627698
| 645
| 5,329
| 4.869767
| 0.268217
| 0.050939
| 0.026743
| 0.020694
| 0.279529
| 0.24801
| 0.212034
| 0.180834
| 0.161095
| 0.099968
| 0
| 0.004034
| 0.25577
| 5,329
| 192
| 79
| 27.755208
| 0.787948
| 0.289923
| 0
| 0.308511
| 0
| 0
| 0.078687
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.255319
| false
| 0
| 0.031915
| 0.170213
| 0.648936
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
137960c813f4163613ba4247cf3f11614175c045
| 320
|
py
|
Python
|
Lekcija08/script01.py
|
islamspahic/python-uup
|
ea7c9c655ad8e678bca5ee52138836732266799f
|
[
"Apache-2.0"
] | null | null | null |
Lekcija08/script01.py
|
islamspahic/python-uup
|
ea7c9c655ad8e678bca5ee52138836732266799f
|
[
"Apache-2.0"
] | null | null | null |
Lekcija08/script01.py
|
islamspahic/python-uup
|
ea7c9c655ad8e678bca5ee52138836732266799f
|
[
"Apache-2.0"
] | null | null | null |
tajniBroj = 51
broj = 2
while tajniBroj != broj:
broj = int(input("Pogodite tajni broj: "))
if tajniBroj == broj:
print("Pogodak!")
elif tajniBroj < broj:
print("Tajni broj je manji od tog broja.")
else:
print("Tajni broj je veci od tog broja.")
print("Kraj programa")
| 21.333333
| 50
| 0.590625
| 41
| 320
| 4.609756
| 0.536585
| 0.206349
| 0.190476
| 0.169312
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.013216
| 0.290625
| 320
| 14
| 51
| 22.857143
| 0.819383
| 0
| 0
| 0
| 0
| 0
| 0.334375
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.363636
| 0
| 0
| 0
| null | 1
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
137bf77da0a4c318b41b184deddd1c0849f9d010
| 11,196
|
py
|
Python
|
verification/tb_template.py
|
ahmednofal/DFFRAM
|
7d7ebc28befe12ec3f232c0d2f5b8ea786227d45
|
[
"Apache-2.0"
] | null | null | null |
verification/tb_template.py
|
ahmednofal/DFFRAM
|
7d7ebc28befe12ec3f232c0d2f5b8ea786227d45
|
[
"Apache-2.0"
] | null | null | null |
verification/tb_template.py
|
ahmednofal/DFFRAM
|
7d7ebc28befe12ec3f232c0d2f5b8ea786227d45
|
[
"Apache-2.0"
] | null | null | null |
# Copyright ©2020-2021 The American University in Cairo and the Cloud V Project.
#
# This file is part of the DFFRAM Memory Compiler.
# See https://github.com/Cloud-V/DFFRAM for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
RAM_instantiation = """
/*
An auto generated testbench to verify RAM{word_num}x{word_size}
Authors: Mohamed Shalan ([email protected])
Ahmed Nofal ([email protected])
*/
`define VERBOSE_1
`define VERBOSE_2
`define UNIT_DELAY #1
`define USE_LATCH 1
`define SIZE {word_size}/8
//`include "{pdk_root}/sky130A/libs.ref/sky130_fd_sc_hd/verilog/primitives.v"
//`include "{pdk_root}/sky130A/libs.ref/sky130_fd_sc_hd/verilog/sky130_fd_sc_hd.v"
// // Temporary override: IcarusVerilog cannot read these for some reason ^
`include "hd_primitives.v"
`include "hd_functional.v"
`include "{filename}"
module tb_RAM{word_num}x{word_size};
localparam SIZE = `SIZE;
localparam A_W = {addr_width}+$clog2(SIZE);
localparam M_SZ = 2**A_W;
reg CLK;
reg [(SIZE-1):0] WE0;
reg EN0;
reg [(SIZE*8-1):0] Di0;
wire [(SIZE*8-1):0] Do0;
reg [A_W-1:0] A0, ADDR;
reg [7:0] Phase;
reg [7:0] RANDOM_BYTE;
event done;
RAM{word_num} #(.USE_LATCH(`USE_LATCH), .WSIZE(SIZE)) SRAM (
.CLK(CLK),
.WE0(WE0),
.EN0(EN0),
.Di0(Di0),
.Do(Do0),
.A0(A0[A_W-1:$clog2(SIZE)])
);
initial begin
$dumpfile("tb_RAM{word_num}x{word_size}.vcd");
$dumpvars(0, tb_RAM{word_num}x{word_size});
@(done) $finish;
end
/* Memory golden Model */
reg [(SIZE*8-1):0] RAM[(M_SZ)-1 : 0];
reg [(SIZE*8-1):0] RAM_DATA_RW;
genvar c;
generate
for (c=0; c < SIZE; c = c+1) begin: mem_golden_model
always @(posedge CLK) begin
if(EN0) begin
RAM_DATA_RW <= RAM[A0/SIZE];
if(WE0[c]) RAM[A0/SIZE][8*(c+1)-1:8*c] <= Di0[8*(c+1)-1:8*c];
end
end
end
endgenerate
"""
begin_single_ported_test = """
initial begin
CLK = 0;
WE0 = 0;
EN0 = 1;
"""
single_ported_custom_test = """
Phase = 0;
// Perform a single word write then read
mem_write_word({{SIZE{{8'h90}}}}, 4);
mem_read_word_0(4);
"""
RAM_instantiation_1RW1R = """
/*
An auto generated testbench to verify RAM{word_num}x{word_size}
Authors: Mohamed Shalan ([email protected])
Ahmed Nofal ([email protected])
*/
`define VERBOSE_1
`define VERBOSE_2
`define UNIT_DELAY #1
`define USE_LATCH 1
`define SIZE {word_size}/8
//`include "{pdk_root}/sky130A/libs.ref/sky130_fd_sc_hd/verilog/primitives.v"
//`include "{pdk_root}/sky130A/libs.ref/sky130_fd_sc_hd/verilog/sky130_fd_sc_hd.v"
// // Temporary override: IcarusVerilog cannot read these for some reason ^
`include "hd_primitives.v"
`include "hd_functional.v"
`include "{filename}"
module tb_RAM{word_num}x{word_size}_1RW1R;
localparam SIZE = `SIZE;
localparam A_W = {addr_width}+$clog2(SIZE);
localparam M_SZ = 2**A_W;
reg CLK;
reg [(SIZE-1):0] WE0;
reg EN0;
reg ENR;
reg [(SIZE*8-1):0] Di0;
wire [(SIZE*8-1):0] Do0;
wire [(SIZE*8-1):0] Do1;
reg [A_W-1:0] A0, A1, ADDR;
reg [7:0] Phase;
reg [7:0] RANDOM_BYTE;
event done;
RAM{word_num}_1RW1R #(.USE_LATCH(`USE_LATCH), .WSIZE(`SIZE)) SRAM (
.CLK(CLK),
.WE0(WE0),
.EN0(EN0),
.EN1(ENR),
.Di0(Di0),
.Do0(Do0),
.Do1(Do1),
.A0(A0[A_W-1:$clog2(SIZE)]),
.A1(A1[A_W-1:$clog2(SIZE)])
);
initial begin
$dumpfile("tb_RAM{word_num}x{word_size}_1RW1R.vcd");
$dumpvars(0, tb_RAM{word_num}x{word_size}_1RW1R);
@(done) $finish;
end
/* Memory golden Model */
reg [(SIZE*8-1):0] RAM[(M_SZ)-1 : 0];
reg [(SIZE*8-1):0] RAM_DATA_RW;
reg [(SIZE*8-1):0] RAM_DATA_R;
genvar c;
generate
for (c=0; c < SIZE; c = c+1) begin: mem_golden_model
always @(posedge CLK) begin
if(EN0) begin
RAM_DATA_RW <= RAM[A0/SIZE];
if(WE0[c]) RAM[A0/SIZE][8*(c+1)-1:8*c] <= Di0[8*(c+1)-1:8*c];
end
if (ENR) begin
RAM_DATA_R <= RAM[A1/SIZE];
end
end
end
endgenerate
"""
begin_dual_ported_test = """
initial begin
CLK = 0;
WE0 = 0;
EN0 = 1;
ENR = 1;
"""
dual_ported_custom_test = """
Phase = 0;
// Perform a 2 word write then read 2 words
mem_write_word({{SIZE{{8'h90}}}}, 4);
mem_write_word({{SIZE{{8'h33}}}}, 8);
mem_read_2words(4,8);
"""
start_test_common = """
always #10 CLK = !CLK;
integer i;
"""
test_port_1RW1R = """
/***********************************************************
Write and read from different ports
************************************************************/
// Fill the memory with a known pattern
// Word Write then Read
Phase = 1;
`ifdef VERBOSE_1
$display("\\nFinished Phase 0, starting Phase 1");
`endif
for(i=0; i<M_SZ; i=i+SIZE) begin
ADDR = (($urandom%M_SZ)) & 'hFFFF_FFFC ;
RANDOM_BYTE = $urandom;
mem_write_word( {SIZE{RANDOM_BYTE}}, ADDR);
mem_read_word_1( ADDR );
end
// HWord Write then Read
Phase = 2;
`ifdef VERBOSE_1
$display("\\nFinished Phase 1, starting Phase 2");
`endif
for(i=0; i<M_SZ; i=i+SIZE/2) begin
ADDR = (($urandom%M_SZ)) & 'hFFFF_FFFE;
RANDOM_BYTE = $urandom;
mem_write_hword( {SIZE/2{RANDOM_BYTE}}, ADDR);
mem_read_word_1( ADDR & {{SIZE-1{8'hFF}}, 8'hFC} );
end
// Byte Write then Read
Phase = 3;
`ifdef VERBOSE_1
$display("\\nFinished Phase 2, starting Phase 3");
`endif
for(i=0; i<M_SZ; i=i+1) begin
ADDR = (($urandom%M_SZ));
mem_write_byte($urandom%255, ADDR);
mem_read_word_1(ADDR & {{SIZE-1{8'hFF}}, 8'hFC} );
end
"""
test_port_RW = """
/***********************************************************
Write and read from same port
************************************************************/
Phase = 4;
`ifdef VERBOSE_1
$display("\\nFinished Phase 3, starting Phase 4");
`endif
for(i=0; i<M_SZ; i=i+SIZE) begin
ADDR = (($urandom%M_SZ)) & 'hFFFF_FFFC ;
RANDOM_BYTE = $urandom;
mem_write_word( {SIZE{RANDOM_BYTE}}, ADDR);
mem_read_word_0( ADDR );
end
// HWord Write then Read
Phase = 5;
`ifdef VERBOSE_1
$display("\\nFinished Phase 4, starting Phase 5");
`endif
for(i=0; i<M_SZ; i=i+SIZE/2) begin
ADDR = (($urandom%M_SZ)) & 'hFFFF_FFFE;
RANDOM_BYTE = $urandom;
mem_write_hword( {SIZE/2{RANDOM_BYTE}}, ADDR);
mem_read_word_0( ADDR & {{SIZE-1{8'hFF}}, 8'hFC} );
end
// Byte Write then Read
Phase = 6;
`ifdef VERBOSE_1
$display("\\nFinished Phase 5, starting Phase 6");
`endif
for(i=0; i<M_SZ; i=i+1) begin
ADDR = (($urandom%M_SZ));
mem_write_byte($urandom%255, ADDR);
mem_read_word_0(ADDR & {{SIZE-1{8'hFF}}, 8'hFC} );
end
$display ("\\n>> Test Passed! <<\\n");
-> done;
"""
end_test = """
end
"""
tasks = """
task mem_write_byte(input [7:0] byte, input [A_W-1:0] addr);
begin
@(posedge CLK);
A0 = addr;//[A_WIDTH:2];
WE0 = (1 << addr[$clog2(SIZE)-1:0]);
Di0 = (byte << (addr[$clog2(SIZE)-1:0] * 8));
@(posedge CLK);
`ifdef VERBOSE_2
$display("WRITE BYTE: 0x%X to %0X(%0D) (0x%X, %B)", byte, addr, addr, Di0, WE0);
`endif
WE0 = {SIZE{8'h00}};
end
endtask
task mem_write_hword(input [SIZE*8-1:0] hword, input [A_W-1:0] addr);
begin
@(posedge CLK);
A0 = addr;//[A_WIDTH:$clog2(SIZE)];
WE0 = {{SIZE/2{addr[$clog2(SIZE)-1]}},{SIZE/2{~addr[$clog2(SIZE)-1]}}};
Di0 = (hword << (addr[$clog2(SIZE)-1] * (SIZE/2)*8));
@(posedge CLK);
`ifdef VERBOSE_2
$display("WRITE HWORD: 0x%X to %0X(%0D) (0x%X, %B)", hword, addr, addr, Di0, WE0);
`endif
WE0 = {SIZE{8'h00}};
end
endtask
task mem_write_word(input [SIZE*8-1:0] word, input [A_W-1:0] addr);
begin
@(posedge CLK);
A0 = addr;
WE0 = {SIZE{8'hFF}};
Di0 = word;
@(posedge CLK);
`ifdef VERBOSE_2
$display("WRITE WORD: 0x%X to %0X(%0D) (0x%X, %B)", word, addr, addr, Di0, WE0);
`endif
WE0 = {SIZE{8'h00}};
end
endtask
task mem_read_word_0(input [A_W-1:0] addr);
begin
@(posedge CLK);
A0 = addr;//[9:2];
WE0 = {SIZE{8'h00}};
@(posedge CLK);
#5;
`ifdef VERBOSE_2
$display("READ WORD: 0x%X from %0D", Do0, addr);
`endif
check0();
end
endtask
task check0; begin
if(RAM_DATA_RW !== Do0) begin
$display("\\n>>Test Failed! <<\\t(Phase: %0d, Iteration: %0d", Phase, i);
$display("Address: 0x%X, READ: 0x%X - Should be: 0x%X", A0, Do0, RAM[A0/SIZE]);
$fatal(1);
end
end
endtask
"""
dual_ported_tasks = """
task mem_read_2words(input [A_W-1:0] addr0,
input [A_W-1:0] addr1);
begin
@(posedge CLK);
A0= addr0;//[9:2];
A1= addr1;//[9:2];
WE0 = {SIZE{8'h00}};
@(posedge CLK);
#5;
`ifdef VERBOSE_2
$display("READ WORD0: 0x%X from %0D", Do0, addr0);
$display("READ WORD1: 0x%X from %0D", Do1, addr1);
`endif
check0();
check1();
end
endtask
task mem_read_word_1(input [A_W-1:0] addr);
begin
@(posedge CLK);
A1 = addr;//[9:2];
WE0 = {SIZE{8'h00}};
@(posedge CLK);
#5;
`ifdef VERBOSE_2
$display("READ WORD: 0x%X from %0D", Do1, addr);
`endif
check1();
end
endtask
task check1; begin
if(RAM_DATA_R !== Do1) begin
$display("\\n>>Test Failed! <<\\t(Phase: %0d, Iteration: %0d", Phase, i);
$display("Address: 0x%X, READ: 0x%X - Should be: 0x%X", A1, Do1, RAM[A1/SIZE]);
$fatal(1);
end
end
endtask
"""
endmodule = """
endmodule
"""
| 27.108959
| 91
| 0.530368
| 1,579
| 11,196
| 3.616213
| 0.155161
| 0.009457
| 0.012609
| 0.014711
| 0.741506
| 0.711033
| 0.648336
| 0.616112
| 0.583888
| 0.578984
| 0
| 0.05727
| 0.296624
| 11,196
| 412
| 92
| 27.174757
| 0.667683
| 0.062969
| 0
| 0.713864
| 0
| 0.041298
| 0.964197
| 0.164121
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.00295
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
139b3faa5c126c4a50efcad5c0824965049d5697
| 258
|
py
|
Python
|
venv/lib/python3.7/site-packages/leancloud/engine/utils.py
|
corgiclub/CorgiBot_telegram
|
a63d91a74ee497b9a405e93bd3b303367ef95268
|
[
"MIT"
] | null | null | null |
venv/lib/python3.7/site-packages/leancloud/engine/utils.py
|
corgiclub/CorgiBot_telegram
|
a63d91a74ee497b9a405e93bd3b303367ef95268
|
[
"MIT"
] | null | null | null |
venv/lib/python3.7/site-packages/leancloud/engine/utils.py
|
corgiclub/CorgiBot_telegram
|
a63d91a74ee497b9a405e93bd3b303367ef95268
|
[
"MIT"
] | null | null | null |
# coding: utf-8
import time
import hashlib
import leancloud
from leancloud._compat import to_bytes
__author__ = 'asaka <[email protected]>'
def sign_by_key(timestamp, key):
return hashlib.md5(to_bytes('{0}{1}'.format(timestamp, key))).hexdigest()
| 18.428571
| 77
| 0.748062
| 37
| 258
| 4.972973
| 0.702703
| 0.076087
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.017699
| 0.124031
| 258
| 13
| 78
| 19.846154
| 0.79646
| 0.050388
| 0
| 0
| 0
| 0
| 0.135802
| 0.08642
| 0
| 0
| 0
| 0
| 0
| 1
| 0.142857
| false
| 0
| 0.571429
| 0.142857
| 0.857143
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 1
| 0
|
0
| 3
|
13a7639121bf30f43e2268fe97c114969714293e
| 1,225
|
py
|
Python
|
listener/src/ethereum_connection.py
|
NicolasMenendez/oracles-dashboard
|
789e4a771c9f7064a19a85ef1b4f44bcbbac1a10
|
[
"MIT"
] | null | null | null |
listener/src/ethereum_connection.py
|
NicolasMenendez/oracles-dashboard
|
789e4a771c9f7064a19a85ef1b4f44bcbbac1a10
|
[
"MIT"
] | null | null | null |
listener/src/ethereum_connection.py
|
NicolasMenendez/oracles-dashboard
|
789e4a771c9f7064a19a85ef1b4f44bcbbac1a10
|
[
"MIT"
] | 1
|
2020-01-17T12:38:39.000Z
|
2020-01-17T12:38:39.000Z
|
import json
import web3
class EthereumConnection():
def __init__(self, url_node):
self._url_node = url_node
self._node_provider = web3.HTTPProvider(self._url_node)
self._w3 = web3.Web3(self._node_provider)
@property
def w3(self):
return self._w3
@property
def url_node(self):
return self._url_node
class ContractConnection():
def __init__(self, eth_conn, contract_address, abi_path):
self._eth_conn = eth_conn
self._contract_address = self._eth_conn.w3.toChecksumAddress(contract_address)
self._abi_path = abi_path
self.__json_abi = self.__open_abi()
self._contract = self._eth_conn.w3.eth.contract(
address=self._contract_address,
abi=self.__json_abi
)
def __open_abi(self):
return json.load(open(self._abi_path, "r"))
@property
def abi(self):
return self.__json_abi
@property
def contract(self):
return self._contract
@property
def address(self):
return self._contract_address
@property
def eth(self):
return self._contract.web3.eth
@property
def w3(self):
return self._eth_conn.w3
| 22.685185
| 86
| 0.646531
| 153
| 1,225
| 4.751634
| 0.169935
| 0.110041
| 0.134801
| 0.053645
| 0.074278
| 0.074278
| 0
| 0
| 0
| 0
| 0
| 0.013319
| 0.26449
| 1,225
| 53
| 87
| 23.113208
| 0.793563
| 0
| 0
| 0.225
| 0
| 0
| 0.000816
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.05
| 0.2
| 0.55
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
13cfe935b3ae2ffb5842e273c8ff7ca4cd002f6d
| 2,753
|
py
|
Python
|
userbot/plugins/alive.py
|
iraqis1/irqis
|
d95303c48b5f15dbe814454a48d847e838793713
|
[
"MIT"
] | null | null | null |
userbot/plugins/alive.py
|
iraqis1/irqis
|
d95303c48b5f15dbe814454a48d847e838793713
|
[
"MIT"
] | null | null | null |
userbot/plugins/alive.py
|
iraqis1/irqis
|
d95303c48b5f15dbe814454a48d847e838793713
|
[
"MIT"
] | null | null | null |
"""Check if userbot alive. If you change these, you become the gayest gay such that even the gay world will disown you."""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "No name set yet nibba, check pinned in @XtraTgBot"
@command(outgoing=True, pattern="^.lk$")
async def amireallyalive(alive):
""" For .alive command, check if the bot is running. """
await alive.edit("اهلا بك في سورس التليثيون العراقي\n"
"➖➖➖➖➖➖➖➖➖\n"
"استخدم امر .alive اذا اعتقدت ان البوت توقف!\n"
"➖➖➖➖➖➖➖➖➖\n"
"اشترك في قناة السورس لانها تطرح ملفات وشروحات مفيده\n"
"➖➖➖➖➖➖➖➖➖\n"
"يمكنك مراسلتنا لاي خلل حاصل\n"
"➖➖➖➖➖➖➖➖➖\n"
"لتنصيب السورس راسلني احد مطورين السورس\n"
"➖➖➖➖➖➖➖➖➖\n"
"مطورين السورس : \n"
"➖➖➖➖➖➖➖➖➖\n"
"احمد || @HHMHHH \n"
"➖➖➖➖➖➖➖➖➖\n"
"حسن || @VHHHHH \n"
"➖➖➖➖➖➖➖➖➖\n"
"حارث || @cCcYo \n"
"➖➖➖➖➖➖➖➖➖\n"
"قناة السورس الرسميه : @cqccqq\n"
"➖➖➖➖➖➖➖➖➖\n"
"اوامر السورس هي :\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.ytv` + رابط فيديو من اي موقع للتحميل\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.purge` تحذف رسائل بالرد\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.song` + اسم اغنيه \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.spam`+ كلمه + عدد \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.smoon` لعرض ٤ اسطر اقمار \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.moon` لعرض سطر واحد اقمار \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.solarsystem` كواكب تتحرك \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.snake` افعى تتحرك\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.clock` ساعات سطر واحد \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.gmute` كتم\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.ungmute` الغاء كتم \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.kick` طرد \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.ban` حظر \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.tss` + رمز اللغه\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.rnupload` رد ع الملف وسم ملف لتغير اسم الملف\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.send` + اسم النلف يدز الملف\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.unload` + اسم الملف للغاء التثببت\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.scha` يطلع يكتب حتى لو مدز رساله\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.get_bot` معرفه عدد البوتات الموجوده\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.iffuci` كتابه كود الملف\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.savefilter` اضف رد\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.clearfilter` حذف رد \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.purge` حذف كل الرسائل\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.figlet` كتابه نصوص شخوط\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.savewelcome` + ترحيب لوضع ترحيب\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.clearwelcome` لحذف الترحيب \n"
"➖➖➖➖➖➖➖➖➖\n"
"`.whois` + ايدي شخص\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.fuk` فاكيو\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.get_id` ايدي اي شخص دزه بمحادثته\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.admins` المشرفين الي بالكروب\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.pin` تثبيت رساله بالكروب\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.mmf` اسم انكلش رد ع الصوره\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.bye` مغادره من المجموعه\n"
"➖➖➖➖➖➖➖➖➖\n"
"`.decide` يدز صورتين متحركات\n"
"➖➖➖➖➖➖➖➖➖\n"
"يوجد الكثير من الاوامر لكن ثبتنا الاساسيات\n")
| 26.219048
| 123
| 0.521976
| 419
| 2,753
| 4.381862
| 0.50358
| 0.245098
| 0.269608
| 0.026144
| 0.025054
| 0
| 0
| 0
| 0
| 0
| 0
| 0.000437
| 0.169633
| 2,753
| 105
| 124
| 26.219048
| 0.625547
| 0.042136
| 0
| 0.45
| 0
| 0
| 0.749494
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.06
| 0
| 0.06
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
13d331fdd92f5e0cc56507427afe5e4da7edb40a
| 636
|
py
|
Python
|
utils/src/adventofcode/utils/Point3D.py
|
dh256/adventofcode
|
428eec13f4cbf153333a0e359bcff23070ef6d27
|
[
"MIT"
] | null | null | null |
utils/src/adventofcode/utils/Point3D.py
|
dh256/adventofcode
|
428eec13f4cbf153333a0e359bcff23070ef6d27
|
[
"MIT"
] | null | null | null |
utils/src/adventofcode/utils/Point3D.py
|
dh256/adventofcode
|
428eec13f4cbf153333a0e359bcff23070ef6d27
|
[
"MIT"
] | null | null | null |
class Point3D:
def __init__(self,x,y,z):
self.x = x
self.y = y
self.z = z
'''
Returns the distance between two 3D points
'''
def distance(self, value):
return abs(self.x - value.x) + abs(self.y - value.y) + abs(self.z - value.z)
def __eq__(self, value):
return self.x == value.x and self.y == value.y and self.z == value.z
def __hash__(self):
return hash((self.x,self.y,self.z))
def __repr__(self):
return f'({self.x},{self.y},{self.z})'
def __add__(self,value):
return Point3D(self.x + value.x, self.y + value.y, self.z + value.z)
| 27.652174
| 84
| 0.561321
| 103
| 636
| 3.271845
| 0.23301
| 0.103858
| 0.071217
| 0.097923
| 0.189911
| 0.106825
| 0.106825
| 0
| 0
| 0
| 0
| 0.006522
| 0.27673
| 636
| 23
| 85
| 27.652174
| 0.726087
| 0
| 0
| 0
| 0
| 0
| 0.048359
| 0.048359
| 0
| 0
| 0
| 0
| 0
| 1
| 0.4
| false
| 0
| 0
| 0.333333
| 0.8
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
13d646c36a3c1b8a275d4d104aa95c23081163a3
| 2,378
|
py
|
Python
|
sdk/python/pulumi_azure_native/labservices/v20181015/__init__.py
|
pulumi-bot/pulumi-azure-native
|
f7b9490b5211544318e455e5cceafe47b628e12c
|
[
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure_native/labservices/v20181015/__init__.py
|
pulumi-bot/pulumi-azure-native
|
f7b9490b5211544318e455e5cceafe47b628e12c
|
[
"Apache-2.0"
] | null | null | null |
sdk/python/pulumi_azure_native/labservices/v20181015/__init__.py
|
pulumi-bot/pulumi-azure-native
|
f7b9490b5211544318e455e5cceafe47b628e12c
|
[
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .environment import *
from .environment_setting import *
from .gallery_image import *
from .get_environment import *
from .get_environment_setting import *
from .get_gallery_image import *
from .get_global_user_environment import *
from .get_global_user_operation_batch_status import *
from .get_global_user_operation_status import *
from .get_global_user_personal_preferences import *
from .get_lab import *
from .get_lab_account import *
from .get_lab_account_regional_availability import *
from .get_user import *
from .lab import *
from .lab_account import *
from .list_global_user_environments import *
from .list_global_user_labs import *
from .user import *
from ._inputs import *
from . import outputs
def _register_module():
import pulumi
from ... import _utilities
class Module(pulumi.runtime.ResourceModule):
_version = _utilities.get_semver_version()
def version(self):
return Module._version
def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
if typ == "azure-native:labservices/v20181015:Environment":
return Environment(name, pulumi.ResourceOptions(urn=urn))
elif typ == "azure-native:labservices/v20181015:EnvironmentSetting":
return EnvironmentSetting(name, pulumi.ResourceOptions(urn=urn))
elif typ == "azure-native:labservices/v20181015:GalleryImage":
return GalleryImage(name, pulumi.ResourceOptions(urn=urn))
elif typ == "azure-native:labservices/v20181015:Lab":
return Lab(name, pulumi.ResourceOptions(urn=urn))
elif typ == "azure-native:labservices/v20181015:LabAccount":
return LabAccount(name, pulumi.ResourceOptions(urn=urn))
elif typ == "azure-native:labservices/v20181015:User":
return User(name, pulumi.ResourceOptions(urn=urn))
else:
raise Exception(f"unknown resource type {typ}")
_module_instance = Module()
pulumi.runtime.register_resource_module("azure-native", "labservices/v20181015", _module_instance)
_register_module()
| 38.983607
| 102
| 0.710681
| 282
| 2,378
| 5.794326
| 0.315603
| 0.128519
| 0.087515
| 0.132803
| 0.405753
| 0.271726
| 0.211138
| 0.211138
| 0.211138
| 0.211138
| 0
| 0.029874
| 0.197645
| 2,378
| 60
| 103
| 39.633333
| 0.82652
| 0.085366
| 0
| 0
| 1
| 0
| 0.151152
| 0.13318
| 0
| 0
| 0
| 0
| 0
| 1
| 0.06383
| false
| 0
| 0.510638
| 0.021277
| 0.765957
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
13e0862967d39493794d0afe2c6e9020dad2d87c
| 777
|
py
|
Python
|
tests/utils/date_utils.py
|
asuol/worky
|
362257e77486af05941cc977055c01e49b09a2dd
|
[
"MIT"
] | null | null | null |
tests/utils/date_utils.py
|
asuol/worky
|
362257e77486af05941cc977055c01e49b09a2dd
|
[
"MIT"
] | null | null | null |
tests/utils/date_utils.py
|
asuol/worky
|
362257e77486af05941cc977055c01e49b09a2dd
|
[
"MIT"
] | null | null | null |
from datetime import datetime, timedelta
due_date_format = '%Y-%m-%d'
datepicker_date_format = '%m%d%Y'
def current_date():
return datetime.utcnow().strftime(due_date_format)
def datepicker_current_date():
return datetime.utcnow().strftime(datepicker_date_format)
def _date_from_today(days_to_add):
return datetime.utcnow() + timedelta(days=days_to_add)
def date_from_today(days_to_add):
return _date_from_today(days_to_add).strftime(due_date_format)
def datepicker_date_from_today(days_to_add):
return _date_from_today(days_to_add).strftime(datepicker_date_format)
def datepicker_to_due_date_format(datepicker_date):
return datetime.strptime(datepicker_date,
datepicker_date_format).strftime(due_date_format)
| 25.064516
| 78
| 0.776062
| 110
| 777
| 5.018182
| 0.190909
| 0.163043
| 0.097826
| 0.153986
| 0.585145
| 0.507246
| 0.271739
| 0.271739
| 0.210145
| 0.210145
| 0
| 0
| 0.135135
| 777
| 30
| 79
| 25.9
| 0.821429
| 0
| 0
| 0
| 0
| 0
| 0.018018
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.375
| false
| 0
| 0.0625
| 0.375
| 0.8125
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
13e172837fb61cdf3f4fe7914fb4c72959b8c9f8
| 497
|
py
|
Python
|
zindi/docs/utils/n_subimissions_per_day.py
|
eaedk/testing-zindi-package
|
5aef7375a629b328fa8ecf9c4559e2897611a1e9
|
[
"MIT"
] | 6
|
2020-09-07T17:56:49.000Z
|
2021-12-09T12:34:01.000Z
|
zindi/docs/utils/n_subimissions_per_day.py
|
eaedk/testing-zindi-package
|
5aef7375a629b328fa8ecf9c4559e2897611a1e9
|
[
"MIT"
] | 2
|
2021-02-24T11:56:48.000Z
|
2021-03-30T14:40:45.000Z
|
zindi/docs/utils/n_subimissions_per_day.py
|
eaedk/testing-zindi-package
|
5aef7375a629b328fa8ecf9c4559e2897611a1e9
|
[
"MIT"
] | 4
|
2020-11-01T00:06:36.000Z
|
2021-11-19T19:20:52.000Z
|
def n_subimissions_per_day( url, headers ):
"""Get the number of submissions we can make per day for the selected challenge.
Parameters
----------
url : {'prize', 'points', 'knowledge' , 'all'}, default='all'
The reward of the challenges for top challengers.
headers : dictionary ,
The headers of the request.
Returns
-------
n_sub : int, default=0 : Means error during info retrieval.
The number of submissions we can make per day.
"""
| 35.5
| 84
| 0.629779
| 64
| 497
| 4.828125
| 0.609375
| 0.058252
| 0.071197
| 0.142395
| 0.239482
| 0.239482
| 0.239482
| 0.239482
| 0.239482
| 0
| 0
| 0.00271
| 0.257545
| 497
| 14
| 85
| 35.5
| 0.834688
| 0.800805
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| false
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
13ebac2480a38d6864e7de863e165c5d96c0e1f7
| 10,928
|
py
|
Python
|
tests/test_crypto.py
|
kimtaehong/PythonForWindows
|
d04eed1754e2e23474213b89580d68e1b73c3fe4
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_crypto.py
|
kimtaehong/PythonForWindows
|
d04eed1754e2e23474213b89580d68e1b73c3fe4
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_crypto.py
|
kimtaehong/PythonForWindows
|
d04eed1754e2e23474213b89580d68e1b73c3fe4
|
[
"BSD-3-Clause"
] | null | null | null |
import pytest
import windows.crypto
import windows.generated_def as gdef
import windows.crypto.generation
from .pfwtest import *
pytestmark = pytest.mark.usefixtures('check_for_gc_garbage')
TEST_CERT = b"""
MIIBwTCCASqgAwIBAgIQG46Uyws+67ZBOfPJCbFrRjANBgkqhkiG9w0BAQsFADAfMR0wGwYDVQQD
ExRQeXRob25Gb3JXaW5kb3dzVGVzdDAeFw0xNzA0MTIxNDM5MjNaFw0xODA0MTIyMDM5MjNaMB8x
HTAbBgNVBAMTFFB5dGhvbkZvcldpbmRvd3NUZXN0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQCRHwC/sRfXh5pc4poc85aidrudbPdya+0OeonQlf1JQ1ekf7KSfADV5FLkSQu2BzgBK9DIWTGX
XknBJIzZF03UZsVg5D67V2mnSClXucc0cGFcK4pDDt0tHeabA2GPinVe7Z6qDT4ZxPR8lKaXDdV2
Pg2hTdcGSpqaltHxph7G/QIDAQABMA0GCSqGSIb3DQEBCwUAA4GBACcQFdOlVjYICOIyAXowQaEN
qcLpN1iWoL9UijNhTY37+U5+ycFT8QksT3Xmh9lEIqXMh121uViy2P/3p+Ek31AN9bB+BhWIM6PQ
gy+ApYDdSwTtWFARSrMqk7rRHUveYEfMw72yaOWDxCzcopEuADKrrYEute4CzZuXF9PbbgK6"""
## Cert info:
# Name: PythonForWindowsTest
# Serial: '1b 8e 94 cb 0b 3e eb b6 41 39 f3 c9 09 b1 6b 46'
TEST_PFX_PASSWORD = "TestPassword"
TEST_PFX = b"""
MIIGMwIBAzCCBe8GCSqGSIb3DQEHAaCCBeAEggXcMIIF2DCCA7AGCSqGSIb3DQEHAaCCA6EEggOd
MIIDmTCCA5UGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAhoE8r3qUJeTQIC
B9AEggKQT7jm7ppgH64scyJ3cFW50BurqpMPtxgYyYCCtjdmHMlLPbUoujXOZVYi3seAEERE51BS
TXUi5ydHpY8cZ104nU4iEuJBAc+TZ7NQSTkjLKwAY1r1jrIikkQEmewLVlWQnj9dvCwD3lNkGXG8
zJdWusta5Lw1Hz5ftsRXvN9UAvH8gxYviVRVmkZA33rI/BiyPZCulu2EBC0MeDBQHLLONup2xVGy
+YgU4Uf7khJIftWCgdrkyJIaMuB7vGUl014ZBV+XWaox+bS71qFQXUP2WnyTeeBVIaTJtggk+80X
fStWwvvzl02LTwGV3kJqWbazPlJkevfRQ7DNh1xa42eO57YEcEl3sR00anFWbL3J/I0bHb5XWY/e
8DYuMgIlat5gub8CTO2IViu6TexXFMXLxZdWAYvJ8ivc/q7mA/JcDJQlNnGof2Z6jY8ykWYloL/R
XMn2LeGqrql/guyRQcDrZu0LGX4sDG0aP9dbjk5fQpXSif1RUY4/T3HYeL0+1zu86ZKwVIIX5YfT
MLheIUGaXy/UJk361vAFKJBERGv1uufnqBxH0r1bRoytOaZr1niEA04u+VJa0DXOZzKBwxNhQRom
x4ffrsP2VnoJX+wnfYhPOjkiPiHyhswheG0VITTkqD+2uF54M5X2LLdzQuJpu0MZ5HOAHck/ZEpa
xV7h+kNse4p7y17b12H6tJNtVoJOlqP0Ujugc7vh4h8ZaPkSqVSV1nEvHzXx0c7gf038jv1+8WlN
4EgHp09FKU7sbSgcPY9jltElgaAr6J8a+rDGtk+055UeUYxM43U8naBiEOL77LP9FA0y8hKLKlJz
0GBCp4bJrLuZJenXHVb1Zme2EXO0jnQ9nB9OEyI3NpYTbZQxgcswEwYJKoZIhvcNAQkVMQYEBAEA
AAAwRwYJKoZIhvcNAQkUMToeOABQAHkAdABoAG8AbgBGAG8AcgBXAGkAbgBkAG8AdwBzAFQATQBQ
AEMAbwBuAHQAYQBpAG4AZQByMGsGCSsGAQQBgjcRATFeHlwATQBpAGMAcgBvAHMAbwBmAHQAIABF
AG4AaABhAG4AYwBlAGQAIABDAHIAeQBwAHQAbwBnAHIAYQBwAGgAaQBjACAAUAByAG8AdgBpAGQA
ZQByACAAdgAxAC4AMDCCAiAGCSqGSIb3DQEHAaCCAhEEggINMIICCTCCAgUGCyqGSIb3DQEMCgED
oIIB3TCCAdkGCiqGSIb3DQEJFgGgggHJBIIBxTCCAcEwggEqoAMCAQICEBuOlMsLPuu2QTnzyQmx
a0YwDQYJKoZIhvcNAQELBQAwHzEdMBsGA1UEAxMUUHl0aG9uRm9yV2luZG93c1Rlc3QwHhcNMTcw
NDEyMTQzOTIzWhcNMTgwNDEyMjAzOTIzWjAfMR0wGwYDVQQDExRQeXRob25Gb3JXaW5kb3dzVGVz
dDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAkR8Av7EX14eaXOKaHPOWona7nWz3cmvtDnqJ
0JX9SUNXpH+yknwA1eRS5EkLtgc4ASvQyFkxl15JwSSM2RdN1GbFYOQ+u1dpp0gpV7nHNHBhXCuK
Qw7dLR3mmwNhj4p1Xu2eqg0+GcT0fJSmlw3Vdj4NoU3XBkqampbR8aYexv0CAwEAATANBgkqhkiG
9w0BAQsFAAOBgQAnEBXTpVY2CAjiMgF6MEGhDanC6TdYlqC/VIozYU2N+/lOfsnBU/EJLE915ofZ
RCKlzIddtblYstj/96fhJN9QDfWwfgYViDOj0IMvgKWA3UsE7VhQEUqzKpO60R1L3mBHzMO9smjl
g8Qs3KKRLgAyq62BLrXuAs2blxfT224CujEVMBMGCSqGSIb3DQEJFTEGBAQBAAAAMDswHzAHBgUr
DgMCGgQU70h/rEXLQOberGvgJenggoWU5poEFCfdE1wNK1M38Yp3+qfjEqNIJGCPAgIH0A==
"""
@pytest.fixture()
def rawcert():
return b64decode(TEST_CERT)
@pytest.fixture()
def rawpfx():
return b64decode(TEST_PFX)
PFW_TEST_TMP_KEY_CONTAINER = "PythonForWindowsTMPContainerTest"
RANDOM_CERTIF_NAME = b"PythonForWindowsGeneratedRandomCertifTest"
RANDOM_PFX_PASSWORD = "PythonForWindowsGeneratedRandomPFXPassword"
@pytest.fixture()
def randomkeypair(keysize=1024):
r"""Generate a cert / pfx. Based on samples\crypto\encryption_demo.py"""
cert_store = windows.crypto.CertificateStore.new_in_memory()
# Create a TMP context that will hold our newly generated key-pair
with windows.crypto.CryptContext(PFW_TEST_TMP_KEY_CONTAINER, None, gdef.PROV_RSA_FULL, 0, retrycreate=True) as ctx:
key = gdef.HCRYPTKEY()
keysize_flags = keysize << 16
# Generate a key-pair that is exportable
windows.winproxy.CryptGenKey(ctx, gdef.AT_KEYEXCHANGE, gdef.CRYPT_EXPORTABLE | keysize_flags, key)
# It does NOT destroy the key-pair from the container,
# It only release the key handle
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa379918(v=vs.85).aspx
windows.winproxy.CryptDestroyKey(key)
# Descrption of the key-container that will be used to generate the certificate
KeyProvInfo = gdef.CRYPT_KEY_PROV_INFO()
KeyProvInfo.pwszContainerName = PFW_TEST_TMP_KEY_CONTAINER
KeyProvInfo.pwszProvName = None
KeyProvInfo.dwProvType = gdef.PROV_RSA_FULL
KeyProvInfo.dwFlags = 0
KeyProvInfo.cProvParam = 0
KeyProvInfo.rgProvParam = None
#KeyProvInfo.dwKeySpec = AT_SIGNATURE
KeyProvInfo.dwKeySpec = gdef.AT_KEYEXCHANGE
crypt_algo = gdef.CRYPT_ALGORITHM_IDENTIFIER()
crypt_algo.pszObjId = gdef.szOID_RSA_SHA256RSA.encode("ascii") # do something else (bytes in generated ctypes ?)
# This is fucking dumb, there is no .format on bytes object...
certif_name = b"".join((b"CN=", RANDOM_CERTIF_NAME))
# Generate a self-signed certificate based on the given key-container and signature algorithme
certif = windows.crypto.generation.generate_selfsigned_certificate(certif_name, key_info=KeyProvInfo, signature_algo=crypt_algo)
# Add the newly created certificate to our TMP cert-store
cert_store.add_certificate(certif)
# Generate a pfx from the TMP cert-store
pfx = windows.crypto.generation.generate_pfx(cert_store, RANDOM_PFX_PASSWORD)
yield certif, pfx
# Destroy the TMP key container
prov = gdef.HCRYPTPROV()
windows.winproxy.CryptAcquireContextW(prov, PFW_TEST_TMP_KEY_CONTAINER, None, gdef.PROV_RSA_FULL, gdef.CRYPT_DELETEKEYSET)
def test_certificate(rawcert):
cert = windows.crypto.Certificate.from_buffer(rawcert)
assert cert.serial == '1b 8e 94 cb 0b 3e eb b6 41 39 f3 c9 09 b1 6b 46'
assert cert.name == b'PythonForWindowsTest'
assert cert.issuer == b'PythonForWindowsTest'
assert cert.thumbprint == 'EF 0C A8 C9 F9 E0 96 AF 74 18 56 8B C1 C9 57 27 A0 89 29 6A'
assert cert.encoded == rawcert
assert cert.version == 2
assert cert == cert
assert cert is cert.duplicate()
cert.chains # TODO: craft a certificate with a chain for test purpose
cert.store.certs
cert.properties
def test_pfx(rawcert, rawpfx):
pfx = windows.crypto.import_pfx(rawpfx, TEST_PFX_PASSWORD)
orig_cert = windows.crypto.Certificate.from_buffer(rawcert)
certs = pfx.certs
assert len(certs) == 1
# Test cert comparaison
assert certs[0] == orig_cert
def test_open_pfx_bad_password(rawpfx):
with pytest.raises(WindowsError) as ar:
pfx = windows.crypto.import_pfx(rawpfx, "BadPassword")
def test_encrypt_decrypt(rawcert, rawpfx):
message_to_encrypt = b"Testing message \xff\x01"
cert = windows.crypto.Certificate.from_buffer(rawcert)
# encrypt should accept a cert or iterable of cert
res = windows.crypto.encrypt(cert, message_to_encrypt)
res2 = windows.crypto.encrypt([cert, cert], message_to_encrypt)
del cert
assert message_to_encrypt not in res
# Open pfx and decrypt
pfx = windows.crypto.import_pfx(rawpfx, TEST_PFX_PASSWORD)
decrypt = windows.crypto.decrypt(pfx, res)
decrypt2 = windows.crypto.decrypt(pfx, res2)
assert message_to_encrypt == decrypt
assert decrypt == decrypt2
def test_randomkeypair(randomkeypair):
randcert, randrawpfx = randomkeypair
assert randcert.name == RANDOM_CERTIF_NAME
randpfx = windows.crypto.import_pfx(randrawpfx, RANDOM_PFX_PASSWORD) # Check password is good too
def test_encrypt_decrypt_multiple_receivers(rawcert, rawpfx, randomkeypair):
message_to_encrypt = b"\xff\x00 Testing message \xff\x01"
# Receiver 1: random key pair
randcert, randrawpfx = randomkeypair
randpfx = windows.crypto.import_pfx(randrawpfx, RANDOM_PFX_PASSWORD)
# Receiver 1: PFW-test-keypair
pfx = windows.crypto.import_pfx(rawpfx, TEST_PFX_PASSWORD)
cert = windows.crypto.Certificate.from_buffer(rawcert)
assert cert.name != randcert.name
assert cert.encoded != randcert.encoded
# Encrypt the message with 2 differents certificates
encrypted = windows.crypto.encrypt([cert, randcert], message_to_encrypt)
# Decrypt with each PFX and check the result is valid/the same
decrypted = windows.crypto.decrypt(pfx, encrypted)
decrypted2 = windows.crypto.decrypt(randpfx, encrypted)
assert decrypted == decrypted2 == message_to_encrypt
def test_crypt_obj():
path = r"C:\windows\system32\kernel32.dll"
x = windows.crypto.CryptObject(path)
x.crypt_msg.certs
x.crypt_msg.signers
x.signers_and_certs
# TODO: Need some better ideas
def test_certificate_from_store():
return windows.crypto.CertificateStore.from_system_store("Root")
def test_sign_verify(rawcert, rawpfx):
message_to_sign = b"Testing message \xff\x01"
# Load PFX (priv+pub key) & certif (pubkey only)
pfx = windows.crypto.import_pfx(rawpfx, TEST_PFX_PASSWORD)
cert = windows.crypto.Certificate.from_buffer(rawcert)
signed_blob = windows.crypto.sign(pfx.certs[0], message_to_sign)
assert message_to_sign in signed_blob
decoded_blob = windows.crypto.verify_signature(cert, signed_blob)
assert decoded_blob == message_to_sign
def test_sign_verify_fail(rawcert, rawpfx):
message_to_sign = b"Testing message \xff\x01"
# Load PFX (priv+pub key) & certif (pubkey only)
pfx = windows.crypto.import_pfx(rawpfx, TEST_PFX_PASSWORD)
cert = windows.crypto.Certificate.from_buffer(rawcert)
signed_blob = windows.crypto.sign(pfx.certs[0], message_to_sign)
assert message_to_sign in signed_blob
# Tamper the signed mesasge content
signed_blob = signed_blob.replace(b"message", b"massage")
with pytest.raises(windows.winproxy.WinproxyError) as excinfo:
decoded_blob = windows.crypto.verify_signature(cert, signed_blob)
assert excinfo.value.winerror == gdef.STATUS_INVALID_SIGNATURE
# str(windows.crypto.encrypt(TEST_CERT, "Hello crypto")).encode("base64")
# Target serial == TEST_CERT.Serial == 1b 8e 94 cb 0b 3e eb b6 41 39 f3 c9 09 b1 6b 46
TEST_CRYPTMSG = b"""MIIBJAYJKoZIhvcNAQcDoIIBFTCCARECAQAxgc0wgcoCAQAwMzAfMR0wGwYDVQQDExRQeXRob25G
b3JXaW5kb3dzVGVzdAIQG46Uyws+67ZBOfPJCbFrRjANBgkqhkiG9w0BAQcwAASBgA1fwFY8w4Bb
fOMer94JhazbJxaUnV305QzF27w4GwNQ2UIpl9KWJoJJaF7azU3nVhP33agAxlxmr9fP48B6DeE1
pbu1jX9tEWlTJC6O0TmKcRPjblEaU6VJXXlpKlKZCmwCUuHR9VtcXGnxEU1Hy7FmHM96lvDRmYQT
Y0MnRJLyMDwGCSqGSIb3DQEHATAdBglghkgBZQMEASoEEEdEGEzKBrDO/zC8z6q6HLaAEGbjGCay
s6u32YhUxQ4/QhI="""
def test_cryptmsg_from_data():
rawdata = b64decode(TEST_CRYPTMSG)
cryptmsg = windows.crypto.CryptMessage.from_buffer(rawdata)
rawtarget = b"\x1b\x8e\x94\xcb\x0b>\xeb\xb6A9\xf3\xc9\t\xb1kF"
assert cryptmsg.get_recipient_data(0).SerialNumber.data[::-1] == rawtarget
| 45.344398
| 132
| 0.811585
| 1,147
| 10,928
| 7.569311
| 0.343505
| 0.052407
| 0.019696
| 0.020272
| 0.158258
| 0.150772
| 0.147201
| 0.136835
| 0.136835
| 0.106312
| 0
| 0.056411
| 0.120791
| 10,928
| 240
| 133
| 45.533333
| 0.847211
| 0.140099
| 0
| 0.14881
| 1
| 0.005952
| 0.393246
| 0.352853
| 0
| 1
| 0
| 0.004167
| 0.130952
| 1
| 0.083333
| false
| 0.071429
| 0.077381
| 0.017857
| 0.178571
| 0.005952
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 3
|
b918bb151415e9d667f5286334be578684cceb18
| 10,754
|
py
|
Python
|
espoem_facts/facts.py
|
emre/espoem_facts
|
0d7164dcfe8a82e1f142929b1e00c3a85f29f101
|
[
"MIT"
] | null | null | null |
espoem_facts/facts.py
|
emre/espoem_facts
|
0d7164dcfe8a82e1f142929b1e00c3a85f29f101
|
[
"MIT"
] | null | null | null |
espoem_facts/facts.py
|
emre/espoem_facts
|
0d7164dcfe8a82e1f142929b1e00c3a85f29f101
|
[
"MIT"
] | 1
|
2018-07-19T18:44:09.000Z
|
2018-07-19T18:44:09.000Z
|
FACTS = ['espoem multiplied by zero still equals espoem.',
'There is no theory of evolution. Just a list of creatures espoem has allowed to live.',
'espoem does not sleep. He waits.',
'Alexander Graham Bell had three missed calls from espoem when he invented the telephone.',
'espoem is the reason why Waldo is hiding.',
'espoem can slam a revolving door.',
"espoem isn't lifting himself up when doing a pushup; he's pushing the earth down.",
"espoem' hand is the only hand that can beat a Royal Flush.",
'espoem made a Happy Meal cry.',
"espoem doesn't need Twitter; he's already following you.",
'espoem once won an underwater breathing contest with a fish.While urinating, espoem is easily capable of welding titanium.',
'In an act of great philanthropy, espoem made a generous donation to the American Cancer Society. He donated 6,000 dead bodies for scientific research.',
'espoem once one a game of connect four in 3 moves.',
"Google won't search for espoem because it knows you don't find espoem, he finds you.",
'espoem? favourite cut of meat is the roundhouse.',
'It is scientifically impossible for espoem to have had a mortal father. The most popular theory is that he went back in time and fathered himself.',
'espoem had to stop washing his clothes in the ocean. The tsunamis were killing people.',
'Pluto is actually an orbiting group of British soldiers from the American Revolution who entered space after the espoem gave them a roundhouse kick to the face.',
'In the Words of Julius Caesar, Veni, Vidi, Vici, espoem. Translation: I came, I saw, and I was roundhouse-kicked inthe face by espoem.',
"espoem doesn't look both ways before he crosses the street... he just roundhouses any cars that get too close.",
'Human cloning is outlawed because of espoem, because then it would be possible for a espoem roundhouse kick to meet another espoem roundhouse kick. Physicists theorize that this contact would end the universe.',
'Using his trademark roundhouse kick, espoem once made a fieldgoal in RJ Stadium in Tampa Bay from the 50 yard line of Qualcomm stadium in San Diego.',
'espoem played Russian Roulette with a fully loaded gun and won.',
"espoem roundhouse kicks don't really kill people. They wipe out their entire existence from the space-time continuum.",
"espoem' testicles do not produce sperm. They produce tiny white ninjas that recognize only one mission: seek and destroy.",
'MacGyver immediately tried to make a bomb out of some Q-Tips and Gatorade, but espoem roundhouse-kicked him in the solar plexus. MacGyver promptly threw up his own heart.',
'Not everyone that espoem is mad at gets killed. Some get away. They are called astronauts.',
'espoem can drink an entire gallon of milk in thirty-seven seconds.',
'If you spell espoem in Scrabble, you win. Forever.',
"When you say no one's perfect, espoem takes this as a personal insult.",
"espoem invented Kentucky Fried Chicken's famous secret recipe with eleven herbs and spices. Nobody ever mentions the twelfth ingredient: Fear.",
'espoem can skeletize a cow in two minutes.',
'espoem eats lightning and shits out thunder.',
'In a fight between Batman and Darth Vader, the winner would be espoem.',
"The phrase 'dead ringer' refers to someone who sits behind espoem in a movie theater and forgets to turn their cell phone off.",
"It is said that looking into espoem' eyes will reveal your future. Unfortunately, everybody's future is always the same: death by a roundhouse-kick to the face.",
"espoem's log statements are always at the FATAL level.",
'espoem can win in a game of Russian roulette with a fully loaded gun.',
'Nothing can escape the gravity of a black hole, except for espoem. espoem eats black holes. They taste like chicken.',
'There is no theory of evolution, just a list of creatures espoem allows to live.',
'A study showed the leading causes of death in the United States are: 1. Heart disease, 2. espoem, 3. Cancer',
'Everybody loves Raymond. Except espoem.',
'Noah was the only man notified before espoem relieved himself in the Atlantic Ocean.',
'In a tagteam match, espoem was teamed with Hulk Hogan against King Kong Bundy and Andre The Giant. He pinned all 3 at the same time.',
"Nobody doesn't like Sara Lee. Except espoem.",
"espoem never has to wax his skis because they're always slick with blood.",
'espoem ordered a Big Mac at Burger King, and got one.',
'espoem owns a chain of fast-food restaurants throughout the southwest. They serve nothing but barbecue-flavored ice cream and Hot Pockets.',
"espoem's database has only one table, 'Kick', which he DROPs frequently.",
"espoem built a time machine and went back in time to stop the JFK assassination. As Oswald shot, espoem met all three bullets with his beard, deflecting them. JFK's head exploded out of sheer amazement.",
'espoem can write infinite recursion functions, and have them return.',
'When espoem does division, there are no remainders.',
'We live in an expanding universe. All of it is trying to get away from espoem.',
'espoem cannot love, he can only not kill.',
'espoem knows the value of NULL, and he can sort by it too.',
'There is no such thing as global warming. espoem was cold, so he turned the sun up.',
'The best-laid plans of mice and men often go awry. Even the worst-laid plans of espoem come off without a hitch.',
'When espoem goes to donate blood, he declines the syringe, and instead requests a hand gun and a bucket.',
'espoem can solve the Towers of Hanoi in one move.',
'All roads lead to espoem. And by the transitive property, a roundhouse kick to the face.',
'If you were somehow able to land a punch on espoem your entire arm would shatter upon impact. This is only in theory, since, come on, who in their right mind would try this?',
'One time, at band camp, espoem ate a percussionist.',
'Product Owners never argue with espoem after he demonstrates the DropKick feature.',
'espoem can read from an input stream.',
'The original draft of The Lord of the Rings featured espoem instead of Frodo Baggins. It was only 5 pages long, as espoem roundhouse-kicked Sauron?s ass halfway through the first chapter.',
"If, by some incredible space-time paradox, espoem would ever fight himself, he'd win. Period.",
'When taking the SAT, write espoem for every answer. You will score over 8000.',
'When in a bar, you can order a drink called a espoem. It is also known as a Bloody Mary, if your name happens to be Mary.',
'espoem causes the Windows Blue Screen of Death.',
'espoem went out of an infinite loop.',
'When Bruce Banner gets mad, he turns into the Hulk. When the Hulk gets mad, he turns into espoem.',
'espoem insists on strongly-typed programming languages.',
'espoem can blow bubbles with beef jerky.',
"espoem is widely predicted to be first black president. If you're thinking to yourself, But espoem isn't black, then you are dead wrong. And stop being a racist.",
'espoem once went skydiving, but promised never to do it again. One Grand Canyon is enough.',
"Godzilla is a Japanese rendition of espoem's first visit to Tokyo.",
'espoem has the greatest Poker-Face of all time. He won the 1983 World Series of Poker, despite holding only a Joker, a Get out of Jail Free Monopoloy card, a 2 of clubs, 7 of spades and a green #4 card from the game UNO.',
'Teenage Mutant Ninja Turtles is based on a true story: espoem once swallowed a turtle whole, and when he crapped it out, the turtle was six feet tall and had learned karate.',
"If you try to kill -9 espoem's programs, it backfires.",
"espoem' Penis is a third degree blackbelt, and an honorable 32nd-degree mason.",
'In ancient China there is a legend that one day a child will be born from a dragon, grow to be a man, and vanquish evil from the land. That man is not espoem, because espoem killed that man.',
'espoem can dereference NULL.',
'All arrays espoem declares are of infinite size, because espoem knows no bounds.',
'The pen is mighter than the sword, but only if the pen is held by espoem.',
"espoem doesn't step on toes. espoem steps on necks.",
'The truth will set you free. Unless espoem has you, in which case, forget it buddy!',
'Simply by pulling on both ends, espoem can stretch diamonds back into coal.',
'espoem does not style his hair. It lays perfectly in place out of sheer terror.',
'espoem once participated in the running of the bulls. He walked.',
'Never look a gift espoem in the mouth, because he will bite your damn eyes off.',
"If you Google search espoem getting his ass kicked you will generate zero results. It just doesn't happen.",
'espoem can unit test entire applications with a single assert.',
'On his birthday, espoem randomly selects one lucky child to be thrown into the sun.',
"Little known medical fact: espoem invented the Caesarean section when he roundhouse-kicked his way out of his monther's womb.",
"No one has ever spoken during review of espoem' code and lived to tell about it.",
'The First rule of espoem is: you do not talk about espoem.',
'Fool me once, shame on you. Fool espoem once and he will roundhouse kick you in the face.',
"espoem doesn't read books. He stares them down until he gets the information he wants.",
"The phrase 'balls to the wall' was originally conceived to describe espoem entering any building smaller than an aircraft hangar.",
"Someone once tried to tell espoem that roundhouse kicks aren't the best way to kick someone. This has been recorded by historians as the worst mistake anyone has ever made.",
'Along with his black belt, espoem often chooses to wear brown shoes. No one has DARED call him on it. Ever.',
'Whiteboards are white because espoem scared them that way.',
'espoem drives an ice cream truck covered in human skulls.',
"Every time espoem smiles, someone dies. Unless he smiles while he's roundhouse kicking someone in the face. Then two people die."]
| 102.419048
| 232
| 0.702343
| 1,704
| 10,754
| 4.432512
| 0.433685
| 0.013107
| 0.006355
| 0.006752
| 0.042367
| 0.032305
| 0.022772
| 0.013769
| 0.013769
| 0.013769
| 0
| 0.003183
| 0.240469
| 10,754
| 104
| 233
| 103.403846
| 0.921523
| 0
| 0
| 0
| 0
| 0.365385
| 0.874279
| 0
| 0
| 0
| 0
| 0
| 0.009615
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
b938dd2d4297c0de33a03a4e075f88143c4fb4d8
| 942
|
py
|
Python
|
setup.py
|
glibin/natasha
|
4f5c153f754759c189779f9879decd8d218356af
|
[
"MIT"
] | 1
|
2020-01-16T14:02:01.000Z
|
2020-01-16T14:02:01.000Z
|
setup.py
|
glibin/natasha
|
4f5c153f754759c189779f9879decd8d218356af
|
[
"MIT"
] | null | null | null |
setup.py
|
glibin/natasha
|
4f5c153f754759c189779f9879decd8d218356af
|
[
"MIT"
] | null | null | null |
from setuptools import setup, find_packages
setup(
name='natasha',
version='0.2.0',
description='Named-entity recognition for russian language',
url='https://github.com/bureaucratic-labs/natasha',
author='Dmitry Veselov',
author_email='[email protected]',
license='MIT',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
keywords='natural language processing, russian morphology, named entity recognition, tomita',
packages=find_packages(),
install_requires=[
'yargy==0.3.0'
],
extras_require={
'web': [
'ujson',
'aiohttp',
],
},
)
| 29.4375
| 97
| 0.59448
| 95
| 942
| 5.842105
| 0.642105
| 0.136937
| 0.18018
| 0.187387
| 0.097297
| 0
| 0
| 0
| 0
| 0
| 0
| 0.020144
| 0.262208
| 942
| 31
| 98
| 30.387097
| 0.778417
| 0
| 0
| 0.1
| 0
| 0
| 0.523355
| 0.022293
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.033333
| 0
| 0.033333
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
b9409e44daa0d7a262748b347f053c849e397b73
| 291
|
py
|
Python
|
homeassistant/components/todoist/types.py
|
MrDelik/core
|
93a66cc357b226389967668441000498a10453bb
|
[
"Apache-2.0"
] | 30,023
|
2016-04-13T10:17:53.000Z
|
2020-03-02T12:56:31.000Z
|
homeassistant/components/todoist/types.py
|
MrDelik/core
|
93a66cc357b226389967668441000498a10453bb
|
[
"Apache-2.0"
] | 24,710
|
2016-04-13T08:27:26.000Z
|
2020-03-02T12:59:13.000Z
|
homeassistant/components/todoist/types.py
|
MrDelik/core
|
93a66cc357b226389967668441000498a10453bb
|
[
"Apache-2.0"
] | 11,956
|
2016-04-13T18:42:31.000Z
|
2020-03-02T09:32:12.000Z
|
"""Types for the Todoist component."""
from __future__ import annotations
from typing import TypedDict
class DueDate(TypedDict):
"""Dict representing a due date in a todoist api response."""
date: str
is_recurring: bool
lang: str
string: str
timezone: str | None
| 19.4
| 65
| 0.697595
| 38
| 291
| 5.210526
| 0.763158
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.223368
| 291
| 14
| 66
| 20.785714
| 0.876106
| 0.302406
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.071429
| 0
| 1
| 0
| true
| 0
| 0.25
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
b943636ba1006005819134b02620af2faa23d559
| 84
|
py
|
Python
|
python/testData/debug/test_ignore_lib.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2019-04-28T07:48:50.000Z
|
2020-12-11T14:18:08.000Z
|
python/testData/debug/test_ignore_lib.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 173
|
2018-07-05T13:59:39.000Z
|
2018-08-09T01:12:03.000Z
|
python/testData/debug/test_ignore_lib.py
|
jnthn/intellij-community
|
8fa7c8a3ace62400c838e0d5926a7be106aa8557
|
[
"Apache-2.0"
] | 2
|
2020-03-15T08:57:37.000Z
|
2020-04-07T04:48:14.000Z
|
from calendar import setfirstweekday
stopped_in_user_file = True
setfirstweekday(15)
| 28
| 36
| 0.880952
| 11
| 84
| 6.454545
| 0.909091
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.025974
| 0.083333
| 84
| 3
| 37
| 28
| 0.896104
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.333333
| 0
| 0.333333
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
b95d4a692bcb2991f35a3f589cde3570c4033e09
| 29,218
|
py
|
Python
|
metrics/pointops/pointops_util.py
|
JiazeWang/SP-GAN
|
455003f78b1160ebe0a2056005b069808c0df35b
|
[
"MIT"
] | 73
|
2021-05-11T12:00:29.000Z
|
2022-03-31T09:40:12.000Z
|
metrics/pointops/pointops_util.py
|
JiazeWang/SP-GAN
|
455003f78b1160ebe0a2056005b069808c0df35b
|
[
"MIT"
] | 6
|
2021-08-18T13:03:43.000Z
|
2022-03-30T04:48:29.000Z
|
metrics/pointops/pointops_util.py
|
JiazeWang/SP-GAN
|
455003f78b1160ebe0a2056005b069808c0df35b
|
[
"MIT"
] | 13
|
2021-08-28T20:09:13.000Z
|
2022-03-20T12:42:51.000Z
|
from typing import Tuple
import torch
from torch.autograd import Function
import torch.nn as nn
from metrics.pointops import pointops_cuda
import numpy as np
class FurthestSampling(Function):
@staticmethod
def forward(ctx, xyz, m):
"""
input: xyz: (b, n, 3) and n > m, m: int32
output: idx: (b, m)
"""
assert xyz.is_contiguous()
b, n, _ = xyz.size()
idx = torch.cuda.IntTensor(b, m)
temp = torch.cuda.FloatTensor(b, n).fill_(1e10)
pointops_cuda.furthestsampling_cuda(b, n, m, xyz, temp, idx)
return idx
@staticmethod
def backward(xyz, a=None):
return None, None
furthestsampling = FurthestSampling.apply
class Gathering(Function):
@staticmethod
def forward(ctx, features, idx):
"""
input: features: (b, c, n), idx : (b, m) tensor
output: (b, c, m)
"""
assert features.is_contiguous()
assert idx.is_contiguous()
b, c, n = features.size()
m = idx.size(1)
output = torch.cuda.FloatTensor(b, c, m)
pointops_cuda.gathering_forward_cuda(b, c, n, m, features, idx, output)
ctx.for_backwards = (idx, c, n)
return output
@staticmethod
def backward(ctx, grad_out):
idx, c, n = ctx.for_backwards
b, m = idx.size()
grad_features = torch.cuda.FloatTensor(b, c, n).zero_()
grad_out_data = grad_out.data.contiguous()
pointops_cuda.gathering_backward_cuda(b, c, n, m, grad_out_data, idx, grad_features.data)
return grad_features, None
gathering = Gathering.apply
class NearestNeighbor(Function):
@staticmethod
def forward(ctx, unknown: torch.Tensor, known: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
"""
Find the three nearest neighbors of unknown in known
input: unknown: (b, n, 3), known: (b, m, 3)
output: dist2: (b, n, 3) l2 distance to the three nearest neighbors
idx: (b, n, 3) index of 3 nearest neighbors
"""
assert unknown.is_contiguous()
assert known.is_contiguous()
b, n, _ = unknown.size()
m = known.size(1)
dist2 = torch.cuda.FloatTensor(b, n, 3)
idx = torch.cuda.IntTensor(b, n, 3)
pointops_cuda.nearestneighbor_cuda(b, n, m, unknown, known, dist2, idx)
return torch.sqrt(dist2), idx
@staticmethod
def backward(ctx, a=None, b=None):
return None, None
nearestneighbor = NearestNeighbor.apply
class Interpolation(Function):
@staticmethod
def forward(ctx, features: torch.Tensor, idx: torch.Tensor, weight: torch.Tensor) -> torch.Tensor:
"""
Performs weight linear interpolation on 3 features
input: features: (b, c, m) features descriptors to be interpolated from
idx: (b, n, 3) three nearest neighbors of the target features in features
weight: (b, n, 3) weights
output: (b, c, n) tensor of the interpolated features
"""
assert features.is_contiguous()
assert idx.is_contiguous()
assert weight.is_contiguous()
b, c, m = features.size()
n = idx.size(1)
ctx.interpolation_for_backward = (idx, weight, m)
output = torch.cuda.FloatTensor(b, c, n)
pointops_cuda.interpolation_forward_cuda(b, c, m, n, features, idx, weight, output)
return output
@staticmethod
def backward(ctx, grad_out: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
"""
input: grad_out: (b, c, n)
output: grad_features: (b, c, m), None, None
"""
idx, weight, m = ctx.interpolation_for_backward
b, c, n = grad_out.size()
grad_features = torch.cuda.FloatTensor(b, c, m).zero_()
grad_out_data = grad_out.data.contiguous()
pointops_cuda.interpolation_backward_cuda(b, c, n, m, grad_out_data, idx, weight, grad_features.data)
return grad_features, None, None
interpolation = Interpolation.apply
class Grouping(Function):
@staticmethod
def forward(ctx, features: torch.Tensor, idx: torch.Tensor) -> torch.Tensor:
"""
input: features: (b, c, n), idx : (b, m, nsample) containing the indicies of features to group with
output: (b, c, m, nsample)
"""
assert features.is_contiguous()
assert idx.is_contiguous()
b, c, n = features.size()
_, m, nsample = idx.size()
output = torch.cuda.FloatTensor(b, c, m, nsample)
pointops_cuda.grouping_forward_cuda(b, c, n, m, nsample, features, idx, output)
ctx.for_backwards = (idx, n)
return output
@staticmethod
def backward(ctx, grad_out: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
"""
input: grad_out: (b, c, m, nsample)
output: (b, c, n), None
"""
idx, n = ctx.for_backwards
b, c, m, nsample = grad_out.size()
grad_features = torch.cuda.FloatTensor(b, c, n).zero_()
grad_out_data = grad_out.data.contiguous()
pointops_cuda.grouping_backward_cuda(b, c, n, m, nsample, grad_out_data, idx, grad_features.data)
return grad_features, None
grouping = Grouping.apply
class GroupingInt(Function):
@staticmethod
def forward(ctx, features: torch.Tensor, idx: torch.Tensor) -> torch.Tensor:
"""
input: features: (b, c, n), idx : (b, m, nsample) containing the indicies of features to group with
output: (b, c, m, nsample)
"""
assert features.is_contiguous()
assert idx.is_contiguous()
b, c, n = features.size()
_, m, nsample = idx.size()
output = torch.cuda.LongTensor(b, c, m, nsample)
pointops_cuda.grouping_int_forward_cuda(b, c, n, m, nsample, features, idx, output)
return output
@staticmethod
def backward(ctx, a=None):
return None, None
grouping_int = GroupingInt.apply
class BallQuery(Function):
@staticmethod
def forward(ctx, radius: float, nsample: int, xyz: torch.Tensor, new_xyz: torch.Tensor) -> torch.Tensor:
"""
input: radius: float, radius of the balls
nsample: int, maximum number of features in the balls
xyz: torch.Tensor, (b, n, 3) xyz coordinates of the features
new_xyz: torch.Tensor, (b, m, 3) centers of the ball query
output: (b, m, nsample) tensor with the indicies of the features that form the query balls
"""
assert xyz.is_contiguous()
assert new_xyz.is_contiguous()
b, n, _ = xyz.size()
m = new_xyz.size(1)
idx = torch.cuda.IntTensor(b, m, nsample).zero_()
pointops_cuda.ballquery_cuda(b, n, m, radius, nsample, new_xyz, xyz, idx)
return idx
@staticmethod
def backward(ctx, a=None):
return None, None, None, None
ballquery = BallQuery.apply
class FeatureDistribute(Function):
@staticmethod
def forward(ctx, max_xyz: torch.Tensor, xyz: torch.Tensor) -> torch.Tensor:
"""
:param ctx:
:param max_xyz: (b, n, 3)
:param xyz: (b, m, 3)
:return: distribute_idx: (b, m)
"""
assert max_xyz.is_contiguous()
assert xyz.is_contiguous()
b, n, _ = max_xyz.size()
m = xyz.size(1)
distribute_idx = torch.cuda.IntTensor(b, m).zero_()
pointops_cuda.featuredistribute_cuda(b, n, m, max_xyz, xyz, distribute_idx)
return distribute_idx
@staticmethod
def backward(ctx, a=None):
return None, None
featuredistribute = FeatureDistribute.apply
class FeatureGather(Function):
@staticmethod
def forward(ctx, max_feature: torch.Tensor, distribute_idx: torch.Tensor) -> torch.Tensor:
'''
:param ctx:
:param max_feature: (b, c, n)
:param distribute_idx: (b, m)
:return: distribute_feature: (b, c, m)
'''
assert max_feature.is_contiguous()
assert distribute_idx.is_contiguous()
b, c, n = max_feature.size()
m = distribute_idx.size(1)
distribute_feature = torch.cuda.FloatTensor(b, c, m).zero_()
pointops_cuda.featuregather_forward_cuda(b, n, m, c, max_feature, distribute_idx, distribute_feature)
ctx.for_backwards = (distribute_idx, n)
return distribute_feature
@staticmethod
def backward(ctx, grad_distribute_feature: torch.Tensor):
'''
:param ctx:
:param grad_distribute_feature: (b, c, m)
:return: grad_max_feature: (b, c, n), None
'''
distribute_idx, n = ctx.for_backwards
b, c, m = grad_distribute_feature.size()
grad_max_feature = torch.cuda.FloatTensor(b, c, n).zero_()
grad_distribute_feature_data = grad_distribute_feature.data.contiguous()
pointops_cuda.featuregather_backward_cuda(b, n, m, c, grad_distribute_feature_data, distribute_idx, grad_max_feature.data)
return grad_max_feature, None
featuregather = FeatureGather.apply
class LabelStatBallRange(Function):
@staticmethod
def forward(ctx, radius: float, xyz: torch.Tensor, new_xyz: torch.Tensor, label_stat: torch.Tensor) -> torch.Tensor:
'''
:param ctx:
:param radius:
:param xyz: (b, n, 3)
:param new_xyz: (b, m, 3)
:param label_stat: (b, n, nclass)
:return: new_label_stat: (b, m, nclass)
'''
assert xyz.is_contiguous()
assert new_xyz.is_contiguous()
assert label_stat.is_contiguous()
b, n, nclass = label_stat.size()
m = new_xyz.size(1)
new_label_stat = torch.cuda.IntTensor(b, m, nclass).zero_()
pointops_cuda.labelstat_ballrange_cuda(b, n, m, radius, nclass, new_xyz, xyz, label_stat, new_label_stat)
return new_label_stat
@staticmethod
def backward(ctx, a=None):
return None, None, None, None
labelstat_ballrange = LabelStatBallRange.apply
class LabelStatIdx(Function):
@staticmethod
def forward(ctx, nsample: int, label_stat: torch.Tensor, idx: torch.Tensor) -> torch.Tensor:
'''
:param ctx:
:param nsample:
:param label_stat: (b, n, nclass)
:param idx: (b, m, nsample)
:return: new_label_stat: (b, m, nclass)
'''
assert label_stat.is_contiguous()
assert idx.is_contiguous()
b, n, nclass = label_stat.size()
m = idx.size(1)
new_label_stat = torch.cuda.IntTensor(b, m, nclass).zero_()
pointops_cuda.labelstat_idx_cuda(b, n, m, nsample, nclass, label_stat, idx, new_label_stat)
return new_label_stat
@staticmethod
def backward(ctx, a=None):
return None, None, None
labelstat_idx = LabelStatIdx.apply
class LabelStatAndBallQuery(Function):
@staticmethod
def forward(ctx, radius: float, nsample: int, xyz: torch.Tensor, new_xyz: torch.Tensor, label_stat: torch.Tensor):
'''
:param ctx:
:param radius:
:param nsample:
:param xyz: (b, n, 3)
:param new_xyz: (b, m, 3)
:param label_stat: (b, n, nclass)
:return: new_label_stat: (b, m, nclass) idx: (b, m, nsample)
'''
assert xyz.is_contiguous()
assert new_xyz.is_contiguous()
assert label_stat.is_contiguous()
b, n, nclass = label_stat.size()
m = new_xyz.size(1)
new_label_stat = torch.cuda.IntTensor(b, m, nclass).zero_()
idx = torch.cuda.IntTensor(b, m, nsample).zero_()
pointops_cuda.labelstat_and_ballquery_cuda(b, n, m, radius, nsample, nclass, new_xyz, xyz, label_stat, idx, new_label_stat)
return new_label_stat, idx
@staticmethod
def backward(ctx, a=None, b=None):
return None, None, None, None, None
labelstat_and_ballquery = LabelStatAndBallQuery.apply
def pairwise_distances(x, y=None):
'''
Input: x is a Nxd matrix
y is an optional Mxd matirx
Output: dist is a NxM matrix where dist[i,j] is the square norm between x[i,:] and y[j,:]
if y is not given then use 'y=x'.
i.e. dist[i,j] = ||x[i,:]-y[j,:]||^2
'''
x_norm = (x ** 2).sum(1).view(-1, 1)
if y is not None:
y_t = torch.transpose(y, 0, 1)
y_norm = (y ** 2).sum(1).view(1, -1)
else:
y_t = torch.transpose(x, 0, 1)
y_norm = x_norm.view(1, -1)
dist = x_norm + y_norm - 2.0 * torch.mm(x, y_t)
import numpy as np
return torch.clamp(dist, 0.0, np.inf)
class KNNQueryNaive(Function):
@staticmethod
def forward(ctx, nsample: int, xyz: torch.Tensor, new_xyz: torch.Tensor = None) -> Tuple[torch.Tensor]:
"""
KNN Indexing
input: nsample: int32, Number of neighbor
xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
output: idx: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
b, m, _ = new_xyz.size()
n = xyz.size(1)
'''
idx = torch.zeros(b, m, nsample).int().cuda()
for i in range(b):
dist = pairwise_distances(new_xyz[i, :, :], xyz[i, :, :])
[_, idxs] = torch.sort(dist, dim=1)
idx[i, :, :] = idxs[:, 0:nsample]
'''
# '''
# new_xyz_repeat = new_xyz.repeat(1, 1, n).view(b, m * n, 3)
# xyz_repeat = xyz.repeat(1, m, 1).view(b, m * n, 3)
# dist = (new_xyz_repeat - xyz_repeat).pow(2).sum(dim=2).view(b, m, n)
dist = (new_xyz.repeat(1, 1, n).view(b, m * n, 3) - xyz.repeat(1, m, 1).view(b, m * n, 3)).pow(2).sum(dim=2).view(b, m, n)
[_, idxs] = torch.sort(dist, dim=2)
idx = idxs[:, :, 0:nsample].int()
# '''
return idx
@staticmethod
def backward(ctx):
return None, None, None
knnquery_naive = KNNQueryNaive.apply
class KNNQuery(Function):
@staticmethod
def forward(ctx, nsample: int, xyz: torch.Tensor, new_xyz: torch.Tensor = None) -> Tuple[torch.Tensor]:
"""
KNN Indexing
input: nsample: int32, Number of neighbor
xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
output: idx: (b, m, nsample)
( dist2: (b, m, nsample) )
"""
if new_xyz is None:
new_xyz = xyz
assert xyz.is_contiguous()
assert new_xyz.is_contiguous()
b, m, _ = new_xyz.size()
n = xyz.size(1)
idx = torch.cuda.IntTensor(b, m, nsample).zero_()
dist2 = torch.cuda.FloatTensor(b, m, nsample).zero_()
pointops_cuda.knnquery_cuda(b, n, m, nsample, xyz, new_xyz, idx, dist2)
return idx
@staticmethod
def backward(ctx, a=None):
return None, None, None
knnquery = KNNQuery.apply
class KNNQueryExclude(Function):
@staticmethod
def forward(ctx, nsample: int, xyz: torch.Tensor, new_xyz: torch.Tensor = None) -> Tuple[torch.Tensor]:
"""
KNN Indexing
input: nsample: int32, Number of neighbor
xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
output: new_features: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
b, m, _ = new_xyz.size()
n = xyz.size(1)
'''
idx = torch.zeros(b, m, nsample).int().cuda()
for i in range(b):
dist = pairwise_distances(new_xyz[i, :, :], xyz[i, :, :])
[_, idxs] = torch.sort(dist, dim=1)
idx[i, :, :] = idxs[:, 0:nsample]
'''
# '''
# new_xyz_repeat = new_xyz.repeat(1, 1, n).view(b, m * n, 3)
# xyz_repeat = xyz.repeat(1, m, 1).view(b, m * n, 3)
# dist = (new_xyz_repeat - xyz_repeat).pow(2).sum(dim=2).view(b, m, n)
dist = (new_xyz.repeat(1, 1, n).view(b, m * n, 3) - xyz.repeat(1, m, 1).view(b, m * n, 3)).pow(2).sum(dim=2).view(b, m, n)
[_, idxs] = torch.sort(dist, dim=2)
idx = idxs[:, :, 1:nsample+1].int()
# '''
return idx
@staticmethod
def backward(ctx):
return None, None, None
knnquery_exclude = KNNQueryExclude.apply
class Le_QueryAndGroup_SameSize(nn.Module):
"""
Groups with a ball query of radius
parameters:
radius: float32, Radius of ball
nsample: int32, Maximum number of features to gather in the ball
"""
def __init__(self, radius=None, nsample=32, use_xyz=True):
super(Le_QueryAndGroup_SameSize, self).__init__()
self.radius, self.nsample, self.use_xyz = radius, nsample, use_xyz
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None, features: torch.Tensor = None, idx: torch.Tensor = None) -> torch.Tensor:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: (b, n, 3) centriods
features: (b, c, n)
idx: idx of neighbors
# idxs: (b, n)
output: new_features: (b, c+3, m, nsample)
# grouped_idxs: (b, m, nsample)
"""
assert xyz.size() == new_xyz.size()
if new_xyz is None:
new_xyz = xyz
if idx is None:
if self.radius is not None:
idx = ballquery(self.radius, self.nsample, xyz, new_xyz)
else:
# idx = knnquery_naive(self.nsample, xyz, new_xyz) # (b, m, nsample)
idx = knnquery(self.nsample, xyz, new_xyz) # (b, m, nsample)
xyz_trans = xyz.transpose(1, 2).contiguous()
grouped_xyz = grouping(xyz_trans, idx) # (b, 3, m, nsample)
# grouped_idxs = grouping(idxs.unsqueeze(1).float(), idx).squeeze(1).int() # (b, m, nsample)
grouped_xyz -= new_xyz.transpose(1, 2).unsqueeze(-1)
if features is not None:
grouped_features = grouping(features, idx) # (b, c, m, nsample)
if self.use_xyz:
#new_features = torch.cat([grouped_xyz, grouped_features], dim=1) # (b, c+3, m, nsample) # le
new_features = grouped_features # (b, c, m, nsample)
else:
new_features = grouped_features
else:
assert self.use_xyz, "Cannot have not features and not use xyz as a feature!"
new_features = grouped_xyz
return grouped_xyz, new_features
class QueryAndGroup(nn.Module):
"""
Groups with a ball query of radius
parameters:
radius: float32, Radius of ball
nsample: int32, Maximum number of features to gather in the ball
"""
def __init__(self, radius=None, nsample=32, use_xyz=True):
super(QueryAndGroup, self).__init__()
self.radius, self.nsample, self.use_xyz = radius, nsample, use_xyz
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None, features: torch.Tensor = None, idx: torch.Tensor = None) -> torch.Tensor:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
features: (b, c, n)
idx: idx of neighbors
# idxs: (b, n)
output: new_features: (b, c+3, m, nsample)
# grouped_idxs: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
if idx is None:
if self.radius is not None:
idx = ballquery(self.radius, self.nsample, xyz, new_xyz)
else:
# idx = knnquery_naive(self.nsample, xyz, new_xyz) # (b, m, nsample)
idx = knnquery(self.nsample, xyz, new_xyz) # (b, m, nsample)
xyz_trans = xyz.transpose(1, 2).contiguous()
grouped_xyz = grouping(xyz_trans, idx) # (b, 3, m, nsample)
# grouped_idxs = grouping(idxs.unsqueeze(1).float(), idx).squeeze(1).int() # (b, m, nsample)
grouped_xyz -= new_xyz.transpose(1, 2).unsqueeze(-1)
if features is not None:
grouped_features = grouping(features, idx)
if self.use_xyz:
new_features = torch.cat([grouped_xyz, grouped_features], dim=1) # (b, c+3, m, nsample)
else:
new_features = grouped_features
else:
assert self.use_xyz, "Cannot have not features and not use xyz as a feature!"
new_features = grouped_xyz
return new_features
class QueryAndGroup_Dilate(nn.Module):
"""
Groups with a ball query of radius
parameters:
radius: float32, Radius of ball
nsample: int32, Maximum number of features to gather in the ball
"""
def __init__(self, radius=None, nsample=32, use_xyz=True):
super(QueryAndGroup_Dilate, self).__init__()
self.radius, self.nsample, self.use_xyz = radius, nsample, use_xyz
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None, features: torch.Tensor = None, idx: torch.Tensor = None) -> torch.Tensor:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
features: (b, c, n)
idx: idx of neighbors
# idxs: (b, n)
output: new_features: (b, c+3, m, nsample)
# grouped_idxs: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
if idx is None:
if self.radius is not None:
idx = ballquery(self.radius, 2*self.nsample, xyz, new_xyz)
else:
# idx = knnquery_naive(self.nsample, xyz, new_xyz) # (b, m, nsample)
idx = knnquery(2*self.nsample, xyz, new_xyz) # (b, m, nsample)
idx2 = np.array([i for i in range(2*self.nsample)])
np.random.shuffle(idx2)
idx2 = idx2[:self.nsample]
idx = idx[:, :, idx2]
xyz_trans = xyz.transpose(1, 2).contiguous()
grouped_xyz = grouping(xyz_trans, idx) # (b, 3, m, nsample)
# grouped_idxs = grouping(idxs.unsqueeze(1).float(), idx).squeeze(1).int() # (b, m, nsample)
grouped_xyz -= new_xyz.transpose(1, 2).unsqueeze(-1)
if features is not None:
grouped_features = grouping(features, idx)
if self.use_xyz:
new_features = torch.cat([grouped_xyz, grouped_features], dim=1) # (b, c+3, m, nsample)
else:
new_features = grouped_features
else:
assert self.use_xyz, "Cannot have not features and not use xyz as a feature!"
new_features = grouped_xyz
return new_features
class Le_QueryAndGroup(nn.Module):
"""
Groups with a ball query of radius
parameters:
radius: float32, Radius of ball
nsample: int32, Maximum number of features to gather in the ball
"""
def __init__(self, radius=None, nsample=32, use_xyz=True):
super(Le_QueryAndGroup, self).__init__()
self.radius, self.nsample, self.use_xyz = radius, nsample, use_xyz
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None, features: torch.Tensor = None, idx: torch.Tensor = None) -> torch.Tensor:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
features: (b, c, n)
idx: idx of neighbors
# idxs: (b, n)
output: new_features: (b, c+3, m, nsample)
# grouped_idxs: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
if idx is None:
if self.radius is not None:
idx = ballquery(self.radius, self.nsample, xyz, new_xyz)
else:
# idx = knnquery_naive(self.nsample, xyz, new_xyz) # (b, m, nsample)
idx = knnquery(self.nsample, xyz, new_xyz) # (b, m, nsample)
xyz_trans = xyz.transpose(1, 2).contiguous()
grouped_xyz = grouping(xyz_trans, idx) # (b, 3, m, nsample)
# grouped_idxs = grouping(idxs.unsqueeze(1).float(), idx).squeeze(1).int() # (b, m, nsample)
grouped_xyz -= new_xyz.transpose(1, 2).unsqueeze(-1)
if features is not None:
grouped_features = grouping(features, idx) # (b, c, m, nsample)
if self.use_xyz:
#new_features = torch.cat([grouped_xyz, grouped_features], dim=1) # (b, c+3, m, nsample) # le
new_features = grouped_features # (b, c, m, nsample)
else:
new_features = grouped_features
else:
assert self.use_xyz, "Cannot have not features and not use xyz as a feature!"
new_features = grouped_xyz
return grouped_xyz, new_features
class Gen_QueryAndGroupXYZ(nn.Module):
"""
Groups with a ball query of radius
parameters:
radius: float32, Radius of ball
nsample: int32, Maximum number of features to gather in the ball
"""
def __init__(self, radius=None, nsample=32, use_xyz=True):
super(Gen_QueryAndGroupXYZ, self).__init__()
self.radius, self.nsample, self.use_xyz = radius, nsample, use_xyz
#def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None, features: torch.Tensor = None, idx: torch.Tensor = None) -> torch.Tensor:
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None) -> torch.Tensor:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
features: (b, c, n)
idx: idx of neighbors
# idxs: (b, n)
output: new_features: (b, c+3, m, nsample)
# grouped_idxs: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
#if idx is None:
if self.radius is not None:
idx = ballquery(self.radius, self.nsample, xyz, new_xyz)
else:
idx = knnquery(self.nsample, xyz, new_xyz) # (b, m, nsample)
xyz_trans = xyz.transpose(1, 2).contiguous() # BxNx3 -> Bx3xN
grouped_xyz = grouping(xyz_trans, idx) # (b, 3, m, nsample)
return grouped_xyz
class Le_QueryAndGroup_OnlyFeature(nn.Module):
"""
Groups with a ball query of radius
parameters:
radius: float32, Radius of ball
nsample: int32, Maximum number of features to gather in the ball
"""
def __init__(self, radius=None, nsample=32, use_xyz=True):
super(Le_QueryAndGroup_OnlyFeature, self).__init__()
self.radius, self.nsample, self.use_xyz = radius, nsample, use_xyz
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor = None, features: torch.Tensor = None, idx: torch.Tensor = None) -> torch.Tensor:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: (b, m, 3) centriods
features: (b, c, n)
idx: idx of neighbors
# idxs: (b, n)
output: new_features: (b, c+3, m, nsample)
# grouped_idxs: (b, m, nsample)
"""
if new_xyz is None:
new_xyz = xyz
if idx is None:
if self.radius is not None:
idx = ballquery(self.radius, self.nsample, xyz, new_xyz)
else:
# idx = knnquery_naive(self.nsample, xyz, new_xyz) # (b, m, nsample)
idx = knnquery(self.nsample, xyz, new_xyz) # (b, m, nsample)
#xyz_trans = xyz.transpose(1, 2).contiguous()
#grouped_xyz = grouping(xyz_trans, idx) # (b, 3, m, nsample)
# grouped_idxs = grouping(idxs.unsqueeze(1).float(), idx).squeeze(1).int() # (b, m, nsample)
#grouped_xyz -= new_xyz.transpose(1, 2).unsqueeze(-1)
if features is not None:
grouped_features = grouping(features, idx) # (b, c, m, nsample)
if self.use_xyz:
#new_features = torch.cat([grouped_xyz, grouped_features], dim=1) # (b, c+3, m, nsample) # le
new_features = grouped_features # (b, c, m, nsample)
else:
new_features = grouped_features
else:
assert self.use_xyz, "Cannot have not features and not use xyz as a feature!"
new_features = grouped_xyz
return new_features
class GroupAll(nn.Module):
"""
Groups all features
"""
def __init__(self, use_xyz: bool = True):
super(GroupAll, self).__init__()
self.use_xyz = use_xyz
def forward(self, xyz: torch.Tensor, new_xyz: torch.Tensor, features: torch.Tensor = None) -> Tuple[torch.Tensor]:
"""
input: xyz: (b, n, 3) coordinates of the features
new_xyz: ignored torch
features: (b, c, n) descriptors of the features
output: new_features: (b, c+3, 1, N) tensor
"""
grouped_xyz = xyz.transpose(1, 2).unsqueeze(2)
if features is not None:
grouped_features = features.unsqueeze(2)
if self.use_xyz:
new_features = torch.cat([grouped_xyz, grouped_features], dim=1) # (b, c+3, 1, n)
else:
new_features = grouped_features
else:
new_features = grouped_xyz
return new_features
| 37.458974
| 145
| 0.585906
| 3,863
| 29,218
| 4.285271
| 0.052032
| 0.033345
| 0.020116
| 0.010149
| 0.782953
| 0.752265
| 0.71898
| 0.682131
| 0.66274
| 0.652773
| 0
| 0.011793
| 0.294784
| 29,218
| 779
| 146
| 37.50706
| 0.791604
| 0.261448
| 0
| 0.632212
| 0
| 0
| 0.013866
| 0
| 0
| 0
| 0
| 0
| 0.081731
| 1
| 0.108173
| false
| 0
| 0.016827
| 0.026442
| 0.269231
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 1
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
b97e1419e0e45b84ecc462227c812c10beb92718
| 181
|
py
|
Python
|
YouTube/CursoEmVideo/python/ex012.py
|
Fh-Shadow/Progamando
|
f496d83c36e9a079ed06b4e7c34396c57f539de9
|
[
"MIT"
] | null | null | null |
YouTube/CursoEmVideo/python/ex012.py
|
Fh-Shadow/Progamando
|
f496d83c36e9a079ed06b4e7c34396c57f539de9
|
[
"MIT"
] | null | null | null |
YouTube/CursoEmVideo/python/ex012.py
|
Fh-Shadow/Progamando
|
f496d83c36e9a079ed06b4e7c34396c57f539de9
|
[
"MIT"
] | null | null | null |
a = float(input('Qual é o preço do produto? R$'))
d = a - (a * 23 / 100)
print('O produto que custava R${:.2f}, na promoção de 23% de desconto vai custar: R${:.2f}' .format(a, d))
| 45.25
| 106
| 0.607735
| 35
| 181
| 3.142857
| 0.685714
| 0.054545
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.061644
| 0.19337
| 181
| 3
| 107
| 60.333333
| 0.691781
| 0
| 0
| 0
| 0
| 0.333333
| 0.618785
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.333333
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 1
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
b99506d26f9716e398b3a3724d393185a9900942
| 1,216
|
py
|
Python
|
hard-gists/98bb452dc14e8c40e403/snippet.py
|
jjhenkel/dockerizeme
|
eaa4fe5366f6b9adf74399eab01c712cacaeb279
|
[
"Apache-2.0"
] | 21
|
2019-07-08T08:26:45.000Z
|
2022-01-24T23:53:25.000Z
|
hard-gists/98bb452dc14e8c40e403/snippet.py
|
jjhenkel/dockerizeme
|
eaa4fe5366f6b9adf74399eab01c712cacaeb279
|
[
"Apache-2.0"
] | 5
|
2019-06-15T14:47:47.000Z
|
2022-02-26T05:02:56.000Z
|
hard-gists/98bb452dc14e8c40e403/snippet.py
|
jjhenkel/dockerizeme
|
eaa4fe5366f6b9adf74399eab01c712cacaeb279
|
[
"Apache-2.0"
] | 17
|
2019-05-16T03:50:34.000Z
|
2021-01-14T14:35:12.000Z
|
from scryptos import *
p1 = 32581479300404876772405716877547
p2 = 27038194053540661979045656526063
p3 = 26440615366395242196516853423447
n = p1*p2*p3
e = 3
c = int(open("flag.enc", "rb").read().encode("hex"), 16)
# from User's Guide to PARI/GP, nth_root function
sqrtnall = 'sqrtnall(x,n)={my(V,r,z,r2);r=sqrtn(x,n,&z);if(!z,error("Impossible case in sqrtn"));if(type(x)=="t_INTMOD"||type(x)=="t_PADIC",r2 = r*z;n=1;while(r2!=r,r2*=z;n++));V=vector(n);V[1]=r;for(i=2,n,V[i]=V[i-1]*z);V}'
c1 = eval(parigp([sqrtnall, "Vec(liftall(sqrtnall(Mod(%d, %d), 3)))" % (c, p1)]))
c2 = eval(parigp([sqrtnall, "Vec(liftall(sqrtnall(Mod(%d, %d), 3)))" % (c, p2)]))
c3 = eval(parigp([sqrtnall, "Vec(liftall(sqrtnall(Mod(%d, %d), 3)))" % (c, p3)]))
"""
c1 = [6149264605288583791069539134541, 13404203109409336045283549715377, 13028011585706956936052628027629]
c2 = [19616973567618515464515107624812]
c3 = [13374868592866626517389128266735, 7379361747422713811654086477766, 5686385026105901867473638678946]
"""
for x in c1:
for y in c2:
for z in c3:
crt = chinese_remainder_theorem([(x, p1), (y, p2), (z, p3)])
d = hex(crt, 2)[2:].decode("hex")
if "0ctf" in d:
print d[d.find("0ctf"):].strip()
| 39.225806
| 224
| 0.663651
| 181
| 1,216
| 4.430939
| 0.441989
| 0.009975
| 0.067332
| 0.078554
| 0.160848
| 0.160848
| 0.160848
| 0.160848
| 0.160848
| 0.160848
| 0
| 0.333959
| 0.123355
| 1,216
| 30
| 225
| 40.533333
| 0.418386
| 0.038651
| 0
| 0
| 0
| 0.055556
| 0.384785
| 0.312018
| 0
| 0
| 0
| 0
| 0
| 0
| null | null | 0
| 0.055556
| null | null | 0.055556
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
b9a3c97262cf3c50a695832e8941374463a78067
| 901
|
py
|
Python
|
tests/test_MaskedArrayCollection.py
|
ahaldane/NDducktype_tests
|
4876416e5fbff7ba0d85445c0eeae432d6e80014
|
[
"BSD-3-Clause"
] | 3
|
2020-06-18T14:18:39.000Z
|
2021-07-22T18:05:52.000Z
|
tests/test_MaskedArrayCollection.py
|
ahaldane/NDducktype_tests
|
4876416e5fbff7ba0d85445c0eeae432d6e80014
|
[
"BSD-3-Clause"
] | 2
|
2020-07-19T15:44:09.000Z
|
2020-07-28T23:22:21.000Z
|
tests/test_MaskedArrayCollection.py
|
ahaldane/NDducktype_tests
|
4876416e5fbff7ba0d85445c0eeae432d6e80014
|
[
"BSD-3-Clause"
] | 2
|
2019-06-20T00:20:13.000Z
|
2020-09-20T21:42:52.000Z
|
#!/usr/bin/env python
from ndarray_ducktypes.ArrayCollection import ArrayCollection
from ndarray_ducktypes.MaskedArray import MaskedArray
from ndarray_ducktypes.MaskedArrayCollection import MaskedArrayCollection
import numpy as np
# Tests for Masked ArrayCollections.
#
# First try: Simply make an arraycollection of MaskedArrays. Downside: this
# strategy does not give a "filled" method. Probably to get a masked
# ArrayCollection we should really subclass ArrayCollection to have a
# fill_value and a filled() method
#a = MaskedArray(np.arange(10), np.arange(10)%3)
#b = MaskedArray(np.arange(10.) + 13, np.arange(10)%2)
#c = ArrayCollection([('age', a), ('weight', b)])
#print(repr(c))
#c['age'] += 100
#print(repr(c))
## second try: Subclass of ArrayCollection
#c = MaskedArrayCollection([('age', a), ('weight', b)])
#print(repr(c))
#c['age'] += 100
#print(repr(c))
#print(repr(c.filled()))
| 31.068966
| 75
| 0.738069
| 125
| 901
| 5.288
| 0.464
| 0.068079
| 0.075643
| 0.06354
| 0.114977
| 0.114977
| 0.114977
| 0.114977
| 0.114977
| 0.114977
| 0
| 0.022699
| 0.119867
| 901
| 28
| 76
| 32.178571
| 0.810845
| 0.719201
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 1
| 0
| 1
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
b9aa6c3c1ecb2355209fd4db4f58118befbffa8a
| 225
|
py
|
Python
|
python-basic-grammer/python-basic/02-python-variables-and-string/string_strip_demo.py
|
jinrunheng/base-of-python
|
595bdbc8bfaf2136d8f1f9ea82c03b84aeaf0a39
|
[
"Apache-2.0"
] | null | null | null |
python-basic-grammer/python-basic/02-python-variables-and-string/string_strip_demo.py
|
jinrunheng/base-of-python
|
595bdbc8bfaf2136d8f1f9ea82c03b84aeaf0a39
|
[
"Apache-2.0"
] | null | null | null |
python-basic-grammer/python-basic/02-python-variables-and-string/string_strip_demo.py
|
jinrunheng/base-of-python
|
595bdbc8bfaf2136d8f1f9ea82c03b84aeaf0a39
|
[
"Apache-2.0"
] | null | null | null |
# 字符串删除空白
str1 = " hello "
print(str1)
print(len(str1))
# 去除两端的空格
print(str1.strip())
print(len(str1.strip()))
# 去除左侧的空格
print(str1.lstrip())
print(len(str1.lstrip()))
# 去除右侧的空格
print(str1.rstrip())
print(len(str1.rstrip()))
| 16.071429
| 25
| 0.688889
| 32
| 225
| 4.84375
| 0.34375
| 0.232258
| 0.309677
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.044118
| 0.093333
| 225
| 14
| 26
| 16.071429
| 0.715686
| 0.137778
| 0
| 0
| 0
| 0
| 0.036842
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.888889
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 3
|
b9b2dd8fc97fddaaa64ec64957043ee8e8088e39
| 615
|
py
|
Python
|
frappe-bench/apps/erpnext/erpnext/non_profit/doctype/member/member.py
|
Semicheche/foa_frappe_docker
|
a186b65d5e807dd4caf049e8aeb3620a799c1225
|
[
"MIT"
] | null | null | null |
frappe-bench/apps/erpnext/erpnext/non_profit/doctype/member/member.py
|
Semicheche/foa_frappe_docker
|
a186b65d5e807dd4caf049e8aeb3620a799c1225
|
[
"MIT"
] | null | null | null |
frappe-bench/apps/erpnext/erpnext/non_profit/doctype/member/member.py
|
Semicheche/foa_frappe_docker
|
a186b65d5e807dd4caf049e8aeb3620a799c1225
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
class Member(Document):
def onload(self):
"""Load address and contacts in `__onload`"""
load_address_and_contact(self)
def validate(self):
self.validate_email_type(self.email)
def validate_email_type(self, email):
from frappe.utils import validate_email_add
validate_email_add(email.strip(), True)
| 29.285714
| 72
| 0.786992
| 86
| 615
| 5.360465
| 0.488372
| 0.086768
| 0.110629
| 0.091106
| 0.112798
| 0
| 0
| 0
| 0
| 0
| 0
| 0.009259
| 0.121951
| 615
| 21
| 73
| 29.285714
| 0.844444
| 0.287805
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.272727
| false
| 0
| 0.363636
| 0
| 0.727273
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
b9c3b62c39c9c9979a0f73775051d1aecd742c75
| 73
|
py
|
Python
|
index.py
|
StarSky1/microsoft-python-study
|
7fdc1ad87ac0eeb497013d7792f499416aac32d9
|
[
"MIT"
] | null | null | null |
index.py
|
StarSky1/microsoft-python-study
|
7fdc1ad87ac0eeb497013d7792f499416aac32d9
|
[
"MIT"
] | null | null | null |
index.py
|
StarSky1/microsoft-python-study
|
7fdc1ad87ac0eeb497013d7792f499416aac32d9
|
[
"MIT"
] | null | null | null |
name=input('input your name:');
print('hello');
print(name.capitalize());
| 24.333333
| 31
| 0.69863
| 10
| 73
| 5.1
| 0.6
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.054795
| 73
| 3
| 32
| 24.333333
| 0.73913
| 0
| 0
| 0
| 0
| 0
| 0.283784
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0
| 0
| 0
| 0.666667
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
|
0
| 3
|
b9c7d11a999150072e268ba745c49eb08ce5081f
| 358
|
py
|
Python
|
src/PyDS/Queue/Deque.py
|
AoWangPhilly/PyDS
|
d79f92d0d2e7c005ebb8fa9f631d5f01e590625e
|
[
"MIT"
] | null | null | null |
src/PyDS/Queue/Deque.py
|
AoWangPhilly/PyDS
|
d79f92d0d2e7c005ebb8fa9f631d5f01e590625e
|
[
"MIT"
] | null | null | null |
src/PyDS/Queue/Deque.py
|
AoWangPhilly/PyDS
|
d79f92d0d2e7c005ebb8fa9f631d5f01e590625e
|
[
"MIT"
] | null | null | null |
class Deque:
def add_first(self, value):
...
def add_last(self, value):
...
def delete_first(self):
...
def delete_last(self):
...
def first(self):
...
def last(self):
...
def is_empty(self):
...
def __len__(self):
...
def __str__(self):
...
| 12.785714
| 31
| 0.430168
| 36
| 358
| 3.916667
| 0.361111
| 0.297872
| 0.170213
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.410615
| 358
| 27
| 32
| 13.259259
| 0.668246
| 0
| 0
| 0.473684
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.473684
| false
| 0
| 0
| 0
| 0.526316
| 0
| 0
| 0
| 0
| null | 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
b9cd3a4333e6169069ae770751a00e82db1b741a
| 736
|
py
|
Python
|
bot_da_os/statemachine/person/person_action.py
|
Atsocs/bot-da-os
|
e6d54057f4a3b703f303e9944a39e291ac87c40f
|
[
"MIT"
] | null | null | null |
bot_da_os/statemachine/person/person_action.py
|
Atsocs/bot-da-os
|
e6d54057f4a3b703f303e9944a39e291ac87c40f
|
[
"MIT"
] | null | null | null |
bot_da_os/statemachine/person/person_action.py
|
Atsocs/bot-da-os
|
e6d54057f4a3b703f303e9944a39e291ac87c40f
|
[
"MIT"
] | null | null | null |
from operator import eq
class PersonAction:
def __init__(self, action):
self.action = action
def __str__(self): return self.action
def __eq__(self, other):
return eq(self.action, other.action)
# Necessary when __cmp__ or __eq__ is defined
# in order to make this class usable as a
# dictionary key:
def __hash__(self):
return hash(self.action)
# Static fields; an enumeration of instances:
PersonAction.compliment = PersonAction("person compliments")
PersonAction.informing = PersonAction("person gives information about the service order")
PersonAction.query = PersonAction("person wants to know about his/her order")
PersonAction.angry = PersonAction("person is pissed off")
| 29.44
| 89
| 0.72962
| 93
| 736
| 5.516129
| 0.569892
| 0.097466
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.191576
| 736
| 24
| 90
| 30.666667
| 0.862185
| 0.194293
| 0
| 0
| 0
| 0
| 0.214286
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.307692
| false
| 0
| 0.076923
| 0.230769
| 0.615385
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
b9fa33196acc6d33e769b7c8e96ca3b00aeee8cc
| 237
|
wsgi
|
Python
|
obviforum/obviforum.wsgi
|
dcloutman/obviforum
|
31af0cf6f2e243bff9d920276831415bd5210cf9
|
[
"MIT"
] | null | null | null |
obviforum/obviforum.wsgi
|
dcloutman/obviforum
|
31af0cf6f2e243bff9d920276831415bd5210cf9
|
[
"MIT"
] | null | null | null |
obviforum/obviforum.wsgi
|
dcloutman/obviforum
|
31af0cf6f2e243bff9d920276831415bd5210cf9
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
import sys
import logging
import os
logging.basicConfig(stream=sys.stderr)
file_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, file_dir)
from main import app as application
from main import db
| 23.7
| 54
| 0.797468
| 40
| 237
| 4.575
| 0.6
| 0.076503
| 0.153005
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004695
| 0.101266
| 237
| 9
| 55
| 26.333333
| 0.85446
| 0.084388
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.625
| 0
| 0.625
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
|
0
| 3
|
b9fc6312cdae3331d02a69bbbf58d767d486a41b
| 1,361
|
py
|
Python
|
arch/api/base/utils/party.py
|
yzjba/FATE
|
9a6d252da637b2583a0f8a51f6cb4c615850bab9
|
[
"Apache-2.0"
] | 32
|
2020-06-12T08:39:58.000Z
|
2022-03-20T06:57:08.000Z
|
arch/api/base/utils/party.py
|
ErikSun2020/FATE
|
bdda535c7d8a974fc2c43102837964b7da199730
|
[
"Apache-2.0"
] | 10
|
2020-11-13T18:55:48.000Z
|
2022-02-10T02:00:12.000Z
|
arch/api/base/utils/party.py
|
ErikSun2020/FATE
|
bdda535c7d8a974fc2c43102837964b7da199730
|
[
"Apache-2.0"
] | 16
|
2020-06-12T06:51:46.000Z
|
2022-03-29T10:23:42.000Z
|
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class Party(object):
"""
Uniquely identify
"""
def __init__(self, role, party_id):
self.role = role
self.party_id = party_id
def __hash__(self):
return (self.role, self.party_id).__hash__()
def __str__(self):
return f"Party(role={self.role}, party_id={self.party_id})"
def __repr__(self):
return self.__str__()
def __lt__(self, other):
return (self.role, self.party_id) < (other.role, other.party_id)
def __eq__(self, other):
return self.party_id == other.party_id and self.role == other.role
def to_pb(self):
from arch.api.proto import federation_pb2
return federation_pb2.Party(partyId=f"{self.party_id}", name=self.role)
| 30.244444
| 79
| 0.683321
| 197
| 1,361
| 4.48731
| 0.477157
| 0.087104
| 0.074661
| 0.050905
| 0.099548
| 0.056561
| 0
| 0
| 0
| 0
| 0
| 0.009381
| 0.216752
| 1,361
| 44
| 80
| 30.931818
| 0.819887
| 0.443791
| 0
| 0
| 0
| 0
| 0.088033
| 0.066025
| 0
| 0
| 0
| 0
| 0
| 1
| 0.411765
| false
| 0
| 0.058824
| 0.294118
| 0.882353
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 1
| 1
| 0
|
0
| 3
|
6a0eabac2607fdcd5104aaa4361b75c94d229375
| 373
|
py
|
Python
|
deep_utils/nlp/utils/utils.py
|
pooya-mohammadi/deep_utils
|
b589d8ab0a8d63f3d3b90c3bc0d4b1b648b8be37
|
[
"MIT"
] | 36
|
2021-11-10T05:17:18.000Z
|
2022-03-27T18:25:10.000Z
|
deep_utils/nlp/utils/utils.py
|
pooya-mohammadi/deep_utils
|
b589d8ab0a8d63f3d3b90c3bc0d4b1b648b8be37
|
[
"MIT"
] | 1
|
2021-12-03T07:07:18.000Z
|
2022-03-08T09:29:03.000Z
|
deep_utils/nlp/utils/utils.py
|
pooya-mohammadi/deep_utils
|
b589d8ab0a8d63f3d3b90c3bc0d4b1b648b8be37
|
[
"MIT"
] | 4
|
2021-11-28T07:39:57.000Z
|
2022-03-30T05:46:10.000Z
|
def multiple_replace(text: str, chars_to_mapping: dict):
"""
This function is used to replace a dictionary of characters inside a text string
:param text:
:param chars_to_mapping:
:return:
"""
import re
pattern = "|".join(map(re.escape, chars_to_mapping.keys()))
return re.sub(pattern, lambda m: chars_to_mapping[m.group()], str(text))
| 31.083333
| 84
| 0.678284
| 54
| 373
| 4.518519
| 0.592593
| 0.114754
| 0.229508
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.201072
| 373
| 11
| 85
| 33.909091
| 0.818792
| 0.340483
| 0
| 0
| 0
| 0
| 0.004587
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.25
| false
| 0
| 0.25
| 0
| 0.75
| 0
| 0
| 0
| 0
| null | 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
6a1517953444573e16ddd717619e49c3ca5152a5
| 70
|
py
|
Python
|
core/github/parsers/__init__.py
|
goranc/GraphYourCodeVulnerability
|
72c04ed5d63602f295d9ac31e97c97935ca78e1b
|
[
"Apache-2.0"
] | null | null | null |
core/github/parsers/__init__.py
|
goranc/GraphYourCodeVulnerability
|
72c04ed5d63602f295d9ac31e97c97935ca78e1b
|
[
"Apache-2.0"
] | 2
|
2021-12-22T11:59:47.000Z
|
2022-01-19T19:28:36.000Z
|
core/github/parsers/__init__.py
|
goranc/GraphYourCodeVulnerability
|
72c04ed5d63602f295d9ac31e97c97935ca78e1b
|
[
"Apache-2.0"
] | 5
|
2021-12-22T11:09:23.000Z
|
2021-12-26T10:18:49.000Z
|
from .python.parser import PythonParser
all_parsers = [PythonParser]
| 17.5
| 39
| 0.814286
| 8
| 70
| 7
| 0.875
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.114286
| 70
| 3
| 40
| 23.333333
| 0.903226
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0
| 0.5
| 0
| 0.5
| 0
| 1
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
|
0
| 3
|
6a20c03889abf01d98da2c14b133084ab0890d44
| 3,324
|
py
|
Python
|
cvxpy/cvxcore/tests/python/364A_scripts/power_lines.py
|
jasondark/cvxpy
|
56aaa01b0e9d98ae5a91a923708129a7b37a6f18
|
[
"ECL-2.0",
"Apache-2.0"
] | 38
|
2015-10-16T16:55:28.000Z
|
2022-02-16T05:06:01.000Z
|
cvxpy/cvxcore/tests/python/364A_scripts/power_lines.py
|
h-vetinari/cvxpy
|
86307f271819bb78fcdf64a9c3a424773e8269fa
|
[
"ECL-2.0",
"Apache-2.0"
] | 28
|
2015-09-16T16:33:23.000Z
|
2021-11-23T07:31:44.000Z
|
cvxpy/cvxcore/tests/python/364A_scripts/power_lines.py
|
h-vetinari/cvxpy
|
86307f271819bb78fcdf64a9c3a424773e8269fa
|
[
"ECL-2.0",
"Apache-2.0"
] | 21
|
2015-09-16T14:56:16.000Z
|
2022-02-16T05:06:03.000Z
|
import numpy as np
from cvxpy import *
import copy
import time
# data for power flow problem
import numpy as np
n = 12 # total number of nodes
m = 18 # number of edges (transmission lines)
k = 4 # number of generators
# transmission line capacities =
TIME = 0
Pmax = np.matrix("""
4.8005,
1.9246,
3.4274,
2.9439,
4.5652,
4.0484,
2.8259,
1.0740,
4.2856,
2.7788,
3.4617,
4.1677,
4.6873,
3.9528,
1.7051,
2.6228,
4.7419,
4.6676,
""")
Gmax = np.matrix("3; 2; 4; 7") # maximum generator power
c = np.matrix("4; 8; 5; 3") # supply generator costs
d = np.matrix("""
1.6154
2.3405
1.0868
1.5293
2.2197
1.0148
1.2083
1.3041
""")# network power demands
# graph incidence matrix
A = np.matrix(""" -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ;
0 0 -1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ;
0 0 0 0 0 0 0 0 0 -1 -1 0 0 0 0 0 0 -1 ;
0 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 -1 0 ;
1 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 ;
0 1 1 0 -1 0 1 -1 0 0 0 0 0 0 0 0 0 0 ;
0 0 0 1 0 0 0 0 -1 1 0 0 0 0 0 0 0 0 ;
0 0 0 0 0 0 0 1 1 0 0 0 -1 0 1 0 0 1 ;
0 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 0 0 ;
0 0 0 0 0 0 0 0 0 0 0 1 1 -1 0 0 0 0 ;
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 ;
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -1 1 0
""")
g = Variable(k)
p = Variable(m)
obj = Minimize(c.T*g)
constraints = [A*p == vstack(-g, d.T), abs(p) <= Pmax.T, 0 <= g, g <= Gmax]
prob = Problem(obj, constraints)
tic = time.time()
val = prob.solve()
toc = time.time()
TIME += toc - tic
ANSWERS.append(val)
pass #print val
pass #print g.value
# N - 1 contingency
g = Variable(k)
flows = []
obj = Minimize(c.T*g)
for i in range(m):
flows.append(Variable(m))
constraints = [g <= Gmax, 0 <= g]
for i in range(m): # N -1 redundancy
constraints.append(A*flows[i] == vstack(-g, d.T))
constraints.append( flows[i][i] == 0 )
constraints.append( abs(flows[i]) <= Pmax.T )
prob = Problem(obj, constraints)
tic = time.time()
val = prob.solve()
toc = time.time()
TIME += toc - tic
ANSWERS.append(val)
pass #print val
pass #print g.value
# the code below is not data for the problem
# it is used only to generate the network graph
# x-y coordinates
# each row is node x-y coordinates
XY = np.matrix("""
1.5 5.2;
4.9 5;
6.9 3.5;
1.9 3.5;
0.2 4.4;
3.2 4.8;
5.9 4.5;
3.9 3.6;
5.9 2.5;
3.9 3;
1.4 2.5;
0 3
""");
# node adjacency matrix
Ad = -A*A.T
Ad = Ad - np.diag(np.diag(Ad))
epsx = 0.05; epsy = 0.15; # text placing offset
# plotting
import matplotlib.pyplot as plt
for i in range(12): #plot edges
for j in range(i):
if Ad[i,j] == 1:
pass #plt.plot((XY[i,0], XY[j,0]), (XY[i,1], XY[j,1]), 'k-')
for j in range(k): #plot nodes
pass #plt.plot(XY[j,0],XY[j,1],'rs', markersize=12)
pass #plt.text(XY[j,0]-epsx,XY[j,1]+epsy,str(j+1))
for j in range(k,n):
pass #plt.plot(XY[j,0],XY[j,1],'ko')
pass #plt.axis('off')
pass #plt.savefig('pwr_net.eps')
if __name__ == '__main__':
pass #plt.show()
| 23.083333
| 75
| 0.513538
| 682
| 3,324
| 2.489736
| 0.219941
| 0.183746
| 0.245583
| 0.289753
| 0.326855
| 0.296231
| 0.280919
| 0.28033
| 0.278563
| 0.256184
| 0
| 0.197525
| 0.343562
| 3,324
| 144
| 76
| 23.083333
| 0.58066
| 0.22503
| 0
| 0.295652
| 0
| 0.043478
| 0.491552
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| false
| 0.095652
| 0.052174
| 0
| 0.052174
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
|
0
| 3
|
6a2c58ba82079e0bdc04e7b2c1c567a97cd9075d
| 451
|
py
|
Python
|
Message/Message.py
|
gauravyeole/KVstoreDB
|
1c7c83b158e95daec998fba62a89fa1211a05089
|
[
"MIT"
] | 1
|
2019-10-01T12:22:38.000Z
|
2019-10-01T12:22:38.000Z
|
Message/Message.py
|
gauravyeole/KVstoreDB
|
1c7c83b158e95daec998fba62a89fa1211a05089
|
[
"MIT"
] | null | null | null |
Message/Message.py
|
gauravyeole/KVstoreDB
|
1c7c83b158e95daec998fba62a89fa1211a05089
|
[
"MIT"
] | null | null | null |
# Message class Implementation
# @author: Gaurav Yeole <[email protected]>
class Message:
class Request:
def __init__(self, action="", data=None):
self.action = action
self.data = data
class Rsponse:
def __init__(self):
self.status = False
self.data = None
def __init__(self):
pass
def set_request(self):
pass
def response(self):
pass
| 20.5
| 49
| 0.569845
| 49
| 451
| 4.979592
| 0.44898
| 0.086066
| 0.135246
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.341463
| 451
| 22
| 50
| 20.5
| 0.821549
| 0.16408
| 0
| 0.333333
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.333333
| false
| 0.2
| 0
| 0
| 0.533333
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 3
|
6a2db7981b57ab2addb91eebdfdaf255263aca79
| 230
|
py
|
Python
|
wpt/websockets/websock_handlers/open_delay_wsh.py
|
gsnedders/presto-testo
|
a0acfbef13a3f8cae67cc7145216d31b67aa8eb4
|
[
"BSD-3-Clause"
] | null | null | null |
wpt/websockets/websock_handlers/open_delay_wsh.py
|
gsnedders/presto-testo
|
a0acfbef13a3f8cae67cc7145216d31b67aa8eb4
|
[
"BSD-3-Clause"
] | null | null | null |
wpt/websockets/websock_handlers/open_delay_wsh.py
|
gsnedders/presto-testo
|
a0acfbef13a3f8cae67cc7145216d31b67aa8eb4
|
[
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/python
from mod_pywebsocket import msgutil
import time
def web_socket_do_extra_handshake(request):
pass # Always accept.
def web_socket_transfer_data(request):
time.sleep(3)
msgutil.send_message(request, "line")
| 19.166667
| 43
| 0.795652
| 34
| 230
| 5.117647
| 0.764706
| 0.068966
| 0.137931
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.004878
| 0.108696
| 230
| 11
| 44
| 20.909091
| 0.843902
| 0.134783
| 0
| 0
| 0
| 0
| 0.020305
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.285714
| false
| 0.142857
| 0.285714
| 0
| 0.571429
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 1
| 0
| 1
| 0
| 0
| 1
| 0
|
0
| 3
|
6a36b0c35f3000da705fd087f744d451ba48d8fd
| 531
|
py
|
Python
|
Udemy/REST-Django-VueJS/C3-practice/03-demo/job_board/jobs/models.py
|
runzezhang/MOOCs
|
8df8c7adc5af3d7b085be01ae9b6963fe33acd68
|
[
"Apache-2.0"
] | 3
|
2019-04-05T18:59:53.000Z
|
2020-09-24T09:05:46.000Z
|
Udemy/REST-Django-VueJS/C3-practice/03-demo/job_board/jobs/models.py
|
runzezhang/MOOCs
|
8df8c7adc5af3d7b085be01ae9b6963fe33acd68
|
[
"Apache-2.0"
] | null | null | null |
Udemy/REST-Django-VueJS/C3-practice/03-demo/job_board/jobs/models.py
|
runzezhang/MOOCs
|
8df8c7adc5af3d7b085be01ae9b6963fe33acd68
|
[
"Apache-2.0"
] | 1
|
2019-02-10T13:35:36.000Z
|
2019-02-10T13:35:36.000Z
|
from django.db import models
class JobOffer(models.Model):
company_name = models.CharField(max_length=50)
company_email = models.EmailField()
job_title = models.CharField(max_length=60)
job_description = models.TextField()
salary = models.PositiveIntegerField()
city = models.CharField(max_length=35)
state = models.CharField(max_length=35)
created_at = models.DateField(auto_now_add=True)
available = models.BooleanField(default=True)
def __str__(self):
return self.company_name
| 31.235294
| 52
| 0.73823
| 66
| 531
| 5.69697
| 0.606061
| 0.159574
| 0.191489
| 0.255319
| 0.138298
| 0
| 0
| 0
| 0
| 0
| 0
| 0.018059
| 0.165725
| 531
| 16
| 53
| 33.1875
| 0.8307
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0.076923
| false
| 0
| 0.076923
| 0.076923
| 1
| 0
| 0
| 0
| 0
| null | 0
| 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
|
0
| 3
|
6a49d502d09956cefd00c54538889163bfebf8f9
| 1,157
|
py
|
Python
|
dltb/thirdparty/datasource/__init__.py
|
CogSciUOS/DeepLearningToolbox
|
bf07578b9486d8c48e25df357bc4b9963b513b46
|
[
"MIT"
] | 2
|
2019-09-01T01:38:59.000Z
|
2020-02-13T19:25:51.000Z
|
dltb/thirdparty/datasource/__init__.py
|
CogSciUOS/DeepLearningToolbox
|
bf07578b9486d8c48e25df357bc4b9963b513b46
|
[
"MIT"
] | null | null | null |
dltb/thirdparty/datasource/__init__.py
|
CogSciUOS/DeepLearningToolbox
|
bf07578b9486d8c48e25df357bc4b9963b513b46
|
[
"MIT"
] | null | null | null |
"""Predefined Datasources.
"""
# toolbox imports
from ...datasource import Datasource
Datasource.register_instance('imagenet-val', __name__ + '.imagenet',
'ImageNet', section='val') # section='train'
Datasource.register_instance('dogsandcats', __name__ + '.dogsandcats',
'DogsAndCats')
Datasource.register_instance('widerface', __name__ + '.widerface', 'WiderFace')
Datasource.register_instance('fgnet', __name__ + '.fgnet', 'FGNet')
Datasource.register_instance('Helen', __name__ + '.helen', 'Helen')
Datasource.register_instance('lfw', __name__ + '.lfw', 'LabeledFacesInTheWild')
Datasource.register_instance('ms-celeb-1m', __name__ + '.face', 'MSCeleb1M')
Datasource.register_instance('5celeb', __name__ + '.fivecelebface',
'FiveCelebFace')
Datasource.register_instance('ffhq', __name__ + '.ffhq', 'FFHQ')
Datasource.register_instance('celeba', __name__ + '.celeba', 'CelebA')
Datasource.register_instance('celeba-aligned', __name__ + '.celeba',
'CelebA', aligned=True)
Datasource.register_class('WiderFace', __name__ + '.widerface')
| 48.208333
| 79
| 0.679343
| 101
| 1,157
| 7.188119
| 0.316832
| 0.297521
| 0.393939
| 0.088154
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0.003112
| 0.166811
| 1,157
| 23
| 80
| 50.304348
| 0.75
| 0.048401
| 0
| 0
| 0
| 0
| 0.265325
| 0.019213
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| true
| 0
| 0.058824
| 0
| 0.058824
| 0
| 0
| 0
| 0
| null | 1
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
e002150863388c3c73e7c985abca9ac6c4427a70
| 2,587
|
bzl
|
Python
|
third_party/org_specs2.bzl
|
wix/wix-oss-infra
|
b57ac2f0f66487cfdd08293a8fa389efe3d42c43
|
[
"MIT"
] | 3
|
2020-01-14T12:57:31.000Z
|
2021-06-06T20:47:57.000Z
|
third_party/org_specs2.bzl
|
wix/wix-oss-infra
|
b57ac2f0f66487cfdd08293a8fa389efe3d42c43
|
[
"MIT"
] | 20
|
2020-04-02T13:08:43.000Z
|
2020-11-05T11:27:40.000Z
|
third_party/org_specs2.bzl
|
wix/wix-oss-infra
|
b57ac2f0f66487cfdd08293a8fa389efe3d42c43
|
[
"MIT"
] | 1
|
2021-04-02T09:32:35.000Z
|
2021-04-02T09:32:35.000Z
|
load("@wix_oss_infra//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "org_specs2_specs2_fp_2_12",
artifact = "org.specs2:specs2-fp_2.12:4.8.3",
artifact_sha256 = "777962ca58054a9ea86e294e025453ecf394c60084c28bd61956a00d16be31a7",
srcjar_sha256 = "6b8bd1e7210754b768b68610709271c0dac29447936a976a2a9881389e6404ca",
deps = [
"@org_scala_lang_scala_library"
],
)
import_external(
name = "org_specs2_specs2_common_2_12",
artifact = "org.specs2:specs2-common_2.12:4.8.3",
artifact_sha256 = "3b08fecb9e21d3903e48b62cd95c19ea9253d466e03fd4cf9dc9227e7c368708",
srcjar_sha256 = "b2f148c75d3939b3cd0d58afddd74a8ce03077bb3ccdc93dae55bd9c3993e9c3",
deps = [
"@org_scala_lang_modules_scala_parser_combinators_2_12",
"@org_scala_lang_modules_scala_xml_2_12",
"@org_scala_lang_scala_library",
"@org_scala_lang_scala_reflect",
"@org_specs2_specs2_fp_2_12"
],
)
import_external(
name = "org_specs2_specs2_matcher_2_12",
artifact = "org.specs2:specs2-matcher_2.12:4.8.3",
artifact_sha256 = "aadf27b6d015572b2e3842627c09bf0797153dbb329262ea3bcbbce129d51ad8",
srcjar_sha256 = "01251acc28219aa17aabcb9a26a84e1871aa64980d335cd8f83c2bcea6f4f1be",
deps = [
"@org_scala_lang_scala_library",
"@org_specs2_specs2_common_2_12"
],
)
import_external(
name = "org_specs2_specs2_core_2_12",
artifact = "org.specs2:specs2-core_2.12:4.8.3",
artifact_sha256 = "f73f32156a711a4e83e696dc83e269c5a165d62cc3dd7c652617cb03d140d063",
srcjar_sha256 = "0e3cebfc7410051b70e627e35f13978add3d061b8f1233741f9b397638f193e9",
deps = [
"@org_scala_lang_scala_library",
"@org_scala_sbt_test_interface",
"@org_specs2_specs2_common_2_12",
"@org_specs2_specs2_matcher_2_12"
],
)
import_external(
name = "org_specs2_specs2_junit_2_12",
artifact = "org.specs2:specs2-junit_2.12:4.8.3",
artifact_sha256 = "5d7ad2c0b0bc142ea064edb7a1ea75ab7b17ad37e1a621ac7e578823845098e8",
srcjar_sha256 = "84edd1cd6291f6686638225fcbaff970ae36da006efabf2228255c2127b2290c",
deps = [
"@junit_junit",
"@org_scala_lang_scala_library",
"@org_scala_sbt_test_interface",
"@org_specs2_specs2_core_2_12"
],
)
| 37.492754
| 102
| 0.68535
| 236
| 2,587
| 6.974576
| 0.207627
| 0.030984
| 0.136695
| 0.061968
| 0.486027
| 0.45322
| 0.243621
| 0.142163
| 0.076549
| 0.076549
| 0
| 0.267436
| 0.22961
| 2,587
| 68
| 103
| 38.044118
| 0.558455
| 0
| 0
| 0.362069
| 0
| 0
| 0.579822
| 0.575184
| 0
| 0
| 0
| 0
| 0
| 1
| 0.017241
| true
| 0
| 0.103448
| 0
| 0.12069
| 0
| 0
| 0
| 0
| null | 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 0
| 1
| null | 0
| 0
| 0
| 0
| 0
| 0
| 1
| 0
| 0
| 0
| 0
| 0
|
0
| 3
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.