repo_name
stringlengths 7
94
| repo_path
stringlengths 4
237
| repo_head_hexsha
stringlengths 40
40
| content
stringlengths 10
680k
| apis
stringlengths 2
840k
|
---|---|---|---|---|
aisk/pyston | test/cpython/test_base64.py | ac69cfef0621dbc8901175e84fa2b5cb5781a646 | import unittest
from test import test_support
import base64
class LegacyBase64TestCase(unittest.TestCase):
def test_encodestring(self):
eq = self.assertEqual
eq(base64.encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n")
eq(base64.encodestring("a"), "YQ==\n")
eq(base64.encodestring("ab"), "YWI=\n")
eq(base64.encodestring("abc"), "YWJj\n")
eq(base64.encodestring(""), "")
eq(base64.encodestring("abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#0^&*();:<>,. []{}"),
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT"
"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n")
# Non-bytes
eq(base64.encodestring(bytearray('abc')), 'YWJj\n')
def test_decodestring(self):
eq = self.assertEqual
eq(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n"), "www.python.org")
eq(base64.decodestring("YQ==\n"), "a")
eq(base64.decodestring("YWI=\n"), "ab")
eq(base64.decodestring("YWJj\n"), "abc")
eq(base64.decodestring("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT"
"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"),
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#0^&*();:<>,. []{}")
eq(base64.decodestring(''), '')
# Non-bytes
eq(base64.decodestring(bytearray("YWJj\n")), "abc")
def test_encode(self):
eq = self.assertEqual
from cStringIO import StringIO
infp = StringIO('abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
'0123456789!@#0^&*();:<>,. []{}')
outfp = StringIO()
base64.encode(infp, outfp)
eq(outfp.getvalue(),
'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE'
'RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT'
'Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n')
def test_decode(self):
from cStringIO import StringIO
infp = StringIO('d3d3LnB5dGhvbi5vcmc=')
outfp = StringIO()
base64.decode(infp, outfp)
self.assertEqual(outfp.getvalue(), 'www.python.org')
class BaseXYTestCase(unittest.TestCase):
def test_b64encode(self):
eq = self.assertEqual
# Test default alphabet
eq(base64.b64encode("www.python.org"), "d3d3LnB5dGhvbi5vcmc=")
eq(base64.b64encode('\x00'), 'AA==')
eq(base64.b64encode("a"), "YQ==")
eq(base64.b64encode("ab"), "YWI=")
eq(base64.b64encode("abc"), "YWJj")
eq(base64.b64encode(""), "")
eq(base64.b64encode("abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#0^&*();:<>,. []{}"),
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NT"
"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==")
# Test with arbitrary alternative characters
eq(base64.b64encode('\xd3V\xbeo\xf7\x1d', altchars='*$'), '01a*b$cd')
# Non-bytes
eq(base64.b64encode(bytearray('abcd')), 'YWJjZA==')
self.assertRaises(TypeError, base64.b64encode,
'\xd3V\xbeo\xf7\x1d', altchars=bytearray('*$'))
# Test standard alphabet
eq(base64.standard_b64encode("www.python.org"), "d3d3LnB5dGhvbi5vcmc=")
eq(base64.standard_b64encode("a"), "YQ==")
eq(base64.standard_b64encode("ab"), "YWI=")
eq(base64.standard_b64encode("abc"), "YWJj")
eq(base64.standard_b64encode(""), "")
eq(base64.standard_b64encode("abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#0^&*();:<>,. []{}"),
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NT"
"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==")
# Non-bytes
eq(base64.standard_b64encode(bytearray('abcd')), 'YWJjZA==')
# Test with 'URL safe' alternative characters
eq(base64.urlsafe_b64encode('\xd3V\xbeo\xf7\x1d'), '01a-b_cd')
# Non-bytes
eq(base64.urlsafe_b64encode(bytearray('\xd3V\xbeo\xf7\x1d')), '01a-b_cd')
def test_b64decode(self):
eq = self.assertEqual
eq(base64.b64decode("d3d3LnB5dGhvbi5vcmc="), "www.python.org")
eq(base64.b64decode('AA=='), '\x00')
eq(base64.b64decode("YQ=="), "a")
eq(base64.b64decode("YWI="), "ab")
eq(base64.b64decode("YWJj"), "abc")
eq(base64.b64decode("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT"
"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="),
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#0^&*();:<>,. []{}")
eq(base64.b64decode(''), '')
# Test with arbitrary alternative characters
eq(base64.b64decode('01a*b$cd', altchars='*$'), '\xd3V\xbeo\xf7\x1d')
# Non-bytes
eq(base64.b64decode(bytearray("YWJj")), "abc")
# Test standard alphabet
eq(base64.standard_b64decode("d3d3LnB5dGhvbi5vcmc="), "www.python.org")
eq(base64.standard_b64decode("YQ=="), "a")
eq(base64.standard_b64decode("YWI="), "ab")
eq(base64.standard_b64decode("YWJj"), "abc")
eq(base64.standard_b64decode(""), "")
eq(base64.standard_b64decode("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NT"
"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="),
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789!@#0^&*();:<>,. []{}")
# Non-bytes
eq(base64.standard_b64decode(bytearray("YWJj")), "abc")
# Test with 'URL safe' alternative characters
eq(base64.urlsafe_b64decode('01a-b_cd'), '\xd3V\xbeo\xf7\x1d')
# Non-bytes
eq(base64.urlsafe_b64decode(bytearray('01a-b_cd')), '\xd3V\xbeo\xf7\x1d')
def test_b64decode_error(self):
self.assertRaises(TypeError, base64.b64decode, 'abc')
def test_b32encode(self):
eq = self.assertEqual
eq(base64.b32encode(''), '')
eq(base64.b32encode('\x00'), 'AA======')
eq(base64.b32encode('a'), 'ME======')
eq(base64.b32encode('ab'), 'MFRA====')
eq(base64.b32encode('abc'), 'MFRGG===')
eq(base64.b32encode('abcd'), 'MFRGGZA=')
eq(base64.b32encode('abcde'), 'MFRGGZDF')
# Non-bytes
eq(base64.b32encode(bytearray('abcd')), 'MFRGGZA=')
def test_b32decode(self):
eq = self.assertEqual
eq(base64.b32decode(''), '')
eq(base64.b32decode('AA======'), '\x00')
eq(base64.b32decode('ME======'), 'a')
eq(base64.b32decode('MFRA===='), 'ab')
eq(base64.b32decode('MFRGG==='), 'abc')
eq(base64.b32decode('MFRGGZA='), 'abcd')
eq(base64.b32decode('MFRGGZDF'), 'abcde')
# Non-bytes
self.assertRaises(TypeError, base64.b32decode, bytearray('MFRGG==='))
def test_b32decode_casefold(self):
eq = self.assertEqual
eq(base64.b32decode('', True), '')
eq(base64.b32decode('ME======', True), 'a')
eq(base64.b32decode('MFRA====', True), 'ab')
eq(base64.b32decode('MFRGG===', True), 'abc')
eq(base64.b32decode('MFRGGZA=', True), 'abcd')
eq(base64.b32decode('MFRGGZDF', True), 'abcde')
# Lower cases
eq(base64.b32decode('me======', True), 'a')
eq(base64.b32decode('mfra====', True), 'ab')
eq(base64.b32decode('mfrgg===', True), 'abc')
eq(base64.b32decode('mfrggza=', True), 'abcd')
eq(base64.b32decode('mfrggzdf', True), 'abcde')
# Expected exceptions
self.assertRaises(TypeError, base64.b32decode, 'me======')
# Mapping zero and one
eq(base64.b32decode('MLO23456'), 'b\xdd\xad\xf3\xbe')
eq(base64.b32decode('M1023456', map01='L'), 'b\xdd\xad\xf3\xbe')
eq(base64.b32decode('M1023456', map01='I'), 'b\x1d\xad\xf3\xbe')
def test_b32decode_error(self):
self.assertRaises(TypeError, base64.b32decode, 'abc')
self.assertRaises(TypeError, base64.b32decode, 'ABCDEF==')
def test_b16encode(self):
eq = self.assertEqual
eq(base64.b16encode('\x01\x02\xab\xcd\xef'), '0102ABCDEF')
eq(base64.b16encode('\x00'), '00')
# Non-bytes
eq(base64.b16encode(bytearray('\x01\x02\xab\xcd\xef')), '0102ABCDEF')
def test_b16decode(self):
eq = self.assertEqual
eq(base64.b16decode('0102ABCDEF'), '\x01\x02\xab\xcd\xef')
eq(base64.b16decode('00'), '\x00')
# Lower case is not allowed without a flag
self.assertRaises(TypeError, base64.b16decode, '0102abcdef')
# Case fold
eq(base64.b16decode('0102abcdef', True), '\x01\x02\xab\xcd\xef')
# Non-bytes
eq(base64.b16decode(bytearray("0102ABCDEF")), '\x01\x02\xab\xcd\xef')
def test_main():
test_support.run_unittest(__name__)
if __name__ == '__main__':
test_main()
| [((213, 4, 213, 39), 'test.test_support.run_unittest', 'test_support.run_unittest', ({(213, 30, 213, 38): '__name__'}, {}), '(__name__)', False, 'from test import test_support\n'), ((43, 15, 45, 57), 'cStringIO.StringIO', 'StringIO', ({(43, 24, 45, 56): '"""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}"""'}, {}), "(\n 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}'\n )", False, 'from cStringIO import StringIO\n'), ((46, 16, 46, 26), 'cStringIO.StringIO', 'StringIO', ({}, {}), '()', False, 'from cStringIO import StringIO\n'), ((47, 8, 47, 34), 'base64.encode', 'base64.encode', ({(47, 22, 47, 26): 'infp', (47, 28, 47, 33): 'outfp'}, {}), '(infp, outfp)', False, 'import base64\n'), ((55, 15, 55, 47), 'cStringIO.StringIO', 'StringIO', ({(55, 24, 55, 46): '"""d3d3LnB5dGhvbi5vcmc="""'}, {}), "('d3d3LnB5dGhvbi5vcmc=')", False, 'from cStringIO import StringIO\n'), ((56, 16, 56, 26), 'cStringIO.StringIO', 'StringIO', ({}, {}), '()', False, 'from cStringIO import StringIO\n'), ((57, 8, 57, 34), 'base64.decode', 'base64.decode', ({(57, 22, 57, 26): 'infp', (57, 28, 57, 33): 'outfp'}, {}), '(infp, outfp)', False, 'import base64\n'), ((10, 11, 10, 48), 'base64.encodestring', 'base64.encodestring', ({(10, 31, 10, 47): '"""www.python.org"""'}, {}), "('www.python.org')", False, 'import base64\n'), ((11, 11, 11, 35), 'base64.encodestring', 'base64.encodestring', ({(11, 31, 11, 34): '"""a"""'}, {}), "('a')", False, 'import base64\n'), ((12, 11, 12, 36), 'base64.encodestring', 'base64.encodestring', ({(12, 31, 12, 35): '"""ab"""'}, {}), "('ab')", False, 'import base64\n'), ((13, 11, 13, 37), 'base64.encodestring', 'base64.encodestring', ({(13, 31, 13, 36): '"""abc"""'}, {}), "('abc')", False, 'import base64\n'), ((14, 11, 14, 34), 'base64.encodestring', 'base64.encodestring', ({(14, 31, 14, 33): '""""""'}, {}), "('')", False, 'import base64\n'), ((15, 11, 17, 64), 'base64.encodestring', 'base64.encodestring', ({(15, 31, 17, 63): '"""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}"""'}, {}), "(\n 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}'\n )", False, 'import base64\n'), ((26, 11, 26, 56), 'base64.decodestring', 'base64.decodestring', ({(26, 31, 26, 55): '"""d3d3LnB5dGhvbi5vcmc=\n"""'}, {}), "('d3d3LnB5dGhvbi5vcmc=\\n')", False, 'import base64\n'), ((27, 11, 27, 40), 'base64.decodestring', 'base64.decodestring', ({(27, 31, 27, 39): '"""YQ==\n"""'}, {}), "('YQ==\\n')", False, 'import base64\n'), ((28, 11, 28, 40), 'base64.decodestring', 'base64.decodestring', ({(28, 31, 28, 39): '"""YWI=\n"""'}, {}), "('YWI=\\n')", False, 'import base64\n'), ((29, 11, 29, 40), 'base64.decodestring', 'base64.decodestring', ({(29, 31, 29, 39): '"""YWJj\n"""'}, {}), "('YWJj\\n')", False, 'import base64\n'), ((30, 11, 32, 70), 'base64.decodestring', 'base64.decodestring', ({(30, 31, 32, 69): '"""YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"""'}, {}), '(\n """YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"""\n )', False, 'import base64\n'), ((36, 11, 36, 34), 'base64.decodestring', 'base64.decodestring', ({(36, 31, 36, 33): '""""""'}, {}), "('')", False, 'import base64\n'), ((66, 11, 66, 45), 'base64.b64encode', 'base64.b64encode', ({(66, 28, 66, 44): '"""www.python.org"""'}, {}), "('www.python.org')", False, 'import base64\n'), ((67, 11, 67, 35), 'base64.b64encode', 'base64.b64encode', ({(67, 28, 67, 34): "'\\x00'"}, {}), "('\\x00')", False, 'import base64\n'), ((68, 11, 68, 32), 'base64.b64encode', 'base64.b64encode', ({(68, 28, 68, 31): '"""a"""'}, {}), "('a')", False, 'import base64\n'), ((69, 11, 69, 33), 'base64.b64encode', 'base64.b64encode', ({(69, 28, 69, 32): '"""ab"""'}, {}), "('ab')", False, 'import base64\n'), ((70, 11, 70, 34), 'base64.b64encode', 'base64.b64encode', ({(70, 28, 70, 33): '"""abc"""'}, {}), "('abc')", False, 'import base64\n'), ((71, 11, 71, 31), 'base64.b64encode', 'base64.b64encode', ({(71, 28, 71, 30): '""""""'}, {}), "('')", False, 'import base64\n'), ((72, 11, 74, 61), 'base64.b64encode', 'base64.b64encode', ({(72, 28, 74, 60): '"""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}"""'}, {}), "(\n 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}'\n )", False, 'import base64\n'), ((79, 11, 79, 64), 'base64.b64encode', 'base64.b64encode', (), '', False, 'import base64\n'), ((85, 11, 85, 54), 'base64.standard_b64encode', 'base64.standard_b64encode', ({(85, 37, 85, 53): '"""www.python.org"""'}, {}), "('www.python.org')", False, 'import base64\n'), ((86, 11, 86, 41), 'base64.standard_b64encode', 'base64.standard_b64encode', ({(86, 37, 86, 40): '"""a"""'}, {}), "('a')", False, 'import base64\n'), ((87, 11, 87, 42), 'base64.standard_b64encode', 'base64.standard_b64encode', ({(87, 37, 87, 41): '"""ab"""'}, {}), "('ab')", False, 'import base64\n'), ((88, 11, 88, 43), 'base64.standard_b64encode', 'base64.standard_b64encode', ({(88, 37, 88, 42): '"""abc"""'}, {}), "('abc')", False, 'import base64\n'), ((89, 11, 89, 40), 'base64.standard_b64encode', 'base64.standard_b64encode', ({(89, 37, 89, 39): '""""""'}, {}), "('')", False, 'import base64\n'), ((90, 11, 92, 70), 'base64.standard_b64encode', 'base64.standard_b64encode', ({(90, 37, 92, 69): '"""abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}"""'}, {}), "(\n 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}'\n )", False, 'import base64\n'), ((99, 11, 99, 57), 'base64.urlsafe_b64encode', 'base64.urlsafe_b64encode', ({(99, 36, 99, 56): '"""ÓV¾o÷\x1d"""'}, {}), "('ÓV¾o÷\\x1d')", False, 'import base64\n'), ((105, 11, 105, 51), 'base64.b64decode', 'base64.b64decode', ({(105, 28, 105, 50): '"""d3d3LnB5dGhvbi5vcmc="""'}, {}), "('d3d3LnB5dGhvbi5vcmc=')", False, 'import base64\n'), ((106, 11, 106, 35), 'base64.b64decode', 'base64.b64decode', ({(106, 28, 106, 34): '"""AA=="""'}, {}), "('AA==')", False, 'import base64\n'), ((107, 11, 107, 35), 'base64.b64decode', 'base64.b64decode', ({(107, 28, 107, 34): '"""YQ=="""'}, {}), "('YQ==')", False, 'import base64\n'), ((108, 11, 108, 35), 'base64.b64decode', 'base64.b64decode', ({(108, 28, 108, 34): '"""YWI="""'}, {}), "('YWI=')", False, 'import base64\n'), ((109, 11, 109, 35), 'base64.b64decode', 'base64.b64decode', ({(109, 28, 109, 34): '"""YWJj"""'}, {}), "('YWJj')", False, 'import base64\n'), ((110, 11, 112, 65), 'base64.b64decode', 'base64.b64decode', ({(110, 28, 112, 64): '"""YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="""'}, {}), '(\n """YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="""\n )', False, 'import base64\n'), ((116, 11, 116, 31), 'base64.b64decode', 'base64.b64decode', ({(116, 28, 116, 30): '""""""'}, {}), "('')", False, 'import base64\n'), ((118, 11, 118, 54), 'base64.b64decode', 'base64.b64decode', (), '', False, 'import base64\n'), ((122, 11, 122, 60), 'base64.standard_b64decode', 'base64.standard_b64decode', ({(122, 37, 122, 59): '"""d3d3LnB5dGhvbi5vcmc="""'}, {}), "('d3d3LnB5dGhvbi5vcmc=')", False, 'import base64\n'), ((123, 11, 123, 44), 'base64.standard_b64decode', 'base64.standard_b64decode', ({(123, 37, 123, 43): '"""YQ=="""'}, {}), "('YQ==')", False, 'import base64\n'), ((124, 11, 124, 44), 'base64.standard_b64decode', 'base64.standard_b64decode', ({(124, 37, 124, 43): '"""YWI="""'}, {}), "('YWI=')", False, 'import base64\n'), ((125, 11, 125, 44), 'base64.standard_b64decode', 'base64.standard_b64decode', ({(125, 37, 125, 43): '"""YWJj"""'}, {}), "('YWJj')", False, 'import base64\n'), ((126, 11, 126, 40), 'base64.standard_b64decode', 'base64.standard_b64decode', ({(126, 37, 126, 39): '""""""'}, {}), "('')", False, 'import base64\n'), ((127, 11, 129, 74), 'base64.standard_b64decode', 'base64.standard_b64decode', ({(127, 37, 129, 73): '"""YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=="""'}, {}), "(\n 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ=='\n )", False, 'import base64\n'), ((136, 11, 136, 47), 'base64.urlsafe_b64decode', 'base64.urlsafe_b64decode', ({(136, 36, 136, 46): '"""01a-b_cd"""'}, {}), "('01a-b_cd')", False, 'import base64\n'), ((145, 11, 145, 31), 'base64.b32encode', 'base64.b32encode', ({(145, 28, 145, 30): '""""""'}, {}), "('')", False, 'import base64\n'), ((146, 11, 146, 35), 'base64.b32encode', 'base64.b32encode', ({(146, 28, 146, 34): "'\\x00'"}, {}), "('\\x00')", False, 'import base64\n'), ((147, 11, 147, 32), 'base64.b32encode', 'base64.b32encode', ({(147, 28, 147, 31): '"""a"""'}, {}), "('a')", False, 'import base64\n'), ((148, 11, 148, 33), 'base64.b32encode', 'base64.b32encode', ({(148, 28, 148, 32): '"""ab"""'}, {}), "('ab')", False, 'import base64\n'), ((149, 11, 149, 34), 'base64.b32encode', 'base64.b32encode', ({(149, 28, 149, 33): '"""abc"""'}, {}), "('abc')", False, 'import base64\n'), ((150, 11, 150, 35), 'base64.b32encode', 'base64.b32encode', ({(150, 28, 150, 34): '"""abcd"""'}, {}), "('abcd')", False, 'import base64\n'), ((151, 11, 151, 36), 'base64.b32encode', 'base64.b32encode', ({(151, 28, 151, 35): '"""abcde"""'}, {}), "('abcde')", False, 'import base64\n'), ((157, 11, 157, 31), 'base64.b32decode', 'base64.b32decode', ({(157, 28, 157, 30): '""""""'}, {}), "('')", False, 'import base64\n'), ((158, 11, 158, 39), 'base64.b32decode', 'base64.b32decode', ({(158, 28, 158, 38): '"""AA======"""'}, {}), "('AA======')", False, 'import base64\n'), ((159, 11, 159, 39), 'base64.b32decode', 'base64.b32decode', ({(159, 28, 159, 38): '"""ME======"""'}, {}), "('ME======')", False, 'import base64\n'), ((160, 11, 160, 39), 'base64.b32decode', 'base64.b32decode', ({(160, 28, 160, 38): '"""MFRA===="""'}, {}), "('MFRA====')", False, 'import base64\n'), ((161, 11, 161, 39), 'base64.b32decode', 'base64.b32decode', ({(161, 28, 161, 38): '"""MFRGG==="""'}, {}), "('MFRGG===')", False, 'import base64\n'), ((162, 11, 162, 39), 'base64.b32decode', 'base64.b32decode', ({(162, 28, 162, 38): '"""MFRGGZA="""'}, {}), "('MFRGGZA=')", False, 'import base64\n'), ((163, 11, 163, 39), 'base64.b32decode', 'base64.b32decode', ({(163, 28, 163, 38): '"""MFRGGZDF"""'}, {}), "('MFRGGZDF')", False, 'import base64\n'), ((169, 11, 169, 37), 'base64.b32decode', 'base64.b32decode', ({(169, 28, 169, 30): '""""""', (169, 32, 169, 36): '(True)'}, {}), "('', True)", False, 'import base64\n'), ((170, 11, 170, 45), 'base64.b32decode', 'base64.b32decode', ({(170, 28, 170, 38): '"""ME======"""', (170, 40, 170, 44): '(True)'}, {}), "('ME======', True)", False, 'import base64\n'), ((171, 11, 171, 45), 'base64.b32decode', 'base64.b32decode', ({(171, 28, 171, 38): '"""MFRA===="""', (171, 40, 171, 44): '(True)'}, {}), "('MFRA====', True)", False, 'import base64\n'), ((172, 11, 172, 45), 'base64.b32decode', 'base64.b32decode', ({(172, 28, 172, 38): '"""MFRGG==="""', (172, 40, 172, 44): '(True)'}, {}), "('MFRGG===', True)", False, 'import base64\n'), ((173, 11, 173, 45), 'base64.b32decode', 'base64.b32decode', ({(173, 28, 173, 38): '"""MFRGGZA="""', (173, 40, 173, 44): '(True)'}, {}), "('MFRGGZA=', True)", False, 'import base64\n'), ((174, 11, 174, 45), 'base64.b32decode', 'base64.b32decode', ({(174, 28, 174, 38): '"""MFRGGZDF"""', (174, 40, 174, 44): '(True)'}, {}), "('MFRGGZDF', True)", False, 'import base64\n'), ((176, 11, 176, 45), 'base64.b32decode', 'base64.b32decode', ({(176, 28, 176, 38): '"""me======"""', (176, 40, 176, 44): '(True)'}, {}), "('me======', True)", False, 'import base64\n'), ((177, 11, 177, 45), 'base64.b32decode', 'base64.b32decode', ({(177, 28, 177, 38): '"""mfra===="""', (177, 40, 177, 44): '(True)'}, {}), "('mfra====', True)", False, 'import base64\n'), ((178, 11, 178, 45), 'base64.b32decode', 'base64.b32decode', ({(178, 28, 178, 38): '"""mfrgg==="""', (178, 40, 178, 44): '(True)'}, {}), "('mfrgg===', True)", False, 'import base64\n'), ((179, 11, 179, 45), 'base64.b32decode', 'base64.b32decode', ({(179, 28, 179, 38): '"""mfrggza="""', (179, 40, 179, 44): '(True)'}, {}), "('mfrggza=', True)", False, 'import base64\n'), ((180, 11, 180, 45), 'base64.b32decode', 'base64.b32decode', ({(180, 28, 180, 38): '"""mfrggzdf"""', (180, 40, 180, 44): '(True)'}, {}), "('mfrggzdf', True)", False, 'import base64\n'), ((184, 11, 184, 39), 'base64.b32decode', 'base64.b32decode', ({(184, 28, 184, 38): '"""MLO23456"""'}, {}), "('MLO23456')", False, 'import base64\n'), ((185, 11, 185, 50), 'base64.b32decode', 'base64.b32decode', (), '', False, 'import base64\n'), ((186, 11, 186, 50), 'base64.b32decode', 'base64.b32decode', (), '', False, 'import base64\n'), ((194, 11, 194, 51), 'base64.b16encode', 'base64.b16encode', ({(194, 28, 194, 50): '"""\x01\x02«Íï"""'}, {}), "('\\x01\\x02«Íï')", False, 'import base64\n'), ((195, 11, 195, 35), 'base64.b16encode', 'base64.b16encode', ({(195, 28, 195, 34): "'\\x00'"}, {}), "('\\x00')", False, 'import base64\n'), ((201, 11, 201, 41), 'base64.b16decode', 'base64.b16decode', ({(201, 28, 201, 40): '"""0102ABCDEF"""'}, {}), "('0102ABCDEF')", False, 'import base64\n'), ((202, 11, 202, 33), 'base64.b16decode', 'base64.b16decode', ({(202, 28, 202, 32): '"""00"""'}, {}), "('00')", False, 'import base64\n'), ((206, 11, 206, 47), 'base64.b16decode', 'base64.b16decode', ({(206, 28, 206, 40): '"""0102abcdef"""', (206, 42, 206, 46): '(True)'}, {}), "('0102abcdef', True)", False, 'import base64\n')] |
gabbonj/Workbench | src/Path.py | 86bbb2e3184e0f2fc5e9ac6dc7cfec86473fb7b9 | import numpy as np
from ctypes import c_void_p
from .Shader import Shader
from .transforms import *
from OpenGL.GL import *
class Path:
# position=[x1, y1, z1, ..., xn, yn, zn] ; rotation = [[Rx1, Ry1, Rz1], ..., [Rxn, Ryn, Rzn]]
def __init__(self, position, rotation=None):
self.loadPath(position)
if rotation:
assert len(position) == len(rotation) * 3
self.loadRotation(rotation)
else:
self.rotation = 'Pio è un figo'
def loadPath(self, position):
# compiling shader
self.path_shader = Shader('src\\shaders\\path\\pathvert.glsl',
'src\\shaders\\path\\pathfrag.glsl').shaderProgram
# setting path buffer
self.vertices = position
self.patharray = glGenVertexArrays(1)
glBindVertexArray(self.patharray)
self.lineBuffer = glGenBuffers(1)
glBindBuffer(GL_ARRAY_BUFFER, self.lineBuffer)
glBufferData(GL_ARRAY_BUFFER, np.array(self.vertices, dtype='float32'), GL_STATIC_DRAW)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * 4, c_void_p(0))
def loadRotation(self, rotation):
self.rotation = rotation
# compiling shader
self.xpath_shader = Shader('src\\shaders\\path\\pathvert.glsl',
'src\\shaders\\path\\xpathfrag.glsl').shaderProgram
self.ypath_shader = Shader('src\\shaders\\path\\pathvert.glsl',
'src\\shaders\\path\\ypathfrag.glsl').shaderProgram
self.zpath_shader = Shader('src\\shaders\\path\\pathvert.glsl',
'src\\shaders\\path\\zpathfrag.glsl').shaderProgram
# setting versors
self.xvertices = []
self.yvertices = []
self.zvertices = []
for pos in range(len(rotation)):
xversor = self.getVersorAtTime(np.array([1, 0, 0, 1], dtype='float32'), pos)
yversor = self.getVersorAtTime(np.array([0, 1, 0, 1], dtype='float32'), pos)
zversor = self.getVersorAtTime(np.array([0, 0, 1, 1], dtype='float32'), pos)
pos = [self.vertices[pos*3], self.vertices[pos*3 + 1], self.vertices[pos*3 + 2]]
self.xvertices.extend(pos)
self.xvertices.extend([xversor[0], xversor[1], xversor[2]])
self.yvertices.extend(pos)
self.yvertices.extend([yversor[0], yversor[1], yversor[2]])
self.zvertices.extend(pos)
self.zvertices.extend([zversor[0], zversor[1], zversor[2]])
#setting xline bufer
self.xpatharray = glGenVertexArrays(1)
glBindVertexArray(self.xpatharray)
self.xlineBuffer = glGenBuffers(1)
glBindBuffer(GL_ARRAY_BUFFER, self.xlineBuffer)
glBufferData(GL_ARRAY_BUFFER, np.array(self.xvertices, dtype='float32'), GL_STATIC_DRAW)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * 4, c_void_p(0))
# setting yline buffer
self.ypatharray = glGenVertexArrays(1)
glBindVertexArray(self.ypatharray)
self.ylineBuffer = glGenBuffers(1)
glBindBuffer(GL_ARRAY_BUFFER, self.ylineBuffer)
glBufferData(GL_ARRAY_BUFFER, np.array(self.yvertices, dtype='float32'), GL_STATIC_DRAW)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * 4, c_void_p(0))
#setting xline bufer
self.zpatharray = glGenVertexArrays(1)
glBindVertexArray(self.zpatharray)
self.zlineBuffer = glGenBuffers(1)
glBindBuffer(GL_ARRAY_BUFFER, self.zlineBuffer)
glBufferData(GL_ARRAY_BUFFER, np.array(self.zvertices, dtype='float32'), GL_STATIC_DRAW)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * 4, c_void_p(0))
def getVersorAtTime(self, versor, index):
r_versor = np.dot(get_rot(self.rotation[index][0], 0), versor)
r_versor = np.dot(get_rot(self.rotation[index][1], 1), r_versor)
r_versor = np.dot(get_rot(self.rotation[index][2], 2), r_versor)
t_versor = np.dot(get_traslation(self.vertices[index*3], self.vertices[index*3 + 1], self.vertices[index*3 + 2]), r_versor)
return t_versor
def renderPath(self, camera):
model = np.identity(4)
view = camera.view
proj = camera.proj
# rendering the path
glBindVertexArray(self.patharray)
glUseProgram(self.path_shader)
modelLocation = glGetUniformLocation(self.path_shader, 'model')
viewLocation = glGetUniformLocation(self.path_shader, 'view')
projectionLocation = glGetUniformLocation(self.path_shader, 'projection')
glUniformMatrix4fv(modelLocation, 1, GL_TRUE, model)
glUniformMatrix4fv(viewLocation, 1, GL_TRUE, view)
glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, proj)
glEnableVertexAttribArray(0)
glDrawArrays(GL_LINE_STRIP, 0, int(len(self.vertices)/3))
glDisableVertexAttribArray(0)
# rendering the xlines
if self.rotation != 'Pio è un figo':
glBindVertexArray(self.xpatharray)
glUseProgram(self.xpath_shader)
modelLocation = glGetUniformLocation(self.xpath_shader, 'model')
viewLocation = glGetUniformLocation(self.xpath_shader, 'view')
projectionLocation = glGetUniformLocation(self.xpath_shader, 'projection')
glUniformMatrix4fv(modelLocation, 1, GL_TRUE, model)
glUniformMatrix4fv(viewLocation, 1, GL_TRUE, view)
glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, proj)
glEnableVertexAttribArray(0)
glDrawArrays(GL_LINES, 0, int(len(self.xvertices)/3))
glDisableVertexAttribArray(0)
# rendering the ylines
glBindVertexArray(self.ypatharray)
glUseProgram(self.ypath_shader)
modelLocation = glGetUniformLocation(self.ypath_shader, 'model')
viewLocation = glGetUniformLocation(self.ypath_shader, 'view')
projectionLocation = glGetUniformLocation(self.ypath_shader, 'projection')
glUniformMatrix4fv(modelLocation, 1, GL_TRUE, model)
glUniformMatrix4fv(viewLocation, 1, GL_TRUE, view)
glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, proj)
glEnableVertexAttribArray(0)
glDrawArrays(GL_LINES, 0, int(len(self.xvertices)/3))
glDisableVertexAttribArray(0)
# rendering the zlines
glBindVertexArray(self.zpatharray)
glUseProgram(self.zpath_shader)
modelLocation = glGetUniformLocation(self.zpath_shader, 'model')
viewLocation = glGetUniformLocation(self.zpath_shader, 'view')
projectionLocation = glGetUniformLocation(self.zpath_shader, 'projection')
glUniformMatrix4fv(modelLocation, 1, GL_TRUE, model)
glUniformMatrix4fv(viewLocation, 1, GL_TRUE, view)
glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, proj)
glEnableVertexAttribArray(0)
glDrawArrays(GL_LINES, 0, int(len(self.xvertices)/3))
glDisableVertexAttribArray(0)
| [((96, 16, 96, 30), 'numpy.identity', 'np.identity', ({(96, 28, 96, 29): '4'}, {}), '(4)', True, 'import numpy as np\n'), ((33, 38, 33, 78), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((34, 63, 34, 74), 'ctypes.c_void_p', 'c_void_p', ({(34, 72, 34, 73): '(0)'}, {}), '(0)', False, 'from ctypes import c_void_p\n'), ((69, 38, 69, 79), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((70, 63, 70, 74), 'ctypes.c_void_p', 'c_void_p', ({(70, 72, 70, 73): '(0)'}, {}), '(0)', False, 'from ctypes import c_void_p\n'), ((77, 38, 77, 79), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((78, 63, 78, 74), 'ctypes.c_void_p', 'c_void_p', ({(78, 72, 78, 73): '(0)'}, {}), '(0)', False, 'from ctypes import c_void_p\n'), ((85, 38, 85, 79), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((86, 63, 86, 74), 'ctypes.c_void_p', 'c_void_p', ({(86, 72, 86, 73): '(0)'}, {}), '(0)', False, 'from ctypes import c_void_p\n'), ((52, 43, 52, 82), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((53, 43, 53, 82), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((54, 43, 54, 82), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n')] |
brsynth/icfree-ml | icfree/echo_instructor/args.py | 7f6c67f26bf60e9cadd59855aebb6bdb5bd64fda | from argparse import (
ArgumentParser
)
from os import getcwd as os_getcwd
DEFAULT_OUTPUT_FOLDER = os_getcwd()
DEFAULT_SAMPLE_VOLUME = 10000
def build_args_parser(
program,
description):
parser = ArgumentParser(
program,
description,
)
parser = add_arguments(parser)
return parser
def add_arguments(parser):
parser.add_argument(
'cfps',
type=str,
help='Path to a .tsv file containing CFPS parameters and features',
)
parser.add_argument(
'init_tset',
type=str,
help='Path to a .tsv file containing initial training set',
)
parser.add_argument(
'norm_set',
type=str,
help='Path to a .tsv file containing normalizer set',
)
parser.add_argument(
'autofluo_set',
type=str,
help='Path to a .tsv file containing autofluorescence set',
)
parser.add_argument(
'-v', '--sample_volume',
type=int,
default=DEFAULT_SAMPLE_VOLUME,
help=('Final sample volume in each well in nL'
f' (default: {DEFAULT_SAMPLE_VOLUME})')
)
parser.add_argument(
'-of', '--output-folder',
type=str,
default=DEFAULT_OUTPUT_FOLDER,
help=('Output folder to write output files'
f' (default: {DEFAULT_OUTPUT_FOLDER})')
)
return parser
| [((6, 24, 6, 35), 'os.getcwd', 'os_getcwd', ({}, {}), '()', True, 'from os import getcwd as os_getcwd\n'), ((14, 13, 17, 5), 'argparse.ArgumentParser', 'ArgumentParser', ({(15, 8, 15, 15): 'program', (16, 8, 16, 19): 'description'}, {}), '(program, description)', False, 'from argparse import ArgumentParser\n')] |
sitdh/59.com-prog | ex1_01.py | 24f536a72b0467ff3ee1615f515ecff9fbf36bb3 | import math
x = float(input())
prop_2 = -(x**2) / math.factorial(2)
prop_3 = (x**4) / math.factorial(4)
prop_4 = -(x**6) / math.factorial(6)
cos_x = float(1 + prop_2 + prop_3 + prop_4)
print(prop_2)
print(prop_3)
print(prop_4)
print(cos_x)
| [((5, 19, 5, 36), 'math.factorial', 'math.factorial', ({(5, 34, 5, 35): '(2)'}, {}), '(2)', False, 'import math\n'), ((7, 18, 7, 35), 'math.factorial', 'math.factorial', ({(7, 33, 7, 34): '(4)'}, {}), '(4)', False, 'import math\n'), ((9, 19, 9, 36), 'math.factorial', 'math.factorial', ({(9, 34, 9, 35): '(6)'}, {}), '(6)', False, 'import math\n')] |
MRichards99/datagateway-api | test/datagateway_api/icat/filters/test_where_filter.py | 2e6133636fed950a16190d2f703f152c73bb5b1b | import pytest
from datagateway_api.src.common.exceptions import BadRequestError, FilterError
from datagateway_api.src.datagateway_api.filter_order_handler import FilterOrderHandler
from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter
class TestICATWhereFilter:
@pytest.mark.parametrize(
"operation, value, expected_condition_value",
[
pytest.param("eq", 5, ["%s = '5'"], id="equal"),
pytest.param("ne", 5, ["%s != 5"], id="not equal"),
pytest.param("like", 5, ["%s like '%%5%%'"], id="like"),
pytest.param("ilike", 5, ["UPPER(%s) like UPPER('%%5%%')"], id="ilike"),
pytest.param("nlike", 5, ["%s not like '%%5%%'"], id="not like"),
pytest.param(
"nilike", 5, ["UPPER(%s) not like UPPER('%%5%%')"], id="not ilike",
),
pytest.param("lt", 5, ["%s < '5'"], id="less than"),
pytest.param("lte", 5, ["%s <= '5'"], id="less than or equal"),
pytest.param("gt", 5, ["%s > '5'"], id="greater than"),
pytest.param("gte", 5, ["%s >= '5'"], id="greater than or equal"),
pytest.param("in", [1, 2, 3, 4], ["%s in (1, 2, 3, 4)"], id="in a list"),
pytest.param("in", [], ["%s in (NULL)"], id="empty list"),
],
)
def test_valid_operations(
self, icat_query, operation, value, expected_condition_value,
):
test_filter = PythonICATWhereFilter("id", value, operation)
test_filter.apply_filter(icat_query)
assert icat_query.conditions == {"id": expected_condition_value}
def test_invalid_in_operation(self, icat_query):
with pytest.raises(BadRequestError):
PythonICATWhereFilter("id", "1, 2, 3, 4, 5", "in")
def test_invalid_operation(self, icat_query):
test_filter = PythonICATWhereFilter("id", 10, "non")
with pytest.raises(FilterError):
test_filter.apply_filter(icat_query)
def test_valid_internal_icat_value(self, icat_query):
"""Check that values that point to other values in the schema are applied"""
test_filter = PythonICATWhereFilter("startDate", "o.endDate", "lt")
test_filter.apply_filter(icat_query)
assert icat_query.conditions == {"startDate": ["%s < o.endDate"]}
def test_valid_field(self, icat_query):
test_filter = PythonICATWhereFilter("title", "Investigation Title", "eq")
test_filter.apply_filter(icat_query)
assert icat_query.conditions == {"title": ["%s = 'Investigation Title'"]}
def test_invalid_field(self, icat_query):
test_filter = PythonICATWhereFilter("random_field", "my_value", "eq")
with pytest.raises(FilterError):
test_filter.apply_filter(icat_query)
def test_multiple_conditions_per_field(self, icat_query):
lt_filter = PythonICATWhereFilter("id", 10, "lt")
gt_filter = PythonICATWhereFilter("id", 5, "gt")
filter_handler = FilterOrderHandler()
filter_handler.add_filters([lt_filter, gt_filter])
filter_handler.apply_filters(icat_query)
assert icat_query.conditions == {"id": ["%s < '10'", "%s > '5'"]}
| [((31, 22, 31, 67), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(31, 44, 31, 48): '"""id"""', (31, 50, 31, 55): 'value', (31, 57, 31, 66): 'operation'}, {}), "('id', value, operation)", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((41, 22, 41, 60), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(41, 44, 41, 48): '"""id"""', (41, 50, 41, 52): '10', (41, 54, 41, 59): '"""non"""'}, {}), "('id', 10, 'non')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((48, 22, 48, 75), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(48, 44, 48, 55): '"""startDate"""', (48, 57, 48, 68): '"""o.endDate"""', (48, 70, 48, 74): '"""lt"""'}, {}), "('startDate', 'o.endDate', 'lt')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((54, 22, 54, 81), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(54, 44, 54, 51): '"""title"""', (54, 53, 54, 74): '"""Investigation Title"""', (54, 76, 54, 80): '"""eq"""'}, {}), "('title', 'Investigation Title', 'eq')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((60, 22, 60, 77), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(60, 44, 60, 58): '"""random_field"""', (60, 60, 60, 70): '"""my_value"""', (60, 72, 60, 76): '"""eq"""'}, {}), "('random_field', 'my_value', 'eq')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((66, 20, 66, 57), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(66, 42, 66, 46): '"""id"""', (66, 48, 66, 50): '10', (66, 52, 66, 56): '"""lt"""'}, {}), "('id', 10, 'lt')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((67, 20, 67, 56), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(67, 42, 67, 46): '"""id"""', (67, 48, 67, 49): '5', (67, 51, 67, 55): '"""gt"""'}, {}), "('id', 5, 'gt')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((69, 25, 69, 45), 'datagateway_api.src.datagateway_api.filter_order_handler.FilterOrderHandler', 'FilterOrderHandler', ({}, {}), '()', False, 'from datagateway_api.src.datagateway_api.filter_order_handler import FilterOrderHandler\n'), ((12, 12, 12, 59), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((13, 12, 13, 62), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((14, 12, 14, 67), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((15, 12, 15, 83), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((16, 12, 16, 76), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((17, 12, 19, 13), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((20, 12, 20, 63), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((21, 12, 21, 74), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((22, 12, 22, 66), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((23, 12, 23, 77), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((24, 12, 24, 84), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((25, 12, 25, 69), 'pytest.param', 'pytest.param', (), '', False, 'import pytest\n'), ((37, 13, 37, 43), 'pytest.raises', 'pytest.raises', ({(37, 27, 37, 42): 'BadRequestError'}, {}), '(BadRequestError)', False, 'import pytest\n'), ((38, 12, 38, 62), 'datagateway_api.src.datagateway_api.icat.filters.PythonICATWhereFilter', 'PythonICATWhereFilter', ({(38, 34, 38, 38): '"""id"""', (38, 40, 38, 55): '"""1, 2, 3, 4, 5"""', (38, 57, 38, 61): '"""in"""'}, {}), "('id', '1, 2, 3, 4, 5', 'in')", False, 'from datagateway_api.src.datagateway_api.icat.filters import PythonICATWhereFilter\n'), ((43, 13, 43, 39), 'pytest.raises', 'pytest.raises', ({(43, 27, 43, 38): 'FilterError'}, {}), '(FilterError)', False, 'import pytest\n'), ((62, 13, 62, 39), 'pytest.raises', 'pytest.raises', ({(62, 27, 62, 38): 'FilterError'}, {}), '(FilterError)', False, 'import pytest\n')] |
huobingli/splider | scrapy/spider/spider/items.py | a62f0553160531a0735b249b0dc49747e9c821f9 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy.loader import ItemLoader
from scrapy.loader.processors import TakeFirst
# class SpiderItem(scrapy.Item):
# # define the fields for your item here like:
# # name = scrapy.Field()
# pass
#
#
#
# class TorrentItem(scrapy.Item):
# url = scrapy.Field()
# name = scrapy.Field()
# description = scrapy.Field()
# size = scrapy.Field()
#
# import scrapy
class StockstarItemLoader(ItemLoader):
# 自定义itemloader,用于存储爬虫所抓取的字段内容
default_output_processor = TakeFirst()
class StockstarItem(scrapy.Item): # 建立相应的字段
# define the fields for your item here like:
# name = scrapy.Field()
code = scrapy.Field() # 股票代码
abbr = scrapy.Field() # 股票简称
last_trade = scrapy.Field() # 最新价
chg_ratio = scrapy.Field() # 涨跌幅
chg_amt = scrapy.Field() # 涨跌额
chg_ratio_5min = scrapy.Field() # 5分钟涨幅
volumn = scrapy.Field() # 成交量
turn_over = scrapy.Field() # 成交额 | [((31, 31, 31, 42), 'scrapy.loader.processors.TakeFirst', 'TakeFirst', ({}, {}), '()', False, 'from scrapy.loader.processors import TakeFirst\n'), ((37, 11, 37, 25), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((38, 11, 38, 25), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((39, 17, 39, 31), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((40, 16, 40, 30), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((41, 14, 41, 28), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((42, 21, 42, 35), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((43, 13, 43, 27), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((44, 16, 44, 30), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n')] |
enthought/codetools | codetools/contexts/multi_context.py | 20d8bb1eba68145750a1b689655b839078121474 | #
# (C) Copyright 2013 Enthought, Inc., Austin, TX
# All right reserved.
#
# This file is open source software distributed according to the terms in
# LICENSE.txt
#
""" Context holding multiple subcontexts.
"""
from __future__ import absolute_import
from itertools import chain
from collections import MutableMapping as DictMixin
from traits.api import (Bool, List, Str, Undefined, Supports,
adapt, provides, on_trait_change)
from .data_context import DataContext, ListenableMixin, PersistableMixin
from .i_context import ICheckpointable, IDataContext, IRestrictedContext
from .utils import safe_repr
@provides(IDataContext)
class MultiContext(ListenableMixin, PersistableMixin, DictMixin):
""" Wrap several subcontexts.
"""
#: The name of the context.
name = Str("multidummy")
#: The underlying dictionary.
subcontexts = List(Supports(IRestrictedContext, factory=DataContext))
#: Suppress subcontext modified events
veto_subcontext_modified = Bool(True)
def __init__(self, *subcontexts, **traits):
subcontexts = list(subcontexts)
super(MultiContext, self).__init__(subcontexts=subcontexts, **traits)
#### IContext interface ####################################################
def __iter__(self):
return iter(self.keys())
def __len__(self):
return len(list(self.keys()))
def __contains__(self, key):
for c in self.subcontexts:
if key in c:
return True
return False
def __delitem__(self, key):
""" Remove the given key with [] access.
Only deletes the first instance of the key.
Parameters
----------
key : str
Raises
------
KeyError if the kew is not available in the context.
"""
for c in self.subcontexts:
try:
del c[key]
return
except KeyError:
continue
raise KeyError(key)
def __getitem__(self, key):
for c in self.subcontexts:
try:
return c[key]
except KeyError:
continue
raise KeyError(key)
def __setitem__(self, key, value):
""" Set item with [] access.
The first subcontext which allows the key/value pair will get it. If an
earlier subcontext has the key, but does not allow the assignment, then
that key will be deleted. Later contexts with the key will be untouched.
If the key/value pair cannot be assigned to anything, no deletion will
take place.
Parameters
----------
key : str
value : object
Raises
------
ValueError if the key is not permitted to be assigned that value.
"""
# Let subtypes dictate compatibility independently of contained contexts
if not self.allows(value, key):
raise ValueError('Disallowed mapping: %s = %s' % (key, safe_repr(value)))
set = False
blocking_contexts = []
for c in self.subcontexts:
if not set:
if c.allows(value, key):
if key in c:
added = []
current_value = c[key]
try:
is_modified = bool(current_value != value)
except Exception:
is_modified = current_value is not value
if is_modified:
modified = [key]
c[key] = value
else:
modified = []
else:
added = [key]
modified = []
c[key] = value
set = True
break
elif key in c:
# Record this context as blocking access to the final
# location of the value.
blocking_contexts.append(c)
# Remove all blocking instances.
for c in blocking_contexts:
del c[key]
if not set:
raise ValueError('Disallowed mapping: %s = %s' % (key, safe_repr(value)))
def keys(self):
return list(set(chain(*[list(c.keys()) for c in self.subcontexts])))
# Expose DictMixin's get method over HasTraits'.
get = DictMixin.get
def __str__(self):
# Maybe a good default string
subcontext_str = '[%s]' % ', '.join([str(x) for x in self.subcontexts])
return '%s(name=%r, subcontexts=%s)' % (type(self).__name__, self.name,
subcontext_str)
def __repr__(self):
# Maybe a good default representation
return '%s(name=%r)' % (type(self).__name__, self.name)
#### IRestrictedContext interface ##########################################
def allows(self, value, name=None):
for c in self.subcontexts:
if c.allows(value, name=name):
return True
return False
#### Trait Event Handlers ##################################################
@on_trait_change('subcontexts:items_modified')
def subcontexts_items_modified(self, event):
""" Pass events up.
"""
if event is Undefined:
# Nothing to do.
return
event.veto = self.veto_subcontext_modified
self._fire_event(added=event.added, removed=event.removed,
modified=event.modified, context=event.context)
def _subcontexts_items_changed(self, event):
""" Trait listener for items of subcontexts list.
"""
added = []
removed = []
# Add to the list of items added
if len(event.added):
for context in event.added:
added.extend(list(context.keys()))
# Add to the list of items removed
if len(event.removed):
for context in event.removed:
removed.extend(list(context.keys()))
self._fire_event(added=added, removed=removed)
#### ICheckpointable interface ############################################
def checkpoint(self):
""" Make a shallow copy of the context.
Technically, this is actually a fairly deep copy. All of the object
structure should be replicated, but the actual dictionary storage will
be shallowly copied::
copy = context.shallow_copy()
copy[key] is context[key] for key in context.keys()
These semantics are useful for saving out checkpointed versions of the
context for implementing an undo/redo stack. They may not be useful for
other purposes.
Returns
-------
copy : IContext
"""
copy = self.clone_traits()
new_subcontexts = []
for context in self.subcontexts:
checkpointable_subcontext = adapt(context, ICheckpointable)
new_subcontexts.append(checkpointable_subcontext.checkpoint())
copy.subcontexts = new_subcontexts
return copy
| [((25, 1, 25, 23), 'traits.api.provides', 'provides', ({(25, 10, 25, 22): 'IDataContext'}, {}), '(IDataContext)', False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n'), ((31, 11, 31, 28), 'traits.api.Str', 'Str', ({(31, 15, 31, 27): '"""multidummy"""'}, {}), "('multidummy')", False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n'), ((37, 31, 37, 41), 'traits.api.Bool', 'Bool', ({(37, 36, 37, 40): 'True'}, {}), '(True)', False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n'), ((176, 5, 176, 50), 'traits.api.on_trait_change', 'on_trait_change', ({(176, 21, 176, 49): '"""subcontexts:items_modified"""'}, {}), "('subcontexts:items_modified')", False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n'), ((34, 23, 34, 72), 'traits.api.Supports', 'Supports', (), '', False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n'), ((230, 40, 230, 71), 'traits.api.adapt', 'adapt', ({(230, 46, 230, 53): 'context', (230, 55, 230, 70): 'ICheckpointable'}, {}), '(context, ICheckpointable)', False, 'from traits.api import Bool, List, Str, Undefined, Supports, adapt, provides, on_trait_change\n')] |
FMoller/coding-auxiliary-tools | line_counter/TestCodes/python_test.py | 21784f01731404f33059f3a8c4e73a104709ffe9 | """A simple file to test the line_counter performance in python
This is a multiline doctest
"""
__author__ = "Frederico Moeller"
__copyright__ = ""
__credits__ = ["Frederico Moeller"]
__license__ = "MIT"
__version__ = "1.0.1"
__maintainer__ = "Frederico Moeller"
__email__ = ""
__status__ = ""
#import things
import math
#define things
def some_function(var_one, var_two,
var_three):
"""This is a function that do things"""
if var_one > var_two:
if var_two*var_three > var_one:
return "blab" #this happens
else:
return "blob"
else:
return "fish"
| [] |
VaniW/deconfounded-lexicon-induction | causal_attribution/data.py | 419ecf717f51cfd1741732ca3191b36b565bd1a4 | """Data pipelines."""
from collections import defaultdict, OrderedDict
from tqdm import tqdm
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
import torch
def get_info(examples, vocab=None, max_seq_len=256):
"""Gathers info on and creats a featurized example generator for a list of raw examples.
Args:
examples: list(list, float, or string). Examples to create generator for.
vocab: list(str). A vocabulary for discrete datatypes (e.g. text or categorical).
max_seq_len: int. maximum sequence length for text examples.
Returns:
A dict of info about this variable as well as a generator over featurized examples.
"""
assert isinstance(examples, list), 'examples must be list; got ' + str(type(examples))
assert len(examples) > 0, 'Empty example list!'
# Text
if isinstance(examples[0], list):
assert vocab is not None, 'ERROR: must provide a vocab.'
example_type = 'input'
vocab = ['UNK', 'PAD'] + vocab
tok2id = {tok: i for i, tok in enumerate(vocab)}
ngrams = max(len(x.split()) for x in vocab)
unk_id = 0
def featurizer(example):
ids = []
for n in range(1, ngrams + 1):
toks = [' '.join(example[i: i + n]) for i in range(len(example) - n + 1)]
ids += [tok2id.get(x, 0) for x in toks]
ids = ids[:max_seq_len]
padded_ids = ids + ([1] * (max_seq_len - len(ids))) # pad idx = 1
return padded_ids
# Continuous
elif isinstance(examples[0], float) or isinstance(examples[0], int):
example_type = 'continuous'
vocab = ['N/A']
if isinstance(examples[0], int):
featurizer = lambda ex: float(ex)
else:
featurizer = lambda ex: ex
# Categorical
elif isinstance(examples[0], str):
example_type = 'categorical'
if not vocab:
vocab = ['UNK'] + sorted(list(set(examples)))
tok2id = {tok: i for i, tok in enumerate(vocab)}
featurizer = lambda ex: tok2id.get(ex, 0) # 0 is the unk id.
else:
print("ERROR: unrecognized example type: ", examples[0])
quit()
return featurizer, example_type, vocab
def get_iterator(vocab, df, name_to_type, batch_size=32, max_seq_len=256):
"""Builds a data iterator for text, confounds, and outcomes.
Args:
vocab: list(str). The vocabulary to use.
df: pandas.df. The data we want to iterate over. The columns of
these data should be a superset of the keys in name_to_type.
name_to_type: dict. A mapping from variable names to whether they are
"input", "predict", or "control" variables.
batch_size: int. The batch size to use.
max_seq_len: int. Maximum length of text sequences.
Returns:
A generator which yields dictionaries where variable names are mapped
to tensors of batched data.
"""
def featurize(featurizer):
return [featurizer(ex) for ex in examples]
var_info = defaultdict(lambda: OrderedDict())
featurized_data = defaultdict(list)
for var_name, var_type in name_to_type.items():
examples = list(df[var_name])
if var_type == 'input':
examples = [x.split() for x in examples]
featurizer, _, vocab = get_info(examples, vocab, max_seq_len)
var_info[var_name] = {
'control': False, 'name': var_name,
'type': var_type, 'vocab': vocab
}
else:
featurizer, varType, vocab = get_info(examples)
var_info[var_name] = {
'control': var_type == 'control',
'name': var_name, 'type': varType, 'vocab': vocab
}
featurized_data[var_name] = [featurizer(ex) for ex in examples]
def to_tensor(var_name):
dtype = torch.float
if var_info[var_name]['type'] in {'categorical', 'input'}:
dtype = torch.long
return torch.tensor(featurized_data[var_name], dtype=dtype)
feature_names = sorted(featurized_data.keys())
data = TensorDataset(*[to_tensor(name) for name in feature_names])
dataloader = DataLoader(
dataset=data,
sampler=RandomSampler(data),
collate_fn=lambda batch: [torch.stack(x) for x in zip(*batch)], # group by datatype.
batch_size=batch_size)
def iterator():
for batch in dataloader:
yield dict(zip(feature_names, batch))
return iterator, var_info
| [((87, 22, 87, 39), 'collections.defaultdict', 'defaultdict', ({(87, 34, 87, 38): 'list'}, {}), '(list)', False, 'from collections import defaultdict, OrderedDict\n'), ((113, 15, 113, 67), 'torch.tensor', 'torch.tensor', (), '', False, 'import torch\n'), ((86, 35, 86, 48), 'collections.OrderedDict', 'OrderedDict', ({}, {}), '()', False, 'from collections import defaultdict, OrderedDict\n'), ((119, 16, 119, 35), 'torch.utils.data.RandomSampler', 'RandomSampler', ({(119, 30, 119, 34): 'data'}, {}), '(data)', False, 'from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler\n'), ((120, 34, 120, 48), 'torch.stack', 'torch.stack', ({(120, 46, 120, 47): 'x'}, {}), '(x)', False, 'import torch\n')] |
H2u-Hwng/EVC | fopp/Chapter 12. Functions/get_num_digits.py | c650fe7356a333011514cf9025dfd97bf71b1de3 | # Take number, and convert integer to string
# Calculate and return number of digits
def get_num_digits(num):
# Convert int to str
num_str = str(num)
# Calculate number of digits
digits = len(num_str)
return digits
# Define main function
def main():
# Prompt user for an integer
number = int(input('Enter an integer: '))
# Obtain number of digits
num_digits = get_num_digits(number)
# Display result
print(f'The number of digits in number {number} is {num_digits}.')
# Call main function
main()
| [] |
mzpqnxow/whois-1 | whois/__init__.py | b5623ed25cfa58d9457d30dae640e69b9e530b23 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import *
import re
import sys
import os
import subprocess
import socket
from .parser import WhoisEntry
from .whois import NICClient
# thanks to https://www.regextester.com/104038
IPV4_OR_V6 = re.compile(r"((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))")
def whois(url, command=False, flags=0):
# clean domain to expose netloc
ip_match = IPV4_OR_V6.match(url)
if ip_match:
domain = url
try:
result = socket.gethostbyaddr(url)
except socket.herror as e:
pass
else:
domain = extract_domain(result[0])
else:
domain = extract_domain(url)
if command:
# try native whois command
r = subprocess.Popen(['whois', domain], stdout=subprocess.PIPE)
text = r.stdout.read().decode()
else:
# try builtin client
nic_client = NICClient()
text = nic_client.whois_lookup(None, domain.encode('idna'), flags)
return WhoisEntry.load(domain, text)
suffixes = None
def extract_domain(url):
"""Extract the domain from the given URL
>>> print(extract_domain('http://www.google.com.au/tos.html'))
google.com.au
>>> print(extract_domain('abc.def.com'))
def.com
>>> print(extract_domain(u'www.公司.hk'))
公司.hk
>>> print(extract_domain('chambagri.fr'))
chambagri.fr
>>> print(extract_domain('www.webscraping.com'))
webscraping.com
>>> print(extract_domain('198.252.206.140'))
stackoverflow.com
>>> print(extract_domain('102.112.2O7.net'))
2o7.net
>>> print(extract_domain('globoesporte.globo.com'))
globo.com
>>> print(extract_domain('1-0-1-1-1-0-1-1-1-1-1-1-1-.0-0-0-0-0-0-0-0-0-0-0-0-0-10-0-0-0-0-0-0-0-0-0-0-0-0-0.info'))
0-0-0-0-0-0-0-0-0-0-0-0-0-10-0-0-0-0-0-0-0-0-0-0-0-0-0.info
>>> print(extract_domain('2607:f8b0:4006:802::200e'))
1e100.net
>>> print(extract_domain('172.217.3.110'))
1e100.net
"""
if IPV4_OR_V6.match(url):
# this is an IP address
return socket.gethostbyaddr(url)[0]
# load known TLD suffixes
global suffixes
if not suffixes:
# downloaded from https://publicsuffix.org/list/public_suffix_list.dat
tlds_path = os.path.join(os.getcwd(), os.path.dirname(__file__), 'data', 'public_suffix_list.dat')
with open(tlds_path, encoding='utf-8') as tlds_fp:
suffixes = set(line.encode('utf-8') for line in tlds_fp.read().splitlines() if line and not line.startswith('//'))
if not isinstance(url, str):
url = url.decode('utf-8')
url = re.sub('^.*://', '', url)
url = url.split('/')[0].lower()
# find the longest suffix match
domain = b''
split_url = url.split('.')
for section in reversed(split_url):
if domain:
domain = b'.' + domain
domain = section.encode('utf-8') + domain
if domain not in suffixes:
if not b'.' in domain and len(split_url) >= 2:
# If this is the first section and there wasn't a match, try to
# match the first two sections - if that works, keep going
# See https://github.com/richardpenman/whois/issues/50
second_order_tld = '.'.join([split_url[-2], split_url[-1]])
if not second_order_tld.encode('utf-8') in suffixes:
break
else:
break
return domain.decode('utf-8')
if __name__ == '__main__':
try:
url = sys.argv[1]
except IndexError:
print('Usage: %s url' % sys.argv[0])
else:
print(whois(url))
| [((8, 0, 8, 34), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ({}, {}), '()', False, 'from future import standard_library\n'), ((20, 13, 20, 1227), 're.compile', 're.compile', ({(20, 24, 20, 1226): '"""((^\\\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\\\\s*$)|(^\\\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:)))(%.+)?\\\\s*$))"""'}, {}), "(\n '((^\\\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\\\\s*$)|(^\\\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)(\\\\.(25[0-5]|2[0-4]\\\\d|1\\\\d\\\\d|[1-9]?\\\\d)){3}))|:)))(%.+)?\\\\s*$))'\n )", False, 'import re\n'), ((88, 10, 88, 35), 're.sub', 're.sub', ({(88, 17, 88, 25): '"""^.*://"""', (88, 27, 88, 29): '""""""', (88, 31, 88, 34): 'url'}, {}), "('^.*://', '', url)", False, 'import re\n'), ((38, 12, 38, 71), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((29, 21, 29, 46), 'socket.gethostbyaddr', 'socket.gethostbyaddr', ({(29, 42, 29, 45): 'url'}, {}), '(url)', False, 'import socket\n'), ((76, 15, 76, 40), 'socket.gethostbyaddr', 'socket.gethostbyaddr', ({(76, 36, 76, 39): 'url'}, {}), '(url)', False, 'import socket\n'), ((82, 33, 82, 44), 'os.getcwd', 'os.getcwd', ({}, {}), '()', False, 'import os\n'), ((82, 46, 82, 71), 'os.path.dirname', 'os.path.dirname', ({(82, 62, 82, 70): '__file__'}, {}), '(__file__)', False, 'import os\n')] |
tirinox/alphavatarbot | app/dialog/avatar_picture_dialog.py | 5adac8c9c4534206eaf6c146f6e194ed5951d055 | import asyncio
from contextlib import AsyncExitStack
from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.dispatcher.storage import FSMContextProxy
from aiogram.types import Message, PhotoSize, ReplyKeyboardRemove, ContentTypes
from aiogram.utils.helper import HelperMode
from dialog.avatar_image_work import download_tg_photo, get_userpic, combine_frame_and_photo_v2, img_to_bio
from dialog.base import BaseDialog, message_handler
from localization import BaseLocalization
from lib.depcont import DepContainer
from lib.texts import kbd
# todo: accept documents!
class AvatarStates(StatesGroup):
mode = HelperMode.snake_case # fixme: no state handle
MAIN = State()
class AvatarDialog(BaseDialog):
def __init__(self, loc: BaseLocalization, data: FSMContextProxy, d: DepContainer):
super().__init__(loc, data, d)
self._work_lock = asyncio.Lock()
def menu_kbd(self):
return kbd([
self.loc.BUTTON_AVA_FROM_MY_USERPIC,
], vert=True)
@message_handler(state=None)
async def on_no_state(self, message: Message):
await self.on_enter(message)
@message_handler(state=AvatarStates.MAIN)
async def on_enter(self, message: Message):
if message.text == self.loc.BUTTON_AVA_FROM_MY_USERPIC:
await self.handle_avatar_picture(message, self.loc)
else:
await AvatarStates.MAIN.set()
await message.answer(self.loc.TEXT_AVA_WELCOME, reply_markup=self.menu_kbd())
@message_handler(state=AvatarStates.MAIN, content_types=ContentTypes.PHOTO)
async def on_picture(self, message: Message):
await self.handle_avatar_picture(message, self.loc, explicit_picture=message.photo[0])
async def handle_avatar_picture(self, message: Message, loc: BaseLocalization, explicit_picture: PhotoSize = None):
async with AsyncExitStack() as stack:
stack.enter_async_context(self._work_lock)
# POST A LOADING STICKER
sticker = await message.answer_sticker(self.loc.LOADING_STICKER,
disable_notification=True,
reply_markup=ReplyKeyboardRemove())
# CLEAN UP IN THE END
stack.push_async_callback(sticker.delete)
if explicit_picture is not None:
user_pic = await download_tg_photo(explicit_picture)
else:
user_pic = await get_userpic(message.from_user)
w, h = user_pic.size
if not w or not h:
await message.answer(loc.TEXT_AVA_ERR_INVALID, reply_markup=self.menu_kbd())
return
if not ((64 <= w <= 4096) and (64 <= h <= 4096)):
await message.answer(loc.TEXT_AVA_ERR_SIZE, reply_markup=self.menu_kbd())
return
# pic = await combine_frame_and_photo(self.deps.cfg, user_pic)
pic = await combine_frame_and_photo_v2(self.deps.cfg, user_pic)
user_id = message.from_user.id
pic = img_to_bio(pic, name=f'alpha_avatar_{user_id}.png')
await message.answer_document(pic, caption=loc.TEXT_AVA_READY, reply_markup=self.menu_kbd())
| [((21, 11, 21, 18), 'aiogram.dispatcher.filters.state.State', 'State', ({}, {}), '()', False, 'from aiogram.dispatcher.filters.state import StatesGroup, State\n'), ((34, 5, 34, 32), 'dialog.base.message_handler', 'message_handler', (), '', False, 'from dialog.base import BaseDialog, message_handler\n'), ((38, 5, 38, 45), 'dialog.base.message_handler', 'message_handler', (), '', False, 'from dialog.base import BaseDialog, message_handler\n'), ((46, 5, 46, 79), 'dialog.base.message_handler', 'message_handler', (), '', False, 'from dialog.base import BaseDialog, message_handler\n'), ((27, 26, 27, 40), 'asyncio.Lock', 'asyncio.Lock', ({}, {}), '()', False, 'import asyncio\n'), ((30, 15, 32, 21), 'lib.texts.kbd', 'kbd', (), '', False, 'from lib.texts import kbd\n'), ((51, 19, 51, 35), 'contextlib.AsyncExitStack', 'AsyncExitStack', ({}, {}), '()', False, 'from contextlib import AsyncExitStack\n'), ((79, 18, 79, 69), 'dialog.avatar_image_work.img_to_bio', 'img_to_bio', (), '', False, 'from dialog.avatar_image_work import download_tg_photo, get_userpic, combine_frame_and_photo_v2, img_to_bio\n'), ((76, 24, 76, 75), 'dialog.avatar_image_work.combine_frame_and_photo_v2', 'combine_frame_and_photo_v2', ({(76, 51, 76, 64): 'self.deps.cfg', (76, 66, 76, 74): 'user_pic'}, {}), '(self.deps.cfg, user_pic)', False, 'from dialog.avatar_image_work import download_tg_photo, get_userpic, combine_frame_and_photo_v2, img_to_bio\n'), ((62, 33, 62, 68), 'dialog.avatar_image_work.download_tg_photo', 'download_tg_photo', ({(62, 51, 62, 67): 'explicit_picture'}, {}), '(explicit_picture)', False, 'from dialog.avatar_image_work import download_tg_photo, get_userpic, combine_frame_and_photo_v2, img_to_bio\n'), ((64, 33, 64, 63), 'dialog.avatar_image_work.get_userpic', 'get_userpic', ({(64, 45, 64, 62): 'message.from_user'}, {}), '(message.from_user)', False, 'from dialog.avatar_image_work import download_tg_photo, get_userpic, combine_frame_and_photo_v2, img_to_bio\n'), ((57, 64, 57, 85), 'aiogram.types.ReplyKeyboardRemove', 'ReplyKeyboardRemove', ({}, {}), '()', False, 'from aiogram.types import Message, PhotoSize, ReplyKeyboardRemove, ContentTypes\n')] |
olubiyiontheweb/digid_websearch_flask | image_store_processing.py | 181107eaa60faff9429b754236406eed56e3c1ec | from skimage.metrics import structural_similarity as ssim
from glob import glob
from PIL import Image
import numpy as np
import ntpath
import dhash
import cv2
from database_structure import database_migrations
IMAGE_FOLDER = "./image_store"
ALLOWED_EXTENSIONS = ['png', 'jpg', 'jpeg']
image_store_hash = dict()
db_ops = database_migrations()
class preprocess:
def __init__(self):
# image table values to insert in database
self.images_list = dict()
self.image_store = list()
def load_images_into_to_db(self):
for img_type in ALLOWED_EXTENSIONS:
images = glob(IMAGE_FOLDER + "/*" + img_type)
for img in images:
imgname = ntpath.basename(img)
values = imgname, IMAGE_FOLDER, "local"
print(values)
db_ops.image_store_migrations()
# TODO Abstract requests and insert from database
db_ops.insert_operations("image_store", values)
def request_list_of_images_in_db(self):
# images = glob(IMAGE_FOLDER + "/*" + img_type)
images = db_ops.request_matches("image_store")
print("list from database" + str(images))
self.image_store.clear()
self.images_list.clear()
for img in images:
# get image name
print("current list" + str(self.image_store))
self.images_list["image_id"] = img[0]
self.images_list["image_name"] = img[1]
print("Check the values" + str(self.images_list))
self.image_store.append(self.images_list.copy())
print("Check the images" + str(self.image_store))
print("We have" + str(len(self.image_store)) + "images in the store")
print(self.image_store)
return self.image_store
def generate_hash(self):
images_in_db = self.request_list_of_images_in_db()
print(images_in_db)
for img in images_in_db:
image = Image.open(IMAGE_FOLDER + "\\" + img["image_name"])
row, col = dhash.dhash_row_col(image)
img_hash = dhash.format_hex(row, col)
values = img_hash, img["image_id"]
db_ops.image_store_migrations()
print(values)
db_ops.insert_operations("image_store_hash", values)
class compare_files:
def __init__(self):
# image table values to insert in database
self.images_list = dict()
self.image_store = list()
def request_image_hashes(self):
images = db_ops.request_matches("image_store_hash")
print("list from database" + str(images))
self.image_store.clear()
self.images_list.clear()
for img in images:
# get image name
print("current list" + str(img))
self.images_list["image_hash"] = img[1]
# request image name from image store database
img_name = db_ops.conditional_request_matches(
"image_store", img[2], "image_name", "image_id")
self.images_list["image_name"] = img_name[0][0]
print("Check the values" + str(self.images_list))
self.image_store.append(self.images_list.copy())
print("Check the images" + str(self.image_store))
print("We have" + str(len(self.image_store)) + "images in the store")
print(self.image_store)
return self.image_store
def calculate_hamming_dist(self, uploaded_hash, db_store_hash):
i = 0
count = 0
while (i < len(uploaded_hash)):
if (uploaded_hash[i] != db_store_hash[i]):
count += 1
i += 1
return count
def mean_squared_error(self, uploaded_image, db_store_image):
# the 'Mean Squared Error' between the two images is the
# sum of the squared difference between the two images;
# NOTE: the two images must have the same dimension
err = np.sum((uploaded_image.astype("float") -
db_store_image.astype("float"))**2)
err /= float(uploaded_image.shape[0] * uploaded_image.shape[1])
# return the MSE, the lower the error, the more "similar"
# the two images are
return err
def structural_similarity_index(self, uploaded_image, db_store_image):
ssim_index = ssim(uploaded_image, db_store_image)
return ssim_index
def convert_and_resize_compare(self, uploaded_image, db_store_image):
# TODO: make structural similarity and mean squared error functionals
uploaded_image = cv2.imread(uploaded_image)
db_store_image = cv2.imread(db_store_image)
uploaded_image = cv2.resize()
db_store_image = cv2.resize()
uploaded_image = cv2.cvtColor(uploaded_image, cv2.COLOR_BGR2GRAY)
db_store_image = cv2.cvtColor(db_store_image, cv2.COLOR_BGR2GRAY)
mean_sq_error = self.mean_squared_error(uploaded_image, db_store_image)
ssim_index = self.structural_similarity_index(uploaded_image,
db_store_image)
return ssim_index, mean_sq_error
| [((14, 9, 14, 30), 'database_structure.database_migrations', 'database_migrations', ({}, {}), '()', False, 'from database_structure import database_migrations\n'), ((119, 21, 119, 57), 'skimage.metrics.structural_similarity', 'ssim', ({(119, 26, 119, 40): 'uploaded_image', (119, 42, 119, 56): 'db_store_image'}, {}), '(uploaded_image, db_store_image)', True, 'from skimage.metrics import structural_similarity as ssim\n'), ((126, 25, 126, 51), 'cv2.imread', 'cv2.imread', ({(126, 36, 126, 50): 'uploaded_image'}, {}), '(uploaded_image)', False, 'import cv2\n'), ((127, 25, 127, 51), 'cv2.imread', 'cv2.imread', ({(127, 36, 127, 50): 'db_store_image'}, {}), '(db_store_image)', False, 'import cv2\n'), ((129, 25, 129, 37), 'cv2.resize', 'cv2.resize', ({}, {}), '()', False, 'import cv2\n'), ((130, 25, 130, 37), 'cv2.resize', 'cv2.resize', ({}, {}), '()', False, 'import cv2\n'), ((132, 25, 132, 73), 'cv2.cvtColor', 'cv2.cvtColor', ({(132, 38, 132, 52): 'uploaded_image', (132, 54, 132, 72): 'cv2.COLOR_BGR2GRAY'}, {}), '(uploaded_image, cv2.COLOR_BGR2GRAY)', False, 'import cv2\n'), ((133, 25, 133, 73), 'cv2.cvtColor', 'cv2.cvtColor', ({(133, 38, 133, 52): 'db_store_image', (133, 54, 133, 72): 'cv2.COLOR_BGR2GRAY'}, {}), '(db_store_image, cv2.COLOR_BGR2GRAY)', False, 'import cv2\n'), ((25, 21, 25, 57), 'glob.glob', 'glob', ({(25, 26, 25, 56): "IMAGE_FOLDER + '/*' + img_type"}, {}), "(IMAGE_FOLDER + '/*' + img_type)", False, 'from glob import glob\n'), ((59, 20, 59, 71), 'PIL.Image.open', 'Image.open', ({(59, 31, 59, 70): "IMAGE_FOLDER + '\\\\' + img['image_name']"}, {}), "(IMAGE_FOLDER + '\\\\' + img['image_name'])", False, 'from PIL import Image\n'), ((60, 23, 60, 49), 'dhash.dhash_row_col', 'dhash.dhash_row_col', ({(60, 43, 60, 48): 'image'}, {}), '(image)', False, 'import dhash\n'), ((61, 23, 61, 49), 'dhash.format_hex', 'dhash.format_hex', ({(61, 40, 61, 43): 'row', (61, 45, 61, 48): 'col'}, {}), '(row, col)', False, 'import dhash\n'), ((27, 26, 27, 46), 'ntpath.basename', 'ntpath.basename', ({(27, 42, 27, 45): 'img'}, {}), '(img)', False, 'import ntpath\n')] |
elthorito/Rai | cogs/jpserv.py | a6f05567a0d4ed98a09676e507c478a27630bf1c | import discord
from discord.ext import commands
import os
import json
from datetime import date, datetime, timedelta
from .utils import helper_functions as hf
from copy import deepcopy
dir_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))).replace('\\', '/')
class Jpserv(commands.Cog):
"""Modules unique for the Japanese server"""
def __init__(self, bot):
self.bot = bot
async def cog_check(self, ctx):
if not ctx.guild:
return
return ctx.guild.id == 189571157446492161 or ctx.guild.id == 275146036178059265
# these commands are only useable on Japanese server or my testing server
@commands.command()
@hf.is_admin()
async def swap(self, ctx):
"""Swaps JHO/JHO2's names and positions in the lists, for if we temporarily want welcome messages to go to
JHO2"""
jpJHO = self.bot.get_channel(189571157446492161)
jpJHO2 = self.bot.get_channel(326263874770829313)
if jpJHO.position == 4:
await jpJHO.edit(position=5, name='just_hanging_out_2')
await jpJHO2.edit(position=4, name='just_hanging_out')
else:
await jpJHO.edit(position=4, name='just_hanging_out')
await jpJHO2.edit(position=5, name='just_hanging_out_2')
@commands.group(invoke_without_command=True, aliases=['uhc'])
async def ultrahardcore(self, ctx, *, member=None):
"""Irreversible hardcore mode. Must talk to an admin to have this undone."""
# if ctx.guild.id != 189571157446492161:
# return
role = ctx.guild.get_role(486851965121331200)
config = self.bot.db['ultraHardcore']['users']
if member: # if you specified someone else's ID, then remove UHC from them
member = await hf.member_converter(ctx, member)
if not member:
return
if hf.admin_check(ctx) and ctx.author.id != member.id:
if str(member.id) in config:
if config[str(member.id)][0]:
config[str(member.id)][0] = False
else:
await ctx.send("That user is not in UHC")
return
else:
await ctx.send("That user is not in UHC mode.")
return
await hf.dump_json()
try:
await member.remove_roles(role)
except discord.errors.Forbidden:
await ctx.send("I couldn't remove the ultra hardcore role")
await ctx.send(f'Undid ultra hardcore mode for {member.name}')
else:
await ctx.send("You can not remove UHC. Ask a mod/admin to help you.")
else:
if str(ctx.author.id) in config:
if config[str(ctx.author.id)][0]:
await ctx.invoke(self.explanation)
return
await ctx.send(f"This is ultra hardcore mode. It means you must speak in the language you are learning"
f" (for example, if you are learning Japanese, any messages in English will be deleted)."
f" This can not be undone unless you ask a mod to remove it for you. \n\n"
f"To enable ultra hardcore mode, type `;uhc on` or `;uhc enable`. ")
@ultrahardcore.command(aliases=['enable'])
async def on(self, ctx):
"""Enables UHC"""
if ctx.guild.id != 189571157446492161:
return
role = ctx.guild.get_role(486851965121331200)
config = self.bot.db['ultraHardcore']['users']
if str(ctx.author.id) in config: # if not enabled
user = config[str(ctx.author.id)]
if user[0]:
await ctx.send("You're already in ultra hardcore mode.")
return
else:
user[0] = True
else:
config[str(ctx.author.id)] = [True, date.today().strftime("%Y/%m/%d"), 0]
await hf.dump_json()
try:
await ctx.author.add_roles(role)
except discord.errors.Forbidden:
await ctx.send("I couldn't add the ultra hardcore role")
await ctx.send(f"{ctx.author.name} has chosen to enable ultra hardcore mode. It works the same as "
"normal hardcore mode except that you can't undo it and asterisks don't change "
"anything. Talk to a mod to undo this.")
@ultrahardcore.command()
async def list(self, ctx):
"""Lists the people currently in ultra hardcore mode"""
if ctx.guild.id != 189571157446492161:
return
string = 'The members in ultra hardcore mode right now are '
guild = self.bot.get_guild(189571157446492161)
members = []
config = self.bot.db['ultraHardcore']['users']
for member_id in config.copy():
if config[member_id][0]:
member = guild.get_member(int(member_id))
if member is not None: # in case a member leaves
members.append(member.name)
else:
del config[member_id]
await ctx.send(f'Removed <@{member_id}> from the list, as they seem to have left the server')
await ctx.send(string + ', '.join(members))
@ultrahardcore.command()
async def explanation(self, ctx):
"""Explains ultra hardcore mode for those who are using it and can't explain it"""
if ctx.guild.id != 189571157446492161:
return
if str(ctx.author.id) in self.bot.db['ultraHardcore']['users']:
if self.bot.db['ultraHardcore']['users'][str(ctx.author.id)][0]:
await ctx.send(f"{ctx.author.mention} is currently using ultra hardcore mode. In this mode, they can't"
f" speak their native language, and they also cannot undo this mode themselves.")
return
await ctx.send(f"{ctx.author.mention} is currently NOT using hardcore mode, so I don't know why "
f"they're trying to use this command. But, ultra hardcore mode means a user can't speak "
f"any English, and can't undo this mode themselves no matter what.")
@ultrahardcore.command(aliases=['lb'])
async def leaderboard(self, ctx):
"""Shows a leaderboard of who has had UHC on for the longest"""
if ctx.guild.id != 189571157446492161:
return
time_dict = deepcopy(self.bot.db['ultraHardcore']['users'])
for i in time_dict:
if time_dict[i][0]:
time_dict[i][2] += (datetime.today() - datetime.strptime(time_dict[i][1], "%Y/%m/%d")).days
# {('243703909166612480', [True, '2019/02/14', 124]),
# ('219617844973797376', [False, '2018/11/30', 122]), ...}
to_sort = [[i[0], i[1][0], i[1][2]] for i in list(time_dict.items())]
# to_sort: [['243703909166612480', True, 162], ['219617844973797376', False, 122], ...]
sorted_dict = sorted(to_sort, key=lambda x: x[2], reverse=True)
leaderboard = f"The number of days each user has had UHC enabled " \
f"(Bold = This user currently has UHC enabled)\n\n"
for i in sorted_dict:
user = ctx.guild.get_member(int(i[0]))
if (i[2] < 10 and not i[1]) or (not user):
continue
if user.nick:
name_str = f"{user.mention} ({user.name})"
else:
name_str = f"{user.name}"
if i[1]:
leaderboard += f"**{i[2]}: {name_str}**\n"
else:
leaderboard += f"{i[2]}: {name_str}\n"
emb = discord.Embed(title="UHC Leaderboard", description=leaderboard,
color=discord.Color(int('ff5500', 16)))
await ctx.send(embed=emb)
@ultrahardcore.command()
@hf.is_admin()
async def ignore(self, ctx):
"""Ignores a channel for UHC"""
if ctx.guild.id != 189571157446492161:
return
config = self.bot.db['ultraHardcore']
try:
if ctx.channel.id not in config['ignore']:
config['ignore'].append(ctx.channel.id)
await ctx.send(f"Added {ctx.channel.name} to list of ignored channels for UHC")
else:
config['ignore'].remove(ctx.channel.id)
await ctx.send(f"Removed {ctx.channel.name} from list of ignored channels for UHC")
except KeyError:
config['ignore'] = [ctx.channel.id]
await ctx.send(f"Added {ctx.channel.name} to list of ignored channels for UHC")
await hf.dump_json()
def setup(bot):
bot.add_cog(Jpserv(bot))
| [((25, 5, 25, 23), 'discord.ext.commands.command', 'commands.command', ({}, {}), '()', False, 'from discord.ext import commands\n'), ((39, 5, 39, 65), 'discord.ext.commands.group', 'commands.group', (), '', False, 'from discord.ext import commands\n'), ((143, 20, 143, 67), 'copy.deepcopy', 'deepcopy', ({(143, 29, 143, 66): "self.bot.db['ultraHardcore']['users']"}, {}), "(self.bot.db['ultraHardcore']['users'])", False, 'from copy import deepcopy\n'), ((9, 43, 9, 69), 'os.path.realpath', 'os.path.realpath', ({(9, 60, 9, 68): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((93, 48, 93, 60), 'datetime.date.today', 'date.today', ({}, {}), '()', False, 'from datetime import date, datetime, timedelta\n'), ((146, 36, 146, 52), 'datetime.datetime.today', 'datetime.today', ({}, {}), '()', False, 'from datetime import date, datetime, timedelta\n'), ((146, 55, 146, 101), 'datetime.datetime.strptime', 'datetime.strptime', ({(146, 73, 146, 88): 'time_dict[i][1]', (146, 90, 146, 100): '"""%Y/%m/%d"""'}, {}), "(time_dict[i][1], '%Y/%m/%d')", False, 'from datetime import date, datetime, timedelta\n')] |
psifertex/nehebn2 | nehebn2.py | 8b62a88a9d06624dbb62b8b74cc0566172fba970 | #!/usr/bin/env python3
from components import ProgramState
import binaryninja as binja
import argparse
import os.path
import curses
# TODO...impliment live-refreashing the settings.json during run (add the keybinding and check for it here in the global input loop)
# TODO...support multi-key presses? Not sure if this already works or not
# TODO...make sure to support small terminals (I think it does right now, but I should add some more checks so nothing goes out of bounds)
def main(stdscr):
# Setup
parser = argparse.ArgumentParser(description='Nearly Headless BinaryNinja.')
parser.add_argument('filename', nargs='?', default="")
args = parser.parse_args()
program = ''
if not args.filename == "":
if os.path.isfile(args.filename):
bv = binja.BinaryViewType.get_view_of_file(''.join(args.filename), False)
bv.update_analysis()
while not str(bv.analysis_progress) == "Idle":
prog = bv.analysis_progress
stdscr.erase()
stdscr.border()
state = ''
if prog.state == binja.AnalysisState.DisassembleState:
state = "Disassembling"
else:
state = "Analyzing"
loadingText = "Loading File: "
prog = int((prog.count/(prog.total+1))*34.0)
stdscr.addstr(2, 4, loadingText)
stdscr.addstr(2, 4 + len(loadingText), state)
stdscr.addstr(4, 4, '[' + '#'*prog + ' '*(34-prog) + ']')
stdscr.refresh()
program = ProgramState(stdscr, bv)
else:
raise IOError("File does not exist.")
else:
program = ProgramState(stdscr)
key = ""
while program.is_running:
# Input Filtering
try:
key = stdscr.getkey()
except curses.error as err:
if not str(err) == "no input":
raise curses.error(str(err))
else:
key = "" # Clear Key Buffer
# Rendering and input
program.parseInput(key)
program.render()
curses.doupdate()
if __name__ == "__main__":
background = "2a2a2a"
text = "e0e0e0"
curses.wrapper(main)
| [((15, 11, 15, 78), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (), '', False, 'import argparse\n'), ((69, 2, 69, 22), 'curses.wrapper', 'curses.wrapper', ({(69, 17, 69, 21): 'main'}, {}), '(main)', False, 'import curses\n'), ((47, 14, 47, 34), 'components.ProgramState', 'ProgramState', ({(47, 27, 47, 33): 'stdscr'}, {}), '(stdscr)', False, 'from components import ProgramState\n'), ((63, 4, 63, 21), 'curses.doupdate', 'curses.doupdate', ({}, {}), '()', False, 'import curses\n'), ((43, 16, 43, 40), 'components.ProgramState', 'ProgramState', ({(43, 29, 43, 35): 'stdscr', (43, 37, 43, 39): 'bv'}, {}), '(stdscr, bv)', False, 'from components import ProgramState\n')] |
itsraina/keras | keras/layers/pooling/base_pooling3d.py | 5e9376b5b94b6fb445dd52dbfafbc4e95bff5e35 | # Copyright 2015 The TensorFlow 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.
# ==============================================================================
"""Private base class for pooling 3D layers."""
import tensorflow.compat.v2 as tf
from keras import backend
from keras.engine.base_layer import Layer
from keras.engine.input_spec import InputSpec
from keras.utils import conv_utils
class Pooling3D(Layer):
"""Pooling layer for arbitrary pooling functions, for 3D inputs.
This class only exists for code reuse. It will never be an exposed API.
Args:
pool_function: The pooling function to apply, e.g. `tf.nn.max_pool2d`.
pool_size: An integer or tuple/list of 3 integers:
(pool_depth, pool_height, pool_width)
specifying the size of the pooling window.
Can be a single integer to specify the same value for
all spatial dimensions.
strides: An integer or tuple/list of 3 integers,
specifying the strides of the pooling operation.
Can be a single integer to specify the same value for
all spatial dimensions.
padding: A string. The padding method, either 'valid' or 'same'.
Case-insensitive.
data_format: A string, one of `channels_last` (default) or
`channels_first`.
The ordering of the dimensions in the inputs.
`channels_last` corresponds to inputs with shape
`(batch, depth, height, width, channels)`
while `channels_first` corresponds to
inputs with shape `(batch, channels, depth, height, width)`.
name: A string, the name of the layer.
"""
def __init__(
self,
pool_function,
pool_size,
strides,
padding="valid",
data_format="channels_last",
name=None,
**kwargs
):
super().__init__(name=name, **kwargs)
if data_format is None:
data_format = backend.image_data_format()
if strides is None:
strides = pool_size
self.pool_function = pool_function
self.pool_size = conv_utils.normalize_tuple(pool_size, 3, "pool_size")
self.strides = conv_utils.normalize_tuple(
strides, 3, "strides", allow_zero=True
)
self.padding = conv_utils.normalize_padding(padding)
self.data_format = conv_utils.normalize_data_format(data_format)
self.input_spec = InputSpec(ndim=5)
def call(self, inputs):
pool_shape = (1,) + self.pool_size + (1,)
strides = (1,) + self.strides + (1,)
if self.data_format == "channels_first":
# TF does not support `channels_first` with 3D pooling operations,
# so we must handle this case manually.
# TODO(fchollet): remove this when TF pooling is feature-complete.
inputs = tf.transpose(inputs, (0, 2, 3, 4, 1))
outputs = self.pool_function(
inputs,
ksize=pool_shape,
strides=strides,
padding=self.padding.upper(),
)
if self.data_format == "channels_first":
outputs = tf.transpose(outputs, (0, 4, 1, 2, 3))
return outputs
def compute_output_shape(self, input_shape):
input_shape = tf.TensorShape(input_shape).as_list()
if self.data_format == "channels_first":
len_dim1 = input_shape[2]
len_dim2 = input_shape[3]
len_dim3 = input_shape[4]
else:
len_dim1 = input_shape[1]
len_dim2 = input_shape[2]
len_dim3 = input_shape[3]
len_dim1 = conv_utils.conv_output_length(
len_dim1, self.pool_size[0], self.padding, self.strides[0]
)
len_dim2 = conv_utils.conv_output_length(
len_dim2, self.pool_size[1], self.padding, self.strides[1]
)
len_dim3 = conv_utils.conv_output_length(
len_dim3, self.pool_size[2], self.padding, self.strides[2]
)
if self.data_format == "channels_first":
return tf.TensorShape(
[input_shape[0], input_shape[1], len_dim1, len_dim2, len_dim3]
)
else:
return tf.TensorShape(
[input_shape[0], len_dim1, len_dim2, len_dim3, input_shape[4]]
)
def get_config(self):
config = {
"pool_size": self.pool_size,
"padding": self.padding,
"strides": self.strides,
"data_format": self.data_format,
}
base_config = super().get_config()
return dict(list(base_config.items()) + list(config.items()))
| [((70, 25, 70, 78), 'keras.utils.conv_utils.normalize_tuple', 'conv_utils.normalize_tuple', ({(70, 52, 70, 61): 'pool_size', (70, 63, 70, 64): '3', (70, 66, 70, 77): '"""pool_size"""'}, {}), "(pool_size, 3, 'pool_size')", False, 'from keras.utils import conv_utils\n'), ((71, 23, 73, 9), 'keras.utils.conv_utils.normalize_tuple', 'conv_utils.normalize_tuple', (), '', False, 'from keras.utils import conv_utils\n'), ((74, 23, 74, 60), 'keras.utils.conv_utils.normalize_padding', 'conv_utils.normalize_padding', ({(74, 52, 74, 59): 'padding'}, {}), '(padding)', False, 'from keras.utils import conv_utils\n'), ((75, 27, 75, 72), 'keras.utils.conv_utils.normalize_data_format', 'conv_utils.normalize_data_format', ({(75, 60, 75, 71): 'data_format'}, {}), '(data_format)', False, 'from keras.utils import conv_utils\n'), ((76, 26, 76, 43), 'keras.engine.input_spec.InputSpec', 'InputSpec', (), '', False, 'from keras.engine.input_spec import InputSpec\n'), ((109, 19, 111, 9), 'keras.utils.conv_utils.conv_output_length', 'conv_utils.conv_output_length', ({(110, 12, 110, 20): 'len_dim1', (110, 22, 110, 39): 'self.pool_size[0]', (110, 41, 110, 53): 'self.padding', (110, 55, 110, 70): 'self.strides[0]'}, {}), '(len_dim1, self.pool_size[0], self.padding,\n self.strides[0])', False, 'from keras.utils import conv_utils\n'), ((112, 19, 114, 9), 'keras.utils.conv_utils.conv_output_length', 'conv_utils.conv_output_length', ({(113, 12, 113, 20): 'len_dim2', (113, 22, 113, 39): 'self.pool_size[1]', (113, 41, 113, 53): 'self.padding', (113, 55, 113, 70): 'self.strides[1]'}, {}), '(len_dim2, self.pool_size[1], self.padding,\n self.strides[1])', False, 'from keras.utils import conv_utils\n'), ((115, 19, 117, 9), 'keras.utils.conv_utils.conv_output_length', 'conv_utils.conv_output_length', ({(116, 12, 116, 20): 'len_dim3', (116, 22, 116, 39): 'self.pool_size[2]', (116, 41, 116, 53): 'self.padding', (116, 55, 116, 70): 'self.strides[2]'}, {}), '(len_dim3, self.pool_size[2], self.padding,\n self.strides[2])', False, 'from keras.utils import conv_utils\n'), ((66, 26, 66, 53), 'keras.backend.image_data_format', 'backend.image_data_format', ({}, {}), '()', False, 'from keras import backend\n'), ((86, 21, 86, 58), 'tensorflow.compat.v2.transpose', 'tf.transpose', ({(86, 34, 86, 40): 'inputs', (86, 42, 86, 57): '(0, 2, 3, 4, 1)'}, {}), '(inputs, (0, 2, 3, 4, 1))', True, 'import tensorflow.compat.v2 as tf\n'), ((96, 22, 96, 60), 'tensorflow.compat.v2.transpose', 'tf.transpose', ({(96, 35, 96, 42): 'outputs', (96, 44, 96, 59): '(0, 4, 1, 2, 3)'}, {}), '(outputs, (0, 4, 1, 2, 3))', True, 'import tensorflow.compat.v2 as tf\n'), ((119, 19, 121, 13), 'tensorflow.compat.v2.TensorShape', 'tf.TensorShape', ({(120, 16, 120, 78): '[input_shape[0], input_shape[1], len_dim1, len_dim2, len_dim3]'}, {}), '([input_shape[0], input_shape[1], len_dim1, len_dim2, len_dim3])', True, 'import tensorflow.compat.v2 as tf\n'), ((123, 19, 125, 13), 'tensorflow.compat.v2.TensorShape', 'tf.TensorShape', ({(124, 16, 124, 78): '[input_shape[0], len_dim1, len_dim2, len_dim3, input_shape[4]]'}, {}), '([input_shape[0], len_dim1, len_dim2, len_dim3, input_shape[4]])', True, 'import tensorflow.compat.v2 as tf\n'), ((100, 22, 100, 49), 'tensorflow.compat.v2.TensorShape', 'tf.TensorShape', ({(100, 37, 100, 48): 'input_shape'}, {}), '(input_shape)', True, 'import tensorflow.compat.v2 as tf\n')] |
lucastan96/video2bitmap | main.py | 8a54f33af92b5088d29322abf936a6ce2ecc0ac4 | import moviepy.editor as mpy
import moviepy.video.fx.all as vfx
import subprocess as sp
# Crop and resize video
clip = mpy.VideoFileClip("smoke.mp4")
(w, h) = clip.size
cropped_clip = vfx.crop(clip, width=(h/128)*64, height=h, x1=w/4*3-100, y1=0).resize((64, 128))
cropped_clip.write_videofile('smoke-cropped.mp4')
# Convert video to frames
# Make sure to install ffmpeg on machine
cmd='ffmpeg -i /path/to/smoke-cropped.mp4 /path/to/frames_temp/%d.bmp'
sp.call(cmd,shell=True)
# Convert image to black and white bitmap
for i in range(202):
col = Image.open("frames_temp/" + str(i + 1) + ".bmp")
gray = col.convert('L')
bw = gray.point(lambda x: 0 if x<128 else 255, '1')
bw.save("frames/" + str(i) + ".bmp") | [((6, 7, 6, 37), 'moviepy.editor.VideoFileClip', 'mpy.VideoFileClip', ({(6, 25, 6, 36): '"""smoke.mp4"""'}, {}), "('smoke.mp4')", True, 'import moviepy.editor as mpy\n'), ((14, 0, 14, 23), 'subprocess.call', 'sp.call', (), '', True, 'import subprocess as sp\n'), ((8, 15, 8, 77), 'moviepy.video.fx.all.crop', 'vfx.crop', (), '', True, 'import moviepy.video.fx.all as vfx\n')] |
bbhunter/Ghostwriter | ghostwriter/rolodex/apps.py | 1b684ddd119feed9891e83b39c9b314b41d086ca | """This contains the configuration of the Rolodex application."""
# Django Imports
from django.apps import AppConfig
class RolodexConfig(AppConfig):
name = "ghostwriter.rolodex"
def ready(self):
try:
import ghostwriter.rolodex.signals # noqa F401 isort:skip
except ImportError:
pass
| [] |
oscarsiles/jotlet | boards/migrations/0024_boardpreferences_moderators.py | 361f7ad0d32ea96d012020a67493931482207036 | # Generated by Django 4.0.3 on 2022-03-01 14:42
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('boards', '0023_alter_image_type'),
]
operations = [
migrations.AddField(
model_name='boardpreferences',
name='moderators',
field=models.ManyToManyField(blank=True, related_name='moderated_boards', to=settings.AUTH_USER_MODEL),
),
]
| [((10, 8, 10, 65), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', ({(10, 40, 10, 64): 'settings.AUTH_USER_MODEL'}, {}), '(settings.AUTH_USER_MODEL)', False, 'from django.db import migrations, models\n'), ((18, 18, 18, 114), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (), '', False, 'from django.db import migrations, models\n')] |
MichalBusta/OpenCitiesAIC | models/minimize_model.py | 2358118a782edde27a588d6adaf79941cbd90de6 | '''
Created on Mar 22, 2020
@author: Michal.Busta at gmail.com
'''
#get rid of the optimizer state ...
import torch
MODEL_PATH = '/models/model-b2-2.pth'
state = torch.load(MODEL_PATH, map_location=lambda storage, loc: storage)
state_out = {
"state_dict": state["state_dict"],
}
torch.save(state_out, 'model-b2-2.pth') | [((10, 8, 10, 73), 'torch.load', 'torch.load', (), '', False, 'import torch\n'), ((16, 0, 16, 39), 'torch.save', 'torch.save', ({(16, 11, 16, 20): 'state_out', (16, 22, 16, 38): '"""model-b2-2.pth"""'}, {}), "(state_out, 'model-b2-2.pth')", False, 'import torch\n')] |
thomas-kloeber/braumeister | setup.py | 1045df0ad95eb6a4b9b16bb91ece64b09ff1b1f7 | import os
import re
from setuptools import setup
version = re.search(
'^__version__\s*=\s*"(.*)"',
open('braumeister/braumeister.py').read(),
re.M
).group(1)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="braumeister",
packages=["braumeister", "braumeister.actions"],
version=version,
author="Marcel Steffen",
author_email="[email protected]",
description="Easy release bulding, combining JIRA and git",
long_description=read('README.md'),
license="MIT",
keywords="git jira release",
url="https://www.talentsconnect.com",
include_package_data=True,
install_requires=['requests', 'colorama'],
entry_points={
'console_scripts': ["braumeister = braumeister.braumeister:main"]
},
python_requires='!=2.7, !=3.4, >=3.5',
zip_safe=False,
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Topic :: Utilities",
"Topic :: Software Development :: Version Control :: Git"
],
)
| [((14, 29, 14, 54), 'os.path.dirname', 'os.path.dirname', ({(14, 45, 14, 53): '__file__'}, {}), '(__file__)', False, 'import os\n')] |
rubelchowdhury20/wuton-with-densepose | modules/inference.py | 5485f1f311724d8f8b887d669a8b55c73849eb98 | # standard library imports
import os
# third party imports
import numpy as np
from PIL import Image
import torch.nn as nn
from torchvision import transforms
# local imports
import config
from . import utils
from . import geometric_transformer
class GeoTransformationInfer(nn.Module):
def __init__(self, output_dir="./output/results"):
super(GeoTransformationInfer, self).__init__()
self.output_dir = output_dir
utils.ensure_folder(self.output_dir)
def forward(self, model_apparel, warped_image, model_image, warped_model_image, random_product_image, random_product_image_warped, output_on_random_product, batch_index, epoch):
batch_size = warped_image.shape[0]
model_apparel = model_apparel.cpu().numpy()
warped_image = warped_image.cpu().numpy()
model_image = model_image.cpu().numpy()
warped_model_image = warped_model_image.cpu().numpy()
random_product_image = random_product_image.cpu().numpy()
random_product_image_warped = random_product_image_warped.cpu().numpy()
output_on_random_product = output_on_random_product.cpu().numpy()
for i in range(batch_size):
self._save_image_sheet(
batch_index*config.PARAMS["batch_size"] + i,
model_apparel[i],
warped_image[i],
model_image[i],
warped_model_image[i],
random_product_image[i],
random_product_image_warped[i],
output_on_random_product[i],
epoch)
def _save_image_sheet(self,
idx,
model_apparel,
warped_image,
model_image,
warped_model_image,
random_product_image,
random_product_image_warped,
output_on_random_product,
epoch):
# inverse normalization of the images along with channel first to channel last steps and finally converting np array to pillow format for saving
model_apparel = np.moveaxis(model_apparel, 0, 2) * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
model_apparel = Image.fromarray(np.uint8(model_apparel * 255))
warped_image = np.moveaxis(warped_image, 0, 2) * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
warped_image = Image.fromarray(np.uint8(warped_image * 255))
model_image = np.moveaxis(model_image, 0, 2) * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
model_image = Image.fromarray(np.uint8(model_image * 255))
warped_model_image = np.moveaxis(warped_model_image, 0, 2) * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
warped_model_image = Image.fromarray(np.uint8(warped_model_image * 255))
random_product_image = np.moveaxis(random_product_image, 0, 2) * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
random_product_image = Image.fromarray(np.uint8(random_product_image * 255))
random_product_image_warped = np.moveaxis(random_product_image_warped, 0, 2) * [0.229, 0.224, 0.225] + (0.485, 0.456, 0.406)
random_product_image_warped = Image.fromarray(np.uint8(random_product_image_warped * 255))
output_on_random_product = np.moveaxis(output_on_random_product, 0, 2) * [0.229, 0.224, 0.225] + [0.485, 0.456, 0.406]
output_on_random_product = Image.fromarray(np.uint8(output_on_random_product * 255))
sheet = Image.new('RGB', (1568, 224), 'white')
sheet.paste(model_apparel, (0, 0))
sheet.paste(warped_image, (224, 0))
sheet.paste(model_image, (448, 0))
sheet.paste(warped_model_image, (672, 0))
sheet.paste(random_product_image, (896, 0))
sheet.paste(random_product_image_warped, (1120, 0))
sheet.paste(output_on_random_product, (1344, 0))
sheet.save(os.path.join(self.output_dir, "image_sheet_{}-epoch{}".format(idx, str(epoch).zfill(3)) + ".jpg"))
| [((75, 10, 75, 48), 'PIL.Image.new', 'Image.new', ({(75, 20, 75, 25): '"""RGB"""', (75, 27, 75, 38): '(1568, 224)', (75, 40, 75, 47): '"""white"""'}, {}), "('RGB', (1568, 224), 'white')", False, 'from PIL import Image\n'), ((61, 34, 61, 63), 'numpy.uint8', 'np.uint8', ({(61, 43, 61, 62): 'model_apparel * 255'}, {}), '(model_apparel * 255)', True, 'import numpy as np\n'), ((63, 33, 63, 61), 'numpy.uint8', 'np.uint8', ({(63, 42, 63, 60): 'warped_image * 255'}, {}), '(warped_image * 255)', True, 'import numpy as np\n'), ((65, 32, 65, 59), 'numpy.uint8', 'np.uint8', ({(65, 41, 65, 58): 'model_image * 255'}, {}), '(model_image * 255)', True, 'import numpy as np\n'), ((67, 39, 67, 73), 'numpy.uint8', 'np.uint8', ({(67, 48, 67, 72): 'warped_model_image * 255'}, {}), '(warped_model_image * 255)', True, 'import numpy as np\n'), ((69, 41, 69, 77), 'numpy.uint8', 'np.uint8', ({(69, 50, 69, 76): 'random_product_image * 255'}, {}), '(random_product_image * 255)', True, 'import numpy as np\n'), ((71, 48, 71, 91), 'numpy.uint8', 'np.uint8', ({(71, 57, 71, 90): 'random_product_image_warped * 255'}, {}), '(random_product_image_warped * 255)', True, 'import numpy as np\n'), ((73, 45, 73, 85), 'numpy.uint8', 'np.uint8', ({(73, 54, 73, 84): 'output_on_random_product * 255'}, {}), '(output_on_random_product * 255)', True, 'import numpy as np\n'), ((60, 18, 60, 50), 'numpy.moveaxis', 'np.moveaxis', ({(60, 30, 60, 43): 'model_apparel', (60, 45, 60, 46): '(0)', (60, 48, 60, 49): '(2)'}, {}), '(model_apparel, 0, 2)', True, 'import numpy as np\n'), ((62, 17, 62, 48), 'numpy.moveaxis', 'np.moveaxis', ({(62, 29, 62, 41): 'warped_image', (62, 43, 62, 44): '(0)', (62, 46, 62, 47): '(2)'}, {}), '(warped_image, 0, 2)', True, 'import numpy as np\n'), ((64, 16, 64, 46), 'numpy.moveaxis', 'np.moveaxis', ({(64, 28, 64, 39): 'model_image', (64, 41, 64, 42): '(0)', (64, 44, 64, 45): '(2)'}, {}), '(model_image, 0, 2)', True, 'import numpy as np\n'), ((66, 23, 66, 60), 'numpy.moveaxis', 'np.moveaxis', ({(66, 35, 66, 53): 'warped_model_image', (66, 55, 66, 56): '(0)', (66, 58, 66, 59): '(2)'}, {}), '(warped_model_image, 0, 2)', True, 'import numpy as np\n'), ((68, 25, 68, 64), 'numpy.moveaxis', 'np.moveaxis', ({(68, 37, 68, 57): 'random_product_image', (68, 59, 68, 60): '(0)', (68, 62, 68, 63): '(2)'}, {}), '(random_product_image, 0, 2)', True, 'import numpy as np\n'), ((70, 32, 70, 78), 'numpy.moveaxis', 'np.moveaxis', ({(70, 44, 70, 71): 'random_product_image_warped', (70, 73, 70, 74): '(0)', (70, 76, 70, 77): '(2)'}, {}), '(random_product_image_warped, 0, 2)', True, 'import numpy as np\n'), ((72, 29, 72, 72), 'numpy.moveaxis', 'np.moveaxis', ({(72, 41, 72, 65): 'output_on_random_product', (72, 67, 72, 68): '(0)', (72, 70, 72, 71): '(2)'}, {}), '(output_on_random_product, 0, 2)', True, 'import numpy as np\n')] |
p-lambda/unlabeled_outputs | imggen/fonts.py | 18cda9e922591ec99d70caaa173abbb049ef274b | from pathlib import Path
import h5py
import numpy as np
from torchvision.datasets.vision import VisionDataset
from PIL import Image
import requests
import zipfile
from tqdm import tqdm
def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params = { 'id' : id }, stream = True)
token = get_confirm_token(response)
if token:
params = { 'id' : id, 'confirm' : token }
response = session.get(URL, params = params, stream = True)
save_response_content(response, destination)
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
def save_response_content(response, destination):
CHUNK_SIZE = 32768
with open(destination, "wb") as f:
for chunk in tqdm(response.iter_content(CHUNK_SIZE)):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
class Fonts(VisionDataset):
url_id = '0B0GtwTQ6IF9AU3NOdzFzUWZ0aDQ'
base_folder = 'fonts'
def __init__(self, root, split='train',
transform=None, target_transform=None, download=True,
denoise=False, denoise_transform=None, num_fonts_pi=None,
num_examples=2500):
'''
Args:
root (str): path
num_train_domains (int): number of train domains up to 41443
test_mean_chars (bool): Use the mean characters as test set
split (str): 'train', 'val', 'test'
transform: input transformation
target_transform: target transformation
download (bool): download or not
'''
super().__init__(root, transform=transform, target_transform=target_transform)
self.split = split
self.transform = transform
self.target_transform = target_transform
self.denoise = denoise
self.denoise_transform = denoise_transform
self.path = Path(self.root) / self.base_folder
self.path.mkdir(parents=True, exist_ok=True)
self.download_path = self.path / 'fonts.hdf5'
if download:
self.download()
with h5py.File(str(self.download_path), 'r') as f:
data_by_domain = f['fonts'][()]
np.random.seed(484347)
# limit the number of fonts
num_fonts = 100
font_idxs = np.arange(len(data_by_domain))
np.random.shuffle(font_idxs)
if not denoise:
data_by_domain = data_by_domain[font_idxs[:num_fonts]]
print(f"NUM FONTS: {num_fonts}")
print(f"NUM CHARS: {data_by_domain.shape[1]}")
num_classes = data_by_domain.shape[1]
self.all_targets = np.concatenate(
[np.arange(num_classes)]*num_fonts, axis=0)
self.all_domain_labels = np.repeat(np.arange(num_fonts), num_classes)
self.all_data = data_by_domain.reshape(data_by_domain.shape[0]*data_by_domain.shape[1], data_by_domain.shape[2], data_by_domain.shape[3])
idxs = np.arange(len(self.all_data))
np.random.shuffle(idxs)
train_val_max = 2600
if num_examples > train_val_max:
# to be able to heuristically test what happens if we have more training data
train_val_max = 5000
if split == 'train':
idxs = idxs[:num_examples]
elif split == 'val':
idxs = idxs[num_examples: train_val_max]
else:
idxs = idxs[train_val_max:]
self.targets = self.all_targets[idxs]
self.domain_labels = self.all_domain_labels[idxs]
self.data = self.all_data[idxs]
else:
# get the train data
train_dbd = data_by_domain[font_idxs[:num_fonts]]
all_data = train_dbd.reshape(train_dbd.shape[0]*train_dbd.shape[1], train_dbd.shape[2], train_dbd.shape[3])
idxs = np.arange(len(all_data))
np.random.shuffle(idxs)
idxs = idxs[:num_examples]
train_data = all_data[idxs]
if num_fonts_pi is not None:
data_by_domain = data_by_domain[font_idxs[num_fonts:num_fonts+num_fonts_pi]]
else:
data_by_domain = data_by_domain[font_idxs[num_fonts:]]
self.data = data_by_domain.reshape(data_by_domain.shape[0]*data_by_domain.shape[1], data_by_domain.shape[2], data_by_domain.shape[3])
self.data = np.concatenate([train_data, self.data], axis=0)
def get_nearest_neighbor(self, all_imgs, x):
idx = np.argmin(np.sum(np.square(all_imgs - x), axis=(1,2)))
return self[idx]
def download(self):
if not self.download_path.exists():
download_file_from_google_drive(self.url_id, str(self.download_path))
def __getitem__(self, index):
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target class.
"""
if self.denoise:
img = self.data[index]
img = Image.fromarray(img)
if self.transform is not None:
tgt_img = self.transform(img)
if self.denoise_transform is not None:
src_img = self.denoise_transform(img)
return src_img, tgt_img
else:
img, target = self.data[index], self.targets[index]
domain_label = self.domain_labels[index]
# doing this so that it is consistent with all other datasets
# to return a PIL Image
img = Image.fromarray(img)
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target, domain_label
def get_item_from_all(self, index):
img, target = self.all_data[index], self.all_targets[index]
domain_label = self.all_domain_labels[index]
# doing this so that it is consistent with all other datasets
# to return a PIL Image
img = Image.fromarray(img)
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target, domain_label
def __len__(self):
return len(self.data)
| [((15, 14, 15, 32), 'requests.Session', 'requests.Session', ({}, {}), '()', False, 'import requests\n'), ((77, 8, 77, 30), 'numpy.random.seed', 'np.random.seed', ({(77, 23, 77, 29): '(484347)'}, {}), '(484347)', True, 'import numpy as np\n'), ((81, 8, 81, 36), 'numpy.random.shuffle', 'np.random.shuffle', ({(81, 26, 81, 35): 'font_idxs'}, {}), '(font_idxs)', True, 'import numpy as np\n'), ((171, 14, 171, 34), 'PIL.Image.fromarray', 'Image.fromarray', ({(171, 30, 171, 33): 'img'}, {}), '(img)', False, 'from PIL import Image\n'), ((67, 20, 67, 35), 'pathlib.Path', 'Path', ({(67, 25, 67, 34): 'self.root'}, {}), '(self.root)', False, 'from pathlib import Path\n'), ((95, 12, 95, 35), 'numpy.random.shuffle', 'np.random.shuffle', ({(95, 30, 95, 34): 'idxs'}, {}), '(idxs)', True, 'import numpy as np\n'), ((114, 12, 114, 35), 'numpy.random.shuffle', 'np.random.shuffle', ({(114, 30, 114, 34): 'idxs'}, {}), '(idxs)', True, 'import numpy as np\n'), ((123, 24, 123, 71), 'numpy.concatenate', 'np.concatenate', (), '', True, 'import numpy as np\n'), ((143, 18, 143, 38), 'PIL.Image.fromarray', 'Image.fromarray', ({(143, 34, 143, 37): 'img'}, {}), '(img)', False, 'from PIL import Image\n'), ((155, 18, 155, 38), 'PIL.Image.fromarray', 'Image.fromarray', ({(155, 34, 155, 37): 'img'}, {}), '(img)', False, 'from PIL import Image\n'), ((91, 47, 91, 67), 'numpy.arange', 'np.arange', ({(91, 57, 91, 66): 'num_fonts'}, {}), '(num_fonts)', True, 'import numpy as np\n'), ((126, 31, 126, 54), 'numpy.square', 'np.square', ({(126, 41, 126, 53): 'all_imgs - x'}, {}), '(all_imgs - x)', True, 'import numpy as np\n'), ((90, 17, 90, 39), 'numpy.arange', 'np.arange', ({(90, 27, 90, 38): 'num_classes'}, {}), '(num_classes)', True, 'import numpy as np\n')] |
windniw/just-for-fun | leetcode/47.py | 54e5c2be145f3848811bfd127f6a89545e921570 | """
link: https://leetcode.com/problems/permutations-ii
problem: 求全排列,nums中存在重复数
solution: 同46,加上排序即可
"""
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
if len(nums) == 1:
return [nums]
new_nums = nums.copy()
new_nums.sort()
res = []
for i in range(0, len(new_nums)):
if i + 1 < len(new_nums) and new_nums[i] == new_nums[i + 1]:
continue
new_nums[i], new_nums[0] = new_nums[0], new_nums[i]
sub_result = self.permuteUnique(new_nums[1:])
for r in sub_result:
res.append([new_nums[0]] + r.copy())
new_nums[i], new_nums[0] = new_nums[0], new_nums[i]
return res
| [] |
IamMayankThakur/test-bigdata | adminmgr/media/code/A3/task3/T1_ocefXVJ.py | cef633eb394419b955bdce479699d0115d8f99c3 | import findspark
findspark.init()
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
def tmp(x):
y = (x.split(';')[7]).split(',')
return (y)
def forf(x):
for i in x:
yield (i,1)
def topprint(time,rdd):
res1=rdd.take(5)
count=0
for i in res1:
if(count==4):
print("%s" % i)
else:
print("%s" % i,end=',')
count = count +1
conf=SparkConf()
conf.setAppName("BigData")
sc=SparkContext(conf=conf)
ssc=StreamingContext(sc,int(sys.argv[1]))
ssc.checkpoint("/checkpoint_BIGDATA")
'''
#Selecting a window :
#outpu3:
inputStream=ssc.socketTextStream("localhost",9009)
dataStream = inputStream.window(int(sys.argv[1]),int(sys.argv[2]))
tweet=dataStream.map(tmp)
septweet=tweet.flatMap(forf)
count=septweet.reduceByKey(lambda x,y:x+y)
sortcount = count.transform(lambda rdd :rdd.sortBy(lambda a:a[1],ascending=False))
tweet1=sortcount.filter(lambda w:w[0] is not '')
tweet1.pprint()
res = tweet1.map(lambda a : a[0])
res.foreachRDD(topprint)
#res.pprint(3)
'''
'''
#Selecting a datastream and then reducing by window:
#outpu2
dataStream=ssc.socketTextStream("localhost",9009)
tweet=dataStream.map(tmp)
septweet=tweet.flatMap(forf)
#septweet.pprint()
count=septweet.reduceByKeyAndWindow(lambda x,y:x+y,int(sys.argv[1]),int(sys.argv[2]))
sortcount = count.transform(lambda rdd :rdd.sortBy(lambda a:a[0],ascending=True))
sortcount = count.transform(lambda rdd :rdd.sortBy(lambda a:a[1],ascending=False))
tweet1=sortcount.filter(lambda w:w[0] is not '')
#tweet1.pprint()
res = tweet1.map(lambda a : a[0])
res.foreachRDD(topprint)
'''
#Try in outpu1
inputStream=ssc.socketTextStream("localhost",9009)
dataStream = inputStream.window(int(sys.argv[2]),int(sys.argv[1]))
tweet=dataStream.map(tmp)
septweet=tweet.flatMap(forf)
count=septweet.reduceByKey(lambda x,y:x+y)
sortcount = count.transform(lambda rdd :rdd.sortBy(lambda a:a[0],ascending=True))
sortcount = sortcount.transform(lambda rdd :rdd.sortBy(lambda a:a[1],ascending=False))
tweet1=sortcount.filter(lambda w:w[0] is not '')
#tweet1.pprint()
res = tweet1.map(lambda a : a[0])
res.foreachRDD(topprint)
#TO maintain state
# totalcount=tweet.updateStateByKey(aggregate_tweets_count)
# totalcount.pprint()
#To Perform operation on each RDD
# totalcount.foreachRDD(process_rdd)
ssc.start()
ssc.awaitTermination(25)
ssc.stop()
| [((2, 0, 2, 16), 'findspark.init', 'findspark.init', ({}, {}), '()', False, 'import findspark\n'), ((31, 5, 31, 16), 'pyspark.SparkConf', 'SparkConf', ({}, {}), '()', False, 'from pyspark import SparkConf, SparkContext\n'), ((33, 3, 33, 26), 'pyspark.SparkContext', 'SparkContext', (), '', False, 'from pyspark import SparkConf, SparkContext\n')] |
antonnifo/E-Soma | courses/migrations/0003_alter_content_options_alter_module_options_and_more.py | 93d49b27dedbff58d19f8245a79693762fc819d5 | # Generated by Django 4.0.1 on 2022-01-20 13:10
import courses.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0002_video_text_image_file_content'),
]
operations = [
migrations.AlterModelOptions(
name='content',
options={'ordering': ['order']},
),
migrations.AlterModelOptions(
name='module',
options={'ordering': ['order']},
),
migrations.AddField(
model_name='content',
name='order',
field=courses.fields.OrderField(blank=True, default=0),
preserve_default=False,
),
migrations.AddField(
model_name='module',
name='order',
field=courses.fields.OrderField(blank=True, default=0),
preserve_default=False,
),
]
| [((14, 8, 17, 9), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', (), '', False, 'from django.db import migrations\n'), ((18, 8, 21, 9), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', (), '', False, 'from django.db import migrations\n')] |
prateekdegaons1991/experiment-loadtest | pkg/maths/maths.py | b53c70fac5b2f7d37df77844b26f79741c74c1b6 | #Atoi stands for ASCII to Integer Conversion
def atoi(string):
res = 0
# Iterate through all characters of
# input and update result
for i in range(len(string)):
res = res * 10 + (ord(string[i]) - ord('0'))
return res
#Adjustment contains rule of three for calculating an integer given another integer representing a percentage
def Adjustment(a, b):
return (a * b) / 100
| [] |
redoxdrh/GCP-Flask | google_compute_engine/config_manager.py | 34af307df541edca4eee58b1d8be64888550a674 | #!/usr/bin/python
# Copyright 2016 Google Inc. 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.
"""A library for retrieving and modifying configuration settings."""
import os
import textwrap
from google_compute_engine import file_utils
from google_compute_engine.compat import parser
CONFIG = '/etc/default/instance_configs.cfg'
class ConfigManager(object):
"""Process the configuration defaults."""
def __init__(self, config_file=None, config_header=None):
"""Constructor.
Args:
config_file: string, the location of the config file.
config_header: string, the message to write at the top of the config.
"""
self.config_file = config_file or CONFIG
self.config_header = config_header
self.config = parser.SafeConfigParser()
self.config.read(self.config_file)
def _AddHeader(self, fp):
"""Create a file header in the config.
Args:
fp: int, a file pointer for writing the header.
"""
text = textwrap.wrap(
textwrap.dedent(self.config_header), break_on_hyphens=False)
fp.write('\n'.join(['# ' + line for line in text]))
fp.write('\n\n')
def GetOptionString(self, section, option):
"""Get the value of an option in the config file.
Args:
section: string, the section of the config file to check.
option: string, the option to retrieve the value of.
Returns:
string, the value of the option or None if the option doesn't exist.
"""
if self.config.has_option(section, option):
return self.config.get(section, option)
else:
return None
def GetOptionBool(self, section, option):
"""Get the value of an option in the config file.
Args:
section: string, the section of the config file to check.
option: string, the option to retrieve the value of.
Returns:
bool, True if the option is enabled or not set.
"""
return (not self.config.has_option(section, option) or
self.config.getboolean(section, option))
def SetOption(self, section, option, value, overwrite=True):
"""Set the value of an option in the config file.
Args:
section: string, the section of the config file to check.
option: string, the option to set the value of.
value: string, the value to set the option.
overwrite: bool, True to overwrite an existing value in the config file.
"""
if not overwrite and self.config.has_option(section, option):
return
if not self.config.has_section(section):
self.config.add_section(section)
self.config.set(section, option, str(value))
def WriteConfig(self, config_file=None):
"""Write the config values to a given file.
Args:
config_file: string, the file location of the config file to write.
"""
config_file = config_file or self.config_file
config_name = os.path.splitext(os.path.basename(config_file))[0]
config_lock = '/var/lock/google_%s.lock' % config_name
with file_utils.LockFile(config_lock):
with open(config_file, 'w') as config_fp:
if self.config_header:
self._AddHeader(config_fp)
self.config.write(config_fp)
| [((39, 18, 39, 43), 'google_compute_engine.compat.parser.SafeConfigParser', 'parser.SafeConfigParser', ({}, {}), '()', False, 'from google_compute_engine.compat import parser\n'), ((49, 8, 49, 43), 'textwrap.dedent', 'textwrap.dedent', ({(49, 24, 49, 42): 'self.config_header'}, {}), '(self.config_header)', False, 'import textwrap\n'), ((105, 9, 105, 41), 'google_compute_engine.file_utils.LockFile', 'file_utils.LockFile', ({(105, 29, 105, 40): 'config_lock'}, {}), '(config_lock)', False, 'from google_compute_engine import file_utils\n'), ((103, 35, 103, 64), 'os.path.basename', 'os.path.basename', ({(103, 52, 103, 63): 'config_file'}, {}), '(config_file)', False, 'import os\n')] |
e-mayo/mscreen | mscreen/autodocktools_prepare_py3k/mglutil/web/services/AppService_services.py | a50f0b2f7104007c730baa51b4ec65c891008c47 | ##################################################
# ./AppService_services.py
# generated by ZSI.wsdl2python
#
#
##################################################
from .AppService_services_types import *
from .AppService_services_types import \
nbcr_sdsc_edu_opal_types as ns1
import urllib.parse, types
from ZSI.TCcompound import Struct
from ZSI import client
import ZSI
class AppServiceInterface:
def getAppServicePortType(self, portAddress=None, **kw):
raise NonImplementationError("method not implemented")
class AppServiceLocator(AppServiceInterface):
AppServicePortType_address = "https://rocks-106.sdsc.edu:8443/axis/services/AutogridServicePort"
def getAppServicePortTypeAddress(self):
return AppServiceLocator.AppServicePortType_address
def getAppServicePortType(self, portAddress=None, **kw):
return AppServicePortSoapBindingSOAP(portAddress or AppServiceLocator.AppServicePortType_address, **kw)
class AppServicePortSoapBindingSOAP:
def __init__(self, addr, **kw):
netloc = (urllib.parse.urlparse(addr)[1]).split(":") + [80,]
if "host" not in kw:
kw["host"] = netloc[0]
if "port" not in kw:
kw["port"] = int(netloc[1])
if "url" not in kw:
kw["url"] = urllib.parse.urlparse(addr)[2]
self.binding = client.Binding(**kw)
def destroy(self, request):
"""
@param: request is str
@return: response from destroyResponse::
_destroyOutput: ns1.StatusOutputType_Def
_baseURL: str
_code: int
_message: str
"""
if not isinstance(request, str):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {'requestclass': destroyRequestWrapper}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/destroy", **kw)
response = self.binding.Receive(destroyResponseWrapper())
if not isinstance(response, destroyResponse) and\
not issubclass(destroyResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def getAppConfig(self, request):
"""
@param: request to getAppConfigRequest
@return: response from getAppConfigResponse::
_getAppConfigOutput: ns1.AppConfigType_Def
_binaryLocation: str
_defaultArgs: str, optional
_metadata: ns1.AppMetadataType_Def
_info: str, optional
_types: ns1.ArgumentsType_Def, optional
_flags: ns1.FlagsArrayType_Def, optional
_flag: ns1.FlagsType_Def, optional
_id: str
_tag: str
_textDesc: str, optional
_implicitParams: ns1.ImplicitParamsArrayType_Def, optional
_param: ns1.ImplicitParamsType_Def, optional
_extension: str, optional
_id: str
_ioType: ns1.IOType_Def
_IOType: str, optional
_max: int, optional
_min: int, optional
_name: str, optional
_required: boolean, optional
_semanticType: str, optional
_textDesc: str, optional
_taggedParams: ns1.ParamsArrayType_Def, optional
_param: ns1.ParamsType_Def, optional
_id: str
_ioType: ns1.IOType_Def, optional
_paramType: ns1.ParamType_Def
_ParamType: str, optional
_required: boolean, optional
_semanticType: str, optional
_tag: str, optional
_textDesc: str, optional
_value: str, optional
_separator: str, optional
_untaggedParams: ns1.ParamsArrayType_Def, optional
_usage: str
_parallel: boolean
"""
if not isinstance(request, getAppConfigRequest) and\
not issubclass(getAppConfigRequest, request.__class__):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/getAppConfig", **kw)
response = self.binding.Receive(getAppConfigResponseWrapper())
if not isinstance(response, getAppConfigResponse) and\
not issubclass(getAppConfigResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def getAppMetadata(self, request):
"""
@param: request to getAppMetadataRequest
@return: response from getAppMetadataResponse::
_getAppMetadataOutput: ns1.AppMetadataType_Def
_info: str, optional
_types: ns1.ArgumentsType_Def, optional
_flags: ns1.FlagsArrayType_Def, optional
_flag: ns1.FlagsType_Def, optional
_id: str
_tag: str
_textDesc: str, optional
_implicitParams: ns1.ImplicitParamsArrayType_Def, optional
_param: ns1.ImplicitParamsType_Def, optional
_extension: str, optional
_id: str
_ioType: ns1.IOType_Def
_IOType: str, optional
_max: int, optional
_min: int, optional
_name: str, optional
_required: boolean, optional
_semanticType: str, optional
_textDesc: str, optional
_taggedParams: ns1.ParamsArrayType_Def, optional
_param: ns1.ParamsType_Def, optional
_id: str
_ioType: ns1.IOType_Def, optional
_paramType: ns1.ParamType_Def
_ParamType: str, optional
_required: boolean, optional
_semanticType: str, optional
_tag: str, optional
_textDesc: str, optional
_value: str, optional
_separator: str, optional
_untaggedParams: ns1.ParamsArrayType_Def, optional
_usage: str
"""
if not isinstance(request, getAppMetadataRequest) and\
not issubclass(getAppMetadataRequest, request.__class__):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/getAppMetadata", **kw)
response = self.binding.Receive(getAppMetadataResponseWrapper())
if not isinstance(response, getAppMetadataResponse) and\
not issubclass(getAppMetadataResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def getOutputAsBase64ByName(self, request):
"""
@param: request to getOutputAsBase64ByNameRequest::
_getOutputAsBase64ByNameInput: ns1.OutputsByNameInputType_Def
_fileName: str
_jobID: str
@return: response from getOutputAsBase64ByNameResponse::
_item: str, optional
"""
if not isinstance(request, getOutputAsBase64ByNameRequest) and\
not issubclass(getOutputAsBase64ByNameRequest, request.__class__):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/getOutputAsBase64ByName", **kw)
response = self.binding.Receive(getOutputAsBase64ByNameResponseWrapper())
if not isinstance(response, getOutputAsBase64ByNameResponse) and\
not issubclass(getOutputAsBase64ByNameResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def getOutputs(self, request):
"""
@param: request is str
@return: response from getOutputsResponse::
_getOutputsOutput: ns1.JobOutputType_Def
_outputFile: ns1.OutputFileType_Def, optional
_name: str
_url: str
_stdErr: str, optional
_stdOut: str, optional
"""
if not isinstance(request, str):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {'requestclass': getOutputsRequestWrapper}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/getOutputs", **kw)
response = self.binding.Receive(getOutputsResponseWrapper())
if not isinstance(response, getOutputsResponse) and\
not issubclass(getOutputsResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def launchJob(self, request):
"""
@param: request to launchJobRequest::
_launchJobInput: ns1.JobInputType_Def
_argList: str, optional
_inputFile: ns1.InputFileType_Def, optional
_contents: str
_name: str
_numProcs: int, optional
@return: response from launchJobResponse::
_launchJobOutput: ns1.JobSubOutputType_Def
_jobID: str
_status: ns1.StatusOutputType_Def
_baseURL: str
_code: int
_message: str
"""
if not isinstance(request, launchJobRequest) and\
not issubclass(launchJobRequest, request.__class__):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/launchJob", **kw)
response = self.binding.Receive(launchJobResponseWrapper())
if not isinstance(response, launchJobResponse) and\
not issubclass(launchJobResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def launchJobBlocking(self, request):
"""
@param: request to launchJobBlockingRequest::
_launchJobBlockingInput: ns1.JobInputType_Def
_argList: str, optional
_inputFile: ns1.InputFileType_Def, optional
_contents: str
_name: str
_numProcs: int, optional
@return: response from launchJobBlockingResponse::
_launchJobBlockingOutput: ns1.BlockingOutputType_Def
_jobOut: ns1.JobOutputType_Def
_outputFile: ns1.OutputFileType_Def, optional
_name: str
_url: str
_stdErr: str, optional
_stdOut: str, optional
_status: ns1.StatusOutputType_Def
_baseURL: str
_code: int
_message: str
"""
if not isinstance(request, launchJobBlockingRequest) and\
not issubclass(launchJobBlockingRequest, request.__class__):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/launchJobBlocking", **kw)
response = self.binding.Receive(launchJobBlockingResponseWrapper())
if not isinstance(response, launchJobBlockingResponse) and\
not issubclass(launchJobBlockingResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
def queryStatus(self, request):
"""
@param: request is str
@return: response from queryStatusResponse::
_queryStatusOutput: ns1.StatusOutputType_Def
_baseURL: str
_code: int
_message: str
"""
if not isinstance(request, str):
raise TypeError("%s incorrect request type" %(request.__class__))
kw = {'requestclass': queryStatusRequestWrapper}
response = self.binding.Send(None, None, request, soapaction="http://nbcr.sdsc.edu/opal/queryStatus", **kw)
response = self.binding.Receive(queryStatusResponseWrapper())
if not isinstance(response, queryStatusResponse) and\
not issubclass(queryStatusResponse, response.__class__):
raise TypeError("%s incorrect response type" %(response.__class__))
return response
class destroyRequest(ns1.destroyInput_Dec):
if not hasattr( ns1.destroyInput_Dec(), "typecode" ):
typecode = ns1.destroyInput_Dec()
def __init__(self, name=None, ns=None):
ns1.destroyInput_Dec.__init__(self, name=None, ns=None)
class destroyRequestWrapper(destroyRequest):
"""wrapper for document:literal message"""
typecode = destroyRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
destroyRequest.__init__( self, name=None, ns=None )
class destroyResponse(ns1.destroyOutput_Dec):
if not hasattr( ns1.destroyOutput_Dec(), "typecode" ):
typecode = ns1.destroyOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.destroyOutput_Dec.__init__(self, name=None, ns=None)
class destroyResponseWrapper(destroyResponse):
"""wrapper for document:literal message"""
typecode = destroyResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
destroyResponse.__init__( self, name=None, ns=None )
class getAppConfigRequest:
def __init__(self, name=None, ns=None):
getAppConfigRequest.typecode = Struct(getAppConfigRequest,[], pname=name, aname="%s" % name, oname="%s xmlns=\"\"" % name )
class getAppConfigRequestWrapper(getAppConfigRequest):
"""wrapper for document:literal message"""
typecode = getAppConfigRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getAppConfigRequest.__init__( self, name=None, ns=None )
class getAppConfigResponse(ns1.getAppConfigOutput_Dec):
if not hasattr( ns1.getAppConfigOutput_Dec(), "typecode" ):
typecode = ns1.getAppConfigOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.getAppConfigOutput_Dec.__init__(self, name=None, ns=None)
class getAppConfigResponseWrapper(getAppConfigResponse):
"""wrapper for document:literal message"""
typecode = getAppConfigResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getAppConfigResponse.__init__( self, name=None, ns=None )
class getAppMetadataRequest:
def __init__(self, name=None, ns=None):
getAppMetadataRequest.typecode = Struct(getAppMetadataRequest,[], pname=name, aname="%s" % name, oname="%s xmlns=\"\"" % name )
class getAppMetadataRequestWrapper(getAppMetadataRequest):
"""wrapper for document:literal message"""
typecode = getAppMetadataRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getAppMetadataRequest.__init__( self, name=None, ns=None )
class getAppMetadataResponse(ns1.getAppMetadataOutput_Dec):
if not hasattr( ns1.getAppMetadataOutput_Dec(), "typecode" ):
typecode = ns1.getAppMetadataOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.getAppMetadataOutput_Dec.__init__(self, name=None, ns=None)
class getAppMetadataResponseWrapper(getAppMetadataResponse):
"""wrapper for document:literal message"""
typecode = getAppMetadataResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getAppMetadataResponse.__init__( self, name=None, ns=None )
class getOutputAsBase64ByNameRequest(ns1.getOutputAsBase64ByNameInput_Dec):
if not hasattr( ns1.getOutputAsBase64ByNameInput_Dec(), "typecode" ):
typecode = ns1.getOutputAsBase64ByNameInput_Dec()
def __init__(self, name=None, ns=None):
ns1.getOutputAsBase64ByNameInput_Dec.__init__(self, name=None, ns=None)
class getOutputAsBase64ByNameRequestWrapper(getOutputAsBase64ByNameRequest):
"""wrapper for document:literal message"""
typecode = getOutputAsBase64ByNameRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getOutputAsBase64ByNameRequest.__init__( self, name=None, ns=None )
class getOutputAsBase64ByNameResponse(ns1.getOutputAsBase64ByNameOutput_Dec):
if not hasattr( ns1.getOutputAsBase64ByNameOutput_Dec(), "typecode" ):
typecode = ns1.getOutputAsBase64ByNameOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.getOutputAsBase64ByNameOutput_Dec.__init__(self, name=None, ns=None)
class getOutputAsBase64ByNameResponseWrapper(getOutputAsBase64ByNameResponse):
"""wrapper for document:literal message"""
typecode = getOutputAsBase64ByNameResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getOutputAsBase64ByNameResponse.__init__( self, name=None, ns=None )
class getOutputsRequest(ns1.getOutputsInput_Dec):
if not hasattr( ns1.getOutputsInput_Dec(), "typecode" ):
typecode = ns1.getOutputsInput_Dec()
def __init__(self, name=None, ns=None):
ns1.getOutputsInput_Dec.__init__(self, name=None, ns=None)
class getOutputsRequestWrapper(getOutputsRequest):
"""wrapper for document:literal message"""
typecode = getOutputsRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getOutputsRequest.__init__( self, name=None, ns=None )
class getOutputsResponse(ns1.getOutputsOutput_Dec):
if not hasattr( ns1.getOutputsOutput_Dec(), "typecode" ):
typecode = ns1.getOutputsOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.getOutputsOutput_Dec.__init__(self, name=None, ns=None)
class getOutputsResponseWrapper(getOutputsResponse):
"""wrapper for document:literal message"""
typecode = getOutputsResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
getOutputsResponse.__init__( self, name=None, ns=None )
class launchJobBlockingRequest(ns1.launchJobBlockingInput_Dec):
if not hasattr( ns1.launchJobBlockingInput_Dec(), "typecode" ):
typecode = ns1.launchJobBlockingInput_Dec()
def __init__(self, name=None, ns=None):
ns1.launchJobBlockingInput_Dec.__init__(self, name=None, ns=None)
class launchJobBlockingRequestWrapper(launchJobBlockingRequest):
"""wrapper for document:literal message"""
typecode = launchJobBlockingRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
launchJobBlockingRequest.__init__( self, name=None, ns=None )
class launchJobBlockingResponse(ns1.launchJobBlockingOutput_Dec):
if not hasattr( ns1.launchJobBlockingOutput_Dec(), "typecode" ):
typecode = ns1.launchJobBlockingOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.launchJobBlockingOutput_Dec.__init__(self, name=None, ns=None)
class launchJobBlockingResponseWrapper(launchJobBlockingResponse):
"""wrapper for document:literal message"""
typecode = launchJobBlockingResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
launchJobBlockingResponse.__init__( self, name=None, ns=None )
class launchJobRequest(ns1.launchJobInput_Dec):
if not hasattr( ns1.launchJobInput_Dec(), "typecode" ):
typecode = ns1.launchJobInput_Dec()
def __init__(self, name=None, ns=None):
ns1.launchJobInput_Dec.__init__(self, name=None, ns=None)
class launchJobRequestWrapper(launchJobRequest):
"""wrapper for document:literal message"""
typecode = launchJobRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
launchJobRequest.__init__( self, name=None, ns=None )
class launchJobResponse(ns1.launchJobOutput_Dec):
if not hasattr( ns1.launchJobOutput_Dec(), "typecode" ):
typecode = ns1.launchJobOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.launchJobOutput_Dec.__init__(self, name=None, ns=None)
class launchJobResponseWrapper(launchJobResponse):
"""wrapper for document:literal message"""
typecode = launchJobResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
launchJobResponse.__init__( self, name=None, ns=None )
class queryStatusRequest(ns1.queryStatusInput_Dec):
if not hasattr( ns1.queryStatusInput_Dec(), "typecode" ):
typecode = ns1.queryStatusInput_Dec()
def __init__(self, name=None, ns=None):
ns1.queryStatusInput_Dec.__init__(self, name=None, ns=None)
class queryStatusRequestWrapper(queryStatusRequest):
"""wrapper for document:literal message"""
typecode = queryStatusRequest( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
queryStatusRequest.__init__( self, name=None, ns=None )
class queryStatusResponse(ns1.queryStatusOutput_Dec):
if not hasattr( ns1.queryStatusOutput_Dec(), "typecode" ):
typecode = ns1.queryStatusOutput_Dec()
def __init__(self, name=None, ns=None):
ns1.queryStatusOutput_Dec.__init__(self, name=None, ns=None)
class queryStatusResponseWrapper(queryStatusResponse):
"""wrapper for document:literal message"""
typecode = queryStatusResponse( name=None, ns=None ).typecode
def __init__( self, name=None, ns=None, **kw ):
queryStatusResponse.__init__( self, name=None, ns=None )
| [((41, 23, 41, 43), 'ZSI.client.Binding', 'client.Binding', ({}, {}), '(**kw)', False, 'from ZSI import client\n'), ((349, 39, 349, 132), 'ZSI.TCcompound.Struct', 'Struct', (), '', False, 'from ZSI.TCcompound import Struct\n'), ((374, 41, 374, 136), 'ZSI.TCcompound.Struct', 'Struct', (), '', False, 'from ZSI.TCcompound import Struct\n')] |
hieuhoang/FasterTransformer | examples/pytorch/swin/checkpoint_quantization.py | 440695ccac874574b1d2e1121788e8fa674b4381 | # Copyright (c) 2020-2022, NVIDIA CORPORATION. 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.
import sys
import argparse
import re
import numpy as np
import torch
ACTIVATION_AMAX_NUM = 72
INT8O_KERNEL_NUM = 5
INT8O_GEMM_NUM = 7
TRT_FUSED_MHA_AMAX_NUM = 3
SCALE_RESERVE_NUM = 8
def extract_amaxlist(init_dict, depths, ths_path='../lib/libpyt_swintransformer.so', verbose=True):
# print("Quantizing checkpoint ...")
torch.classes.load_library(ths_path)
weight_quantize = torch.ops.fastertransformer.swin_weight_quantize
layer_num = len(depths)
amaxTotalNum = ACTIVATION_AMAX_NUM + INT8O_KERNEL_NUM + INT8O_GEMM_NUM + 1 + TRT_FUSED_MHA_AMAX_NUM + SCALE_RESERVE_NUM
kernel_name_list = ["attn.qkv",
"attn.proj",
"mlp.fc1",
"mlp.fc2"]
amax_name_list = ["attn.qkv._input_quantizer",
"attn.qkv._aftergemm_quantizer",
"attn.proj._input_quantizer",
"attn.proj._aftergemm_quantizer",
"attn.matmul_q_input_quantizer",
"attn.matmul_k_input_quantizer",
"attn.matmul_v_input_quantizer",
"attn.matmul_a_input_quantizer",
"attn.softmax_input_quantizer",
"mlp.fc1._input_quantizer",
"mlp.fc1._aftergemm_quantizer",
"mlp.fc2._input_quantizer",
"mlp.fc2._aftergemm_quantizer",
"add1_residual_input_quantizer",
"add2_residual_input_quantizer"
]
int8O_gemm_weight_amax_list = [0 for i in range(INT8O_GEMM_NUM)]
int8O_gemm_weight_list = ["attn.qkv",
"attn.proj",
"mlp.fc1",
"mlp.fc2",
"attn.matmul_k_input_quantizer",
"attn.matmul_v_input_quantizer"]
int8O_gemm_input_amax_list = [0 for i in range(INT8O_GEMM_NUM)]
int8O_gemm_input_list = ["attn.qkv._input_quantizer",
"attn.proj._input_quantizer",
"mlp.fc1._input_quantizer",
"mlp.fc2._input_quantizer",
"attn.matmul_q_input_quantizer",
"attn.matmul_a_input_quantizer"]
int8O_gemm_output_amax_list = [0 for i in range(INT8O_GEMM_NUM)]
int8O_gemm_output_list = ["attn.qkv._aftergemm_quantizer",
"attn.proj._aftergemm_quantizer",
"mlp.fc1._aftergemm_quantizer",
"mlp.fc2._aftergemm_quantizer",
"attn.softmax_input_quantizer",
"attn.proj._input_quantizer"]
downsample_input = "downsample.reduction._input_quantizer"
downsample_weight = "downsample.reduction._weight_quantizer"
downsample_out = "downsample.reduction._aftergemm_quantizer"
factor = 1000000.0
for i in range(layer_num):
for depth in range(depths[i]):
amaxList = np.zeros([amaxTotalNum]).astype(np.float32)
amax_id = 0
for amax_name in amax_name_list:
quant_max = init_dict["layers.{}.blocks.{}.{}._amax".format(i, depth, amax_name)].item()
amax = abs(quant_max)#round(abs(quant_max)*factor)/factor
if amax_name in int8O_gemm_input_list:
int8O_gemm_input_amax_list[int8O_gemm_input_list.index(amax_name)] = amax
if amax_name in int8O_gemm_output_list:
int8O_gemm_output_amax_list[int8O_gemm_output_list.index(amax_name)] = amax
if amax_name in int8O_gemm_weight_list:
int8O_gemm_weight_amax_list[int8O_gemm_weight_list.index(amax_name)] = amax
amaxList[amax_id] = amax
amax_id += 1
amaxList[amax_id] = amax/127.0
amax_id += 1
amaxList[amax_id] = amax/127.0/127.0
amax_id += 1
amaxList[amax_id] = 127.0/amax
amax_id += 1
# if verbose:
# print(i, amax_name)
# print('quant_max:', quant_max)
# print('amax:', amax)
if i != layer_num - 1:
amax = init_dict["layers.{}.{}._amax".format(i, downsample_input)].item()
amaxList[amax_id] = amax
amax_id += 1
amaxList[amax_id] = amax/127.0
amax_id += 1
amaxList[amax_id] = amax/127.0/127.0
amax_id += 1
amaxList[amax_id] = 127.0/amax
amax_id += 1
amax = init_dict["layers.{}.{}._amax".format(i, downsample_out)].item()
amaxList[amax_id] = amax
amax_id += 1
amaxList[amax_id] = amax/127.0
amax_id += 1
amaxList[amax_id] = amax/127.0/127.0
amax_id += 1
amaxList[amax_id] = 127.0/amax
amax_id += 1
else:
amax_id += 8
if verbose:
print("done process layer_{} block_{} activation amax".format(i, depth))
#kernel amax starts from ACTIVATION_AMAX_NUM
assert amax_id == 68
amax_id = ACTIVATION_AMAX_NUM
for kernel_id, kernel_name in enumerate(kernel_name_list):
kernel = init_dict["layers.{}.blocks.{}.{}.weight".format(i, depth, kernel_name)].transpose(-1, -2).contiguous()
quant_max2 = init_dict["layers.{}.blocks.{}.{}._weight_quantizer._amax".format(i, depth, kernel_name)]
amax2 = abs(quant_max2)
# if (amax2.dim() == 0):
# quant_max_processed = torch.full((kernel.size(1),), amax2.item(), dtype=amax2.dtype, device=amax2.device)
# else:
# quant_max_processed = amax2.view(-1)
kernel_processed = weight_quantize(kernel, amax2.cuda())
init_dict["layers.{}.blocks.{}.{}.weight".format(i, depth, kernel_name)] = kernel_processed
if kernel_name in int8O_gemm_weight_list:
int8O_gemm_weight_amax_list[int8O_gemm_weight_list.index(kernel_name)] = amax2.item()
amaxList[amax_id] = amax2
amax_id += 1
# if verbose:
# print(i, kernel_name)
# print('kernel:', kernel)
# print('quant_max2:', quant_max2)
# print('quant_max_processed_:', quant_max_processed)
if i != layer_num - 1:
amaxList[amax_id] = init_dict["layers.{}.downsample.reduction._weight_quantizer._amax".format(i)].item()
amax_id += 1
assert amax_id == ACTIVATION_AMAX_NUM + INT8O_KERNEL_NUM
#for int8O gemm deQuant
for j in range(INT8O_GEMM_NUM - 1):
amaxList[amax_id] = (int8O_gemm_input_amax_list[j]*int8O_gemm_weight_amax_list[j])/(127.0*int8O_gemm_output_amax_list[j])
# print('layernum:', i, 'j:', j, ' gemm_int8IO_scale:',amaxList[amax_id])
# print(int8O_gemm_input_amax_list[j], int8O_gemm_weight_amax_list[j], int8O_gemm_output_amax_list[j])
amax_id += 1
if i != layer_num - 1:
patchMerge_i = init_dict["layers.{}.{}._amax".format(i, downsample_input)].item()
patchMerge_w = init_dict["layers.{}.{}._amax".format(i, downsample_weight)].item()
patchMerge_o = init_dict["layers.{}.{}._amax".format(i, downsample_out)].item()
amaxList[amax_id] = (patchMerge_i * patchMerge_w) / (127 * patchMerge_o)
amax_id += 1
assert amax_id == ACTIVATION_AMAX_NUM + INT8O_KERNEL_NUM + INT8O_GEMM_NUM
amax_id += 1
#for trt fused MHA amax
#### QKV_addBias_amax
# amaxList[amax_id] = np.maximum(np.maximum(amaxList[16],amaxList[20]), amaxList[24])
# amax_id += 1
# #### softmax amax
# amaxList[amax_id] = amaxList[28]
# amax_id += 1
# #### bmm2 amax
# amaxList[amax_id] = amaxList[8]
# amax_id += 1
qkvMax = np.maximum(np.maximum(amaxList[16],amaxList[20]), amaxList[24])
amaxList[amax_id] = amaxList[16] * amaxList[20] / (127.0 * 127.0)
amax_id += 1
amaxList[amax_id] = 127.0 / amaxList[28]
amax_id += 1
amaxList[amax_id] = amaxList[24] * amaxList[28] / (127.0 * amaxList[8])
amax_id += 1
init_dict["layers.{}.blocks.{}.amaxList".format(i, depth)] = torch.tensor(amaxList, dtype=torch.float32)
if verbose:
print("done process layer_{} block_{} kernel weight".format(i, depth))
if i != layer_num - 1:
kernel = init_dict["layers.{}.downsample.reduction.weight".format(i)]
quant_max2 = init_dict["layers.{}.downsample.reduction._weight_quantizer._amax".format(i)]
amax2 = abs(quant_max2)
kernel = kernel.transpose(-1, -2).contiguous()
kernel_processed = weight_quantize(kernel, amax2.cuda())
init_dict["layers.{}.downsample.reduction.weight".format(i)] = kernel_processed
# print("Quantizing checkpoint done.")
return init_dict
if __name__ == '__main__':
weights = torch.load('pytorch_model.bin')
extract_amaxlist(weights, [2, 2, 6, 2]) | [((29, 4, 29, 40), 'torch.classes.load_library', 'torch.classes.load_library', ({(29, 31, 29, 39): 'ths_path'}, {}), '(ths_path)', False, 'import torch\n'), ((218, 14, 218, 45), 'torch.load', 'torch.load', ({(218, 25, 218, 44): '"""pytorch_model.bin"""'}, {}), "('pytorch_model.bin')", False, 'import torch\n'), ((198, 73, 198, 116), 'torch.tensor', 'torch.tensor', (), '', False, 'import torch\n'), ((190, 32, 190, 69), 'numpy.maximum', 'np.maximum', ({(190, 43, 190, 55): 'amaxList[16]', (190, 56, 190, 68): 'amaxList[20]'}, {}), '(amaxList[16], amaxList[20])', True, 'import numpy as np\n'), ((89, 23, 89, 47), 'numpy.zeros', 'np.zeros', ({(89, 32, 89, 46): '[amaxTotalNum]'}, {}), '([amaxTotalNum])', True, 'import numpy as np\n')] |
tomzhang/mars-1 | mars/deploy/kubernetes/core.py | 6f1d85e37eb1b383251314cb0ba13e06288af03d | # -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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.
import logging
import os
import random
import time
from ...actors import new_client, FunctionActor
logger = logging.getLogger(__name__)
class K8SPodsIPWatcher(object):
"""
Pods watcher class, compatible with SchedulerDiscoverer
"""
dynamic = True
def __init__(self, k8s_config=None, k8s_namespace=None, label_selector=None):
from kubernetes import config, client
from gevent.threadpool import ThreadPool
if k8s_config is not None:
self._k8s_config = k8s_config
elif os.environ.get('KUBE_API_ADDRESS'):
self._k8s_config = client.Configuration()
self._k8s_config.host = os.environ['KUBE_API_ADDRESS']
else:
self._k8s_config = config.load_incluster_config()
self._k8s_namespace = k8s_namespace or os.environ.get('MARS_K8S_POD_NAMESPACE') or 'default'
self._label_selector = label_selector
self._client = client.CoreV1Api(client.ApiClient(self._k8s_config))
self._pool = ThreadPool(1)
self._pod_to_ep = None
def __reduce__(self):
return type(self), (self._k8s_config, self._k8s_namespace, self._label_selector)
def _extract_pod_name_ep(self, pod_data):
svc_port = pod_data['spec']['containers'][0]['ports'][0]['container_port']
return pod_data['metadata']['name'], '%s:%s' % (pod_data['status']['pod_ip'], svc_port)
@staticmethod
def _extract_pod_ready(obj_data):
# if conditions not supported, always return True
if 'status' not in obj_data or 'conditions' not in obj_data['status']:
return True
return any(cond['type'] == 'Ready' and cond['status'] == 'True'
for cond in obj_data['status']['conditions'])
def _get_pod_to_ep(self):
query = self._pool.spawn(self._client.list_namespaced_pod,
namespace=self._k8s_namespace,
label_selector=self._label_selector).result().to_dict()
result = dict()
for el in query['items']:
name, pod_ep = self._extract_pod_name_ep(el)
if pod_ep is not None and not self._extract_pod_ready(el):
pod_ep = None
result[name] = pod_ep
return result
def get(self, update=False):
if self._pod_to_ep is None or update:
self._pod_to_ep = self._get_pod_to_ep()
return sorted(a for a in self._pod_to_ep.values() if a is not None)
def is_all_ready(self):
self.get(True)
return all(a is not None for a in self._pod_to_ep.values())
def watch(self):
from urllib3.exceptions import ReadTimeoutError
from kubernetes import watch
cur_pods = set(self.get(True))
w = watch.Watch()
while True:
# when some schedulers are not ready, we refresh faster
linger = 10 if self.is_all_ready() else 1
streamer = w.stream(self._client.list_namespaced_pod,
namespace=self._k8s_namespace,
label_selector=self._label_selector,
timeout_seconds=linger)
while True:
try:
event = self._pool.spawn(next, streamer, StopIteration).result()
if event is StopIteration:
raise StopIteration
except (ReadTimeoutError, StopIteration):
new_pods = set(self.get(True))
if new_pods != cur_pods:
cur_pods = new_pods
yield self.get(False)
break
except: # noqa: E722
logger.exception('Unexpected error when watching on kubernetes')
break
obj_dict = event['object'].to_dict()
pod_name, endpoint = self._extract_pod_name_ep(obj_dict)
self._pod_to_ep[pod_name] = endpoint \
if endpoint and self._extract_pod_ready(obj_dict) else None
yield self.get(False)
class ReadinessActor(FunctionActor):
"""
Dummy actor indicating service start
"""
@classmethod
def default_uid(cls):
return 'k:0:%s' % cls.__name__
class K8SServiceMixin:
@staticmethod
def write_pid_file():
with open('/tmp/mars-service.pid', 'w') as pid_file:
pid_file.write(str(os.getpid()))
def wait_all_schedulers_ready(self):
"""
Wait till all containers are ready, both in kubernetes and in ClusterInfoActor
"""
from ...scheduler.utils import SchedulerClusterInfoActor
# check if all schedulers are ready using Kubernetes API
sleep_fun = (getattr(self, 'pool', None) or time).sleep
while not self.scheduler_discoverer.is_all_ready():
sleep_fun(1)
kube_schedulers = self.scheduler_discoverer.get()
logger.debug('Schedulers all ready in kubernetes, waiting ClusterInfoActor to be ready')
# check if all schedulers are registered in ClusterInfoActor
actor_client = new_client()
while True:
cluster_info = actor_client.actor_ref(
SchedulerClusterInfoActor.default_uid(), address=random.choice(kube_schedulers))
cluster_info_schedulers = cluster_info.get_schedulers()
if set(cluster_info_schedulers) == set(kube_schedulers):
from ...cluster_info import INITIAL_SCHEDULER_FILE
with open(INITIAL_SCHEDULER_FILE, 'w') as scheduler_file:
scheduler_file.write(','.join(cluster_info_schedulers))
logger.debug('Scheduler detection finished. Result: %r', kube_schedulers)
break
sleep_fun(1) # pragma: no cover
def create_scheduler_discoverer(self):
self.scheduler_discoverer = K8SPodsIPWatcher(label_selector='name=marsscheduler')
| [((23, 9, 23, 36), 'logging.getLogger', 'logging.getLogger', ({(23, 27, 23, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((47, 21, 47, 34), 'gevent.threadpool.ThreadPool', 'ThreadPool', ({(47, 32, 47, 33): '1'}, {}), '(1)', False, 'from gevent.threadpool import ThreadPool\n'), ((92, 12, 92, 25), 'kubernetes.watch.Watch', 'watch.Watch', ({}, {}), '()', False, 'from kubernetes import watch\n'), ((38, 13, 38, 47), 'os.environ.get', 'os.environ.get', ({(38, 28, 38, 46): '"""KUBE_API_ADDRESS"""'}, {}), "('KUBE_API_ADDRESS')", False, 'import os\n'), ((44, 47, 44, 87), 'os.environ.get', 'os.environ.get', ({(44, 62, 44, 86): '"""MARS_K8S_POD_NAMESPACE"""'}, {}), "('MARS_K8S_POD_NAMESPACE')", False, 'import os\n'), ((46, 40, 46, 74), 'kubernetes.client.ApiClient', 'client.ApiClient', ({(46, 57, 46, 73): 'self._k8s_config'}, {}), '(self._k8s_config)', False, 'from kubernetes import config, client\n'), ((39, 31, 39, 53), 'kubernetes.client.Configuration', 'client.Configuration', ({}, {}), '()', False, 'from kubernetes import config, client\n'), ((42, 31, 42, 61), 'kubernetes.config.load_incluster_config', 'config.load_incluster_config', ({}, {}), '()', False, 'from kubernetes import config, client\n'), ((136, 31, 136, 42), 'os.getpid', 'os.getpid', ({}, {}), '()', False, 'import os\n'), ((155, 65, 155, 95), 'random.choice', 'random.choice', ({(155, 79, 155, 94): 'kube_schedulers'}, {}), '(kube_schedulers)', False, 'import random\n')] |
elangovana/gene_normalisation | tests/tests_model/tests_bert_model.py | 9152298e951cd968ee516815c7fa11f1ceabca51 | from unittest import TestCase
import torch
import transformers
from model.bert_model import BertModel
class TestBertModel(TestCase):
def test_forward(self):
# Bert Config
vocab_size = 10
sequence_len = 20
batch = 32
num_classes = 3
expected_shape = (batch, sequence_len, num_classes)
input_batch = torch.randint(low=0, high=vocab_size-1, size=(batch, sequence_len))
config= transformers.BertConfig(vocab_size=vocab_size,hidden_size=10, num_hidden_layers=1, num_attention_heads=1,num_labels=num_classes)
sut = BertModel(None, None, bert_config=config)
# Act
actual = sut.forward(input_batch)[0]
# Assert
self.assertEqual(expected_shape, actual.shape)
| [((20, 22, 20, 89), 'torch.randint', 'torch.randint', (), '', False, 'import torch\n'), ((21, 16, 21, 144), 'transformers.BertConfig', 'transformers.BertConfig', (), '', False, 'import transformers\n'), ((22, 14, 22, 55), 'model.bert_model.BertModel', 'BertModel', (), '', False, 'from model.bert_model import BertModel\n')] |
tmcclintock/PyDonJuan | tests/renderer_test.py | ab6d567b568c3e0dd976b10c2628ad99ca81b953 | import json
import os
import tempfile
from unittest import TestCase
import pytest
from donjuan import Dungeon, DungeonRandomizer, Renderer
class RendererTest(TestCase):
def setUp(self):
super().setUp()
self.TEMP_DIR = tempfile.mkdtemp()
def test_smoke(self):
r = Renderer()
assert r is not None
def test_scale(self):
r = Renderer(scale=3)
assert r.scale == 3
@pytest.mark.slow
def test_render_dummy_dungeon(self):
inpath = os.path.abspath(os.path.dirname(__file__))
inpath = os.path.join(inpath, "fixtures/dummy_dungeon.json")
with open(inpath, "r") as f:
darr = json.load(f)["dungeon"]
n_rows = len(darr)
n_cols = len(darr)
dungeon = Dungeon(n_rows=n_rows, n_cols=n_cols)
for i in range(n_rows):
for j in range(n_cols):
dungeon.grid.cells[i][j].filled = bool(darr[i][j])
# Render and check for the file
fp = os.path.join(self.TEMP_DIR, "rendered_dungeon.png")
r = Renderer()
r.render(dungeon, file_path=fp)
assert os.path.exists(fp)
@pytest.mark.slow
def test_render_dungeon_with_rooms(self):
randomizer = DungeonRandomizer()
dungeon = Dungeon(10, 10, randomizers=[randomizer])
dungeon.randomize()
dungeon.emplace_rooms()
renderer = Renderer()
# Render and check for the file
fp = os.path.join(self.TEMP_DIR, "rendered_dungeon.png")
renderer.render(dungeon, file_path=fp)
assert os.path.exists(fp)
| [((14, 24, 14, 42), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ({}, {}), '()', False, 'import tempfile\n'), ((17, 12, 17, 22), 'donjuan.Renderer', 'Renderer', ({}, {}), '()', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((21, 12, 21, 29), 'donjuan.Renderer', 'Renderer', (), '', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((27, 17, 27, 68), 'os.path.join', 'os.path.join', ({(27, 30, 27, 36): 'inpath', (27, 38, 27, 67): '"""fixtures/dummy_dungeon.json"""'}, {}), "(inpath, 'fixtures/dummy_dungeon.json')", False, 'import os\n'), ((32, 18, 32, 55), 'donjuan.Dungeon', 'Dungeon', (), '', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((38, 13, 38, 64), 'os.path.join', 'os.path.join', ({(38, 26, 38, 39): 'self.TEMP_DIR', (38, 41, 38, 63): '"""rendered_dungeon.png"""'}, {}), "(self.TEMP_DIR, 'rendered_dungeon.png')", False, 'import os\n'), ((39, 12, 39, 22), 'donjuan.Renderer', 'Renderer', ({}, {}), '()', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((41, 15, 41, 33), 'os.path.exists', 'os.path.exists', ({(41, 30, 41, 32): 'fp'}, {}), '(fp)', False, 'import os\n'), ((45, 21, 45, 40), 'donjuan.DungeonRandomizer', 'DungeonRandomizer', ({}, {}), '()', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((46, 18, 46, 59), 'donjuan.Dungeon', 'Dungeon', (), '', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((49, 19, 49, 29), 'donjuan.Renderer', 'Renderer', ({}, {}), '()', False, 'from donjuan import Dungeon, DungeonRandomizer, Renderer\n'), ((52, 13, 52, 64), 'os.path.join', 'os.path.join', ({(52, 26, 52, 39): 'self.TEMP_DIR', (52, 41, 52, 63): '"""rendered_dungeon.png"""'}, {}), "(self.TEMP_DIR, 'rendered_dungeon.png')", False, 'import os\n'), ((54, 15, 54, 33), 'os.path.exists', 'os.path.exists', ({(54, 30, 54, 32): 'fp'}, {}), '(fp)', False, 'import os\n'), ((26, 33, 26, 58), 'os.path.dirname', 'os.path.dirname', ({(26, 49, 26, 57): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((29, 19, 29, 31), 'json.load', 'json.load', ({(29, 29, 29, 30): 'f'}, {}), '(f)', False, 'import json\n')] |
dnava013/foremast | src/foremast/validate.py | 9849821b5bb3cd67b438c5adeaa0e42f86e9eaf8 | """Spinnaker validate functions."""
import logging
from .consts import API_URL
from .utils.credentials import get_env_credential
LOG = logging.getLogger(__name__)
def validate_gate():
"""Check Gate connection."""
try:
credentials = get_env_credential()
LOG.debug('Found credentials: %s', credentials)
LOG.info('Gate working.')
except TypeError:
LOG.fatal('Gate connection not valid: API_URL = %s', API_URL)
def validate_all(args):
"""Run all validate steps."""
LOG.debug('Args: %s', args)
LOG.info('Running all validate steps.')
validate_gate()
| [((7, 6, 7, 33), 'logging.getLogger', 'logging.getLogger', ({(7, 24, 7, 32): '__name__'}, {}), '(__name__)', False, 'import logging\n')] |
ConstellationApps/Forms | constellation_forms/migrations/0001_initial.py | 5d2bacf589c1a473cf619f34d569d33191b11285 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 00:56
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Form',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('form_id', models.IntegerField()),
('version', models.IntegerField()),
('name', models.TextField()),
('description', models.TextField(blank=True)),
('elements', django.contrib.postgres.fields.jsonb.JSONField()),
],
options={
'ordering': ('-version',),
'db_table': 'form',
},
),
migrations.CreateModel(
name='FormSubmission',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('state', models.IntegerField(choices=[(0, 'draft'), (1, 'submitted'), (2, 'approved'), (3, 'denied')])),
('modified', models.DateField()),
('submission', django.contrib.postgres.fields.jsonb.JSONField()),
('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='constellation_forms.Form')),
('owner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'form_submission',
},
),
migrations.CreateModel(
name='Validator',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.TextField()),
('regex', models.TextField()),
],
options={
'db_table': 'validators',
},
),
migrations.AlterUniqueTogether(
name='form',
unique_together=set([('form_id', 'version')]),
),
]
| [((16, 8, 16, 65), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', ({(16, 40, 16, 64): 'settings.AUTH_USER_MODEL'}, {}), '(settings.AUTH_USER_MODEL)', False, 'from django.db import migrations, models\n'), ((23, 23, 23, 112), 'django.db.models.AutoField', 'models.AutoField', (), '', False, 'from django.db import migrations, models\n'), ((24, 28, 24, 49), 'django.db.models.IntegerField', 'models.IntegerField', ({}, {}), '()', False, 'from django.db import migrations, models\n'), ((25, 28, 25, 49), 'django.db.models.IntegerField', 'models.IntegerField', ({}, {}), '()', False, 'from django.db import migrations, models\n'), ((26, 25, 26, 43), 'django.db.models.TextField', 'models.TextField', ({}, {}), '()', False, 'from django.db import migrations, models\n'), ((27, 32, 27, 60), 'django.db.models.TextField', 'models.TextField', (), '', False, 'from django.db import migrations, models\n'), ((38, 23, 38, 112), 'django.db.models.AutoField', 'models.AutoField', (), '', False, 'from django.db import migrations, models\n'), ((39, 26, 39, 119), 'django.db.models.IntegerField', 'models.IntegerField', (), '', False, 'from django.db import migrations, models\n'), ((40, 29, 40, 47), 'django.db.models.DateField', 'models.DateField', ({}, {}), '()', False, 'from django.db import migrations, models\n'), ((42, 25, 42, 118), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import migrations, models\n'), ((43, 26, 43, 140), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import migrations, models\n'), ((52, 23, 52, 112), 'django.db.models.AutoField', 'models.AutoField', (), '', False, 'from django.db import migrations, models\n'), ((53, 25, 53, 43), 'django.db.models.TextField', 'models.TextField', ({}, {}), '()', False, 'from django.db import migrations, models\n'), ((54, 26, 54, 44), 'django.db.models.TextField', 'models.TextField', ({}, {}), '()', False, 'from django.db import migrations, models\n')] |
ptphp/PyLib | src/webpy1/src/borough/dbsqli.py | 07ac99cf2deb725475f5771b123b9ea1375f5e65 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3 as sqlite
import os.path as osp
import sys
class Sqli(object):
conn = ''
cursor = ''
def __init__(self, dbname):
try:
self.conn = sqlite.connect(osp.abspath(dbname))
except Exception, what:
print what
sys.exit()
self.conn.row_factory = sqlite.Row
self.cursor = self.conn.cursor()
def createTable(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS [website](
[id] INTEGER PRIMARY KEY,
[siteName] TEXT,
[loginUrl] TEXT,
[loginQuery] TEXT,
[postUrl] TEXT,
[postQuery] TEXT,
UNIQUE([siteName]));
''')
print "create table website "
self.cursor.execute('''
CREATE INDEX IF NOT EXISTS [website_idx_siteName] ON [website]([siteName]);
''')
print 'create website index'
self.conn.commit()
def createTable_com(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS [com](
[id] INTEGER PRIMARY KEY,
[title] TEXT,
[city] TEXT,
[url] TEXT,
UNIQUE([url]));
''')
print "create table com "
self.cursor.execute('''
CREATE INDEX IF NOT EXISTS [website_idx_url] ON [com]([url]);
''')
print 'create map index'
self.conn.commit()
def createTable_58(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS [com](
[id] INTEGER PRIMARY KEY,
[title] TEXT,
[city] TEXT,
[url] TEXT,
UNIQUE([url]));
''')
print "create table com "
self.cursor.execute('''
CREATE INDEX IF NOT EXISTS [website_idx_url] ON [com]([url]);
''')
print 'create map index'
self.conn.commit()
def query(self, sql):
try:
self.cursor.execute(sql)
self.conn.commit()
except Exception, what:
print what
def show(self):
r = self.cursor.fetchall()
return r
def showone(self):
return self.cursor.fetchone()
def __del__(self):
self.cursor.close()
self.conn.close()
| [] |
Liudzz/loss-chapter | losses/all_lost.py | 22359b92ca5e155d5af32ef2f22eeddf0483b947 | """
easy way to use losses
"""
from center_loss import Centerloss
import torch.nn as nn
from FocalLoss import FocalLoss
def center_loss(pred,label,num_calss,feature):
loss = Centerloss(num_calss,feature)
return loss(pred,label)
def Focal_loss(pred,label,num_calss,alaph=None, gamma):
loss = Centerloss(num_calss,gamma)
return loss(pred,label)
def L1_loss(pred,label):
loss = nn.L1Loss(pred,label)
return loss
def L2_loss(pred,label):
loss = nn.MSELoss(pred,label)
return loss
def SmoothL1_loss(pred,label):
loss = nn.SmoothL1Loss(pred,label)
return loss | [] |
Nexenta/nova | nova/tests/functional/test_metadata.py | ccecb507ff4bdcdd23d90e7b5b02a22c5a46ecc3 | # Copyright 2016 Rackspace Australia
# 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.
import fixtures
import jsonschema
import os
import requests
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from nova import test
from nova.tests import fixtures as nova_fixtures
from nova.tests.functional import fixtures as func_fixtures
from nova.tests.functional import integrated_helpers
from nova.tests.unit.image import fake as fake_image
class fake_result(object):
def __init__(self, result):
self.status_code = 200
self.text = jsonutils.dumps(result)
real_request = requests.request
def fake_request(obj, url, method, **kwargs):
if url.startswith('http://127.0.0.1:123'):
return fake_result({'a': 1, 'b': 'foo'})
if url.startswith('http://127.0.0.1:124'):
return fake_result({'c': 3})
if url.startswith('http://127.0.0.1:125'):
return fake_result(jsonutils.loads(kwargs.get('data', '{}')))
return real_request(method, url, **kwargs)
class MetadataTest(test.TestCase, integrated_helpers.InstanceHelperMixin):
def setUp(self):
super(MetadataTest, self).setUp()
fake_image.stub_out_image_service(self)
self.addCleanup(fake_image.FakeImageService_reset)
self.useFixture(nova_fixtures.NeutronFixture(self))
self.useFixture(func_fixtures.PlacementFixture())
self.start_service('conductor')
self.start_service('scheduler')
self.api = self.useFixture(
nova_fixtures.OSAPIFixture(api_version='v2.1')).api
self.start_service('compute')
# create a server for the tests
server = self._build_server(name='test')
server = self.api.post_server({'server': server})
self.server = self._wait_for_state_change(server, 'ACTIVE')
self.api_fixture = self.useFixture(nova_fixtures.OSMetadataServer())
self.md_url = self.api_fixture.md_url
# make sure that the metadata service returns information about the
# server we created above
def fake_get_fixed_ip_by_address(self, ctxt, address):
return {'instance_uuid': server['id']}
self.useFixture(
fixtures.MonkeyPatch(
'nova.network.neutron.API.get_fixed_ip_by_address',
fake_get_fixed_ip_by_address))
def test_lookup_metadata_root_url(self):
res = requests.request('GET', self.md_url, timeout=5)
self.assertEqual(200, res.status_code)
def test_lookup_metadata_openstack_url(self):
url = '%sopenstack' % self.md_url
res = requests.request('GET', url, timeout=5,
headers={'X-Forwarded-For': '127.0.0.2'})
self.assertEqual(200, res.status_code)
def test_lookup_metadata_data_url(self):
url = '%sopenstack/latest/meta_data.json' % self.md_url
res = requests.request('GET', url, timeout=5)
self.assertEqual(200, res.status_code)
j = jsonutils.loads(res.text)
self.assertIn('hostname', j)
self.assertEqual('test.novalocal', j['hostname'])
def test_lookup_external_service(self):
self.flags(
vendordata_providers=['StaticJSON', 'DynamicJSON'],
vendordata_dynamic_targets=[
'testing@http://127.0.0.1:123',
'hamster@http://127.0.0.1:123'
],
group='api'
)
self.useFixture(fixtures.MonkeyPatch(
'keystoneauth1.session.Session.request', fake_request))
url = '%sopenstack/2016-10-06/vendor_data2.json' % self.md_url
res = requests.request('GET', url, timeout=5)
self.assertEqual(200, res.status_code)
j = jsonutils.loads(res.text)
self.assertEqual({}, j['static'])
self.assertEqual(1, j['testing']['a'])
self.assertEqual('foo', j['testing']['b'])
self.assertEqual(1, j['hamster']['a'])
self.assertEqual('foo', j['hamster']['b'])
def test_lookup_external_service_no_overwrite(self):
self.flags(
vendordata_providers=['DynamicJSON'],
vendordata_dynamic_targets=[
'testing@http://127.0.0.1:123',
'testing@http://127.0.0.1:124'
],
group='api'
)
self.useFixture(fixtures.MonkeyPatch(
'keystoneauth1.session.Session.request', fake_request))
url = '%sopenstack/2016-10-06/vendor_data2.json' % self.md_url
res = requests.request('GET', url, timeout=5)
self.assertEqual(200, res.status_code)
j = jsonutils.loads(res.text)
self.assertNotIn('static', j)
self.assertEqual(1, j['testing']['a'])
self.assertEqual('foo', j['testing']['b'])
self.assertNotIn('c', j['testing'])
def test_lookup_external_service_passes_data(self):
# Much of the data we pass to the REST service is missing because of
# the way we've created the fake instance, but we should at least try
# and ensure we're passing _some_ data through to the external REST
# service.
self.flags(
vendordata_providers=['DynamicJSON'],
vendordata_dynamic_targets=[
'testing@http://127.0.0.1:125'
],
group='api'
)
self.useFixture(fixtures.MonkeyPatch(
'keystoneauth1.session.Session.request', fake_request))
url = '%sopenstack/2016-10-06/vendor_data2.json' % self.md_url
res = requests.request('GET', url, timeout=5)
self.assertEqual(200, res.status_code)
j = jsonutils.loads(res.text)
self.assertIn('instance-id', j['testing'])
self.assertTrue(uuidutils.is_uuid_like(j['testing']['instance-id']))
self.assertIn('hostname', j['testing'])
self.assertEqual(self.server['tenant_id'], j['testing']['project-id'])
self.assertIn('metadata', j['testing'])
self.assertIn('image-id', j['testing'])
self.assertIn('user-data', j['testing'])
def test_network_data_matches_schema(self):
self.useFixture(fixtures.MonkeyPatch(
'keystoneauth1.session.Session.request', fake_request))
url = '%sopenstack/latest/network_data.json' % self.md_url
res = requests.request('GET', url, timeout=5)
self.assertEqual(200, res.status_code)
# load the jsonschema for network_data
schema_file = os.path.normpath(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../../../doc/api_schemas/network_data.json"))
with open(schema_file, 'rb') as f:
schema = jsonutils.load(f)
jsonschema.validate(res.json(), schema)
| [((33, 20, 33, 43), 'oslo_serialization.jsonutils.dumps', 'jsonutils.dumps', ({(33, 36, 33, 42): 'result'}, {}), '(result)', False, 'from oslo_serialization import jsonutils\n'), ((53, 8, 53, 47), 'nova.tests.unit.image.fake.stub_out_image_service', 'fake_image.stub_out_image_service', ({(53, 42, 53, 46): 'self'}, {}), '(self)', True, 'from nova.tests.unit.image import fake as fake_image\n'), ((82, 14, 82, 61), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((87, 14, 88, 72), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((93, 14, 93, 53), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((95, 12, 95, 37), 'oslo_serialization.jsonutils.loads', 'jsonutils.loads', ({(95, 28, 95, 36): 'res.text'}, {}), '(res.text)', False, 'from oslo_serialization import jsonutils\n'), ((113, 14, 113, 53), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((116, 12, 116, 37), 'oslo_serialization.jsonutils.loads', 'jsonutils.loads', ({(116, 28, 116, 36): 'res.text'}, {}), '(res.text)', False, 'from oslo_serialization import jsonutils\n'), ((137, 14, 137, 53), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((140, 12, 140, 37), 'oslo_serialization.jsonutils.loads', 'jsonutils.loads', ({(140, 28, 140, 36): 'res.text'}, {}), '(res.text)', False, 'from oslo_serialization import jsonutils\n'), ((164, 14, 164, 53), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((167, 12, 167, 37), 'oslo_serialization.jsonutils.loads', 'jsonutils.loads', ({(167, 28, 167, 36): 'res.text'}, {}), '(res.text)', False, 'from oslo_serialization import jsonutils\n'), ((182, 14, 182, 53), 'requests.request', 'requests.request', (), '', False, 'import requests\n'), ((55, 24, 55, 58), 'nova.tests.fixtures.NeutronFixture', 'nova_fixtures.NeutronFixture', ({(55, 53, 55, 57): 'self'}, {}), '(self)', True, 'from nova.tests import fixtures as nova_fixtures\n'), ((56, 24, 56, 56), 'nova.tests.functional.fixtures.PlacementFixture', 'func_fixtures.PlacementFixture', ({}, {}), '()', True, 'from nova.tests.functional import fixtures as func_fixtures\n'), ((68, 43, 68, 75), 'nova.tests.fixtures.OSMetadataServer', 'nova_fixtures.OSMetadataServer', ({}, {}), '()', True, 'from nova.tests import fixtures as nova_fixtures\n'), ((77, 12, 79, 45), 'fixtures.MonkeyPatch', 'fixtures.MonkeyPatch', ({(78, 16, 78, 66): '"""nova.network.neutron.API.get_fixed_ip_by_address"""', (79, 16, 79, 44): 'fake_get_fixed_ip_by_address'}, {}), "('nova.network.neutron.API.get_fixed_ip_by_address',\n fake_get_fixed_ip_by_address)", False, 'import fixtures\n'), ((109, 24, 110, 70), 'fixtures.MonkeyPatch', 'fixtures.MonkeyPatch', ({(110, 16, 110, 55): '"""keystoneauth1.session.Session.request"""', (110, 57, 110, 69): 'fake_request'}, {}), "('keystoneauth1.session.Session.request', fake_request)", False, 'import fixtures\n'), ((133, 24, 134, 70), 'fixtures.MonkeyPatch', 'fixtures.MonkeyPatch', ({(134, 16, 134, 55): '"""keystoneauth1.session.Session.request"""', (134, 57, 134, 69): 'fake_request'}, {}), "('keystoneauth1.session.Session.request', fake_request)", False, 'import fixtures\n'), ((160, 24, 161, 70), 'fixtures.MonkeyPatch', 'fixtures.MonkeyPatch', ({(161, 16, 161, 55): '"""keystoneauth1.session.Session.request"""', (161, 57, 161, 69): 'fake_request'}, {}), "('keystoneauth1.session.Session.request', fake_request)", False, 'import fixtures\n'), ((169, 24, 169, 75), 'oslo_utils.uuidutils.is_uuid_like', 'uuidutils.is_uuid_like', ({(169, 47, 169, 74): "j['testing']['instance-id']"}, {}), "(j['testing']['instance-id'])", False, 'from oslo_utils import uuidutils\n'), ((177, 24, 178, 70), 'fixtures.MonkeyPatch', 'fixtures.MonkeyPatch', ({(178, 16, 178, 55): '"""keystoneauth1.session.Session.request"""', (178, 57, 178, 69): 'fake_request'}, {}), "('keystoneauth1.session.Session.request', fake_request)", False, 'import fixtures\n'), ((190, 21, 190, 38), 'oslo_serialization.jsonutils.load', 'jsonutils.load', ({(190, 36, 190, 37): 'f'}, {}), '(f)', False, 'from oslo_serialization import jsonutils\n'), ((60, 12, 60, 58), 'nova.tests.fixtures.OSAPIFixture', 'nova_fixtures.OSAPIFixture', (), '', True, 'from nova.tests import fixtures as nova_fixtures\n'), ((187, 28, 187, 53), 'os.path.abspath', 'os.path.abspath', ({(187, 44, 187, 52): '__file__'}, {}), '(__file__)', False, 'import os\n')] |
zxlzr/OpenUE | openue/sequence_labeling/subject_labeling_data_manager.py | a49f8950dc2b93a489bb8ce0d40abb26c2c0f347 | import os
import sys
import json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../bert")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")))
import tokenization
from config import config
class Model_data_preparation(object):
def __init__(self, DATA_INPUT_DIR="raw_data", DATA_OUTPUT_DIR="SKE_2019_tokened_labeling",
vocab_file_path="vocab.txt", do_lower_case=True,General_Mode = False):
self.bert_tokenizer = tokenization.FullTokenizer(vocab_file=self.get_vocab_file_path(vocab_file_path),
do_lower_case=do_lower_case) # 初始化 bert_token 工具
self.DATA_INPUT_DIR = self.get_data_input_dir(DATA_INPUT_DIR)
self.DATA_OUTPUT_DIR = os.path.join(os.path.dirname(__file__), DATA_OUTPUT_DIR)
self.General_Mode = General_Mode
def get_data_input_dir(self, DATA_INPUT_DIR):
DATAself_INPUT_DIR = os.path.join(
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")), DATA_INPUT_DIR)
return DATA_INPUT_DIR
def get_vocab_file_path(self, vocab_file_path):
print(vocab_file_path)
return vocab_file_path
def subject_object_labeling(self, spo_list, text):
def _spo_list_to_spo_predicate_dict(spo_list):
spo_predicate_dict = dict()
for spo_item in spo_list:
predicate = spo_item["predicate"]
subject = spo_item["subject"]
object = spo_item["object"]
spo_predicate_dict.setdefault(predicate, []).append((subject, object))
return spo_predicate_dict
def _gen_event_dic(spo_list):
res = []
res_d = {}
predicate = ""
for spo_item in spo_list:
predicate = spo_item["event"]
if 'time' in spo_item:
time = spo_item["time"]
res.append(('time',time))
if 'location' in spo_item:
location = spo_item["location"]
res.append(('location',location))
if 'participant' in spo_item:
participant = spo_item["participant"]
res.append(('participant',participant))
if 'denoter' in spo_item:
denoter = spo_item["denoter"]
res.append(('denoter',denoter))
if 'object' in spo_item:
object = spo_item["object"]
res.append(('object',object))
res_d[predicate] = res
return res_d
def _index_q_list_in_k_list(q_list, k_list):
"""Known q_list in k_list, find index(first time) of q_list in k_list"""
q_list_length = len(q_list)
k_list_length = len(k_list)
for idx in range(k_list_length - q_list_length + 1):
t = [q == k for q, k in zip(q_list, k_list[idx: idx + q_list_length])]
# print(idx, t)
if all(t):
# print(idx)
idx_start = idx
return idx_start
def _labeling_type(subject_object, so_type):
tokener_error_flag = False
so_tokened = self.bert_tokenizer.tokenize(subject_object)
so_tokened_length = len(so_tokened)
idx_start = _index_q_list_in_k_list(q_list=so_tokened, k_list=text_tokened)
if idx_start is None:
tokener_error_flag = True
'''
实体: "1981年" 原句: "●1981年2月27日,中国人口学会成立"
so_tokened ['1981', '年'] text_tokened ['●', '##19', '##81', '年', '2', '月', '27', '日', ',', '中', '国', '人', '口', '学', '会', '成', '立']
so_tokened 无法在 text_tokened 找到!原因是bert_tokenizer.tokenize 分词增添 “##” 所致!
'''
self.bert_tokener_error_log_f.write(subject_object + " @@ " + text + "\n")
self.bert_tokener_error_log_f.write(str(so_tokened) + " @@ " + str(text_tokened) + "\n")
else: #给实体开始处标 B 其它位置标 I
labeling_list[idx_start] = "B-" + so_type
if so_tokened_length == 2:
labeling_list[idx_start + 1] = "I-" + so_type
elif so_tokened_length >= 3:
labeling_list[idx_start + 1: idx_start + so_tokened_length] = ["I-" + so_type] * (so_tokened_length - 1)
return tokener_error_flag
text_tokened = self.bert_tokenizer.tokenize(text)
text_tokened_not_UNK = self.bert_tokenizer.tokenize_not_UNK(text)
if not self.General_Mode:
spo_predicate_dict = _spo_list_to_spo_predicate_dict(spo_list)
else:
spo_predicate_dict = _gen_event_dic(spo_list)
for predicate, spo_list_form in spo_predicate_dict.items():
tokener_error_flag = False
labeling_list = ["O"] * len(text_tokened)
if not self.General_Mode:
for (spo_subject, spo_object) in spo_list_form:
flag_A = _labeling_type(spo_subject, "SUB")
#flag_B = _labeling_type(spo_object, "OBJ")
if flag_A or flag_B:
tokener_error_flag = True
else:
for item in spo_list_form:
if item[1]== None:
continue
flag_A = _labeling_type(item[1],item[0])
if flag_A:
tokener_error_flag = True
#给被bert_tokenizer.tokenize 拆分的词语打上特殊标签[##WordPiece]
for idx, token in enumerate(text_tokened):
"""标注被 bert_tokenizer.tokenize 拆分的词语"""
if token.startswith("##"):
labeling_list[idx] = "[##WordPiece]"
if not tokener_error_flag:
self.token_label_and_one_prdicate_out_f.write(" ".join(labeling_list)+"\t"+predicate+"\n")
self.text_f.write(text + "\n")
self.token_in_f.write(" ".join(text_tokened)+"\t"+predicate+"\n")
self.token_in_not_UNK_f.write(" ".join(text_tokened_not_UNK) + "\n")
def separate_raw_data_and_token_labeling(self):
if not os.path.exists(self.DATA_OUTPUT_DIR):
os.makedirs(os.path.join(self.DATA_OUTPUT_DIR, "train"))
os.makedirs(os.path.join(self.DATA_OUTPUT_DIR, "valid"))
os.makedirs(os.path.join(self.DATA_OUTPUT_DIR, "test"))
for file_set_type in ["train", "valid"]:
print(os.path.join(os.path.join(self.DATA_OUTPUT_DIR, file_set_type)))
self.token_label_and_one_prdicate_out_f = open(os.path.join(os.path.join(self.DATA_OUTPUT_DIR, file_set_type), "token_label_and_one_prdicate_out.txt"), "w", encoding='utf-8')
self.bert_tokener_error_log_f = open(os.path.join(os.path.join(self.DATA_OUTPUT_DIR, file_set_type), "bert_tokener_error_log.txt"), "w", encoding='utf-8')
self.text_f = open(os.path.join(os.path.join(self.DATA_OUTPUT_DIR, file_set_type), "text.txt"), "w", encoding='utf-8')
self.token_in_f = open(os.path.join(os.path.join(self.DATA_OUTPUT_DIR, file_set_type), "token_in.txt"), "w", encoding='utf-8')
self.token_in_not_UNK_f = open(os.path.join(os.path.join(self.DATA_OUTPUT_DIR, file_set_type), "token_in_not_UNK.txt"), "w", encoding='utf-8')
if file_set_type == "train":
path_to_raw_data_file = "train.json"
elif file_set_type == "valid":
path_to_raw_data_file = "valid.json"
else:
pass
with open(os.path.join(self.DATA_INPUT_DIR, path_to_raw_data_file), 'r', encoding='utf-8') as f:
count_numbers = 0
while True:
line = f.readline()
if line:
count_numbers += 1
r = json.loads(line)
text = r["text"]
spo_list = r["spo_list"]
self.subject_object_labeling(spo_list=spo_list, text=text)
else:
break
print("all numbers", count_numbers)
self.text_f.close()
self.token_in_f.close()
self.token_in_not_UNK_f.close()
self.token_label_and_one_prdicate_out_f.close()
self.bert_tokener_error_log_f.close()
if __name__=="__main__":
DATA_INPUT_DIR = config.data_dir
DATA_OUTPUT_DIR = "sequence_labeling_data"
Vocab_Path = config.bert_vocab_dir
General_Mode = False
model_data = Model_data_preparation(General_Mode = General_Mode,DATA_INPUT_DIR=DATA_INPUT_DIR, DATA_OUTPUT_DIR=DATA_OUTPUT_DIR,vocab_file_path=Vocab_Path)
model_data.separate_raw_data_and_token_labeling()
| [((4, 45, 4, 70), 'os.path.dirname', 'os.path.dirname', ({(4, 61, 4, 69): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((5, 45, 5, 70), 'os.path.dirname', 'os.path.dirname', ({(5, 61, 5, 69): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((17, 44, 17, 69), 'os.path.dirname', 'os.path.dirname', ({(17, 60, 17, 68): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((132, 15, 132, 51), 'os.path.exists', 'os.path.exists', ({(132, 30, 132, 50): 'self.DATA_OUTPUT_DIR'}, {}), '(self.DATA_OUTPUT_DIR)', False, 'import os\n'), ((133, 24, 133, 67), 'os.path.join', 'os.path.join', ({(133, 37, 133, 57): 'self.DATA_OUTPUT_DIR', (133, 59, 133, 66): '"""train"""'}, {}), "(self.DATA_OUTPUT_DIR, 'train')", False, 'import os\n'), ((134, 24, 134, 67), 'os.path.join', 'os.path.join', ({(134, 37, 134, 57): 'self.DATA_OUTPUT_DIR', (134, 59, 134, 66): '"""valid"""'}, {}), "(self.DATA_OUTPUT_DIR, 'valid')", False, 'import os\n'), ((135, 24, 135, 66), 'os.path.join', 'os.path.join', ({(135, 37, 135, 57): 'self.DATA_OUTPUT_DIR', (135, 59, 135, 65): '"""test"""'}, {}), "(self.DATA_OUTPUT_DIR, 'test')", False, 'import os\n'), ((22, 41, 22, 66), 'os.path.dirname', 'os.path.dirname', ({(22, 57, 22, 65): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((138, 31, 138, 80), 'os.path.join', 'os.path.join', ({(138, 44, 138, 64): 'self.DATA_OUTPUT_DIR', (138, 66, 138, 79): 'file_set_type'}, {}), '(self.DATA_OUTPUT_DIR, file_set_type)', False, 'import os\n'), ((139, 72, 139, 121), 'os.path.join', 'os.path.join', ({(139, 85, 139, 105): 'self.DATA_OUTPUT_DIR', (139, 107, 139, 120): 'file_set_type'}, {}), '(self.DATA_OUTPUT_DIR, file_set_type)', False, 'import os\n'), ((140, 62, 140, 111), 'os.path.join', 'os.path.join', ({(140, 75, 140, 95): 'self.DATA_OUTPUT_DIR', (140, 97, 140, 110): 'file_set_type'}, {}), '(self.DATA_OUTPUT_DIR, file_set_type)', False, 'import os\n'), ((142, 44, 142, 93), 'os.path.join', 'os.path.join', ({(142, 57, 142, 77): 'self.DATA_OUTPUT_DIR', (142, 79, 142, 92): 'file_set_type'}, {}), '(self.DATA_OUTPUT_DIR, file_set_type)', False, 'import os\n'), ((143, 48, 143, 97), 'os.path.join', 'os.path.join', ({(143, 61, 143, 81): 'self.DATA_OUTPUT_DIR', (143, 83, 143, 96): 'file_set_type'}, {}), '(self.DATA_OUTPUT_DIR, file_set_type)', False, 'import os\n'), ((144, 56, 144, 105), 'os.path.join', 'os.path.join', ({(144, 69, 144, 89): 'self.DATA_OUTPUT_DIR', (144, 91, 144, 104): 'file_set_type'}, {}), '(self.DATA_OUTPUT_DIR, file_set_type)', False, 'import os\n'), ((152, 22, 152, 78), 'os.path.join', 'os.path.join', ({(152, 35, 152, 54): 'self.DATA_INPUT_DIR', (152, 56, 152, 77): 'path_to_raw_data_file'}, {}), '(self.DATA_INPUT_DIR, path_to_raw_data_file)', False, 'import os\n'), ((158, 28, 158, 44), 'json.loads', 'json.loads', ({(158, 39, 158, 43): 'line'}, {}), '(line)', False, 'import json\n')] |
Taik/clarifai-python | clarifai/rest/grpc/custom_converters/custom_message_to_dict.py | c3b66b84cb348d3cb1edff958f561a4734b78650 | import typing # noqa
from google.protobuf import descriptor
from google.protobuf.json_format import _IsMapEntry, _Printer
from google.protobuf.message import Message # noqa
from clarifai.rest.grpc.proto.clarifai.api.utils import extensions_pb2
def protobuf_to_dict(object_protobuf, use_integers_for_enums=True, ignore_show_empty=False):
# type: (Message, typing.Optional[bool], typing.Optional[bool]) -> dict
# printer = _CustomPrinter(
printer = _CustomPrinter(
including_default_value_fields=False,
preserving_proto_field_name=True,
use_integers_for_enums=use_integers_for_enums,
ignore_show_empty=ignore_show_empty)
# pylint: disable=protected-access
return printer._MessageToJsonObject(object_protobuf)
class _CustomPrinter(_Printer):
def __init__(self, including_default_value_fields, preserving_proto_field_name,
use_integers_for_enums, ignore_show_empty):
super(_CustomPrinter, self).__init__(including_default_value_fields,
preserving_proto_field_name, use_integers_for_enums)
self._ignore_show_empty = ignore_show_empty
def _RegularMessageToJsonObject(self, message, js):
"""
Because of the fields with the custom extension `cl_show_if_empty`, we need to adjust the
original's method's return JSON object and keep these fields.
"""
js = super(_CustomPrinter, self)._RegularMessageToJsonObject(message, js)
message_descriptor = message.DESCRIPTOR
for field in message_descriptor.fields:
if (self._ignore_show_empty and
not field.GetOptions().Extensions[extensions_pb2.cl_default_float]):
continue
if not field.GetOptions().Extensions[extensions_pb2.cl_show_if_empty]:
continue
# Singular message fields and oneof fields will not be affected.
if ((field.label != descriptor.FieldDescriptor.LABEL_REPEATED and
field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE) or
field.containing_oneof):
continue
if self.preserving_proto_field_name:
name = field.name
else:
name = field.json_name
if name in js:
# Skip the field which has been serialized already.
continue
if _IsMapEntry(field):
js[name] = {}
elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
js[name] = []
else:
js[name] = self._FieldToJsonObject(field, field.default_value)
return js
def _StructMessageToJsonObject(self, message):
"""
Converts Struct message according to Proto3 JSON Specification.
However, by default, empty objects {} get converted to null. We overwrite this behavior so {}
get converted to {}.
"""
fields = message.fields
ret = {}
for key in fields:
# When there's a Struct with an empty Struct field, this condition will hold True.
# Far as I know this is the only case this condition will be true. If not, this condition
# needs to be amended.
if fields[key].WhichOneof('kind') is None:
json_object = {}
else:
json_object = self._ValueMessageToJsonObject(fields[key])
ret[key] = json_object
return ret
| [((60, 9, 60, 27), 'google.protobuf.json_format._IsMapEntry', '_IsMapEntry', ({(60, 21, 60, 26): 'field'}, {}), '(field)', False, 'from google.protobuf.json_format import _IsMapEntry, _Printer\n')] |
mschrimpf/CapsNetKeras | __init__.py | 4c514860bf6689fb1772a7bd858638cd538ff22f | from .capsulenet import *
| [] |
mrchoi87/IRSOSv4 | gate/mate_ksx3267v2.py | 886c3dcbeb64c3a8cc257b58692946fd5462312e | #!/usr/bin/env python
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 JiNong, Inc.
# All right reserved.
#
import struct
import time
import socket
import select
import traceback
import hashlib
import json
from enum import IntEnum
from threading import Thread, Lock
from mate import Mate, ThreadMate, DevType
from mblock import MBlock, BlkType, StatCode, ResCode, CmdCode, Observation, Request, Response, NotiCode, Notice
from pymodbus.client.sync import ModbusSerialClient
from pymodbus.client.sync import ModbusTcpClient
class NodeType(IntEnum):
SENNODE = 1
ACTNODE = 2
INTNODE = 3
NUTNODE = 4
class ProtoVer(IntEnum):
KS_X_3267_2020 = 10
KS_X_3267_2018 = 101
TTA_1 = 201
class KSX3267MateV2(ThreadMate):
_SLEEP = 0.5
_VERSION = "KSX3267_0.1"
_KEYWORDS = {"value" : (2, "float"), "status" : (1, "status"),
"opid" : (1, "short"), "state-hold-time" : (2, "int"), "ratio": (1, "short"),
"position" : (1, "short"), "remain-time" : (2, "int"),
"control": (1, "control"), "area" : (1, "short"), "alert" : (1, "alert"),
"hold-time" : (2, "int"), "operation" : (1, "operation"),
"time" : (2, "int"), "opentime" : (1, "short"), "closetime" : (1, "short"),
"EC": (2, "float"), "pH": (2, "float"), "on-sec" : (1, "short"),
"start-area" : (1, "short"), "stop-area": (1, "short"),
"epoch" : (2, "int"), "vfloat": (2, "float"), "vint" : (2, "int")}
_DEVINFOREG = 2
_DEVCODEREG = 101
def __init__(self, option, devinfo, coupleid, logger):
super(KSX3267MateV2, self).__init__(option, devinfo, coupleid, logger)
self._timeout = 3 if "timeout" not in option else option["timeout"]
self._conn = {}
self._tempthd = []
self._isdetecting = False
self._detection = {"port": [], "saddr":0, "eaddr":0, "opid":0}
#self._nodes = self._devinfo.getgw()["children"]
self._lock = Lock()
self._logger.info("KSX3267MateV2 Started.")
def detect_node(self, conn, unit, registers):
print "detect_node", unit, registers
compcode = registers[0]
nodecode = registers[2]
size = registers[4]
while True:
res = self.readregister(conn, KSX3267MateV2._DEVCODEREG, size, unit)
if res is None or res.isError():
self._logger.warn("Fail to get devices from " + str(unit) + " " + str(res))
return None
if len(res.registers) != size:
self._logger.info("retry to get data since size of data is not matched. " + str(size) + " " + str(len(res.registers)))
continue
return {"compcode" : compcode, "nodecode" : nodecode, "devcodes": res.registers}
def getdk(self, dev, idx):
dk = json.loads(dev["dk"])
return dk[idx]
def setdetection(self, flag, opid=0):
self._isdetecting = flag
self._detection["opid"] = opid
def startdetection(self, params, opid):
if self._detection["opid"] != 0:
self._logger.info("detection is processing.... so this command would be ignored.")
return ResCode.FAIL
self.setdetection(True, opid)
if params:
self._detection["saddr"] = params['saddr']
self._detection["eaddr"] = params['eaddr']
self._detection["port"] = params['port']
else:
self._detection["saddr"] = 1
self._detection["eaddr"] = 12
self._detection["port"] = None
return ResCode.OK
def readregister(self, conn, addr, count, unit):
print "....... before lock for read"
with self._lock:
time.sleep(KSX3267MateV2._SLEEP)
#mrchoi87
self._logger.info("read_holding_registers: " + str(unit) + " " + str(addr) + " " + str(count))
print "read register", unit, addr, count
try:
return conn.read_holding_registers(addr, count, unit=unit)
except Exception as ex:
self._logger.warn("fail to read holding registers. : " + str(ex))
return None
def detect(self):
detected = {}
for port, conn in self._conn.iteritems():
if self._isdetecting == False or self.isexecuting() == False:
self._logger.info("Total detection is canceled.")
break
info = self.detectone(port, conn)
detected[port] = info
self._logger.info ("finished to detect devices : " + str(detected))
noti = Notice(None, NotiCode.DETECT_FINISHED) # Detection Started
if noti:
noti.setkeyvalue("opid", self._detection["opid"])
for port, info in detected.iteritems():
noti.setcontent(port, info)
self.writecb(noti)
self.setdetection(False)
def detectone(self, port, conn):
detected = {}
if self._detection["port"] is not None and port not in self._detection["port"]:
return detected
#mrchoi87
#for unit in range(self._detection["saddr"], 12):
for unit in range(self._detection["saddr"], self._detection["eaddr"]):
if self._isdetecting == False or self.isexecuting() == False:
self._logger.info("A port " + str(port) + " detection is canceled.")
break
tempid = port + "-" + str(unit)
noti = Notice(None, NotiCode.DETECT_NODE_STARTED, devid=tempid) # Detection Started
if noti:
noti.setkeyvalue("opid", self._detection["opid"])
self.writecb(noti)
noti = None
info = None
res = None
for _ in range(3):
res = self.readregister(conn, KSX3267MateV2._DEVINFOREG, 6, unit)
if res is None or res.isError():
continue
if len(res.registers) != 6:
self._logger.info("retry to get data since size of data is not matched. 6 " + str(len(res.registers)))
continue
break
if res is None or res.isError():
noti = Notice(None, NotiCode.DETECT_NO_NODE, devid=tempid) # Detection Started
self._logger.info ("Fail to get information from a node : " + str(unit) + " " + str(res))
elif res.registers[1] in (NodeType.SENNODE, NodeType.ACTNODE, NodeType.INTNODE): # device type
if res.registers[3] == ProtoVer.KS_X_3267_2020 or res.registers[3] == ProtoVer.KS_X_3267_2018:
info = self.detect_node(conn, unit, res.registers)
self._logger.info ("Found a node : " + str(unit) + " " + str(info))
else:
noti = Notice(None, NotiCode.DETECT_UNKNOWN_PROTOCOL_VER, devid=tempid) # unknown protocol version
elif res.registers[1] == NodeType.NUTNODE:
if res.registers[3] == ProtoVer.TTA_1:
info = self.detect_node(conn, unit, res.registers)
self._logger.info ("Found a nutrient system : " + str(unit) + " " + str(info))
else:
noti = Notice(None, NotiCode.DETECT_UNKNOWN_PROTOCOL_VER, devid=tempid) # unknown protocol version
else:
noti = Notice(unit, NotiCode.DETECT_UNKNOWN_NODE, devid=tempid) # unknown device
if noti is None:
if info is None:
noti = Notice(None, NotiCode.DETECT_WRONG_DEVICE, devid=tempid) # fail to find a node
else:
noti = Notice(None, NotiCode.DETECT_NODE_DETECTED, devid=port, content={unit : info}) # found a node
detected[unit] = info
noti.setkeyvalue("opid", self._detection["opid"])
print "noti", noti.stringify()
self.writecb(noti)
time.sleep(0.1)
return detected
def canceldetection(self, params):
time.sleep(self._timeout)
noti = Notice(None, NotiCode.DETECT_CANCELED) # detection is canceled
noti.setkeyvalue("opid", self._detection["opid"])
self.writecb(noti)
self.setdetection(False)
return ResCode.OK
def _listen(self, opt):
try:
servsoc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
servsoc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
servsoc.bind((opt['host'], opt['port']))
servsoc.listen(1)
self._logger.info("listen : " + str(opt))
executing = True
while executing:
self._logger.info("waiting a client~")
rsoc, wsoc, esoc = select.select([servsoc], [], [], 10)
for sock in rsoc:
if sock == servsoc:
clisoc, address = servsoc.accept()
self._logger.info("client connected from " + str(address))
for tmp in self._tempthd:
if tmp["port"] == opt["port"]:
conn = ModbusTcpClient(timeout=self._timeout)
conn.socket = clisoc
self._conn[opt["port"]] = conn
tmp["status"] = 10 # connected
executing = False
except Exception as ex:
servsoc.close()
for tmp in self._tempthd:
if tmp["port"] == opt["port"]:
self._logger.warn(" port [" + str(opt["port"]) + "] exception : " + str(ex))
tmp["status"] = 5 # error
def listen(self, opt):
tmp = {"thd" : Thread(target=self._listen, args=(opt)), "status": 0, "port":opt['port']}
self._tempthd.append(tmp)
tmp["thd"].start()
def checktempthreads(self):
for tmp in self._tempthd:
if tmp["status"] > 2:
tmp["thd"].stop()
tmp["thd"].join()
def connectone(self, opt):
ret = False
conn = None
if opt['method'] == 'rtu':
conn = ModbusSerialClient(method='rtu', port=opt['port'],
timeout=self._timeout, baudrate=opt['baudrate'])
ret = conn.connect()
msg = "failed to connect with rtu"
code = NotiCode.RTU_CONNECTED if ret else NotiCode.RTU_FAILED_CONNECTION
elif opt['method'] == 'tcpc':
conn = ModbusTcpClient(opt['host'], port=opt['port'], timeout=self._timeout)
ret = conn.connect()
msg = "failed to connect with tcp"
code = NotiCode.TCP_CONNECTED if ret else NotiCode.RTU_FAILED_CONNECTION
elif opt['method'] == 'tcpcs':
self._logger.info("It would wait for a while to connect a client.")
ret = self.listen(opt)
msg = "failed to connect with tcp"
code = NotiCode.TCP_WAITING if ret else NotiCode.RTU_FAILED_CONNECTION
conn = None
else:
msg = "It's a wrong connection method. " + str(opt['method'])
if ret == False:
self._logger.warn(msg)
noti = Notice(None, NotiCode.RTU_FAILED_CONNECTION) # detection is canceled
else:
noti = Notice(None, NotiCode.RTU_CONNECTED) # detection is canceled
self.writecb(noti)
return conn
def connect(self):
ret = False
for opt in self._option['conn']:
conn = self.connectone(opt)
if conn:
self._conn[opt["port"][8:]] = conn
super(KSX3267MateV2, self).connect()
return ret
def closeone(self, port):
self._conn[port].close()
def close(self):
for port in self._conn.keys():
self.closeone(port)
super(KSX3267MateV2, self).close()
def readmsg(self):
self._msgq = []
for gw in self._devinfo:
for nd in gw["children"]:
self._msgq.append(self.readsensornodeinfo(nd))
if self._isdetecting:
self.detect()
self.checktempthreads()
def processrequest(self, dev, request, node):
gw = self._devinfo.findgateway(request.getnodeid())
unit = self.getdk(dev, 0)
operation = request.getcommand()
params = request.getparams()
params["operation"] = operation # need to convert by case
params["opid"] = request.getopid() # need to convert by case
properparams = CmdCode.getparams(operation) + ["operation", "opid"]
registers = []
for key in self.getdk(dev, 4):
if key not in properparams:
# key param is not used for this operation
# However, the register should be filled.
val = 0
elif key in params:
val = params[key]
else:
self._logger.warn("Wrong Keyword : " + str(key))
return ResCode.FAIL_WRONG_KEYWORD
if KSX3267MateV2._KEYWORDS[key][0] == 1:
registers.append(val)
elif KSX3267MateV2._KEYWORDS[key][1] == "int":
registers.extend(struct.unpack('HH', struct.pack('i', val)))
elif KSX3267MateV2._KEYWORDS[key][1] == "float":
registers.extend(struct.unpack('HH', struct.pack('f', val)))
#else:
# self._logger.warn("This param is needed for this operation. " + str(params['operation']) + ", " + str(key))
# return ResCode.FAIL_WRONG_KEYWORD
print "....... befor lock for write"
with self._lock:
time.sleep(KSX3267MateV2._SLEEP)
print "....... lock for write", self.getdk(dev, 3), registers
res = self._conn[gw["dk"]].write_registers(self.getdk(dev, 3), registers, unit=unit)
if res.isError():
self._logger.warn("Fail to write a request to dev." + str(dev) + "," + str(res) + ":" + str(request))
return ResCode.FAIL_TO_WRITE
msg = self.readactinfo(node, dev)
if msg is None:
self._logger.warn("Fail to read dev status.")
else:
self.sendnoticeforactuatorstatus(msg)
return ResCode.OK
def writeblk(self, blk):
print "received message", blk.getdevid(), self._coupleid
if BlkType.isrequest(blk.gettype()) is False:
self._logger.warn("The message is not request. " + str(blk.gettype()))
return False
response = Response(blk)
cmd = blk.getcommand()
nd = self._devinfo.finddevbyid(blk.getnodeid())
dev = self._devinfo.finddevbyid(blk.getdevid())
if blk.getdevid() == self._coupleid:
params = blk.getparams()
if cmd == CmdCode.DETECT_DEVICE:
print "detect device"
code = self.startdetection(params, blk.getopid())
elif cmd == CmdCode.CANCEL_DETECT:
print "cancel to detect device"
code = self.canceldetection(params)
else:
self._logger.warn("Unknown Error. " + str(blk) + ", " + str(dev))
code = ResCode.FAIL
elif dev is None:
self._logger.warn("There is no device. " + str(blk.getdevid()))
code = ResCode.FAIL_NO_DEVICE
elif DevType.ispropercommand(dev['dt'], cmd) is False:
self._logger.warn("The request is not proper. " + str(cmd) + " " + str(dev['dt']))
code = ResCode.FAIL_NOT_PROPER_COMMAND
elif DevType.isactuator(dev['dt']) or DevType.isnode(dev['dt']):
# modbus
code = self.processrequest(dev, blk, nd)
self._logger.info("Actuator processed : " + str(code))
elif DevType.isgateway(dev['dt']):
self._logger.info("Gateway does not receive a request")
code = ResCode.FAIL
else:
self._logger.warn("Unknown Error. " + str(blk) + ", " + str(dev))
code = ResCode.FAIL
response.setresult(code)
self._logger.info("write response: " + str(response))
self.writecb(response)
return True #if code == ResCode.OK else False
def parseregisters(self, names, values):
idx = 0
ret = {}
for nm in names:
(size, vtype) = KSX3267MateV2._KEYWORDS[nm]
if vtype == "float":
val = struct.unpack('f', struct.pack('HH', values[idx], values[idx+1]))[0]
elif vtype == "int":
val = struct.unpack('i', struct.pack('HH', values[idx], values[idx+1]))[0]
else:
val = values[idx]
ret[nm] = val
idx = idx + size
print "parsed", ret
return ret
def readinfofromdev(self, conn, dev):
size = self.getsize(self.getdk(dev, 2))
#for _ in range(3):
res = self.readregister(conn, self.getdk(dev, 1), size, self.getdk(dev, 0))
if res is None:
self._logger.warn("fail to get status from " + str(dev['dk']))
# break
elif res.isError():
self._logger.info("retry to get status from " + str(dev['dk']) + " " + str(res))
# continue
else:
if len(res.registers) == size:
return self.parseregisters(self.getdk(dev, 2), res.registers)
else:
self._logger.info("retry to get data since size of data is not matched. " + str(size) + " " + str(len(res.registers)))
return None
def readnodeinfo(self, node):
ret = {"id" : node["id"], "sen" : {}, "act" : {}, "nd" : {"status":StatCode.ERROR.value}}
gw = self._devinfo.findgateway(node["id"])
conn = self._conn[gw["dk"]]
ret["conn"] = conn
info = self.readinfofromdev(conn, node)
if info:
ret["nd"] = info
else:
self._logger.warn("fail to read node info : " + str(node))
return ret
def readsensornodeinfo(self, node):
ret = self.readnodeinfo(node)
for dev in node['children']:
if DevType.issensor(dev["dt"]):
info = self.readinfofromdev(ret["conn"], dev)
if info:
ret["sen"][dev["id"]] = info
#else:
# self._logger.warn("fail to read sensor info : " + str(dev) + " however continue to read other device")
return ret
def readactnodeinfo(self, node):
ret = self.readnodeinfo(node)
for dev in node['children']:
if DevType.issensor(dev["dt"]) == False:
info = self.readinfofromdev(ret["conn"], dev)
if info:
ret["act"][dev["id"]] = info
else:
self._logger.warn("fail to read actuator info : " + str(dev) + " however continue to read other device")
return ret
def readactinfo(self, node, act):
ret = self.readnodeinfo(node)
info = self.readinfofromdev(ret["conn"], act)
if info:
ret["act"][act["id"]] = info
else:
self._logger.warn("fail to read actuator info : " + str(act) + " however continue to read other device")
return ret
def sendobs(self):
for msg in self._msgq:
if msg is None:
continue
self.sendobservation(msg)
def sendnoti(self):
for gw in self._devinfo:
for node in gw["children"]:
ret = self.readnodeinfo(node)
i = 1
for dev in node['children']:
if DevType.issensor(dev["dt"]) == False:
info = self.readinfofromdev(ret["conn"], dev)
if info:
ret["act"][dev["id"]] = info
i = i + 1
if i % 3 == 0:
self.sendnoticeforactuatorstatus(ret)
ret["act"] = {}
self.sendnoticeforactuatorstatus(ret)
def sendobservation(self, ndinfo):
if StatCode.has_value(ndinfo["nd"]["status"]) == False:
ndinfo["nd"]["status"] = StatCode.ERROR.value
obsblk = Observation(ndinfo["id"])
obsblk.setobservation(ndinfo["id"], 0, StatCode(ndinfo["nd"]["status"]))
for devid, info in ndinfo["sen"].iteritems():
if StatCode.has_value(info["status"]) == False:
info["status"] = StatCode.ERROR.value
obsblk.setobservation(devid, info["value"], StatCode(info["status"]))
# do not send observation for actuator
#for devid, info in ndinfo["act"].iteritems():
# if StatCode.has_value(info["status"]) == False:
# info["status"] = StatCode.ERROR.value
# obsblk.setobservation(devid, 0, StatCode(info["status"]))
self.writecb(obsblk)
def sendnoticeforactuatorstatus(self, ndinfo):
blk = Notice(ndinfo["id"], NotiCode.ACTUATOR_STATUS, ndinfo["id"], ndinfo["nd"])
for devid, info in ndinfo["act"].iteritems():
blk.setcontent(devid, info)
self.writecb(blk)
def start(self, writecb):
super(KSX3267MateV2, self).start(writecb)
return True
def stop(self):
super(KSX3267MateV2, self).stop()
return True
def getsize(self, lst):
size =0
for k in lst:
if k in KSX3267MateV2._KEYWORDS:
size = size + KSX3267MateV2._KEYWORDS[k][0]
else:
self._logger.warn("wrong keyword : " + str(k))
return -1
return size
if __name__ == "__main__":
isnutri = False
opt = {
'conn' : [{
'method': 'rtu',
'port' : '/dev/ttyJND2',
'baudrate' : 9600,
'timeout': 5
}]
}
nutriinfo = [{
"id" : "1", "dk" : "", "dt": "gw", "children" : [{
"id" : "101", "dk" : '[1,40201,["status"],45001,["operation","opid"]]', "dt": "nd", "children" : [
{"id" : "102", "dk" : '[1,40211,["control","status","area","alert","opid"],45001,["operation", "opid", "control","EC","pH", "start-area", "stop-area", "on-sec"]]', "dt": "nutrient-supply/level1"},
{"id" : "103", "dk" : '[1,40221,["value","status"]]', "dt": "sen"},
{"id" : "104", "dk" : '[1,40231,["value","status"]]', "dt": "sen"},
{"id" : "105", "dk" : '[1,40241,["value","status"]]', "dt": "sen"},
{"id" : "106", "dk" : '[1,40251,["value","status"]]', "dt": "sen"},
{"id" : "107", "dk" : '[1,40261,["value","status"]]', "dt": "sen"},
{"id" : "109", "dk" : '[1,40271,["value","status"]]', "dt": "sen"},
{"id" : "110", "dk" : '[1,40281,["value","status"]]', "dt": "sen"},
{"id" : "111", "dk" : '[1,40291,["value","status"]]', "dt": "sen"},
{"id" : "112", "dk" : '[1,40301,["value","status"]]', "dt": "sen"},
{"id" : "113", "dk" : '[1,40311,["value","status"]]', "dt": "sen"}
]}
]}
]
devinfo = [{
"id" : "1", "dk" : "JND2", "dt": "gw", "children" : [
# {
# "id" : "101", "dk" : '[1,201,["status"],301,["operation","opid"]]', "dt": "nd", "children" : [
#{"id" : "102", "dk" : '[1,210,["value","status"]]', "dt": "sen"},
#{"id" : "103", "dk" : '[1,220,["value","status"]]', "dt": "sen"}
# "id" : "101", "dk" : '[1,40201,["status"],45001,["operation","opid"]]', "dt": "nd", "children" : [
#{"id" : "102", "dk" : '[1,41010,["value","status"]]', "dt": "sen"},
#{"id" : "103", "dk" : '[1,41020,["value","status"]]', "dt": "sen"}
# {"id" : "102", "dk" : '[1,40202,["value","status"]]', "dt": "sen"},
# {"id" : "103", "dk" : '[1,40205,["value","status"]]', "dt": "sen"},
#{"id" : "104", "dk" : '[1,40208,["value","status"]]', "dt": "sen"},
# {"id" : "105", "dk" : '[1,40211,["value","status"]]', "dt": "sen"},
#{"id" : "106", "dk" : '[1,40251,["value","status"]]', "dt": "sen"},
#{"id" : "107", "dk" : '[1,40261,["value","status"]]', "dt": "sen"},
#{"id" : "108", "dk" : '[1,40271,["value","status"]]', "dt": "sen"},
#{"id" : "109", "dk" : '[1,40281,["value","status"]]', "dt": "sen"},
#{"id" : "110", "dk" : '[1,40291,["value","status"]]', "dt": "sen"}
# ]
# }
]
}]
"""
}, {
"id" : "201", "dk" : '[2,40201,["status"],45001,["operation","opid"]]', "dt": "nd", "children" : [
{"id" : "202", "dk" : '[2,40202,["opid","status","state-hold-time","remain-time"],40206,["operation","opid","time"]]', "dt": "act/retractable/level1"},
{"id" : "202", "dk" : '[2,40209,["opid","status","state-hold-time","remain-time"],40213,["operation","opid","time"]]', "dt": "act/retractable/level1"},
{"id" : "203", "dk" : '[2,40216,["value","status"]]', "dt": "sen"},
{"id" : "204", "dk" : '[2,40219,["value","status"]]', "dt": "sen"},
#{"id" : "203", "dk" : (2,40221,["opid","status"],45021,["operation","opid"]), "dt": "act/switch/level0"},
#{"id" : "204", "dk" : (2,40231,["opid","status"],45031,["operation","opid"]), "dt": "act/switch/level0"},
#{"id" : "205", "dk" : (2,40241,["opid","status"],45041,["operation","opid"]), "dt": "act/switch/level0"},
#{"id" : "206", "dk" : (2,40251,["opid","status"],45051,["operation","opid"]), "dt": "act/switch/level0"},
#{"id" : "207", "dk" : (2,40261,["opid","status"],45061,["operation","opid"]), "dt": "act/switch/level0"},
#{"id" : "208", "dk" : (2,40271,["opid","status"],45071,["operation","opid"]), "dt": "act/switch/level0"},
#{"id" : "209", "dk" : (2,40281,["opid","status"],45081,["operation","opid"]), "dt": "act/switch/level0"}
]
}, {
"id" : "301", "dk" : (3,40201,["opid","status"],45001,["operation","opid"]), "dt": "nd", "children" : [
{"id" : "302", "dk" : (3,40211,["opid","status"],45011,["operation","opid"]), "dt": "act/retractable/level0"},
{"id" : "303", "dk" : (3,40221,["opid","status"],45021,["operation","opid"]), "dt": "act/retractable/level0"},
{"id" : "304", "dk" : (3,40231,["opid","status"],45031,["operation","opid"]), "dt": "act/retractable/level0"},
{"id" : "305", "dk" : (3,40241,["opid","status"],45041,["operation","opid"]), "dt": "act/retractable/level0"}
]
}]
}]
"""
if isnutri:
kdmate = KSX3267MateV2(opt, nutriinfo, "1", None)
else:
kdmate = KSX3267MateV2(opt, devinfo, "1", None)
mate = Mate ({}, [], "1", None)
kdmate.start (mate.writeblk)
print "mate started"
time.sleep(10)
req = Request(None)
req.setcommand("1", CmdCode.DETECT_DEVICE, None)
print "=======================================#1"
kdmate.writeblk(req)
print "=======================================#1"
"""
time.sleep(1)
req = Request(None)
req.setcommand("1", CmdCode.CANCEL_DETECT, {})
print "=======================================#2"
kdmate.writeblk(req)
print "=======================================#2"
time.sleep(1)
req = Request(None)
req.setcommand("1", CmdCode.DETECT_DEVICE, None)
print "=======================================#3"
kdmate.writeblk(req)
print "=======================================#3"
time.sleep(1)
req = Request(None)
req.setcommand("1", CmdCode.CANCEL_DETECT, {})
print "=======================================#4"
kdmate.writeblk(req)
print "=======================================#4"
time.sleep(10)
req = Request(201)
req.setcommand(202, CmdCode.OPEN, {})
kdmate.writeblk(req)
time.sleep(5)
req = Request(201)
req.setcommand(202, CmdCode.OFF, {})
kdmate.writeblk(req)
time.sleep(10)
req = Request(201)
req.setcommand(202, CmdCode.TIMED_OPEN, {"time":10})
kdmate.writeblk(req)
time.sleep(15)
req = Request(201)
req.setcommand(202, CmdCode.TIMED_CLOSE, {"time":10})
kdmate.writeblk(req)
time.sleep(5)
req = Request(201)
req.setcommand(202, CmdCode.OFF, {})
kdmate.writeblk(req)
"""
time.sleep(30)
kdmate.stop()
print "mate stopped"
| [] |
aimalygin/aws-sdk-ios | CircleciScripts/run_integrationtests.py | 6cfaa3c56296300499f4885e9039c2dd24624cfa | import demjson
import sys
from subprocess import Popen, PIPE
import subprocess
import xml.etree.ElementTree as ET
import os
from datetime import datetime
from functions import runcommand
#from sets import Set
def getfailedcases(withBundle = True):
xmlfile='build/reports/junit.xml'
tree = ET.parse(xmlfile)
root = tree.getroot()
testbundle = root.get('name')
testbundle = testbundle[0:len(testbundle) - 7]
failedtests = set()
#TODO we can filter with condtion
for testsuite in root.findall(".//testsuite"):
for testcase in testsuite.findall('.//testcase[failure]'):
suitename = testsuite.get('name')
casename = testcase.get('name')
if withBundle:
failedtests.add(testbundle + '/' + suitename + '/' + casename)
else:
failedtests.add(suitename + '/' + casename)
return failedtests
#run test
def runtest(otherargments, projectPath, schemeName, projectName, destination, derivedDataPath, timeout = 0):
runcommand("rm raw.log")
runcommand("rm xcpretty.log")
testcommand = "xcodebuild test-without-building -project {0} -scheme {1} -sdk iphonesimulator -destination '{2}' -derivedDataPath {3}/{4}".format(projectPath,schemeName, destination, derivedDataPath, projectName)
testcommand +=" " + otherargments;
rawoutput = open('raw.log','w')
exit_code = runcommand(testcommand,timeout, pipeout = rawoutput)
rawoutput.close()
print("Formatting test result .......")
xcprettycommand = "cat raw.log | xcpretty -r junit | tee xcpretty.log"
runcommand(xcprettycommand)
return exit_code
########################## main function ###############################
# a command will like
if (len(sys.argv) < 3 or sys.argv[1] == '-h' or sys.argv[1] == '-h') :
print("Usage: \r\n {0} <integrationTestsConfiguration json file path> <test result location> <group name>".format(sys.argv[0])) ;
exit(1)
jsonfilename=sys.argv[1]
test_result_folder=sys.argv[2]
group_name = sys.argv[3]
destination = sys.argv[4]
derivedDataPath = sys.argv[5]
with open(jsonfilename, 'r') as jsonfile:
jsonstring = jsonfile.read()
testConfigure = demjson.decode(jsonstring)
runningConfigure = testConfigure['runningConfigure']
projectName = runningConfigure['projectName']
projectPath = runningConfigure['projectPath']
schemeName = runningConfigure['schemeName']
sdkName = runningConfigure['sdkName']
print("group name:", group_name)
testgroup = testConfigure[group_name]
testlist = testgroup['test_list']
if 'projectName' in testgroup.keys() :
projectName = testgroup['projectName']
if 'projectPath' in testgroup.keys():
projectPath = testgroup['projectPath']
if 'schemeName' in testgroup.keys():
schemeName = testgroup['schemeName']
print("projectName, projectPath, schemeName, destination", projectName, projectPath, schemeName, destination)
# testcommandhead = f"xcodebuild test-without-building -project {projectName} -scheme {schemeName} -sdk {sdkName} -destination 'platform={paltformName},name={deviceName},OS={osVersion}'"
# testcommandtail = " | tee raw.log | xcpretty -r junit | tee xcpretty.log"
runcommand('echo "export testresult=0" >> $BASH_ENV')
testresult = 0
for testname in testlist:
print("-------------------------------", testname , "-------------------------------");
test = testlist[testname]
testarguments = ' -only-testing:' + testname
#create skipping tests parameters
skipingtests = ""
if 'excludetests' in test:
for skipingtest in test['excludetests']:
skipingtests += ' -skip-testing:' + testname+ "/" + skipingtest
print("excludetests:", skipingtests)
exit_code = runtest(testarguments + skipingtests, projectPath, schemeName, projectName, destination, derivedDataPath)
print(testname, "exit code:", exit_code)
# if test fails, check if the failed tests can be retried
if exit_code == 65:
retriabletimes = 3 ;
if 'retriabletimes' in test:
retriabletimes = test['retriabletimes']
if retriabletimes > 1:
#get all failed test cases
faileds = getfailedcases()
if len(faileds) == 0 :
print("test command return an error code, but the failed test cases is 0")
print("exit code:", exit_code)
break;
print("failed tests:",faileds)
retrytimes = 1
print('retriabletimes:', retriabletimes)
while retrytimes <= retriabletimes and exit_code > 0:
print("retry ", testname, "for ", retrytimes, " times")
testarguments = ""
for failed in faileds:
testarguments += ' -only-testing:' + failed
retrytimes += 1
exit_code = runtest(testarguments,projectPath, schemeName, projectName, destination, derivedDataPath);
print("retry exit code:", exit_code)
if(exit_code != 0 ):
faileds = getfailedcases()
if exit_code != 0 :
print("exit code:", exit_code)
runcommand('mkdir -p {0}/{1}'.format(test_result_folder,testname))
runcommand('echo "{2}" >> {0}/{1}/exitcode.log'.format(test_result_folder,testname,exit_code))
runcommand('mv raw.log {0}/{1}/raw.log'.format(test_result_folder,testname))
runcommand('mv xcpretty.log {0}/{1}/xcpretty.log'.format(test_result_folder,testname))
runcommand('cp build/reports/junit.xml {0}/{1}/junit.xml'.format(test_result_folder,testname))
ignorefailure = False ;
if exit_code == 65 :
failedtests = getfailedcases(False)
print("failedtests:", failedtests)
if 'ignoreFailures' in test and failedtests :
ignoreFailures = set(test['ignoreFailures'])
if failedtests.issubset(ignoreFailures):
print("There are failed testcases that can be ignored")
ignorefailure = True;
else :
print("Failed testcases that cannot be ignored: ", failedtests - ignoreFailures )
if not ignorefailure:
print("There are faillures in the test")
testresult = 1
else:
print("Test succeed")
print("testresult:", testresult)
runcommand('echo "export testresult={0}" >> $BASH_ENV'.format(testresult))
| [((61, 17, 61, 43), 'demjson.decode', 'demjson.decode', ({(61, 32, 61, 42): 'jsonstring'}, {}), '(jsonstring)', False, 'import demjson\n'), ((82, 0, 82, 53), 'functions.runcommand', 'runcommand', ({(82, 11, 82, 52): '"""echo "export testresult=0" >> $BASH_ENV"""'}, {}), '(\'echo "export testresult=0" >> $BASH_ENV\')', False, 'from functions import runcommand\n'), ((12, 11, 12, 28), 'xml.etree.ElementTree.parse', 'ET.parse', ({(12, 20, 12, 27): 'xmlfile'}, {}), '(xmlfile)', True, 'import xml.etree.ElementTree as ET\n'), ((32, 4, 32, 28), 'functions.runcommand', 'runcommand', ({(32, 15, 32, 27): '"""rm raw.log"""'}, {}), "('rm raw.log')", False, 'from functions import runcommand\n'), ((33, 4, 33, 33), 'functions.runcommand', 'runcommand', ({(33, 15, 33, 32): '"""rm xcpretty.log"""'}, {}), "('rm xcpretty.log')", False, 'from functions import runcommand\n'), ((37, 16, 37, 68), 'functions.runcommand', 'runcommand', (), '', False, 'from functions import runcommand\n'), ((41, 4, 41, 31), 'functions.runcommand', 'runcommand', ({(41, 15, 41, 30): 'xcprettycommand'}, {}), '(xcprettycommand)', False, 'from functions import runcommand\n')] |
kernelmethod/Seagrass | seagrass/hooks/__init__.py | 52c5f1852fb2d52b3d94411c2a49c3da6fab6c6c | # flake8: noqa: F401
from .context_manager_hook import ContextManagerHook
from .counter_hook import CounterHook
from .file_open_hook import FileOpenHook
from .logging_hook import LoggingHook
from .profiler_hook import ProfilerHook
from .runtime_audit_hook import RuntimeAuditHook
from .stack_trace_hook import StackTraceHook
from .timer_hook import TimerHook
from .tracing_hook import TracingHook
__all__ = [
"CounterHook",
"FileOpenHook",
"LoggingHook",
"ProfilerHook",
"StackTraceHook",
"RuntimeAuditHook",
"TimerHook",
"TracingHook",
]
| [] |
aschleg/hypy | tests/test_internal.py | d5b8451dcd24b803bbf2eebc46bc3acfd64d8edc | import pytest
import numpy as np
import pandas as pd
from hypothetical._lib import _build_des_mat
def test_array():
d = np.array([[1., 1.11, 2.569, 3.58, 0.76],
[1., 1.19, 2.928, 3.75, 0.821],
[1., 1.09, 2.865, 3.93, 0.928],
[1., 1.25, 3.844, 3.94, 1.009],
[1., 1.11, 3.027, 3.6, 0.766],
[1., 1.08, 2.336, 3.51, 0.726],
[1., 1.11, 3.211, 3.98, 1.209],
[1., 1.16, 3.037, 3.62, 0.75],
[2., 1.05, 2.074, 4.09, 1.036],
[2., 1.17, 2.885, 4.06, 1.094],
[2., 1.11, 3.378, 4.87, 1.635],
[2., 1.25, 3.906, 4.98, 1.517],
[2., 1.17, 2.782, 4.38, 1.197],
[2., 1.15, 3.018, 4.65, 1.244],
[2., 1.17, 3.383, 4.69, 1.495],
[2., 1.19, 3.447, 4.4, 1.026],
[3., 1.07, 2.505, 3.76, 0.912],
[3., 0.99, 2.315, 4.44, 1.398],
[3., 1.06, 2.667, 4.38, 1.197],
[3., 1.02, 2.39, 4.67, 1.613],
[3., 1.15, 3.021, 4.48, 1.476],
[3., 1.2, 3.085, 4.78, 1.571],
[3., 1.2, 3.308, 4.57, 1.506],
[3., 1.17, 3.231, 4.56, 1.458],
[4., 1.22, 2.838, 3.89, 0.944],
[4., 1.03, 2.351, 4.05, 1.241],
[4., 1.14, 3.001, 4.05, 1.023],
[4., 1.01, 2.439, 3.92, 1.067],
[4., 0.99, 2.199, 3.27, 0.693],
[4., 1.11, 3.318, 3.95, 1.085],
[4., 1.2, 3.601, 4.27, 1.242],
[4., 1.08, 3.291, 3.85, 1.017],
[5., 0.91, 1.532, 4.04, 1.084],
[5., 1.15, 2.552, 4.16, 1.151],
[5., 1.14, 3.083, 4.79, 1.381],
[5., 1.05, 2.33, 4.42, 1.242],
[5., 0.99, 2.079, 3.47, 0.673],
[5., 1.22, 3.366, 4.41, 1.137],
[5., 1.05, 2.416, 4.64, 1.455],
[5., 1.13, 3.1, 4.57, 1.325],
[6., 1.11, 2.813, 3.76, 0.8],
[6., 0.75, 0.84, 3.14, 0.606],
[6., 1.05, 2.199, 3.75, 0.79],
[6., 1.02, 2.132, 3.99, 0.853],
[6., 1.05, 1.949, 3.34, 0.61],
[6., 1.07, 2.251, 3.21, 0.562],
[6., 1.13, 3.064, 3.63, 0.707],
[6., 1.11, 2.469, 3.95, 0.952]])
return d
def test_build_design_matrix():
dat = test_array()
dat_df = pd.DataFrame(dat)
des_mat = _build_des_mat(dat[:, 1], dat[:, 2], dat[:, 3], dat[:, 4], group=dat[:, 0])
des_mat_df = _build_des_mat(dat_df[1], dat_df[2], dat_df[3], dat_df[4], group=dat_df[0])
des_mat_no_group = _build_des_mat(dat[:, 1], dat[:, 2], dat[:, 3], dat[:, 4])
des_mat_group_df = _build_des_mat(dat[:, 1], dat[:, 2], dat[:, 3], dat[:, 4], group=pd.DataFrame(dat[:, 0]))
des_mat_group_df = _build_des_mat(dat[:, 1], dat[:, 2], dat[:, 3], dat[:, 4], group=pd.DataFrame(dat[:, 0]))
assert isinstance(des_mat, np.ndarray)
assert des_mat.shape == dat.shape
assert isinstance(des_mat_df, np.ndarray)
assert des_mat_df.shape == dat.shape
assert isinstance(des_mat_no_group, np.ndarray)
assert des_mat_no_group.shape[1] == 2
assert isinstance(des_mat, np.ndarray)
assert des_mat_group_df.shape == dat.shape
def test_build_matrix():
arr1 = [4, 4, 5, 5, 3, 2, 5]
arr2 = [2, 3, 3, 3, 3, 3, 3]
| [((8, 8, 55, 50), 'numpy.array', 'np.array', ({(8, 17, 55, 49): '[[1.0, 1.11, 2.569, 3.58, 0.76], [1.0, 1.19, 2.928, 3.75, 0.821], [1.0, \n 1.09, 2.865, 3.93, 0.928], [1.0, 1.25, 3.844, 3.94, 1.009], [1.0, 1.11,\n 3.027, 3.6, 0.766], [1.0, 1.08, 2.336, 3.51, 0.726], [1.0, 1.11, 3.211,\n 3.98, 1.209], [1.0, 1.16, 3.037, 3.62, 0.75], [2.0, 1.05, 2.074, 4.09, \n 1.036], [2.0, 1.17, 2.885, 4.06, 1.094], [2.0, 1.11, 3.378, 4.87, 1.635\n ], [2.0, 1.25, 3.906, 4.98, 1.517], [2.0, 1.17, 2.782, 4.38, 1.197], [\n 2.0, 1.15, 3.018, 4.65, 1.244], [2.0, 1.17, 3.383, 4.69, 1.495], [2.0, \n 1.19, 3.447, 4.4, 1.026], [3.0, 1.07, 2.505, 3.76, 0.912], [3.0, 0.99, \n 2.315, 4.44, 1.398], [3.0, 1.06, 2.667, 4.38, 1.197], [3.0, 1.02, 2.39,\n 4.67, 1.613], [3.0, 1.15, 3.021, 4.48, 1.476], [3.0, 1.2, 3.085, 4.78, \n 1.571], [3.0, 1.2, 3.308, 4.57, 1.506], [3.0, 1.17, 3.231, 4.56, 1.458],\n [4.0, 1.22, 2.838, 3.89, 0.944], [4.0, 1.03, 2.351, 4.05, 1.241], [4.0,\n 1.14, 3.001, 4.05, 1.023], [4.0, 1.01, 2.439, 3.92, 1.067], [4.0, 0.99,\n 2.199, 3.27, 0.693], [4.0, 1.11, 3.318, 3.95, 1.085], [4.0, 1.2, 3.601,\n 4.27, 1.242], [4.0, 1.08, 3.291, 3.85, 1.017], [5.0, 0.91, 1.532, 4.04,\n 1.084], [5.0, 1.15, 2.552, 4.16, 1.151], [5.0, 1.14, 3.083, 4.79, 1.381\n ], [5.0, 1.05, 2.33, 4.42, 1.242], [5.0, 0.99, 2.079, 3.47, 0.673], [\n 5.0, 1.22, 3.366, 4.41, 1.137], [5.0, 1.05, 2.416, 4.64, 1.455], [5.0, \n 1.13, 3.1, 4.57, 1.325], [6.0, 1.11, 2.813, 3.76, 0.8], [6.0, 0.75, \n 0.84, 3.14, 0.606], [6.0, 1.05, 2.199, 3.75, 0.79], [6.0, 1.02, 2.132, \n 3.99, 0.853], [6.0, 1.05, 1.949, 3.34, 0.61], [6.0, 1.07, 2.251, 3.21, \n 0.562], [6.0, 1.13, 3.064, 3.63, 0.707], [6.0, 1.11, 2.469, 3.95, 0.952]]'}, {}), '([[1.0, 1.11, 2.569, 3.58, 0.76], [1.0, 1.19, 2.928, 3.75, 0.821],\n [1.0, 1.09, 2.865, 3.93, 0.928], [1.0, 1.25, 3.844, 3.94, 1.009], [1.0,\n 1.11, 3.027, 3.6, 0.766], [1.0, 1.08, 2.336, 3.51, 0.726], [1.0, 1.11, \n 3.211, 3.98, 1.209], [1.0, 1.16, 3.037, 3.62, 0.75], [2.0, 1.05, 2.074,\n 4.09, 1.036], [2.0, 1.17, 2.885, 4.06, 1.094], [2.0, 1.11, 3.378, 4.87,\n 1.635], [2.0, 1.25, 3.906, 4.98, 1.517], [2.0, 1.17, 2.782, 4.38, 1.197\n ], [2.0, 1.15, 3.018, 4.65, 1.244], [2.0, 1.17, 3.383, 4.69, 1.495], [\n 2.0, 1.19, 3.447, 4.4, 1.026], [3.0, 1.07, 2.505, 3.76, 0.912], [3.0, \n 0.99, 2.315, 4.44, 1.398], [3.0, 1.06, 2.667, 4.38, 1.197], [3.0, 1.02,\n 2.39, 4.67, 1.613], [3.0, 1.15, 3.021, 4.48, 1.476], [3.0, 1.2, 3.085, \n 4.78, 1.571], [3.0, 1.2, 3.308, 4.57, 1.506], [3.0, 1.17, 3.231, 4.56, \n 1.458], [4.0, 1.22, 2.838, 3.89, 0.944], [4.0, 1.03, 2.351, 4.05, 1.241\n ], [4.0, 1.14, 3.001, 4.05, 1.023], [4.0, 1.01, 2.439, 3.92, 1.067], [\n 4.0, 0.99, 2.199, 3.27, 0.693], [4.0, 1.11, 3.318, 3.95, 1.085], [4.0, \n 1.2, 3.601, 4.27, 1.242], [4.0, 1.08, 3.291, 3.85, 1.017], [5.0, 0.91, \n 1.532, 4.04, 1.084], [5.0, 1.15, 2.552, 4.16, 1.151], [5.0, 1.14, 3.083,\n 4.79, 1.381], [5.0, 1.05, 2.33, 4.42, 1.242], [5.0, 0.99, 2.079, 3.47, \n 0.673], [5.0, 1.22, 3.366, 4.41, 1.137], [5.0, 1.05, 2.416, 4.64, 1.455\n ], [5.0, 1.13, 3.1, 4.57, 1.325], [6.0, 1.11, 2.813, 3.76, 0.8], [6.0, \n 0.75, 0.84, 3.14, 0.606], [6.0, 1.05, 2.199, 3.75, 0.79], [6.0, 1.02, \n 2.132, 3.99, 0.853], [6.0, 1.05, 1.949, 3.34, 0.61], [6.0, 1.07, 2.251,\n 3.21, 0.562], [6.0, 1.13, 3.064, 3.63, 0.707], [6.0, 1.11, 2.469, 3.95,\n 0.952]])', True, 'import numpy as np\n'), ((62, 13, 62, 30), 'pandas.DataFrame', 'pd.DataFrame', ({(62, 26, 62, 29): 'dat'}, {}), '(dat)', True, 'import pandas as pd\n'), ((64, 14, 64, 89), 'hypothetical._lib._build_des_mat', '_build_des_mat', (), '', False, 'from hypothetical._lib import _build_des_mat\n'), ((65, 17, 65, 92), 'hypothetical._lib._build_des_mat', '_build_des_mat', (), '', False, 'from hypothetical._lib import _build_des_mat\n'), ((67, 23, 67, 81), 'hypothetical._lib._build_des_mat', '_build_des_mat', ({(67, 38, 67, 47): 'dat[:, (1)]', (67, 49, 67, 58): 'dat[:, (2)]', (67, 60, 67, 69): 'dat[:, (3)]', (67, 71, 67, 80): 'dat[:, (4)]'}, {}), '(dat[:, (1)], dat[:, (2)], dat[:, (3)], dat[:, (4)])', False, 'from hypothetical._lib import _build_des_mat\n'), ((69, 88, 69, 111), 'pandas.DataFrame', 'pd.DataFrame', ({(69, 101, 69, 110): 'dat[:, (0)]'}, {}), '(dat[:, (0)])', True, 'import pandas as pd\n'), ((71, 88, 71, 111), 'pandas.DataFrame', 'pd.DataFrame', ({(71, 101, 71, 110): 'dat[:, (0)]'}, {}), '(dat[:, (0)])', True, 'import pandas as pd\n')] |
JamesWang007/Open3D-PointNet | download.py | 402847ceef8d364672ca7d81e0afebcb445cceb5 | #!/usr/bin/env python3
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""Download big files from Google Drive."""
import shutil
import sys
import requests
import os
import time
import urllib.request
import zipfile
def reporthook(count, block_size, total_size):
global start_time
if count == 0:
start_time = time.time()
return
duration = time.time() - start_time
progress_size = int(count * block_size)
speed = int(progress_size / (1024 * duration))
percent = int(count * block_size * 100 / total_size)
if percent % 5 == 0:
sys.stdout.write("\r...%d%%, %d MB, %d KB/s, %d seconds passed" %
(percent, progress_size / (1024 * 1024), speed, duration))
sys.stdout.flush()
def sizeof_fmt(num, suffix='B'):
# https://stackoverflow.com/a/1094933/5308925
for unit in ['','K','M','G','T','P','E','Z']:
if abs(num) < 1000.0:
return "%3.2f%s%s" % (num, unit, suffix)
num /= 1000.0
return "%.2f%s%s" % (num, 'Yi', suffix)
def print_status(destination, progress):
message = "Downloading %s... %s" % (destination, sizeof_fmt(progress))
empty_space = shutil.get_terminal_size((80, 20)).columns - len(message)
sys.stdout.write('\r' + message + empty_space * ' ')
sys.stdout.flush()
def download_file_from_google_drive(id, destination):
# https://stackoverflow.com/a/39225039/5308925
def save_response_content(response, destination):
chunk_size = 32768
written_size = 0
with open(destination, "wb") as f:
for chunk in response.iter_content(chunk_size):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
written_size += chunk_size
print_status(destination, written_size)
print('Done.')
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
return None
url = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(url, params={'id': id}, stream=True)
token = get_confirm_token(response)
if token:
params = {'id': id, 'confirm': token}
response = session.get(url, params=params, stream=True)
save_response_content(response, destination)
def download_contents():
# download model
model_path = './cls_model.pth'
if os.path.isfile(model_path):
print('Model file already downloaded in', model_path)
else:
download_file_from_google_drive('1WWf5B5fmik5_P1dwxltJ-atRkYeCcCC5', './cls_model.pth')
# download dataset
dataset_path = './shapenetcore_partanno_segmentation_benchmark_v0.zip'
if os.path.isfile(dataset_path):
print('Dataset file already downloaded in', dataset_path)
else:
dataset_url = 'https://shapenet.cs.stanford.edu/ericyi/shapenetcore_partanno_segmentation_benchmark_v0.zip'
urllib.request.urlretrieve(dataset_url, os.path.basename(dataset_url), reporthook)
# unzip dataset
zip_ref = zipfile.ZipFile(os.path.basename(dataset_url), 'r')
zip_ref.extractall('.')
zip_ref.close()
print('Now unzipping...Wait for 2 minutes ish...!')
return 0
if __name__ == '__main__':
download_contents()
| [((46, 4, 46, 56), 'sys.stdout.write', 'sys.stdout.write', ({(46, 21, 46, 55): "('\\r' + message + empty_space * ' ')"}, {}), "('\\r' + message + empty_space * ' ')", False, 'import sys\n'), ((47, 4, 47, 22), 'sys.stdout.flush', 'sys.stdout.flush', ({}, {}), '()', False, 'import sys\n'), ((74, 14, 74, 32), 'requests.Session', 'requests.Session', ({}, {}), '()', False, 'import requests\n'), ((89, 7, 89, 33), 'os.path.isfile', 'os.path.isfile', ({(89, 22, 89, 32): 'model_path'}, {}), '(model_path)', False, 'import os\n'), ((96, 7, 96, 35), 'os.path.isfile', 'os.path.isfile', ({(96, 22, 96, 34): 'dataset_path'}, {}), '(dataset_path)', False, 'import os\n'), ((22, 21, 22, 32), 'time.time', 'time.time', ({}, {}), '()', False, 'import time\n'), ((24, 15, 24, 26), 'time.time', 'time.time', ({}, {}), '()', False, 'import time\n'), ((30, 8, 31, 70), 'sys.stdout.write', 'sys.stdout.write', ({(30, 25, 31, 69): "('\\r...%d%%, %d MB, %d KB/s, %d seconds passed' % (percent, progress_size /\n (1024 * 1024), speed, duration))"}, {}), "('\\r...%d%%, %d MB, %d KB/s, %d seconds passed' % (percent,\n progress_size / (1024 * 1024), speed, duration))", False, 'import sys\n'), ((32, 8, 32, 26), 'sys.stdout.flush', 'sys.stdout.flush', ({}, {}), '()', False, 'import sys\n'), ((45, 18, 45, 52), 'shutil.get_terminal_size', 'shutil.get_terminal_size', ({(45, 43, 45, 51): '(80, 20)'}, {}), '((80, 20))', False, 'import shutil\n'), ((100, 48, 100, 77), 'os.path.basename', 'os.path.basename', ({(100, 65, 100, 76): 'dataset_url'}, {}), '(dataset_url)', False, 'import os\n'), ((103, 34, 103, 63), 'os.path.basename', 'os.path.basename', ({(103, 51, 103, 62): 'dataset_url'}, {}), '(dataset_url)', False, 'import os\n')] |
cklwblove/python-100-days-source-code | ls12/demo5.py | 5d66c7708047f0d7bac0ce05d21834bbbfa6ccf1 | # -*- coding: utf-8 -*-
"""
将耗时间的任务放到线程中以获得更好的用户体验。
"""
import time
import tkinter
import tkinter.messagebox
def download():
# 模拟下载任务需要花费10秒时间
time.sleep(10)
tkinter.messagebox.showinfo('提示', '下载完成')
def show_about():
tkinter.messagebox.showinfo('关于', '作者:罗浩')
def main():
top = tkinter.Tk()
top.title('单线程')
top.geometry('200x150')
top.wm_attributes('-topmost', True)
panel = tkinter.Frame(top)
button1 = tkinter.Button(panel, text='下载', command=download)
button1.pack(side='left')
button2 = tkinter.Button(panel, text='关于', command=show_about)
button2.pack(side='right')
panel.pack(side='bottom')
tkinter.mainloop()
if __name__ == '__main__':
main()
| [((12, 4, 12, 18), 'time.sleep', 'time.sleep', ({(12, 15, 12, 17): '(10)'}, {}), '(10)', False, 'import time\n'), ((13, 4, 13, 57), 'tkinter.messagebox.showinfo', 'tkinter.messagebox.showinfo', ({(13, 32, 13, 40): '"""提示"""', (13, 42, 13, 56): '"""下载完成"""'}, {}), "('提示', '下载完成')", False, 'import tkinter\n'), ((17, 4, 17, 60), 'tkinter.messagebox.showinfo', 'tkinter.messagebox.showinfo', ({(17, 32, 17, 40): '"""关于"""', (17, 42, 17, 59): '"""作者:罗浩"""'}, {}), "('关于', '作者:罗浩')", False, 'import tkinter\n'), ((21, 10, 21, 22), 'tkinter.Tk', 'tkinter.Tk', ({}, {}), '()', False, 'import tkinter\n'), ((26, 12, 26, 30), 'tkinter.Frame', 'tkinter.Frame', ({(26, 26, 26, 29): 'top'}, {}), '(top)', False, 'import tkinter\n'), ((27, 14, 27, 68), 'tkinter.Button', 'tkinter.Button', (), '', False, 'import tkinter\n'), ((29, 14, 29, 70), 'tkinter.Button', 'tkinter.Button', (), '', False, 'import tkinter\n'), ((33, 4, 33, 22), 'tkinter.mainloop', 'tkinter.mainloop', ({}, {}), '()', False, 'import tkinter\n')] |
mygreentour/hangoutsbot | hangupsbot/sinks/gitlab/simplepush.py | 9ea2da10f546e6f1dd06c8240187049501c5452a | """
GitLab webhook receiver - see http://doc.gitlab.com/ee/web_hooks/web_hooks.html
"""
import asyncio
import json
import logging
from sinks.base_bot_request_handler import AsyncRequestHandler
logger = logging.getLogger(__name__)
try:
import dateutil.parser
except ImportError:
logger.error("missing module python_dateutil: pip3 install python_dateutil")
raise
class webhookReceiver(AsyncRequestHandler):
"""Receive REST API posts from GitLab"""
_bot = None
@asyncio.coroutine
def process_request(self, path, dummy_query_string, content):
"""Process a received POST to a given converstation"""
path = path.split("/")
conv_or_user_id = path[1]
if conv_or_user_id is None:
logger.error("conversation or user id must be provided as part of path")
return
try:
payload = json.loads(content)
except json.JSONDecodeError as err:
logger.exception("invalid payload @%d:%d: %s", err.lineno, err.colno, err)
logger.error("GitLab message: %s", json.dumps(payload))
refs = payload.get("ref", '').split("/")
user = payload.get("user_name")
if not user:
user = payload["user"]["name"]
message = ["GitLab update for [{}]({}) by __{}__".format(
payload["project"]["name"], payload["project"]["web_url"], user)]
if payload["object_kind"] == "push":
message.append("Pushed {} commit(s) on {} branch:".format(
payload["total_commits_count"], "/".join(refs[2:])))
for commit in payload["commits"]:
message.append("{} -- {} at [{:%c}]({})".format(
commit["message"], commit["author"]["name"],
dateutil.parser.parse(commit["timestamp"]), commit["url"]))
elif payload["object_kind"] == "tag_push":
message.append("Pushed tag {}]".format("/".join(refs[2:])))
elif payload["object_kind"] == "issue":
issue = payload["object_attributes"]
message.append("Update {} issue {} at {:%c}\n[{}]({})".format(
issue["state"], issue["id"],
dateutil.parser.parse(issue["updated_at"]),
issue["title"], issue["url"]))
elif payload["object_kind"] == "note":
note = payload["object_attributes"]
message.append("{} note on {}: [{}]({})".format(
note["notable_type"], note["id"], note["note"], note["url"]))
elif payload["object_kind"] == "merge_request":
request = payload["object_attributes"]
message.append("Merge request {}: from [{}:{}]({}) to [{}:{}]({})".format(
request["id"],
request["source"]["name"], request["source_branch"], request["source"]["web_url"],
request["target"]["name"], request["target_branch"], request["target"]["web_url"]))
else:
message.append("{}: unknown gitlab webhook object kind".format(payload["object_kind"]))
logger.warning("%s: unknown gitlab webhook object kind", payload["object_kind"])
if message:
yield from self.send_data(conv_or_user_id, "\n".join(message))
| [((11, 9, 11, 36), 'logging.getLogger', 'logging.getLogger', ({(11, 27, 11, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((33, 22, 33, 41), 'json.loads', 'json.loads', ({(33, 33, 33, 40): 'content'}, {}), '(content)', False, 'import json\n'), ((37, 43, 37, 62), 'json.dumps', 'json.dumps', ({(37, 54, 37, 61): 'payload'}, {}), '(payload)', False, 'import json\n')] |
cbchoi/nppsim | evsim/assessor.py | 4d096f9d2fdb5ebf3e3e83be7b1974bfc92554c1 | from evsim.system_simulator import SystemSimulator
from evsim.behavior_model_executor import BehaviorModelExecutor
from evsim.system_message import SysMessage
from evsim.definition import *
import os
import subprocess as sp
class Assessor(BehaviorModelExecutor):
def __init__(self, instance_time, destruct_time, name, engine_name):
BehaviorModelExecutor.__init__(self, instance_time, destruct_time, name, engine_name)
# Open CSV
self.init_state("IDLE")
self.insert_state("IDLE", Infinite)
self.insert_state("MOVE", 1)
self.insert_input_port("assess")
self.insert_output_port("done")
def ext_trans(self,port, msg):
data = msg.retrieve()
#print("Assessor")
#print(str(datetime.datetime.now()) + " " + str(data[0]))
#temp = "[%f] %s" % (SystemSimulator().get_engine(self.engine_name).get_global_time(), str(data[0]))
#print(temp)
def output(self):
#temp = "[%f] %s" % (SystemSimulator().get_engine(self.engine_name).get_global_time(), "Human Receiver Object: Move")
#print(temp)
return None
def int_trans(self):
self._cur_state = "MOVE" | [((11, 8, 11, 93), 'evsim.behavior_model_executor.BehaviorModelExecutor.__init__', 'BehaviorModelExecutor.__init__', ({(11, 39, 11, 43): 'self', (11, 45, 11, 58): 'instance_time', (11, 60, 11, 73): 'destruct_time', (11, 75, 11, 79): 'name', (11, 81, 11, 92): 'engine_name'}, {}), '(self, instance_time, destruct_time, name,\n engine_name)', False, 'from evsim.behavior_model_executor import BehaviorModelExecutor\n')] |
NEISSproject/TEIEntityEnricher | tei_entity_enricher/interface/postprocessing/gnd_connector.py | 09a4a932b30886e50965959935dc803b36063e36 | import os
from typing import Union, List
from tei_entity_enricher.interface.postprocessing.io import FileReader, FileWriter
from tei_entity_enricher.util.helper import local_save_path, makedir_if_necessary
from tei_entity_enricher.util.exceptions import FileNotFound
class GndConnector:
def __init__(
self,
gnd_id: Union[str, List[str], None] = None,
apiindex: int = 0,
check_connectivity: bool = True,
show_printmessages: bool = True,
) -> None:
"""establishes connection to api, from which norm data for entities of Deutsche Nationalbibliothek´s database is retrieved,
loaded data can be passed to an instance of Cache class for further processing or FileWriter class to save it
gnd_id:
gnd id number(s)
apiindex:
index of selected api in list defined in self.apilist
check_connectivity:
execute connectivity check in __init__() or not (see connectivitycheck_loop())
show_printmessages:
show class internal printmessages on runtime or not
apilist_filepath:
path to apilist config file
apilist:
list of dicts as configuration data set, delivers a mapping to be able to normalize data from different apis, defines api`s url and aliases for filtering purposes (see get_gnd_data())
connection_established:
data from an api has already been received or not
remaining_apis_to_check:
list of apiindex values, which have not been checked yet in connectivitycheck_loop()"""
print("initializing GndConnector..") if show_printmessages else None
self.show_printmessages: bool = show_printmessages
self.gnd_id: Union[str, List[str], None] = gnd_id
self.apiindex: int = apiindex
self.apilist_filepath: str = os.path.join(local_save_path, "config", "postprocessing", "gnd_apilist.json")
try:
self.apilist: Union[dict, None] = FileReader(
filepath=self.apilist_filepath, origin="local", internal_call=True, show_printmessages=False
).loadfile_json()
except FileNotFound:
print(
"GndConnector: could not find gnd_apilist.json in config dir. creating file with default settings..."
) if self.show_printmessages else None
self.apilist: List[dict] = [
{
"name": "culturegraph",
"baseUrl": "https://hub.culturegraph.org/entityfacts/{}",
"baseAliases": {
"type": [
"@type",
"str",
"categorial",
{
"person": "person",
"organisation": "organisation",
"place": "place",
},
],
"name": ["preferredName", "str", "nominal"],
"furtherNames": ["variantName", ["str"], "nominal"],
"sameAs": ["sameAs", [{"@id": "str"}], "nominal"],
"pseudonyms": [
"pseudonym",
[{"preferredName": "str"}],
"nominal",
],
},
"personAliases": {},
"placeAliases": {},
"organizationAliases": {},
},
{
"name": "lobid",
"baseUrl": "http://lobid.org/gnd/{}",
"baseAliases": {
"type": [
"type",
["str"],
"categorial",
{
"person": "Person",
"organisation": "CorporateBody",
"place": "PlaceOrGeographicName",
},
],
"name": ["preferredName", "str", "nominal"],
"furtherNames": ["variantName", ["str"], "nominal"],
"sameAs": ["sameAs", [{"id": "str"}], "nominal"],
"pseudonyms": [
"variantNameEntityForThePerson",
[{"forename": ["str"], "surname": ["str"]}],
"nominal",
],
},
"personAliases": {},
"placeAliases": {},
"organizationAliases": {},
},
]
self.apiindex: int = 0
try:
makedir_if_necessary(os.path.dirname(self.apilist_filepath))
FileWriter(data=self.apilist, filepath=self.apilist_filepath).writefile_json()
except:
print(
f"GndConnector __init__(): could not create default gnd_apilist.json in config folder."
) if self.show_printmessages == True else None
self.check_connectivity: bool = check_connectivity
self.connection_established: bool = False
self.remaining_apis_to_check: list = [i for i, _ in enumerate(self.apilist)]
if self.check_connectivity == True:
self.connectivitycheck_loop()
else:
print(
"GndConnector: initialization has been done without connectivity check."
) if self.show_printmessages else None
def connectivitycheck_single(self, index_to_test: int, gnd_id_to_test: str = "118540238") -> bool:
"""auxiliary method of connectivitycheck_loop(),
checks a single api`s (from self.apilist) response status code and checks if response data type is json,
preset gnd_id_to_test value refers to Goethe"""
try:
result: dict = FileReader(
filepath=self.apilist[index_to_test]["baseUrl"].format(gnd_id_to_test),
origin="web",
internal_call=True,
show_printmessages=self.show_printmessages,
).loadfile_json()
except:
return False
if type(result) == dict:
return True
return False
def connectivitycheck_loop(self) -> int:
"""recursive connectivity check, checking every single api in self.apilist (ascending)
and setting self.apiindex to the value of those api, which is first to pass the check successfully.
returns 0 or -1 for unittest purposes"""
if self.check_connectivity == False:
self.check_connectivity == True
if len(self.remaining_apis_to_check) > 0:
if self.connectivitycheck_single(self.remaining_apis_to_check[0]) == True:
print(
f"GndConnector: connectivity check passed, connection to {self.apilist[self.remaining_apis_to_check[0]]['name']} api established."
) if self.show_printmessages else None
self.apiindex = self.remaining_apis_to_check[0]
self.remaining_apis_to_check = [i for i, _ in enumerate(self.apilist)]
self.connection_established = True
return 0
else:
print(
f"GndConnector connectivity check: {self.apilist[self.remaining_apis_to_check[0]]['name']} api is currently not responding as expected. checking for alternatives..."
) if self.show_printmessages else None
self.remaining_apis_to_check.remove(self.remaining_apis_to_check[0])
self.connectivitycheck_loop()
else:
print(
"GndConnector connectivity check error: none of the listed apis is responding as expected."
) if self.show_printmessages else None
return -1
def print_complete_url(self, index: int = 0) -> int:
"""print baseUrl string of the currently selected api defined in self.apilist,
formatted with a gnd id number of self.gnd_id (list or str) selected by index value.
returns 0 or -1 for unittest purposes"""
if self.apiindex not in [i for i, _ in enumerate(self.apilist)]:
print(
"GndConnector print_complete_url() error: apiindex is not defined correctly. using default api..."
) if self.show_printmessages else None
self.apiindex = 0
if self.gnd_id is not None:
if type(self.gnd_id) == str:
print(
f"GndConnector complete URL: {self.apilist[self.apiindex]['baseUrl'].format(self.gnd_id)}"
) if self.show_printmessages else None
elif type(self.gnd_id) == list:
print(
f"GndConnector complete URL of gnd id number {index + 1} in passed gnd id list: {self.apilist[self.apiindex]['baseUrl'].format(self.gnd_id[index])}"
) if self.show_printmessages else None
return 0
else:
print(
"GndConnector print_complete_url() internal error: no gnd id number has been passed to connector object yet."
) if self.show_printmessages else None
return -1
def return_complete_url(self, index: int = 0) -> Union[str, None]:
"""return baseUrl string of the currently selected api defined in self.apilist,
formatted with a gnd id number of self.gnd_id (list or str) selected by index value"""
if self.apiindex not in [i for i, _ in enumerate(self.apilist)]:
print(
"GndConnector return_complete_url() error: apiindex is not defined correctly. using default api..."
) if self.show_printmessages else None
self.apiindex = 0
if self.gnd_id is not None:
if type(self.gnd_id) == str:
return self.apilist[self.apiindex]["baseUrl"].format(self.gnd_id)
elif type(self.gnd_id) == list:
return self.apilist[self.apiindex]["baseUrl"].format(self.gnd_id[index])
else:
print(
"GndConnector return_complete_url() internal error: no gnd id number has been passed to connector object yet."
) if self.show_printmessages else None
return None
def get_gnd_data(self, data_selection: Union[str, List[str], None] = None) -> Union[dict, None]:
"""method to receive data from api with the possibility to filter results,
a dict is created, having gnd id numbers as keys and filtered or unfiltered response json data as values
data_selection:
if delivered, a normalized output is generated by renaming keys and re-sorting data from different keys from the raw data into new keys (purpose: json data delivered by different apis comes in different key-value-structures; normalization of this data is achieved with the help of key-value mapping information stored in self.apilist)
can be "base" (all baseAliases data is provided: "type", "name", "furtherNames", "sameAs", "pseudonyms")
can be a list of one or more baseAliases (i.e. ["type", "name"])
(not yet implemented: can be a "person", "place", "organization" or a custom string refering to a user-defined set of keys, for which the mapping is provided in self.apilist)
"""
if self.check_connectivity == False:
print(
f"GndConnector note: connections to apis have not been checked yet. to do so manually execute connectivitycheck_loop() method of the current connector object. continuing attempt to receive gnd data from {self.apilist[self.apiindex]['name']} api..."
) if self.show_printmessages else None
elif self.connection_established == False:
print(
"GndConnector connectivity error: after connectivity check no connection could has been established to any of the available apis. gnd data queries can not be executed at the moment."
) if self.show_printmessages else None
return None
result = {}
if type(self.gnd_id) == str:
_temp_data = {}
try:
filereader = FileReader(
filepath=self.return_complete_url(), origin="web", internal_call=True, show_printmessages=False
)
_temp_data = filereader.loadfile_json()
except:
print(
"GndConnector connectivity error in get_gnd_data() method: could not load resource from api as expected."
) if self.show_printmessages else None
return None
self.connection_established = True
if _temp_data != None and _temp_data != False:
result[self.gnd_id] = _temp_data
print(
f"GndConnector get_gnd_data() status: data for gnd id {self.gnd_id} received."
) if self.show_printmessages else None
else:
print(
f"GndConnector get_gnd_data() status: for gnd id {self.gnd_id} no data could be delivered by api"
) if self.show_printmessages else None
return None
elif type(self.gnd_id) == list:
for index, gnd in enumerate(self.gnd_id):
_temp_data = {}
try:
filereader = FileReader(
filepath=self.return_complete_url(index),
origin="web",
internal_call=True,
show_printmessages=True,
)
_temp_data = filereader.loadfile_json()
except:
print(
f"GndConnector get_gnd_data() status: for gnd id {index + 1} ({gnd}) of {len(self.gnd_id)} no data could be delivered by api"
) if self.show_printmessages else None
result[gnd] = _temp_data
print(
f"GndConnector get_gnd_data() status: gnd id {index + 1} ({gnd}) of {len(self.gnd_id)} processed"
) if self.show_printmessages else None
self.connection_established = True
# filtering: build new dict with selected values, which should be returned (base mode = all base aliases from apilist definition. list mode = select specific aliases from base set)
# defining sub method for filtering
def filter_received_data(gnd_id: str, mode: Union[str, List[str]]) -> dict:
"""sub method, which extracts the key-value pairs from the raw data received from api for one gnd id number and renames the keys and/or values.
alias definitions in self.apilist are used for this filtering process:
the keys of 'baseAliases' dict define the new key names, their value list denotates (in order of the list)
1. the original key name,
2. the original value type (python-wise: i.e. 'str' or '[str]'),
3. the original value type (logic-wise: 'categorial' or 'nominal'),
4. a categorization dict, if the original value type logic-wise is 'categorial':
it delivers mapping information to assign a category (defined keys of this mapping dict) based on specific values (defined in the values of this mapping dict) found in raw data,
example 1: using culturegraph api the value of the base category 'type' is assigned to 'person', if the raw data json object has a key '@type' with the value 'person' of type str,
example 2: using lobid api the value of the base category 'type' is assigned to 'person', if the raw data json object has a key 'type' with a list as a value, which has itself a value 'Person' of type str in it,
mode parameter accepts str 'base' (all base aliases will be extracted) or a list of str (specific aliases will be extracted)"""
# todo: handle additional alias definition sets in gnd_apilist.json by user
# category_sets = {'base': [list(self.apilist[self.apiindex]["baseAliases"].keys()), 'baseAliases'],
# 'custom': [list(self.apilist[self.apiindex]["custom"].keys()), 'custom']
# }
# selected_categories_list = category_sets.get(mode)[0] if type(mode) == str else mode
# selected_categories_alias = category_sets.get(mode)[1] if type(mode) == str else 'baseAliases'
# => allow parsing a list of categories to get_gnd_data() only if they are defined in baseAlias set?
base_categories = list(self.apilist[self.apiindex]["baseAliases"].keys())
selected_categories = base_categories if mode == "base" else mode
selected_categories_data = {}
for category in selected_categories:
_temp_data = []
try:
_temp_data = result[gnd_id][self.apilist[self.apiindex]["baseAliases"][category][0]]
except KeyError:
_temp_data = []
print(
f"GndConnector get_gnd_data() filtering note: could not find {category} information for {gnd_id} in raw data. continuing processing..."
) if self.show_printmessages else None
# handling of categorical data types
if (
len(_temp_data) > 0
and self.apilist[self.apiindex]["baseAliases"][category][2] == "categorial"
and type(self.apilist[self.apiindex]["baseAliases"][category][3] == dict)
):
_temp_category_data_form = self.apilist[self.apiindex]["baseAliases"][category][1]
_temp_categorial_values = self.apilist[self.apiindex]["baseAliases"][category][3]
# change found categorial string to selfdefined string (i.e. 'Person' to 'person')
if type(_temp_category_data_form) == str:
for _type in _temp_categorial_values:
if _temp_data == _temp_categorial_values[_type]:
_temp_data = _type
# replace found categorial list with selfdefined string (i.e. ['Person', 'PoliticalLeader'] to 'person')
elif type(_temp_category_data_form) == list:
for _type in _temp_categorial_values:
if _temp_categorial_values[_type] in _temp_data:
_temp_data = _type
selected_categories_data[category] = _temp_data
return selected_categories_data
# executing sub method for filtering
if data_selection is not None:
if type(self.gnd_id) == str:
_new_dict = {list(result.keys())[0]: filter_received_data(self.gnd_id, data_selection)}
elif type(self.gnd_id) == list:
_new_dict = {}
for key in result:
_new_dict[key] = filter_received_data(key, data_selection)
result = _new_dict
return result
| [((39, 37, 39, 114), 'os.path.join', 'os.path.join', ({(39, 50, 39, 65): 'local_save_path', (39, 67, 39, 75): '"""config"""', (39, 77, 39, 93): '"""postprocessing"""', (39, 95, 39, 113): '"""gnd_apilist.json"""'}, {}), "(local_save_path, 'config', 'postprocessing', 'gnd_apilist.json')", False, 'import os\n'), ((41, 46, 43, 13), 'tei_entity_enricher.interface.postprocessing.io.FileReader', 'FileReader', (), '', False, 'from tei_entity_enricher.interface.postprocessing.io import FileReader, FileWriter\n'), ((106, 37, 106, 75), 'os.path.dirname', 'os.path.dirname', ({(106, 53, 106, 74): 'self.apilist_filepath'}, {}), '(self.apilist_filepath)', False, 'import os\n'), ((107, 16, 107, 77), 'tei_entity_enricher.interface.postprocessing.io.FileWriter', 'FileWriter', (), '', False, 'from tei_entity_enricher.interface.postprocessing.io import FileReader, FileWriter\n')] |
WHOIGit/nes-lter-ims | neslter/workflow/__init__.py | d4cc96c10da56ca33286af84d669625b67170522 | import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
logger.level = logging.DEBUG | [((3, 9, 3, 36), 'logging.getLogger', 'logging.getLogger', ({(3, 27, 3, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((4, 18, 4, 39), 'logging.NullHandler', 'logging.NullHandler', ({}, {}), '()', False, 'import logging\n')] |
emitch/SEAMLeSS | inference/_archive/render_section.py | cae21c67316ed36529fdc2e470a105a9f847975c | from args import get_argparser, parse_args, get_aligner, get_bbox
def render(aligner, bbox, z):
aligner.total_bbox = bbox
aligner.zs = z
aligner.render_section_all_mips(z, bbox)
if __name__ == '__main__':
parser = get_argparser()
args = parse_args(parser)
a = get_aligner(args)
bbox = get_bbox(args)
for z in range(args.bbox_start[2], args.bbox_stop[2]):
print('Rendering z={0}'.format(z))
render(a, bbox, z)
| [((9, 11, 9, 26), 'args.get_argparser', 'get_argparser', ({}, {}), '()', False, 'from args import get_argparser, parse_args, get_aligner, get_bbox\n'), ((10, 9, 10, 27), 'args.parse_args', 'parse_args', ({(10, 20, 10, 26): 'parser'}, {}), '(parser)', False, 'from args import get_argparser, parse_args, get_aligner, get_bbox\n'), ((11, 6, 11, 23), 'args.get_aligner', 'get_aligner', ({(11, 18, 11, 22): 'args'}, {}), '(args)', False, 'from args import get_argparser, parse_args, get_aligner, get_bbox\n'), ((12, 9, 12, 23), 'args.get_bbox', 'get_bbox', ({(12, 18, 12, 22): 'args'}, {}), '(args)', False, 'from args import get_argparser, parse_args, get_aligner, get_bbox\n')] |
qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3 | venv/lib/python3.9/site-packages/google/cloud/spanner_admin_instance_v1/gapic/instance_admin_client.py | 630dcef73e6a258b6e9a52f934e2dd912ce741f8 | # -*- coding: utf-8 -*-
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://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.
"""Accesses the google.spanner.admin.instance.v1 InstanceAdmin API."""
import functools
import pkg_resources
import warnings
from google.oauth2 import service_account
import google.api_core.client_options
import google.api_core.gapic_v1.client_info
import google.api_core.gapic_v1.config
import google.api_core.gapic_v1.method
import google.api_core.gapic_v1.routing_header
import google.api_core.grpc_helpers
import google.api_core.operation
import google.api_core.operations_v1
import google.api_core.page_iterator
import google.api_core.path_template
import grpc
from google.cloud.spanner_admin_instance_v1.gapic import enums
from google.cloud.spanner_admin_instance_v1.gapic import instance_admin_client_config
from google.cloud.spanner_admin_instance_v1.gapic.transports import (
instance_admin_grpc_transport,
)
from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2
from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2_grpc
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import options_pb2
from google.iam.v1 import policy_pb2
from google.longrunning import operations_pb2
from google.protobuf import empty_pb2
from google.protobuf import field_mask_pb2
_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-spanner").version
class InstanceAdminClient(object):
"""
Cloud Spanner Instance Admin API
The Cloud Spanner Instance Admin API can be used to create, delete,
modify and list instances. Instances are dedicated Cloud Spanner serving
and storage resources to be used by Cloud Spanner databases.
Each instance has a "configuration", which dictates where the
serving resources for the Cloud Spanner instance are located (e.g.,
US-central, Europe). Configurations are created by Google based on
resource availability.
Cloud Spanner billing is based on the instances that exist and their
sizes. After an instance exists, there are no additional
per-database or per-operation charges for use of the instance
(though there may be additional network bandwidth charges).
Instances offer isolation: problems with databases in one instance
will not affect other instances. However, within an instance
databases can affect each other. For example, if one database in an
instance receives a lot of requests and consumes most of the
instance resources, fewer resources are available for other
databases in that instance, and their performance may suffer.
"""
SERVICE_ADDRESS = "spanner.googleapis.com:443"
"""The default address of the service."""
# The name of the interface for this client. This is the key used to
# find the method configuration in the client_config dictionary.
_INTERFACE_NAME = "google.spanner.admin.instance.v1.InstanceAdmin"
@classmethod
def from_service_account_file(cls, filename, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
InstanceAdminClient: The constructed client.
"""
credentials = service_account.Credentials.from_service_account_file(filename)
kwargs["credentials"] = credentials
return cls(*args, **kwargs)
from_service_account_json = from_service_account_file
@classmethod
def instance_path(cls, project, instance):
"""Return a fully-qualified instance string."""
return google.api_core.path_template.expand(
"projects/{project}/instances/{instance}",
project=project,
instance=instance,
)
@classmethod
def instance_config_path(cls, project, instance_config):
"""Return a fully-qualified instance_config string."""
return google.api_core.path_template.expand(
"projects/{project}/instanceConfigs/{instance_config}",
project=project,
instance_config=instance_config,
)
@classmethod
def project_path(cls, project):
"""Return a fully-qualified project string."""
return google.api_core.path_template.expand(
"projects/{project}", project=project
)
def __init__(
self,
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
):
"""Constructor.
Args:
transport (Union[~.InstanceAdminGrpcTransport,
Callable[[~.Credentials, type], ~.InstanceAdminGrpcTransport]): A transport
instance, responsible for actually making the API calls.
The default transport uses the gRPC protocol.
This argument may also be a callable which returns a
transport instance. Callables will be sent the credentials
as the first argument and the default transport class as
the second argument.
channel (grpc.Channel): DEPRECATED. A ``Channel`` instance
through which to make calls. This argument is mutually exclusive
with ``credentials``; providing both will raise an exception.
credentials (google.auth.credentials.Credentials): The
authorization credentials to attach to requests. These
credentials identify this application to the service. If none
are specified, the client will attempt to ascertain the
credentials from the environment.
This argument is mutually exclusive with providing a
transport instance to ``transport``; doing so will raise
an exception.
client_config (dict): DEPRECATED. A dictionary of call options for
each method. If not specified, the default configuration is used.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
client_options (Union[dict, google.api_core.client_options.ClientOptions]):
Client options used to set user options on the client. API Endpoint
should be set through client_options.
"""
# Raise deprecation warnings for things we want to go away.
if client_config is not None:
warnings.warn(
"The `client_config` argument is deprecated.",
PendingDeprecationWarning,
stacklevel=2,
)
else:
client_config = instance_admin_client_config.config
if channel:
warnings.warn(
"The `channel` argument is deprecated; use " "`transport` instead.",
PendingDeprecationWarning,
stacklevel=2,
)
api_endpoint = self.SERVICE_ADDRESS
if client_options:
if type(client_options) == dict:
client_options = google.api_core.client_options.from_dict(
client_options
)
if client_options.api_endpoint:
api_endpoint = client_options.api_endpoint
# Instantiate the transport.
# The transport is responsible for handling serialization and
# deserialization and actually sending data to the service.
if transport:
if callable(transport):
self.transport = transport(
credentials=credentials,
default_class=instance_admin_grpc_transport.InstanceAdminGrpcTransport,
address=api_endpoint,
)
else:
if credentials:
raise ValueError(
"Received both a transport instance and "
"credentials; these are mutually exclusive."
)
self.transport = transport
else:
self.transport = instance_admin_grpc_transport.InstanceAdminGrpcTransport(
address=api_endpoint, channel=channel, credentials=credentials
)
if client_info is None:
client_info = google.api_core.gapic_v1.client_info.ClientInfo(
gapic_version=_GAPIC_LIBRARY_VERSION
)
else:
client_info.gapic_version = _GAPIC_LIBRARY_VERSION
self._client_info = client_info
# Parse out the default settings for retry and timeout for each RPC
# from the client configuration.
# (Ordinarily, these are the defaults specified in the `*_config.py`
# file next to this one.)
self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
client_config["interfaces"][self._INTERFACE_NAME]
)
# Save a dictionary of cached API call functions.
# These are the actual callables which invoke the proper
# transport methods, wrapped with `wrap_method` to add retry,
# timeout, and the like.
self._inner_api_calls = {}
# Service calls
def create_instance(
self,
parent,
instance_id,
instance,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates an instance and begins preparing it to begin serving. The
returned ``long-running operation`` can be used to track the progress of
preparing the new instance. The instance name is assigned by the caller.
If the named instance already exists, ``CreateInstance`` returns
``ALREADY_EXISTS``.
Immediately upon completion of this request:
- The instance is readable via the API, with all requested attributes
but no allocated resources. Its state is ``CREATING``.
Until completion of the returned operation:
- Cancelling the operation renders the instance immediately unreadable
via the API.
- The instance can be deleted.
- All other attempts to modify the instance are rejected.
Upon completion of the returned operation:
- Billing for all successfully-allocated resources begins (some types
may have lower than the requested levels).
- Databases can be created in the instance.
- The instance's allocated resource levels are readable via the API.
- The instance's state becomes ``READY``.
The returned ``long-running operation`` will have a name of the format
``<instance_name>/operations/<operation_id>`` and can be used to track
creation of the instance. The ``metadata`` field type is
``CreateInstanceMetadata``. The ``response`` field type is ``Instance``,
if successful.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # TODO: Initialize `instance_id`:
>>> instance_id = ''
>>>
>>> # TODO: Initialize `instance`:
>>> instance = {}
>>>
>>> response = client.create_instance(parent, instance_id, instance)
>>>
>>> def callback(operation_future):
... # Handle result.
... result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Args:
parent (str): Required. The name of the project in which to create the instance.
Values are of the form ``projects/<project>``.
instance_id (str): Required. The ID of the instance to create. Valid identifiers are of
the form ``[a-z][-a-z0-9]*[a-z0-9]`` and must be between 2 and 64
characters in length.
instance (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.Instance]): Required. The instance to create. The name may be omitted, but if
specified must be ``<parent>/instances/<instance_id>``.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.spanner_admin_instance_v1.types.Instance`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.api_core.operation.Operation` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "create_instance" not in self._inner_api_calls:
self._inner_api_calls[
"create_instance"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.create_instance,
default_retry=self._method_configs["CreateInstance"].retry,
default_timeout=self._method_configs["CreateInstance"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.CreateInstanceRequest(
parent=parent, instance_id=instance_id, instance=instance
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("parent", parent)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
operation = self._inner_api_calls["create_instance"](
request, retry=retry, timeout=timeout, metadata=metadata
)
return google.api_core.operation.from_gapic(
operation,
self.transport._operations_client,
spanner_instance_admin_pb2.Instance,
metadata_type=spanner_instance_admin_pb2.CreateInstanceMetadata,
)
def update_instance(
self,
instance,
field_mask,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates an instance, and begins allocating or releasing resources as
requested. The returned ``long-running operation`` can be used to track
the progress of updating the instance. If the named instance does not
exist, returns ``NOT_FOUND``.
Immediately upon completion of this request:
- For resource types for which a decrease in the instance's allocation
has been requested, billing is based on the newly-requested level.
Until completion of the returned operation:
- Cancelling the operation sets its metadata's ``cancel_time``, and
begins restoring resources to their pre-request values. The operation
is guaranteed to succeed at undoing all resource changes, after which
point it terminates with a ``CANCELLED`` status.
- All other attempts to modify the instance are rejected.
- Reading the instance via the API continues to give the pre-request
resource levels.
Upon completion of the returned operation:
- Billing begins for all successfully-allocated resources (some types
may have lower than the requested levels).
- All newly-reserved resources are available for serving the instance's
tables.
- The instance's new resource levels are readable via the API.
The returned ``long-running operation`` will have a name of the format
``<instance_name>/operations/<operation_id>`` and can be used to track
the instance modification. The ``metadata`` field type is
``UpdateInstanceMetadata``. The ``response`` field type is ``Instance``,
if successful.
Authorization requires ``spanner.instances.update`` permission on
resource ``name``.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> # TODO: Initialize `instance`:
>>> instance = {}
>>>
>>> # TODO: Initialize `field_mask`:
>>> field_mask = {}
>>>
>>> response = client.update_instance(instance, field_mask)
>>>
>>> def callback(operation_future):
... # Handle result.
... result = operation_future.result()
>>>
>>> response.add_done_callback(callback)
>>>
>>> # Handle metadata.
>>> metadata = response.metadata()
Args:
instance (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.Instance]): Required. The instance to update, which must always include the
instance name. Otherwise, only fields mentioned in ``field_mask`` need
be included.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.spanner_admin_instance_v1.types.Instance`
field_mask (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.FieldMask]): Required. A mask specifying which fields in ``Instance`` should be
updated. The field mask must always be specified; this prevents any
future fields in ``Instance`` from being erased accidentally by clients
that do not know about them.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.spanner_admin_instance_v1.types.FieldMask`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.api_core.operation.Operation` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "update_instance" not in self._inner_api_calls:
self._inner_api_calls[
"update_instance"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.update_instance,
default_retry=self._method_configs["UpdateInstance"].retry,
default_timeout=self._method_configs["UpdateInstance"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.UpdateInstanceRequest(
instance=instance, field_mask=field_mask
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("instance.name", instance.name)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
operation = self._inner_api_calls["update_instance"](
request, retry=retry, timeout=timeout, metadata=metadata
)
return google.api_core.operation.from_gapic(
operation,
self.transport._operations_client,
spanner_instance_admin_pb2.Instance,
metadata_type=spanner_instance_admin_pb2.UpdateInstanceMetadata,
)
def list_instance_configs(
self,
parent,
page_size=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lists the supported instance configurations for a given project.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_instance_configs(parent):
... # process element
... pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_instance_configs(parent).pages:
... for element in page:
... # process element
... pass
Args:
parent (str): Required. The name of the project for which a list of supported
instance configurations is requested. Values are of the form
``projects/<project>``.
page_size (int): The maximum number of resources contained in the
underlying API response. If page streaming is performed per-
resource, this parameter does not affect the return value. If page
streaming is performed per-page, this determines the maximum number
of resources in a page.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.api_core.page_iterator.PageIterator` instance.
An iterable of :class:`~google.cloud.spanner_admin_instance_v1.types.InstanceConfig` instances.
You can also iterate over the pages of the response
using its `pages` property.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "list_instance_configs" not in self._inner_api_calls:
self._inner_api_calls[
"list_instance_configs"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.list_instance_configs,
default_retry=self._method_configs["ListInstanceConfigs"].retry,
default_timeout=self._method_configs["ListInstanceConfigs"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.ListInstanceConfigsRequest(
parent=parent, page_size=page_size
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("parent", parent)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
iterator = google.api_core.page_iterator.GRPCIterator(
client=None,
method=functools.partial(
self._inner_api_calls["list_instance_configs"],
retry=retry,
timeout=timeout,
metadata=metadata,
),
request=request,
items_field="instance_configs",
request_token_field="page_token",
response_token_field="next_page_token",
)
return iterator
def get_instance_config(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets information about a particular instance configuration.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> name = client.instance_config_path('[PROJECT]', '[INSTANCE_CONFIG]')
>>>
>>> response = client.get_instance_config(name)
Args:
name (str): Required. The name of the requested instance configuration. Values
are of the form ``projects/<project>/instanceConfigs/<config>``.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.cloud.spanner_admin_instance_v1.types.InstanceConfig` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "get_instance_config" not in self._inner_api_calls:
self._inner_api_calls[
"get_instance_config"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.get_instance_config,
default_retry=self._method_configs["GetInstanceConfig"].retry,
default_timeout=self._method_configs["GetInstanceConfig"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.GetInstanceConfigRequest(name=name)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("name", name)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
return self._inner_api_calls["get_instance_config"](
request, retry=retry, timeout=timeout, metadata=metadata
)
def list_instances(
self,
parent,
page_size=None,
filter_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Lists all instances in the given project.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> parent = client.project_path('[PROJECT]')
>>>
>>> # Iterate over all results
>>> for element in client.list_instances(parent):
... # process element
... pass
>>>
>>>
>>> # Alternatively:
>>>
>>> # Iterate over results one page at a time
>>> for page in client.list_instances(parent).pages:
... for element in page:
... # process element
... pass
Args:
parent (str): Required. The name of the project for which a list of instances is
requested. Values are of the form ``projects/<project>``.
page_size (int): The maximum number of resources contained in the
underlying API response. If page streaming is performed per-
resource, this parameter does not affect the return value. If page
streaming is performed per-page, this determines the maximum number
of resources in a page.
filter_ (str): An expression for filtering the results of the request. Filter rules
are case insensitive. The fields eligible for filtering are:
- ``name``
- ``display_name``
- ``labels.key`` where key is the name of a label
Some examples of using filters are:
- ``name:*`` --> The instance has a name.
- ``name:Howl`` --> The instance's name contains the string "howl".
- ``name:HOWL`` --> Equivalent to above.
- ``NAME:howl`` --> Equivalent to above.
- ``labels.env:*`` --> The instance has the label "env".
- ``labels.env:dev`` --> The instance has the label "env" and the value
of the label contains the string "dev".
- ``name:howl labels.env:dev`` --> The instance's name contains "howl"
and it has the label "env" with its value containing "dev".
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.api_core.page_iterator.PageIterator` instance.
An iterable of :class:`~google.cloud.spanner_admin_instance_v1.types.Instance` instances.
You can also iterate over the pages of the response
using its `pages` property.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "list_instances" not in self._inner_api_calls:
self._inner_api_calls[
"list_instances"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.list_instances,
default_retry=self._method_configs["ListInstances"].retry,
default_timeout=self._method_configs["ListInstances"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.ListInstancesRequest(
parent=parent, page_size=page_size, filter=filter_
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("parent", parent)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
iterator = google.api_core.page_iterator.GRPCIterator(
client=None,
method=functools.partial(
self._inner_api_calls["list_instances"],
retry=retry,
timeout=timeout,
metadata=metadata,
),
request=request,
items_field="instances",
request_token_field="page_token",
response_token_field="next_page_token",
)
return iterator
def get_instance(
self,
name,
field_mask=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets information about a particular instance.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> name = client.instance_path('[PROJECT]', '[INSTANCE]')
>>>
>>> response = client.get_instance(name)
Args:
name (str): Required. The name of the requested instance. Values are of the form
``projects/<project>/instances/<instance>``.
field_mask (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.FieldMask]): If field_mask is present, specifies the subset of ``Instance``
fields that should be returned. If absent, all ``Instance`` fields are
returned.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.spanner_admin_instance_v1.types.FieldMask`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.cloud.spanner_admin_instance_v1.types.Instance` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "get_instance" not in self._inner_api_calls:
self._inner_api_calls[
"get_instance"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.get_instance,
default_retry=self._method_configs["GetInstance"].retry,
default_timeout=self._method_configs["GetInstance"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.GetInstanceRequest(
name=name, field_mask=field_mask
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("name", name)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
return self._inner_api_calls["get_instance"](
request, retry=retry, timeout=timeout, metadata=metadata
)
def delete_instance(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes an instance.
Immediately upon completion of the request:
- Billing ceases for all of the instance's reserved resources.
Soon afterward:
- The instance and *all of its databases* immediately and irrevocably
disappear from the API. All data in the databases is permanently
deleted.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> name = client.instance_path('[PROJECT]', '[INSTANCE]')
>>>
>>> client.delete_instance(name)
Args:
name (str): Required. The name of the instance to be deleted. Values are of the
form ``projects/<project>/instances/<instance>``
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "delete_instance" not in self._inner_api_calls:
self._inner_api_calls[
"delete_instance"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.delete_instance,
default_retry=self._method_configs["DeleteInstance"].retry,
default_timeout=self._method_configs["DeleteInstance"].timeout,
client_info=self._client_info,
)
request = spanner_instance_admin_pb2.DeleteInstanceRequest(name=name)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("name", name)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
self._inner_api_calls["delete_instance"](
request, retry=retry, timeout=timeout, metadata=metadata
)
def set_iam_policy(
self,
resource,
policy,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Sets the access control policy on an instance resource. Replaces any
existing policy.
Authorization requires ``spanner.instances.setIamPolicy`` on
``resource``.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> # TODO: Initialize `resource`:
>>> resource = ''
>>>
>>> # TODO: Initialize `policy`:
>>> policy = {}
>>>
>>> response = client.set_iam_policy(resource, policy)
Args:
resource (str): REQUIRED: The resource for which the policy is being specified.
See the operation documentation for the appropriate value for this field.
policy (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.Policy]): REQUIRED: The complete policy to be applied to the ``resource``. The
size of the policy is limited to a few 10s of KB. An empty policy is a
valid policy but certain Cloud Platform services (such as Projects)
might reject them.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.spanner_admin_instance_v1.types.Policy`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.cloud.spanner_admin_instance_v1.types.Policy` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "set_iam_policy" not in self._inner_api_calls:
self._inner_api_calls[
"set_iam_policy"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.set_iam_policy,
default_retry=self._method_configs["SetIamPolicy"].retry,
default_timeout=self._method_configs["SetIamPolicy"].timeout,
client_info=self._client_info,
)
request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("resource", resource)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
return self._inner_api_calls["set_iam_policy"](
request, retry=retry, timeout=timeout, metadata=metadata
)
def get_iam_policy(
self,
resource,
options_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Gets the access control policy for an instance resource. Returns an
empty policy if an instance exists but does not have a policy set.
Authorization requires ``spanner.instances.getIamPolicy`` on
``resource``.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> # TODO: Initialize `resource`:
>>> resource = ''
>>>
>>> response = client.get_iam_policy(resource)
Args:
resource (str): REQUIRED: The resource for which the policy is being requested.
See the operation documentation for the appropriate value for this field.
options_ (Union[dict, ~google.cloud.spanner_admin_instance_v1.types.GetPolicyOptions]): OPTIONAL: A ``GetPolicyOptions`` object for specifying options to
``GetIamPolicy``. This field is only used by Cloud IAM.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.spanner_admin_instance_v1.types.GetPolicyOptions`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.cloud.spanner_admin_instance_v1.types.Policy` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "get_iam_policy" not in self._inner_api_calls:
self._inner_api_calls[
"get_iam_policy"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.get_iam_policy,
default_retry=self._method_configs["GetIamPolicy"].retry,
default_timeout=self._method_configs["GetIamPolicy"].timeout,
client_info=self._client_info,
)
request = iam_policy_pb2.GetIamPolicyRequest(
resource=resource, options=options_
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("resource", resource)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
return self._inner_api_calls["get_iam_policy"](
request, retry=retry, timeout=timeout, metadata=metadata
)
def test_iam_permissions(
self,
resource,
permissions,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Returns permissions that the caller has on the specified instance
resource.
Attempting this RPC on a non-existent Cloud Spanner instance resource
will result in a NOT_FOUND error if the user has
``spanner.instances.list`` permission on the containing Google Cloud
Project. Otherwise returns an empty set of permissions.
Example:
>>> from google.cloud import spanner_admin_instance_v1
>>>
>>> client = spanner_admin_instance_v1.InstanceAdminClient()
>>>
>>> # TODO: Initialize `resource`:
>>> resource = ''
>>>
>>> # TODO: Initialize `permissions`:
>>> permissions = []
>>>
>>> response = client.test_iam_permissions(resource, permissions)
Args:
resource (str): REQUIRED: The resource for which the policy detail is being requested.
See the operation documentation for the appropriate value for this field.
permissions (list[str]): The set of permissions to check for the ``resource``. Permissions
with wildcards (such as '*' or 'storage.*') are not allowed. For more
information see `IAM
Overview <https://cloud.google.com/iam/docs/overview#permissions>`__.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.
Returns:
A :class:`~google.cloud.spanner_admin_instance_v1.types.TestIamPermissionsResponse` instance.
Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "test_iam_permissions" not in self._inner_api_calls:
self._inner_api_calls[
"test_iam_permissions"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.test_iam_permissions,
default_retry=self._method_configs["TestIamPermissions"].retry,
default_timeout=self._method_configs["TestIamPermissions"].timeout,
client_info=self._client_info,
)
request = iam_policy_pb2.TestIamPermissionsRequest(
resource=resource, permissions=permissions
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("resource", resource)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)
return self._inner_api_calls["test_iam_permissions"](
request, retry=retry, timeout=timeout, metadata=metadata
)
| [((51, 25, 51, 79), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', ({(51, 56, 51, 78): '"""google-cloud-spanner"""'}, {}), "('google-cloud-spanner')", False, 'import pkg_resources\n'), ((100, 22, 100, 85), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service_account.Credentials.from_service_account_file', ({(100, 76, 100, 84): 'filename'}, {}), '(filename)', False, 'from google.oauth2 import service_account\n'), ((351, 18, 353, 9), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.CreateInstanceRequest', 'spanner_instance_admin_pb2.CreateInstanceRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((489, 18, 491, 9), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.UpdateInstanceRequest', 'spanner_instance_admin_pb2.UpdateInstanceRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((589, 18, 591, 9), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.ListInstanceConfigsRequest', 'spanner_instance_admin_pb2.ListInstanceConfigsRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((672, 18, 672, 80), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.GetInstanceConfigRequest', 'spanner_instance_admin_pb2.GetInstanceConfigRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((782, 18, 784, 9), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.ListInstancesRequest', 'spanner_instance_admin_pb2.ListInstancesRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((872, 18, 874, 9), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.GetInstanceRequest', 'spanner_instance_admin_pb2.GetInstanceRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((951, 18, 951, 77), 'google.cloud.spanner_admin_instance_v1.proto.spanner_instance_admin_pb2.DeleteInstanceRequest', 'spanner_instance_admin_pb2.DeleteInstanceRequest', (), '', False, 'from google.cloud.spanner_admin_instance_v1.proto import spanner_instance_admin_pb2\n'), ((1037, 18, 1037, 86), 'google.iam.v1.iam_policy_pb2.SetIamPolicyRequest', 'iam_policy_pb2.SetIamPolicyRequest', (), '', False, 'from google.iam.v1 import iam_policy_pb2\n'), ((1118, 18, 1120, 9), 'google.iam.v1.iam_policy_pb2.GetIamPolicyRequest', 'iam_policy_pb2.GetIamPolicyRequest', (), '', False, 'from google.iam.v1 import iam_policy_pb2\n'), ((1205, 18, 1207, 9), 'google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest', 'iam_policy_pb2.TestIamPermissionsRequest', (), '', False, 'from google.iam.v1 import iam_policy_pb2\n'), ((175, 12, 179, 13), 'warnings.warn', 'warnings.warn', (), '', False, 'import warnings\n'), ((184, 12, 188, 13), 'warnings.warn', 'warnings.warn', (), '', False, 'import warnings\n'), ((217, 29, 219, 13), 'google.cloud.spanner_admin_instance_v1.gapic.transports.instance_admin_grpc_transport.InstanceAdminGrpcTransport', 'instance_admin_grpc_transport.InstanceAdminGrpcTransport', (), '', False, 'from google.cloud.spanner_admin_instance_v1.gapic.transports import instance_admin_grpc_transport\n'), ((607, 19, 612, 13), 'functools.partial', 'functools.partial', (), '', False, 'import functools\n'), ((800, 19, 805, 13), 'functools.partial', 'functools.partial', (), '', False, 'import functools\n')] |
helloabunai/ScaleHD | src/ScaleHD/__backend.py | b48c1a1ed742bdbda0a4cd42555d1e12d2e3024d | #/usr/bin/python
__version__ = '1.0'
__author__ = '[email protected]'
##
## Imports
import string
import os
import errno
import shutil
import sys
import glob
import datetime
import subprocess
import logging as log
import numpy as np
import csv
from io import StringIO
import PyPDF2
from sklearn import preprocessing
from collections import defaultdict
from xml.etree import cElementTree
from lxml import etree
from reportlab.pdfgen import canvas
class Colour:
def __init__(self):
pass
purple = '\033[95m'
cyan = '\033[96m'
darkcyan = '\033[36m'
blue = '\033[94m'
green = '\033[92m'
yellow = '\033[93m'
red = '\033[91m'
bold = '\033[1m'
underline = '\033[4m'
end = '\033[0m'
class ConfigReader(object):
"""
The configuration file reader.
Opens a configuration file, and if valid, converts the parameters within the file to a dictionary object,
reader to be viewed through accessing the config_dict variable.
"""
def __init__(self, scriptdir, config_filename=None):
##
## Instance variables
self.scriptdir = scriptdir
self.config_filename = config_filename
self.dtd_filename = scriptdir + "/config/config.dtd"
##
## Check for configuration file (just incase)
if self.config_filename is None:
log.error("No configuration file specified!")
else:
self.config_file = etree.parse(self.config_filename)
##
## Check config vs dtd, parse info to dictionary, validate vs ruleset
self.validate_against_dtd()
self.set_dictionary()
self.validate_config()
def validate_against_dtd(self):
"""
Validate input config against DTD ruleset
i.e. confirms conformation of XML structure
"""
##
## Open > etree.DTD object
dtd_file = open(self.dtd_filename, 'r')
dtd_object = etree.DTD(dtd_file)
##
## If validation fails, close the object (memory) and raise an error
if not dtd_object.validate(self.config_file):
dtd_file.close()
log.error("DTD validation failure {0}: {1}".format(self.config_filename, dtd_object.error_log.filter_from_errors()[0]))
sys.exit(2)
dtd_file.close()
def set_dictionary(self):
"""
Takes the now validated XML and extracts information from the tree into
a python dictionary {key: value}. This dictionary will be used for variables
within the pipeline. Recursion adapted from http://stackoverflow.com/a/9286702
"""
def recursive_generation(t):
d = {t.tag: {} if t.attrib else None}
children = list(t)
##
## If list was populated, create dictionary, Append keys
if children:
dd = defaultdict(list)
for dc in map(recursive_generation, children):
for k, v in dc.items():
dd[k].append(v)
d = {t.tag: {k: v[0] if len(v) == 1 else v for k, v in dd.items()}}
##
## Values for key
if t.attrib:
d[t.tag].update(('@' + k, v) for k, v in t.attrib.items())
if t.text:
text = t.text.strip()
if children or t.attrib:
if text:
d[t.tag]['#text'] = text
else:
d[t.tag] = text
return d
##
## Takes the formatted xml doc, puts through generator, returns dictionary
string_repr = etree.tostring(self.config_file, pretty_print=True)
element_tree = cElementTree.XML(string_repr)
self.config_dict = recursive_generation(element_tree)
self.config_dict = self.config_dict[list(self.config_dict.keys())[0]]
def validate_config(self):
"""
Method which validates the configuration file's contents.
If all pass, guarantees that the settings dictionary is full of valid settings!
"""
trigger = False
##
## Main configuration instance settings
data_directory = self.config_dict['@data_dir']
if not os.path.exists(data_directory):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified data directory could not be found.'))
trigger = True
for fqfile in glob.glob(os.path.join(data_directory, '*')):
if not (fqfile.endswith('.fq') or fqfile.endswith('.fastq') or fqfile.endswith('.fq.gz') or fqfile.endswith('.fastq.gz')):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Non FastQ/GZ data detected in specified input directory.'))
trigger = True
forward_reference = self.config_dict['@forward_reference']
if not os.path.isfile(forward_reference):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified forward reference file could not be found.'))
trigger = True
if not (forward_reference.endswith('.fa') or forward_reference.endswith('.fasta')):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified forward reference file is not a fa/fas file.'))
trigger = True
reverse_reference = self.config_dict['@reverse_reference']
if not os.path.isfile(reverse_reference):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified reverse reference file could not be found.'))
trigger = True
if not (reverse_reference.endswith('fa') or reverse_reference.endswith('.fasta')):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified reverse reference file is not a fa/fas file.'))
trigger = True
if forward_reference.split('/')[-1] == reverse_reference.split('/')[-1]:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: FW and RV references have identical filenames. Will create indexing issue.'))
trigger = True
##
## Instance flag settings
demultiplexing_flag = self.config_dict['instance_flags']['@demultiplex']
if not (demultiplexing_flag == 'True' or demultiplexing_flag == 'False'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Demultiplexing flag is not set to True/False.'))
trigger = True
sequence_qc_flag = self.config_dict['instance_flags']['@quality_control']
if not (sequence_qc_flag == 'True' or sequence_qc_flag == 'False'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Sequence Quality control flag is not set to True/False.'))
trigger = True
alignment_flag = self.config_dict['instance_flags']['@sequence_alignment']
if not (alignment_flag == 'True' or alignment_flag == 'False'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Sequence Alignment flag is not set to True/False.'))
trigger = True
atypical_flag = self.config_dict['instance_flags']['@atypical_realignment']
if not (atypical_flag == 'True' or atypical_flag == 'False'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Atypical Realignment flag is not True/False.'))
trigger = True
genotype_flag = self.config_dict['instance_flags']['@genotype_prediction']
if not (genotype_flag == 'True' or genotype_flag == 'False'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Genotype Prediction control flag is not True/False.'))
trigger = True
snpcall_flag = self.config_dict['instance_flags']['@snp_calling']
if not (snpcall_flag == 'True' or snpcall_flag == 'False'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: SNP Calling flag is not True/False.'))
trigger = True
##
## Demultiplexing flag settings
trim_adapter_base = ['A', 'G', 'C', 'T']
if demultiplexing_flag == 'True':
forward_adapter = self.config_dict['demultiplex_flags']['@forward_adapter']
for charbase in forward_adapter:
if charbase not in trim_adapter_base:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Invalid character detected in forward_adapter demultiplexing flag.'))
trigger = True
forward_position = self.config_dict['demultiplex_flags']['@forward_position']
if forward_position not in ['5P', '3P', 'AP']:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Given demultiplexing forward adapter position invalid! [5P, 3P, AP]'))
trigger = True
reverse_adapter = self.config_dict['demultiplex_flags']['@reverse_adapter']
for charbase in reverse_adapter:
if charbase not in trim_adapter_base:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Invalid character detected in reverse_adapter demultiplexing flag.'))
trigger = True
reverse_position = self.config_dict['demultiplex_flags']['@reverse_position']
if reverse_position not in ['5P', '3P', 'AP']:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Given demultiplexing reverse adapter position invalid! [5P, 3P, AP]'))
trigger = True
error_rate = self.config_dict['demultiplex_flags']['@error_rate']
if not error_rate.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified error_rate is not a valid integer.'))
trigger = True
minimum_overlap = self.config_dict['demultiplex_flags']['@min_overlap']
if not minimum_overlap.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified min_overlap is not a valid integer.'))
trigger = True
minimum_length = self.config_dict['demultiplex_flags']['@min_length']
if not minimum_length == '':
if not minimum_length.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified min_length is not a valid integer.'))
trigger = True
maximum_length = self.config_dict['demultiplex_flags']['@max_length']
if not maximum_length == '':
if not maximum_length.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified max_length is not a valid integer.'))
trigger = True
##
## Trimming flag settings
if sequence_qc_flag == 'True':
trimming_type = self.config_dict['trim_flags']['@trim_type']
if not (trimming_type == 'Quality' or trimming_type == 'Adapter' or trimming_type == 'Both'):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Trimming type is not Quality/Adapter/Both.'))
trigger = True
quality_threshold = self.config_dict['trim_flags']['@quality_threshold']
if not quality_threshold.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified quality threshold integer is invalid.'))
trigger = True
elif not int(quality_threshold) in range(0,39):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified quality threshold integer out of range (0-38).'))
trigger = True
trim_adapters = ['-a','-g','-a$','-g^','-b']
adapter_flag = self.config_dict['trim_flags']['@adapter_flag']
if not (adapter_flag in trim_adapters):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified trimming adapter not valid selection.'))
trigger = True
forward_adapter = self.config_dict['trim_flags']['@forward_adapter']
for charbase in forward_adapter:
if charbase not in trim_adapter_base:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Invalid character detected in FW adapter sequence.'))
trigger = True
reverse_adapter = self.config_dict['trim_flags']['@reverse_adapter']
for charbase in reverse_adapter:
if charbase not in trim_adapter_base:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Invalid character detected in RV adapter sequence.'))
trigger = True
error_tolerance = self.config_dict['trim_flags']['@error_tolerance']
if not isinstance(float(error_tolerance), float):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified error tolerance is not a valid float.'))
trigger = True
if not float(error_tolerance) in np.arange(0,1.1,0.01):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified error tolerance is not 0.0 < x < 1.0.'))
trigger = True
##
## Alignment flag settings
if alignment_flag == 'True':
min_seed_length = self.config_dict['alignment_flags']['@min_seed_length']
if not min_seed_length.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified min_seed_length integer is invalid.'))
trigger=True
band_width = self.config_dict['alignment_flags']['@band_width']
if not band_width.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified band_width integer is invalid.'))
trigger=True
seed_length_extension = self.config_dict['alignment_flags']['@seed_length_extension']
if not isinstance(float(seed_length_extension), float):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified seed_length_extension float is invalid.'))
trigger=True
skip_seed_with_occurrence = self.config_dict['alignment_flags']['@skip_seed_with_occurrence']
if not skip_seed_with_occurrence.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified skip_seed_with_occurrence integer is invalid.'))
trigger=True
chain_drop = self.config_dict['alignment_flags']['@chain_drop']
if not isinstance(float(chain_drop), float):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified chain_drop float is invalid.'))
trigger=True
seeded_chain_drop = self.config_dict['alignment_flags']['@seeded_chain_drop']
if not seeded_chain_drop.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified seeded_chain_drop integer is invalid.'))
trigger=True
seq_match_score = self.config_dict['alignment_flags']['@seq_match_score']
if not seq_match_score.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified seq_match_score integer is invalid.'))
trigger=True
mismatch_penalty = self.config_dict['alignment_flags']['@mismatch_penalty']
if not mismatch_penalty.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified mismatch_penalty integer is invalid.'))
trigger=True
indel_penalty_raw = self.config_dict['alignment_flags']['@indel_penalty']
indel_penalty = indel_penalty_raw.split(',')
for individual_indelpen in indel_penalty:
if not individual_indelpen.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified indel_penalty integer(s) is(are) invalid.'))
trigger=True
gap_extend_penalty_raw = self.config_dict['alignment_flags']['@gap_extend_penalty']
gap_extend_penalty = gap_extend_penalty_raw.split(',')
for individual_gaextend in gap_extend_penalty:
if not individual_gaextend.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified gap_extend_penalty integer(s) is(are) invalid.'))
trigger=True
prime_clipping_penalty_raw = self.config_dict['alignment_flags']['@prime_clipping_penalty']
prime_clipping_penalty = prime_clipping_penalty_raw.split(',')
for individual_prclip in prime_clipping_penalty:
if not individual_prclip.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified prime_clipping_penalty integer(s) is(are) invalid.'))
trigger=True
unpaired_pairing_penalty = self.config_dict['alignment_flags']['@unpaired_pairing_penalty']
if not unpaired_pairing_penalty.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Specified unpaired_pairing_penalty integer is invalid.'))
trigger=True
##
## Genotype prediction flag settings
if genotype_flag == 'True':
snp_observation_pcnt = self.config_dict['prediction_flags']['@snp_observation_threshold']
if not snp_observation_pcnt.isdigit():
if not int(snp_observation_pcnt) in range(1,5):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: SNP Observation value invalid! Please use 1-10.'))
trigger = True
quality_cutoff = self.config_dict['prediction_flags']['@quality_cutoff']
if not quality_cutoff.isdigit():
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: SNP Quality Cutoff value is not an integer.'))
trigger = True
if trigger:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'XML Config: Failure, exiting.'))
sys.exit(2)
else:
log.info('{}{}{}{}'.format(Colour.green, 'shd__ ', Colour.end, 'XML Config: Parsing parameters successful!'))
class DataClump(dict):
"""Container object for datasets: dictionary-like object that
exposes its keys as attributes."""
def __init__(self, **kwargs):
dict.__init__(self, kwargs)
self.__dict__ = self
class DataLoader:
def __init__(self, database, descriptor):
self.database = database
self.descriptor = descriptor
def load_model(self):
## Loads description file for respective data set
modeldescr_name = self.descriptor
with open(modeldescr_name) as f:
descr_text = f.read()
## Loads data set from csv, into objects in preparation for bunch()
data_file_name = self.database
with open(data_file_name) as f:
data_file = csv.reader(f)
temp = next(data_file)
n_samples = int(temp[0])
n_features = int(temp[1])
data = np.empty((n_samples, n_features))
temp = next(data_file)
feature_names = np.array(temp)
labels = []
for i, d in enumerate(data_file):
data[i] = d[:-1]
label = d[-1]
labels.append(label)
le = preprocessing.LabelEncoder()
le.fit(labels)
hash_int_labels = le.transform(labels)
return DataClump(DATA=data,
TARGET=hash_int_labels,
FTRNAME=feature_names[:-1],
DESCR=descr_text,
ENCDR=le)
def parse_boolean(boolean_value):
"""
Given a string (boolean_value), returns a boolean value representing the string contents.
For example, a string with 'true', 't', 'y' or 'yes' will yield True.
"""
boolean_value = string.lower(boolean_value) in ('yes', 'y', 'true', 't', '1')
return boolean_value
def empty_string_check(string, raise_exception=True):
"""
Simple check to see if the string provided by parameter string is empty. False indicates the string is NOT empty.
Parameter raise_exception determines if a ValueError exception should be raised if the string is empty.
If raise_exception is False and the string is empty, True is returned.
"""
if string != '':
return False
if raise_exception:
raise ValueError("Empty string detected!")
return True
def sanitise_inputs(parsed_arguments):
"""
Utilises filesystem_exists_check and check_input_files
if either return false, path is invalid or unsupported files present
so, quit
"""
trigger = False
##
## Jobname prefix validity check
if parsed_arguments.jobname:
for character in parsed_arguments.jobname:
if character is ' ' or character is '/':
log.error('{}{}{}{}{}{}'.format(Colour.red,'shd__ ',Colour.end,'Specified Job Name has invalid characters: "', character, '"'))
trigger = True
##
## Config mode check
if parsed_arguments.config:
if not filesystem_exists_check(parsed_arguments.config[0]):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'Specified config file could not be found.'))
trigger = True
for xmlfile in parsed_arguments.config:
if not check_input_files('.xml',xmlfile):
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'Specified config file is not an XML file.'))
trigger = True
return trigger
def extract_data(input_data_directory):
target_files = glob.glob(os.path.join(input_data_directory, '*'))
for extract_target in target_files:
if extract_target.lower().endswith(('.fq.gz', '.fastq.gz')):
log.info('{}{}{}{}'.format(Colour.bold, 'shd__ ', Colour.end, 'Detected compressed input data. Extracting!'))
break
for extract_target in target_files:
unzipd = subprocess.Popen(['gzip', '-q', '-f', '-d', extract_target], stderr=subprocess.PIPE)
unzipd.wait()
return True
def sequence_pairings(data_path, instance_rundir):
##
## Get input files from data path
## Sort so that ordering isn't screwy on linux
input_files = glob.glob(os.path.join(data_path, '*'))
sorted_input = sorted(input_files)
sequence_pairs = []
file_count = len(sorted_input)
if not file_count % 2 == 0:
log.error('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'I/O: Non-even number of input files specified. Cannot continue without pairing!'))
sys.exit(2)
##
## Optimise so code isn't recycled
for i in range(0, len(sorted_input), 2):
file_pair = {}
forward_data = sorted_input[i]
reverse_data = sorted_input[i+1]
##
## Check forward ends with R1
forward_data_name = sorted_input[i].split('/')[-1].split('.')[0]
if not forward_data_name.endswith('_R1'):
log.error('{}{}{}{}{}'.format(Colour.red,'shd__ ',Colour.end,'I/O: Forward input file does not end in _R1. ', forward_data))
sys.exit(2)
##
## Check reverse ends with R2
reverse_data_name = sorted_input[i+1].split('/')[-1].split('.')[0]
if not reverse_data_name.endswith('_R2'):
log.error('{}{}{}{}{}'.format(Colour.red,'shd__ ',Colour.end,'I/O: Reverse input file does not end in _R2. ', reverse_data))
sys.exit(2)
##
## Make Stage outputs for use in everywhere else in pipeline
sample_root = '_'.join(forward_data_name.split('_')[:-1])
instance_path = os.path.join(instance_rundir)
seq_qc_path = os.path.join(instance_rundir, sample_root, 'SeqQC')
align_path = os.path.join(instance_rundir, sample_root, 'Align')
predict_path = os.path.join(instance_rundir, sample_root, 'Predict')
file_pair[sample_root] = [forward_data, reverse_data, instance_path, seq_qc_path, align_path, predict_path]
sequence_pairs.append(file_pair)
return sequence_pairs
def filesystem_exists_check(path, raise_exception=True):
"""
Checks to see if the path, specified by parameter path, exists. Can be either a directory or file.
If the path exists, True is returned. If the path does not exist, and raise_exception is set to True,
an IOError is raised - else False is returned.
"""
if os.path.lexists(path):
return True
if raise_exception:
log.error('{}{}{}{}'.format(Colour.red,'shd__ ',Colour.end,'Specified input path could not be found.'))
return False
def check_input_files(input_format, input_file):
if input_file.endswith(input_format):
return True
return False
def initialise_libraries(instance_params):
trigger = False
##
## Subfunction for recycling code
## Calls UNIX type for checking binaries present
## Changed from WHICH as apparently type functions over different shells/config files
def type_func(binary):
binary_result = []
binary_string = 'type {}'.format(binary)
binary_subprocess = subprocess.Popen([binary_string], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
binary_result = binary_subprocess.communicate()
binary_subprocess.wait()
if 'not found'.encode() in binary_result[0] or binary_result[1]:
log.critical('{}{}{}{}{}{}'.format(Colour.red,'shd__ ',Colour.end,'Missing binary: ', binary, '!'))
raise NameError
##
## To determine which binaries to check for
## AttributeError in the situation where instance_params origin differs
## try for -c style, except AttributeError for -b style
try:
quality_control = instance_params.config_dict['instance_flags']['@quality_control']
alignment = instance_params.config_dict['instance_flags']['@sequence_alignment']
genotyping = instance_params.config_dict['instance_flags']['@genotype_prediction']
snp_calling = instance_params.config_dict['instance_flags']['@snp_calling']
except AttributeError:
quality_control = instance_params['quality_control']
alignment = instance_params['sequence_alignment']
genotyping = instance_params['genotype_prediction']
snp_calling = instance_params['snp_calling']
if quality_control == 'True':
try:type_func('java')
except NameError: trigger=True
try:type_func('fastqc')
except NameError: trigger=True
try:type_func('cutadapt')
except NameError: trigger=True
if alignment == 'True':
try:type_func('seqtk')
except NameError: trigger=True
try:type_func('bwa')
except NameError: trigger=True
try:type_func('samtools')
except NameError: trigger=True
try:type_func('generatr')
except NameError: trigger=True
if genotyping == 'True':
try:type_func('samtools')
except NameError: trigger=True
try:type_func('generatr')
except NameError: trigger=True
if snp_calling == 'True':
try: type_func('picard')
except NameError: trigger=True
try: type_func('freebayes')
except NameError: trigger=True
return trigger
def sanitise_outputs(jobname, output_argument):
run_dir = ''
output_root = output_argument[0]
if jobname:
target_output = os.path.join(output_root, jobname)
if not os.path.exists(target_output):
log.info('{}{}{}{}{}'.format(Colour.bold, 'shd__ ', Colour.end, 'Creating Output with prefix: ', jobname))
run_dir = os.path.join(output_root, jobname)
mkdir_p(run_dir)
else:
purge_choice = ''
while True:
purge_choice = input('{}{}{}{}'.format(Colour.bold, 'shd__ ', Colour.end, 'Job folder already exists. Delete existing folder? Y/N: '))
if not (purge_choice.lower() == 'y') and not (purge_choice.lower() == 'n'):
log.info('{}{}{}{}'.format(Colour.red, 'shd__ ', Colour.end, 'Invalid input. Please input Y or N.'))
continue
else:
break
if purge_choice.lower() == 'y':
log.info('{}{}{}{}{}'.format(Colour.bold, 'shd__ ', Colour.end, 'Clearing pre-existing Jobname Prefix: ', jobname))
run_dir = os.path.join(output_root, jobname)
if os.path.exists(run_dir):
shutil.rmtree(run_dir, ignore_errors=True)
mkdir_p(run_dir)
else:
raise Exception('User chose not to delete pre-existing Job folder. Cannot write output.')
else:
## Ensures root output is a real directory
## Generates folder name based on date (for run ident)
date = datetime.date.today().strftime('%d-%m-%Y')
walltime = datetime.datetime.now().strftime('%H%M%S')
today = date + '-' + walltime
## If the user specified root doesn't exist, make it
## Then make the run directory for datetime
if not os.path.exists(output_root):
log.info('{}{}{}{}'.format(Colour.bold, 'shd__ ', Colour.end, 'Creating output root... '))
mkdir_p(output_root)
run_dir = os.path.join(output_root, 'ScaleHDRun_'+today)
log.info('{}{}{}{}'.format(Colour.bold, 'shd__ ', Colour.end, 'Creating instance run directory.. '))
mkdir_p(run_dir)
## Inform user it's all gonna be okaaaayyyy
log.info('{}{}{}{}'.format(Colour.green, 'shd__ ', Colour.end, 'Output directories OK!'))
return run_dir
def replace_fqfile(mutate_list, target_fqfile, altered_path):
if target_fqfile in mutate_list:
loc = mutate_list.index(target_fqfile)
mutate_list[loc] = altered_path
return mutate_list
def scrape_summary_data(stage, input_report_file):
##
## If the argument input_report_file is from trimming..
if stage == 'trim':
with open(input_report_file, 'r') as trpf:
trim_lines = trpf.readlines()
##
## Determine buffer size to slice from above array
scraping_buffer = 8
if '-q' in trim_lines[1]:
scraping_buffer += 1
##
## Get Anchor
summary_start = 0
for i in range(0, len(trim_lines)):
if '== Summary ==' in trim_lines[i]:
summary_start = i
##
## Slice and close
summary_data = trim_lines[summary_start:summary_start + scraping_buffer]
trpf.close()
return summary_data[2:]
##
## If the argument input_report_file is from alignment..
if stage == 'align':
with open(input_report_file, 'r') as alnrpf:
align_lines = alnrpf.readlines()
alnrpf.close()
##
## No ranges required, only skip first line
return align_lines[1:]
##
## No need to tidy up report for genotyping
## since we already have the data from our own objects
if stage == 'gtype':
pass
def generate_atypical_xml(label, allele_object, index_path, direction):
"""
:param allele_object:
:param index_path:
:return:
"""
##TODO docstring
atypical_path = os.path.join(index_path, '{}{}_{}.xml'.format(direction, label, allele_object.get_reflabel()))
fp_flank = 'GCGACCCTGGAAAAGCTGATGAAGGCCTTCGAGTCCCTCAAGTCCTTC'
cagstart = ''; cagend = ''
intv = allele_object.get_intervening()
ccgstart = ''; ccgend = ''
ccglen = allele_object.get_ccg()
cctlen = allele_object.get_cct()
tp_flank = 'CAGCTTCCTCAGCCGCCGCCGCAGGCACAGCCGCTGCT'
if direction == 'fw':
cagstart = '1'; cagend = '200'
ccgstart = '1'; ccgend = '20'
if direction == 'rv':
cagstart = '100'; cagend = '100'
ccgstart = '1'; ccgend = '20'
##
## Create XML
data_root = etree.Element('data')
loci_root = etree.Element('loci', label=allele_object.get_reflabel()); data_root.append(loci_root)
##
## Loci Nodes
fp_input = etree.Element('input', type='fiveprime', flank=fp_flank)
cag_region = etree.Element('input', type='repeat_region', order='1', unit='CAG', start=cagstart, end=cagend)
intervening = etree.Element('input', type='intervening', sequence=intv, prior='1')
ccg_region = etree.Element('input', type='repeat_region', order='2', unit='CCG', start=ccgstart, end=ccgend)
cct_region = etree.Element('input', type='repeat_region', order='3', unit='CCT', start=str(cctlen), end=str(cctlen))
tp_input = etree.Element('input', type='threeprime', flank=tp_flank)
for node in [fp_input, cag_region, intervening, ccg_region, cct_region, tp_input]:
loci_root.append(node)
s = etree.tostring(data_root, pretty_print=True)
with open(atypical_path, 'w') as xmlfi:
xmlfi.write(s.decode())
xmlfi.close()
return atypical_path
def generate_reference(input_xml, index_path, ref_indexes, direction):
##TODO docstring
label = input_xml.split('/')[-1].split('.')[0]
target_output = os.path.join(index_path, label + '.fa')
temp_output = os.path.join(index_path, label + '_concat.fa')
gen_process = subprocess.Popen(['generatr', '-i', input_xml, '-o', target_output], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gen_process.wait()
##
## Join typical and atypical reference into one file
if direction == 'fw':
toutfi = open(temp_output, 'w')
cat_process = subprocess.Popen(['cat', target_output, ref_indexes[0]], stdout=toutfi, stderr=subprocess.PIPE)
cat_process.wait()
toutfi.close()
target_output = temp_output
return target_output
def seek_target(input_list, target):
for i in range(0, len(input_list)):
if target in input_list[i]:
return i
def sanitise_trimming_output(input_object, input_list):
if type(input_object) is int:
cleanse_target = input_list[input_object].split(':')[1].lstrip().rstrip()
return cleanse_target
else:
return '*'
def sanitise_alignment_output(input_object, input_list, stage):
if type(input_object) is int:
if stage == 3:
cleanse_target = input_list[input_object].lstrip().rstrip().split(' ')[0:1]
return ''.join(cleanse_target)
else:
cleanse_target = input_list[input_object].lstrip().rstrip().split(' ')[0:2]
return ' '.join(cleanse_target)
else:
return '*'
def mkdir_p(path):
try: os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path): pass
else: raise
| [((542, 4, 542, 25), 'os.path.lexists', 'os.path.lexists', ({(542, 20, 542, 24): 'path'}, {}), '(path)', False, 'import os\n'), ((740, 13, 740, 34), 'lxml.etree.Element', 'etree.Element', ({(740, 27, 740, 33): '"""data"""'}, {}), "('data')", False, 'from lxml import etree\n'), ((745, 12, 745, 68), 'lxml.etree.Element', 'etree.Element', (), '', False, 'from lxml import etree\n'), ((746, 14, 746, 109), 'lxml.etree.Element', 'etree.Element', (), '', False, 'from lxml import etree\n'), ((747, 15, 747, 83), 'lxml.etree.Element', 'etree.Element', (), '', False, 'from lxml import etree\n'), ((748, 14, 748, 109), 'lxml.etree.Element', 'etree.Element', (), '', False, 'from lxml import etree\n'), ((750, 12, 750, 69), 'lxml.etree.Element', 'etree.Element', (), '', False, 'from lxml import etree\n'), ((755, 5, 755, 49), 'lxml.etree.tostring', 'etree.tostring', (), '', False, 'from lxml import etree\n'), ((767, 17, 767, 56), 'os.path.join', 'os.path.join', ({(767, 30, 767, 40): 'index_path', (767, 42, 767, 55): "label + '.fa'"}, {}), "(index_path, label + '.fa')", False, 'import os\n'), ((768, 15, 768, 61), 'os.path.join', 'os.path.join', ({(768, 28, 768, 38): 'index_path', (768, 40, 768, 60): "label + '_concat.fa'"}, {}), "(index_path, label + '_concat.fa')", False, 'import os\n'), ((769, 15, 769, 131), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((81, 15, 81, 34), 'lxml.etree.DTD', 'etree.DTD', ({(81, 25, 81, 33): 'dtd_file'}, {}), '(dtd_file)', False, 'from lxml import etree\n'), ((129, 16, 129, 67), 'lxml.etree.tostring', 'etree.tostring', (), '', False, 'from lxml import etree\n'), ((130, 17, 130, 46), 'xml.etree.cElementTree.XML', 'cElementTree.XML', ({(130, 34, 130, 45): 'string_repr'}, {}), '(string_repr)', False, 'from xml.etree import cElementTree\n'), ((425, 17, 425, 44), 'string.lower', 'string.lower', ({(425, 30, 425, 43): 'boolean_value'}, {}), '(boolean_value)', False, 'import string\n'), ((475, 26, 475, 65), 'os.path.join', 'os.path.join', ({(475, 39, 475, 59): 'input_data_directory', (475, 61, 475, 64): '"""*"""'}, {}), "(input_data_directory, '*')", False, 'import os\n'), ((482, 11, 482, 95), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((492, 25, 492, 53), 'os.path.join', 'os.path.join', ({(492, 38, 492, 47): 'data_path', (492, 49, 492, 52): '"""*"""'}, {}), "(data_path, '*')", False, 'import os\n'), ((499, 2, 499, 13), 'sys.exit', 'sys.exit', ({(499, 11, 499, 12): '(2)'}, {}), '(2)', False, 'import sys\n'), ((525, 18, 525, 47), 'os.path.join', 'os.path.join', ({(525, 31, 525, 46): 'instance_rundir'}, {}), '(instance_rundir)', False, 'import os\n'), ((526, 16, 526, 67), 'os.path.join', 'os.path.join', ({(526, 29, 526, 44): 'instance_rundir', (526, 46, 526, 57): 'sample_root', (526, 59, 526, 66): '"""SeqQC"""'}, {}), "(instance_rundir, sample_root, 'SeqQC')", False, 'import os\n'), ((527, 15, 527, 66), 'os.path.join', 'os.path.join', ({(527, 28, 527, 43): 'instance_rundir', (527, 45, 527, 56): 'sample_root', (527, 58, 527, 65): '"""Align"""'}, {}), "(instance_rundir, sample_root, 'Align')", False, 'import os\n'), ((528, 17, 528, 70), 'os.path.join', 'os.path.join', ({(528, 30, 528, 45): 'instance_rundir', (528, 47, 528, 58): 'sample_root', (528, 60, 528, 69): '"""Predict"""'}, {}), "(instance_rundir, sample_root, 'Predict')", False, 'import os\n'), ((565, 22, 565, 115), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((622, 18, 622, 52), 'os.path.join', 'os.path.join', ({(622, 31, 622, 42): 'output_root', (622, 44, 622, 51): 'jobname'}, {}), '(output_root, jobname)', False, 'import os\n'), ((658, 12, 658, 58), 'os.path.join', 'os.path.join', ({(658, 25, 658, 36): 'output_root', (658, 38, 658, 57): "'ScaleHDRun_' + today"}, {}), "(output_root, 'ScaleHDRun_' + today)", False, 'import os\n'), ((776, 16, 776, 111), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((811, 6, 811, 23), 'os.makedirs', 'os.makedirs', ({(811, 18, 811, 22): 'path'}, {}), '(path)', False, 'import os\n'), ((61, 3, 61, 48), 'logging.error', 'log.error', ({(61, 13, 61, 47): '"""No configuration file specified!"""'}, {}), "('No configuration file specified!')", True, 'import logging as log\n'), ((63, 22, 63, 55), 'lxml.etree.parse', 'etree.parse', ({(63, 34, 63, 54): 'self.config_filename'}, {}), '(self.config_filename)', False, 'from lxml import etree\n'), ((88, 3, 88, 14), 'sys.exit', 'sys.exit', ({(88, 12, 88, 13): '(2)'}, {}), '(2)', False, 'import sys\n'), ((146, 9, 146, 39), 'os.path.exists', 'os.path.exists', ({(146, 24, 146, 38): 'data_directory'}, {}), '(data_directory)', False, 'import os\n'), ((149, 26, 149, 59), 'os.path.join', 'os.path.join', ({(149, 39, 149, 53): 'data_directory', (149, 55, 149, 58): '"""*"""'}, {}), "(data_directory, '*')", False, 'import os\n'), ((154, 9, 154, 42), 'os.path.isfile', 'os.path.isfile', ({(154, 24, 154, 41): 'forward_reference'}, {}), '(forward_reference)', False, 'import os\n'), ((161, 9, 161, 42), 'os.path.isfile', 'os.path.isfile', ({(161, 24, 161, 41): 'reverse_reference'}, {}), '(reverse_reference)', False, 'import os\n'), ((362, 3, 362, 14), 'sys.exit', 'sys.exit', ({(362, 12, 362, 13): '(2)'}, {}), '(2)', False, 'import sys\n'), ((393, 16, 393, 29), 'csv.reader', 'csv.reader', ({(393, 27, 393, 28): 'f'}, {}), '(f)', False, 'import csv\n'), ((397, 11, 397, 44), 'numpy.empty', 'np.empty', ({(397, 20, 397, 43): '(n_samples, n_features)'}, {}), '((n_samples, n_features))', True, 'import numpy as np\n'), ((399, 20, 399, 34), 'numpy.array', 'np.array', ({(399, 29, 399, 33): 'temp'}, {}), '(temp)', True, 'import numpy as np\n'), ((407, 9, 407, 37), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ({}, {}), '()', False, 'from sklearn import preprocessing\n'), ((513, 3, 513, 14), 'sys.exit', 'sys.exit', ({(513, 12, 513, 13): '(2)'}, {}), '(2)', False, 'import sys\n'), ((520, 3, 520, 14), 'sys.exit', 'sys.exit', ({(520, 12, 520, 13): '(2)'}, {}), '(2)', False, 'import sys\n'), ((623, 9, 623, 38), 'os.path.exists', 'os.path.exists', ({(623, 24, 623, 37): 'target_output'}, {}), '(target_output)', False, 'import os\n'), ((625, 13, 625, 47), 'os.path.join', 'os.path.join', ({(625, 26, 625, 37): 'output_root', (625, 39, 625, 46): 'jobname'}, {}), '(output_root, jobname)', False, 'import os\n'), ((655, 9, 655, 36), 'os.path.exists', 'os.path.exists', ({(655, 24, 655, 35): 'output_root'}, {}), '(output_root)', False, 'import os\n'), ((106, 9, 106, 26), 'collections.defaultdict', 'defaultdict', ({(106, 21, 106, 25): 'list'}, {}), '(list)', False, 'from collections import defaultdict\n'), ((639, 14, 639, 48), 'os.path.join', 'os.path.join', ({(639, 27, 639, 38): 'output_root', (639, 40, 639, 47): 'jobname'}, {}), '(output_root, jobname)', False, 'import os\n'), ((640, 7, 640, 30), 'os.path.exists', 'os.path.exists', ({(640, 22, 640, 29): 'run_dir'}, {}), '(run_dir)', False, 'import os\n'), ((649, 9, 649, 30), 'datetime.date.today', 'datetime.date.today', ({}, {}), '()', False, 'import datetime\n'), ((650, 13, 650, 36), 'datetime.datetime.now', 'datetime.datetime.now', ({}, {}), '()', False, 'import datetime\n'), ((813, 35, 813, 54), 'os.path.isdir', 'os.path.isdir', ({(813, 49, 813, 53): 'path'}, {}), '(path)', False, 'import os\n'), ((274, 36, 274, 57), 'numpy.arange', 'np.arange', ({(274, 46, 274, 47): '(0)', (274, 48, 274, 51): '(1.1)', (274, 52, 274, 56): '(0.01)'}, {}), '(0, 1.1, 0.01)', True, 'import numpy as np\n'), ((641, 5, 641, 47), 'shutil.rmtree', 'shutil.rmtree', (), '', False, 'import shutil\n')] |
Jian137/mmediting-1 | tests/test_models/test_backbones/test_encoder_decoders/test_deepfill_encoder.py | e1ac6c93441ec96696d0b530f040b91b809015b6 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder
from mmedit.models.common import SimpleGatedConvModule
def test_deepfill_enc():
encoder = DeepFillEncoder()
x = torch.randn((2, 5, 256, 256))
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 128, 64, 64)
assert encoder.enc2.stride == (2, 2)
assert encoder.enc2.out_channels == 64
encoder = DeepFillEncoder(encoder_type='stage2_conv')
x = torch.randn((2, 5, 256, 256))
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 128, 64, 64)
assert encoder.enc2.out_channels == 32
assert encoder.enc3.out_channels == 64
assert encoder.enc4.out_channels == 64
encoder = DeepFillEncoder(encoder_type='stage2_attention')
x = torch.randn((2, 5, 256, 256))
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 128, 64, 64)
assert encoder.enc2.out_channels == 32
assert encoder.enc3.out_channels == 64
assert encoder.enc4.out_channels == 128
if torch.cuda.is_available():
encoder = DeepFillEncoder().cuda()
x = torch.randn((2, 5, 256, 256)).cuda()
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 128, 64, 64)
assert encoder.enc2.stride == (2, 2)
assert encoder.enc2.out_channels == 64
encoder = DeepFillEncoder(encoder_type='stage2_conv').cuda()
x = torch.randn((2, 5, 256, 256)).cuda()
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 128, 64, 64)
assert encoder.enc2.out_channels == 32
assert encoder.enc3.out_channels == 64
assert encoder.enc4.out_channels == 64
encoder = DeepFillEncoder(encoder_type='stage2_attention').cuda()
x = torch.randn((2, 5, 256, 256)).cuda()
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 128, 64, 64)
assert encoder.enc2.out_channels == 32
assert encoder.enc3.out_channels == 64
assert encoder.enc4.out_channels == 128
encoder = DeepFillEncoder(
conv_type='gated_conv', channel_factor=0.75).cuda()
x = torch.randn((2, 5, 256, 256)).cuda()
outputs = encoder(x)
assert isinstance(outputs, dict)
assert 'out' in outputs
res = outputs['out']
assert res.shape == (2, 96, 64, 64)
assert isinstance(encoder.enc2, SimpleGatedConvModule)
assert encoder.enc2.conv.stride == (2, 2)
assert encoder.enc2.conv.out_channels == 48 * 2
def test_deepfill_contextual_attention_neck():
# TODO: add unittest for contextual attention module
neck = ContextualAttentionNeck(in_channels=128)
x = torch.rand((2, 128, 64, 64))
mask = torch.zeros((2, 1, 64, 64))
mask[..., 20:100, 23:90] = 1.
res, offset = neck(x, mask)
assert res.shape == (2, 128, 64, 64)
assert offset.shape == (2, 32, 32, 32, 32)
if torch.cuda.is_available():
neck.cuda()
res, offset = neck(x.cuda(), mask.cuda())
assert res.shape == (2, 128, 64, 64)
assert offset.shape == (2, 32, 32, 32, 32)
neck = ContextualAttentionNeck(
in_channels=128, conv_type='gated_conv').cuda()
res, offset = neck(x.cuda(), mask.cuda())
assert res.shape == (2, 128, 64, 64)
assert offset.shape == (2, 32, 32, 32, 32)
assert isinstance(neck.conv1, SimpleGatedConvModule)
| [((9, 14, 9, 31), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', ({}, {}), '()', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((10, 8, 10, 37), 'torch.randn', 'torch.randn', ({(10, 20, 10, 36): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((19, 14, 19, 57), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((20, 8, 20, 37), 'torch.randn', 'torch.randn', ({(20, 20, 20, 36): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((30, 14, 30, 62), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((31, 8, 31, 37), 'torch.randn', 'torch.randn', ({(31, 20, 31, 36): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((40, 7, 40, 32), 'torch.cuda.is_available', 'torch.cuda.is_available', ({}, {}), '()', False, 'import torch\n'), ((88, 11, 88, 51), 'mmedit.models.backbones.ContextualAttentionNeck', 'ContextualAttentionNeck', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((89, 8, 89, 36), 'torch.rand', 'torch.rand', ({(89, 19, 89, 35): '(2, 128, 64, 64)'}, {}), '((2, 128, 64, 64))', False, 'import torch\n'), ((90, 11, 90, 38), 'torch.zeros', 'torch.zeros', ({(90, 23, 90, 37): '(2, 1, 64, 64)'}, {}), '((2, 1, 64, 64))', False, 'import torch\n'), ((98, 7, 98, 32), 'torch.cuda.is_available', 'torch.cuda.is_available', ({}, {}), '()', False, 'import torch\n'), ((41, 18, 41, 35), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', ({}, {}), '()', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((42, 12, 42, 41), 'torch.randn', 'torch.randn', ({(42, 24, 42, 40): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((51, 18, 51, 61), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((52, 12, 52, 41), 'torch.randn', 'torch.randn', ({(52, 24, 52, 40): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((62, 18, 62, 66), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((63, 12, 63, 41), 'torch.randn', 'torch.randn', ({(63, 24, 63, 40): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((73, 18, 74, 56), 'mmedit.models.backbones.DeepFillEncoder', 'DeepFillEncoder', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n'), ((75, 12, 75, 41), 'torch.randn', 'torch.randn', ({(75, 24, 75, 40): '(2, 5, 256, 256)'}, {}), '((2, 5, 256, 256))', False, 'import torch\n'), ((105, 15, 106, 52), 'mmedit.models.backbones.ContextualAttentionNeck', 'ContextualAttentionNeck', (), '', False, 'from mmedit.models.backbones import ContextualAttentionNeck, DeepFillEncoder\n')] |
Wastecoinng/mvp_beta | mvp/migrations/0004_auto_20201127_0649.py | 2faa4b9eeac99b2c284bafad955b90f9951991fc | # Generated by Django 2.2.13 on 2020-11-27 05:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mvp', '0003_hublocation'),
]
operations = [
migrations.RemoveField(
model_name='hublocation',
name='longitude',
),
migrations.AddField(
model_name='hublocation',
name='longi',
field=models.TextField(default=654433, max_length=90, unique=True, verbose_name='Longitude'),
preserve_default=False,
),
]
| [((13, 8, 16, 9), 'django.db.migrations.RemoveField', 'migrations.RemoveField', (), '', False, 'from django.db import migrations, models\n'), ((20, 18, 20, 104), 'django.db.models.TextField', 'models.TextField', (), '', False, 'from django.db import migrations, models\n')] |
mofresh27/MuseumExperience-Group2-Python-BE-1 | adminapp/migrations/0012_auto_20210714_1155.py | d6ca7aceeddfcfdefdf112ab5e40cf74d6b472ce | # Generated by Django 3.2.4 on 2021-07-14 11:55
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('adminapp', '0011_faq'),
]
operations = [
migrations.AddField(
model_name='faq',
name='uuid',
field=models.UUIDField(blank=True, default=uuid.uuid4, null=True),
),
migrations.AlterField(
model_name='faq',
name='answer',
field=models.TextField(blank=True, default=None, null=True),
),
migrations.AlterField(
model_name='faq',
name='question',
field=models.TextField(blank=True, default=None, null=True),
),
]
| [((17, 18, 17, 77), 'django.db.models.UUIDField', 'models.UUIDField', (), '', False, 'from django.db import migrations, models\n'), ((22, 18, 22, 71), 'django.db.models.TextField', 'models.TextField', (), '', False, 'from django.db import migrations, models\n'), ((27, 18, 27, 71), 'django.db.models.TextField', 'models.TextField', (), '', False, 'from django.db import migrations, models\n')] |
andrewsimonds14/Capstone | scripts/json_parse.py | 5ae56b9be40846e9993a8f23aaa8e1ef92cd9ea3 | import json
import os
import nibabel as nib
import csv
from operator import itemgetter
# PATH TO PREPROCESSED DATA
raw_data_path = '/home/lab/nnUNet_data/nnUNet_raw_data_base/nnUNet_raw_data/Task500_BrainMets'
pixdim_ind = [1,2,3] # Indexes at which the voxel size [x,y,z] is stored
# PATH TO JSON FILE
with open('/home/lab/nnUNet_data/RESULTS_FOLDER/nnUNet/3d_fullres/Task500_BrainMets/nnUNetTrainerV2__nnUNetPlansv2.1/fold_4/validation_raw/summary.json') as file:
data = json.load(file)
with open('json_parsed.csv', mode='w') as csv_file:
csv_writer = csv.writer(csv_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow(['Case Number', 'Dice Score', 'Voxel Size-X', 'Voxel Size-Y', 'Voxel Size-Z'])
for img in data['results']['all']:
# Get dice score on image
dice = img['1']['Dice']
# Get nifti data on image
img_filename = (os.path.basename(img['reference']).split('.'))[0]
img_ni = nib.load(raw_data_path + '/imagesTr/' + img_filename + '_0000.nii.gz')
label_ni = nib.load(raw_data_path + '/labelsTr/' + img_filename + '.nii.gz')
voxel_size = itemgetter(*pixdim_ind)(img_ni.header["pixdim"])
# Get tumor dimensions
# tumor_size =
# Get case number corresponding to image
case_number = img_filename.split('_')[1]
# Write to csv file
csv_writer = csv.writer(csv_file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
csv_writer.writerow([case_number, dice, voxel_size[0], voxel_size[1], voxel_size[2]])
| [((15, 9, 15, 24), 'json.load', 'json.load', ({(15, 19, 15, 23): 'file'}, {}), '(file)', False, 'import json\n'), ((18, 17, 18, 94), 'csv.writer', 'csv.writer', (), '', False, 'import csv\n'), ((27, 17, 27, 87), 'nibabel.load', 'nib.load', ({(27, 26, 27, 86): "raw_data_path + '/imagesTr/' + img_filename + '_0000.nii.gz'"}, {}), "(raw_data_path + '/imagesTr/' + img_filename + '_0000.nii.gz')", True, 'import nibabel as nib\n'), ((28, 19, 28, 84), 'nibabel.load', 'nib.load', ({(28, 28, 28, 83): "raw_data_path + '/labelsTr/' + img_filename + '.nii.gz'"}, {}), "(raw_data_path + '/labelsTr/' + img_filename + '.nii.gz')", True, 'import nibabel as nib\n'), ((39, 21, 39, 98), 'csv.writer', 'csv.writer', (), '', False, 'import csv\n'), ((30, 21, 30, 44), 'operator.itemgetter', 'itemgetter', ({(30, 32, 30, 43): '*pixdim_ind'}, {}), '(*pixdim_ind)', False, 'from operator import itemgetter\n'), ((26, 24, 26, 58), 'os.path.basename', 'os.path.basename', ({(26, 41, 26, 57): "img['reference']"}, {}), "(img['reference'])", False, 'import os\n')] |
tinylambda/tornadio2 | tests/gen_test.py | 7b112e2e207bd7500288b42896f9970c16e623ad | # -*- coding: utf-8 -*-
"""
tornadio2.tests.gen
~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011 by the Serge S. Koval, see AUTHORS for more details.
:license: Apache, see LICENSE for more details.
"""
from collections import deque
from nose.tools import eq_
from tornadio2 import gen
_queue = None
def init_environment():
global _queue
_queue = deque()
def run_sync(test, callback):
callback(test)
def queue_async(test, callback):
global _queue
_queue.append((callback, test))
def step_async():
callback = _queue.popleft()
callback[0](callback[1])
def run_async():
global _queue
while True:
try:
step_async()
except IndexError:
break
def run_async_oor():
global _queue
while True:
try:
callback = _queue.pop()
callback[0](callback[1])
except IndexError:
break
class Dummy():
def __init__(self, queue_type):
self.v = None
self.queue_type = queue_type
@gen.sync_engine
def test(self, value):
self.v = yield gen.Task(self.queue_type, value)
class DummyList():
def __init__(self, queue_type):
self.v = []
self.queue_type = queue_type
@gen.sync_engine
def test(self, value):
self.v.append((yield gen.Task(self.queue_type, value)))
class DummyListOutOfOrder():
def __init__(self, queue_type):
self.v = []
self.queue_type = queue_type
@gen.engine
def test(self, value):
self.v.append((yield gen.Task(self.queue_type, value)))
class DummyLoop():
def __init__(self, queue_type):
self.v = 0
self.queue_type = queue_type
@gen.sync_engine
def test(self, value):
for n in range(2):
self.v += (yield gen.Task(self.queue_type, value))
def test():
init_environment()
dummy = Dummy(run_sync)
dummy.test('test')
eq_(dummy.v, 'test')
def test_async():
init_environment()
dummy = Dummy(queue_async)
dummy.test('test')
run_async()
# Verify value
eq_(dummy.v, 'test')
def test_sync_queue():
init_environment()
dummy = DummyList(queue_async)
dummy.test('1')
dummy.test('2')
dummy.test('3')
run_async()
# Verify value
eq_(dummy.v, ['1', '2', '3'])
def test_sync_queue_oor():
init_environment()
dummy = DummyList(queue_async)
dummy.test('1')
dummy.test('2')
dummy.test('3')
run_async_oor()
# Verify value
eq_(dummy.v, ['1', '2', '3'])
def test_async_queue_oor():
init_environment()
dummy = DummyListOutOfOrder(queue_async)
dummy.test('1')
dummy.test('2')
dummy.test('3')
run_async_oor()
# Verify value
eq_(dummy.v, ['3', '2', '1'])
| [((21, 13, 21, 20), 'collections.deque', 'deque', ({}, {}), '()', False, 'from collections import deque\n'), ((105, 4, 105, 24), 'nose.tools.eq_', 'eq_', ({(105, 8, 105, 15): 'dummy.v', (105, 17, 105, 23): '"""test"""'}, {}), "(dummy.v, 'test')", False, 'from nose.tools import eq_\n'), ((116, 4, 116, 24), 'nose.tools.eq_', 'eq_', ({(116, 8, 116, 15): 'dummy.v', (116, 17, 116, 23): '"""test"""'}, {}), "(dummy.v, 'test')", False, 'from nose.tools import eq_\n'), ((129, 4, 129, 33), 'nose.tools.eq_', 'eq_', ({(129, 8, 129, 15): 'dummy.v', (129, 17, 129, 32): "['1', '2', '3']"}, {}), "(dummy.v, ['1', '2', '3'])", False, 'from nose.tools import eq_\n'), ((142, 4, 142, 33), 'nose.tools.eq_', 'eq_', ({(142, 8, 142, 15): 'dummy.v', (142, 17, 142, 32): "['1', '2', '3']"}, {}), "(dummy.v, ['1', '2', '3'])", False, 'from nose.tools import eq_\n'), ((155, 4, 155, 33), 'nose.tools.eq_', 'eq_', ({(155, 8, 155, 15): 'dummy.v', (155, 17, 155, 32): "['3', '2', '1']"}, {}), "(dummy.v, ['3', '2', '1'])", False, 'from nose.tools import eq_\n'), ((66, 23, 66, 55), 'tornadio2.gen.Task', 'gen.Task', ({(66, 32, 66, 47): 'self.queue_type', (66, 49, 66, 54): 'value'}, {}), '(self.queue_type, value)', False, 'from tornadio2 import gen\n'), ((76, 29, 76, 61), 'tornadio2.gen.Task', 'gen.Task', ({(76, 38, 76, 53): 'self.queue_type', (76, 55, 76, 60): 'value'}, {}), '(self.queue_type, value)', False, 'from tornadio2 import gen\n'), ((86, 29, 86, 61), 'tornadio2.gen.Task', 'gen.Task', ({(86, 38, 86, 53): 'self.queue_type', (86, 55, 86, 60): 'value'}, {}), '(self.queue_type, value)', False, 'from tornadio2 import gen\n'), ((97, 29, 97, 61), 'tornadio2.gen.Task', 'gen.Task', ({(97, 38, 97, 53): 'self.queue_type', (97, 55, 97, 60): 'value'}, {}), '(self.queue_type, value)', False, 'from tornadio2 import gen\n')] |
JordanMicahBennett/DeepBrainSeg | DeepBrainSeg/tumor/Tester.py | 659dd439d20d4c024fe337874eadb90deffc40a4 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# author: Avinash Kori
# contact: [email protected]
import torch
import SimpleITK as sitk
import numpy as np
import nibabel as nib
from torch.autograd import Variable
from skimage.transform import resize
from torchvision import transforms
from time import gmtime, strftime
from tqdm import tqdm
import pdb
import os
from ..helpers.helper import *
from os.path import expanduser
home = expanduser("~")
#========================================================================================
# prediction functions.....................
bin_path = os.path.join('/opt/ANTs/bin/')
class tumorSeg():
"""
class performs segmentation for a given sequence of patient data.
to main platform for segmentation mask estimation
one for the patient data in brats format
other with any random format
step followed for in estimation of segmentation mask
1. ABLnet for reducing false positives outside the brain
Air Brain Lesson model (2D model, 103 layered)
2. BNet3Dnet 3D network for inner class classification
Dual Path way network
3. MNet2D 57 layered convolutional network for inner class
classification
4. Tir3Dnet 57 layered 3D convolutional network for inner class
classification
more on training details and network information:
(https://link.springer.com/chapter/10.1007/978-3-030-11726-9_43<Paste>)
=========================
quick: True (just evaluates on Dual path network (BNet3D)
else copmutes an ensumble over all four networks
"""
def __init__(self,
quick = False,
ants_path = bin_path):
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# device = "cpu"
map_location = device
#========================================================================================
ckpt_tir2D = os.path.join(home, '.DeepBrainSeg/BestModels/Tramisu_2D_FC57_best_loss.pth.tar')
ckpt_tir3D = os.path.join(home, '.DeepBrainSeg/BestModels/Tramisu_3D_FC57_best_acc.pth.tar')
ckpt_BNET3D = os.path.join(home, '.DeepBrainSeg/BestModels/BrainNet_3D_best_acc.pth.tar')
ckpt_ABL = os.path.join(home, '.DeepBrainSeg/BestModels/ABL_CE_best_model_loss_based.pth.tar')
#========================================================================================
# air brain lesion segmentation..............
from .models.modelABL import FCDenseNet103
self.ABLnclasses = 3
self.ABLnet = FCDenseNet103(n_classes = self.ABLnclasses) ## intialize the graph
saved_parms=torch.load(ckpt_ABL, map_location=map_location)
self.ABLnet.load_state_dict(saved_parms['state_dict']) ## fill the model with trained params
print ("=================================== ABLNET2D Loaded =================================")
self.ABLnet.eval()
self.ABLnet = self.ABLnet.to(device)
#========================================================================================
# Tir2D net.......................
from .models.modelTir2D import FCDenseNet57
self.Mnclasses = 4
self.MNET2D = FCDenseNet57(self.Mnclasses)
ckpt = torch.load(ckpt_tir2D, map_location=map_location)
self.MNET2D.load_state_dict(ckpt['state_dict'])
print ("=================================== MNET2D Loaded ===================================")
self.MNET2D.eval()
self.MNET2D = self.MNET2D.to(device)
#========================================================================================
if not quick:
# BrainNet3D model......................
from .models.model3DBNET import BrainNet_3D_Inception
self.B3Dnclasses = 5
self.BNET3Dnet = BrainNet_3D_Inception()
ckpt = torch.load(ckpt_BNET3D, map_location=map_location)
self.BNET3Dnet.load_state_dict(ckpt['state_dict'])
print ("=================================== KAMNET3D Loaded =================================")
self.BNET3Dnet.eval()
self.BNET3Dnet = self.BNET3Dnet.to(device)
#========================================================================================
# Tir3D model...................
from .models.modelTir3D import FCDenseNet57
self.T3Dnclasses = 5
self.Tir3Dnet = FCDenseNet57(self.T3Dnclasses)
ckpt = torch.load(ckpt_tir3D, map_location=map_location)
self.Tir3Dnet.load_state_dict(ckpt['state_dict'])
print ("================================== TIRNET2D Loaded =================================")
self.Tir3Dnet.eval()
self.Tir3Dnet = self.Tir3Dnet.to(device)
#========================================================================================
self.device = device
self.quick = quick
self.ants_path = ants_path
def get_ants_mask(self, t1_path):
"""
We make use of ants framework for generalized skull stripping
t1_path: t1 volume path (str)
saves the mask in the same location as t1 data directory
returns: maskvolume (numpy uint8 type)
"""
mask_path = os.path.join(os.path.dirname(t1_path), 'mask.nii.gz')
os.system(self.ants_path +'ImageMath 3 '+ mask_path +' Normalize '+ t1_path)
os.system(self.ants_path +'ThresholdImage 3 '+ mask_path +' '+ mask_path +' 0.01 1')
os.system(self.ants_path +'ImageMath 3 '+ mask_path +' MD '+ mask_path +' 1')
os.system(self.ants_path +'ImageMath 3 '+ mask_path +' ME '+ mask_path +' 1')
os.system(self.ants_path +'CopyImageHeaderInformation '+ t1_path+' '+ mask_path +' '+ mask_path +' 1 1 1')
mask = np.uint8(nib.load(mask_path).get_data())
return mask
def get_localization(self, t1_v, t1c_v, t2_v, flair_v, brain_mask):
"""
ABLnetwork output, finds the brain, Whole tumor region
t1_v = t1 volume (numpy array)
t1c_v = t1c volume (numpy array)
t2_v = t2 volume (numpy array)
flair_v = flair volume (numpy array)
brain_mask = brain, whole tumor mask (numpy array, output of ANTs pieline)
"""
t1_v = normalize(t1_v, brain_mask)
t1c_v = normalize(t1c_v, brain_mask)
t2_v = normalize(t2_v, brain_mask)
flair_v = normalize(flair_v, brain_mask)
generated_output_logits = np.empty((self.ABLnclasses, flair_v.shape[0],flair_v.shape[1],flair_v.shape[2]))
for slices in tqdm(range(flair_v.shape[2])):
flair_slice = np.transpose(flair_v[:,:,slices])
t2_slice = np.transpose(t2_v[:,:,slices])
t1ce_slice = np.transpose(t1c_v[:,:,slices])
t1_slice = np.transpose(t1_v[:,:,slices])
array = np.zeros((flair_slice.shape[0],flair_slice.shape[1],4))
array[:,:,0] = flair_slice
array[:,:,1] = t2_slice
array[:,:,2] = t1ce_slice
array[:,:,3] = t1_slice
transformed_array = torch.from_numpy(convert_image(array)).float()
transformed_array = transformed_array.unsqueeze(0) ## neccessary if batch size == 1
transformed_array = transformed_array.to(self.device)
logits = self.ABLnet(transformed_array).detach().cpu().numpy()# 3 x 240 x 240
generated_output_logits[:,:,:, slices] = logits.transpose(0, 1, 3, 2)
final_pred = apply_argmax_to_logits(generated_output_logits)
final_pred = perform_postprocessing(final_pred)
final_pred = adjust_classes_air_brain_tumour(np.uint8(final_pred))
return np.uint8(final_pred)
def inner_class_classification_with_logits_NCube(self, t1,
t1ce, t2, flair,
brain_mask, mask, N = 64):
"""
output of 3D tiramisu model (tir3Dnet)
mask = numpy array output of ABLnet
N = patch size during inference
"""
t1 = normalize(t1, brain_mask)
t1ce = normalize(t1ce, brain_mask)
t2 = normalize(t2, brain_mask)
flair = normalize(flair, brain_mask)
shape = t1.shape # to exclude batch_size
final_prediction = np.zeros((self.T3Dnclasses, shape[0], shape[1], shape[2]))
x_min, x_max, y_min, y_max, z_min, z_max = bbox(mask, pad = N)
x_min, x_max, y_min, y_max, z_min, z_max = x_min, min(shape[0] - N, x_max), y_min, min(shape[1] - N, y_max), z_min, min(shape[2] - N, z_max)
with torch.no_grad():
for x in tqdm(range(x_min, x_max, N//2)):
for y in range(y_min, y_max, N//2):
for z in range(z_min, z_max, N//2):
high = np.zeros((1, 4, N, N, N))
high[0, 0, :, :, :] = flair[x:x+N, y:y+N, z:z+N]
high[0, 1, :, :, :] = t2[x:x+N, y:y+N, z:z+N]
high[0, 2, :, :, :] = t1[x:x+N, y:y+N, z:z+N]
high[0, 3, :, :, :] = t1ce[x:x+N, y:y+N, z:z+N]
high = Variable(torch.from_numpy(high)).to(self.device).float()
pred = torch.nn.functional.softmax(self.Tir3Dnet(high).detach().cpu())
pred = pred.data.numpy()
final_prediction[:, x:x+N, y:y+N, z:z+N] = pred[0]
final_prediction = convert5class_logitsto_4class(final_prediction)
return final_prediction
def inner_class_classification_with_logits_DualPath(self, t1,
t1ce, t2, flair,
brain_mask, mask=None,
prediction_size = 9):
"""
output of BNet3D
prediction_size = mid inference patch size
"""
t1 = normalize(t1, brain_mask)
t1ce = normalize(t1ce, brain_mask)
t2 = normalize(t2, brain_mask)
flair = normalize(flair, brain_mask)
shape = t1.shape # to exclude batch_size
final_prediction = np.zeros((self.B3Dnclasses, shape[0], shape[1], shape[2]))
x_min, x_max, y_min, y_max, z_min, z_max = bbox(mask, pad = prediction_size)
# obtained by aspect ratio calculation
high_res_size = prediction_size + 16
resize_to = int(prediction_size ** 0.5) + 16
low_res_size = int(51*resize_to/19)
hl_pad = (high_res_size - prediction_size)//2
hr_pad = hl_pad + prediction_size
ll_pad = (low_res_size - prediction_size)//2
lr_pad = ll_pad + prediction_size
for x in tqdm(range(x_min, x_max - prediction_size, prediction_size)):
for y in (range(y_min, y_max - prediction_size, prediction_size)):
for z in (range(z_min, z_max - prediction_size, prediction_size)):
high = np.zeros((1, 4, high_res_size, high_res_size, high_res_size))
low = np.zeros((1, 4, low_res_size, low_res_size, low_res_size))
low1 = np.zeros((1, 4, resize_to, resize_to, resize_to))
high[0, 0], high[0, 1], high[0, 2], high[0, 3] = high[0, 0] + flair[0,0,0], high[0, 1] + t2[0,0,0], high[0, 2] + t1[0,0,0], high[0, 2] + t1ce[0,0,0]
low[0, 0], low[0, 1], low[0, 2], low[0, 3] = low[0, 0] + flair[0,0,0], low[0, 1] + t2[0,0,0], low[0, 2] + t1[0,0,0], low[0, 2] + t1ce[0,0,0]
low1[0, 0], low1[0, 1], low1[0, 2], low1[0, 3] = low1[0, 0] + flair[0,0,0], low1[0, 1] + t2[0,0,0], low1[0, 2] + t1[0,0,0], low1[0, 2] + t1ce[0,0,0]
# =========================================================================
vxf, vxt = max(0, x-hl_pad), min(shape[0], x+hr_pad)
vyf, vyt = max(0, y-hl_pad), min(shape[1], y+hr_pad)
vzf, vzt = max(0, z-hl_pad), min(shape[2], z+hr_pad)
txf, txt = max(0, hl_pad-x), max(0, hl_pad-x) + vxt - vxf
tyf, tyt = max(0, hl_pad-y), max(0, hl_pad-y) + vyt - vyf
tzf, tzt = max(0, hl_pad-z), max(0, hl_pad-z) + vzt - vzf
high[0, 0, txf:txt, tyf:tyt, tzf:tzt] = flair[vxf:vxt, vyf:vyt, vzf:vzt]
high[0, 1, txf:txt, tyf:tyt, tzf:tzt] = t2[vxf:vxt, vyf:vyt, vzf:vzt]
high[0, 2, txf:txt, tyf:tyt, tzf:tzt] = t1[vxf:vxt, vyf:vyt, vzf:vzt]
high[0, 3, txf:txt, tyf:tyt, tzf:tzt] = t1ce[vxf:vxt, vyf:vyt, vzf:vzt]
# =========================================================================
vxf, vxt = max(0, x-ll_pad), min(shape[0], x+lr_pad)
vyf, vyt = max(0, y-ll_pad), min(shape[1], y+lr_pad)
vzf, vzt = max(0, z-ll_pad), min(shape[2], z+lr_pad)
txf, txt = max(0, ll_pad-x), max(0, ll_pad-x) + vxt - vxf
tyf, tyt = max(0, ll_pad-y), max(0, ll_pad-y) + vyt - vyf
tzf, tzt = max(0, ll_pad-z), max(0, ll_pad-z) + vzt - vzf
low[0, 0, txf:txt, tyf:tyt, tzf:tzt] = flair[vxf:vxt, vyf:vyt, vzf:vzt]
low[0, 1, txf:txt, tyf:tyt, tzf:tzt] = t2[vxf:vxt, vyf:vyt, vzf:vzt]
low[0, 2, txf:txt, tyf:tyt, tzf:tzt] = t1[vxf:vxt, vyf:vyt, vzf:vzt]
low[0, 3, txf:txt, tyf:tyt, tzf:tzt] = t1ce[vxf:vxt, vyf:vyt, vzf:vzt]
# =========================================================================
low1[0] = [resize(low[0, i, :, :, :], (resize_to, resize_to, resize_to)) for i in range(4)]
high = Variable(torch.from_numpy(high)).to(self.device).float()
low1 = Variable(torch.from_numpy(low1)).to(self.device).float()
pred = torch.nn.functional.softmax(self.BNET3Dnet(high, low1, pred_size=prediction_size).detach().cpu())
pred = pred.numpy()
final_prediction[:, x:x+prediction_size, y:y+prediction_size, z:z+prediction_size] = pred[0]
final_prediction = convert5class_logitsto_4class(final_prediction)
return final_prediction
def inner_class_classification_with_logits_2D(self,
t1ce_volume,
t2_volume,
flair_volume):
"""
output of 2D tiramisu model (MNet)
"""
normalize = transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
transformList = []
transformList.append(transforms.ToTensor())
transformList.append(normalize)
transformSequence=transforms.Compose(transformList)
generated_output = np.empty((self.Mnclasses,flair_volume.shape[0],flair_volume.shape[1],flair_volume.shape[2]))
for slices in tqdm(range(flair_volume.shape[2])):
flair_slice = scale_every_slice_between_0_to_255(np.transpose(flair_volume[:,:,slices]))
t2_slice = scale_every_slice_between_0_to_255(np.transpose(t2_volume[:,:,slices]))
t1ce_slice = scale_every_slice_between_0_to_255(np.transpose(t1ce_volume[:,:,slices]))
array = np.zeros((flair_slice.shape[0],flair_slice.shape[1],3))
array[:,:,0] = flair_slice
array[:,:,1] = t2_slice
array[:,:,2] = t1ce_slice
array = np.uint8(array)
transformed_array = transformSequence(array)
transformed_array = transformed_array.unsqueeze(0)
transformed_array = transformed_array.to(self.device)
outs = torch.nn.functional.softmax(self.MNET2D(transformed_array).detach().cpu()).numpy()
outs = np.swapaxes(generated_output,1, 2)
return outs
def get_segmentation(self,
t1_path,
t2_path,
t1ce_path,
flair_path,
save_path = None):
"""
Generates segmentation for the data not in brats format
if save_path provided function saves the prediction with
DeepBrainSeg_Prediction.nii.qz name in the provided
directory
returns: segmentation mask
"""
t1 = nib.load(t1_path).get_data()
t2 = nib.load(t2_path).get_data()
t1ce = nib.load(t1ce_path).get_data()
flair = nib.load(flair_path).get_data()
affine = nib.load(flair_path).affine
brain_mask = self.get_ants_mask(t2_path)
mask = self.get_localization(t1, t1ce, t2, flair, brain_mask)
# mask = np.swapaxes(mask,1, 0)
if not self.quick:
final_predictionTir3D_logits = self.inner_class_classification_with_logits_NCube(t1, t1ce, t2, flair, brain_mask, mask)
final_predictionBNET3D_logits = self.inner_class_classification_with_logits_DualPath(t1, t1ce, t2, flair, brain_mask, mask)
final_predictionMnet_logits = self.inner_class_classification_with_logits_2D(t1, t2, flair).transpose(0, 2, 1, 3)
final_prediction_array = np.array([final_predictionTir3D_logits, final_predictionBNET3D_logits, final_predictionMnet_logits])
else:
final_predictionMnet_logits = self.inner_class_classification_with_logits_2D(t1, t2, flair)
final_prediction_array = np.array([final_predictionMnet_logits])
final_prediction_logits = combine_logits_AM(final_prediction_array)
final_pred = postprocessing_pydensecrf(final_prediction_logits)
final_pred = combine_mask_prediction(mask, final_pred)
final_pred = perform_postprocessing(final_pred)
final_pred = adjust_classes(final_pred)
if save_path:
os.makedirs(save_path, exist_ok=True)
save_volume(final_pred, affine, os.path.join(save_path, 'DeepBrainSeg_Prediction'))
return final_pred
def get_segmentation_brats(self,
path,
save = True):
"""
Generates segmentation for the data in BraTs format
if save True saves the prediction in the save directory
in the patients data path
returns : segmentation mask
"""
name = path.split("/")[-1] + "_"
flair = nib.load(os.path.join(path, name + 'flair.nii.gz')).get_data()
t1 = nib.load(os.path.join(path, name + 't1.nii.gz')).get_data()
t1ce = nib.load(os.path.join(path, name + 't1ce.nii.gz')).get_data()
t2 = nib.load(os.path.join(path, name + 't2.nii.gz')).get_data()
affine= nib.load(os.path.join(path, name + 'flair.nii.gz')).affine
print ("[INFO: DeepBrainSeg] (" + strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) + ") Working on: ", path)
brain_mask = self.get_ants_mask(os.path.join(path, name + 't2.nii.gz'))
# brain_mask = get_brain_mask(t1)
mask = self.get_localization(t1, t1ce, t2, flair, brain_mask)
mask = np.swapaxes(mask,1, 0)
if not self.quick:
final_predictionTir3D_logits = self.inner_class_classification_with_logits_NCube(t1, t1ce, t2, flair, brain_mask, mask)
final_predictionBNET3D_logits = self.inner_class_classification_with_logits_DualPath(t1, t1ce, t2, flair, brain_mask, mask)
final_predictionMnet_logits = self.inner_class_classification_with_logits_2D(t1, t2, flair)
final_prediction_array = np.array([final_predictionTir3D_logits, final_predictionBNET3D_logits, final_predictionMnet_logits])
else:
final_predictionMnet_logits = self.inner_class_classification_with_logits_2D(t1, t2, flair)
final_prediction_array = np.array([final_predictionMnet_logits])
final_prediction_logits = combine_logits_AM(final_prediction_array)
final_pred = postprocessing_pydensecrf(final_prediction_logits)
final_pred = combine_mask_prediction(mask, final_pred)
final_pred = perform_postprocessing(final_pred)
final_pred = adjust_classes(final_pred)
if save:
save_volume(final_pred, affine, os.path.join(path, 'DeepBrainSeg_Prediction'))
return final_pred
# ========================================================================================
if __name__ == '__main__':
ext = deepSeg(True)
ext.get_segmentation_brats('../../sample_volume/Brats18_CBICA_AVG_1/')
| [((22, 7, 22, 22), 'os.path.expanduser', 'expanduser', ({(22, 18, 22, 21): '"""~"""'}, {}), "('~')", False, 'from os.path import expanduser\n'), ((26, 11, 26, 41), 'os.path.join', 'os.path.join', ({(26, 24, 26, 40): '"""/opt/ANTs/bin/"""'}, {}), "('/opt/ANTs/bin/')", False, 'import os\n'), ((61, 24, 61, 104), 'os.path.join', 'os.path.join', ({(61, 37, 61, 41): 'home', (61, 43, 61, 103): '""".DeepBrainSeg/BestModels/Tramisu_2D_FC57_best_loss.pth.tar"""'}, {}), "(home, '.DeepBrainSeg/BestModels/Tramisu_2D_FC57_best_loss.pth.tar'\n )", False, 'import os\n'), ((62, 24, 62, 103), 'os.path.join', 'os.path.join', ({(62, 37, 62, 41): 'home', (62, 43, 62, 102): '""".DeepBrainSeg/BestModels/Tramisu_3D_FC57_best_acc.pth.tar"""'}, {}), "(home, '.DeepBrainSeg/BestModels/Tramisu_3D_FC57_best_acc.pth.tar')", False, 'import os\n'), ((63, 24, 63, 99), 'os.path.join', 'os.path.join', ({(63, 37, 63, 41): 'home', (63, 43, 63, 98): '""".DeepBrainSeg/BestModels/BrainNet_3D_best_acc.pth.tar"""'}, {}), "(home, '.DeepBrainSeg/BestModels/BrainNet_3D_best_acc.pth.tar')", False, 'import os\n'), ((64, 24, 64, 107), 'os.path.join', 'os.path.join', ({(64, 37, 64, 41): 'home', (64, 43, 64, 106): '""".DeepBrainSeg/BestModels/ABL_CE_best_model_loss_based.pth.tar"""'}, {}), "(home,\n '.DeepBrainSeg/BestModels/ABL_CE_best_model_loss_based.pth.tar')", False, 'import os\n'), ((72, 20, 72, 67), 'torch.load', 'torch.load', (), '', False, 'import torch\n'), ((84, 15, 84, 64), 'torch.load', 'torch.load', (), '', False, 'import torch\n'), ((133, 8, 133, 84), 'os.system', 'os.system', ({(133, 18, 133, 83): "(self.ants_path + 'ImageMath 3 ' + mask_path + ' Normalize ' + t1_path)"}, {}), "(self.ants_path + 'ImageMath 3 ' + mask_path + ' Normalize ' + t1_path\n )", False, 'import os\n'), ((134, 8, 134, 92), 'os.system', 'os.system', ({(134, 18, 134, 91): "(self.ants_path + 'ThresholdImage 3 ' + mask_path + ' ' + mask_path + ' 0.01 1'\n )"}, {}), "(self.ants_path + 'ThresholdImage 3 ' + mask_path + ' ' +\n mask_path + ' 0.01 1')", False, 'import os\n'), ((135, 8, 135, 85), 'os.system', 'os.system', ({(135, 18, 135, 84): "(self.ants_path + 'ImageMath 3 ' + mask_path + ' MD ' + mask_path + ' 1')"}, {}), "(self.ants_path + 'ImageMath 3 ' + mask_path + ' MD ' + mask_path +\n ' 1')", False, 'import os\n'), ((136, 8, 136, 85), 'os.system', 'os.system', ({(136, 18, 136, 84): "(self.ants_path + 'ImageMath 3 ' + mask_path + ' ME ' + mask_path + ' 1')"}, {}), "(self.ants_path + 'ImageMath 3 ' + mask_path + ' ME ' + mask_path +\n ' 1')", False, 'import os\n'), ((137, 8, 137, 114), 'os.system', 'os.system', ({(137, 18, 137, 113): "(self.ants_path + 'CopyImageHeaderInformation ' + t1_path + ' ' + mask_path +\n ' ' + mask_path + ' 1 1 1')"}, {}), "(self.ants_path + 'CopyImageHeaderInformation ' + t1_path + ' ' +\n mask_path + ' ' + mask_path + ' 1 1 1')", False, 'import os\n'), ((158, 34, 158, 114), 'numpy.empty', 'np.empty', ({(158, 43, 158, 113): '(self.ABLnclasses, flair_v.shape[0], flair_v.shape[1], flair_v.shape[2])'}, {}), '((self.ABLnclasses, flair_v.shape[0], flair_v.shape[1], flair_v.\n shape[2]))', True, 'import numpy as np\n'), ((183, 15, 183, 35), 'numpy.uint8', 'np.uint8', ({(183, 24, 183, 34): 'final_pred'}, {}), '(final_pred)', True, 'import numpy as np\n'), ((202, 27, 202, 85), 'numpy.zeros', 'np.zeros', ({(202, 36, 202, 84): '(self.T3Dnclasses, shape[0], shape[1], shape[2])'}, {}), '((self.T3Dnclasses, shape[0], shape[1], shape[2]))', True, 'import numpy as np\n'), ((245, 27, 245, 85), 'numpy.zeros', 'np.zeros', ({(245, 36, 245, 84): '(self.B3Dnclasses, shape[0], shape[1], shape[2])'}, {}), '((self.B3Dnclasses, shape[0], shape[1], shape[2]))', True, 'import numpy as np\n'), ((326, 20, 326, 86), 'torchvision.transforms.Normalize', 'transforms.Normalize', ({(326, 41, 326, 62): '[0.485, 0.456, 0.406]', (326, 64, 326, 85): '[0.229, 0.224, 0.225]'}, {}), '([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])', False, 'from torchvision import transforms\n'), ((330, 26, 330, 59), 'torchvision.transforms.Compose', 'transforms.Compose', ({(330, 45, 330, 58): 'transformList'}, {}), '(transformList)', False, 'from torchvision import transforms\n'), ((332, 27, 332, 119), 'numpy.empty', 'np.empty', ({(332, 36, 332, 118): '(self.Mnclasses, flair_volume.shape[0], flair_volume.shape[1], flair_volume\n .shape[2])'}, {}), '((self.Mnclasses, flair_volume.shape[0], flair_volume.shape[1],\n flair_volume.shape[2]))', True, 'import numpy as np\n'), ((423, 22, 423, 44), 'numpy.swapaxes', 'np.swapaxes', ({(423, 34, 423, 38): 'mask', (423, 39, 423, 40): '1', (423, 42, 423, 43): '0'}, {}), '(mask, 1, 0)', True, 'import numpy as np\n'), ((98, 19, 98, 69), 'torch.load', 'torch.load', (), '', False, 'import torch\n'), ((110, 19, 110, 68), 'torch.load', 'torch.load', (), '', False, 'import torch\n'), ((132, 33, 132, 57), 'os.path.dirname', 'os.path.dirname', ({(132, 49, 132, 56): 't1_path'}, {}), '(t1_path)', False, 'import os\n'), ((161, 26, 161, 59), 'numpy.transpose', 'np.transpose', ({(161, 39, 161, 58): 'flair_v[:, :, (slices)]'}, {}), '(flair_v[:, :, (slices)])', True, 'import numpy as np\n'), ((162, 26, 162, 56), 'numpy.transpose', 'np.transpose', ({(162, 39, 162, 55): 't2_v[:, :, (slices)]'}, {}), '(t2_v[:, :, (slices)])', True, 'import numpy as np\n'), ((163, 26, 163, 57), 'numpy.transpose', 'np.transpose', ({(163, 39, 163, 56): 't1c_v[:, :, (slices)]'}, {}), '(t1c_v[:, :, (slices)])', True, 'import numpy as np\n'), ((164, 26, 164, 56), 'numpy.transpose', 'np.transpose', ({(164, 39, 164, 55): 't1_v[:, :, (slices)]'}, {}), '(t1_v[:, :, (slices)])', True, 'import numpy as np\n'), ((166, 27, 166, 82), 'numpy.zeros', 'np.zeros', ({(166, 36, 166, 81): '(flair_slice.shape[0], flair_slice.shape[1], 4)'}, {}), '((flair_slice.shape[0], flair_slice.shape[1], 4))', True, 'import numpy as np\n'), ((181, 54, 181, 74), 'numpy.uint8', 'np.uint8', ({(181, 63, 181, 73): 'final_pred'}, {}), '(final_pred)', True, 'import numpy as np\n'), ((206, 13, 206, 28), 'torch.no_grad', 'torch.no_grad', ({}, {}), '()', False, 'import torch\n'), ((328, 29, 328, 50), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ({}, {}), '()', False, 'from torchvision import transforms\n'), ((338, 27, 338, 82), 'numpy.zeros', 'np.zeros', ({(338, 36, 338, 81): '(flair_slice.shape[0], flair_slice.shape[1], 3)'}, {}), '((flair_slice.shape[0], flair_slice.shape[1], 3))', True, 'import numpy as np\n'), ((342, 20, 342, 35), 'numpy.uint8', 'np.uint8', ({(342, 29, 342, 34): 'array'}, {}), '(array)', True, 'import numpy as np\n'), ((347, 19, 347, 53), 'numpy.swapaxes', 'np.swapaxes', ({(347, 31, 347, 47): 'generated_output', (347, 48, 347, 49): '1', (347, 51, 347, 52): '2'}, {}), '(generated_output, 1, 2)', True, 'import numpy as np\n'), ((370, 17, 370, 37), 'nibabel.load', 'nib.load', ({(370, 26, 370, 36): 'flair_path'}, {}), '(flair_path)', True, 'import nibabel as nib\n'), ((381, 44, 381, 144), 'numpy.array', 'np.array', ({(381, 53, 381, 143): '[final_predictionTir3D_logits, final_predictionBNET3D_logits,\n final_predictionMnet_logits]'}, {}), '([final_predictionTir3D_logits, final_predictionBNET3D_logits,\n final_predictionMnet_logits])', True, 'import numpy as np\n'), ((384, 43, 384, 82), 'numpy.array', 'np.array', ({(384, 52, 384, 81): '[final_predictionMnet_logits]'}, {}), '([final_predictionMnet_logits])', True, 'import numpy as np\n'), ((393, 12, 393, 49), 'os.makedirs', 'os.makedirs', (), '', False, 'import os\n'), ((420, 41, 420, 79), 'os.path.join', 'os.path.join', ({(420, 54, 420, 58): 'path', (420, 60, 420, 78): "name + 't2.nii.gz'"}, {}), "(path, name + 't2.nii.gz')", False, 'import os\n'), ((429, 44, 429, 144), 'numpy.array', 'np.array', ({(429, 53, 429, 143): '[final_predictionTir3D_logits, final_predictionBNET3D_logits,\n final_predictionMnet_logits]'}, {}), '([final_predictionTir3D_logits, final_predictionBNET3D_logits,\n final_predictionMnet_logits])', True, 'import numpy as np\n'), ((432, 43, 432, 82), 'numpy.array', 'np.array', ({(432, 52, 432, 81): '[final_predictionMnet_logits]'}, {}), '([final_predictionMnet_logits])', True, 'import numpy as np\n'), ((55, 42, 55, 67), 'torch.cuda.is_available', 'torch.cuda.is_available', ({}, {}), '()', False, 'import torch\n'), ((334, 61, 334, 99), 'numpy.transpose', 'np.transpose', ({(334, 74, 334, 98): 'flair_volume[:, :, (slices)]'}, {}), '(flair_volume[:, :, (slices)])', True, 'import numpy as np\n'), ((335, 61, 335, 96), 'numpy.transpose', 'np.transpose', ({(335, 74, 335, 95): 't2_volume[:, :, (slices)]'}, {}), '(t2_volume[:, :, (slices)])', True, 'import numpy as np\n'), ((336, 61, 336, 98), 'numpy.transpose', 'np.transpose', ({(336, 74, 336, 97): 't1ce_volume[:, :, (slices)]'}, {}), '(t1ce_volume[:, :, (slices)])', True, 'import numpy as np\n'), ((366, 13, 366, 30), 'nibabel.load', 'nib.load', ({(366, 22, 366, 29): 't1_path'}, {}), '(t1_path)', True, 'import nibabel as nib\n'), ((367, 13, 367, 30), 'nibabel.load', 'nib.load', ({(367, 22, 367, 29): 't2_path'}, {}), '(t2_path)', True, 'import nibabel as nib\n'), ((368, 15, 368, 34), 'nibabel.load', 'nib.load', ({(368, 24, 368, 33): 't1ce_path'}, {}), '(t1ce_path)', True, 'import nibabel as nib\n'), ((369, 16, 369, 36), 'nibabel.load', 'nib.load', ({(369, 25, 369, 35): 'flair_path'}, {}), '(flair_path)', True, 'import nibabel as nib\n'), ((394, 44, 394, 94), 'os.path.join', 'os.path.join', ({(394, 57, 394, 66): 'save_path', (394, 68, 394, 93): '"""DeepBrainSeg_Prediction"""'}, {}), "(save_path, 'DeepBrainSeg_Prediction')", False, 'import os\n'), ((416, 26, 416, 67), 'os.path.join', 'os.path.join', ({(416, 39, 416, 43): 'path', (416, 45, 416, 66): "(name + 'flair.nii.gz')"}, {}), "(path, name + 'flair.nii.gz')", False, 'import os\n'), ((440, 44, 440, 89), 'os.path.join', 'os.path.join', ({(440, 57, 440, 61): 'path', (440, 63, 440, 88): '"""DeepBrainSeg_Prediction"""'}, {}), "(path, 'DeepBrainSeg_Prediction')", False, 'import os\n'), ((138, 24, 138, 43), 'nibabel.load', 'nib.load', ({(138, 33, 138, 42): 'mask_path'}, {}), '(mask_path)', True, 'import nibabel as nib\n'), ((263, 27, 263, 88), 'numpy.zeros', 'np.zeros', ({(263, 36, 263, 87): '(1, 4, high_res_size, high_res_size, high_res_size)'}, {}), '((1, 4, high_res_size, high_res_size, high_res_size))', True, 'import numpy as np\n'), ((264, 27, 264, 85), 'numpy.zeros', 'np.zeros', ({(264, 36, 264, 84): '(1, 4, low_res_size, low_res_size, low_res_size)'}, {}), '((1, 4, low_res_size, low_res_size, low_res_size))', True, 'import numpy as np\n'), ((265, 28, 265, 77), 'numpy.zeros', 'np.zeros', ({(265, 37, 265, 76): '(1, 4, resize_to, resize_to, resize_to)'}, {}), '((1, 4, resize_to, resize_to, resize_to))', True, 'import numpy as np\n'), ((412, 26, 412, 67), 'os.path.join', 'os.path.join', ({(412, 39, 412, 43): 'path', (412, 45, 412, 66): "name + 'flair.nii.gz'"}, {}), "(path, name + 'flair.nii.gz')", False, 'import os\n'), ((413, 26, 413, 64), 'os.path.join', 'os.path.join', ({(413, 39, 413, 43): 'path', (413, 45, 413, 63): "name + 't1.nii.gz'"}, {}), "(path, name + 't1.nii.gz')", False, 'import os\n'), ((414, 26, 414, 66), 'os.path.join', 'os.path.join', ({(414, 39, 414, 43): 'path', (414, 45, 414, 65): "name + 't1ce.nii.gz'"}, {}), "(path, name + 't1ce.nii.gz')", False, 'import os\n'), ((415, 26, 415, 64), 'os.path.join', 'os.path.join', ({(415, 39, 415, 43): 'path', (415, 45, 415, 63): "name + 't2.nii.gz'"}, {}), "(path, name + 't2.nii.gz')", False, 'import os\n'), ((210, 31, 210, 56), 'numpy.zeros', 'np.zeros', ({(210, 40, 210, 55): '(1, 4, N, N, N)'}, {}), '((1, 4, N, N, N))', True, 'import numpy as np\n'), ((303, 31, 303, 92), 'skimage.transform.resize', 'resize', ({(303, 38, 303, 56): 'low[(0), (i), :, :, :]', (303, 58, 303, 91): '(resize_to, resize_to, resize_to)'}, {}), '(low[(0), (i), :, :, :], (resize_to, resize_to, resize_to))', False, 'from skimage.transform import resize\n'), ((418, 82, 418, 90), 'time.gmtime', 'gmtime', ({}, {}), '()', False, 'from time import gmtime, strftime\n'), ((305, 36, 305, 58), 'torch.from_numpy', 'torch.from_numpy', ({(305, 53, 305, 57): 'high'}, {}), '(high)', False, 'import torch\n'), ((306, 37, 306, 59), 'torch.from_numpy', 'torch.from_numpy', ({(306, 54, 306, 58): 'low1'}, {}), '(low1)', False, 'import torch\n'), ((217, 40, 217, 62), 'torch.from_numpy', 'torch.from_numpy', ({(217, 57, 217, 61): 'high'}, {}), '(high)', False, 'import torch\n')] |
porcpine1967/statsmodels | statsmodels/discrete/tests/test_conditional.py | db4900056d80732ffff2733454fac88781ced8d2 | import numpy as np
from statsmodels.discrete.conditional_models import (
ConditionalLogit, ConditionalPoisson)
from statsmodels.tools.numdiff import approx_fprime
from numpy.testing import assert_allclose
import pandas as pd
def test_logit_1d():
y = np.r_[0, 1, 0, 1, 0, 1, 0, 1, 1, 1]
g = np.r_[0, 0, 0, 1, 1, 1, 2, 2, 2, 2]
x = np.r_[0, 1, 0, 0, 1, 1, 0, 0, 1, 0]
x = x[:, None]
model = ConditionalLogit(y, x, groups=g)
# Check the gradient for the denominator of the partial likelihood
for x in -1, 0, 1, 2:
params = np.r_[x, ]
_, grad = model._denom_grad(0, params)
ngrad = approx_fprime(params, lambda x: model._denom(0, x))
assert_allclose(grad, ngrad)
# Check the gradient for the loglikelihood
for x in -1, 0, 1, 2:
grad = approx_fprime(np.r_[x, ], model.loglike)
score = model.score(np.r_[x, ])
assert_allclose(grad, score, rtol=1e-4)
result = model.fit()
# From Stata
assert_allclose(result.params, np.r_[0.9272407], rtol=1e-5)
assert_allclose(result.bse, np.r_[1.295155], rtol=1e-5)
def test_logit_2d():
y = np.r_[0, 1, 0, 1, 0, 1, 0, 1, 1, 1]
g = np.r_[0, 0, 0, 1, 1, 1, 2, 2, 2, 2]
x1 = np.r_[0, 1, 0, 0, 1, 1, 0, 0, 1, 0]
x2 = np.r_[0, 0, 1, 0, 0, 1, 0, 1, 1, 1]
x = np.empty((10, 2))
x[:, 0] = x1
x[:, 1] = x2
model = ConditionalLogit(y, x, groups=g)
# Check the gradient for the denominator of the partial likelihood
for x in -1, 0, 1, 2:
params = np.r_[x, -1.5*x]
_, grad = model._denom_grad(0, params)
ngrad = approx_fprime(params, lambda x: model._denom(0, x))
assert_allclose(grad, ngrad, rtol=1e-5)
# Check the gradient for the loglikelihood
for x in -1, 0, 1, 2:
params = np.r_[-0.5*x, 0.5*x]
grad = approx_fprime(params, model.loglike)
score = model.score(params)
assert_allclose(grad, score, rtol=1e-4)
result = model.fit()
# From Stata
assert_allclose(result.params, np.r_[1.011074, 1.236758], rtol=1e-3)
assert_allclose(result.bse, np.r_[1.420784, 1.361738], rtol=1e-5)
result.summary()
def test_formula():
for j in 0, 1:
np.random.seed(34234)
n = 200
y = np.random.randint(0, 2, size=n)
x1 = np.random.normal(size=n)
x2 = np.random.normal(size=n)
g = np.random.randint(0, 25, size=n)
x = np.hstack((x1[:, None], x2[:, None]))
if j == 0:
model1 = ConditionalLogit(y, x, groups=g)
else:
model1 = ConditionalPoisson(y, x, groups=g)
result1 = model1.fit()
df = pd.DataFrame({"y": y, "x1": x1, "x2": x2, "g": g})
if j == 0:
model2 = ConditionalLogit.from_formula(
"y ~ 0 + x1 + x2", groups="g", data=df)
else:
model2 = ConditionalPoisson.from_formula(
"y ~ 0 + x1 + x2", groups="g", data=df)
result2 = model2.fit()
assert_allclose(result1.params, result2.params, rtol=1e-5)
assert_allclose(result1.bse, result2.bse, rtol=1e-5)
assert_allclose(result1.cov_params(), result2.cov_params(), rtol=1e-5)
assert_allclose(result1.tvalues, result2.tvalues, rtol=1e-5)
def test_poisson_1d():
y = np.r_[3, 1, 1, 4, 5, 2, 0, 1, 6, 2]
g = np.r_[0, 0, 0, 0, 1, 1, 1, 1, 1, 1]
x = np.r_[0, 1, 0, 0, 1, 1, 0, 0, 1, 0]
x = x[:, None]
model = ConditionalPoisson(y, x, groups=g)
# Check the gradient for the loglikelihood
for x in -1, 0, 1, 2:
grad = approx_fprime(np.r_[x, ], model.loglike)
score = model.score(np.r_[x, ])
assert_allclose(grad, score, rtol=1e-4)
result = model.fit()
# From Stata
assert_allclose(result.params, np.r_[0.6466272], rtol=1e-4)
assert_allclose(result.bse, np.r_[0.4170918], rtol=1e-5)
def test_poisson_2d():
y = np.r_[3, 1, 4, 8, 2, 5, 4, 7, 2, 6]
g = np.r_[0, 0, 0, 1, 1, 1, 2, 2, 2, 2]
x1 = np.r_[0, 1, 0, 0, 1, 1, 0, 0, 1, 0]
x2 = np.r_[2, 1, 0, 0, 1, 2, 3, 2, 0, 1]
x = np.empty((10, 2))
x[:, 0] = x1
x[:, 1] = x2
model = ConditionalPoisson(y, x, groups=g)
# Check the gradient for the loglikelihood
for x in -1, 0, 1, 2:
params = np.r_[-0.5*x, 0.5*x]
grad = approx_fprime(params, model.loglike)
score = model.score(params)
assert_allclose(grad, score, rtol=1e-4)
result = model.fit()
# From Stata
assert_allclose(result.params, np.r_[-.9478957, -.0134279], rtol=1e-3)
assert_allclose(result.bse, np.r_[.3874942, .1686712], rtol=1e-5)
result.summary()
def test_lasso_logistic():
np.random.seed(3423948)
n = 200
groups = np.arange(10)
groups = np.kron(groups, np.ones(n // 10))
group_effects = np.random.normal(size=10)
group_effects = np.kron(group_effects, np.ones(n // 10))
x = np.random.normal(size=(n, 4))
params = np.r_[0, 0, 1, 0]
lin_pred = np.dot(x, params) + group_effects
mean = 1 / (1 + np.exp(-lin_pred))
y = (np.random.uniform(size=n) < mean).astype(np.int)
model0 = ConditionalLogit(y, x, groups=groups)
result0 = model0.fit()
# Should be the same as model0
model1 = ConditionalLogit(y, x, groups=groups)
result1 = model1.fit_regularized(L1_wt=0, alpha=0)
assert_allclose(result0.params, result1.params, rtol=1e-3)
model2 = ConditionalLogit(y, x, groups=groups)
result2 = model2.fit_regularized(L1_wt=1, alpha=0.05)
# Rxegression test
assert_allclose(result2.params, np.r_[0, 0, 0.55235152, 0], rtol=1e-4)
# Test with formula
df = pd.DataFrame({"y": y, "x1": x[:, 0], "x2": x[:, 1], "x3": x[:, 2],
"x4": x[:, 3], "groups": groups})
fml = "y ~ 0 + x1 + x2 + x3 + x4"
model3 = ConditionalLogit.from_formula(fml, groups="groups", data=df)
result3 = model3.fit_regularized(L1_wt=1, alpha=0.05)
assert_allclose(result2.params, result3.params)
def test_lasso_poisson():
np.random.seed(342394)
n = 200
groups = np.arange(10)
groups = np.kron(groups, np.ones(n // 10))
group_effects = np.random.normal(size=10)
group_effects = np.kron(group_effects, np.ones(n // 10))
x = np.random.normal(size=(n, 4))
params = np.r_[0, 0, 1, 0]
lin_pred = np.dot(x, params) + group_effects
mean = np.exp(lin_pred)
y = np.random.poisson(mean)
model0 = ConditionalPoisson(y, x, groups=groups)
result0 = model0.fit()
# Should be the same as model0
model1 = ConditionalPoisson(y, x, groups=groups)
result1 = model1.fit_regularized(L1_wt=0, alpha=0)
assert_allclose(result0.params, result1.params, rtol=1e-3)
model2 = ConditionalPoisson(y, x, groups=groups)
result2 = model2.fit_regularized(L1_wt=1, alpha=0.2)
# Regression test
assert_allclose(result2.params, np.r_[0, 0, 0.91697508, 0], rtol=1e-4)
# Test with formula
df = pd.DataFrame({"y": y, "x1": x[:, 0], "x2": x[:, 1], "x3": x[:, 2],
"x4": x[:, 3], "groups": groups})
fml = "y ~ 0 + x1 + x2 + x3 + x4"
model3 = ConditionalPoisson.from_formula(fml, groups="groups", data=df)
result3 = model3.fit_regularized(L1_wt=1, alpha=0.2)
assert_allclose(result2.params, result3.params)
| [((17, 12, 17, 44), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((35, 4, 35, 63), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((36, 4, 36, 59), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((46, 8, 46, 25), 'numpy.empty', 'np.empty', ({(46, 17, 46, 24): '(10, 2)'}, {}), '((10, 2))', True, 'import numpy as np\n'), ((50, 12, 50, 44), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((69, 4, 69, 72), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((70, 4, 70, 69), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((116, 12, 116, 46), 'statsmodels.discrete.conditional_models.ConditionalPoisson', 'ConditionalPoisson', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((127, 4, 127, 63), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((128, 4, 128, 60), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((138, 8, 138, 25), 'numpy.empty', 'np.empty', ({(138, 17, 138, 24): '(10, 2)'}, {}), '((10, 2))', True, 'import numpy as np\n'), ((142, 12, 142, 46), 'statsmodels.discrete.conditional_models.ConditionalPoisson', 'ConditionalPoisson', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((154, 4, 154, 74), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((155, 4, 155, 69), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((162, 4, 162, 27), 'numpy.random.seed', 'np.random.seed', ({(162, 19, 162, 26): '(3423948)'}, {}), '(3423948)', True, 'import numpy as np\n'), ((165, 13, 165, 26), 'numpy.arange', 'np.arange', ({(165, 23, 165, 25): '10'}, {}), '(10)', True, 'import numpy as np\n'), ((167, 20, 167, 45), 'numpy.random.normal', 'np.random.normal', (), '', True, 'import numpy as np\n'), ((170, 8, 170, 37), 'numpy.random.normal', 'np.random.normal', (), '', True, 'import numpy as np\n'), ((177, 13, 177, 50), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((181, 13, 181, 50), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((184, 4, 184, 62), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((186, 13, 186, 50), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((190, 4, 190, 74), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((193, 9, 194, 56), 'pandas.DataFrame', 'pd.DataFrame', ({(193, 22, 194, 55): "{'y': y, 'x1': x[:, (0)], 'x2': x[:, (1)], 'x3': x[:, (2)], 'x4': x[:, (3)],\n 'groups': groups}"}, {}), "({'y': y, 'x1': x[:, (0)], 'x2': x[:, (1)], 'x3': x[:, (2)],\n 'x4': x[:, (3)], 'groups': groups})", True, 'import pandas as pd\n'), ((196, 13, 196, 73), 'statsmodels.discrete.conditional_models.ConditionalLogit.from_formula', 'ConditionalLogit.from_formula', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((198, 4, 198, 51), 'numpy.testing.assert_allclose', 'assert_allclose', ({(198, 20, 198, 34): 'result2.params', (198, 36, 198, 50): 'result3.params'}, {}), '(result2.params, result3.params)', False, 'from numpy.testing import assert_allclose\n'), ((203, 4, 203, 26), 'numpy.random.seed', 'np.random.seed', ({(203, 19, 203, 25): '(342394)'}, {}), '(342394)', True, 'import numpy as np\n'), ((206, 13, 206, 26), 'numpy.arange', 'np.arange', ({(206, 23, 206, 25): '10'}, {}), '(10)', True, 'import numpy as np\n'), ((208, 20, 208, 45), 'numpy.random.normal', 'np.random.normal', (), '', True, 'import numpy as np\n'), ((211, 8, 211, 37), 'numpy.random.normal', 'np.random.normal', (), '', True, 'import numpy as np\n'), ((215, 11, 215, 27), 'numpy.exp', 'np.exp', ({(215, 18, 215, 26): 'lin_pred'}, {}), '(lin_pred)', True, 'import numpy as np\n'), ((216, 8, 216, 31), 'numpy.random.poisson', 'np.random.poisson', ({(216, 26, 216, 30): 'mean'}, {}), '(mean)', True, 'import numpy as np\n'), ((218, 13, 218, 52), 'statsmodels.discrete.conditional_models.ConditionalPoisson', 'ConditionalPoisson', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((222, 13, 222, 52), 'statsmodels.discrete.conditional_models.ConditionalPoisson', 'ConditionalPoisson', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((225, 4, 225, 62), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((227, 13, 227, 52), 'statsmodels.discrete.conditional_models.ConditionalPoisson', 'ConditionalPoisson', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((231, 4, 231, 74), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((234, 9, 235, 56), 'pandas.DataFrame', 'pd.DataFrame', ({(234, 22, 235, 55): "{'y': y, 'x1': x[:, (0)], 'x2': x[:, (1)], 'x3': x[:, (2)], 'x4': x[:, (3)],\n 'groups': groups}"}, {}), "({'y': y, 'x1': x[:, (0)], 'x2': x[:, (1)], 'x3': x[:, (2)],\n 'x4': x[:, (3)], 'groups': groups})", True, 'import pandas as pd\n'), ((237, 13, 237, 75), 'statsmodels.discrete.conditional_models.ConditionalPoisson.from_formula', 'ConditionalPoisson.from_formula', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((239, 4, 239, 51), 'numpy.testing.assert_allclose', 'assert_allclose', ({(239, 20, 239, 34): 'result2.params', (239, 36, 239, 50): 'result3.params'}, {}), '(result2.params, result3.params)', False, 'from numpy.testing import assert_allclose\n'), ((24, 8, 24, 36), 'numpy.testing.assert_allclose', 'assert_allclose', ({(24, 24, 24, 28): 'grad', (24, 30, 24, 35): 'ngrad'}, {}), '(grad, ngrad)', False, 'from numpy.testing import assert_allclose\n'), ((28, 15, 28, 55), 'statsmodels.tools.numdiff.approx_fprime', 'approx_fprime', ({(28, 29, 28, 39): 'np.r_[x,]', (28, 41, 28, 54): 'model.loglike'}, {}), '(np.r_[x,], model.loglike)', False, 'from statsmodels.tools.numdiff import approx_fprime\n'), ((30, 8, 30, 47), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((57, 8, 57, 47), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((62, 15, 62, 51), 'statsmodels.tools.numdiff.approx_fprime', 'approx_fprime', ({(62, 29, 62, 35): 'params', (62, 37, 62, 50): 'model.loglike'}, {}), '(params, model.loglike)', False, 'from statsmodels.tools.numdiff import approx_fprime\n'), ((64, 8, 64, 47), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((79, 8, 79, 29), 'numpy.random.seed', 'np.random.seed', ({(79, 23, 79, 28): '(34234)'}, {}), '(34234)', True, 'import numpy as np\n'), ((81, 12, 81, 43), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((82, 13, 82, 37), 'numpy.random.normal', 'np.random.normal', (), '', True, 'import numpy as np\n'), ((83, 13, 83, 37), 'numpy.random.normal', 'np.random.normal', (), '', True, 'import numpy as np\n'), ((84, 12, 84, 44), 'numpy.random.randint', 'np.random.randint', (), '', True, 'import numpy as np\n'), ((86, 12, 86, 49), 'numpy.hstack', 'np.hstack', ({(86, 22, 86, 48): '(x1[:, (None)], x2[:, (None)])'}, {}), '((x1[:, (None)], x2[:, (None)]))', True, 'import numpy as np\n'), ((93, 13, 93, 63), 'pandas.DataFrame', 'pd.DataFrame', ({(93, 26, 93, 62): "{'y': y, 'x1': x1, 'x2': x2, 'g': g}"}, {}), "({'y': y, 'x1': x1, 'x2': x2, 'g': g})", True, 'import pandas as pd\n'), ((102, 8, 102, 66), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((103, 8, 103, 60), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((105, 8, 105, 68), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((120, 15, 120, 55), 'statsmodels.tools.numdiff.approx_fprime', 'approx_fprime', ({(120, 29, 120, 39): 'np.r_[x,]', (120, 41, 120, 54): 'model.loglike'}, {}), '(np.r_[x,], model.loglike)', False, 'from statsmodels.tools.numdiff import approx_fprime\n'), ((122, 8, 122, 47), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((147, 15, 147, 51), 'statsmodels.tools.numdiff.approx_fprime', 'approx_fprime', ({(147, 29, 147, 35): 'params', (147, 37, 147, 50): 'model.loglike'}, {}), '(params, model.loglike)', False, 'from statsmodels.tools.numdiff import approx_fprime\n'), ((149, 8, 149, 47), 'numpy.testing.assert_allclose', 'assert_allclose', (), '', False, 'from numpy.testing import assert_allclose\n'), ((166, 29, 166, 45), 'numpy.ones', 'np.ones', ({(166, 37, 166, 44): 'n // 10'}, {}), '(n // 10)', True, 'import numpy as np\n'), ((168, 43, 168, 59), 'numpy.ones', 'np.ones', ({(168, 51, 168, 58): 'n // 10'}, {}), '(n // 10)', True, 'import numpy as np\n'), ((172, 15, 172, 32), 'numpy.dot', 'np.dot', ({(172, 22, 172, 23): 'x', (172, 25, 172, 31): 'params'}, {}), '(x, params)', True, 'import numpy as np\n'), ((207, 29, 207, 45), 'numpy.ones', 'np.ones', ({(207, 37, 207, 44): 'n // 10'}, {}), '(n // 10)', True, 'import numpy as np\n'), ((209, 43, 209, 59), 'numpy.ones', 'np.ones', ({(209, 51, 209, 58): 'n // 10'}, {}), '(n // 10)', True, 'import numpy as np\n'), ((213, 15, 213, 32), 'numpy.dot', 'np.dot', ({(213, 22, 213, 23): 'x', (213, 25, 213, 31): 'params'}, {}), '(x, params)', True, 'import numpy as np\n'), ((88, 21, 88, 53), 'statsmodels.discrete.conditional_models.ConditionalLogit', 'ConditionalLogit', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((90, 21, 90, 55), 'statsmodels.discrete.conditional_models.ConditionalPoisson', 'ConditionalPoisson', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((95, 21, 96, 63), 'statsmodels.discrete.conditional_models.ConditionalLogit.from_formula', 'ConditionalLogit.from_formula', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((98, 21, 99, 63), 'statsmodels.discrete.conditional_models.ConditionalPoisson.from_formula', 'ConditionalPoisson.from_formula', (), '', False, 'from statsmodels.discrete.conditional_models import ConditionalLogit, ConditionalPoisson\n'), ((174, 20, 174, 37), 'numpy.exp', 'np.exp', ({(174, 27, 174, 36): '(-lin_pred)'}, {}), '(-lin_pred)', True, 'import numpy as np\n'), ((175, 9, 175, 34), 'numpy.random.uniform', 'np.random.uniform', (), '', True, 'import numpy as np\n')] |
tcarmet/bert-e | bert_e/workflow/gitwaterflow/utils.py | 8e0623d9a8c7bd111790d72307862167eca18a23 |
def bypass_incompatible_branch(job):
return (job.settings.bypass_incompatible_branch or
job.author_bypass.get('bypass_incompatible_branch', False))
def bypass_peer_approval(job):
return (job.settings.bypass_peer_approval or
job.author_bypass.get('bypass_peer_approval', False))
def bypass_leader_approval(job):
return (job.settings.bypass_leader_approval or
job.author_bypass.get('bypass_leader_approval', False))
def bypass_author_approval(job):
return (job.settings.bypass_author_approval or
job.author_bypass.get('bypass_author_approval', False))
def bypass_build_status(job):
return (job.settings.bypass_build_status or
job.author_bypass.get('bypass_build_status', False))
def bypass_jira_check(job):
return (job.settings.bypass_jira_check or
job.author_bypass.get('bypass_jira_check', False))
| [] |
pyro-team/bkt-toolbox | bkt/library/powerpoint/elements.py | bbccba142a81ca0a46056f2bcda75899979158a5 | # -*- coding: utf-8 -*-
'''
Created on 02.11.2017
@author: fstallmann
'''
from __future__ import absolute_import
from collections import deque
import bkt
from bkt import dotnet
Drawing = dotnet.import_drawing()
from . import helpers as pplib
class TextframeSpinnerBox(bkt.ribbon.RoundingSpinnerBox):
### Instance initialization
attr = 'MarginTop'
def __init__(self, **kwargs):
'''
attr examples: MarginTop, MarginBottom, MarginLeft, MarginRight
'''
#self.attr is automatically set through RibbonControl attribute handling
self.fallback_value = 0
my_kwargs = dict(
size_string = '###',
round_cm = True,
convert = 'pt_to_cm',
get_enabled = bkt.apps.ppt_selection_contains_textframe,
)
my_kwargs.update(kwargs)
super(TextframeSpinnerBox, self).__init__(**my_kwargs)
### Spinner Box callbacks ###
def get_text(self, shapes, selection):
value = self.get_attr_from_shapes(shapes, selection)
if value is None: #e.g. no textframe detected
return None
elif int(value) == -2147483648: #replace large negative number (values differ between selected items) with fallback value
return self.fallback_value
else:
return value
def on_change(self, shapes, selection, value):
self.set_attr_for_shapes(shapes, selection, value)
### Getter Methods ###
def get_attr_from_shapes(self, shapes, selection):
'''
Get attr for shapes
'''
for textframe in pplib.iterate_shape_textframes(shapes):
try:
return self.get_attr_from_textframe(textframe)
except:
# produces error for certain chart types, e.g. Treemap
continue
return None
def get_attr_from_textframe(self, textframe):
return getattr(textframe, self.attr)
### Setter methods ###
def set_attr_for_shapes(self, shapes, selection, value):
'''
Set attr for shapes
'''
value = max(0,value)
for textframe in pplib.iterate_shape_textframes(shapes):
self.set_attr_for_textframe(textframe, value)
def set_attr_for_textframe(self, textframe, value):
setattr(textframe, self.attr, value)
class ParagraphFormatSpinnerBox(bkt.ribbon.RoundingSpinnerBox):
### Instance initialization
attr = 'SpaceBefore'
def __init__(self, **kwargs):
'''
attr examples: SpaceBefore, SpaceAfter, LeftIndent, FirstLineIndent, LineSpacing
'''
#self.attr is automatically set through RibbonControl attribute handling
self.fallback_value = 0
my_kwargs = dict(
size_string = '-###',
get_enabled = bkt.apps.ppt_selection_contains_textframe,
)
if self.attr in ["SpaceBefore", "SpaceAfter", "SpaceWithin"]:
my_kwargs["round_pt"] = True
else:
my_kwargs["round_cm"] = True
my_kwargs["convert"] = "pt_to_cm"
if self.attr in ["LeftIndent", "FirstLineIndent"]:
my_kwargs["big_step"] = 0.25
my_kwargs["small_step"] = 0.125
my_kwargs["rounding_factor"] = 0.125
my_kwargs.update(kwargs)
super(ParagraphFormatSpinnerBox, self).__init__(**my_kwargs)
### Spinner Box callbacks ###
def get_text(self, shapes, selection):
value = self.get_attr_from_shapes(shapes, selection)
if value is None: #e.g. no textframe detected
return None
elif int(value) == -2147483648: #replace large negative number (values differ between selected items) with fallback value
return self.fallback_value
else:
return value
def on_change(self, shapes, selection, value):
self.set_attr_for_shapes(shapes, selection, value)
### Getter Methods ###
def get_attr_from_shapes(self, shapes, selection):
if selection.Type == 3:
# text selected
try:
# produces error if no text is selected
return self._get_attr(selection.TextRange2.Paragraphs(1,1).ParagraphFormat)
except:
try:
# produces error if there is no textrange, e.g. selection within a chart
return self._get_attr(selection.TextRange2.ParagraphFormat)
except:
return None
else:
# shapes selected
for textframe in pplib.iterate_shape_textframes(shapes):
try:
value = self.get_attr_from_textrange(textframe.TextRange)
except:
# produces error for certain chart types, e.g. Treemap
continue
try:
if int(value) == -2147483648: #different values for each paragraph, so get value from first paragraph
value = self._get_attr(textframe.TextRange.Paragraphs(1,1).ParagraphFormat)
except:
pass
return value
return None
def get_attr_from_textrange(self, textrange):
return self._get_attr(textrange.ParagraphFormat)
def _get_attr(self, par_format):
if self.attr in ["SpaceBefore", "SpaceAfter", "SpaceWithin"]:
if (self.attr == "SpaceBefore" and par_format.LineRuleBefore == 0) or (self.attr == "SpaceAfter" and par_format.LineRuleAfter == 0) or (self.attr == "SpaceWithin" and par_format.LineRuleWithin == 0):
self.huge_step = 10
self.big_step = 3
self.small_step = 1
self.round_at = 0
else:
self.huge_step = 0.5
self.big_step = 0.2
self.small_step = 0.1
self.round_at = 1
return getattr(par_format, self.attr)
### Setter methods ###
def set_attr_for_shapes(self, shapes, selection, value):
if self.attr != "FirstLineIndent": #FirstLineIndent can be negative!
value = max(0,value)
if selection.Type == 3:
# text selected
self.set_attr_for_textrange(selection.TextRange2, value) #need to use TextRange2 as TextRange does not contain LeftIndent, etc.
else:
for textframe in pplib.iterate_shape_textframes(shapes):
self.set_attr_for_textrange(textframe.TextRange, value)
def set_attr_for_textrange(self, textrange, value): #using textrange instead of textframe!
if self.attr == "SpaceBefore" and textrange.ParagraphFormat.LineRuleBefore == -2: #if values differ, set the same value as in the first paragraph
textrange.ParagraphFormat.LineRuleBefore = textrange.Paragraphs(1,1).ParagraphFormat.LineRuleBefore
if self.attr == "SpaceAfter" and textrange.ParagraphFormat.LineRuleAfter == -2: #if values differ, set the same value as in the first paragraph
textrange.ParagraphFormat.LineRuleAfter = textrange.Paragraphs(1,1).ParagraphFormat.LineRuleAfter
if self.attr == "SpaceWithin" and textrange.ParagraphFormat.LineRuleWithin == -2: #if values differ, set the same value as in the first paragraph
textrange.ParagraphFormat.LineRuleWithin = textrange.Paragraphs(1,1).ParagraphFormat.LineRuleWithin
setattr(textrange.ParagraphFormat, self.attr, value)
class PPTSymbolsSettings(object):
recent_symbols = deque(bkt.settings.get("bkt.symbols.recent_symbols", []), maxlen=3)
convert_into_shape = bkt.settings.get("bkt.symbols.convert_into_shape", True) #always convert newly inserted symbols into shapes
convert_into_bitmap = bkt.settings.get("bkt.symbols.convert_into_bitmap", False) #always convert newly inserted symbols into bitmap picture
unicode_font = bkt.settings.get("bkt.symbols.unicode_font", None) #insert unicode characters as symbol with special font (e.g. Arial Unicode)
@classmethod
def add_to_recent(cls, item):
try:
#try to remove if already exists and add to beginning
cls.recent_symbols.remove(item)
cls.recent_symbols.append(item)
except ValueError:
cls.recent_symbols.append(item)
bkt.settings["bkt.symbols.recent_symbols"] = cls.recent_symbols
@classmethod
def switch_unicode_font(cls, font=None):
cls.unicode_font = font #if font else SymbolsGallery.fallback_font
bkt.settings["bkt.symbols.unicode_font"] = cls.unicode_font
@classmethod
def convert_into_text(cls):
return not (cls.convert_into_shape or cls.convert_into_bitmap)
@classmethod
def switch_convert_into_text(cls, pressed):
cls.convert_into_shape = False
cls.convert_into_bitmap = False
bkt.settings["bkt.symbols.convert_into_shape"] = cls.convert_into_shape
bkt.settings["bkt.symbols.convert_into_bitmap"] = cls.convert_into_bitmap
@classmethod
def switch_convert_into_shape(cls, pressed):
cls.convert_into_shape = pressed
cls.convert_into_bitmap = False
bkt.settings["bkt.symbols.convert_into_shape"] = cls.convert_into_shape
bkt.settings["bkt.symbols.convert_into_bitmap"] = cls.convert_into_bitmap
@classmethod
def get_convert_into_shape(cls):
return (cls.convert_into_shape or bkt.get_key_state(bkt.KeyCodes.SHIFT)) and not bkt.get_key_state(bkt.KeyCodes.CTRL)
@classmethod
def switch_convert_into_bitmap(cls, pressed):
cls.convert_into_shape = False
cls.convert_into_bitmap = pressed
bkt.settings["bkt.symbols.convert_into_shape"] = cls.convert_into_shape
bkt.settings["bkt.symbols.convert_into_bitmap"] = cls.convert_into_bitmap
@classmethod
def get_convert_into_bitmap(cls):
return (cls.convert_into_bitmap or bkt.get_key_state(bkt.KeyCodes.CTRL)) and not bkt.get_key_state(bkt.KeyCodes.SHIFT)
class PPTSymbolsGallery(bkt.ribbon.SymbolsGallery):
@property
def fallback_font(self):
return PPTSymbolsSettings.unicode_font or bkt.ribbon.SymbolsGallery.fallback_font
def on_action_indexed(self, selected_item, index, context, selection, **kwargs):
''' create numberd shape according of settings in clicked element '''
item = self.symbols[index]
self._add_to_recent(item)
shift_or_ctrl = bkt.get_key_state(bkt.KeyCodes.CTRL) or bkt.get_key_state(bkt.KeyCodes.SHIFT)
if selection.Type == 3 and not shift_or_ctrl: #text selected
selection.TextRange2.Text = "" #remove selected text first and then insert symbol
self.insert_symbol_into_text(selection.TextRange2, item)
elif PPTSymbolsSettings.convert_into_text() and selection.Type == 2 and not shift_or_ctrl: #shapes selected
self.insert_symbol_into_shapes(pplib.get_shapes_from_selection(selection), item)
else: #convert into shape or bitmap
if PPTSymbolsSettings.get_convert_into_bitmap():
self.create_symbol_bitmap(selection.SlideRange(1), item)
else:
self.create_symbol_shape(selection.SlideRange(1), item)
def _add_to_recent(self, item):
PPTSymbolsSettings.add_to_recent(item)
def insert_symbol_into_text(self, textrange, item):
if item[0] or PPTSymbolsSettings.unicode_font is not None: #font name is given, then insert as symbol
font = item[0] or self.fallback_font
try:
char_number = ord(item[1]) #ord does not work for higher level unicode, e.g. emojis, and throws TypeError
if char_number > 61695: #for higher numbers (f0ff works, f100 doesnt work) InsertSymbol does not work anymore. Also the default ppt symbol-picker only shows unicode chars til f0ff.
raise TypeError("character number to large for InsertSymbol") #fallback to InsertAfter
placeholder_char = textrange.InsertAfter("X") #append placeholder symbol so that InsertSymbol behaves the same as InsertAfter
return placeholder_char.InsertSymbol(font, char_number, -1) #symbol: FontName, CharNumber (decimal), Unicode=True
except TypeError:
char_inserted = textrange.InsertAfter(item[1]) #append symbol text
#so, NameFarEast and NameComplexScript should be writable, but they are not if InsertSymbol is used before (it remains the font of the symbol). only way to replace these values and correctly show icon is setting it to '+mn-..'
char_inserted.Font.NameFarEast = "+mn-ea"
char_inserted.Font.NameComplexScript = "+mn-cs"
char_inserted.Font.Name = font #font name
return char_inserted
else:
return textrange.InsertAfter(item[1]) #append symbol text
# if item[0]:
# char_inserted.Font.Name = item[0] #font name
def insert_symbol_into_shapes(self, shapes, item):
#pplib.iterate_shape_textframes(shapes, lambda textframe: self.insert_symbol_into_text(textframe.TextRange, item))
for textframe in pplib.iterate_shape_textframes(shapes):
self.insert_symbol_into_text(textframe.TextRange, item)
# for shape in shapes:
# if shape.HasTextFrame == -1:
# self.insert_symbol_into_text(shape.TextFrame2.TextRange, item)
def create_symbol_shape(self, slide, item):
shape = slide.shapes.addTextbox(
#office.MsoAutoShapeType.msoShapeRectangle.value__,
1,
100,100,200,200)
shape.TextFrame2.WordWrap = 0
shape.TextFrame2.AutoSize = 1 #ppAutoSizeShapeToFitText
shape.TextFrame2.MarginBottom = 0
shape.TextFrame2.MarginTop = 0
shape.TextFrame2.MarginLeft = 0
shape.TextFrame2.MarginRight = 0
self.insert_symbol_into_text(shape.TextFrame2.TextRange, item)
# if item[0]:
# shape.TextFrame.TextRange.Font.Name = item[0] #font name
# shape.TextFrame.TextRange.Text = item[1] #symbol text
if PPTSymbolsSettings.get_convert_into_shape(): #convert into shape
try:
orig_fontsize = shape.TextFrame2.TextRange.Font.Size
shape.TextFrame2.TextRange.Font.Size = 60
shape.TextFrame2.TextRange.ParagraphFormat.Bullet.Visible = 0
new_shape = pplib.convert_text_into_shape(shape)
new_shape.TextFrame2.TextRange.Font.Size = orig_fontsize
except:
shape.select()
else:
new_shape.select()
else:
shape.select()
def create_symbol_bitmap(self, slide, item):
import tempfile, os
font = item[0] or self.fallback_font
img = bkt.ribbon.SymbolsGallery.create_symbol_image(font, item[1], 400, None)
tmpfile = os.path.join(tempfile.gettempdir(), "bkt-symbol.png")
img.Save(tmpfile, Drawing.Imaging.ImageFormat.Png)
shape = slide.shapes.AddPicture(tmpfile, 0, -1, 200, 200) #FileName, LinkToFile, SaveWithDocument, Left, Top
shape.select()
os.remove(tmpfile)
class PPTSymbolsGalleryRecent(PPTSymbolsGallery):
@property
def symbols(self):
return PPTSymbolsSettings.recent_symbols
@symbols.setter
def symbols(self, value):
pass
def get_item_image(self, index):
try:
return super(PPTSymbolsGalleryRecent, self).get_item_image(index)
except:
return super(PPTSymbolsGalleryRecent, self).create_symbol_image("Arial", "?")
def button_get_label(self, index):
try:
return self.symbols[index][2]
except:
return "Zuletzt verwendet: Undefined"
def button_get_visible(self, index):
try:
return self.symbols[index] is not None
except:
return False
def get_index_as_button(self, index):
return bkt.ribbon.Button(
id="{}_button_{}".format(self.id, index),
get_label=bkt.Callback(lambda: self.button_get_label(index)),
on_action=bkt.Callback(lambda context, selection: self.on_action_indexed(None, index, context, selection)),
get_image=bkt.Callback(lambda: self.get_item_image(index)),
get_visible=bkt.Callback(lambda: self.button_get_visible(index)),
)
class LocpinGallery(bkt.ribbon.Gallery):
def __init__(self, locpin=None, item_supertip="Shape-Fixpunkt bzw. Fixierung bei Änderung {}", **kwargs):
self.locpin = locpin or pplib.GlobalLocPin
self.items = [
("fix_locpin_tl", "Oben-links", item_supertip.format("oben-links")),
("fix_locpin_tm", "Oben-mitte", item_supertip.format("oben-mitte")),
("fix_locpin_tr", "Oben-rechts", item_supertip.format("oben-rechts")),
("fix_locpin_ml", "Mitte-links", item_supertip.format("mitte-links")),
("fix_locpin_mm", "Mitte-mitte", item_supertip.format("mitte-mitte")),
("fix_locpin_mr", "Mitte-rechts", item_supertip.format("mitte-rechts")),
("fix_locpin_bl", "Unten-links", item_supertip.format("unten-links")),
("fix_locpin_bm", "Unten-mitte", item_supertip.format("unten-mitte")),
("fix_locpin_br", "Unten-rechts", item_supertip.format("unten-rechts")),
]
my_kwargs = dict(
# get_enabled=bkt.apps.ppt_shapes_or_text_selected,
columns="3",
item_height="24",
item_width="24",
show_item_label=False,
on_action_indexed = bkt.Callback(self.locpin_on_action_indexed),
get_selected_item_index = bkt.Callback(lambda: self.locpin.index),
get_item_count = bkt.Callback(lambda: len(self.items)),
get_item_label = bkt.Callback(lambda index: self.items[index][1]),
get_item_image = bkt.Callback(self.locpin_get_image, context=True),
get_item_screentip = bkt.Callback(lambda index: self.items[index][1]),
get_item_supertip = bkt.Callback(lambda index: self.items[index][2]),
# children = [
# Item(image=gal_item[0], screentip=gal_item[1], supertip=gal_item[2])
# for gal_item in self.items
# ]
)
if not "image" in kwargs and not "image_mso" in kwargs:
my_kwargs["get_image"] = bkt.Callback(self.locpin_get_image, context=True)
my_kwargs.update(kwargs)
super(LocpinGallery, self).__init__(**my_kwargs)
def locpin_on_action_indexed(self, selected_item, index):
self.locpin.index = index
def locpin_get_image(self, context, index=None):
if index is None:
return context.python_addin.load_image(self.items[self.locpin.index][0])
else:
return context.python_addin.load_image(self.items[index][0])
class PositionGallery(bkt.ribbon.Gallery):
# items: [label, position, reference]
# position: [left, top, width, height]
# values can be absolute or percentage
# reference: CONTENTE / SLIDE / ABS
# values are converted according to reference
items = [
[u"Volle Fläche", [ 0, 0, 1, 1], 'CONTENT'],
[u"2/3 Links", [ 0, 0, 2./3, 1], 'CONTENT'],
[u"2/3 Rechts", [1./3, 0, 2./3, 1], 'CONTENT'],
[u"1/2 Links", [ 0, 0, .5, 1], 'CONTENT'],
[u"1/2 Mitte", [.25, 0, .5, 1], 'CONTENT'],
[u"1/2 Rechts", [ .5, 0, .5, 1], 'CONTENT'],
[u"1/3 Links", [ 0, 0, 1./3, 1], 'CONTENT'],
[u"1/3 Mitte", [1./3, 0, 1./3, 1], 'CONTENT'],
[u"1/3 Rechts", [2./3, 0, 1./3, 1], 'CONTENT'],
[u"1/6 Oben", [ 0, 0, 1, 1./6], 'CONTENT'],
[u"1/6 Unten", [ 0, 5./6, 1, 1./6], 'CONTENT']
]
def __init__(self, positions=None, label="Standardpositionen", columns=3, **kwargs):
self.items = positions or PositionGallery.items
super(PositionGallery, self).__init__(
label = label,
columns = columns,
image_mso='PositionAnchoringGallery',
supertip=u"Positioniere die ausgewählten Shapes auf eine Standardposition.",
children=[
bkt.ribbon.Button(
label="Benutzerdef. Bereich festlegen",
supertip="Der benutzerdefinierte Bereich wird anhand des gewählten Shapes festgelegt. Dieser Bereich ist anschließend über die Gallery wählbar und wird dauerhaft in der aktuellen Prästentation vorgehalten.",
on_action=bkt.Callback(self.set_userdefined_area),
get_enabled = bkt.get_enabled_auto
)
],
**kwargs
)
def on_action_indexed(self, selected_item, index, context, **kwargs):
''' reposition shapes according of settings in clicked element '''
item = self.items[index]
position = item[1]
reference = item[2]
#self.change_position(selection, shapes, item[1])
# reference size
if reference == 'CONTENT':
ref_left,ref_top,ref_width,ref_height = pplib.slide_content_size(context.slide)
else: # SLIDE / ABS
page_setup = context.presentation.PageSetup
ref_left,ref_top = 0, 0
ref_width,ref_height = page_setup.SlideWidth, page_setup.SlideHeight
# target size
left,top,width,height = self.rect_from_definition(position, ref_frame=[ref_left,ref_top,ref_width, ref_height])
frame = pplib.BoundingFrame.from_rect(left, top, width, height)
if 'on_position_change' in self._callbacks:
if context:
return context.invoke_callback(self._callbacks['on_position_change'], target_frame=frame, **kwargs)
def get_item_count(self, presentation):
self.init_userdefined_area_item(presentation)
return len(self.items)
# def get_enabled(self, shapes):
# return True
# def get_item_label(self, index):
# item = self.items[index]
# return "%s" % getattr(NumberedShapes, 'label_' + item['label'])[index%self.columns]
def get_item_image(self, index, presentation):
''' creates an item image with target area according to settings in the specified item '''
# retrieve item-settings
item = self.items[index]
return self.create_image(item[1], item[2], presentation)
def get_item_screentip(self, index):
# retrieve item-settings
item = self.items[index]
return 'Positionierung: ' + item[0]
def get_item_supertip(self, index):
return 'Verwende angezeigten Position/Größe.'
def create_image(self, position, reference, presentation):
# create bitmap, define pen/brush
height = 40
width = height*16./9
img = Drawing.Bitmap(width, height)
g = Drawing.Graphics.FromImage(img)
# reference size
if reference == 'CONTENT':
v_offset = height/5
v_ref = (height*4)/5
left,top,fill_width,fill_height = self.rect_from_definition(position, ref_frame=[0,v_offset,width, v_ref])
else: # SLIDE / ABS
ref_width,ref_height = presentation.PageSetup.SlideWidth, presentation.PageSetup.SlideHeight
left,top,fill_width,fill_height = self.rect_from_definition(position, ref_frame=[0,0,ref_width, ref_height])
left = left /ref_width * width
fill_width = fill_width /ref_width * width
top = top /ref_height * height
fill_height = fill_height/ref_height * height
color = Drawing.ColorTranslator.FromHtml('#ffdd0000')
brush = Drawing.SolidBrush(color)
g.FillRectangle(brush, Drawing.Rectangle(round(left),round(top), round(fill_width), round(fill_height)))
color = Drawing.ColorTranslator.FromHtml('#ff999999')
pen = Drawing.Pen(color,1)
g.DrawRectangle(pen, Drawing.Rectangle(0,0, width-1, height/5-1))
g.DrawRectangle(pen, Drawing.Rectangle(0,0, width-1, height-1))
return img
def rect_from_definition(self, pos_definition, ref_frame=[0,0,640,480]):
left = self.length_from_definition(pos_definition[0], ref_frame[2]) + ref_frame[0]
top = self.length_from_definition(pos_definition[1], ref_frame[3]) + ref_frame[1]
width = self.length_from_definition(pos_definition[2], ref_frame[2])
height = self.length_from_definition(pos_definition[3], ref_frame[3])
return left, top, width, height
def length_from_definition(self, length_definition, reference):
if type(length_definition) == list:
# allow [150, 50%]
l = 0
for ldef in length_definition:
l += self.length_from_definition(ldef, reference)
return l
elif type(length_definition) in [int, float, long]:
if length_definition < 0:
# negative values specify distance 'from right'
return reference - self.length_from_definition(-length_definition, reference)
elif length_definition <= 1:
# percentage values
return reference * length_definition
else:
# absolute values
return length_definition
else:
return 10
## userdefined area
def set_userdefined_area(self, presentation, shapes):
if len(shapes) == 1:
pplib.ContentArea.define_contentarea(presentation, shapes[0])
else:
frame = pplib.BoundingFrame.from_shapes(shapes)
pplib.ContentArea.define_contentarea(presentation, frame)
self.init_userdefined_area_item(presentation)
def init_userdefined_area_item(self, presentation):
#due to performance check first if tag exists at all
if pplib.ContentArea.isset_contentarea(presentation):
left, top, width, height = pplib.ContentArea.read_contentarea(presentation)
if len(self.items) == 12:
self.items.pop()
self.items.append([u"Benutzerdef. Bereich", [left, top, width, height], 'ABS'])
| [((15, 10, 15, 33), 'bkt.dotnet.import_drawing', 'dotnet.import_drawing', ({}, {}), '()', False, 'from bkt import dotnet\n'), ((217, 25, 217, 81), 'bkt.settings.get', 'bkt.settings.get', ({(217, 42, 217, 74): '"""bkt.symbols.convert_into_shape"""', (217, 76, 217, 80): 'True'}, {}), "('bkt.symbols.convert_into_shape', True)", False, 'import bkt\n'), ((218, 26, 218, 84), 'bkt.settings.get', 'bkt.settings.get', ({(218, 43, 218, 76): '"""bkt.symbols.convert_into_bitmap"""', (218, 78, 218, 83): 'False'}, {}), "('bkt.symbols.convert_into_bitmap', False)", False, 'import bkt\n'), ((219, 19, 219, 69), 'bkt.settings.get', 'bkt.settings.get', ({(219, 36, 219, 62): '"""bkt.symbols.unicode_font"""', (219, 64, 219, 68): 'None'}, {}), "('bkt.symbols.unicode_font', None)", False, 'import bkt\n'), ((216, 27, 216, 77), 'bkt.settings.get', 'bkt.settings.get', ({(216, 44, 216, 72): '"""bkt.symbols.recent_symbols"""', (216, 74, 216, 76): '[]'}, {}), "('bkt.symbols.recent_symbols', [])", False, 'import bkt\n'), ((363, 14, 363, 85), 'bkt.ribbon.SymbolsGallery.create_symbol_image', 'bkt.ribbon.SymbolsGallery.create_symbol_image', ({(363, 60, 363, 64): 'font', (363, 66, 363, 73): 'item[1]', (363, 75, 363, 78): '400', (363, 80, 363, 84): 'None'}, {}), '(font, item[1], 400, None)', False, 'import bkt\n'), ((368, 8, 368, 26), 'os.remove', 'os.remove', ({(368, 18, 368, 25): 'tmpfile'}, {}), '(tmpfile)', False, 'import tempfile, os\n'), ((280, 24, 280, 60), 'bkt.get_key_state', 'bkt.get_key_state', ({(280, 42, 280, 59): 'bkt.KeyCodes.CTRL'}, {}), '(bkt.KeyCodes.CTRL)', False, 'import bkt\n'), ((280, 64, 280, 101), 'bkt.get_key_state', 'bkt.get_key_state', ({(280, 82, 280, 100): 'bkt.KeyCodes.SHIFT'}, {}), '(bkt.KeyCodes.SHIFT)', False, 'import bkt\n'), ((364, 31, 364, 52), 'tempfile.gettempdir', 'tempfile.gettempdir', ({}, {}), '()', False, 'import tempfile, os\n'), ((442, 37, 442, 86), 'bkt.Callback', 'bkt.Callback', (), '', False, 'import bkt\n'), ((256, 42, 256, 79), 'bkt.get_key_state', 'bkt.get_key_state', ({(256, 60, 256, 78): 'bkt.KeyCodes.SHIFT'}, {}), '(bkt.KeyCodes.SHIFT)', False, 'import bkt\n'), ((256, 89, 256, 125), 'bkt.get_key_state', 'bkt.get_key_state', ({(256, 107, 256, 124): 'bkt.KeyCodes.CTRL'}, {}), '(bkt.KeyCodes.CTRL)', False, 'import bkt\n'), ((267, 43, 267, 79), 'bkt.get_key_state', 'bkt.get_key_state', ({(267, 61, 267, 78): 'bkt.KeyCodes.CTRL'}, {}), '(bkt.KeyCodes.CTRL)', False, 'import bkt\n'), ((267, 89, 267, 126), 'bkt.get_key_state', 'bkt.get_key_state', ({(267, 107, 267, 125): 'bkt.KeyCodes.SHIFT'}, {}), '(bkt.KeyCodes.SHIFT)', False, 'import bkt\n'), ((429, 33, 429, 76), 'bkt.Callback', 'bkt.Callback', ({(429, 46, 429, 75): 'self.locpin_on_action_indexed'}, {}), '(self.locpin_on_action_indexed)', False, 'import bkt\n'), ((430, 38, 430, 77), 'bkt.Callback', 'bkt.Callback', ({(430, 51, 430, 76): 'lambda : self.locpin.index'}, {}), '(lambda : self.locpin.index)', False, 'import bkt\n'), ((432, 29, 432, 77), 'bkt.Callback', 'bkt.Callback', ({(432, 42, 432, 76): 'lambda index: self.items[index][1]'}, {}), '(lambda index: self.items[index][1])', False, 'import bkt\n'), ((433, 29, 433, 78), 'bkt.Callback', 'bkt.Callback', (), '', False, 'import bkt\n'), ((434, 33, 434, 81), 'bkt.Callback', 'bkt.Callback', ({(434, 46, 434, 80): 'lambda index: self.items[index][1]'}, {}), '(lambda index: self.items[index][1])', False, 'import bkt\n'), ((435, 32, 435, 80), 'bkt.Callback', 'bkt.Callback', ({(435, 45, 435, 79): 'lambda index: self.items[index][2]'}, {}), '(lambda index: self.items[index][2])', False, 'import bkt\n'), ((491, 30, 491, 69), 'bkt.Callback', 'bkt.Callback', ({(491, 43, 491, 68): 'self.set_userdefined_area'}, {}), '(self.set_userdefined_area)', False, 'import bkt\n')] |
guliverza/AdditionalPylons | sc2/unit.py | 37336dcd1678c6cdfa22d881c2178ba65cb1fd61 | from __future__ import annotations
import warnings
from typing import Any, Dict, List, Optional, Set, Tuple, Union, TYPE_CHECKING
from .cache import property_immutable_cache, property_mutable_cache
from .constants import (
transforming,
IS_STRUCTURE,
IS_LIGHT,
IS_ARMORED,
IS_BIOLOGICAL,
IS_MECHANICAL,
IS_MASSIVE,
IS_PSIONIC,
UNIT_BATTLECRUISER,
UNIT_ORACLE,
TARGET_GROUND,
TARGET_AIR,
TARGET_BOTH,
IS_SNAPSHOT,
IS_VISIBLE,
IS_MINE,
IS_ENEMY,
IS_CLOAKED,
IS_REVEALED,
CAN_BE_ATTACKED,
IS_CARRYING_MINERALS,
IS_CARRYING_VESPENE,
IS_CARRYING_RESOURCES,
IS_ATTACKING,
IS_PATROLLING,
IS_GATHERING,
IS_RETURNING,
IS_COLLECTING,
IS_CONSTRUCTING_SCV,
IS_REPAIRING,
IS_DETECTOR,
UNIT_PHOTONCANNON,
UNIT_COLOSSUS,
)
from .data import Alliance, Attribute, CloakState, DisplayType, Race, TargetType, warpgate_abilities, TargetType, Target
from .ids.ability_id import AbilityId
from .ids.buff_id import BuffId
from .ids.upgrade_id import UpgradeId
from .ids.unit_typeid import UnitTypeId
from .position import Point2, Point3
from .unit_command import UnitCommand
warnings.simplefilter("once")
if TYPE_CHECKING:
from .bot_ai import BotAI
from .game_data import AbilityData
class UnitOrder:
@classmethod
def from_proto(cls, proto, bot_object: BotAI):
return cls(
bot_object._game_data.abilities[proto.ability_id],
(proto.target_world_space_pos if proto.HasField("target_world_space_pos") else proto.target_unit_tag),
proto.progress,
)
def __init__(self, ability: AbilityData, target, progress: float = None):
"""
:param ability:
:param target:
:param progress:
"""
self.ability = ability
self.target = target
self.progress = progress
def __repr__(self) -> str:
return f"UnitOrder({self.ability}, {self.target}, {self.progress})"
class Unit:
def __init__(self, proto_data, bot_object: BotAI):
"""
:param proto_data:
:param bot_object:
"""
self._proto = proto_data
self._bot_object = bot_object
# Used by property_immutable_cache
self.cache = {}
def __repr__(self) -> str:
""" Returns string of this form: Unit(name='SCV', tag=4396941328). """
return f"Unit(name={self.name !r}, tag={self.tag})"
@property_immutable_cache
def type_id(self) -> UnitTypeId:
""" UnitTypeId found in sc2/ids/unit_typeid.
Caches all type_ids of the same unit type. """
unit_type = self._proto.unit_type
if unit_type not in self._bot_object._game_data.unit_types:
self._bot_object._game_data.unit_types[unit_type] = UnitTypeId(unit_type)
return self._bot_object._game_data.unit_types[unit_type]
@property_immutable_cache
def _type_data(self) -> "UnitTypeData":
""" Provides the unit type data. """
return self._bot_object._game_data.units[self._proto.unit_type]
@property
def name(self) -> str:
""" Returns the name of the unit. """
return self._type_data.name
@property
def race(self) -> Race:
""" Returns the race of the unit """
return Race(self._type_data._proto.race)
@property
def tag(self) -> int:
""" Returns the unique tag of the unit. """
return self._proto.tag
@property
def is_structure(self) -> bool:
""" Checks if the unit is a structure. """
return IS_STRUCTURE in self._type_data.attributes
@property
def is_light(self) -> bool:
""" Checks if the unit has the 'light' attribute. """
return IS_LIGHT in self._type_data.attributes
@property
def is_armored(self) -> bool:
""" Checks if the unit has the 'armored' attribute. """
return IS_ARMORED in self._type_data.attributes
@property
def is_biological(self) -> bool:
""" Checks if the unit has the 'biological' attribute. """
return IS_BIOLOGICAL in self._type_data.attributes
@property
def is_mechanical(self) -> bool:
""" Checks if the unit has the 'mechanical' attribute. """
return IS_MECHANICAL in self._type_data.attributes
@property
def is_massive(self) -> bool:
""" Checks if the unit has the 'massive' attribute. """
return IS_MASSIVE in self._type_data.attributes
@property
def is_psionic(self) -> bool:
""" Checks if the unit has the 'psionic' attribute. """
return IS_PSIONIC in self._type_data.attributes
@property
def tech_alias(self) -> Optional[List[UnitTypeId]]:
""" Building tech equality, e.g. OrbitalCommand is the same as CommandCenter
For Hive, this returns [UnitTypeId.Hatchery, UnitTypeId.Lair]
For SCV, this returns None """
return self._type_data.tech_alias
@property
def unit_alias(self) -> Optional[UnitTypeId]:
""" Building type equality, e.g. FlyingOrbitalCommand is the same as OrbitalCommand
For flying OrbitalCommand, this returns UnitTypeId.OrbitalCommand
For SCV, this returns None """
return self._type_data.unit_alias
@property_immutable_cache
def _weapons(self):
""" Returns the weapons of the unit. """
try:
return self._type_data._proto.weapons
except:
return None
@property_immutable_cache
def can_attack(self) -> bool:
""" Checks if the unit can attack at all. """
# TODO BATTLECRUISER doesnt have weapons in proto?!
return bool(self._weapons) or self.type_id in {UNIT_BATTLECRUISER, UNIT_ORACLE}
@property_immutable_cache
def can_attack_both(self) -> bool:
""" Checks if the unit can attack both ground and air units. """
if self.type_id == UNIT_BATTLECRUISER:
return True
if self._weapons:
return any(weapon.type in TARGET_BOTH for weapon in self._weapons)
return False
@property_immutable_cache
def can_attack_ground(self) -> bool:
""" Checks if the unit can attack ground units. """
if self.type_id in {UNIT_BATTLECRUISER, UNIT_ORACLE}:
return True
if self._weapons:
return any(weapon.type in TARGET_GROUND for weapon in self._weapons)
return False
@property_immutable_cache
def ground_dps(self) -> Union[int, float]:
""" Returns the dps against ground units. Does not include upgrades. """
if self.can_attack_ground:
weapon = next((weapon for weapon in self._weapons if weapon.type in TARGET_GROUND), None)
if weapon:
return (weapon.damage * weapon.attacks) / weapon.speed
return 0
@property_immutable_cache
def ground_range(self) -> Union[int, float]:
""" Returns the range against ground units. Does not include upgrades. """
if self.type_id == UNIT_ORACLE:
return 4
if self.type_id == UNIT_BATTLECRUISER:
return 6
if self.can_attack_ground:
weapon = next((weapon for weapon in self._weapons if weapon.type in TARGET_GROUND), None)
if weapon:
return weapon.range
return 0
@property_immutable_cache
def can_attack_air(self) -> bool:
""" Checks if the unit can air attack at all. Does not include upgrades. """
if self.type_id == UNIT_BATTLECRUISER:
return True
if self._weapons:
return any(weapon.type in TARGET_AIR for weapon in self._weapons)
return False
@property_immutable_cache
def air_dps(self) -> Union[int, float]:
""" Returns the dps against air units. Does not include upgrades. """
if self.can_attack_air:
weapon = next((weapon for weapon in self._weapons if weapon.type in TARGET_AIR), None)
if weapon:
return (weapon.damage * weapon.attacks) / weapon.speed
return 0
@property_immutable_cache
def air_range(self) -> Union[int, float]:
""" Returns the range against air units. Does not include upgrades. """
if self.type_id == UNIT_BATTLECRUISER:
return 6
if self.can_attack_air:
weapon = next((weapon for weapon in self._weapons if weapon.type in TARGET_AIR), None)
if weapon:
return weapon.range
return 0
@property_immutable_cache
def bonus_damage(self):
""" Returns a tuple of form '(bonus damage, armor type)' if unit does 'bonus damage' against 'armor type'.
Possible armor typs are: 'Light', 'Armored', 'Biological', 'Mechanical', 'Psionic', 'Massive', 'Structure'. """
# TODO: Consider units with ability attacks (Oracle, Baneling) or multiple attacks (Thor).
if self._weapons:
for weapon in self._weapons:
if weapon.damage_bonus:
b = weapon.damage_bonus[0]
return (b.bonus, Attribute(b.attribute).name)
else:
return None
@property
def armor(self) -> Union[int, float]:
""" Returns the armor of the unit. Does not include upgrades """
return self._type_data._proto.armor
@property
def sight_range(self) -> Union[int, float]:
""" Returns the sight range of the unit. """
return self._type_data._proto.sight_range
@property
def movement_speed(self) -> Union[int, float]:
""" Returns the movement speed of the unit. Does not include upgrades or buffs. """
return self._type_data._proto.movement_speed
@property
def is_mineral_field(self) -> bool:
""" Checks if the unit is a mineral field. """
return self._type_data.has_minerals
@property
def is_vespene_geyser(self) -> bool:
""" Checks if the unit is a non-empty vespene geyser or gas extraction building. """
return self._type_data.has_vespene
@property
def health(self) -> Union[int, float]:
""" Returns the health of the unit. Does not include shields. """
return self._proto.health
@property
def health_max(self) -> Union[int, float]:
""" Returns the maximum health of the unit. Does not include shields. """
return self._proto.health_max
@property
def health_percentage(self) -> Union[int, float]:
""" Returns the percentage of health the unit has. Does not include shields. """
if self._proto.health_max == 0:
return 0
return self._proto.health / self._proto.health_max
@property
def shield(self) -> Union[int, float]:
""" Returns the shield points the unit has. Returns 0 for non-protoss units. """
return self._proto.shield
@property
def shield_max(self) -> Union[int, float]:
""" Returns the maximum shield points the unit can have. Returns 0 for non-protoss units. """
return self._proto.shield_max
@property
def shield_percentage(self) -> Union[int, float]:
""" Returns the percentage of shield points the unit has. Returns 0 for non-protoss units. """
if self._proto.shield_max == 0:
return 0
return self._proto.shield / self._proto.shield_max
@property
def energy(self) -> Union[int, float]:
""" Returns the amount of energy the unit has. Returns 0 for units without energy. """
return self._proto.energy
@property
def energy_max(self) -> Union[int, float]:
""" Returns the maximum amount of energy the unit can have. Returns 0 for units without energy. """
return self._proto.energy_max
@property
def energy_percentage(self) -> Union[int, float]:
""" Returns the percentage of amount of energy the unit has. Returns 0 for units without energy. """
if self._proto.energy_max == 0:
return 0
return self._proto.energy / self._proto.energy_max
@property
def is_snapshot(self) -> bool:
""" Checks if the unit is only available as a snapshot for the bot.
Enemy buildings that have been scouted and are in the fog of war or
attacking enemy units on higher, not visible ground appear this way. """
return self._proto.display_type == IS_SNAPSHOT
@property
def is_visible(self) -> bool:
""" Checks if the unit is visible for the bot.
NOTE: This means the bot has vision of the position of the unit!
It does not give any information about the cloak status of the unit."""
return self._proto.display_type == IS_VISIBLE
@property
def alliance(self) -> Alliance:
""" Returns the team the unit belongs to. """
return self._proto.alliance
@property
def is_mine(self) -> bool:
""" Checks if the unit is controlled by the bot. """
return self._proto.alliance == IS_MINE
@property
def is_enemy(self) -> bool:
""" Checks if the unit is hostile. """
return self._proto.alliance == IS_ENEMY
@property
def owner_id(self) -> int:
""" Returns the owner of the unit. This is a value of 1 or 2 in a two player game. """
return self._proto.owner
@property
def position_tuple(self) -> Tuple[float, float]:
""" Returns the 2d position of the unit as tuple without conversion to Point2. """
return self._proto.pos.x, self._proto.pos.y
@property_immutable_cache
def position(self) -> Point2:
""" Returns the 2d position of the unit. """
return Point2.from_proto(self._proto.pos)
@property_immutable_cache
def position3d(self) -> Point3:
""" Returns the 3d position of the unit. """
return Point3.from_proto(self._proto.pos)
def distance_to(self, p: Union[Unit, Point2, Point3]) -> Union[int, float]:
""" Using the 2d distance between self and p.
To calculate the 3d distance, use unit.position3d.distance_to(p)
:param p: """
if isinstance(p, Unit):
return self._bot_object._distance_squared_unit_to_unit(self, p) ** 0.5
return self._bot_object.distance_math_hypot(self.position_tuple, p)
def target_in_range(self, target: Unit, bonus_distance: Union[int, float] = 0) -> bool:
""" Checks if the target is in range.
Includes the target's radius when calculating distance to target.
:param target:
:param bonus_distance: """
# TODO: Fix this because immovable units (sieged tank, planetary fortress etc.) have a little lower range than this formula
if self.can_attack_ground and not target.is_flying:
unit_attack_range = self.ground_range
elif self.can_attack_air and (target.is_flying or target.type_id == UNIT_COLOSSUS):
unit_attack_range = self.air_range
else:
return False
return (
self._bot_object._distance_squared_unit_to_unit(self, target)
<= (self.radius + target.radius + unit_attack_range + bonus_distance) ** 2
)
def in_ability_cast_range(
self, ability_id: AbilityId, target: Union[Unit, Point2], bonus_distance: float = 0
) -> bool:
""" Test if a unit is able to cast an ability on the target without checking ability cooldown (like stalker blink) or if ability is made available through research (like HT storm).
:param ability_id:
:param target:
:param bonus_distance: """
cast_range = self._bot_object._game_data.abilities[ability_id.value]._proto.cast_range
assert cast_range > 0, f"Checking for an ability ({ability_id}) that has no cast range"
ability_target_type = self._bot_object._game_data.abilities[ability_id.value]._proto.target
# For casting abilities that target other units, like transfuse, feedback, snipe, yamato
if ability_target_type in {Target.Unit.value, Target.PointOrUnit.value} and isinstance(target, Unit):
return (
self._bot_object._distance_squared_unit_to_unit(self, target)
<= (cast_range + self.radius + target.radius + bonus_distance) ** 2
)
# For casting abilities on the ground, like queen creep tumor, ravager bile, HT storm
if ability_target_type in {Target.Point.value, Target.PointOrUnit.value} and isinstance(
target, (Point2, tuple)
):
return (
self._bot_object._distance_pos_to_pos(self.position_tuple, target)
<= cast_range + self.radius + bonus_distance
)
return False
@property
def facing(self) -> Union[int, float]:
""" Returns direction the unit is facing as a float in range [0,2π). 0 is in direction of x axis."""
return self._proto.facing
# TODO: a function that checks if this unit is facing another unit
def is_facing_unit(self, other_unit: Unit, angle_error: float = 1e-3) -> bool:
"""
Function not completed yet
:param other_unit:
:param angle_error:
"""
pass
@property
def radius(self) -> Union[int, float]:
""" Half of unit size. See https://liquipedia.net/starcraft2/Unit_Statistics_(Legacy_of_the_Void) """
return self._proto.radius
@property
def build_progress(self) -> Union[int, float]:
""" Returns completion in range [0,1]."""
return self._proto.build_progress
@property
def is_ready(self) -> bool:
""" Checks if the unit is completed. """
return self.build_progress == 1
@property
def cloak(self) -> CloakState:
""" Returns cloak state.
See https://github.com/Blizzard/s2client-api/blob/d9ba0a33d6ce9d233c2a4ee988360c188fbe9dbf/include/sc2api/sc2_unit.h#L95 """
return self._proto.cloak
@property
def is_cloaked(self) -> bool:
""" Checks if the unit is cloaked. """
return self._proto.cloak in IS_CLOAKED
@property
def is_revealed(self) -> bool:
""" Checks if the unit is revealed. """
return self._proto.cloak is IS_REVEALED
@property
def can_be_attacked(self) -> bool:
""" Checks if the unit is revealed or not cloaked and therefore can be attacked. """
return self._proto.cloak in CAN_BE_ATTACKED
@property_immutable_cache
def buffs(self) -> Set:
""" Returns the set of current buffs the unit has. """
return {BuffId(buff_id) for buff_id in self._proto.buff_ids}
@property_immutable_cache
def is_carrying_minerals(self) -> bool:
""" Checks if a worker or MULE is carrying (gold-)minerals. """
return not IS_CARRYING_MINERALS.isdisjoint(self.buffs)
@property_immutable_cache
def is_carrying_vespene(self) -> bool:
""" Checks if a worker is carrying vespene gas. """
return not IS_CARRYING_VESPENE.isdisjoint(self.buffs)
@property_immutable_cache
def is_carrying_resource(self) -> bool:
""" Checks if a worker is carrying a resource. """
return not IS_CARRYING_RESOURCES.isdisjoint(self.buffs)
@property
def detect_range(self) -> Union[int, float]:
""" Returns the detection distance of the unit. """
return self._proto.detect_range
@property_immutable_cache
def is_detector(self) -> bool:
""" Checks if the unit is a detector. Has to be completed
in order to detect and Photoncannons also need to be powered. """
return self.is_ready and (self.type_id in IS_DETECTOR or self.type_id == UNIT_PHOTONCANNON and self.is_powered)
@property
def radar_range(self) -> Union[int, float]:
return self._proto.radar_range
@property
def is_selected(self) -> bool:
""" Checks if the unit is currently selected. """
return self._proto.is_selected
@property
def is_on_screen(self) -> bool:
""" Checks if the unit is on the screen. """
return self._proto.is_on_screen
@property
def is_blip(self) -> bool:
""" Checks if the unit is detected by a sensor tower. """
return self._proto.is_blip
@property
def is_powered(self) -> bool:
""" Checks if the unit is powered by a pylon or warppism. """
return self._proto.is_powered
@property
def is_active(self) -> bool:
""" Checks if the unit is currently training or researching. """
return self._proto.is_active
# PROPERTIES BELOW THIS COMMENT ARE NOT POPULATED FOR SNAPSHOTS
@property
def mineral_contents(self) -> int:
""" Returns the amount of minerals remaining in a mineral field. """
return self._proto.mineral_contents
@property
def vespene_contents(self) -> int:
""" Returns the amount of gas remaining in a geyser. """
return self._proto.vespene_contents
@property
def has_vespene(self) -> bool:
""" Checks if a geyser has any gas remaining.
You can't build extractors on empty geysers. """
return bool(self._proto.vespene_contents)
@property
def is_flying(self) -> bool:
""" Checks if the unit is flying. """
return self._proto.is_flying or self.has_buff(BuffId.GRAVITONBEAM)
@property
def is_burrowed(self) -> bool:
""" Checks if the unit is burrowed. """
return self._proto.is_burrowed
@property
def is_hallucination(self) -> bool:
""" Returns True if the unit is your own hallucination or detected. """
return self._proto.is_hallucination
@property
def attack_upgrade_level(self) -> int:
""" Returns the upgrade level of the units attack.
# NOTE: Returns 0 for units without a weapon. """
return self._proto.attack_upgrade_level
@property
def armor_upgrade_level(self) -> int:
""" Returns the upgrade level of the units armor. """
return self._proto.armor_upgrade_level
@property
def shield_upgrade_level(self) -> int:
""" Returns the upgrade level of the units shield.
# NOTE: Returns 0 for units without a shield. """
return self._proto.shield_upgrade_level
@property
def buff_duration_remain(self) -> int:
""" Returns the amount of remaining frames of the visible timer bar.
# NOTE: Returns 0 for units without a timer bar. """
return self._proto.buff_duration_remain
@property
def buff_duration_max(self) -> int:
""" Returns the maximum amount of frames of the visible timer bar.
# NOTE: Returns 0 for units without a timer bar. """
return self._proto.buff_duration_max
# PROPERTIES BELOW THIS COMMENT ARE NOT POPULATED FOR ENEMIES
@property_mutable_cache
def orders(self) -> List[UnitOrder]:
""" Returns the a list of the current orders. """
return [UnitOrder.from_proto(order, self._bot_object) for order in self._proto.orders]
@property_immutable_cache
def order_target(self) -> Optional[Union[int, Point2]]:
""" Returns the target tag (if it is a Unit) or Point2 (if it is a Position)
from the first order, returns None if the unit is idle """
if self.orders:
if isinstance(self.orders[0].target, int):
return self.orders[0].target
else:
return Point2.from_proto(self.orders[0].target)
return None
@property
def noqueue(self) -> bool:
""" Checks if the unit is idle. """
warnings.warn("noqueue will be removed soon, please use is_idle instead", DeprecationWarning, stacklevel=2)
return self.is_idle
@property
def is_idle(self) -> bool:
""" Checks if unit is idle. """
return not self._proto.orders
def is_using_ability(self, abilities: Union[AbilityId, Set[AbilityId]]) -> bool:
""" Check if the unit is using one of the given abilities.
Only works for own units. """
if not self.orders:
return False
if isinstance(abilities, AbilityId):
abilities = {abilities}
return self.orders[0].ability.id in abilities
@property_immutable_cache
def is_moving(self) -> bool:
""" Checks if the unit is moving.
Only works for own units. """
return self.is_using_ability(AbilityId.MOVE)
@property_immutable_cache
def is_attacking(self) -> bool:
""" Checks if the unit is attacking.
Only works for own units. """
return self.is_using_ability(IS_ATTACKING)
@property_immutable_cache
def is_patrolling(self) -> bool:
""" Checks if a unit is patrolling.
Only works for own units. """
return self.is_using_ability(IS_PATROLLING)
@property_immutable_cache
def is_gathering(self) -> bool:
""" Checks if a unit is on its way to a mineral field or vespene geyser to mine.
Only works for own units. """
return self.is_using_ability(IS_GATHERING)
@property_immutable_cache
def is_returning(self) -> bool:
""" Checks if a unit is returning from mineral field or vespene geyser to deliver resources to townhall.
Only works for own units. """
return self.is_using_ability(IS_RETURNING)
@property_immutable_cache
def is_collecting(self) -> bool:
""" Checks if a unit is gathering or returning.
Only works for own units. """
return self.is_using_ability(IS_COLLECTING)
@property_immutable_cache
def is_constructing_scv(self) -> bool:
""" Checks if the unit is an SCV that is currently building.
Only works for own units. """
return self.is_using_ability(IS_CONSTRUCTING_SCV)
@property_immutable_cache
def is_transforming(self) -> bool:
""" Checks if the unit transforming.
Only works for own units. """
return self.type_id in transforming and self.is_using_ability(transforming[self.type_id])
@property_immutable_cache
def is_repairing(self) -> bool:
""" Checks if the unit is an SCV or MULE that is currently repairing.
Only works for own units. """
return self.is_using_ability(IS_REPAIRING)
@property
def add_on_tag(self) -> int:
""" Returns the tag of the addon of unit. """
return self._proto.add_on_tag
@property
def has_add_on(self) -> bool:
""" Checks if unit has an addon attached. """
return bool(self._proto.add_on_tag)
@property_immutable_cache
def add_on_land_position(self) -> Point2:
""" If unit is addon (techlab or reactor), returns the position
where a terran building has to land to connect to addon """
return self.position.offset(Point2((-2.5, 0.5)))
@property_mutable_cache
def passengers(self) -> Set[Unit]:
""" Returns the units inside a Bunker, CommandCenter, PlanetaryFortress, Medivac, Nydus, Overlord or WarpPrism. """
return {Unit(unit, self._bot_object) for unit in self._proto.passengers}
@property_mutable_cache
def passengers_tags(self) -> Set[int]:
""" Returns the tags of the units inside a Bunker, CommandCenter, PlanetaryFortress, Medivac, Nydus, Overlord or WarpPrism. """
return {unit.tag for unit in self._proto.passengers}
@property
def cargo_used(self) -> Union[float, int]:
""" Returns how much cargo space is currently used in the unit.
Note that some units take up more than one space. """
return self._proto.cargo_space_taken
@property
def has_cargo(self) -> bool:
""" Checks if this unit has any units loaded. """
return bool(self._proto.cargo_space_taken)
@property
def cargo_size(self) -> Union[float, int]:
""" Returns the amount of cargo space the unit needs. """
return self._type_data.cargo_size
@property
def cargo_max(self) -> Union[float, int]:
""" How much cargo space is available at maximum. """
return self._proto.cargo_space_max
@property
def cargo_left(self) -> Union[float, int]:
""" Returns how much cargo space is currently left in the unit. """
return self._proto.cargo_space_max - self._proto.cargo_space_taken
@property
def assigned_harvesters(self) -> int:
""" Returns the number of workers currently gathering resources at a geyser or mining base."""
return self._proto.assigned_harvesters
@property
def ideal_harvesters(self) -> int:
""" Returns the ideal harverster count for unit.
3 for gas buildings, 2*n for n mineral patches on that base."""
return self._proto.ideal_harvesters
@property
def surplus_harvesters(self) -> int:
""" Returns a positive int if unit has too many harvesters mining,
a negative int if it has too few mining."""
return self._proto.assigned_harvesters - self._proto.ideal_harvesters
@property_immutable_cache
def weapon_cooldown(self) -> Union[int, float]:
""" Returns the time until the unit can fire again,
returns -1 for units that can't attack.
Usage:
if unit.weapon_cooldown == 0:
self.actions.append(unit.attack(target))
elif unit.weapon_cooldown < 0:
self.actions.append(unit.move(closest_allied_unit_because_cant_attack))
else:
self.actions.append(unit.move(retreatPosition)) """
if self.can_attack:
return self._proto.weapon_cooldown
return -1
@property
def engaged_target_tag(self) -> int:
# TODO What does this do?
return self._proto.engaged_target_tag
# Unit functions
def has_buff(self, buff: BuffId) -> bool:
""" Checks if unit has buff 'buff'. """
assert isinstance(buff, BuffId), f"{buff} is no BuffId"
return buff in self.buffs
def train(self, unit: UnitTypeId, queue: bool = False) -> UnitCommand:
""" Orders unit to train another 'unit'.
Usage: self.actions.append(COMMANDCENTER.train(SCV))
:param unit:
:param queue: """
return self(self._bot_object._game_data.units[unit.value].creation_ability.id, queue=queue)
def build(self, unit: UnitTypeId, position: Union[Point2, Point3] = None, queue: bool = False) -> UnitCommand:
""" Orders unit to build another 'unit' at 'position'.
Usage: self.actions.append(SCV.build(COMMANDCENTER, position))
:param unit:
:param position:
:param queue:
"""
return self(self._bot_object._game_data.units[unit.value].creation_ability.id, target=position, queue=queue)
def research(self, upgrade: UpgradeId, queue: bool = False) -> UnitCommand:
""" Orders unit to research 'upgrade'.
Requires UpgradeId to be passed instead of AbilityId.
:param upgrade:
:param queue:
"""
return self(self._bot_object._game_data.upgrades[upgrade.value].research_ability.id, queue=queue)
def warp_in(self, unit: UnitTypeId, position: Union[Point2, Point3]) -> UnitCommand:
""" Orders Warpgate to warp in 'unit' at 'position'.
:param unit:
:param queue:
"""
normal_creation_ability = self._bot_object._game_data.units[unit.value].creation_ability.id
return self(warpgate_abilities[normal_creation_ability], target=position)
def attack(self, target: Union[Unit, Point2, Point3], queue: bool = False) -> UnitCommand:
""" Orders unit to attack. Target can be a Unit or Point2.
Attacking a position will make the unit move there and attack everything on its way.
:param target:
:param queue:
"""
return self(AbilityId.ATTACK, target=target, queue=queue)
def gather(self, target: Unit, queue: bool = False) -> UnitCommand:
""" Orders a unit to gather minerals or gas.
'Target' must be a mineral patch or a gas extraction building.
:param target:
:param queue:
"""
return self(AbilityId.HARVEST_GATHER, target=target, queue=queue)
def return_resource(self, target: Unit = None, queue: bool = False) -> UnitCommand:
""" Orders the unit to return resource. Does not need a 'target'.
:param target:
:param queue:
"""
return self(AbilityId.HARVEST_RETURN, target=target, queue=queue)
def move(self, position: Union[Point2, Point3], queue: bool = False) -> UnitCommand:
""" Orders the unit to move to 'position'.
Target can be a Unit (to follow that unit) or Point2.
:param position:
:param queue:
"""
return self(AbilityId.MOVE_MOVE, target=position, queue=queue)
def scan_move(self, *args, **kwargs) -> UnitCommand:
""" Deprecated: This ability redirects to 'AbilityId.ATTACK' """
return self(AbilityId.SCAN_MOVE, *args, **kwargs)
def hold_position(self, queue: bool = False) -> UnitCommand:
""" Orders a unit to stop moving. It will not move until it gets new orders.
:param queue:
"""
return self(AbilityId.HOLDPOSITION, queue=queue)
def stop(self, queue: bool = False) -> UnitCommand:
""" Orders a unit to stop, but can start to move on its own
if it is attacked, enemy unit is in range or other friendly
units need the space.
:param queue:
"""
return self(AbilityId.STOP, queue=queue)
def patrol(self, position: Union[Point2, Point3], queue: bool = False) -> UnitCommand:
""" Orders a unit to patrol between position it has when the command starts and the target position.
Can be queued up to seven patrol points. If the last point is the same as the starting
point, the unit will patrol in a circle.
:param position:
:param queue:
"""
return self(AbilityId.PATROL, target=position, queue=queue)
def repair(self, repair_target: Unit, queue: bool = False) -> UnitCommand:
""" Order an SCV or MULE to repair.
:param repair_target:
:param queue:
"""
return self(AbilityId.EFFECT_REPAIR, target=repair_target, queue=queue)
def __hash__(self):
return self.tag
def __eq__(self, other):
try:
return self.tag == other.tag
except:
return False
def __call__(self, ability, target=None, queue: bool = False):
return UnitCommand(ability, self, target=target, queue=queue)
| [((49, 0, 49, 29), 'warnings.simplefilter', 'warnings.simplefilter', ({(49, 22, 49, 28): '"""once"""'}, {}), "('once')", False, 'import warnings\n'), ((641, 8, 641, 115), 'warnings.warn', 'warnings.warn', (), '', False, 'import warnings\n')] |
striantafyllouEPFL/healthy-candies | healthy_candies/load/__init__.py | fc7d9e05d54ba207e15d997acea44ff0bf9edb13 | from .load import load_data, NUTRI_COLS, load_clean_rel_to_nutri
| [] |
mia-jingyi/simglucose | simglucose/sensor/cgm.py | a90bd8750fce362be91668ed839b3b252bc0d58d | # from .noise_gen import CGMNoiseGenerator
from .noise_gen import CGMNoise
import pandas as pd
import logging
logger = logging.getLogger(__name__)
class CGMSensor(object):
def __init__(self, params, seed=None):
self._params = params
self.name = params.Name
self.sample_time = params.sample_time
self.seed = seed
self._last_CGM = 0
@classmethod
def withName(cls, name, sensor_para_file, **kwargs):
sensor_params = pd.read_csv(sensor_para_file)
params = sensor_params.loc[sensor_params.Name == name].squeeze()
return cls(params, **kwargs)
def measure(self, patient):
if patient.t % self.sample_time == 0:
BG = patient.observation.Gsub
CGM = BG + next(self._noise_generator)
CGM = max(CGM, self._params["min"])
CGM = min(CGM, self._params["max"])
self._last_CGM = CGM
return CGM
# Zero-Order Hold
return self._last_CGM
@property
def seed(self):
return self._seed
@seed.setter
def seed(self, seed):
self._seed = seed
self._noise_generator = CGMNoise(self._params, seed=seed)
def reset(self):
logger.debug('Resetting CGM sensor ...')
self._noise_generator = CGMNoise(self._params, seed=self.seed)
self._last_CGM = 0
if __name__ == '__main__':
pass
| [((6, 9, 6, 36), 'logging.getLogger', 'logging.getLogger', ({(6, 27, 6, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((19, 24, 19, 53), 'pandas.read_csv', 'pd.read_csv', ({(19, 36, 19, 52): 'sensor_para_file'}, {}), '(sensor_para_file)', True, 'import pandas as pd\n')] |
carlabguillen/spack | var/spack/repos/builtin/packages/thepeg/package.py | 7070bb892f9bdb5cf9e76e0eecd64f6cc5f4695c | # Copyright 2013-2020 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 Thepeg(AutotoolsPackage):
"""Toolkit for High Energy Physics Event Generation"""
homepage = "http://home.thep.lu.se/~leif/ThePEG/"
url = "https://thepeg.hepforge.org/downloads/?f=ThePEG-2.2.1.tar.bz2"
# The commented out versions exist, but may need patches
# and/or recipe changes
version('2.2.1', sha256='63abc7215e6ad45c11cf9dac013738e194cc38556a8368b850b70ab1b57ea58f')
version('2.2.0', sha256='d3e1474811b7d9f61a4a98db1e9d60d8ef8f913a50de4cae4dc2cc4f98e6fbf8')
# version('2.1.7', sha256='2e15727afc1fbfb158fa42ded31c4b1e5b51c25ed6bb66a38233e1fc594329c8')
version('2.1.6', sha256='c1e51f83716bfca815b55100fbab3805ef5f9b9215e4373b22762693f5353f4f')
version('2.1.5', sha256='c61a00fb6cf406f0f98e8c934683d8d5efcb655747842113abc92e9526e4b5e6')
# version('2.1.4', sha256='400c37319aa967ed993fdbec84fc65b24f6cb3779fb1b173d7f5d7a56b772df5')
version('2.1.3', sha256='16e8f6507530c2b80ed873ad22946efefed7355d15c7026f3465f18acebc1c0c')
# version('2.1.2', sha256='6a0f675a27e10863d495de069f25b892e532beb32e9cbfe5a58317d015387f49')
version('2.1.1', sha256='e1b0bdc116fbc9a6e598b601f2aa670530cf2e1cd46b4572814a9b0130b10281')
# version('2.1.0', sha256='fe6e7740ce3cd4a3ce3d7a0079a16c9214ad18f432e29d034ae763bfc40f3d39')
# version('2.0.4', sha256='f3b625b411667e2708995f1d1379b5b8691406853c8c2cca2f4e4e6e062da0e4')
# version('2.0.3', sha256='c57ba68fbfda06a0ba256e06f276f91434bf2529a13f6287c051a4cd6da44634')
# version('2.0.2', sha256='d4249e019543d5c7520733292d2edfb0bdd9733177200a63837781ed6194789b')
# version('2.0.1', sha256='ec284abdc82ceaf10a8736f908e7955f49f872b79aaa62d22aa33bc5c7679bdb')
# version('2.0.0', sha256='571730cc956027dc82780dc04ef6e7382ab5ea853fcfebe259e488c6df302a04')
version('1.9.2', sha256='ff7bbb256866f994dae04ade1f57c92d2670edaac3df11c9a300419a5343faf4')
# version('1.9.1', sha256='8ec6d0669eba51e308be4e33aeb219999418170eae3aad93ec1491c942c2a4e9')
version('1.9.0', sha256='3ee58e5e3a26184567df1b9a10ca70df228e86f322e72f018dd7d8d5a4700a5d')
version('1.8.3', sha256='55ede3a3dd0bd07b90d0d49cf7ae28c18cd965780fdf53528508b97d57152fc7')
# version('1.8.2', sha256='44ccd0d70e42bb6ecd801a51bade6c25b3953c56f33017402d4f52ee6492dffa')
# version('1.8.1', sha256='84c2a212a681545cddd541dca191eb65d96f41df86c87480b6f4f7d4f9683562')
# version('1.8.0', sha256='4b22fda1078f410b999a23a17f611c9ae3a7f0f4cee4e83dc82c9336b7adf037')
# version('1.7.3', sha256='066d5df74118d6e984bb60e1c0bea08a8edcbcf917d83d8bc32ec6fea0726187')
# version('1.7.2', sha256='3b885c6c5a39b7399ccd45d1f5a866b7a65c96174a56a7ff4ae423347843d013')
# version('1.7.1', sha256='13434dc7a8623cacb94c0b5c8d7e15b4c5d5187fe9322d1afc1c91b2c940102e')
# version('1.7.0', sha256='40eb7196139a8bf4c35f5bb69818135943d534457df64aeb1cf60b6621435312')
# version('1.6.1', sha256='5bc074b78f8b663a6a33df9c94dcaa3100269f8da59f9553a565298e55af270f')
# version('1.6.0', sha256='c0ac06b70f3e8046fce4e49ba5916c9b49450f528d0e25f8f7f1427c62fec680')
# version('1.5.0', sha256='ccbf102cf1d350a21487518d12e7e03e6e50010e5604f0201f256fa46a7a50c2')
# version('1.4.2', sha256='40444304e40e07fd417a8ebf8e5c1cf07e895ceac52ef4f7c1eecc911f6f775c')
# version('1.4.1', sha256='156d06fd1ce68466d1f2adb9cc13f412b8b87073ec6a1d02102b173c34c29b8a')
# version('1.4.0', sha256='b1f55e9a3bec713e9abf2fe71c5bd8cf8df936ea00b09f96df9123d0d5ab233f')
# version('1.3.0', sha256='f731ebf3ce5a52b6d750d6e3c282fdc74d8ffd78bccb47b68f10a4daf44c7045')
patch('thepeg-1.8.3.patch', when='@1.8.3', level=0)
patch('thepeg-1.9.0.patch', when='@1.9.0', level=0)
patch('thepeg-1.9.2.patch', when='@1.9.2', level=0)
patch('thepeg-2.1.1.patch', when='@2.1.1:2.2.1', level=0)
depends_on('gsl')
depends_on('lhapdf')
depends_on('lhapdf@:6.2.999', when='@:1.9.999')
depends_on('hepmc', when='hepmc=2')
depends_on('hepmc3', when='hepmc=3')
conflicts('hepmc=3', when='@:2.1.999', msg='HepMC3 support was added in 2.2.0')
depends_on('fastjet', when='@2.0.0:')
depends_on('rivet', when='@2.0.3:')
depends_on('boost', when='@2.1.1:')
depends_on('autoconf', type='build')
depends_on('automake', type='build')
depends_on('libtool', type='build')
depends_on('m4', type='build')
variant('hepmc', default='2', values=('2', '3'), description='HepMC interface to build ')
install_targets = ['install-strip']
def configure_args(self):
args = ['--with-gsl=' + self.spec['gsl'].prefix, '--without-javagui']
if self.spec.satisfies('@:1.8.999'):
args += ['--with-LHAPDF=' + self.spec['lhapdf'].prefix]
else:
args += ['--with-lhapdf=' + self.spec['lhapdf'].prefix]
if self.spec.satisfies('hepmc=2'):
args += ['--with-hepmc=' + self.spec['hepmc'].prefix]
else:
args += ['--with-hepmc=' + self.spec['hepmc3'].prefix]
if self.spec.satisfies('@2.2.0:'):
args += ['--with-hepmcversion=' +
self.spec.variants['hepmc'].value]
if self.spec.satisfies('@2.0.0:'):
args += ['--with-fastjet=' + self.spec['fastjet'].prefix]
if self.spec.satisfies('@2.0.3:'):
args += ['--with-rivet=' + self.spec['rivet'].prefix]
if self.spec.satisfies('@:2.1.999'):
args += ['--with-boost=' + self.spec['boost'].prefix]
args += ['CFLAGS=-O2', 'CXXFLAGS=-O2', 'FFLAGS=-O2']
return args
| [] |
wfu8/lightwave | vmca/python/get_cert.py | cf6a7417cd9807bfcf9bcd99c43c5b2eecf2d298 | #!/usr/bin/env python
#
# Copyright © 2012-2016 VMware, Inc. 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.
#
# Helper function that gets certificates from VMWare Certificate Authority
# More details. If this module can be used as a main program, include usage information.
""" certool.py : This is the standard library function for
cloudVM/vcenterwindows first boot to integrate with
VMCA Certificate Generation.
if not running under a cloudVM, then it is assumed that
the OS.Environment has the following defined.
VMWARE_SKIP_VISL = True
system.urlhostname
vmdir.ldu-guid
system.hostname.type
vmca.cert.password
vmca.cert.dir
"""
__copyright__ = "Copyright 2012, VMware Inc."
__version__ = 0.1
__author__ = "VMware, Inc."
import logging
import os
import subprocess
class CerTool:
__vislInstall__ = ""
__systemUrlHostname__ = ""
__systemHosttype__ = ""
__vmcaPassword__ = ""
__vmcaCertPath__ = ""
__skipInstallParams__ = False
__certfileName__ = ""
__privateKeyFileName__ = ""
__publicKeyFileName__ = ""
__pfxFileName__ = ""
def __init__(self):
self.FindEnvParams()
self.GetVislParams()
def GetHostName(self):
return self.__systemUrlHostname__
def GetHostType(self):
return self.__systemHosttype__
def GetPassword(self):
return self.__vmcaPassword__
def GetCertDir(self):
return self.__vmcaCertPath__
def GetCertFileName(self):
return self.__certfileName__
def GetPrivateKeyFileName(self):
return self.__privateKeyFile__
def GetPublicKeyFileName(self):
return self.__publicKeyFile__
def GetPfxFileName(self):
return self.__pfxFileName__
def GenCert(self, componentName):
""" Generates the Certificates in the Cert directory"""
# Generate full file names for all artifacts
self.__certfileName__ = \
os.path.join(self.GetCertDir(), componentName, componentName + ".crt")
logging.debug("cert File Name : " + self.GetCertFileName())
self.__privateKeyFile__ = \
os.path.join(self.GetCertDir(), componentName, componentName + ".priv")
logging.debug("Private Key Name : " + self.GetPrivateKeyFileName())
self.__publicKeyFile__ = \
os.path.join(self.GetCertDir(), componentName, componentName + ".pub")
logging.debug("Public Key Name : " + self.GetPublicKeyFileName())
self.__pfxFileName__ = \
os.path.join(self.GetCertDir(), componentName, componentName + ".pfx")
logging.debug("pfx file Name : " + self.GetPfxFileName())
dir = os.path.join(self.GetCertDir(),componentName)
logging.debug("Target Dir : " + dir)
try:
if not os.path.exists(dir):
os.makedirs(dir)
logging.debug("Created directory")
except OSError as e:
raise Exception("I/O error({0}): {1}".format(e.errno, e.strerror))
# Generate Private Key and Public Keys First
cmd = [self.GetCertToolPath(),
'--genkey',
'--priv=' + self.GetPrivateKeyFileName(),
'--pub=' + self.GetPublicKeyFileName()]
output = self.RunCmd(cmd)
logging.info(output)
cmd = [self.GetCertToolPath(),
'--genCIScert',
'--priv=' + self.GetPrivateKeyFileName(),
'--cert=' + self.GetCertFileName(),
'--Name=' + componentName]
# if we know the host name, put that into the certificate
if (self.GetHostType() == 'fqdn'):
cmd.append('--FQDN=' + self.GetHostName())
# elif (self.GetHostType() == 'ipv4'):
# # Possible TODO : support IPv4 in certificates
# elif (self.GetHostType() == 'ipv6'):
# # Possible TODO : support IPv6 in certificates
output = self.RunCmd(cmd)
logging.info(output)
# TODO : Replace this with certool PKCS12 capabilities
cmd = [self.GetOpenSSLPath(),
'pkcs12',
'-export',
'-in',
self.GetCertFileName(),
'-inkey',
self.GetPrivateKeyFileName(),
'-out',
self.GetPfxFileName(),
'-name',
componentName,
'-passout',
'pass:' + self.GetPassword()]
output = self.RunCmd(cmd)
logging.info(output)
def FindEnvParams(self):
""" Finds the Default Environment parameters. if you are
not running inside the cloudVM, set VMWARE_SKIP_VISL = True
in your environment. This will enable this script to look
for values in the env. block instead of VISL namespace."""
# Find VISL Install Parameter
INSTALL_PARAM_ENV_VAR = 'VMWARE_INSTALL_PARAMETER'
VMWARE_SKIP_VISL = 'VMWARE_SKIP_VISL'
if INSTALL_PARAM_ENV_VAR in os.environ:
self.__vislInstall__ = os.environ[INSTALL_PARAM_ENV_VAR]
if VMWARE_SKIP_VISL in os.environ:
skip = os.environ[VMWARE_SKIP_VISL]
if (skip in ['true', 'True', 'yes', '1', 'skip']):
self.__skipInstallParams__ = True
if (not self.__vislInstall__ and self.__skipInstallParams__ is False):
errString = 'Unable to find install param script'
logging.error(errString)
raise Exception(errString)
logging.debug('Using install param script : ' + self.__vislInstall__)
def GetInstallParams(self, key):
""" Waits on Install Parameter to return the value from visl.
Or if the VMWARE_SKIP_VISL = True, then reads the value from
the os environment"""
if (self.__skipInstallParams__ is False):
cmd = [self.__vislInstall__, '-d', key]
output = self.RunCmd(cmd)
logging.debug('Install param found :' + output)
return output
else:
if val in os.environ:
param = os.environ[key]
logging.debug('Env. param found : ' + param)
return param
else:
raise Exception('Requested Value not found in Env : ' + key)
def RunCmd(self, args):
""" Runs a given command"""
logging.info('running %s' % args)
p = subprocess.Popen(args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
if p.returncode:
raise Exception('Failed to execute last cmd')
else:
return p.communicate()[0].rstrip()
def GetVislParams(self):
""" Waits for all VISL parameters that VMCA certool needs"""
INSTALL_PARAM_SYSTEM_URL_HOSTNAME = "system.urlhostname"
INSTALL_PARAM_LDU_GUID = "vmdir.ldu-guid"
INSTALL_PARAM_SYSTEM_HOST_TYPE = "system.hostname.type"
INSTALL_PARAM_PASSWORD = "vmca.cert.password"
INSTALL_PARAM_CERT_DIR = "vmca.cert.dir"
# Please note that each of this is a blocking call.
# VISL will wait until these value are populated by the
# appropriate Script
self.__systemUrlHostname__ = \
self.GetInstallParams(INSTALL_PARAM_SYSTEM_URL_HOSTNAME)
self.__systemHosttype__ = \
self.GetInstallParams(INSTALL_PARAM_SYSTEM_HOST_TYPE)
self.__vmcaPassword__ = \
self.GetInstallParams(INSTALL_PARAM_PASSWORD)
self.__vmcaCertPath__ = \
self.GetInstallParams(INSTALL_PARAM_CERT_DIR)
# We really don't need this value,
# it is a technique on waiting for directory
# first boot to finish.
discardldu = self.GetInstallParams(INSTALL_PARAM_LDU_GUID)
def GetCertToolPath(self):
"""returns the path to certool"""
#TODO : Publish Certool Path from VMCA First Boot
if(os.name == "nt"):
PROGRAM_FILES = os.environ['PROGRAMFILES']
return os.path.normpath(PROGRAM_FILES +
'/VMware/CIS/Vmcad/certool.exe')
elif (os.name == 'posix'):
return '/opt/vmware/bin/certool'
def GetOpenSSLPath(self):
if(os.name == "nt"):
PROGRAM_FILES = os.environ['PROGRAMFILES']
return os.path.normpath(PROGRAM_FILES +
'/VMware/CIS/OpenSSL/openssl.exe')
elif (os.name == 'posix'):
return '/usr/lib/vmware-openSSL/openssl'
def main():
""" Example Code Usage """
testComponent = 'sso'
VmcaCertool = CerTool()
VmcaCertool.GenCert(testComponent)
print 'Generated a pfx file : %s' % VmcaCertool.GetPfxFileName()
print 'Using Password : %s' % VmcaCertool.GetPassword()
if __name__ == "__main__":
main()
| [] |
sisisin/pulumi-gcp | sdk/python/pulumi_gcp/securitycenter/notification_config.py | af6681d70ea457843409110c1324817fe55f68ad | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._inputs import *
__all__ = ['NotificationConfigArgs', 'NotificationConfig']
@pulumi.input_type
class NotificationConfigArgs:
def __init__(__self__, *,
config_id: pulumi.Input[str],
organization: pulumi.Input[str],
pubsub_topic: pulumi.Input[str],
streaming_config: pulumi.Input['NotificationConfigStreamingConfigArgs'],
description: Optional[pulumi.Input[str]] = None):
"""
The set of arguments for constructing a NotificationConfig resource.
:param pulumi.Input[str] config_id: This must be unique within the organization.
:param pulumi.Input[str] organization: The organization whose Cloud Security Command Center the Notification
Config lives in.
:param pulumi.Input[str] pubsub_topic: The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
:param pulumi.Input['NotificationConfigStreamingConfigArgs'] streaming_config: The config for triggering streaming-based notifications.
Structure is documented below.
:param pulumi.Input[str] description: The description of the notification config (max of 1024 characters).
"""
pulumi.set(__self__, "config_id", config_id)
pulumi.set(__self__, "organization", organization)
pulumi.set(__self__, "pubsub_topic", pubsub_topic)
pulumi.set(__self__, "streaming_config", streaming_config)
if description is not None:
pulumi.set(__self__, "description", description)
@property
@pulumi.getter(name="configId")
def config_id(self) -> pulumi.Input[str]:
"""
This must be unique within the organization.
"""
return pulumi.get(self, "config_id")
@config_id.setter
def config_id(self, value: pulumi.Input[str]):
pulumi.set(self, "config_id", value)
@property
@pulumi.getter
def organization(self) -> pulumi.Input[str]:
"""
The organization whose Cloud Security Command Center the Notification
Config lives in.
"""
return pulumi.get(self, "organization")
@organization.setter
def organization(self, value: pulumi.Input[str]):
pulumi.set(self, "organization", value)
@property
@pulumi.getter(name="pubsubTopic")
def pubsub_topic(self) -> pulumi.Input[str]:
"""
The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
"""
return pulumi.get(self, "pubsub_topic")
@pubsub_topic.setter
def pubsub_topic(self, value: pulumi.Input[str]):
pulumi.set(self, "pubsub_topic", value)
@property
@pulumi.getter(name="streamingConfig")
def streaming_config(self) -> pulumi.Input['NotificationConfigStreamingConfigArgs']:
"""
The config for triggering streaming-based notifications.
Structure is documented below.
"""
return pulumi.get(self, "streaming_config")
@streaming_config.setter
def streaming_config(self, value: pulumi.Input['NotificationConfigStreamingConfigArgs']):
pulumi.set(self, "streaming_config", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
The description of the notification config (max of 1024 characters).
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@pulumi.input_type
class _NotificationConfigState:
def __init__(__self__, *,
config_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
organization: Optional[pulumi.Input[str]] = None,
pubsub_topic: Optional[pulumi.Input[str]] = None,
service_account: Optional[pulumi.Input[str]] = None,
streaming_config: Optional[pulumi.Input['NotificationConfigStreamingConfigArgs']] = None):
"""
Input properties used for looking up and filtering NotificationConfig resources.
:param pulumi.Input[str] config_id: This must be unique within the organization.
:param pulumi.Input[str] description: The description of the notification config (max of 1024 characters).
:param pulumi.Input[str] name: The resource name of this notification config, in the format
'organizations/{{organization}}/notificationConfigs/{{config_id}}'.
:param pulumi.Input[str] organization: The organization whose Cloud Security Command Center the Notification
Config lives in.
:param pulumi.Input[str] pubsub_topic: The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
:param pulumi.Input[str] service_account: The service account that needs "pubsub.topics.publish" permission to publish to the Pub/Sub topic.
:param pulumi.Input['NotificationConfigStreamingConfigArgs'] streaming_config: The config for triggering streaming-based notifications.
Structure is documented below.
"""
if config_id is not None:
pulumi.set(__self__, "config_id", config_id)
if description is not None:
pulumi.set(__self__, "description", description)
if name is not None:
pulumi.set(__self__, "name", name)
if organization is not None:
pulumi.set(__self__, "organization", organization)
if pubsub_topic is not None:
pulumi.set(__self__, "pubsub_topic", pubsub_topic)
if service_account is not None:
pulumi.set(__self__, "service_account", service_account)
if streaming_config is not None:
pulumi.set(__self__, "streaming_config", streaming_config)
@property
@pulumi.getter(name="configId")
def config_id(self) -> Optional[pulumi.Input[str]]:
"""
This must be unique within the organization.
"""
return pulumi.get(self, "config_id")
@config_id.setter
def config_id(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "config_id", value)
@property
@pulumi.getter
def description(self) -> Optional[pulumi.Input[str]]:
"""
The description of the notification config (max of 1024 characters).
"""
return pulumi.get(self, "description")
@description.setter
def description(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "description", value)
@property
@pulumi.getter
def name(self) -> Optional[pulumi.Input[str]]:
"""
The resource name of this notification config, in the format
'organizations/{{organization}}/notificationConfigs/{{config_id}}'.
"""
return pulumi.get(self, "name")
@name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter
def organization(self) -> Optional[pulumi.Input[str]]:
"""
The organization whose Cloud Security Command Center the Notification
Config lives in.
"""
return pulumi.get(self, "organization")
@organization.setter
def organization(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "organization", value)
@property
@pulumi.getter(name="pubsubTopic")
def pubsub_topic(self) -> Optional[pulumi.Input[str]]:
"""
The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
"""
return pulumi.get(self, "pubsub_topic")
@pubsub_topic.setter
def pubsub_topic(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "pubsub_topic", value)
@property
@pulumi.getter(name="serviceAccount")
def service_account(self) -> Optional[pulumi.Input[str]]:
"""
The service account that needs "pubsub.topics.publish" permission to publish to the Pub/Sub topic.
"""
return pulumi.get(self, "service_account")
@service_account.setter
def service_account(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "service_account", value)
@property
@pulumi.getter(name="streamingConfig")
def streaming_config(self) -> Optional[pulumi.Input['NotificationConfigStreamingConfigArgs']]:
"""
The config for triggering streaming-based notifications.
Structure is documented below.
"""
return pulumi.get(self, "streaming_config")
@streaming_config.setter
def streaming_config(self, value: Optional[pulumi.Input['NotificationConfigStreamingConfigArgs']]):
pulumi.set(self, "streaming_config", value)
class NotificationConfig(pulumi.CustomResource):
@overload
def __init__(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
config_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
organization: Optional[pulumi.Input[str]] = None,
pubsub_topic: Optional[pulumi.Input[str]] = None,
streaming_config: Optional[pulumi.Input[pulumi.InputType['NotificationConfigStreamingConfigArgs']]] = None,
__props__=None):
"""
A Cloud Security Command Center (Cloud SCC) notification configs. A
notification config is a Cloud SCC resource that contains the
configuration to send notifications for create/update events of
findings, assets and etc.
> **Note:** In order to use Cloud SCC resources, your organization must be enrolled
in [SCC Standard/Premium](https://cloud.google.com/security-command-center/docs/quickstart-security-command-center).
Without doing so, you may run into errors during resource creation.
To get more information about NotificationConfig, see:
* [API documentation](https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.notificationConfigs)
* How-to Guides
* [Official Documentation](https://cloud.google.com/security-command-center/docs)
## Example Usage
### Scc Notification Config Basic
```python
import pulumi
import pulumi_gcp as gcp
scc_notification = gcp.pubsub.Topic("sccNotification")
custom_notification_config = gcp.securitycenter.NotificationConfig("customNotificationConfig",
config_id="my-config",
organization="123456789",
description="My custom Cloud Security Command Center Finding Notification Configuration",
pubsub_topic=scc_notification.id,
streaming_config=gcp.securitycenter.NotificationConfigStreamingConfigArgs(
filter="category = \"OPEN_FIREWALL\" AND state = \"ACTIVE\"",
))
```
## Import
NotificationConfig can be imported using any of these accepted formats
```sh
$ pulumi import gcp:securitycenter/notificationConfig:NotificationConfig default organizations/{{organization}}/notificationConfigs/{{name}}
```
```sh
$ pulumi import gcp:securitycenter/notificationConfig:NotificationConfig default {{organization}}/{{name}}
```
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] config_id: This must be unique within the organization.
:param pulumi.Input[str] description: The description of the notification config (max of 1024 characters).
:param pulumi.Input[str] organization: The organization whose Cloud Security Command Center the Notification
Config lives in.
:param pulumi.Input[str] pubsub_topic: The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
:param pulumi.Input[pulumi.InputType['NotificationConfigStreamingConfigArgs']] streaming_config: The config for triggering streaming-based notifications.
Structure is documented below.
"""
...
@overload
def __init__(__self__,
resource_name: str,
args: NotificationConfigArgs,
opts: Optional[pulumi.ResourceOptions] = None):
"""
A Cloud Security Command Center (Cloud SCC) notification configs. A
notification config is a Cloud SCC resource that contains the
configuration to send notifications for create/update events of
findings, assets and etc.
> **Note:** In order to use Cloud SCC resources, your organization must be enrolled
in [SCC Standard/Premium](https://cloud.google.com/security-command-center/docs/quickstart-security-command-center).
Without doing so, you may run into errors during resource creation.
To get more information about NotificationConfig, see:
* [API documentation](https://cloud.google.com/security-command-center/docs/reference/rest/v1/organizations.notificationConfigs)
* How-to Guides
* [Official Documentation](https://cloud.google.com/security-command-center/docs)
## Example Usage
### Scc Notification Config Basic
```python
import pulumi
import pulumi_gcp as gcp
scc_notification = gcp.pubsub.Topic("sccNotification")
custom_notification_config = gcp.securitycenter.NotificationConfig("customNotificationConfig",
config_id="my-config",
organization="123456789",
description="My custom Cloud Security Command Center Finding Notification Configuration",
pubsub_topic=scc_notification.id,
streaming_config=gcp.securitycenter.NotificationConfigStreamingConfigArgs(
filter="category = \"OPEN_FIREWALL\" AND state = \"ACTIVE\"",
))
```
## Import
NotificationConfig can be imported using any of these accepted formats
```sh
$ pulumi import gcp:securitycenter/notificationConfig:NotificationConfig default organizations/{{organization}}/notificationConfigs/{{name}}
```
```sh
$ pulumi import gcp:securitycenter/notificationConfig:NotificationConfig default {{organization}}/{{name}}
```
:param str resource_name: The name of the resource.
:param NotificationConfigArgs args: The arguments to use to populate this resource's properties.
:param pulumi.ResourceOptions opts: Options for the resource.
"""
...
def __init__(__self__, resource_name: str, *args, **kwargs):
resource_args, opts = _utilities.get_resource_args_opts(NotificationConfigArgs, pulumi.ResourceOptions, *args, **kwargs)
if resource_args is not None:
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
else:
__self__._internal_init(resource_name, *args, **kwargs)
def _internal_init(__self__,
resource_name: str,
opts: Optional[pulumi.ResourceOptions] = None,
config_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
organization: Optional[pulumi.Input[str]] = None,
pubsub_topic: Optional[pulumi.Input[str]] = None,
streaming_config: Optional[pulumi.Input[pulumi.InputType['NotificationConfigStreamingConfigArgs']]] = None,
__props__=None):
if opts is None:
opts = pulumi.ResourceOptions()
if not isinstance(opts, pulumi.ResourceOptions):
raise TypeError('Expected resource options to be a ResourceOptions instance')
if opts.version is None:
opts.version = _utilities.get_version()
if opts.id is None:
if __props__ is not None:
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
__props__ = NotificationConfigArgs.__new__(NotificationConfigArgs)
if config_id is None and not opts.urn:
raise TypeError("Missing required property 'config_id'")
__props__.__dict__["config_id"] = config_id
__props__.__dict__["description"] = description
if organization is None and not opts.urn:
raise TypeError("Missing required property 'organization'")
__props__.__dict__["organization"] = organization
if pubsub_topic is None and not opts.urn:
raise TypeError("Missing required property 'pubsub_topic'")
__props__.__dict__["pubsub_topic"] = pubsub_topic
if streaming_config is None and not opts.urn:
raise TypeError("Missing required property 'streaming_config'")
__props__.__dict__["streaming_config"] = streaming_config
__props__.__dict__["name"] = None
__props__.__dict__["service_account"] = None
super(NotificationConfig, __self__).__init__(
'gcp:securitycenter/notificationConfig:NotificationConfig',
resource_name,
__props__,
opts)
@staticmethod
def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
config_id: Optional[pulumi.Input[str]] = None,
description: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
organization: Optional[pulumi.Input[str]] = None,
pubsub_topic: Optional[pulumi.Input[str]] = None,
service_account: Optional[pulumi.Input[str]] = None,
streaming_config: Optional[pulumi.Input[pulumi.InputType['NotificationConfigStreamingConfigArgs']]] = None) -> 'NotificationConfig':
"""
Get an existing NotificationConfig resource's state with the given name, id, and optional extra
properties used to qualify the lookup.
:param str resource_name: The unique name of the resulting resource.
:param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] config_id: This must be unique within the organization.
:param pulumi.Input[str] description: The description of the notification config (max of 1024 characters).
:param pulumi.Input[str] name: The resource name of this notification config, in the format
'organizations/{{organization}}/notificationConfigs/{{config_id}}'.
:param pulumi.Input[str] organization: The organization whose Cloud Security Command Center the Notification
Config lives in.
:param pulumi.Input[str] pubsub_topic: The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
:param pulumi.Input[str] service_account: The service account that needs "pubsub.topics.publish" permission to publish to the Pub/Sub topic.
:param pulumi.Input[pulumi.InputType['NotificationConfigStreamingConfigArgs']] streaming_config: The config for triggering streaming-based notifications.
Structure is documented below.
"""
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = _NotificationConfigState.__new__(_NotificationConfigState)
__props__.__dict__["config_id"] = config_id
__props__.__dict__["description"] = description
__props__.__dict__["name"] = name
__props__.__dict__["organization"] = organization
__props__.__dict__["pubsub_topic"] = pubsub_topic
__props__.__dict__["service_account"] = service_account
__props__.__dict__["streaming_config"] = streaming_config
return NotificationConfig(resource_name, opts=opts, __props__=__props__)
@property
@pulumi.getter(name="configId")
def config_id(self) -> pulumi.Output[str]:
"""
This must be unique within the organization.
"""
return pulumi.get(self, "config_id")
@property
@pulumi.getter
def description(self) -> pulumi.Output[Optional[str]]:
"""
The description of the notification config (max of 1024 characters).
"""
return pulumi.get(self, "description")
@property
@pulumi.getter
def name(self) -> pulumi.Output[str]:
"""
The resource name of this notification config, in the format
'organizations/{{organization}}/notificationConfigs/{{config_id}}'.
"""
return pulumi.get(self, "name")
@property
@pulumi.getter
def organization(self) -> pulumi.Output[str]:
"""
The organization whose Cloud Security Command Center the Notification
Config lives in.
"""
return pulumi.get(self, "organization")
@property
@pulumi.getter(name="pubsubTopic")
def pubsub_topic(self) -> pulumi.Output[str]:
"""
The Pub/Sub topic to send notifications to. Its format is
"projects/[project_id]/topics/[topic]".
"""
return pulumi.get(self, "pubsub_topic")
@property
@pulumi.getter(name="serviceAccount")
def service_account(self) -> pulumi.Output[str]:
"""
The service account that needs "pubsub.topics.publish" permission to publish to the Pub/Sub topic.
"""
return pulumi.get(self, "service_account")
@property
@pulumi.getter(name="streamingConfig")
def streaming_config(self) -> pulumi.Output['outputs.NotificationConfigStreamingConfig']:
"""
The config for triggering streaming-based notifications.
Structure is documented below.
"""
return pulumi.get(self, "streaming_config")
| [((42, 5, 42, 35), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((67, 5, 67, 38), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((80, 5, 80, 42), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((145, 5, 145, 35), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((195, 5, 195, 38), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((208, 5, 208, 41), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((220, 5, 220, 42), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((448, 5, 448, 35), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((482, 5, 482, 38), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((491, 5, 491, 41), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((499, 5, 499, 42), 'pulumi.getter', 'pulumi.getter', (), '', False, 'import pulumi\n'), ((34, 8, 34, 52), 'pulumi.set', 'pulumi.set', ({(34, 19, 34, 27): '__self__', (34, 29, 34, 40): '"""config_id"""', (34, 42, 34, 51): 'config_id'}, {}), "(__self__, 'config_id', config_id)", False, 'import pulumi\n'), ((35, 8, 35, 58), 'pulumi.set', 'pulumi.set', ({(35, 19, 35, 27): '__self__', (35, 29, 35, 43): '"""organization"""', (35, 45, 35, 57): 'organization'}, {}), "(__self__, 'organization', organization)", False, 'import pulumi\n'), ((36, 8, 36, 58), 'pulumi.set', 'pulumi.set', ({(36, 19, 36, 27): '__self__', (36, 29, 36, 43): '"""pubsub_topic"""', (36, 45, 36, 57): 'pubsub_topic'}, {}), "(__self__, 'pubsub_topic', pubsub_topic)", False, 'import pulumi\n'), ((37, 8, 37, 66), 'pulumi.set', 'pulumi.set', ({(37, 19, 37, 27): '__self__', (37, 29, 37, 47): '"""streaming_config"""', (37, 49, 37, 65): 'streaming_config'}, {}), "(__self__, 'streaming_config', streaming_config)", False, 'import pulumi\n'), ((47, 15, 47, 44), 'pulumi.get', 'pulumi.get', ({(47, 26, 47, 30): 'self', (47, 32, 47, 43): '"""config_id"""'}, {}), "(self, 'config_id')", False, 'import pulumi\n'), ((51, 8, 51, 44), 'pulumi.set', 'pulumi.set', ({(51, 19, 51, 23): 'self', (51, 25, 51, 36): '"""config_id"""', (51, 38, 51, 43): 'value'}, {}), "(self, 'config_id', value)", False, 'import pulumi\n'), ((60, 15, 60, 47), 'pulumi.get', 'pulumi.get', ({(60, 26, 60, 30): 'self', (60, 32, 60, 46): '"""organization"""'}, {}), "(self, 'organization')", False, 'import pulumi\n'), ((64, 8, 64, 47), 'pulumi.set', 'pulumi.set', ({(64, 19, 64, 23): 'self', (64, 25, 64, 39): '"""organization"""', (64, 41, 64, 46): 'value'}, {}), "(self, 'organization', value)", False, 'import pulumi\n'), ((73, 15, 73, 47), 'pulumi.get', 'pulumi.get', ({(73, 26, 73, 30): 'self', (73, 32, 73, 46): '"""pubsub_topic"""'}, {}), "(self, 'pubsub_topic')", False, 'import pulumi\n'), ((77, 8, 77, 47), 'pulumi.set', 'pulumi.set', ({(77, 19, 77, 23): 'self', (77, 25, 77, 39): '"""pubsub_topic"""', (77, 41, 77, 46): 'value'}, {}), "(self, 'pubsub_topic', value)", False, 'import pulumi\n'), ((86, 15, 86, 51), 'pulumi.get', 'pulumi.get', ({(86, 26, 86, 30): 'self', (86, 32, 86, 50): '"""streaming_config"""'}, {}), "(self, 'streaming_config')", False, 'import pulumi\n'), ((90, 8, 90, 51), 'pulumi.set', 'pulumi.set', ({(90, 19, 90, 23): 'self', (90, 25, 90, 43): '"""streaming_config"""', (90, 45, 90, 50): 'value'}, {}), "(self, 'streaming_config', value)", False, 'import pulumi\n'), ((98, 15, 98, 46), 'pulumi.get', 'pulumi.get', ({(98, 26, 98, 30): 'self', (98, 32, 98, 45): '"""description"""'}, {}), "(self, 'description')", False, 'import pulumi\n'), ((102, 8, 102, 46), 'pulumi.set', 'pulumi.set', ({(102, 19, 102, 23): 'self', (102, 25, 102, 38): '"""description"""', (102, 40, 102, 45): 'value'}, {}), "(self, 'description', value)", False, 'import pulumi\n'), ((150, 15, 150, 44), 'pulumi.get', 'pulumi.get', ({(150, 26, 150, 30): 'self', (150, 32, 150, 43): '"""config_id"""'}, {}), "(self, 'config_id')", False, 'import pulumi\n'), ((154, 8, 154, 44), 'pulumi.set', 'pulumi.set', ({(154, 19, 154, 23): 'self', (154, 25, 154, 36): '"""config_id"""', (154, 38, 154, 43): 'value'}, {}), "(self, 'config_id', value)", False, 'import pulumi\n'), ((162, 15, 162, 46), 'pulumi.get', 'pulumi.get', ({(162, 26, 162, 30): 'self', (162, 32, 162, 45): '"""description"""'}, {}), "(self, 'description')", False, 'import pulumi\n'), ((166, 8, 166, 46), 'pulumi.set', 'pulumi.set', ({(166, 19, 166, 23): 'self', (166, 25, 166, 38): '"""description"""', (166, 40, 166, 45): 'value'}, {}), "(self, 'description', value)", False, 'import pulumi\n'), ((175, 15, 175, 39), 'pulumi.get', 'pulumi.get', ({(175, 26, 175, 30): 'self', (175, 32, 175, 38): '"""name"""'}, {}), "(self, 'name')", False, 'import pulumi\n'), ((179, 8, 179, 39), 'pulumi.set', 'pulumi.set', ({(179, 19, 179, 23): 'self', (179, 25, 179, 31): '"""name"""', (179, 33, 179, 38): 'value'}, {}), "(self, 'name', value)", False, 'import pulumi\n'), ((188, 15, 188, 47), 'pulumi.get', 'pulumi.get', ({(188, 26, 188, 30): 'self', (188, 32, 188, 46): '"""organization"""'}, {}), "(self, 'organization')", False, 'import pulumi\n'), ((192, 8, 192, 47), 'pulumi.set', 'pulumi.set', ({(192, 19, 192, 23): 'self', (192, 25, 192, 39): '"""organization"""', (192, 41, 192, 46): 'value'}, {}), "(self, 'organization', value)", False, 'import pulumi\n'), ((201, 15, 201, 47), 'pulumi.get', 'pulumi.get', ({(201, 26, 201, 30): 'self', (201, 32, 201, 46): '"""pubsub_topic"""'}, {}), "(self, 'pubsub_topic')", False, 'import pulumi\n'), ((205, 8, 205, 47), 'pulumi.set', 'pulumi.set', ({(205, 19, 205, 23): 'self', (205, 25, 205, 39): '"""pubsub_topic"""', (205, 41, 205, 46): 'value'}, {}), "(self, 'pubsub_topic', value)", False, 'import pulumi\n'), ((213, 15, 213, 50), 'pulumi.get', 'pulumi.get', ({(213, 26, 213, 30): 'self', (213, 32, 213, 49): '"""service_account"""'}, {}), "(self, 'service_account')", False, 'import pulumi\n'), ((217, 8, 217, 50), 'pulumi.set', 'pulumi.set', ({(217, 19, 217, 23): 'self', (217, 25, 217, 42): '"""service_account"""', (217, 44, 217, 49): 'value'}, {}), "(self, 'service_account', value)", False, 'import pulumi\n'), ((226, 15, 226, 51), 'pulumi.get', 'pulumi.get', ({(226, 26, 226, 30): 'self', (226, 32, 226, 50): '"""streaming_config"""'}, {}), "(self, 'streaming_config')", False, 'import pulumi\n'), ((230, 8, 230, 51), 'pulumi.set', 'pulumi.set', ({(230, 19, 230, 23): 'self', (230, 25, 230, 43): '"""streaming_config"""', (230, 45, 230, 50): 'value'}, {}), "(self, 'streaming_config', value)", False, 'import pulumi\n'), ((453, 15, 453, 44), 'pulumi.get', 'pulumi.get', ({(453, 26, 453, 30): 'self', (453, 32, 453, 43): '"""config_id"""'}, {}), "(self, 'config_id')", False, 'import pulumi\n'), ((461, 15, 461, 46), 'pulumi.get', 'pulumi.get', ({(461, 26, 461, 30): 'self', (461, 32, 461, 45): '"""description"""'}, {}), "(self, 'description')", False, 'import pulumi\n'), ((470, 15, 470, 39), 'pulumi.get', 'pulumi.get', ({(470, 26, 470, 30): 'self', (470, 32, 470, 38): '"""name"""'}, {}), "(self, 'name')", False, 'import pulumi\n'), ((479, 15, 479, 47), 'pulumi.get', 'pulumi.get', ({(479, 26, 479, 30): 'self', (479, 32, 479, 46): '"""organization"""'}, {}), "(self, 'organization')", False, 'import pulumi\n'), ((488, 15, 488, 47), 'pulumi.get', 'pulumi.get', ({(488, 26, 488, 30): 'self', (488, 32, 488, 46): '"""pubsub_topic"""'}, {}), "(self, 'pubsub_topic')", False, 'import pulumi\n'), ((496, 15, 496, 50), 'pulumi.get', 'pulumi.get', ({(496, 26, 496, 30): 'self', (496, 32, 496, 49): '"""service_account"""'}, {}), "(self, 'service_account')", False, 'import pulumi\n'), ((505, 15, 505, 51), 'pulumi.get', 'pulumi.get', ({(505, 26, 505, 30): 'self', (505, 32, 505, 50): '"""streaming_config"""'}, {}), "(self, 'streaming_config')", False, 'import pulumi\n'), ((39, 12, 39, 60), 'pulumi.set', 'pulumi.set', ({(39, 23, 39, 31): '__self__', (39, 33, 39, 46): '"""description"""', (39, 48, 39, 59): 'description'}, {}), "(__self__, 'description', description)", False, 'import pulumi\n'), ((130, 12, 130, 56), 'pulumi.set', 'pulumi.set', ({(130, 23, 130, 31): '__self__', (130, 33, 130, 44): '"""config_id"""', (130, 46, 130, 55): 'config_id'}, {}), "(__self__, 'config_id', config_id)", False, 'import pulumi\n'), ((132, 12, 132, 60), 'pulumi.set', 'pulumi.set', ({(132, 23, 132, 31): '__self__', (132, 33, 132, 46): '"""description"""', (132, 48, 132, 59): 'description'}, {}), "(__self__, 'description', description)", False, 'import pulumi\n'), ((134, 12, 134, 46), 'pulumi.set', 'pulumi.set', ({(134, 23, 134, 31): '__self__', (134, 33, 134, 39): '"""name"""', (134, 41, 134, 45): 'name'}, {}), "(__self__, 'name', name)", False, 'import pulumi\n'), ((136, 12, 136, 62), 'pulumi.set', 'pulumi.set', ({(136, 23, 136, 31): '__self__', (136, 33, 136, 47): '"""organization"""', (136, 49, 136, 61): 'organization'}, {}), "(__self__, 'organization', organization)", False, 'import pulumi\n'), ((138, 12, 138, 62), 'pulumi.set', 'pulumi.set', ({(138, 23, 138, 31): '__self__', (138, 33, 138, 47): '"""pubsub_topic"""', (138, 49, 138, 61): 'pubsub_topic'}, {}), "(__self__, 'pubsub_topic', pubsub_topic)", False, 'import pulumi\n'), ((140, 12, 140, 68), 'pulumi.set', 'pulumi.set', ({(140, 23, 140, 31): '__self__', (140, 33, 140, 50): '"""service_account"""', (140, 52, 140, 67): 'service_account'}, {}), "(__self__, 'service_account', service_account)", False, 'import pulumi\n'), ((142, 12, 142, 70), 'pulumi.set', 'pulumi.set', ({(142, 23, 142, 31): '__self__', (142, 33, 142, 51): '"""streaming_config"""', (142, 53, 142, 69): 'streaming_config'}, {}), "(__self__, 'streaming_config', streaming_config)", False, 'import pulumi\n'), ((373, 19, 373, 43), 'pulumi.ResourceOptions', 'pulumi.ResourceOptions', ({}, {}), '()', False, 'import pulumi\n'), ((434, 50, 434, 79), 'pulumi.ResourceOptions', 'pulumi.ResourceOptions', (), '', False, 'import pulumi\n')] |
wwxFromTju/malib | malib/agents/tabular/q_learning/base_tabular_agent.py | 7cd2a4af55cf1f56da8854e26ea7a4f3782ceea2 | from abc import ABCMeta, abstractmethod
import numpy as np
class Agent(object):
__metaclass__ = ABCMeta
def __init__(self, name, id_, action_num, env):
self.name = name
self.id_ = id_
self.action_num = action_num
# len(env.action_space[id_])
# self.opp_action_space = env.action_space[0:id_] + env.action_space[id_:-1]
def set_pi(self, pi):
# assert len(pi) == self.actin_num
self.pi = pi
def done(self, env):
pass
@abstractmethod
def act(self, s, exploration, env):
pass
def update(self, s, a, o, r, s2, env):
pass
@staticmethod
def format_time(n):
return ""
# s = humanfriendly.format_size(n)
# return s.replace(' ', '').replace('bytes', '').replace('byte', '').rstrip('B')
def full_name(self, env):
return "{}_{}_{}".format(env.name, self.name, self.id_)
class StationaryAgent(Agent):
def __init__(self, id_, action_num, env, pi=None):
super().__init__("stationary", id_, action_num, env)
if pi is None:
pi = np.random.dirichlet([1.0] * self.action_num)
self.pi = np.array(pi, dtype=np.double)
StationaryAgent.normalize(self.pi)
def act(self, s, exploration, env):
if self.verbose:
print("pi of agent {}: {}".format(self.id_, self.pi))
return StationaryAgent.sample(self.pi)
@staticmethod
def normalize(pi):
minprob = np.min(pi)
if minprob < 0.0:
pi -= minprob
pi /= np.sum(pi)
@staticmethod
def sample(pi):
return np.random.choice(pi.size, size=1, p=pi)[0]
class RandomAgent(StationaryAgent):
def __init__(self, id_, action_num, env):
assert action_num > 0
super().__init__(id_, env, action_num, pi=[1.0 / action_num] * action_num)
self.name = "random"
| [((44, 18, 44, 47), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((54, 18, 54, 28), 'numpy.min', 'np.min', ({(54, 25, 54, 27): 'pi'}, {}), '(pi)', True, 'import numpy as np\n'), ((57, 14, 57, 24), 'numpy.sum', 'np.sum', ({(57, 21, 57, 23): 'pi'}, {}), '(pi)', True, 'import numpy as np\n'), ((43, 17, 43, 61), 'numpy.random.dirichlet', 'np.random.dirichlet', ({(43, 37, 43, 60): '[1.0] * self.action_num'}, {}), '([1.0] * self.action_num)', True, 'import numpy as np\n'), ((61, 15, 61, 54), 'numpy.random.choice', 'np.random.choice', (), '', True, 'import numpy as np\n')] |
Lonitch/hackerRank | 290.word-pattern.py | 84991b8340e725422bc47eec664532cc84a3447e | #
# @lc app=leetcode id=290 lang=python3
#
# [290] Word Pattern
#
# https://leetcode.com/problems/word-pattern/description/
#
# algorithms
# Easy (35.86%)
# Likes: 825
# Dislikes: 113
# Total Accepted: 164K
# Total Submissions: 455.9K
# Testcase Example: '"abba"\n"dog cat cat dog"'
#
# Given a pattern and a string str, find if str follows the same pattern.
#
# Here follow means a full match, such that there is a bijection between a
# letter in pattern and a non-empty word in str.
#
# Example 1:
#
#
# Input: pattern = "abba", str = "dog cat cat dog"
# Output: true
#
# Example 2:
#
#
# Input:pattern = "abba", str = "dog cat cat fish"
# Output: false
#
# Example 3:
#
#
# Input: pattern = "aaaa", str = "dog cat cat dog"
# Output: false
#
# Example 4:
#
#
# Input: pattern = "abba", str = "dog dog dog dog"
# Output: false
#
# Notes:
# You may assume pattern contains only lowercase letters, and str contains
# lowercase letters that may be separated by a single space.
#
#
# @lc code=start
from collections import defaultdict
class Solution:
def wordPattern(self, pattern: str, str1: str) -> bool:
if len(pattern)!=len(str1.split()):
return False
abmap = defaultdict(str)
bamap = defaultdict(str)
for a,b in zip(pattern, str1.split()):
if abmap[a]=='' and bamap[b]=='':
abmap[a]=b
bamap[b]=a
elif abmap[a]!=b or bamap[b]!=a:
return False
return True
# @lc code=end
| [((57, 16, 57, 32), 'collections.defaultdict', 'defaultdict', ({(57, 28, 57, 31): 'str'}, {}), '(str)', False, 'from collections import defaultdict\n'), ((58, 16, 58, 32), 'collections.defaultdict', 'defaultdict', ({(58, 28, 58, 31): 'str'}, {}), '(str)', False, 'from collections import defaultdict\n')] |
jaschn/dtu_mlops | s1_getting_started/exercise_files/final_exercise/model.py | 59f404cffc756739433b5ccebb46ef6bfd467436 | from torch import nn
class MyAwesomeModel(nn.Module):
def __init__(self):
super().__init__()
self.cnn = nn.Sequential(nn.Conv2d(in_channels=1, out_channels=5, kernel_size=3),
nn.ReLU(),
nn.Conv2d(in_channels=5, out_channels=3, kernel_size=3, stride=2)
)
self.fc = nn.Sequential(nn.Linear(432, 100),
nn.ReLU(),
nn.Linear(100,10),
nn.LogSoftmax(dim=1)
)
def forward(self, x):
x = self.cnn(x).view(x.size(0), -1)
return self.fc(x)
| [((8, 33, 8, 88), 'torch.nn.Conv2d', 'nn.Conv2d', (), '', False, 'from torch import nn\n'), ((9, 32, 9, 41), 'torch.nn.ReLU', 'nn.ReLU', ({}, {}), '()', False, 'from torch import nn\n'), ((10, 32, 10, 97), 'torch.nn.Conv2d', 'nn.Conv2d', (), '', False, 'from torch import nn\n'), ((12, 32, 12, 51), 'torch.nn.Linear', 'nn.Linear', ({(12, 42, 12, 45): '432', (12, 47, 12, 50): '100'}, {}), '(432, 100)', False, 'from torch import nn\n'), ((13, 32, 13, 41), 'torch.nn.ReLU', 'nn.ReLU', ({}, {}), '()', False, 'from torch import nn\n'), ((14, 32, 14, 49), 'torch.nn.Linear', 'nn.Linear', ({(14, 42, 14, 45): '100', (14, 46, 14, 48): '10'}, {}), '(100, 10)', False, 'from torch import nn\n'), ((15, 32, 15, 52), 'torch.nn.LogSoftmax', 'nn.LogSoftmax', (), '', False, 'from torch import nn\n')] |
dreamflyer/musket_core | musket_core/tests/coders_test.py | 1bdf1b4715a3b5c63bf687799d7b977fdf49053f | import unittest
from musket_core import coders
import numpy as np
import pandas as pd
import os
import math
fl=__file__
fl=os.path.dirname(fl)
class TestCoders(unittest.TestCase):
def test_binary_num(self):
a=np.array([0,1,0,1])
bc=coders.get_coder("binary",a, None)
self.assertEqual(bc[0], 0, "should be zero")
self.assertEqual(bc[1], 1, "should be one")
v=bc._decode(np.array([0.6]))
self.assertEqual(v, 1, "should be one")
v=bc._decode(np.array([0.2]))
self.assertEqual(v, 0, "should be zero")
pass
def test_binary_str(self):
a=np.array(["0","1","0","1"])
bc=coders.get_coder("binary",a, None)
self.assertEqual(bc[0], 0, "should be zero")
self.assertEqual(bc[1], 1, "should be one")
v=bc._decode(np.array([0.6]))
self.assertEqual(v, "1", "should be one")
v=bc._decode(np.array([0.2]))
self.assertEqual(v, "0", "should be zero")
pass
def test_binary_str2(self):
a=np.array(["","1","","1"])
bc=coders.get_coder("binary",a, None)
self.assertEqual(bc[0], 0, "should be zero")
self.assertEqual(bc[1], 1, "should be one")
v=bc._decode(np.array([0.6]))
self.assertEqual(v, "1", "should be one")
v=bc._decode(np.array([0.2]))
self.assertEqual(v, "", "should be zero")
pass
def test_binary_bool(self):
a=np.array([True,False,True,False])
bc=coders.get_coder("binary",a, None)
self.assertEqual(bc[0], 1, "should be zero")
self.assertEqual(bc[1], 0, "should be one")
v=bc._decode(np.array([0.6]))
self.assertEqual(v, True, "should be one")
v=bc._decode(np.array([0.2]))
self.assertEqual(v, False, "should be zero")
pass
def test_categorical_num(self):
a=np.array([0,1,2,1])
bc=coders.get_coder("categorical_one_hot",a, None)
self.assertEqual(bc[0][0], True, "should be zero")
self.assertEqual(bc[0][1], False, "should be one")
v=bc._decode(np.array([0.3,0.4,0.45]))
self.assertEqual(v, 2, "should be one")
v=bc._decode(np.array([0.2,0.1,0.1]))
self.assertEqual(v, 0, "should be zero")
pass
def test_categorical_str(self):
a=np.array(["a","b","c","b"])
bc=coders.get_coder("categorical_one_hot",a, None)
self.assertEqual(bc[0][0], True, "should be zero")
self.assertEqual(bc[0][1], False, "should be one")
v=bc._decode(np.array([0.3,0.4,0.45]))
self.assertEqual(v, "c", "should be one")
v=bc._decode(np.array([0.2,0.1,0.1]))
self.assertEqual(v, "a", "should be zero")
pass
def test_categorical_str2(self):
a=np.array(["","b","c","b"])
bc=coders.get_coder("categorical_one_hot",a, None)
self.assertEqual(bc[0][0], True, "should be zero")
self.assertEqual(bc[0][1], False, "should be one")
v=bc._decode(np.array([0.3,0.4,0.45]))
self.assertEqual(v, "c", "should be one")
v=bc._decode(np.array([0.2,0.1,0.1]))
self.assertEqual(v, "", "should be zero")
pass
def test_categorical_pd(self):
a=np.array([math.nan,1,2,1])
bc=coders.get_coder("categorical_one_hot",a, None)
self.assertEqual(bc[0][2], True, "should be zero")
self.assertEqual(bc[0][1], False, "should be one")
v=bc._decode(np.array([0.3,0.4,0.45]))
self.assertEqual(math.isnan(v),True, "should be one")
v=bc._decode(np.array([0.2,0.1,0.1]))
self.assertEqual(v, 1, "should be zero")
pass
def test_multiclass(self):
a=np.array(["1 2","0 2","0",""])
bc=coders.get_coder("multi_class",a, None)
val=bc[0]
self.assertEqual((val==np.array([False,True,True])).sum(), 3,"Fixing format")
for i in range(len(a)):
val=bc[i]
r=bc._decode(val)
self.assertEqual(r, a[i], "Decoding should work also")
pass
def test_multiclass1(self):
a=np.array(["1_2","0_2","0",""])
bc=coders.get_coder("multi_class",a, None)
val=bc[0]
self.assertEqual((val==np.array([False,True,True])).sum(), 3,"Fixing format")
for i in range(len(a)):
val=bc[i]
r=bc._decode(val)
self.assertEqual(r, a[i], "Decoding should work also")
pass
def test_multiclass2(self):
a=np.array(["1","","",""])
bc=coders.get_coder("multi_class",a, None)
val=bc[0]
self.assertEqual((val==np.array([True])).sum(), 1,"Fixing format")
for i in range(len(a)):
val=bc[i]
r=bc._decode(val)
self.assertEqual(r, a[i], "Decoding should work also")
pass | [((10, 3, 10, 22), 'os.path.dirname', 'os.path.dirname', ({(10, 19, 10, 21): 'fl'}, {}), '(fl)', False, 'import os\n'), ((14, 10, 14, 29), 'numpy.array', 'np.array', ({(14, 19, 14, 28): '[0, 1, 0, 1]'}, {}), '([0, 1, 0, 1])', True, 'import numpy as np\n'), ((15, 11, 15, 45), 'musket_core.coders.get_coder', 'coders.get_coder', ({(15, 28, 15, 36): '"""binary"""', (15, 37, 15, 38): 'a', (15, 40, 15, 44): 'None'}, {}), "('binary', a, None)", False, 'from musket_core import coders\n'), ((24, 10, 24, 37), 'numpy.array', 'np.array', ({(24, 19, 24, 36): "['0', '1', '0', '1']"}, {}), "(['0', '1', '0', '1'])", True, 'import numpy as np\n'), ((25, 11, 25, 45), 'musket_core.coders.get_coder', 'coders.get_coder', ({(25, 28, 25, 36): '"""binary"""', (25, 37, 25, 38): 'a', (25, 40, 25, 44): 'None'}, {}), "('binary', a, None)", False, 'from musket_core import coders\n'), ((34, 10, 34, 35), 'numpy.array', 'np.array', ({(34, 19, 34, 34): "['', '1', '', '1']"}, {}), "(['', '1', '', '1'])", True, 'import numpy as np\n'), ((35, 11, 35, 45), 'musket_core.coders.get_coder', 'coders.get_coder', ({(35, 28, 35, 36): '"""binary"""', (35, 37, 35, 38): 'a', (35, 40, 35, 44): 'None'}, {}), "('binary', a, None)", False, 'from musket_core import coders\n'), ((44, 10, 44, 43), 'numpy.array', 'np.array', ({(44, 19, 44, 42): '[True, False, True, False]'}, {}), '([True, False, True, False])', True, 'import numpy as np\n'), ((45, 11, 45, 45), 'musket_core.coders.get_coder', 'coders.get_coder', ({(45, 28, 45, 36): '"""binary"""', (45, 37, 45, 38): 'a', (45, 40, 45, 44): 'None'}, {}), "('binary', a, None)", False, 'from musket_core import coders\n'), ((55, 10, 55, 29), 'numpy.array', 'np.array', ({(55, 19, 55, 28): '[0, 1, 2, 1]'}, {}), '([0, 1, 2, 1])', True, 'import numpy as np\n'), ((56, 11, 56, 58), 'musket_core.coders.get_coder', 'coders.get_coder', ({(56, 28, 56, 49): '"""categorical_one_hot"""', (56, 50, 56, 51): 'a', (56, 53, 56, 57): 'None'}, {}), "('categorical_one_hot', a, None)", False, 'from musket_core import coders\n'), ((67, 10, 67, 37), 'numpy.array', 'np.array', ({(67, 19, 67, 36): "['a', 'b', 'c', 'b']"}, {}), "(['a', 'b', 'c', 'b'])", True, 'import numpy as np\n'), ((68, 11, 68, 58), 'musket_core.coders.get_coder', 'coders.get_coder', ({(68, 28, 68, 49): '"""categorical_one_hot"""', (68, 50, 68, 51): 'a', (68, 53, 68, 57): 'None'}, {}), "('categorical_one_hot', a, None)", False, 'from musket_core import coders\n'), ((79, 10, 79, 36), 'numpy.array', 'np.array', ({(79, 19, 79, 35): "['', 'b', 'c', 'b']"}, {}), "(['', 'b', 'c', 'b'])", True, 'import numpy as np\n'), ((80, 11, 80, 58), 'musket_core.coders.get_coder', 'coders.get_coder', ({(80, 28, 80, 49): '"""categorical_one_hot"""', (80, 50, 80, 51): 'a', (80, 53, 80, 57): 'None'}, {}), "('categorical_one_hot', a, None)", False, 'from musket_core import coders\n'), ((91, 10, 91, 36), 'numpy.array', 'np.array', ({(91, 19, 91, 35): '[math.nan, 1, 2, 1]'}, {}), '([math.nan, 1, 2, 1])', True, 'import numpy as np\n'), ((92, 11, 92, 58), 'musket_core.coders.get_coder', 'coders.get_coder', ({(92, 28, 92, 49): '"""categorical_one_hot"""', (92, 50, 92, 51): 'a', (92, 53, 92, 57): 'None'}, {}), "('categorical_one_hot', a, None)", False, 'from musket_core import coders\n'), ((103, 10, 103, 40), 'numpy.array', 'np.array', ({(103, 19, 103, 39): "['1 2', '0 2', '0', '']"}, {}), "(['1 2', '0 2', '0', ''])", True, 'import numpy as np\n'), ((104, 11, 104, 50), 'musket_core.coders.get_coder', 'coders.get_coder', ({(104, 28, 104, 41): '"""multi_class"""', (104, 42, 104, 43): 'a', (104, 45, 104, 49): 'None'}, {}), "('multi_class', a, None)", False, 'from musket_core import coders\n'), ((115, 10, 115, 40), 'numpy.array', 'np.array', ({(115, 19, 115, 39): "['1_2', '0_2', '0', '']"}, {}), "(['1_2', '0_2', '0', ''])", True, 'import numpy as np\n'), ((116, 11, 116, 50), 'musket_core.coders.get_coder', 'coders.get_coder', ({(116, 28, 116, 41): '"""multi_class"""', (116, 42, 116, 43): 'a', (116, 45, 116, 49): 'None'}, {}), "('multi_class', a, None)", False, 'from musket_core import coders\n'), ((127, 10, 127, 34), 'numpy.array', 'np.array', ({(127, 19, 127, 33): "['1', '', '', '']"}, {}), "(['1', '', '', ''])", True, 'import numpy as np\n'), ((128, 11, 128, 50), 'musket_core.coders.get_coder', 'coders.get_coder', ({(128, 28, 128, 41): '"""multi_class"""', (128, 42, 128, 43): 'a', (128, 45, 128, 49): 'None'}, {}), "('multi_class', a, None)", False, 'from musket_core import coders\n'), ((18, 21, 18, 36), 'numpy.array', 'np.array', ({(18, 30, 18, 35): '[0.6]'}, {}), '([0.6])', True, 'import numpy as np\n'), ((20, 21, 20, 36), 'numpy.array', 'np.array', ({(20, 30, 20, 35): '[0.2]'}, {}), '([0.2])', True, 'import numpy as np\n'), ((28, 21, 28, 36), 'numpy.array', 'np.array', ({(28, 30, 28, 35): '[0.6]'}, {}), '([0.6])', True, 'import numpy as np\n'), ((30, 21, 30, 36), 'numpy.array', 'np.array', ({(30, 30, 30, 35): '[0.2]'}, {}), '([0.2])', True, 'import numpy as np\n'), ((38, 21, 38, 36), 'numpy.array', 'np.array', ({(38, 30, 38, 35): '[0.6]'}, {}), '([0.6])', True, 'import numpy as np\n'), ((40, 21, 40, 36), 'numpy.array', 'np.array', ({(40, 30, 40, 35): '[0.2]'}, {}), '([0.2])', True, 'import numpy as np\n'), ((48, 21, 48, 36), 'numpy.array', 'np.array', ({(48, 30, 48, 35): '[0.6]'}, {}), '([0.6])', True, 'import numpy as np\n'), ((50, 21, 50, 36), 'numpy.array', 'np.array', ({(50, 30, 50, 35): '[0.2]'}, {}), '([0.2])', True, 'import numpy as np\n'), ((60, 21, 60, 45), 'numpy.array', 'np.array', ({(60, 30, 60, 44): '[0.3, 0.4, 0.45]'}, {}), '([0.3, 0.4, 0.45])', True, 'import numpy as np\n'), ((62, 21, 62, 44), 'numpy.array', 'np.array', ({(62, 30, 62, 43): '[0.2, 0.1, 0.1]'}, {}), '([0.2, 0.1, 0.1])', True, 'import numpy as np\n'), ((72, 21, 72, 45), 'numpy.array', 'np.array', ({(72, 30, 72, 44): '[0.3, 0.4, 0.45]'}, {}), '([0.3, 0.4, 0.45])', True, 'import numpy as np\n'), ((74, 21, 74, 44), 'numpy.array', 'np.array', ({(74, 30, 74, 43): '[0.2, 0.1, 0.1]'}, {}), '([0.2, 0.1, 0.1])', True, 'import numpy as np\n'), ((84, 21, 84, 45), 'numpy.array', 'np.array', ({(84, 30, 84, 44): '[0.3, 0.4, 0.45]'}, {}), '([0.3, 0.4, 0.45])', True, 'import numpy as np\n'), ((86, 21, 86, 44), 'numpy.array', 'np.array', ({(86, 30, 86, 43): '[0.2, 0.1, 0.1]'}, {}), '([0.2, 0.1, 0.1])', True, 'import numpy as np\n'), ((96, 21, 96, 45), 'numpy.array', 'np.array', ({(96, 30, 96, 44): '[0.3, 0.4, 0.45]'}, {}), '([0.3, 0.4, 0.45])', True, 'import numpy as np\n'), ((97, 25, 97, 38), 'math.isnan', 'math.isnan', ({(97, 36, 97, 37): 'v'}, {}), '(v)', False, 'import math\n'), ((98, 21, 98, 44), 'numpy.array', 'np.array', ({(98, 30, 98, 43): '[0.2, 0.1, 0.1]'}, {}), '([0.2, 0.1, 0.1])', True, 'import numpy as np\n'), ((107, 31, 107, 58), 'numpy.array', 'np.array', ({(107, 40, 107, 57): '[False, True, True]'}, {}), '([False, True, True])', True, 'import numpy as np\n'), ((119, 31, 119, 58), 'numpy.array', 'np.array', ({(119, 40, 119, 57): '[False, True, True]'}, {}), '([False, True, True])', True, 'import numpy as np\n'), ((131, 31, 131, 47), 'numpy.array', 'np.array', ({(131, 40, 131, 46): '[True]'}, {}), '([True])', True, 'import numpy as np\n')] |
isijara/zulip | manage.py | 403f4dafcc71369f3b1143b9f7073cd5d76bf357 | #!/usr/bin/env python3
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
if __name__ == "__main__":
if 'posix' in os.name and os.geteuid() == 0:
print("manage.py should not be run as root. Use `su zulip` to drop root.")
sys.exit(1)
if (os.access('/etc/zulip/zulip.conf', os.R_OK) and not
os.access('/etc/zulip/zulip-secrets.conf', os.R_OK)):
# The best way to detect running manage.py as another user in
# production before importing anything that would require that
# access is to check for access to /etc/zulip/zulip.conf (in
# which case it's a production server, not a dev environment)
# and lack of access for /etc/zulip/zulip-secrets.conf (which
# should be only readable by root and zulip)
print("Error accessing Zulip secrets; manage.py in production must be run as the zulip user.")
sys.exit(1)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zproject.settings")
from django.conf import settings
from django.core.management import execute_from_command_line
from django.core.management.base import CommandError
from scripts.lib.zulip_tools import log_management_command
log_management_command(" ".join(sys.argv), settings.MANAGEMENT_LOG_PATH)
os.environ.setdefault("PYTHONSTARTUP", os.path.join(BASE_DIR, "scripts/lib/pythonrc.py"))
if "--no-traceback" not in sys.argv and len(sys.argv) > 1:
sys.argv.append("--traceback")
try:
execute_from_command_line(sys.argv)
except CommandError as e:
print(e, file=sys.stderr)
sys.exit(1)
| [((6, 0, 6, 25), 'sys.path.append', 'sys.path.append', ({(6, 16, 6, 24): 'BASE_DIR'}, {}), '(BASE_DIR)', False, 'import sys\n'), ((5, 27, 5, 52), 'os.path.abspath', 'os.path.abspath', ({(5, 43, 5, 51): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((24, 4, 24, 72), 'os.environ.setdefault', 'os.environ.setdefault', ({(24, 26, 24, 50): '"""DJANGO_SETTINGS_MODULE"""', (24, 52, 24, 71): '"""zproject.settings"""'}, {}), "('DJANGO_SETTINGS_MODULE', 'zproject.settings')", False, 'import os\n'), ((12, 8, 12, 19), 'sys.exit', 'sys.exit', ({(12, 17, 12, 18): '(1)'}, {}), '(1)', False, 'import sys\n'), ((13, 8, 13, 51), 'os.access', 'os.access', ({(13, 18, 13, 41): '"""/etc/zulip/zulip.conf"""', (13, 43, 13, 50): 'os.R_OK'}, {}), "('/etc/zulip/zulip.conf', os.R_OK)", False, 'import os\n'), ((22, 8, 22, 19), 'sys.exit', 'sys.exit', ({(22, 17, 22, 18): '(1)'}, {}), '(1)', False, 'import sys\n'), ((32, 43, 32, 92), 'os.path.join', 'os.path.join', ({(32, 56, 32, 64): 'BASE_DIR', (32, 66, 32, 91): '"""scripts/lib/pythonrc.py"""'}, {}), "(BASE_DIR, 'scripts/lib/pythonrc.py')", False, 'import os\n'), ((34, 8, 34, 38), 'sys.argv.append', 'sys.argv.append', ({(34, 24, 34, 37): '"""--traceback"""'}, {}), "('--traceback')", False, 'import sys\n'), ((36, 8, 36, 43), 'django.core.management.execute_from_command_line', 'execute_from_command_line', ({(36, 34, 36, 42): 'sys.argv'}, {}), '(sys.argv)', False, 'from django.core.management import execute_from_command_line\n'), ((10, 30, 10, 42), 'os.geteuid', 'os.geteuid', ({}, {}), '()', False, 'import os\n'), ((14, 12, 14, 63), 'os.access', 'os.access', ({(14, 22, 14, 53): '"""/etc/zulip/zulip-secrets.conf"""', (14, 55, 14, 62): 'os.R_OK'}, {}), "('/etc/zulip/zulip-secrets.conf', os.R_OK)", False, 'import os\n'), ((39, 8, 39, 19), 'sys.exit', 'sys.exit', ({(39, 17, 39, 18): '(1)'}, {}), '(1)', False, 'import sys\n')] |
merwaaan/mr.system | core/scripts/fetch_instructions_specs.py | 0b3ff1b1fd726c6fd525a3f03f361dcac678344a | import json, requests
from bs4 import BeautifulSoup
def fetch():
r = requests.get('http://clrhome.org/table/')
if not r.ok:
print('Cannot fetch {})'.format(r.url))
return None
# remove newlines
text = r.text.replace('\n', '')
# Return the data as a BeautifulSoup object for easy querying
return BeautifulSoup(text, 'html.parser')
def table_title(table):
return 'main' if table['title'] == '' else table['title'].lower()
def parse_tables(page):
return {table_title(table): parse_table(table)
for table in page.find_all('table')}
def parse_table(table):
print('Table {}'.format(table_title(table)))
opcodes = []
for td in table.find_all('td', axis=True):
hi = int(td.parent.find('th').text, 16) # row
lo = td.parent.index(td) - 1 # column
code = hi << 4 | lo
specs = td['axis'].split('|')
# Conditional instructions have different durations depending on how they
# branch so the possible durations are stored in an array. Otherwise, the
# duration is just stored as a single value.
cycles = list(map(int, specs[2].split('/'))) if '/' in specs[2] else int(specs[2])
opcodes.append({
'opcode': code,
'mnemonics': normalize(td.text).strip(),
'size': int(specs[1]),
'cycles': cycles,
'flags': specs[0],
'description': specs[3]
})
print(' {}: {}'.format(hex(code), td.text))
return opcodes
def normalize(mnemonics):
parts = mnemonics.split(' ')
name = parts[0]
operands = parts[1].split(',') if len(parts) > 1 else []
return '{} {}'.format(name,
','.join(normalize_operand(o, name) for o in operands))
def normalize_operand(operand, instr_name):
# Flag condition
if instr_name in ['jr', 'jp', 'ret', 'call'] and operand in ['c', 'nc', 'z', 'nz', 'po', 'pe', 'p', 'm']:
operand = 'f_' + {
'po': 'np',
'pe': 'p',
'p': 'ns',
'm': 's'
}.get(operand, operand)
# Alt registers
elif operand == 'af\'':
operand = 'af_'
return operand
if __name__ == '__main__':
"""
This scripts fetches the contents of a webpage that contains
nicely formatted data about the Z80 opcodes and outputs it
to JSON.
"""
page = fetch()
if page is not None:
opcodes = parse_tables(page)
with open('opcodes.json', 'w') as output:
json.dump(opcodes, output, indent=2)
| [((6, 6, 6, 47), 'requests.get', 'requests.get', ({(6, 19, 6, 46): '"""http://clrhome.org/table/"""'}, {}), "('http://clrhome.org/table/')", False, 'import json, requests\n'), ((16, 9, 16, 43), 'bs4.BeautifulSoup', 'BeautifulSoup', ({(16, 23, 16, 27): 'text', (16, 29, 16, 42): '"""html.parser"""'}, {}), "(text, 'html.parser')", False, 'from bs4 import BeautifulSoup\n'), ((95, 6, 95, 42), 'json.dump', 'json.dump', (), '', False, 'import json, requests\n')] |
M-Rod101/django-DefectDojo | unittests/tools/test_intsights_parser.py | 7b09a00b1a526abaf40455c2ddec16aaa06b16e2 | from ..dojo_test_case import DojoTestCase
from dojo.models import Test
from dojo.tools.intsights.parser import IntSightsParser
class TestIntSightsParser(DojoTestCase):
def test_intsights_parser_with_one_critical_vuln_has_one_findings_json(
self):
testfile = open("unittests/scans/intsights/intsights_one_vul.json")
parser = IntSightsParser()
findings = parser.get_findings(testfile, Test())
testfile.close()
self.assertEqual(1, len(findings))
finding = list(findings)[0]
self.assertEqual(
'5c80dbf83b4a3900078b6be6',
finding.unique_id_from_tool)
self.assertEqual(
'HTTP headers weakness in initech.com web server',
finding.title)
self.assertEquals('Critical', finding.severity)
self.assertEquals(
"https://dashboard.intsights.com/#/threat-command/alerts?search=5c80dbf83b4a3900078b6be6",
finding.references)
def test_intsights_parser_with_one_critical_vuln_has_one_findings_csv(
self):
testfile = open("unittests/scans/intsights/intsights_one_vuln.csv")
parser = IntSightsParser()
findings = parser.get_findings(testfile, Test())
testfile.close()
self.assertEqual(1, len(findings))
finding = list(findings)[0]
self.assertEqual(
"mn7xy83finmmth4ja363rci9",
finding.unique_id_from_tool)
self.assertEqual(
"HTTP headers weakness in company-domain.com web server",
finding.title)
def test_intsights_parser_with_many_vuln_has_many_findings_json(self):
testfile = open("unittests/scans/intsights/intsights_many_vul.json")
parser = IntSightsParser()
findings = parser.get_findings(testfile, Test())
testfile.close()
self.assertEqual(3, len(findings))
def test_intsights_parser_with_many_vuln_has_many_findings_csv(self):
testfile = open("unittests/scans/intsights/intsights_many_vuln.csv")
parser = IntSightsParser()
findings = parser.get_findings(testfile, Test())
testfile.close()
self.assertEqual(9, len(findings))
def test_intsights_parser_invalid_text_with_error_csv(self):
with self.assertRaises(ValueError):
testfile = open(
"unittests/scans/intsights/intsights_invalid_file.txt")
parser = IntSightsParser()
findings = parser.get_findings(testfile, Test())
| [((10, 17, 10, 34), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ({}, {}), '()', False, 'from dojo.tools.intsights.parser import IntSightsParser\n'), ((32, 17, 32, 34), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ({}, {}), '()', False, 'from dojo.tools.intsights.parser import IntSightsParser\n'), ((48, 17, 48, 34), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ({}, {}), '()', False, 'from dojo.tools.intsights.parser import IntSightsParser\n'), ((55, 17, 55, 34), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ({}, {}), '()', False, 'from dojo.tools.intsights.parser import IntSightsParser\n'), ((11, 49, 11, 55), 'dojo.models.Test', 'Test', ({}, {}), '()', False, 'from dojo.models import Test\n'), ((33, 49, 33, 55), 'dojo.models.Test', 'Test', ({}, {}), '()', False, 'from dojo.models import Test\n'), ((49, 49, 49, 55), 'dojo.models.Test', 'Test', ({}, {}), '()', False, 'from dojo.models import Test\n'), ((56, 49, 56, 55), 'dojo.models.Test', 'Test', ({}, {}), '()', False, 'from dojo.models import Test\n'), ((64, 21, 64, 38), 'dojo.tools.intsights.parser.IntSightsParser', 'IntSightsParser', ({}, {}), '()', False, 'from dojo.tools.intsights.parser import IntSightsParser\n'), ((65, 53, 65, 59), 'dojo.models.Test', 'Test', ({}, {}), '()', False, 'from dojo.models import Test\n')] |
sktollman/p4c | tools/testutils.py | 380830f6c26135d1d65e1312e3ba2da628c18145 | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
# Copyright 2018 VMware, Inc.
#
# 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.
""" Defines helper functions for a general testing framework. Used by multiple
Python testing scripts in the backends folder."""
from __future__ import print_function
import subprocess
from subprocess import Popen
from threading import Timer
import sys
import os
TIMEOUT = 10 * 60
SUCCESS = 0
FAILURE = 1
SKIPPED = 2 # used occasionally to indicate that a test was not executed
def is_err(p4filename):
""" True if the filename represents a p4 program that should fail. """
return "_errors" in p4filename
def report_err(file, *message):
""" Write message to given file, report to stderr if verbose """
print("***", file=sys.stderr, *message)
if (file and file != sys.stderr):
err_file = open(file, "a+")
print("***", file=err_file, *message)
err_file.close()
def report_output(file, verbose, *message):
""" Write message to given file, report to stdout if verbose """
if (verbose):
print(file=sys.stdout, *message)
if (file and file != sys.stdout):
out_file = open(file, "a+")
print("", file=out_file, *message)
out_file.close()
def byte_to_hex(byteStr):
""" Convert byte sequences to a hex string. """
return ''.join(["%02X " % ord(x) for x in byteStr]).strip()
def hex_to_byte(hexStr):
""" Convert hex strings to bytes. """
bytes = []
hexStr = ''.join(hexStr.split(" "))
for i in range(0, len(hexStr), 2):
bytes.append(chr(int(hexStr[i:i + 2], 16)))
return ''.join(bytes)
def compare_pkt(outputs, expected, received):
""" Compare two given byte sequences and check if they are the same.
Report errors if this is not the case. """
received = ''.join(byte_to_hex(str(received)).split()).upper()
expected = ''.join(expected.split()).upper()
if len(received) < len(expected):
report_err(outputs["stderr"], "Received packet too short",
len(received), "vs", len(expected))
return FAILURE
for i in range(0, len(expected)):
if expected[i] == "*":
continue
if expected[i] != received[i]:
report_err(outputs["stderr"], "Received packet ", received)
report_err(outputs["stderr"], "Packet different at position", i,
": expected", expected[i], ", received", received[i])
report_err(outputs["stderr"], "Expected packet ", expected)
return FAILURE
return SUCCESS
def open_process(verbose, args, outputs):
""" Run the given arguments as a subprocess. Time out after TIMEOUT
seconds and report failures or stdout. """
report_output(outputs["stdout"],
verbose, "Writing", args)
proc = None
if outputs["stderr"] is not None:
try:
proc = Popen(args, stdout=subprocess.PIPE, shell=True,
stdin=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True)
except OSError as e:
report_err(outputs["stderr"], "Failed executing: ", e)
if proc is None:
# Never even started
report_err(outputs["stderr"], "Process failed to start")
return proc
def run_process(verbose, proc, timeout, outputs, errmsg):
def kill(process):
process.kill()
timer = Timer(TIMEOUT, kill, [proc])
try:
timer.start()
out, err = proc.communicate()
finally:
timer.cancel()
if out:
msg = ("\n########### PROCESS OUTPUT BEGIN:\n"
"%s########### PROCESS OUTPUT END\n" % out)
report_output(outputs["stdout"], verbose, msg)
if proc.returncode != SUCCESS:
report_err(outputs["stderr"], "Error %d: %s\n%s" %
(proc.returncode, errmsg, err))
else:
# Also report non fatal warnings in stdout
if err:
report_err(outputs["stderr"], err)
return proc.returncode
def run_timeout(verbose, args, timeout, outputs, errmsg):
proc = open_process(verbose, args, outputs)
if proc is None:
return FAILURE
report_output(outputs["stdout"],
verbose, "Executing", args)
return run_process(verbose, proc, timeout, outputs, errmsg)
def check_root():
""" This function returns False if the user does not have root privileges.
Caution: Only works on Unix systems """
return (os.getuid() == 0)
| [((116, 12, 116, 40), 'threading.Timer', 'Timer', ({(116, 18, 116, 25): 'TIMEOUT', (116, 27, 116, 31): 'kill', (116, 33, 116, 39): '[proc]'}, {}), '(TIMEOUT, kill, [proc])', False, 'from threading import Timer\n'), ((148, 12, 148, 23), 'os.getuid', 'os.getuid', ({}, {}), '()', False, 'import os\n'), ((102, 19, 104, 49), 'subprocess.Popen', 'Popen', (), '', False, 'from subprocess import Popen\n')] |
BootyAss/bmstu | AlgorithmsAndDataStructures/mod2/Heap.py | bea202cbdff159d3840335b2a2a5c3bd632a7393 | class Heap:
def __init__(self):
self.items = dict() # key - (value, index)
self.indexes = [] # index - key // to know indexes
# Usefull functions
def swap(self, i, j):
x = self.indexes[i] # key of 1 item
y = self.indexes[j] # key of 2 item
# swap keys in index array
self.indexes[i] = y
self.indexes[j] = x
temp = self.items[x][1] # index of 1 item
# swap indexes in dictionary
self.items.update({x: (self.items[x][0], self.items[y][1])})
self.items.update({y: (self.items[y][0], temp)})
def bigger(self, i, j):
if self.indexes[i] <= self.indexes[j]:
return False
else:
return True
# Check family UwU
def hasParent(self, i):
if (i - 1)/2 >= 0:
return True
return False
def parentIndex(self, i):
return int((i - 1)/2)
def hasLeft(self, i):
if i*2 + 1 < len(self.indexes):
return True
return False
def leftIndex(self, i):
return int(i*2 + 1)
def hasRight(self, i):
if i*2 + 2 < len(self.indexes):
return True
return False
def rightIndex(self, i):
return int(i*2 + 2)
# heapifys
def heapifyUp(self, i=None):
if i:
index = i
else:
index = len(self.indexes) - 1
while self.hasParent(index) and self.bigger(self.parentIndex(index), index):
self.swap(self.parentIndex(index), index)
index = self.parentIndex(index)
def heapifyDown(self, i=0):
index = i
while self.hasLeft(index):
smaller = self.leftIndex(index)
if self.hasRight(index) and self.bigger(self.leftIndex(index), self.rightIndex(index)):
smaller = self.rightIndex(index)
if self.bigger(smaller, index):
break
else:
self.swap(index, smaller)
index = smaller
# all needed methods
def add(self, key, data):
if self.items.get(key, None):
raise(Exception)
self.items[key] = (data, int(len(self.indexes)))
self.indexes.append(key)
self.heapifyUp()
def set(self, key, data):
temp = self.items.get(key, None)
if not temp:
raise(Exception)
self.items[key] = (data, temp[1])
def delete(self, key):
temp = self.items.get(key, None)
if not temp:
raise(Exception)
if len(self.indexes) > 1:
lastKey = self.indexes[-1]
last = self.items.get(lastKey, None)
# set last item index of deleted
self.items.update({lastKey: (last[0], temp[1])})
# set key of last item to deleted index
self.indexes[temp[1]] = lastKey
self.indexes.pop()
del self.items[key]
if temp[1] < len(self.indexes): # dont heapify if deleted last element
self.heapifyDown(i=temp[1])
self.heapifyUp(i=temp[1])
def search(self, key):
temp = self.items.get(key, None)
if temp:
print('1', temp[1], temp[0])
else:
print('0')
def min(self):
if len(self.indexes) == 0:
raise(Exception)
key = self.indexes[0]
print(key, '0', self.items[key][0])
def max(self):
if len(self.indexes) == 0:
raise(Exception)
i = int(len(self.indexes)/2)
maxKey = self.indexes[i]
index = i
while i < len(self.indexes):
if maxKey < self.indexes[i]:
maxKey = self.indexes[i]
index = i
i += 1
print(maxKey, index, self.items[maxKey][0])
def extract(self):
if len(self.indexes) == 0:
raise(Exception)
rootKey = self.indexes[0]
rootData = self.items[rootKey][0]
del self.items[rootKey]
if len(self.indexes) > 1:
self.indexes[0] = self.indexes.pop()
# set top item index to 0
self.items.update({self.indexes[0] : (self.items[self.indexes[0]][0], 0)})
self.heapifyDown()
else:
self.indexes.pop()
print(rootKey, rootData)
def print(self):
height = 0
index = 0
out = ''
i = 0
if len(self.indexes) == 0:
out += '_\n'
print('_')
return
while i < len(self.indexes):
lineLen = 1 << height
index += 1
key = self.indexes[i]
out += '[' + str(key) + ' ' + self.items[key][0]
if height != 0:
out += ' ' + str(self.indexes[self.parentIndex(i)])
out += ']'
if index == lineLen:
out += '\n'
index = 0
height += 1
else:
out += ' '
i += 1
if index != 0 and index < lineLen:
out += '_ ' * (lineLen - index)
print(out[0:-1])
else:
print(out, end='')
cycle = True
heap = Heap()
while cycle:
try:
line = input()
cmd = line.split(' ', 2)
try:
if len(cmd) == 1 and cmd[0] == '':
continue
if len(cmd) == 2 and cmd[0] == '' and cmd[1] == '':
continue
if cmd[0] == 'add':
heap.add(int(cmd[1]), cmd[2])
elif cmd[0] == 'set':
heap.set(int(cmd[1]), cmd[2])
elif cmd[0] == 'delete':
heap.delete(int(cmd[1]))
elif cmd[0] == 'search':
heap.search(int(cmd[1]))
elif cmd[0] == 'min':
heap.min()
elif cmd[0] == 'max':
heap.max()
elif cmd[0] == 'extract':
heap.extract()
elif cmd[0] == 'print':
heap.print()
else:
raise(Exception)
except Exception:
print('error')
continue
except Exception:
cycle = False
| [] |
Boondockers-Welcome/django-comments-xtd | django_comments_xtd/tests/test_api_views.py | 8edd68350803bfc351345820ccc4289077918e91 | from __future__ import unicode_literals
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APIRequestFactory, force_authenticate
from django_comments_xtd import django_comments
from django_comments_xtd.api.views import CommentCreate
from django_comments_xtd.tests.models import Article, Diary
request_factory = APIRequestFactory()
def post_comment(data, auth_user=None):
request = request_factory.post(reverse('comments-xtd-api-create'), data)
if auth_user:
force_authenticate(request, user=auth_user)
view = CommentCreate.as_view()
return view(request)
class CommentCreateTestCase(TestCase):
def setUp(self):
patcher = patch('django_comments_xtd.views.send_mail')
self.mock_mailer = patcher.start()
self.article = Article.objects.create(
title="October", slug="october", body="What I did on October...")
self.form = django_comments.get_form()(self.article)
def test_post_returns_2xx_response(self):
data = {"name": "Bob", "email": "[email protected]",
"followup": True, "reply_to": 0, "level": 1, "order": 1,
"comment": "Es war einmal eine kleine...",
"honeypot": ""}
data.update(self.form.initial)
response = post_comment(data)
self.assertEqual(response.status_code, 204)
self.assertEqual(self.mock_mailer.call_count, 1)
def test_post_returns_4xx_response(self):
# It uses an authenticated user, but the user has no mail address.
self.user = User.objects.create_user("bob", "", "pwd")
data = {"name": "", "email": "",
"followup": True, "reply_to": 0, "level": 1, "order": 1,
"comment": "Es war einmal eine kleine...",
"honeypot": ""}
data.update(self.form.initial)
response = post_comment(data, auth_user=self.user)
self.assertEqual(response.status_code, 400)
self.assertTrue('name' in response.data)
self.assertTrue('email' in response.data)
self.assertEqual(self.mock_mailer.call_count, 0)
| [((20, 18, 20, 37), 'rest_framework.test.APIRequestFactory', 'APIRequestFactory', ({}, {}), '()', False, 'from rest_framework.test import APIRequestFactory, force_authenticate\n'), ((27, 11, 27, 34), 'django_comments_xtd.api.views.CommentCreate.as_view', 'CommentCreate.as_view', ({}, {}), '()', False, 'from django_comments_xtd.api.views import CommentCreate\n'), ((24, 35, 24, 69), 'django.urls.reverse', 'reverse', ({(24, 43, 24, 68): '"""comments-xtd-api-create"""'}, {}), "('comments-xtd-api-create')", False, 'from django.urls import reverse\n'), ((26, 8, 26, 51), 'rest_framework.test.force_authenticate', 'force_authenticate', (), '', False, 'from rest_framework.test import APIRequestFactory, force_authenticate\n'), ((33, 18, 33, 62), 'mock.patch', 'patch', ({(33, 24, 33, 61): '"""django_comments_xtd.views.send_mail"""'}, {}), "('django_comments_xtd.views.send_mail')", False, 'from mock import patch\n'), ((35, 23, 36, 77), 'django_comments_xtd.tests.models.Article.objects.create', 'Article.objects.create', (), '', False, 'from django_comments_xtd.tests.models import Article, Diary\n'), ((51, 20, 51, 62), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ({(51, 45, 51, 50): '"""bob"""', (51, 52, 51, 54): '""""""', (51, 56, 51, 61): '"""pwd"""'}, {}), "('bob', '', 'pwd')", False, 'from django.contrib.auth.models import User\n'), ((37, 20, 37, 46), 'django_comments_xtd.django_comments.get_form', 'django_comments.get_form', ({}, {}), '()', False, 'from django_comments_xtd import django_comments\n')] |
szhu3210/LeetCode_Solutions | LC/358.py | 64747eb172c2ecb3c889830246f3282669516e10 | class Solution(object):
def rearrangeString(self, str, k):
"""
:type str: str
:type k: int
:rtype: str
"""
## greedy: count keeps the # of chars, valid keeps the leftmost valid index of a char.
res=[]
# count # of chars
d=collections.defaultdict(int)
for c in str:
d[c]+=1
# create a valid dict
v=collections.defaultdict(int)
# add char one by one, that with max # first, must have valid leftmost index
for i in range(len(str)):
c=None
for key in d:
if (not c or d[key]>d[c]) and d[key]>0 and v[key]<=i: # get c with max # and be valid
c=key
if not c: return ''
res.append(c)
d[c]-=1
v[c]=i+k
return ''.join(res) | [] |
ferdinand-wood/kino_dynamic_opt | momentumopt/python/momentumopt/kinoptpy/momentum_kinematics_optimizer.py | ba6bef170819c55d1d26e40af835a744d1ae663f | '''
@file momentum_kinematics_optimizer.py
@package momentumopt
@author Brahayam Ponton ([email protected])
@license License BSD-3-Clause
@copyright Copyright (c) 2019, New York University and Max Planck Gesellschaft.
@date 2019-10-08
'''
import os
import numpy as np
from momentumopt.kinoptpy.qp import QpSolver
from momentumopt.kinoptpy.inverse_kinematics import PointContactInverseKinematics
from pinocchio import RobotWrapper
import pinocchio as se3
from pinocchio.utils import zero
from pymomentum import *
from momentumopt.quadruped.quadruped_wrapper import QuadrupedWrapper
from momentumopt.kinoptpy.min_jerk_traj import *
from pymomentum import \
PlannerVectorParam_KinematicDefaultJointPositions, \
PlannerIntParam_NumTimesteps, \
PlannerDoubleParam_TimeStep
class Contact(object):
def __init__(self, position, start_time, end_time):
self.pos = position
self.init_time = start_time
self.final_time = end_time
def position(self):
return self.pos
def start_time(self):
return self.init_time
def end_time(self):
return self.final_time
def get_contact_plan(contact_states, effs):
contacts = {}
for i, eff in enumerate(effs):
num_contacts = len(contact_states(i))
contacts[eff] = []
for j in range(num_contacts):
contact_ = contact_states(i)[j]
start_time = contact_.start_time
end_time = contact_.end_time
position = contact_.position
contacts[eff].append(Contact(position, start_time, end_time))
return contacts
def generate_eff_traj(contacts, z_offset):
effs = contacts.keys()
eff_traj_poly = {}
for eff in effs:
cnt = contacts[eff]
num_contacts = len(cnt)
poly_traj = [
PolynominalList(), PolynominalList(), PolynominalList()
]
for i in range(num_contacts):
# Create a constant polynominal for endeffector on the ground.
t = [cnt[i].start_time(), cnt[i].end_time()]
for idx in range(3):
poly_traj[idx].append(t, constant_poly(cnt[i].position()[idx]))
# If there is a contact following, add the transition between
# the two contact points.
if i < num_contacts - 1:
t = [cnt[i].end_time(), cnt[i+1].start_time()]
for idx in range(3):
via = None
if idx == 2:
via = z_offset + cnt[i].position()[idx]
poly = poly_points(t, cnt[i].position()[idx], cnt[i+1].position()[idx], via)
poly_traj[idx].append(t, poly)
eff_traj_poly[eff] = poly_traj
# returns end eff trajectories
return eff_traj_poly
class EndeffectorTrajectoryGenerator(object):
def __init__(self):
self.z_offset = 0.1
def get_z_bound(self, mom_kin_optimizer):
z_max = min(max(mom_kin_optimizer.com_dyn[:, 2]), self.max_bound)
z_min = max(min(mom_kin_optimizer.com_dyn[:, 2]), self.min_bound)
return z_max, z_min
def __call__(self, mom_kin_optimizer):
'''
Computes the endeffector positions and velocities.
Returns endeff_pos_ref, endeff_vel_ref
[0]: endeff_pos_ref: np.array, shape=[num_time_steps, num_eff, 3={x, y, z}]
[1]: endeff_vel_ref: np.array, shape=[num_time_steps, num_eff, 3={x, y, z}]
'''
dt = mom_kin_optimizer.dt
num_eff = len(mom_kin_optimizer.eff_names)
num_time_steps = mom_kin_optimizer.num_time_steps
contacts = get_contact_plan(mom_kin_optimizer.contact_sequence.contact_states,
mom_kin_optimizer.eff_names)
# Generate minimum jerk trajectories
eff_traj_poly = generate_eff_traj(contacts, self.z_offset)
# Compute the endeffector position and velocity trajectories.
endeff_pos_ref = np.zeros((num_time_steps, num_eff, 3))
endeff_vel_ref = np.zeros((num_time_steps, num_eff, 3))
endeff_contact = np.zeros((num_time_steps, num_eff))
for it in range(num_time_steps):
for eff, name in enumerate(mom_kin_optimizer.eff_names):
endeff_pos_ref[it][eff] = [eff_traj_poly[name][i].eval(it * dt) for i in range(3)]
endeff_vel_ref[it][eff] = [eff_traj_poly[name][i].deval(it * dt) for i in range(3)]
# HACK: If the velocity is zero, assume the endeffector is in
# contact with the ground.
if np.all(endeff_vel_ref[it][eff] == 0.):
endeff_contact[it][eff] = 1.
else:
endeff_contact[it][eff] = 0.
return endeff_pos_ref, endeff_vel_ref, endeff_contact
class JointTrajectoryGenerator(object):
def __init__(self):
self.dt =.01
self.num_time_steps = None
self.q_init = None
self.poly_traj = None
def joint_traj(self, q_via):
self.poly_traj = []
for i in range(len(self.q_init)):
self.poly_traj = np.append(self.poly_traj, [PolynominalList()])
for j in range(len(self.q_init)):
for i in range (len(q_via[:,0])+1):
if i==0:
t = [0, q_via[0,0]/self.dt]
poly = poly_points(t, self.q_init[j], q_via[i,j+1])
self.poly_traj[j].append(t, poly)
elif(i==len(q_via[:,0])):
t = [q_via[i-1,0]/self.dt, self.num_time_steps]
poly = poly_points(t, q_via[i-1,j+1], self.q_init[j])
self.poly_traj[j].append(t, poly)
else:
t = [q_via[i-1,0]/self.dt, q_via[i,0]/self.dt]
poly = poly_points(t, q_via[i-1,j+1], q_via[i,j+1])
self.poly_traj[j].append(t, poly)
def eval_traj(self,t):
q = np.zeros((1,len(self.q_init)),float)
for j in range(len(self.q_init)):
q[0,j] = self.poly_traj[j].eval(t)
return np.matrix(q)
class MomentumKinematicsOptimizer(object):
def __init__(self):
self.q_init = None
self.dq_init = None
self.reg_orientation = 1e-2
self.reg_joint_position = 2.
self.joint_des = None
def reset(self):
self.kinematics_sequence = KinematicsSequence()
self.kinematics_sequence.resize(self.planner_setting.get(PlannerIntParam_NumTimesteps),
self.planner_setting.get(PlannerIntParam_NumDofs))
def initialize(self, planner_setting, max_iterations=50, eps=0.001, endeff_traj_generator=None,
RobotWrapper=QuadrupedWrapper):
self.planner_setting = planner_setting
if endeff_traj_generator is None:
endeff_traj_generator = EndeffectorTrajectoryGenerator()
self.endeff_traj_generator = endeff_traj_generator
self.dt = planner_setting.get(PlannerDoubleParam_TimeStep)
self.num_time_steps = planner_setting.get(PlannerIntParam_NumTimesteps)
self.max_iterations = max_iterations
self.eps = eps
self.robot = RobotWrapper()
self.reset()
# Holds dynamics and kinematics results
self.com_dyn = np.zeros((self.num_time_steps, 3))
self.lmom_dyn = np.zeros((self.num_time_steps, 3))
self.amom_dyn = np.zeros((self.num_time_steps, 3))
self.com_kin = np.zeros((self.num_time_steps, 3))
self.lmom_kin = np.zeros((self.num_time_steps, 3))
self.amom_kin = np.zeros((self.num_time_steps, 3))
self.q_kin = np.zeros((self.num_time_steps, self.robot.model.nq))
self.dq_kin = np.zeros((self.num_time_steps, self.robot.model.nv))
self.hip_names = ['{}_HFE'.format(eff) for eff in self.robot.effs]
self.hip_ids = [self.robot.model.getFrameId(name) for name in self.hip_names]
self.eff_names = ['{}_{}'.format(eff, self.robot.joints_list[-1]) for eff in self.robot.effs]
self.inv_kin = PointContactInverseKinematics(self.robot.model, self.eff_names)
self.motion_eff = {
'trajectory': np.zeros((self.num_time_steps, 3 * self.inv_kin.ne)),
'velocity': np.zeros((self.num_time_steps, 3 * self.inv_kin.ne)),
'trajectory_wrt_base': np.zeros((self.num_time_steps, 3 * self.inv_kin.ne)),
'velocity_wrt_base': np.zeros((self.num_time_steps, 3 * self.inv_kin.ne))
}
def fill_data_from_dynamics(self):
# The centroidal information
for it in range(self.num_time_steps):
self.com_dyn[it] = self.dynamic_sequence.dynamics_states[it].com
self.lmom_dyn[it] = self.dynamic_sequence.dynamics_states[it].lmom
self.amom_dyn[it] = self.dynamic_sequence.dynamics_states[it].amom
def fill_endeffector_trajectory(self):
self.endeff_pos_ref, self.endeff_vel_ref, self.endeff_contact = \
self.endeff_traj_generator(self)
def fill_kinematic_result(self, it, q, dq):
def framesPos(frames):
return np.vstack([data.oMf[idx].translation for idx in frames]).reshape(-1)
def framesVel(frames):
return np.vstack([
self.inv_kin.get_world_oriented_frame_jacobian(q, idx).dot(dq)[:3] for idx in frames
]).reshape(-1)
data = self.inv_kin.robot.data
hg = self.inv_kin.robot.centroidalMomentum(q, dq)
# Storing on the internal array.
self.com_kin[it] = self.inv_kin.robot.com(q).T
self.lmom_kin[it] = hg.linear.T
self.amom_kin[it] = hg.angular.T
self.q_kin[it] = q.T
self.dq_kin[it] = dq.T
# The endeffector informations as well.
self.motion_eff['trajectory'][it] = framesPos(self.inv_kin.endeff_ids)
self.motion_eff['velocity'][it] = self.inv_kin.J[6:(self.inv_kin.ne + 2) * 3].dot(dq).T
self.motion_eff['trajectory_wrt_base'][it] = \
self.motion_eff['trajectory'][it] - framesPos(self.hip_ids)
self.motion_eff['velocity_wrt_base'][it] = \
self.motion_eff['velocity'][it] - framesVel(self.hip_ids)
# Storing on the kinematic sequence.
kinematic_state = self.kinematics_sequence.kinematics_states[it]
kinematic_state.com = self.com_kin[it]
kinematic_state.lmom = self.lmom_kin[it]
kinematic_state.amom = self.amom_kin[it]
kinematic_state.robot_posture.base_position = q[:3]
kinematic_state.robot_posture.base_orientation = q[3:7]
kinematic_state.robot_posture.joint_positions = q[7:]
kinematic_state.robot_velocity.base_linear_velocity = dq[:3]
kinematic_state.robot_velocity.base_angular_velocity = dq[3:6]
kinematic_state.robot_velocity.joint_velocities = dq[6:]
def optimize_initial_position(self, init_state):
# Optimize the initial configuration
q = se3.neutral(self.robot.model)
plan_joint_init_pos = self.planner_setting.get(
PlannerVectorParam_KinematicDefaultJointPositions)
if len(plan_joint_init_pos) != self.robot.num_ctrl_joints:
raise ValueError(
'Number of joints in config file not same as required for robot\n' +
'Got %d joints but robot expects %d joints.' % (
len(plan_joint_init_pos), self.robot.num_ctrl_joints))
q[7:] = np.matrix(plan_joint_init_pos).T
q[2] = self.robot.floor_height + 0.32
dq = np.matrix(np.zeros(self.robot.robot.nv)).T
com_ref = init_state.com
lmom_ref = np.zeros(3)
amom_ref = np.zeros(3)
endeff_pos_ref = np.array([init_state.effPosition(i) for i in range(init_state.effNum())])
endeff_vel_ref = np.matrix(np.zeros((init_state.effNum(), 3)))
endeff_contact = np.ones(init_state.effNum())
quad_goal = se3.Quaternion(se3.rpy.rpyToMatrix(np.matrix([0.0, 0, 0.]).T))
q[3:7] = quad_goal.coeffs()
for iters in range(self.max_iterations):
# Adding small P controller for the base orientation to always start with flat
# oriented base.
quad_q = se3.Quaternion(float(q[6]), float(q[3]), float(q[4]), float(q[5]))
amom_ref = 1e-1 * se3.log((quad_goal * quad_q.inverse()).matrix())
res = self.inv_kin.compute(q, dq, com_ref, lmom_ref, amom_ref,
endeff_pos_ref, endeff_vel_ref, endeff_contact, None)
q = se3.integrate(self.robot.model, q, res)
if np.linalg.norm(res) < 1e-3:
print('Found initial configuration after {} iterations'.format(iters + 1))
break
if iters == self.max_iterations - 1:
print('Failed to converge for initial setup.')
print("initial configuration: \n", q)
self.q_init = q.copy()
self.dq_init = dq.copy()
def optimize(self, init_state, contact_sequence, dynamic_sequence, plotting=False):
self.init_state = init_state
self.contact_sequence = contact_sequence
self.dynamic_sequence = dynamic_sequence
self.q_via = None
# Create array with centroidal and endeffector informations.
self.fill_data_from_dynamics()
self.fill_endeffector_trajectory()
# Run the optimization for the initial configuration only once.
if self.q_init is None:
self.optimize_initial_position(init_state)
# Get the desired joint trajectory
# print "num_joint_via:",self.planner_setting.get(PlannerIntParam_NumJointViapoints)
# print "joint_via:",self.planner_setting.get(PlannerCVectorParam_JointViapoints)
# TODO: this is for jump, should go to config file
# q_jump = [1., 0.1, -0.2 ,0.1, -0.2 ,-0.1, 0.2 ,-0.1, 0.2]
# q_via = np.matrix([.75, np.pi/2, -np.pi, np.pi/2, -np.pi, -np.pi/2, np.pi, -np.pi/2, np.pi]).T
# q_max = np.matrix([1.35, .7*np.pi/2, -.7*np.pi, .7*np.pi/2, -.7*np.pi, -.7*np.pi/2, .7*np.pi, -.7*np.pi/2, .7*np.pi]).T
# q_via0 = np.vstack((q_via.T, q_jump))
# self.q_via = np.vstack((q_via0, q_max.T))
joint_traj_gen = JointTrajectoryGenerator()
joint_traj_gen.num_time_steps = self.num_time_steps
joint_traj_gen.q_init = self.q_init[7:]
self.joint_des = np.zeros((len(self.q_init[7:]),self.num_time_steps), float)
if self.q_via is None:
for i in range (self.num_time_steps):
self.joint_des[:,i] = self.q_init[7 : ].T
else:
joint_traj_gen.joint_traj(self.q_via)
for it in range(self.num_time_steps):
self.joint_des[:,it] = joint_traj_gen.eval_traj(it)
# Compute inverse kinematics over the full trajectory.
self.inv_kin.is_init_time = 0
q, dq = self.q_init.copy(), self.dq_init.copy()
for it in range(self.num_time_steps):
quad_goal = se3.Quaternion(se3.rpy.rpyToMatrix(np.matrix([0.0, 0, 0.]).T))
quad_q = se3.Quaternion(float(q[6]), float(q[3]), float(q[4]), float(q[5]))
amom_ref = (self.reg_orientation * se3.log((quad_goal * quad_q.inverse()).matrix()).T + self.amom_dyn[it]).reshape(-1)
joint_regularization_ref = self.reg_joint_position * (np.matrix(self.joint_des[:,it]).T - q[7 : ])
# joint_regularization_ref = self.reg_joint_position * (self.q_init[7 : ] - q[7 : ])
# Fill the kinematics results for it.
self.inv_kin.forward_robot(q, dq)
self.fill_kinematic_result(it, q, dq)
dq = self.inv_kin.compute(
q, dq, self.com_dyn[it], self.lmom_dyn[it], amom_ref,
self.endeff_pos_ref[it], self.endeff_vel_ref[it],
self.endeff_contact[it], joint_regularization_ref)
# Integrate to the next state.
q = se3.integrate(self.robot.model, q, dq * self.dt)
| [((123, 25, 123, 63), 'numpy.zeros', 'np.zeros', ({(123, 34, 123, 62): '(num_time_steps, num_eff, 3)'}, {}), '((num_time_steps, num_eff, 3))', True, 'import numpy as np\n'), ((124, 25, 124, 63), 'numpy.zeros', 'np.zeros', ({(124, 34, 124, 62): '(num_time_steps, num_eff, 3)'}, {}), '((num_time_steps, num_eff, 3))', True, 'import numpy as np\n'), ((125, 25, 125, 60), 'numpy.zeros', 'np.zeros', ({(125, 34, 125, 59): '(num_time_steps, num_eff)'}, {}), '((num_time_steps, num_eff))', True, 'import numpy as np\n'), ((172, 15, 172, 27), 'numpy.matrix', 'np.matrix', ({(172, 25, 172, 26): 'q'}, {}), '(q)', True, 'import numpy as np\n'), ((202, 21, 202, 35), 'pinocchio.RobotWrapper', 'RobotWrapper', ({}, {}), '()', False, 'from pinocchio import RobotWrapper\n'), ((207, 23, 207, 57), 'numpy.zeros', 'np.zeros', ({(207, 32, 207, 56): '(self.num_time_steps, 3)'}, {}), '((self.num_time_steps, 3))', True, 'import numpy as np\n'), ((208, 24, 208, 58), 'numpy.zeros', 'np.zeros', ({(208, 33, 208, 57): '(self.num_time_steps, 3)'}, {}), '((self.num_time_steps, 3))', True, 'import numpy as np\n'), ((209, 24, 209, 58), 'numpy.zeros', 'np.zeros', ({(209, 33, 209, 57): '(self.num_time_steps, 3)'}, {}), '((self.num_time_steps, 3))', True, 'import numpy as np\n'), ((211, 23, 211, 57), 'numpy.zeros', 'np.zeros', ({(211, 32, 211, 56): '(self.num_time_steps, 3)'}, {}), '((self.num_time_steps, 3))', True, 'import numpy as np\n'), ((212, 24, 212, 58), 'numpy.zeros', 'np.zeros', ({(212, 33, 212, 57): '(self.num_time_steps, 3)'}, {}), '((self.num_time_steps, 3))', True, 'import numpy as np\n'), ((213, 24, 213, 58), 'numpy.zeros', 'np.zeros', ({(213, 33, 213, 57): '(self.num_time_steps, 3)'}, {}), '((self.num_time_steps, 3))', True, 'import numpy as np\n'), ((214, 21, 214, 73), 'numpy.zeros', 'np.zeros', ({(214, 30, 214, 72): '(self.num_time_steps, self.robot.model.nq)'}, {}), '((self.num_time_steps, self.robot.model.nq))', True, 'import numpy as np\n'), ((215, 22, 215, 74), 'numpy.zeros', 'np.zeros', ({(215, 31, 215, 73): '(self.num_time_steps, self.robot.model.nv)'}, {}), '((self.num_time_steps, self.robot.model.nv))', True, 'import numpy as np\n'), ((220, 23, 220, 86), 'momentumopt.kinoptpy.inverse_kinematics.PointContactInverseKinematics', 'PointContactInverseKinematics', ({(220, 53, 220, 69): 'self.robot.model', (220, 71, 220, 85): 'self.eff_names'}, {}), '(self.robot.model, self.eff_names)', False, 'from momentumopt.kinoptpy.inverse_kinematics import PointContactInverseKinematics\n'), ((285, 12, 285, 41), 'pinocchio.neutral', 'se3.neutral', ({(285, 24, 285, 40): 'self.robot.model'}, {}), '(self.robot.model)', True, 'import pinocchio as se3\n'), ((300, 19, 300, 30), 'numpy.zeros', 'np.zeros', ({(300, 28, 300, 29): '3'}, {}), '(3)', True, 'import numpy as np\n'), ((301, 19, 301, 30), 'numpy.zeros', 'np.zeros', ({(301, 28, 301, 29): '3'}, {}), '(3)', True, 'import numpy as np\n'), ((223, 26, 223, 78), 'numpy.zeros', 'np.zeros', ({(223, 35, 223, 77): '(self.num_time_steps, 3 * self.inv_kin.ne)'}, {}), '((self.num_time_steps, 3 * self.inv_kin.ne))', True, 'import numpy as np\n'), ((224, 24, 224, 76), 'numpy.zeros', 'np.zeros', ({(224, 33, 224, 75): '(self.num_time_steps, 3 * self.inv_kin.ne)'}, {}), '((self.num_time_steps, 3 * self.inv_kin.ne))', True, 'import numpy as np\n'), ((225, 35, 225, 87), 'numpy.zeros', 'np.zeros', ({(225, 44, 225, 86): '(self.num_time_steps, 3 * self.inv_kin.ne)'}, {}), '((self.num_time_steps, 3 * self.inv_kin.ne))', True, 'import numpy as np\n'), ((226, 33, 226, 85), 'numpy.zeros', 'np.zeros', ({(226, 42, 226, 84): '(self.num_time_steps, 3 * self.inv_kin.ne)'}, {}), '((self.num_time_steps, 3 * self.inv_kin.ne))', True, 'import numpy as np\n'), ((295, 16, 295, 46), 'numpy.matrix', 'np.matrix', ({(295, 26, 295, 45): 'plan_joint_init_pos'}, {}), '(plan_joint_init_pos)', True, 'import numpy as np\n'), ((316, 16, 316, 55), 'pinocchio.integrate', 'se3.integrate', ({(316, 30, 316, 46): 'self.robot.model', (316, 48, 316, 49): 'q', (316, 51, 316, 54): 'res'}, {}), '(self.robot.model, q, res)', True, 'import pinocchio as se3\n'), ((387, 16, 387, 64), 'pinocchio.integrate', 'se3.integrate', ({(387, 30, 387, 46): 'self.robot.model', (387, 48, 387, 49): 'q', (387, 51, 387, 63): 'dq * self.dt'}, {}), '(self.robot.model, q, dq * self.dt)', True, 'import pinocchio as se3\n'), ((134, 19, 134, 56), 'numpy.all', 'np.all', ({(134, 26, 134, 55): '(endeff_vel_ref[it][eff] == 0.0)'}, {}), '(endeff_vel_ref[it][eff] == 0.0)', True, 'import numpy as np\n'), ((297, 23, 297, 52), 'numpy.zeros', 'np.zeros', ({(297, 32, 297, 51): 'self.robot.robot.nv'}, {}), '(self.robot.robot.nv)', True, 'import numpy as np\n'), ((318, 15, 318, 34), 'numpy.linalg.norm', 'np.linalg.norm', ({(318, 30, 318, 33): 'res'}, {}), '(res)', True, 'import numpy as np\n'), ((242, 19, 242, 75), 'numpy.vstack', 'np.vstack', ({(242, 29, 242, 74): '[data.oMf[idx].translation for idx in frames]'}, {}), '([data.oMf[idx].translation for idx in frames])', True, 'import numpy as np\n'), ((305, 55, 305, 78), 'numpy.matrix', 'np.matrix', ({(305, 65, 305, 77): '[0.0, 0, 0.0]'}, {}), '([0.0, 0, 0.0])', True, 'import numpy as np\n'), ((370, 59, 370, 82), 'numpy.matrix', 'np.matrix', ({(370, 69, 370, 81): '[0.0, 0, 0.0]'}, {}), '([0.0, 0, 0.0])', True, 'import numpy as np\n'), ((374, 66, 374, 97), 'numpy.matrix', 'np.matrix', ({(374, 76, 374, 96): 'self.joint_des[:, (it)]'}, {}), '(self.joint_des[:, (it)])', True, 'import numpy as np\n')] |
Addvilz/gullveig | gullveig/web/__init__.py | 6ac5e66062c1b5ea8ad7c66f69be9e3d99ac0825 | import logging
from gullveig import bootstrap_default_logger
# Configure default logging
def _configure_default_web_logger():
logger = logging.getLogger('gullveig-web')
bootstrap_default_logger(logger)
api_logger = logging.getLogger('gullveig-api')
bootstrap_default_logger(api_logger)
aio_logger = logging.getLogger('aiohttp.server')
bootstrap_default_logger(aio_logger)
_configure_default_web_logger()
| [((8, 13, 8, 46), 'logging.getLogger', 'logging.getLogger', ({(8, 31, 8, 45): '"""gullveig-web"""'}, {}), "('gullveig-web')", False, 'import logging\n'), ((9, 4, 9, 36), 'gullveig.bootstrap_default_logger', 'bootstrap_default_logger', ({(9, 29, 9, 35): 'logger'}, {}), '(logger)', False, 'from gullveig import bootstrap_default_logger\n'), ((11, 17, 11, 50), 'logging.getLogger', 'logging.getLogger', ({(11, 35, 11, 49): '"""gullveig-api"""'}, {}), "('gullveig-api')", False, 'import logging\n'), ((12, 4, 12, 40), 'gullveig.bootstrap_default_logger', 'bootstrap_default_logger', ({(12, 29, 12, 39): 'api_logger'}, {}), '(api_logger)', False, 'from gullveig import bootstrap_default_logger\n'), ((14, 17, 14, 52), 'logging.getLogger', 'logging.getLogger', ({(14, 35, 14, 51): '"""aiohttp.server"""'}, {}), "('aiohttp.server')", False, 'import logging\n'), ((15, 4, 15, 40), 'gullveig.bootstrap_default_logger', 'bootstrap_default_logger', ({(15, 29, 15, 39): 'aio_logger'}, {}), '(aio_logger)', False, 'from gullveig import bootstrap_default_logger\n')] |
clockfly/jupterhub_http_authenticator | jupyterhub_http_authenticator/httpauthenticator.py | 88185e4677836129cd1bd15af368b7070103b1bf | import json
import urllib
import os
import jupyterhub
from tornado.httpclient import HTTPRequest, AsyncHTTPClient
from traitlets import Unicode
from jupyterhub.auth import Authenticator
from tornado import gen
class HttpAuthenticator(Authenticator):
server = Unicode(
None,
allow_none=True,
config=True,
help="""
Http authentication server.
"""
)
appid = Unicode(
None,
allow_none=True,
config=True,
help="""
Application Id recognized by the http authentication server
"""
)
@gen.coroutine
def authenticate(self, handler, data):
http_client = AsyncHTTPClient()
headers = {
"Accept": "application/json",
"User-Agent": "JupyterHub",
}
params = dict(
type="json",
appid=self.appid,
ac=data['username'],
pw=data['password']
)
req = HTTPRequest(self.server,
method="POST",
headers=headers,
body=urllib.parse.urlencode(params),
validate_cert = False
)
resp = yield http_client.fetch(req)
reply = json.loads(resp.body.decode('utf8', 'replace'))
if reply.get("code") == 200:
return (reply.get("data").get("UserCN"))
else:
return None
| [((12, 13, 19, 5), 'traitlets.Unicode', 'Unicode', (), '', False, 'from traitlets import Unicode\n'), ((21, 12, 28, 5), 'traitlets.Unicode', 'Unicode', (), '', False, 'from traitlets import Unicode\n'), ((32, 22, 32, 39), 'tornado.httpclient.AsyncHTTPClient', 'AsyncHTTPClient', ({}, {}), '()', False, 'from tornado.httpclient import HTTPRequest, AsyncHTTPClient\n'), ((49, 31, 49, 61), 'urllib.parse.urlencode', 'urllib.parse.urlencode', ({(49, 54, 49, 60): 'params'}, {}), '(params)', False, 'import urllib\n')] |
KushajveerSingh/fastai_without_fastai | src/lr_find.py | 9a7c71b92c49be1e05858dc0e7ce63901c3c1bd2 | import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
# NOT -> ParameterModule
# NOT -> children_and_parameters
# NOT -> flatten_model
# NOT -> lr_range
# NOT -> scheduling functions
# NOT -> SmoothenValue
# YES -> lr_find
# NOT -> plot_lr_find
# NOT TO BE MODIFIED
class ParameterModule(nn.Module):
"Register a lone parameter 'p' in a module"
def __init__(self, p:nn.Parameter):
super().__init__()
self.val = p
def forward(self, x):
return x
# NOT TO BE MODIFIED
# To be used to flatten_model
def children_and_parameters(m:nn.Module):
"Return the children of `m` and its direct parameters not registered in modules."
children = list(m.children())
children_p = sum([[id(p) for p in c.parameters()] for c in m.children()],[])
for p in m.parameters():
if id(p) not in children_p: children.append(ParameterModule(p))
return children
# NOT TO BE MODIFIED
flatten_model = lambda m: sum(map(flatten_model,children_and_parameters(m)),[]) if len(list(m.children())) else [m]
# NOT TO BE MODIFIED
def lr_range(model, lr):
"""
Build differential learning rate from lr. It will give you the
Arguments:
model :- torch.nn.Module
lr :- float or slice
Returns:
Depending upon lr
"""
if not isinstance(lr, slice):
return lr
num_layer = len([nn.Sequential(*flatten_model(model))])
if lr.start:
mult = lr.stop / lr.start
step = mult**(1/(num_layer-1))
res = np.array([lr.start*(step**i) for i in range(num_layer)])
else:
res = [lr.stop/10.]*(num_layer-1) + [lr.stop]
return np.array(res)
# NOT TO BE MODIFIED
# These are the functions that would give us the values of lr. Liks for linearly
# increasing lr we would use annealing_linear.
# You can add your own custom function, for producing lr.
# By defualt annealing_exp is used for both lr and momentum
def annealing_no(start, end, pct:float):
"No annealing, always return `start`."
return start
def annealing_linear(start, end, pct:float):
"Linearly anneal from `start` to `end` as pct goes from 0.0 to 1.0."
return start + pct * (end-start)
def annealing_exp(start, end, pct:float):
"Exponentially anneal from `start` to `end` as pct goes from 0.0 to 1.0."
return start * (end/start) ** pct
def annealing_cos(start, end, pct:float):
"Cosine anneal from `start` to `end` as pct goes from 0.0 to 1.0."
cos_out = np.cos(np.pi * pct) + 1
return end + (start-end)/2 * cos_out
def do_annealing_poly(start, end, pct:float, degree):
return end + (start-end) * (1-pct)**degree
# NOT TO BE MODIFIED
class Stepper():
"""
Used to step from start, end ('vals') over 'n_iter' iterations on a schedule.
We will create a stepper object and then use one of the above annelaing functions,
to step from start lr to end lr.
"""
def __init__(self, vals, n_iter:int, func=None):
self.start, self.end = (vals[0], vals[1]) if isinstance(vals, tuple) else (vals,0)
self.n_iter = max(1, n_iter)
if func is None:
self.func = annealing_linear if isinstance(vals, tuple) else annealing_no
else:
self.func = func
self.n = 0
def step(self):
"Return next value along annealed schedule"
self.n += 1
return self.func(self.start, self.end, self.n/self.n_iter)
@property
def is_done(self)->bool:
"Return 'True' if schedule completed"
return self.n >= self.n_iter
# NOT TO BE MODIFIED
class SmoothenValue():
"Create a smooth moving average for a value (loss, etc) using `beta`."
def __init__(self, beta:float):
self.beta,self.n,self.mov_avg = beta,0,0
def add_value(self, val:float)->None:
"Add `val` to calculate updated smoothed value."
self.n += 1
self.mov_avg = self.beta * self.mov_avg + (1 - self.beta) * val
self.smooth = self.mov_avg / (1 - self.beta ** self.n)
# TO BE MODIFIED IN SOME CASES
def lr_find(data_loader, model, loss_fn, opt, wd:int=0, start_lr:float=1e-7, end_lr:float=10,
num_it:int=100, stop_div:bool=True, smooth_beta:float=0.98, use_gpu:bool=True,
device=torch.device('cuda'), anneal_func=annealing_exp):
"""
The main function that you will call to plot learning_rate vs losses graph. It is
the only function from lr_find.py that you will call. By default it will use GPU. It
assumes your model is already on GPU if you use use_gpu.
Arguments:-
data_loader :- torch.utils.data.DataLoader
model :- torch.nn.Module
loss_fn :- torch.nn.LossFunction
opt :- torch.optim.Optimizer
wd :- weight decay (default=0).
start_lr :- The learning rate from where to start in lr_find (default=1e-7)
end_lr :- The learning rate at which to end lr_find (default=10)
num_it :- Number of iterations for lr_find (default=100)
stop_div :- If the loss diverges, then stop early (default=True)
smooth_beta :- The beta value to smoothen the running avergae of the loss function (default=0.98)
use_gpu :- True (train on GPU) else CPU
anneal_func :- The step function you want to use (default exp)
device :- Torch device to use for training model (default GPU)
Returns:
losses :- list of smoothened version of losses
lrs :- list of all lrs that we test
"""
model.train()
stop = False
flag = False
best_loss = 0.
iteration = 0
losses = []
lrs = []
lrs.append(start_lr)
start_lr = lr_range(model, start_lr)
start_lr = np.array(start_lr) if isinstance(start_lr, (tuple, list)) else start_lr
end_lr = lr_range(model, end_lr)
end_lr = np.array(end_lr) if isinstance(end_lr, (tuple, list)) else end_lr
sched = Stepper((start_lr, end_lr), num_it, anneal_func)
smoothener = SmoothenValue(smooth_beta)
epochs = int(np.ceil(num_it/len(data_loader)))
# save model_dict
model_state = model.state_dict()
opt_state = opt.state_dict()
# Set optimizer learning_rate = start_lr
for group in opt.param_groups:
group['lr'] = sched.start
for i in range(epochs):
for data in data_loader:
opt.zero_grad()
################### TO BE MODIFIED ###################
# Depending on your model, you will have to modify your
# data pipeline and how you give inputs to your model.
inputs, labels = data
if use_gpu:
inputs = inputs.to(device)
labels = labels.to(device)
outputs = model(inputs)
loss = loss_fn(outputs, labels)
#####################################################
if use_gpu:
smoothener.add_value(loss.detach().cpu())
else:
smoothener.add_value(loss.detach())
smooth_loss = smoothener.smooth
losses.append(smooth_loss)
loss.backward()
################### TO BE MODIFIED ###################
# For AdamW. If you want to use Adam, comment these lines
for group in opt.param_groups:
for param in group['params']:
param.data = param.data.add(-wd * group['lr'], param.data)
#####################################################
opt.step()
# Change lr
new_lr = sched.step()
lrs.append(new_lr)
for group in opt.param_groups:
group['lr'] = new_lr
################### TO BE MODIFIED ###################
# You necessarily don't want to change it. But in cases
# when you are maximizing the loss, then you will have
# to change it.
if iteration == 0 or smooth_loss < best_loss:
best_loss = smooth_loss
iteration += 1
if sched.is_done or (stop_div and (smooth_loss > 4*best_loss or torch.isnan(loss))):
flag = True
break
#####################################################
if iteration%10 == 0:
print(f'Iteration: {iteration}')
if flag:
break
# Load state dict
model.load_state_dict(model_state)
opt.load_state_dict(opt_state)
lrs.pop()
print(f'LR Finder is complete.')
return losses, lrs
# NOT TO BE MODIFIED
def plot_lr_find(losses, lrs, skip_start:int=10, skip_end:int=5, suggestion:bool=False, return_fig:bool=None):
"""
It will take the losses and lrs returned by lr_find as input.
Arguments:-
skip_start -> It will skip skip_start lrs from the start
skip_end -> It will skip skip_end lrs from the end
suggestion -> If you want to see the point where the gradient changes most
return_fig -> True then get the fig in the return statement
"""
lrs = lrs[skip_start:-skip_end] if skip_end > 0 else lrs[skip_start:]
losses = losses[skip_start:-skip_end] if skip_end > 0 else losses[skip_start:]
losses = [x.item() for x in losses]
fig, ax = plt.subplots(1, 1)
ax.plot(lrs, losses)
ax.set_ylabel("Loss")
ax.set_xlabel("Learning Rate")
ax.set_xscale('log')
ax.xaxis.set_major_formatter(plt.FormatStrFormatter('%.0e'))
if suggestion:
try:
mg = (np.gradient(np.array(losses))).argmin()
except:
print("Failed to compute the gradients, there might not be enough points.")
return
print(f"Min numerical gradient: {lrs[mg]:.2E}")
ax.plot(lrs[mg], losses[mg], markersize=10, marker='o', color='red')
if return_fig is not None:
return fig
| [((58, 11, 58, 24), 'numpy.array', 'np.array', ({(58, 20, 58, 23): 'res'}, {}), '(res)', True, 'import numpy as np\n'), ((121, 19, 121, 39), 'torch.device', 'torch.device', ({(121, 32, 121, 38): '"""cuda"""'}, {}), "('cuda')", False, 'import torch\n'), ((255, 14, 255, 32), 'matplotlib.pyplot.subplots', 'plt.subplots', ({(255, 27, 255, 28): '1', (255, 30, 255, 31): '1'}, {}), '(1, 1)', True, 'import matplotlib.pyplot as plt\n'), ((76, 14, 76, 33), 'numpy.cos', 'np.cos', ({(76, 21, 76, 32): '(np.pi * pct)'}, {}), '(np.pi * pct)', True, 'import numpy as np\n'), ((156, 15, 156, 33), 'numpy.array', 'np.array', ({(156, 24, 156, 32): 'start_lr'}, {}), '(start_lr)', True, 'import numpy as np\n'), ((158, 13, 158, 29), 'numpy.array', 'np.array', ({(158, 22, 158, 28): 'end_lr'}, {}), '(end_lr)', True, 'import numpy as np\n'), ((260, 33, 260, 63), 'matplotlib.pyplot.FormatStrFormatter', 'plt.FormatStrFormatter', ({(260, 56, 260, 62): '"""%.0e"""'}, {}), "('%.0e')", True, 'import matplotlib.pyplot as plt\n'), ((219, 76, 219, 93), 'torch.isnan', 'torch.isnan', ({(219, 88, 219, 92): 'loss'}, {}), '(loss)', False, 'import torch\n'), ((264, 30, 264, 46), 'numpy.array', 'np.array', ({(264, 39, 264, 45): 'losses'}, {}), '(losses)', True, 'import numpy as np\n')] |
Polidea/SiriusObfuscator | SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py | b0e590d8130e97856afe578869b83a209e2b19be | """
Test the lldb disassemble command on each call frame when stopped on C's ctor.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class IterateFrameAndDisassembleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_and_run_command(self):
"""Disassemble each call frame when stopped on C's constructor."""
self.build()
self.breakOnCtor()
raw_output = self.res.GetOutput()
frameRE = re.compile(r"""
^\s\sframe # heading for the frame info,
.* # wildcard, and
0x[0-9a-f]{16} # the frame pc, and
\sa.out`(.+) # module`function, and
\s\+\s # the rest ' + ....'
""", re.VERBOSE)
for line in raw_output.split(os.linesep):
match = frameRE.search(line)
if match:
function = match.group(1)
#print("line:", line)
#print("function:", function)
self.runCmd("disassemble -n '%s'" % function)
@add_test_categories(['pyapi'])
def test_and_python_api(self):
"""Disassemble each call frame when stopped on C's constructor."""
self.build()
self.breakOnCtor()
# Now use the Python API to get at each function on the call stack and
# disassemble it.
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
thread = lldbutil.get_stopped_thread(
process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
depth = thread.GetNumFrames()
for i in range(depth - 1):
frame = thread.GetFrameAtIndex(i)
function = frame.GetFunction()
# Print the function header.
if self.TraceOn():
print()
print(function)
if function:
# Get all instructions for this function and print them out.
insts = function.GetInstructions(target)
for inst in insts:
# We could simply do 'print inst' to print out the disassembly.
# But we want to print to stdout only if self.TraceOn() is
# True.
disasm = str(inst)
if self.TraceOn():
print(disasm)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break for main.cpp.
self.line = line_number('main.cpp', '// Set break point at this line.')
def breakOnCtor(self):
"""Setup/run the program so it stops on C's constructor."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on the ctor function of class C.
bpno = lldbutil.run_break_set_by_file_and_line(
self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=['stopped',
'stop reason = breakpoint %d.' % (bpno)])
# This test was failing because we fail to put the C:: in front of constructore.
# We should maybe make another testcase to cover that specifically, but we shouldn't
# fail this whole testcase for an inessential issue.
# We should be stopped on the ctor function of class C.
# self.expect("thread backtrace", BACKTRACE_DISPLAYED_CORRECTLY,
# substrs = ['C::C'])
| [((51, 17, 52, 48), 'lldbsuite.test.lldbutil.get_stopped_thread', 'lldbutil.get_stopped_thread', ({(52, 12, 52, 19): 'process', (52, 21, 52, 47): 'lldb.eStopReasonBreakpoint'}, {}), '(process, lldb.eStopReasonBreakpoint)', False, 'from lldbsuite.test import lldbutil\n'), ((85, 15, 86, 67), 'lldbsuite.test.lldbutil.run_break_set_by_file_and_line', 'lldbutil.run_break_set_by_file_and_line', (), '', False, 'from lldbsuite.test import lldbutil\n'), ((81, 27, 81, 38), 'os.getcwd', 'os.getcwd', ({}, {}), '()', False, 'import os\n')] |
irinaid/MAlice | reservedwords.py | 02740d661020866c3927b9ee7ee4523aaaafcb7e | '''
All the reserved, individual words used in MAlice.
'''
A = "a"
ALICE = "Alice"
AND = "and"
ATE = "ate"
BECAME = "became"
BECAUSE = "because"
BUT = "but"
CLOSED = "closed"
COMMA = ","
CONTAINED = "contained"
DOT = "."
DRANK = "drank"
EITHER = "either"
ENOUGH = "enough"
EVENTUALLY = "eventually"
FOUND = "found"
HAD = "had"
HATTA = "hatta"
LETTER = "letter"
LOOKING_GLASS = "looking-glass"
LPAR = "("
MAYBE = "maybe"
NUMBER = "number"
OF = "of"
OPENED = "opened"
OR = "or"
PERHAPS = "perhaps"
PIECE = "piece"
QUESTION = "?"
ROOM = "room"
RPAR = ")"
S = "'s"
SAID = "said"
SENTENCE = "sentence"
SO = "so"
SPIDER = "spider"
SPOKE = "spoke"
THE = "The"
THEN = "then"
TIMES = "times"
TOO = "too"
UNDERSCORE = "_"
UNSURE = "unsure"
WAS = "was"
WHAT = "what"
WHICH = "which"
RESTRICTED = [ A, ALICE, AND, ATE, BECAME ,BECAUSE ,BUT ,CLOSED ,COMMA ,CONTAINED ,DOT ,DRANK ,EITHER ,ENOUGH ,EVENTUALLY ,FOUND ,HAD ,HATTA ,LETTER ,LOOKING_GLASS ,LPAR ,MAYBE ,NUMBER ,OF ,OPENED ,OR ,PERHAPS ,PIECE ,QUESTION ,ROOM ,RPAR ,S ,SAID, SENTENCE ,SO ,SPIDER ,SPOKE ,THE ,THEN ,TIMES ,TOO ,UNDERSCORE ,UNSURE ,WAS ,WHAT ,WHICH]
| [] |
theck17/notes | leetcode/0057_Insert_Interval/result.py | f32f0f4b8f821b1ed38d173ef0913efddd094b91 | # !/usr/bin/env python3
# Author: C.K
# Email: [email protected]
# DateTime:2021-04-12 18:35:15
# Description:
import os
import sys
class Solution:
def insert(self, intervals: List[List[int]],
newInterval: List[int]) -> List[List[int]]:
res, i = [], 0
for interval in intervals:
if interval[1] < newInterval[0]:
res.append(interval)
elif interval[0] > newInterval[1]:
res.append(newInterval)
newInterval = interval
elif interval[1] >= newInterval[0] or newInterval[1] >= interval[0]:
newInterval = [
min(interval[0], newInterval[0]),
max(interval[1], newInterval[1])
]
res.append(newInterval)
return res
if __name__ == "__main__":
pass
| [] |
TiKeil/pymor | src/pymortests/benchmarks.py | 5c6b3b6e1714b5ede11ce7cf03399780ab29d252 | # This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from pymortests.base import runmodule
if __name__ == "__main__":
runmodule(filename=__file__)
| [((9, 4, 9, 32), 'pymortests.base.runmodule', 'runmodule', (), '', False, 'from pymortests.base import runmodule\n')] |
anand2312/storage-py | storage3/_sync/client.py | 75c9c43ea373cb58970255b8e7438c2ec67e7f25 | from ..utils import SyncClient, __version__
from .bucket import SyncStorageBucketAPI
from .file_api import SyncBucketProxy
__all__ = [
"SyncStorageClient",
]
class SyncStorageClient(SyncStorageBucketAPI):
"""Manage storage buckets and files."""
def __init__(self, url: str, headers: dict[str, str]) -> None:
super().__init__(
url,
{"User-Agent": f"supabase-py/storage3 v{__version__}", **headers},
SyncClient(),
)
def from_(self, id: str) -> SyncBucketProxy:
"""Run a storage file operation.
Parameters
----------
id
The unique identifier of the bucket
"""
return SyncBucketProxy(id, self.url, self.headers, self._client)
| [] |
Hades01/Addons | repo/script.module.liveresolver/lib/js2py/translators/__init__.py | 710da97ac850197498a3cd64be1811c593610add | # The MIT License
#
# Copyright 2014, 2015 Piotr Dabkowski
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the 'Software'),
# to deal in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so, subject
# to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
__all__ = ['PyJsParser', 'Node', 'WrappingNode', 'node_to_dict', 'parse', 'translate_js', 'translate', 'syntax_tree_translate',
'DEFAULT_HEADER']
__author__ = 'Piotr Dabkowski'
__version__ = '2.2.0'
from pyjsparser import PyJsParser, Node, WrappingNode, node_to_dict
from translator import translate_js, trasnlate, syntax_tree_translate, DEFAULT_HEADER
def parse(javascript_code):
"""Returns syntax tree of javascript_code.
Syntax tree has the same structure as syntax tree produced by esprima.js
Same as PyJsParser().parse For your convenience :) """
p = PyJsParser()
return p.parse(javascript_code)
| [((35, 8, 35, 20), 'pyjsparser.PyJsParser', 'PyJsParser', ({}, {}), '()', False, 'from pyjsparser import PyJsParser, Node, WrappingNode, node_to_dict\n')] |
xchange11/ttconv-1 | src/test/python/test_scc_pacs.py | 6e67172af126fa0e90690044848f300c0173715c | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2020, Sandflow Consulting LLC
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Unit tests for the SCC PACs"""
# pylint: disable=R0201,C0115,C0116
import unittest
from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode
from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType
class SCCPreambleAddressCodesTest(unittest.TestCase):
def test_scc_pac_values(self):
channel_1_byte_1 = [0x11, 0x12, 0x15, 0x16, 0x17, 0x10, 0x13, 0x14]
channel_2_byte_1 = [0x19, 0x1A, 0x1D, 0x1E, 0x1F, 0x18, 0x1B, 0x1C]
all_range = list(range(0x00, 0XFF))
byte_2_range = range(0x40, 0x80)
other_bytes_1 = [item for item in all_range
if item not in channel_1_byte_1 and item not in channel_2_byte_1]
other_bytes_2 = [item for item in all_range if item not in list(byte_2_range)]
for b1 in channel_1_byte_1:
for b2 in byte_2_range:
pac = SccPreambleAddressCode.find(b1, b2)
if b2 > 0x5F and b1 % 0x08 == 0: # row 11 case
self.assertIsNone(pac)
else:
self.assertIsNotNone(pac)
for b2 in other_bytes_2:
self.assertIsNone(SccPreambleAddressCode.find(b1, b2))
for b1 in channel_2_byte_1:
for b2 in byte_2_range:
pac = SccPreambleAddressCode.find(b1, b2)
if b2 > 0x5F and b1 % 0x08 == 0: # row 11 case
self.assertIsNone(pac)
else:
self.assertIsNotNone(pac)
for b2 in other_bytes_2:
self.assertIsNone(SccPreambleAddressCode.find(b1, b2))
for b1 in other_bytes_1:
for b2 in range(0x00, 0xFF):
self.assertIsNone(SccPreambleAddressCode.find(b1, b2))
def check_scc_pac_attributes(self, pac, channel, row, indent, color, font_style, text_decoration):
self.assertEqual(channel, pac.get_channel())
self.assertEqual(row, pac.get_row())
self.assertEqual(indent, pac.get_indent())
self.assertEqual(color, pac.get_color())
self.assertEqual(font_style, pac.get_font_style())
self.assertEqual(text_decoration, pac.get_text_decoration())
def test_scc_pac_white(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x40), 1, 1, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x60), 1, 2, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x40), 1, 3, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x60), 1, 4, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x40), 1, 5, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x60), 1, 6, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x40), 1, 7, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x60), 1, 8, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x40), 1, 9, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x60), 1, 10, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x40), 1, 11, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x40), 1, 12, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x60), 1, 13, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x40), 1, 14, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x60), 1, 15, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x40), 2, 1, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x60), 2, 2, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x40), 2, 3, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x60), 2, 4, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x40), 2, 5, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x60), 2, 6, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x40), 2, 7, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x60), 2, 8, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x40), 2, 9, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x60), 2, 10, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x40), 2, 11, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x40), 2, 12, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x60), 2, 13, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x40), 2, 14, None, NamedColors.white.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x60), 2, 15, None, NamedColors.white.value, None, None)
def test_scc_pac_white_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x41), 1, 1, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x61), 1, 2, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x41), 1, 3, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x61), 1, 4, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x41), 1, 5, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x61), 1, 6, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x41), 1, 7, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x61), 1, 8, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x41), 1, 9, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x61), 1, 10, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x41), 1, 11, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x41), 1, 12, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x61), 1, 13, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x41), 1, 14, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x61), 1, 15, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x41), 2, 1, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x61), 2, 2, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x41), 2, 3, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x61), 2, 4, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x41), 2, 5, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x61), 2, 6, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x41), 2, 7, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x61), 2, 8, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x41), 2, 9, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x61), 2, 10, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x41), 2, 11, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x41), 2, 12, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x61), 2, 13, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x41), 2, 14, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x61), 2, 15, None, NamedColors.white.value, None,
TextDecorationType(underline=True))
def test_scc_pac_green(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x42), 1, 1, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x62), 1, 2, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x42), 1, 3, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x62), 1, 4, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x42), 1, 5, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x62), 1, 6, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x42), 1, 7, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x62), 1, 8, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x42), 1, 9, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x62), 1, 10, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x42), 1, 11, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x42), 1, 12, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x62), 1, 13, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x42), 1, 14, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x62), 1, 15, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x42), 2, 1, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x62), 2, 2, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x42), 2, 3, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x62), 2, 4, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x42), 2, 5, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x62), 2, 6, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x42), 2, 7, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x62), 2, 8, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x42), 2, 9, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x62), 2, 10, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x42), 2, 11, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x42), 2, 12, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x62), 2, 13, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x42), 2, 14, None, NamedColors.green.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x62), 2, 15, None, NamedColors.green.value, None, None)
def test_scc_pac_green_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x43), 1, 1, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x63), 1, 2, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x43), 1, 3, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x63), 1, 4, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x43), 1, 5, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x63), 1, 6, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x43), 1, 7, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x63), 1, 8, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x43), 1, 9, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x63), 1, 10, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x43), 1, 11, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x43), 1, 12, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x63), 1, 13, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x43), 1, 14, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x63), 1, 15, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x43), 2, 1, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x63), 2, 2, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x43), 2, 3, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x63), 2, 4, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x43), 2, 5, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x63), 2, 6, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x43), 2, 7, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x63), 2, 8, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x43), 2, 9, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x63), 2, 10, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x43), 2, 11, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x43), 2, 12, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x63), 2, 13, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x43), 2, 14, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x63), 2, 15, None, NamedColors.green.value, None,
TextDecorationType(underline=True))
def test_scc_pac_blue(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x44), 1, 1, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x64), 1, 2, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x44), 1, 3, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x64), 1, 4, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x44), 1, 5, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x64), 1, 6, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x44), 1, 7, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x64), 1, 8, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x44), 1, 9, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x64), 1, 10, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x44), 1, 11, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x44), 1, 12, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x64), 1, 13, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x44), 1, 14, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x64), 1, 15, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x44), 2, 1, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x64), 2, 2, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x44), 2, 3, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x64), 2, 4, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x44), 2, 5, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x64), 2, 6, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x44), 2, 7, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x64), 2, 8, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x44), 2, 9, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x64), 2, 10, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x44), 2, 11, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x44), 2, 12, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x64), 2, 13, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x44), 2, 14, None, NamedColors.blue.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x64), 2, 15, None, NamedColors.blue.value, None, None)
def test_scc_pac_blue_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x45), 1, 1, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x65), 1, 2, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x45), 1, 3, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x65), 1, 4, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x45), 1, 5, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x65), 1, 6, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x45), 1, 7, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x65), 1, 8, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x45), 1, 9, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x65), 1, 10, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x45), 1, 11, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x45), 1, 12, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x65), 1, 13, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x45), 1, 14, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x65), 1, 15, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x45), 2, 1, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x65), 2, 2, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x45), 2, 3, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x65), 2, 4, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x45), 2, 5, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x65), 2, 6, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x45), 2, 7, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x65), 2, 8, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x45), 2, 9, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x65), 2, 10, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x45), 2, 11, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x45), 2, 12, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x65), 2, 13, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x45), 2, 14, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x65), 2, 15, None, NamedColors.blue.value, None,
TextDecorationType(underline=True))
def test_scc_pac_cyan(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x46), 1, 1, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x66), 1, 2, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x46), 1, 3, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x66), 1, 4, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x46), 1, 5, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x66), 1, 6, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x46), 1, 7, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x66), 1, 8, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x46), 1, 9, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x66), 1, 10, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x46), 1, 11, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x46), 1, 12, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x66), 1, 13, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x46), 1, 14, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x66), 1, 15, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x46), 2, 1, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x66), 2, 2, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x46), 2, 3, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x66), 2, 4, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x46), 2, 5, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x66), 2, 6, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x46), 2, 7, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x66), 2, 8, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x46), 2, 9, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x66), 2, 10, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x46), 2, 11, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x46), 2, 12, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x66), 2, 13, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x46), 2, 14, None, NamedColors.cyan.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x66), 2, 15, None, NamedColors.cyan.value, None, None)
def test_scc_pac_cyan_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x47), 1, 1, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x67), 1, 2, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x47), 1, 3, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x67), 1, 4, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x47), 1, 5, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x67), 1, 6, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x47), 1, 7, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x67), 1, 8, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x47), 1, 9, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x67), 1, 10, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x47), 1, 11, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x47), 1, 12, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x67), 1, 13, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x47), 1, 14, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x67), 1, 15, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x47), 2, 1, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x67), 2, 2, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x47), 2, 3, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x67), 2, 4, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x47), 2, 5, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x67), 2, 6, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x47), 2, 7, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x67), 2, 8, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x47), 2, 9, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x67), 2, 10, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x47), 2, 11, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x47), 2, 12, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x67), 2, 13, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x47), 2, 14, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x67), 2, 15, None, NamedColors.cyan.value, None,
TextDecorationType(underline=True))
def test_scc_pac_red(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x48), 1, 1, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x68), 1, 2, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x48), 1, 3, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x68), 1, 4, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x48), 1, 5, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x68), 1, 6, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x48), 1, 7, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x68), 1, 8, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x48), 1, 9, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x68), 1, 10, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x48), 1, 11, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x48), 1, 12, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x68), 1, 13, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x48), 1, 14, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x68), 1, 15, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x48), 2, 1, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x68), 2, 2, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x48), 2, 3, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x68), 2, 4, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x48), 2, 5, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x68), 2, 6, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x48), 2, 7, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x68), 2, 8, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x48), 2, 9, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x68), 2, 10, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x48), 2, 11, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x48), 2, 12, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x68), 2, 13, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x48), 2, 14, None, NamedColors.red.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x68), 2, 15, None, NamedColors.red.value, None, None)
def test_scc_pac_red_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x49), 1, 1, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x69), 1, 2, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x49), 1, 3, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x69), 1, 4, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x49), 1, 5, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x69), 1, 6, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x49), 1, 7, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x69), 1, 8, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x49), 1, 9, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x69), 1, 10, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x49), 1, 11, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x49), 1, 12, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x69), 1, 13, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x49), 1, 14, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x69), 1, 15, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x49), 2, 1, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x69), 2, 2, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x49), 2, 3, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x69), 2, 4, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x49), 2, 5, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x69), 2, 6, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x49), 2, 7, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x69), 2, 8, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x49), 2, 9, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x69), 2, 10, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x49), 2, 11, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x49), 2, 12, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x69), 2, 13, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x49), 2, 14, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x69), 2, 15, None, NamedColors.red.value, None,
TextDecorationType(underline=True))
def test_scc_pac_yellow(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x4A), 1, 1, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x6A), 1, 2, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x4A), 1, 3, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x6A), 1, 4, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x4A), 1, 5, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x6A), 1, 6, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x4A), 1, 7, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x6A), 1, 8, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x4A), 1, 9, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x6A), 1, 10, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x4A), 1, 11, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x4A), 1, 12, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x6A), 1, 13, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x4A), 1, 14, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x6A), 1, 15, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x4A), 2, 1, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x6A), 2, 2, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x4A), 2, 3, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x6A), 2, 4, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x4A), 2, 5, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x6A), 2, 6, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x4A), 2, 7, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x6A), 2, 8, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x4A), 2, 9, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x6A), 2, 10, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x4A), 2, 11, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x4A), 2, 12, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x6A), 2, 13, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x4A), 2, 14, None, NamedColors.yellow.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x6A), 2, 15, None, NamedColors.yellow.value, None, None)
def test_scc_pac_yellow_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x4B), 1, 1, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x6B), 1, 2, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x4B), 1, 3, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x6B), 1, 4, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x4B), 1, 5, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x6B), 1, 6, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x4B), 1, 7, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x6B), 1, 8, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x4B), 1, 9, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x6B), 1, 10, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x4B), 1, 11, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x4B), 1, 12, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x6B), 1, 13, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x4B), 1, 14, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x6B), 1, 15, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x4B), 2, 1, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x6B), 2, 2, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x4B), 2, 3, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x6B), 2, 4, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x4B), 2, 5, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x6B), 2, 6, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x4B), 2, 7, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x6B), 2, 8, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x4B), 2, 9, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x6B), 2, 10, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x4B), 2, 11, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x4B), 2, 12, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x6B), 2, 13, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x4B), 2, 14, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x6B), 2, 15, None, NamedColors.yellow.value, None,
TextDecorationType(underline=True))
def test_scc_pac_magenta(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x4C), 1, 1, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x6C), 1, 2, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x4C), 1, 3, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x6C), 1, 4, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x4C), 1, 5, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x6C), 1, 6, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x4C), 1, 7, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x6C), 1, 8, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x4C), 1, 9, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x6C), 1, 10, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x4C), 1, 11, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x4C), 1, 12, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x6C), 1, 13, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x4C), 1, 14, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x6C), 1, 15, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x4C), 2, 1, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x6C), 2, 2, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x4C), 2, 3, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x6C), 2, 4, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x4C), 2, 5, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x6C), 2, 6, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x4C), 2, 7, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x6C), 2, 8, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x4C), 2, 9, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x6C), 2, 10, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x4C), 2, 11, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x4C), 2, 12, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x6C), 2, 13, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x4C), 2, 14, None, NamedColors.magenta.value, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x6C), 2, 15, None, NamedColors.magenta.value, None, None)
def test_scc_pac_magenta_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x4D), 1, 1, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x6D), 1, 2, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x4D), 1, 3, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x6D), 1, 4, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x4D), 1, 5, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x6D), 1, 6, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x4D), 1, 7, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x6D), 1, 8, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x4D), 1, 9, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x6D), 1, 10, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x4D), 1, 11, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x4D), 1, 12, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x6D), 1, 13, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x4D), 1, 14, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x6D), 1, 15, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x4D), 2, 1, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x6D), 2, 2, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x4D), 2, 3, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x6D), 2, 4, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x4D), 2, 5, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x6D), 2, 6, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x4D), 2, 7, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x6D), 2, 8, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x4D), 2, 9, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x6D), 2, 10, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x4D), 2, 11, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x4D), 2, 12, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x6D), 2, 13, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x4D), 2, 14, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x6D), 2, 15, None, NamedColors.magenta.value, None,
TextDecorationType(underline=True))
def test_scc_pac_white_italics(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x4E), 1, 1, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x6E), 1, 2, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x4E), 1, 3, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x6E), 1, 4, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x4E), 1, 5, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x6E), 1, 6, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x4E), 1, 7, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x6E), 1, 8, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x4E), 1, 9, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x6E), 1, 10, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x4E), 1, 11, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x4E), 1, 12, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x6E), 1, 13, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x4E), 1, 14, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x6E), 1, 15, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x4E), 2, 1, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x6E), 2, 2, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x4E), 2, 3, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x6E), 2, 4, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x4E), 2, 5, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x6E), 2, 6, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x4E), 2, 7, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x6E), 2, 8, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x4E), 2, 9, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x6E), 2, 10, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x4E), 2, 11, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x4E), 2, 12, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x6E), 2, 13, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x4E), 2, 14, None, NamedColors.white.value, FontStyleType.italic,
None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x6E), 2, 15, None, NamedColors.white.value, FontStyleType.italic,
None)
def test_scc_pac_white_italics_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x4F), 1, 1, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x6F), 1, 2, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x4F), 1, 3, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x6F), 1, 4, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x4F), 1, 5, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x6F), 1, 6, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x4F), 1, 7, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x6F), 1, 8, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x4F), 1, 9, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x6F), 1, 10, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x4F), 1, 11, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x4F), 1, 12, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x6F), 1, 13, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x4F), 1, 14, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x6F), 1, 15, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x4F), 2, 1, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x6F), 2, 2, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x4F), 2, 3, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x6F), 2, 4, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x4F), 2, 5, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x6F), 2, 6, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x4F), 2, 7, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x6F), 2, 8, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x4F), 2, 9, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x6F), 2, 10, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x4F), 2, 11, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x4F), 2, 12, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x6F), 2, 13, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x4F), 2, 14, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x6F), 2, 15, None, NamedColors.white.value, FontStyleType.italic,
TextDecorationType(underline=True))
def test_scc_pac_indent_0(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x50), 1, 1, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x70), 1, 2, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x50), 1, 3, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x70), 1, 4, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x50), 1, 5, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x70), 1, 6, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x50), 1, 7, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x70), 1, 8, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x50), 1, 9, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x70), 1, 10, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x50), 1, 11, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x50), 1, 12, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x70), 1, 13, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x50), 1, 14, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x70), 1, 15, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x50), 2, 1, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x70), 2, 2, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x50), 2, 3, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x70), 2, 4, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x50), 2, 5, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x70), 2, 6, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x50), 2, 7, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x70), 2, 8, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x50), 2, 9, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x70), 2, 10, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x50), 2, 11, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x50), 2, 12, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x70), 2, 13, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x50), 2, 14, 0, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x70), 2, 15, 0, None, None, None)
def test_scc_pac_indent_0_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x51), 1, 1, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x71), 1, 2, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x51), 1, 3, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x71), 1, 4, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x51), 1, 5, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x71), 1, 6, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x51), 1, 7, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x71), 1, 8, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x51), 1, 9, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x71), 1, 10, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x51), 1, 11, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x51), 1, 12, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x71), 1, 13, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x51), 1, 14, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x71), 1, 15, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x51), 2, 1, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x71), 2, 2, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x51), 2, 3, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x71), 2, 4, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x51), 2, 5, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x71), 2, 6, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x51), 2, 7, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x71), 2, 8, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x51), 2, 9, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x71), 2, 10, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x51), 2, 11, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x51), 2, 12, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x71), 2, 13, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x51), 2, 14, 0, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x71), 2, 15, 0, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_4(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x52), 1, 1, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x72), 1, 2, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x52), 1, 3, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x72), 1, 4, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x52), 1, 5, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x72), 1, 6, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x52), 1, 7, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x72), 1, 8, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x52), 1, 9, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x72), 1, 10, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x52), 1, 11, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x52), 1, 12, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x72), 1, 13, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x52), 1, 14, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x72), 1, 15, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x52), 2, 1, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x72), 2, 2, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x52), 2, 3, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x72), 2, 4, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x52), 2, 5, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x72), 2, 6, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x52), 2, 7, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x72), 2, 8, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x52), 2, 9, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x72), 2, 10, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x52), 2, 11, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x52), 2, 12, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x72), 2, 13, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x52), 2, 14, 4, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x72), 2, 15, 4, None, None, None)
def test_scc_pac_indent_4_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x53), 1, 1, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x73), 1, 2, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x53), 1, 3, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x73), 1, 4, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x53), 1, 5, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x73), 1, 6, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x53), 1, 7, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x73), 1, 8, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x53), 1, 9, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x73), 1, 10, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x53), 1, 11, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x53), 1, 12, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x73), 1, 13, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x53), 1, 14, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x73), 1, 15, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x53), 2, 1, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x73), 2, 2, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x53), 2, 3, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x73), 2, 4, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x53), 2, 5, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x73), 2, 6, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x53), 2, 7, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x73), 2, 8, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x53), 2, 9, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x73), 2, 10, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x53), 2, 11, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x53), 2, 12, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x73), 2, 13, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x53), 2, 14, 4, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x73), 2, 15, 4, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_8(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x54), 1, 1, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x74), 1, 2, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x54), 1, 3, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x74), 1, 4, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x54), 1, 5, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x74), 1, 6, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x54), 1, 7, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x74), 1, 8, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x54), 1, 9, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x74), 1, 10, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x54), 1, 11, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x54), 1, 12, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x74), 1, 13, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x54), 1, 14, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x74), 1, 15, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x54), 2, 1, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x74), 2, 2, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x54), 2, 3, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x74), 2, 4, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x54), 2, 5, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x74), 2, 6, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x54), 2, 7, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x74), 2, 8, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x54), 2, 9, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x74), 2, 10, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x54), 2, 11, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x54), 2, 12, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x74), 2, 13, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x54), 2, 14, 8, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x74), 2, 15, 8, None, None, None)
def test_scc_pac_indent_8_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x55), 1, 1, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x75), 1, 2, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x55), 1, 3, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x75), 1, 4, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x55), 1, 5, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x75), 1, 6, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x55), 1, 7, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x75), 1, 8, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x55), 1, 9, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x75), 1, 10, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x55), 1, 11, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x55), 1, 12, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x75), 1, 13, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x55), 1, 14, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x75), 1, 15, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x55), 2, 1, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x75), 2, 2, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x55), 2, 3, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x75), 2, 4, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x55), 2, 5, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x75), 2, 6, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x55), 2, 7, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x75), 2, 8, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x55), 2, 9, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x75), 2, 10, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x55), 2, 11, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x55), 2, 12, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x75), 2, 13, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x55), 2, 14, 8, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x75), 2, 15, 8, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_12(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x56), 1, 1, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x76), 1, 2, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x56), 1, 3, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x76), 1, 4, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x56), 1, 5, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x76), 1, 6, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x56), 1, 7, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x76), 1, 8, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x56), 1, 9, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x76), 1, 10, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x56), 1, 11, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x56), 1, 12, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x76), 1, 13, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x56), 1, 14, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x76), 1, 15, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x56), 2, 1, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x76), 2, 2, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x56), 2, 3, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x76), 2, 4, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x56), 2, 5, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x76), 2, 6, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x56), 2, 7, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x76), 2, 8, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x56), 2, 9, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x76), 2, 10, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x56), 2, 11, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x56), 2, 12, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x76), 2, 13, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x56), 2, 14, 12, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x76), 2, 15, 12, None, None, None)
def test_scc_pac_indent_12_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x57), 1, 1, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x77), 1, 2, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x57), 1, 3, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x77), 1, 4, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x57), 1, 5, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x77), 1, 6, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x57), 1, 7, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x77), 1, 8, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x57), 1, 9, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x77), 1, 10, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x57), 1, 11, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x57), 1, 12, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x77), 1, 13, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x57), 1, 14, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x77), 1, 15, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x57), 2, 1, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x77), 2, 2, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x57), 2, 3, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x77), 2, 4, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x57), 2, 5, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x77), 2, 6, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x57), 2, 7, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x77), 2, 8, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x57), 2, 9, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x77), 2, 10, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x57), 2, 11, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x57), 2, 12, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x77), 2, 13, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x57), 2, 14, 12, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x77), 2, 15, 12, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_16(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x58), 1, 1, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x78), 1, 2, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x58), 1, 3, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x78), 1, 4, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x58), 1, 5, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x78), 1, 6, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x58), 1, 7, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x78), 1, 8, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x58), 1, 9, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x78), 1, 10, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x58), 1, 11, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x58), 1, 12, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x78), 1, 13, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x58), 1, 14, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x78), 1, 15, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x58), 2, 1, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x78), 2, 2, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x58), 2, 3, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x78), 2, 4, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x58), 2, 5, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x78), 2, 6, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x58), 2, 7, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x78), 2, 8, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x58), 2, 9, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x78), 2, 10, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x58), 2, 11, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x58), 2, 12, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x78), 2, 13, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x58), 2, 14, 16, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x78), 2, 15, 16, None, None, None)
def test_scc_pac_indent_16_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x59), 1, 1, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x79), 1, 2, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x59), 1, 3, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x79), 1, 4, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x59), 1, 5, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x79), 1, 6, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x59), 1, 7, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x79), 1, 8, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x59), 1, 9, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x79), 1, 10, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x59), 1, 11, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x59), 1, 12, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x79), 1, 13, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x59), 1, 14, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x79), 1, 15, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x59), 2, 1, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x79), 2, 2, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x59), 2, 3, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x79), 2, 4, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x59), 2, 5, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x79), 2, 6, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x59), 2, 7, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x79), 2, 8, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x59), 2, 9, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x79), 2, 10, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x59), 2, 11, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x59), 2, 12, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x79), 2, 13, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x59), 2, 14, 16, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x79), 2, 15, 16, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_20(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x5A), 1, 1, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x7A), 1, 2, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x5A), 1, 3, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x7A), 1, 4, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x5A), 1, 5, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x7A), 1, 6, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x5A), 1, 7, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x7A), 1, 8, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x5A), 1, 9, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x7A), 1, 10, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x5A), 1, 11, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x5A), 1, 12, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x7A), 1, 13, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x5A), 1, 14, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x7A), 1, 15, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x5A), 2, 1, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x7A), 2, 2, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x5A), 2, 3, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x7A), 2, 4, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x5A), 2, 5, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x7A), 2, 6, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x5A), 2, 7, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x7A), 2, 8, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x5A), 2, 9, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x7A), 2, 10, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x5A), 2, 11, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x5A), 2, 12, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x7A), 2, 13, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x5A), 2, 14, 20, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x7A), 2, 15, 20, None, None, None)
def test_scc_pac_indent_20_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x5B), 1, 1, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x7B), 1, 2, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x5B), 1, 3, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x7B), 1, 4, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x5B), 1, 5, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x7B), 1, 6, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x5B), 1, 7, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x7B), 1, 8, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x5B), 1, 9, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x7B), 1, 10, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x5B), 1, 11, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x5B), 1, 12, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x7B), 1, 13, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x5B), 1, 14, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x7B), 1, 15, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x5B), 2, 1, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x7B), 2, 2, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x5B), 2, 3, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x7B), 2, 4, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x5B), 2, 5, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x7B), 2, 6, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x5B), 2, 7, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x7B), 2, 8, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x5B), 2, 9, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x7B), 2, 10, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x5B), 2, 11, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x5B), 2, 12, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x7B), 2, 13, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x5B), 2, 14, 20, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x7B), 2, 15, 20, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_24(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x5C), 1, 1, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x7C), 1, 2, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x5C), 1, 3, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x7C), 1, 4, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x5C), 1, 5, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x7C), 1, 6, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x5C), 1, 7, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x7C), 1, 8, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x5C), 1, 9, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x7C), 1, 10, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x5C), 1, 11, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x5C), 1, 12, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x7C), 1, 13, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x5C), 1, 14, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x7C), 1, 15, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x5C), 2, 1, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x7C), 2, 2, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x5C), 2, 3, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x7C), 2, 4, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x5C), 2, 5, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x7C), 2, 6, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x5C), 2, 7, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x7C), 2, 8, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x5C), 2, 9, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x7C), 2, 10, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x5C), 2, 11, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x5C), 2, 12, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x7C), 2, 13, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x5C), 2, 14, 24, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x7C), 2, 15, 24, None, None, None)
def test_scc_pac_indent_24_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x5D), 1, 1, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x7D), 1, 2, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x5D), 1, 3, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x7D), 1, 4, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x5D), 1, 5, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x7D), 1, 6, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x5D), 1, 7, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x7D), 1, 8, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x5D), 1, 9, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x7D), 1, 10, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x5D), 1, 11, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x5D), 1, 12, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x7D), 1, 13, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x5D), 1, 14, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x7D), 1, 15, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x5D), 2, 1, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x7D), 2, 2, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x5D), 2, 3, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x7D), 2, 4, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x5D), 2, 5, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x7D), 2, 6, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x5D), 2, 7, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x7D), 2, 8, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x5D), 2, 9, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x7D), 2, 10, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x5D), 2, 11, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x5D), 2, 12, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x7D), 2, 13, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x5D), 2, 14, 24, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x7D), 2, 15, 24, None, None,
TextDecorationType(underline=True))
def test_scc_pac_indent_28(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x5E), 1, 1, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x7E), 1, 2, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x5E), 1, 3, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x7E), 1, 4, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x5E), 1, 5, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x7E), 1, 6, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x5E), 1, 7, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x7E), 1, 8, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x5E), 1, 9, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x7E), 1, 10, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x5E), 1, 11, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x5E), 1, 12, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x7E), 1, 13, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x5E), 1, 14, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x7E), 1, 15, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x5E), 2, 1, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x7E), 2, 2, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x5E), 2, 3, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x7E), 2, 4, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x5E), 2, 5, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x7E), 2, 6, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x5E), 2, 7, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x7E), 2, 8, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x5E), 2, 9, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x7E), 2, 10, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x5E), 2, 11, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x5E), 2, 12, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x7E), 2, 13, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x5E), 2, 14, 28, None, None, None)
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x7E), 2, 15, 28, None, None, None)
def test_scc_pac_indent_28_underline(self):
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x5F), 1, 1, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x11, 0x7F), 1, 2, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x5F), 1, 3, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x12, 0x7F), 1, 4, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x5F), 1, 5, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x15, 0x7F), 1, 6, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x5F), 1, 7, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x16, 0x7F), 1, 8, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x5F), 1, 9, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x17, 0x7F), 1, 10, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x10, 0x5F), 1, 11, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x5F), 1, 12, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x13, 0x7F), 1, 13, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x5F), 1, 14, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x14, 0x7F), 1, 15, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x5F), 2, 1, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x19, 0x7F), 2, 2, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x5F), 2, 3, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1A, 0x7F), 2, 4, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x5F), 2, 5, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1D, 0x7F), 2, 6, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x5F), 2, 7, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1E, 0x7F), 2, 8, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x5F), 2, 9, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1F, 0x7F), 2, 10, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x18, 0x5F), 2, 11, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x5F), 2, 12, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1B, 0x7F), 2, 13, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x5F), 2, 14, 28, None, None,
TextDecorationType(underline=True))
self.check_scc_pac_attributes(SccPreambleAddressCode(0x1C, 0x7F), 2, 15, 28, None, None,
TextDecorationType(underline=True))
if __name__ == '__main__':
unittest.main()
| [((1621, 2, 1621, 17), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((86, 34, 86, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(86, 57, 86, 61): '(17)', (86, 63, 86, 67): '(64)'}, {}), '(17, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((87, 34, 87, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(87, 57, 87, 61): '(17)', (87, 63, 87, 67): '(96)'}, {}), '(17, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((88, 34, 88, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(88, 57, 88, 61): '(18)', (88, 63, 88, 67): '(64)'}, {}), '(18, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((89, 34, 89, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(89, 57, 89, 61): '(18)', (89, 63, 89, 67): '(96)'}, {}), '(18, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((90, 34, 90, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(90, 57, 90, 61): '(21)', (90, 63, 90, 67): '(64)'}, {}), '(21, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((91, 34, 91, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(91, 57, 91, 61): '(21)', (91, 63, 91, 67): '(96)'}, {}), '(21, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((92, 34, 92, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(92, 57, 92, 61): '(22)', (92, 63, 92, 67): '(64)'}, {}), '(22, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((93, 34, 93, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(93, 57, 93, 61): '(22)', (93, 63, 93, 67): '(96)'}, {}), '(22, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((94, 34, 94, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(94, 57, 94, 61): '(23)', (94, 63, 94, 67): '(64)'}, {}), '(23, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((95, 34, 95, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(95, 57, 95, 61): '(23)', (95, 63, 95, 67): '(96)'}, {}), '(23, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((96, 34, 96, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(96, 57, 96, 61): '(16)', (96, 63, 96, 67): '(64)'}, {}), '(16, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((97, 34, 97, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(97, 57, 97, 61): '(19)', (97, 63, 97, 67): '(64)'}, {}), '(19, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((98, 34, 98, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(98, 57, 98, 61): '(19)', (98, 63, 98, 67): '(96)'}, {}), '(19, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((99, 34, 99, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(99, 57, 99, 61): '(20)', (99, 63, 99, 67): '(64)'}, {}), '(20, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((100, 34, 100, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(100, 57, 100, 61): '(20)', (100, 63, 100, 67): '(96)'}, {}), '(20, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((101, 34, 101, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(101, 57, 101, 61): '(25)', (101, 63, 101, 67): '(64)'}, {}), '(25, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((102, 34, 102, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(102, 57, 102, 61): '(25)', (102, 63, 102, 67): '(96)'}, {}), '(25, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((103, 34, 103, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(103, 57, 103, 61): '(26)', (103, 63, 103, 67): '(64)'}, {}), '(26, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((104, 34, 104, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(104, 57, 104, 61): '(26)', (104, 63, 104, 67): '(96)'}, {}), '(26, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((105, 34, 105, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(105, 57, 105, 61): '(29)', (105, 63, 105, 67): '(64)'}, {}), '(29, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((106, 34, 106, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(106, 57, 106, 61): '(29)', (106, 63, 106, 67): '(96)'}, {}), '(29, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((107, 34, 107, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(107, 57, 107, 61): '(30)', (107, 63, 107, 67): '(64)'}, {}), '(30, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((108, 34, 108, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(108, 57, 108, 61): '(30)', (108, 63, 108, 67): '(96)'}, {}), '(30, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((109, 34, 109, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(109, 57, 109, 61): '(31)', (109, 63, 109, 67): '(64)'}, {}), '(31, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((110, 34, 110, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(110, 57, 110, 61): '(31)', (110, 63, 110, 67): '(96)'}, {}), '(31, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((111, 34, 111, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(111, 57, 111, 61): '(24)', (111, 63, 111, 67): '(64)'}, {}), '(24, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((112, 34, 112, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(112, 57, 112, 61): '(27)', (112, 63, 112, 67): '(64)'}, {}), '(27, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((113, 34, 113, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(113, 57, 113, 61): '(27)', (113, 63, 113, 67): '(96)'}, {}), '(27, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((114, 34, 114, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(114, 57, 114, 61): '(28)', (114, 63, 114, 67): '(64)'}, {}), '(28, 64)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((115, 34, 115, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(115, 57, 115, 61): '(28)', (115, 63, 115, 67): '(96)'}, {}), '(28, 96)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((118, 34, 118, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(118, 57, 118, 61): '(17)', (118, 63, 118, 67): '(65)'}, {}), '(17, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((119, 34, 119, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((120, 34, 120, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(120, 57, 120, 61): '(17)', (120, 63, 120, 67): '(97)'}, {}), '(17, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((121, 34, 121, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((122, 34, 122, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(122, 57, 122, 61): '(18)', (122, 63, 122, 67): '(65)'}, {}), '(18, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((123, 34, 123, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((124, 34, 124, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(124, 57, 124, 61): '(18)', (124, 63, 124, 67): '(97)'}, {}), '(18, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((125, 34, 125, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((126, 34, 126, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(126, 57, 126, 61): '(21)', (126, 63, 126, 67): '(65)'}, {}), '(21, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((127, 34, 127, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((128, 34, 128, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(128, 57, 128, 61): '(21)', (128, 63, 128, 67): '(97)'}, {}), '(21, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((129, 34, 129, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((130, 34, 130, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(130, 57, 130, 61): '(22)', (130, 63, 130, 67): '(65)'}, {}), '(22, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((131, 34, 131, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((132, 34, 132, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(132, 57, 132, 61): '(22)', (132, 63, 132, 67): '(97)'}, {}), '(22, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((133, 34, 133, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((134, 34, 134, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(134, 57, 134, 61): '(23)', (134, 63, 134, 67): '(65)'}, {}), '(23, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((135, 34, 135, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((136, 34, 136, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(136, 57, 136, 61): '(23)', (136, 63, 136, 67): '(97)'}, {}), '(23, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((137, 34, 137, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((138, 34, 138, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(138, 57, 138, 61): '(16)', (138, 63, 138, 67): '(65)'}, {}), '(16, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((139, 34, 139, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((140, 34, 140, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(140, 57, 140, 61): '(19)', (140, 63, 140, 67): '(65)'}, {}), '(19, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((141, 34, 141, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((142, 34, 142, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(142, 57, 142, 61): '(19)', (142, 63, 142, 67): '(97)'}, {}), '(19, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((143, 34, 143, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((144, 34, 144, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(144, 57, 144, 61): '(20)', (144, 63, 144, 67): '(65)'}, {}), '(20, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((145, 34, 145, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((146, 34, 146, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(146, 57, 146, 61): '(20)', (146, 63, 146, 67): '(97)'}, {}), '(20, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((147, 34, 147, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((148, 34, 148, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(148, 57, 148, 61): '(25)', (148, 63, 148, 67): '(65)'}, {}), '(25, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((149, 34, 149, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((150, 34, 150, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(150, 57, 150, 61): '(25)', (150, 63, 150, 67): '(97)'}, {}), '(25, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((151, 34, 151, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((152, 34, 152, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(152, 57, 152, 61): '(26)', (152, 63, 152, 67): '(65)'}, {}), '(26, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((153, 34, 153, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((154, 34, 154, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(154, 57, 154, 61): '(26)', (154, 63, 154, 67): '(97)'}, {}), '(26, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((155, 34, 155, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((156, 34, 156, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(156, 57, 156, 61): '(29)', (156, 63, 156, 67): '(65)'}, {}), '(29, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((157, 34, 157, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((158, 34, 158, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(158, 57, 158, 61): '(29)', (158, 63, 158, 67): '(97)'}, {}), '(29, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((159, 34, 159, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((160, 34, 160, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(160, 57, 160, 61): '(30)', (160, 63, 160, 67): '(65)'}, {}), '(30, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((161, 34, 161, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((162, 34, 162, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(162, 57, 162, 61): '(30)', (162, 63, 162, 67): '(97)'}, {}), '(30, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((163, 34, 163, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((164, 34, 164, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(164, 57, 164, 61): '(31)', (164, 63, 164, 67): '(65)'}, {}), '(31, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((165, 34, 165, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((166, 34, 166, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(166, 57, 166, 61): '(31)', (166, 63, 166, 67): '(97)'}, {}), '(31, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((167, 34, 167, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((168, 34, 168, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(168, 57, 168, 61): '(24)', (168, 63, 168, 67): '(65)'}, {}), '(24, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((169, 34, 169, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((170, 34, 170, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(170, 57, 170, 61): '(27)', (170, 63, 170, 67): '(65)'}, {}), '(27, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((171, 34, 171, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((172, 34, 172, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(172, 57, 172, 61): '(27)', (172, 63, 172, 67): '(97)'}, {}), '(27, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((173, 34, 173, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((174, 34, 174, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(174, 57, 174, 61): '(28)', (174, 63, 174, 67): '(65)'}, {}), '(28, 65)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((175, 34, 175, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((176, 34, 176, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(176, 57, 176, 61): '(28)', (176, 63, 176, 67): '(97)'}, {}), '(28, 97)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((177, 34, 177, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((180, 34, 180, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(180, 57, 180, 61): '(17)', (180, 63, 180, 67): '(66)'}, {}), '(17, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((181, 34, 181, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(181, 57, 181, 61): '(17)', (181, 63, 181, 67): '(98)'}, {}), '(17, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((182, 34, 182, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(182, 57, 182, 61): '(18)', (182, 63, 182, 67): '(66)'}, {}), '(18, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((183, 34, 183, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(183, 57, 183, 61): '(18)', (183, 63, 183, 67): '(98)'}, {}), '(18, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((184, 34, 184, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(184, 57, 184, 61): '(21)', (184, 63, 184, 67): '(66)'}, {}), '(21, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((185, 34, 185, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(185, 57, 185, 61): '(21)', (185, 63, 185, 67): '(98)'}, {}), '(21, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((186, 34, 186, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(186, 57, 186, 61): '(22)', (186, 63, 186, 67): '(66)'}, {}), '(22, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((187, 34, 187, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(187, 57, 187, 61): '(22)', (187, 63, 187, 67): '(98)'}, {}), '(22, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((188, 34, 188, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(188, 57, 188, 61): '(23)', (188, 63, 188, 67): '(66)'}, {}), '(23, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((189, 34, 189, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(189, 57, 189, 61): '(23)', (189, 63, 189, 67): '(98)'}, {}), '(23, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((190, 34, 190, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(190, 57, 190, 61): '(16)', (190, 63, 190, 67): '(66)'}, {}), '(16, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((191, 34, 191, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(191, 57, 191, 61): '(19)', (191, 63, 191, 67): '(66)'}, {}), '(19, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((192, 34, 192, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(192, 57, 192, 61): '(19)', (192, 63, 192, 67): '(98)'}, {}), '(19, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((193, 34, 193, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(193, 57, 193, 61): '(20)', (193, 63, 193, 67): '(66)'}, {}), '(20, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((194, 34, 194, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(194, 57, 194, 61): '(20)', (194, 63, 194, 67): '(98)'}, {}), '(20, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((195, 34, 195, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(195, 57, 195, 61): '(25)', (195, 63, 195, 67): '(66)'}, {}), '(25, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((196, 34, 196, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(196, 57, 196, 61): '(25)', (196, 63, 196, 67): '(98)'}, {}), '(25, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((197, 34, 197, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(197, 57, 197, 61): '(26)', (197, 63, 197, 67): '(66)'}, {}), '(26, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((198, 34, 198, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(198, 57, 198, 61): '(26)', (198, 63, 198, 67): '(98)'}, {}), '(26, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((199, 34, 199, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(199, 57, 199, 61): '(29)', (199, 63, 199, 67): '(66)'}, {}), '(29, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((200, 34, 200, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(200, 57, 200, 61): '(29)', (200, 63, 200, 67): '(98)'}, {}), '(29, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((201, 34, 201, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(201, 57, 201, 61): '(30)', (201, 63, 201, 67): '(66)'}, {}), '(30, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((202, 34, 202, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(202, 57, 202, 61): '(30)', (202, 63, 202, 67): '(98)'}, {}), '(30, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((203, 34, 203, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(203, 57, 203, 61): '(31)', (203, 63, 203, 67): '(66)'}, {}), '(31, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((204, 34, 204, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(204, 57, 204, 61): '(31)', (204, 63, 204, 67): '(98)'}, {}), '(31, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((205, 34, 205, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(205, 57, 205, 61): '(24)', (205, 63, 205, 67): '(66)'}, {}), '(24, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((206, 34, 206, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(206, 57, 206, 61): '(27)', (206, 63, 206, 67): '(66)'}, {}), '(27, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((207, 34, 207, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(207, 57, 207, 61): '(27)', (207, 63, 207, 67): '(98)'}, {}), '(27, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((208, 34, 208, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(208, 57, 208, 61): '(28)', (208, 63, 208, 67): '(66)'}, {}), '(28, 66)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((209, 34, 209, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(209, 57, 209, 61): '(28)', (209, 63, 209, 67): '(98)'}, {}), '(28, 98)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((212, 34, 212, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(212, 57, 212, 61): '(17)', (212, 63, 212, 67): '(67)'}, {}), '(17, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((213, 34, 213, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((214, 34, 214, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(214, 57, 214, 61): '(17)', (214, 63, 214, 67): '(99)'}, {}), '(17, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((215, 34, 215, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((216, 34, 216, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(216, 57, 216, 61): '(18)', (216, 63, 216, 67): '(67)'}, {}), '(18, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((217, 34, 217, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((218, 34, 218, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(218, 57, 218, 61): '(18)', (218, 63, 218, 67): '(99)'}, {}), '(18, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((219, 34, 219, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((220, 34, 220, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(220, 57, 220, 61): '(21)', (220, 63, 220, 67): '(67)'}, {}), '(21, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((221, 34, 221, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((222, 34, 222, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(222, 57, 222, 61): '(21)', (222, 63, 222, 67): '(99)'}, {}), '(21, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((223, 34, 223, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((224, 34, 224, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(224, 57, 224, 61): '(22)', (224, 63, 224, 67): '(67)'}, {}), '(22, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((225, 34, 225, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((226, 34, 226, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(226, 57, 226, 61): '(22)', (226, 63, 226, 67): '(99)'}, {}), '(22, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((227, 34, 227, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((228, 34, 228, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(228, 57, 228, 61): '(23)', (228, 63, 228, 67): '(67)'}, {}), '(23, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((229, 34, 229, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((230, 34, 230, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(230, 57, 230, 61): '(23)', (230, 63, 230, 67): '(99)'}, {}), '(23, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((231, 34, 231, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((232, 34, 232, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(232, 57, 232, 61): '(16)', (232, 63, 232, 67): '(67)'}, {}), '(16, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((233, 34, 233, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((234, 34, 234, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(234, 57, 234, 61): '(19)', (234, 63, 234, 67): '(67)'}, {}), '(19, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((235, 34, 235, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((236, 34, 236, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(236, 57, 236, 61): '(19)', (236, 63, 236, 67): '(99)'}, {}), '(19, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((237, 34, 237, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((238, 34, 238, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(238, 57, 238, 61): '(20)', (238, 63, 238, 67): '(67)'}, {}), '(20, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((239, 34, 239, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((240, 34, 240, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(240, 57, 240, 61): '(20)', (240, 63, 240, 67): '(99)'}, {}), '(20, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((241, 34, 241, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((242, 34, 242, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(242, 57, 242, 61): '(25)', (242, 63, 242, 67): '(67)'}, {}), '(25, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((243, 34, 243, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((244, 34, 244, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(244, 57, 244, 61): '(25)', (244, 63, 244, 67): '(99)'}, {}), '(25, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((245, 34, 245, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((246, 34, 246, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(246, 57, 246, 61): '(26)', (246, 63, 246, 67): '(67)'}, {}), '(26, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((247, 34, 247, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((248, 34, 248, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(248, 57, 248, 61): '(26)', (248, 63, 248, 67): '(99)'}, {}), '(26, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((249, 34, 249, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((250, 34, 250, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(250, 57, 250, 61): '(29)', (250, 63, 250, 67): '(67)'}, {}), '(29, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((251, 34, 251, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((252, 34, 252, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(252, 57, 252, 61): '(29)', (252, 63, 252, 67): '(99)'}, {}), '(29, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((253, 34, 253, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((254, 34, 254, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(254, 57, 254, 61): '(30)', (254, 63, 254, 67): '(67)'}, {}), '(30, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((255, 34, 255, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((256, 34, 256, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(256, 57, 256, 61): '(30)', (256, 63, 256, 67): '(99)'}, {}), '(30, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((257, 34, 257, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((258, 34, 258, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(258, 57, 258, 61): '(31)', (258, 63, 258, 67): '(67)'}, {}), '(31, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((259, 34, 259, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((260, 34, 260, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(260, 57, 260, 61): '(31)', (260, 63, 260, 67): '(99)'}, {}), '(31, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((261, 34, 261, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((262, 34, 262, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(262, 57, 262, 61): '(24)', (262, 63, 262, 67): '(67)'}, {}), '(24, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((263, 34, 263, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((264, 34, 264, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(264, 57, 264, 61): '(27)', (264, 63, 264, 67): '(67)'}, {}), '(27, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((265, 34, 265, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((266, 34, 266, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(266, 57, 266, 61): '(27)', (266, 63, 266, 67): '(99)'}, {}), '(27, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((267, 34, 267, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((268, 34, 268, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(268, 57, 268, 61): '(28)', (268, 63, 268, 67): '(67)'}, {}), '(28, 67)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((269, 34, 269, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((270, 34, 270, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(270, 57, 270, 61): '(28)', (270, 63, 270, 67): '(99)'}, {}), '(28, 99)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((271, 34, 271, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((274, 34, 274, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(274, 57, 274, 61): '(17)', (274, 63, 274, 67): '(68)'}, {}), '(17, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((275, 34, 275, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(275, 57, 275, 61): '(17)', (275, 63, 275, 67): '(100)'}, {}), '(17, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((276, 34, 276, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(276, 57, 276, 61): '(18)', (276, 63, 276, 67): '(68)'}, {}), '(18, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((277, 34, 277, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(277, 57, 277, 61): '(18)', (277, 63, 277, 67): '(100)'}, {}), '(18, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((278, 34, 278, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(278, 57, 278, 61): '(21)', (278, 63, 278, 67): '(68)'}, {}), '(21, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((279, 34, 279, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(279, 57, 279, 61): '(21)', (279, 63, 279, 67): '(100)'}, {}), '(21, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((280, 34, 280, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(280, 57, 280, 61): '(22)', (280, 63, 280, 67): '(68)'}, {}), '(22, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((281, 34, 281, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(281, 57, 281, 61): '(22)', (281, 63, 281, 67): '(100)'}, {}), '(22, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((282, 34, 282, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(282, 57, 282, 61): '(23)', (282, 63, 282, 67): '(68)'}, {}), '(23, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((283, 34, 283, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(283, 57, 283, 61): '(23)', (283, 63, 283, 67): '(100)'}, {}), '(23, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((284, 34, 284, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(284, 57, 284, 61): '(16)', (284, 63, 284, 67): '(68)'}, {}), '(16, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((285, 34, 285, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(285, 57, 285, 61): '(19)', (285, 63, 285, 67): '(68)'}, {}), '(19, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((286, 34, 286, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(286, 57, 286, 61): '(19)', (286, 63, 286, 67): '(100)'}, {}), '(19, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((287, 34, 287, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(287, 57, 287, 61): '(20)', (287, 63, 287, 67): '(68)'}, {}), '(20, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((288, 34, 288, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(288, 57, 288, 61): '(20)', (288, 63, 288, 67): '(100)'}, {}), '(20, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((289, 34, 289, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(289, 57, 289, 61): '(25)', (289, 63, 289, 67): '(68)'}, {}), '(25, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((290, 34, 290, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(290, 57, 290, 61): '(25)', (290, 63, 290, 67): '(100)'}, {}), '(25, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((291, 34, 291, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(291, 57, 291, 61): '(26)', (291, 63, 291, 67): '(68)'}, {}), '(26, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((292, 34, 292, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(292, 57, 292, 61): '(26)', (292, 63, 292, 67): '(100)'}, {}), '(26, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((293, 34, 293, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(293, 57, 293, 61): '(29)', (293, 63, 293, 67): '(68)'}, {}), '(29, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((294, 34, 294, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(294, 57, 294, 61): '(29)', (294, 63, 294, 67): '(100)'}, {}), '(29, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((295, 34, 295, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(295, 57, 295, 61): '(30)', (295, 63, 295, 67): '(68)'}, {}), '(30, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((296, 34, 296, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(296, 57, 296, 61): '(30)', (296, 63, 296, 67): '(100)'}, {}), '(30, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((297, 34, 297, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(297, 57, 297, 61): '(31)', (297, 63, 297, 67): '(68)'}, {}), '(31, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((298, 34, 298, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(298, 57, 298, 61): '(31)', (298, 63, 298, 67): '(100)'}, {}), '(31, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((299, 34, 299, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(299, 57, 299, 61): '(24)', (299, 63, 299, 67): '(68)'}, {}), '(24, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((300, 34, 300, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(300, 57, 300, 61): '(27)', (300, 63, 300, 67): '(68)'}, {}), '(27, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((301, 34, 301, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(301, 57, 301, 61): '(27)', (301, 63, 301, 67): '(100)'}, {}), '(27, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((302, 34, 302, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(302, 57, 302, 61): '(28)', (302, 63, 302, 67): '(68)'}, {}), '(28, 68)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((303, 34, 303, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(303, 57, 303, 61): '(28)', (303, 63, 303, 67): '(100)'}, {}), '(28, 100)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((306, 34, 306, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(306, 57, 306, 61): '(17)', (306, 63, 306, 67): '(69)'}, {}), '(17, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((307, 34, 307, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((308, 34, 308, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(308, 57, 308, 61): '(17)', (308, 63, 308, 67): '(101)'}, {}), '(17, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((309, 34, 309, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((310, 34, 310, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(310, 57, 310, 61): '(18)', (310, 63, 310, 67): '(69)'}, {}), '(18, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((311, 34, 311, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((312, 34, 312, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(312, 57, 312, 61): '(18)', (312, 63, 312, 67): '(101)'}, {}), '(18, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((313, 34, 313, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((314, 34, 314, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(314, 57, 314, 61): '(21)', (314, 63, 314, 67): '(69)'}, {}), '(21, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((315, 34, 315, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((316, 34, 316, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(316, 57, 316, 61): '(21)', (316, 63, 316, 67): '(101)'}, {}), '(21, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((317, 34, 317, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((318, 34, 318, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(318, 57, 318, 61): '(22)', (318, 63, 318, 67): '(69)'}, {}), '(22, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((319, 34, 319, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((320, 34, 320, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(320, 57, 320, 61): '(22)', (320, 63, 320, 67): '(101)'}, {}), '(22, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((321, 34, 321, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((322, 34, 322, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(322, 57, 322, 61): '(23)', (322, 63, 322, 67): '(69)'}, {}), '(23, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((323, 34, 323, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((324, 34, 324, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(324, 57, 324, 61): '(23)', (324, 63, 324, 67): '(101)'}, {}), '(23, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((325, 34, 325, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((326, 34, 326, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(326, 57, 326, 61): '(16)', (326, 63, 326, 67): '(69)'}, {}), '(16, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((327, 34, 327, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((328, 34, 328, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(328, 57, 328, 61): '(19)', (328, 63, 328, 67): '(69)'}, {}), '(19, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((329, 34, 329, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((330, 34, 330, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(330, 57, 330, 61): '(19)', (330, 63, 330, 67): '(101)'}, {}), '(19, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((331, 34, 331, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((332, 34, 332, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(332, 57, 332, 61): '(20)', (332, 63, 332, 67): '(69)'}, {}), '(20, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((333, 34, 333, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((334, 34, 334, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(334, 57, 334, 61): '(20)', (334, 63, 334, 67): '(101)'}, {}), '(20, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((335, 34, 335, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((336, 34, 336, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(336, 57, 336, 61): '(25)', (336, 63, 336, 67): '(69)'}, {}), '(25, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((337, 34, 337, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((338, 34, 338, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(338, 57, 338, 61): '(25)', (338, 63, 338, 67): '(101)'}, {}), '(25, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((339, 34, 339, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((340, 34, 340, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(340, 57, 340, 61): '(26)', (340, 63, 340, 67): '(69)'}, {}), '(26, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((341, 34, 341, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((342, 34, 342, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(342, 57, 342, 61): '(26)', (342, 63, 342, 67): '(101)'}, {}), '(26, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((343, 34, 343, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((344, 34, 344, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(344, 57, 344, 61): '(29)', (344, 63, 344, 67): '(69)'}, {}), '(29, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((345, 34, 345, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((346, 34, 346, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(346, 57, 346, 61): '(29)', (346, 63, 346, 67): '(101)'}, {}), '(29, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((347, 34, 347, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((348, 34, 348, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(348, 57, 348, 61): '(30)', (348, 63, 348, 67): '(69)'}, {}), '(30, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((349, 34, 349, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((350, 34, 350, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(350, 57, 350, 61): '(30)', (350, 63, 350, 67): '(101)'}, {}), '(30, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((351, 34, 351, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((352, 34, 352, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(352, 57, 352, 61): '(31)', (352, 63, 352, 67): '(69)'}, {}), '(31, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((353, 34, 353, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((354, 34, 354, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(354, 57, 354, 61): '(31)', (354, 63, 354, 67): '(101)'}, {}), '(31, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((355, 34, 355, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((356, 34, 356, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(356, 57, 356, 61): '(24)', (356, 63, 356, 67): '(69)'}, {}), '(24, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((357, 34, 357, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((358, 34, 358, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(358, 57, 358, 61): '(27)', (358, 63, 358, 67): '(69)'}, {}), '(27, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((359, 34, 359, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((360, 34, 360, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(360, 57, 360, 61): '(27)', (360, 63, 360, 67): '(101)'}, {}), '(27, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((361, 34, 361, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((362, 34, 362, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(362, 57, 362, 61): '(28)', (362, 63, 362, 67): '(69)'}, {}), '(28, 69)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((363, 34, 363, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((364, 34, 364, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(364, 57, 364, 61): '(28)', (364, 63, 364, 67): '(101)'}, {}), '(28, 101)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((365, 34, 365, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((368, 34, 368, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(368, 57, 368, 61): '(17)', (368, 63, 368, 67): '(70)'}, {}), '(17, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((369, 34, 369, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(369, 57, 369, 61): '(17)', (369, 63, 369, 67): '(102)'}, {}), '(17, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((370, 34, 370, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(370, 57, 370, 61): '(18)', (370, 63, 370, 67): '(70)'}, {}), '(18, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((371, 34, 371, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(371, 57, 371, 61): '(18)', (371, 63, 371, 67): '(102)'}, {}), '(18, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((372, 34, 372, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(372, 57, 372, 61): '(21)', (372, 63, 372, 67): '(70)'}, {}), '(21, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((373, 34, 373, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(373, 57, 373, 61): '(21)', (373, 63, 373, 67): '(102)'}, {}), '(21, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((374, 34, 374, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(374, 57, 374, 61): '(22)', (374, 63, 374, 67): '(70)'}, {}), '(22, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((375, 34, 375, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(375, 57, 375, 61): '(22)', (375, 63, 375, 67): '(102)'}, {}), '(22, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((376, 34, 376, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(376, 57, 376, 61): '(23)', (376, 63, 376, 67): '(70)'}, {}), '(23, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((377, 34, 377, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(377, 57, 377, 61): '(23)', (377, 63, 377, 67): '(102)'}, {}), '(23, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((378, 34, 378, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(378, 57, 378, 61): '(16)', (378, 63, 378, 67): '(70)'}, {}), '(16, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((379, 34, 379, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(379, 57, 379, 61): '(19)', (379, 63, 379, 67): '(70)'}, {}), '(19, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((380, 34, 380, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(380, 57, 380, 61): '(19)', (380, 63, 380, 67): '(102)'}, {}), '(19, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((381, 34, 381, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(381, 57, 381, 61): '(20)', (381, 63, 381, 67): '(70)'}, {}), '(20, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((382, 34, 382, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(382, 57, 382, 61): '(20)', (382, 63, 382, 67): '(102)'}, {}), '(20, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((383, 34, 383, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(383, 57, 383, 61): '(25)', (383, 63, 383, 67): '(70)'}, {}), '(25, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((384, 34, 384, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(384, 57, 384, 61): '(25)', (384, 63, 384, 67): '(102)'}, {}), '(25, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((385, 34, 385, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(385, 57, 385, 61): '(26)', (385, 63, 385, 67): '(70)'}, {}), '(26, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((386, 34, 386, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(386, 57, 386, 61): '(26)', (386, 63, 386, 67): '(102)'}, {}), '(26, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((387, 34, 387, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(387, 57, 387, 61): '(29)', (387, 63, 387, 67): '(70)'}, {}), '(29, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((388, 34, 388, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(388, 57, 388, 61): '(29)', (388, 63, 388, 67): '(102)'}, {}), '(29, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((389, 34, 389, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(389, 57, 389, 61): '(30)', (389, 63, 389, 67): '(70)'}, {}), '(30, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((390, 34, 390, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(390, 57, 390, 61): '(30)', (390, 63, 390, 67): '(102)'}, {}), '(30, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((391, 34, 391, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(391, 57, 391, 61): '(31)', (391, 63, 391, 67): '(70)'}, {}), '(31, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((392, 34, 392, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(392, 57, 392, 61): '(31)', (392, 63, 392, 67): '(102)'}, {}), '(31, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((393, 34, 393, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(393, 57, 393, 61): '(24)', (393, 63, 393, 67): '(70)'}, {}), '(24, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((394, 34, 394, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(394, 57, 394, 61): '(27)', (394, 63, 394, 67): '(70)'}, {}), '(27, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((395, 34, 395, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(395, 57, 395, 61): '(27)', (395, 63, 395, 67): '(102)'}, {}), '(27, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((396, 34, 396, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(396, 57, 396, 61): '(28)', (396, 63, 396, 67): '(70)'}, {}), '(28, 70)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((397, 34, 397, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(397, 57, 397, 61): '(28)', (397, 63, 397, 67): '(102)'}, {}), '(28, 102)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((400, 34, 400, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(400, 57, 400, 61): '(17)', (400, 63, 400, 67): '(71)'}, {}), '(17, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((401, 34, 401, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((402, 34, 402, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(402, 57, 402, 61): '(17)', (402, 63, 402, 67): '(103)'}, {}), '(17, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((403, 34, 403, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((404, 34, 404, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(404, 57, 404, 61): '(18)', (404, 63, 404, 67): '(71)'}, {}), '(18, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((405, 34, 405, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((406, 34, 406, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(406, 57, 406, 61): '(18)', (406, 63, 406, 67): '(103)'}, {}), '(18, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((407, 34, 407, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((408, 34, 408, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(408, 57, 408, 61): '(21)', (408, 63, 408, 67): '(71)'}, {}), '(21, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((409, 34, 409, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((410, 34, 410, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(410, 57, 410, 61): '(21)', (410, 63, 410, 67): '(103)'}, {}), '(21, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((411, 34, 411, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((412, 34, 412, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(412, 57, 412, 61): '(22)', (412, 63, 412, 67): '(71)'}, {}), '(22, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((413, 34, 413, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((414, 34, 414, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(414, 57, 414, 61): '(22)', (414, 63, 414, 67): '(103)'}, {}), '(22, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((415, 34, 415, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((416, 34, 416, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(416, 57, 416, 61): '(23)', (416, 63, 416, 67): '(71)'}, {}), '(23, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((417, 34, 417, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((418, 34, 418, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(418, 57, 418, 61): '(23)', (418, 63, 418, 67): '(103)'}, {}), '(23, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((419, 34, 419, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((420, 34, 420, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(420, 57, 420, 61): '(16)', (420, 63, 420, 67): '(71)'}, {}), '(16, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((421, 34, 421, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((422, 34, 422, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(422, 57, 422, 61): '(19)', (422, 63, 422, 67): '(71)'}, {}), '(19, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((423, 34, 423, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((424, 34, 424, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(424, 57, 424, 61): '(19)', (424, 63, 424, 67): '(103)'}, {}), '(19, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((425, 34, 425, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((426, 34, 426, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(426, 57, 426, 61): '(20)', (426, 63, 426, 67): '(71)'}, {}), '(20, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((427, 34, 427, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((428, 34, 428, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(428, 57, 428, 61): '(20)', (428, 63, 428, 67): '(103)'}, {}), '(20, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((429, 34, 429, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((430, 34, 430, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(430, 57, 430, 61): '(25)', (430, 63, 430, 67): '(71)'}, {}), '(25, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((431, 34, 431, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((432, 34, 432, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(432, 57, 432, 61): '(25)', (432, 63, 432, 67): '(103)'}, {}), '(25, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((433, 34, 433, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((434, 34, 434, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(434, 57, 434, 61): '(26)', (434, 63, 434, 67): '(71)'}, {}), '(26, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((435, 34, 435, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((436, 34, 436, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(436, 57, 436, 61): '(26)', (436, 63, 436, 67): '(103)'}, {}), '(26, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((437, 34, 437, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((438, 34, 438, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(438, 57, 438, 61): '(29)', (438, 63, 438, 67): '(71)'}, {}), '(29, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((439, 34, 439, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((440, 34, 440, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(440, 57, 440, 61): '(29)', (440, 63, 440, 67): '(103)'}, {}), '(29, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((441, 34, 441, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((442, 34, 442, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(442, 57, 442, 61): '(30)', (442, 63, 442, 67): '(71)'}, {}), '(30, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((443, 34, 443, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((444, 34, 444, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(444, 57, 444, 61): '(30)', (444, 63, 444, 67): '(103)'}, {}), '(30, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((445, 34, 445, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((446, 34, 446, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(446, 57, 446, 61): '(31)', (446, 63, 446, 67): '(71)'}, {}), '(31, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((447, 34, 447, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((448, 34, 448, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(448, 57, 448, 61): '(31)', (448, 63, 448, 67): '(103)'}, {}), '(31, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((449, 34, 449, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((450, 34, 450, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(450, 57, 450, 61): '(24)', (450, 63, 450, 67): '(71)'}, {}), '(24, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((451, 34, 451, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((452, 34, 452, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(452, 57, 452, 61): '(27)', (452, 63, 452, 67): '(71)'}, {}), '(27, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((453, 34, 453, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((454, 34, 454, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(454, 57, 454, 61): '(27)', (454, 63, 454, 67): '(103)'}, {}), '(27, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((455, 34, 455, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((456, 34, 456, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(456, 57, 456, 61): '(28)', (456, 63, 456, 67): '(71)'}, {}), '(28, 71)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((457, 34, 457, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((458, 34, 458, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(458, 57, 458, 61): '(28)', (458, 63, 458, 67): '(103)'}, {}), '(28, 103)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((459, 34, 459, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((462, 34, 462, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(462, 57, 462, 61): '(17)', (462, 63, 462, 67): '(72)'}, {}), '(17, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((463, 34, 463, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(463, 57, 463, 61): '(17)', (463, 63, 463, 67): '(104)'}, {}), '(17, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((464, 34, 464, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(464, 57, 464, 61): '(18)', (464, 63, 464, 67): '(72)'}, {}), '(18, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((465, 34, 465, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(465, 57, 465, 61): '(18)', (465, 63, 465, 67): '(104)'}, {}), '(18, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((466, 34, 466, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(466, 57, 466, 61): '(21)', (466, 63, 466, 67): '(72)'}, {}), '(21, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((467, 34, 467, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(467, 57, 467, 61): '(21)', (467, 63, 467, 67): '(104)'}, {}), '(21, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((468, 34, 468, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(468, 57, 468, 61): '(22)', (468, 63, 468, 67): '(72)'}, {}), '(22, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((469, 34, 469, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(469, 57, 469, 61): '(22)', (469, 63, 469, 67): '(104)'}, {}), '(22, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((470, 34, 470, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(470, 57, 470, 61): '(23)', (470, 63, 470, 67): '(72)'}, {}), '(23, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((471, 34, 471, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(471, 57, 471, 61): '(23)', (471, 63, 471, 67): '(104)'}, {}), '(23, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((472, 34, 472, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(472, 57, 472, 61): '(16)', (472, 63, 472, 67): '(72)'}, {}), '(16, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((473, 34, 473, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(473, 57, 473, 61): '(19)', (473, 63, 473, 67): '(72)'}, {}), '(19, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((474, 34, 474, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(474, 57, 474, 61): '(19)', (474, 63, 474, 67): '(104)'}, {}), '(19, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((475, 34, 475, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(475, 57, 475, 61): '(20)', (475, 63, 475, 67): '(72)'}, {}), '(20, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((476, 34, 476, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(476, 57, 476, 61): '(20)', (476, 63, 476, 67): '(104)'}, {}), '(20, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((477, 34, 477, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(477, 57, 477, 61): '(25)', (477, 63, 477, 67): '(72)'}, {}), '(25, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((478, 34, 478, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(478, 57, 478, 61): '(25)', (478, 63, 478, 67): '(104)'}, {}), '(25, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((479, 34, 479, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(479, 57, 479, 61): '(26)', (479, 63, 479, 67): '(72)'}, {}), '(26, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((480, 34, 480, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(480, 57, 480, 61): '(26)', (480, 63, 480, 67): '(104)'}, {}), '(26, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((481, 34, 481, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(481, 57, 481, 61): '(29)', (481, 63, 481, 67): '(72)'}, {}), '(29, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((482, 34, 482, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(482, 57, 482, 61): '(29)', (482, 63, 482, 67): '(104)'}, {}), '(29, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((483, 34, 483, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(483, 57, 483, 61): '(30)', (483, 63, 483, 67): '(72)'}, {}), '(30, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((484, 34, 484, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(484, 57, 484, 61): '(30)', (484, 63, 484, 67): '(104)'}, {}), '(30, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((485, 34, 485, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(485, 57, 485, 61): '(31)', (485, 63, 485, 67): '(72)'}, {}), '(31, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((486, 34, 486, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(486, 57, 486, 61): '(31)', (486, 63, 486, 67): '(104)'}, {}), '(31, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((487, 34, 487, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(487, 57, 487, 61): '(24)', (487, 63, 487, 67): '(72)'}, {}), '(24, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((488, 34, 488, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(488, 57, 488, 61): '(27)', (488, 63, 488, 67): '(72)'}, {}), '(27, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((489, 34, 489, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(489, 57, 489, 61): '(27)', (489, 63, 489, 67): '(104)'}, {}), '(27, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((490, 34, 490, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(490, 57, 490, 61): '(28)', (490, 63, 490, 67): '(72)'}, {}), '(28, 72)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((491, 34, 491, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(491, 57, 491, 61): '(28)', (491, 63, 491, 67): '(104)'}, {}), '(28, 104)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((494, 34, 494, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(494, 57, 494, 61): '(17)', (494, 63, 494, 67): '(73)'}, {}), '(17, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((495, 34, 495, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((496, 34, 496, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(496, 57, 496, 61): '(17)', (496, 63, 496, 67): '(105)'}, {}), '(17, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((497, 34, 497, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((498, 34, 498, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(498, 57, 498, 61): '(18)', (498, 63, 498, 67): '(73)'}, {}), '(18, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((499, 34, 499, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((500, 34, 500, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(500, 57, 500, 61): '(18)', (500, 63, 500, 67): '(105)'}, {}), '(18, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((501, 34, 501, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((502, 34, 502, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(502, 57, 502, 61): '(21)', (502, 63, 502, 67): '(73)'}, {}), '(21, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((503, 34, 503, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((504, 34, 504, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(504, 57, 504, 61): '(21)', (504, 63, 504, 67): '(105)'}, {}), '(21, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((505, 34, 505, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((506, 34, 506, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(506, 57, 506, 61): '(22)', (506, 63, 506, 67): '(73)'}, {}), '(22, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((507, 34, 507, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((508, 34, 508, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(508, 57, 508, 61): '(22)', (508, 63, 508, 67): '(105)'}, {}), '(22, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((509, 34, 509, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((510, 34, 510, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(510, 57, 510, 61): '(23)', (510, 63, 510, 67): '(73)'}, {}), '(23, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((511, 34, 511, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((512, 34, 512, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(512, 57, 512, 61): '(23)', (512, 63, 512, 67): '(105)'}, {}), '(23, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((513, 34, 513, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((514, 34, 514, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(514, 57, 514, 61): '(16)', (514, 63, 514, 67): '(73)'}, {}), '(16, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((515, 34, 515, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((516, 34, 516, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(516, 57, 516, 61): '(19)', (516, 63, 516, 67): '(73)'}, {}), '(19, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((517, 34, 517, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((518, 34, 518, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(518, 57, 518, 61): '(19)', (518, 63, 518, 67): '(105)'}, {}), '(19, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((519, 34, 519, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((520, 34, 520, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(520, 57, 520, 61): '(20)', (520, 63, 520, 67): '(73)'}, {}), '(20, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((521, 34, 521, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((522, 34, 522, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(522, 57, 522, 61): '(20)', (522, 63, 522, 67): '(105)'}, {}), '(20, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((523, 34, 523, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((524, 34, 524, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(524, 57, 524, 61): '(25)', (524, 63, 524, 67): '(73)'}, {}), '(25, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((525, 34, 525, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((526, 34, 526, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(526, 57, 526, 61): '(25)', (526, 63, 526, 67): '(105)'}, {}), '(25, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((527, 34, 527, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((528, 34, 528, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(528, 57, 528, 61): '(26)', (528, 63, 528, 67): '(73)'}, {}), '(26, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((529, 34, 529, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((530, 34, 530, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(530, 57, 530, 61): '(26)', (530, 63, 530, 67): '(105)'}, {}), '(26, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((531, 34, 531, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((532, 34, 532, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(532, 57, 532, 61): '(29)', (532, 63, 532, 67): '(73)'}, {}), '(29, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((533, 34, 533, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((534, 34, 534, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(534, 57, 534, 61): '(29)', (534, 63, 534, 67): '(105)'}, {}), '(29, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((535, 34, 535, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((536, 34, 536, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(536, 57, 536, 61): '(30)', (536, 63, 536, 67): '(73)'}, {}), '(30, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((537, 34, 537, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((538, 34, 538, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(538, 57, 538, 61): '(30)', (538, 63, 538, 67): '(105)'}, {}), '(30, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((539, 34, 539, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((540, 34, 540, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(540, 57, 540, 61): '(31)', (540, 63, 540, 67): '(73)'}, {}), '(31, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((541, 34, 541, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((542, 34, 542, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(542, 57, 542, 61): '(31)', (542, 63, 542, 67): '(105)'}, {}), '(31, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((543, 34, 543, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((544, 34, 544, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(544, 57, 544, 61): '(24)', (544, 63, 544, 67): '(73)'}, {}), '(24, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((545, 34, 545, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((546, 34, 546, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(546, 57, 546, 61): '(27)', (546, 63, 546, 67): '(73)'}, {}), '(27, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((547, 34, 547, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((548, 34, 548, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(548, 57, 548, 61): '(27)', (548, 63, 548, 67): '(105)'}, {}), '(27, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((549, 34, 549, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((550, 34, 550, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(550, 57, 550, 61): '(28)', (550, 63, 550, 67): '(73)'}, {}), '(28, 73)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((551, 34, 551, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((552, 34, 552, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(552, 57, 552, 61): '(28)', (552, 63, 552, 67): '(105)'}, {}), '(28, 105)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((553, 34, 553, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((556, 34, 556, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(556, 57, 556, 61): '(17)', (556, 63, 556, 67): '(74)'}, {}), '(17, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((557, 34, 557, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(557, 57, 557, 61): '(17)', (557, 63, 557, 67): '(106)'}, {}), '(17, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((558, 34, 558, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(558, 57, 558, 61): '(18)', (558, 63, 558, 67): '(74)'}, {}), '(18, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((559, 34, 559, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(559, 57, 559, 61): '(18)', (559, 63, 559, 67): '(106)'}, {}), '(18, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((560, 34, 560, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(560, 57, 560, 61): '(21)', (560, 63, 560, 67): '(74)'}, {}), '(21, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((561, 34, 561, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(561, 57, 561, 61): '(21)', (561, 63, 561, 67): '(106)'}, {}), '(21, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((562, 34, 562, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(562, 57, 562, 61): '(22)', (562, 63, 562, 67): '(74)'}, {}), '(22, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((563, 34, 563, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(563, 57, 563, 61): '(22)', (563, 63, 563, 67): '(106)'}, {}), '(22, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((564, 34, 564, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(564, 57, 564, 61): '(23)', (564, 63, 564, 67): '(74)'}, {}), '(23, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((565, 34, 565, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(565, 57, 565, 61): '(23)', (565, 63, 565, 67): '(106)'}, {}), '(23, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((566, 34, 566, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(566, 57, 566, 61): '(16)', (566, 63, 566, 67): '(74)'}, {}), '(16, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((567, 34, 567, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(567, 57, 567, 61): '(19)', (567, 63, 567, 67): '(74)'}, {}), '(19, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((568, 34, 568, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(568, 57, 568, 61): '(19)', (568, 63, 568, 67): '(106)'}, {}), '(19, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((569, 34, 569, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(569, 57, 569, 61): '(20)', (569, 63, 569, 67): '(74)'}, {}), '(20, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((570, 34, 570, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(570, 57, 570, 61): '(20)', (570, 63, 570, 67): '(106)'}, {}), '(20, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((571, 34, 571, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(571, 57, 571, 61): '(25)', (571, 63, 571, 67): '(74)'}, {}), '(25, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((572, 34, 572, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(572, 57, 572, 61): '(25)', (572, 63, 572, 67): '(106)'}, {}), '(25, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((573, 34, 573, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(573, 57, 573, 61): '(26)', (573, 63, 573, 67): '(74)'}, {}), '(26, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((574, 34, 574, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(574, 57, 574, 61): '(26)', (574, 63, 574, 67): '(106)'}, {}), '(26, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((575, 34, 575, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(575, 57, 575, 61): '(29)', (575, 63, 575, 67): '(74)'}, {}), '(29, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((576, 34, 576, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(576, 57, 576, 61): '(29)', (576, 63, 576, 67): '(106)'}, {}), '(29, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((577, 34, 577, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(577, 57, 577, 61): '(30)', (577, 63, 577, 67): '(74)'}, {}), '(30, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((578, 34, 578, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(578, 57, 578, 61): '(30)', (578, 63, 578, 67): '(106)'}, {}), '(30, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((579, 34, 579, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(579, 57, 579, 61): '(31)', (579, 63, 579, 67): '(74)'}, {}), '(31, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((580, 34, 580, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(580, 57, 580, 61): '(31)', (580, 63, 580, 67): '(106)'}, {}), '(31, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((581, 34, 581, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(581, 57, 581, 61): '(24)', (581, 63, 581, 67): '(74)'}, {}), '(24, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((582, 34, 582, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(582, 57, 582, 61): '(27)', (582, 63, 582, 67): '(74)'}, {}), '(27, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((583, 34, 583, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(583, 57, 583, 61): '(27)', (583, 63, 583, 67): '(106)'}, {}), '(27, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((584, 34, 584, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(584, 57, 584, 61): '(28)', (584, 63, 584, 67): '(74)'}, {}), '(28, 74)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((585, 34, 585, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(585, 57, 585, 61): '(28)', (585, 63, 585, 67): '(106)'}, {}), '(28, 106)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((588, 34, 588, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(588, 57, 588, 61): '(17)', (588, 63, 588, 67): '(75)'}, {}), '(17, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((589, 34, 589, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((590, 34, 590, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(590, 57, 590, 61): '(17)', (590, 63, 590, 67): '(107)'}, {}), '(17, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((591, 34, 591, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((592, 34, 592, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(592, 57, 592, 61): '(18)', (592, 63, 592, 67): '(75)'}, {}), '(18, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((593, 34, 593, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((594, 34, 594, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(594, 57, 594, 61): '(18)', (594, 63, 594, 67): '(107)'}, {}), '(18, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((595, 34, 595, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((596, 34, 596, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(596, 57, 596, 61): '(21)', (596, 63, 596, 67): '(75)'}, {}), '(21, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((597, 34, 597, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((598, 34, 598, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(598, 57, 598, 61): '(21)', (598, 63, 598, 67): '(107)'}, {}), '(21, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((599, 34, 599, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((600, 34, 600, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(600, 57, 600, 61): '(22)', (600, 63, 600, 67): '(75)'}, {}), '(22, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((601, 34, 601, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((602, 34, 602, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(602, 57, 602, 61): '(22)', (602, 63, 602, 67): '(107)'}, {}), '(22, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((603, 34, 603, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((604, 34, 604, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(604, 57, 604, 61): '(23)', (604, 63, 604, 67): '(75)'}, {}), '(23, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((605, 34, 605, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((606, 34, 606, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(606, 57, 606, 61): '(23)', (606, 63, 606, 67): '(107)'}, {}), '(23, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((607, 34, 607, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((608, 34, 608, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(608, 57, 608, 61): '(16)', (608, 63, 608, 67): '(75)'}, {}), '(16, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((609, 34, 609, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((610, 34, 610, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(610, 57, 610, 61): '(19)', (610, 63, 610, 67): '(75)'}, {}), '(19, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((611, 34, 611, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((612, 34, 612, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(612, 57, 612, 61): '(19)', (612, 63, 612, 67): '(107)'}, {}), '(19, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((613, 34, 613, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((614, 34, 614, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(614, 57, 614, 61): '(20)', (614, 63, 614, 67): '(75)'}, {}), '(20, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((615, 34, 615, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((616, 34, 616, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(616, 57, 616, 61): '(20)', (616, 63, 616, 67): '(107)'}, {}), '(20, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((617, 34, 617, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((618, 34, 618, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(618, 57, 618, 61): '(25)', (618, 63, 618, 67): '(75)'}, {}), '(25, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((619, 34, 619, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((620, 34, 620, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(620, 57, 620, 61): '(25)', (620, 63, 620, 67): '(107)'}, {}), '(25, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((621, 34, 621, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((622, 34, 622, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(622, 57, 622, 61): '(26)', (622, 63, 622, 67): '(75)'}, {}), '(26, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((623, 34, 623, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((624, 34, 624, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(624, 57, 624, 61): '(26)', (624, 63, 624, 67): '(107)'}, {}), '(26, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((625, 34, 625, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((626, 34, 626, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(626, 57, 626, 61): '(29)', (626, 63, 626, 67): '(75)'}, {}), '(29, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((627, 34, 627, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((628, 34, 628, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(628, 57, 628, 61): '(29)', (628, 63, 628, 67): '(107)'}, {}), '(29, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((629, 34, 629, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((630, 34, 630, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(630, 57, 630, 61): '(30)', (630, 63, 630, 67): '(75)'}, {}), '(30, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((631, 34, 631, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((632, 34, 632, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(632, 57, 632, 61): '(30)', (632, 63, 632, 67): '(107)'}, {}), '(30, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((633, 34, 633, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((634, 34, 634, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(634, 57, 634, 61): '(31)', (634, 63, 634, 67): '(75)'}, {}), '(31, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((635, 34, 635, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((636, 34, 636, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(636, 57, 636, 61): '(31)', (636, 63, 636, 67): '(107)'}, {}), '(31, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((637, 34, 637, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((638, 34, 638, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(638, 57, 638, 61): '(24)', (638, 63, 638, 67): '(75)'}, {}), '(24, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((639, 34, 639, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((640, 34, 640, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(640, 57, 640, 61): '(27)', (640, 63, 640, 67): '(75)'}, {}), '(27, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((641, 34, 641, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((642, 34, 642, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(642, 57, 642, 61): '(27)', (642, 63, 642, 67): '(107)'}, {}), '(27, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((643, 34, 643, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((644, 34, 644, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(644, 57, 644, 61): '(28)', (644, 63, 644, 67): '(75)'}, {}), '(28, 75)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((645, 34, 645, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((646, 34, 646, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(646, 57, 646, 61): '(28)', (646, 63, 646, 67): '(107)'}, {}), '(28, 107)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((647, 34, 647, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((650, 34, 650, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(650, 57, 650, 61): '(17)', (650, 63, 650, 67): '(76)'}, {}), '(17, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((651, 34, 651, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(651, 57, 651, 61): '(17)', (651, 63, 651, 67): '(108)'}, {}), '(17, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((652, 34, 652, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(652, 57, 652, 61): '(18)', (652, 63, 652, 67): '(76)'}, {}), '(18, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((653, 34, 653, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(653, 57, 653, 61): '(18)', (653, 63, 653, 67): '(108)'}, {}), '(18, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((654, 34, 654, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(654, 57, 654, 61): '(21)', (654, 63, 654, 67): '(76)'}, {}), '(21, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((655, 34, 655, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(655, 57, 655, 61): '(21)', (655, 63, 655, 67): '(108)'}, {}), '(21, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((656, 34, 656, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(656, 57, 656, 61): '(22)', (656, 63, 656, 67): '(76)'}, {}), '(22, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((657, 34, 657, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(657, 57, 657, 61): '(22)', (657, 63, 657, 67): '(108)'}, {}), '(22, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((658, 34, 658, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(658, 57, 658, 61): '(23)', (658, 63, 658, 67): '(76)'}, {}), '(23, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((659, 34, 659, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(659, 57, 659, 61): '(23)', (659, 63, 659, 67): '(108)'}, {}), '(23, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((660, 34, 660, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(660, 57, 660, 61): '(16)', (660, 63, 660, 67): '(76)'}, {}), '(16, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((661, 34, 661, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(661, 57, 661, 61): '(19)', (661, 63, 661, 67): '(76)'}, {}), '(19, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((662, 34, 662, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(662, 57, 662, 61): '(19)', (662, 63, 662, 67): '(108)'}, {}), '(19, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((663, 34, 663, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(663, 57, 663, 61): '(20)', (663, 63, 663, 67): '(76)'}, {}), '(20, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((664, 34, 664, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(664, 57, 664, 61): '(20)', (664, 63, 664, 67): '(108)'}, {}), '(20, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((665, 34, 665, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(665, 57, 665, 61): '(25)', (665, 63, 665, 67): '(76)'}, {}), '(25, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((666, 34, 666, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(666, 57, 666, 61): '(25)', (666, 63, 666, 67): '(108)'}, {}), '(25, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((667, 34, 667, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(667, 57, 667, 61): '(26)', (667, 63, 667, 67): '(76)'}, {}), '(26, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((668, 34, 668, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(668, 57, 668, 61): '(26)', (668, 63, 668, 67): '(108)'}, {}), '(26, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((669, 34, 669, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(669, 57, 669, 61): '(29)', (669, 63, 669, 67): '(76)'}, {}), '(29, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((670, 34, 670, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(670, 57, 670, 61): '(29)', (670, 63, 670, 67): '(108)'}, {}), '(29, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((671, 34, 671, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(671, 57, 671, 61): '(30)', (671, 63, 671, 67): '(76)'}, {}), '(30, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((672, 34, 672, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(672, 57, 672, 61): '(30)', (672, 63, 672, 67): '(108)'}, {}), '(30, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((673, 34, 673, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(673, 57, 673, 61): '(31)', (673, 63, 673, 67): '(76)'}, {}), '(31, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((674, 34, 674, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(674, 57, 674, 61): '(31)', (674, 63, 674, 67): '(108)'}, {}), '(31, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((675, 34, 675, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(675, 57, 675, 61): '(24)', (675, 63, 675, 67): '(76)'}, {}), '(24, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((676, 34, 676, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(676, 57, 676, 61): '(27)', (676, 63, 676, 67): '(76)'}, {}), '(27, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((677, 34, 677, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(677, 57, 677, 61): '(27)', (677, 63, 677, 67): '(108)'}, {}), '(27, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((678, 34, 678, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(678, 57, 678, 61): '(28)', (678, 63, 678, 67): '(76)'}, {}), '(28, 76)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((679, 34, 679, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(679, 57, 679, 61): '(28)', (679, 63, 679, 67): '(108)'}, {}), '(28, 108)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((682, 34, 682, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(682, 57, 682, 61): '(17)', (682, 63, 682, 67): '(77)'}, {}), '(17, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((683, 34, 683, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((684, 34, 684, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(684, 57, 684, 61): '(17)', (684, 63, 684, 67): '(109)'}, {}), '(17, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((685, 34, 685, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((686, 34, 686, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(686, 57, 686, 61): '(18)', (686, 63, 686, 67): '(77)'}, {}), '(18, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((687, 34, 687, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((688, 34, 688, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(688, 57, 688, 61): '(18)', (688, 63, 688, 67): '(109)'}, {}), '(18, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((689, 34, 689, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((690, 34, 690, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(690, 57, 690, 61): '(21)', (690, 63, 690, 67): '(77)'}, {}), '(21, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((691, 34, 691, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((692, 34, 692, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(692, 57, 692, 61): '(21)', (692, 63, 692, 67): '(109)'}, {}), '(21, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((693, 34, 693, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((694, 34, 694, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(694, 57, 694, 61): '(22)', (694, 63, 694, 67): '(77)'}, {}), '(22, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((695, 34, 695, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((696, 34, 696, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(696, 57, 696, 61): '(22)', (696, 63, 696, 67): '(109)'}, {}), '(22, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((697, 34, 697, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((698, 34, 698, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(698, 57, 698, 61): '(23)', (698, 63, 698, 67): '(77)'}, {}), '(23, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((699, 34, 699, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((700, 34, 700, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(700, 57, 700, 61): '(23)', (700, 63, 700, 67): '(109)'}, {}), '(23, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((701, 34, 701, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((702, 34, 702, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(702, 57, 702, 61): '(16)', (702, 63, 702, 67): '(77)'}, {}), '(16, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((703, 34, 703, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((704, 34, 704, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(704, 57, 704, 61): '(19)', (704, 63, 704, 67): '(77)'}, {}), '(19, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((705, 34, 705, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((706, 34, 706, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(706, 57, 706, 61): '(19)', (706, 63, 706, 67): '(109)'}, {}), '(19, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((707, 34, 707, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((708, 34, 708, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(708, 57, 708, 61): '(20)', (708, 63, 708, 67): '(77)'}, {}), '(20, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((709, 34, 709, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((710, 34, 710, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(710, 57, 710, 61): '(20)', (710, 63, 710, 67): '(109)'}, {}), '(20, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((711, 34, 711, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((712, 34, 712, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(712, 57, 712, 61): '(25)', (712, 63, 712, 67): '(77)'}, {}), '(25, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((713, 34, 713, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((714, 34, 714, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(714, 57, 714, 61): '(25)', (714, 63, 714, 67): '(109)'}, {}), '(25, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((715, 34, 715, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((716, 34, 716, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(716, 57, 716, 61): '(26)', (716, 63, 716, 67): '(77)'}, {}), '(26, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((717, 34, 717, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((718, 34, 718, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(718, 57, 718, 61): '(26)', (718, 63, 718, 67): '(109)'}, {}), '(26, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((719, 34, 719, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((720, 34, 720, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(720, 57, 720, 61): '(29)', (720, 63, 720, 67): '(77)'}, {}), '(29, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((721, 34, 721, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((722, 34, 722, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(722, 57, 722, 61): '(29)', (722, 63, 722, 67): '(109)'}, {}), '(29, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((723, 34, 723, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((724, 34, 724, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(724, 57, 724, 61): '(30)', (724, 63, 724, 67): '(77)'}, {}), '(30, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((725, 34, 725, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((726, 34, 726, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(726, 57, 726, 61): '(30)', (726, 63, 726, 67): '(109)'}, {}), '(30, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((727, 34, 727, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((728, 34, 728, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(728, 57, 728, 61): '(31)', (728, 63, 728, 67): '(77)'}, {}), '(31, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((729, 34, 729, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((730, 34, 730, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(730, 57, 730, 61): '(31)', (730, 63, 730, 67): '(109)'}, {}), '(31, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((731, 34, 731, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((732, 34, 732, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(732, 57, 732, 61): '(24)', (732, 63, 732, 67): '(77)'}, {}), '(24, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((733, 34, 733, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((734, 34, 734, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(734, 57, 734, 61): '(27)', (734, 63, 734, 67): '(77)'}, {}), '(27, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((735, 34, 735, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((736, 34, 736, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(736, 57, 736, 61): '(27)', (736, 63, 736, 67): '(109)'}, {}), '(27, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((737, 34, 737, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((738, 34, 738, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(738, 57, 738, 61): '(28)', (738, 63, 738, 67): '(77)'}, {}), '(28, 77)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((739, 34, 739, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((740, 34, 740, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(740, 57, 740, 61): '(28)', (740, 63, 740, 67): '(109)'}, {}), '(28, 109)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((741, 34, 741, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((744, 34, 744, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(744, 57, 744, 61): '(17)', (744, 63, 744, 67): '(78)'}, {}), '(17, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((746, 34, 746, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(746, 57, 746, 61): '(17)', (746, 63, 746, 67): '(110)'}, {}), '(17, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((748, 34, 748, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(748, 57, 748, 61): '(18)', (748, 63, 748, 67): '(78)'}, {}), '(18, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((750, 34, 750, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(750, 57, 750, 61): '(18)', (750, 63, 750, 67): '(110)'}, {}), '(18, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((752, 34, 752, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(752, 57, 752, 61): '(21)', (752, 63, 752, 67): '(78)'}, {}), '(21, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((754, 34, 754, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(754, 57, 754, 61): '(21)', (754, 63, 754, 67): '(110)'}, {}), '(21, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((756, 34, 756, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(756, 57, 756, 61): '(22)', (756, 63, 756, 67): '(78)'}, {}), '(22, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((758, 34, 758, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(758, 57, 758, 61): '(22)', (758, 63, 758, 67): '(110)'}, {}), '(22, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((760, 34, 760, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(760, 57, 760, 61): '(23)', (760, 63, 760, 67): '(78)'}, {}), '(23, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((762, 34, 762, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(762, 57, 762, 61): '(23)', (762, 63, 762, 67): '(110)'}, {}), '(23, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((764, 34, 764, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(764, 57, 764, 61): '(16)', (764, 63, 764, 67): '(78)'}, {}), '(16, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((766, 34, 766, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(766, 57, 766, 61): '(19)', (766, 63, 766, 67): '(78)'}, {}), '(19, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((768, 34, 768, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(768, 57, 768, 61): '(19)', (768, 63, 768, 67): '(110)'}, {}), '(19, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((770, 34, 770, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(770, 57, 770, 61): '(20)', (770, 63, 770, 67): '(78)'}, {}), '(20, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((772, 34, 772, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(772, 57, 772, 61): '(20)', (772, 63, 772, 67): '(110)'}, {}), '(20, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((774, 34, 774, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(774, 57, 774, 61): '(25)', (774, 63, 774, 67): '(78)'}, {}), '(25, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((776, 34, 776, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(776, 57, 776, 61): '(25)', (776, 63, 776, 67): '(110)'}, {}), '(25, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((778, 34, 778, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(778, 57, 778, 61): '(26)', (778, 63, 778, 67): '(78)'}, {}), '(26, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((780, 34, 780, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(780, 57, 780, 61): '(26)', (780, 63, 780, 67): '(110)'}, {}), '(26, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((782, 34, 782, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(782, 57, 782, 61): '(29)', (782, 63, 782, 67): '(78)'}, {}), '(29, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((784, 34, 784, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(784, 57, 784, 61): '(29)', (784, 63, 784, 67): '(110)'}, {}), '(29, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((786, 34, 786, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(786, 57, 786, 61): '(30)', (786, 63, 786, 67): '(78)'}, {}), '(30, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((788, 34, 788, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(788, 57, 788, 61): '(30)', (788, 63, 788, 67): '(110)'}, {}), '(30, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((790, 34, 790, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(790, 57, 790, 61): '(31)', (790, 63, 790, 67): '(78)'}, {}), '(31, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((792, 34, 792, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(792, 57, 792, 61): '(31)', (792, 63, 792, 67): '(110)'}, {}), '(31, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((794, 34, 794, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(794, 57, 794, 61): '(24)', (794, 63, 794, 67): '(78)'}, {}), '(24, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((796, 34, 796, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(796, 57, 796, 61): '(27)', (796, 63, 796, 67): '(78)'}, {}), '(27, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((798, 34, 798, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(798, 57, 798, 61): '(27)', (798, 63, 798, 67): '(110)'}, {}), '(27, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((800, 34, 800, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(800, 57, 800, 61): '(28)', (800, 63, 800, 67): '(78)'}, {}), '(28, 78)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((802, 34, 802, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(802, 57, 802, 61): '(28)', (802, 63, 802, 67): '(110)'}, {}), '(28, 110)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((806, 34, 806, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(806, 57, 806, 61): '(17)', (806, 63, 806, 67): '(79)'}, {}), '(17, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((807, 34, 807, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((808, 34, 808, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(808, 57, 808, 61): '(17)', (808, 63, 808, 67): '(111)'}, {}), '(17, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((809, 34, 809, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((810, 34, 810, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(810, 57, 810, 61): '(18)', (810, 63, 810, 67): '(79)'}, {}), '(18, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((811, 34, 811, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((812, 34, 812, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(812, 57, 812, 61): '(18)', (812, 63, 812, 67): '(111)'}, {}), '(18, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((813, 34, 813, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((814, 34, 814, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(814, 57, 814, 61): '(21)', (814, 63, 814, 67): '(79)'}, {}), '(21, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((815, 34, 815, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((816, 34, 816, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(816, 57, 816, 61): '(21)', (816, 63, 816, 67): '(111)'}, {}), '(21, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((817, 34, 817, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((818, 34, 818, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(818, 57, 818, 61): '(22)', (818, 63, 818, 67): '(79)'}, {}), '(22, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((819, 34, 819, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((820, 34, 820, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(820, 57, 820, 61): '(22)', (820, 63, 820, 67): '(111)'}, {}), '(22, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((821, 34, 821, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((822, 34, 822, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(822, 57, 822, 61): '(23)', (822, 63, 822, 67): '(79)'}, {}), '(23, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((823, 34, 823, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((824, 34, 824, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(824, 57, 824, 61): '(23)', (824, 63, 824, 67): '(111)'}, {}), '(23, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((825, 34, 825, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((826, 34, 826, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(826, 57, 826, 61): '(16)', (826, 63, 826, 67): '(79)'}, {}), '(16, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((827, 34, 827, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((828, 34, 828, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(828, 57, 828, 61): '(19)', (828, 63, 828, 67): '(79)'}, {}), '(19, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((829, 34, 829, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((830, 34, 830, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(830, 57, 830, 61): '(19)', (830, 63, 830, 67): '(111)'}, {}), '(19, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((831, 34, 831, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((832, 34, 832, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(832, 57, 832, 61): '(20)', (832, 63, 832, 67): '(79)'}, {}), '(20, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((833, 34, 833, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((834, 34, 834, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(834, 57, 834, 61): '(20)', (834, 63, 834, 67): '(111)'}, {}), '(20, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((835, 34, 835, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((836, 34, 836, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(836, 57, 836, 61): '(25)', (836, 63, 836, 67): '(79)'}, {}), '(25, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((837, 34, 837, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((838, 34, 838, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(838, 57, 838, 61): '(25)', (838, 63, 838, 67): '(111)'}, {}), '(25, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((839, 34, 839, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((840, 34, 840, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(840, 57, 840, 61): '(26)', (840, 63, 840, 67): '(79)'}, {}), '(26, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((841, 34, 841, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((842, 34, 842, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(842, 57, 842, 61): '(26)', (842, 63, 842, 67): '(111)'}, {}), '(26, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((843, 34, 843, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((844, 34, 844, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(844, 57, 844, 61): '(29)', (844, 63, 844, 67): '(79)'}, {}), '(29, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((845, 34, 845, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((846, 34, 846, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(846, 57, 846, 61): '(29)', (846, 63, 846, 67): '(111)'}, {}), '(29, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((847, 34, 847, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((848, 34, 848, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(848, 57, 848, 61): '(30)', (848, 63, 848, 67): '(79)'}, {}), '(30, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((849, 34, 849, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((850, 34, 850, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(850, 57, 850, 61): '(30)', (850, 63, 850, 67): '(111)'}, {}), '(30, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((851, 34, 851, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((852, 34, 852, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(852, 57, 852, 61): '(31)', (852, 63, 852, 67): '(79)'}, {}), '(31, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((853, 34, 853, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((854, 34, 854, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(854, 57, 854, 61): '(31)', (854, 63, 854, 67): '(111)'}, {}), '(31, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((855, 34, 855, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((856, 34, 856, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(856, 57, 856, 61): '(24)', (856, 63, 856, 67): '(79)'}, {}), '(24, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((857, 34, 857, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((858, 34, 858, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(858, 57, 858, 61): '(27)', (858, 63, 858, 67): '(79)'}, {}), '(27, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((859, 34, 859, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((860, 34, 860, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(860, 57, 860, 61): '(27)', (860, 63, 860, 67): '(111)'}, {}), '(27, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((861, 34, 861, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((862, 34, 862, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(862, 57, 862, 61): '(28)', (862, 63, 862, 67): '(79)'}, {}), '(28, 79)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((863, 34, 863, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((864, 34, 864, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(864, 57, 864, 61): '(28)', (864, 63, 864, 67): '(111)'}, {}), '(28, 111)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((865, 34, 865, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((868, 34, 868, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(868, 57, 868, 61): '(17)', (868, 63, 868, 67): '(80)'}, {}), '(17, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((869, 34, 869, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(869, 57, 869, 61): '(17)', (869, 63, 869, 67): '(112)'}, {}), '(17, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((870, 34, 870, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(870, 57, 870, 61): '(18)', (870, 63, 870, 67): '(80)'}, {}), '(18, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((871, 34, 871, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(871, 57, 871, 61): '(18)', (871, 63, 871, 67): '(112)'}, {}), '(18, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((872, 34, 872, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(872, 57, 872, 61): '(21)', (872, 63, 872, 67): '(80)'}, {}), '(21, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((873, 34, 873, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(873, 57, 873, 61): '(21)', (873, 63, 873, 67): '(112)'}, {}), '(21, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((874, 34, 874, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(874, 57, 874, 61): '(22)', (874, 63, 874, 67): '(80)'}, {}), '(22, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((875, 34, 875, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(875, 57, 875, 61): '(22)', (875, 63, 875, 67): '(112)'}, {}), '(22, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((876, 34, 876, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(876, 57, 876, 61): '(23)', (876, 63, 876, 67): '(80)'}, {}), '(23, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((877, 34, 877, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(877, 57, 877, 61): '(23)', (877, 63, 877, 67): '(112)'}, {}), '(23, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((878, 34, 878, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(878, 57, 878, 61): '(16)', (878, 63, 878, 67): '(80)'}, {}), '(16, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((879, 34, 879, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(879, 57, 879, 61): '(19)', (879, 63, 879, 67): '(80)'}, {}), '(19, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((880, 34, 880, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(880, 57, 880, 61): '(19)', (880, 63, 880, 67): '(112)'}, {}), '(19, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((881, 34, 881, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(881, 57, 881, 61): '(20)', (881, 63, 881, 67): '(80)'}, {}), '(20, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((882, 34, 882, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(882, 57, 882, 61): '(20)', (882, 63, 882, 67): '(112)'}, {}), '(20, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((883, 34, 883, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(883, 57, 883, 61): '(25)', (883, 63, 883, 67): '(80)'}, {}), '(25, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((884, 34, 884, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(884, 57, 884, 61): '(25)', (884, 63, 884, 67): '(112)'}, {}), '(25, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((885, 34, 885, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(885, 57, 885, 61): '(26)', (885, 63, 885, 67): '(80)'}, {}), '(26, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((886, 34, 886, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(886, 57, 886, 61): '(26)', (886, 63, 886, 67): '(112)'}, {}), '(26, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((887, 34, 887, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(887, 57, 887, 61): '(29)', (887, 63, 887, 67): '(80)'}, {}), '(29, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((888, 34, 888, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(888, 57, 888, 61): '(29)', (888, 63, 888, 67): '(112)'}, {}), '(29, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((889, 34, 889, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(889, 57, 889, 61): '(30)', (889, 63, 889, 67): '(80)'}, {}), '(30, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((890, 34, 890, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(890, 57, 890, 61): '(30)', (890, 63, 890, 67): '(112)'}, {}), '(30, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((891, 34, 891, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(891, 57, 891, 61): '(31)', (891, 63, 891, 67): '(80)'}, {}), '(31, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((892, 34, 892, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(892, 57, 892, 61): '(31)', (892, 63, 892, 67): '(112)'}, {}), '(31, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((893, 34, 893, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(893, 57, 893, 61): '(24)', (893, 63, 893, 67): '(80)'}, {}), '(24, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((894, 34, 894, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(894, 57, 894, 61): '(27)', (894, 63, 894, 67): '(80)'}, {}), '(27, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((895, 34, 895, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(895, 57, 895, 61): '(27)', (895, 63, 895, 67): '(112)'}, {}), '(27, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((896, 34, 896, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(896, 57, 896, 61): '(28)', (896, 63, 896, 67): '(80)'}, {}), '(28, 80)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((897, 34, 897, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(897, 57, 897, 61): '(28)', (897, 63, 897, 67): '(112)'}, {}), '(28, 112)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((900, 34, 900, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(900, 57, 900, 61): '(17)', (900, 63, 900, 67): '(81)'}, {}), '(17, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((901, 34, 901, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((902, 34, 902, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(902, 57, 902, 61): '(17)', (902, 63, 902, 67): '(113)'}, {}), '(17, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((903, 34, 903, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((904, 34, 904, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(904, 57, 904, 61): '(18)', (904, 63, 904, 67): '(81)'}, {}), '(18, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((905, 34, 905, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((906, 34, 906, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(906, 57, 906, 61): '(18)', (906, 63, 906, 67): '(113)'}, {}), '(18, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((907, 34, 907, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((908, 34, 908, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(908, 57, 908, 61): '(21)', (908, 63, 908, 67): '(81)'}, {}), '(21, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((909, 34, 909, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((910, 34, 910, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(910, 57, 910, 61): '(21)', (910, 63, 910, 67): '(113)'}, {}), '(21, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((911, 34, 911, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((912, 34, 912, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(912, 57, 912, 61): '(22)', (912, 63, 912, 67): '(81)'}, {}), '(22, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((913, 34, 913, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((914, 34, 914, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(914, 57, 914, 61): '(22)', (914, 63, 914, 67): '(113)'}, {}), '(22, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((915, 34, 915, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((916, 34, 916, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(916, 57, 916, 61): '(23)', (916, 63, 916, 67): '(81)'}, {}), '(23, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((917, 34, 917, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((918, 34, 918, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(918, 57, 918, 61): '(23)', (918, 63, 918, 67): '(113)'}, {}), '(23, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((919, 34, 919, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((920, 34, 920, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(920, 57, 920, 61): '(16)', (920, 63, 920, 67): '(81)'}, {}), '(16, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((921, 34, 921, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((922, 34, 922, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(922, 57, 922, 61): '(19)', (922, 63, 922, 67): '(81)'}, {}), '(19, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((923, 34, 923, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((924, 34, 924, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(924, 57, 924, 61): '(19)', (924, 63, 924, 67): '(113)'}, {}), '(19, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((925, 34, 925, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((926, 34, 926, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(926, 57, 926, 61): '(20)', (926, 63, 926, 67): '(81)'}, {}), '(20, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((927, 34, 927, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((928, 34, 928, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(928, 57, 928, 61): '(20)', (928, 63, 928, 67): '(113)'}, {}), '(20, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((929, 34, 929, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((930, 34, 930, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(930, 57, 930, 61): '(25)', (930, 63, 930, 67): '(81)'}, {}), '(25, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((931, 34, 931, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((932, 34, 932, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(932, 57, 932, 61): '(25)', (932, 63, 932, 67): '(113)'}, {}), '(25, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((933, 34, 933, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((934, 34, 934, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(934, 57, 934, 61): '(26)', (934, 63, 934, 67): '(81)'}, {}), '(26, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((935, 34, 935, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((936, 34, 936, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(936, 57, 936, 61): '(26)', (936, 63, 936, 67): '(113)'}, {}), '(26, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((937, 34, 937, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((938, 34, 938, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(938, 57, 938, 61): '(29)', (938, 63, 938, 67): '(81)'}, {}), '(29, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((939, 34, 939, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((940, 34, 940, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(940, 57, 940, 61): '(29)', (940, 63, 940, 67): '(113)'}, {}), '(29, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((941, 34, 941, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((942, 34, 942, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(942, 57, 942, 61): '(30)', (942, 63, 942, 67): '(81)'}, {}), '(30, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((943, 34, 943, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((944, 34, 944, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(944, 57, 944, 61): '(30)', (944, 63, 944, 67): '(113)'}, {}), '(30, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((945, 34, 945, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((946, 34, 946, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(946, 57, 946, 61): '(31)', (946, 63, 946, 67): '(81)'}, {}), '(31, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((947, 34, 947, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((948, 34, 948, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(948, 57, 948, 61): '(31)', (948, 63, 948, 67): '(113)'}, {}), '(31, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((949, 34, 949, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((950, 34, 950, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(950, 57, 950, 61): '(24)', (950, 63, 950, 67): '(81)'}, {}), '(24, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((951, 34, 951, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((952, 34, 952, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(952, 57, 952, 61): '(27)', (952, 63, 952, 67): '(81)'}, {}), '(27, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((953, 34, 953, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((954, 34, 954, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(954, 57, 954, 61): '(27)', (954, 63, 954, 67): '(113)'}, {}), '(27, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((955, 34, 955, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((956, 34, 956, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(956, 57, 956, 61): '(28)', (956, 63, 956, 67): '(81)'}, {}), '(28, 81)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((957, 34, 957, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((958, 34, 958, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(958, 57, 958, 61): '(28)', (958, 63, 958, 67): '(113)'}, {}), '(28, 113)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((959, 34, 959, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((962, 34, 962, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(962, 57, 962, 61): '(17)', (962, 63, 962, 67): '(82)'}, {}), '(17, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((963, 34, 963, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(963, 57, 963, 61): '(17)', (963, 63, 963, 67): '(114)'}, {}), '(17, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((964, 34, 964, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(964, 57, 964, 61): '(18)', (964, 63, 964, 67): '(82)'}, {}), '(18, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((965, 34, 965, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(965, 57, 965, 61): '(18)', (965, 63, 965, 67): '(114)'}, {}), '(18, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((966, 34, 966, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(966, 57, 966, 61): '(21)', (966, 63, 966, 67): '(82)'}, {}), '(21, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((967, 34, 967, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(967, 57, 967, 61): '(21)', (967, 63, 967, 67): '(114)'}, {}), '(21, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((968, 34, 968, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(968, 57, 968, 61): '(22)', (968, 63, 968, 67): '(82)'}, {}), '(22, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((969, 34, 969, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(969, 57, 969, 61): '(22)', (969, 63, 969, 67): '(114)'}, {}), '(22, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((970, 34, 970, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(970, 57, 970, 61): '(23)', (970, 63, 970, 67): '(82)'}, {}), '(23, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((971, 34, 971, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(971, 57, 971, 61): '(23)', (971, 63, 971, 67): '(114)'}, {}), '(23, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((972, 34, 972, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(972, 57, 972, 61): '(16)', (972, 63, 972, 67): '(82)'}, {}), '(16, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((973, 34, 973, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(973, 57, 973, 61): '(19)', (973, 63, 973, 67): '(82)'}, {}), '(19, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((974, 34, 974, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(974, 57, 974, 61): '(19)', (974, 63, 974, 67): '(114)'}, {}), '(19, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((975, 34, 975, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(975, 57, 975, 61): '(20)', (975, 63, 975, 67): '(82)'}, {}), '(20, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((976, 34, 976, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(976, 57, 976, 61): '(20)', (976, 63, 976, 67): '(114)'}, {}), '(20, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((977, 34, 977, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(977, 57, 977, 61): '(25)', (977, 63, 977, 67): '(82)'}, {}), '(25, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((978, 34, 978, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(978, 57, 978, 61): '(25)', (978, 63, 978, 67): '(114)'}, {}), '(25, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((979, 34, 979, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(979, 57, 979, 61): '(26)', (979, 63, 979, 67): '(82)'}, {}), '(26, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((980, 34, 980, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(980, 57, 980, 61): '(26)', (980, 63, 980, 67): '(114)'}, {}), '(26, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((981, 34, 981, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(981, 57, 981, 61): '(29)', (981, 63, 981, 67): '(82)'}, {}), '(29, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((982, 34, 982, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(982, 57, 982, 61): '(29)', (982, 63, 982, 67): '(114)'}, {}), '(29, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((983, 34, 983, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(983, 57, 983, 61): '(30)', (983, 63, 983, 67): '(82)'}, {}), '(30, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((984, 34, 984, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(984, 57, 984, 61): '(30)', (984, 63, 984, 67): '(114)'}, {}), '(30, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((985, 34, 985, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(985, 57, 985, 61): '(31)', (985, 63, 985, 67): '(82)'}, {}), '(31, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((986, 34, 986, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(986, 57, 986, 61): '(31)', (986, 63, 986, 67): '(114)'}, {}), '(31, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((987, 34, 987, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(987, 57, 987, 61): '(24)', (987, 63, 987, 67): '(82)'}, {}), '(24, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((988, 34, 988, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(988, 57, 988, 61): '(27)', (988, 63, 988, 67): '(82)'}, {}), '(27, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((989, 34, 989, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(989, 57, 989, 61): '(27)', (989, 63, 989, 67): '(114)'}, {}), '(27, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((990, 34, 990, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(990, 57, 990, 61): '(28)', (990, 63, 990, 67): '(82)'}, {}), '(28, 82)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((991, 34, 991, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(991, 57, 991, 61): '(28)', (991, 63, 991, 67): '(114)'}, {}), '(28, 114)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((994, 34, 994, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(994, 57, 994, 61): '(17)', (994, 63, 994, 67): '(83)'}, {}), '(17, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((995, 34, 995, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((996, 34, 996, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(996, 57, 996, 61): '(17)', (996, 63, 996, 67): '(115)'}, {}), '(17, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((997, 34, 997, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((998, 34, 998, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(998, 57, 998, 61): '(18)', (998, 63, 998, 67): '(83)'}, {}), '(18, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((999, 34, 999, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1000, 34, 1000, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1000, 57, 1000, 61): '(18)', (1000, 63, 1000, 67): '(115)'}, {}), '(18, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1001, 34, 1001, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1002, 34, 1002, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1002, 57, 1002, 61): '(21)', (1002, 63, 1002, 67): '(83)'}, {}), '(21, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1003, 34, 1003, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1004, 34, 1004, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1004, 57, 1004, 61): '(21)', (1004, 63, 1004, 67): '(115)'}, {}), '(21, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1005, 34, 1005, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1006, 34, 1006, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1006, 57, 1006, 61): '(22)', (1006, 63, 1006, 67): '(83)'}, {}), '(22, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1007, 34, 1007, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1008, 34, 1008, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1008, 57, 1008, 61): '(22)', (1008, 63, 1008, 67): '(115)'}, {}), '(22, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1009, 34, 1009, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1010, 34, 1010, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1010, 57, 1010, 61): '(23)', (1010, 63, 1010, 67): '(83)'}, {}), '(23, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1011, 34, 1011, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1012, 34, 1012, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1012, 57, 1012, 61): '(23)', (1012, 63, 1012, 67): '(115)'}, {}), '(23, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1013, 34, 1013, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1014, 34, 1014, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1014, 57, 1014, 61): '(16)', (1014, 63, 1014, 67): '(83)'}, {}), '(16, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1015, 34, 1015, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1016, 34, 1016, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1016, 57, 1016, 61): '(19)', (1016, 63, 1016, 67): '(83)'}, {}), '(19, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1017, 34, 1017, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1018, 34, 1018, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1018, 57, 1018, 61): '(19)', (1018, 63, 1018, 67): '(115)'}, {}), '(19, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1019, 34, 1019, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1020, 34, 1020, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1020, 57, 1020, 61): '(20)', (1020, 63, 1020, 67): '(83)'}, {}), '(20, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1021, 34, 1021, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1022, 34, 1022, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1022, 57, 1022, 61): '(20)', (1022, 63, 1022, 67): '(115)'}, {}), '(20, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1023, 34, 1023, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1024, 34, 1024, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1024, 57, 1024, 61): '(25)', (1024, 63, 1024, 67): '(83)'}, {}), '(25, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1025, 34, 1025, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1026, 34, 1026, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1026, 57, 1026, 61): '(25)', (1026, 63, 1026, 67): '(115)'}, {}), '(25, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1027, 34, 1027, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1028, 34, 1028, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1028, 57, 1028, 61): '(26)', (1028, 63, 1028, 67): '(83)'}, {}), '(26, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1029, 34, 1029, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1030, 34, 1030, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1030, 57, 1030, 61): '(26)', (1030, 63, 1030, 67): '(115)'}, {}), '(26, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1031, 34, 1031, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1032, 34, 1032, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1032, 57, 1032, 61): '(29)', (1032, 63, 1032, 67): '(83)'}, {}), '(29, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1033, 34, 1033, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1034, 34, 1034, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1034, 57, 1034, 61): '(29)', (1034, 63, 1034, 67): '(115)'}, {}), '(29, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1035, 34, 1035, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1036, 34, 1036, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1036, 57, 1036, 61): '(30)', (1036, 63, 1036, 67): '(83)'}, {}), '(30, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1037, 34, 1037, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1038, 34, 1038, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1038, 57, 1038, 61): '(30)', (1038, 63, 1038, 67): '(115)'}, {}), '(30, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1039, 34, 1039, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1040, 34, 1040, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1040, 57, 1040, 61): '(31)', (1040, 63, 1040, 67): '(83)'}, {}), '(31, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1041, 34, 1041, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1042, 34, 1042, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1042, 57, 1042, 61): '(31)', (1042, 63, 1042, 67): '(115)'}, {}), '(31, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1043, 34, 1043, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1044, 34, 1044, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1044, 57, 1044, 61): '(24)', (1044, 63, 1044, 67): '(83)'}, {}), '(24, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1045, 34, 1045, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1046, 34, 1046, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1046, 57, 1046, 61): '(27)', (1046, 63, 1046, 67): '(83)'}, {}), '(27, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1047, 34, 1047, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1048, 34, 1048, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1048, 57, 1048, 61): '(27)', (1048, 63, 1048, 67): '(115)'}, {}), '(27, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1049, 34, 1049, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1050, 34, 1050, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1050, 57, 1050, 61): '(28)', (1050, 63, 1050, 67): '(83)'}, {}), '(28, 83)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1051, 34, 1051, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1052, 34, 1052, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1052, 57, 1052, 61): '(28)', (1052, 63, 1052, 67): '(115)'}, {}), '(28, 115)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1053, 34, 1053, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1056, 34, 1056, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1056, 57, 1056, 61): '(17)', (1056, 63, 1056, 67): '(84)'}, {}), '(17, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1057, 34, 1057, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1057, 57, 1057, 61): '(17)', (1057, 63, 1057, 67): '(116)'}, {}), '(17, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1058, 34, 1058, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1058, 57, 1058, 61): '(18)', (1058, 63, 1058, 67): '(84)'}, {}), '(18, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1059, 34, 1059, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1059, 57, 1059, 61): '(18)', (1059, 63, 1059, 67): '(116)'}, {}), '(18, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1060, 34, 1060, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1060, 57, 1060, 61): '(21)', (1060, 63, 1060, 67): '(84)'}, {}), '(21, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1061, 34, 1061, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1061, 57, 1061, 61): '(21)', (1061, 63, 1061, 67): '(116)'}, {}), '(21, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1062, 34, 1062, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1062, 57, 1062, 61): '(22)', (1062, 63, 1062, 67): '(84)'}, {}), '(22, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1063, 34, 1063, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1063, 57, 1063, 61): '(22)', (1063, 63, 1063, 67): '(116)'}, {}), '(22, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1064, 34, 1064, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1064, 57, 1064, 61): '(23)', (1064, 63, 1064, 67): '(84)'}, {}), '(23, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1065, 34, 1065, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1065, 57, 1065, 61): '(23)', (1065, 63, 1065, 67): '(116)'}, {}), '(23, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1066, 34, 1066, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1066, 57, 1066, 61): '(16)', (1066, 63, 1066, 67): '(84)'}, {}), '(16, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1067, 34, 1067, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1067, 57, 1067, 61): '(19)', (1067, 63, 1067, 67): '(84)'}, {}), '(19, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1068, 34, 1068, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1068, 57, 1068, 61): '(19)', (1068, 63, 1068, 67): '(116)'}, {}), '(19, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1069, 34, 1069, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1069, 57, 1069, 61): '(20)', (1069, 63, 1069, 67): '(84)'}, {}), '(20, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1070, 34, 1070, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1070, 57, 1070, 61): '(20)', (1070, 63, 1070, 67): '(116)'}, {}), '(20, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1071, 34, 1071, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1071, 57, 1071, 61): '(25)', (1071, 63, 1071, 67): '(84)'}, {}), '(25, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1072, 34, 1072, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1072, 57, 1072, 61): '(25)', (1072, 63, 1072, 67): '(116)'}, {}), '(25, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1073, 34, 1073, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1073, 57, 1073, 61): '(26)', (1073, 63, 1073, 67): '(84)'}, {}), '(26, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1074, 34, 1074, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1074, 57, 1074, 61): '(26)', (1074, 63, 1074, 67): '(116)'}, {}), '(26, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1075, 34, 1075, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1075, 57, 1075, 61): '(29)', (1075, 63, 1075, 67): '(84)'}, {}), '(29, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1076, 34, 1076, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1076, 57, 1076, 61): '(29)', (1076, 63, 1076, 67): '(116)'}, {}), '(29, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1077, 34, 1077, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1077, 57, 1077, 61): '(30)', (1077, 63, 1077, 67): '(84)'}, {}), '(30, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1078, 34, 1078, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1078, 57, 1078, 61): '(30)', (1078, 63, 1078, 67): '(116)'}, {}), '(30, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1079, 34, 1079, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1079, 57, 1079, 61): '(31)', (1079, 63, 1079, 67): '(84)'}, {}), '(31, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1080, 34, 1080, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1080, 57, 1080, 61): '(31)', (1080, 63, 1080, 67): '(116)'}, {}), '(31, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1081, 34, 1081, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1081, 57, 1081, 61): '(24)', (1081, 63, 1081, 67): '(84)'}, {}), '(24, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1082, 34, 1082, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1082, 57, 1082, 61): '(27)', (1082, 63, 1082, 67): '(84)'}, {}), '(27, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1083, 34, 1083, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1083, 57, 1083, 61): '(27)', (1083, 63, 1083, 67): '(116)'}, {}), '(27, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1084, 34, 1084, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1084, 57, 1084, 61): '(28)', (1084, 63, 1084, 67): '(84)'}, {}), '(28, 84)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1085, 34, 1085, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1085, 57, 1085, 61): '(28)', (1085, 63, 1085, 67): '(116)'}, {}), '(28, 116)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1088, 34, 1088, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1088, 57, 1088, 61): '(17)', (1088, 63, 1088, 67): '(85)'}, {}), '(17, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1089, 34, 1089, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1090, 34, 1090, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1090, 57, 1090, 61): '(17)', (1090, 63, 1090, 67): '(117)'}, {}), '(17, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1091, 34, 1091, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1092, 34, 1092, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1092, 57, 1092, 61): '(18)', (1092, 63, 1092, 67): '(85)'}, {}), '(18, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1093, 34, 1093, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1094, 34, 1094, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1094, 57, 1094, 61): '(18)', (1094, 63, 1094, 67): '(117)'}, {}), '(18, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1095, 34, 1095, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1096, 34, 1096, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1096, 57, 1096, 61): '(21)', (1096, 63, 1096, 67): '(85)'}, {}), '(21, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1097, 34, 1097, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1098, 34, 1098, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1098, 57, 1098, 61): '(21)', (1098, 63, 1098, 67): '(117)'}, {}), '(21, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1099, 34, 1099, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1100, 34, 1100, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1100, 57, 1100, 61): '(22)', (1100, 63, 1100, 67): '(85)'}, {}), '(22, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1101, 34, 1101, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1102, 34, 1102, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1102, 57, 1102, 61): '(22)', (1102, 63, 1102, 67): '(117)'}, {}), '(22, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1103, 34, 1103, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1104, 34, 1104, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1104, 57, 1104, 61): '(23)', (1104, 63, 1104, 67): '(85)'}, {}), '(23, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1105, 34, 1105, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1106, 34, 1106, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1106, 57, 1106, 61): '(23)', (1106, 63, 1106, 67): '(117)'}, {}), '(23, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1107, 34, 1107, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1108, 34, 1108, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1108, 57, 1108, 61): '(16)', (1108, 63, 1108, 67): '(85)'}, {}), '(16, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1109, 34, 1109, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1110, 34, 1110, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1110, 57, 1110, 61): '(19)', (1110, 63, 1110, 67): '(85)'}, {}), '(19, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1111, 34, 1111, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1112, 34, 1112, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1112, 57, 1112, 61): '(19)', (1112, 63, 1112, 67): '(117)'}, {}), '(19, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1113, 34, 1113, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1114, 34, 1114, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1114, 57, 1114, 61): '(20)', (1114, 63, 1114, 67): '(85)'}, {}), '(20, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1115, 34, 1115, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1116, 34, 1116, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1116, 57, 1116, 61): '(20)', (1116, 63, 1116, 67): '(117)'}, {}), '(20, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1117, 34, 1117, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1118, 34, 1118, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1118, 57, 1118, 61): '(25)', (1118, 63, 1118, 67): '(85)'}, {}), '(25, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1119, 34, 1119, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1120, 34, 1120, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1120, 57, 1120, 61): '(25)', (1120, 63, 1120, 67): '(117)'}, {}), '(25, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1121, 34, 1121, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1122, 34, 1122, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1122, 57, 1122, 61): '(26)', (1122, 63, 1122, 67): '(85)'}, {}), '(26, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1123, 34, 1123, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1124, 34, 1124, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1124, 57, 1124, 61): '(26)', (1124, 63, 1124, 67): '(117)'}, {}), '(26, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1125, 34, 1125, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1126, 34, 1126, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1126, 57, 1126, 61): '(29)', (1126, 63, 1126, 67): '(85)'}, {}), '(29, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1127, 34, 1127, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1128, 34, 1128, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1128, 57, 1128, 61): '(29)', (1128, 63, 1128, 67): '(117)'}, {}), '(29, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1129, 34, 1129, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1130, 34, 1130, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1130, 57, 1130, 61): '(30)', (1130, 63, 1130, 67): '(85)'}, {}), '(30, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1131, 34, 1131, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1132, 34, 1132, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1132, 57, 1132, 61): '(30)', (1132, 63, 1132, 67): '(117)'}, {}), '(30, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1133, 34, 1133, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1134, 34, 1134, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1134, 57, 1134, 61): '(31)', (1134, 63, 1134, 67): '(85)'}, {}), '(31, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1135, 34, 1135, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1136, 34, 1136, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1136, 57, 1136, 61): '(31)', (1136, 63, 1136, 67): '(117)'}, {}), '(31, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1137, 34, 1137, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1138, 34, 1138, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1138, 57, 1138, 61): '(24)', (1138, 63, 1138, 67): '(85)'}, {}), '(24, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1139, 34, 1139, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1140, 34, 1140, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1140, 57, 1140, 61): '(27)', (1140, 63, 1140, 67): '(85)'}, {}), '(27, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1141, 34, 1141, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1142, 34, 1142, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1142, 57, 1142, 61): '(27)', (1142, 63, 1142, 67): '(117)'}, {}), '(27, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1143, 34, 1143, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1144, 34, 1144, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1144, 57, 1144, 61): '(28)', (1144, 63, 1144, 67): '(85)'}, {}), '(28, 85)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1145, 34, 1145, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1146, 34, 1146, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1146, 57, 1146, 61): '(28)', (1146, 63, 1146, 67): '(117)'}, {}), '(28, 117)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1147, 34, 1147, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1150, 34, 1150, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1150, 57, 1150, 61): '(17)', (1150, 63, 1150, 67): '(86)'}, {}), '(17, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1151, 34, 1151, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1151, 57, 1151, 61): '(17)', (1151, 63, 1151, 67): '(118)'}, {}), '(17, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1152, 34, 1152, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1152, 57, 1152, 61): '(18)', (1152, 63, 1152, 67): '(86)'}, {}), '(18, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1153, 34, 1153, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1153, 57, 1153, 61): '(18)', (1153, 63, 1153, 67): '(118)'}, {}), '(18, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1154, 34, 1154, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1154, 57, 1154, 61): '(21)', (1154, 63, 1154, 67): '(86)'}, {}), '(21, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1155, 34, 1155, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1155, 57, 1155, 61): '(21)', (1155, 63, 1155, 67): '(118)'}, {}), '(21, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1156, 34, 1156, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1156, 57, 1156, 61): '(22)', (1156, 63, 1156, 67): '(86)'}, {}), '(22, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1157, 34, 1157, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1157, 57, 1157, 61): '(22)', (1157, 63, 1157, 67): '(118)'}, {}), '(22, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1158, 34, 1158, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1158, 57, 1158, 61): '(23)', (1158, 63, 1158, 67): '(86)'}, {}), '(23, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1159, 34, 1159, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1159, 57, 1159, 61): '(23)', (1159, 63, 1159, 67): '(118)'}, {}), '(23, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1160, 34, 1160, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1160, 57, 1160, 61): '(16)', (1160, 63, 1160, 67): '(86)'}, {}), '(16, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1161, 34, 1161, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1161, 57, 1161, 61): '(19)', (1161, 63, 1161, 67): '(86)'}, {}), '(19, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1162, 34, 1162, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1162, 57, 1162, 61): '(19)', (1162, 63, 1162, 67): '(118)'}, {}), '(19, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1163, 34, 1163, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1163, 57, 1163, 61): '(20)', (1163, 63, 1163, 67): '(86)'}, {}), '(20, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1164, 34, 1164, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1164, 57, 1164, 61): '(20)', (1164, 63, 1164, 67): '(118)'}, {}), '(20, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1165, 34, 1165, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1165, 57, 1165, 61): '(25)', (1165, 63, 1165, 67): '(86)'}, {}), '(25, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1166, 34, 1166, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1166, 57, 1166, 61): '(25)', (1166, 63, 1166, 67): '(118)'}, {}), '(25, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1167, 34, 1167, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1167, 57, 1167, 61): '(26)', (1167, 63, 1167, 67): '(86)'}, {}), '(26, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1168, 34, 1168, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1168, 57, 1168, 61): '(26)', (1168, 63, 1168, 67): '(118)'}, {}), '(26, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1169, 34, 1169, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1169, 57, 1169, 61): '(29)', (1169, 63, 1169, 67): '(86)'}, {}), '(29, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1170, 34, 1170, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1170, 57, 1170, 61): '(29)', (1170, 63, 1170, 67): '(118)'}, {}), '(29, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1171, 34, 1171, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1171, 57, 1171, 61): '(30)', (1171, 63, 1171, 67): '(86)'}, {}), '(30, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1172, 34, 1172, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1172, 57, 1172, 61): '(30)', (1172, 63, 1172, 67): '(118)'}, {}), '(30, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1173, 34, 1173, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1173, 57, 1173, 61): '(31)', (1173, 63, 1173, 67): '(86)'}, {}), '(31, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1174, 34, 1174, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1174, 57, 1174, 61): '(31)', (1174, 63, 1174, 67): '(118)'}, {}), '(31, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1175, 34, 1175, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1175, 57, 1175, 61): '(24)', (1175, 63, 1175, 67): '(86)'}, {}), '(24, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1176, 34, 1176, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1176, 57, 1176, 61): '(27)', (1176, 63, 1176, 67): '(86)'}, {}), '(27, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1177, 34, 1177, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1177, 57, 1177, 61): '(27)', (1177, 63, 1177, 67): '(118)'}, {}), '(27, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1178, 34, 1178, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1178, 57, 1178, 61): '(28)', (1178, 63, 1178, 67): '(86)'}, {}), '(28, 86)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1179, 34, 1179, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1179, 57, 1179, 61): '(28)', (1179, 63, 1179, 67): '(118)'}, {}), '(28, 118)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1182, 34, 1182, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1182, 57, 1182, 61): '(17)', (1182, 63, 1182, 67): '(87)'}, {}), '(17, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1183, 34, 1183, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1184, 34, 1184, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1184, 57, 1184, 61): '(17)', (1184, 63, 1184, 67): '(119)'}, {}), '(17, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1185, 34, 1185, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1186, 34, 1186, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1186, 57, 1186, 61): '(18)', (1186, 63, 1186, 67): '(87)'}, {}), '(18, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1187, 34, 1187, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1188, 34, 1188, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1188, 57, 1188, 61): '(18)', (1188, 63, 1188, 67): '(119)'}, {}), '(18, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1189, 34, 1189, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1190, 34, 1190, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1190, 57, 1190, 61): '(21)', (1190, 63, 1190, 67): '(87)'}, {}), '(21, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1191, 34, 1191, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1192, 34, 1192, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1192, 57, 1192, 61): '(21)', (1192, 63, 1192, 67): '(119)'}, {}), '(21, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1193, 34, 1193, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1194, 34, 1194, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1194, 57, 1194, 61): '(22)', (1194, 63, 1194, 67): '(87)'}, {}), '(22, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1195, 34, 1195, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1196, 34, 1196, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1196, 57, 1196, 61): '(22)', (1196, 63, 1196, 67): '(119)'}, {}), '(22, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1197, 34, 1197, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1198, 34, 1198, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1198, 57, 1198, 61): '(23)', (1198, 63, 1198, 67): '(87)'}, {}), '(23, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1199, 34, 1199, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1200, 34, 1200, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1200, 57, 1200, 61): '(23)', (1200, 63, 1200, 67): '(119)'}, {}), '(23, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1201, 34, 1201, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1202, 34, 1202, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1202, 57, 1202, 61): '(16)', (1202, 63, 1202, 67): '(87)'}, {}), '(16, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1203, 34, 1203, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1204, 34, 1204, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1204, 57, 1204, 61): '(19)', (1204, 63, 1204, 67): '(87)'}, {}), '(19, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1205, 34, 1205, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1206, 34, 1206, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1206, 57, 1206, 61): '(19)', (1206, 63, 1206, 67): '(119)'}, {}), '(19, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1207, 34, 1207, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1208, 34, 1208, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1208, 57, 1208, 61): '(20)', (1208, 63, 1208, 67): '(87)'}, {}), '(20, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1209, 34, 1209, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1210, 34, 1210, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1210, 57, 1210, 61): '(20)', (1210, 63, 1210, 67): '(119)'}, {}), '(20, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1211, 34, 1211, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1212, 34, 1212, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1212, 57, 1212, 61): '(25)', (1212, 63, 1212, 67): '(87)'}, {}), '(25, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1213, 34, 1213, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1214, 34, 1214, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1214, 57, 1214, 61): '(25)', (1214, 63, 1214, 67): '(119)'}, {}), '(25, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1215, 34, 1215, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1216, 34, 1216, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1216, 57, 1216, 61): '(26)', (1216, 63, 1216, 67): '(87)'}, {}), '(26, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1217, 34, 1217, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1218, 34, 1218, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1218, 57, 1218, 61): '(26)', (1218, 63, 1218, 67): '(119)'}, {}), '(26, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1219, 34, 1219, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1220, 34, 1220, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1220, 57, 1220, 61): '(29)', (1220, 63, 1220, 67): '(87)'}, {}), '(29, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1221, 34, 1221, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1222, 34, 1222, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1222, 57, 1222, 61): '(29)', (1222, 63, 1222, 67): '(119)'}, {}), '(29, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1223, 34, 1223, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1224, 34, 1224, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1224, 57, 1224, 61): '(30)', (1224, 63, 1224, 67): '(87)'}, {}), '(30, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1225, 34, 1225, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1226, 34, 1226, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1226, 57, 1226, 61): '(30)', (1226, 63, 1226, 67): '(119)'}, {}), '(30, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1227, 34, 1227, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1228, 34, 1228, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1228, 57, 1228, 61): '(31)', (1228, 63, 1228, 67): '(87)'}, {}), '(31, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1229, 34, 1229, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1230, 34, 1230, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1230, 57, 1230, 61): '(31)', (1230, 63, 1230, 67): '(119)'}, {}), '(31, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1231, 34, 1231, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1232, 34, 1232, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1232, 57, 1232, 61): '(24)', (1232, 63, 1232, 67): '(87)'}, {}), '(24, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1233, 34, 1233, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1234, 34, 1234, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1234, 57, 1234, 61): '(27)', (1234, 63, 1234, 67): '(87)'}, {}), '(27, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1235, 34, 1235, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1236, 34, 1236, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1236, 57, 1236, 61): '(27)', (1236, 63, 1236, 67): '(119)'}, {}), '(27, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1237, 34, 1237, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1238, 34, 1238, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1238, 57, 1238, 61): '(28)', (1238, 63, 1238, 67): '(87)'}, {}), '(28, 87)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1239, 34, 1239, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1240, 34, 1240, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1240, 57, 1240, 61): '(28)', (1240, 63, 1240, 67): '(119)'}, {}), '(28, 119)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1241, 34, 1241, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1244, 34, 1244, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1244, 57, 1244, 61): '(17)', (1244, 63, 1244, 67): '(88)'}, {}), '(17, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1245, 34, 1245, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1245, 57, 1245, 61): '(17)', (1245, 63, 1245, 67): '(120)'}, {}), '(17, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1246, 34, 1246, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1246, 57, 1246, 61): '(18)', (1246, 63, 1246, 67): '(88)'}, {}), '(18, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1247, 34, 1247, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1247, 57, 1247, 61): '(18)', (1247, 63, 1247, 67): '(120)'}, {}), '(18, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1248, 34, 1248, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1248, 57, 1248, 61): '(21)', (1248, 63, 1248, 67): '(88)'}, {}), '(21, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1249, 34, 1249, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1249, 57, 1249, 61): '(21)', (1249, 63, 1249, 67): '(120)'}, {}), '(21, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1250, 34, 1250, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1250, 57, 1250, 61): '(22)', (1250, 63, 1250, 67): '(88)'}, {}), '(22, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1251, 34, 1251, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1251, 57, 1251, 61): '(22)', (1251, 63, 1251, 67): '(120)'}, {}), '(22, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1252, 34, 1252, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1252, 57, 1252, 61): '(23)', (1252, 63, 1252, 67): '(88)'}, {}), '(23, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1253, 34, 1253, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1253, 57, 1253, 61): '(23)', (1253, 63, 1253, 67): '(120)'}, {}), '(23, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1254, 34, 1254, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1254, 57, 1254, 61): '(16)', (1254, 63, 1254, 67): '(88)'}, {}), '(16, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1255, 34, 1255, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1255, 57, 1255, 61): '(19)', (1255, 63, 1255, 67): '(88)'}, {}), '(19, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1256, 34, 1256, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1256, 57, 1256, 61): '(19)', (1256, 63, 1256, 67): '(120)'}, {}), '(19, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1257, 34, 1257, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1257, 57, 1257, 61): '(20)', (1257, 63, 1257, 67): '(88)'}, {}), '(20, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1258, 34, 1258, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1258, 57, 1258, 61): '(20)', (1258, 63, 1258, 67): '(120)'}, {}), '(20, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1259, 34, 1259, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1259, 57, 1259, 61): '(25)', (1259, 63, 1259, 67): '(88)'}, {}), '(25, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1260, 34, 1260, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1260, 57, 1260, 61): '(25)', (1260, 63, 1260, 67): '(120)'}, {}), '(25, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1261, 34, 1261, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1261, 57, 1261, 61): '(26)', (1261, 63, 1261, 67): '(88)'}, {}), '(26, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1262, 34, 1262, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1262, 57, 1262, 61): '(26)', (1262, 63, 1262, 67): '(120)'}, {}), '(26, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1263, 34, 1263, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1263, 57, 1263, 61): '(29)', (1263, 63, 1263, 67): '(88)'}, {}), '(29, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1264, 34, 1264, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1264, 57, 1264, 61): '(29)', (1264, 63, 1264, 67): '(120)'}, {}), '(29, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1265, 34, 1265, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1265, 57, 1265, 61): '(30)', (1265, 63, 1265, 67): '(88)'}, {}), '(30, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1266, 34, 1266, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1266, 57, 1266, 61): '(30)', (1266, 63, 1266, 67): '(120)'}, {}), '(30, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1267, 34, 1267, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1267, 57, 1267, 61): '(31)', (1267, 63, 1267, 67): '(88)'}, {}), '(31, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1268, 34, 1268, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1268, 57, 1268, 61): '(31)', (1268, 63, 1268, 67): '(120)'}, {}), '(31, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1269, 34, 1269, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1269, 57, 1269, 61): '(24)', (1269, 63, 1269, 67): '(88)'}, {}), '(24, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1270, 34, 1270, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1270, 57, 1270, 61): '(27)', (1270, 63, 1270, 67): '(88)'}, {}), '(27, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1271, 34, 1271, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1271, 57, 1271, 61): '(27)', (1271, 63, 1271, 67): '(120)'}, {}), '(27, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1272, 34, 1272, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1272, 57, 1272, 61): '(28)', (1272, 63, 1272, 67): '(88)'}, {}), '(28, 88)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1273, 34, 1273, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1273, 57, 1273, 61): '(28)', (1273, 63, 1273, 67): '(120)'}, {}), '(28, 120)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1276, 34, 1276, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1276, 57, 1276, 61): '(17)', (1276, 63, 1276, 67): '(89)'}, {}), '(17, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1277, 34, 1277, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1278, 34, 1278, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1278, 57, 1278, 61): '(17)', (1278, 63, 1278, 67): '(121)'}, {}), '(17, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1279, 34, 1279, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1280, 34, 1280, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1280, 57, 1280, 61): '(18)', (1280, 63, 1280, 67): '(89)'}, {}), '(18, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1281, 34, 1281, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1282, 34, 1282, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1282, 57, 1282, 61): '(18)', (1282, 63, 1282, 67): '(121)'}, {}), '(18, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1283, 34, 1283, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1284, 34, 1284, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1284, 57, 1284, 61): '(21)', (1284, 63, 1284, 67): '(89)'}, {}), '(21, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1285, 34, 1285, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1286, 34, 1286, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1286, 57, 1286, 61): '(21)', (1286, 63, 1286, 67): '(121)'}, {}), '(21, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1287, 34, 1287, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1288, 34, 1288, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1288, 57, 1288, 61): '(22)', (1288, 63, 1288, 67): '(89)'}, {}), '(22, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1289, 34, 1289, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1290, 34, 1290, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1290, 57, 1290, 61): '(22)', (1290, 63, 1290, 67): '(121)'}, {}), '(22, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1291, 34, 1291, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1292, 34, 1292, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1292, 57, 1292, 61): '(23)', (1292, 63, 1292, 67): '(89)'}, {}), '(23, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1293, 34, 1293, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1294, 34, 1294, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1294, 57, 1294, 61): '(23)', (1294, 63, 1294, 67): '(121)'}, {}), '(23, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1295, 34, 1295, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1296, 34, 1296, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1296, 57, 1296, 61): '(16)', (1296, 63, 1296, 67): '(89)'}, {}), '(16, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1297, 34, 1297, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1298, 34, 1298, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1298, 57, 1298, 61): '(19)', (1298, 63, 1298, 67): '(89)'}, {}), '(19, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1299, 34, 1299, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1300, 34, 1300, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1300, 57, 1300, 61): '(19)', (1300, 63, 1300, 67): '(121)'}, {}), '(19, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1301, 34, 1301, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1302, 34, 1302, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1302, 57, 1302, 61): '(20)', (1302, 63, 1302, 67): '(89)'}, {}), '(20, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1303, 34, 1303, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1304, 34, 1304, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1304, 57, 1304, 61): '(20)', (1304, 63, 1304, 67): '(121)'}, {}), '(20, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1305, 34, 1305, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1306, 34, 1306, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1306, 57, 1306, 61): '(25)', (1306, 63, 1306, 67): '(89)'}, {}), '(25, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1307, 34, 1307, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1308, 34, 1308, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1308, 57, 1308, 61): '(25)', (1308, 63, 1308, 67): '(121)'}, {}), '(25, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1309, 34, 1309, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1310, 34, 1310, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1310, 57, 1310, 61): '(26)', (1310, 63, 1310, 67): '(89)'}, {}), '(26, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1311, 34, 1311, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1312, 34, 1312, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1312, 57, 1312, 61): '(26)', (1312, 63, 1312, 67): '(121)'}, {}), '(26, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1313, 34, 1313, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1314, 34, 1314, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1314, 57, 1314, 61): '(29)', (1314, 63, 1314, 67): '(89)'}, {}), '(29, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1315, 34, 1315, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1316, 34, 1316, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1316, 57, 1316, 61): '(29)', (1316, 63, 1316, 67): '(121)'}, {}), '(29, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1317, 34, 1317, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1318, 34, 1318, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1318, 57, 1318, 61): '(30)', (1318, 63, 1318, 67): '(89)'}, {}), '(30, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1319, 34, 1319, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1320, 34, 1320, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1320, 57, 1320, 61): '(30)', (1320, 63, 1320, 67): '(121)'}, {}), '(30, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1321, 34, 1321, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1322, 34, 1322, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1322, 57, 1322, 61): '(31)', (1322, 63, 1322, 67): '(89)'}, {}), '(31, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1323, 34, 1323, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1324, 34, 1324, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1324, 57, 1324, 61): '(31)', (1324, 63, 1324, 67): '(121)'}, {}), '(31, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1325, 34, 1325, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1326, 34, 1326, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1326, 57, 1326, 61): '(24)', (1326, 63, 1326, 67): '(89)'}, {}), '(24, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1327, 34, 1327, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1328, 34, 1328, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1328, 57, 1328, 61): '(27)', (1328, 63, 1328, 67): '(89)'}, {}), '(27, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1329, 34, 1329, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1330, 34, 1330, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1330, 57, 1330, 61): '(27)', (1330, 63, 1330, 67): '(121)'}, {}), '(27, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1331, 34, 1331, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1332, 34, 1332, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1332, 57, 1332, 61): '(28)', (1332, 63, 1332, 67): '(89)'}, {}), '(28, 89)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1333, 34, 1333, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1334, 34, 1334, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1334, 57, 1334, 61): '(28)', (1334, 63, 1334, 67): '(121)'}, {}), '(28, 121)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1335, 34, 1335, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1338, 34, 1338, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1338, 57, 1338, 61): '(17)', (1338, 63, 1338, 67): '(90)'}, {}), '(17, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1339, 34, 1339, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1339, 57, 1339, 61): '(17)', (1339, 63, 1339, 67): '(122)'}, {}), '(17, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1340, 34, 1340, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1340, 57, 1340, 61): '(18)', (1340, 63, 1340, 67): '(90)'}, {}), '(18, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1341, 34, 1341, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1341, 57, 1341, 61): '(18)', (1341, 63, 1341, 67): '(122)'}, {}), '(18, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1342, 34, 1342, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1342, 57, 1342, 61): '(21)', (1342, 63, 1342, 67): '(90)'}, {}), '(21, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1343, 34, 1343, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1343, 57, 1343, 61): '(21)', (1343, 63, 1343, 67): '(122)'}, {}), '(21, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1344, 34, 1344, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1344, 57, 1344, 61): '(22)', (1344, 63, 1344, 67): '(90)'}, {}), '(22, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1345, 34, 1345, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1345, 57, 1345, 61): '(22)', (1345, 63, 1345, 67): '(122)'}, {}), '(22, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1346, 34, 1346, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1346, 57, 1346, 61): '(23)', (1346, 63, 1346, 67): '(90)'}, {}), '(23, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1347, 34, 1347, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1347, 57, 1347, 61): '(23)', (1347, 63, 1347, 67): '(122)'}, {}), '(23, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1348, 34, 1348, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1348, 57, 1348, 61): '(16)', (1348, 63, 1348, 67): '(90)'}, {}), '(16, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1349, 34, 1349, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1349, 57, 1349, 61): '(19)', (1349, 63, 1349, 67): '(90)'}, {}), '(19, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1350, 34, 1350, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1350, 57, 1350, 61): '(19)', (1350, 63, 1350, 67): '(122)'}, {}), '(19, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1351, 34, 1351, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1351, 57, 1351, 61): '(20)', (1351, 63, 1351, 67): '(90)'}, {}), '(20, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1352, 34, 1352, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1352, 57, 1352, 61): '(20)', (1352, 63, 1352, 67): '(122)'}, {}), '(20, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1353, 34, 1353, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1353, 57, 1353, 61): '(25)', (1353, 63, 1353, 67): '(90)'}, {}), '(25, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1354, 34, 1354, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1354, 57, 1354, 61): '(25)', (1354, 63, 1354, 67): '(122)'}, {}), '(25, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1355, 34, 1355, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1355, 57, 1355, 61): '(26)', (1355, 63, 1355, 67): '(90)'}, {}), '(26, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1356, 34, 1356, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1356, 57, 1356, 61): '(26)', (1356, 63, 1356, 67): '(122)'}, {}), '(26, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1357, 34, 1357, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1357, 57, 1357, 61): '(29)', (1357, 63, 1357, 67): '(90)'}, {}), '(29, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1358, 34, 1358, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1358, 57, 1358, 61): '(29)', (1358, 63, 1358, 67): '(122)'}, {}), '(29, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1359, 34, 1359, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1359, 57, 1359, 61): '(30)', (1359, 63, 1359, 67): '(90)'}, {}), '(30, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1360, 34, 1360, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1360, 57, 1360, 61): '(30)', (1360, 63, 1360, 67): '(122)'}, {}), '(30, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1361, 34, 1361, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1361, 57, 1361, 61): '(31)', (1361, 63, 1361, 67): '(90)'}, {}), '(31, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1362, 34, 1362, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1362, 57, 1362, 61): '(31)', (1362, 63, 1362, 67): '(122)'}, {}), '(31, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1363, 34, 1363, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1363, 57, 1363, 61): '(24)', (1363, 63, 1363, 67): '(90)'}, {}), '(24, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1364, 34, 1364, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1364, 57, 1364, 61): '(27)', (1364, 63, 1364, 67): '(90)'}, {}), '(27, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1365, 34, 1365, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1365, 57, 1365, 61): '(27)', (1365, 63, 1365, 67): '(122)'}, {}), '(27, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1366, 34, 1366, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1366, 57, 1366, 61): '(28)', (1366, 63, 1366, 67): '(90)'}, {}), '(28, 90)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1367, 34, 1367, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1367, 57, 1367, 61): '(28)', (1367, 63, 1367, 67): '(122)'}, {}), '(28, 122)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1370, 34, 1370, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1370, 57, 1370, 61): '(17)', (1370, 63, 1370, 67): '(91)'}, {}), '(17, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1371, 34, 1371, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1372, 34, 1372, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1372, 57, 1372, 61): '(17)', (1372, 63, 1372, 67): '(123)'}, {}), '(17, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1373, 34, 1373, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1374, 34, 1374, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1374, 57, 1374, 61): '(18)', (1374, 63, 1374, 67): '(91)'}, {}), '(18, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1375, 34, 1375, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1376, 34, 1376, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1376, 57, 1376, 61): '(18)', (1376, 63, 1376, 67): '(123)'}, {}), '(18, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1377, 34, 1377, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1378, 34, 1378, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1378, 57, 1378, 61): '(21)', (1378, 63, 1378, 67): '(91)'}, {}), '(21, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1379, 34, 1379, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1380, 34, 1380, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1380, 57, 1380, 61): '(21)', (1380, 63, 1380, 67): '(123)'}, {}), '(21, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1381, 34, 1381, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1382, 34, 1382, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1382, 57, 1382, 61): '(22)', (1382, 63, 1382, 67): '(91)'}, {}), '(22, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1383, 34, 1383, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1384, 34, 1384, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1384, 57, 1384, 61): '(22)', (1384, 63, 1384, 67): '(123)'}, {}), '(22, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1385, 34, 1385, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1386, 34, 1386, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1386, 57, 1386, 61): '(23)', (1386, 63, 1386, 67): '(91)'}, {}), '(23, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1387, 34, 1387, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1388, 34, 1388, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1388, 57, 1388, 61): '(23)', (1388, 63, 1388, 67): '(123)'}, {}), '(23, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1389, 34, 1389, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1390, 34, 1390, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1390, 57, 1390, 61): '(16)', (1390, 63, 1390, 67): '(91)'}, {}), '(16, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1391, 34, 1391, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1392, 34, 1392, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1392, 57, 1392, 61): '(19)', (1392, 63, 1392, 67): '(91)'}, {}), '(19, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1393, 34, 1393, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1394, 34, 1394, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1394, 57, 1394, 61): '(19)', (1394, 63, 1394, 67): '(123)'}, {}), '(19, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1395, 34, 1395, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1396, 34, 1396, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1396, 57, 1396, 61): '(20)', (1396, 63, 1396, 67): '(91)'}, {}), '(20, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1397, 34, 1397, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1398, 34, 1398, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1398, 57, 1398, 61): '(20)', (1398, 63, 1398, 67): '(123)'}, {}), '(20, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1399, 34, 1399, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1400, 34, 1400, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1400, 57, 1400, 61): '(25)', (1400, 63, 1400, 67): '(91)'}, {}), '(25, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1401, 34, 1401, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1402, 34, 1402, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1402, 57, 1402, 61): '(25)', (1402, 63, 1402, 67): '(123)'}, {}), '(25, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1403, 34, 1403, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1404, 34, 1404, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1404, 57, 1404, 61): '(26)', (1404, 63, 1404, 67): '(91)'}, {}), '(26, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1405, 34, 1405, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1406, 34, 1406, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1406, 57, 1406, 61): '(26)', (1406, 63, 1406, 67): '(123)'}, {}), '(26, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1407, 34, 1407, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1408, 34, 1408, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1408, 57, 1408, 61): '(29)', (1408, 63, 1408, 67): '(91)'}, {}), '(29, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1409, 34, 1409, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1410, 34, 1410, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1410, 57, 1410, 61): '(29)', (1410, 63, 1410, 67): '(123)'}, {}), '(29, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1411, 34, 1411, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1412, 34, 1412, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1412, 57, 1412, 61): '(30)', (1412, 63, 1412, 67): '(91)'}, {}), '(30, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1413, 34, 1413, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1414, 34, 1414, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1414, 57, 1414, 61): '(30)', (1414, 63, 1414, 67): '(123)'}, {}), '(30, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1415, 34, 1415, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1416, 34, 1416, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1416, 57, 1416, 61): '(31)', (1416, 63, 1416, 67): '(91)'}, {}), '(31, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1417, 34, 1417, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1418, 34, 1418, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1418, 57, 1418, 61): '(31)', (1418, 63, 1418, 67): '(123)'}, {}), '(31, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1419, 34, 1419, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1420, 34, 1420, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1420, 57, 1420, 61): '(24)', (1420, 63, 1420, 67): '(91)'}, {}), '(24, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1421, 34, 1421, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1422, 34, 1422, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1422, 57, 1422, 61): '(27)', (1422, 63, 1422, 67): '(91)'}, {}), '(27, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1423, 34, 1423, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1424, 34, 1424, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1424, 57, 1424, 61): '(27)', (1424, 63, 1424, 67): '(123)'}, {}), '(27, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1425, 34, 1425, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1426, 34, 1426, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1426, 57, 1426, 61): '(28)', (1426, 63, 1426, 67): '(91)'}, {}), '(28, 91)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1427, 34, 1427, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1428, 34, 1428, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1428, 57, 1428, 61): '(28)', (1428, 63, 1428, 67): '(123)'}, {}), '(28, 123)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1429, 34, 1429, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1432, 34, 1432, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1432, 57, 1432, 61): '(17)', (1432, 63, 1432, 67): '(92)'}, {}), '(17, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1433, 34, 1433, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1433, 57, 1433, 61): '(17)', (1433, 63, 1433, 67): '(124)'}, {}), '(17, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1434, 34, 1434, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1434, 57, 1434, 61): '(18)', (1434, 63, 1434, 67): '(92)'}, {}), '(18, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1435, 34, 1435, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1435, 57, 1435, 61): '(18)', (1435, 63, 1435, 67): '(124)'}, {}), '(18, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1436, 34, 1436, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1436, 57, 1436, 61): '(21)', (1436, 63, 1436, 67): '(92)'}, {}), '(21, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1437, 34, 1437, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1437, 57, 1437, 61): '(21)', (1437, 63, 1437, 67): '(124)'}, {}), '(21, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1438, 34, 1438, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1438, 57, 1438, 61): '(22)', (1438, 63, 1438, 67): '(92)'}, {}), '(22, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1439, 34, 1439, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1439, 57, 1439, 61): '(22)', (1439, 63, 1439, 67): '(124)'}, {}), '(22, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1440, 34, 1440, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1440, 57, 1440, 61): '(23)', (1440, 63, 1440, 67): '(92)'}, {}), '(23, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1441, 34, 1441, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1441, 57, 1441, 61): '(23)', (1441, 63, 1441, 67): '(124)'}, {}), '(23, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1442, 34, 1442, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1442, 57, 1442, 61): '(16)', (1442, 63, 1442, 67): '(92)'}, {}), '(16, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1443, 34, 1443, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1443, 57, 1443, 61): '(19)', (1443, 63, 1443, 67): '(92)'}, {}), '(19, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1444, 34, 1444, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1444, 57, 1444, 61): '(19)', (1444, 63, 1444, 67): '(124)'}, {}), '(19, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1445, 34, 1445, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1445, 57, 1445, 61): '(20)', (1445, 63, 1445, 67): '(92)'}, {}), '(20, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1446, 34, 1446, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1446, 57, 1446, 61): '(20)', (1446, 63, 1446, 67): '(124)'}, {}), '(20, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1447, 34, 1447, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1447, 57, 1447, 61): '(25)', (1447, 63, 1447, 67): '(92)'}, {}), '(25, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1448, 34, 1448, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1448, 57, 1448, 61): '(25)', (1448, 63, 1448, 67): '(124)'}, {}), '(25, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1449, 34, 1449, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1449, 57, 1449, 61): '(26)', (1449, 63, 1449, 67): '(92)'}, {}), '(26, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1450, 34, 1450, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1450, 57, 1450, 61): '(26)', (1450, 63, 1450, 67): '(124)'}, {}), '(26, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1451, 34, 1451, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1451, 57, 1451, 61): '(29)', (1451, 63, 1451, 67): '(92)'}, {}), '(29, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1452, 34, 1452, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1452, 57, 1452, 61): '(29)', (1452, 63, 1452, 67): '(124)'}, {}), '(29, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1453, 34, 1453, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1453, 57, 1453, 61): '(30)', (1453, 63, 1453, 67): '(92)'}, {}), '(30, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1454, 34, 1454, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1454, 57, 1454, 61): '(30)', (1454, 63, 1454, 67): '(124)'}, {}), '(30, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1455, 34, 1455, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1455, 57, 1455, 61): '(31)', (1455, 63, 1455, 67): '(92)'}, {}), '(31, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1456, 34, 1456, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1456, 57, 1456, 61): '(31)', (1456, 63, 1456, 67): '(124)'}, {}), '(31, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1457, 34, 1457, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1457, 57, 1457, 61): '(24)', (1457, 63, 1457, 67): '(92)'}, {}), '(24, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1458, 34, 1458, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1458, 57, 1458, 61): '(27)', (1458, 63, 1458, 67): '(92)'}, {}), '(27, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1459, 34, 1459, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1459, 57, 1459, 61): '(27)', (1459, 63, 1459, 67): '(124)'}, {}), '(27, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1460, 34, 1460, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1460, 57, 1460, 61): '(28)', (1460, 63, 1460, 67): '(92)'}, {}), '(28, 92)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1461, 34, 1461, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1461, 57, 1461, 61): '(28)', (1461, 63, 1461, 67): '(124)'}, {}), '(28, 124)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1464, 34, 1464, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1464, 57, 1464, 61): '(17)', (1464, 63, 1464, 67): '(93)'}, {}), '(17, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1465, 34, 1465, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1466, 34, 1466, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1466, 57, 1466, 61): '(17)', (1466, 63, 1466, 67): '(125)'}, {}), '(17, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1467, 34, 1467, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1468, 34, 1468, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1468, 57, 1468, 61): '(18)', (1468, 63, 1468, 67): '(93)'}, {}), '(18, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1469, 34, 1469, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1470, 34, 1470, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1470, 57, 1470, 61): '(18)', (1470, 63, 1470, 67): '(125)'}, {}), '(18, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1471, 34, 1471, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1472, 34, 1472, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1472, 57, 1472, 61): '(21)', (1472, 63, 1472, 67): '(93)'}, {}), '(21, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1473, 34, 1473, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1474, 34, 1474, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1474, 57, 1474, 61): '(21)', (1474, 63, 1474, 67): '(125)'}, {}), '(21, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1475, 34, 1475, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1476, 34, 1476, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1476, 57, 1476, 61): '(22)', (1476, 63, 1476, 67): '(93)'}, {}), '(22, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1477, 34, 1477, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1478, 34, 1478, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1478, 57, 1478, 61): '(22)', (1478, 63, 1478, 67): '(125)'}, {}), '(22, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1479, 34, 1479, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1480, 34, 1480, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1480, 57, 1480, 61): '(23)', (1480, 63, 1480, 67): '(93)'}, {}), '(23, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1481, 34, 1481, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1482, 34, 1482, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1482, 57, 1482, 61): '(23)', (1482, 63, 1482, 67): '(125)'}, {}), '(23, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1483, 34, 1483, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1484, 34, 1484, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1484, 57, 1484, 61): '(16)', (1484, 63, 1484, 67): '(93)'}, {}), '(16, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1485, 34, 1485, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1486, 34, 1486, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1486, 57, 1486, 61): '(19)', (1486, 63, 1486, 67): '(93)'}, {}), '(19, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1487, 34, 1487, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1488, 34, 1488, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1488, 57, 1488, 61): '(19)', (1488, 63, 1488, 67): '(125)'}, {}), '(19, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1489, 34, 1489, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1490, 34, 1490, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1490, 57, 1490, 61): '(20)', (1490, 63, 1490, 67): '(93)'}, {}), '(20, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1491, 34, 1491, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1492, 34, 1492, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1492, 57, 1492, 61): '(20)', (1492, 63, 1492, 67): '(125)'}, {}), '(20, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1493, 34, 1493, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1494, 34, 1494, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1494, 57, 1494, 61): '(25)', (1494, 63, 1494, 67): '(93)'}, {}), '(25, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1495, 34, 1495, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1496, 34, 1496, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1496, 57, 1496, 61): '(25)', (1496, 63, 1496, 67): '(125)'}, {}), '(25, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1497, 34, 1497, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1498, 34, 1498, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1498, 57, 1498, 61): '(26)', (1498, 63, 1498, 67): '(93)'}, {}), '(26, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1499, 34, 1499, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1500, 34, 1500, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1500, 57, 1500, 61): '(26)', (1500, 63, 1500, 67): '(125)'}, {}), '(26, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1501, 34, 1501, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1502, 34, 1502, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1502, 57, 1502, 61): '(29)', (1502, 63, 1502, 67): '(93)'}, {}), '(29, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1503, 34, 1503, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1504, 34, 1504, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1504, 57, 1504, 61): '(29)', (1504, 63, 1504, 67): '(125)'}, {}), '(29, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1505, 34, 1505, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1506, 34, 1506, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1506, 57, 1506, 61): '(30)', (1506, 63, 1506, 67): '(93)'}, {}), '(30, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1507, 34, 1507, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1508, 34, 1508, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1508, 57, 1508, 61): '(30)', (1508, 63, 1508, 67): '(125)'}, {}), '(30, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1509, 34, 1509, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1510, 34, 1510, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1510, 57, 1510, 61): '(31)', (1510, 63, 1510, 67): '(93)'}, {}), '(31, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1511, 34, 1511, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1512, 34, 1512, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1512, 57, 1512, 61): '(31)', (1512, 63, 1512, 67): '(125)'}, {}), '(31, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1513, 34, 1513, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1514, 34, 1514, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1514, 57, 1514, 61): '(24)', (1514, 63, 1514, 67): '(93)'}, {}), '(24, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1515, 34, 1515, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1516, 34, 1516, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1516, 57, 1516, 61): '(27)', (1516, 63, 1516, 67): '(93)'}, {}), '(27, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1517, 34, 1517, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1518, 34, 1518, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1518, 57, 1518, 61): '(27)', (1518, 63, 1518, 67): '(125)'}, {}), '(27, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1519, 34, 1519, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1520, 34, 1520, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1520, 57, 1520, 61): '(28)', (1520, 63, 1520, 67): '(93)'}, {}), '(28, 93)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1521, 34, 1521, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1522, 34, 1522, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1522, 57, 1522, 61): '(28)', (1522, 63, 1522, 67): '(125)'}, {}), '(28, 125)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1523, 34, 1523, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1526, 34, 1526, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1526, 57, 1526, 61): '(17)', (1526, 63, 1526, 67): '(94)'}, {}), '(17, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1527, 34, 1527, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1527, 57, 1527, 61): '(17)', (1527, 63, 1527, 67): '(126)'}, {}), '(17, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1528, 34, 1528, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1528, 57, 1528, 61): '(18)', (1528, 63, 1528, 67): '(94)'}, {}), '(18, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1529, 34, 1529, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1529, 57, 1529, 61): '(18)', (1529, 63, 1529, 67): '(126)'}, {}), '(18, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1530, 34, 1530, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1530, 57, 1530, 61): '(21)', (1530, 63, 1530, 67): '(94)'}, {}), '(21, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1531, 34, 1531, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1531, 57, 1531, 61): '(21)', (1531, 63, 1531, 67): '(126)'}, {}), '(21, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1532, 34, 1532, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1532, 57, 1532, 61): '(22)', (1532, 63, 1532, 67): '(94)'}, {}), '(22, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1533, 34, 1533, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1533, 57, 1533, 61): '(22)', (1533, 63, 1533, 67): '(126)'}, {}), '(22, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1534, 34, 1534, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1534, 57, 1534, 61): '(23)', (1534, 63, 1534, 67): '(94)'}, {}), '(23, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1535, 34, 1535, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1535, 57, 1535, 61): '(23)', (1535, 63, 1535, 67): '(126)'}, {}), '(23, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1536, 34, 1536, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1536, 57, 1536, 61): '(16)', (1536, 63, 1536, 67): '(94)'}, {}), '(16, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1537, 34, 1537, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1537, 57, 1537, 61): '(19)', (1537, 63, 1537, 67): '(94)'}, {}), '(19, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1538, 34, 1538, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1538, 57, 1538, 61): '(19)', (1538, 63, 1538, 67): '(126)'}, {}), '(19, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1539, 34, 1539, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1539, 57, 1539, 61): '(20)', (1539, 63, 1539, 67): '(94)'}, {}), '(20, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1540, 34, 1540, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1540, 57, 1540, 61): '(20)', (1540, 63, 1540, 67): '(126)'}, {}), '(20, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1541, 34, 1541, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1541, 57, 1541, 61): '(25)', (1541, 63, 1541, 67): '(94)'}, {}), '(25, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1542, 34, 1542, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1542, 57, 1542, 61): '(25)', (1542, 63, 1542, 67): '(126)'}, {}), '(25, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1543, 34, 1543, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1543, 57, 1543, 61): '(26)', (1543, 63, 1543, 67): '(94)'}, {}), '(26, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1544, 34, 1544, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1544, 57, 1544, 61): '(26)', (1544, 63, 1544, 67): '(126)'}, {}), '(26, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1545, 34, 1545, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1545, 57, 1545, 61): '(29)', (1545, 63, 1545, 67): '(94)'}, {}), '(29, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1546, 34, 1546, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1546, 57, 1546, 61): '(29)', (1546, 63, 1546, 67): '(126)'}, {}), '(29, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1547, 34, 1547, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1547, 57, 1547, 61): '(30)', (1547, 63, 1547, 67): '(94)'}, {}), '(30, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1548, 34, 1548, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1548, 57, 1548, 61): '(30)', (1548, 63, 1548, 67): '(126)'}, {}), '(30, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1549, 34, 1549, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1549, 57, 1549, 61): '(31)', (1549, 63, 1549, 67): '(94)'}, {}), '(31, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1550, 34, 1550, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1550, 57, 1550, 61): '(31)', (1550, 63, 1550, 67): '(126)'}, {}), '(31, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1551, 34, 1551, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1551, 57, 1551, 61): '(24)', (1551, 63, 1551, 67): '(94)'}, {}), '(24, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1552, 34, 1552, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1552, 57, 1552, 61): '(27)', (1552, 63, 1552, 67): '(94)'}, {}), '(27, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1553, 34, 1553, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1553, 57, 1553, 61): '(27)', (1553, 63, 1553, 67): '(126)'}, {}), '(27, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1554, 34, 1554, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1554, 57, 1554, 61): '(28)', (1554, 63, 1554, 67): '(94)'}, {}), '(28, 94)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1555, 34, 1555, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1555, 57, 1555, 61): '(28)', (1555, 63, 1555, 67): '(126)'}, {}), '(28, 126)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1558, 34, 1558, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1558, 57, 1558, 61): '(17)', (1558, 63, 1558, 67): '(95)'}, {}), '(17, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1559, 34, 1559, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1560, 34, 1560, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1560, 57, 1560, 61): '(17)', (1560, 63, 1560, 67): '(127)'}, {}), '(17, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1561, 34, 1561, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1562, 34, 1562, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1562, 57, 1562, 61): '(18)', (1562, 63, 1562, 67): '(95)'}, {}), '(18, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1563, 34, 1563, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1564, 34, 1564, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1564, 57, 1564, 61): '(18)', (1564, 63, 1564, 67): '(127)'}, {}), '(18, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1565, 34, 1565, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1566, 34, 1566, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1566, 57, 1566, 61): '(21)', (1566, 63, 1566, 67): '(95)'}, {}), '(21, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1567, 34, 1567, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1568, 34, 1568, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1568, 57, 1568, 61): '(21)', (1568, 63, 1568, 67): '(127)'}, {}), '(21, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1569, 34, 1569, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1570, 34, 1570, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1570, 57, 1570, 61): '(22)', (1570, 63, 1570, 67): '(95)'}, {}), '(22, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1571, 34, 1571, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1572, 34, 1572, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1572, 57, 1572, 61): '(22)', (1572, 63, 1572, 67): '(127)'}, {}), '(22, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1573, 34, 1573, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1574, 34, 1574, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1574, 57, 1574, 61): '(23)', (1574, 63, 1574, 67): '(95)'}, {}), '(23, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1575, 34, 1575, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1576, 34, 1576, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1576, 57, 1576, 61): '(23)', (1576, 63, 1576, 67): '(127)'}, {}), '(23, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1577, 34, 1577, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1578, 34, 1578, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1578, 57, 1578, 61): '(16)', (1578, 63, 1578, 67): '(95)'}, {}), '(16, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1579, 34, 1579, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1580, 34, 1580, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1580, 57, 1580, 61): '(19)', (1580, 63, 1580, 67): '(95)'}, {}), '(19, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1581, 34, 1581, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1582, 34, 1582, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1582, 57, 1582, 61): '(19)', (1582, 63, 1582, 67): '(127)'}, {}), '(19, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1583, 34, 1583, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1584, 34, 1584, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1584, 57, 1584, 61): '(20)', (1584, 63, 1584, 67): '(95)'}, {}), '(20, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1585, 34, 1585, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1586, 34, 1586, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1586, 57, 1586, 61): '(20)', (1586, 63, 1586, 67): '(127)'}, {}), '(20, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1587, 34, 1587, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1588, 34, 1588, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1588, 57, 1588, 61): '(25)', (1588, 63, 1588, 67): '(95)'}, {}), '(25, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1589, 34, 1589, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1590, 34, 1590, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1590, 57, 1590, 61): '(25)', (1590, 63, 1590, 67): '(127)'}, {}), '(25, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1591, 34, 1591, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1592, 34, 1592, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1592, 57, 1592, 61): '(26)', (1592, 63, 1592, 67): '(95)'}, {}), '(26, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1593, 34, 1593, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1594, 34, 1594, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1594, 57, 1594, 61): '(26)', (1594, 63, 1594, 67): '(127)'}, {}), '(26, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1595, 34, 1595, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1596, 34, 1596, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1596, 57, 1596, 61): '(29)', (1596, 63, 1596, 67): '(95)'}, {}), '(29, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1597, 34, 1597, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1598, 34, 1598, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1598, 57, 1598, 61): '(29)', (1598, 63, 1598, 67): '(127)'}, {}), '(29, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1599, 34, 1599, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1600, 34, 1600, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1600, 57, 1600, 61): '(30)', (1600, 63, 1600, 67): '(95)'}, {}), '(30, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1601, 34, 1601, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1602, 34, 1602, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1602, 57, 1602, 61): '(30)', (1602, 63, 1602, 67): '(127)'}, {}), '(30, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1603, 34, 1603, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1604, 34, 1604, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1604, 57, 1604, 61): '(31)', (1604, 63, 1604, 67): '(95)'}, {}), '(31, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1605, 34, 1605, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1606, 34, 1606, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1606, 57, 1606, 61): '(31)', (1606, 63, 1606, 67): '(127)'}, {}), '(31, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1607, 34, 1607, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1608, 34, 1608, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1608, 57, 1608, 61): '(24)', (1608, 63, 1608, 67): '(95)'}, {}), '(24, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1609, 34, 1609, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1610, 34, 1610, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1610, 57, 1610, 61): '(27)', (1610, 63, 1610, 67): '(95)'}, {}), '(27, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1611, 34, 1611, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1612, 34, 1612, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1612, 57, 1612, 61): '(27)', (1612, 63, 1612, 67): '(127)'}, {}), '(27, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1613, 34, 1613, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1614, 34, 1614, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1614, 57, 1614, 61): '(28)', (1614, 63, 1614, 67): '(95)'}, {}), '(28, 95)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1615, 34, 1615, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((1616, 34, 1616, 68), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode', 'SccPreambleAddressCode', ({(1616, 57, 1616, 61): '(28)', (1616, 63, 1616, 67): '(127)'}, {}), '(28, 127)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((1617, 34, 1617, 68), 'ttconv.style_properties.TextDecorationType', 'TextDecorationType', (), '', False, 'from ttconv.style_properties import TextDecorationType, NamedColors, FontStyleType\n'), ((51, 14, 51, 49), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode.find', 'SccPreambleAddressCode.find', ({(51, 42, 51, 44): 'b1', (51, 46, 51, 48): 'b2'}, {}), '(b1, b2)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((63, 14, 63, 49), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode.find', 'SccPreambleAddressCode.find', ({(63, 42, 63, 44): 'b1', (63, 46, 63, 48): 'b2'}, {}), '(b1, b2)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((59, 26, 59, 61), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode.find', 'SccPreambleAddressCode.find', ({(59, 54, 59, 56): 'b1', (59, 58, 59, 60): 'b2'}, {}), '(b1, b2)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((71, 26, 71, 61), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode.find', 'SccPreambleAddressCode.find', ({(71, 54, 71, 56): 'b1', (71, 58, 71, 60): 'b2'}, {}), '(b1, b2)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n'), ((75, 26, 75, 61), 'ttconv.scc.codes.preambles_address_codes.SccPreambleAddressCode.find', 'SccPreambleAddressCode.find', ({(75, 54, 75, 56): 'b1', (75, 58, 75, 60): 'b2'}, {}), '(b1, b2)', False, 'from ttconv.scc.codes.preambles_address_codes import SccPreambleAddressCode\n')] |
NMijat1024/azure-sdk-for-python | azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/custom_image_properties_custom.py | c49e1d6d797dceaca81813cafb1a486d67185182 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class CustomImagePropertiesCustom(Model):
"""Properties for creating a custom image from a VHD.
:param image_name: The image name.
:type image_name: str
:param sys_prep: Indicates whether sysprep has been run on the VHD.
:type sys_prep: bool
:param os_type: The OS type of the custom image (i.e. Windows, Linux).
Possible values include: 'Windows', 'Linux', 'None'
:type os_type: str or ~azure.mgmt.devtestlabs.models.CustomImageOsType
"""
_validation = {
'os_type': {'required': True},
}
_attribute_map = {
'image_name': {'key': 'imageName', 'type': 'str'},
'sys_prep': {'key': 'sysPrep', 'type': 'bool'},
'os_type': {'key': 'osType', 'type': 'str'},
}
def __init__(self, os_type, image_name=None, sys_prep=None):
super(CustomImagePropertiesCustom, self).__init__()
self.image_name = image_name
self.sys_prep = sys_prep
self.os_type = os_type
| [] |
nicolalandro/softpool | distance_torch_no_compile/chamfer.py | ca77161ab70e5fe6c6505dc40f448bd8e1d78a48 | import torch
def expanded_pairwise_distances(x, y):
'''
Input: x is a bxNxd matrix
y is an optional bxMxd matirx
Output: dist is a bxNxM 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
'''
differences = x.unsqueeze(2) - y.unsqueeze(1)
distances = torch.sum(differences * differences, -1)
return distances
def chamfer_distance(x, y):
'''
input x and y are bxNxM matrix, b: batch, N:number of point, M: point dim (ex. 2 for 2D or 3 for 3D)
output is a bx1 Matrix with the value of the chamfer distance for each sample of the batch
'''
dist_vec = expanded_pairwise_distances(x, y)
min_distances = torch.topk(dist_vec, k=1, dim=2, largest=False).values
chamfer = torch.sum(min_distances, dim=1) / torch.tensor(x.shape[1])
return chamfer
class ChamferLoss(torch.nn.Module):
def forward(self, x, y):
chamfer = chamfer_distance(x, y)
return torch.sum(chamfer)
if __name__ == "__main__":
x = torch.tensor([
[
[0., 0., 0.],
[0., 1., 0.],
[0., 1., 0.],
],
[
[1., 1., 0.],
[1., 2., 0.],
[0., 1., 0.],
]
])
y = torch.tensor([
[
[0., 1., 0.],
[0., 1., 0.],
[0., 1., 0.],
],
[
[1., 1., 0.],
[1., 2., 0.],
[0., 1., 0.],
]
])
chamfer = ChamferLoss()
print('chamfer loss torch (cpu):', chamfer(x, y))
print('chamfer loss torch (cuda):', chamfer(x.cuda(), y.cuda()))
# import sys
# sys.path.append("../distance/chamfer/")
# import dist_chamfer as cd
# CD = cd.chamferDist()
# dist1, dist2, _, _= CD(x, y)
# print('orig', dist1)
| [((12, 16, 12, 56), 'torch.sum', 'torch.sum', ({(12, 26, 12, 51): 'differences * differences', (12, 53, 12, 55): '-1'}, {}), '(differences * differences, -1)', False, 'import torch\n'), ((33, 8, 44, 6), 'torch.tensor', 'torch.tensor', ({(33, 21, 44, 5): '[[[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 1.0, 0.0]], [[1.0, 1.0, 0.0], [\n 1.0, 2.0, 0.0], [0.0, 1.0, 0.0]]]'}, {}), '([[[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 1.0, 0.0]], [[1.0, \n 1.0, 0.0], [1.0, 2.0, 0.0], [0.0, 1.0, 0.0]]])', False, 'import torch\n'), ((45, 8, 56, 6), 'torch.tensor', 'torch.tensor', ({(45, 21, 56, 5): '[[[0.0, 1.0, 0.0], [0.0, 1.0, 0.0], [0.0, 1.0, 0.0]], [[1.0, 1.0, 0.0], [\n 1.0, 2.0, 0.0], [0.0, 1.0, 0.0]]]'}, {}), '([[[0.0, 1.0, 0.0], [0.0, 1.0, 0.0], [0.0, 1.0, 0.0]], [[1.0, \n 1.0, 0.0], [1.0, 2.0, 0.0], [0.0, 1.0, 0.0]]])', False, 'import torch\n'), ((21, 20, 21, 67), 'torch.topk', 'torch.topk', (), '', False, 'import torch\n'), ((22, 14, 22, 45), 'torch.sum', 'torch.sum', (), '', False, 'import torch\n'), ((22, 48, 22, 72), 'torch.tensor', 'torch.tensor', ({(22, 61, 22, 71): 'x.shape[1]'}, {}), '(x.shape[1])', False, 'import torch\n'), ((30, 15, 30, 33), 'torch.sum', 'torch.sum', ({(30, 25, 30, 32): 'chamfer'}, {}), '(chamfer)', False, 'import torch\n')] |
crispzips/IsisCB | isiscb/curation/authority_views/relation_views.py | 72f5ad47bbc2c615f995df148f5b86550835efdb | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict #, HttpResponseForbidden, Http404, , JsonResponse
from django.shortcuts import get_object_or_404, render, redirect
from django.urls import reverse
from django.contrib.admin.views.decorators import staff_member_required, user_passes_test
from rules.contrib.views import permission_required, objectgetter
from isisdata.models import *
from isisdata.utils import strip_punctuation, normalize
from isisdata import operations
from isisdata.filters import *
from isisdata import tasks as data_tasks
from curation import p3_port_utils
from curation.forms import *
from curation.contrib.views import check_rules
@user_passes_test(lambda u: u.is_superuser or u.is_staff)
@check_rules('can_access_view_edit', fn=objectgetter(Authority, 'authority_id'))
def create_acrelation_for_authority(request, authority_id):
authority = get_object_or_404(Authority, pk=authority_id)
search_key = request.GET.get('search', request.POST.get('search'))
current_index = request.GET.get('current', request.POST.get('current'))
context = {
'curation_section': 'datasets',
'curation_subsection': 'authorities',
'instance': authority,
'search_key': search_key,
'current_index': current_index
}
if request.method == 'GET':
initial = {
'authority': authority.id,
'name_for_display_in_citation': authority.name
}
type_controlled = request.GET.get('type_controlled', None)
if type_controlled:
initial.update({'type_controlled': type_controlled.upper()})
form = ACRelationForm(prefix='acrelation', initial=initial)
elif request.method == 'POST':
form = ACRelationForm(request.POST, prefix='acrelation')
if form.is_valid():
form.save()
target = reverse('curation:curate_authority', args=(authority.id,)) + '?tab=acrelations'
if search_key and current_index:
target += '&search=%s¤t=%s' % (search_key, current_index)
return HttpResponseRedirect(target)
context.update({
'form': form,
})
template = 'curation/authority_acrelation_changeview.html'
return render(request, template, context)
@user_passes_test(lambda u: u.is_superuser or u.is_staff)
@check_rules('can_access_view_edit', fn=objectgetter(Authority, 'authority_id'))
def create_aarelation_for_authority(request, authority_id):
authority = get_object_or_404(Authority, pk=authority_id)
search_key = request.GET.get('search', request.POST.get('search'))
current_index = request.GET.get('current', request.POST.get('current'))
context = {
'curation_section': 'datasets',
'curation_subsection': 'authorities',
'instance': authority,
'search_key': search_key,
'current_index': current_index
}
if request.method == 'GET':
initial = {
'subject': authority.id
}
aarelation=AARelation()
aarelation.subject = authority
type_controlled = request.GET.get('type_controlled', None)
if type_controlled:
aarelation = dict(AARelation.TYPE_CHOICES)[type_controlled]
form = AARelationForm(prefix='aarelation', instance=aarelation)
elif request.method == 'POST':
form = AARelationForm(request.POST, prefix='aarelation')
if form.is_valid():
form.save()
target = reverse('curation:curate_authority', args=(authority.id,)) + '?tab=aarelations'
if search_key and current_index:
target += '&search=%s¤t=%s' % (search_key, current_index)
return HttpResponseRedirect(target)
context.update({
'form': form,
})
template = 'curation/authority_aarelation_changeview.html'
return render(request, template, context)
@user_passes_test(lambda u: u.is_superuser or u.is_staff)
@check_rules('can_access_view_edit', fn=objectgetter(Authority, 'authority_id'))
def acrelation_for_authority(request, authority_id, acrelation_id):
authority = get_object_or_404(Authority, pk=authority_id)
acrelation = get_object_or_404(ACRelation, pk=acrelation_id)
search_key = request.GET.get('search', request.POST.get('search'))
current_index = request.GET.get('current', request.POST.get('current'))
context = {
'curation_section': 'datasets',
'curation_subsection': 'authorities',
'instance': authority,
'acrelation': acrelation,
'search_key': search_key,
'current_index': current_index
}
if request.method == 'GET':
form = ACRelationForm(instance=acrelation, prefix='acrelation')
elif request.method == 'POST':
form = ACRelationForm(request.POST, instance=acrelation, prefix='acrelation')
if form.is_valid():
form.save()
target = reverse('curation:curate_authority', args=(authority.id,)) + '?tab=acrelations'
if search_key and current_index:
target += '&search=%s¤t=%s' % (search_key, current_index)
return HttpResponseRedirect(target)
context.update({
'form': form,
})
template = 'curation/authority_acrelation_changeview.html'
return render(request, template, context)
@user_passes_test(lambda u: u.is_superuser or u.is_staff)
@check_rules('can_access_view_edit', fn=objectgetter(Authority, 'authority_id'))
def aarelation_for_authority(request, authority_id, aarelation_id):
authority = get_object_or_404(Authority, pk=authority_id)
aarelation = get_object_or_404(AARelation, pk=aarelation_id)
search_key = request.GET.get('search', request.POST.get('search'))
current_index = request.GET.get('current', request.POST.get('current'))
context = {
'curation_section': 'datasets',
'curation_subsection': 'authorities',
'instance': authority,
'aarelation': aarelation,
'search_key': search_key,
'current_index': current_index
}
if request.method == 'GET':
form = AARelationForm(instance=aarelation, prefix='aarelation')
elif request.method == 'POST':
form = AARelationForm(request.POST, instance=aarelation, prefix='aarelation')
if form.is_valid():
form.save()
target = reverse('curation:curate_authority', args=(authority.id,)) + '?tab=aarelations'
if search_key and current_index:
target += '&search=%s¤t=%s' % (search_key, current_index)
return HttpResponseRedirect(target)
context.update({
'form': form,
})
template = 'curation/authority_aarelation_changeview.html'
return render(request, template, context)
@user_passes_test(lambda u: u.is_superuser or u.is_staff)
@check_rules('can_access_view_edit', fn=objectgetter(Authority, 'authority_id'))
def delete_aarelation_for_authority(request, authority_id, aarelation_id, format=None):
authority = get_object_or_404(Authority, pk=authority_id)
aarelation = get_object_or_404(AARelation, pk=aarelation_id)
search_key = request.GET.get('search', request.POST.get('search'))
current_index = request.GET.get('current', request.POST.get('current'))
context = {
'curation_section': 'datasets',
'curation_subsection': 'authorities',
'instance': authority,
'aarelation': aarelation,
'search_key': search_key,
'current_index': current_index
}
if request.POST.get('confirm', False) == 'true':
if not aarelation.modified_on:
aarelation.modified_on = datetime.datetime.now()
aarelation.delete()
if format == 'json':
return JsonResponse({'result': True})
target = reverse('curation:curate_authority', args=(authority.id,)) + '?tab=aarelations'
if search_key and current_index:
target += '&search=%s¤t=%s' % (search_key, current_index)
return HttpResponseRedirect(target)
if format == 'json':
return JsonResponse({'result': False})
template = 'curation/authority_aarelation_delete.html'
return render(request, template, context)
| [((24, 1, 24, 57), 'django.contrib.admin.views.decorators.user_passes_test', 'user_passes_test', ({(24, 18, 24, 56): '(lambda u: u.is_superuser or u.is_staff)'}, {}), '(lambda u: u.is_superuser or u.is_staff)', False, 'from django.contrib.admin.views.decorators import staff_member_required, user_passes_test\n'), ((65, 1, 65, 57), 'django.contrib.admin.views.decorators.user_passes_test', 'user_passes_test', ({(65, 18, 65, 56): '(lambda u: u.is_superuser or u.is_staff)'}, {}), '(lambda u: u.is_superuser or u.is_staff)', False, 'from django.contrib.admin.views.decorators import staff_member_required, user_passes_test\n'), ((107, 1, 107, 57), 'django.contrib.admin.views.decorators.user_passes_test', 'user_passes_test', ({(107, 18, 107, 56): '(lambda u: u.is_superuser or u.is_staff)'}, {}), '(lambda u: u.is_superuser or u.is_staff)', False, 'from django.contrib.admin.views.decorators import staff_member_required, user_passes_test\n'), ((142, 1, 142, 57), 'django.contrib.admin.views.decorators.user_passes_test', 'user_passes_test', ({(142, 18, 142, 56): '(lambda u: u.is_superuser or u.is_staff)'}, {}), '(lambda u: u.is_superuser or u.is_staff)', False, 'from django.contrib.admin.views.decorators import staff_member_required, user_passes_test\n'), ((177, 1, 177, 57), 'django.contrib.admin.views.decorators.user_passes_test', 'user_passes_test', ({(177, 18, 177, 56): '(lambda u: u.is_superuser or u.is_staff)'}, {}), '(lambda u: u.is_superuser or u.is_staff)', False, 'from django.contrib.admin.views.decorators import staff_member_required, user_passes_test\n'), ((27, 16, 27, 61), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((63, 11, 63, 45), 'django.shortcuts.render', 'render', ({(63, 18, 63, 25): 'request', (63, 27, 63, 35): 'template', (63, 37, 63, 44): 'context'}, {}), '(request, template, context)', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((68, 16, 68, 61), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((104, 11, 104, 45), 'django.shortcuts.render', 'render', ({(104, 18, 104, 25): 'request', (104, 27, 104, 35): 'template', (104, 37, 104, 44): 'context'}, {}), '(request, template, context)', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((110, 16, 110, 61), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((111, 17, 111, 64), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((140, 11, 140, 45), 'django.shortcuts.render', 'render', ({(140, 18, 140, 25): 'request', (140, 27, 140, 35): 'template', (140, 37, 140, 44): 'context'}, {}), '(request, template, context)', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((145, 16, 145, 61), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((146, 17, 146, 64), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((175, 11, 175, 45), 'django.shortcuts.render', 'render', ({(175, 18, 175, 25): 'request', (175, 27, 175, 35): 'template', (175, 37, 175, 44): 'context'}, {}), '(request, template, context)', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((180, 16, 180, 61), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((181, 17, 181, 64), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (), '', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((210, 11, 210, 45), 'django.shortcuts.render', 'render', ({(210, 18, 210, 25): 'request', (210, 27, 210, 35): 'template', (210, 37, 210, 44): 'context'}, {}), '(request, template, context)', False, 'from django.shortcuts import get_object_or_404, render, redirect\n'), ((25, 40, 25, 79), 'rules.contrib.views.objectgetter', 'objectgetter', ({(25, 53, 25, 62): 'Authority', (25, 64, 25, 78): '"""authority_id"""'}, {}), "(Authority, 'authority_id')", False, 'from rules.contrib.views import permission_required, objectgetter\n'), ((66, 40, 66, 79), 'rules.contrib.views.objectgetter', 'objectgetter', ({(66, 53, 66, 62): 'Authority', (66, 64, 66, 78): '"""authority_id"""'}, {}), "(Authority, 'authority_id')", False, 'from rules.contrib.views import permission_required, objectgetter\n'), ((108, 40, 108, 79), 'rules.contrib.views.objectgetter', 'objectgetter', ({(108, 53, 108, 62): 'Authority', (108, 64, 108, 78): '"""authority_id"""'}, {}), "(Authority, 'authority_id')", False, 'from rules.contrib.views import permission_required, objectgetter\n'), ((143, 40, 143, 79), 'rules.contrib.views.objectgetter', 'objectgetter', ({(143, 53, 143, 62): 'Authority', (143, 64, 143, 78): '"""authority_id"""'}, {}), "(Authority, 'authority_id')", False, 'from rules.contrib.views import permission_required, objectgetter\n'), ((204, 15, 204, 43), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', ({(204, 36, 204, 42): 'target'}, {}), '(target)', False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((207, 15, 207, 46), 'django.http.JsonResponse', 'JsonResponse', ({(207, 28, 207, 45): "{'result': False}"}, {}), "({'result': False})", False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((178, 40, 178, 79), 'rules.contrib.views.objectgetter', 'objectgetter', ({(178, 53, 178, 62): 'Authority', (178, 64, 178, 78): '"""authority_id"""'}, {}), "(Authority, 'authority_id')", False, 'from rules.contrib.views import permission_required, objectgetter\n'), ((199, 19, 199, 49), 'django.http.JsonResponse', 'JsonResponse', ({(199, 32, 199, 48): "{'result': True}"}, {}), "({'result': True})", False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((201, 17, 201, 75), 'django.urls.reverse', 'reverse', (), '', False, 'from django.urls import reverse\n'), ((57, 19, 57, 47), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', ({(57, 40, 57, 46): 'target'}, {}), '(target)', False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((98, 19, 98, 47), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', ({(98, 40, 98, 46): 'target'}, {}), '(target)', False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((134, 19, 134, 47), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', ({(134, 40, 134, 46): 'target'}, {}), '(target)', False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((169, 19, 169, 47), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', ({(169, 40, 169, 46): 'target'}, {}), '(target)', False, 'from django.http import HttpResponse, HttpResponseRedirect, JsonResponse, QueryDict\n'), ((54, 21, 54, 79), 'django.urls.reverse', 'reverse', (), '', False, 'from django.urls import reverse\n'), ((95, 21, 95, 79), 'django.urls.reverse', 'reverse', (), '', False, 'from django.urls import reverse\n'), ((131, 21, 131, 79), 'django.urls.reverse', 'reverse', (), '', False, 'from django.urls import reverse\n'), ((166, 21, 166, 79), 'django.urls.reverse', 'reverse', (), '', False, 'from django.urls import reverse\n')] |
silx-kit/silx | run_tests.py | 360f890a617676a92f0bed6a28b718d09e70ec03 | #!/usr/bin/env python3
# coding: utf8
# /*##########################################################################
#
# Copyright (c) 2015-2021 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# ###########################################################################*/
"""Run the tests of the project.
This script expects a suite function in <project_package>.test,
which returns a unittest.TestSuite.
Test coverage dependencies: coverage, lxml.
"""
__authors__ = ["Jérôme Kieffer", "Thomas Vincent"]
__date__ = "30/09/2020"
__license__ = "MIT"
import distutils.util
import logging
import os
import subprocess
import sys
import importlib
# Capture all default warnings
logging.captureWarnings(True)
import warnings
warnings.simplefilter('default')
logger = logging.getLogger("run_tests")
logger.setLevel(logging.WARNING)
logger.info("Python %s %s", sys.version, tuple.__itemsize__ * 8)
try:
import numpy
except Exception as error:
logger.warning("Numpy missing: %s", error)
else:
logger.info("Numpy %s", numpy.version.version)
try:
import h5py
except Exception as error:
logger.warning("h5py missing: %s", error)
else:
logger.info("h5py %s", h5py.version.version)
def get_project_name(root_dir):
"""Retrieve project name by running python setup.py --name in root_dir.
:param str root_dir: Directory where to run the command.
:return: The name of the project stored in root_dir
"""
logger.debug("Getting project name in %s", root_dir)
p = subprocess.Popen([sys.executable, "setup.py", "--name"],
shell=False, cwd=root_dir, stdout=subprocess.PIPE)
name, _stderr_data = p.communicate()
logger.debug("subprocess ended with rc= %s", p.returncode)
return name.split()[-1].decode('ascii')
def is_debug_python():
"""Returns true if the Python interpreter is in debug mode."""
try:
import sysconfig
except ImportError: # pragma nocover
# Python < 2.7
import distutils.sysconfig as sysconfig
if sysconfig.get_config_var("Py_DEBUG"):
return True
return hasattr(sys, "gettotalrefcount")
def build_project(name, root_dir):
"""Run python setup.py build for the project.
Build directory can be modified by environment variables.
:param str name: Name of the project.
:param str root_dir: Root directory of the project
:return: The path to the directory were build was performed
"""
platform = distutils.util.get_platform()
architecture = "lib.%s-%i.%i" % (platform,
sys.version_info[0], sys.version_info[1])
if is_debug_python():
architecture += "-pydebug"
if os.environ.get("PYBUILD_NAME") == name:
# we are in the debian packaging way
home = os.environ.get("PYTHONPATH", "").split(os.pathsep)[-1]
elif os.environ.get("BUILDPYTHONPATH"):
home = os.path.abspath(os.environ.get("BUILDPYTHONPATH", ""))
else:
home = os.path.join(root_dir, "build", architecture)
logger.warning("Building %s to %s", name, home)
p = subprocess.Popen([sys.executable, "setup.py", "build"],
shell=False, cwd=root_dir)
logger.debug("subprocess ended with rc= %s", p.wait())
if os.path.isdir(home):
return home
alt_home = os.path.join(os.path.dirname(home), "lib")
if os.path.isdir(alt_home):
return alt_home
def import_project_module(project_name, project_dir):
"""Import project module, from the system of from the project directory"""
if "--installed" in sys.argv:
try:
module = importlib.import_module(project_name)
except Exception:
logger.error("Cannot run tests on installed version: %s not installed or raising error.",
project_name)
raise
else: # Use built source
build_dir = build_project(project_name, project_dir)
if build_dir is None:
logging.error("Built project is not available !!! investigate")
sys.path.insert(0, build_dir)
logger.warning("Patched sys.path, added: '%s'", build_dir)
module = importlib.import_module(project_name)
return module
if __name__ == "__main__": # Needed for multiprocessing support on Windows
import pytest
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_NAME = get_project_name(PROJECT_DIR)
logger.info("Project name: %s", PROJECT_NAME)
project_module = import_project_module(PROJECT_NAME, PROJECT_DIR)
PROJECT_VERSION = getattr(project_module, 'version', '')
PROJECT_PATH = project_module.__path__[0]
def normalize_option(option):
option_parts = option.split(os.path.sep)
if option_parts == ["src", "silx"]:
return PROJECT_PATH
if option_parts[:2] == ["src", "silx"]:
return os.path.join(PROJECT_PATH, *option_parts[2:])
return option
args = [normalize_option(p) for p in sys.argv[1:] if p != "--installed"]
# Run test on PROJECT_PATH if nothing is specified
without_options = [a for a in args if not a.startswith("-")]
if len(without_options) == 0:
args += [PROJECT_PATH]
argv = ["--rootdir", PROJECT_PATH] + args
sys.exit(pytest.main(argv))
| [((47, 0, 47, 29), 'logging.captureWarnings', 'logging.captureWarnings', ({(47, 24, 47, 28): '(True)'}, {}), '(True)', False, 'import logging\n'), ((49, 0, 49, 32), 'warnings.simplefilter', 'warnings.simplefilter', ({(49, 22, 49, 31): '"""default"""'}, {}), "('default')", False, 'import warnings\n'), ((51, 9, 51, 39), 'logging.getLogger', 'logging.getLogger', ({(51, 27, 51, 38): '"""run_tests"""'}, {}), "('run_tests')", False, 'import logging\n'), ((79, 8, 80, 75), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((94, 7, 94, 43), 'distutils.sysconfig.get_config_var', 'sysconfig.get_config_var', ({(94, 32, 94, 42): '"""Py_DEBUG"""'}, {}), "('Py_DEBUG')", True, 'import distutils.sysconfig as sysconfig\n'), ((124, 8, 125, 51), 'subprocess.Popen', 'subprocess.Popen', (), '', False, 'import subprocess\n'), ((128, 7, 128, 26), 'os.path.isdir', 'os.path.isdir', ({(128, 21, 128, 25): 'home'}, {}), '(home)', False, 'import os\n'), ((131, 7, 131, 30), 'os.path.isdir', 'os.path.isdir', ({(131, 21, 131, 29): 'alt_home'}, {}), '(alt_home)', False, 'import os\n'), ((115, 7, 115, 37), 'os.environ.get', 'os.environ.get', ({(115, 22, 115, 36): '"""PYBUILD_NAME"""'}, {}), "('PYBUILD_NAME')", False, 'import os\n'), ((118, 9, 118, 42), 'os.environ.get', 'os.environ.get', ({(118, 24, 118, 41): '"""BUILDPYTHONPATH"""'}, {}), "('BUILDPYTHONPATH')", False, 'import os\n'), ((130, 28, 130, 49), 'os.path.dirname', 'os.path.dirname', ({(130, 44, 130, 48): 'home'}, {}), '(home)', False, 'import os\n'), ((148, 8, 148, 37), 'sys.path.insert', 'sys.path.insert', ({(148, 24, 148, 25): '(0)', (148, 27, 148, 36): 'build_dir'}, {}), '(0, build_dir)', False, 'import sys\n'), ((150, 17, 150, 54), 'importlib.import_module', 'importlib.import_module', ({(150, 41, 150, 53): 'project_name'}, {}), '(project_name)', False, 'import importlib\n'), ((157, 34, 157, 59), 'os.path.abspath', 'os.path.abspath', ({(157, 50, 157, 58): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((181, 13, 181, 30), 'pytest.main', 'pytest.main', ({(181, 25, 181, 29): 'argv'}, {}), '(argv)', False, 'import pytest\n'), ((121, 15, 121, 60), 'os.path.join', 'os.path.join', ({(121, 28, 121, 36): 'root_dir', (121, 38, 121, 45): '"""build"""', (121, 47, 121, 59): 'architecture'}, {}), "(root_dir, 'build', architecture)", False, 'import os\n'), ((139, 21, 139, 58), 'importlib.import_module', 'importlib.import_module', ({(139, 45, 139, 57): 'project_name'}, {}), '(project_name)', False, 'import importlib\n'), ((147, 12, 147, 75), 'logging.error', 'logging.error', ({(147, 26, 147, 74): '"""Built project is not available !!! investigate"""'}, {}), "('Built project is not available !!! investigate')", False, 'import logging\n'), ((170, 19, 170, 64), 'os.path.join', 'os.path.join', ({(170, 32, 170, 44): 'PROJECT_PATH', (170, 46, 170, 63): '*option_parts[2:]'}, {}), '(PROJECT_PATH, *option_parts[2:])', False, 'import os\n'), ((119, 31, 119, 68), 'os.environ.get', 'os.environ.get', ({(119, 46, 119, 63): '"""BUILDPYTHONPATH"""', (119, 65, 119, 67): '""""""'}, {}), "('BUILDPYTHONPATH', '')", False, 'import os\n'), ((117, 15, 117, 47), 'os.environ.get', 'os.environ.get', ({(117, 30, 117, 42): '"""PYTHONPATH"""', (117, 44, 117, 46): '""""""'}, {}), "('PYTHONPATH', '')", False, 'import os\n')] |
vprashanth777/Selenium | src/robot/utils/error.py | b3c48b75e73322891bb697f251b32a9a9d8b4dbe | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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.
import os
import re
import sys
import traceback
from robot.errors import RobotError
from .platform import JYTHON, RERAISED_EXCEPTIONS
from .unic import unic
EXCLUDE_ROBOT_TRACES = not os.getenv('ROBOT_INTERNAL_TRACES')
if JYTHON:
from java.io import StringWriter, PrintWriter
from java.lang import Throwable, OutOfMemoryError
else:
Throwable = ()
def get_error_message():
"""Returns error message of the last occurred exception.
This method handles also exceptions containing unicode messages. Thus it
MUST be used to get messages from all exceptions originating outside the
framework.
"""
return ErrorDetails().message
def get_error_details(exclude_robot_traces=EXCLUDE_ROBOT_TRACES):
"""Returns error message and details of the last occurred exception."""
details = ErrorDetails(exclude_robot_traces=exclude_robot_traces)
return details.message, details.traceback
def ErrorDetails(exc_info=None, exclude_robot_traces=EXCLUDE_ROBOT_TRACES):
"""This factory returns an object that wraps the last occurred exception
It has attributes `message`, `traceback` and `error`, where `message`
contains type and message of the original error, `traceback` contains the
traceback/stack trace and `error` contains the original error instance.
"""
exc_type, exc_value, exc_traceback = exc_info or sys.exc_info()
if exc_type in RERAISED_EXCEPTIONS:
raise exc_value
details = PythonErrorDetails \
if not isinstance(exc_value, Throwable) else JavaErrorDetails
return details(exc_type, exc_value, exc_traceback, exclude_robot_traces)
class _ErrorDetails(object):
_generic_exception_names = ('AssertionError', 'AssertionFailedError',
'Exception', 'Error', 'RuntimeError',
'RuntimeException')
def __init__(self, exc_type, exc_value, exc_traceback,
exclude_robot_traces=True):
self.error = exc_value
self._exc_type = exc_type
self._exc_traceback = exc_traceback
self._exclude_robot_traces = exclude_robot_traces
self._message = None
self._traceback = None
@property
def message(self):
if self._message is None:
self._message = self._get_message()
return self._message
def _get_message(self):
raise NotImplementedError
@property
def traceback(self):
if self._traceback is None:
self._traceback = self._get_details()
return self._traceback
def _get_details(self):
raise NotImplementedError
def _get_name(self, exc_type):
try:
return exc_type.__name__
except AttributeError:
return unic(exc_type)
def _format_message(self, name, message):
message = unic(message or '')
message = self._clean_up_message(message, name)
name = name.split('.')[-1] # Use only last part of the name
if not message:
return name
if self._is_generic_exception(name):
return message
return '%s: %s' % (name, message)
def _is_generic_exception(self, name):
return (name in self._generic_exception_names or
isinstance(self.error, RobotError) or
getattr(self.error, 'ROBOT_SUPPRESS_NAME', False))
def _clean_up_message(self, message, name):
return message
class PythonErrorDetails(_ErrorDetails):
def _get_message(self):
name = self._get_name(self._exc_type)
return self._format_message(name, unic(self.error))
def _get_details(self):
if isinstance(self.error, RobotError):
return self.error.details
return 'Traceback (most recent call last):\n' + self._get_traceback()
def _get_traceback(self):
tb = self._exc_traceback
while tb and self._is_excluded_traceback(tb):
tb = tb.tb_next
return ''.join(traceback.format_tb(tb)).rstrip() or ' None'
def _is_excluded_traceback(self, traceback):
if not self._exclude_robot_traces:
return False
module = traceback.tb_frame.f_globals.get('__name__')
return module and module.startswith('robot.')
class JavaErrorDetails(_ErrorDetails):
_java_trace_re = re.compile('^\s+at (\w.+)')
_ignored_java_trace = ('org.python.', 'robot.running.', 'robot$py.',
'sun.reflect.', 'java.lang.reflect.')
def _get_message(self):
exc_name = self._get_name(self._exc_type)
# OOME.getMessage and even toString seem to throw NullPointerException
if not self._is_out_of_memory_error(self._exc_type):
exc_msg = self.error.getMessage()
else:
exc_msg = str(self.error)
return self._format_message(exc_name, exc_msg)
def _is_out_of_memory_error(self, exc_type):
return exc_type is OutOfMemoryError
def _get_details(self):
# OOME.printStackTrace seems to throw NullPointerException
if self._is_out_of_memory_error(self._exc_type):
return ''
output = StringWriter()
self.error.printStackTrace(PrintWriter(output))
details = '\n'.join(line for line in output.toString().splitlines()
if not self._is_ignored_stack_trace_line(line))
msg = unic(self.error.getMessage() or '')
if msg:
details = details.replace(msg, '', 1)
return details
def _is_ignored_stack_trace_line(self, line):
if not line:
return True
res = self._java_trace_re.match(line)
if res is None:
return False
location = res.group(1)
for entry in self._ignored_java_trace:
if location.startswith(entry):
return True
return False
def _clean_up_message(self, msg, name):
msg = self._remove_stack_trace_lines(msg)
return self._remove_exception_name(msg, name).strip()
def _remove_stack_trace_lines(self, msg):
lines = msg.splitlines()
while lines:
if self._java_trace_re.match(lines[-1]):
lines.pop()
else:
break
return '\n'.join(lines)
def _remove_exception_name(self, msg, name):
tokens = msg.split(':', 1)
if len(tokens) == 2 and tokens[0] == name:
msg = tokens[1]
return msg
| [((26, 27, 26, 61), 'os.getenv', 'os.getenv', ({(26, 37, 26, 60): '"""ROBOT_INTERNAL_TRACES"""'}, {}), "('ROBOT_INTERNAL_TRACES')", False, 'import os\n'), ((147, 21, 147, 48), 're.compile', 're.compile', ({(147, 32, 147, 47): '"""^\\\\s+at (\\\\w.+)"""'}, {}), "('^\\\\s+at (\\\\w.+)')", False, 'import re\n'), ((57, 53, 57, 67), 'sys.exc_info', 'sys.exc_info', ({}, {}), '()', False, 'import sys\n'), ((142, 17, 142, 61), 'traceback.tb_frame.f_globals.get', 'traceback.tb_frame.f_globals.get', ({(142, 50, 142, 60): '"""__name__"""'}, {}), "('__name__')", False, 'import traceback\n'), ((167, 17, 167, 31), 'java.io.StringWriter', 'StringWriter', ({}, {}), '()', False, 'from java.io import StringWriter, PrintWriter\n'), ((168, 35, 168, 54), 'java.io.PrintWriter', 'PrintWriter', ({(168, 47, 168, 53): 'output'}, {}), '(output)', False, 'from java.io import StringWriter, PrintWriter\n'), ((137, 23, 137, 46), 'traceback.format_tb', 'traceback.format_tb', ({(137, 43, 137, 45): 'tb'}, {}), '(tb)', False, 'import traceback\n')] |
neozhangthe1/dedupe | dedupe/_init.py | aff99e6bd027291eecfb78eae08aa73877f4fff0 | from dedupe.api import StaticDedupe, Dedupe
from dedupe.api import StaticRecordLink, RecordLink
from dedupe.api import StaticGazetteer, Gazetteer
from dedupe.core import randomPairs, randomPairsMatch, frozendict
from dedupe.convenience import consoleLabel, trainingDataDedupe, trainingDataLink, canonicalize
| [] |
ggreif/ic | scalability/tests/test_misc.py | ac56ec91f077c00d59eea3f73f51e14a1b3ea882 | import unittest
from unittest import TestCase
from misc import verify
class TestVerify(TestCase):
"""Tests misc.py verifies function."""
def test_verify__with_zero_threshold_and_expected_succeeds(self):
"""Test passes when expected rate, actual rate and threshold are all zero."""
result = verify(metric="Query failure rate", actual=0.0, expected=0.0, threshold=0.0)
self.assertEqual(result, 0)
def test_verify__fails_when_positive_delta_is_larger_than_postive_threshold(self):
"""Test fails when positive delta between actual rate and expected rate exceeds positive threshold."""
result = verify(metric="Update latency", actual=200, expected=100, threshold=0.1)
self.assertEqual(result, 1)
def test_verify__fails_when_negative_delta_is_smaller_than_negative_threshold(self):
"""Test fails when negative delta between actual rate and expected rate exceeds negative threshold."""
result = verify(metric="Update latency", actual=50, expected=100, threshold=-0.01)
self.assertEqual(result, 1)
def test_verify__fails_when_negative_delta_and_positive_threshold(self):
"""Test fails when delta between actual rate and expected rate exceeds threshold."""
result = verify(metric="Update latency", actual=50, expected=100, threshold=0.01)
self.assertEqual(result, 0)
if __name__ == "__main__":
unittest.main()
| [((32, 4, 32, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((12, 17, 12, 93), 'misc.verify', 'verify', (), '', False, 'from misc import verify\n'), ((17, 17, 17, 89), 'misc.verify', 'verify', (), '', False, 'from misc import verify\n'), ((22, 17, 22, 90), 'misc.verify', 'verify', (), '', False, 'from misc import verify\n'), ((27, 17, 27, 89), 'misc.verify', 'verify', (), '', False, 'from misc import verify\n')] |
tomzhang/mars-1 | mars/tensor/fft/ifft.py | 6f1d85e37eb1b383251314cb0ba13e06288af03d | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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.
import numpy as np
from ... import opcodes as OperandDef
from ..datasource import tensor as astensor
from .core import TensorComplexFFTMixin, validate_fft, TensorStandardFFT
class TensorIFFT(TensorStandardFFT, TensorComplexFFTMixin):
_op_type_ = OperandDef.IFFT
def __init__(self, n=None, axis=-1, norm=None, dtype=None, **kw):
super().__init__(_n=n, _axis=axis, _norm=norm, _dtype=dtype, **kw)
def ifft(a, n=None, axis=-1, norm=None):
"""
Compute the one-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the one-dimensional *n*-point
discrete Fourier transform computed by `fft`. In other words,
``ifft(fft(a)) == a`` to within numerical accuracy.
For a general description of the algorithm and definitions,
see `mt.fft`.
The input should be ordered in the same way as is returned by `fft`,
i.e.,
* ``a[0]`` should contain the zero frequency term,
* ``a[1:n//2]`` should contain the positive-frequency terms,
* ``a[n//2 + 1:]`` should contain the negative-frequency terms, in
increasing order starting from the most negative frequency.
For an even number of input points, ``A[n//2]`` represents the sum of
the values at the positive and negative Nyquist frequencies, as the two
are aliased together. See `numpy.fft` for details.
Parameters
----------
a : array_like
Input tensor, can be complex.
n : int, optional
Length of the transformed axis of the output.
If `n` is smaller than the length of the input, the input is cropped.
If it is larger, the input is padded with zeros. If `n` is not given,
the length of the input along the axis specified by `axis` is used.
See notes about padding issues.
axis : int, optional
Axis over which to compute the inverse DFT. If not given, the last
axis is used.
norm : {None, "ortho"}, optional
Normalization mode (see `numpy.fft`). Default is None.
Returns
-------
out : complex Tensor
The truncated or zero-padded input, transformed along the axis
indicated by `axis`, or the last one if `axis` is not specified.
Raises
------
IndexError
If `axes` is larger than the last axis of `a`.
See Also
--------
mt.fft : An introduction, with definitions and general explanations.
fft : The one-dimensional (forward) FFT, of which `ifft` is the inverse
ifft2 : The two-dimensional inverse FFT.
ifftn : The n-dimensional inverse FFT.
Notes
-----
If the input parameter `n` is larger than the size of the input, the input
is padded by appending zeros at the end. Even though this is the common
approach, it might lead to surprising results. If a different padding is
desired, it must be performed before calling `ifft`.
Examples
--------
>>> import mars.tensor as mt
>>> mt.fft.ifft([0, 4, 0, 0]).execute()
array([ 1.+0.j, 0.+1.j, -1.+0.j, 0.-1.j])
Create and plot a band-limited signal with random phases:
>>> import matplotlib.pyplot as plt
>>> t = mt.arange(400)
>>> n = mt.zeros((400,), dtype=complex)
>>> n[40:60] = mt.exp(1j*mt.random.uniform(0, 2*mt.pi, (20,)))
>>> s = mt.fft.ifft(n)
>>> plt.plot(t.execute(), s.real.execute(), 'b-', t.execute(), s.imag.execute(), 'r--')
...
>>> plt.legend(('real', 'imaginary'))
...
>>> plt.show()
"""
a = astensor(a)
validate_fft(a, axis, norm)
op = TensorIFFT(n=n, axis=axis, norm=norm, dtype=np.dtype(np.complex_))
return op(a)
| [((117, 53, 117, 74), 'numpy.dtype', 'np.dtype', ({(117, 62, 117, 73): 'np.complex_'}, {}), '(np.complex_)', True, 'import numpy as np\n')] |
mminamina/311-data | server/api/src/db/migrate/versions/v_2.py | 9a3e4dc6e14c7500fc3f75f583c7fc4b01108b29 |
def migrate():
print('migrating to version 2')
| [] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.