code
stringlengths
1
25.8M
language
stringclasses
18 values
source
stringclasses
4 values
repo
stringclasses
78 values
path
stringlengths
0
268
import copy import enum import doctest import inspect import os import pydoc import sys import unittest import threading import typing import builtins as bltns from collections import OrderedDict from datetime import date from enum import Enum, EnumMeta, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto from enum import STRICT, CONFORM, EJECT, KEEP, _simple_enum, _test_simple_enum from enum import verify, UNIQUE, CONTINUOUS, NAMED_FLAGS, ReprEnum from enum import member, nonmember, _iter_bits_lsb, EnumDict from io import StringIO from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL from test import support from test.support import ALWAYS_EQ, REPO_ROOT from test.support import threading_helper, cpython_only from test.support.import_helper import ensure_lazy_imports from datetime import timedelta python_version = sys.version_info[:2] def load_tests(loader, tests, ignore): tests.addTests(doctest.DocTestSuite(enum)) lib_tests = os.path.join(REPO_ROOT, 'Doc/library/enum.rst') if os.path.exists(lib_tests): tests.addTests(doctest.DocFileSuite( lib_tests, module_relative=False, optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE, )) howto_tests = os.path.join(REPO_ROOT, 'Doc/howto/enum.rst') if os.path.exists(howto_tests) and sys.float_repr_style == 'short': tests.addTests(doctest.DocFileSuite( howto_tests, module_relative=False, optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE, )) return tests def reraise_if_not_enum(*enum_types_or_exceptions): from functools import wraps def decorator(func): @wraps(func) def inner(*args, **kwargs): excs = [ e for e in enum_types_or_exceptions if isinstance(e, Exception) ] if len(excs) == 1: raise excs[0] elif excs: raise ExceptionGroup('Enum Exceptions', excs) return func(*args, **kwargs) return inner return decorator MODULE = __name__ SHORT_MODULE = MODULE.split('.')[-1] # for pickle tests try: class Stooges(Enum): LARRY = 1 CURLY = 2 MOE = 3 except Exception as exc: Stooges = exc try: class IntStooges(int, Enum): LARRY = 1 CURLY = 2 MOE = 3 except Exception as exc: IntStooges = exc try: class FloatStooges(float, Enum): LARRY = 1.39 CURLY = 2.72 MOE = 3.142596 except Exception as exc: FloatStooges = exc try: class FlagStooges(Flag): LARRY = 1 CURLY = 2 MOE = 4 BIG = 389 except Exception as exc: FlagStooges = exc try: class FlagStoogesWithZero(Flag): NOFLAG = 0 LARRY = 1 CURLY = 2 MOE = 4 BIG = 389 except Exception as exc: FlagStoogesWithZero = exc try: class IntFlagStooges(IntFlag): LARRY = 1 CURLY = 2 MOE = 4 BIG = 389 except Exception as exc: IntFlagStooges = exc try: class IntFlagStoogesWithZero(IntFlag): NOFLAG = 0 LARRY = 1 CURLY = 2 MOE = 4 BIG = 389 except Exception as exc: IntFlagStoogesWithZero = exc # for pickle test and subclass tests try: class Name(StrEnum): BDFL = 'Guido van Rossum' FLUFL = 'Barry Warsaw' except Exception as exc: Name = exc try: Question = Enum('Question', 'who what when where why', module=__name__) except Exception as exc: Question = exc try: Answer = Enum('Answer', 'him this then there because') except Exception as exc: Answer = exc try: Theory = Enum('Theory', 'rule law supposition', qualname='spanish_inquisition') except Exception as exc: Theory = exc # for doctests try: class Fruit(Enum): TOMATO = 1 BANANA = 2 CHERRY = 3 except Exception: pass def test_pickle_dump_load(assertion, source, target=None): if target is None: target = source for protocol in range(HIGHEST_PROTOCOL + 1): assertion(loads(dumps(source, protocol=protocol)), target) def test_pickle_exception(assertion, exception, obj): for protocol in range(HIGHEST_PROTOCOL + 1): with assertion(exception): dumps(obj, protocol=protocol) class TestHelpers(unittest.TestCase): # _is_descriptor, _is_sunder, _is_dunder sunder_names = '_bad_', '_good_', '_what_ho_' dunder_names = '__mal__', '__bien__', '__que_que__' private_names = '_MyEnum__private', '_MyEnum__still_private', '_MyEnum___triple_private' private_and_sunder_names = '_MyEnum__private_', '_MyEnum__also_private_' random_names = 'okay', '_semi_private', '_weird__', '_MyEnum__' def test_is_descriptor(self): class foo: pass for attr in ('__get__','__set__','__delete__'): obj = foo() self.assertFalse(enum._is_descriptor(obj)) setattr(obj, attr, 1) self.assertTrue(enum._is_descriptor(obj)) def test_sunder(self): for name in self.sunder_names + self.private_and_sunder_names: self.assertTrue(enum._is_sunder(name), '%r is a not sunder name?' % name) for name in self.dunder_names + self.private_names + self.random_names: self.assertFalse(enum._is_sunder(name), '%r is a sunder name?' % name) for s in ('_a_', '_aa_'): self.assertTrue(enum._is_sunder(s)) for s in ('a', 'a_', '_a', '__a', 'a__', '__a__', '_a__', '__a_', '_', '__', '___', '____', '_____',): self.assertFalse(enum._is_sunder(s)) def test_dunder(self): for name in self.dunder_names: self.assertTrue(enum._is_dunder(name), '%r is a not dunder name?' % name) for name in self.sunder_names + self.private_names + self.private_and_sunder_names + self.random_names: self.assertFalse(enum._is_dunder(name), '%r is a dunder name?' % name) for s in ('__a__', '__aa__'): self.assertTrue(enum._is_dunder(s)) for s in ('a', 'a_', '_a', '__a', 'a__', '_a_', '_a__', '__a_', '_', '__', '___', '____', '_____',): self.assertFalse(enum._is_dunder(s)) def test_is_private(self): for name in self.private_names + self.private_and_sunder_names: self.assertTrue(enum._is_private('MyEnum', name), '%r is a not private name?') for name in self.sunder_names + self.dunder_names + self.random_names: self.assertFalse(enum._is_private('MyEnum', name), '%r is a private name?') def test_iter_bits_lsb(self): self.assertEqual(list(_iter_bits_lsb(7)), [1, 2, 4]) self.assertRaisesRegex(ValueError, '-8 is not a positive integer', list, _iter_bits_lsb(-8)) # for subclassing tests class classproperty: def __init__(self, fget=None, fset=None, fdel=None, doc=None): self.fget = fget self.fset = fset self.fdel = fdel if doc is None and fget is not None: doc = fget.__doc__ self.__doc__ = doc def __get__(self, instance, ownerclass): return self.fget(ownerclass) # for global repr tests try: @enum.global_enum class HeadlightsK(IntFlag, boundary=enum.KEEP): OFF_K = 0 LOW_BEAM_K = auto() HIGH_BEAM_K = auto() FOG_K = auto() except Exception as exc: HeadlightsK = exc try: @enum.global_enum class HeadlightsC(IntFlag, boundary=enum.CONFORM): OFF_C = 0 LOW_BEAM_C = auto() HIGH_BEAM_C = auto() FOG_C = auto() except Exception as exc: HeadlightsC = exc try: @enum.global_enum class NoName(Flag): ONE = 1 TWO = 2 except Exception as exc: NoName = exc # tests class _EnumTests: """ Test for behavior that is the same across the different types of enumerations. """ values = None def setUp(self): if self.__class__.__name__[-5:] == 'Class': class BaseEnum(self.enum_type): @enum.property def first(self): return '%s is first!' % self.name class MainEnum(BaseEnum): first = auto() second = auto() third = auto() if issubclass(self.enum_type, Flag): dupe = 3 else: dupe = third self.MainEnum = MainEnum # class NewStrEnum(self.enum_type): def __str__(self): return self.name.upper() first = auto() self.NewStrEnum = NewStrEnum # class NewFormatEnum(self.enum_type): def __format__(self, spec): return self.name.upper() first = auto() self.NewFormatEnum = NewFormatEnum # class NewStrFormatEnum(self.enum_type): def __str__(self): return self.name.title() def __format__(self, spec): return ''.join(reversed(self.name)) first = auto() self.NewStrFormatEnum = NewStrFormatEnum # class NewBaseEnum(self.enum_type): def __str__(self): return self.name.title() def __format__(self, spec): return ''.join(reversed(self.name)) self.NewBaseEnum = NewBaseEnum class NewSubEnum(NewBaseEnum): first = auto() self.NewSubEnum = NewSubEnum # class LazyGNV(self.enum_type): def _generate_next_value_(name, start, last, values): pass self.LazyGNV = LazyGNV # class BusyGNV(self.enum_type): @staticmethod def _generate_next_value_(name, start, last, values): pass self.BusyGNV = BusyGNV # self.is_flag = False self.names = ['first', 'second', 'third'] if issubclass(MainEnum, StrEnum): self.values = self.names elif MainEnum._member_type_ is str: self.values = ['1', '2', '3'] elif issubclass(self.enum_type, Flag): self.values = [1, 2, 4] self.is_flag = True self.dupe2 = MainEnum(5) else: self.values = self.values or [1, 2, 3] # if not getattr(self, 'source_values', False): self.source_values = self.values elif self.__class__.__name__[-8:] == 'Function': @enum.property def first(self): return '%s is first!' % self.name BaseEnum = self.enum_type('BaseEnum', {'first':first}) # first = auto() second = auto() third = auto() if issubclass(self.enum_type, Flag): dupe = 3 else: dupe = third self.MainEnum = MainEnum = BaseEnum('MainEnum', dict(first=first, second=second, third=third, dupe=dupe)) # def __str__(self): return self.name.upper() first = auto() self.NewStrEnum = self.enum_type('NewStrEnum', (('first',first),('__str__',__str__))) # def __format__(self, spec): return self.name.upper() first = auto() self.NewFormatEnum = self.enum_type('NewFormatEnum', [('first',first),('__format__',__format__)]) # def __str__(self): return self.name.title() def __format__(self, spec): return ''.join(reversed(self.name)) first = auto() self.NewStrFormatEnum = self.enum_type('NewStrFormatEnum', dict(first=first, __format__=__format__, __str__=__str__)) # def __str__(self): return self.name.title() def __format__(self, spec): return ''.join(reversed(self.name)) self.NewBaseEnum = self.enum_type('NewBaseEnum', dict(__format__=__format__, __str__=__str__)) self.NewSubEnum = self.NewBaseEnum('NewSubEnum', 'first') # def _generate_next_value_(name, start, last, values): pass self.LazyGNV = self.enum_type('LazyGNV', {'_generate_next_value_':_generate_next_value_}) # @staticmethod def _generate_next_value_(name, start, last, values): pass self.BusyGNV = self.enum_type('BusyGNV', {'_generate_next_value_':_generate_next_value_}) # self.is_flag = False self.names = ['first', 'second', 'third'] if issubclass(MainEnum, StrEnum): self.values = self.names elif MainEnum._member_type_ is str: self.values = ['1', '2', '3'] elif issubclass(self.enum_type, Flag): self.values = [1, 2, 4] self.is_flag = True self.dupe2 = MainEnum(5) else: self.values = self.values or [1, 2, 3] # if not getattr(self, 'source_values', False): self.source_values = self.values else: raise ValueError('unknown enum style: %r' % self.__class__.__name__) def assertFormatIsValue(self, spec, member): self.assertEqual(spec.format(member), spec.format(member.value)) def assertFormatIsStr(self, spec, member): self.assertEqual(spec.format(member), spec.format(str(member))) def test_attribute_deletion(self): class Season(self.enum_type): SPRING = auto() SUMMER = auto() AUTUMN = auto() # def spam(cls): pass # self.assertHasAttr(Season, 'spam') del Season.spam self.assertNotHasAttr(Season, 'spam') # with self.assertRaises(AttributeError): del Season.SPRING with self.assertRaises(AttributeError): del Season.DRY with self.assertRaises(AttributeError): del Season.SPRING.name def test_bad_new_super(self): with self.assertRaisesRegex( TypeError, 'do not use .super...__new__;', ): class BadSuper(self.enum_type): def __new__(cls, value): obj = super().__new__(cls, value) return obj failed = 1 def test_basics(self): TE = self.MainEnum if self.is_flag: self.assertEqual(repr(TE), "<flag 'MainEnum'>") self.assertEqual(str(TE), "<flag 'MainEnum'>") self.assertEqual(format(TE), "<flag 'MainEnum'>") self.assertTrue(TE(5) is self.dupe2) self.assertTrue(7 in TE) else: self.assertEqual(repr(TE), "<enum 'MainEnum'>") self.assertEqual(str(TE), "<enum 'MainEnum'>") self.assertEqual(format(TE), "<enum 'MainEnum'>") self.assertEqual(list(TE), [TE.first, TE.second, TE.third]) self.assertEqual( [m.name for m in TE], self.names, ) self.assertEqual( [m.value for m in TE], self.values, ) self.assertEqual( [m.first for m in TE], ['first is first!', 'second is first!', 'third is first!'] ) for member, name in zip(TE, self.names, strict=True): self.assertIs(TE[name], member) for member, value in zip(TE, self.values, strict=True): self.assertIs(TE(value), member) if issubclass(TE, StrEnum): self.assertTrue(TE.dupe is TE('third') is TE['dupe']) elif TE._member_type_ is str: self.assertTrue(TE.dupe is TE('3') is TE['dupe']) elif issubclass(TE, Flag): self.assertTrue(TE.dupe is TE(3) is TE['dupe']) else: self.assertTrue(TE.dupe is TE(self.values[2]) is TE['dupe']) def test_bool_is_true(self): class Empty(self.enum_type): pass self.assertTrue(Empty) # self.assertTrue(self.MainEnum) for member in self.MainEnum: self.assertTrue(member) def test_changing_member_fails(self): MainEnum = self.MainEnum with self.assertRaises(AttributeError): self.MainEnum.second = 'really first' def test_contains_tf(self): MainEnum = self.MainEnum self.assertIn(MainEnum.first, MainEnum) self.assertTrue(self.values[0] in MainEnum) if type(self) not in (TestStrEnumClass, TestStrEnumFunction): self.assertFalse('first' in MainEnum) val = MainEnum.dupe self.assertIn(val, MainEnum) self.assertNotIn(float('nan'), MainEnum) # class OtherEnum(Enum): one = auto() two = auto() self.assertNotIn(OtherEnum.two, MainEnum) # if MainEnum._member_type_ is object: # enums without mixed data types will always be False class NotEqualEnum(self.enum_type): this = self.source_values[0] that = self.source_values[1] self.assertNotIn(NotEqualEnum.this, MainEnum) self.assertNotIn(NotEqualEnum.that, MainEnum) else: # enums with mixed data types may be True class EqualEnum(self.enum_type): this = self.source_values[0] that = self.source_values[1] self.assertIn(EqualEnum.this, MainEnum) self.assertIn(EqualEnum.that, MainEnum) def test_contains_same_name_diff_enum_diff_values(self): MainEnum = self.MainEnum # class OtherEnum(Enum): first = "brand" second = "new" third = "values" # self.assertIn(MainEnum.first, MainEnum) self.assertIn(MainEnum.second, MainEnum) self.assertIn(MainEnum.third, MainEnum) self.assertNotIn(MainEnum.first, OtherEnum) self.assertNotIn(MainEnum.second, OtherEnum) self.assertNotIn(MainEnum.third, OtherEnum) # self.assertIn(OtherEnum.first, OtherEnum) self.assertIn(OtherEnum.second, OtherEnum) self.assertIn(OtherEnum.third, OtherEnum) self.assertNotIn(OtherEnum.first, MainEnum) self.assertNotIn(OtherEnum.second, MainEnum) self.assertNotIn(OtherEnum.third, MainEnum) def test_dir_on_class(self): TE = self.MainEnum self.assertEqual(set(dir(TE)), set(enum_dir(TE))) def test_dir_on_item(self): TE = self.MainEnum self.assertEqual(set(dir(TE.first)), set(member_dir(TE.first))) def test_dir_with_added_behavior(self): class Test(self.enum_type): this = auto() these = auto() def wowser(self): return ("Wowser! I'm %s!" % self.name) self.assertTrue('wowser' not in dir(Test)) self.assertTrue('wowser' in dir(Test.this)) def test_dir_on_sub_with_behavior_on_super(self): # see issue22506 class SuperEnum(self.enum_type): def invisible(self): return "did you see me?" class SubEnum(SuperEnum): sample = auto() self.assertTrue('invisible' not in dir(SubEnum)) self.assertTrue('invisible' in dir(SubEnum.sample)) def test_dir_on_sub_with_behavior_including_instance_dict_on_super(self): # see issue40084 class SuperEnum(self.enum_type): def __new__(cls, *value, **kwds): new = self.enum_type._member_type_.__new__ if self.enum_type._member_type_ is object: obj = new(cls) else: if isinstance(value[0], tuple): create_value ,= value[0] else: create_value = value obj = new(cls, *create_value) obj._value_ = value[0] if len(value) == 1 else value obj.description = 'test description' return obj class SubEnum(SuperEnum): sample = self.source_values[1] self.assertTrue('description' not in dir(SubEnum)) self.assertTrue('description' in dir(SubEnum.sample), dir(SubEnum.sample)) def test_empty_enum_has_no_values(self): with self.assertRaisesRegex(TypeError, "<.... 'NewBaseEnum'> has no members"): self.NewBaseEnum(7) def test_enum_in_enum_out(self): Main = self.MainEnum self.assertIs(Main(Main.first), Main.first) def test_gnv_is_static(self): lazy = self.LazyGNV busy = self.BusyGNV self.assertTrue(type(lazy.__dict__['_generate_next_value_']) is staticmethod) self.assertTrue(type(busy.__dict__['_generate_next_value_']) is staticmethod) def test_hash(self): MainEnum = self.MainEnum mapping = {} mapping[MainEnum.first] = '1225' mapping[MainEnum.second] = '0315' mapping[MainEnum.third] = '0704' self.assertEqual(mapping[MainEnum.second], '0315') def test_invalid_names(self): with self.assertRaises(ValueError): class Wrong(self.enum_type): mro = 9 with self.assertRaises(ValueError): class Wrong(self.enum_type): _create_= 11 with self.assertRaises(ValueError): class Wrong(self.enum_type): _get_mixins_ = 9 with self.assertRaises(ValueError): class Wrong(self.enum_type): _find_new_ = 1 with self.assertRaises(ValueError): class Wrong(self.enum_type): _any_name_ = 9 def test_object_str_override(self): "check that setting __str__ to object's is not reset to Enum's" class Generic(self.enum_type): item = self.source_values[2] def __repr__(self): return "%s.test" % (self._name_, ) __str__ = object.__str__ self.assertEqual(str(Generic.item), 'item.test') def test_overridden_str(self): NS = self.NewStrEnum self.assertEqual(str(NS.first), NS.first.name.upper()) self.assertEqual(format(NS.first), NS.first.name.upper()) def test_overridden_str_format(self): NSF = self.NewStrFormatEnum self.assertEqual(str(NSF.first), NSF.first.name.title()) self.assertEqual(format(NSF.first), ''.join(reversed(NSF.first.name))) def test_overridden_str_format_inherited(self): NSE = self.NewSubEnum self.assertEqual(str(NSE.first), NSE.first.name.title()) self.assertEqual(format(NSE.first), ''.join(reversed(NSE.first.name))) def test_programmatic_function_string(self): MinorEnum = self.enum_type('MinorEnum', 'june july august') lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) values = self.values if self.enum_type is StrEnum: values = ['june','july','august'] for month, av in zip('june july august'.split(), values): e = MinorEnum[month] self.assertEqual(e.value, av, list(MinorEnum)) self.assertEqual(e.name, month) if MinorEnum._member_type_ is not object and issubclass(MinorEnum, MinorEnum._member_type_): self.assertEqual(e, av) else: self.assertNotEqual(e, av) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) self.assertIs(e, MinorEnum(av)) def test_programmatic_function_string_list(self): MinorEnum = self.enum_type('MinorEnum', ['june', 'july', 'august']) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) values = self.values if self.enum_type is StrEnum: values = ['june','july','august'] for month, av in zip('june july august'.split(), values): e = MinorEnum[month] self.assertEqual(e.value, av) self.assertEqual(e.name, month) if MinorEnum._member_type_ is not object and issubclass(MinorEnum, MinorEnum._member_type_): self.assertEqual(e, av) else: self.assertNotEqual(e, av) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) self.assertIs(e, MinorEnum(av)) def test_programmatic_function_iterable(self): MinorEnum = self.enum_type( 'MinorEnum', (('june', self.source_values[0]), ('july', self.source_values[1]), ('august', self.source_values[2])) ) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for month, av in zip('june july august'.split(), self.values): e = MinorEnum[month] self.assertEqual(e.value, av) self.assertEqual(e.name, month) if MinorEnum._member_type_ is not object and issubclass(MinorEnum, MinorEnum._member_type_): self.assertEqual(e, av) else: self.assertNotEqual(e, av) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) self.assertIs(e, MinorEnum(av)) def test_programmatic_function_from_dict(self): MinorEnum = self.enum_type( 'MinorEnum', OrderedDict((('june', self.source_values[0]), ('july', self.source_values[1]), ('august', self.source_values[2]))) ) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for month, av in zip('june july august'.split(), self.values): e = MinorEnum[month] if MinorEnum._member_type_ is not object and issubclass(MinorEnum, MinorEnum._member_type_): self.assertEqual(e, av) else: self.assertNotEqual(e, av) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) self.assertIs(e, MinorEnum(av)) def test_repr(self): TE = self.MainEnum if self.is_flag: self.assertEqual(repr(TE(0)), "<MainEnum: 0>") self.assertEqual(repr(TE.dupe), "<MainEnum.dupe: 3>") self.assertEqual(repr(self.dupe2), "<MainEnum.first|third: 5>") elif issubclass(TE, StrEnum): self.assertEqual(repr(TE.dupe), "<MainEnum.third: 'third'>") else: self.assertEqual(repr(TE.dupe), "<MainEnum.third: %r>" % (self.values[2], ), TE._value_repr_) for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(repr(member), "<MainEnum.%s: %r>" % (member.name, member.value)) def test_repr_override(self): class Generic(self.enum_type): first = auto() second = auto() third = auto() def __repr__(self): return "don't you just love shades of %s?" % self.name self.assertEqual( repr(Generic.third), "don't you just love shades of third?", ) def test_inherited_repr(self): class MyEnum(self.enum_type): def __repr__(self): return "My name is %s." % self.name class MySubEnum(MyEnum): this = auto() that = auto() theother = auto() self.assertEqual(repr(MySubEnum.that), "My name is that.") def test_multiple_superclasses_repr(self): class _EnumSuperClass(metaclass=EnumMeta): pass class E(_EnumSuperClass, Enum): A = 1 self.assertEqual(repr(E.A), "<E.A: 1>") def test_reversed_iteration_order(self): self.assertEqual( list(reversed(self.MainEnum)), [self.MainEnum.third, self.MainEnum.second, self.MainEnum.first], ) class _PlainOutputTests: def test_str(self): TE = self.MainEnum if self.is_flag: self.assertEqual(str(TE(0)), "MainEnum(0)") self.assertEqual(str(TE.dupe), "MainEnum.dupe") self.assertEqual(str(self.dupe2), "MainEnum.first|third") else: self.assertEqual(str(TE.dupe), "MainEnum.third") for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(str(member), "MainEnum.%s" % (member.name, )) def test_format(self): TE = self.MainEnum if self.is_flag: self.assertEqual(format(TE.dupe), "MainEnum.dupe") self.assertEqual(format(self.dupe2), "MainEnum.first|third") else: self.assertEqual(format(TE.dupe), "MainEnum.third") for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(format(member), "MainEnum.%s" % (member.name, )) def test_overridden_format(self): NF = self.NewFormatEnum self.assertEqual(str(NF.first), "NewFormatEnum.first", '%s %r' % (NF.__str__, NF.first)) self.assertEqual(format(NF.first), "FIRST") def test_format_specs(self): TE = self.MainEnum self.assertFormatIsStr('{}', TE.second) self.assertFormatIsStr('{:}', TE.second) self.assertFormatIsStr('{:20}', TE.second) self.assertFormatIsStr('{:^20}', TE.second) self.assertFormatIsStr('{:>20}', TE.second) self.assertFormatIsStr('{:<20}', TE.second) self.assertFormatIsStr('{:5.2}', TE.second) class _MixedOutputTests: def test_str(self): TE = self.MainEnum if self.is_flag: self.assertEqual(str(TE.dupe), "MainEnum.dupe") self.assertEqual(str(self.dupe2), "MainEnum.first|third") else: self.assertEqual(str(TE.dupe), "MainEnum.third") for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(str(member), "MainEnum.%s" % (member.name, )) def test_format(self): TE = self.MainEnum if self.is_flag: self.assertEqual(format(TE.dupe), "MainEnum.dupe") self.assertEqual(format(self.dupe2), "MainEnum.first|third") else: self.assertEqual(format(TE.dupe), "MainEnum.third") for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(format(member), "MainEnum.%s" % (member.name, )) def test_overridden_format(self): NF = self.NewFormatEnum self.assertEqual(str(NF.first), "NewFormatEnum.first") self.assertEqual(format(NF.first), "FIRST") def test_format_specs(self): TE = self.MainEnum self.assertFormatIsStr('{}', TE.first) self.assertFormatIsStr('{:}', TE.first) self.assertFormatIsStr('{:20}', TE.first) self.assertFormatIsStr('{:^20}', TE.first) self.assertFormatIsStr('{:>20}', TE.first) self.assertFormatIsStr('{:<20}', TE.first) self.assertFormatIsStr('{:5.2}', TE.first) class _MinimalOutputTests: def test_str(self): TE = self.MainEnum if self.is_flag: self.assertEqual(str(TE.dupe), "3") self.assertEqual(str(self.dupe2), "5") else: self.assertEqual(str(TE.dupe), str(self.values[2])) for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(str(member), str(value)) def test_format(self): TE = self.MainEnum if self.is_flag: self.assertEqual(format(TE.dupe), "3") self.assertEqual(format(self.dupe2), "5") else: self.assertEqual(format(TE.dupe), format(self.values[2])) for name, value, member in zip(self.names, self.values, TE, strict=True): self.assertEqual(format(member), format(value)) def test_overridden_format(self): NF = self.NewFormatEnum self.assertEqual(str(NF.first), str(self.values[0])) self.assertEqual(format(NF.first), "FIRST") def test_format_specs(self): TE = self.MainEnum self.assertFormatIsValue('{}', TE.third) self.assertFormatIsValue('{:}', TE.third) self.assertFormatIsValue('{:20}', TE.third) self.assertFormatIsValue('{:^20}', TE.third) self.assertFormatIsValue('{:>20}', TE.third) self.assertFormatIsValue('{:<20}', TE.third) if TE._member_type_ is float: self.assertFormatIsValue('{:n}', TE.third) self.assertFormatIsValue('{:5.2}', TE.third) self.assertFormatIsValue('{:f}', TE.third) def test_copy(self): TE = self.MainEnum copied = copy.copy(TE) self.assertEqual(copied, TE) self.assertIs(copied, TE) deep = copy.deepcopy(TE) self.assertEqual(deep, TE) self.assertIs(deep, TE) def test_copy_member(self): TE = self.MainEnum copied = copy.copy(TE.first) self.assertIs(copied, TE.first) deep = copy.deepcopy(TE.first) self.assertIs(deep, TE.first) class _FlagTests: def test_default_missing_with_wrong_type_value(self): with self.assertRaisesRegex( ValueError, "'RED' is not a valid ", ) as ctx: self.MainEnum('RED') self.assertIs(ctx.exception.__context__, None) def test_closed_invert_expectations(self): class ClosedAB(self.enum_type): A = 1 B = 2 MASK = 3 A, B = ClosedAB AB_MASK = ClosedAB.MASK # self.assertIs(~A, B) self.assertIs(~B, A) self.assertIs(~(A|B), ClosedAB(0)) self.assertIs(~AB_MASK, ClosedAB(0)) self.assertIs(~ClosedAB(0), (A|B)) # class ClosedXYZ(self.enum_type): X = 4 Y = 2 Z = 1 MASK = 7 X, Y, Z = ClosedXYZ XYZ_MASK = ClosedXYZ.MASK # self.assertIs(~X, Y|Z) self.assertIs(~Y, X|Z) self.assertIs(~Z, X|Y) self.assertIs(~(X|Y), Z) self.assertIs(~(X|Z), Y) self.assertIs(~(Y|Z), X) self.assertIs(~(X|Y|Z), ClosedXYZ(0)) self.assertIs(~XYZ_MASK, ClosedXYZ(0)) self.assertIs(~ClosedXYZ(0), (X|Y|Z)) def test_open_invert_expectations(self): class OpenAB(self.enum_type): A = 1 B = 2 MASK = 255 A, B = OpenAB AB_MASK = OpenAB.MASK # if OpenAB._boundary_ in (EJECT, KEEP): self.assertIs(~A, OpenAB(254)) self.assertIs(~B, OpenAB(253)) self.assertIs(~(A|B), OpenAB(252)) self.assertIs(~AB_MASK, OpenAB(0)) self.assertIs(~OpenAB(0), AB_MASK) self.assertIs(OpenAB(~4), OpenAB(251)) else: self.assertIs(~A, B) self.assertIs(~B, A) self.assertIs(OpenAB(~1), B) self.assertIs(OpenAB(~2), A) self.assertIs(~(A|B), OpenAB(0)) self.assertIs(~AB_MASK, OpenAB(0)) self.assertIs(~OpenAB(0), (A|B)) self.assertIs(OpenAB(~3), OpenAB(0)) self.assertIs(OpenAB(~4), OpenAB(3)) self.assertIs(OpenAB(~33), B) # class OpenXYZ(self.enum_type): X = 4 Y = 2 Z = 1 MASK = 31 X, Y, Z = OpenXYZ XYZ_MASK = OpenXYZ.MASK # if OpenXYZ._boundary_ in (EJECT, KEEP): self.assertIs(~X, OpenXYZ(27)) self.assertIs(~Y, OpenXYZ(29)) self.assertIs(~Z, OpenXYZ(30)) self.assertIs(~(X|Y), OpenXYZ(25)) self.assertIs(~(X|Z), OpenXYZ(26)) self.assertIs(~(Y|Z), OpenXYZ(28)) self.assertIs(~(X|Y|Z), OpenXYZ(24)) self.assertIs(~XYZ_MASK, OpenXYZ(0)) self.assertTrue(~OpenXYZ(0), XYZ_MASK) else: self.assertIs(~X, Y|Z) self.assertIs(~Y, X|Z) self.assertIs(~Z, X|Y) self.assertIs(OpenXYZ(~4), Y|Z) self.assertIs(OpenXYZ(~2), X|Z) self.assertIs(OpenXYZ(~1), X|Y) self.assertIs(~(X|Y), Z) self.assertIs(~(X|Z), Y) self.assertIs(~(Y|Z), X) self.assertIs(~(X|Y|Z), OpenXYZ(0)) self.assertIs(~XYZ_MASK, OpenXYZ(0)) self.assertTrue(~OpenXYZ(0), (X|Y|Z)) def test_assigned_negative_value(self): class X(self.enum_type): A = auto() B = auto() C = A | B D = ~A self.assertEqual(list(X), [X.A, X.B]) self.assertIs(~X.A, X.B) self.assertIs(X.D, X.B) self.assertEqual(X.D.value, 2) # class Y(self.enum_type): A = auto() B = auto() C = A | B D = ~A E = auto() self.assertEqual(list(Y), [Y.A, Y.B, Y.E]) self.assertIs(~Y.A, Y.B|Y.E) self.assertIs(Y.D, Y.B|Y.E) self.assertEqual(Y.D.value, 6) class TestPlainEnumClass(_EnumTests, _PlainOutputTests, unittest.TestCase): enum_type = Enum class TestPlainEnumFunction(_EnumTests, _PlainOutputTests, unittest.TestCase): enum_type = Enum class TestPlainFlagClass(_EnumTests, _PlainOutputTests, _FlagTests, unittest.TestCase): enum_type = Flag def test_none_member(self): class FlagWithNoneMember(Flag): A = 1 E = None self.assertEqual(FlagWithNoneMember.A.value, 1) self.assertIs(FlagWithNoneMember.E.value, None) with self.assertRaisesRegex(TypeError, r"'FlagWithNoneMember.E' cannot be combined with other flags with |"): FlagWithNoneMember.A | FlagWithNoneMember.E with self.assertRaisesRegex(TypeError, r"'FlagWithNoneMember.E' cannot be combined with other flags with &"): FlagWithNoneMember.E & FlagWithNoneMember.A with self.assertRaisesRegex(TypeError, r"'FlagWithNoneMember.E' cannot be combined with other flags with \^"): FlagWithNoneMember.A ^ FlagWithNoneMember.E with self.assertRaisesRegex(TypeError, r"'FlagWithNoneMember.E' cannot be inverted"): ~FlagWithNoneMember.E class TestPlainFlagFunction(_EnumTests, _PlainOutputTests, _FlagTests, unittest.TestCase): enum_type = Flag class TestIntEnumClass(_EnumTests, _MinimalOutputTests, unittest.TestCase): enum_type = IntEnum # def test_shadowed_attr(self): class Number(IntEnum): divisor = 1 numerator = 2 # self.assertEqual(Number.divisor.numerator, 1) self.assertIs(Number.numerator.divisor, Number.divisor) class TestIntEnumFunction(_EnumTests, _MinimalOutputTests, unittest.TestCase): enum_type = IntEnum # def test_shadowed_attr(self): Number = IntEnum('Number', ('divisor', 'numerator')) # self.assertEqual(Number.divisor.numerator, 1) self.assertIs(Number.numerator.divisor, Number.divisor) class TestStrEnumClass(_EnumTests, _MinimalOutputTests, unittest.TestCase): enum_type = StrEnum # def test_shadowed_attr(self): class Book(StrEnum): author = 'author' title = 'title' # self.assertEqual(Book.author.title(), 'Author') self.assertEqual(Book.title.title(), 'Title') self.assertIs(Book.title.author, Book.author) class TestStrEnumFunction(_EnumTests, _MinimalOutputTests, unittest.TestCase): enum_type = StrEnum # def test_shadowed_attr(self): Book = StrEnum('Book', ('author', 'title')) # self.assertEqual(Book.author.title(), 'Author') self.assertEqual(Book.title.title(), 'Title') self.assertIs(Book.title.author, Book.author) class TestIntFlagClass(_EnumTests, _MinimalOutputTests, _FlagTests, unittest.TestCase): enum_type = IntFlag class TestIntFlagFunction(_EnumTests, _MinimalOutputTests, _FlagTests, unittest.TestCase): enum_type = IntFlag class TestMixedIntClass(_EnumTests, _MixedOutputTests, unittest.TestCase): class enum_type(int, Enum): pass class TestMixedIntFunction(_EnumTests, _MixedOutputTests, unittest.TestCase): enum_type = Enum('enum_type', type=int) class TestMixedStrClass(_EnumTests, _MixedOutputTests, unittest.TestCase): class enum_type(str, Enum): pass class TestMixedStrFunction(_EnumTests, _MixedOutputTests, unittest.TestCase): enum_type = Enum('enum_type', type=str) class TestMixedIntFlagClass(_EnumTests, _MixedOutputTests, _FlagTests, unittest.TestCase): class enum_type(int, Flag): pass class TestMixedIntFlagFunction(_EnumTests, _MixedOutputTests, _FlagTests, unittest.TestCase): enum_type = Flag('enum_type', type=int) class TestMixedDateClass(_EnumTests, _MixedOutputTests, unittest.TestCase): # values = [date(2021, 12, 25), date(2020, 3, 15), date(2019, 11, 27)] source_values = [(2021, 12, 25), (2020, 3, 15), (2019, 11, 27)] # class enum_type(date, Enum): @staticmethod def _generate_next_value_(name, start, count, last_values): values = [(2021, 12, 25), (2020, 3, 15), (2019, 11, 27)] return values[count] class TestMixedDateFunction(_EnumTests, _MixedOutputTests, unittest.TestCase): # values = [date(2021, 12, 25), date(2020, 3, 15), date(2019, 11, 27)] source_values = [(2021, 12, 25), (2020, 3, 15), (2019, 11, 27)] # # staticmethod decorator will be added by EnumType if not present def _generate_next_value_(name, start, count, last_values): values = [(2021, 12, 25), (2020, 3, 15), (2019, 11, 27)] return values[count] # enum_type = Enum('enum_type', {'_generate_next_value_':_generate_next_value_}, type=date) class TestMinimalDateClass(_EnumTests, _MinimalOutputTests, unittest.TestCase): # values = [date(2023, 12, 1), date(2016, 2, 29), date(2009, 1, 1)] source_values = [(2023, 12, 1), (2016, 2, 29), (2009, 1, 1)] # class enum_type(date, ReprEnum): # staticmethod decorator will be added by EnumType if absent def _generate_next_value_(name, start, count, last_values): values = [(2023, 12, 1), (2016, 2, 29), (2009, 1, 1)] return values[count] class TestMinimalDateFunction(_EnumTests, _MinimalOutputTests, unittest.TestCase): # values = [date(2023, 12, 1), date(2016, 2, 29), date(2009, 1, 1)] source_values = [(2023, 12, 1), (2016, 2, 29), (2009, 1, 1)] # @staticmethod def _generate_next_value_(name, start, count, last_values): values = [(2023, 12, 1), (2016, 2, 29), (2009, 1, 1)] return values[count] # enum_type = ReprEnum('enum_type', {'_generate_next_value_':_generate_next_value_}, type=date) class TestMixedFloatClass(_EnumTests, _MixedOutputTests, unittest.TestCase): # values = [1.1, 2.2, 3.3] # class enum_type(float, Enum): def _generate_next_value_(name, start, count, last_values): values = [1.1, 2.2, 3.3] return values[count] class TestMixedFloatFunction(_EnumTests, _MixedOutputTests, unittest.TestCase): # values = [1.1, 2.2, 3.3] # def _generate_next_value_(name, start, count, last_values): values = [1.1, 2.2, 3.3] return values[count] # enum_type = Enum('enum_type', {'_generate_next_value_':_generate_next_value_}, type=float) class TestMinimalFloatClass(_EnumTests, _MinimalOutputTests, unittest.TestCase): # values = [4.4, 5.5, 6.6] # class enum_type(float, ReprEnum): def _generate_next_value_(name, start, count, last_values): values = [4.4, 5.5, 6.6] return values[count] class TestMinimalFloatFunction(_EnumTests, _MinimalOutputTests, unittest.TestCase): # values = [4.4, 5.5, 6.6] # def _generate_next_value_(name, start, count, last_values): values = [4.4, 5.5, 6.6] return values[count] # enum_type = ReprEnum('enum_type', {'_generate_next_value_':_generate_next_value_}, type=float) class TestSpecial(unittest.TestCase): """ various operations that are not attributable to every possible enum """ def setUp(self): class Season(Enum): SPRING = 1 SUMMER = 2 AUTUMN = 3 WINTER = 4 self.Season = Season # class Grades(IntEnum): A = 5 B = 4 C = 3 D = 2 F = 0 self.Grades = Grades # class Directional(str, Enum): EAST = 'east' WEST = 'west' NORTH = 'north' SOUTH = 'south' self.Directional = Directional # from datetime import date class Holiday(date, Enum): NEW_YEAR = 2013, 1, 1 IDES_OF_MARCH = 2013, 3, 15 self.Holiday = Holiday def test_bool(self): # plain Enum members are always True class Logic(Enum): true = True false = False self.assertTrue(Logic.true) self.assertTrue(Logic.false) # unless overridden class RealLogic(Enum): true = True false = False def __bool__(self): return bool(self._value_) self.assertTrue(RealLogic.true) self.assertFalse(RealLogic.false) # mixed Enums depend on mixed-in type class IntLogic(int, Enum): true = 1 false = 0 self.assertTrue(IntLogic.true) self.assertFalse(IntLogic.false) def test_comparisons(self): Season = self.Season with self.assertRaises(TypeError): Season.SPRING < Season.WINTER with self.assertRaises(TypeError): Season.SPRING > 4 # self.assertNotEqual(Season.SPRING, 1) # class Part(Enum): SPRING = 1 CLIP = 2 BARREL = 3 # self.assertNotEqual(Season.SPRING, Part.SPRING) with self.assertRaises(TypeError): Season.SPRING < Part.CLIP @unittest.skip('to-do list') def test_dir_with_custom_dunders(self): class PlainEnum(Enum): pass cls_dir = dir(PlainEnum) self.assertNotIn('__repr__', cls_dir) self.assertNotIn('__str__', cls_dir) self.assertNotIn('__format__', cls_dir) self.assertNotIn('__init__', cls_dir) # class MyEnum(Enum): def __repr__(self): return object.__repr__(self) def __str__(self): return object.__repr__(self) def __format__(self): return object.__repr__(self) def __init__(self): pass cls_dir = dir(MyEnum) self.assertIn('__repr__', cls_dir) self.assertIn('__str__', cls_dir) self.assertIn('__format__', cls_dir) self.assertIn('__init__', cls_dir) def test_duplicate_name_error(self): with self.assertRaises(TypeError): class Color(Enum): red = 1 green = 2 blue = 3 red = 4 # with self.assertRaises(TypeError): class Color(Enum): red = 1 green = 2 blue = 3 def red(self): # noqa: F811 return 'red' # with self.assertRaises(TypeError): class Color(Enum): @enum.property def red(self): return 'redder' red = 1 # noqa: F811 green = 2 blue = 3 @reraise_if_not_enum(Theory) def test_enum_function_with_qualname(self): self.assertEqual(Theory.__qualname__, 'spanish_inquisition') def test_enum_of_types(self): """Support using Enum to refer to types deliberately.""" class MyTypes(Enum): i = int f = float s = str self.assertEqual(MyTypes.i.value, int) self.assertEqual(MyTypes.f.value, float) self.assertEqual(MyTypes.s.value, str) class Foo: pass class Bar: pass class MyTypes2(Enum): a = Foo b = Bar self.assertEqual(MyTypes2.a.value, Foo) self.assertEqual(MyTypes2.b.value, Bar) class SpamEnumNotInner: pass class SpamEnum(Enum): spam = SpamEnumNotInner self.assertEqual(SpamEnum.spam.value, SpamEnumNotInner) def test_enum_of_generic_aliases(self): class E(Enum): a = typing.List[int] b = list[int] self.assertEqual(E.a.value, typing.List[int]) self.assertEqual(E.b.value, list[int]) self.assertEqual(repr(E.a), '<E.a: typing.List[int]>') self.assertEqual(repr(E.b), '<E.b: list[int]>') @unittest.skipIf( python_version >= (3, 13), 'inner classes are not members', ) def test_nested_classes_in_enum_are_members(self): """ Check for warnings pre-3.13 """ with self.assertWarnsRegex(DeprecationWarning, 'will not become a member'): class Outer(Enum): a = 1 b = 2 class Inner(Enum): foo = 10 bar = 11 self.assertTrue(isinstance(Outer.Inner, Outer)) self.assertEqual(Outer.a.value, 1) self.assertEqual(Outer.Inner.value.foo.value, 10) self.assertEqual( list(Outer.Inner.value), [Outer.Inner.value.foo, Outer.Inner.value.bar], ) self.assertEqual( list(Outer), [Outer.a, Outer.b, Outer.Inner], ) @unittest.skipIf( python_version < (3, 13), 'inner classes are still members', ) def test_nested_classes_in_enum_are_not_members(self): """Support locally-defined nested classes.""" class Outer(Enum): a = 1 b = 2 class Inner(Enum): foo = 10 bar = 11 self.assertTrue(isinstance(Outer.Inner, type)) self.assertEqual(Outer.a.value, 1) self.assertEqual(Outer.Inner.foo.value, 10) self.assertEqual( list(Outer.Inner), [Outer.Inner.foo, Outer.Inner.bar], ) self.assertEqual( list(Outer), [Outer.a, Outer.b], ) def test_nested_classes_in_enum_with_nonmember(self): class Outer(Enum): a = 1 b = 2 @nonmember class Inner(Enum): foo = 10 bar = 11 self.assertTrue(isinstance(Outer.Inner, type)) self.assertEqual(Outer.a.value, 1) self.assertEqual(Outer.Inner.foo.value, 10) self.assertEqual( list(Outer.Inner), [Outer.Inner.foo, Outer.Inner.bar], ) self.assertEqual( list(Outer), [Outer.a, Outer.b], ) def test_enum_of_types_with_nonmember(self): """Support using Enum to refer to types deliberately.""" class MyTypes(Enum): i = int f = nonmember(float) s = str self.assertEqual(MyTypes.i.value, int) self.assertTrue(MyTypes.f is float) self.assertEqual(MyTypes.s.value, str) class Foo: pass class Bar: pass class MyTypes2(Enum): a = Foo b = nonmember(Bar) self.assertEqual(MyTypes2.a.value, Foo) self.assertTrue(MyTypes2.b is Bar) class SpamEnumIsInner: pass class SpamEnum(Enum): spam = nonmember(SpamEnumIsInner) self.assertTrue(SpamEnum.spam is SpamEnumIsInner) def test_using_members_as_nonmember(self): class Example(Flag): A = 1 B = 2 ALL = nonmember(A | B) self.assertEqual(Example.A.value, 1) self.assertEqual(Example.B.value, 2) self.assertEqual(Example.ALL, 3) self.assertIs(type(Example.ALL), int) class Example(Flag): A = auto() B = auto() ALL = nonmember(A | B) self.assertEqual(Example.A.value, 1) self.assertEqual(Example.B.value, 2) self.assertEqual(Example.ALL, 3) self.assertIs(type(Example.ALL), int) def test_nested_classes_in_enum_with_member(self): """Support locally-defined nested classes.""" class Outer(Enum): a = 1 b = 2 @member class Inner(Enum): foo = 10 bar = 11 self.assertTrue(isinstance(Outer.Inner, Outer)) self.assertEqual(Outer.a.value, 1) self.assertEqual(Outer.Inner.value.foo.value, 10) self.assertEqual( list(Outer.Inner.value), [Outer.Inner.value.foo, Outer.Inner.value.bar], ) self.assertEqual( list(Outer), [Outer.a, Outer.b, Outer.Inner], ) def test_enum_with_value_name(self): class Huh(Enum): name = 1 value = 2 self.assertEqual(list(Huh), [Huh.name, Huh.value]) self.assertIs(type(Huh.name), Huh) self.assertEqual(Huh.name.name, 'name') self.assertEqual(Huh.name.value, 1) def test_contains_name_and_value_overlap(self): class IntEnum1(IntEnum): X = 1 class IntEnum2(IntEnum): X = 1 class IntEnum3(IntEnum): X = 2 class IntEnum4(IntEnum): Y = 1 self.assertIn(IntEnum1.X, IntEnum1) self.assertIn(IntEnum1.X, IntEnum2) self.assertNotIn(IntEnum1.X, IntEnum3) self.assertIn(IntEnum1.X, IntEnum4) def test_contains_different_types_same_members(self): class IntEnum1(IntEnum): X = 1 class IntFlag1(IntFlag): X = 1 self.assertIn(IntEnum1.X, IntFlag1) self.assertIn(IntFlag1.X, IntEnum1) def test_contains_does_not_call_missing(self): class AnEnum(Enum): UNKNOWN = None LUCKY = 3 @classmethod def _missing_(cls, *values): return cls.UNKNOWN self.assertTrue(None in AnEnum) self.assertTrue(3 in AnEnum) self.assertFalse(7 in AnEnum) def test_inherited_data_type(self): class HexInt(int): __qualname__ = 'HexInt' def __repr__(self): return hex(self) class MyEnum(HexInt, enum.Enum): __qualname__ = 'MyEnum' A = 1 B = 2 C = 3 self.assertEqual(repr(MyEnum.A), '<MyEnum.A: 0x1>') globals()['HexInt'] = HexInt globals()['MyEnum'] = MyEnum test_pickle_dump_load(self.assertIs, MyEnum.A) test_pickle_dump_load(self.assertIs, MyEnum) # class SillyInt(HexInt): __qualname__ = 'SillyInt' class MyOtherEnum(SillyInt, enum.Enum): __qualname__ = 'MyOtherEnum' D = 4 E = 5 F = 6 self.assertIs(MyOtherEnum._member_type_, SillyInt) globals()['SillyInt'] = SillyInt globals()['MyOtherEnum'] = MyOtherEnum test_pickle_dump_load(self.assertIs, MyOtherEnum.E) test_pickle_dump_load(self.assertIs, MyOtherEnum) # # This did not work in 3.10, but does now with pickling by name class UnBrokenInt(int): __qualname__ = 'UnBrokenInt' def __new__(cls, value): return int.__new__(cls, value) class MyUnBrokenEnum(UnBrokenInt, Enum): __qualname__ = 'MyUnBrokenEnum' G = 7 H = 8 I = 9 self.assertIs(MyUnBrokenEnum._member_type_, UnBrokenInt) self.assertIs(MyUnBrokenEnum(7), MyUnBrokenEnum.G) globals()['UnBrokenInt'] = UnBrokenInt globals()['MyUnBrokenEnum'] = MyUnBrokenEnum test_pickle_dump_load(self.assertIs, MyUnBrokenEnum.I) test_pickle_dump_load(self.assertIs, MyUnBrokenEnum) @reraise_if_not_enum(FloatStooges) def test_floatenum_fromhex(self): h = float.hex(FloatStooges.MOE.value) self.assertIs(FloatStooges.fromhex(h), FloatStooges.MOE) h = float.hex(FloatStooges.MOE.value + 0.01) with self.assertRaises(ValueError): FloatStooges.fromhex(h) def test_programmatic_function_type(self): MinorEnum = Enum('MinorEnum', 'june july august', type=int) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for i, month in enumerate('june july august'.split(), 1): e = MinorEnum(i) self.assertEqual(e, i) self.assertEqual(e.name, month) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) def test_programmatic_function_string_with_start(self): MinorEnum = Enum('MinorEnum', 'june july august', start=10) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for i, month in enumerate('june july august'.split(), 10): e = MinorEnum(i) self.assertEqual(int(e.value), i) self.assertNotEqual(e, i) self.assertEqual(e.name, month) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) def test_programmatic_function_type_with_start(self): MinorEnum = Enum('MinorEnum', 'june july august', type=int, start=30) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for i, month in enumerate('june july august'.split(), 30): e = MinorEnum(i) self.assertEqual(e, i) self.assertEqual(e.name, month) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) def test_programmatic_function_string_list_with_start(self): MinorEnum = Enum('MinorEnum', ['june', 'july', 'august'], start=20) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for i, month in enumerate('june july august'.split(), 20): e = MinorEnum(i) self.assertEqual(int(e.value), i) self.assertNotEqual(e, i) self.assertEqual(e.name, month) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) def test_programmatic_function_type_from_subclass(self): MinorEnum = IntEnum('MinorEnum', 'june july august') lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for i, month in enumerate('june july august'.split(), 1): e = MinorEnum(i) self.assertEqual(e, i) self.assertEqual(e.name, month) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) def test_programmatic_function_type_from_subclass_with_start(self): MinorEnum = IntEnum('MinorEnum', 'june july august', start=40) lst = list(MinorEnum) self.assertEqual(len(lst), len(MinorEnum)) self.assertEqual(len(MinorEnum), 3, MinorEnum) self.assertEqual( [MinorEnum.june, MinorEnum.july, MinorEnum.august], lst, ) for i, month in enumerate('june july august'.split(), 40): e = MinorEnum(i) self.assertEqual(e, i) self.assertEqual(e.name, month) self.assertIn(e, MinorEnum) self.assertIs(type(e), MinorEnum) def test_programmatic_function_is_value_call(self): class TwoPart(Enum): ONE = 1, 1.0 TWO = 2, 2.0 THREE = 3, 3.0 self.assertRaisesRegex(ValueError, '1 is not a valid .*TwoPart', TwoPart, 1) self.assertIs(TwoPart((1, 1.0)), TwoPart.ONE) self.assertIs(TwoPart(1, 1.0), TwoPart.ONE) class ThreePart(Enum): ONE = 1, 1.0, 'one' TWO = 2, 2.0, 'two' THREE = 3, 3.0, 'three' self.assertIs(ThreePart((3, 3.0, 'three')), ThreePart.THREE) self.assertIs(ThreePart(3, 3.0, 'three'), ThreePart.THREE) @reraise_if_not_enum(IntStooges) def test_intenum_from_bytes(self): self.assertIs(IntStooges.from_bytes(b'\x00\x03', 'big'), IntStooges.MOE) with self.assertRaises(ValueError): IntStooges.from_bytes(b'\x00\x05', 'big') def test_reserved_sunder_error(self): with self.assertRaisesRegex( ValueError, '_sunder_ names, such as ._bad_., are reserved', ): class Bad(Enum): _bad_ = 1 def test_too_many_data_types(self): with self.assertRaisesRegex(TypeError, 'too many data types'): class Huh(str, int, Enum): One = 1 class MyStr(str): def hello(self): return 'hello, %s' % self class MyInt(int): def repr(self): return hex(self) with self.assertRaisesRegex(TypeError, 'too many data types'): class Huh(MyStr, MyInt, Enum): One = 1 @reraise_if_not_enum(Stooges) def test_pickle_enum(self): test_pickle_dump_load(self.assertIs, Stooges.CURLY) test_pickle_dump_load(self.assertIs, Stooges) @reraise_if_not_enum(IntStooges) def test_pickle_int(self): test_pickle_dump_load(self.assertIs, IntStooges.CURLY) test_pickle_dump_load(self.assertIs, IntStooges) @reraise_if_not_enum(FloatStooges) def test_pickle_float(self): test_pickle_dump_load(self.assertIs, FloatStooges.CURLY) test_pickle_dump_load(self.assertIs, FloatStooges) @reraise_if_not_enum(Answer) def test_pickle_enum_function(self): test_pickle_dump_load(self.assertIs, Answer.him) test_pickle_dump_load(self.assertIs, Answer) @reraise_if_not_enum(Question) def test_pickle_enum_function_with_module(self): test_pickle_dump_load(self.assertIs, Question.who) test_pickle_dump_load(self.assertIs, Question) def test_pickle_nested_class(self): # would normally just have this directly in the class namespace class NestedEnum(Enum): twigs = 'common' shiny = 'rare' self.__class__.NestedEnum = NestedEnum self.NestedEnum.__qualname__ = '%s.NestedEnum' % self.__class__.__name__ test_pickle_dump_load(self.assertIs, self.NestedEnum.twigs) def test_pickle_by_name(self): class ReplaceGlobalInt(IntEnum): ONE = 1 TWO = 2 ReplaceGlobalInt.__reduce_ex__ = enum._reduce_ex_by_global_name for proto in range(HIGHEST_PROTOCOL): self.assertEqual(ReplaceGlobalInt.TWO.__reduce_ex__(proto), 'TWO') def test_pickle_explodes(self): BadPickle = Enum( 'BadPickle', 'dill sweet bread-n-butter', module=__name__) globals()['BadPickle'] = BadPickle # now break BadPickle to test exception raising enum._make_class_unpicklable(BadPickle) test_pickle_exception(self.assertRaises, TypeError, BadPickle.dill) test_pickle_exception(self.assertRaises, PicklingError, BadPickle) def test_string_enum(self): class SkillLevel(str, Enum): master = 'what is the sound of one hand clapping?' journeyman = 'why did the chicken cross the road?' apprentice = 'knock, knock!' self.assertEqual(SkillLevel.apprentice, 'knock, knock!') def test_getattr_getitem(self): class Period(Enum): morning = 1 noon = 2 evening = 3 night = 4 self.assertIs(Period(2), Period.noon) self.assertIs(getattr(Period, 'night'), Period.night) self.assertIs(Period['morning'], Period.morning) def test_getattr_dunder(self): Season = self.Season self.assertTrue(getattr(Season, '__eq__')) def test_iteration_order(self): class Season(Enum): SUMMER = 2 WINTER = 4 AUTUMN = 3 SPRING = 1 self.assertEqual( list(Season), [Season.SUMMER, Season.WINTER, Season.AUTUMN, Season.SPRING], ) @reraise_if_not_enum(Name) def test_subclassing(self): self.assertEqual(Name.BDFL, 'Guido van Rossum') self.assertTrue(Name.BDFL, Name('Guido van Rossum')) self.assertIs(Name.BDFL, getattr(Name, 'BDFL')) test_pickle_dump_load(self.assertIs, Name.BDFL) def test_extending(self): class Color(Enum): red = 1 green = 2 blue = 3 # with self.assertRaises(TypeError): class MoreColor(Color): cyan = 4 magenta = 5 yellow = 6 # with self.assertRaisesRegex(TypeError, "<enum .EvenMoreColor.> cannot extend <enum .Color.>"): class EvenMoreColor(Color, IntEnum): chartruese = 7 # with self.assertRaisesRegex(ValueError, r"\(.Foo., \(.pink., .black.\)\) is not a valid .*Color"): Color('Foo', ('pink', 'black')) def test_exclude_methods(self): class whatever(Enum): this = 'that' these = 'those' def really(self): return 'no, not %s' % self.value self.assertIsNot(type(whatever.really), whatever) self.assertEqual(whatever.this.really(), 'no, not that') def test_wrong_inheritance_order(self): with self.assertRaises(TypeError): class Wrong(Enum, str): NotHere = 'error before this point' def test_raise_custom_error_on_creation(self): class InvalidRgbColorError(ValueError): def __init__(self, r, g, b): self.r = r self.g = g self.b = b super().__init__(f'({r}, {g}, {b}) is not a valid RGB color') with self.assertRaises(InvalidRgbColorError): class RgbColor(Enum): RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) INVALID = (256, 0, 0) def __init__(self, r, g, b): if not all(0 <= val <= 255 for val in (r, g, b)): raise InvalidRgbColorError(r, g, b) def test_intenum_transitivity(self): class number(IntEnum): one = 1 two = 2 three = 3 class numero(IntEnum): uno = 1 dos = 2 tres = 3 self.assertEqual(number.one, numero.uno) self.assertEqual(number.two, numero.dos) self.assertEqual(number.three, numero.tres) def test_wrong_enum_in_call(self): class Monochrome(Enum): black = 0 white = 1 class Gender(Enum): male = 0 female = 1 self.assertRaises(ValueError, Monochrome, Gender.male) def test_wrong_enum_in_mixed_call(self): class Monochrome(IntEnum): black = 0 white = 1 class Gender(Enum): male = 0 female = 1 self.assertRaises(ValueError, Monochrome, Gender.male) def test_mixed_enum_in_call_1(self): class Monochrome(IntEnum): black = 0 white = 1 class Gender(IntEnum): male = 0 female = 1 self.assertIs(Monochrome(Gender.female), Monochrome.white) def test_mixed_enum_in_call_2(self): class Monochrome(Enum): black = 0 white = 1 class Gender(IntEnum): male = 0 female = 1 self.assertIs(Monochrome(Gender.male), Monochrome.black) def test_flufl_enum(self): class Fluflnum(Enum): def __int__(self): return int(self.value) class MailManOptions(Fluflnum): option1 = 1 option2 = 2 option3 = 3 self.assertEqual(int(MailManOptions.option1), 1) def test_introspection(self): class Number(IntEnum): one = 100 two = 200 self.assertIs(Number.one._member_type_, int) self.assertIs(Number._member_type_, int) class String(str, Enum): yarn = 'soft' rope = 'rough' wire = 'hard' self.assertIs(String.yarn._member_type_, str) self.assertIs(String._member_type_, str) class Plain(Enum): vanilla = 'white' one = 1 self.assertIs(Plain.vanilla._member_type_, object) self.assertIs(Plain._member_type_, object) def test_no_such_enum_member(self): class Color(Enum): red = 1 green = 2 blue = 3 with self.assertRaises(ValueError): Color(4) with self.assertRaises(KeyError): Color['chartreuse'] # tests that need to be evalualted for moving def test_multiple_mixin_mro(self): class auto_enum(type(Enum)): def __new__(metacls, cls, bases, classdict): temp = type(classdict)() temp._cls_name = cls names = set(classdict._member_names) i = 0 for k in classdict._member_names: v = classdict[k] if v is Ellipsis: v = i else: i = v i += 1 temp[k] = v for k, v in classdict.items(): if k not in names: temp[k] = v return super(auto_enum, metacls).__new__( metacls, cls, bases, temp) class AutoNumberedEnum(Enum, metaclass=auto_enum): pass class AutoIntEnum(IntEnum, metaclass=auto_enum): pass class TestAutoNumber(AutoNumberedEnum): a = ... b = 3 c = ... class TestAutoInt(AutoIntEnum): a = ... b = 3 c = ... def test_subclasses_with_getnewargs(self): class NamedInt(int): __qualname__ = 'NamedInt' # needed for pickle protocol 4 def __new__(cls, *args): _args = args name, *args = args if len(args) == 0: raise TypeError("name and value must be specified") self = int.__new__(cls, *args) self._intname = name self._args = _args return self def __getnewargs__(self): return self._args @bltns.property def __name__(self): return self._intname def __repr__(self): # repr() is updated to include the name and type info return "{}({!r}, {})".format( type(self).__name__, self.__name__, int.__repr__(self), ) def __str__(self): # str() is unchanged, even if it relies on the repr() fallback base = int base_str = base.__str__ if base_str.__objclass__ is object: return base.__repr__(self) return base_str(self) # for simplicity, we only define one operator that # propagates expressions def __add__(self, other): temp = int(self) + int( other) if isinstance(self, NamedInt) and isinstance(other, NamedInt): return NamedInt( '({0} + {1})'.format(self.__name__, other.__name__), temp, ) else: return temp class NEI(NamedInt, Enum): __qualname__ = 'NEI' # needed for pickle protocol 4 x = ('the-x', 1) y = ('the-y', 2) self.assertIs(NEI.__new__, Enum.__new__) self.assertEqual(repr(NEI.x + NEI.y), "NamedInt('(the-x + the-y)', 3)") globals()['NamedInt'] = NamedInt globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5) test_pickle_dump_load(self.assertEqual, NI5, 5) self.assertEqual(NEI.y.value, 2) test_pickle_dump_load(self.assertIs, NEI.y) test_pickle_dump_load(self.assertIs, NEI) def test_subclasses_with_getnewargs_ex(self): class NamedInt(int): __qualname__ = 'NamedInt' # needed for pickle protocol 4 def __new__(cls, *args): _args = args name, *args = args if len(args) == 0: raise TypeError("name and value must be specified") self = int.__new__(cls, *args) self._intname = name self._args = _args return self def __getnewargs_ex__(self): return self._args, {} @bltns.property def __name__(self): return self._intname def __repr__(self): # repr() is updated to include the name and type info return "{}({!r}, {})".format( type(self).__name__, self.__name__, int.__repr__(self), ) def __str__(self): # str() is unchanged, even if it relies on the repr() fallback base = int base_str = base.__str__ if base_str.__objclass__ is object: return base.__repr__(self) return base_str(self) # for simplicity, we only define one operator that # propagates expressions def __add__(self, other): temp = int(self) + int( other) if isinstance(self, NamedInt) and isinstance(other, NamedInt): return NamedInt( '({0} + {1})'.format(self.__name__, other.__name__), temp, ) else: return temp class NEI(NamedInt, Enum): __qualname__ = 'NEI' # needed for pickle protocol 4 x = ('the-x', 1) y = ('the-y', 2) self.assertIs(NEI.__new__, Enum.__new__) self.assertEqual(repr(NEI.x + NEI.y), "NamedInt('(the-x + the-y)', 3)") globals()['NamedInt'] = NamedInt globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5) test_pickle_dump_load(self.assertEqual, NI5, 5) self.assertEqual(NEI.y.value, 2) test_pickle_dump_load(self.assertIs, NEI.y) test_pickle_dump_load(self.assertIs, NEI) def test_subclasses_with_reduce(self): class NamedInt(int): __qualname__ = 'NamedInt' # needed for pickle protocol 4 def __new__(cls, *args): _args = args name, *args = args if len(args) == 0: raise TypeError("name and value must be specified") self = int.__new__(cls, *args) self._intname = name self._args = _args return self def __reduce__(self): return self.__class__, self._args @bltns.property def __name__(self): return self._intname def __repr__(self): # repr() is updated to include the name and type info return "{}({!r}, {})".format( type(self).__name__, self.__name__, int.__repr__(self), ) def __str__(self): # str() is unchanged, even if it relies on the repr() fallback base = int base_str = base.__str__ if base_str.__objclass__ is object: return base.__repr__(self) return base_str(self) # for simplicity, we only define one operator that # propagates expressions def __add__(self, other): temp = int(self) + int( other) if isinstance(self, NamedInt) and isinstance(other, NamedInt): return NamedInt( '({0} + {1})'.format(self.__name__, other.__name__), temp, ) else: return temp class NEI(NamedInt, Enum): __qualname__ = 'NEI' # needed for pickle protocol 4 x = ('the-x', 1) y = ('the-y', 2) self.assertIs(NEI.__new__, Enum.__new__) self.assertEqual(repr(NEI.x + NEI.y), "NamedInt('(the-x + the-y)', 3)") globals()['NamedInt'] = NamedInt globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5) test_pickle_dump_load(self.assertEqual, NI5, 5) self.assertEqual(NEI.y.value, 2) test_pickle_dump_load(self.assertIs, NEI.y) test_pickle_dump_load(self.assertIs, NEI) def test_subclasses_with_reduce_ex(self): class NamedInt(int): __qualname__ = 'NamedInt' # needed for pickle protocol 4 def __new__(cls, *args): _args = args name, *args = args if len(args) == 0: raise TypeError("name and value must be specified") self = int.__new__(cls, *args) self._intname = name self._args = _args return self def __reduce_ex__(self, proto): return self.__class__, self._args @bltns.property def __name__(self): return self._intname def __repr__(self): # repr() is updated to include the name and type info return "{}({!r}, {})".format( type(self).__name__, self.__name__, int.__repr__(self), ) def __str__(self): # str() is unchanged, even if it relies on the repr() fallback base = int base_str = base.__str__ if base_str.__objclass__ is object: return base.__repr__(self) return base_str(self) # for simplicity, we only define one operator that # propagates expressions def __add__(self, other): temp = int(self) + int( other) if isinstance(self, NamedInt) and isinstance(other, NamedInt): return NamedInt( '({0} + {1})'.format(self.__name__, other.__name__), temp, ) else: return temp class NEI(NamedInt, Enum): __qualname__ = 'NEI' # needed for pickle protocol 4 x = ('the-x', 1) y = ('the-y', 2) self.assertIs(NEI.__new__, Enum.__new__) self.assertEqual(repr(NEI.x + NEI.y), "NamedInt('(the-x + the-y)', 3)") globals()['NamedInt'] = NamedInt globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5) test_pickle_dump_load(self.assertEqual, NI5, 5) self.assertEqual(NEI.y.value, 2) test_pickle_dump_load(self.assertIs, NEI.y) test_pickle_dump_load(self.assertIs, NEI) def test_subclasses_without_direct_pickle_support(self): class NamedInt(int): __qualname__ = 'NamedInt' def __new__(cls, *args): _args = args name, *args = args if len(args) == 0: raise TypeError("name and value must be specified") self = int.__new__(cls, *args) self._intname = name self._args = _args return self @bltns.property def __name__(self): return self._intname def __repr__(self): # repr() is updated to include the name and type info return "{}({!r}, {})".format( type(self).__name__, self.__name__, int.__repr__(self), ) def __str__(self): # str() is unchanged, even if it relies on the repr() fallback base = int base_str = base.__str__ if base_str.__objclass__ is object: return base.__repr__(self) return base_str(self) # for simplicity, we only define one operator that # propagates expressions def __add__(self, other): temp = int(self) + int( other) if isinstance(self, NamedInt) and isinstance(other, NamedInt): return NamedInt( '({0} + {1})'.format(self.__name__, other.__name__), temp ) else: return temp class NEI(NamedInt, Enum): __qualname__ = 'NEI' x = ('the-x', 1) y = ('the-y', 2) self.assertIs(NEI.__new__, Enum.__new__) self.assertEqual(repr(NEI.x + NEI.y), "NamedInt('(the-x + the-y)', 3)") globals()['NamedInt'] = NamedInt globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5) self.assertEqual(NEI.y.value, 2) with self.assertRaisesRegex(TypeError, "name and value must be specified"): test_pickle_dump_load(self.assertIs, NEI.y) # fix pickle support and try again NEI.__reduce_ex__ = enum.pickle_by_enum_name test_pickle_dump_load(self.assertIs, NEI.y) test_pickle_dump_load(self.assertIs, NEI) def test_subclasses_with_direct_pickle_support(self): class NamedInt(int): __qualname__ = 'NamedInt' def __new__(cls, *args): _args = args name, *args = args if len(args) == 0: raise TypeError("name and value must be specified") self = int.__new__(cls, *args) self._intname = name self._args = _args return self @bltns.property def __name__(self): return self._intname def __repr__(self): # repr() is updated to include the name and type info return "{}({!r}, {})".format( type(self).__name__, self.__name__, int.__repr__(self), ) def __str__(self): # str() is unchanged, even if it relies on the repr() fallback base = int base_str = base.__str__ if base_str.__objclass__ is object: return base.__repr__(self) return base_str(self) # for simplicity, we only define one operator that # propagates expressions def __add__(self, other): temp = int(self) + int( other) if isinstance(self, NamedInt) and isinstance(other, NamedInt): return NamedInt( '({0} + {1})'.format(self.__name__, other.__name__), temp, ) else: return temp class NEI(NamedInt, Enum): __qualname__ = 'NEI' x = ('the-x', 1) y = ('the-y', 2) def __reduce_ex__(self, proto): return getattr, (self.__class__, self._name_) self.assertIs(NEI.__new__, Enum.__new__) self.assertEqual(repr(NEI.x + NEI.y), "NamedInt('(the-x + the-y)', 3)") globals()['NamedInt'] = NamedInt globals()['NEI'] = NEI NI5 = NamedInt('test', 5) self.assertEqual(NI5, 5) self.assertEqual(NEI.y.value, 2) test_pickle_dump_load(self.assertIs, NEI.y) test_pickle_dump_load(self.assertIs, NEI) def test_tuple_subclass(self): class SomeTuple(tuple, Enum): __qualname__ = 'SomeTuple' # needed for pickle protocol 4 first = (1, 'for the money') second = (2, 'for the show') third = (3, 'for the music') self.assertIs(type(SomeTuple.first), SomeTuple) self.assertIsInstance(SomeTuple.second, tuple) self.assertEqual(SomeTuple.third, (3, 'for the music')) globals()['SomeTuple'] = SomeTuple test_pickle_dump_load(self.assertIs, SomeTuple.first) def test_tuple_subclass_with_auto_1(self): from collections import namedtuple T = namedtuple('T', 'index desc') class SomeEnum(T, Enum): __qualname__ = 'SomeEnum' # needed for pickle protocol 4 first = auto(), 'for the money' second = auto(), 'for the show' third = auto(), 'for the music' self.assertIs(type(SomeEnum.first), SomeEnum) self.assertEqual(SomeEnum.third.value, (3, 'for the music')) self.assertIsInstance(SomeEnum.third.value, T) self.assertEqual(SomeEnum.first.index, 1) self.assertEqual(SomeEnum.second.desc, 'for the show') globals()['SomeEnum'] = SomeEnum globals()['T'] = T test_pickle_dump_load(self.assertIs, SomeEnum.first) def test_tuple_subclass_with_auto_2(self): from collections import namedtuple T = namedtuple('T', 'index desc') class SomeEnum(Enum): __qualname__ = 'SomeEnum' # needed for pickle protocol 4 first = T(auto(), 'for the money') second = T(auto(), 'for the show') third = T(auto(), 'for the music') self.assertIs(type(SomeEnum.first), SomeEnum) self.assertEqual(SomeEnum.third.value, (3, 'for the music')) self.assertIsInstance(SomeEnum.third.value, T) self.assertEqual(SomeEnum.first.value.index, 1) self.assertEqual(SomeEnum.second.value.desc, 'for the show') globals()['SomeEnum'] = SomeEnum globals()['T'] = T test_pickle_dump_load(self.assertIs, SomeEnum.first) def test_duplicate_values_give_unique_enum_items(self): class AutoNumber(Enum): first = () second = () third = () def __new__(cls): value = len(cls.__members__) + 1 obj = object.__new__(cls) obj._value_ = value return obj def __int__(self): return int(self._value_) self.assertEqual( list(AutoNumber), [AutoNumber.first, AutoNumber.second, AutoNumber.third], ) self.assertEqual(int(AutoNumber.second), 2) self.assertEqual(AutoNumber.third.value, 3) self.assertIs(AutoNumber(1), AutoNumber.first) def test_inherited_new_from_enhanced_enum(self): class AutoNumber(Enum): def __new__(cls): value = len(cls.__members__) + 1 obj = object.__new__(cls) obj._value_ = value return obj def __int__(self): return int(self._value_) class Color(AutoNumber): red = () green = () blue = () self.assertEqual(list(Color), [Color.red, Color.green, Color.blue]) self.assertEqual(list(map(int, Color)), [1, 2, 3]) def test_inherited_new_from_mixed_enum(self): class AutoNumber(IntEnum): def __new__(cls): value = len(cls.__members__) + 1 obj = int.__new__(cls, value) obj._value_ = value return obj class Color(AutoNumber): red = () green = () blue = () self.assertEqual(list(Color), [Color.red, Color.green, Color.blue]) self.assertEqual(list(map(int, Color)), [1, 2, 3]) def test_equality(self): class OrdinaryEnum(Enum): a = 1 self.assertEqual(ALWAYS_EQ, OrdinaryEnum.a) self.assertEqual(OrdinaryEnum.a, ALWAYS_EQ) def test_ordered_mixin(self): class OrderedEnum(Enum): def __ge__(self, other): if self.__class__ is other.__class__: return self._value_ >= other._value_ return NotImplemented def __gt__(self, other): if self.__class__ is other.__class__: return self._value_ > other._value_ return NotImplemented def __le__(self, other): if self.__class__ is other.__class__: return self._value_ <= other._value_ return NotImplemented def __lt__(self, other): if self.__class__ is other.__class__: return self._value_ < other._value_ return NotImplemented class Grade(OrderedEnum): A = 5 B = 4 C = 3 D = 2 F = 1 self.assertGreater(Grade.A, Grade.B) self.assertLessEqual(Grade.F, Grade.C) self.assertLess(Grade.D, Grade.A) self.assertGreaterEqual(Grade.B, Grade.B) self.assertEqual(Grade.B, Grade.B) self.assertNotEqual(Grade.C, Grade.D) def test_extending2(self): class Shade(Enum): def shade(self): print(self.name) class Color(Shade): red = 1 green = 2 blue = 3 with self.assertRaises(TypeError): class MoreColor(Color): cyan = 4 magenta = 5 yellow = 6 def test_extending3(self): class Shade(Enum): def shade(self): return self.name class Color(Shade): def hex(self): return '%s hexlified!' % self.value class MoreColor(Color): cyan = 4 magenta = 5 yellow = 6 self.assertEqual(MoreColor.magenta.hex(), '5 hexlified!') def test_subclass_duplicate_name(self): class Base(Enum): def test(self): pass class Test(Base): test = 1 self.assertIs(type(Test.test), Test) def test_subclass_duplicate_name_dynamic(self): from types import DynamicClassAttribute class Base(Enum): @DynamicClassAttribute def test(self): return 'dynamic' class Test(Base): test = 1 self.assertEqual(Test.test.test, 'dynamic') self.assertEqual(Test.test.value, 1) class Base2(Enum): @enum.property def flash(self): return 'flashy dynamic' class Test(Base2): flash = 1 self.assertEqual(Test.flash.flash, 'flashy dynamic') self.assertEqual(Test.flash.value, 1) def test_no_duplicates(self): class UniqueEnum(Enum): def __init__(self, *args): cls = self.__class__ if any(self.value == e.value for e in cls): a = self.name e = cls(self.value).name raise ValueError( "aliases not allowed in UniqueEnum: %r --> %r" % (a, e) ) class Color(UniqueEnum): red = 1 green = 2 blue = 3 with self.assertRaises(ValueError): class Color(UniqueEnum): red = 1 green = 2 blue = 3 grene = 2 def test_init(self): class Planet(Enum): MERCURY = (3.303e+23, 2.4397e6) VENUS = (4.869e+24, 6.0518e6) EARTH = (5.976e+24, 6.37814e6) MARS = (6.421e+23, 3.3972e6) JUPITER = (1.9e+27, 7.1492e7) SATURN = (5.688e+26, 6.0268e7) URANUS = (8.686e+25, 2.5559e7) NEPTUNE = (1.024e+26, 2.4746e7) def __init__(self, mass, radius): self.mass = mass # in kilograms self.radius = radius # in meters @enum.property def surface_gravity(self): # universal gravitational constant (m3 kg-1 s-2) G = 6.67300E-11 return G * self.mass / (self.radius * self.radius) self.assertEqual(round(Planet.EARTH.surface_gravity, 2), 9.80) self.assertEqual(Planet.EARTH.value, (5.976e+24, 6.37814e6)) def test_ignore(self): class Period(timedelta, Enum): ''' different lengths of time ''' def __new__(cls, value, period): obj = timedelta.__new__(cls, value) obj._value_ = value obj.period = period return obj _ignore_ = 'Period i' Period = vars() for i in range(13): Period['month_%d' % i] = i*30, 'month' for i in range(53): Period['week_%d' % i] = i*7, 'week' for i in range(32): Period['day_%d' % i] = i, 'day' OneDay = day_1 OneWeek = week_1 OneMonth = month_1 self.assertNotHasAttr(Period, '_ignore_') self.assertNotHasAttr(Period, 'Period') self.assertNotHasAttr(Period, 'i') self.assertIsInstance(Period.day_1, timedelta) self.assertIs(Period.month_1, Period.day_30) self.assertIs(Period.week_4, Period.day_28) def test_nonhash_value(self): class AutoNumberInAList(Enum): def __new__(cls): value = [len(cls.__members__) + 1] obj = object.__new__(cls) obj._value_ = value return obj class ColorInAList(AutoNumberInAList): red = () green = () blue = () self.assertEqual(list(ColorInAList), [ColorInAList.red, ColorInAList.green, ColorInAList.blue]) for enum, value in zip(ColorInAList, range(3)): value += 1 self.assertEqual(enum.value, [value]) self.assertIs(ColorInAList([value]), enum) def test_conflicting_types_resolved_in_new(self): class LabelledIntEnum(int, Enum): def __new__(cls, *args): value, label = args obj = int.__new__(cls, value) obj.label = label obj._value_ = value return obj class LabelledList(LabelledIntEnum): unprocessed = (1, "Unprocessed") payment_complete = (2, "Payment Complete") self.assertEqual(list(LabelledList), [LabelledList.unprocessed, LabelledList.payment_complete]) self.assertEqual(LabelledList.unprocessed, 1) self.assertEqual(LabelledList(1), LabelledList.unprocessed) def test_default_missing_no_chained_exception(self): class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 try: Color(7) except ValueError as exc: self.assertTrue(exc.__context__ is None) else: raise Exception('Exception not raised.') def test_missing_override(self): class Color(Enum): red = 1 green = 2 blue = 3 @classmethod def _missing_(cls, item): if item == 'three': return cls.blue elif item == 'bad return': # trigger internal error return 5 elif item == 'error out': raise ZeroDivisionError else: # trigger not found return None self.assertIs(Color('three'), Color.blue) try: Color(7) except ValueError as exc: self.assertTrue(exc.__context__ is None) else: raise Exception('Exception not raised.') try: Color('bad return') except TypeError as exc: self.assertTrue(isinstance(exc.__context__, ValueError)) else: raise Exception('Exception not raised.') try: Color('error out') except ZeroDivisionError as exc: self.assertTrue(isinstance(exc.__context__, ValueError)) else: raise Exception('Exception not raised.') def test_missing_exceptions_reset(self): import gc import weakref # class TestEnum(enum.Enum): VAL1 = 'val1' VAL2 = 'val2' # class Class1: def __init__(self): # Gracefully handle an exception of our own making try: raise ValueError() except ValueError: pass # class Class2: def __init__(self): # Gracefully handle an exception of Enum's making try: TestEnum('invalid_value') except ValueError: pass # No strong refs here so these are free to die. class_1_ref = weakref.ref(Class1()) class_2_ref = weakref.ref(Class2()) # # The exception raised by Enum used to create a reference loop and thus # Class2 instances would stick around until the next garbage collection # cycle, unlike Class1. Verify Class2 no longer does this. gc.collect() # For PyPy or other GCs. self.assertIs(class_1_ref(), None) self.assertIs(class_2_ref(), None) def test_multiple_mixin(self): class MaxMixin: @classproperty def MAX(cls): max = len(cls) cls.MAX = max return max class StrMixin: def __str__(self): return self._name_.lower() class SomeEnum(Enum): def behavior(self): return 'booyah' class AnotherEnum(Enum): def behavior(self): return 'nuhuh!' def social(self): return "what's up?" class Color(MaxMixin, Enum): RED = auto() GREEN = auto() BLUE = auto() self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 3) self.assertEqual(Color.MAX, 3) self.assertEqual(str(Color.BLUE), 'Color.BLUE') class Color(MaxMixin, StrMixin, Enum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 3) self.assertEqual(Color.MAX, 3) self.assertEqual(str(Color.BLUE), 'blue') class Color(StrMixin, MaxMixin, Enum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 3) self.assertEqual(Color.MAX, 3) self.assertEqual(str(Color.BLUE), 'blue') class CoolColor(StrMixin, SomeEnum, Enum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(CoolColor.RED.value, 1) self.assertEqual(CoolColor.GREEN.value, 2) self.assertEqual(CoolColor.BLUE.value, 3) self.assertEqual(str(CoolColor.BLUE), 'blue') self.assertEqual(CoolColor.RED.behavior(), 'booyah') class CoolerColor(StrMixin, AnotherEnum, Enum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(CoolerColor.RED.value, 1) self.assertEqual(CoolerColor.GREEN.value, 2) self.assertEqual(CoolerColor.BLUE.value, 3) self.assertEqual(str(CoolerColor.BLUE), 'blue') self.assertEqual(CoolerColor.RED.behavior(), 'nuhuh!') self.assertEqual(CoolerColor.RED.social(), "what's up?") class CoolestColor(StrMixin, SomeEnum, AnotherEnum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(CoolestColor.RED.value, 1) self.assertEqual(CoolestColor.GREEN.value, 2) self.assertEqual(CoolestColor.BLUE.value, 3) self.assertEqual(str(CoolestColor.BLUE), 'blue') self.assertEqual(CoolestColor.RED.behavior(), 'booyah') self.assertEqual(CoolestColor.RED.social(), "what's up?") class ConfusedColor(StrMixin, AnotherEnum, SomeEnum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(ConfusedColor.RED.value, 1) self.assertEqual(ConfusedColor.GREEN.value, 2) self.assertEqual(ConfusedColor.BLUE.value, 3) self.assertEqual(str(ConfusedColor.BLUE), 'blue') self.assertEqual(ConfusedColor.RED.behavior(), 'nuhuh!') self.assertEqual(ConfusedColor.RED.social(), "what's up?") class ReformedColor(StrMixin, IntEnum, SomeEnum, AnotherEnum): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ # needed as of 3.11 self.assertEqual(ReformedColor.RED.value, 1) self.assertEqual(ReformedColor.GREEN.value, 2) self.assertEqual(ReformedColor.BLUE.value, 3) self.assertEqual(str(ReformedColor.BLUE), 'blue') self.assertEqual(ReformedColor.RED.behavior(), 'booyah') self.assertEqual(ConfusedColor.RED.social(), "what's up?") self.assertIsSubclass(ReformedColor, int) def test_multiple_inherited_mixin(self): @unique class Decision1(StrEnum): REVERT = "REVERT" REVERT_ALL = "REVERT_ALL" RETRY = "RETRY" class MyEnum(StrEnum): pass @unique class Decision2(MyEnum): REVERT = "REVERT" REVERT_ALL = "REVERT_ALL" RETRY = "RETRY" def test_multiple_mixin_inherited(self): class MyInt(int): def __new__(cls, value): return super().__new__(cls, value) class HexMixin: def __repr__(self): return hex(self) class MyIntEnum(HexMixin, MyInt, enum.Enum): __repr__ = HexMixin.__repr__ class Foo(MyIntEnum): TEST = 1 self.assertTrue(isinstance(Foo.TEST, MyInt)) self.assertEqual(Foo._member_type_, MyInt) self.assertEqual(repr(Foo.TEST), "0x1") class Fee(MyIntEnum): TEST = 1 def __new__(cls, value): value += 1 member = int.__new__(cls, value) member._value_ = value return member self.assertEqual(Fee.TEST, 2) def test_multiple_mixin_with_common_data_type(self): class CaseInsensitiveStrEnum(str, Enum): @classmethod def _missing_(cls, value): for member in cls._member_map_.values(): if member._value_.lower() == value.lower(): return member return super()._missing_(value) # class LenientStrEnum(str, Enum): def __init__(self, *args): self._valid = True @classmethod def _missing_(cls, value): unknown = cls._member_type_.__new__(cls, value) unknown._valid = False unknown._name_ = value.upper() unknown._value_ = value cls._member_map_[value] = unknown return unknown @enum.property def valid(self): return self._valid # class JobStatus(CaseInsensitiveStrEnum, LenientStrEnum): ACTIVE = "active" PENDING = "pending" TERMINATED = "terminated" # JS = JobStatus self.assertEqual(list(JobStatus), [JS.ACTIVE, JS.PENDING, JS.TERMINATED]) self.assertEqual(JS.ACTIVE, 'active') self.assertEqual(JS.ACTIVE.value, 'active') self.assertIs(JS('Active'), JS.ACTIVE) self.assertTrue(JS.ACTIVE.valid) missing = JS('missing') self.assertEqual(list(JobStatus), [JS.ACTIVE, JS.PENDING, JS.TERMINATED]) self.assertEqual(JS.ACTIVE, 'active') self.assertEqual(JS.ACTIVE.value, 'active') self.assertIs(JS('Active'), JS.ACTIVE) self.assertTrue(JS.ACTIVE.valid) self.assertTrue(isinstance(missing, JS)) self.assertFalse(missing.valid) def test_empty_globals(self): # bpo-35717: sys._getframe(2).f_globals['__name__'] fails with KeyError # when using compile and exec because f_globals is empty code = "from enum import Enum; Enum('Animal', 'ANT BEE CAT DOG')" code = compile(code, "<string>", "exec") global_ns = {} local_ls = {} exec(code, global_ns, local_ls) def test_strenum(self): class GoodStrEnum(StrEnum): one = '1' two = '2' three = b'3', 'ascii' four = b'4', 'latin1', 'strict' self.assertEqual(GoodStrEnum.one, '1') self.assertEqual(str(GoodStrEnum.one), '1') self.assertEqual('{}'.format(GoodStrEnum.one), '1') self.assertEqual(GoodStrEnum.one, str(GoodStrEnum.one)) self.assertEqual(GoodStrEnum.one, '{}'.format(GoodStrEnum.one)) self.assertEqual(repr(GoodStrEnum.one), "<GoodStrEnum.one: '1'>") # class DumbMixin: def __str__(self): return "don't do this" class DumbStrEnum(DumbMixin, StrEnum): five = '5' six = '6' seven = '7' __str__ = DumbMixin.__str__ # needed as of 3.11 self.assertEqual(DumbStrEnum.seven, '7') self.assertEqual(str(DumbStrEnum.seven), "don't do this") # class EnumMixin(Enum): def hello(self): print('hello from %s' % (self, )) class HelloEnum(EnumMixin, StrEnum): eight = '8' self.assertEqual(HelloEnum.eight, '8') self.assertEqual(HelloEnum.eight, str(HelloEnum.eight)) # class GoodbyeMixin: def goodbye(self): print('%s wishes you a fond farewell') class GoodbyeEnum(GoodbyeMixin, EnumMixin, StrEnum): nine = '9' self.assertEqual(GoodbyeEnum.nine, '9') self.assertEqual(GoodbyeEnum.nine, str(GoodbyeEnum.nine)) # with self.assertRaisesRegex(TypeError, '1 is not a string'): class FirstFailedStrEnum(StrEnum): one = 1 two = '2' with self.assertRaisesRegex(TypeError, "2 is not a string"): class SecondFailedStrEnum(StrEnum): one = '1' two = 2, three = '3' with self.assertRaisesRegex(TypeError, '2 is not a string'): class ThirdFailedStrEnum(StrEnum): one = '1' two = 2 with self.assertRaisesRegex(TypeError, 'encoding must be a string, not %r' % (sys.getdefaultencoding, )): class ThirdFailedStrEnum(StrEnum): one = '1' two = b'2', sys.getdefaultencoding with self.assertRaisesRegex(TypeError, 'errors must be a string, not 9'): class ThirdFailedStrEnum(StrEnum): one = '1' two = b'2', 'ascii', 9 def test_custom_strenum(self): class CustomStrEnum(str, Enum): pass class OkayEnum(CustomStrEnum): one = '1' two = '2' three = b'3', 'ascii' four = b'4', 'latin1', 'strict' self.assertEqual(OkayEnum.one, '1') self.assertEqual(str(OkayEnum.one), 'OkayEnum.one') self.assertEqual('{}'.format(OkayEnum.one), 'OkayEnum.one') self.assertEqual(repr(OkayEnum.one), "<OkayEnum.one: '1'>") # class DumbMixin: def __str__(self): return "don't do this" class DumbStrEnum(DumbMixin, CustomStrEnum): five = '5' six = '6' seven = '7' __str__ = DumbMixin.__str__ # needed as of 3.11 self.assertEqual(DumbStrEnum.seven, '7') self.assertEqual(str(DumbStrEnum.seven), "don't do this") # class EnumMixin(Enum): def hello(self): print('hello from %s' % (self, )) class HelloEnum(EnumMixin, CustomStrEnum): eight = '8' self.assertEqual(HelloEnum.eight, '8') self.assertEqual(str(HelloEnum.eight), 'HelloEnum.eight') # class GoodbyeMixin: def goodbye(self): print('%s wishes you a fond farewell') class GoodbyeEnum(GoodbyeMixin, EnumMixin, CustomStrEnum): nine = '9' self.assertEqual(GoodbyeEnum.nine, '9') self.assertEqual(str(GoodbyeEnum.nine), 'GoodbyeEnum.nine') # class FirstFailedStrEnum(CustomStrEnum): one = 1 # this will become '1' two = '2' class SecondFailedStrEnum(CustomStrEnum): one = '1' two = 2, # this will become '2' three = '3' class ThirdFailedStrEnum(CustomStrEnum): one = '1' two = 2 # this will become '2' with self.assertRaisesRegex(TypeError, r"argument (2|'encoding') must be str, not "): class ThirdFailedStrEnum(CustomStrEnum): one = '1' two = b'2', sys.getdefaultencoding with self.assertRaisesRegex(TypeError, r"argument (3|'errors') must be str, not "): class ThirdFailedStrEnum(CustomStrEnum): one = '1' two = b'2', 'ascii', 9 def test_missing_value_error(self): with self.assertRaisesRegex(TypeError, "_value_ not set in __new__"): class Combined(str, Enum): # def __new__(cls, value, sequence): enum = str.__new__(cls, value) if '(' in value: fis_name, segment = value.split('(', 1) segment = segment.strip(' )') else: fis_name = value segment = None enum.fis_name = fis_name enum.segment = segment enum.sequence = sequence return enum # def __repr__(self): return "<%s.%s>" % (self.__class__.__name__, self._name_) # key_type = 'An$(1,2)', 0 company_id = 'An$(3,2)', 1 code = 'An$(5,1)', 2 description = 'Bn$', 3 def test_private_variable_is_normal_attribute(self): class Private(Enum): __corporal = 'Radar' __major_ = 'Hoolihan' self.assertEqual(Private._Private__corporal, 'Radar') self.assertEqual(Private._Private__major_, 'Hoolihan') def test_member_from_member_access(self): class Di(Enum): YES = 1 NO = 0 name = 3 warn = Di.YES.NO self.assertIs(warn, Di.NO) self.assertIs(Di.name, Di['name']) self.assertEqual(Di.name.name, 'name') def test_dynamic_members_with_static_methods(self): # foo_defines = {'FOO_CAT': 'aloof', 'BAR_DOG': 'friendly', 'FOO_HORSE': 'big'} class Foo(Enum): vars().update({ k: v for k, v in foo_defines.items() if k.startswith('FOO_') }) def upper(self): return self.value.upper() self.assertEqual(list(Foo), [Foo.FOO_CAT, Foo.FOO_HORSE]) self.assertEqual(Foo.FOO_CAT.value, 'aloof') self.assertEqual(Foo.FOO_HORSE.upper(), 'BIG') # with self.assertRaisesRegex(TypeError, "'FOO_CAT' already defined as 'aloof'"): class FooBar(Enum): vars().update({ k: v for k, v in foo_defines.items() if k.startswith('FOO_') }, **{'FOO_CAT': 'small'}, ) def upper(self): return self.value.upper() def test_repr_with_dataclass(self): "ensure dataclass-mixin has correct repr()" # # check overridden dataclass __repr__ is used # from dataclasses import dataclass, field @dataclass(repr=False) class Foo: __qualname__ = 'Foo' a: int def __repr__(self): return 'ha hah!' class Entries(Foo, Enum): ENTRY1 = 1 self.assertEqual(repr(Entries.ENTRY1), '<Entries.ENTRY1: ha hah!>') self.assertTrue(Entries.ENTRY1.value == Foo(1), Entries.ENTRY1.value) self.assertTrue(isinstance(Entries.ENTRY1, Foo)) self.assertTrue(Entries._member_type_ is Foo, Entries._member_type_) # # check auto-generated dataclass __repr__ is not used # @dataclass class CreatureDataMixin: __qualname__ = 'CreatureDataMixin' size: str legs: int tail: bool = field(repr=False, default=True) class Creature(CreatureDataMixin, Enum): __qualname__ = 'Creature' BEETLE = ('small', 6) DOG = ('medium', 4) self.assertEqual(repr(Creature.DOG), "<Creature.DOG: size='medium', legs=4>") # # check inherited repr used # class Huh: def __repr__(self): return 'inherited' @dataclass(repr=False) class CreatureDataMixin(Huh): __qualname__ = 'CreatureDataMixin' size: str legs: int tail: bool = field(repr=False, default=True) class Creature(CreatureDataMixin, Enum): __qualname__ = 'Creature' BEETLE = ('small', 6) DOG = ('medium', 4) self.assertEqual(repr(Creature.DOG), "<Creature.DOG: inherited>") # # check default object.__repr__ used if nothing provided # @dataclass(repr=False) class CreatureDataMixin: __qualname__ = 'CreatureDataMixin' size: str legs: int tail: bool = field(repr=False, default=True) class Creature(CreatureDataMixin, Enum): __qualname__ = 'Creature' BEETLE = ('small', 6) DOG = ('medium', 4) self.assertRegex(repr(Creature.DOG), "<Creature.DOG: .*CreatureDataMixin object at .*>") def test_repr_with_init_mixin(self): class Foo: def __init__(self, a): self.a = a def __repr__(self): return f'Foo(a={self.a!r})' class Entries(Foo, Enum): ENTRY1 = 1 # self.assertEqual(repr(Entries.ENTRY1), 'Foo(a=1)') def test_repr_and_str_with_no_init_mixin(self): # non-data_type is a mixin that doesn't define __new__ class Foo: def __repr__(self): return 'Foo' def __str__(self): return 'ooF' class Entries(Foo, Enum): ENTRY1 = 1 # self.assertEqual(repr(Entries.ENTRY1), 'Foo') self.assertEqual(str(Entries.ENTRY1), 'ooF') def test_value_backup_assign(self): # check that enum will add missing values when custom __new__ does not class Some(Enum): def __new__(cls, val): return object.__new__(cls) x = 1 y = 2 self.assertEqual(Some.x.value, 1) self.assertEqual(Some.y.value, 2) def test_custom_flag_bitwise(self): class MyIntFlag(int, Flag): ONE = 1 TWO = 2 FOUR = 4 self.assertTrue(isinstance(MyIntFlag.ONE | MyIntFlag.TWO, MyIntFlag), MyIntFlag.ONE | MyIntFlag.TWO) self.assertTrue(isinstance(MyIntFlag.ONE | 2, MyIntFlag)) def test_int_flags_copy(self): class MyIntFlag(IntFlag): ONE = 1 TWO = 2 FOUR = 4 flags = MyIntFlag.ONE | MyIntFlag.TWO copied = copy.copy(flags) deep = copy.deepcopy(flags) self.assertEqual(copied, flags) self.assertEqual(deep, flags) flags = MyIntFlag.ONE | MyIntFlag.TWO | 8 copied = copy.copy(flags) deep = copy.deepcopy(flags) self.assertEqual(copied, flags) self.assertEqual(deep, flags) self.assertEqual(copied.value, 1 | 2 | 8) def test_namedtuple_as_value(self): from collections import namedtuple TTuple = namedtuple('TTuple', 'id a blist') class NTEnum(Enum): NONE = TTuple(0, 0, []) A = TTuple(1, 2, [4]) B = TTuple(2, 4, [0, 1, 2]) self.assertEqual(repr(NTEnum.NONE), "<NTEnum.NONE: TTuple(id=0, a=0, blist=[])>") self.assertEqual(NTEnum.NONE.value, TTuple(id=0, a=0, blist=[])) self.assertEqual( [x.value for x in NTEnum], [TTuple(id=0, a=0, blist=[]), TTuple(id=1, a=2, blist=[4]), TTuple(id=2, a=4, blist=[0, 1, 2])], ) self.assertRaises(AttributeError, getattr, NTEnum.NONE, 'id') # class NTCEnum(TTuple, Enum): NONE = 0, 0, [] A = 1, 2, [4] B = 2, 4, [0, 1, 2] self.assertEqual(repr(NTCEnum.NONE), "<NTCEnum.NONE: TTuple(id=0, a=0, blist=[])>") self.assertEqual(NTCEnum.NONE.value, TTuple(id=0, a=0, blist=[])) self.assertEqual(NTCEnum.NONE.id, 0) self.assertEqual(NTCEnum.A.a, 2) self.assertEqual(NTCEnum.B.blist, [0, 1 ,2]) self.assertEqual( [x.value for x in NTCEnum], [TTuple(id=0, a=0, blist=[]), TTuple(id=1, a=2, blist=[4]), TTuple(id=2, a=4, blist=[0, 1, 2])], ) # class NTDEnum(Enum): def __new__(cls, id, a, blist): member = object.__new__(cls) member.id = id member.a = a member.blist = blist return member NONE = TTuple(0, 0, []) A = TTuple(1, 2, [4]) B = TTuple(2, 4, [0, 1, 2]) self.assertEqual(repr(NTDEnum.NONE), "<NTDEnum.NONE: TTuple(id=0, a=0, blist=[])>") self.assertEqual(NTDEnum.NONE.id, 0) self.assertEqual(NTDEnum.A.a, 2) self.assertEqual(NTDEnum.B.blist, [0, 1 ,2]) def test_flag_with_custom_new(self): class FlagFromChar(IntFlag): def __new__(cls, c): value = 1 << c self = int.__new__(cls, value) self._value_ = value return self # a = ord('a') # self.assertEqual(FlagFromChar._all_bits_, 316912650057057350374175801343) self.assertEqual(FlagFromChar._flag_mask_, 158456325028528675187087900672) self.assertEqual(FlagFromChar.a, 158456325028528675187087900672) self.assertEqual(FlagFromChar.a|1, 158456325028528675187087900673) # # class FlagFromChar(Flag): def __new__(cls, c): value = 1 << c self = object.__new__(cls) self._value_ = value return self # a = ord('a') z = 1 # self.assertEqual(FlagFromChar._all_bits_, 316912650057057350374175801343) self.assertEqual(FlagFromChar._flag_mask_, 158456325028528675187087900674) self.assertEqual(FlagFromChar.a.value, 158456325028528675187087900672) self.assertEqual((FlagFromChar.a|FlagFromChar.z).value, 158456325028528675187087900674) # # class FlagFromChar(int, Flag, boundary=KEEP): def __new__(cls, c): value = 1 << c self = int.__new__(cls, value) self._value_ = value return self # a = ord('a') # self.assertEqual(FlagFromChar._all_bits_, 316912650057057350374175801343) self.assertEqual(FlagFromChar._flag_mask_, 158456325028528675187087900672) self.assertEqual(FlagFromChar.a, 158456325028528675187087900672) self.assertEqual(FlagFromChar.a|1, 158456325028528675187087900673) def test_init_exception(self): class Base: def __new__(cls, *args): return object.__new__(cls) def __init__(self, x): raise ValueError("I don't like", x) with self.assertRaises(TypeError): class MyEnum(Base, enum.Enum): A = 'a' def __init__(self, y): self.y = y with self.assertRaises(ValueError): class MyEnum(Base, enum.Enum): A = 'a' def __init__(self, y): self.y = y def __new__(cls, value): member = Base.__new__(cls) member._value_ = Base(value) return member def test_extra_member_creation(self): class IDEnumMeta(EnumMeta): def __new__(metacls, cls, bases, classdict, **kwds): # add new entries to classdict for name in classdict.member_names: classdict[f'{name}_DESC'] = f'-{classdict[name]}' return super().__new__(metacls, cls, bases, classdict, **kwds) class IDEnum(StrEnum, metaclass=IDEnumMeta): pass class MyEnum(IDEnum): ID = 'id' NAME = 'name' self.assertEqual(list(MyEnum), [MyEnum.ID, MyEnum.NAME, MyEnum.ID_DESC, MyEnum.NAME_DESC]) def test_add_alias(self): class mixin: @property def ORG(self): return 'huh' class Color(mixin, Enum): RED = 1 GREEN = 2 BLUE = 3 Color.RED._add_alias_('ROJO') self.assertIs(Color.RED, Color['ROJO']) self.assertIs(Color.RED, Color.ROJO) Color.BLUE._add_alias_('ORG') self.assertIs(Color.BLUE, Color['ORG']) self.assertIs(Color.BLUE, Color.ORG) self.assertEqual(Color.RED.ORG, 'huh') self.assertEqual(Color.GREEN.ORG, 'huh') self.assertEqual(Color.BLUE.ORG, 'huh') self.assertEqual(Color.ORG.ORG, 'huh') def test_add_value_alias_after_creation(self): class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 Color.RED._add_value_alias_(5) self.assertIs(Color.RED, Color(5)) def test_add_value_alias_during_creation(self): class Types(Enum): Unknown = 0, Source = 1, 'src' NetList = 2, 'nl' def __new__(cls, int_value, *value_aliases): member = object.__new__(cls) member._value_ = int_value for alias in value_aliases: member._add_value_alias_(alias) return member self.assertIs(Types(0), Types.Unknown) self.assertIs(Types(1), Types.Source) self.assertIs(Types('src'), Types.Source) self.assertIs(Types(2), Types.NetList) self.assertIs(Types('nl'), Types.NetList) def test_second_tuple_item_is_falsey(self): class Cardinal(Enum): RIGHT = (1, 0) UP = (0, 1) LEFT = (-1, 0) DOWN = (0, -1) self.assertIs(Cardinal(1, 0), Cardinal.RIGHT) self.assertIs(Cardinal(-1, 0), Cardinal.LEFT) def test_no_members(self): with self.assertRaisesRegex( TypeError, 'has no members', ): Enum(7) with self.assertRaisesRegex( TypeError, 'has no members', ): Flag(7) def test_empty_names(self): for nothing in '', [], {}: for e_type in None, int: empty_enum = Enum('empty_enum', nothing, type=e_type) self.assertEqual(len(empty_enum), 0) self.assertRaisesRegex(TypeError, 'has no members', empty_enum, 0) self.assertRaisesRegex(TypeError, '.int. object is not iterable', Enum, 'bad_enum', names=0) self.assertRaisesRegex(TypeError, '.int. object is not iterable', Enum, 'bad_enum', 0, type=int) def test_nonhashable_matches_hashable(self): # issue 125710 class Directions(Enum): DOWN_ONLY = frozenset({"sc"}) UP_ONLY = frozenset({"cs"}) UNRESTRICTED = frozenset({"sc", "cs"}) self.assertIs(Directions({"sc"}), Directions.DOWN_ONLY) class TestOrder(unittest.TestCase): "test usage of the `_order_` attribute" def test_same_members(self): class Color(Enum): _order_ = 'red green blue' red = 1 green = 2 blue = 3 def test_same_members_with_aliases(self): class Color(Enum): _order_ = 'red green blue' red = 1 green = 2 blue = 3 verde = green def test_same_members_wrong_order(self): with self.assertRaisesRegex(TypeError, 'member order does not match _order_'): class Color(Enum): _order_ = 'red green blue' red = 1 blue = 3 green = 2 def test_order_has_extra_members(self): with self.assertRaisesRegex(TypeError, 'member order does not match _order_'): class Color(Enum): _order_ = 'red green blue purple' red = 1 green = 2 blue = 3 def test_order_has_extra_members_with_aliases(self): with self.assertRaisesRegex(TypeError, 'member order does not match _order_'): class Color(Enum): _order_ = 'red green blue purple' red = 1 green = 2 blue = 3 verde = green def test_enum_has_extra_members(self): with self.assertRaisesRegex(TypeError, 'member order does not match _order_'): class Color(Enum): _order_ = 'red green blue' red = 1 green = 2 blue = 3 purple = 4 def test_enum_has_extra_members_with_aliases(self): with self.assertRaisesRegex(TypeError, 'member order does not match _order_'): class Color(Enum): _order_ = 'red green blue' red = 1 green = 2 blue = 3 purple = 4 verde = green class OldTestFlag(unittest.TestCase): """Tests of the Flags.""" class Perm(Flag): R, W, X = 4, 2, 1 class Open(Flag): RO = 0 WO = 1 RW = 2 AC = 3 CE = 1<<19 class Color(Flag): BLACK = 0 RED = 1 ROJO = 1 GREEN = 2 BLUE = 4 PURPLE = RED|BLUE WHITE = RED|GREEN|BLUE BLANCO = RED|GREEN|BLUE def test_or(self): Perm = self.Perm for i in Perm: for j in Perm: self.assertEqual((i | j), Perm(i.value | j.value)) self.assertEqual((i | j).value, i.value | j.value) self.assertIs(type(i | j), Perm) for i in Perm: self.assertIs(i | i, i) Open = self.Open self.assertIs(Open.RO | Open.CE, Open.CE) def test_and(self): Perm = self.Perm RW = Perm.R | Perm.W RX = Perm.R | Perm.X WX = Perm.W | Perm.X RWX = Perm.R | Perm.W | Perm.X values = list(Perm) + [RW, RX, WX, RWX, Perm(0)] for i in values: for j in values: self.assertEqual((i & j).value, i.value & j.value) self.assertIs(type(i & j), Perm) for i in Perm: self.assertIs(i & i, i) self.assertIs(i & RWX, i) self.assertIs(RWX & i, i) Open = self.Open self.assertIs(Open.RO & Open.CE, Open.RO) def test_xor(self): Perm = self.Perm for i in Perm: for j in Perm: self.assertEqual((i ^ j).value, i.value ^ j.value) self.assertIs(type(i ^ j), Perm) for i in Perm: self.assertIs(i ^ Perm(0), i) self.assertIs(Perm(0) ^ i, i) Open = self.Open self.assertIs(Open.RO ^ Open.CE, Open.CE) self.assertIs(Open.CE ^ Open.CE, Open.RO) def test_bool(self): Perm = self.Perm for f in Perm: self.assertTrue(f) Open = self.Open for f in Open: self.assertEqual(bool(f.value), bool(f)) def test_boundary(self): self.assertIs(enum.Flag._boundary_, STRICT) class Iron(Flag, boundary=CONFORM): ONE = 1 TWO = 2 EIGHT = 8 self.assertIs(Iron._boundary_, CONFORM) # class Water(Flag, boundary=STRICT): ONE = 1 TWO = 2 EIGHT = 8 self.assertIs(Water._boundary_, STRICT) # class Space(Flag, boundary=EJECT): ONE = 1 TWO = 2 EIGHT = 8 self.assertIs(Space._boundary_, EJECT) # class Bizarre(Flag, boundary=KEEP): b = 3 c = 4 d = 6 # self.assertRaisesRegex(ValueError, 'invalid value 7', Water, 7) # self.assertIs(Iron(7), Iron.ONE|Iron.TWO) self.assertIs(Iron(~9), Iron.TWO) # self.assertEqual(Space(7), 7) self.assertTrue(type(Space(7)) is int) # self.assertEqual(list(Bizarre), [Bizarre.c]) self.assertIs(Bizarre(3), Bizarre.b) self.assertIs(Bizarre(6), Bizarre.d) # class SkipFlag(enum.Flag): A = 1 B = 2 C = 4 | B # self.assertTrue(SkipFlag.C in (SkipFlag.A|SkipFlag.C)) self.assertTrue(SkipFlag.B in SkipFlag.C) self.assertIs(SkipFlag(~1), SkipFlag.B) self.assertRaisesRegex(ValueError, 'SkipFlag.. invalid value 42', SkipFlag, 42) # class SkipIntFlag(enum.IntFlag): A = 1 B = 2 C = 4 | B # self.assertTrue(SkipIntFlag.C in (SkipIntFlag.A|SkipIntFlag.C)) self.assertTrue(SkipIntFlag.B in SkipIntFlag.C) self.assertIs(SkipIntFlag(~1), SkipIntFlag.B|SkipIntFlag.C) self.assertEqual(SkipIntFlag(42).value, 42) # class MethodHint(Flag): HiddenText = 0x10 DigitsOnly = 0x01 LettersOnly = 0x02 OnlyMask = 0x0f # self.assertEqual(str(MethodHint.HiddenText|MethodHint.OnlyMask), 'MethodHint.HiddenText|DigitsOnly|LettersOnly|OnlyMask') def test_iter(self): Color = self.Color Open = self.Open self.assertEqual(list(Color), [Color.RED, Color.GREEN, Color.BLUE]) self.assertEqual(list(Open), [Open.WO, Open.RW, Open.CE]) def test_programatic_function_string(self): Perm = Flag('Perm', 'R W X') lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<i e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_string_with_start(self): Perm = Flag('Perm', 'R W X', start=8) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 8<<i e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_string_list(self): Perm = Flag('Perm', ['R', 'W', 'X']) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<i e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_iterable(self): Perm = Flag('Perm', (('R', 2), ('W', 8), ('X', 32))) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<(2*i+1) e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_from_dict(self): Perm = Flag('Perm', OrderedDict((('R', 2), ('W', 8), ('X', 32)))) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<(2*i+1) e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) @reraise_if_not_enum( FlagStooges, FlagStoogesWithZero, IntFlagStooges, IntFlagStoogesWithZero, ) def test_pickle(self): test_pickle_dump_load(self.assertIs, FlagStooges.CURLY) test_pickle_dump_load(self.assertEqual, FlagStooges.CURLY|FlagStooges.MOE) test_pickle_dump_load(self.assertEqual, FlagStooges.CURLY&~FlagStooges.CURLY) test_pickle_dump_load(self.assertIs, FlagStooges) test_pickle_dump_load(self.assertEqual, FlagStooges.BIG) test_pickle_dump_load(self.assertEqual, FlagStooges.CURLY|FlagStooges.BIG) test_pickle_dump_load(self.assertIs, FlagStoogesWithZero.CURLY) test_pickle_dump_load(self.assertEqual, FlagStoogesWithZero.CURLY|FlagStoogesWithZero.MOE) test_pickle_dump_load(self.assertIs, FlagStoogesWithZero.NOFLAG) test_pickle_dump_load(self.assertEqual, FlagStoogesWithZero.BIG) test_pickle_dump_load(self.assertEqual, FlagStoogesWithZero.CURLY|FlagStoogesWithZero.BIG) test_pickle_dump_load(self.assertIs, IntFlagStooges.CURLY) test_pickle_dump_load(self.assertEqual, IntFlagStooges.CURLY|IntFlagStooges.MOE) test_pickle_dump_load(self.assertEqual, IntFlagStooges.CURLY|IntFlagStooges.MOE|0x30) test_pickle_dump_load(self.assertEqual, IntFlagStooges(0)) test_pickle_dump_load(self.assertEqual, IntFlagStooges(0x30)) test_pickle_dump_load(self.assertIs, IntFlagStooges) test_pickle_dump_load(self.assertEqual, IntFlagStooges.BIG) test_pickle_dump_load(self.assertEqual, IntFlagStooges.BIG|1) test_pickle_dump_load(self.assertEqual, IntFlagStooges.CURLY|IntFlagStooges.BIG) test_pickle_dump_load(self.assertIs, IntFlagStoogesWithZero.CURLY) test_pickle_dump_load(self.assertEqual, IntFlagStoogesWithZero.CURLY|IntFlagStoogesWithZero.MOE) test_pickle_dump_load(self.assertIs, IntFlagStoogesWithZero.NOFLAG) test_pickle_dump_load(self.assertEqual, IntFlagStoogesWithZero.BIG) test_pickle_dump_load(self.assertEqual, IntFlagStoogesWithZero.BIG|1) test_pickle_dump_load(self.assertEqual, IntFlagStoogesWithZero.CURLY|IntFlagStoogesWithZero.BIG) def test_contains_tf(self): Open = self.Open Color = self.Color self.assertFalse(Color.BLACK in Open) self.assertFalse(Open.RO in Color) self.assertFalse('BLACK' in Color) self.assertFalse('RO' in Open) self.assertTrue(Color.BLACK in Color) self.assertTrue(Open.RO in Open) self.assertTrue(1 in Color) self.assertTrue(1 in Open) def test_member_contains(self): Perm = self.Perm R, W, X = Perm RW = R | W RX = R | X WX = W | X RWX = R | W | X self.assertTrue(R in RW) self.assertTrue(R in RX) self.assertTrue(R in RWX) self.assertTrue(W in RW) self.assertTrue(W in WX) self.assertTrue(W in RWX) self.assertTrue(X in RX) self.assertTrue(X in WX) self.assertTrue(X in RWX) self.assertFalse(R in WX) self.assertFalse(W in RX) self.assertFalse(X in RW) def test_member_iter(self): Color = self.Color self.assertEqual(list(Color.BLACK), []) self.assertEqual(list(Color.PURPLE), [Color.RED, Color.BLUE]) self.assertEqual(list(Color.BLUE), [Color.BLUE]) self.assertEqual(list(Color.GREEN), [Color.GREEN]) self.assertEqual(list(Color.WHITE), [Color.RED, Color.GREEN, Color.BLUE]) self.assertEqual(list(Color.WHITE), [Color.RED, Color.GREEN, Color.BLUE]) def test_member_length(self): self.assertEqual(self.Color.__len__(self.Color.BLACK), 0) self.assertEqual(self.Color.__len__(self.Color.GREEN), 1) self.assertEqual(self.Color.__len__(self.Color.PURPLE), 2) self.assertEqual(self.Color.__len__(self.Color.BLANCO), 3) def test_number_reset_and_order_cleanup(self): class Confused(Flag): _order_ = 'ONE TWO FOUR DOS EIGHT SIXTEEN' ONE = auto() TWO = auto() FOUR = auto() DOS = 2 EIGHT = auto() SIXTEEN = auto() self.assertEqual( list(Confused), [Confused.ONE, Confused.TWO, Confused.FOUR, Confused.EIGHT, Confused.SIXTEEN]) self.assertIs(Confused.TWO, Confused.DOS) self.assertEqual(Confused.DOS._value_, 2) self.assertEqual(Confused.EIGHT._value_, 8) self.assertEqual(Confused.SIXTEEN._value_, 16) def test_aliases(self): Color = self.Color self.assertEqual(Color(1).name, 'RED') self.assertEqual(Color['ROJO'].name, 'RED') self.assertEqual(Color(7).name, 'WHITE') self.assertEqual(Color['BLANCO'].name, 'WHITE') self.assertIs(Color.BLANCO, Color.WHITE) Open = self.Open self.assertIs(Open['AC'], Open.AC) def test_auto_number(self): class Color(Flag): red = auto() blue = auto() green = auto() self.assertEqual(list(Color), [Color.red, Color.blue, Color.green]) self.assertEqual(Color.red.value, 1) self.assertEqual(Color.blue.value, 2) self.assertEqual(Color.green.value, 4) def test_auto_number_garbage(self): with self.assertRaisesRegex(TypeError, 'invalid flag value .not an int.'): class Color(Flag): red = 'not an int' blue = auto() def test_duplicate_auto(self): class Dupes(Enum): first = primero = auto() second = auto() third = auto() self.assertEqual([Dupes.first, Dupes.second, Dupes.third], list(Dupes)) def test_multiple_mixin(self): class AllMixin: @classproperty def ALL(cls): members = list(cls) all_value = None if members: all_value = members[0] for member in members[1:]: all_value |= member cls.ALL = all_value return all_value class StrMixin: def __str__(self): return self._name_.lower() class Color(AllMixin, Flag): RED = auto() GREEN = auto() BLUE = auto() self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 4) self.assertEqual(Color.ALL.value, 7) self.assertEqual(str(Color.BLUE), 'Color.BLUE') class Color(AllMixin, StrMixin, Flag): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 4) self.assertEqual(Color.ALL.value, 7) self.assertEqual(str(Color.BLUE), 'blue') class Color(StrMixin, AllMixin, Flag): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 4) self.assertEqual(Color.ALL.value, 7) self.assertEqual(str(Color.BLUE), 'blue') @threading_helper.reap_threads @threading_helper.requires_working_threading() def test_unique_composite(self): # override __eq__ to be identity only class TestFlag(Flag): one = auto() two = auto() three = auto() four = auto() five = auto() six = auto() seven = auto() eight = auto() def __eq__(self, other): return self is other def __hash__(self): return hash(self._value_) # have multiple threads competing to complete the composite members seen = set() failed = False def cycle_enum(): nonlocal failed try: for i in range(256): seen.add(TestFlag(i)) except Exception: failed = True threads = [ threading.Thread(target=cycle_enum) for _ in range(8) ] with threading_helper.start_threads(threads): pass # check that only 248 members were created self.assertFalse( failed, 'at least one thread failed while creating composite members') self.assertEqual(256, len(seen), 'too many composite members created') def test_init_subclass(self): class MyEnum(Flag): def __init_subclass__(cls, **kwds): super().__init_subclass__(**kwds) self.assertFalse(cls.__dict__.get('_test', False)) cls._test1 = 'MyEnum' # class TheirEnum(MyEnum): def __init_subclass__(cls, **kwds): super(TheirEnum, cls).__init_subclass__(**kwds) cls._test2 = 'TheirEnum' class WhoseEnum(TheirEnum): def __init_subclass__(cls, **kwds): pass class NoEnum(WhoseEnum): ONE = 1 self.assertEqual(TheirEnum.__dict__['_test1'], 'MyEnum') self.assertEqual(WhoseEnum.__dict__['_test1'], 'MyEnum') self.assertEqual(WhoseEnum.__dict__['_test2'], 'TheirEnum') self.assertFalse(NoEnum.__dict__.get('_test1', False)) self.assertFalse(NoEnum.__dict__.get('_test2', False)) # class OurEnum(MyEnum): def __init_subclass__(cls, **kwds): cls._test2 = 'OurEnum' class WhereEnum(OurEnum): def __init_subclass__(cls, **kwds): pass class NeverEnum(WhereEnum): ONE = 1 self.assertEqual(OurEnum.__dict__['_test1'], 'MyEnum') self.assertFalse(WhereEnum.__dict__.get('_test1', False)) self.assertEqual(WhereEnum.__dict__['_test2'], 'OurEnum') self.assertFalse(NeverEnum.__dict__.get('_test1', False)) self.assertFalse(NeverEnum.__dict__.get('_test2', False)) class OldTestIntFlag(unittest.TestCase): """Tests of the IntFlags.""" class Perm(IntFlag): R = 1 << 2 W = 1 << 1 X = 1 << 0 class Open(IntFlag): RO = 0 WO = 1 RW = 2 AC = 3 CE = 1<<19 class Color(IntFlag): BLACK = 0 RED = 1 ROJO = 1 GREEN = 2 BLUE = 4 PURPLE = RED|BLUE WHITE = RED|GREEN|BLUE BLANCO = RED|GREEN|BLUE class Skip(IntFlag): FIRST = 1 SECOND = 2 EIGHTH = 8 def test_type(self): Perm = self.Perm self.assertTrue(Perm._member_type_ is int) Open = self.Open for f in Perm: self.assertTrue(isinstance(f, Perm)) self.assertEqual(f, f.value) self.assertTrue(isinstance(Perm.W | Perm.X, Perm)) self.assertEqual(Perm.W | Perm.X, 3) for f in Open: self.assertTrue(isinstance(f, Open)) self.assertEqual(f, f.value) self.assertTrue(isinstance(Open.WO | Open.RW, Open)) self.assertEqual(Open.WO | Open.RW, 3) @reraise_if_not_enum(HeadlightsK) def test_global_repr_keep(self): self.assertEqual( repr(HeadlightsK(0)), '%s.OFF_K' % SHORT_MODULE, ) self.assertEqual( repr(HeadlightsK(2**0 + 2**2 + 2**3)), '%(m)s.LOW_BEAM_K|%(m)s.FOG_K|8' % {'m': SHORT_MODULE}, ) self.assertEqual( repr(HeadlightsK(2**3)), '%(m)s.HeadlightsK(8)' % {'m': SHORT_MODULE}, ) @reraise_if_not_enum(HeadlightsC) def test_global_repr_conform1(self): self.assertEqual( repr(HeadlightsC(0)), '%s.OFF_C' % SHORT_MODULE, ) self.assertEqual( repr(HeadlightsC(2**0 + 2**2 + 2**3)), '%(m)s.LOW_BEAM_C|%(m)s.FOG_C' % {'m': SHORT_MODULE}, ) self.assertEqual( repr(HeadlightsC(2**3)), '%(m)s.OFF_C' % {'m': SHORT_MODULE}, ) @reraise_if_not_enum(NoName) def test_global_enum_str(self): self.assertEqual(repr(NoName.ONE), 'test_enum.ONE') self.assertEqual(repr(NoName(0)), 'test_enum.NoName(0)') self.assertEqual(str(NoName.ONE & NoName.TWO), 'NoName(0)') self.assertEqual(str(NoName(0)), 'NoName(0)') def test_format(self): Perm = self.Perm self.assertEqual(format(Perm.R, ''), '4') self.assertEqual(format(Perm.R | Perm.X, ''), '5') # class NewPerm(IntFlag): R = 1 << 2 W = 1 << 1 X = 1 << 0 def __str__(self): return self._name_ self.assertEqual(format(NewPerm.R, ''), 'R') self.assertEqual(format(NewPerm.R | Perm.X, ''), 'R|X') def test_or(self): Perm = self.Perm for i in Perm: for j in Perm: self.assertEqual(i | j, i.value | j.value) self.assertEqual((i | j).value, i.value | j.value) self.assertIs(type(i | j), Perm) for j in range(8): self.assertEqual(i | j, i.value | j) self.assertEqual((i | j).value, i.value | j) self.assertIs(type(i | j), Perm) self.assertEqual(j | i, j | i.value) self.assertEqual((j | i).value, j | i.value) self.assertIs(type(j | i), Perm) for i in Perm: self.assertIs(i | i, i) self.assertIs(i | 0, i) self.assertIs(0 | i, i) Open = self.Open self.assertIs(Open.RO | Open.CE, Open.CE) def test_and(self): Perm = self.Perm RW = Perm.R | Perm.W RX = Perm.R | Perm.X WX = Perm.W | Perm.X RWX = Perm.R | Perm.W | Perm.X values = list(Perm) + [RW, RX, WX, RWX, Perm(0)] for i in values: for j in values: self.assertEqual(i & j, i.value & j.value, 'i is %r, j is %r' % (i, j)) self.assertEqual((i & j).value, i.value & j.value, 'i is %r, j is %r' % (i, j)) self.assertIs(type(i & j), Perm, 'i is %r, j is %r' % (i, j)) for j in range(8): self.assertEqual(i & j, i.value & j) self.assertEqual((i & j).value, i.value & j) self.assertIs(type(i & j), Perm) self.assertEqual(j & i, j & i.value) self.assertEqual((j & i).value, j & i.value) self.assertIs(type(j & i), Perm) for i in Perm: self.assertIs(i & i, i) self.assertIs(i & 7, i) self.assertIs(7 & i, i) Open = self.Open self.assertIs(Open.RO & Open.CE, Open.RO) def test_xor(self): Perm = self.Perm for i in Perm: for j in Perm: self.assertEqual(i ^ j, i.value ^ j.value) self.assertEqual((i ^ j).value, i.value ^ j.value) self.assertIs(type(i ^ j), Perm) for j in range(8): self.assertEqual(i ^ j, i.value ^ j) self.assertEqual((i ^ j).value, i.value ^ j) self.assertIs(type(i ^ j), Perm) self.assertEqual(j ^ i, j ^ i.value) self.assertEqual((j ^ i).value, j ^ i.value) self.assertIs(type(j ^ i), Perm) for i in Perm: self.assertIs(i ^ 0, i) self.assertIs(0 ^ i, i) Open = self.Open self.assertIs(Open.RO ^ Open.CE, Open.CE) self.assertIs(Open.CE ^ Open.CE, Open.RO) def test_invert(self): Perm = self.Perm RW = Perm.R | Perm.W RX = Perm.R | Perm.X WX = Perm.W | Perm.X RWX = Perm.R | Perm.W | Perm.X values = list(Perm) + [RW, RX, WX, RWX, Perm(0)] for i in values: self.assertEqual(~i, (~i).value) self.assertIs(type(~i), Perm) self.assertEqual(~~i, i) for i in Perm: self.assertIs(~~i, i) Open = self.Open self.assertIs(Open.WO & ~Open.WO, Open.RO) self.assertIs((Open.WO|Open.CE) & ~Open.WO, Open.CE) def test_boundary(self): self.assertIs(enum.IntFlag._boundary_, KEEP) class Simple(IntFlag, boundary=KEEP): SINGLE = 1 # class Iron(IntFlag, boundary=STRICT): ONE = 1 TWO = 2 EIGHT = 8 self.assertIs(Iron._boundary_, STRICT) # class Water(IntFlag, boundary=CONFORM): ONE = 1 TWO = 2 EIGHT = 8 self.assertIs(Water._boundary_, CONFORM) # class Space(IntFlag, boundary=EJECT): ONE = 1 TWO = 2 EIGHT = 8 self.assertIs(Space._boundary_, EJECT) # class Bizarre(IntFlag, boundary=KEEP): b = 3 c = 4 d = 6 # self.assertRaisesRegex(ValueError, 'invalid value 5', Iron, 5) # self.assertIs(Water(7), Water.ONE|Water.TWO) self.assertIs(Water(~9), Water.TWO) # self.assertEqual(Space(7), 7) self.assertTrue(type(Space(7)) is int) # self.assertEqual(list(Bizarre), [Bizarre.c]) self.assertIs(Bizarre(3), Bizarre.b) self.assertIs(Bizarre(6), Bizarre.d) # simple = Simple.SINGLE | Iron.TWO self.assertEqual(simple, 3) self.assertIsInstance(simple, Simple) self.assertEqual(repr(simple), '<Simple.SINGLE|<Iron.TWO: 2>: 3>') self.assertEqual(str(simple), '3') def test_iter(self): Color = self.Color Open = self.Open self.assertEqual(list(Color), [Color.RED, Color.GREEN, Color.BLUE]) self.assertEqual(list(Open), [Open.WO, Open.RW, Open.CE]) def test_programatic_function_string(self): Perm = IntFlag('Perm', 'R W X') lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<i e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e, v) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_string_with_start(self): Perm = IntFlag('Perm', 'R W X', start=8) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 8<<i e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e, v) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_string_list(self): Perm = IntFlag('Perm', ['R', 'W', 'X']) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<i e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e, v) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_iterable(self): Perm = IntFlag('Perm', (('R', 2), ('W', 8), ('X', 32))) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<(2*i+1) e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e, v) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_from_dict(self): Perm = IntFlag('Perm', OrderedDict((('R', 2), ('W', 8), ('X', 32)))) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 3, Perm) self.assertEqual(lst, [Perm.R, Perm.W, Perm.X]) for i, n in enumerate('R W X'.split()): v = 1<<(2*i+1) e = Perm(v) self.assertEqual(e.value, v) self.assertEqual(type(e.value), int) self.assertEqual(e, v) self.assertEqual(e.name, n) self.assertIn(e, Perm) self.assertIs(type(e), Perm) def test_programatic_function_from_empty_list(self): Perm = enum.IntFlag('Perm', []) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 0, Perm) Thing = enum.Enum('Thing', []) lst = list(Thing) self.assertEqual(len(lst), len(Thing)) self.assertEqual(len(Thing), 0, Thing) def test_programatic_function_from_empty_tuple(self): Perm = enum.IntFlag('Perm', ()) lst = list(Perm) self.assertEqual(len(lst), len(Perm)) self.assertEqual(len(Perm), 0, Perm) Thing = enum.Enum('Thing', ()) self.assertEqual(len(lst), len(Thing)) self.assertEqual(len(Thing), 0, Thing) def test_contains_tf(self): Open = self.Open Color = self.Color self.assertTrue(Color.GREEN in Color) self.assertTrue(Open.RW in Open) self.assertFalse('GREEN' in Color) self.assertFalse('RW' in Open) self.assertTrue(2 in Color) self.assertTrue(2 in Open) def test_member_contains(self): Perm = self.Perm R, W, X = Perm RW = R | W RX = R | X WX = W | X RWX = R | W | X self.assertTrue(R in RW) self.assertTrue(R in RX) self.assertTrue(R in RWX) self.assertTrue(W in RW) self.assertTrue(W in WX) self.assertTrue(W in RWX) self.assertTrue(X in RX) self.assertTrue(X in WX) self.assertTrue(X in RWX) self.assertFalse(R in WX) self.assertFalse(W in RX) self.assertFalse(X in RW) with self.assertRaises(TypeError): self.assertFalse('test' in RW) def test_member_iter(self): Color = self.Color self.assertEqual(list(Color.BLACK), []) self.assertEqual(list(Color.PURPLE), [Color.RED, Color.BLUE]) self.assertEqual(list(Color.BLUE), [Color.BLUE]) self.assertEqual(list(Color.GREEN), [Color.GREEN]) self.assertEqual(list(Color.WHITE), [Color.RED, Color.GREEN, Color.BLUE]) def test_member_length(self): self.assertEqual(self.Color.__len__(self.Color.BLACK), 0) self.assertEqual(self.Color.__len__(self.Color.GREEN), 1) self.assertEqual(self.Color.__len__(self.Color.PURPLE), 2) self.assertEqual(self.Color.__len__(self.Color.BLANCO), 3) def test_aliases(self): Color = self.Color self.assertEqual(Color(1).name, 'RED') self.assertEqual(Color['ROJO'].name, 'RED') self.assertEqual(Color(7).name, 'WHITE') self.assertEqual(Color['BLANCO'].name, 'WHITE') self.assertIs(Color.BLANCO, Color.WHITE) Open = self.Open self.assertIs(Open['AC'], Open.AC) def test_bool(self): Perm = self.Perm for f in Perm: self.assertTrue(f) Open = self.Open for f in Open: self.assertEqual(bool(f.value), bool(f)) def test_multiple_mixin(self): class AllMixin: @classproperty def ALL(cls): members = list(cls) all_value = None if members: all_value = members[0] for member in members[1:]: all_value |= member cls.ALL = all_value return all_value class StrMixin: def __str__(self): return self._name_.lower() class Color(AllMixin, IntFlag): RED = auto() GREEN = auto() BLUE = auto() self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 4) self.assertEqual(Color.ALL.value, 7) self.assertEqual(str(Color.BLUE), '4') class Color(AllMixin, StrMixin, IntFlag): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 4) self.assertEqual(Color.ALL.value, 7) self.assertEqual(str(Color.BLUE), 'blue') class Color(StrMixin, AllMixin, IntFlag): RED = auto() GREEN = auto() BLUE = auto() __str__ = StrMixin.__str__ self.assertEqual(Color.RED.value, 1) self.assertEqual(Color.GREEN.value, 2) self.assertEqual(Color.BLUE.value, 4) self.assertEqual(Color.ALL.value, 7) self.assertEqual(str(Color.BLUE), 'blue') @threading_helper.reap_threads @threading_helper.requires_working_threading() def test_unique_composite(self): # override __eq__ to be identity only class TestFlag(IntFlag): one = auto() two = auto() three = auto() four = auto() five = auto() six = auto() seven = auto() eight = auto() def __eq__(self, other): return self is other def __hash__(self): return hash(self._value_) # have multiple threads competing to complete the composite members seen = set() failed = False def cycle_enum(): nonlocal failed try: for i in range(256): seen.add(TestFlag(i)) except Exception: failed = True threads = [ threading.Thread(target=cycle_enum) for _ in range(8) ] with threading_helper.start_threads(threads): pass # check that only 248 members were created self.assertFalse( failed, 'at least one thread failed while creating composite members') self.assertEqual(256, len(seen), 'too many composite members created') class TestEmptyAndNonLatinStrings(unittest.TestCase): def test_empty_string(self): with self.assertRaises(ValueError): empty_abc = Enum('empty_abc', ('', 'B', 'C')) def test_non_latin_character_string(self): greek_abc = Enum('greek_abc', ('\u03B1', 'B', 'C')) item = getattr(greek_abc, '\u03B1') self.assertEqual(item.value, 1) def test_non_latin_number_string(self): hebrew_123 = Enum('hebrew_123', ('\u05D0', '2', '3')) item = getattr(hebrew_123, '\u05D0') self.assertEqual(item.value, 1) class TestUnique(unittest.TestCase): def test_unique_clean(self): @unique class Clean(Enum): one = 1 two = 'dos' tres = 4.0 # @unique class Cleaner(IntEnum): single = 1 double = 2 triple = 3 def test_unique_dirty(self): with self.assertRaisesRegex(ValueError, 'tres.*one'): @unique class Dirty(Enum): one = 1 two = 'dos' tres = 1 with self.assertRaisesRegex( ValueError, 'double.*single.*turkey.*triple', ): @unique class Dirtier(IntEnum): single = 1 double = 1 triple = 3 turkey = 3 def test_unique_with_name(self): @verify(UNIQUE) class Silly(Enum): one = 1 two = 'dos' name = 3 # @verify(UNIQUE) class Sillier(IntEnum): single = 1 name = 2 triple = 3 value = 4 class TestVerify(unittest.TestCase): def test_continuous(self): @verify(CONTINUOUS) class Auto(Enum): FIRST = auto() SECOND = auto() THIRD = auto() FORTH = auto() # @verify(CONTINUOUS) class Manual(Enum): FIRST = 3 SECOND = 4 THIRD = 5 FORTH = 6 # with self.assertRaisesRegex(ValueError, 'invalid enum .Missing.: missing values 5, 6, 7, 8, 9, 10, 12'): @verify(CONTINUOUS) class Missing(Enum): FIRST = 3 SECOND = 4 THIRD = 11 FORTH = 13 # with self.assertRaisesRegex(ValueError, 'invalid flag .Incomplete.: missing values 32'): @verify(CONTINUOUS) class Incomplete(Flag): FIRST = 4 SECOND = 8 THIRD = 16 FORTH = 64 # with self.assertRaisesRegex(ValueError, 'invalid flag .StillIncomplete.: missing values 16'): @verify(CONTINUOUS) class StillIncomplete(Flag): FIRST = 4 SECOND = 8 THIRD = 11 FORTH = 32 def test_composite(self): class Bizarre(Flag): b = 3 c = 4 d = 6 self.assertEqual(list(Bizarre), [Bizarre.c]) self.assertEqual(Bizarre.b.value, 3) self.assertEqual(Bizarre.c.value, 4) self.assertEqual(Bizarre.d.value, 6) with self.assertRaisesRegex( ValueError, "invalid Flag 'Bizarre': aliases b and d are missing combined values of 0x3 .use enum.show_flag_values.value. for details.", ): @verify(NAMED_FLAGS) class Bizarre(Flag): b = 3 c = 4 d = 6 # self.assertEqual(enum.show_flag_values(3), [1, 2]) class Bizarre(IntFlag): b = 3 c = 4 d = 6 self.assertEqual(list(Bizarre), [Bizarre.c]) self.assertEqual(Bizarre.b.value, 3) self.assertEqual(Bizarre.c.value, 4) self.assertEqual(Bizarre.d.value, 6) with self.assertRaisesRegex( ValueError, "invalid Flag 'Bizarre': alias d is missing value 0x2 .use enum.show_flag_values.value. for details.", ): @verify(NAMED_FLAGS) class Bizarre(IntFlag): c = 4 d = 6 self.assertEqual(enum.show_flag_values(2), [2]) def test_unique_clean(self): @verify(UNIQUE) class Clean(Enum): one = 1 two = 'dos' tres = 4.0 # @verify(UNIQUE) class Cleaner(IntEnum): single = 1 double = 2 triple = 3 def test_unique_dirty(self): with self.assertRaisesRegex(ValueError, 'tres.*one'): @verify(UNIQUE) class Dirty(Enum): one = 1 two = 'dos' tres = 1 with self.assertRaisesRegex( ValueError, 'double.*single.*turkey.*triple', ): @verify(UNIQUE) class Dirtier(IntEnum): single = 1 double = 1 triple = 3 turkey = 3 def test_unique_with_name(self): @verify(UNIQUE) class Silly(Enum): one = 1 two = 'dos' name = 3 # @verify(UNIQUE) class Sillier(IntEnum): single = 1 name = 2 triple = 3 value = 4 def test_negative_alias(self): @verify(NAMED_FLAGS) class Color(Flag): RED = 1 GREEN = 2 BLUE = 4 WHITE = -1 # no error means success self.assertEqual(list(Color.WHITE), [Color.RED, Color.GREEN, Color.BLUE]) self.assertEqual(Color.WHITE.value, 7) class TestInternals(unittest.TestCase): sunder_names = '_bad_', '_good_', '_what_ho_' dunder_names = '__mal__', '__bien__', '__que_que__' private_names = '_MyEnum__private', '_MyEnum__still_private' private_and_sunder_names = '_MyEnum__private_', '_MyEnum__also_private_' random_names = 'okay', '_semi_private', '_weird__', '_MyEnum__' def test_sunder(self): for name in self.sunder_names + self.private_and_sunder_names: self.assertTrue(enum._is_sunder(name), '%r is a not sunder name?' % name) for name in self.dunder_names + self.private_names + self.random_names: self.assertFalse(enum._is_sunder(name), '%r is a sunder name?' % name) def test_dunder(self): for name in self.dunder_names: self.assertTrue(enum._is_dunder(name), '%r is a not dunder name?' % name) for name in self.sunder_names + self.private_names + self.private_and_sunder_names + self.random_names: self.assertFalse(enum._is_dunder(name), '%r is a dunder name?' % name) def test_is_private(self): for name in self.private_names + self.private_and_sunder_names: self.assertTrue(enum._is_private('MyEnum', name), '%r is a not private name?') for name in self.sunder_names + self.dunder_names + self.random_names: self.assertFalse(enum._is_private('MyEnum', name), '%r is a private name?') def test_auto_number(self): class Color(Enum): red = auto() blue = auto() green = auto() self.assertEqual(list(Color), [Color.red, Color.blue, Color.green]) self.assertEqual(Color.red.value, 1) self.assertEqual(Color.blue.value, 2) self.assertEqual(Color.green.value, 3) def test_auto_name(self): class Color(Enum): def _generate_next_value_(name, start, count, last): return name red = auto() blue = auto() green = auto() self.assertEqual(list(Color), [Color.red, Color.blue, Color.green]) self.assertEqual(Color.red.value, 'red') self.assertEqual(Color.blue.value, 'blue') self.assertEqual(Color.green.value, 'green') def test_auto_name_inherit(self): class AutoNameEnum(Enum): def _generate_next_value_(name, start, count, last): return name class Color(AutoNameEnum): red = auto() blue = auto() green = auto() self.assertEqual(list(Color), [Color.red, Color.blue, Color.green]) self.assertEqual(Color.red.value, 'red') self.assertEqual(Color.blue.value, 'blue') self.assertEqual(Color.green.value, 'green') @unittest.skipIf( python_version >= (3, 13), 'mixed types with auto() no longer supported', ) def test_auto_garbage_ok(self): with self.assertWarnsRegex(DeprecationWarning, 'will require all values to be sortable'): class Color(Enum): red = 'red' blue = auto() self.assertEqual(Color.blue.value, 1) @unittest.skipIf( python_version >= (3, 13), 'mixed types with auto() no longer supported', ) def test_auto_garbage_corrected_ok(self): with self.assertWarnsRegex(DeprecationWarning, 'will require all values to be sortable'): class Color(Enum): red = 'red' blue = 2 green = auto() self.assertEqual(list(Color), [Color.red, Color.blue, Color.green]) self.assertEqual(Color.red.value, 'red') self.assertEqual(Color.blue.value, 2) self.assertEqual(Color.green.value, 3) @unittest.skipIf( python_version < (3, 13), 'mixed types with auto() will raise in 3.13', ) def test_auto_garbage_fail(self): with self.assertRaisesRegex(TypeError, "unable to increment 'red'"): class Color(Enum): red = 'red' blue = auto() @unittest.skipIf( python_version < (3, 13), 'mixed types with auto() will raise in 3.13', ) def test_auto_garbage_corrected_fail(self): with self.assertRaisesRegex(TypeError, 'unable to sort non-numeric values'): class Color(Enum): red = 'red' blue = 2 green = auto() def test_auto_order(self): with self.assertRaises(TypeError): class Color(Enum): red = auto() green = auto() blue = auto() def _generate_next_value_(name, start, count, last): return name def test_auto_order_weird(self): weird_auto = auto() weird_auto.value = 'pathological case' class Color(Enum): red = weird_auto def _generate_next_value_(name, start, count, last): return name blue = auto() self.assertEqual(list(Color), [Color.red, Color.blue]) self.assertEqual(Color.red.value, 'pathological case') self.assertEqual(Color.blue.value, 'blue') @unittest.skipIf( python_version < (3, 13), 'auto() will return highest value + 1 in 3.13', ) def test_auto_with_aliases(self): class Color(Enum): red = auto() blue = auto() oxford = blue crimson = red green = auto() self.assertIs(Color.crimson, Color.red) self.assertIs(Color.oxford, Color.blue) self.assertIsNot(Color.green, Color.red) self.assertIsNot(Color.green, Color.blue) def test_duplicate_auto(self): class Dupes(Enum): first = primero = auto() second = auto() third = auto() self.assertEqual([Dupes.first, Dupes.second, Dupes.third], list(Dupes)) def test_multiple_auto_on_line(self): class Huh(Enum): ONE = auto() TWO = auto(), auto() THREE = auto(), auto(), auto() self.assertEqual(Huh.ONE.value, 1) self.assertEqual(Huh.TWO.value, (2, 3)) self.assertEqual(Huh.THREE.value, (4, 5, 6)) # class Hah(Enum): def __new__(cls, value, abbr=None): member = object.__new__(cls) member._value_ = value member.abbr = abbr or value[:3].lower() return member def _generate_next_value_(name, start, count, last): return name # MONDAY = auto() TUESDAY = auto() WEDNESDAY = auto(), 'WED' THURSDAY = auto(), 'Thu' FRIDAY = auto() self.assertEqual(Hah.MONDAY.value, 'MONDAY') self.assertEqual(Hah.MONDAY.abbr, 'mon') self.assertEqual(Hah.TUESDAY.value, 'TUESDAY') self.assertEqual(Hah.TUESDAY.abbr, 'tue') self.assertEqual(Hah.WEDNESDAY.value, 'WEDNESDAY') self.assertEqual(Hah.WEDNESDAY.abbr, 'WED') self.assertEqual(Hah.THURSDAY.value, 'THURSDAY') self.assertEqual(Hah.THURSDAY.abbr, 'Thu') self.assertEqual(Hah.FRIDAY.value, 'FRIDAY') self.assertEqual(Hah.FRIDAY.abbr, 'fri') # class Huh(Enum): def _generate_next_value_(name, start, count, last): return count+1 ONE = auto() TWO = auto(), auto() THREE = auto(), auto(), auto() self.assertEqual(Huh.ONE.value, 1) self.assertEqual(Huh.TWO.value, (2, 2)) self.assertEqual(Huh.THREE.value, (3, 3, 3)) expected_help_output_with_docs = """\ Help on class Color in module %s: class Color(enum.Enum) | Color(*values) | | Method resolution order: | Color | enum.Enum | builtins.object | | Data and other attributes defined here: | | CYAN = <Color.CYAN: 1> | | MAGENTA = <Color.MAGENTA: 2> | | YELLOW = <Color.YELLOW: 3> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Static methods inherited from enum.EnumType: | | __contains__(value) | Return True if `value` is in `cls`. | | `value` is in `cls` if: | 1) `value` is a member of `cls`, or | 2) `value` is the value of one of the `cls`'s members. | 3) `value` is a pseudo-member (flags) | | __getitem__(name) | Return the member matching `name`. | | __iter__() | Return members in definition order. | | __len__() | Return the number of members (no aliases) | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumType: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping.""" expected_help_output_without_docs = """\ Help on class Color in module %s: class Color(enum.Enum) | Color(*values) | | Method resolution order: | Color | enum.Enum | builtins.object | | Data and other attributes defined here: | | CYAN = <Color.CYAN: 1> | | MAGENTA = <Color.MAGENTA: 2> | | YELLOW = <Color.YELLOW: 3> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | | value | | ---------------------------------------------------------------------- | Static methods inherited from enum.EnumType: | | __contains__(value) | | __getitem__(name) | | __iter__() | | __len__() | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumType: | | __members__""" class TestStdLib(unittest.TestCase): maxDiff = None class Color(Enum): CYAN = 1 MAGENTA = 2 YELLOW = 3 def test_pydoc(self): # indirectly test __objclass__ if StrEnum.__doc__ is None: expected_text = expected_help_output_without_docs % __name__ else: expected_text = expected_help_output_with_docs % __name__ output = StringIO() helper = pydoc.Helper(output=output) helper(self.Color) result = output.getvalue().strip() self.assertEqual(result, expected_text, result) def test_inspect_getmembers(self): values = dict(( ('__class__', EnumType), ('__doc__', '...'), ('__members__', self.Color.__members__), ('__module__', __name__), ('YELLOW', self.Color.YELLOW), ('MAGENTA', self.Color.MAGENTA), ('CYAN', self.Color.CYAN), ('name', Enum.__dict__['name']), ('value', Enum.__dict__['value']), ('__len__', self.Color.__len__), ('__contains__', self.Color.__contains__), ('__name__', 'Color'), ('__getitem__', self.Color.__getitem__), ('__qualname__', 'TestStdLib.Color'), ('__init_subclass__', getattr(self.Color, '__init_subclass__')), ('__iter__', self.Color.__iter__), )) result = dict(inspect.getmembers(self.Color)) self.assertEqual(set(values.keys()), set(result.keys())) failed = False for k in values.keys(): if k == '__doc__': # __doc__ is huge, not comparing continue if result[k] != values[k]: print() print('\n%s\n key: %s\n result: %s\nexpected: %s\n%s\n' % ('=' * 75, k, result[k], values[k], '=' * 75), sep='') failed = True if failed: self.fail("result does not equal expected, see print above") def test_inspect_classify_class_attrs(self): # indirectly test __objclass__ from inspect import Attribute values = [ Attribute(name='__class__', kind='data', defining_class=object, object=EnumType), Attribute(name='__contains__', kind='method', defining_class=EnumType, object=self.Color.__contains__), Attribute(name='__doc__', kind='data', defining_class=self.Color, object='...'), Attribute(name='__getitem__', kind='method', defining_class=EnumType, object=self.Color.__getitem__), Attribute(name='__iter__', kind='method', defining_class=EnumType, object=self.Color.__iter__), Attribute(name='__init_subclass__', kind='class method', defining_class=object, object=getattr(self.Color, '__init_subclass__')), Attribute(name='__len__', kind='method', defining_class=EnumType, object=self.Color.__len__), Attribute(name='__members__', kind='property', defining_class=EnumType, object=EnumType.__members__), Attribute(name='__module__', kind='data', defining_class=self.Color, object=__name__), Attribute(name='__name__', kind='data', defining_class=self.Color, object='Color'), Attribute(name='__qualname__', kind='data', defining_class=self.Color, object='TestStdLib.Color'), Attribute(name='YELLOW', kind='data', defining_class=self.Color, object=self.Color.YELLOW), Attribute(name='MAGENTA', kind='data', defining_class=self.Color, object=self.Color.MAGENTA), Attribute(name='CYAN', kind='data', defining_class=self.Color, object=self.Color.CYAN), Attribute(name='name', kind='data', defining_class=Enum, object=Enum.__dict__['name']), Attribute(name='value', kind='data', defining_class=Enum, object=Enum.__dict__['value']), ] for v in values: try: v.name except AttributeError: print(v) values.sort(key=lambda item: item.name) result = list(inspect.classify_class_attrs(self.Color)) result.sort(key=lambda item: item.name) self.assertEqual( len(values), len(result), "%s != %s" % ([a.name for a in values], [a.name for a in result]) ) failed = False for v, r in zip(values, result): if r.name in ('__init_subclass__', '__doc__'): # not sure how to make the __init_subclass_ Attributes match # so as long as there is one, call it good # __doc__ is too big to check exactly, so treat the same as __init_subclass__ for name in ('name','kind','defining_class'): if getattr(v, name) != getattr(r, name): print('\n%s\n%s\n%s\n%s\n' % ('=' * 75, r, v, '=' * 75), sep='') failed = True elif r != v: print('\n%s\n%s\n%s\n%s\n' % ('=' * 75, r, v, '=' * 75), sep='') failed = True if failed: self.fail("result does not equal expected, see print above") def test_inspect_signatures(self): from inspect import signature, Signature, Parameter self.assertEqual( signature(Enum), Signature([ Parameter('new_class_name', Parameter.POSITIONAL_ONLY), Parameter('names', Parameter.POSITIONAL_OR_KEYWORD), Parameter('module', Parameter.KEYWORD_ONLY, default=None), Parameter('qualname', Parameter.KEYWORD_ONLY, default=None), Parameter('type', Parameter.KEYWORD_ONLY, default=None), Parameter('start', Parameter.KEYWORD_ONLY, default=1), Parameter('boundary', Parameter.KEYWORD_ONLY, default=None), ]), ) self.assertEqual( signature(enum.FlagBoundary), Signature([ Parameter('values', Parameter.VAR_POSITIONAL), ]), ) def test_test_simple_enum(self): @_simple_enum(Enum) class SimpleColor: CYAN = 1 MAGENTA = 2 YELLOW = 3 @bltns.property def zeroth(self): return 'zeroed %s' % self.name class CheckedColor(Enum): CYAN = 1 MAGENTA = 2 YELLOW = 3 @bltns.property def zeroth(self): return 'zeroed %s' % self.name _test_simple_enum(CheckedColor, SimpleColor) SimpleColor.MAGENTA._value_ = 9 self.assertRaisesRegex( TypeError, "enum mismatch", _test_simple_enum, CheckedColor, SimpleColor, ) # # class CheckedMissing(IntFlag, boundary=KEEP): SIXTY_FOUR = 64 ONE_TWENTY_EIGHT = 128 TWENTY_FORTY_EIGHT = 2048 ALL = 2048 + 128 + 64 + 12 CM = CheckedMissing self.assertEqual(list(CheckedMissing), [CM.SIXTY_FOUR, CM.ONE_TWENTY_EIGHT, CM.TWENTY_FORTY_EIGHT]) # @_simple_enum(IntFlag, boundary=KEEP) class Missing: SIXTY_FOUR = 64 ONE_TWENTY_EIGHT = 128 TWENTY_FORTY_EIGHT = 2048 ALL = 2048 + 128 + 64 + 12 M = Missing self.assertEqual(list(CheckedMissing), [M.SIXTY_FOUR, M.ONE_TWENTY_EIGHT, M.TWENTY_FORTY_EIGHT]) _test_simple_enum(CheckedMissing, Missing) # # class CheckedUnhashable(Enum): ONE = dict() TWO = set() name = 'python' self.assertIn(dict(), CheckedUnhashable) self.assertIn('python', CheckedUnhashable) self.assertEqual(CheckedUnhashable.name.value, 'python') self.assertEqual(CheckedUnhashable.name.name, 'name') # @_simple_enum() class Unhashable: ONE = dict() TWO = set() name = 'python' self.assertIn(dict(), Unhashable) self.assertIn('python', Unhashable) self.assertEqual(Unhashable.name.value, 'python') self.assertEqual(Unhashable.name.name, 'name') _test_simple_enum(CheckedUnhashable, Unhashable) ## class CheckedComplexStatus(IntEnum): def __new__(cls, value, phrase, description=''): obj = int.__new__(cls, value) obj._value_ = value obj.phrase = phrase obj.description = description return obj CONTINUE = 100, 'Continue', 'Request received, please continue' PROCESSING = 102, 'Processing' EARLY_HINTS = 103, 'Early Hints' SOME_HINTS = 103, 'Some Early Hints' # @_simple_enum(IntEnum) class ComplexStatus: def __new__(cls, value, phrase, description=''): obj = int.__new__(cls, value) obj._value_ = value obj.phrase = phrase obj.description = description return obj CONTINUE = 100, 'Continue', 'Request received, please continue' PROCESSING = 102, 'Processing' EARLY_HINTS = 103, 'Early Hints' SOME_HINTS = 103, 'Some Early Hints' _test_simple_enum(CheckedComplexStatus, ComplexStatus) # # class CheckedComplexFlag(IntFlag): def __new__(cls, value, label): obj = int.__new__(cls, value) obj._value_ = value obj.label = label return obj SHIRT = 1, 'upper half' VEST = 1, 'outer upper half' PANTS = 2, 'lower half' self.assertIs(CheckedComplexFlag.SHIRT, CheckedComplexFlag.VEST) # @_simple_enum(IntFlag) class ComplexFlag: def __new__(cls, value, label): obj = int.__new__(cls, value) obj._value_ = value obj.label = label return obj SHIRT = 1, 'upper half' VEST = 1, 'uppert half' PANTS = 2, 'lower half' _test_simple_enum(CheckedComplexFlag, ComplexFlag) class MiscTestCase(unittest.TestCase): def test__all__(self): support.check__all__(self, enum) @cpython_only def test_lazy_import(self): ensure_lazy_imports("enum", {"functools", "warnings", "inspect", "re"}) def test_doc_1(self): class Single(Enum): ONE = 1 self.assertEqual(Single.__doc__, None) def test_doc_2(self): class Double(Enum): ONE = 1 TWO = 2 self.assertEqual(Double.__doc__, None) def test_doc_3(self): class Triple(Enum): ONE = 1 TWO = 2 THREE = 3 self.assertEqual(Triple.__doc__, None) def test_doc_4(self): class Quadruple(Enum): ONE = 1 TWO = 2 THREE = 3 FOUR = 4 self.assertEqual(Quadruple.__doc__, None) # These are unordered here on purpose to ensure that declaration order # makes no difference. CONVERT_TEST_NAME_D = 5 CONVERT_TEST_NAME_C = 5 CONVERT_TEST_NAME_B = 5 CONVERT_TEST_NAME_A = 5 # This one should sort first. CONVERT_TEST_NAME_E = 5 CONVERT_TEST_NAME_F = 5 CONVERT_STRING_TEST_NAME_D = 5 CONVERT_STRING_TEST_NAME_C = 5 CONVERT_STRING_TEST_NAME_B = 5 CONVERT_STRING_TEST_NAME_A = 5 # This one should sort first. CONVERT_STRING_TEST_NAME_E = 5 CONVERT_STRING_TEST_NAME_F = 5 # global names for StrEnum._convert_ test CONVERT_STR_TEST_2 = 'goodbye' CONVERT_STR_TEST_1 = 'hello' # We also need values that cannot be compared: UNCOMPARABLE_A = 5 UNCOMPARABLE_C = (9, 1) # naming order is broken on purpose UNCOMPARABLE_B = 'value' COMPLEX_C = 1j COMPLEX_A = 2j COMPLEX_B = 3j class TestConvert(unittest.TestCase): def tearDown(self): # Reset the module-level test variables to their original integer # values, otherwise the already created enum values get converted # instead. g = globals() for suffix in ['A', 'B', 'C', 'D', 'E', 'F']: g['CONVERT_TEST_NAME_%s' % suffix] = 5 g['CONVERT_STRING_TEST_NAME_%s' % suffix] = 5 for suffix, value in (('A', 5), ('B', (9, 1)), ('C', 'value')): g['UNCOMPARABLE_%s' % suffix] = value for suffix, value in (('A', 2j), ('B', 3j), ('C', 1j)): g['COMPLEX_%s' % suffix] = value for suffix, value in (('1', 'hello'), ('2', 'goodbye')): g['CONVERT_STR_TEST_%s' % suffix] = value def test_convert_value_lookup_priority(self): test_type = enum.IntEnum._convert_( 'UnittestConvert', MODULE, filter=lambda x: x.startswith('CONVERT_TEST_')) # We don't want the reverse lookup value to vary when there are # multiple possible names for a given value. It should always # report the first lexicographical name in that case. self.assertEqual(test_type(5).name, 'CONVERT_TEST_NAME_A') def test_convert_int(self): test_type = enum.IntEnum._convert_( 'UnittestConvert', MODULE, filter=lambda x: x.startswith('CONVERT_TEST_')) # Ensure that test_type has all of the desired names and values. self.assertEqual(test_type.CONVERT_TEST_NAME_F, test_type.CONVERT_TEST_NAME_A) self.assertEqual(test_type.CONVERT_TEST_NAME_B, 5) self.assertEqual(test_type.CONVERT_TEST_NAME_C, 5) self.assertEqual(test_type.CONVERT_TEST_NAME_D, 5) self.assertEqual(test_type.CONVERT_TEST_NAME_E, 5) # Ensure that test_type only picked up names matching the filter. extra = [name for name in dir(test_type) if name not in enum_dir(test_type)] missing = [name for name in enum_dir(test_type) if name not in dir(test_type)] self.assertEqual( extra + missing, [], msg='extra names: %r; missing names: %r' % (extra, missing), ) def test_convert_uncomparable(self): uncomp = enum.Enum._convert_( 'Uncomparable', MODULE, filter=lambda x: x.startswith('UNCOMPARABLE_')) # Should be ordered by `name` only: self.assertEqual( list(uncomp), [uncomp.UNCOMPARABLE_A, uncomp.UNCOMPARABLE_B, uncomp.UNCOMPARABLE_C], ) def test_convert_complex(self): uncomp = enum.Enum._convert_( 'Uncomparable', MODULE, filter=lambda x: x.startswith('COMPLEX_')) # Should be ordered by `name` only: self.assertEqual( list(uncomp), [uncomp.COMPLEX_A, uncomp.COMPLEX_B, uncomp.COMPLEX_C], ) def test_convert_str(self): test_type = enum.StrEnum._convert_( 'UnittestConvert', MODULE, filter=lambda x: x.startswith('CONVERT_STR_'), as_global=True) # Ensure that test_type has all of the desired names and values. self.assertEqual(test_type.CONVERT_STR_TEST_1, 'hello') self.assertEqual(test_type.CONVERT_STR_TEST_2, 'goodbye') # Ensure that test_type only picked up names matching the filter. extra = [name for name in dir(test_type) if name not in enum_dir(test_type)] missing = [name for name in enum_dir(test_type) if name not in dir(test_type)] self.assertEqual( extra + missing, [], msg='extra names: %r; missing names: %r' % (extra, missing), ) self.assertEqual(repr(test_type.CONVERT_STR_TEST_1), '%s.CONVERT_STR_TEST_1' % SHORT_MODULE) self.assertEqual(str(test_type.CONVERT_STR_TEST_2), 'goodbye') self.assertEqual(format(test_type.CONVERT_STR_TEST_1), 'hello') def test_convert_raise(self): with self.assertRaises(AttributeError): enum.IntEnum._convert( 'UnittestConvert', MODULE, filter=lambda x: x.startswith('CONVERT_TEST_')) def test_convert_repr_and_str(self): test_type = enum.IntEnum._convert_( 'UnittestConvert', MODULE, filter=lambda x: x.startswith('CONVERT_STRING_TEST_'), as_global=True) self.assertEqual(repr(test_type.CONVERT_STRING_TEST_NAME_A), '%s.CONVERT_STRING_TEST_NAME_A' % SHORT_MODULE) self.assertEqual(str(test_type.CONVERT_STRING_TEST_NAME_A), '5') self.assertEqual(format(test_type.CONVERT_STRING_TEST_NAME_A), '5') class TestEnumDict(unittest.TestCase): def test_enum_dict_in_metaclass(self): """Test that EnumDict is usable as a class namespace""" class Meta(type): @classmethod def __prepare__(metacls, cls, bases, **kwds): return EnumDict(cls) class MyClass(metaclass=Meta): a = 1 with self.assertRaises(TypeError): a = 2 # duplicate with self.assertRaises(ValueError): _a_sunder_ = 3 def test_enum_dict_standalone(self): """Test that EnumDict is usable on its own""" enumdict = EnumDict() enumdict['a'] = 1 with self.assertRaises(TypeError): enumdict['a'] = 'other value' # Only MutableMapping interface is overridden for now. # If this stops passing, update the documentation. enumdict |= {'a': 'other value'} self.assertEqual(enumdict['a'], 'other value') # helpers def enum_dir(cls): if issubclass(cls, Flag): members = list(cls._member_map_.keys()) else: members = cls._member_names_ interesting = set([ '__class__', '__contains__', '__doc__', '__getitem__', '__iter__', '__len__', '__members__', '__module__', '__name__', '__qualname__', ] + members ) if cls._new_member_ is not object.__new__: interesting.add('__new__') if cls.__init_subclass__ is not object.__init_subclass__: interesting.add('__init_subclass__') if cls._member_type_ is object: return sorted(interesting) else: # return whatever mixed-in data type has return sorted(set(dir(cls._member_type_)) | interesting) def member_dir(member): if member.__class__._member_type_ is object: allowed = set(['__class__', '__doc__', '__eq__', '__hash__', '__module__', 'name', 'value']) else: allowed = set(dir(member)) for cls in member.__class__.mro(): for name, obj in cls.__dict__.items(): if name[0] == '_': continue if isinstance(obj, enum.property): if obj.fget is not None or name not in member._member_map_: allowed.add(name) else: allowed.discard(name) elif name not in member._member_map_: allowed.add(name) return sorted(allowed) if __name__ == '__main__': unittest.main()
python
github
https://github.com/python/cpython
Lib/test/test_enum.py
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # Indico is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Indico; if not, see <http://www.gnu.org/licenses/>. import logging import errno import urlparse import os import signal import socket import sys import werkzeug.serving from flask import current_app from flask_script import Command, Option from werkzeug.contrib.fixers import ProxyFix from werkzeug.debug import DebuggedApplication from werkzeug.exceptions import NotFound from werkzeug.serving import WSGIRequestHandler from werkzeug.wsgi import DispatcherMiddleware, SharedDataMiddleware from indico.core.config import Config from indico.core.logger import Logger from indico.util import console try: from OpenSSL import SSL except ImportError: SSL = None class IndicoDevServer(Command): """Runs the Flask development server""" def get_options(self): return ( Option('--logging', action='store', help='display logging messages for specified level'), Option('--host', help='use a different host than the one in indico.conf'), Option('--port', type=int, help='use a different port than the one in indico.conf'), Option('--keep-base-url', action='store_true', help='do not update the base url with the given host/port'), Option('--with-ssl', action='store_true', help='enable ssl support for web server'), Option('--ssl-key', help='path to the ssl private key file'), Option('--ssl-cert', help='path to the ssl certificate file'), Option('--disable-reloader', action='store_true', help='restart the server whenever a file changes (does not work for legacy code)'), Option('--enable-evalex', action='store_true', help="enable the werkzeug debugger's python shell in tracebacks and via /console)"), Option('--evalex-from', action='append', metavar='IP', help="restricts the evalex shell to the given ips (can be used multiple times)"), Option('--quiet', action='store_true', help="don't log successful requests for common static files") ) def run(self, **args): if args['logging']: setup_logging(args['logging']) app = current_app._get_current_object() start_web_server(app, host=args['host'], port=args['port'], keep_base_url=args['keep_base_url'], with_ssl=args['with_ssl'], ssl_cert=args['ssl_cert'], ssl_key=args['ssl_key'], enable_evalex=args['enable_evalex'], evalex_from=args['evalex_from'], reload_on_change=not args['disable_reloader'], quiet=args['quiet']) def make_indico_dispatcher(wsgi_app): config = Config.getInstance() baseURL = config.getBaseURL() path = urlparse.urlparse(baseURL)[2].rstrip('/') if not path: # Nothing to dispatch return wsgi_app else: return DispatcherMiddleware(NotFound(), { path: wsgi_app }) class DebuggedIndico(DebuggedApplication): def __init__(self, *args, **kwargs): self._evalex_whitelist = None self._request_ip = None super(DebuggedIndico, self).__init__(*args, **kwargs) @property def evalex(self): if not self._evalex_whitelist: return False elif self._evalex_whitelist is True: # explicitly check against True! return True else: return self._request_ip in self._evalex_whitelist @evalex.setter def evalex(self, value): self._evalex_whitelist = value def __call__(self, environ, start_response): self._request_ip = environ['REMOTE_ADDR'] return super(DebuggedIndico, self).__call__(environ, start_response) class QuietWSGIRequestHandler(WSGIRequestHandler): INDICO_URL_PREFIX = '' # set from outside based on BaseURL IGNORED_PATH_PREFIXES = {'/vars.js', '/js/', '/css/', '/static/', '/images/'} def log_request(self, code='-', size='-'): if code not in (304, 200): super(QuietWSGIRequestHandler, self).log_request(code, size) elif '?__debugger__=yes&cmd=resource' in self.path: pass # don't log debugger resources, they are quite uninteresting elif not any(self.path.startswith(self.INDICO_URL_PREFIX + x) for x in self.IGNORED_PATH_PREFIXES): super(QuietWSGIRequestHandler, self).log_request(code, size) class WerkzeugServer(object): def __init__(self, app, host='localhost', port=8000, enable_ssl=False, ssl_key=None, ssl_cert=None, reload_on_change=False, use_debugger=True, evalex_whitelist=None, quiet=False): """ Run an Indico server based on the Werkzeug server """ if not SSL and enable_ssl: console.error('You need pyopenssl to use SSL') sys.exit(1) self.app = app self.host = host self.port = port self.ssl = enable_ssl self.ssl_key = ssl_key self.ssl_cert = ssl_cert self.reload_on_change = reload_on_change self.use_debugger = use_debugger self.evalex_whitelist = evalex_whitelist self.quiet = quiet logger = logging.getLogger('werkzeug') logger.setLevel(logging.DEBUG) logger.addHandler(logging.StreamHandler(sys.stderr)) self._setup_ssl() self._server = None def _setup_ssl(self): if not self.ssl: self.ssl_context = None elif not self.ssl_cert and not self.ssl_key: self.ssl_context = 'adhoc' else: self.ssl_context = (self.ssl_cert, self.ssl_key) def make_server(self): assert self._server is None app = self.app if self.use_debugger: app = DebuggedIndico(app, self.evalex_whitelist) if Config.getInstance().getUseProxy(): # this applies ProxyFix a second time (it's also done in configure_app), # but the debugger MUST receive the proper ip address or evalex ip restrictions # might not work as expected app = ProxyFix(app) self._server = werkzeug.serving.make_server(self.host, self.port, app, threaded=True, request_handler=QuietWSGIRequestHandler if self.quiet else None, ssl_context=self.ssl_context) self.addr = self._server.socket.getsockname()[:2] return self._server def _test_socket(self): # Create and destroy a socket so that any exceptions are raised before # we spawn a separate Python interpreter and lose this ability. # (taken from werkzeug.serving.run_simple) address_family = werkzeug.serving.select_ip_version(self.host, self.port) test_socket = socket.socket(address_family, socket.SOCK_STREAM) test_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) test_socket.bind((self.host, self.port)) test_socket.close() def _run_new_server(self): # The werkzeug reloader needs a callable which creates and starts a new server self.make_server().serve_forever() def _display_host(self): if os.environ.get('WERKZEUG_RUN_MAIN') != 'true': display_hostname = self.host != '*' and self.host or 'localhost' if ':' in display_hostname: display_hostname = '[%s]' % display_hostname proto = 'https' if self.ssl_context else 'http' console.info(' * Running on {0}://{1}:{2}'.format(proto, display_hostname, self.port)) if self.evalex_whitelist: console.info(' * Werkzeug debugger console on {0}://{1}:{2}/console'.format(proto, display_hostname, self.port)) if self.evalex_whitelist is True: # explicitly check against True! console.warning(' * Werkzeug debugger console is available to all clients') def run(self): self._display_host() if not self.reload_on_change: if self._server is None: self.make_server() self._server.serve_forever() else: assert self._server is None # otherwise the socket is already bound self._test_socket() cfg_dir = Config.getInstance().getConfigurationDir() extra_files = [os.path.join(cfg_dir, name) for name in ('logging.conf', 'indico.conf')] werkzeug.serving.run_with_reloader(self._run_new_server, extra_files) def _can_bind_port(port): s = socket.socket() try: s.bind(('', port)) except socket.error, e: if e.errno == errno.EACCES: return False s.close() return True def _sigint(sig, frame): print # Sometimes a request hangs and prevents the interpreter from exiting. # By setting an 1-second alarm we avoid this if hasattr(signal, 'alarm'): signal.alarm(1) sys.exit(0) def setup_logging(level): formatter = logging.Formatter('%(asctime)s %(name)-16s: %(levelname)-8s - %(message)s') logger = Logger.get() handler = logging.StreamHandler() handler.setLevel(getattr(logging, level)) handler.setFormatter(formatter) logger.addHandler(handler) def start_web_server(app, host='localhost', port=0, with_ssl=False, keep_base_url=True, ssl_cert=None, ssl_key=None, reload_on_change=False, enable_evalex=False, evalex_from=None, quiet=False): config = Config.getInstance() # Let Indico know that we are using the embedded server. This causes it to re-raise exceptions so they # end up in the Werkzeug debugger. config._configVars['EmbeddedWebserver'] = True # We obviously do not have X-Sendfile or X-Accel-Redirect support in the embedded server config._configVars['StaticFileMethod'] = None # Get appropriate base url and defaults base_url = config.getBaseSecureURL() if with_ssl else config.getBaseURL() if not base_url: base_url = config.getBaseURL() or 'http://localhost' if with_ssl: port = 443 console.warning(' * You should set {0}; retrieving host information from {1}'.format( 'BaseSecureURL' if with_ssl else 'BaseURL', base_url) ) default_port = 443 if with_ssl else 80 url_data = urlparse.urlparse(base_url) # commandline data has priority, fallback to data from base url (or default in case of port) host = host or url_data.netloc.partition(':')[0] requested_port = used_port = port or url_data.port or default_port # Don't let people bind on a port they cannot use. if used_port < 1024 and not _can_bind_port(used_port): used_port += 8000 console.warning(' * You cannot open a socket on port {}, using {} instead.'.format(requested_port, used_port)) # By default we update the base URL with the actual host/port. The user has the option to # disable this though in case he wants different values, e.g. to use iptables to make his # development server available via port 443 while listening on a non-privileged port: # iptables -t nat -A PREROUTING -d YOURIP/32 -p tcp -m tcp --dport 443 -j REDIRECT --to-port 8443 if not keep_base_url: scheme = 'https' if with_ssl else 'http' netloc = host if used_port != default_port: netloc += ':%d' % used_port base_url = '{0}://{1}{2}'.format(scheme, netloc, url_data.path) # However, if we had to change the port to avoid a permission issue we always rewrite BaseURL. # In this case it is somewhat safe to assume that the user is not actually trying to use the iptables hack # mentioned above but simply did not consider using a non-privileged port. elif requested_port != used_port: netloc = '{0}:{1}'.format(url_data.netloc.partition(':')[0], used_port) base_url = '{0}://{1}{2}'.format(url_data.scheme, netloc, url_data.path) # We update both BaseURL and BaseSecureURL to something that actually works. # In case of SSL-only we need both URLs to be set to the same SSL url to prevent some stuff being "loaded" # from an URL that is not available. # In case of not using SSL we clear the BaseSecureURL so the user does not need to update the config during # development if he needs to disable SSL for some reason. if with_ssl: config._configVars['BaseURL'] = base_url config._configVars['BaseSecureURL'] = base_url else: config._configVars['BaseURL'] = base_url config._configVars['BaseSecureURL'] = '' config._deriveOptions() if not enable_evalex: evalex_whitelist = False elif evalex_from: evalex_whitelist = evalex_from else: evalex_whitelist = True console.info(' * Using BaseURL {0}'.format(base_url)) app.wsgi_app = make_indico_dispatcher(app.wsgi_app) app.wsgi_app = SharedDataMiddleware(app.wsgi_app, { '/htmlcov': os.path.join(app.root_path, '..', 'htmlcov') }, cache=False) QuietWSGIRequestHandler.INDICO_URL_PREFIX = url_data.path.rstrip('/') server = WerkzeugServer(app, host, used_port, reload_on_change=reload_on_change, evalex_whitelist=evalex_whitelist, enable_ssl=with_ssl, ssl_cert=ssl_cert, ssl_key=ssl_key, quiet=quiet) signal.signal(signal.SIGINT, _sigint) server.run()
unknown
codeparrot/codeparrot-clean
"""Implements nose test program and collector. """ from __future__ import generators import logging import os import sys import time import unittest from nose.config import Config, all_config_files from nose.loader import defaultTestLoader from nose.plugins.manager import PluginManager, DefaultPluginManager, \ RestrictedPluginManager from nose.result import TextTestResult from nose.suite import FinalizingSuiteWrapper from nose.util import isclass, tolist log = logging.getLogger('nose.core') compat_24 = sys.version_info >= (2, 4) __all__ = ['TestProgram', 'main', 'run', 'run_exit', 'runmodule', 'collector', 'TextTestRunner'] class TextTestRunner(unittest.TextTestRunner): """Test runner that uses nose's TextTestResult to enable errorClasses, as well as providing hooks for plugins to override or replace the test output stream, results, and the test case itself. """ def __init__(self, stream=sys.stderr, descriptions=1, verbosity=1, config=None): if config is None: config = Config() self.config = config unittest.TextTestRunner.__init__(self, stream, descriptions, verbosity) def _makeResult(self): return TextTestResult(self.stream, self.descriptions, self.verbosity, self.config) def run(self, test): """Overrides to provide plugin hooks and defer all output to the test result class. """ wrapper = self.config.plugins.prepareTest(test) if wrapper is not None: test = wrapper # plugins can decorate or capture the output stream wrapped = self.config.plugins.setOutputStream(self.stream) if wrapped is not None: self.stream = wrapped result = self._makeResult() start = time.time() try: test(result) except KeyboardInterrupt: pass stop = time.time() result.printErrors() result.printSummary(start, stop) self.config.plugins.finalize(result) return result class TestProgram(unittest.TestProgram): """Collect and run tests, returning success or failure. The arguments to TestProgram() are the same as to :func:`main()` and :func:`run()`: * module: All tests are in this module (default: None) * defaultTest: Tests to load (default: '.') * argv: Command line arguments (default: None; sys.argv is read) * testRunner: Test runner instance (default: None) * testLoader: Test loader instance (default: None) * env: Environment; ignored if config is provided (default: None; os.environ is read) * config: :class:`nose.config.Config` instance (default: None) * suite: Suite or list of tests to run (default: None). Passing a suite or lists of tests will bypass all test discovery and loading. *ALSO NOTE* that if you pass a unittest.TestSuite instance as the suite, context fixtures at the class, module and package level will not be used, and many plugin hooks will not be called. If you want normal nose behavior, either pass a list of tests, or a fully-configured :class:`nose.suite.ContextSuite`. * exit: Exit after running tests and printing report (default: True) * plugins: List of plugins to use; ignored if config is provided (default: load plugins with DefaultPluginManager) * addplugins: List of **extra** plugins to use. Pass a list of plugin instances in this argument to make custom plugins available while still using the DefaultPluginManager. """ verbosity = 1 def __init__(self, module=None, defaultTest='.', argv=None, testRunner=None, testLoader=None, env=None, config=None, suite=None, exit=True, plugins=None, addplugins=None): if env is None: env = os.environ if config is None: config = self.makeConfig(env, plugins) if addplugins: config.plugins.addPlugins(extraplugins=addplugins) self.config = config self.suite = suite self.exit = exit extra_args = {} version = sys.version_info[0:2] if version >= (2,7) and version != (3,0): extra_args['exit'] = exit unittest.TestProgram.__init__( self, module=module, defaultTest=defaultTest, argv=argv, testRunner=testRunner, testLoader=testLoader, **extra_args) def getAllConfigFiles(self, env=None): env = env or {} if env.get('NOSE_IGNORE_CONFIG_FILES', False): return [] else: return all_config_files() def makeConfig(self, env, plugins=None): """Load a Config, pre-filled with user config files if any are found. """ cfg_files = self.getAllConfigFiles(env) if plugins: manager = PluginManager(plugins=plugins) else: manager = DefaultPluginManager() return Config( env=env, files=cfg_files, plugins=manager) def parseArgs(self, argv): """Parse argv and env and configure running environment. """ self.config.configure(argv, doc=self.usage()) log.debug("configured %s", self.config) # quick outs: version, plugins (optparse would have already # caught and exited on help) if self.config.options.version: from nose import __version__ sys.stdout = sys.__stdout__ print "%s version %s" % (os.path.basename(sys.argv[0]), __version__) sys.exit(0) if self.config.options.showPlugins: self.showPlugins() sys.exit(0) if self.testLoader is None: self.testLoader = defaultTestLoader(config=self.config) elif isclass(self.testLoader): self.testLoader = self.testLoader(config=self.config) plug_loader = self.config.plugins.prepareTestLoader(self.testLoader) if plug_loader is not None: self.testLoader = plug_loader log.debug("test loader is %s", self.testLoader) # FIXME if self.module is a string, add it to self.testNames? not sure if self.config.testNames: self.testNames = self.config.testNames else: self.testNames = tolist(self.defaultTest) log.debug('defaultTest %s', self.defaultTest) log.debug('Test names are %s', self.testNames) if self.config.workingDir is not None: os.chdir(self.config.workingDir) self.createTests() def createTests(self): """Create the tests to run. If a self.suite is set, then that suite will be used. Otherwise, tests will be loaded from the given test names (self.testNames) using the test loader. """ log.debug("createTests called with %s", self.suite) if self.suite is not None: # We were given an explicit suite to run. Make sure it's # loaded and wrapped correctly. self.test = self.testLoader.suiteClass(self.suite) else: self.test = self.testLoader.loadTestsFromNames(self.testNames) def runTests(self): """Run Tests. Returns true on success, false on failure, and sets self.success to the same value. """ log.debug("runTests called") if self.testRunner is None: self.testRunner = TextTestRunner(stream=self.config.stream, verbosity=self.config.verbosity, config=self.config) plug_runner = self.config.plugins.prepareTestRunner(self.testRunner) if plug_runner is not None: self.testRunner = plug_runner result = self.testRunner.run(self.test) self.success = result.wasSuccessful() if self.exit: sys.exit(not self.success) return self.success def showPlugins(self): """Print list of available plugins. """ import textwrap class DummyParser: def __init__(self): self.options = [] def add_option(self, *arg, **kw): self.options.append((arg, kw.pop('help', ''))) v = self.config.verbosity self.config.plugins.sort() for p in self.config.plugins: print "Plugin %s" % p.name if v >= 2: print " score: %s" % p.score print '\n'.join(textwrap.wrap(p.help().strip(), initial_indent=' ', subsequent_indent=' ')) if v >= 3: parser = DummyParser() p.addOptions(parser) if len(parser.options): print print " Options:" for opts, help in parser.options: print ' %s' % (', '.join(opts)) if help: print '\n'.join( textwrap.wrap(help.strip(), initial_indent=' ', subsequent_indent=' ')) print def usage(cls): import nose try: ld = nose.__loader__ text = ld.get_data(os.path.join( os.path.dirname(__file__), 'usage.txt')) except AttributeError: f = open(os.path.join( os.path.dirname(__file__), 'usage.txt'), 'r') try: text = f.read() finally: f.close() # Ensure that we return str, not bytes. if not isinstance(text, str): text = text.decode('utf-8') return text usage = classmethod(usage) # backwards compatibility run_exit = main = TestProgram def run(*arg, **kw): """Collect and run tests, returning success or failure. The arguments to `run()` are the same as to `main()`: * module: All tests are in this module (default: None) * defaultTest: Tests to load (default: '.') * argv: Command line arguments (default: None; sys.argv is read) * testRunner: Test runner instance (default: None) * testLoader: Test loader instance (default: None) * env: Environment; ignored if config is provided (default: None; os.environ is read) * config: :class:`nose.config.Config` instance (default: None) * suite: Suite or list of tests to run (default: None). Passing a suite or lists of tests will bypass all test discovery and loading. *ALSO NOTE* that if you pass a unittest.TestSuite instance as the suite, context fixtures at the class, module and package level will not be used, and many plugin hooks will not be called. If you want normal nose behavior, either pass a list of tests, or a fully-configured :class:`nose.suite.ContextSuite`. * plugins: List of plugins to use; ignored if config is provided (default: load plugins with DefaultPluginManager) * addplugins: List of **extra** plugins to use. Pass a list of plugin instances in this argument to make custom plugins available while still using the DefaultPluginManager. With the exception that the ``exit`` argument is always set to False. """ kw['exit'] = False return TestProgram(*arg, **kw).success def runmodule(name='__main__', **kw): """Collect and run tests in a single module only. Defaults to running tests in __main__. Additional arguments to TestProgram may be passed as keyword arguments. """ main(defaultTest=name, **kw) def collector(): """TestSuite replacement entry point. Use anywhere you might use a unittest.TestSuite. The collector will, by default, load options from all config files and execute loader.loadTestsFromNames() on the configured testNames, or '.' if no testNames are configured. """ # plugins that implement any of these methods are disabled, since # we don't control the test runner and won't be able to run them # finalize() is also not called, but plugins that use it aren't disabled, # because capture needs it. setuptools_incompat = ('report', 'prepareTest', 'prepareTestLoader', 'prepareTestRunner', 'setOutputStream') plugins = RestrictedPluginManager(exclude=setuptools_incompat) conf = Config(files=all_config_files(), plugins=plugins) conf.configure(argv=['collector']) loader = defaultTestLoader(conf) if conf.testNames: suite = loader.loadTestsFromNames(conf.testNames) else: suite = loader.loadTestsFromNames(('.',)) return FinalizingSuiteWrapper(suite, plugins.finalize) if __name__ == '__main__': main()
unknown
codeparrot/codeparrot-clean
// Copyright IBM Corp. 2016, 2025 // SPDX-License-Identifier: MPL-2.0 //go:build !enterprise package dbplugin import ( "github.com/hashicorp/vault/sdk/database/dbplugin/v5/proto" ) var _ proto.DatabaseClient = fakeClient{} type fakeClient struct { initResp *proto.InitializeResponse initErr error newUserResp *proto.NewUserResponse newUserErr error updateUserResp *proto.UpdateUserResponse updateUserErr error deleteUserResp *proto.DeleteUserResponse deleteUserErr error typeResp *proto.TypeResponse typeErr error closeErr error }
go
github
https://github.com/hashicorp/vault
sdk/database/dbplugin/v5/grpc_client_oss_test.go
import json from django import shortcuts from django.contrib import messages from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse from django.http import HttpResponse from django.shortcuts import redirect from django.template import RequestContext from django.template.loader import render_to_string from django.utils.http import is_safe_url from django.utils.translation import ugettext_lazy as _ from django.views.generic import FormView, View from extra_views import ModelFormSetView from oscar.apps.basket import signals from oscar.core import ajax from oscar.core.loading import get_class, get_classes, get_model from oscar.core.utils import redirect_to_referrer, safe_referrer Applicator = get_class('offer.utils', 'Applicator') (BasketLineFormSet, BasketLineForm, AddToBasketForm, BasketVoucherForm, SavedLineFormSet, SavedLineForm) \ = get_classes('basket.forms', ('BasketLineFormSet', 'BasketLineForm', 'AddToBasketForm', 'BasketVoucherForm', 'SavedLineFormSet', 'SavedLineForm')) Repository = get_class('shipping.repository', ('Repository')) OrderTotalCalculator = get_class( 'checkout.calculators', 'OrderTotalCalculator') BasketMessageGenerator = get_class('basket.utils', 'BasketMessageGenerator') class BasketView(ModelFormSetView): model = get_model('basket', 'Line') basket_model = get_model('basket', 'Basket') formset_class = BasketLineFormSet form_class = BasketLineForm extra = 0 can_delete = True template_name = 'basket/basket.html' def get_formset_kwargs(self): kwargs = super(BasketView, self).get_formset_kwargs() kwargs['strategy'] = self.request.strategy return kwargs def get_queryset(self): return self.request.basket.all_lines() def get_shipping_methods(self, basket): return Repository().get_shipping_methods( basket=self.request.basket, user=self.request.user, request=self.request) def get_default_shipping_method(self, basket): return Repository().get_default_shipping_method( basket=self.request.basket, user=self.request.user, request=self.request) def get_basket_warnings(self, basket): """ Return a list of warnings that apply to this basket """ warnings = [] for line in basket.all_lines(): warning = line.get_warning() if warning: warnings.append(warning) return warnings def get_upsell_messages(self, basket): offers = Applicator().get_offers(basket, self.request.user, self.request) applied_offers = list(basket.offer_applications.offers.values()) msgs = [] for offer in offers: if offer.is_condition_partially_satisfied(basket) \ and offer not in applied_offers: data = { 'message': offer.get_upsell_message(basket), 'offer': offer} msgs.append(data) return msgs def get_basket_voucher_form(self): """ This is a separate method so that it's easy to e.g. not return a form if there are no vouchers available. """ return BasketVoucherForm() def get_context_data(self, **kwargs): context = super(BasketView, self).get_context_data(**kwargs) context['voucher_form'] = self.get_basket_voucher_form() # Shipping information is included to give an idea of the total order # cost. It is also important for PayPal Express where the customer # gets redirected away from the basket page and needs to see what the # estimated order total is beforehand. context['shipping_methods'] = self.get_shipping_methods( self.request.basket) method = self.get_default_shipping_method(self.request.basket) context['shipping_method'] = method shipping_charge = method.calculate(self.request.basket) context['shipping_charge'] = shipping_charge if method.is_discounted: excl_discount = method.calculate_excl_discount(self.request.basket) context['shipping_charge_excl_discount'] = excl_discount context['order_total'] = OrderTotalCalculator().calculate( self.request.basket, shipping_charge) context['basket_warnings'] = self.get_basket_warnings( self.request.basket) context['upsell_messages'] = self.get_upsell_messages( self.request.basket) if self.request.user.is_authenticated(): try: saved_basket = self.basket_model.saved.get( owner=self.request.user) except self.basket_model.DoesNotExist: pass else: saved_basket.strategy = self.request.basket.strategy if not saved_basket.is_empty: saved_queryset = saved_basket.all_lines() formset = SavedLineFormSet(strategy=self.request.strategy, basket=self.request.basket, queryset=saved_queryset, prefix='saved') context['saved_formset'] = formset return context def get_success_url(self): return safe_referrer(self.request, 'basket:summary') def formset_valid(self, formset): # Store offers before any changes are made so we can inform the user of # any changes offers_before = self.request.basket.applied_offers() save_for_later = False # Keep a list of messages - we don't immediately call # django.contrib.messages as we may be returning an AJAX response in # which case we pass the messages back in a JSON payload. flash_messages = ajax.FlashMessages() for form in formset: if (hasattr(form, 'cleaned_data') and form.cleaned_data['save_for_later']): line = form.instance if self.request.user.is_authenticated(): self.move_line_to_saved_basket(line) msg = render_to_string( 'basket/messages/line_saved.html', {'line': line}) flash_messages.info(msg) save_for_later = True else: msg = _("You can't save an item for later if you're " "not logged in!") flash_messages.error(msg) return redirect(self.get_success_url()) if save_for_later: # No need to call super if we're moving lines to the saved basket response = redirect(self.get_success_url()) else: # Save changes to basket as per normal response = super(BasketView, self).formset_valid(formset) # If AJAX submission, don't redirect but reload the basket content HTML if self.request.is_ajax(): # Reload basket and apply offers again self.request.basket = get_model('basket', 'Basket').objects.get( id=self.request.basket.id) self.request.basket.strategy = self.request.strategy Applicator().apply(self.request.basket, self.request.user, self.request) offers_after = self.request.basket.applied_offers() for level, msg in BasketMessageGenerator().get_messages( self.request.basket, offers_before, offers_after, include_buttons=False): flash_messages.add_message(level, msg) # Reload formset - we have to remove the POST fields from the # kwargs as, if they are left in, the formset won't construct # correctly as there will be a state mismatch between the # management form and the database. kwargs = self.get_formset_kwargs() del kwargs['data'] del kwargs['files'] if 'queryset' in kwargs: del kwargs['queryset'] formset = self.get_formset()(queryset=self.get_queryset(), **kwargs) ctx = self.get_context_data(formset=formset, basket=self.request.basket) return self.json_response(ctx, flash_messages) BasketMessageGenerator().apply_messages(self.request, offers_before) return response def json_response(self, ctx, flash_messages): basket_html = render_to_string( 'basket/partials/basket_content.html', RequestContext(self.request, ctx)) payload = { 'content_html': basket_html, 'messages': flash_messages.as_dict()} return HttpResponse(json.dumps(payload), content_type="application/json") def move_line_to_saved_basket(self, line): saved_basket, _ = get_model('basket', 'basket').saved.get_or_create( owner=self.request.user) saved_basket.merge_line(line) def formset_invalid(self, formset): flash_messages = ajax.FlashMessages() flash_messages.warning(_( "Your basket couldn't be updated. " "Please correct any validation errors below.")) if self.request.is_ajax(): ctx = self.get_context_data(formset=formset, basket=self.request.basket) return self.json_response(ctx, flash_messages) flash_messages.apply_to_request(self.request) return super(BasketView, self).formset_invalid(formset) class BasketAddView(FormView): """ Handles the add-to-basket submissions, which are triggered from various parts of the site. The add-to-basket form is loaded into templates using a templatetag from module basket_tags.py. """ form_class = AddToBasketForm product_model = get_model('catalogue', 'product') add_signal = signals.basket_addition http_method_names = ['post'] def post(self, request, *args, **kwargs): self.product = shortcuts.get_object_or_404( self.product_model, pk=kwargs['pk']) return super(BasketAddView, self).post(request, *args, **kwargs) def get_form_kwargs(self): kwargs = super(BasketAddView, self).get_form_kwargs() kwargs['basket'] = self.request.basket kwargs['product'] = self.product return kwargs def form_invalid(self, form): msgs = [] for error in form.errors.values(): msgs.append(error.as_text()) clean_msgs = [m.replace('* ', '') for m in msgs if m.startswith('* ')] messages.error(self.request, ",".join(clean_msgs)) return redirect_to_referrer(self.request, 'basket:summary') def form_valid(self, form): offers_before = self.request.basket.applied_offers() self.request.basket.add_product( form.product, form.cleaned_data['quantity'], form.cleaned_options()) messages.success(self.request, self.get_success_message(form), extra_tags='safe noicon') # Check for additional offer messages BasketMessageGenerator().apply_messages(self.request, offers_before) # Send signal for basket addition self.add_signal.send( sender=self, product=form.product, user=self.request.user, request=self.request) return super(BasketAddView, self).form_valid(form) def get_success_message(self, form): return render_to_string( 'basket/messages/addition.html', {'product': form.product, 'quantity': form.cleaned_data['quantity']}) def get_success_url(self): post_url = self.request.POST.get('next') if post_url and is_safe_url(post_url, self.request.get_host()): return post_url return safe_referrer(self.request, 'basket:summary') class VoucherAddView(FormView): form_class = BasketVoucherForm voucher_model = get_model('voucher', 'voucher') add_signal = signals.voucher_addition def get(self, request, *args, **kwargs): return redirect('basket:summary') def apply_voucher_to_basket(self, voucher): if voucher.is_expired(): messages.error( self.request, _("The '%(code)s' voucher has expired") % { 'code': voucher.code}) return if not voucher.is_active(): messages.error( self.request, _("The '%(code)s' voucher is not active") % { 'code': voucher.code}) return is_available, message = voucher.is_available_to_user(self.request.user) if not is_available: messages.error(self.request, message) return self.request.basket.vouchers.add(voucher) # Raise signal self.add_signal.send( sender=self, basket=self.request.basket, voucher=voucher) # Recalculate discounts to see if the voucher gives any Applicator().apply(self.request.basket, self.request.user, self.request) discounts_after = self.request.basket.offer_applications # Look for discounts from this new voucher found_discount = False for discount in discounts_after: if discount['voucher'] and discount['voucher'] == voucher: found_discount = True break if not found_discount: messages.warning( self.request, _("Your basket does not qualify for a voucher discount")) self.request.basket.vouchers.remove(voucher) else: messages.info( self.request, _("Voucher '%(code)s' added to basket") % { 'code': voucher.code}) def form_valid(self, form): code = form.cleaned_data['code'] if not self.request.basket.id: return redirect_to_referrer(self.request, 'basket:summary') if self.request.basket.contains_voucher(code): messages.error( self.request, _("You have already added the '%(code)s' voucher to " "your basket") % {'code': code}) else: try: voucher = self.voucher_model._default_manager.get(code=code) except self.voucher_model.DoesNotExist: messages.error( self.request, _("No voucher found with code '%(code)s'") % { 'code': code}) else: self.apply_voucher_to_basket(voucher) return redirect_to_referrer(self.request, 'basket:summary') def form_invalid(self, form): messages.error(self.request, _("Please enter a voucher code")) return redirect(reverse('basket:summary') + '#voucher') class VoucherRemoveView(View): voucher_model = get_model('voucher', 'voucher') remove_signal = signals.voucher_removal http_method_names = ['post'] def post(self, request, *args, **kwargs): response = redirect('basket:summary') voucher_id = kwargs['pk'] if not request.basket.id: # Hacking attempt - the basket must be saved for it to have # a voucher in it. return response try: voucher = request.basket.vouchers.get(id=voucher_id) except ObjectDoesNotExist: messages.error( request, _("No voucher found with id '%d'") % voucher_id) else: request.basket.vouchers.remove(voucher) self.remove_signal.send( sender=self, basket=request.basket, voucher=voucher) messages.info( request, _("Voucher '%s' removed from basket") % voucher.code) return response class SavedView(ModelFormSetView): model = get_model('basket', 'line') basket_model = get_model('basket', 'basket') formset_class = SavedLineFormSet form_class = SavedLineForm extra = 0 can_delete = True def get(self, request, *args, **kwargs): return redirect('basket:summary') def get_queryset(self): try: saved_basket = self.basket_model.saved.get(owner=self.request.user) saved_basket.strategy = self.request.strategy return saved_basket.all_lines() except self.basket_model.DoesNotExist: return [] def get_success_url(self): return safe_referrer(self.request, 'basket:summary') def get_formset_kwargs(self): kwargs = super(SavedView, self).get_formset_kwargs() kwargs['prefix'] = 'saved' kwargs['basket'] = self.request.basket kwargs['strategy'] = self.request.strategy return kwargs def formset_valid(self, formset): offers_before = self.request.basket.applied_offers() is_move = False for form in formset: if form.cleaned_data.get('move_to_basket', False): is_move = True msg = render_to_string( 'basket/messages/line_restored.html', {'line': form.instance}) messages.info(self.request, msg, extra_tags='safe noicon') real_basket = self.request.basket real_basket.merge_line(form.instance) if is_move: # As we're changing the basket, we need to check if it qualifies # for any new offers. BasketMessageGenerator().apply_messages(self.request, offers_before) response = redirect(self.get_success_url()) else: response = super(SavedView, self).formset_valid(formset) return response def formset_invalid(self, formset): messages.error( self.request, '\n'.join( error for ed in formset.errors for el in ed.values() for error in el)) return redirect_to_referrer(self.request, 'basket:summary')
unknown
codeparrot/codeparrot-clean
# Copyright 2017 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. # pylint: disable=missing-docstring import io import logging import os import shutil import tempfile import unittest from buildtool import ( check_subprocess, check_subprocesses_to_logfile, run_subprocess, ExecutionError) from test_util import init_runtime class TestRunner(unittest.TestCase): @classmethod def setUpClass(cls): cls.base_temp_dir = tempfile.mkdtemp(prefix='buildtool.subprocess_test') @classmethod def tearDownClass(cls): shutil.rmtree(cls.base_temp_dir) def do_run_subprocess_ok(self, check, logfile=None): if os.path.exists('/bin/true'): true_path = '/bin/true' elif os.path.exists('/usr/bin/true'): true_path = '/usr/bin/true' else: raise NotImplementedError('Unsupported test platform.') tests = [(true_path, ''), ('/bin/echo Hello', 'Hello'), ('/bin/echo "Hello"', 'Hello'), ('/bin/echo "Hello World"', 'Hello World'), ('/bin/echo "Hello\nWorld"', 'Hello\nWorld'), ('/bin/echo \'"Hello World"\'', '"Hello World"')] for cmd, expect in tests: if logfile: output = check_subprocesses_to_logfile('Test Logfile', logfile, [cmd]) elif check: output = check_subprocess(cmd) else: code, output = run_subprocess(cmd) self.assertEqual(0, code) if logfile: self.assertTrue(os.path.exists(logfile)) self.assertIsNone(output) with io.open(logfile, 'r', encoding='utf-8') as stream: lines = stream.read().split('\n') self.assertTrue('Spawning' in lines[0]) self.assertTrue('process completed with' in lines[-2]) body = '\n'.join(lines[3:-3]).strip() self.assertEqual(expect, body) else: self.assertEqual(expect, output) def test_run_subprocess_ok(self): self.do_run_subprocess_ok(False) def test_check_subprocess_ok(self): self.do_run_subprocess_ok(False) def test_run_subprocess_fail(self): if os.path.exists('/bin/false'): false_path = '/bin/false' elif os.path.exists('/usr/bin/false'): false_path = '/usr/bin/false' else: raise NotImplementedError('Unsupported test platform.') got, output = run_subprocess(false_path) self.assertEqual((1, ''), (got, output)) got, output = run_subprocess('/bin/ls /abc/def') self.assertNotEqual(0, got) self.assertTrue(output.find('No such file or directory') >= 0) def test_check_subprocess_fail(self): if os.path.exists('/bin/false'): false_path = '/bin/false' elif os.path.exists('/usr/bin/false'): false_path = '/usr/bin/false' else: raise NotImplementedError('Unsupported test platform.') tests = [false_path, '/bin/ls /abc/def'] for test in tests: with self.assertRaises(ExecutionError) as ex: check_subprocess(test) self.assertTrue(hasattr(ex.exception, 'loggedit')) def test_check_to_file_subprocess_ok(self): path = os.path.join(self.base_temp_dir, 'check_ok.log') self.do_run_subprocess_ok(False, logfile=path) def test_check_to_file_subprocess_failed(self): cmd = '/bin/ls /abc/def' path = os.path.join(self.base_temp_dir, 'check_failed.log') with self.assertRaises(ExecutionError) as ex: check_subprocesses_to_logfile('Test Logfile', path, [cmd]) self.assertTrue(hasattr(ex.exception, 'loggedit')) self.assertTrue(os.path.exists(path)) with open(path, 'r') as stream: lines = stream.read().split('\n') body = '\n'.join(lines[3:-3]).strip() expect = "/bin/ls: cannot access '/abc/def': No such file or directory" self.assertEqual(expect, body) def test_run_subprocess_get_pid(self): # See if we can run a job by looking up our job # This is also testing parsing command lines. code, output = run_subprocess('/bin/ps -x') self.assertEqual(0, code) my_pid = '%d ' % os.getpid() candidates = [line for line in output.split('\n') if line.find(my_pid) >= 0 and line.find('python') > 0] if len(candidates) != 1: logging.error('Unexpected output\n%s', output) self.assertEqual(1, len(candidates)) self.assertTrue(candidates[0].find(' python ') > 0) if __name__ == '__main__': init_runtime() unittest.main(verbosity=2)
unknown
codeparrot/codeparrot-clean
/* * Copyright 2002-present the original author or authors. * * 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. */ package org.springframework.docs.integration.cache.cachestoreconfigurationcaffeine import org.springframework.cache.CacheManager import org.springframework.cache.caffeine.CaffeineCacheManager import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @Configuration class CustomCacheConfiguration { // tag::snippet[] @Bean fun cacheManager(): CacheManager { return CaffeineCacheManager("default", "books") } // end::snippet[] }
kotlin
github
https://github.com/spring-projects/spring-framework
framework-docs/src/main/kotlin/org/springframework/docs/integration/cache/cachestoreconfigurationcaffeine/CustomCacheConfiguration.kt
/* * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. */ package io.ktor.http import io.ktor.util.* internal val ROOT_PATH = listOf("") /** * Take url parts from [urlString] * throws [URLParserException] * * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.http.takeFrom) */ public fun URLBuilder.takeFrom(urlString: String): URLBuilder { if (urlString.isBlank()) return this return try { takeFromUnsafe(urlString) } catch (cause: Throwable) { throw URLParserException(urlString, cause) } } /** * Thrown when failed to parse URL * * [Report a problem](https://ktor.io/feedback/?fqname=io.ktor.http.URLParserException) */ public class URLParserException(urlString: String, cause: Throwable) : IllegalStateException( "Fail to parse url: $urlString", cause ) internal fun URLBuilder.takeFromUnsafe(urlString: String): URLBuilder { var startIndex = urlString.indexOfFirst { !it.isWhitespace() } val endIndex = urlString.indexOfLast { !it.isWhitespace() } + 1 val schemeLength = findScheme(urlString, startIndex, endIndex) if (schemeLength > 0) { val scheme = urlString.substring(startIndex, startIndex + schemeLength) protocol = URLProtocol.createOrDefault(scheme) startIndex += schemeLength + 1 } // Special handling for data URLs if (protocol.name == "data") { host = urlString.substring(startIndex, endIndex) return this } // Auth & Host val slashCount = count(urlString, startIndex, endIndex, '/') startIndex += slashCount if (protocol.name == "file") { parseFile(urlString, startIndex, endIndex, slashCount) return this } if (protocol.name == "mailto") { require(slashCount == 0) parseMailto(urlString, startIndex, endIndex) return this } if (protocol.name == "about") { require(slashCount == 0) host = urlString.substring(startIndex, endIndex) return this } if (protocol.name == "tel") { require(slashCount == 0) host = urlString.substring(startIndex, endIndex) return this } if (slashCount >= 2) { loop@ while (true) { val delimiter = urlString.indexOfAny("@/\\?#".toCharArray(), startIndex).takeIf { it > 0 } ?: endIndex if (delimiter < endIndex && urlString[delimiter] == '@') { // user and password check val passwordIndex = urlString.indexOfColonInHostPort(startIndex, delimiter) if (passwordIndex != -1) { encodedUser = urlString.substring(startIndex, passwordIndex) encodedPassword = urlString.substring(passwordIndex + 1, delimiter) } else { encodedUser = urlString.substring(startIndex, delimiter) } startIndex = delimiter + 1 } else { fillHost(urlString, startIndex, delimiter) startIndex = delimiter break@loop } } } // Path if (startIndex >= endIndex) { encodedPathSegments = if (urlString[endIndex - 1] == '/') ROOT_PATH else emptyList() return this } encodedPathSegments = if (slashCount == 0) { // Relative path // last item is either file name or empty string for directories encodedPathSegments.dropLast(1) } else { emptyList() } val pathEnd = urlString.indexOfAny("?#".toCharArray(), startIndex).takeIf { it > 0 } ?: endIndex if (pathEnd > startIndex) { val rawPath = urlString.substring(startIndex, pathEnd) val basePath = when { encodedPathSegments.size == 1 && encodedPathSegments.first().isEmpty() -> emptyList() else -> encodedPathSegments } val rawChunks = if (rawPath == "/") ROOT_PATH else rawPath.split('/') val relativePath = when (slashCount) { 1 -> ROOT_PATH else -> emptyList() } + rawChunks encodedPathSegments = basePath + relativePath startIndex = pathEnd } // Query if (startIndex < endIndex && urlString[startIndex] == '?') { startIndex = parseQuery(urlString, startIndex, endIndex) } // Fragment parseFragment(urlString, startIndex, endIndex) return this } private fun URLBuilder.parseFile(urlString: String, startIndex: Int, endIndex: Int, slashCount: Int) { when (slashCount) { 1 -> { host = "" encodedPath = urlString.substring(startIndex, endIndex) } 2 -> { val nextSlash = urlString.indexOf('/', startIndex) if (nextSlash == -1 || nextSlash == endIndex) { host = urlString.substring(startIndex, endIndex) return } host = urlString.substring(startIndex, nextSlash) encodedPath = urlString.substring(nextSlash, endIndex) } 3 -> { host = "" encodedPath = "/" + urlString.substring(startIndex, endIndex) } else -> throw IllegalArgumentException("Invalid file url: $urlString") } } private fun URLBuilder.parseMailto(urlString: String, startIndex: Int, endIndex: Int) { val delimiter = urlString.indexOf("@", startIndex) if (delimiter == -1) { throw IllegalArgumentException("Invalid mailto url: $urlString, it should contain '@'.") } user = urlString.substring(startIndex, delimiter).decodeURLPart() host = urlString.substring(delimiter + 1, endIndex) } private fun URLBuilder.parseQuery(urlString: String, startIndex: Int, endIndex: Int): Int { if (startIndex + 1 == endIndex) { trailingQuery = true return endIndex } val fragmentStart = urlString.indexOf('#', startIndex + 1).takeIf { it > 0 } ?: endIndex val rawParameters = parseQueryString(urlString.substring(startIndex + 1, fragmentStart), decode = false) rawParameters.forEach { key, values -> encodedParameters.appendAll(key, values) } return fragmentStart } private fun URLBuilder.parseFragment(urlString: String, startIndex: Int, endIndex: Int) { if (startIndex < endIndex && urlString[startIndex] == '#') { encodedFragment = urlString.substring(startIndex + 1, endIndex) } } private fun URLBuilder.fillHost(urlString: String, startIndex: Int, endIndex: Int) { val colonIndex = urlString.indexOfColonInHostPort(startIndex, endIndex).takeIf { it > 0 } ?: endIndex host = urlString.substring(startIndex, colonIndex) port = if (colonIndex + 1 < endIndex) { urlString.substring(colonIndex + 1, endIndex).toInt() } else { DEFAULT_PORT } } /** * Finds scheme in the given [urlString]. If there is no scheme found the function returns -1. If the scheme contains * illegal characters an [IllegalArgumentException] will be thrown. If the scheme is present and it doesn't contain * illegal characters the function returns the length of the scheme. */ private fun findScheme(urlString: String, startIndex: Int, endIndex: Int): Int { var current = startIndex // Incorrect scheme position is used to identify the first position at which the character is not allowed in the // scheme or the part of the scheme. This number is reported in the exception message. var incorrectSchemePosition = -1 val firstChar = urlString[current] if (firstChar !in 'a'..'z' && firstChar !in 'A'..'Z') { incorrectSchemePosition = current } while (current < endIndex) { val char = urlString[current] // Character ':' means the end of the scheme and at this point the length of the scheme should be returned or // the exception should be thrown in case the scheme contains illegal characters. if (char == ':') { if (incorrectSchemePosition != -1) { throw IllegalArgumentException("Illegal character in scheme at position $incorrectSchemePosition") } return current - startIndex } // If character '/' or '?' or '#' found this is not a scheme. if (char == '/' || char == '?' || char == '#') return -1 // Update incorrect scheme position is current char is illegal. if (incorrectSchemePosition == -1 && char !in 'a'..'z' && char !in 'A'..'Z' && char !in '0'..'9' && char != '.' && char != '+' && char != '-' ) { incorrectSchemePosition = current } ++current } return -1 } private fun count(urlString: String, startIndex: Int, endIndex: Int, char: Char): Int { var result = 0 while (startIndex + result < endIndex) { if (urlString[startIndex + result] != char) break result++ } return result } private fun String.indexOfColonInHostPort(startIndex: Int, endIndex: Int): Int { var skip = false for (index in startIndex until endIndex) { when (this[index]) { '[' -> skip = true ']' -> skip = false ':' -> if (!skip) return index } } return -1 } private fun Char.isLetter(): Boolean = lowercaseChar() in 'a'..'z'
kotlin
github
https://github.com/ktorio/ktor
ktor-http/common/src/io/ktor/http/URLParser.kt
from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( unified_strdate, clean_html, ) class ArchiveOrgIE(InfoExtractor): IE_NAME = 'archive.org' IE_DESC = 'archive.org videos' _VALID_URL = r'https?://(?:www\.)?archive\.org/(?:details|embed)/(?P<id>[^/?#]+)(?:[?].*)?$' _TESTS = [{ 'url': 'http://archive.org/details/XD300-23_68HighlightsAResearchCntAugHumanIntellect', 'md5': '8af1d4cf447933ed3c7f4871162602db', 'info_dict': { 'id': 'XD300-23_68HighlightsAResearchCntAugHumanIntellect', 'ext': 'ogg', 'title': '1968 Demo - FJCC Conference Presentation Reel #1', 'description': 'md5:da45c349df039f1cc8075268eb1b5c25', 'upload_date': '19681210', 'uploader': 'SRI International' } }, { 'url': 'https://archive.org/details/Cops1922', 'md5': '0869000b4ce265e8ca62738b336b268a', 'info_dict': { 'id': 'Cops1922', 'ext': 'mp4', 'title': 'Buster Keaton\'s "Cops" (1922)', 'description': 'md5:89e7c77bf5d965dd5c0372cfb49470f6', } }, { 'url': 'http://archive.org/embed/XD300-23_68HighlightsAResearchCntAugHumanIntellect', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage( 'http://archive.org/embed/' + video_id, video_id) jwplayer_playlist = self._parse_json(self._search_regex( r"(?s)Play\('[^']+'\s*,\s*(\[.+\])\s*,\s*{.*?}\);", webpage, 'jwplayer playlist'), video_id) info = self._parse_jwplayer_data( {'playlist': jwplayer_playlist}, video_id, base_url=url) def get_optional(metadata, field): return metadata.get(field, [None])[0] metadata = self._download_json( 'http://archive.org/details/' + video_id, video_id, query={ 'output': 'json', })['metadata'] info.update({ 'title': get_optional(metadata, 'title') or info.get('title'), 'description': clean_html(get_optional(metadata, 'description')), }) if info.get('_type') != 'playlist': info.update({ 'uploader': get_optional(metadata, 'creator'), 'upload_date': unified_strdate(get_optional(metadata, 'date')), }) return info
unknown
codeparrot/codeparrot-clean
<?php declare(strict_types=1); /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Test\Mock; use Composer\Repository\InstalledFilesystemRepository; use Composer\Installer\InstallationManager; class InstalledFilesystemRepositoryMock extends InstalledFilesystemRepository { public function reload(): void { } public function write($devMode, InstallationManager $installationManager): void { } }
php
github
https://github.com/composer/composer
tests/Composer/Test/Mock/InstalledFilesystemRepositoryMock.php
# Natural Language Toolkit: Text Segmentation Metrics # # Copyright (C) 2001-2013 NLTK Project # Author: Edward Loper <edloper@gmail.com> # Steven Bird <stevenbird1@gmail.com> # David Doukhan <david.doukhan@gmail.com> # URL: <http://nltk.org/> # For license information, see LICENSE.TXT """ Text Segmentation Metrics 1. Windowdiff Pevzner, L., and Hearst, M., A Critique and Improvement of an Evaluation Metric for Text Segmentation, Computational Linguistics 28, 19-36 2. Generalized Hamming Distance Bookstein A., Kulyukin V.A., Raita T. Generalized Hamming Distance Information Retrieval 5, 2002, pp 353-375 Baseline implementation in C++ http://digital.cs.usu.edu/~vkulyukin/vkweb/software/ghd/ghd.html Study describing benefits of Generalized Hamming Distance Versus WindowDiff for evaluating text segmentation tasks Begsten, Y. Quel indice pour mesurer l'efficacite en segmentation de textes ? TALN 2009 3. Pk text segmentation metric Beeferman D., Berger A., Lafferty J. (1999) Statistical Models for Text Segmentation Machine Learning, 34, 177-210 """ try: import numpy as np except ImportError: pass from nltk.compat import xrange def windowdiff(seg1, seg2, k, boundary="1", weighted=False): """ Compute the windowdiff score for a pair of segmentations. A segmentation is any sequence over a vocabulary of two items (e.g. "0", "1"), where the specified boundary value is used to mark the edge of a segmentation. >>> s1 = "000100000010" >>> s2 = "000010000100" >>> s3 = "100000010000" >>> '%.2f' % windowdiff(s1, s1, 3) '0.00' >>> '%.2f' % windowdiff(s1, s2, 3) '0.30' >>> '%.2f' % windowdiff(s2, s3, 3) '0.80' :param seg1: a segmentation :type seg1: str or list :param seg2: a segmentation :type seg2: str or list :param k: window width :type k: int :param boundary: boundary value :type boundary: str or int or bool :param weighted: use the weighted variant of windowdiff :type weighted: boolean :rtype: float """ if len(seg1) != len(seg2): raise ValueError("Segmentations have unequal length") if k > len(seg1): raise ValueError("Window width k should be smaller or equal than segmentation lengths") wd = 0 for i in range(len(seg1) - k + 1): ndiff = abs(seg1[i:i+k].count(boundary) - seg2[i:i+k].count(boundary)) if weighted: wd += ndiff else: wd += min(1, ndiff) return wd / (len(seg1) - k + 1.) # Generalized Hamming Distance def _init_mat(nrows, ncols, ins_cost, del_cost): mat = np.empty((nrows, ncols)) mat[0, :] = ins_cost * np.arange(ncols) mat[:, 0] = del_cost * np.arange(nrows) return mat def _ghd_aux(mat, rowv, colv, ins_cost, del_cost, shift_cost_coeff): for i, rowi in enumerate(rowv): for j, colj in enumerate(colv): shift_cost = shift_cost_coeff * abs(rowi - colj) + mat[i, j] if rowi == colj: # boundaries are at the same location, no transformation required tcost = mat[i, j] elif rowi > colj: # boundary match through a deletion tcost = del_cost + mat[i, j + 1] else: # boundary match through an insertion tcost = ins_cost + mat[i + 1, j] mat[i + 1, j + 1] = min(tcost, shift_cost) def ghd(ref, hyp, ins_cost=2.0, del_cost=2.0, shift_cost_coeff=1.0, boundary='1'): """ Compute the Generalized Hamming Distance for a reference and a hypothetical segmentation, corresponding to the cost related to the transformation of the hypothetical segmentation into the reference segmentation through boundary insertion, deletion and shift operations. A segmentation is any sequence over a vocabulary of two items (e.g. "0", "1"), where the specified boundary value is used to mark the edge of a segmentation. Recommended parameter values are a shift_cost_coeff of 2. Associated with a ins_cost, and del_cost equal to the mean segment length in the reference segmentation. >>> # Same examples as Kulyukin C++ implementation >>> ghd('1100100000', '1100010000', 1.0, 1.0, 0.5) 0.5 >>> ghd('1100100000', '1100000001', 1.0, 1.0, 0.5) 2.0 >>> ghd('011', '110', 1.0, 1.0, 0.5) 1.0 >>> ghd('1', '0', 1.0, 1.0, 0.5) 1.0 >>> ghd('111', '000', 1.0, 1.0, 0.5) 3.0 >>> ghd('000', '111', 1.0, 2.0, 0.5) 6.0 :param ref: the reference segmentation :type ref: str or list :param hyp: the hypothetical segmentation :type hyp: str or list :param ins_cost: insertion cost :type ins_cost: float :param del_cost: deletion cost :type del_cost: float :param shift_cost_coeff: constant used to compute the cost of a shift. shift cost = shift_cost_coeff * |i - j| where i and j are the positions indicating the shift :type shift_cost_coeff: float :param boundary: boundary value :type boundary: str or int or bool :rtype: float """ ref_idx = [i for (i, val) in enumerate(ref) if val == boundary] hyp_idx = [i for (i, val) in enumerate(hyp) if val == boundary] nref_bound = len(ref_idx) nhyp_bound = len(hyp_idx) if nref_bound == 0 and nhyp_bound == 0: return 0.0 elif nref_bound > 0 and nhyp_bound == 0: return nref_bound * ins_cost elif nref_bound == 0 and nhyp_bound > 0: return nhyp_bound * del_cost mat = _init_mat(nhyp_bound + 1, nref_bound + 1, ins_cost, del_cost) _ghd_aux(mat, hyp_idx, ref_idx, ins_cost, del_cost, shift_cost_coeff) return mat[-1, -1] # Beeferman's Pk text segmentation evaluation metric def pk(ref, hyp, k=None, boundary='1'): """ Compute the Pk metric for a pair of segmentations A segmentation is any sequence over a vocabulary of two items (e.g. "0", "1"), where the specified boundary value is used to mark the edge of a segmentation. >>> '%.2f' % pk('0100'*100, '1'*400, 2) '0.50' >>> '%.2f' % pk('0100'*100, '0'*400, 2) '0.50' >>> '%.2f' % pk('0100'*100, '0100'*100, 2) '0.00' :param ref: the reference segmentation :type ref: str or list :param hyp: the segmentation to evaluate :type hyp: str or list :param k: window size, if None, set to half of the average reference segment length :type boundary: str or int or bool :param boundary: boundary value :type boundary: str or int or bool :rtype: float """ if k is None: k = int(round(len(ref) / (ref.count(boundary) * 2.))) err = 0 for i in xrange(len(ref)-k +1): r = ref[i:i+k].count(boundary) > 0 h = hyp[i:i+k].count(boundary) > 0 if r != h: err += 1 return err / (len(ref)-k +1.) # skip doctests if numpy is not installed def setup_module(module): from nose import SkipTest try: import numpy except ImportError: raise SkipTest("numpy is required for nltk.metrics.segmentation") if __name__ == "__main__": import doctest doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE)
unknown
codeparrot/codeparrot-clean
import json import django.db import unittest from student.tests.factories import UserFactory, RegistrationFactory, PendingEmailChangeFactory from student.views import ( reactivation_email_for_user, do_email_change_request, confirm_email_change, validate_new_email, SETTING_CHANGE_INITIATED ) from student.models import UserProfile, PendingEmailChange from django.core.urlresolvers import reverse from django.core import mail from django.contrib.auth.models import User from django.db import transaction from django.test import TestCase, TransactionTestCase from django.test.client import RequestFactory from mock import Mock, patch from django.http import HttpResponse from django.conf import settings from edxmako.shortcuts import render_to_string from edxmako.tests import mako_middleware_process_request from util.request import safe_get_host from util.testing import EventTestMixin class TestException(Exception): """Exception used for testing that nothing will catch explicitly""" pass def mock_render_to_string(template_name, context): """Return a string that encodes template_name and context""" return str((template_name, sorted(context.iteritems()))) def mock_render_to_response(template_name, context): """Return an HttpResponse with content that encodes template_name and context""" # This simulates any db access in the templates. UserProfile.objects.exists() return HttpResponse(mock_render_to_string(template_name, context)) class EmailTestMixin(object): """Adds useful assertions for testing `email_user`""" def assertEmailUser(self, email_user, subject_template, subject_context, body_template, body_context): """Assert that `email_user` was used to send and email with the supplied subject and body `email_user`: The mock `django.contrib.auth.models.User.email_user` function to verify `subject_template`: The template to have been used for the subject `subject_context`: The context to have been used for the subject `body_template`: The template to have been used for the body `body_context`: The context to have been used for the body """ email_user.assert_called_with( mock_render_to_string(subject_template, subject_context), mock_render_to_string(body_template, body_context), settings.DEFAULT_FROM_EMAIL ) def append_allowed_hosts(self, hostname): """ Append hostname to settings.ALLOWED_HOSTS """ settings.ALLOWED_HOSTS.append(hostname) self.addCleanup(settings.ALLOWED_HOSTS.pop) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class ActivationEmailTests(TestCase): """Test sending of the activation email. """ ACTIVATION_SUBJECT = "Activate Your edX Account" # Text fragments we expect in the body of an email # sent from an OpenEdX installation. OPENEDX_FRAGMENTS = [ "Thank you for signing up for {platform}.".format(platform=settings.PLATFORM_NAME), "http://edx.org/activate/", ( "if you require assistance, check the help section of the " "{platform} website".format(platform=settings.PLATFORM_NAME) ) ] # Text fragments we expect in the body of an email # sent from an EdX-controlled domain. EDX_DOMAIN_FRAGMENTS = [ "Thank you for signing up for {platform}".format(platform=settings.PLATFORM_NAME), "http://edx.org/activate/", "https://www.edx.org/contact-us", "This email was automatically sent by edx.org" ] def setUp(self): super(ActivationEmailTests, self).setUp() def test_activation_email(self): self._create_account() self._assert_activation_email(self.ACTIVATION_SUBJECT, self.OPENEDX_FRAGMENTS) @patch.dict(settings.FEATURES, {'IS_EDX_DOMAIN': True}) def test_activation_email_edx_domain(self): self._create_account() self._assert_activation_email(self.ACTIVATION_SUBJECT, self.EDX_DOMAIN_FRAGMENTS) def _create_account(self): """Create an account, triggering the activation email. """ url = reverse('create_account') params = { 'username': 'test_user', 'email': 'test_user@example.com', 'password': 'edx', 'name': 'Test User', 'honor_code': True, 'terms_of_service': True } resp = self.client.post(url, params) self.assertEqual( resp.status_code, 200, msg=u"Could not create account (status {status}). The response was {response}".format( status=resp.status_code, response=resp.content ) ) def _assert_activation_email(self, subject, body_fragments): """Verify that the activation email was sent. """ self.assertEqual(len(mail.outbox), 1) msg = mail.outbox[0] self.assertEqual(msg.subject, subject) for fragment in body_fragments: self.assertIn(fragment, msg.body) @patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True)) @patch('django.contrib.auth.models.User.email_user') class ReactivationEmailTests(EmailTestMixin, TestCase): """Test sending a reactivation email to a user""" def setUp(self): super(ReactivationEmailTests, self).setUp() self.user = UserFactory.create() self.unregisteredUser = UserFactory.create() self.registration = RegistrationFactory.create(user=self.user) def reactivation_email(self, user): """ Send the reactivation email to the specified user, and return the response as json data. """ return json.loads(reactivation_email_for_user(user).content) def assertReactivateEmailSent(self, email_user): """Assert that the correct reactivation email has been sent""" context = { 'name': self.user.profile.name, 'key': self.registration.activation_key } self.assertEmailUser( email_user, 'emails/activation_email_subject.txt', context, 'emails/activation_email.txt', context ) # Thorough tests for safe_get_host are elsewhere; here we just want a quick URL sanity check request = RequestFactory().post('unused_url') request.user = self.user request.META['HTTP_HOST'] = "aGenericValidHostName" self.append_allowed_hosts("aGenericValidHostName") mako_middleware_process_request(request) body = render_to_string('emails/activation_email.txt', context) host = safe_get_host(request) self.assertIn(host, body) def test_reactivation_email_failure(self, email_user): self.user.email_user.side_effect = Exception response_data = self.reactivation_email(self.user) self.assertReactivateEmailSent(email_user) self.assertFalse(response_data['success']) def test_reactivation_for_unregistered_user(self, email_user): """ Test that trying to send a reactivation email to an unregistered user fails without throwing a 500 error. """ response_data = self.reactivation_email(self.unregisteredUser) self.assertFalse(response_data['success']) def test_reactivation_email_success(self, email_user): response_data = self.reactivation_email(self.user) self.assertReactivateEmailSent(email_user) self.assertTrue(response_data['success']) class EmailChangeRequestTests(EventTestMixin, TestCase): """Test changing a user's email address""" def setUp(self): super(EmailChangeRequestTests, self).setUp('student.views.tracker') self.user = UserFactory.create() self.new_email = 'new.email@edx.org' self.req_factory = RequestFactory() self.request = self.req_factory.post('unused_url', data={ 'password': 'test', 'new_email': self.new_email }) self.request.user = self.user self.user.email_user = Mock() def do_email_validation(self, email): """Executes validate_new_email, returning any resulting error message. """ try: validate_new_email(self.request.user, email) except ValueError as err: return err.message def do_email_change(self, user, email, activation_key=None): """Executes do_email_change_request, returning any resulting error message. """ try: do_email_change_request(user, email, activation_key) except ValueError as err: return err.message def assertFailedRequest(self, response_data, expected_error): """Assert that `response_data` indicates a failed request that returns `expected_error`""" self.assertFalse(response_data['success']) self.assertEquals(expected_error, response_data['error']) self.assertFalse(self.user.email_user.called) @patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True)) def test_duplicate_activation_key(self): """Assert that if two users change Email address simultaneously, no error is thrown""" # New emails for the users user1_new_email = "valid_user1_email@example.com" user2_new_email = "valid_user2_email@example.com" # Create a another user 'user2' & make request for change email user2 = UserFactory.create(email=self.new_email, password="test2") # Send requests & ensure no error was thrown self.assertIsNone(self.do_email_change(self.user, user1_new_email)) self.assertIsNone(self.do_email_change(user2, user2_new_email)) def test_invalid_emails(self): """ Assert the expected error message from the email validation method for an invalid (improperly formatted) email address. """ for email in ('bad_email', 'bad_email@', '@bad_email'): self.assertEqual(self.do_email_validation(email), 'Valid e-mail address required.') def test_change_email_to_existing_value(self): """ Test the error message if user attempts to change email to the existing value. """ self.assertEqual(self.do_email_validation(self.user.email), 'Old email is the same as the new email.') def test_duplicate_email(self): """ Assert the expected error message from the email validation method for an email address that is already in use by another account. """ UserFactory.create(email=self.new_email) self.assertEqual(self.do_email_validation(self.new_email), 'An account with this e-mail already exists.') @patch('django.core.mail.send_mail') @patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True)) def test_email_failure(self, send_mail): """ Test the return value if sending the email for the user to click fails. """ send_mail.side_effect = [Exception, None] self.assertEqual( self.do_email_change(self.user, "valid@email.com"), 'Unable to send email activation link. Please try again later.' ) self.assert_no_events_were_emitted() @patch('django.core.mail.send_mail') @patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True)) def test_email_success(self, send_mail): """ Test email was sent if no errors encountered. """ old_email = self.user.email new_email = "valid@example.com" registration_key = "test registration key" self.assertIsNone(self.do_email_change(self.user, new_email, registration_key)) context = { 'key': registration_key, 'old_email': old_email, 'new_email': new_email } send_mail.assert_called_with( mock_render_to_string('emails/email_change_subject.txt', context), mock_render_to_string('emails/email_change.txt', context), settings.DEFAULT_FROM_EMAIL, [new_email] ) self.assert_event_emitted( SETTING_CHANGE_INITIATED, user_id=self.user.id, setting=u'email', old=old_email, new=new_email ) @patch('django.contrib.auth.models.User.email_user') @patch('student.views.render_to_response', Mock(side_effect=mock_render_to_response, autospec=True)) @patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True)) class EmailChangeConfirmationTests(EmailTestMixin, TransactionTestCase): """Test that confirmation of email change requests function even in the face of exceptions thrown while sending email""" def setUp(self): super(EmailChangeConfirmationTests, self).setUp() self.user = UserFactory.create() self.profile = UserProfile.objects.get(user=self.user) self.req_factory = RequestFactory() self.request = self.req_factory.get('unused_url') self.request.user = self.user self.user.email_user = Mock() self.pending_change_request = PendingEmailChangeFactory.create(user=self.user) self.key = self.pending_change_request.activation_key def assertRolledBack(self): """Assert that no changes to user, profile, or pending email have been made to the db""" self.assertEquals(self.user.email, User.objects.get(username=self.user.username).email) self.assertEquals(self.profile.meta, UserProfile.objects.get(user=self.user).meta) self.assertEquals(1, PendingEmailChange.objects.count()) def assertFailedBeforeEmailing(self, email_user): """Assert that the function failed before emailing a user""" self.assertRolledBack() self.assertFalse(email_user.called) def check_confirm_email_change(self, expected_template, expected_context): """Call `confirm_email_change` and assert that the content was generated as expected `expected_template`: The name of the template that should have been used to generate the content `expected_context`: The context dictionary that should have been used to generate the content """ response = confirm_email_change(self.request, self.key) self.assertEquals( mock_render_to_response(expected_template, expected_context).content, response.content ) def assertChangeEmailSent(self, email_user): """Assert that the correct email was sent to confirm an email change""" context = { 'old_email': self.user.email, 'new_email': self.pending_change_request.new_email, } self.assertEmailUser( email_user, 'emails/email_change_subject.txt', context, 'emails/confirm_email_change.txt', context ) # Thorough tests for safe_get_host are elsewhere; here we just want a quick URL sanity check request = RequestFactory().post('unused_url') request.user = self.user request.META['HTTP_HOST'] = "aGenericValidHostName" self.append_allowed_hosts("aGenericValidHostName") mako_middleware_process_request(request) body = render_to_string('emails/confirm_email_change.txt', context) url = safe_get_host(request) self.assertIn(url, body) def test_not_pending(self, email_user): self.key = 'not_a_key' self.check_confirm_email_change('invalid_email_key.html', {}) self.assertFailedBeforeEmailing(email_user) def test_duplicate_email(self, email_user): UserFactory.create(email=self.pending_change_request.new_email) self.check_confirm_email_change('email_exists.html', {}) self.assertFailedBeforeEmailing(email_user) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") def test_old_email_fails(self, email_user): email_user.side_effect = [Exception, None] self.check_confirm_email_change('email_change_failed.html', { 'email': self.user.email, }) self.assertRolledBack() self.assertChangeEmailSent(email_user) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") def test_new_email_fails(self, email_user): email_user.side_effect = [None, Exception] self.check_confirm_email_change('email_change_failed.html', { 'email': self.pending_change_request.new_email }) self.assertRolledBack() self.assertChangeEmailSent(email_user) @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") def test_successful_email_change(self, email_user): self.check_confirm_email_change('email_change_successful.html', { 'old_email': self.user.email, 'new_email': self.pending_change_request.new_email }) self.assertChangeEmailSent(email_user) meta = json.loads(UserProfile.objects.get(user=self.user).meta) self.assertIn('old_emails', meta) self.assertEquals(self.user.email, meta['old_emails'][0][0]) self.assertEquals( self.pending_change_request.new_email, User.objects.get(username=self.user.username).email ) self.assertEquals(0, PendingEmailChange.objects.count()) @patch('student.views.PendingEmailChange.objects.get', Mock(side_effect=TestException)) def test_always_rollback(self, _email_user): connection = transaction.get_connection() with patch.object(connection, 'rollback', wraps=connection.rollback) as mock_rollback: with self.assertRaises(TestException): confirm_email_change(self.request, self.key) mock_rollback.assert_called_with()
unknown
codeparrot/codeparrot-clean
# coding: utf-8 # Copyright 2014-2020 Álvaro Justen <https://github.com/turicas/rows/> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import unicode_literals import datetime import json import platform import unittest import uuid from base64 import b64encode from decimal import Decimal import six import rows from rows import fields if platform.system() == "Windows": locale_name = "ptb_bra" else: locale_name = "pt_BR.UTF-8" class FieldsTestCase(unittest.TestCase): def test_Field(self): self.assertEqual(fields.Field.TYPE, (type(None),)) self.assertIs(fields.Field.deserialize(None), None) self.assertEqual(fields.Field.deserialize("Álvaro"), "Álvaro") self.assertEqual(fields.Field.serialize(None), "") self.assertIs(type(fields.Field.serialize(None)), six.text_type) self.assertEqual(fields.Field.serialize("Álvaro"), "Álvaro") self.assertIs(type(fields.Field.serialize("Álvaro")), six.text_type) def test_BinaryField(self): deserialized = "Álvaro".encode("utf-8") serialized = b64encode(deserialized).decode("ascii") self.assertEqual(type(deserialized), six.binary_type) self.assertEqual(type(serialized), six.text_type) self.assertEqual(fields.BinaryField.TYPE, (bytes,)) self.assertEqual(fields.BinaryField.serialize(None), "") self.assertIs(type(fields.BinaryField.serialize(None)), six.text_type) self.assertEqual(fields.BinaryField.serialize(deserialized), serialized) self.assertIs(type(fields.BinaryField.serialize(deserialized)), six.text_type) with self.assertRaises(ValueError): fields.BinaryField.serialize(42) with self.assertRaises(ValueError): fields.BinaryField.serialize(3.14) with self.assertRaises(ValueError): fields.BinaryField.serialize("Álvaro") with self.assertRaises(ValueError): fields.BinaryField.serialize("123") self.assertIs(fields.BinaryField.deserialize(None), b"") self.assertEqual(fields.BinaryField.deserialize(serialized), deserialized) self.assertIs(type(fields.BinaryField.deserialize(serialized)), six.binary_type) with self.assertRaises(ValueError): fields.BinaryField.deserialize(42) with self.assertRaises(ValueError): fields.BinaryField.deserialize(3.14) with self.assertRaises(ValueError): fields.BinaryField.deserialize("Álvaro") self.assertEqual(fields.BinaryField.deserialize(deserialized), deserialized) self.assertEqual(fields.BinaryField.deserialize(serialized), deserialized) self.assertEqual( fields.BinaryField.deserialize(serialized.encode("ascii")), serialized.encode("ascii"), ) def test_BoolField(self): self.assertEqual(fields.BoolField.TYPE, (bool,)) self.assertEqual(fields.BoolField.serialize(None), "") false_values = ("False", "false", "no", False) for value in false_values: self.assertIs(fields.BoolField.deserialize(value), False) self.assertIs(fields.BoolField.deserialize(None), None) self.assertEqual(fields.BoolField.deserialize(""), None) true_values = ("True", "true", "yes", True) for value in true_values: self.assertIs(fields.BoolField.deserialize(value), True) self.assertEqual(fields.BoolField.serialize(False), "false") self.assertIs(type(fields.BoolField.serialize(False)), six.text_type) self.assertEqual(fields.BoolField.serialize(True), "true") self.assertIs(type(fields.BoolField.serialize(True)), six.text_type) # '0' and '1' should be not accepted as boolean values because the # sample could not contain other integers but the actual type could be # integer with self.assertRaises(ValueError): fields.BoolField.deserialize("0") with self.assertRaises(ValueError): fields.BoolField.deserialize(b"0") with self.assertRaises(ValueError): fields.BoolField.deserialize("1") with self.assertRaises(ValueError): fields.BoolField.deserialize(b"1") def test_IntegerField(self): self.assertEqual(fields.IntegerField.TYPE, (int,)) self.assertEqual(fields.IntegerField.serialize(None), "") self.assertIs(type(fields.IntegerField.serialize(None)), six.text_type) self.assertIn( type(fields.IntegerField.deserialize("42")), fields.IntegerField.TYPE ) self.assertEqual(fields.IntegerField.deserialize("42"), 42) self.assertEqual(fields.IntegerField.deserialize(42), 42) self.assertEqual(fields.IntegerField.serialize(42), "42") self.assertIs(type(fields.IntegerField.serialize(42)), six.text_type) self.assertEqual(fields.IntegerField.deserialize(None), None) self.assertEqual( fields.IntegerField.deserialize("10152709355006317"), 10152709355006317 ) with rows.locale_context(locale_name): self.assertEqual(fields.IntegerField.serialize(42000), "42000") self.assertIs(type(fields.IntegerField.serialize(42000)), six.text_type) self.assertEqual( fields.IntegerField.serialize(42000, grouping=True), "42.000" ) self.assertEqual(fields.IntegerField.deserialize("42.000"), 42000) self.assertEqual(fields.IntegerField.deserialize(42), 42) self.assertEqual(fields.IntegerField.deserialize(42.0), 42) with self.assertRaises(ValueError): fields.IntegerField.deserialize(1.23) with self.assertRaises(ValueError): fields.IntegerField.deserialize("013") self.assertEqual(fields.IntegerField.deserialize("0"), 0) def test_FloatField(self): self.assertEqual(fields.FloatField.TYPE, (float,)) self.assertEqual(fields.FloatField.serialize(None), "") self.assertIs(type(fields.FloatField.serialize(None)), six.text_type) self.assertIn( type(fields.FloatField.deserialize("42.0")), fields.FloatField.TYPE ) self.assertEqual(fields.FloatField.deserialize("42.0"), 42.0) self.assertEqual(fields.FloatField.deserialize(42.0), 42.0) self.assertEqual(fields.FloatField.deserialize(42), 42.0) self.assertEqual(fields.FloatField.deserialize(None), None) self.assertEqual(fields.FloatField.serialize(42.0), "42.0") self.assertIs(type(fields.FloatField.serialize(42.0)), six.text_type) with rows.locale_context(locale_name): self.assertEqual(fields.FloatField.serialize(42000.0), "42000,000000") self.assertIs(type(fields.FloatField.serialize(42000.0)), six.text_type) self.assertEqual( fields.FloatField.serialize(42000, grouping=True), "42.000,000000" ) self.assertEqual(fields.FloatField.deserialize("42.000,00"), 42000.0) self.assertEqual(fields.FloatField.deserialize(42), 42.0) self.assertEqual(fields.FloatField.deserialize(42.0), 42.0) def test_DecimalField(self): deserialized = Decimal("42.010") self.assertEqual(fields.DecimalField.TYPE, (Decimal,)) self.assertEqual(fields.DecimalField.serialize(None), "") self.assertIs(type(fields.DecimalField.serialize(None)), six.text_type) self.assertEqual(fields.DecimalField.deserialize(""), None) self.assertIn( type(fields.DecimalField.deserialize("42.0")), fields.DecimalField.TYPE ) self.assertEqual(fields.DecimalField.deserialize("42.0"), Decimal("42.0")) self.assertEqual(fields.DecimalField.deserialize(deserialized), deserialized) self.assertEqual(fields.DecimalField.serialize(deserialized), "42.010") self.assertEqual( type(fields.DecimalField.serialize(deserialized)), six.text_type ) self.assertEqual( fields.DecimalField.deserialize("21.21657469231"), Decimal("21.21657469231") ) self.assertEqual(fields.DecimalField.deserialize("-21.34"), Decimal("-21.34")) self.assertEqual(fields.DecimalField.serialize(Decimal("-21.34")), "-21.34") self.assertEqual(fields.DecimalField.deserialize(None), None) with rows.locale_context(locale_name): self.assertEqual( six.text_type, type(fields.DecimalField.serialize(deserialized)) ) self.assertEqual(fields.DecimalField.serialize(Decimal("4200")), "4200") self.assertEqual(fields.DecimalField.serialize(Decimal("42.0")), "42,0") self.assertEqual( fields.DecimalField.serialize(Decimal("42000.0")), "42000,0" ) self.assertEqual(fields.DecimalField.serialize(Decimal("-42.0")), "-42,0") self.assertEqual( fields.DecimalField.deserialize("42.000,00"), Decimal("42000.00") ) self.assertEqual( fields.DecimalField.deserialize("-42.000,00"), Decimal("-42000.00") ) self.assertEqual( fields.DecimalField.serialize(Decimal("42000.0"), grouping=True), "42.000,0", ) self.assertEqual(fields.DecimalField.deserialize(42000), Decimal("42000")) self.assertEqual(fields.DecimalField.deserialize(42000.0), Decimal("42000")) def test_PercentField(self): deserialized = Decimal("0.42010") self.assertEqual(fields.PercentField.TYPE, (Decimal,)) self.assertIn( type(fields.PercentField.deserialize("42.0%")), fields.PercentField.TYPE ) self.assertEqual(fields.PercentField.deserialize("42.0%"), Decimal("0.420")) self.assertEqual( fields.PercentField.deserialize(Decimal("0.420")), Decimal("0.420") ) self.assertEqual(fields.PercentField.deserialize(deserialized), deserialized) self.assertEqual(fields.PercentField.deserialize(None), None) self.assertEqual(fields.PercentField.serialize(deserialized), "42.010%") self.assertEqual( type(fields.PercentField.serialize(deserialized)), six.text_type ) self.assertEqual(fields.PercentField.serialize(Decimal("42.010")), "4201.0%") self.assertEqual(fields.PercentField.serialize(Decimal("0")), "0.00%") self.assertEqual(fields.PercentField.serialize(None), "") self.assertEqual(fields.PercentField.serialize(Decimal("0.01")), "1%") with rows.locale_context(locale_name): self.assertEqual( type(fields.PercentField.serialize(deserialized)), six.text_type ) self.assertEqual(fields.PercentField.serialize(Decimal("42.0")), "4200%") self.assertEqual( fields.PercentField.serialize(Decimal("42000.0")), "4200000%" ) self.assertEqual( fields.PercentField.deserialize("42.000,00%"), Decimal("420.0000") ) self.assertEqual( fields.PercentField.serialize(Decimal("42000.00"), grouping=True), "4.200.000%", ) with self.assertRaises(ValueError): fields.PercentField.deserialize(42) def test_DateField(self): # TODO: test timezone-aware datetime.date serialized = "2015-05-27" deserialized = datetime.date(2015, 5, 27) self.assertEqual(fields.DateField.TYPE, (datetime.date,)) self.assertEqual(fields.DateField.serialize(None), "") self.assertIs(type(fields.DateField.serialize(None)), six.text_type) self.assertIn( type(fields.DateField.deserialize(serialized)), fields.DateField.TYPE ) self.assertEqual(fields.DateField.deserialize(serialized), deserialized) self.assertEqual(fields.DateField.deserialize(deserialized), deserialized) self.assertEqual(fields.DateField.deserialize(None), None) self.assertEqual(fields.DateField.deserialize(""), None) self.assertEqual(fields.DateField.serialize(deserialized), serialized) self.assertIs(type(fields.DateField.serialize(deserialized)), six.text_type) with self.assertRaises(ValueError): fields.DateField.deserialize(42) with self.assertRaises(ValueError): fields.DateField.deserialize(serialized + "T00:00:00") with self.assertRaises(ValueError): fields.DateField.deserialize("Álvaro") with self.assertRaises(ValueError): fields.DateField.deserialize(serialized.encode("utf-8")) def test_DatetimeField(self): # TODO: test timezone-aware datetime.date serialized = "2015-05-27T01:02:03" self.assertEqual(fields.DatetimeField.TYPE, (datetime.datetime,)) deserialized = fields.DatetimeField.deserialize(serialized) self.assertIn(type(deserialized), fields.DatetimeField.TYPE) self.assertEqual(fields.DatetimeField.serialize(None), "") self.assertIs(type(fields.DatetimeField.serialize(None)), six.text_type) value = datetime.datetime(2015, 5, 27, 1, 2, 3) self.assertEqual(fields.DatetimeField.deserialize(serialized), value) self.assertEqual(fields.DatetimeField.deserialize(deserialized), deserialized) self.assertEqual(fields.DatetimeField.deserialize(None), None) self.assertEqual(fields.DatetimeField.serialize(value), serialized) self.assertIs(type(fields.DatetimeField.serialize(value)), six.text_type) with self.assertRaises(ValueError): fields.DatetimeField.deserialize(42) with self.assertRaises(ValueError): fields.DatetimeField.deserialize("2015-01-01") with self.assertRaises(ValueError): fields.DatetimeField.deserialize("Álvaro") with self.assertRaises(ValueError): fields.DatetimeField.deserialize(serialized.encode("utf-8")) def test_EmailField(self): # TODO: accept spaces also serialized = "test@domain.com" self.assertEqual(fields.EmailField.TYPE, (six.text_type,)) deserialized = fields.EmailField.deserialize(serialized) self.assertIn(type(deserialized), fields.EmailField.TYPE) self.assertEqual(fields.EmailField.serialize(None), "") self.assertIs(type(fields.EmailField.serialize(None)), six.text_type) self.assertEqual(fields.EmailField.serialize(serialized), serialized) self.assertEqual(fields.EmailField.deserialize(serialized), serialized) self.assertEqual(fields.EmailField.deserialize(None), None) self.assertEqual(fields.EmailField.deserialize(""), None) self.assertIs(type(fields.EmailField.serialize(serialized)), six.text_type) with self.assertRaises(ValueError): fields.EmailField.deserialize(42) with self.assertRaises(ValueError): fields.EmailField.deserialize("2015-01-01") with self.assertRaises(ValueError): fields.EmailField.deserialize("Álvaro") with self.assertRaises(ValueError): fields.EmailField.deserialize("test@example.com".encode("utf-8")) def test_TextField(self): self.assertEqual(fields.TextField.TYPE, (six.text_type,)) self.assertEqual(fields.TextField.serialize(None), "") self.assertIs(type(fields.TextField.serialize(None)), six.text_type) self.assertIn(type(fields.TextField.deserialize("test")), fields.TextField.TYPE) self.assertEqual(fields.TextField.deserialize("Álvaro"), "Álvaro") self.assertIs(fields.TextField.deserialize(None), None) self.assertIs(fields.TextField.deserialize(""), "") self.assertEqual(fields.TextField.serialize("Álvaro"), "Álvaro") self.assertIs(type(fields.TextField.serialize("Álvaro")), six.text_type) with self.assertRaises(ValueError) as exception_context: fields.TextField.deserialize("Álvaro".encode("utf-8")) self.assertEqual(exception_context.exception.args[0], "Binary is not supported") def test_JSONField(self): self.assertEqual(fields.JSONField.TYPE, (list, dict)) self.assertEqual(type(fields.JSONField.deserialize("[]")), list) self.assertEqual(type(fields.JSONField.deserialize("{}")), dict) deserialized = {"a": 123, "b": 3.14, "c": [42, 24]} serialized = json.dumps(deserialized) self.assertEqual(fields.JSONField.deserialize(serialized), deserialized) def test_UUIDField(self): with self.assertRaises(ValueError) as exception_context: fields.UUIDField.deserialize("not an UUID value") with self.assertRaises(ValueError) as exception_context: # "z" not hex fields.UUIDField.deserialize("z" * 32) fields.UUIDField.deserialize("a" * 32) # no exception should be raised data = uuid.uuid4() assert fields.UUIDField.deserialize(data) == data assert fields.UUIDField.deserialize(str(data)) == data assert fields.UUIDField.deserialize(str(data).replace("-", "")) == data class FieldUtilsTestCase(unittest.TestCase): maxDiff = None def setUp(self): with open("tests/data/all-field-types.csv", "rb") as fobj: data = fobj.read().decode("utf-8") lines = [line.split(",") for line in data.splitlines()] self.fields = lines[0] self.data = lines[1:] self.expected = { "bool_column": fields.BoolField, "integer_column": fields.IntegerField, "float_column": fields.FloatField, "decimal_column": fields.FloatField, "percent_column": fields.PercentField, "date_column": fields.DateField, "datetime_column": fields.DatetimeField, "unicode_column": fields.TextField, } def test_slug(self): self.assertEqual(fields.slug(None), "") self.assertEqual(fields.slug("Álvaro Justen"), "alvaro_justen") self.assertEqual(fields.slug("Moe's Bar"), "moe_s_bar") self.assertEqual(fields.slug("-----te-----st------"), "te_st") self.assertEqual(fields.slug("first line\nsecond line"), "first_line_second_line") self.assertEqual(fields.slug("first/second"), "first_second") self.assertEqual(fields.slug("first\xa0second"), "first_second") # As in <https://github.com/turicas/rows/issues/179> self.assertEqual( fields.slug('Query Occurrence"( % ),"First Seen'), "query_occurrence_first_seen", ) self.assertEqual(fields.slug(" ÁLVARO justen% "), "alvaro_justen") self.assertEqual(fields.slug(42), "42") self.assertEqual(fields.slug("^test"), "test") self.assertEqual(fields.slug("^test", permitted_chars=fields.SLUG_CHARS + "^"), "^test") self.assertEqual(fields.slug("this/is\ta\ntest", separator="-"), "this-is-a-test") def test_detect_types_no_sample(self): expected = {key: fields.TextField for key in self.expected.keys()} result = fields.detect_types(self.fields, []) self.assertDictEqual(dict(result), expected) def test_detect_types_binary(self): # first, try values as (`bytes`/`str`) expected = {key: fields.BinaryField for key in self.expected.keys()} values = [ [b"some binary data" for _ in range(len(self.data[0]))] for __ in range(20) ] result = fields.detect_types(self.fields, values) self.assertDictEqual(dict(result), expected) # second, try base64-encoded values (as `str`/`unicode`) expected = {key: fields.TextField for key in self.expected.keys()} values = [ [b64encode(value.encode("utf-8")).decode("ascii") for value in row] for row in self.data ] result = fields.detect_types(self.fields, values) self.assertDictEqual(dict(result), expected) def test_detect_types(self): result = fields.detect_types(self.fields, self.data) self.assertDictEqual(dict(result), self.expected) def test_detect_types_different_number_of_fields(self): result = fields.detect_types(["f1", "f2"], [["a", "b", "c"]]) self.assertEqual(list(result.keys()), ["f1", "f2", "field_2"]) def test_empty_sequences_should_not_be_bool(self): result = fields.detect_types(["field_1"], [[""], [""]])["field_1"] expected = fields.TextField self.assertEqual(result, expected) def test_precedence(self): field_types = [ ("bool", fields.BoolField), ("integer", fields.IntegerField), ("float", fields.FloatField), ("datetime", fields.DatetimeField), ("date", fields.DateField), ("float", fields.FloatField), ("percent", fields.PercentField), ("json", fields.JSONField), ("email", fields.EmailField), ("binary1", fields.BinaryField), ("binary2", fields.BinaryField), ("text", fields.TextField), ] data = [ [ "false", "42", "3.14", "2016-08-15T05:21:10", "2016-08-15", "2.71", "76.38%", '{"key": "value"}', "test@example.com", b"cHl0aG9uIHJ1bGVz", b"python rules", "Álvaro Justen", ] ] result = fields.detect_types( [item[0] for item in field_types], data, field_types=[item[1] for item in field_types], ) self.assertDictEqual(dict(result), dict(field_types)) class FieldsFunctionsTestCase(unittest.TestCase): def test_is_null(self): self.assertTrue(fields.is_null(None)) self.assertTrue(fields.is_null("")) self.assertTrue(fields.is_null(" \t ")) self.assertTrue(fields.is_null("null")) self.assertTrue(fields.is_null("nil")) self.assertTrue(fields.is_null("none")) self.assertTrue(fields.is_null("-")) self.assertFalse(fields.is_null("Álvaro")) self.assertFalse(fields.is_null("Álvaro".encode("utf-8"))) def test_as_string(self): self.assertEqual(fields.as_string(None), "None") self.assertEqual(fields.as_string(42), "42") self.assertEqual(fields.as_string(3.141592), "3.141592") self.assertEqual(fields.as_string("Álvaro"), "Álvaro") with self.assertRaises(ValueError) as exception_context: fields.as_string("Álvaro".encode("utf-8")) self.assertEqual(exception_context.exception.args[0], "Binary is not supported") def test_get_items(self): func = fields.get_items(2) self.assertEqual(func("a b c d e f".split()), ("c",)) func = fields.get_items(0, 2, 3) self.assertEqual(func("a b c d e f".split()), ("a", "c", "d")) self.assertEqual(func("a b c".split()), ("a", "c", None))
unknown
codeparrot/codeparrot-clean
#!/usr/bin/env python3 # Copyright 2014-2016 Open Source Robotics Foundation, 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. import argparse import copy import sys from ros_buildfarm.argument import add_argument_config_url from ros_buildfarm.argument import add_argument_dry_run from ros_buildfarm.argument import add_argument_rosdistro_name from ros_buildfarm.common import get_release_job_prefix from ros_buildfarm.config import get_index from ros_buildfarm.config import get_release_build_files from ros_buildfarm.git import get_repository from ros_buildfarm.jenkins import configure_job from ros_buildfarm.jenkins import configure_management_view from ros_buildfarm.jenkins import connect from ros_buildfarm.templates import expand_template def main(argv=sys.argv[1:]): parser = argparse.ArgumentParser( description="Generate the 'repos_status_page' job on Jenkins") add_argument_config_url(parser) add_argument_rosdistro_name(parser) add_argument_dry_run(parser) args = parser.parse_args(argv) config = get_index(args.config_url) job_config = get_job_config(args, config) jenkins = connect(config.jenkins_url) configure_management_view(jenkins, dry_run=args.dry_run) prefix = get_release_job_prefix(args.rosdistro_name) job_name = '%s_repos-status-page' % prefix configure_job(jenkins, job_name, job_config, dry_run=args.dry_run) def get_job_config(args, config): template_name = 'status/repos_status_page_job.xml.em' targets_by_repo = get_targets_by_repo(config, args.rosdistro_name) status_pages = {} for name, repo_urls in config.status_page_repositories.items(): data = get_status_page_data(repo_urls, targets_by_repo) if data is not None: status_pages[name] = data else: print(("Skipping repos status page '%s' since no repository URL" + "matches any of the release build files") % name) job_data = copy.deepcopy(args.__dict__) job_data.update({ 'ros_buildfarm_repository': get_repository(), 'status_pages': status_pages, 'notification_emails': config.distributions[args.rosdistro_name]['notification_emails'], }) job_config = expand_template(template_name, job_data) return job_config def get_targets_by_repo(config, ros_distro_name): # collect all target repositories (building) and their targets # from all release build files target_dicts_by_repo = {} release_build_files = get_release_build_files(config, ros_distro_name) for release_build_file in release_build_files.values(): target_repository = release_build_file.target_repository merged_os_names = target_dicts_by_repo.setdefault( target_repository, {}) for os_name in release_build_file.targets.keys(): os_code_names = release_build_file.targets[os_name] merged_os_code_names = merged_os_names.setdefault(os_name, {}) for os_code_name in os_code_names.keys(): arches = os_code_names[os_code_name] merged_arches = merged_os_code_names.setdefault( os_code_name, {}) for arch in arches.keys(): merged_arches.setdefault(arch, {}) # flatten each os_code_name and arch into a single colon separated string targets_by_repo = {} for target_repository in target_dicts_by_repo.keys(): targets_by_repo[target_repository] = [] targets = target_dicts_by_repo[target_repository] # TODO support other OS names for os_name in ['debian', 'ubuntu']: if os_name not in targets: continue for os_code_name in sorted(targets[os_name].keys()): target = '%s:source' % os_code_name targets_by_repo[target_repository].append(target) for arch in sorted(targets[os_name][os_code_name].keys()): target = '%s:%s' % (os_code_name, arch) targets_by_repo[target_repository].append(target) return targets_by_repo def get_status_page_data(repo_urls, targets_by_repo): targets = None for repo_url in repo_urls: if repo_url in targets_by_repo.keys(): targets = targets_by_repo[repo_url] break if targets is None: return None data = {} data['debian_repository_urls'] = repo_urls data['os_code_name_and_arch_tuples'] = targets return data if __name__ == '__main__': main()
unknown
codeparrot/codeparrot-clean
# -*- coding: utf-8 -*- # # Ranger documentation build configuration file, created by # sphinx-quickstart on Tue Jul 22 16:28:48 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os import pkg_resources # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.coverage', 'sphinx.ext.autosummary', 'sphinx.ext.todo', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'numpydoc' ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Ranger' copyright = u'2014, Eli Rodgers-Melnick' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # try: release = pkg_resources.get_distribution('Ranger').version except pkg_resources.DistributionNotFound: print("To build the documentation, the distribution information of Ranger") print("needs to be available. Either install the package into your development") print("environment or run 'setup.py develop' to set up the metadata.") print("A virtualenv is recommended!") sys.exit(1) del pkg_resources version = '.'.join(release.split('.')[:2]) # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'nature' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'Rangerdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'Ranger.tex', u'Ranger Documentation', u'Author', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'ranger', u'Ranger Documentation', [u'Author'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'Ranger', u'Ranger Documentation', u'Author', 'Ranger', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False # -- Options for Epub output ---------------------------------------------- # Bibliographic Dublin Core info. epub_title = u'Ranger' epub_author = u'Author' epub_publisher = u'Author' epub_copyright = u'2014, Author' # The basename for the epub file. It defaults to the project name. #epub_basename = u'Ranger' # The HTML theme for the epub output. Since the default themes are not optimized # for small screen space, using the same theme for HTML and epub output is # usually not wise. This defaults to 'epub', a theme designed to save visual # space. #epub_theme = 'epub' # The language of the text. It defaults to the language option # or en if the language is not set. #epub_language = '' # The scheme of the identifier. Typical schemes are ISBN or URL. #epub_scheme = '' # The unique identifier of the text. This can be a ISBN number # or the project homepage. #epub_identifier = '' # A unique identification for the text. #epub_uid = '' # A tuple containing the cover image and cover page html template filenames. #epub_cover = () # A sequence of (type, uri, title) tuples for the guide element of content.opf. #epub_guide = () # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_post_files = [] # A list of files that should not be packed into the epub file. epub_exclude_files = ['search.html'] # The depth of the table of contents in toc.ncx. #epub_tocdepth = 3 # Allow duplicate toc entries. #epub_tocdup = True # Choose between 'default' and 'includehidden'. #epub_tocscope = 'default' # Fix unsupported image types using the PIL. #epub_fix_images = False # Scale large images. #epub_max_image_width = 0 # How to display URL addresses: 'footnote', 'no', or 'inline'. #epub_show_urls = 'inline' # If false, no index is generated. #epub_use_index = True
unknown
codeparrot/codeparrot-clean
//===--- Migrator.cpp -----------------------------------------------------===// // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #include "Diff.h" #include "swift/Basic/Assertions.h" #include "swift/Frontend/Frontend.h" #include "swift/Migrator/ASTMigratorPass.h" #include "swift/Migrator/EditorAdapter.h" #include "swift/Migrator/FixitApplyDiagnosticConsumer.h" #include "swift/Migrator/Migrator.h" #include "swift/Migrator/RewriteBufferEditsReceiver.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Edit/EditedSource.h" #include "llvm/ADT/RewriteBuffer.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" using namespace swift; using namespace swift::migrator; bool migrator::updateCodeAndEmitRemapIfNeeded(CompilerInstance *Instance) { const auto &Invocation = Instance->getInvocation(); if (!Invocation.getMigratorOptions().shouldRunMigrator()) return false; // Delete the remap file, in case someone is re-running the Migrator. If the // file fails to compile and we don't get a chance to overwrite it, the old // changes may get picked up. llvm::sys::fs::remove(Invocation.getMigratorOptions().EmitRemapFilePath); Migrator M { Instance, Invocation }; // Provide inputs and configuration auto EffectiveVersion = Invocation.getLangOptions().EffectiveLanguageVersion; auto CurrentVersion = version::Version::getCurrentLanguageVersion(); // Phase 1: Pre Fix-it passes // These uses the initial frontend invocation to apply any obvious fix-its // to see if we can get an error-free AST to get to Phase 2. std::unique_ptr<swift::CompilerInstance> PreFixItInstance; if (Instance->getASTContext().hadError()) { PreFixItInstance = M.repeatFixitMigrations(2, EffectiveVersion); // If we still couldn't fix all of the errors, give up. if (PreFixItInstance == nullptr || !PreFixItInstance->hasASTContext() || PreFixItInstance->getASTContext().hadError()) { return true; } M.StartInstance = PreFixItInstance.get(); } // Phase 2: Syntactic Transformations // Don't run these passes if we're already in newest Swift version. if (EffectiveVersion != CurrentVersion) { SyntacticPassOptions Opts; // Type of optional try changes since Swift 5. Opts.RunOptionalTryMigration = !EffectiveVersion.isVersionAtLeast(5); auto FailedSyntacticPasses = M.performSyntacticPasses(Opts); if (FailedSyntacticPasses) { return true; } } // Phase 3: Post Fix-it Passes // Perform fix-it based migrations on the compiler, some number of times in // order to give the compiler an opportunity to // take its time reaching a fixed point. // This is the end of the pipeline, so we throw away the compiler instance(s) // we used in these fix-it runs. if (M.getMigratorOptions().EnableMigratorFixits) { M.repeatFixitMigrations(Migrator::MaxCompilerFixitPassIterations, CurrentVersion); } // OK, we have a final resulting text. Now we compare against the input // to calculate a replacement map describing the changes to the input // necessary to get the output. // TODO: Document replacement map format. auto EmitRemapFailed = M.emitRemap(); auto EmitMigratedFailed = M.emitMigratedFile(); auto DumpMigrationStatesFailed = M.dumpStates(); return EmitRemapFailed || EmitMigratedFailed || DumpMigrationStatesFailed; } Migrator::Migrator(CompilerInstance *StartInstance, const CompilerInvocation &StartInvocation) : StartInstance(StartInstance), StartInvocation(StartInvocation) { auto ErrorOrStartBuffer = llvm::MemoryBuffer::getFile(getInputFilename()); auto &StartBuffer = ErrorOrStartBuffer.get(); auto StartBufferID = SrcMgr.addNewSourceBuffer(std::move(StartBuffer)); States.push_back(MigrationState::start(SrcMgr, StartBufferID)); } std::unique_ptr<swift::CompilerInstance> Migrator::repeatFixitMigrations(const unsigned Iterations, version::Version SwiftLanguageVersion) { for (unsigned i = 0; i < Iterations; ++i) { auto ThisInstance = performAFixItMigration(SwiftLanguageVersion); if (ThisInstance == nullptr) { break; } else { if (States.back()->noChangesOccurred()) { return ThisInstance; } } } return nullptr; } std::unique_ptr<swift::CompilerInstance> Migrator::performAFixItMigration(version::Version SwiftLanguageVersion) { auto InputState = States.back(); auto InputText = InputState->getOutputText(); auto InputBuffer = llvm::MemoryBuffer::getMemBufferCopy(InputText, getInputFilename()); CompilerInvocation Invocation { StartInvocation }; Invocation.getFrontendOptions().InputsAndOutputs.clearInputs(); Invocation.getLangOptions().EffectiveLanguageVersion = SwiftLanguageVersion; auto &LLVMArgs = Invocation.getFrontendOptions().LLVMArgs; auto aarch64_use_tbi = std::find(LLVMArgs.begin(), LLVMArgs.end(), "-aarch64-use-tbi"); if (aarch64_use_tbi != LLVMArgs.end()) { LLVMArgs.erase(aarch64_use_tbi); } const auto &OrigFrontendOpts = StartInvocation.getFrontendOptions(); assert(OrigFrontendOpts.InputsAndOutputs.hasPrimaryInputs() && "Migration must have a primary"); for (const auto &input : OrigFrontendOpts.InputsAndOutputs.getAllInputs()) { Invocation.getFrontendOptions().InputsAndOutputs.addInput( InputFile(input.getFileName(), input.isPrimary(), input.isPrimary() ? InputBuffer.get() : input.getBuffer(), input.getType())); } auto Instance = std::make_unique<swift::CompilerInstance>(); // rdar://78576743 - Reset LLVM global state for command-line arguments set // by prior calls to setup. llvm::cl::ResetAllOptionOccurrences(); std::string InstanceSetupError; if (Instance->setup(Invocation, InstanceSetupError)) { return nullptr; } FixitApplyDiagnosticConsumer FixitApplyConsumer { InputText, getInputFilename(), }; Instance->addDiagnosticConsumer(&FixitApplyConsumer); Instance->performSema(); StringRef ResultText = InputText; unsigned ResultBufferID = InputState->getOutputBufferID(); if (FixitApplyConsumer.getNumFixitsApplied() > 0) { SmallString<4096> Scratch; llvm::raw_svector_ostream OS(Scratch); FixitApplyConsumer.printResult(OS); auto ResultBuffer = llvm::MemoryBuffer::getMemBufferCopy(OS.str()); ResultText = ResultBuffer->getBuffer(); ResultBufferID = SrcMgr.addNewSourceBuffer(std::move(ResultBuffer)); } States.push_back(MigrationState::make(MigrationKind::CompilerFixits, SrcMgr, InputState->getOutputBufferID(), ResultBufferID)); return Instance; } bool Migrator::performSyntacticPasses(SyntacticPassOptions Opts) { clang::FileSystemOptions ClangFileSystemOptions; clang::FileManager ClangFileManager { ClangFileSystemOptions }; llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> DummyClangDiagIDs { new clang::DiagnosticIDs() }; clang::DiagnosticOptions diagOpts; auto ClangDiags = std::make_unique<clang::DiagnosticsEngine>( DummyClangDiagIDs, diagOpts, new clang::DiagnosticConsumer(), /*ShouldOwnClient=*/true); clang::SourceManager ClangSourceManager { *ClangDiags, ClangFileManager }; clang::LangOptions ClangLangOpts; clang::edit::EditedSource Edits { ClangSourceManager, ClangLangOpts }; auto InputState = States.back(); auto InputText = InputState->getOutputText(); EditorAdapter Editor { StartInstance->getSourceMgr(), ClangSourceManager }; runAPIDiffMigratorPass(Editor, StartInstance->getPrimarySourceFile(), getMigratorOptions()); if (Opts.RunOptionalTryMigration) { runOptionalTryMigratorPass(Editor, StartInstance->getPrimarySourceFile(), getMigratorOptions()); } Edits.commit(Editor.getEdits()); RewriteBufferEditsReceiver Rewriter { ClangSourceManager, Editor.getClangFileIDForSwiftBufferID( StartInstance->getPrimarySourceFile()->getBufferID()), InputState->getOutputText() }; Edits.applyRewrites(Rewriter); SmallString<1024> Scratch; llvm::raw_svector_ostream OS(Scratch); Rewriter.printResult(OS); auto ResultBuffer = this->SrcMgr.addMemBufferCopy(OS.str()); States.push_back( MigrationState::make(MigrationKind::Syntactic, this->SrcMgr, States.back()->getInputBufferID(), ResultBuffer)); return false; } namespace { /// Print a replacement from a diff edit scriptto the given output stream. /// /// \param Filename The filename of the original file /// \param Rep The Replacement to print /// \param OS The output stream void printReplacement(const StringRef Filename, const Replacement &Rep, llvm::raw_ostream &OS) { assert(!Filename.empty()); if (Rep.Remove == 0 && Rep.Text.empty()) { return; } OS << " {\n"; OS << " \"file\": \""; OS.write_escaped(Filename); OS << "\",\n"; OS << " \"offset\": " << Rep.Offset; if (Rep.Remove > 0) { OS << ",\n"; OS << " \"remove\": " << Rep.Remove; } if (!Rep.Text.empty()) { OS << ",\n"; OS << " \"text\": \""; OS.write_escaped(Rep.Text); OS << "\"\n"; } else { OS << "\n"; } OS << " }"; } /// Print a remap file to the given output stream. /// /// \param OriginalFilename The filename of the file that was edited /// not the output file for printing here. /// \param InputText The input text without any changes. /// \param OutputText The result text after any changes. /// \param OS The output stream. void printRemap(const StringRef OriginalFilename, const StringRef InputText, const StringRef OutputText, llvm::raw_ostream &OS) { assert(!OriginalFilename.empty()); diff_match_patch<std::string> DMP; const auto Diffs = DMP.diff_main(InputText.str(), OutputText.str(), /*checkLines=*/false); OS << "["; size_t Offset = 0; llvm::SmallVector<Replacement, 32> Replacements; for (const auto &Diff : Diffs) { size_t OffsetIncrement = 0; switch (Diff.operation) { case decltype(DMP)::EQUAL: OffsetIncrement += Diff.text.size(); break; case decltype(DMP)::INSERT: Replacements.push_back({ Offset, 0, Diff.text }); break; case decltype(DMP)::DELETE: Replacements.push_back({ Offset, Diff.text.size(), "" }); OffsetIncrement = Diff.text.size(); break; } Offset += OffsetIncrement; } assert(Offset == InputText.size()); // Combine removal edits with previous edits that are consecutive. for (unsigned i = 1; i < Replacements.size();) { auto &Previous = Replacements[i-1]; auto &Current = Replacements[i]; assert(Current.Offset >= Previous.Offset + Previous.Remove); unsigned Distance = Current.Offset-(Previous.Offset + Previous.Remove); if (Distance > 0) { ++i; continue; } if (!Current.Text.empty()) { ++i; continue; } Previous.Remove += Current.Remove; Replacements.erase(Replacements.begin() + i); } // Combine removal edits with next edits that are consecutive. for (unsigned i = 0; i + 1 < Replacements.size();) { auto &Current = Replacements[i]; auto &nextRep = Replacements[i + 1]; assert(nextRep.Offset >= Current.Offset + Current.Remove); unsigned Distance = nextRep.Offset - (Current.Offset + Current.Remove); if (Distance > 0) { ++i; continue; } if (!Current.Text.empty()) { ++i; continue; } nextRep.Offset -= Current.Remove; nextRep.Remove += Current.Remove; Replacements.erase(Replacements.begin() + i); } // For remaining removal diffs, include the byte adjacent to the range on the // left. libclang applies the diffs as byte diffs, so it doesn't matter if the // byte is part of a multi-byte UTF8 character. for (unsigned i = 0; i < Replacements.size(); ++i) { auto &Current = Replacements[i]; if (!Current.Text.empty()) continue; if (Current.Offset == 0) continue; Current.Offset -= 1; Current.Remove += 1; Current.Text = InputText.substr(Current.Offset, 1).str(); } for (auto Rep = Replacements.begin(); Rep != Replacements.end(); ++Rep) { if (Rep != Replacements.begin()) { OS << ",\n"; } else { OS << "\n"; } printReplacement(OriginalFilename, *Rep, OS); } OS << "\n]"; } } // end anonymous namespace bool Migrator::emitRemap() const { const auto &RemapPath = getMigratorOptions().EmitRemapFilePath; if (RemapPath.empty()) { return false; } std::error_code Error; llvm::raw_fd_ostream FileOS(RemapPath, Error, llvm::sys::fs::OF_Text); if (FileOS.has_error()) { return true; } auto InputText = States.front()->getOutputText(); auto OutputText = States.back()->getOutputText(); printRemap(getInputFilename(), InputText, OutputText, FileOS); FileOS.flush(); return FileOS.has_error(); } bool Migrator::emitMigratedFile() const { const auto &OutFilename = getMigratorOptions().EmitMigratedFilePath; if (OutFilename.empty()) { return false; } std::error_code Error; llvm::raw_fd_ostream FileOS(OutFilename, Error, llvm::sys::fs::OF_Text); if (FileOS.has_error()) { return true; } FileOS << States.back()->getOutputText(); FileOS.flush(); return FileOS.has_error(); } bool Migrator::dumpStates() const { const auto &OutDir = getMigratorOptions().DumpMigrationStatesDir; if (OutDir.empty()) { return false; } auto Failed = false; for (size_t i = 0; i < States.size(); ++i) { Failed |= States[i]->print(i, OutDir); } return Failed; } const MigratorOptions &Migrator::getMigratorOptions() const { return StartInvocation.getMigratorOptions(); } const StringRef Migrator::getInputFilename() const { auto &PrimaryInput = StartInvocation.getFrontendOptions() .InputsAndOutputs.getRequiredUniquePrimaryInput(); return PrimaryInput.getFileName(); }
cpp
github
https://github.com/apple/swift
lib/Migrator/Migrator.cpp
"""Config flow to configure zone component.""" import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant import config_entries from homeassistant.const import ( CONF_NAME, CONF_LATITUDE, CONF_LONGITUDE, CONF_ICON, CONF_RADIUS) from homeassistant.core import callback from homeassistant.util import slugify from .const import CONF_PASSIVE, DOMAIN, HOME_ZONE @callback def configured_zones(hass): """Return a set of the configured hosts.""" return set((slugify(entry.data[CONF_NAME])) for entry in hass.config_entries.async_entries(DOMAIN)) @config_entries.HANDLERS.register(DOMAIN) class ZoneFlowHandler(config_entries.ConfigFlow): """Zone config flow.""" VERSION = 1 def __init__(self): """Initialize zone configuration flow.""" pass async def async_step_user(self, user_input=None): """Handle a flow initialized by the user.""" return await self.async_step_init(user_input) async def async_step_init(self, user_input=None): """Handle a flow start.""" errors = {} if user_input is not None: name = slugify(user_input[CONF_NAME]) if name not in configured_zones(self.hass) and name != HOME_ZONE: return self.async_create_entry( title=user_input[CONF_NAME], data=user_input, ) errors['base'] = 'name_exists' return self.async_show_form( step_id='init', data_schema=vol.Schema({ vol.Required(CONF_NAME): str, vol.Required(CONF_LATITUDE): cv.latitude, vol.Required(CONF_LONGITUDE): cv.longitude, vol.Optional(CONF_RADIUS): vol.Coerce(float), vol.Optional(CONF_ICON): str, vol.Optional(CONF_PASSIVE): bool, }), errors=errors, )
unknown
codeparrot/codeparrot-clean
# Copyright 2017 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. # ============================================================================== """Tests to check that py_test are properly loaded in BUILD files.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import subprocess def check_output_despite_error(args): """Get output of args from command line, even if there are errors. Args: args: a list of command line args. Returns: output as string. """ try: output = subprocess.check_output(args, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: output = e.output return output.strip() def main(): # Get all py_test target, note bazel query result will also include # cuda_py_test etc. try: targets = subprocess.check_output( 'bazel query "kind(py_test, //tensorflow/contrib/... + ' '//tensorflow/python/... - ' '//tensorflow/contrib/tensorboard/...)"', shell=True).strip() except subprocess.CalledProcessError as e: targets = e.output # Only keep py_test targets, and filter out targets with 'no_pip' tag. valid_targets = [] for target in targets.split('\n'): kind = check_output_despite_error(['buildozer', 'print kind', target]) if kind == 'py_test': tags = check_output_despite_error(['buildozer', 'print tags', target]) if 'no_pip' not in tags: valid_targets.append(target) # Get all BUILD files for all valid targets. build_files = set() for target in valid_targets: build_files.add(os.path.join(target[2:].split(':')[0], 'BUILD')) # Check if BUILD files load py_test. files_missing_load = [] for build_file in build_files: updated_build_file = subprocess.check_output( 'buildozer -stdout "new_load //tensorflow:tensorflow.bzl py_test" ' + build_file, shell=True) with open(build_file, 'r') as f: if f.read() != updated_build_file: files_missing_load.append(build_file) if files_missing_load: raise RuntimeError('The following files are missing %s:\n %s' % ( 'load("//tensorflow:tensorflow.bzl", "py_test").\nThis load statement' ' is needed because otherwise pip tests will try to use their ' 'dependencies, which are not visible to them.', '\n'.join(files_missing_load))) else: print('TEST PASSED.') if __name__ == '__main__': main()
unknown
codeparrot/codeparrot-clean
//go:build !ignore_autogenerated // +build !ignore_autogenerated /* Copyright The Kubernetes Authors. 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. */ // Code generated by validation-gen. DO NOT EDIT. package v1 import ( context "context" fmt "fmt" resourcev1 "k8s.io/api/resource/v1" equality "k8s.io/apimachinery/pkg/api/equality" operation "k8s.io/apimachinery/pkg/api/operation" safe "k8s.io/apimachinery/pkg/api/safe" validate "k8s.io/apimachinery/pkg/api/validate" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" types "k8s.io/apimachinery/pkg/types" sets "k8s.io/apimachinery/pkg/util/sets" field "k8s.io/apimachinery/pkg/util/validation/field" ) func init() { localSchemeBuilder.Register(RegisterValidations) } // RegisterValidations adds validation functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterValidations(scheme *runtime.Scheme) error { // type DeviceClass scheme.AddValidationFunc((*resourcev1.DeviceClass)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { switch op.Request.SubresourcePath() { case "/": return Validate_DeviceClass(ctx, op, nil /* fldPath */, obj.(*resourcev1.DeviceClass), safe.Cast[*resourcev1.DeviceClass](oldObj)) } return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} }) // type ResourceClaim scheme.AddValidationFunc((*resourcev1.ResourceClaim)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { switch op.Request.SubresourcePath() { case "/", "/status": return Validate_ResourceClaim(ctx, op, nil /* fldPath */, obj.(*resourcev1.ResourceClaim), safe.Cast[*resourcev1.ResourceClaim](oldObj)) } return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} }) // type ResourceClaimTemplate scheme.AddValidationFunc((*resourcev1.ResourceClaimTemplate)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { switch op.Request.SubresourcePath() { case "/": return Validate_ResourceClaimTemplate(ctx, op, nil /* fldPath */, obj.(*resourcev1.ResourceClaimTemplate), safe.Cast[*resourcev1.ResourceClaimTemplate](oldObj)) } return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} }) // type ResourceSlice scheme.AddValidationFunc((*resourcev1.ResourceSlice)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { switch op.Request.SubresourcePath() { case "/": return Validate_ResourceSlice(ctx, op, nil /* fldPath */, obj.(*resourcev1.ResourceSlice), safe.Cast[*resourcev1.ResourceSlice](oldObj)) } return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} }) return nil } // Validate_AllocatedDeviceStatus validates an instance of AllocatedDeviceStatus according // to declarative validation rules in the API schema. func Validate_AllocatedDeviceStatus(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.AllocatedDeviceStatus) (errs field.ErrorList) { // field resourcev1.AllocatedDeviceStatus.Driver has no validation // field resourcev1.AllocatedDeviceStatus.Pool has no validation // field resourcev1.AllocatedDeviceStatus.Device has no validation // field resourcev1.AllocatedDeviceStatus.ShareID errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.UUID(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("shareID"), obj.ShareID, safe.Field(oldObj, func(oldObj *resourcev1.AllocatedDeviceStatus) *string { return oldObj.ShareID }), oldObj != nil)...) // field resourcev1.AllocatedDeviceStatus.Conditions has no validation // field resourcev1.AllocatedDeviceStatus.Data has no validation // field resourcev1.AllocatedDeviceStatus.NetworkData errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.NetworkDeviceData, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_NetworkDeviceData(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("networkData"), obj.NetworkData, safe.Field(oldObj, func(oldObj *resourcev1.AllocatedDeviceStatus) *resourcev1.NetworkDeviceData { return oldObj.NetworkData }), oldObj != nil)...) return errs } var symbolsForAllocationConfigSource = sets.New(resourcev1.AllocationConfigSourceClaim, resourcev1.AllocationConfigSourceClass) // Validate_AllocationConfigSource validates an instance of AllocationConfigSource according // to declarative validation rules in the API schema. func Validate_AllocationConfigSource(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.AllocationConfigSource) (errs field.ErrorList) { errs = append(errs, validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForAllocationConfigSource, nil)...) return errs } // Validate_AllocationResult validates an instance of AllocationResult according // to declarative validation rules in the API schema. func Validate_AllocationResult(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.AllocationResult) (errs field.ErrorList) { // field resourcev1.AllocationResult.Devices errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceAllocationResult, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceAllocationResult(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("devices"), &obj.Devices, safe.Field(oldObj, func(oldObj *resourcev1.AllocationResult) *resourcev1.DeviceAllocationResult { return &oldObj.Devices }), oldObj != nil)...) // field resourcev1.AllocationResult.NodeSelector has no validation // field resourcev1.AllocationResult.AllocationTimestamp has no validation return errs } // Validate_CounterSet validates an instance of CounterSet according // to declarative validation rules in the API schema. func Validate_CounterSet(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.CounterSet) (errs field.ErrorList) { // field resourcev1.CounterSet.Name errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.ShortName(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("name"), &obj.Name, safe.Field(oldObj, func(oldObj *resourcev1.CounterSet) *string { return &oldObj.Name }), oldObj != nil)...) // field resourcev1.CounterSet.Counters errs = append(errs, func(fldPath *field.Path, obj, oldObj map[string]resourcev1.Counter, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredMap(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.EachMapKey(ctx, op, fldPath, obj, oldObj, validate.ShortName)...) return }(fldPath.Child("counters"), obj.Counters, safe.Field(oldObj, func(oldObj *resourcev1.CounterSet) map[string]resourcev1.Counter { return oldObj.Counters }), oldObj != nil)...) return errs } // Validate_Device validates an instance of Device according // to declarative validation rules in the API schema. func Validate_Device(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.Device) (errs field.ErrorList) { // field resourcev1.Device.Name has no validation // field resourcev1.Device.Attributes errs = append(errs, func(fldPath *field.Path, obj, oldObj map[resourcev1.QualifiedName]resourcev1.DeviceAttribute, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // iterate the map and call the value type's validation function errs = append(errs, validate.EachMapVal(ctx, op, fldPath, obj, oldObj, validate.SemanticDeepEqual, Validate_DeviceAttribute)...) return }(fldPath.Child("attributes"), obj.Attributes, safe.Field(oldObj, func(oldObj *resourcev1.Device) map[resourcev1.QualifiedName]resourcev1.DeviceAttribute { return oldObj.Attributes }), oldObj != nil)...) // field resourcev1.Device.Capacity has no validation // field resourcev1.Device.ConsumesCounters errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceCounterConsumption, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 2); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with map semantics require unique keys errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, func(a resourcev1.DeviceCounterConsumption, b resourcev1.DeviceCounterConsumption) bool { return a.CounterSet == b.CounterSet })...) // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, func(a resourcev1.DeviceCounterConsumption, b resourcev1.DeviceCounterConsumption) bool { return a.CounterSet == b.CounterSet }, validate.SemanticDeepEqual, Validate_DeviceCounterConsumption)...) return }(fldPath.Child("consumesCounters"), obj.ConsumesCounters, safe.Field(oldObj, func(oldObj *resourcev1.Device) []resourcev1.DeviceCounterConsumption { return oldObj.ConsumesCounters }), oldObj != nil)...) // field resourcev1.Device.NodeName has no validation // field resourcev1.Device.NodeSelector has no validation // field resourcev1.Device.AllNodes has no validation // field resourcev1.Device.Taints errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceTaint, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceTaint)...) return }(fldPath.Child("taints"), obj.Taints, safe.Field(oldObj, func(oldObj *resourcev1.Device) []resourcev1.DeviceTaint { return oldObj.Taints }), oldObj != nil)...) // field resourcev1.Device.BindsToNode has no validation // field resourcev1.Device.BindingConditions errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("bindingConditions"), obj.BindingConditions, safe.Field(oldObj, func(oldObj *resourcev1.Device) []string { return oldObj.BindingConditions }), oldObj != nil)...) // field resourcev1.Device.BindingFailureConditions errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("bindingFailureConditions"), obj.BindingFailureConditions, safe.Field(oldObj, func(oldObj *resourcev1.Device) []string { return oldObj.BindingFailureConditions }), oldObj != nil)...) // field resourcev1.Device.AllowMultipleAllocations has no validation return errs } // Validate_DeviceAllocationConfiguration validates an instance of DeviceAllocationConfiguration according // to declarative validation rules in the API schema. func Validate_DeviceAllocationConfiguration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceAllocationConfiguration) (errs field.ErrorList) { // field resourcev1.DeviceAllocationConfiguration.Source errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.AllocationConfigSource, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_AllocationConfigSource(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("source"), &obj.Source, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAllocationConfiguration) *resourcev1.AllocationConfigSource { return &oldObj.Source }), oldObj != nil)...) // field resourcev1.DeviceAllocationConfiguration.Requests errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with set semantics require unique values errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual)...) return }(fldPath.Child("requests"), obj.Requests, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAllocationConfiguration) []string { return oldObj.Requests }), oldObj != nil)...) // field resourcev1.DeviceAllocationConfiguration.DeviceConfiguration errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) return }(safe.Value(fldPath, func() *field.Path { return fldPath.Child("resourcev1.DeviceConfiguration") }), &obj.DeviceConfiguration, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAllocationConfiguration) *resourcev1.DeviceConfiguration { return &oldObj.DeviceConfiguration }), oldObj != nil)...) return errs } var symbolsForDeviceAllocationMode = sets.New(resourcev1.DeviceAllocationModeAll, resourcev1.DeviceAllocationModeExactCount) // Validate_DeviceAllocationMode validates an instance of DeviceAllocationMode according // to declarative validation rules in the API schema. func Validate_DeviceAllocationMode(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceAllocationMode) (errs field.ErrorList) { errs = append(errs, validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceAllocationMode, nil)...) return errs } // Validate_DeviceAllocationResult validates an instance of DeviceAllocationResult according // to declarative validation rules in the API schema. func Validate_DeviceAllocationResult(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceAllocationResult) (errs field.ErrorList) { // field resourcev1.DeviceAllocationResult.Results errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceRequestAllocationResult, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceRequestAllocationResult)...) return }(fldPath.Child("results"), obj.Results, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAllocationResult) []resourcev1.DeviceRequestAllocationResult { return oldObj.Results }), oldObj != nil)...) // field resourcev1.DeviceAllocationResult.Config errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceAllocationConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 64); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceAllocationConfiguration)...) return }(fldPath.Child("config"), obj.Config, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAllocationResult) []resourcev1.DeviceAllocationConfiguration { return oldObj.Config }), oldObj != nil)...) return errs } var unionMembershipFor_k8s_io_api_resource_v1_DeviceAttribute_ = validate.NewUnionMembership(validate.NewUnionMember("int"), validate.NewUnionMember("bool"), validate.NewUnionMember("string"), validate.NewUnionMember("version")) // Validate_DeviceAttribute validates an instance of DeviceAttribute according // to declarative validation rules in the API schema. func Validate_DeviceAttribute(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceAttribute) (errs field.ErrorList) { errs = append(errs, validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_resource_v1_DeviceAttribute_, func(obj *resourcev1.DeviceAttribute) bool { if obj == nil { return false } return obj.IntValue != nil }, func(obj *resourcev1.DeviceAttribute) bool { if obj == nil { return false } return obj.BoolValue != nil }, func(obj *resourcev1.DeviceAttribute) bool { if obj == nil { return false } return obj.StringValue != nil }, func(obj *resourcev1.DeviceAttribute) bool { if obj == nil { return false } return obj.VersionValue != nil })...) // field resourcev1.DeviceAttribute.IntValue errs = append(errs, func(fldPath *field.Path, obj, oldObj *int64, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("int"), obj.IntValue, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAttribute) *int64 { return oldObj.IntValue }), oldObj != nil)...) // field resourcev1.DeviceAttribute.BoolValue errs = append(errs, func(fldPath *field.Path, obj, oldObj *bool, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("bool"), obj.BoolValue, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAttribute) *bool { return oldObj.BoolValue }), oldObj != nil)...) // field resourcev1.DeviceAttribute.StringValue errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("string"), obj.StringValue, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAttribute) *string { return oldObj.StringValue }), oldObj != nil)...) // field resourcev1.DeviceAttribute.VersionValue errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("version"), obj.VersionValue, safe.Field(oldObj, func(oldObj *resourcev1.DeviceAttribute) *string { return oldObj.VersionValue }), oldObj != nil)...) return errs } // Validate_DeviceClaim validates an instance of DeviceClaim according // to declarative validation rules in the API schema. func Validate_DeviceClaim(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceClaim) (errs field.ErrorList) { // field resourcev1.DeviceClaim.Requests errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceRequest, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with map semantics require unique keys errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, func(a resourcev1.DeviceRequest, b resourcev1.DeviceRequest) bool { return a.Name == b.Name })...) // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, func(a resourcev1.DeviceRequest, b resourcev1.DeviceRequest) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_DeviceRequest)...) return }(fldPath.Child("requests"), obj.Requests, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClaim) []resourcev1.DeviceRequest { return oldObj.Requests }), oldObj != nil)...) // field resourcev1.DeviceClaim.Constraints errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceConstraint, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceConstraint)...) return }(fldPath.Child("constraints"), obj.Constraints, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClaim) []resourcev1.DeviceConstraint { return oldObj.Constraints }), oldObj != nil)...) // field resourcev1.DeviceClaim.Config errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceClaimConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceClaimConfiguration)...) return }(fldPath.Child("config"), obj.Config, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClaim) []resourcev1.DeviceClaimConfiguration { return oldObj.Config }), oldObj != nil)...) return errs } // Validate_DeviceClaimConfiguration validates an instance of DeviceClaimConfiguration according // to declarative validation rules in the API schema. func Validate_DeviceClaimConfiguration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceClaimConfiguration) (errs field.ErrorList) { // field resourcev1.DeviceClaimConfiguration.Requests errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with set semantics require unique values errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual)...) return }(fldPath.Child("requests"), obj.Requests, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClaimConfiguration) []string { return oldObj.Requests }), oldObj != nil)...) // field resourcev1.DeviceClaimConfiguration.DeviceConfiguration errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) return }(safe.Value(fldPath, func() *field.Path { return fldPath.Child("resourcev1.DeviceConfiguration") }), &obj.DeviceConfiguration, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClaimConfiguration) *resourcev1.DeviceConfiguration { return &oldObj.DeviceConfiguration }), oldObj != nil)...) return errs } // Validate_DeviceClass validates an instance of DeviceClass according // to declarative validation rules in the API schema. func Validate_DeviceClass(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceClass) (errs field.ErrorList) { // field resourcev1.DeviceClass.TypeMeta has no validation // field resourcev1.DeviceClass.ObjectMeta errs = append(errs, func(fldPath *field.Path, obj, oldObj *metav1.ObjectMeta, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations func() { // cohort name earlyReturn := false if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "name", func(o *metav1.ObjectMeta) *string { return &o.Name }, validate.DirectEqualPtr, validate.OptionalValue); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.Subfield(ctx, op, fldPath, obj, oldObj, "name", func(o *metav1.ObjectMeta) *string { return &o.Name }, validate.DirectEqualPtr, validate.LongName)...) }() return }(fldPath.Child("metadata"), &obj.ObjectMeta, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClass) *metav1.ObjectMeta { return &oldObj.ObjectMeta }), oldObj != nil)...) // field resourcev1.DeviceClass.Spec errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceClassSpec, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceClassSpec(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClass) *resourcev1.DeviceClassSpec { return &oldObj.Spec }), oldObj != nil)...) return errs } // Validate_DeviceClassConfiguration validates an instance of DeviceClassConfiguration according // to declarative validation rules in the API schema. func Validate_DeviceClassConfiguration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceClassConfiguration) (errs field.ErrorList) { // field resourcev1.DeviceClassConfiguration.DeviceConfiguration errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) return }(safe.Value(fldPath, func() *field.Path { return fldPath.Child("resourcev1.DeviceConfiguration") }), &obj.DeviceConfiguration, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClassConfiguration) *resourcev1.DeviceConfiguration { return &oldObj.DeviceConfiguration }), oldObj != nil)...) return errs } // Validate_DeviceClassSpec validates an instance of DeviceClassSpec according // to declarative validation rules in the API schema. func Validate_DeviceClassSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceClassSpec) (errs field.ErrorList) { // field resourcev1.DeviceClassSpec.Selectors errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceSelector, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("selectors"), obj.Selectors, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClassSpec) []resourcev1.DeviceSelector { return oldObj.Selectors }), oldObj != nil)...) // field resourcev1.DeviceClassSpec.Config errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceClassConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceClassConfiguration)...) return }(fldPath.Child("config"), obj.Config, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClassSpec) []resourcev1.DeviceClassConfiguration { return oldObj.Config }), oldObj != nil)...) // field resourcev1.DeviceClassSpec.ExtendedResourceName errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.ExtendedResourceName(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("extendedResourceName"), obj.ExtendedResourceName, safe.Field(oldObj, func(oldObj *resourcev1.DeviceClassSpec) *string { return oldObj.ExtendedResourceName }), oldObj != nil)...) return errs } // Validate_DeviceConfiguration validates an instance of DeviceConfiguration according // to declarative validation rules in the API schema. func Validate_DeviceConfiguration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceConfiguration) (errs field.ErrorList) { // field resourcev1.DeviceConfiguration.Opaque errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.OpaqueDeviceConfiguration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_OpaqueDeviceConfiguration(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("opaque"), obj.Opaque, safe.Field(oldObj, func(oldObj *resourcev1.DeviceConfiguration) *resourcev1.OpaqueDeviceConfiguration { return oldObj.Opaque }), oldObj != nil)...) return errs } // Validate_DeviceConstraint validates an instance of DeviceConstraint according // to declarative validation rules in the API schema. func Validate_DeviceConstraint(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceConstraint) (errs field.ErrorList) { // field resourcev1.DeviceConstraint.Requests errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with set semantics require unique values errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual)...) return }(fldPath.Child("requests"), obj.Requests, safe.Field(oldObj, func(oldObj *resourcev1.DeviceConstraint) []string { return oldObj.Requests }), oldObj != nil)...) // field resourcev1.DeviceConstraint.MatchAttribute errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.FullyQualifiedName, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.ResourceFullyQualifiedName(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("matchAttribute"), obj.MatchAttribute, safe.Field(oldObj, func(oldObj *resourcev1.DeviceConstraint) *resourcev1.FullyQualifiedName { return oldObj.MatchAttribute }), oldObj != nil)...) // field resourcev1.DeviceConstraint.DistinctAttribute has no validation return errs } // Validate_DeviceCounterConsumption validates an instance of DeviceCounterConsumption according // to declarative validation rules in the API schema. func Validate_DeviceCounterConsumption(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceCounterConsumption) (errs field.ErrorList) { // field resourcev1.DeviceCounterConsumption.CounterSet errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.ShortName(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("counterSet"), &obj.CounterSet, safe.Field(oldObj, func(oldObj *resourcev1.DeviceCounterConsumption) *string { return &oldObj.CounterSet }), oldObj != nil)...) // field resourcev1.DeviceCounterConsumption.Counters errs = append(errs, func(fldPath *field.Path, obj, oldObj map[string]resourcev1.Counter, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredMap(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.EachMapKey(ctx, op, fldPath, obj, oldObj, validate.ShortName)...) return }(fldPath.Child("counters"), obj.Counters, safe.Field(oldObj, func(oldObj *resourcev1.DeviceCounterConsumption) map[string]resourcev1.Counter { return oldObj.Counters }), oldObj != nil)...) return errs } // Validate_DeviceRequest validates an instance of DeviceRequest according // to declarative validation rules in the API schema. func Validate_DeviceRequest(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceRequest) (errs field.ErrorList) { // field resourcev1.DeviceRequest.Name has no validation // field resourcev1.DeviceRequest.Exactly errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.ExactDeviceRequest, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_ExactDeviceRequest(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("exactly"), obj.Exactly, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequest) *resourcev1.ExactDeviceRequest { return oldObj.Exactly }), oldObj != nil)...) // field resourcev1.DeviceRequest.FirstAvailable errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceSubRequest, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with map semantics require unique keys errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, func(a resourcev1.DeviceSubRequest, b resourcev1.DeviceSubRequest) bool { return a.Name == b.Name })...) // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, func(a resourcev1.DeviceSubRequest, b resourcev1.DeviceSubRequest) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_DeviceSubRequest)...) return }(fldPath.Child("firstAvailable"), obj.FirstAvailable, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequest) []resourcev1.DeviceSubRequest { return oldObj.FirstAvailable }), oldObj != nil)...) return errs } // Validate_DeviceRequestAllocationResult validates an instance of DeviceRequestAllocationResult according // to declarative validation rules in the API schema. func Validate_DeviceRequestAllocationResult(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceRequestAllocationResult) (errs field.ErrorList) { // field resourcev1.DeviceRequestAllocationResult.Request has no validation // field resourcev1.DeviceRequestAllocationResult.Driver errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.LongNameCaseless(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("driver"), &obj.Driver, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequestAllocationResult) *string { return &oldObj.Driver }), oldObj != nil)...) // field resourcev1.DeviceRequestAllocationResult.Pool errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.ResourcePoolName(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("pool"), &obj.Pool, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequestAllocationResult) *string { return &oldObj.Pool }), oldObj != nil)...) // field resourcev1.DeviceRequestAllocationResult.Device has no validation // field resourcev1.DeviceRequestAllocationResult.AdminAccess has no validation // field resourcev1.DeviceRequestAllocationResult.Tolerations errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceToleration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceToleration)...) return }(fldPath.Child("tolerations"), obj.Tolerations, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequestAllocationResult) []resourcev1.DeviceToleration { return oldObj.Tolerations }), oldObj != nil)...) // field resourcev1.DeviceRequestAllocationResult.BindingConditions errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("bindingConditions"), obj.BindingConditions, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequestAllocationResult) []string { return oldObj.BindingConditions }), oldObj != nil)...) // field resourcev1.DeviceRequestAllocationResult.BindingFailureConditions errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("bindingFailureConditions"), obj.BindingFailureConditions, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequestAllocationResult) []string { return oldObj.BindingFailureConditions }), oldObj != nil)...) // field resourcev1.DeviceRequestAllocationResult.ShareID errs = append(errs, func(fldPath *field.Path, obj, oldObj *types.UID, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.UUID(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("shareID"), obj.ShareID, safe.Field(oldObj, func(oldObj *resourcev1.DeviceRequestAllocationResult) *types.UID { return oldObj.ShareID }), oldObj != nil)...) // field resourcev1.DeviceRequestAllocationResult.ConsumedCapacity has no validation return errs } // Validate_DeviceSubRequest validates an instance of DeviceSubRequest according // to declarative validation rules in the API schema. func Validate_DeviceSubRequest(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceSubRequest) (errs field.ErrorList) { // field resourcev1.DeviceSubRequest.Name has no validation // field resourcev1.DeviceSubRequest.DeviceClassName errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.LongName(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("deviceClassName"), &obj.DeviceClassName, safe.Field(oldObj, func(oldObj *resourcev1.DeviceSubRequest) *string { return &oldObj.DeviceClassName }), oldObj != nil)...) // field resourcev1.DeviceSubRequest.Selectors errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceSelector, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("selectors"), obj.Selectors, safe.Field(oldObj, func(oldObj *resourcev1.DeviceSubRequest) []resourcev1.DeviceSelector { return oldObj.Selectors }), oldObj != nil)...) // field resourcev1.DeviceSubRequest.AllocationMode errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceAllocationMode, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceAllocationMode(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("allocationMode"), &obj.AllocationMode, safe.Field(oldObj, func(oldObj *resourcev1.DeviceSubRequest) *resourcev1.DeviceAllocationMode { return &oldObj.AllocationMode }), oldObj != nil)...) // field resourcev1.DeviceSubRequest.Count has no validation // field resourcev1.DeviceSubRequest.Tolerations errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceToleration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceToleration)...) return }(fldPath.Child("tolerations"), obj.Tolerations, safe.Field(oldObj, func(oldObj *resourcev1.DeviceSubRequest) []resourcev1.DeviceToleration { return oldObj.Tolerations }), oldObj != nil)...) // field resourcev1.DeviceSubRequest.Capacity has no validation return errs } // Validate_DeviceTaint validates an instance of DeviceTaint according // to declarative validation rules in the API schema. func Validate_DeviceTaint(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceTaint) (errs field.ErrorList) { // field resourcev1.DeviceTaint.Key has no validation // field resourcev1.DeviceTaint.Value has no validation // field resourcev1.DeviceTaint.Effect errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceTaintEffect, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_DeviceTaintEffect(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("effect"), &obj.Effect, safe.Field(oldObj, func(oldObj *resourcev1.DeviceTaint) *resourcev1.DeviceTaintEffect { return &oldObj.Effect }), oldObj != nil)...) // field resourcev1.DeviceTaint.TimeAdded has no validation return errs } var symbolsForDeviceTaintEffect = sets.New(resourcev1.DeviceTaintEffectNoExecute, resourcev1.DeviceTaintEffectNoSchedule, resourcev1.DeviceTaintEffectNone) // Validate_DeviceTaintEffect validates an instance of DeviceTaintEffect according // to declarative validation rules in the API schema. func Validate_DeviceTaintEffect(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceTaintEffect) (errs field.ErrorList) { errs = append(errs, validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceTaintEffect, nil)...) return errs } // Validate_DeviceToleration validates an instance of DeviceToleration according // to declarative validation rules in the API schema. func Validate_DeviceToleration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceToleration) (errs field.ErrorList) { // field resourcev1.DeviceToleration.Key errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.LabelKey(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("key"), &obj.Key, safe.Field(oldObj, func(oldObj *resourcev1.DeviceToleration) *string { return &oldObj.Key }), oldObj != nil)...) // field resourcev1.DeviceToleration.Operator errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceTolerationOperator, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceTolerationOperator(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("operator"), &obj.Operator, safe.Field(oldObj, func(oldObj *resourcev1.DeviceToleration) *resourcev1.DeviceTolerationOperator { return &oldObj.Operator }), oldObj != nil)...) // field resourcev1.DeviceToleration.Value has no validation // field resourcev1.DeviceToleration.Effect errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceTaintEffect, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceTaintEffect(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("effect"), &obj.Effect, safe.Field(oldObj, func(oldObj *resourcev1.DeviceToleration) *resourcev1.DeviceTaintEffect { return &oldObj.Effect }), oldObj != nil)...) // field resourcev1.DeviceToleration.TolerationSeconds has no validation return errs } var symbolsForDeviceTolerationOperator = sets.New(resourcev1.DeviceTolerationOpEqual, resourcev1.DeviceTolerationOpExists) // Validate_DeviceTolerationOperator validates an instance of DeviceTolerationOperator according // to declarative validation rules in the API schema. func Validate_DeviceTolerationOperator(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.DeviceTolerationOperator) (errs field.ErrorList) { errs = append(errs, validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceTolerationOperator, nil)...) return errs } // Validate_ExactDeviceRequest validates an instance of ExactDeviceRequest according // to declarative validation rules in the API schema. func Validate_ExactDeviceRequest(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ExactDeviceRequest) (errs field.ErrorList) { // field resourcev1.ExactDeviceRequest.DeviceClassName has no validation // field resourcev1.ExactDeviceRequest.Selectors errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceSelector, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 32); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } return }(fldPath.Child("selectors"), obj.Selectors, safe.Field(oldObj, func(oldObj *resourcev1.ExactDeviceRequest) []resourcev1.DeviceSelector { return oldObj.Selectors }), oldObj != nil)...) // field resourcev1.ExactDeviceRequest.AllocationMode errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceAllocationMode, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_DeviceAllocationMode(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("allocationMode"), &obj.AllocationMode, safe.Field(oldObj, func(oldObj *resourcev1.ExactDeviceRequest) *resourcev1.DeviceAllocationMode { return &oldObj.AllocationMode }), oldObj != nil)...) // field resourcev1.ExactDeviceRequest.Count has no validation // field resourcev1.ExactDeviceRequest.AdminAccess has no validation // field resourcev1.ExactDeviceRequest.Tolerations errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.DeviceToleration, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_DeviceToleration)...) return }(fldPath.Child("tolerations"), obj.Tolerations, safe.Field(oldObj, func(oldObj *resourcev1.ExactDeviceRequest) []resourcev1.DeviceToleration { return oldObj.Tolerations }), oldObj != nil)...) // field resourcev1.ExactDeviceRequest.Capacity has no validation return errs } // Validate_NetworkDeviceData validates an instance of NetworkDeviceData according // to declarative validation rules in the API schema. func Validate_NetworkDeviceData(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.NetworkDeviceData) (errs field.ErrorList) { // field resourcev1.NetworkDeviceData.InterfaceName errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.MaxLength(ctx, op, fldPath, obj, oldObj, 256)...) return }(fldPath.Child("interfaceName"), &obj.InterfaceName, safe.Field(oldObj, func(oldObj *resourcev1.NetworkDeviceData) *string { return &oldObj.InterfaceName }), oldObj != nil)...) // field resourcev1.NetworkDeviceData.IPs errs = append(errs, func(fldPath *field.Path, obj, oldObj []string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 16); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with set semantics require unique values errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, validate.DirectEqual)...) return }(fldPath.Child("ips"), obj.IPs, safe.Field(oldObj, func(oldObj *resourcev1.NetworkDeviceData) []string { return oldObj.IPs }), oldObj != nil)...) // field resourcev1.NetworkDeviceData.HardwareAddress errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.MaxLength(ctx, op, fldPath, obj, oldObj, 128)...) return }(fldPath.Child("hardwareAddress"), &obj.HardwareAddress, safe.Field(oldObj, func(oldObj *resourcev1.NetworkDeviceData) *string { return &oldObj.HardwareAddress }), oldObj != nil)...) return errs } // Validate_OpaqueDeviceConfiguration validates an instance of OpaqueDeviceConfiguration according // to declarative validation rules in the API schema. func Validate_OpaqueDeviceConfiguration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.OpaqueDeviceConfiguration) (errs field.ErrorList) { // field resourcev1.OpaqueDeviceConfiguration.Driver errs = append(errs, func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations earlyReturn := false if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } errs = append(errs, validate.LongNameCaseless(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("driver"), &obj.Driver, safe.Field(oldObj, func(oldObj *resourcev1.OpaqueDeviceConfiguration) *string { return &oldObj.Driver }), oldObj != nil)...) // field resourcev1.OpaqueDeviceConfiguration.Parameters has no validation return errs } // Validate_ResourceClaim validates an instance of ResourceClaim according // to declarative validation rules in the API schema. func Validate_ResourceClaim(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaim) (errs field.ErrorList) { // field resourcev1.ResourceClaim.TypeMeta has no validation // field resourcev1.ResourceClaim.ObjectMeta has no validation // field resourcev1.ResourceClaim.Spec errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimSpec, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.Immutable(ctx, op, fldPath, obj, oldObj); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_ResourceClaimSpec(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaim) *resourcev1.ResourceClaimSpec { return &oldObj.Spec }), oldObj != nil)...) // field resourcev1.ResourceClaim.Status errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimStatus, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_ResourceClaimStatus(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("status"), &obj.Status, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaim) *resourcev1.ResourceClaimStatus { return &oldObj.Status }), oldObj != nil)...) return errs } // Validate_ResourceClaimSpec validates an instance of ResourceClaimSpec according // to declarative validation rules in the API schema. func Validate_ResourceClaimSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimSpec) (errs field.ErrorList) { // field resourcev1.ResourceClaimSpec.Devices errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.DeviceClaim, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_DeviceClaim(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("devices"), &obj.Devices, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaimSpec) *resourcev1.DeviceClaim { return &oldObj.Devices }), oldObj != nil)...) return errs } // Validate_ResourceClaimStatus validates an instance of ResourceClaimStatus according // to declarative validation rules in the API schema. func Validate_ResourceClaimStatus(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimStatus) (errs field.ErrorList) { // field resourcev1.ResourceClaimStatus.Allocation errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.AllocationResult, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoModify); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } // call the type's validation function errs = append(errs, Validate_AllocationResult(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("allocation"), obj.Allocation, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaimStatus) *resourcev1.AllocationResult { return oldObj.Allocation }), oldObj != nil)...) // field resourcev1.ResourceClaimStatus.ReservedFor errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.ResourceClaimConsumerReference, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 256); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with map semantics require unique keys errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, func(a resourcev1.ResourceClaimConsumerReference, b resourcev1.ResourceClaimConsumerReference) bool { return a.UID == b.UID })...) return }(fldPath.Child("reservedFor"), obj.ReservedFor, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaimStatus) []resourcev1.ResourceClaimConsumerReference { return oldObj.ReservedFor }), oldObj != nil)...) // field resourcev1.ResourceClaimStatus.Devices errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.AllocatedDeviceStatus, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with map semantics require unique keys errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, func(a resourcev1.AllocatedDeviceStatus, b resourcev1.AllocatedDeviceStatus) bool { return a.Driver == b.Driver && a.Device == b.Device && a.Pool == b.Pool && ((a.ShareID == nil && b.ShareID == nil) || (a.ShareID != nil && b.ShareID != nil && *a.ShareID == *b.ShareID)) })...) // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, func(a resourcev1.AllocatedDeviceStatus, b resourcev1.AllocatedDeviceStatus) bool { return a.Driver == b.Driver && a.Device == b.Device && a.Pool == b.Pool && ((a.ShareID == nil && b.ShareID == nil) || (a.ShareID != nil && b.ShareID != nil && *a.ShareID == *b.ShareID)) }, validate.SemanticDeepEqual, Validate_AllocatedDeviceStatus)...) return }(fldPath.Child("devices"), obj.Devices, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaimStatus) []resourcev1.AllocatedDeviceStatus { return oldObj.Devices }), oldObj != nil)...) return errs } // Validate_ResourceClaimTemplate validates an instance of ResourceClaimTemplate according // to declarative validation rules in the API schema. func Validate_ResourceClaimTemplate(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimTemplate) (errs field.ErrorList) { // field resourcev1.ResourceClaimTemplate.TypeMeta has no validation // field resourcev1.ResourceClaimTemplate.ObjectMeta has no validation // field resourcev1.ResourceClaimTemplate.Spec errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimTemplateSpec, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_ResourceClaimTemplateSpec(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaimTemplate) *resourcev1.ResourceClaimTemplateSpec { return &oldObj.Spec }), oldObj != nil)...) return errs } // Validate_ResourceClaimTemplateSpec validates an instance of ResourceClaimTemplateSpec according // to declarative validation rules in the API schema. func Validate_ResourceClaimTemplateSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimTemplateSpec) (errs field.ErrorList) { // field resourcev1.ResourceClaimTemplateSpec.ObjectMeta has no validation // field resourcev1.ResourceClaimTemplateSpec.Spec errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.ResourceClaimSpec, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_ResourceClaimSpec(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1.ResourceClaimTemplateSpec) *resourcev1.ResourceClaimSpec { return &oldObj.Spec }), oldObj != nil)...) return errs } // Validate_ResourceSlice validates an instance of ResourceSlice according // to declarative validation rules in the API schema. func Validate_ResourceSlice(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceSlice) (errs field.ErrorList) { // field resourcev1.ResourceSlice.TypeMeta has no validation // field resourcev1.ResourceSlice.ObjectMeta has no validation // field resourcev1.ResourceSlice.Spec errs = append(errs, func(fldPath *field.Path, obj, oldObj *resourcev1.ResourceSliceSpec, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call the type's validation function errs = append(errs, Validate_ResourceSliceSpec(ctx, op, fldPath, obj, oldObj)...) return }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1.ResourceSlice) *resourcev1.ResourceSliceSpec { return &oldObj.Spec }), oldObj != nil)...) return errs } // Validate_ResourceSliceSpec validates an instance of ResourceSliceSpec according // to declarative validation rules in the API schema. func Validate_ResourceSliceSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1.ResourceSliceSpec) (errs field.ErrorList) { // field resourcev1.ResourceSliceSpec.Driver has no validation // field resourcev1.ResourceSliceSpec.Pool has no validation // field resourcev1.ResourceSliceSpec.NodeName has no validation // field resourcev1.ResourceSliceSpec.NodeSelector has no validation // field resourcev1.ResourceSliceSpec.AllNodes has no validation // field resourcev1.ResourceSliceSpec.Devices errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.Device, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_Device)...) return }(fldPath.Child("devices"), obj.Devices, safe.Field(oldObj, func(oldObj *resourcev1.ResourceSliceSpec) []resourcev1.Device { return oldObj.Devices }), oldObj != nil)...) // field resourcev1.ResourceSliceSpec.PerDeviceNodeSelection has no validation // field resourcev1.ResourceSliceSpec.SharedCounters errs = append(errs, func(fldPath *field.Path, obj, oldObj []resourcev1.CounterSet, oldValueCorrelated bool) (errs field.ErrorList) { // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { return nil } // call field-attached validations earlyReturn := false if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } // lists with map semantics require unique keys errs = append(errs, validate.Unique(ctx, op, fldPath, obj, oldObj, func(a resourcev1.CounterSet, b resourcev1.CounterSet) bool { return a.Name == b.Name })...) // iterate the list and call the type's validation function errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, func(a resourcev1.CounterSet, b resourcev1.CounterSet) bool { return a.Name == b.Name }, validate.SemanticDeepEqual, Validate_CounterSet)...) return }(fldPath.Child("sharedCounters"), obj.SharedCounters, safe.Field(oldObj, func(oldObj *resourcev1.ResourceSliceSpec) []resourcev1.CounterSet { return oldObj.SharedCounters }), oldObj != nil)...) return errs }
go
github
https://github.com/kubernetes/kubernetes
pkg/apis/resource/v1/zz_generated.validations.go
# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # """ """ # force SMESH importation at interpretor initialization # see salome_shared_modules.py # (avoids incomplete import at run time) from launchConfigureParser import verbose if verbose(): print "============== import SMESH =======================" import SMESH # this function is required def init_shared_modules(): """ This function initializes shared modules that need to be """ pass
unknown
codeparrot/codeparrot-clean
<docs-decorative-header title="Anatomy of a component" imgSrc="adev/src/assets/images/components.svg"> <!-- markdownlint-disable-line --> </docs-decorative-header> TIP: This guide assumes you've already read the [Essentials Guide](essentials). Read that first if you're new to Angular. Every component must have: - A TypeScript class with _behaviors_ such as handling user input and fetching data from a server - An HTML template that controls what renders into the DOM - A [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors) that defines how the component is used in HTML You provide Angular-specific information for a component by adding a `@Component` [decorator](https://www.typescriptlang.org/docs/handbook/decorators.html) on top of the TypeScript class: ```angular-ts {highlight: [1, 2, 3, 4]} @Component({ selector: 'profile-photo', template: `<img src="profile-photo.jpg" alt="Your profile photo" />`, }) export class ProfilePhoto {} ``` For full details on writing Angular templates, including data binding, event handling, and control flow, see the [Templates guide](guide/templates). The object passed to the `@Component` decorator is called the component's **metadata**. This includes the `selector`, `template`, and other properties described throughout this guide. Components can optionally include a list of CSS styles that apply to that component's DOM: ```angular-ts {highlight: [4]} @Component({ selector: 'profile-photo', template: `<img src="profile-photo.jpg" alt="Your profile photo" />`, styles: ` img { border-radius: 50%; } `, }) export class ProfilePhoto {} ``` By default, a component's styles only affect elements defined in that component's template. See [Styling Components](guide/components/styling) for details on Angular's approach to styling. You can alternatively choose to write your template and styles in separate files: ```ts {highlight: [3,4]} @Component({ selector: 'profile-photo', templateUrl: 'profile-photo.html', styleUrl: 'profile-photo.css', }) export class ProfilePhoto {} ``` This can help separate the concerns of _presentation_ from _behavior_ in your project. You can choose one approach for your entire project, or you decide which to use for each component. Both `templateUrl` and `styleUrl` are relative to the directory in which the component resides. ## Using components ### Imports in the `@Component` decorator To use a component, [directive](guide/directives), or [pipe](guide/templates/pipes), you must add it to the `imports` array in the `@Component` decorator: ```ts import {ProfilePhoto} from './profile-photo'; @Component({ // Import the `ProfilePhoto` component in // order to use it in this component's template. imports: [ProfilePhoto], /* ... */ }) export class UserProfile {} ``` By default, Angular components are _standalone_, meaning that you can directly add them to the `imports` array of other components. Components created with an earlier version of Angular may instead specify `standalone: false` in their `@Component` decorator. For these components, you instead import the `NgModule` in which the component is defined. See the full [`NgModule` guide](guide/ngmodules/overview) for details. Important: In Angular versions before 19.0.0, the `standalone` option defaults to `false`. ### Showing components in a template Every component defines a [CSS selector](https://developer.mozilla.org/docs/Learn/CSS/Building_blocks/Selectors): ```angular-ts {highlight: [2]} @Component({ selector: 'profile-photo', ... }) export class ProfilePhoto { } ``` See [Component Selectors](guide/components/selectors) for details about which types of selectors Angular supports and guidance on choosing a selector. You show a component by creating a matching HTML element in the template of _other_ components: ```angular-ts {highlight: [8]} @Component({ selector: 'profile-photo', }) export class ProfilePhoto {} @Component({ imports: [ProfilePhoto], template: `<profile-photo />`, }) export class UserProfile {} ``` Angular creates an instance of the component for every matching HTML element it encounters. The DOM element that matches a component's selector is referred to as that component's **host element**. The contents of a component's template are rendered inside its host element. The DOM rendered by a component, corresponding to that component's template, is called that component's **view**. In composing components in this way, **you can think of your Angular application as a tree of components**. ```mermaid flowchart TD A[AccountSettings]-->B A-->C B[UserProfile]-->D B-->E C[PaymentInfo] D[ProfilePic] E[UserBio] ``` This tree structure is important to understanding several other Angular concepts, including [dependency injection](guide/di) and [child queries](guide/components/queries).
unknown
github
https://github.com/angular/angular
adev/src/content/guide/components/anatomy-of-components.md
import json from datetime import timedelta from django.conf import settings import requests SURVEYS = { 'general': { # This is for users browsing the KB and navigation pages. 'email_collection_survey_id': 1002970, 'exit_survey_id': 991425, 'exit_survey_campaign_id': 878533, }, 'questions': { # This is for users that are browsing questions. 'email_collection_survey_id': 1717268, 'exit_survey_id': 1724445, 'exit_survey_campaign_id': 1687339, }, 'askers': { # This is for users that asked a question 2 days ago. 'exit_survey_id': 1817790, 'exit_survey_campaign_id': 1876443, }, 'kb-firefox-android': { # This is for KB users looking at Firefox for Android pages. 'email_collection_survey_id': 1983780, 'exit_survey_id': 1979872, 'exit_survey_campaign_id': 2208951, }, } def get_email_addresses(survey, startdate, enddate): """Get the email addresses collected between startdate and enddate.""" user = settings.SURVEYGIZMO_USER password = settings.SURVEYGIZMO_PASSWORD emails = [] page = 1 more_pages = True survey_id = SURVEYS[survey]['email_collection_survey_id'] while more_pages: response = requests.get( 'https://restapi.surveygizmo.com/v2/survey/{survey}' '/surveyresponse?' 'filter[field][0]=datesubmitted' '&filter[operator][0]=>=&filter[value][0]={start}+0:0:0' 'filter[field][1]=datesubmitted' '&filter[operator][1]=<&filter[value][1]={end}+0:0:0' '&filter[field][2]=status&filter[operator][2]==' '&filter[value][2]=Complete' '&resultsperpage=500' '&page={page}' '&user:pass={user}:{password}'.format( survey=survey_id, start=startdate, end=enddate, page=page, user=user, password=password), timeout=300) results = json.loads(response.content) total_pages = results['total_pages'] more_pages = page < total_pages emails = emails + [r['[question(13)]'] for r in results['data']] page += 1 return emails def add_email_to_campaign(survey, email): """Add email to the exit survey campaign.""" user = settings.SURVEYGIZMO_USER password = settings.SURVEYGIZMO_PASSWORD survey_id = SURVEYS[survey]['exit_survey_id'] campaign_id = SURVEYS[survey]['exit_survey_campaign_id'] try: requests.put( 'https://restapi.surveygizmo.com/v2/survey/{survey}' '/surveycampaign/{campaign}/contact?' 'semailaddress={email}' '&user:pass={user}:{password}'.format( survey=survey_id, campaign=campaign_id, email=email, user=user, password=password), timeout=30) except requests.exceptions.Timeout: print 'Timedout adding: %s' % email def get_exit_survey_results(survey, date): """Collect and aggregate the exit survey results for the date.""" user = settings.SURVEYGIZMO_USER password = settings.SURVEYGIZMO_PASSWORD answers = [] page = 1 more_pages = True survey_id = SURVEYS[survey]['exit_survey_id'] while more_pages: response = requests.get( 'https://restapi.surveygizmo.com/v2/survey/{survey}' '/surveyresponse?' 'filter[field][0]=datesubmitted' '&filter[operator][0]=>=&filter[value][0]={start}+0:0:0' '&filter[field][1]=datesubmitted' '&filter[operator][1]=<&filter[value][1]={end}+0:0:0' '&filter[field][2]=status&filter[operator][2]==' '&filter[value][2]=Complete' '&resultsperpage=500' '&page={page}' '&user:pass={user}:{password}'.format( survey=survey_id, start=date, end=date + timedelta(days=1), page=page, user=user, password=password), timeout=300) results = json.loads(response.content) total_pages = results.get('total_pages', 0) more_pages = page < total_pages answers = answers + [r.get('[question(2)]') for r in results.get('data', [])] page += 1 # Aggregate results. summary = { 'yes': 0, 'no': 0, 'dont-know': 0, } for answer in answers: lower_stripped = answer.lower().strip() if lower_stripped in ['no', 'yes']: summary[lower_stripped] += 1 else: summary['dont-know'] += 1 return summary
unknown
codeparrot/codeparrot-clean
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. from __future__ import annotations import os from ansible.module_utils.common.text.converters import to_bytes from ansible.playbook.attribute import NonInheritableFieldAttribute from ansible.playbook.base import Base from ansible.playbook.conditional import Conditional from ansible.playbook.taggable import Taggable from ansible.utils.collection_loader import AnsibleCollectionConfig from ansible.utils.collection_loader._collection_finder import _get_collection_name_from_path, _get_collection_playbook_path from ansible._internal._templating._engine import TemplateEngine from ansible.errors import AnsibleError from ansible import constants as C class PlaybookInclude(Base, Conditional, Taggable): import_playbook = NonInheritableFieldAttribute(isa='string', required=True) _post_validate_object = True # manually post_validate to get free arg validation/coercion def preprocess_data(self, ds): keys = {action for action in C._ACTION_IMPORT_PLAYBOOK if action in ds} if len(keys) != 1: raise AnsibleError(f'Found conflicting import_playbook actions: {", ".join(sorted(keys))}') key = next(iter(keys)) ds['import_playbook'] = ds.pop(key) return ds @staticmethod def load(data, basedir, variable_manager=None, loader=None): return PlaybookInclude().load_data(ds=data, basedir=basedir, variable_manager=variable_manager, loader=loader) def load_data(self, ds, variable_manager=None, loader=None, basedir=None): """ Overrides the base load_data(), as we're actually going to return a new Playbook() object rather than a PlaybookInclude object """ # import here to avoid a dependency loop from ansible.playbook import Playbook from ansible.playbook.play import Play # first, we use the original parent method to correctly load the object # via the load_data/preprocess_data system we normally use for other # playbook objects new_obj = super(PlaybookInclude, self).load_data(ds, variable_manager, loader) all_vars = self.vars.copy() if variable_manager: all_vars |= variable_manager.get_vars() templar = TemplateEngine(loader=loader, variables=all_vars) new_obj.post_validate(templar) # then we use the object to load a Playbook pb = Playbook(loader=loader) file_name = new_obj.import_playbook # check for FQCN resource = _get_collection_playbook_path(file_name) if resource is not None: playbook = resource[1] playbook_collection = resource[2] else: # not FQCN try path playbook = file_name if not os.path.isabs(playbook): playbook = os.path.join(basedir, playbook) # might still be collection playbook playbook_collection = _get_collection_name_from_path(playbook) if playbook_collection: # it is a collection playbook, setup default collections AnsibleCollectionConfig.default_collection = playbook_collection else: # it is NOT a collection playbook, setup adjacent paths AnsibleCollectionConfig.playbook_paths.append(os.path.dirname(os.path.abspath(to_bytes(playbook, errors='surrogate_or_strict')))) # broken, see: https://github.com/ansible/ansible/issues/85357 pb._load_playbook_data(file_name=playbook, variable_manager=variable_manager, vars=self.vars.copy()) # finally, update each loaded playbook entry with any variables specified # on the included playbook and/or any tags which may have been set for entry in pb._entries: # conditional includes on a playbook need a marker to skip gathering if new_obj.when and isinstance(entry, Play): entry._included_conditional = new_obj.when[:] temp_vars = entry.vars | new_obj.vars param_tags = temp_vars.pop('tags', None) if param_tags is not None: entry.tags.extend(param_tags.split(',')) entry.vars = temp_vars entry.tags = list(set(entry.tags).union(new_obj.tags)) if entry._included_path is None: entry._included_path = os.path.dirname(playbook) # Check to see if we need to forward the conditionals on to the included # plays. If so, we can take a shortcut here and simply prepend them to # those attached to each block (if any) if new_obj.when: for task_block in (entry.pre_tasks + entry.roles + entry.tasks + entry.post_tasks): task_block._when = new_obj.when[:] + task_block.when[:] return pb
python
github
https://github.com/ansible/ansible
lib/ansible/playbook/playbook_include.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # GuessIt - A library for guessing information from filenames # Copyright (c) 2011 Nicolas Wack <wackou@gmail.com> # # GuessIt is free software; you can redistribute it and/or modify it under # the terms of the Lesser GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # GuessIt is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # Lesser GNU General Public License for more details. # # You should have received a copy of the Lesser GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # from __future__ import unicode_literals from guessit import UnicodeMixin, base_text_type, Guess from guessit.textutils import clean_string, str_fill from guessit.patterns import group_delimiters from guessit.guess import (merge_similar_guesses, merge_all, choose_int, choose_string) import copy import logging log = logging.getLogger(__name__) class BaseMatchTree(UnicodeMixin): """A MatchTree represents the hierarchical split of a string into its constituent semantic groups.""" def __init__(self, string='', span=None, parent=None): self.string = string self.span = span or (0, len(string)) self.parent = parent self.children = [] self.guess = Guess() @property def value(self): return self.string[self.span[0]:self.span[1]] @property def clean_value(self): return clean_string(self.value) @property def offset(self): return self.span[0] @property def info(self): result = dict(self.guess) for c in self.children: result.update(c.info) return result @property def root(self): if not self.parent: return self return self.parent.root @property def depth(self): if self.is_leaf(): return 0 return 1 + max(c.depth for c in self.children) def is_leaf(self): return self.children == [] def add_child(self, span): child = MatchTree(self.string, span=span, parent=self) self.children.append(child) def partition(self, indices): indices = sorted(indices) if indices[0] != 0: indices.insert(0, 0) if indices[-1] != len(self.value): indices.append(len(self.value)) for start, end in zip(indices[:-1], indices[1:]): self.add_child(span=(self.offset + start, self.offset + end)) def split_on_components(self, components): offset = 0 for c in components: start = self.value.find(c, offset) end = start + len(c) self.add_child(span=(self.offset + start, self.offset + end)) offset = end def nodes_at_depth(self, depth): if depth == 0: yield self for child in self.children: for node in child.nodes_at_depth(depth - 1): yield node @property def node_idx(self): if self.parent is None: return () return self.parent.node_idx + (self.parent.children.index(self),) def node_at(self, idx): if not idx: return self try: return self.children[idx[0]].node_at(idx[1:]) except: raise ValueError('Non-existent node index: %s' % (idx,)) def nodes(self): yield self for child in self.children: for node in child.nodes(): yield node def _leaves(self): if self.is_leaf(): yield self else: for child in self.children: # pylint: disable=W0212 for leaf in child._leaves(): yield leaf def leaves(self): return list(self._leaves()) def to_string(self): empty_line = ' ' * len(self.string) def to_hex(x): if isinstance(x, int): return str(x) if x < 10 else chr(55 + x) return x def meaning(result): mmap = { 'episodeNumber': 'E', 'season': 'S', 'extension': 'e', 'format': 'f', 'language': 'l', 'country': 'C', 'videoCodec': 'v', 'audioCodec': 'a', 'website': 'w', 'container': 'c', 'series': 'T', 'title': 't', 'date': 'd', 'year': 'y', 'releaseGroup': 'r', 'screenSize': 's' } if result is None: return ' ' for prop, l in mmap.items(): if prop in result: return l return 'x' lines = [ empty_line ] * (self.depth + 2) # +2: remaining, meaning lines[-2] = self.string for node in self.nodes(): if node == self: continue idx = node.node_idx depth = len(idx) - 1 if idx: lines[depth] = str_fill(lines[depth], node.span, to_hex(idx[-1])) if node.guess: lines[-2] = str_fill(lines[-2], node.span, '_') lines[-1] = str_fill(lines[-1], node.span, meaning(node.guess)) lines.append(self.string) return '\n'.join(lines) def __unicode__(self): return self.to_string() class MatchTree(BaseMatchTree): """The MatchTree contains a few "utility" methods which are not necessary for the BaseMatchTree, but add a lot of convenience for writing higher-level rules.""" def _unidentified_leaves(self, valid=lambda leaf: len(leaf.clean_value) >= 2): for leaf in self._leaves(): if not leaf.guess and valid(leaf): yield leaf def unidentified_leaves(self, valid=lambda leaf: len(leaf.clean_value) >= 2): return list(self._unidentified_leaves(valid)) def _leaves_containing(self, property_name): if isinstance(property_name, base_text_type): property_name = [ property_name ] for leaf in self._leaves(): for prop in property_name: if prop in leaf.guess: yield leaf break def leaves_containing(self, property_name): return list(self._leaves_containing(property_name)) def first_leaf_containing(self, property_name): try: return next(self._leaves_containing(property_name)) except StopIteration: return None def _previous_unidentified_leaves(self, node): node_idx = node.node_idx for leaf in self._unidentified_leaves(): if leaf.node_idx < node_idx: yield leaf def previous_unidentified_leaves(self, node): return list(self._previous_unidentified_leaves(node)) def _previous_leaves_containing(self, node, property_name): node_idx = node.node_idx for leaf in self._leaves_containing(property_name): if leaf.node_idx < node_idx: yield leaf def previous_leaves_containing(self, node, property_name): return list(self._previous_leaves_containing(node, property_name)) def is_explicit(self): """Return whether the group was explicitly enclosed by parentheses/square brackets/etc.""" return (self.value[0] + self.value[-1]) in group_delimiters def matched(self): # we need to make a copy here, as the merge functions work in place and # calling them on the match tree would modify it parts = [node.guess for node in self.nodes() if node.guess] parts = copy.deepcopy(parts) # 1- try to merge similar information together and give it a higher # confidence for int_part in ('year', 'season', 'episodeNumber'): merge_similar_guesses(parts, int_part, choose_int) for string_part in ('title', 'series', 'container', 'format', 'releaseGroup', 'website', 'audioCodec', 'videoCodec', 'screenSize', 'episodeFormat', 'audioChannels', 'idNumber'): merge_similar_guesses(parts, string_part, choose_string) # 2- merge the rest, potentially discarding information not properly # merged before result = merge_all(parts, append=['language', 'subtitleLanguage', 'other']) log.debug('Final result: ' + result.nice_string()) return result
unknown
codeparrot/codeparrot-clean
import os from email.mime.image import MIMEImage from django.core.mail import EmailMultiAlternatives from django.core.mail.message import SafeMIMEMultipart, SafeMIMEText from django.core.files.images import ImageFile from django.template.loader import get_template from django.test import TestCase from django.test.utils import override_settings from post_office.models import Email, EmailTemplate, STATUS from post_office.template import render_to_string from post_office.template.backends.post_office import PostOfficeTemplates from post_office.mail import send, send_queued class HTMLMailTest(TestCase): def test_text(self): template = get_template('hello.html', using='post_office') self.assertIsInstance(template.backend, PostOfficeTemplates) context = {'foo': "Bar"} content = template.render(context) self.assertHTMLEqual(content, '<h1>Bar</h1>') def test_html(self): template = get_template('image.html', using='post_office') body = template.render({'imgsrc': 'dummy.png'}) self.assertHTMLEqual(body, """ <h3>Testing image attachments</h3> <img src="cid:f5c66340b8af7dc946cd25d84fdf8c90" width="200" /> """) subject = "[Django Post-Office unit tests] attached image" msg = EmailMultiAlternatives(subject, body, to=['john@example.com']) template.attach_related(msg) msg.content_subtype = 'html' self.assertEqual(msg.mixed_subtype, 'related') # this message can be send by email parts = msg.message().walk() part = next(parts) self.assertIsInstance(part, SafeMIMEMultipart) part = next(parts) self.assertIsInstance(part, SafeMIMEText) self.assertHTMLEqual(part.get_payload(), body) part = next(parts) self.assertIsInstance(part, MIMEImage) self.assertEqual(part.get_content_type(), 'image/png') self.assertEqual(part['Content-Disposition'], 'inline; filename="f5c66340b8af7dc946cd25d84fdf8c90"') self.assertEqual(part.get_content_disposition(), 'inline') self.assertEqual(part.get_filename(), 'f5c66340b8af7dc946cd25d84fdf8c90') self.assertEqual(part['Content-ID'], '<f5c66340b8af7dc946cd25d84fdf8c90>') def test_mixed(self): body = "Testing mixed text and html attachments" html, attached_images = render_to_string('image.html', {'imgsrc': 'dummy.png'}, using='post_office') subject = "[django-SHOP unit tests] attached image" msg = EmailMultiAlternatives(subject, body, to=['john@example.com']) msg.attach_alternative(html, 'text/html') for attachment in attached_images: msg.attach(attachment) msg.mixed_subtype = 'related' # this message can be send by email parts = msg.message().walk() part = next(parts) self.assertIsInstance(part, SafeMIMEMultipart) part = next(parts) self.assertIsInstance(part, SafeMIMEMultipart) part = next(parts) self.assertIsInstance(part, SafeMIMEText) self.assertEqual(part.get_content_type(), 'text/plain') self.assertHTMLEqual(part.get_payload(), body) part = next(parts) self.assertIsInstance(part, SafeMIMEText) self.assertEqual(part.get_content_type(), 'text/html') self.assertHTMLEqual(part.get_payload(), html) part = next(parts) self.assertIsInstance(part, MIMEImage) self.assertEqual(part.get_content_type(), 'image/png') def test_image(self): relfilename = 'static/dummy.png' filename = os.path.join(os.path.dirname(__file__), relfilename) imagefile = ImageFile(open(filename, 'rb'), name=relfilename) template = get_template('image.html', using='post_office') body = template.render({'imgsrc': imagefile}) self.assertHTMLEqual(body, """ <h3>Testing image attachments</h3> <img src="cid:f5c66340b8af7dc946cd25d84fdf8c90" width="200" /> """) subject = "[Django Post-Office unit tests] attached image" msg = EmailMultiAlternatives(subject, body, to=['john@example.com']) template.attach_related(msg) # this message can be send by email parts = msg.message().walk() part = next(parts) self.assertIsInstance(part, SafeMIMEMultipart) part = next(parts) self.assertIsInstance(part, SafeMIMEText) self.assertEqual(part.get_payload(), body) part = next(parts) self.assertIsInstance(part, MIMEImage) self.assertEqual(part.get_content_type(), 'image/png') self.assertEqual(part['Content-Disposition'], 'inline; filename="f5c66340b8af7dc946cd25d84fdf8c90"') self.assertEqual(part.get_content_disposition(), 'inline') self.assertEqual(part.get_filename(), 'f5c66340b8af7dc946cd25d84fdf8c90') self.assertEqual(part['Content-ID'], '<f5c66340b8af7dc946cd25d84fdf8c90>') @override_settings(EMAIL_BACKEND='django.core.mail.backends.locmem.EmailBackend', POST_OFFICE={ 'BACKENDS': {'locmem': 'django.core.mail.backends.locmem.EmailBackend'}, 'TEMPLATE_ENGINE': 'post_office', }) def test_send_with_html_template(self): template = EmailTemplate.objects.create( name="Test Inlined Images", subject="[django-SHOP unit tests] attached image", html_content=""" {% load post_office %} <h3>Testing image attachments</h3> <img src="{% inline_image imgsrc %}" width="200" />""" ) filename = os.path.join(os.path.dirname(__file__), 'static/dummy.png') context = {'imgsrc': filename} queued_mail = send(recipients=['to@example.com'], sender='from@example.com', template=template, context=context, render_on_delivery=True) queued_mail = Email.objects.get(id=queued_mail.id) send_queued() self.assertEqual(Email.objects.get(id=queued_mail.id).status, STATUS.sent)
unknown
codeparrot/codeparrot-clean
import BeautifulSoup from BeautifulSoup import Comment, Tag, NavigableString import logging import os import re import text class textfile: def __init__(self, gdbm_files, filter_file, path, category): self.category = category self.filter_file = filter_file self.gdbm_files = gdbm_files self.path = path return def processHTMLFile(self, filename): log = logging.getLogger('classify') log.debug("texfile.processHTMLFile()") text_obj = text.text(self.gdbm_files, self.filter_file, self.path, self.category) htmlfile = open(filename, "r") html = htmlfile.read() htmlfile.close() soup = BeautifulSoup.BeautifulSoup(html) # Removes <!-- --> comments from html comments = soup.findAll(text=lambda text:isinstance(text, Comment)) [comment.extract() for comment in comments] #visible_text = soup.findAll(text=lambda text: text.parent.name != "script" and text.parent.name != "style" and text.parent.name != "[document]" and text.parent.name != "head" and text.parent.name != "title") #log.debug("visible text = %s" % visible_text) visible_entries = [] # Filters out all visible content from the web page excluding text from the script, style, document, head, and title tags for element in soup.findAll(text=lambda text: text.parent.name != "script" and text.parent.name != "style" and text.parent.name != "[document]" and text.parent.name != "head" and text.parent.name != "title"): # Removes any matches that don't have any words or numbers in it if re.search("[\w\d]+", element): log.debug("element = %s" % element) visible_entries.append(element) log.debug("visible entries = %s" % visible_entries) visible_string = " ".join(visible_entries) log.debug("visible string = %s" % visible_string) all_matches = text_obj.processUnicodeString(visible_string) log.debug(" All Matches:") log.debug("Number of Matches Found = %s" % len(all_matches)) all_matches = sorted(all_matches, key=lambda positive_match: positive_match.offset) for item in all_matches: item.printMatch() return # Processes the utf file by first reading the file and then determining if any of the words in the text is a match to the chosen category def processUTFFile(self, filename): log = logging.getLogger('classify') log.debug("texfile.processUTFFile()") text_obj = text.text(self.gdbm_files, self.filter_file, self.path, self.category) textfile = open(filename, "r") excerpt = textfile.read() textfile.close() all_matches = text_obj.processUTFString(excerpt) log.debug(" All Matches:") log.debug("Number of Matches Found = %s" % len(all_matches)) all_matches = sorted(all_matches, key=lambda positive_match: positive_match.offset) for item in all_matches: item.printMatch() return
unknown
codeparrot/codeparrot-clean
// AUTO-GENERATED FILE FROM genmap_japanese.py: DO NOT EDIT static const ucs2_t __jisx0208_decmap[6956] = { 12288,12289,12290,65292,65294,12539,65306,65307,65311,65281,12443,12444,180, 65344,168,65342,65507,65343,12541,12542,12445,12446,12291,20189,12293,12294, 12295,12540,8213,8208,65295,92,12316,8214,65372,8230,8229,8216,8217,8220,8221, 65288,65289,12308,12309,65339,65341,65371,65373,12296,12297,12298,12299,12300, 12301,12302,12303,12304,12305,65291,8722,177,215,247,65309,8800,65308,65310, 8806,8807,8734,8756,9794,9792,176,8242,8243,8451,65509,65284,162,163,65285, 65283,65286,65290,65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651, 9650,9661,9660,8251,12306,8594,8592,8593,8595,12307,U,U,U,U,U,U,U,U,U,U,U, 8712,8715,8838,8839,8834,8835,8746,8745,U,U,U,U,U,U,U,U,8743,8744,172,8658, 8660,8704,8707,U,U,U,U,U,U,U,U,U,U,U,8736,8869,8978,8706,8711,8801,8786,8810, 8811,8730,8765,8733,8757,8747,8748,U,U,U,U,U,U,U,8491,8240,9839,9837,9834, 8224,8225,182,U,U,U,U,9711,65296,65297,65298,65299,65300,65301,65302,65303, 65304,65305,U,U,U,U,U,U,U,65313,65314,65315,65316,65317,65318,65319,65320, 65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333, 65334,65335,65336,65337,65338,U,U,U,U,U,U,65345,65346,65347,65348,65349,65350, 65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363, 65364,65365,65366,65367,65368,65369,65370,12353,12354,12355,12356,12357,12358, 12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371, 12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, 12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397, 12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410, 12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423, 12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,12449, 12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, 12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475, 12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488, 12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501, 12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514, 12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527, 12528,12529,12530,12531,12532,12533,12534,913,914,915,916,917,918,919,920,921, 922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,U,U,U,U,U,U,U,U, 945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964, 965,966,967,968,969,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049, 1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064, 1065,1066,1067,1068,1069,1070,1071,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,1072,1073, 1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087, 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102, 1103,9472,9474,9484,9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487, 9491,9499,9495,9507,9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520, 9509,9528,9538,20124,21782,23043,38463,21696,24859,25384,23030,36898,33909, 33564,31312,24746,25569,28197,26093,33894,33446,39925,26771,22311,26017,25201, 23451,22992,34427,39156,32098,32190,39822,25110,31903,34999,23433,24245,25353, 26263,26696,38343,38797,26447,20197,20234,20301,20381,20553,22258,22839,22996, 23041,23561,24799,24847,24944,26131,26885,28858,30031,30064,31227,32173,32239, 32963,33806,34915,35586,36949,36986,21307,20117,20133,22495,32946,37057,30959, 19968,22769,28322,36920,31282,33576,33419,39983,20801,21360,21693,21729,22240, 23035,24341,39154,28139,32996,34093,38498,38512,38560,38907,21515,21491,23431, 28879,32701,36802,38632,21359,40284,31418,19985,30867,33276,28198,22040,21764, 27421,34074,39995,23013,21417,28006,29916,38287,22082,20113,36939,38642,33615, 39180,21473,21942,23344,24433,26144,26355,26628,27704,27891,27945,29787,30408, 31310,38964,33521,34907,35424,37613,28082,30123,30410,39365,24742,35585,36234, 38322,27022,21421,20870,22290,22576,22852,23476,24310,24616,25513,25588,27839, 28436,28814,28948,29017,29141,29503,32257,33398,33489,34199,36960,37467,40219, 22633,26044,27738,29989,20985,22830,22885,24448,24540,25276,26106,27178,27431, 27572,29579,32705,35158,40236,40206,40644,23713,27798,33659,20740,23627,25014, 33222,26742,29281,20057,20474,21368,24681,28201,31311,38899,19979,21270,20206, 20309,20285,20385,20339,21152,21487,22025,22799,23233,23478,23521,31185,26247, 26524,26550,27468,27827,28779,29634,31117,31166,31292,31623,33457,33499,33540, 33655,33775,33747,34662,35506,22057,36008,36838,36942,38686,34442,20420,23784, 25105,29273,30011,33253,33469,34558,36032,38597,39187,39381,20171,20250,35299, 22238,22602,22730,24315,24555,24618,24724,24674,25040,25106,25296,25913,39745, 26214,26800,28023,28784,30028,30342,32117,33445,34809,38283,38542,35997,20977, 21182,22806,21683,23475,23830,24936,27010,28079,30861,33995,34903,35442,37799, 39608,28012,39336,34521,22435,26623,34510,37390,21123,22151,21508,24275,25313, 25785,26684,26680,27579,29554,30906,31339,35226,35282,36203,36611,37101,38307, 38548,38761,23398,23731,27005,38989,38990,25499,31520,27179,27263,26806,39949, 28511,21106,21917,24688,25324,27963,28167,28369,33883,35088,36676,19988,39993, 21494,26907,27194,38788,26666,20828,31427,33970,37340,37772,22107,40232,26658, 33541,33841,31909,21000,33477,29926,20094,20355,20896,23506,21002,21208,21223, 24059,21914,22570,23014,23436,23448,23515,24178,24185,24739,24863,24931,25022, 25563,25954,26577,26707,26874,27454,27475,27735,28450,28567,28485,29872,29976, 30435,30475,31487,31649,31777,32233,32566,32752,32925,33382,33694,35251,35532, 36011,36996,37969,38291,38289,38306,38501,38867,39208,33304,20024,21547,23736, 24012,29609,30284,30524,23721,32747,36107,38593,38929,38996,39000,20225,20238, 21361,21916,22120,22522,22855,23305,23492,23696,24076,24190,24524,25582,26426, 26071,26082,26399,26827,26820,27231,24112,27589,27671,27773,30079,31048,23395, 31232,32000,24509,35215,35352,36020,36215,36556,36637,39138,39438,39740,20096, 20605,20736,22931,23452,25135,25216,25836,27450,29344,30097,31047,32681,34811, 35516,35696,25516,33738,38816,21513,21507,21931,26708,27224,35440,30759,26485, 40653,21364,23458,33050,34384,36870,19992,20037,20167,20241,21450,21560,23470, 24339,24613,25937,26429,27714,27762,27875,28792,29699,31350,31406,31496,32026, 31998,32102,26087,29275,21435,23621,24040,25298,25312,25369,28192,34394,35377, 36317,37624,28417,31142,39770,20136,20139,20140,20379,20384,20689,20807,31478, 20849,20982,21332,21281,21375,21483,21932,22659,23777,24375,24394,24623,24656, 24685,25375,25945,27211,27841,29378,29421,30703,33016,33029,33288,34126,37111, 37857,38911,39255,39514,20208,20957,23597,26241,26989,23616,26354,26997,29577, 26704,31873,20677,21220,22343,24062,37670,26020,27427,27453,29748,31105,31165, 31563,32202,33465,33740,34943,35167,35641,36817,37329,21535,37504,20061,20534, 21477,21306,29399,29590,30697,33510,36527,39366,39368,39378,20855,24858,34398, 21936,31354,20598,23507,36935,38533,20018,27355,37351,23633,23624,25496,31391, 27795,38772,36705,31402,29066,38536,31874,26647,32368,26705,37740,21234,21531, 34219,35347,32676,36557,37089,21350,34952,31041,20418,20670,21009,20804,21843, 22317,29674,22411,22865,24418,24452,24693,24950,24935,25001,25522,25658,25964, 26223,26690,28179,30054,31293,31995,32076,32153,32331,32619,33550,33610,34509, 35336,35427,35686,36605,38938,40335,33464,36814,39912,21127,25119,25731,28608, 38553,26689,20625,27424,27770,28500,31348,32080,34880,35363,26376,20214,20537, 20518,20581,20860,21048,21091,21927,22287,22533,23244,24314,25010,25080,25331, 25458,26908,27177,29309,29356,29486,30740,30831,32121,30476,32937,35211,35609, 36066,36562,36963,37749,38522,38997,39443,40568,20803,21407,21427,24187,24358, 28187,28304,29572,29694,32067,33335,35328,35578,38480,20046,20491,21476,21628, 22266,22993,23396,24049,24235,24359,25144,25925,26543,28246,29392,31946,34996, 32929,32993,33776,34382,35463,36328,37431,38599,39015,40723,20116,20114,20237, 21320,21577,21566,23087,24460,24481,24735,26791,27278,29786,30849,35486,35492, 35703,37264,20062,39881,20132,20348,20399,20505,20502,20809,20844,21151,21177, 21246,21402,21475,21521,21518,21897,22353,22434,22909,23380,23389,23439,24037, 24039,24055,24184,24195,24218,24247,24344,24658,24908,25239,25304,25511,25915, 26114,26179,26356,26477,26657,26775,27083,27743,27946,28009,28207,28317,30002, 30343,30828,31295,31968,32005,32024,32094,32177,32789,32771,32943,32945,33108, 33167,33322,33618,34892,34913,35611,36002,36092,37066,37237,37489,30783,37628, 38308,38477,38917,39321,39640,40251,21083,21163,21495,21512,22741,25335,28640, 35946,36703,40633,20811,21051,21578,22269,31296,37239,40288,40658,29508,28425, 33136,29969,24573,24794,39592,29403,36796,27492,38915,20170,22256,22372,22718, 23130,24680,25031,26127,26118,26681,26801,28151,30165,32058,33390,39746,20123, 20304,21449,21766,23919,24038,24046,26619,27801,29811,30722,35408,37782,35039, 22352,24231,25387,20661,20652,20877,26368,21705,22622,22971,23472,24425,25165, 25505,26685,27507,28168,28797,37319,29312,30741,30758,31085,25998,32048,33756, 35009,36617,38555,21092,22312,26448,32618,36001,20916,22338,38442,22586,27018, 32948,21682,23822,22524,30869,40442,20316,21066,21643,25662,26152,26388,26613, 31364,31574,32034,37679,26716,39853,31545,21273,20874,21047,23519,25334,25774, 25830,26413,27578,34217,38609,30352,39894,25420,37638,39851,30399,26194,19977, 20632,21442,23665,24808,25746,25955,26719,29158,29642,29987,31639,32386,34453, 35715,36059,37240,39184,26028,26283,27531,20181,20180,20282,20351,21050,21496, 21490,21987,22235,22763,22987,22985,23039,23376,23629,24066,24107,24535,24605, 25351,25903,23388,26031,26045,26088,26525,27490,27515,27663,29509,31049,31169, 31992,32025,32043,32930,33026,33267,35222,35422,35433,35430,35468,35566,36039, 36060,38604,39164,27503,20107,20284,20365,20816,23383,23546,24904,25345,26178, 27425,28363,27835,29246,29885,30164,30913,31034,32780,32819,33258,33940,36766, 27728,40575,24335,35672,40235,31482,36600,23437,38635,19971,21489,22519,22833, 23241,23460,24713,28287,28422,30142,36074,23455,34048,31712,20594,26612,33437, 23649,34122,32286,33294,20889,23556,25448,36198,26012,29038,31038,32023,32773, 35613,36554,36974,34503,37034,20511,21242,23610,26451,28796,29237,37196,37320, 37675,33509,23490,24369,24825,20027,21462,23432,25163,26417,27530,29417,29664, 31278,33131,36259,37202,39318,20754,21463,21610,23551,25480,27193,32172,38656, 22234,21454,21608,23447,23601,24030,20462,24833,25342,27954,31168,31179,32066, 32333,32722,33261,33311,33936,34886,35186,35728,36468,36655,36913,37195,37228, 38598,37276,20160,20303,20805,21313,24467,25102,26580,27713,28171,29539,32294, 37325,37507,21460,22809,23487,28113,31069,32302,31899,22654,29087,20986,34899, 36848,20426,23803,26149,30636,31459,33308,39423,20934,24490,26092,26991,27529, 28147,28310,28516,30462,32020,24033,36981,37255,38918,20966,21021,25152,26257, 26329,28186,24246,32210,32626,26360,34223,34295,35576,21161,21465,22899,24207, 24464,24661,37604,38500,20663,20767,21213,21280,21319,21484,21736,21830,21809, 22039,22888,22974,23100,23477,23558,23567,23569,23578,24196,24202,24288,24432, 25215,25220,25307,25484,25463,26119,26124,26157,26230,26494,26786,27167,27189, 27836,28040,28169,28248,28988,28966,29031,30151,30465,30813,30977,31077,31216, 31456,31505,31911,32057,32918,33750,33931,34121,34909,35059,35359,35388,35412, 35443,35937,36062,37284,37478,37758,37912,38556,38808,19978,19976,19998,20055, 20887,21104,22478,22580,22732,23330,24120,24773,25854,26465,26454,27972,29366, 30067,31331,33976,35698,37304,37664,22065,22516,39166,25325,26893,27542,29165, 32340,32887,33394,35302,39135,34645,36785,23611,20280,20449,20405,21767,23072, 23517,23529,24515,24910,25391,26032,26187,26862,27035,28024,28145,30003,30137, 30495,31070,31206,32051,33251,33455,34218,35242,35386,36523,36763,36914,37341, 38663,20154,20161,20995,22645,22764,23563,29978,23613,33102,35338,36805,38499, 38765,31525,35535,38920,37218,22259,21416,36887,21561,22402,24101,25512,27700, 28810,30561,31883,32736,34928,36930,37204,37648,37656,38543,29790,39620,23815, 23913,25968,26530,36264,38619,25454,26441,26905,33733,38935,38592,35070,28548, 25722,23544,19990,28716,30045,26159,20932,21046,21218,22995,24449,24615,25104, 25919,25972,26143,26228,26866,26646,27491,28165,29298,29983,30427,31934,32854, 22768,35069,35199,35488,35475,35531,36893,37266,38738,38745,25993,31246,33030, 38587,24109,24796,25114,26021,26132,26512,30707,31309,31821,32318,33034,36012, 36196,36321,36447,30889,20999,25305,25509,25666,25240,35373,31363,31680,35500, 38634,32118,33292,34633,20185,20808,21315,21344,23459,23554,23574,24029,25126, 25159,25776,26643,26676,27849,27973,27927,26579,28508,29006,29053,26059,31359, 31661,32218,32330,32680,33146,33307,33337,34214,35438,36046,36341,36984,36983, 37549,37521,38275,39854,21069,21892,28472,28982,20840,31109,32341,33203,31950, 22092,22609,23720,25514,26366,26365,26970,29401,30095,30094,30990,31062,31199, 31895,32032,32068,34311,35380,38459,36961,40736,20711,21109,21452,21474,20489, 21930,22766,22863,29245,23435,23652,21277,24803,24819,25436,25475,25407,25531, 25805,26089,26361,24035,27085,27133,28437,29157,20105,30185,30456,31379,31967, 32207,32156,32865,33609,33624,33900,33980,34299,35013,36208,36865,36973,37783, 38684,39442,20687,22679,24974,33235,34101,36104,36896,20419,20596,21063,21363, 24687,25417,26463,28204,36275,36895,20439,23646,36042,26063,32154,21330,34966, 20854,25539,23384,23403,23562,25613,26449,36956,20182,22810,22826,27760,35409, 21822,22549,22949,24816,25171,26561,33333,26965,38464,39364,39464,20307,22534, 23550,32784,23729,24111,24453,24608,24907,25140,26367,27888,28382,32974,33151, 33492,34955,36024,36864,36910,38538,40667,39899,20195,21488,22823,31532,37261, 38988,40441,28381,28711,21331,21828,23429,25176,25246,25299,27810,28655,29730, 35351,37944,28609,35582,33592,20967,34552,21482,21481,20294,36948,36784,22890, 33073,24061,31466,36799,26842,35895,29432,40008,27197,35504,20025,21336,22022, 22374,25285,25506,26086,27470,28129,28251,28845,30701,31471,31658,32187,32829, 32966,34507,35477,37723,22243,22727,24382,26029,26262,27264,27573,30007,35527, 20516,30693,22320,24347,24677,26234,27744,30196,31258,32622,33268,34584,36933, 39347,31689,30044,31481,31569,33988,36880,31209,31378,33590,23265,30528,20013, 20210,23449,24544,25277,26172,26609,27880,34411,34935,35387,37198,37619,39376, 27159,28710,29482,33511,33879,36015,19969,20806,20939,21899,23541,24086,24115, 24193,24340,24373,24427,24500,25074,25361,26274,26397,28526,29266,30010,30522, 32884,33081,33144,34678,35519,35548,36229,36339,37530,38263,38914,40165,21189, 25431,30452,26389,27784,29645,36035,37806,38515,27941,22684,26894,27084,36861, 37786,30171,36890,22618,26626,25524,27131,20291,28460,26584,36795,34086,32180, 37716,26943,28528,22378,22775,23340,32044,29226,21514,37347,40372,20141,20302, 20572,20597,21059,35998,21576,22564,23450,24093,24213,24237,24311,24351,24716, 25269,25402,25552,26799,27712,30855,31118,31243,32224,33351,35330,35558,36420, 36883,37048,37165,37336,40718,27877,25688,25826,25973,28404,30340,31515,36969, 37841,28346,21746,24505,25764,36685,36845,37444,20856,22635,22825,23637,24215, 28155,32399,29980,36028,36578,39003,28857,20253,27583,28593,30000,38651,20814, 21520,22581,22615,22956,23648,24466,26007,26460,28193,30331,33759,36077,36884, 37117,37709,30757,30778,21162,24230,22303,22900,24594,20498,20826,20908,20941, 20992,21776,22612,22616,22871,23445,23798,23947,24764,25237,25645,26481,26691, 26812,26847,30423,28120,28271,28059,28783,29128,24403,30168,31095,31561,31572, 31570,31958,32113,21040,33891,34153,34276,35342,35588,35910,36367,36867,36879, 37913,38518,38957,39472,38360,20685,21205,21516,22530,23566,24999,25758,27934, 30643,31461,33012,33796,36947,37509,23776,40199,21311,24471,24499,28060,29305, 30563,31167,31716,27602,29420,35501,26627,27233,20984,31361,26932,23626,40182, 33515,23493,37193,28702,22136,23663,24775,25958,27788,35930,36929,38931,21585, 26311,37389,22856,37027,20869,20045,20970,34201,35598,28760,25466,37707,26978, 39348,32260,30071,21335,26976,36575,38627,27741,20108,23612,24336,36841,21250, 36049,32905,34425,24319,26085,20083,20837,22914,23615,38894,20219,22922,24525, 35469,28641,31152,31074,23527,33905,29483,29105,24180,24565,25467,25754,29123, 31896,20035,24316,20043,22492,22178,24745,28611,32013,33021,33075,33215,36786, 35223,34468,24052,25226,25773,35207,26487,27874,27966,29750,30772,23110,32629, 33453,39340,20467,24259,25309,25490,25943,26479,30403,29260,32972,32954,36649, 37197,20493,22521,23186,26757,26995,29028,29437,36023,22770,36064,38506,36889, 34687,31204,30695,33833,20271,21093,21338,25293,26575,27850,30333,31636,31893, 33334,34180,36843,26333,28448,29190,32283,33707,39361,40614,20989,31665,30834, 31672,32903,31560,27368,24161,32908,30033,30048,20843,37474,28300,30330,37271, 39658,20240,32624,25244,31567,38309,40169,22138,22617,34532,38588,20276,21028, 21322,21453,21467,24070,25644,26001,26495,27710,27726,29256,29359,29677,30036, 32321,33324,34281,36009,31684,37318,29033,38930,39151,25405,26217,30058,30436, 30928,34115,34542,21290,21329,21542,22915,24199,24444,24754,25161,25209,25259, 26000,27604,27852,30130,30382,30865,31192,32203,32631,32933,34987,35513,36027, 36991,38750,39131,27147,31800,20633,23614,24494,26503,27608,29749,30473,32654, 40763,26570,31255,21305,30091,39661,24422,33181,33777,32920,24380,24517,30050, 31558,36924,26727,23019,23195,32016,30334,35628,20469,24426,27161,27703,28418, 29922,31080,34920,35413,35961,24287,25551,30149,31186,33495,37672,37618,33948, 34541,39981,21697,24428,25996,27996,28693,36007,36051,38971,25935,29942,19981, 20184,22496,22827,23142,23500,20904,24067,24220,24598,25206,25975,26023,26222, 28014,29238,31526,33104,33178,33433,35676,36000,36070,36212,38428,38468,20398, 25771,27494,33310,33889,34154,37096,23553,26963,39080,33914,34135,20239,21103, 24489,24133,26381,31119,33145,35079,35206,28149,24343,25173,27832,20175,29289, 39826,20998,21563,22132,22707,24996,25198,28954,22894,31881,31966,32027,38640, 25991,32862,19993,20341,20853,22592,24163,24179,24330,26564,20006,34109,38281, 38491,31859,38913,20731,22721,30294,30887,21029,30629,34065,31622,20559,22793, 29255,31687,32232,36794,36820,36941,20415,21193,23081,24321,38829,20445,33303, 37610,22275,25429,27497,29995,35036,36628,31298,21215,22675,24917,25098,26286, 27597,31807,33769,20515,20472,21253,21574,22577,22857,23453,23792,23791,23849, 24214,25265,25447,25918,26041,26379,27861,27873,28921,30770,32299,32990,33459, 33804,34028,34562,35090,35370,35914,37030,37586,39165,40179,40300,20047,20129, 20621,21078,22346,22952,24125,24536,24537,25151,26292,26395,26576,26834,20882, 32033,32938,33192,35584,35980,36031,37502,38450,21536,38956,21271,20693,21340, 22696,25778,26420,29287,30566,31302,37350,21187,27809,27526,22528,24140,22868, 26412,32763,20961,30406,25705,30952,39764,40635,22475,22969,26151,26522,27598, 21737,27097,24149,33180,26517,39850,26622,40018,26717,20134,20451,21448,25273, 26411,27819,36804,20397,32365,40639,19975,24930,28288,28459,34067,21619,26410, 39749,24051,31637,23724,23494,34588,28234,34001,31252,33032,22937,31885,27665, 30496,21209,22818,28961,29279,30683,38695,40289,26891,23167,23064,20901,21517, 21629,26126,30431,36855,37528,40180,23018,29277,28357,20813,26825,32191,32236, 38754,40634,25720,27169,33538,22916,23391,27611,29467,30450,32178,32791,33945, 20786,26408,40665,30446,26466,21247,39173,23588,25147,31870,36016,21839,24758, 32011,38272,21249,20063,20918,22812,29242,32822,37326,24357,30690,21380,24441, 32004,34220,35379,36493,38742,26611,34222,37971,24841,24840,27833,30290,35565, 36664,21807,20305,20778,21191,21451,23461,24189,24736,24962,25558,26377,26586, 28263,28044,29494,29495,30001,31056,35029,35480,36938,37009,37109,38596,34701, 22805,20104,20313,19982,35465,36671,38928,20653,24188,22934,23481,24248,25562, 25594,25793,26332,26954,27096,27915,28342,29076,29992,31407,32650,32768,33865, 33993,35201,35617,36362,36965,38525,39178,24958,25233,27442,27779,28020,32716, 32764,28096,32645,34746,35064,26469,33713,38972,38647,27931,32097,33853,37226, 20081,21365,23888,27396,28651,34253,34349,35239,21033,21519,23653,26446,26792, 29702,29827,30178,35023,35041,37324,38626,38520,24459,29575,31435,33870,25504, 30053,21129,27969,28316,29705,30041,30827,31890,38534,31452,40845,20406,24942, 26053,34396,20102,20142,20698,20001,20940,23534,26009,26753,28092,29471,30274, 30637,31260,31975,33391,35538,36988,37327,38517,38936,21147,32209,20523,21400, 26519,28107,29136,29747,33256,36650,38563,40023,40607,29792,22593,28057,32047, 39006,20196,20278,20363,20919,21169,23994,24604,29618,31036,33491,37428,38583, 38646,38666,40599,40802,26278,27508,21015,21155,28872,35010,24265,24651,24976, 28451,29001,31806,32244,32879,34030,36899,37676,21570,39791,27347,28809,36034, 36335,38706,21172,23105,24266,24324,26391,27004,27028,28010,28431,29282,29436, 31725,32769,32894,34635,37070,20845,40595,31108,32907,37682,35542,20525,21644, 35441,27498,36036,33031,24785,26528,40434,20121,20120,39952,35435,34241,34152, 26880,28286,30871,33109,24332,19984,19989,20010,20017,20022,20028,20031,20034, 20054,20056,20098,20101,35947,20106,33298,24333,20110,20126,20127,20128,20130, 20144,20147,20150,20174,20173,20164,20166,20162,20183,20190,20205,20191,20215, 20233,20314,20272,20315,20317,20311,20295,20342,20360,20367,20376,20347,20329, 20336,20369,20335,20358,20374,20760,20436,20447,20430,20440,20443,20433,20442, 20432,20452,20453,20506,20520,20500,20522,20517,20485,20252,20470,20513,20521, 20524,20478,20463,20497,20486,20547,20551,26371,20565,20560,20552,20570,20566, 20588,20600,20608,20634,20613,20660,20658,20681,20682,20659,20674,20694,20702, 20709,20717,20707,20718,20729,20725,20745,20737,20738,20758,20757,20756,20762, 20769,20794,20791,20796,20795,20799,20800,20818,20812,20820,20834,31480,20841, 20842,20846,20864,20866,22232,20876,20873,20879,20881,20883,20885,20886,20900, 20902,20898,20905,20906,20907,20915,20913,20914,20912,20917,20925,20933,20937, 20955,20960,34389,20969,20973,20976,20981,20990,20996,21003,21012,21006,21031, 21034,21038,21043,21049,21071,21060,21067,21068,21086,21076,21098,21108,21097, 21107,21119,21117,21133,21140,21138,21105,21128,21137,36776,36775,21164,21165, 21180,21173,21185,21197,21207,21214,21219,21222,39149,21216,21235,21237,21240, 21241,21254,21256,30008,21261,21264,21263,21269,21274,21283,21295,21297,21299, 21304,21312,21318,21317,19991,21321,21325,20950,21342,21353,21358,22808,21371, 21367,21378,21398,21408,21414,21413,21422,21424,21430,21443,31762,38617,21471, 26364,29166,21486,21480,21485,21498,21505,21565,21568,21548,21549,21564,21550, 21558,21545,21533,21582,21647,21621,21646,21599,21617,21623,21616,21650,21627, 21632,21622,21636,21648,21638,21703,21666,21688,21669,21676,21700,21704,21672, 21675,21698,21668,21694,21692,21720,21733,21734,21775,21780,21757,21742,21741, 21754,21730,21817,21824,21859,21836,21806,21852,21829,21846,21847,21816,21811, 21853,21913,21888,21679,21898,21919,21883,21886,21912,21918,21934,21884,21891, 21929,21895,21928,21978,21957,21983,21956,21980,21988,21972,22036,22007,22038, 22014,22013,22043,22009,22094,22096,29151,22068,22070,22066,22072,22123,22116, 22063,22124,22122,22150,22144,22154,22176,22164,22159,22181,22190,22198,22196, 22210,22204,22209,22211,22208,22216,22222,22225,22227,22231,22254,22265,22272, 22271,22276,22281,22280,22283,22285,22291,22296,22294,21959,22300,22310,22327, 22328,22350,22331,22336,22351,22377,22464,22408,22369,22399,22409,22419,22432, 22451,22436,22442,22448,22467,22470,22484,22482,22483,22538,22486,22499,22539, 22553,22557,22642,22561,22626,22603,22640,27584,22610,22589,22649,22661,22713, 22687,22699,22714,22750,22715,22712,22702,22725,22739,22737,22743,22745,22744, 22757,22748,22756,22751,22767,22778,22777,22779,22780,22781,22786,22794,22800, 22811,26790,22821,22828,22829,22834,22840,22846,31442,22869,22864,22862,22874, 22872,22882,22880,22887,22892,22889,22904,22913,22941,20318,20395,22947,22962, 22982,23016,23004,22925,23001,23002,23077,23071,23057,23068,23049,23066,23104, 23148,23113,23093,23094,23138,23146,23194,23228,23230,23243,23234,23229,23267, 23255,23270,23273,23254,23290,23291,23308,23307,23318,23346,23248,23338,23350, 23358,23363,23365,23360,23377,23381,23386,23387,23397,23401,23408,23411,23413, 23416,25992,23418,23424,23427,23462,23480,23491,23495,23497,23508,23504,23524, 23526,23522,23518,23525,23531,23536,23542,23539,23557,23559,23560,23565,23571, 23584,23586,23592,23608,23609,23617,23622,23630,23635,23632,23631,23409,23660, 23662,20066,23670,23673,23692,23697,23700,22939,23723,23739,23734,23740,23735, 23749,23742,23751,23769,23785,23805,23802,23789,23948,23786,23819,23829,23831, 23900,23839,23835,23825,23828,23842,23834,23833,23832,23884,23890,23886,23883, 23916,23923,23926,23943,23940,23938,23970,23965,23980,23982,23997,23952,23991, 23996,24009,24013,24019,24018,24022,24027,24043,24050,24053,24075,24090,24089, 24081,24091,24118,24119,24132,24131,24128,24142,24151,24148,24159,24162,24164, 24135,24181,24182,24186,40636,24191,24224,24257,24258,24264,24272,24271,24278, 24291,24285,24282,24283,24290,24289,24296,24297,24300,24305,24307,24304,24308, 24312,24318,24323,24329,24413,24412,24331,24337,24342,24361,24365,24376,24385, 24392,24396,24398,24367,24401,24406,24407,24409,24417,24429,24435,24439,24451, 24450,24447,24458,24456,24465,24455,24478,24473,24472,24480,24488,24493,24508, 24534,24571,24548,24568,24561,24541,24755,24575,24609,24672,24601,24592,24617, 24590,24625,24603,24597,24619,24614,24591,24634,24666,24641,24682,24695,24671, 24650,24646,24653,24675,24643,24676,24642,24684,24683,24665,24705,24717,24807, 24707,24730,24708,24731,24726,24727,24722,24743,24715,24801,24760,24800,24787, 24756,24560,24765,24774,24757,24792,24909,24853,24838,24822,24823,24832,24820, 24826,24835,24865,24827,24817,24845,24846,24903,24894,24872,24871,24906,24895, 24892,24876,24884,24893,24898,24900,24947,24951,24920,24921,24922,24939,24948, 24943,24933,24945,24927,24925,24915,24949,24985,24982,24967,25004,24980,24986, 24970,24977,25003,25006,25036,25034,25033,25079,25032,25027,25030,25018,25035, 32633,25037,25062,25059,25078,25082,25076,25087,25085,25084,25086,25088,25096, 25097,25101,25100,25108,25115,25118,25121,25130,25134,25136,25138,25139,25153, 25166,25182,25187,25179,25184,25192,25212,25218,25225,25214,25234,25235,25238, 25300,25219,25236,25303,25297,25275,25295,25343,25286,25812,25288,25308,25292, 25290,25282,25287,25243,25289,25356,25326,25329,25383,25346,25352,25327,25333, 25424,25406,25421,25628,25423,25494,25486,25472,25515,25462,25507,25487,25481, 25503,25525,25451,25449,25534,25577,25536,25542,25571,25545,25554,25590,25540, 25622,25652,25606,25619,25638,25654,25885,25623,25640,25615,25703,25711,25718, 25678,25898,25749,25747,25765,25769,25736,25788,25818,25810,25797,25799,25787, 25816,25794,25841,25831,33289,25824,25825,25260,25827,25839,25900,25846,25844, 25842,25850,25856,25853,25880,25884,25861,25892,25891,25899,25908,25909,25911, 25910,25912,30027,25928,25942,25941,25933,25944,25950,25949,25970,25976,25986, 25987,35722,26011,26015,26027,26039,26051,26054,26049,26052,26060,26066,26075, 26073,26080,26081,26097,26482,26122,26115,26107,26483,26165,26166,26164,26140, 26191,26180,26185,26177,26206,26205,26212,26215,26216,26207,26210,26224,26243, 26248,26254,26249,26244,26264,26269,26305,26297,26313,26302,26300,26308,26296, 26326,26330,26336,26175,26342,26345,26352,26357,26359,26383,26390,26398,26406, 26407,38712,26414,26431,26422,26433,26424,26423,26438,26462,26464,26457,26467, 26468,26505,26480,26537,26492,26474,26508,26507,26534,26529,26501,26551,26607, 26548,26604,26547,26601,26552,26596,26590,26589,26594,26606,26553,26574,26566, 26599,27292,26654,26694,26665,26688,26701,26674,26702,26803,26667,26713,26723, 26743,26751,26783,26767,26797,26772,26781,26779,26755,27310,26809,26740,26805, 26784,26810,26895,26765,26750,26881,26826,26888,26840,26914,26918,26849,26892, 26829,26836,26855,26837,26934,26898,26884,26839,26851,26917,26873,26848,26863, 26920,26922,26906,26915,26913,26822,27001,26999,26972,27000,26987,26964,27006, 26990,26937,26996,26941,26969,26928,26977,26974,26973,27009,26986,27058,27054, 27088,27071,27073,27091,27070,27086,23528,27082,27101,27067,27075,27047,27182, 27025,27040,27036,27029,27060,27102,27112,27138,27163,27135,27402,27129,27122, 27111,27141,27057,27166,27117,27156,27115,27146,27154,27329,27171,27155,27204, 27148,27250,27190,27256,27207,27234,27225,27238,27208,27192,27170,27280,27277, 27296,27268,27298,27299,27287,34327,27323,27331,27330,27320,27315,27308,27358, 27345,27359,27306,27354,27370,27387,27397,34326,27386,27410,27414,39729,27423, 27448,27447,30428,27449,39150,27463,27459,27465,27472,27481,27476,27483,27487, 27489,27512,27513,27519,27520,27524,27523,27533,27544,27541,27550,27556,27562, 27563,27567,27570,27569,27571,27575,27580,27590,27595,27603,27615,27628,27627, 27635,27631,40638,27656,27667,27668,27675,27684,27683,27742,27733,27746,27754, 27778,27789,27802,27777,27803,27774,27752,27763,27794,27792,27844,27889,27859, 27837,27863,27845,27869,27822,27825,27838,27834,27867,27887,27865,27882,27935, 34893,27958,27947,27965,27960,27929,27957,27955,27922,27916,28003,28051,28004, 27994,28025,27993,28046,28053,28644,28037,28153,28181,28170,28085,28103,28134, 28088,28102,28140,28126,28108,28136,28114,28101,28154,28121,28132,28117,28138, 28142,28205,28270,28206,28185,28274,28255,28222,28195,28267,28203,28278,28237, 28191,28227,28218,28238,28196,28415,28189,28216,28290,28330,28312,28361,28343, 28371,28349,28335,28356,28338,28372,28373,28303,28325,28354,28319,28481,28433, 28748,28396,28408,28414,28479,28402,28465,28399,28466,28364,28478,28435,28407, 28550,28538,28536,28545,28544,28527,28507,28659,28525,28546,28540,28504,28558, 28561,28610,28518,28595,28579,28577,28580,28601,28614,28586,28639,28629,28652, 28628,28632,28657,28654,28635,28681,28683,28666,28689,28673,28687,28670,28699, 28698,28532,28701,28696,28703,28720,28734,28722,28753,28771,28825,28818,28847, 28913,28844,28856,28851,28846,28895,28875,28893,28889,28937,28925,28956,28953, 29029,29013,29064,29030,29026,29004,29014,29036,29071,29179,29060,29077,29096, 29100,29143,29113,29118,29138,29129,29140,29134,29152,29164,29159,29173,29180, 29177,29183,29197,29200,29211,29224,29229,29228,29232,29234,29243,29244,29247, 29248,29254,29259,29272,29300,29310,29314,29313,29319,29330,29334,29346,29351, 29369,29362,29379,29382,29380,29390,29394,29410,29408,29409,29433,29431,20495, 29463,29450,29468,29462,29469,29492,29487,29481,29477,29502,29518,29519,40664, 29527,29546,29544,29552,29560,29557,29563,29562,29640,29619,29646,29627,29632, 29669,29678,29662,29858,29701,29807,29733,29688,29746,29754,29781,29759,29791, 29785,29761,29788,29801,29808,29795,29802,29814,29822,29835,29854,29863,29898, 29903,29908,29681,29920,29923,29927,29929,29934,29938,29936,29937,29944,29943, 29956,29955,29957,29964,29966,29965,29973,29971,29982,29990,29996,30012,30020, 30029,30026,30025,30043,30022,30042,30057,30052,30055,30059,30061,30072,30070, 30086,30087,30068,30090,30089,30082,30100,30106,30109,30117,30115,30146,30131, 30147,30133,30141,30136,30140,30129,30157,30154,30162,30169,30179,30174,30206, 30207,30204,30209,30192,30202,30194,30195,30219,30221,30217,30239,30247,30240, 30241,30242,30244,30260,30256,30267,30279,30280,30278,30300,30296,30305,30306, 30312,30313,30314,30311,30316,30320,30322,30326,30328,30332,30336,30339,30344, 30347,30350,30358,30355,30361,30362,30384,30388,30392,30393,30394,30402,30413, 30422,30418,30430,30433,30437,30439,30442,34351,30459,30472,30471,30468,30505, 30500,30494,30501,30502,30491,30519,30520,30535,30554,30568,30571,30555,30565, 30591,30590,30585,30606,30603,30609,30624,30622,30640,30646,30649,30655,30652, 30653,30651,30663,30669,30679,30682,30684,30691,30702,30716,30732,30738,31014, 30752,31018,30789,30862,30836,30854,30844,30874,30860,30883,30901,30890,30895, 30929,30918,30923,30932,30910,30908,30917,30922,30956,30951,30938,30973,30964, 30983,30994,30993,31001,31020,31019,31040,31072,31063,31071,31066,31061,31059, 31098,31103,31114,31133,31143,40779,31146,31150,31155,31161,31162,31177,31189, 31207,31212,31201,31203,31240,31245,31256,31257,31264,31263,31104,31281,31291, 31294,31287,31299,31319,31305,31329,31330,31337,40861,31344,31353,31357,31368, 31383,31381,31384,31382,31401,31432,31408,31414,31429,31428,31423,36995,31431, 31434,31437,31439,31445,31443,31449,31450,31453,31457,31458,31462,31469,31472, 31490,31503,31498,31494,31539,31512,31513,31518,31541,31528,31542,31568,31610, 31492,31565,31499,31564,31557,31605,31589,31604,31591,31600,31601,31596,31598, 31645,31640,31647,31629,31644,31642,31627,31634,31631,31581,31641,31691,31681, 31692,31695,31668,31686,31709,31721,31761,31764,31718,31717,31840,31744,31751, 31763,31731,31735,31767,31757,31734,31779,31783,31786,31775,31799,31787,31805, 31820,31811,31828,31823,31808,31824,31832,31839,31844,31830,31845,31852,31861, 31875,31888,31908,31917,31906,31915,31905,31912,31923,31922,31921,31918,31929, 31933,31936,31941,31938,31960,31954,31964,31970,39739,31983,31986,31988,31990, 31994,32006,32002,32028,32021,32010,32069,32075,32046,32050,32063,32053,32070, 32115,32086,32078,32114,32104,32110,32079,32099,32147,32137,32091,32143,32125, 32155,32186,32174,32163,32181,32199,32189,32171,32317,32162,32175,32220,32184, 32159,32176,32216,32221,32228,32222,32251,32242,32225,32261,32266,32291,32289, 32274,32305,32287,32265,32267,32290,32326,32358,32315,32309,32313,32323,32311, 32306,32314,32359,32349,32342,32350,32345,32346,32377,32362,32361,32380,32379, 32387,32213,32381,36782,32383,32392,32393,32396,32402,32400,32403,32404,32406, 32398,32411,32412,32568,32570,32581,32588,32589,32590,32592,32593,32597,32596, 32600,32607,32608,32616,32617,32615,32632,32642,32646,32643,32648,32647,32652, 32660,32670,32669,32666,32675,32687,32690,32697,32686,32694,32696,35697,32709, 32710,32714,32725,32724,32737,32742,32745,32755,32761,39132,32774,32772,32779, 32786,32792,32793,32796,32801,32808,32831,32827,32842,32838,32850,32856,32858, 32863,32866,32872,32883,32882,32880,32886,32889,32893,32895,32900,32902,32901, 32923,32915,32922,32941,20880,32940,32987,32997,32985,32989,32964,32986,32982, 33033,33007,33009,33051,33065,33059,33071,33099,38539,33094,33086,33107,33105, 33020,33137,33134,33125,33126,33140,33155,33160,33162,33152,33154,33184,33173, 33188,33187,33119,33171,33193,33200,33205,33214,33208,33213,33216,33218,33210, 33225,33229,33233,33241,33240,33224,33242,33247,33248,33255,33274,33275,33278, 33281,33282,33285,33287,33290,33293,33296,33302,33321,33323,33336,33331,33344, 33369,33368,33373,33370,33375,33380,33378,33384,33386,33387,33326,33393,33399, 33400,33406,33421,33426,33451,33439,33467,33452,33505,33507,33503,33490,33524, 33523,33530,33683,33539,33531,33529,33502,33542,33500,33545,33497,33589,33588, 33558,33586,33585,33600,33593,33616,33605,33583,33579,33559,33560,33669,33690, 33706,33695,33698,33686,33571,33678,33671,33674,33660,33717,33651,33653,33696, 33673,33704,33780,33811,33771,33742,33789,33795,33752,33803,33729,33783,33799, 33760,33778,33805,33826,33824,33725,33848,34054,33787,33901,33834,33852,34138, 33924,33911,33899,33965,33902,33922,33897,33862,33836,33903,33913,33845,33994, 33890,33977,33983,33951,34009,33997,33979,34010,34000,33985,33990,34006,33953, 34081,34047,34036,34071,34072,34092,34079,34069,34068,34044,34112,34147,34136, 34120,34113,34306,34123,34133,34176,34212,34184,34193,34186,34216,34157,34196, 34203,34282,34183,34204,34167,34174,34192,34249,34234,34255,34233,34256,34261, 34269,34277,34268,34297,34314,34323,34315,34302,34298,34310,34338,34330,34352, 34367,34381,20053,34388,34399,34407,34417,34451,34467,34473,34474,34443,34444, 34486,34479,34500,34502,34480,34505,34851,34475,34516,34526,34537,34540,34527, 34523,34543,34578,34566,34568,34560,34563,34555,34577,34569,34573,34553,34570, 34612,34623,34615,34619,34597,34601,34586,34656,34655,34680,34636,34638,34676, 34647,34664,34670,34649,34643,34659,34666,34821,34722,34719,34690,34735,34763, 34749,34752,34768,38614,34731,34756,34739,34759,34758,34747,34799,34802,34784, 34831,34829,34814,34806,34807,34830,34770,34833,34838,34837,34850,34849,34865, 34870,34873,34855,34875,34884,34882,34898,34905,34910,34914,34923,34945,34942, 34974,34933,34941,34997,34930,34946,34967,34962,34990,34969,34978,34957,34980, 34992,35007,34993,35011,35012,35028,35032,35033,35037,35065,35074,35068,35060, 35048,35058,35076,35084,35082,35091,35139,35102,35109,35114,35115,35137,35140, 35131,35126,35128,35148,35101,35168,35166,35174,35172,35181,35178,35183,35188, 35191,35198,35203,35208,35210,35219,35224,35233,35241,35238,35244,35247,35250, 35258,35261,35263,35264,35290,35292,35293,35303,35316,35320,35331,35350,35344, 35340,35355,35357,35365,35382,35393,35419,35410,35398,35400,35452,35437,35436, 35426,35461,35458,35460,35496,35489,35473,35493,35494,35482,35491,35524,35533, 35522,35546,35563,35571,35559,35556,35569,35604,35552,35554,35575,35550,35547, 35596,35591,35610,35553,35606,35600,35607,35616,35635,38827,35622,35627,35646, 35624,35649,35660,35663,35662,35657,35670,35675,35674,35691,35679,35692,35695, 35700,35709,35712,35724,35726,35730,35731,35734,35737,35738,35898,35905,35903, 35912,35916,35918,35920,35925,35938,35948,35960,35962,35970,35977,35973,35978, 35981,35982,35988,35964,35992,25117,36013,36010,36029,36018,36019,36014,36022, 36040,36033,36068,36067,36058,36093,36090,36091,36100,36101,36106,36103,36111, 36109,36112,40782,36115,36045,36116,36118,36199,36205,36209,36211,36225,36249, 36290,36286,36282,36303,36314,36310,36300,36315,36299,36330,36331,36319,36323, 36348,36360,36361,36351,36381,36382,36368,36383,36418,36405,36400,36404,36426, 36423,36425,36428,36432,36424,36441,36452,36448,36394,36451,36437,36470,36466, 36476,36481,36487,36485,36484,36491,36490,36499,36497,36500,36505,36522,36513, 36524,36528,36550,36529,36542,36549,36552,36555,36571,36579,36604,36603,36587, 36606,36618,36613,36629,36626,36633,36627,36636,36639,36635,36620,36646,36659, 36667,36665,36677,36674,36670,36684,36681,36678,36686,36695,36700,36706,36707, 36708,36764,36767,36771,36781,36783,36791,36826,36837,36834,36842,36847,36999, 36852,36869,36857,36858,36881,36885,36897,36877,36894,36886,36875,36903,36918, 36917,36921,36856,36943,36944,36945,36946,36878,36937,36926,36950,36952,36958, 36968,36975,36982,38568,36978,36994,36989,36993,36992,37002,37001,37007,37032, 37039,37041,37045,37090,37092,25160,37083,37122,37138,37145,37170,37168,37194, 37206,37208,37219,37221,37225,37235,37234,37259,37257,37250,37282,37291,37295, 37290,37301,37300,37306,37312,37313,37321,37323,37328,37334,37343,37345,37339, 37372,37365,37366,37406,37375,37396,37420,37397,37393,37470,37463,37445,37449, 37476,37448,37525,37439,37451,37456,37532,37526,37523,37531,37466,37583,37561, 37559,37609,37647,37626,37700,37678,37657,37666,37658,37667,37690,37685,37691, 37724,37728,37756,37742,37718,37808,37804,37805,37780,37817,37846,37847,37864, 37861,37848,37827,37853,37840,37832,37860,37914,37908,37907,37891,37895,37904, 37942,37931,37941,37921,37946,37953,37970,37956,37979,37984,37986,37982,37994, 37417,38000,38005,38007,38013,37978,38012,38014,38017,38015,38274,38279,38282, 38292,38294,38296,38297,38304,38312,38311,38317,38332,38331,38329,38334,38346, 28662,38339,38349,38348,38357,38356,38358,38364,38369,38373,38370,38433,38440, 38446,38447,38466,38476,38479,38475,38519,38492,38494,38493,38495,38502,38514, 38508,38541,38552,38549,38551,38570,38567,38577,38578,38576,38580,38582,38584, 38585,38606,38603,38601,38605,35149,38620,38669,38613,38649,38660,38662,38664, 38675,38670,38673,38671,38678,38681,38692,38698,38704,38713,38717,38718,38724, 38726,38728,38722,38729,38748,38752,38756,38758,38760,21202,38763,38769,38777, 38789,38780,38785,38778,38790,38795,38799,38800,38812,38824,38822,38819,38835, 38836,38851,38854,38856,38859,38876,38893,40783,38898,31455,38902,38901,38927, 38924,38968,38948,38945,38967,38973,38982,38991,38987,39019,39023,39024,39025, 39028,39027,39082,39087,39089,39094,39108,39107,39110,39145,39147,39171,39177, 39186,39188,39192,39201,39197,39198,39204,39200,39212,39214,39229,39230,39234, 39241,39237,39248,39243,39249,39250,39244,39253,39319,39320,39333,39341,39342, 39356,39391,39387,39389,39384,39377,39405,39406,39409,39410,39419,39416,39425, 39439,39429,39394,39449,39467,39479,39493,39490,39488,39491,39486,39509,39501, 39515,39511,39519,39522,39525,39524,39529,39531,39530,39597,39600,39612,39616, 39631,39633,39635,39636,39646,39647,39650,39651,39654,39663,39659,39662,39668, 39665,39671,39675,39686,39704,39706,39711,39714,39715,39717,39719,39720,39721, 39722,39726,39727,39730,39748,39747,39759,39757,39758,39761,39768,39796,39827, 39811,39825,39830,39831,39839,39840,39848,39860,39872,39882,39865,39878,39887, 39889,39890,39907,39906,39908,39892,39905,39994,39922,39921,39920,39957,39956, 39945,39955,39948,39942,39944,39954,39946,39940,39982,39963,39973,39972,39969, 39984,40007,39986,40006,39998,40026,40032,40039,40054,40056,40167,40172,40176, 40201,40200,40171,40195,40198,40234,40230,40367,40227,40223,40260,40213,40210, 40257,40255,40254,40262,40264,40285,40286,40292,40273,40272,40281,40306,40329, 40327,40363,40303,40314,40346,40356,40361,40370,40388,40385,40379,40376,40378, 40390,40399,40386,40409,40403,40440,40422,40429,40431,40445,40474,40475,40478, 40565,40569,40573,40577,40584,40587,40588,40594,40597,40593,40605,40613,40617, 40632,40618,40621,38753,40652,40654,40655,40656,40660,40668,40670,40669,40672, 40677,40680,40687,40692,40694,40695,40697,40699,40700,40701,40711,40712,30391, 40725,40737,40748,40766,40778,40786,40788,40803,40799,40800,40801,40806,40807, 40812,40810,40823,40818,40822,40853,40860,40864,22575,27079,36953,29796,20956, 29081, }; static const struct dbcs_index jisx0208_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0208_decmap+0,33,126},{__jisx0208_decmap +94,33,126},{__jisx0208_decmap+188,48,122},{__jisx0208_decmap+263,33,115},{ __jisx0208_decmap+346,33,118},{__jisx0208_decmap+432,33,88},{__jisx0208_decmap +488,33,113},{__jisx0208_decmap+569,33,64},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{__jisx0208_decmap+601,33,126},{__jisx0208_decmap+695,33, 126},{__jisx0208_decmap+789,33,126},{__jisx0208_decmap+883,33,126},{ __jisx0208_decmap+977,33,126},{__jisx0208_decmap+1071,33,126},{ __jisx0208_decmap+1165,33,126},{__jisx0208_decmap+1259,33,126},{ __jisx0208_decmap+1353,33,126},{__jisx0208_decmap+1447,33,126},{ __jisx0208_decmap+1541,33,126},{__jisx0208_decmap+1635,33,126},{ __jisx0208_decmap+1729,33,126},{__jisx0208_decmap+1823,33,126},{ __jisx0208_decmap+1917,33,126},{__jisx0208_decmap+2011,33,126},{ __jisx0208_decmap+2105,33,126},{__jisx0208_decmap+2199,33,126},{ __jisx0208_decmap+2293,33,126},{__jisx0208_decmap+2387,33,126},{ __jisx0208_decmap+2481,33,126},{__jisx0208_decmap+2575,33,126},{ __jisx0208_decmap+2669,33,126},{__jisx0208_decmap+2763,33,126},{ __jisx0208_decmap+2857,33,126},{__jisx0208_decmap+2951,33,126},{ __jisx0208_decmap+3045,33,126},{__jisx0208_decmap+3139,33,126},{ __jisx0208_decmap+3233,33,126},{__jisx0208_decmap+3327,33,126},{ __jisx0208_decmap+3421,33,126},{__jisx0208_decmap+3515,33,83},{ __jisx0208_decmap+3566,33,126},{__jisx0208_decmap+3660,33,126},{ __jisx0208_decmap+3754,33,126},{__jisx0208_decmap+3848,33,126},{ __jisx0208_decmap+3942,33,126},{__jisx0208_decmap+4036,33,126},{ __jisx0208_decmap+4130,33,126},{__jisx0208_decmap+4224,33,126},{ __jisx0208_decmap+4318,33,126},{__jisx0208_decmap+4412,33,126},{ __jisx0208_decmap+4506,33,126},{__jisx0208_decmap+4600,33,126},{ __jisx0208_decmap+4694,33,126},{__jisx0208_decmap+4788,33,126},{ __jisx0208_decmap+4882,33,126},{__jisx0208_decmap+4976,33,126},{ __jisx0208_decmap+5070,33,126},{__jisx0208_decmap+5164,33,126},{ __jisx0208_decmap+5258,33,126},{__jisx0208_decmap+5352,33,126},{ __jisx0208_decmap+5446,33,126},{__jisx0208_decmap+5540,33,126},{ __jisx0208_decmap+5634,33,126},{__jisx0208_decmap+5728,33,126},{ __jisx0208_decmap+5822,33,126},{__jisx0208_decmap+5916,33,126},{ __jisx0208_decmap+6010,33,126},{__jisx0208_decmap+6104,33,126},{ __jisx0208_decmap+6198,33,126},{__jisx0208_decmap+6292,33,126},{ __jisx0208_decmap+6386,33,126},{__jisx0208_decmap+6480,33,126},{ __jisx0208_decmap+6574,33,126},{__jisx0208_decmap+6668,33,126},{ __jisx0208_decmap+6762,33,126},{__jisx0208_decmap+6856,33,126},{ __jisx0208_decmap+6950,33,38},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, }; static const ucs2_t __jisx0212_decmap[6179] = { 728,711,184,729,733,175,731,730,126,900,901,U,U,U,U,U,U,U,U,161,166,191,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,186,170, 169,174,8482,164,8470,902,904,905,906,938,U,908,U,910,939,U,911,U,U,U,U,940, 941,942,943,970,912,972,962,973,971,944,974,1026,1027,1028,1029,1030,1031, 1032,1033,1034,1035,1036,1038,1039,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115, 1116,1118,1119,198,272,U,294,U,306,U,321,319,U,330,216,338,U,358,222,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,230,273,240,295,305,307,312,322,320,329,331,248,339, 223,359,254,193,192,196,194,258,461,256,260,197,195,262,264,268,199,266,270, 201,200,203,202,282,278,274,280,U,284,286,290,288,292,205,204,207,206,463,304, 298,302,296,308,310,313,317,315,323,327,325,209,211,210,214,212,465,336,332, 213,340,344,342,346,348,352,350,356,354,218,217,220,219,364,467,368,362,370, 366,360,471,475,473,469,372,221,376,374,377,381,379,225,224,228,226,259,462, 257,261,229,227,263,265,269,231,267,271,233,232,235,234,283,279,275,281,501, 285,287,U,289,293,237,236,239,238,464,U,299,303,297,309,311,314,318,316,324, 328,326,241,243,242,246,244,466,337,333,245,341,345,343,347,349,353,351,357, 355,250,249,252,251,365,468,369,363,371,367,361,472,476,474,470,373,253,255, 375,378,382,380,19970,19972,19973,19980,19986,19999,20003,20004,20008,20011, 20014,20015,20016,20021,20032,20033,20036,20039,20049,20058,20060,20067,20072, 20073,20084,20085,20089,20095,20109,20118,20119,20125,20143,20153,20163,20176, 20186,20187,20192,20193,20194,20200,20207,20209,20211,20213,20221,20222,20223, 20224,20226,20227,20232,20235,20236,20242,20245,20246,20247,20249,20270,20273, 20320,20275,20277,20279,20281,20283,20286,20288,20290,20296,20297,20299,20300, 20306,20308,20310,20312,20319,20323,20330,20332,20334,20337,20343,20344,20345, 20346,20349,20350,20353,20354,20356,20357,20361,20362,20364,20366,20368,20370, 20371,20372,20375,20377,20378,20382,20383,20402,20407,20409,20411,20412,20413, 20414,20416,20417,20421,20422,20424,20425,20427,20428,20429,20431,20434,20444, 20448,20450,20464,20466,20476,20477,20479,20480,20481,20484,20487,20490,20492, 20494,20496,20499,20503,20504,20507,20508,20509,20510,20514,20519,20526,20528, 20530,20531,20533,20544,20545,20546,20549,20550,20554,20556,20558,20561,20562, 20563,20567,20569,20575,20576,20578,20579,20582,20583,20586,20589,20592,20593, 20539,20609,20611,20612,20614,20618,20622,20623,20624,20626,20627,20628,20630, 20635,20636,20638,20639,20640,20641,20642,20650,20655,20656,20665,20666,20669, 20672,20675,20676,20679,20684,20686,20688,20691,20692,20696,20700,20701,20703, 20706,20708,20710,20712,20713,20719,20721,20726,20730,20734,20739,20742,20743, 20744,20747,20748,20749,20750,20722,20752,20759,20761,20763,20764,20765,20766, 20771,20775,20776,20780,20781,20783,20785,20787,20788,20789,20792,20793,20802, 20810,20815,20819,20821,20823,20824,20831,20836,20838,20862,20867,20868,20875, 20878,20888,20893,20897,20899,20909,20920,20922,20924,20926,20927,20930,20936, 20943,20945,20946,20947,20949,20952,20958,20962,20965,20974,20978,20979,20980, 20983,20993,20994,20997,21010,21011,21013,21014,21016,21026,21032,21041,21042, 21045,21052,21061,21065,21077,21079,21080,21082,21084,21087,21088,21089,21094, 21102,21111,21112,21113,21120,21122,21125,21130,21132,21139,21141,21142,21143, 21144,21146,21148,21156,21157,21158,21159,21167,21168,21174,21175,21176,21178, 21179,21181,21184,21188,21190,21192,21196,21199,21201,21204,21206,21211,21212, 21217,21221,21224,21225,21226,21228,21232,21233,21236,21238,21239,21248,21251, 21258,21259,21260,21265,21267,21272,21275,21276,21278,21279,21285,21287,21288, 21289,21291,21292,21293,21296,21298,21301,21308,21309,21310,21314,21324,21323, 21337,21339,21345,21347,21349,21356,21357,21362,21369,21374,21379,21383,21384, 21390,21395,21396,21401,21405,21409,21412,21418,21419,21423,21426,21428,21429, 21431,21432,21434,21437,21440,21445,21455,21458,21459,21461,21466,21469,21470, 21472,21478,21479,21493,21506,21523,21530,21537,21543,21544,21546,21551,21553, 21556,21557,21571,21572,21575,21581,21583,21598,21602,21604,21606,21607,21609, 21611,21613,21614,21620,21631,21633,21635,21637,21640,21641,21645,21649,21653, 21654,21660,21663,21665,21670,21671,21673,21674,21677,21678,21681,21687,21689, 21690,21691,21695,21702,21706,21709,21710,21728,21738,21740,21743,21750,21756, 21758,21759,21760,21761,21765,21768,21769,21772,21773,21774,21781,21802,21803, 21810,21813,21814,21819,21820,21821,21825,21831,21833,21834,21837,21840,21841, 21848,21850,21851,21854,21856,21857,21860,21862,21887,21889,21890,21894,21896, 21902,21903,21905,21906,21907,21908,21911,21923,21924,21933,21938,21951,21953, 21955,21958,21961,21963,21964,21966,21969,21970,21971,21975,21976,21979,21982, 21986,21993,22006,22015,22021,22024,22026,22029,22030,22031,22032,22033,22034, 22041,22060,22064,22067,22069,22071,22073,22075,22076,22077,22079,22080,22081, 22083,22084,22086,22089,22091,22093,22095,22100,22110,22112,22113,22114,22115, 22118,22121,22125,22127,22129,22130,22133,22148,22149,22152,22155,22156,22165, 22169,22170,22173,22174,22175,22182,22183,22184,22185,22187,22188,22189,22193, 22195,22199,22206,22213,22217,22218,22219,22223,22224,22220,22221,22233,22236, 22237,22239,22241,22244,22245,22246,22247,22248,22257,22251,22253,22262,22263, 22273,22274,22279,22282,22284,22289,22293,22298,22299,22301,22304,22306,22307, 22308,22309,22313,22314,22316,22318,22319,22323,22324,22333,22334,22335,22341, 22342,22348,22349,22354,22370,22373,22375,22376,22379,22381,22382,22383,22384, 22385,22387,22388,22389,22391,22393,22394,22395,22396,22398,22401,22403,22412, 22420,22423,22425,22426,22428,22429,22430,22431,22433,22421,22439,22440,22441, 22444,22456,22461,22471,22472,22476,22479,22485,22493,22494,22500,22502,22503, 22505,22509,22512,22517,22518,22520,22525,22526,22527,22531,22532,22536,22537, 22497,22540,22541,22555,22558,22559,22560,22566,22567,22573,22578,22585,22591, 22601,22604,22605,22607,22608,22613,22623,22625,22628,22631,22632,22648,22652, 22655,22656,22657,22663,22664,22665,22666,22668,22669,22671,22672,22676,22678, 22685,22688,22689,22690,22694,22697,22705,22706,22724,22716,22722,22728,22733, 22734,22736,22738,22740,22742,22746,22749,22753,22754,22761,22771,22789,22790, 22795,22796,22802,22803,22804,34369,22813,22817,22819,22820,22824,22831,22832, 22835,22837,22838,22847,22851,22854,22866,22867,22873,22875,22877,22878,22879, 22881,22883,22891,22893,22895,22898,22901,22902,22905,22907,22908,22923,22924, 22926,22930,22933,22935,22943,22948,22951,22957,22958,22959,22960,22963,22967, 22970,22972,22977,22979,22980,22984,22986,22989,22994,23005,23006,23007,23011, 23012,23015,23022,23023,23025,23026,23028,23031,23040,23044,23052,23053,23054, 23058,23059,23070,23075,23076,23079,23080,23082,23085,23088,23108,23109,23111, 23112,23116,23120,23125,23134,23139,23141,23143,23149,23159,23162,23163,23166, 23179,23184,23187,23190,23193,23196,23198,23199,23200,23202,23207,23212,23217, 23218,23219,23221,23224,23226,23227,23231,23236,23238,23240,23247,23258,23260, 23264,23269,23274,23278,23285,23286,23293,23296,23297,23304,23319,23348,23321, 23323,23325,23329,23333,23341,23352,23361,23371,23372,23378,23382,23390,23400, 23406,23407,23420,23421,23422,23423,23425,23428,23430,23434,23438,23440,23441, 23443,23444,23446,23464,23465,23468,23469,23471,23473,23474,23479,23482,23484, 23488,23489,23501,23503,23510,23511,23512,23513,23514,23520,23535,23537,23540, 23549,23564,23575,23582,23583,23587,23590,23593,23595,23596,23598,23600,23602, 23605,23606,23641,23642,23644,23650,23651,23655,23656,23657,23661,23664,23668, 23669,23674,23675,23676,23677,23687,23688,23690,23695,23698,23709,23711,23712, 23714,23715,23718,23722,23730,23732,23733,23738,23753,23755,23762,23773,23767, 23790,23793,23794,23796,23809,23814,23821,23826,23851,23843,23844,23846,23847, 23857,23860,23865,23869,23871,23874,23875,23878,23880,23893,23889,23897,23882, 23903,23904,23905,23906,23908,23914,23917,23920,23929,23930,23934,23935,23937, 23939,23944,23946,23954,23955,23956,23957,23961,23963,23967,23968,23975,23979, 23984,23988,23992,23993,24003,24007,24011,24016,24014,24024,24025,24032,24036, 24041,24056,24057,24064,24071,24077,24082,24084,24085,24088,24095,24096,24110, 24104,24114,24117,24126,24139,24144,24137,24145,24150,24152,24155,24156,24158, 24168,24170,24171,24172,24173,24174,24176,24192,24203,24206,24226,24228,24229, 24232,24234,24236,24241,24243,24253,24254,24255,24262,24268,24267,24270,24273, 24274,24276,24277,24284,24286,24293,24299,24322,24326,24327,24328,24334,24345, 24348,24349,24353,24354,24355,24356,24360,24363,24364,24366,24368,24372,24374, 24379,24381,24383,24384,24388,24389,24391,24397,24400,24404,24408,24411,24416, 24419,24420,24423,24431,24434,24436,24437,24440,24442,24445,24446,24457,24461, 24463,24470,24476,24477,24482,24487,24491,24484,24492,24495,24496,24497,24504, 24516,24519,24520,24521,24523,24528,24529,24530,24531,24532,24542,24545,24546, 24552,24553,24554,24556,24557,24558,24559,24562,24563,24566,24570,24572,24583, 24586,24589,24595,24596,24599,24600,24602,24607,24612,24621,24627,24629,24640, 24647,24648,24649,24652,24657,24660,24662,24663,24669,24673,24679,24689,24702, 24703,24706,24710,24712,24714,24718,24721,24723,24725,24728,24733,24734,24738, 24740,24741,24744,24752,24753,24759,24763,24766,24770,24772,24776,24777,24778, 24779,24782,24783,24788,24789,24793,24795,24797,24798,24802,24805,24818,24821, 24824,24828,24829,24834,24839,24842,24844,24848,24849,24850,24851,24852,24854, 24855,24857,24860,24862,24866,24874,24875,24880,24881,24885,24886,24887,24889, 24897,24901,24902,24905,24926,24928,24940,24946,24952,24955,24956,24959,24960, 24961,24963,24964,24971,24973,24978,24979,24983,24984,24988,24989,24991,24992, 24997,25000,25002,25005,25016,25017,25020,25024,25025,25026,25038,25039,25045, 25052,25053,25054,25055,25057,25058,25063,25065,25061,25068,25069,25071,25089, 25091,25092,25095,25107,25109,25116,25120,25122,25123,25127,25129,25131,25145, 25149,25154,25155,25156,25158,25164,25168,25169,25170,25172,25174,25178,25180, 25188,25197,25199,25203,25210,25213,25229,25230,25231,25232,25254,25256,25267, 25270,25271,25274,25278,25279,25284,25294,25301,25302,25306,25322,25330,25332, 25340,25341,25347,25348,25354,25355,25357,25360,25363,25366,25368,25385,25386, 25389,25397,25398,25401,25404,25409,25410,25411,25412,25414,25418,25419,25422, 25426,25427,25428,25432,25435,25445,25446,25452,25453,25457,25460,25461,25464, 25468,25469,25471,25474,25476,25479,25482,25488,25492,25493,25497,25498,25502, 25508,25510,25517,25518,25519,25533,25537,25541,25544,25550,25553,25555,25556, 25557,25564,25568,25573,25578,25580,25586,25587,25589,25592,25593,25609,25610, 25616,25618,25620,25624,25630,25632,25634,25636,25637,25641,25642,25647,25648, 25653,25661,25663,25675,25679,25681,25682,25683,25684,25690,25691,25692,25693, 25695,25696,25697,25699,25709,25715,25716,25723,25725,25733,25735,25743,25744, 25745,25752,25753,25755,25757,25759,25761,25763,25766,25768,25772,25779,25789, 25790,25791,25796,25801,25802,25803,25804,25806,25808,25809,25813,25815,25828, 25829,25833,25834,25837,25840,25845,25847,25851,25855,25857,25860,25864,25865, 25866,25871,25875,25876,25878,25881,25883,25886,25887,25890,25894,25897,25902, 25905,25914,25916,25917,25923,25927,25929,25936,25938,25940,25951,25952,25959, 25963,25978,25981,25985,25989,25994,26002,26005,26008,26013,26016,26019,26022, 26030,26034,26035,26036,26047,26050,26056,26057,26062,26064,26068,26070,26072, 26079,26096,26098,26100,26101,26105,26110,26111,26112,26116,26120,26121,26125, 26129,26130,26133,26134,26141,26142,26145,26146,26147,26148,26150,26153,26154, 26155,26156,26158,26160,26161,26163,26169,26167,26176,26181,26182,26186,26188, 26193,26190,26199,26200,26201,26203,26204,26208,26209,26363,26218,26219,26220, 26238,26227,26229,26239,26231,26232,26233,26235,26240,26236,26251,26252,26253, 26256,26258,26265,26266,26267,26268,26271,26272,26276,26285,26289,26290,26293, 26299,26303,26304,26306,26307,26312,26316,26318,26319,26324,26331,26335,26344, 26347,26348,26350,26362,26373,26375,26382,26387,26393,26396,26400,26402,26419, 26430,26437,26439,26440,26444,26452,26453,26461,26470,26476,26478,26484,26486, 26491,26497,26500,26510,26511,26513,26515,26518,26520,26521,26523,26544,26545, 26546,26549,26555,26556,26557,26617,26560,26562,26563,26565,26568,26569,26578, 26583,26585,26588,26593,26598,26608,26610,26614,26615,26706,26644,26649,26653, 26655,26664,26663,26668,26669,26671,26672,26673,26675,26683,26687,26692,26693, 26698,26700,26709,26711,26712,26715,26731,26734,26735,26736,26737,26738,26741, 26745,26746,26747,26748,26754,26756,26758,26760,26774,26776,26778,26780,26785, 26787,26789,26793,26794,26798,26802,26811,26821,26824,26828,26831,26832,26833, 26835,26838,26841,26844,26845,26853,26856,26858,26859,26860,26861,26864,26865, 26869,26870,26875,26876,26877,26886,26889,26890,26896,26897,26899,26902,26903, 26929,26931,26933,26936,26939,26946,26949,26953,26958,26967,26971,26979,26980, 26981,26982,26984,26985,26988,26992,26993,26994,27002,27003,27007,27008,27021, 27026,27030,27032,27041,27045,27046,27048,27051,27053,27055,27063,27064,27066, 27068,27077,27080,27089,27094,27095,27106,27109,27118,27119,27121,27123,27125, 27134,27136,27137,27139,27151,27153,27157,27162,27165,27168,27172,27176,27184, 27186,27188,27191,27195,27198,27199,27205,27206,27209,27210,27214,27216,27217, 27218,27221,27222,27227,27236,27239,27242,27249,27251,27262,27265,27267,27270, 27271,27273,27275,27281,27291,27293,27294,27295,27301,27307,27311,27312,27313, 27316,27325,27326,27327,27334,27337,27336,27340,27344,27348,27349,27350,27356, 27357,27364,27367,27372,27376,27377,27378,27388,27389,27394,27395,27398,27399, 27401,27407,27408,27409,27415,27419,27422,27428,27432,27435,27436,27439,27445, 27446,27451,27455,27462,27466,27469,27474,27478,27480,27485,27488,27495,27499, 27502,27504,27509,27517,27518,27522,27525,27543,27547,27551,27552,27554,27555, 27560,27561,27564,27565,27566,27568,27576,27577,27581,27582,27587,27588,27593, 27596,27606,27610,27617,27619,27622,27623,27630,27633,27639,27641,27647,27650, 27652,27653,27657,27661,27662,27664,27666,27673,27679,27686,27687,27688,27692, 27694,27699,27701,27702,27706,27707,27711,27722,27723,27725,27727,27730,27732, 27737,27739,27740,27755,27757,27759,27764,27766,27768,27769,27771,27781,27782, 27783,27785,27796,27797,27799,27800,27804,27807,27824,27826,27828,27842,27846, 27853,27855,27856,27857,27858,27860,27862,27866,27868,27872,27879,27881,27883, 27884,27886,27890,27892,27908,27911,27914,27918,27919,27921,27923,27930,27942, 27943,27944,27751,27950,27951,27953,27961,27964,27967,27991,27998,27999,28001, 28005,28007,28015,28016,28028,28034,28039,28049,28050,28052,28054,28055,28056, 28074,28076,28084,28087,28089,28093,28095,28100,28104,28106,28110,28111,28118, 28123,28125,28127,28128,28130,28133,28137,28143,28144,28148,28150,28156,28160, 28164,28190,28194,28199,28210,28214,28217,28219,28220,28228,28229,28232,28233, 28235,28239,28241,28242,28243,28244,28247,28252,28253,28254,28258,28259,28264, 28275,28283,28285,28301,28307,28313,28320,28327,28333,28334,28337,28339,28347, 28351,28352,28353,28355,28359,28360,28362,28365,28366,28367,28395,28397,28398, 28409,28411,28413,28420,28424,28426,28428,28429,28438,28440,28442,28443,28454, 28457,28458,28463,28464,28467,28470,28475,28476,28461,28495,28497,28498,28499, 28503,28505,28506,28509,28510,28513,28514,28520,28524,28541,28542,28547,28551, 28552,28555,28556,28557,28560,28562,28563,28564,28566,28570,28575,28576,28581, 28582,28583,28584,28590,28591,28592,28597,28598,28604,28613,28615,28616,28618, 28634,28638,28648,28649,28656,28661,28665,28668,28669,28672,28677,28678,28679, 28685,28695,28704,28707,28719,28724,28727,28729,28732,28739,28740,28744,28745, 28746,28747,28756,28757,28765,28766,28750,28772,28773,28780,28782,28789,28790, 28798,28801,28805,28806,28820,28821,28822,28823,28824,28827,28836,28843,28848, 28849,28852,28855,28874,28881,28883,28884,28885,28886,28888,28892,28900,28922, 28931,28932,28933,28934,28935,28939,28940,28943,28958,28960,28971,28973,28975, 28976,28977,28984,28993,28997,28998,28999,29002,29003,29008,29010,29015,29018, 29020,29022,29024,29032,29049,29056,29061,29063,29068,29074,29082,29083,29088, 29090,29103,29104,29106,29107,29114,29119,29120,29121,29124,29131,29132,29139, 29142,29145,29146,29148,29176,29182,29184,29191,29192,29193,29203,29207,29210, 29213,29215,29220,29227,29231,29236,29240,29241,29249,29250,29251,29253,29262, 29263,29264,29267,29269,29270,29274,29276,29278,29280,29283,29288,29291,29294, 29295,29297,29303,29304,29307,29308,29311,29316,29321,29325,29326,29331,29339, 29352,29357,29358,29361,29364,29374,29377,29383,29385,29388,29397,29398,29400, 29407,29413,29427,29428,29434,29435,29438,29442,29444,29445,29447,29451,29453, 29458,29459,29464,29465,29470,29474,29476,29479,29480,29484,29489,29490,29493, 29498,29499,29501,29507,29517,29520,29522,29526,29528,29533,29534,29535,29536, 29542,29543,29545,29547,29548,29550,29551,29553,29559,29561,29564,29568,29569, 29571,29573,29574,29582,29584,29587,29589,29591,29592,29596,29598,29599,29600, 29602,29605,29606,29610,29611,29613,29621,29623,29625,29628,29629,29631,29637, 29638,29641,29643,29644,29647,29650,29651,29654,29657,29661,29665,29667,29670, 29671,29673,29684,29685,29687,29689,29690,29691,29693,29695,29696,29697,29700, 29703,29706,29713,29722,29723,29732,29734,29736,29737,29738,29739,29740,29741, 29742,29743,29744,29745,29753,29760,29763,29764,29766,29767,29771,29773,29777, 29778,29783,29789,29794,29798,29799,29800,29803,29805,29806,29809,29810,29824, 29825,29829,29830,29831,29833,29839,29840,29841,29842,29848,29849,29850,29852, 29855,29856,29857,29859,29862,29864,29865,29866,29867,29870,29871,29873,29874, 29877,29881,29883,29887,29896,29897,29900,29904,29907,29912,29914,29915,29918, 29919,29924,29928,29930,29931,29935,29940,29946,29947,29948,29951,29958,29970, 29974,29975,29984,29985,29988,29991,29993,29994,29999,30006,30009,30013,30014, 30015,30016,30019,30023,30024,30030,30032,30034,30039,30046,30047,30049,30063, 30065,30073,30074,30075,30076,30077,30078,30081,30085,30096,30098,30099,30101, 30105,30108,30114,30116,30132,30138,30143,30144,30145,30148,30150,30156,30158, 30159,30167,30172,30175,30176,30177,30180,30183,30188,30190,30191,30193,30201, 30208,30210,30211,30212,30215,30216,30218,30220,30223,30226,30227,30229,30230, 30233,30235,30236,30237,30238,30243,30245,30246,30249,30253,30258,30259,30261, 30264,30265,30266,30268,30282,30272,30273,30275,30276,30277,30281,30283,30293, 30297,30303,30308,30309,30317,30318,30319,30321,30324,30337,30341,30348,30349, 30357,30363,30364,30365,30367,30368,30370,30371,30372,30373,30374,30375,30376, 30378,30381,30397,30401,30405,30409,30411,30412,30414,30420,30425,30432,30438, 30440,30444,30448,30449,30454,30457,30460,30464,30470,30474,30478,30482,30484, 30485,30487,30489,30490,30492,30498,30504,30509,30510,30511,30516,30517,30518, 30521,30525,30526,30530,30533,30534,30538,30541,30542,30543,30546,30550,30551, 30556,30558,30559,30560,30562,30564,30567,30570,30572,30576,30578,30579,30580, 30586,30589,30592,30596,30604,30605,30612,30613,30614,30618,30623,30626,30631, 30634,30638,30639,30641,30645,30654,30659,30665,30673,30674,30677,30681,30686, 30687,30688,30692,30694,30698,30700,30704,30705,30708,30712,30715,30725,30726, 30729,30733,30734,30737,30749,30753,30754,30755,30765,30766,30768,30773,30775, 30787,30788,30791,30792,30796,30798,30802,30812,30814,30816,30817,30819,30820, 30824,30826,30830,30842,30846,30858,30863,30868,30872,30881,30877,30878,30879, 30884,30888,30892,30893,30896,30897,30898,30899,30907,30909,30911,30919,30920, 30921,30924,30926,30930,30931,30933,30934,30948,30939,30943,30944,30945,30950, 30954,30962,30963,30976,30966,30967,30970,30971,30975,30982,30988,30992,31002, 31004,31006,31007,31008,31013,31015,31017,31021,31025,31028,31029,31035,31037, 31039,31044,31045,31046,31050,31051,31055,31057,31060,31064,31067,31068,31079, 31081,31083,31090,31097,31099,31100,31102,31115,31116,31121,31123,31124,31125, 31126,31128,31131,31132,31137,31144,31145,31147,31151,31153,31156,31160,31163, 31170,31172,31175,31176,31178,31183,31188,31190,31194,31197,31198,31200,31202, 31205,31210,31211,31213,31217,31224,31228,31234,31235,31239,31241,31242,31244, 31249,31253,31259,31262,31265,31271,31275,31277,31279,31280,31284,31285,31288, 31289,31290,31300,31301,31303,31304,31308,31317,31318,31321,31324,31325,31327, 31328,31333,31335,31338,31341,31349,31352,31358,31360,31362,31365,31366,31370, 31371,31376,31377,31380,31390,31392,31395,31404,31411,31413,31417,31419,31420, 31430,31433,31436,31438,31441,31451,31464,31465,31467,31468,31473,31476,31483, 31485,31486,31495,31508,31519,31523,31527,31529,31530,31531,31533,31534,31535, 31536,31537,31540,31549,31551,31552,31553,31559,31566,31573,31584,31588,31590, 31593,31594,31597,31599,31602,31603,31607,31620,31625,31630,31632,31633,31638, 31643,31646,31648,31653,31660,31663,31664,31666,31669,31670,31674,31675,31676, 31677,31682,31685,31688,31690,31700,31702,31703,31705,31706,31707,31720,31722, 31730,31732,31733,31736,31737,31738,31740,31742,31745,31746,31747,31748,31750, 31753,31755,31756,31758,31759,31769,31771,31776,31781,31782,31784,31788,31793, 31795,31796,31798,31801,31802,31814,31818,31829,31825,31826,31827,31833,31834, 31835,31836,31837,31838,31841,31843,31847,31849,31853,31854,31856,31858,31865, 31868,31869,31878,31879,31887,31892,31902,31904,31910,31920,31926,31927,31930, 31931,31932,31935,31940,31943,31944,31945,31949,31951,31955,31956,31957,31959, 31961,31962,31965,31974,31977,31979,31989,32003,32007,32008,32009,32015,32017, 32018,32019,32022,32029,32030,32035,32038,32042,32045,32049,32060,32061,32062, 32064,32065,32071,32072,32077,32081,32083,32087,32089,32090,32092,32093,32101, 32103,32106,32112,32120,32122,32123,32127,32129,32130,32131,32133,32134,32136, 32139,32140,32141,32145,32150,32151,32157,32158,32166,32167,32170,32179,32182, 32183,32185,32194,32195,32196,32197,32198,32204,32205,32206,32215,32217,32256, 32226,32229,32230,32234,32235,32237,32241,32245,32246,32249,32250,32264,32272, 32273,32277,32279,32284,32285,32288,32295,32296,32300,32301,32303,32307,32310, 32319,32324,32325,32327,32334,32336,32338,32344,32351,32353,32354,32357,32363, 32366,32367,32371,32376,32382,32385,32390,32391,32394,32397,32401,32405,32408, 32410,32413,32414,32572,32571,32573,32574,32575,32579,32580,32583,32591,32594, 32595,32603,32604,32605,32609,32611,32612,32613,32614,32621,32625,32637,32638, 32639,32640,32651,32653,32655,32656,32657,32662,32663,32668,32673,32674,32678, 32682,32685,32692,32700,32703,32704,32707,32712,32718,32719,32731,32735,32739, 32741,32744,32748,32750,32751,32754,32762,32765,32766,32767,32775,32776,32778, 32781,32782,32783,32785,32787,32788,32790,32797,32798,32799,32800,32804,32806, 32812,32814,32816,32820,32821,32823,32825,32826,32828,32830,32832,32836,32864, 32868,32870,32877,32881,32885,32897,32904,32910,32924,32926,32934,32935,32939, 32952,32953,32968,32973,32975,32978,32980,32981,32983,32984,32992,33005,33006, 33008,33010,33011,33014,33017,33018,33022,33027,33035,33046,33047,33048,33052, 33054,33056,33060,33063,33068,33072,33077,33082,33084,33093,33095,33098,33100, 33106,33111,33120,33121,33127,33128,33129,33133,33135,33143,33153,33168,33156, 33157,33158,33163,33166,33174,33176,33179,33182,33186,33198,33202,33204,33211, 33227,33219,33221,33226,33230,33231,33237,33239,33243,33245,33246,33249,33252, 33259,33260,33264,33265,33266,33269,33270,33272,33273,33277,33279,33280,33283, 33295,33299,33300,33305,33306,33309,33313,33314,33320,33330,33332,33338,33347, 33348,33349,33350,33355,33358,33359,33361,33366,33372,33376,33379,33383,33389, 33396,33403,33405,33407,33408,33409,33411,33412,33415,33417,33418,33422,33425, 33428,33430,33432,33434,33435,33440,33441,33443,33444,33447,33448,33449,33450, 33454,33456,33458,33460,33463,33466,33468,33470,33471,33478,33488,33493,33498, 33504,33506,33508,33512,33514,33517,33519,33526,33527,33533,33534,33536,33537, 33543,33544,33546,33547,33620,33563,33565,33566,33567,33569,33570,33580,33581, 33582,33584,33587,33591,33594,33596,33597,33602,33603,33604,33607,33613,33614, 33617,33621,33622,33623,33648,33656,33661,33663,33664,33666,33668,33670,33677, 33682,33684,33685,33688,33689,33691,33692,33693,33702,33703,33705,33708,33726, 33727,33728,33735,33737,33743,33744,33745,33748,33757,33619,33768,33770,33782, 33784,33785,33788,33793,33798,33802,33807,33809,33813,33817,33709,33839,33849, 33861,33863,33864,33866,33869,33871,33873,33874,33878,33880,33881,33882,33884, 33888,33892,33893,33895,33898,33904,33907,33908,33910,33912,33916,33917,33921, 33925,33938,33939,33941,33950,33958,33960,33961,33962,33967,33969,33972,33978, 33981,33982,33984,33986,33991,33992,33996,33999,34003,34012,34023,34026,34031, 34032,34033,34034,34039,34098,34042,34043,34045,34050,34051,34055,34060,34062, 34064,34076,34078,34082,34083,34084,34085,34087,34090,34091,34095,34099,34100, 34102,34111,34118,34127,34128,34129,34130,34131,34134,34137,34140,34141,34142, 34143,34144,34145,34146,34148,34155,34159,34169,34170,34171,34173,34175,34177, 34181,34182,34185,34187,34188,34191,34195,34200,34205,34207,34208,34210,34213, 34215,34228,34230,34231,34232,34236,34237,34238,34239,34242,34247,34250,34251, 34254,34221,34264,34266,34271,34272,34278,34280,34285,34291,34294,34300,34303, 34304,34308,34309,34317,34318,34320,34321,34322,34328,34329,34331,34334,34337, 34343,34345,34358,34360,34362,34364,34365,34368,34370,34374,34386,34387,34390, 34391,34392,34393,34397,34400,34401,34402,34403,34404,34409,34412,34415,34421, 34422,34423,34426,34445,34449,34454,34456,34458,34460,34465,34470,34471,34472, 34477,34481,34483,34484,34485,34487,34488,34489,34495,34496,34497,34499,34501, 34513,34514,34517,34519,34522,34524,34528,34531,34533,34535,34440,34554,34556, 34557,34564,34565,34567,34571,34574,34575,34576,34579,34580,34585,34590,34591, 34593,34595,34600,34606,34607,34609,34610,34617,34618,34620,34621,34622,34624, 34627,34629,34637,34648,34653,34657,34660,34661,34671,34673,34674,34683,34691, 34692,34693,34694,34695,34696,34697,34699,34700,34704,34707,34709,34711,34712, 34713,34718,34720,34723,34727,34732,34733,34734,34737,34741,34750,34751,34753, 34760,34761,34762,34766,34773,34774,34777,34778,34780,34783,34786,34787,34788, 34794,34795,34797,34801,34803,34808,34810,34815,34817,34819,34822,34825,34826, 34827,34832,34841,34834,34835,34836,34840,34842,34843,34844,34846,34847,34856, 34861,34862,34864,34866,34869,34874,34876,34881,34883,34885,34888,34889,34890, 34891,34894,34897,34901,34902,34904,34906,34908,34911,34912,34916,34921,34929, 34937,34939,34944,34968,34970,34971,34972,34975,34976,34984,34986,35002,35005, 35006,35008,35018,35019,35020,35021,35022,35025,35026,35027,35035,35038,35047, 35055,35056,35057,35061,35063,35073,35078,35085,35086,35087,35093,35094,35096, 35097,35098,35100,35104,35110,35111,35112,35120,35121,35122,35125,35129,35130, 35134,35136,35138,35141,35142,35145,35151,35154,35159,35162,35163,35164,35169, 35170,35171,35179,35182,35184,35187,35189,35194,35195,35196,35197,35209,35213, 35216,35220,35221,35227,35228,35231,35232,35237,35248,35252,35253,35254,35255, 35260,35284,35285,35286,35287,35288,35301,35305,35307,35309,35313,35315,35318, 35321,35325,35327,35332,35333,35335,35343,35345,35346,35348,35349,35358,35360, 35362,35364,35366,35371,35372,35375,35381,35383,35389,35390,35392,35395,35397, 35399,35401,35405,35406,35411,35414,35415,35416,35420,35421,35425,35429,35431, 35445,35446,35447,35449,35450,35451,35454,35455,35456,35459,35462,35467,35471, 35472,35474,35478,35479,35481,35487,35495,35497,35502,35503,35507,35510,35511, 35515,35518,35523,35526,35528,35529,35530,35537,35539,35540,35541,35543,35549, 35551,35564,35568,35572,35573,35574,35580,35583,35589,35590,35595,35601,35612, 35614,35615,35594,35629,35632,35639,35644,35650,35651,35652,35653,35654,35656, 35666,35667,35668,35673,35661,35678,35683,35693,35702,35704,35705,35708,35710, 35713,35716,35717,35723,35725,35727,35732,35733,35740,35742,35743,35896,35897, 35901,35902,35909,35911,35913,35915,35919,35921,35923,35924,35927,35928,35931, 35933,35929,35939,35940,35942,35944,35945,35949,35955,35957,35958,35963,35966, 35974,35975,35979,35984,35986,35987,35993,35995,35996,36004,36025,36026,36037, 36038,36041,36043,36047,36054,36053,36057,36061,36065,36072,36076,36079,36080, 36082,36085,36087,36088,36094,36095,36097,36099,36105,36114,36119,36123,36197, 36201,36204,36206,36223,36226,36228,36232,36237,36240,36241,36245,36254,36255, 36256,36262,36267,36268,36271,36274,36277,36279,36281,36283,36288,36293,36294, 36295,36296,36298,36302,36305,36308,36309,36311,36313,36324,36325,36327,36332, 36336,36284,36337,36338,36340,36349,36353,36356,36357,36358,36363,36369,36372, 36374,36384,36385,36386,36387,36390,36391,36401,36403,36406,36407,36408,36409, 36413,36416,36417,36427,36429,36430,36431,36436,36443,36444,36445,36446,36449, 36450,36457,36460,36461,36463,36464,36465,36473,36474,36475,36482,36483,36489, 36496,36498,36501,36506,36507,36509,36510,36514,36519,36521,36525,36526,36531, 36533,36538,36539,36544,36545,36547,36548,36551,36559,36561,36564,36572,36584, 36590,36592,36593,36599,36601,36602,36589,36608,36610,36615,36616,36623,36624, 36630,36631,36632,36638,36640,36641,36643,36645,36647,36648,36652,36653,36654, 36660,36661,36662,36663,36666,36672,36673,36675,36679,36687,36689,36690,36691, 36692,36693,36696,36701,36702,36709,36765,36768,36769,36772,36773,36774,36789, 36790,36792,36798,36800,36801,36806,36810,36811,36813,36816,36818,36819,36821, 36832,36835,36836,36840,36846,36849,36853,36854,36859,36862,36866,36868,36872, 36876,36888,36891,36904,36905,36911,36906,36908,36909,36915,36916,36919,36927, 36931,36932,36940,36955,36957,36962,36966,36967,36972,36976,36980,36985,36997, 37000,37003,37004,37006,37008,37013,37015,37016,37017,37019,37024,37025,37026, 37029,37040,37042,37043,37044,37046,37053,37068,37054,37059,37060,37061,37063, 37064,37077,37079,37080,37081,37084,37085,37087,37093,37074,37110,37099,37103, 37104,37108,37118,37119,37120,37124,37125,37126,37128,37133,37136,37140,37142, 37143,37144,37146,37148,37150,37152,37157,37154,37155,37159,37161,37166,37167, 37169,37172,37174,37175,37177,37178,37180,37181,37187,37191,37192,37199,37203, 37207,37209,37210,37211,37217,37220,37223,37229,37236,37241,37242,37243,37249, 37251,37253,37254,37258,37262,37265,37267,37268,37269,37272,37278,37281,37286, 37288,37292,37293,37294,37296,37297,37298,37299,37302,37307,37308,37309,37311, 37314,37315,37317,37331,37332,37335,37337,37338,37342,37348,37349,37353,37354, 37356,37357,37358,37359,37360,37361,37367,37369,37371,37373,37376,37377,37380, 37381,37382,37383,37385,37386,37388,37392,37394,37395,37398,37400,37404,37405, 37411,37412,37413,37414,37416,37422,37423,37424,37427,37429,37430,37432,37433, 37434,37436,37438,37440,37442,37443,37446,37447,37450,37453,37454,37455,37457, 37464,37465,37468,37469,37472,37473,37477,37479,37480,37481,37486,37487,37488, 37493,37494,37495,37496,37497,37499,37500,37501,37503,37512,37513,37514,37517, 37518,37522,37527,37529,37535,37536,37540,37541,37543,37544,37547,37551,37554, 37558,37560,37562,37563,37564,37565,37567,37568,37569,37570,37571,37573,37574, 37575,37576,37579,37580,37581,37582,37584,37587,37589,37591,37592,37593,37596, 37597,37599,37600,37601,37603,37605,37607,37608,37612,37614,37616,37625,37627, 37631,37632,37634,37640,37645,37649,37652,37653,37660,37661,37662,37663,37665, 37668,37669,37671,37673,37674,37683,37684,37686,37687,37703,37704,37705,37712, 37713,37714,37717,37719,37720,37722,37726,37732,37733,37735,37737,37738,37741, 37743,37744,37745,37747,37748,37750,37754,37757,37759,37760,37761,37762,37768, 37770,37771,37773,37775,37778,37781,37784,37787,37790,37793,37795,37796,37798, 37800,37803,37812,37813,37814,37818,37801,37825,37828,37829,37830,37831,37833, 37834,37835,37836,37837,37843,37849,37852,37854,37855,37858,37862,37863,37881, 37879,37880,37882,37883,37885,37889,37890,37892,37896,37897,37901,37902,37903, 37909,37910,37911,37919,37934,37935,37937,37938,37939,37940,37947,37951,37949, 37955,37957,37960,37962,37964,37973,37977,37980,37983,37985,37987,37992,37995, 37997,37998,37999,38001,38002,38020,38019,38264,38265,38270,38276,38280,38284, 38285,38286,38301,38302,38303,38305,38310,38313,38315,38316,38324,38326,38330, 38333,38335,38342,38344,38345,38347,38352,38353,38354,38355,38361,38362,38365, 38366,38367,38368,38372,38374,38429,38430,38434,38436,38437,38438,38444,38449, 38451,38455,38456,38457,38458,38460,38461,38465,38482,38484,38486,38487,38488, 38497,38510,38516,38523,38524,38526,38527,38529,38530,38531,38532,38537,38545, 38550,38554,38557,38559,38564,38565,38566,38569,38574,38575,38579,38586,38602, 38610,23986,38616,38618,38621,38622,38623,38633,38639,38641,38650,38658,38659, 38661,38665,38682,38683,38685,38689,38690,38691,38696,38705,38707,38721,38723, 38730,38734,38735,38741,38743,38744,38746,38747,38755,38759,38762,38766,38771, 38774,38775,38776,38779,38781,38783,38784,38793,38805,38806,38807,38809,38810, 38814,38815,38818,38828,38830,38833,38834,38837,38838,38840,38841,38842,38844, 38846,38847,38849,38852,38853,38855,38857,38858,38860,38861,38862,38864,38865, 38868,38871,38872,38873,38877,38878,38880,38875,38881,38884,38895,38897,38900, 38903,38904,38906,38919,38922,38937,38925,38926,38932,38934,38940,38942,38944, 38947,38950,38955,38958,38959,38960,38962,38963,38965,38949,38974,38980,38983, 38986,38993,38994,38995,38998,38999,39001,39002,39010,39011,39013,39014,39018, 39020,39083,39085,39086,39088,39092,39095,39096,39098,39099,39103,39106,39109, 39112,39116,39137,39139,39141,39142,39143,39146,39155,39158,39170,39175,39176, 39185,39189,39190,39191,39194,39195,39196,39199,39202,39206,39207,39211,39217, 39218,39219,39220,39221,39225,39226,39227,39228,39232,39233,39238,39239,39240, 39245,39246,39252,39256,39257,39259,39260,39262,39263,39264,39323,39325,39327, 39334,39344,39345,39346,39349,39353,39354,39357,39359,39363,39369,39379,39380, 39385,39386,39388,39390,39399,39402,39403,39404,39408,39412,39413,39417,39421, 39422,39426,39427,39428,39435,39436,39440,39441,39446,39454,39456,39458,39459, 39460,39463,39469,39470,39475,39477,39478,39480,39495,39489,39492,39498,39499, 39500,39502,39505,39508,39510,39517,39594,39596,39598,39599,39602,39604,39605, 39606,39609,39611,39614,39615,39617,39619,39622,39624,39630,39632,39634,39637, 39638,39639,39643,39644,39648,39652,39653,39655,39657,39660,39666,39667,39669, 39673,39674,39677,39679,39680,39681,39682,39683,39684,39685,39688,39689,39691, 39692,39693,39694,39696,39698,39702,39705,39707,39708,39712,39718,39723,39725, 39731,39732,39733,39735,39737,39738,39741,39752,39755,39756,39765,39766,39767, 39771,39774,39777,39779,39781,39782,39784,39786,39787,39788,39789,39790,39795, 39797,39799,39800,39801,39807,39808,39812,39813,39814,39815,39817,39818,39819, 39821,39823,39824,39828,39834,39837,39838,39846,39847,39849,39852,39856,39857, 39858,39863,39864,39867,39868,39870,39871,39873,39879,39880,39886,39888,39895, 39896,39901,39903,39909,39911,39914,39915,39919,39923,39927,39928,39929,39930, 39933,39935,39936,39938,39947,39951,39953,39958,39960,39961,39962,39964,39966, 39970,39971,39974,39975,39976,39977,39978,39985,39989,39990,39991,39997,40001, 40003,40004,40005,40009,40010,40014,40015,40016,40019,40020,40022,40024,40027, 40029,40030,40031,40035,40041,40042,40028,40043,40040,40046,40048,40050,40053, 40055,40059,40166,40178,40183,40185,40203,40194,40209,40215,40216,40220,40221, 40222,40239,40240,40242,40243,40244,40250,40252,40261,40253,40258,40259,40263, 40266,40275,40276,40287,40291,40290,40293,40297,40298,40299,40304,40310,40311, 40315,40316,40318,40323,40324,40326,40330,40333,40334,40338,40339,40341,40342, 40343,40344,40353,40362,40364,40366,40369,40373,40377,40380,40383,40387,40391, 40393,40394,40404,40405,40406,40407,40410,40414,40415,40416,40421,40423,40425, 40427,40430,40432,40435,40436,40446,40458,40450,40455,40462,40464,40465,40466, 40469,40470,40473,40476,40477,40570,40571,40572,40576,40578,40579,40580,40581, 40583,40590,40591,40598,40600,40603,40606,40612,40616,40620,40622,40623,40624, 40627,40628,40629,40646,40648,40651,40661,40671,40676,40679,40684,40685,40686, 40688,40689,40690,40693,40696,40703,40706,40707,40713,40719,40720,40721,40722, 40724,40726,40727,40729,40730,40731,40735,40738,40742,40746,40747,40751,40753, 40754,40756,40759,40761,40762,40764,40765,40767,40769,40771,40772,40773,40774, 40775,40787,40789,40790,40791,40792,40794,40797,40798,40808,40809,40813,40814, 40815,40816,40817,40819,40821,40826,40829,40847,40848,40849,40850,40852,40854, 40855,40862,40865,40866,40867,40869, }; static const struct dbcs_index jisx0212_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0212_decmap+0,47,113},{0,0,0},{ 0,0,0},{0,0,0},{__jisx0212_decmap+67,97,124},{__jisx0212_decmap+95,66,126},{0, 0,0},{__jisx0212_decmap+156,33,80},{__jisx0212_decmap+204,33,119},{ __jisx0212_decmap+291,33,119},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __jisx0212_decmap+378,33,126},{__jisx0212_decmap+472,33,126},{ __jisx0212_decmap+566,33,126},{__jisx0212_decmap+660,33,126},{ __jisx0212_decmap+754,33,126},{__jisx0212_decmap+848,33,126},{ __jisx0212_decmap+942,33,126},{__jisx0212_decmap+1036,33,126},{ __jisx0212_decmap+1130,33,126},{__jisx0212_decmap+1224,33,126},{ __jisx0212_decmap+1318,33,126},{__jisx0212_decmap+1412,33,126},{ __jisx0212_decmap+1506,33,126},{__jisx0212_decmap+1600,33,126},{ __jisx0212_decmap+1694,33,126},{__jisx0212_decmap+1788,33,126},{ __jisx0212_decmap+1882,33,126},{__jisx0212_decmap+1976,33,126},{ __jisx0212_decmap+2070,33,126},{__jisx0212_decmap+2164,33,126},{ __jisx0212_decmap+2258,33,126},{__jisx0212_decmap+2352,33,126},{ __jisx0212_decmap+2446,33,126},{__jisx0212_decmap+2540,33,126},{ __jisx0212_decmap+2634,33,126},{__jisx0212_decmap+2728,33,126},{ __jisx0212_decmap+2822,33,126},{__jisx0212_decmap+2916,33,126},{ __jisx0212_decmap+3010,33,126},{__jisx0212_decmap+3104,33,126},{ __jisx0212_decmap+3198,33,126},{__jisx0212_decmap+3292,33,126},{ __jisx0212_decmap+3386,33,126},{__jisx0212_decmap+3480,33,126},{ __jisx0212_decmap+3574,33,126},{__jisx0212_decmap+3668,33,126},{ __jisx0212_decmap+3762,33,126},{__jisx0212_decmap+3856,33,126},{ __jisx0212_decmap+3950,33,126},{__jisx0212_decmap+4044,33,126},{ __jisx0212_decmap+4138,33,126},{__jisx0212_decmap+4232,33,126},{ __jisx0212_decmap+4326,33,126},{__jisx0212_decmap+4420,33,126},{ __jisx0212_decmap+4514,33,126},{__jisx0212_decmap+4608,33,126},{ __jisx0212_decmap+4702,33,126},{__jisx0212_decmap+4796,33,126},{ __jisx0212_decmap+4890,33,126},{__jisx0212_decmap+4984,33,126},{ __jisx0212_decmap+5078,33,126},{__jisx0212_decmap+5172,33,126},{ __jisx0212_decmap+5266,33,126},{__jisx0212_decmap+5360,33,126},{ __jisx0212_decmap+5454,33,126},{__jisx0212_decmap+5548,33,126},{ __jisx0212_decmap+5642,33,126},{__jisx0212_decmap+5736,33,126},{ __jisx0212_decmap+5830,33,126},{__jisx0212_decmap+5924,33,126},{ __jisx0212_decmap+6018,33,126},{__jisx0212_decmap+6112,33,99},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, }; static const DBCHAR __jisxcommon_encmap[22016] = { 8512,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41527, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41538, 8561,8562,41584,N,41539,8568,8495,41581,41580,N,8780,N,41582,41524,8555,8542, N,N,8493,N,8825,N,41521,N,41579,N,N,N,N,41540,43554,43553,43556,43562,43555, 43561,43297,43566,43570,43569,43572,43571,43584,43583,43586,43585,N,43600, 43602,43601,43604,43608,43603,8543,43308,43619,43618,43621,43620,43634,43312, 43342,43810,43809,43812,43818,43811,43817,43329,43822,43826,43825,43828,43827, 43840,43839,43842,43841,43331,43856,43858,43857,43860,43864,43859,8544,43340, 43875,43874,43877,43876,43890,43344,43891,43559,43815,43557,43813,43560,43816, 43563,43819,43564,43820,43567,43823,43565,43821,43568,43824,43298,43330,43575, 43831,N,N,43574,43830,43576,43832,43573,43829,43578,43834,43579,43835,43581, 43837,43580,N,43582,43838,43300,43332,43591,43847,43589,43845,N,N,43590,43846, 43588,43333,43302,43334,43592,43848,43593,43849,43335,43594,43850,43596,43852, 43595,43851,43305,43337,43304,43336,43597,43853,43599,43855,43598,43854,43338, 43307,43339,43607,43863,N,N,43606,43862,43309,43341,43609,43865,43611,43867, 43610,43866,43612,43868,43613,43869,43615,43871,43614,43870,43617,43873,43616, 43872,43311,43343,43628,43884,43625,43881,43622,43878,43627,43883,43624,43880, 43626,43882,43633,43889,43636,43892,43635,43637,43893,43639,43895,43638,43894, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 43558,43814,43587,43843,43605,43861,43623,43879,43632,43888,43629,43885,43631, 43887,43630,43886,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43833,41520, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41519,41522,41526,41525,N,41523,41528,41529, 42593,N,42594,42595,42596,N,42599,N,42601,42604,42614,9761,9762,9763,9764, 9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776,9777,N,9778,9779, 9780,9781,9782,9783,9784,42597,42602,42609,42610,42611,42612,42619,9793,9794, 9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806,9807,9808,9809, 42616,9810,9811,9812,9813,9814,9815,9816,42613,42618,42615,42617,42620,10023, 42818,42819,42820,42821,42822,42823,42824,42825,42826,42827,42828,N,42829, 42830,10017,10018,10019,10020,10021,10022,10024,10025,10026,10027,10028,10029, 10030,10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10042, 10043,10044,10045,10046,10047,10048,10049,10065,10066,10067,10068,10069,10070, 10072,10073,10074,10075,10076,10077,10078,10079,10080,10081,10082,10083,10084, 10085,10086,10087,10088,10089,10090,10091,10092,10093,10094,10095,10096,10097, N,10071,42866,42867,42868,42869,42870,42871,42872,42873,42874,42875,42876,N, 42877,42878,8510,N,N,N,N,8509,8514,N,8518,8519,N,N,8520,8521,N,N,8823,8824,N, N,N,8517,8516,N,N,N,N,N,N,N,N,N,8819,N,8556,8557,N,N,N,N,N,N,N,8744,8558,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41585,N,N,N,N,N,N,N,N,N,N,N,41583,N,N,N,N,N,N, N,N,8818,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8747,8748,8746,8749,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8781,N,8782,8783,N,8799,8784,N,N,N, 8800,8762,N,N,8763,N,N,N,N,N,N,8541,N,N,N,N,N,N,N,8805,N,N,8807,8551,N,8796,N, N,N,N,N,N,8778,8779,8769,8768,8809,8810,N,N,N,N,N,N,N,8552,8808,N,N,N,N,N,N,N, 8806,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8802,N,N,N,N,N,N,N,N,N,N,N,N,N, 8546,8801,N,N,N,N,8549,8550,N,N,8803,8804,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,8766,8767,N,N,8764,8765,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,8797,8798,10273,10284,10274,10285,N,N,N,N,N,N,N,N,10275,N,N,10286, 10276,N,N,10287,10278,N,N,10289,10277,N,N,10288,10279,10300,N,N,10295,N,N, 10290,10281,10302,N,N,10297,N,N,10292,10280,N,N,10296,10301,N,N,10291,10282,N, N,10298,10303,N,N,10293,10283,N,N,10299,N,N,10304,N,N,N,N,N,N,N,N,10294,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,8739,8738,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8741,8740,N,N,N,N,N,N,N,N, 8743,8742,N,N,N,N,N,N,N,N,8737,8574,N,N,N,8571,N,N,8573,8572,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8830,8570,8569,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,8554,N,8553,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8822,N,N,8821,N,8820,8481,8482,8483,8503,N, 8505,8506,8507,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8745,8750, 8524,8525,N,N,N,N,N,N,8513,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,9249,9250,9251,9252,9253,9254,9255,9256,9257,9258,9259, 9260,9261,9262,9263,9264,9265,9266,9267,9268,9269,9270,9271,9272,9273,9274, 9275,9276,9277,9278,9279,9280,9281,9282,9283,9284,9285,9286,9287,9288,9289, 9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302,9303,9304, 9305,9306,9307,9308,9309,9310,9311,9312,9313,9314,9315,9316,9317,9318,9319, 9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,N,N,N,N,N,N,N, 8491,8492,8501,8502,N,N,9505,9506,9507,9508,9509,9510,9511,9512,9513,9514, 9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528,9529, 9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543,9544, 9545,9546,9547,9548,9549,9550,9551,9552,9553,9554,9555,9556,9557,9558,9559, 9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574, 9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9588,9589, 9590,N,N,N,N,8486,8508,8499,8500,12396,17274,45089,15415,45090,45091,N,19324, 15974,15152,15973,12860,45092,18772,19775,N,20514,12591,45093,N,13166,20515, 16420,21058,13654,19002,N,N,N,N,15975,45094,N,20030,N,45095,45096,N,19010,N, 45097,N,20516,45098,N,17254,45099,45100,45101,20517,13946,N,N,45102,20518,N, 13405,17200,N,15463,20519,N,N,20520,45103,45104,20521,18229,45105,13655,N, 45106,N,N,N,18231,N,18019,14403,19251,N,45107,N,N,N,26953,20522,15976,20523, 12853,45108,N,45109,13925,14448,19561,N,N,22054,45110,N,N,N,N,45111,45112,N,N, N,N,N,N,N,19824,N,18045,45113,45114,N,N,N,45115,N,N,N,N,13349,45116,13621,N, 20524,N,N,20525,20027,N,19773,16744,20527,15222,18035,45117,20530,N,N,12606, 14431,N,14430,12390,45118,45119,20299,20298,N,14899,12321,45120,20531,20532, 20533,19252,20534,N,14450,12391,19314,N,13692,N,N,13693,13694,17506,20028, 45121,20535,N,N,20536,N,N,20537,N,N,45122,16205,N,N,N,N,N,15674,16206,20542, 45123,20540,N,20541,13656,N,N,14883,12912,N,20539,20538,18985,45124,N,N,N, 15174,15173,16958,20543,18773,16487,45125,45126,N,8504,20544,20546,45127, 45128,45129,16997,20065,12362,N,N,45130,N,N,N,N,20545,12862,45131,13892,45132, 17255,45133,N,45134,14191,20547,N,N,N,18212,N,45135,45136,45137,45138,13419, 45139,45140,N,N,N,N,45141,20548,12363,45142,45143,14432,13420,18810,18482, 13657,45144,N,N,45145,45146,45147,N,45148,12913,N,20583,17729,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,45149,18284,20550,45150,N,45152,18492,45153,20066,45154,16173, 45155,15175,45156,15223,12864,45157,N,45158,N,45159,17489,N,N,17186,20554, 45160,45161,N,45162,45163,12364,17507,15675,14900,19748,45164,16974,45165, 12863,45166,20553,45167,19774,20549,20551,14958,20552,21796,45168,45151,N,N, 45169,N,N,N,N,N,20560,45170,N,45171,N,45172,20563,20561,45173,N,12866,N,19003, 20555,45174,45175,45176,45177,20559,14451,45178,45179,15176,N,45180,45181, 13350,45182,45345,20564,N,20556,45346,45347,20067,45348,15224,45349,20557, 45350,20562,45351,45352,45353,N,20565,45354,20558,45355,45356,13857,N,12365, 45357,45358,13858,12865,N,N,N,N,N,N,N,N,N,21797,N,19321,18798,14452,N,N,45359, N,N,16175,20023,45360,N,45361,N,45362,45363,45364,45365,19032,45366,45367, 14136,16933,12900,45368,45369,N,45370,45371,15699,45372,45373,45374,20569, 45375,20574,20572,45376,N,20567,N,N,16943,20570,N,20573,20571,45377,19037,N, 20568,45378,16174,45379,19315,20575,20576,N,N,N,N,N,N,N,N,15652,20589,45380,N, 45381,18256,N,18742,20584,N,19056,N,12854,N,45382,45383,20588,45384,45385, 45386,N,N,45387,20582,20591,45388,N,16722,45389,14404,45390,18268,45391,24647, 45392,20590,17757,45393,20579,N,14454,45394,45395,14453,20577,45396,45397, 45398,45399,15450,N,20585,45400,19055,17229,20581,14193,45401,20578,20586, 20580,20049,20587,20289,45402,N,45403,N,45404,45405,N,45406,13926,N,N,14192,N, 45430,N,N,N,N,45407,45408,45409,20592,N,45410,45411,20593,20597,12366,45412,N, 45413,N,45414,19024,20596,45415,45416,45417,N,20595,20599,45418,N,45419,20598, N,17508,N,N,45420,45421,N,45422,45423,N,14194,45424,45425,N,N,45426,N,20600, 45427,N,N,45428,45429,15429,N,16934,17509,13942,N,20601,N,N,N,N,13622,N,N, 20602,45431,N,45432,45433,20604,45434,N,N,N,45435,N,N,19253,45436,45437,45438, 14182,45601,45602,45603,N,45604,N,15153,18551,20603,45605,45606,N,45607,45608, 45609,45610,45611,N,N,N,N,N,N,N,45612,N,14917,19779,N,45613,45614,N,20606, 20771,20605,14916,N,15741,N,45615,45616,N,N,45617,14137,N,45618,N,20772,45619, 45620,13903,N,45621,N,20769,20770,N,45622,17967,45623,16764,45624,13859,N, 45625,45626,19277,20773,N,45627,N,20029,N,45628,45629,20774,45630,N,N,45631, 20777,45632,20775,45633,16718,45634,45635,N,N,N,20776,20778,45636,N,45637, 45649,N,N,20780,45638,N,N,20779,45639,19016,N,N,45640,13623,20782,20783,45641, 12847,N,45642,45643,45644,20781,N,45645,45646,45647,45648,N,45650,N,15476,N, 20786,20785,20784,45651,20566,45652,20787,45653,45654,45655,45656,15742,N, 20788,N,45657,N,N,N,45658,45659,N,19749,N,45660,45661,N,45662,N,45663,19545, 45664,45665,45666,N,20790,45667,45668,20789,20792,20791,N,N,20793,20794,12404, 45669,14389,14139,15676,17275,13860,16488,14455,45670,14702,20796,19528,17734, 45671,15225,N,20795,45672,20797,45673,N,45674,45675,N,17758,N,13173,N,N,45676, N,N,20798,N,45677,18046,45678,N,16692,20800,20801,18476,14456,20283,20802,N,N, 13862,N,N,N,19004,16950,13937,17717,N,N,N,14195,N,45679,N,20803,N,20804,45680, 45681,18018,12639,N,N,20807,14973,45682,20806,14918,45683,20808,26222,20809, 19265,20810,N,20811,20812,15977,45684,15436,N,N,N,45685,N,N,13351,45686,20815, 45687,20813,19517,20814,N,18778,20816,20817,20818,17759,45688,N,N,20822,20820, 20821,20819,14947,20823,19562,20068,45689,N,45690,N,45691,20824,45692,45693,N, N,45694,N,16424,20825,15706,N,45857,20826,N,17276,20031,17760,N,45858,N,45859, 45860,45861,N,45862,21061,N,45863,N,N,20827,29733,13893,45864,N,20828,19294, 45865,N,N,45866,15720,17020,N,20830,18020,N,N,20831,45867,N,20832,13102,45868, 45869,45870,20833,13863,45871,17996,12666,15696,N,N,18465,20834,17761,45872, 45873,16207,20835,45874,18988,16474,13346,N,13353,20836,N,N,20838,N,N,14138, 45875,45876,20837,45877,45878,20083,45879,N,N,N,N,15721,N,N,N,N,45880,N,18493, 19020,N,20839,45881,19832,20840,N,N,N,20841,N,17790,45882,45883,20842,N,45884, 16425,14974,14196,20843,15177,14703,45885,N,N,N,N,N,N,17510,20845,45886,N, 16935,N,45887,14959,20846,20847,16688,N,20844,N,N,N,N,20849,45888,19254,45889, 45890,N,45891,14692,45892,N,20848,45893,45894,45895,N,14197,14942,18285,45896, N,N,20852,20850,N,N,N,45897,18811,15978,20859,13156,20853,20851,16719,N,45898, 45899,45900,N,N,N,20855,N,20854,45901,N,45902,13124,N,45903,N,14176,20860, 20013,45904,N,45905,20856,N,N,N,20861,20858,45906,20857,45907,45908,45909, 45910,N,45911,20047,45912,N,N,14457,12867,N,N,20084,45913,45914,45915,45916,N, 15733,17752,14693,21026,21027,N,45917,45918,20069,N,N,20267,21029,45919,45920, 45921,14458,45922,45923,21028,45924,13103,N,45925,21030,N,19286,45926,17468, 45927,19750,45928,19033,N,N,45929,21031,N,45930,N,45931,28757,N,45932,17968, 45933,21032,13354,19507,N,45934,45935,15905,21033,19047,21037,45936,16426, 21034,13904,45937,21035,13355,45938,45939,45940,N,45941,N,N,N,45942,45943, 14126,21038,45944,21039,45945,45946,21040,21041,15451,N,N,N,14459,19550,45947, 19560,18039,45948,N,19057,21042,N,21043,N,45949,45950,46113,21045,N,21047, 21046,46114,N,46115,N,21048,12861,19276,46116,14972,21049,46117,46118,16729, 46119,46120,15906,13865,N,21050,N,46121,N,46122,46123,46124,18523,46125,46126, 46127,N,21051,46128,21052,46129,21053,N,46130,N,N,21054,18724,13928,12389, 46131,46132,46133,17983,21055,15677,46134,16489,N,21057,21056,15907,14433, 21059,18494,46136,46135,21060,N,N,N,18524,16948,17006,13864,N,N,18030,17201, 46137,18286,46138,19278,N,21062,N,16490,46139,N,46140,N,46141,14133,N,N,21063, N,N,46142,46143,21064,12588,12405,13421,46144,16936,13649,19825,N,21067,12855, 46145,N,21066,N,N,46146,13866,N,N,21068,46147,19569,N,N,46148,46149,N,N,N,N,N, 46150,N,N,N,N,46151,46152,N,21069,N,20050,46153,14460,N,N,46154,N,14390,21070, 46155,N,N,46156,21072,21071,N,16223,12601,46157,46158,N,12638,21073,46159, 21074,N,46160,14391,46161,46162,21075,46163,46164,N,46165,13678,N,46166,N,N, 46167,N,15154,21076,N,46168,N,N,19316,14901,13658,19751,16720,18495,15485, 46169,N,N,46170,46171,15687,46172,15464,15477,N,15734,46173,18496,N,46174, 46175,21079,46176,12611,16721,14461,14405,13927,46177,46178,21083,17185,17022, 13867,15908,21084,21082,12868,16998,15416,15179,12582,N,46179,13168,14694, 15178,N,21085,21086,46180,13641,13126,N,N,N,14695,13640,17503,12581,17969, 19518,14625,19833,17735,14462,N,46181,N,N,N,N,N,N,46182,14127,N,21095,N,13923, 19274,46183,N,N,N,N,18525,46184,46185,21094,46186,13406,21089,21090,21092, 46187,N,46188,N,N,46189,46190,21093,N,13659,16225,N,18989,21091,21087,14435,N, 21088,N,20260,46191,46192,N,19058,46193,17512,14434,14704,N,N,46194,21096, 46195,N,18013,N,N,N,N,N,N,N,N,N,N,N,N,46196,21100,N,N,46197,N,46198,N,46199, 46200,15486,46201,15478,46202,N,46203,46204,N,21103,21101,N,19491,46205,21098, 21107,21102,N,N,N,21105,14406,19519,N,46206,21106,46369,N,46370,21108,46371, 21110,N,46372,46373,N,14960,20290,46374,21099,21097,21109,46375,21104,N,N, 46376,46377,N,N,N,N,N,46378,N,N,46379,N,46380,21112,N,21283,21114,46381,46382, 21118,46383,46384,21281,21115,46385,46386,21310,N,46387,14953,13105,N,N,N, 46388,21113,46389,46390,46391,21285,12406,21284,46392,12325,18762,21282,N, 21116,N,46393,21111,21117,14920,46394,N,N,46395,46396,N,N,N,N,N,N,N,N,N,21286, N,N,N,N,N,N,N,46397,12407,21295,N,N,21287,21288,N,15909,19305,46398,N,46399, 21293,21292,46400,N,N,17711,N,N,N,46401,N,N,N,21294,N,46402,21291,46403,46404, 46405,46406,N,N,12596,46407,14902,16176,46408,46409,N,N,46410,46411,46412, 21289,17762,N,N,N,21290,46413,12322,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 46414,46415,N,N,21300,19747,N,15911,46416,21306,N,46417,46418,N,21305,21296,N, 46419,46420,46421,16963,N,21297,46422,N,N,17007,21302,15910,46423,N,46424, 46425,N,21299,46426,N,19556,46427,46428,N,14140,N,N,21303,21304,46429,N,46430, 46431,21301,21307,46432,N,46433,46434,N,21298,46435,N,46436,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,21313,21318,N,21314,46437,21309,46438,46439,21319,16689, N,46440,21321,46441,14626,21311,17277,N,N,46442,46443,N,46444,46445,46446, 46447,N,N,46448,21315,21308,13357,N,13422,13157,21316,21312,N,N,N,46449,46450, N,N,14198,21322,21320,16723,13642,13868,46451,21317,N,13940,N,46452,N,N,N, 12612,N,N,N,N,N,N,N,N,46453,N,46454,N,46455,21326,21324,46456,21543,N,46457,N, 46458,46459,N,46460,N,N,46461,46462,46625,21329,N,N,46626,46627,N,21323,46628, 21327,N,46629,21325,N,N,46630,15180,21328,N,N,N,N,46631,N,N,N,N,N,N,N,N,N,N,N, N,46632,21331,N,21336,N,N,N,21334,21333,46633,46634,17202,N,46635,12869,46636, N,N,46637,46638,46639,46640,46641,46642,N,21330,N,21332,15912,12595,46643,N, 21335,N,N,N,N,N,N,N,N,N,N,N,N,N,12894,N,N,46644,N,N,21346,46645,15996,21342, 46646,21340,46647,21341,46648,21343,46649,N,46650,46651,46652,N,46653,46654, 46655,12605,46656,46657,N,46658,N,N,46659,N,46660,16697,46661,21337,46662, 21338,N,N,N,46663,N,N,N,N,N,N,13178,N,N,46664,N,46665,46666,46667,46668,21345, N,46669,N,13423,46670,21348,21344,21347,46671,N,46672,N,46673,46674,N,18990, 46675,N,N,18005,N,18488,N,N,N,N,N,21350,N,N,N,46676,46677,21349,13125,46678,N, 21351,46679,46680,N,N,21354,N,N,N,N,21353,46681,N,N,N,46682,46683,N,N,46684, 46685,46686,21352,N,18233,N,N,21355,46687,46688,46689,46690,N,46691,46692, 46693,21356,N,N,46694,N,46695,21358,N,21357,46696,N,N,N,N,21360,N,46697,N, 21363,21361,21359,21362,N,46698,N,N,21364,46699,46700,46701,46704,46705,21365, 46702,46703,21366,N,21367,N,N,N,21368,20805,46706,15484,15181,46707,46708, 12915,46709,12408,46710,N,17220,46711,46712,46713,46714,46715,N,N,46717,N, 46718,21369,N,14884,46716,12367,16222,N,N,46881,46882,N,21370,14407,N,N,14705, N,21372,21371,46883,46884,19040,21373,N,N,46885,21537,21374,46886,21538,46887, 21539,N,14199,N,46888,12640,21540,N,46889,21542,N,21541,N,46890,46891,21544, 46892,N,17754,46893,N,46894,46895,46896,46897,21545,12341,14943,46898,46899,N, 46900,14141,46901,46902,17231,N,N,46903,46904,N,N,21546,21547,N,N,21549,N, 46905,46906,46907,21550,N,14948,N,N,46908,46909,13905,N,N,19255,N,46910,46911, 21548,21551,14913,14627,46912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21555,46913,N,14885, 46914,17203,46915,46916,21552,17498,46917,N,46918,46919,46920,46921,46922,N, 46923,46924,46925,N,46926,N,46927,46928,46929,46930,N,46931,21556,N,46932, 16226,46933,N,N,N,N,21554,21557,N,14143,46934,N,N,N,N,N,N,21558,46935,46944,N, 46936,N,46937,46938,N,46939,46940,46941,46942,21559,46943,14628,13120,21561,N, N,46945,46946,46947,21562,N,46948,N,N,N,21563,N,N,21560,N,N,N,N,46949,N,N,N,N, 46950,N,N,21553,N,N,21564,N,N,21565,46951,46952,N,N,19300,46953,N,15979,46954, N,N,21567,21568,21566,46955,21570,N,N,N,N,N,18232,46956,46957,12392,18774, 46974,N,21571,46958,N,46959,46960,N,46961,N,N,N,46962,N,N,46963,N,N,N,15997, 46964,46965,15417,46966,18269,13424,N,14955,46967,46968,46969,19289,N,17970, 46970,46971,14200,16975,N,46972,46973,21569,21572,47137,47138,N,N,N,N,N,N,N, 16964,N,N,N,21573,N,47139,N,21574,47140,47141,47142,21576,N,N,17513,N,47143, 47144,N,N,13358,N,N,47145,N,29729,12641,19059,47146,N,15980,17736,N,N,N,47147, 14950,N,N,21582,N,47148,19005,20061,N,N,N,N,N,N,N,47149,12916,21578,47150, 47151,N,47152,47153,16698,21581,N,17763,47154,N,17737,17764,18489,17485,N,N,N, 14921,47155,N,47156,21577,N,47157,N,N,47158,47159,12662,N,17718,N,N,N,N,21579, N,21575,N,N,16208,N,N,47160,21583,N,N,47161,N,15694,47162,47163,47164,N,13869, N,21584,N,47165,47166,47167,47168,N,47169,47170,N,47171,47172,N,N,19048,47173, N,47174,16765,N,N,N,N,17478,47175,N,21586,47176,47177,47178,N,N,N,47179,N, 19279,47180,N,21587,N,N,21592,N,N,47181,47182,18991,N,N,N,N,21591,21585,21588, 21590,47184,N,14886,N,N,19017,47185,N,47183,21593,N,17221,47186,N,12917,N, 15981,47187,47188,N,47189,21595,47190,21594,47191,14696,47192,21596,21598, 21597,47193,N,21600,47194,21589,21602,N,47195,47196,N,21601,21599,N,N,N,47197, N,15182,16209,N,16724,21603,16444,12397,18276,47198,N,N,N,17499,N,21605,21604, 21606,21607,21608,21609,N,N,47199,47200,N,N,19025,21610,47201,47202,N,N,12870, 21611,N,47203,47204,47205,19772,13104,N,21065,15688,16959,21612,19563,47207,N, N,N,47208,19508,47209,47210,21614,N,16999,47211,17719,16960,18775,21615,21616, 12667,47212,47213,15418,21617,47214,N,47215,47216,12368,21618,N,N,N,N,N,21619, 47217,N,N,N,47218,12642,N,47219,13425,18016,19060,N,N,N,N,21623,16725,21622, 14144,47220,47221,19291,21621,N,17765,21625,47222,21624,47223,N,47224,47225, 47226,21627,47227,21626,47228,N,12668,N,21628,15913,21630,17189,47229,21629, 47230,18995,47393,N,N,47394,15735,17755,47395,47396,N,21793,47397,N,47398, 47399,14629,N,N,N,21794,18209,18526,19537,N,N,N,N,N,18213,47400,47401,21803, 47402,N,N,N,47403,13624,N,47404,19781,47405,N,19503,N,22060,N,21795,N,47406,N, N,N,21798,47407,16965,N,47408,19256,N,N,N,17738,47409,47410,47411,47412,N, 21799,47413,N,N,N,47414,N,19301,47415,14922,47416,N,15914,N,N,47417,N,47418, 47419,N,21800,N,47420,15184,47421,15183,N,47422,N,N,12345,14408,47423,16427, 12369,N,N,N,N,21804,21805,N,21802,47424,47425,47426,N,N,N,47427,47428,12600, 13359,47429,21801,N,19525,18737,N,N,47430,47431,N,47432,47433,N,47434,N,12328, 47435,N,N,N,12409,N,N,N,15185,47436,12370,N,12323,47437,N,N,N,N,21810,N,N, 47438,47439,47440,N,N,21808,47441,47442,N,N,N,N,19516,N,21811,N,21809,N,47443, 21807,16177,N,N,47444,47445,21806,N,47446,47447,19034,47448,N,N,47449,N,14436, 47450,N,N,N,N,21815,21816,N,N,N,N,N,15915,N,N,N,21812,20268,N,N,47451,47452, 18252,47453,47454,21814,N,N,47455,N,N,N,47456,N,N,N,N,47457,N,N,N,N,14887,N,N, N,47458,N,N,N,21817,47459,N,47460,18776,47461,N,N,21818,N,21813,47462,N,N,N,N, N,N,N,N,N,47463,N,N,47464,47465,N,N,47466,19515,N,N,N,N,N,N,N,N,N,N,N,47467,N, N,N,N,47468,N,18270,47469,N,N,47470,N,N,47471,21819,18738,47472,N,47473,47474, 47475,N,47476,N,N,N,N,47477,N,N,N,N,47478,N,N,N,N,47479,47480,47481,N,47482,N, N,47483,N,47484,47485,21820,21824,21821,47486,N,12871,21823,N,47649,N,47650,N, 47651,15419,N,21822,14201,N,N,47652,21836,N,N,N,N,N,21829,21826,N,N,47653,N, 47654,N,N,N,47655,17252,N,21825,N,47656,21827,N,N,21828,47657,N,N,N,47658,N,N, N,N,N,N,47659,47660,N,N,N,21830,21831,N,47661,47662,47663,N,N,N,N,N,N,47664, 13426,N,21833,21832,N,N,N,N,N,N,N,N,N,21834,47665,N,47667,N,47668,N,47669,N,N, N,47670,15982,N,N,47671,N,N,N,N,21837,N,17500,47672,N,N,12613,N,21835,N,47666, N,21838,N,47673,N,N,N,N,N,21839,N,21842,47674,N,21840,N,21841,N,N,N,N,N,47675, 47676,N,N,N,15186,21843,47677,N,14630,21844,47678,15226,16952,N,21845,21846, 15194,14631,47679,19538,N,N,N,13608,14409,21847,13144,N,47680,21848,N,16953,N, N,47681,47682,21849,22051,N,21850,N,21851,N,N,21852,N,21854,N,47683,47684, 47685,47686,21855,47687,N,21856,47688,17008,47689,12583,15465,12354,47690, 16727,13360,15413,47691,14632,47692,47693,N,47694,47695,17766,47696,15649, 13361,17256,17514,12344,13625,19061,N,15426,N,N,13650,16491,15420,19752,21857, N,47697,47698,N,N,47699,47700,13660,47701,14923,47702,47703,13106,12643,15916, 12872,47704,21858,19782,47705,N,47706,N,N,15689,47707,47708,15460,21859,13427, 18002,19497,21860,N,21861,N,N,18777,47709,N,47710,21863,N,13352,13943,21862,N, 47711,47712,47713,47714,47715,13362,N,16178,21867,15137,47716,12873,21866,N, 21864,21868,21865,18219,23629,16179,N,21869,N,N,20032,47717,21870,47718,N, 21872,47719,17278,21871,N,16419,N,15227,N,N,47720,16976,15479,18805,16492,N, 15437,21873,15917,21874,21875,12371,16954,16210,47721,21876,17971,15918,N, 15919,N,21877,N,N,16493,47722,N,N,15920,N,N,N,47723,47724,21878,N,21879,47725, 19552,N,47726,N,21880,47727,N,47728,47729,13894,47730,N,47731,15650,47732,N,N, 47733,47734,N,21881,21882,15452,16172,18036,16212,18552,18210,13897,21883,N,N, N,13679,21884,N,13950,N,17999,12848,N,15187,21885,22050,22049,13949,N,21886,N, 17720,N,N,N,47735,47736,N,47737,N,16944,N,17739,15432,47738,47739,16728,19834, N,47740,47741,47742,N,N,22052,47905,22053,18006,47906,15155,N,N,47907,47908, 22055,N,N,22056,47909,47910,47911,47912,N,N,N,N,N,N,N,N,N,47913,47914,N,47915, N,22057,N,N,47916,13428,22058,47917,N,22059,N,N,N,N,N,N,N,N,47918,N,47919, 47920,12844,47921,47922,N,N,47923,N,16699,13412,47924,22061,19496,N,N,N,N, 16978,47925,13145,47926,47927,22063,22065,13407,N,47928,22062,22064,N,22067,N, N,N,N,N,N,22066,N,22068,N,47929,N,47930,N,N,N,N,N,N,47931,N,N,N,N,47933,N, 22069,N,N,N,47932,N,N,17981,13870,N,N,N,N,N,N,12901,22070,22075,N,N,22073, 47934,19063,19062,47935,47936,N,47937,N,17767,N,N,N,22072,15700,N,22071,47938, N,N,N,N,47939,16242,N,N,N,22076,N,47940,14954,N,N,22082,47941,N,22083,22077, 13107,22078,22087,22086,22085,22081,N,N,N,22080,N,N,22084,47943,47944,N,47945, 47946,N,19064,N,47942,N,N,N,N,N,47947,N,N,47948,N,N,N,N,47949,N,N,N,47950,N, 47951,N,N,47952,47953,N,N,47954,N,47955,N,47959,22091,22088,N,22090,N,19826, 47957,22089,N,N,47956,N,N,N,47958,N,N,22079,N,N,47960,47961,47962,47963,N, 47964,N,N,N,N,16243,47965,N,22092,47966,N,14903,47967,N,N,22093,N,N,22094,N,N, 47968,47969,N,N,N,47970,47971,N,47972,22097,47973,22096,N,N,22095,47974,N, 47975,17768,22074,N,N,N,22103,N,47976,47977,47978,47979,N,N,N,47980,N,47981,N, 22099,N,47982,47983,N,22098,N,N,N,N,47984,N,N,N,47985,22100,N,22101,N,47986,N, 58996,N,47987,N,N,22104,47988,47989,20070,N,22105,22102,N,N,N,N,N,47990,N,N,N, 47991,N,22106,N,47992,13408,22107,47994,N,47993,N,22109,22108,N,N,22110,N, 47995,47996,N,22111,N,16494,15651,N,47997,15716,N,16739,47998,14633,14904, 14634,13680,48161,N,22112,N,N,14905,N,N,14410,22113,19494,18243,22114,N,14635, 48162,48163,N,13356,N,17191,13906,48164,N,15188,18779,N,N,18497,48165,N,N,N, 22115,13429,48166,N,N,N,22118,48167,N,48168,48169,17441,N,48170,22117,22116, 22119,N,17515,N,48171,48172,N,N,N,N,16227,N,N,48174,N,N,15189,N,16458,48173, 16979,13602,N,48175,17442,N,48176,22120,22121,15983,N,N,N,N,19257,48177,N, 22124,N,N,22123,22122,18813,N,22131,N,48180,N,48178,19290,N,22125,N,48179, 48181,N,N,22127,19307,48182,22126,48183,N,N,48184,48185,N,48186,22128,N,18472, 22129,19006,22130,N,N,N,48187,N,48188,48189,48190,48191,48192,N,48193,N,13363, 19007,18223,22132,22133,N,14636,13364,22134,14392,19780,19753,13430,22136, 48194,17443,N,14637,15921,N,N,18527,N,N,15922,48195,N,N,48196,15736,N,N,N,N,N, 17516,19065,17721,N,N,14638,N,18780,N,N,N,22137,N,48197,N,48198,48199,17753, 14914,48200,N,48201,14411,48202,17517,N,N,N,48203,N,48204,N,12355,15726,14639, 19783,N,N,N,N,48205,48206,48207,N,22138,22139,18257,N,N,48208,N,22140,20087, 20269,48210,48209,N,48211,22142,22141,48212,48213,13127,48214,48215,22305,N,N, N,22308,22309,48216,22307,48217,18752,15923,22311,22310,22306,N,48218,N,N, 22312,22313,N,48219,22314,N,N,N,22317,22315,N,22316,22318,N,12644,17518,22319, N,14202,12918,18230,N,22320,18043,19035,48220,22321,20270,N,48221,48222,48223, 22322,19008,22325,20513,20529,48224,15408,18037,22326,N,13661,17444,12410, 22327,18982,14640,48225,N,17232,48226,48227,N,17519,N,48228,48229,48230,48231, 19567,14393,14412,48232,22328,N,48233,48234,22329,48235,22335,48236,15461,N,N, 48237,17445,48238,13871,22330,N,N,48239,18731,48240,17222,48241,48242,22331,N, N,48243,48244,N,48245,22332,N,13872,N,22333,48246,22334,N,48247,22336,N,17782, 48248,N,22337,22338,48249,22339,N,48250,22324,22323,N,N,48251,22340,14145, 48252,48253,N,18727,48254,N,14924,18743,17446,18763,22341,N,48417,15924,12614, 48418,22342,48419,48420,N,22343,48421,19570,48422,N,18528,48423,48424,22346, 12669,16428,22345,22344,14146,16980,N,22350,22348,48425,22347,20007,14437, 48426,N,48427,15737,22349,17740,15678,N,N,48428,17984,22353,22352,N,N,48429, 48430,22351,N,22354,14438,48431,N,48434,N,N,48432,22355,18812,15707,48433, 48435,22356,18553,48436,48437,48438,N,17985,17447,N,N,N,48439,17712,N,N,22357, 13611,N,N,N,N,N,16180,48440,18732,N,48441,48442,48443,N,48444,13431,18214,N,N, 48445,48446,48447,48448,48449,N,22358,15190,19258,19259,N,N,12670,22363,48450, N,17257,48451,48452,N,22360,N,N,N,48453,48454,48455,12919,48456,48457,48458, 48459,22573,22362,48460,48461,N,18224,48462,N,22361,N,48463,22359,48464,14714, N,22365,48465,N,N,48466,N,N,48467,22371,22377,22369,N,17756,48468,48469,22374, 18781,48470,48471,22368,48472,22373,20071,15191,N,48473,16981,22366,N,N,48474, 13662,22376,16429,12645,22370,12920,22375,N,48475,N,13873,N,22372,N,48476,N, 48477,N,N,N,N,22378,N,N,N,N,N,48478,22380,22390,22388,N,N,22385,48479,48480, 48481,22384,20088,48482,22386,N,N,13874,48483,14641,N,48484,15738,48485,48486, N,22393,22379,N,N,48487,N,22383,22367,48488,12922,22387,22389,17233,N,48489, 14888,12856,22381,22392,22391,13875,N,16937,13158,48490,N,N,N,14147,N,22382,N, N,N,N,N,N,48491,48492,N,22394,48493,22397,22561,N,48494,N,48495,15421,48496, 22567,17520,22395,48497,N,N,48498,22565,48499,12921,48500,22563,22564,48501,N, 22398,22562,N,48502,48503,14439,19754,N,48504,13365,48505,48506,12633,22566, 48507,18234,12333,N,N,N,N,N,48508,48509,18529,22364,22572,22576,19557,48510, 22569,N,N,48673,17769,22574,48674,N,N,N,48675,N,48676,15984,22575,18007,48677, 48678,48679,48680,N,N,48681,48682,N,20295,N,22571,48683,48684,N,N,22577,48685, 14715,48686,16459,48687,48688,12372,22570,22568,48689,16730,N,48690,N,22396, 15156,N,N,N,N,N,N,N,16966,22589,48691,16731,22584,48692,22581,22582,48693, 15462,22585,22588,48694,48695,22583,15653,48696,22586,N,N,22580,48697,19580, 19579,48698,N,48699,22590,22591,12373,48700,48701,48702,48703,48704,22579, 48705,48706,N,48707,13938,12326,48708,N,48709,13366,N,22587,48710,N,N,N,N, 22595,22594,N,48711,48712,22599,N,N,N,48713,48714,N,N,22600,48715,48716,48717, N,48718,N,N,22598,22601,22593,22597,N,48719,22602,N,22603,48720,48721,22592, 15228,48722,22596,16982,14642,22578,16181,N,N,N,N,22616,N,19049,N,N,22606, 22607,22608,N,N,22615,48723,22614,48724,N,19325,13367,N,22612,N,14149,13108,N, N,22609,48725,N,20024,22611,12374,22613,48726,22604,22610,22617,14148,22605, 48727,N,N,48728,48729,N,19805,48730,48731,48732,19755,48733,48734,N,N,22620,N, N,22624,48735,N,48736,16766,N,20089,22625,48737,48738,22622,N,22619,48739, 48740,22618,22623,N,48741,48742,N,48743,48744,N,N,N,18992,48745,N,17972,48746, 14150,48747,22626,22621,48748,22627,N,N,N,14203,N,N,N,12849,N,48749,48750, 22635,N,48751,N,13368,N,48752,48753,48754,22633,N,N,22634,14889,22632,22630, 22629,22636,22628,22638,48755,48756,12923,N,N,N,N,48757,N,N,N,N,N,N,48758, 48759,48760,48761,N,48762,48763,22640,N,48766,22639,48764,N,48765,N,N,48929, 48930,N,48931,N,N,17448,N,22643,N,22641,22631,14204,N,22642,N,22646,22645, 22647,22644,22648,48932,N,48933,48934,N,N,48935,22649,22650,19050,N,22652, 22651,15679,N,16430,12902,12924,48936,22653,48937,12351,N,N,N,16460,22654, 48938,27715,22817,14177,48939,22818,48940,48941,N,N,16495,48942,N,48943,22819, 48944,N,N,22820,13626,22821,N,22822,22823,16983,N,N,N,14413,48945,N,19553,N, 48946,N,19260,15722,22824,48947,48948,48949,N,48950,16496,28221,18530,N,15466, 48951,14925,22825,N,48952,48953,48954,16967,48955,18983,48956,N,17009,N,48957, 22828,48958,N,22826,N,22829,N,N,22827,48959,N,N,N,22830,N,N,N,N,48960,18993, 48961,N,12343,N,48962,N,N,18782,N,N,18531,48963,N,22831,48964,22834,15925, 13627,N,22832,22839,15926,N,N,N,N,22833,18244,N,N,48965,48966,48967,48968, 19806,22835,22836,22840,17770,22837,14643,16478,N,N,22854,18484,N,17010,N,N,N, N,N,N,N,48969,N,48970,N,N,18532,23085,N,N,N,N,19066,N,48971,N,17521,48972, 48973,N,19317,48974,22843,12833,17258,48975,48976,N,N,22852,N,48977,17204, 22846,22853,22848,22855,22851,N,22850,18287,48978,22844,12925,22842,13681, 17011,22838,48979,48980,22841,14644,16475,48981,15927,22849,18258,N,N,13682, 13128,N,N,N,N,N,N,N,N,48982,N,13159,16161,22857,22862,N,22858,48983,14205, 48984,22863,15138,14697,N,N,N,N,48985,48986,15654,22845,15229,22860,48987, 48988,N,N,15192,22861,12356,48989,48990,22856,48991,N,N,48992,17449,N,48993,N, N,48994,N,48995,13683,N,N,N,N,N,13876,N,N,N,N,N,N,N,22859,12327,48996,48997, 14915,N,48998,N,16182,N,N,N,N,N,48999,49000,N,N,49001,17522,N,49002,18516, 22865,16734,N,49003,49004,49005,49006,N,49007,N,N,16938,49008,49009,15147, 22866,49010,22868,22864,N,49011,49012,49013,19041,N,17469,49014,N,N,49015, 16732,N,N,N,N,N,N,N,N,49016,49017,19067,15438,22880,N,22879,49018,49019,16248, N,N,49020,14206,N,49021,49022,22873,15929,49185,N,18024,18225,49186,49187,N, 49188,22871,N,49189,16733,49190,N,N,49191,15480,22876,49192,N,15928,N,22870, 22875,49193,N,18259,N,49194,49195,22869,N,14113,49196,49197,13149,N,N,49198, 22877,20011,14926,17205,22874,49199,16476,49200,14645,16228,12646,16700,22872, 13637,49201,49202,49203,N,N,14151,N,17487,22878,N,N,N,N,N,16735,N,49204,22881, N,22883,49205,N,16951,22889,49206,22884,N,49207,22886,N,N,N,N,49208,18753, 17523,49209,22887,49210,49211,49212,19756,N,N,N,19784,13369,49213,N,N,N,49214, 12334,N,22885,N,49215,N,N,N,22882,49216,N,49217,N,13432,N,N,N,49218,49219, 12647,49220,22888,N,49221,49222,19785,22892,N,N,49223,49224,N,N,16955,N,22899, 49225,N,49226,22893,49227,N,22890,22897,49228,N,N,N,22867,N,49229,N,49230,N, 49231,N,49232,49233,22894,N,22898,49234,49235,N,18498,17771,N,49236,49237,N,N, N,22891,49238,22895,N,N,N,14152,N,N,49239,14961,49240,N,N,16477,N,N,N,N,N,N,N, N,49241,N,N,22903,49242,N,49243,49244,49245,49246,N,N,N,17702,N,49247,49248, 49249,49250,N,49251,49252,49253,N,49254,N,N,N,22900,N,19296,N,N,N,49255,N, 22901,N,N,N,49256,49257,N,22902,N,19534,N,16418,49258,N,49259,N,N,N,N,N,14178, N,49260,N,49261,22909,N,N,N,N,N,N,49262,49263,49264,15157,22906,N,22905,N,N, 49265,49266,18226,49267,N,49268,17973,49269,N,49270,N,49271,17713,22907,49272, N,49273,22908,N,18799,49274,18245,15139,N,16497,N,19280,49275,N,N,N,N,N,13129, N,23077,22910,49276,49277,49278,N,19786,23079,N,49441,23075,N,23076,N,49442, 49443,49444,49445,16736,49446,N,49447,49448,23074,N,22847,49449,N,49450,23078, N,23073,N,N,N,N,N,23083,23084,17703,23086,49451,49452,15140,23081,N,49453, 49454,N,13628,49455,N,23087,49456,23080,23091,N,23090,49457,23089,49458,N,N, 23092,49459,N,23094,15985,49460,23093,49461,N,N,49462,23097,N,N,49463,49464, 49465,N,N,N,N,49466,N,N,N,49467,49468,N,49469,N,23095,49470,N,49471,23096, 22896,49472,49473,N,N,49474,23099,23098,N,49475,N,N,49476,22904,23100,23088,N, 49477,15193,N,49478,N,N,23101,23102,23104,23103,23105,12926,49479,14646,49480, 49481,19068,16431,N,N,N,49482,N,14414,N,49483,23107,49484,N,N,N,23110,N,18770, 49485,13663,49486,N,49487,23109,23108,18260,23111,13877,N,N,N,23113,23112, 49488,49489,N,13370,15158,N,N,18008,49490,N,N,N,49491,14153,N,N,N,16244,N, 23114,N,16432,17704,N,18783,23115,N,49492,N,N,49493,N,N,N,49494,23116,23117,N, 49495,N,19000,21853,16454,49496,N,18764,N,14936,N,18533,18499,49497,N,N,49498, N,17741,49499,20033,N,23119,15440,49500,N,23120,49501,12342,N,49502,13908, 16461,49503,18784,N,N,N,23121,15170,17223,49504,15195,16183,N,49505,49506, 49507,N,N,23122,N,19069,N,N,12663,15196,N,49508,N,23125,49509,23123,23126, 20025,23124,N,49510,49511,N,16507,23127,N,49512,16946,49513,N,23128,N,49514,N, 49515,13434,49516,23130,N,23129,N,N,N,49517,23131,23132,13435,N,N,18044,17206, 13676,15197,16737,N,N,15708,12336,N,N,49518,23133,49519,N,49520,49521,N,N,N, 49522,12834,23137,N,N,49523,49524,49525,N,14647,23136,49526,N,14891,15930, 49527,49528,23135,N,15931,49529,19520,14890,N,49530,49531,12375,16462,49532, 49533,N,N,N,N,N,23142,49534,49697,16433,12615,49698,49699,49700,49701,15701, 49702,19302,14962,49703,49704,49705,49706,15932,49707,16423,49708,49709,N, 49710,23141,23139,23140,49712,N,49711,N,N,17259,N,N,23334,49713,23146,15230, 14648,23144,49714,49715,N,N,23145,49716,16184,49717,N,49719,23143,N,49718, 15151,N,N,N,N,49720,49721,49722,N,49723,49724,23148,23147,23152,49725,49726, 23153,N,23149,N,13090,23150,23151,18517,49728,49729,49730,N,18785,14154,23154, N,N,49732,16434,49733,15933,49735,49736,49737,17234,49738,49740,N,49731,49734, 49739,13895,N,23155,23159,N,N,12875,23156,23158,N,49741,49742,49743,23157,N, 49744,15723,49745,N,N,N,17224,12357,23160,49746,49747,49748,49749,23161,N, 49750,49751,N,17450,N,49752,N,20081,N,N,N,N,15171,N,49753,19051,N,N,49754, 49755,N,19261,49756,N,N,23330,23163,N,49757,23166,N,23165,49758,49759,23162, 49760,49761,23329,N,N,18014,49762,23164,N,N,49763,N,49764,49765,N,N,N,N,49766, N,23331,N,N,15724,23332,49767,19787,18296,N,49768,23333,N,N,N,N,N,23335,N, 49769,23336,N,49770,49771,N,49772,N,23337,N,13898,12616,14649,23338,N,23339, 15729,16738,49773,49727,21080,16702,16701,16984,14919,N,N,20594,N,49774,N, 49775,14190,19757,N,19070,N,18814,49776,23340,N,N,N,49777,14963,17471,23341, 20271,N,49778,N,19262,49779,17451,23342,13436,49780,N,49781,N,N,N,23343,23344, 19546,N,19492,19318,19292,15141,23346,N,N,15467,N,49782,19281,N,23348,23351, 23350,N,13433,N,N,13664,49783,23347,N,23349,N,N,N,49784,23352,49785,49786, 16249,N,N,49787,N,19835,12361,14944,16956,N,15453,49788,49789,15987,N,N,23355, N,N,17742,49790,23353,16939,23354,15986,19549,23356,23357,19816,49953,N,N,N, 23362,N,49954,14650,49955,18261,23359,17772,23134,23138,49956,13647,49957, 18247,N,N,N,49958,23361,N,15934,18500,N,49959,N,N,49960,23367,N,18554,N,23358, N,23364,23363,N,49961,49962,16463,49963,N,49964,N,19309,49965,20051,49966, 49967,19303,49968,12876,15198,N,N,20296,23366,16245,N,N,N,23365,N,N,23360,N,N, N,N,N,14415,49969,49970,49971,23372,23370,49972,12877,23368,23374,23380,N, 49973,49974,49975,N,N,49977,16968,49978,49979,19009,49980,23382,N,49981,49982, 18722,N,N,N,23381,18288,19263,13371,49983,16503,15680,N,N,49984,17491,49985, 19758,N,49986,23377,23376,N,N,49987,23378,N,23375,N,49988,23383,N,23373,N,N, 23371,N,23379,23369,49989,17260,49990,19576,15430,14964,49991,49992,N,49976,N, 14906,N,N,19311,13121,17486,17994,12617,N,N,N,N,N,N,N,N,N,N,N,N,N,N,16498, 49994,N,16436,14122,N,49995,N,N,N,49996,23385,49997,N,14651,13180,N,N,N,N, 49999,49998,23387,13172,23393,50000,50001,N,50002,50003,50004,23390,50005, 16499,N,N,N,13131,14892,N,50006,13130,14927,N,50007,23388,14181,14155,17773, 50008,50009,23386,N,12358,N,50010,N,50011,23389,23391,N,13901,14124,49993, 13372,13643,50012,N,50013,50014,23394,N,50015,14969,19313,N,15159,N,N,N,23395, N,N,N,18736,N,N,N,50016,N,N,50017,50018,50019,50020,50021,N,23407,50022,12851, 23396,N,50023,50024,50025,50026,N,23413,23397,N,20034,50027,23404,50028,18271, 50029,N,50030,N,N,N,N,23412,N,23399,N,N,N,12340,23401,N,50031,14652,50032,N, 50033,23403,50034,23402,N,23398,23409,50035,15935,50036,N,50037,21613,14440, 19836,50038,50039,N,N,23400,50040,17524,13091,14893,50041,23392,N,23408,13153, N,N,23406,23410,50042,17774,N,N,N,N,N,N,N,13438,50043,23602,N,50044,19529, 23415,13437,50045,23422,N,50046,50209,50210,19264,50211,23585,23587,50212, 23591,23417,50213,17194,N,50214,50215,N,17775,23595,23420,N,23592,N,50216,N, 23586,50217,N,50218,50219,50220,50221,16185,23596,50222,50223,16435,N,N,50224, 50225,N,N,23594,13373,50226,50227,50228,20304,23414,N,N,23590,12376,50229,N, 23416,50230,50231,19514,23421,16162,17479,23411,50232,50233,23589,50234,N,N, 50235,50236,N,16250,23599,13169,14369,N,N,N,N,23601,23418,23600,N,23593,23419, N,23597,N,23598,N,N,N,N,N,23615,50237,N,50238,17998,50239,23588,N,50240,23611, N,50241,N,23613,N,17496,N,N,50242,N,N,50243,N,N,N,50244,19788,N,N,N,50245,N,N, N,N,18806,23608,16970,N,50246,N,23614,16703,50247,23605,23618,23617,N,18031, 23616,18026,50248,50249,50250,50251,N,50252,50253,23620,23607,50254,13896, 23610,15709,50255,50256,50257,18272,23612,13899,N,23604,23606,23603,50258, 50259,20272,13146,23609,50260,50261,23619,13109,N,N,N,N,N,N,N,14951,N,N,50262, 12637,N,N,23636,50263,N,20273,23639,50264,N,50265,N,N,16186,23638,N,N,N,23637, 50266,N,N,N,50267,50268,23634,50269,N,N,50270,N,50271,23622,50272,N,23651, 23621,N,23640,N,N,50273,50274,N,50275,23632,50276,N,23627,23624,N,23625,N, 23633,N,50277,N,29730,50278,N,23630,14653,17480,16740,23628,N,23623,50279,N, 23626,N,N,50280,50281,19789,19306,N,N,N,23631,23641,N,N,N,50282,N,N,50283,N, 23649,23642,N,N,23655,N,23653,50284,50285,N,50286,23648,50287,N,50288,N,N,N, 23647,N,17488,N,16741,50289,23645,50290,50291,23643,50292,N,23650,N,N,N,N, 23656,18549,23662,N,N,50293,N,50294,23657,23660,23654,50295,N,17268,N,18744, 50296,23644,N,50297,23652,15936,50298,19535,23672,23659,50299,N,N,N,50300, 14370,12835,13151,N,N,23635,N,50301,N,50302,N,50465,15937,23664,50466,23671, 15481,13170,50467,N,17198,50468,50469,N,N,N,N,23661,50470,50471,23666,23670, 50472,50473,13878,N,N,50474,N,50475,50476,50477,N,N,50478,50479,N,13644,23668, N,50480,N,N,N,13601,N,17995,23667,N,50481,N,23669,50482,N,N,50483,N,N,N,N,N,N, 50484,23663,50485,N,N,N,N,23665,N,N,N,N,N,50486,13152,17225,50487,N,50488, 23676,N,50489,50490,N,50491,N,50492,N,23674,14441,N,23673,50493,N,N,N,N,N, 23841,N,N,N,50494,23384,50495,50496,50497,23675,N,23677,23678,N,50498,N,N,N,N, 23852,50499,23848,N,23405,50500,50501,50502,N,23847,50503,N,N,N,23846,N,N, 23843,N,50504,50505,50506,N,23658,23845,23844,N,N,50507,N,50509,50508,N,N, 50510,N,N,N,50511,23850,N,20262,50512,50513,50514,N,N,N,23853,13947,50515, 50516,23849,23851,N,N,N,N,50517,N,N,50518,18471,N,23854,N,50519,N,N,N,50520, 50521,50522,N,N,N,N,N,N,N,23858,23855,50523,50524,50525,50526,19827,23856, 50527,50528,N,50529,23646,N,N,N,N,50530,50531,50532,23859,N,N,N,23860,50533,N, N,N,50534,N,12597,50535,23862,14183,15393,N,13909,50536,N,N,12836,50537,N,N, 50538,50539,N,N,50540,N,N,19807,N,N,50541,50542,23864,23863,23866,13629,50543, N,13910,13374,50544,N,N,N,23869,N,N,50545,23868,N,23870,50546,N,12878,50547, 17207,N,23871,N,50548,13375,23873,N,50549,N,50550,23872,N,23874,N,50551,N, 23875,50552,23876,15199,16437,14881,N,18800,50553,N,19042,20292,50554,N,N, 50555,15221,50556,N,N,14928,20082,50557,N,N,23877,23878,N,15200,N,50558,50721, 23879,23880,N,50722,23882,23881,50723,19288,N,N,15710,15468,15172,N,23883,N,N, N,N,N,N,N,23885,16163,50724,23884,N,N,50725,N,N,23886,50726,50727,N,50728, 50729,23887,N,N,N,50730,50731,23888,23889,50732,50733,50734,23890,50735,23892, 23891,23893,12837,17226,N,23894,50736,50737,15142,13132,23895,50738,50739, 17730,21580,N,N,50740,50741,13603,23896,N,N,50742,N,23897,50743,19052,19304,N, N,N,17991,23898,18534,N,50744,N,18555,N,50745,19539,N,N,N,23899,N,50746,N, 50747,N,N,50748,50749,N,N,N,23901,23900,N,50750,23903,N,50751,N,23902,N,N,N, 50752,N,50753,N,N,N,N,N,50754,50755,N,50756,50757,N,N,23905,50758,N,N,N,50759, 50760,15201,50761,19505,50762,23906,23907,N,N,13604,N,50763,N,23908,N,N,N, 50764,N,N,N,23910,23909,N,50765,50766,50767,N,N,N,50768,N,50769,N,N,N,N,50770, 16229,50771,50772,18745,12618,N,50773,50774,N,N,18501,50775,17525,15681,13665, N,N,N,N,N,N,N,50776,50777,N,50778,18502,50779,15406,N,50780,N,50781,23912,N, 13376,N,50782,12664,50783,50784,18034,23911,14654,17235,N,23913,N,N,N,N,50998, 23921,N,23914,50785,N,50786,N,50787,16961,N,13666,23922,50788,N,50789,N,50790, 50791,14184,50792,N,13605,23920,N,N,23918,23915,19808,N,50793,50794,50795, 17472,50796,N,N,18009,23916,N,N,23924,N,23923,14115,50797,50798,12845,50799, 50800,14907,23917,23919,50801,N,N,50802,N,19287,17012,N,N,N,N,N,N,N,N,19319,N, N,23932,N,50803,23933,50804,12879,50805,N,N,N,18984,19581,24097,15395,15938, 23928,23934,12648,N,13879,50806,N,23925,23930,50807,N,N,16500,18289,N,18535, 50808,N,50809,50810,50811,50812,23927,50813,19233,50814,23929,N,24100,50977, 24098,50978,23931,N,N,50979,19234,18248,13667,N,17701,N,50980,17261,50981, 24101,50982,50983,N,50984,24099,16985,23926,50985,12619,50986,50987,N,N,50988, N,N,50989,19790,24112,N,50990,50991,N,50992,24111,50993,N,N,N,16502,N,24108, 50994,19820,N,N,17974,24102,N,N,N,N,N,17477,50995,50996,50997,12620,14655, 24105,N,N,50999,51000,N,51001,15655,24110,N,24109,24104,N,24107,51002,N,13160, 51003,24106,18249,51004,N,20014,N,N,15988,16501,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,51005,N,24118,24116,N,18765,N,51006,51007,N,51008,N,24113,24115,51009, 12602,51010,N,14656,20274,N,13117,N,18786,51011,51012,N,N,N,19809,N,N,13092, 16187,24117,N,N,51013,N,N,N,N,N,51014,N,N,24122,N,51015,15939,N,N,N,19760,N, 24119,N,N,51016,51017,24114,51018,24120,51019,51020,51021,20062,N,17779,17986, N,N,N,N,N,N,N,N,N,N,N,N,N,51022,N,51023,N,N,13110,N,N,12629,N,51024,24126,N, 51025,24129,51026,N,N,20035,51027,N,51028,19812,N,N,N,51029,24136,24130,24127, 51030,N,51031,20052,24133,N,51032,51033,N,15690,24135,N,N,24140,51034,N,17777, 24138,N,51035,N,51036,24132,51037,51038,17208,51039,N,24139,51040,24128,N, 24134,51041,24141,12412,24131,N,24142,51042,51043,16188,N,15711,51044,18981, 51045,14894,N,24123,24137,17722,51046,51047,N,N,N,51048,16438,N,13161,14929, 15940,24125,15682,N,N,N,N,N,N,N,14156,N,24124,N,N,N,24146,15725,14394,N,24161, 51049,24155,13684,17743,51050,24150,24159,12335,12594,51051,N,12857,N,24152, 16940,24143,24145,14657,N,N,51052,N,N,N,51053,N,24162,51054,24157,51055,51056, N,24149,N,N,N,N,24156,51057,51058,N,N,51059,51060,19499,51061,N,24154,24158, 51062,N,51063,51064,51065,51066,N,14416,51067,15941,N,N,17209,51068,51069, 51070,24148,N,N,51233,51234,N,N,N,19759,51235,N,N,24151,N,N,24144,17778,N,N, 24147,51236,N,N,24153,N,N,N,N,51237,N,51238,20305,15422,19326,N,24163,N,N,N,N, N,N,N,N,N,18478,51239,N,24175,14395,N,N,51240,N,N,15712,N,24165,51241,N,N, 20015,14658,N,24178,51242,N,12398,N,N,24176,N,51243,N,N,24164,N,N,51244,51245, 24170,N,51246,24172,51247,N,N,19791,24167,N,N,17710,51248,N,24169,N,51249, 51250,51251,24177,51252,24171,19527,N,51253,51254,24166,51255,15394,24190, 51256,51257,51258,N,13162,N,24168,24173,24174,N,N,N,N,N,N,N,17004,16986,N,N,N, N,N,N,N,N,N,N,N,N,51259,24182,51260,51261,24188,N,N,24186,N,17705,N,N,24355, 24183,51262,N,51263,N,51264,24184,24160,13689,18746,N,51265,N,15423,N,51266, 14711,51267,N,51268,51269,N,20275,N,24180,N,24354,12649,16742,51270,N,51271,N, 51272,51273,N,N,N,N,18297,N,13377,20090,N,N,51274,N,N,51275,51276,19489,17490, 51283,N,51277,51278,24187,24189,51279,N,N,51280,N,16690,N,N,51281,51282,N, 24353,24185,N,24179,N,N,N,13379,N,N,N,N,N,N,N,N,N,51284,N,51285,51286,51287, 14185,N,N,51288,24367,51289,51290,24362,16504,51291,51292,13155,N,51293,51294, N,15713,N,24371,N,51295,N,N,N,51296,24364,17452,24361,17497,N,N,N,24396,N,N,N, 24358,N,24357,N,24366,51297,51298,N,24360,24359,24365,51299,16417,N,24356, 51300,51301,N,N,51302,51303,51304,24368,N,51305,24369,51306,51307,51308,N, 51309,13378,N,N,51310,N,N,N,N,51311,51312,24374,N,24373,24375,51313,51314, 51315,51316,N,24378,N,N,N,51317,51318,51319,17731,N,24372,N,51320,51321,N,N, 24376,N,N,51322,N,N,N,14179,17017,24370,18235,N,51323,24377,51324,51325,N, 51326,N,N,N,N,N,N,N,N,N,24382,24380,N,N,24383,N,51489,24386,N,N,51490,24379, 14698,18216,N,N,24121,N,N,N,51491,51492,N,19828,24381,N,24385,17013,51493, 24384,N,24363,N,51494,28521,N,N,51495,24389,N,51496,51497,24393,51498,24391,N, N,N,51499,51500,51501,N,24387,N,24388,N,51502,N,24392,N,24390,N,N,N,18766,N, 51503,24398,N,24395,24394,N,24397,18004,24399,51504,N,N,51505,N,N,17269,17005, N,N,N,N,16421,N,N,51506,24400,N,24402,N,51507,N,N,51508,N,51509,N,N,51510,N, 24401,N,N,N,N,51511,51512,N,N,N,51513,51514,51515,51516,24181,N,51521,N,N, 24403,N,N,51517,51518,N,N,18023,N,N,N,N,51519,51520,N,N,N,N,24404,51522,51523, N,N,N,N,N,12880,51524,N,51525,17780,13093,N,N,N,N,51526,51527,N,13668,N,N,N, 15454,14930,51528,N,N,51529,N,N,N,51530,51531,N,N,20263,16230,N,N,N,12650,N,N, N,24406,N,51532,51533,51534,51535,51536,24405,N,51537,N,N,N,N,N,N,N,N,51538,N, N,N,N,N,N,51539,24409,17210,24412,24407,51540,51541,N,24411,51542,N,N,51543, 24410,17728,12377,N,N,N,N,N,N,N,N,N,N,N,N,N,20085,N,51544,24414,N,N,N,12584,N, 51545,N,51546,51547,51548,51549,N,51550,24416,N,N,51551,24415,N,24413,N,N,N,N, 51552,N,N,N,N,N,N,N,N,N,N,N,N,24408,N,N,N,N,N,N,N,19235,51553,N,N,24418,51554, 51555,51556,51557,51558,N,24417,N,51559,51560,N,N,51561,N,N,N,N,12651,N,N,N,N, 24420,18994,N,24419,N,51562,N,51563,19509,N,N,N,N,15943,N,N,N,N,51564,N,51565, N,51566,51567,51568,N,N,N,N,16691,N,51569,N,N,N,15942,N,N,N,N,51570,N,N,N, 51571,51572,51573,N,20091,51574,51575,24426,N,16505,N,51576,N,51577,N,N,24422, 24427,51578,N,12652,51579,N,51580,N,51581,N,51582,N,24425,N,18273,24421,24424, 15944,51745,18513,N,N,24428,N,15441,N,N,N,N,N,N,N,N,N,N,51746,N,N,N,16506,N,N, 51747,N,N,N,24431,51748,N,51749,24423,N,14119,N,51750,N,N,24429,N,N,51751,N, 19792,24432,N,N,N,29734,51752,51753,N,N,N,15695,51754,N,51755,N,N,N,N,N,24433, N,N,N,24434,N,N,51756,51757,18222,51758,51759,N,N,N,N,N,24436,51760,N,N,N, 24437,51761,51762,51763,N,18227,51764,N,N,N,17781,24439,N,51765,51766,N,24441, N,20053,N,24438,51767,24440,12653,51768,24435,N,51769,51770,N,51771,N,N,21339, 24442,N,N,N,N,16743,15160,24444,N,N,N,N,24443,16164,21081,N,N,N,N,N,N,24445,N, N,51772,24609,N,24430,24446,N,51773,24610,51774,N,N,N,N,N,18298,51775,51776, 51777,N,N,N,24611,N,N,24612,N,N,51778,N,N,N,51779,N,N,51780,24613,N,51781,N, 51782,N,N,N,N,51783,N,N,N,24614,N,17502,51784,24616,24615,N,51785,24617,N, 24618,N,51786,15455,18787,N,51787,51788,19564,24619,24620,16726,15396,24621, 24622,51789,51790,51791,N,51792,24623,19026,18503,N,N,24624,18263,N,51793, 51794,51795,N,17453,51796,N,51797,51798,N,24625,12903,51799,13677,51800,19526, 51801,19510,51802,12852,20276,51803,N,N,N,19282,51804,18986,N,51805,N,N,51806, 51807,N,51808,16439,N,24626,N,N,51809,51810,17987,N,51811,51812,14371,24627, 51813,14932,24629,24628,N,51814,N,N,24630,N,51815,N,N,N,51816,51817,N,N,N, 24631,51818,N,N,24632,N,N,N,N,51819,N,N,N,N,13630,N,24633,N,N,N,N,24634,51820, N,N,N,14372,51821,51822,18504,N,51823,24636,N,51824,N,15989,N,N,24635,N,N,N,N, 51825,N,N,51826,13880,24637,24639,N,24638,51827,N,51828,N,N,51829,N,24640,N, 14417,N,24641,N,N,51830,51831,13929,51832,16704,N,14717,N,N,N,51833,24643, 24644,24642,N,N,51834,N,N,N,15469,N,N,17992,13881,N,N,N,N,N,51835,51836,N,N, 24646,17196,24645,51837,51838,20277,18274,52001,52002,N,52003,52004,N,52005,N, N,24649,52006,N,52007,N,N,N,N,52008,52009,N,N,24651,24648,52010,52011,N,19540, 24650,24652,52012,20036,N,N,52013,N,52014,24656,N,52015,52016,24655,17270, 18221,52017,N,14373,24654,N,52018,52019,N,24653,52020,19761,19762,N,N,52021, 52022,N,52023,24657,12654,N,N,N,52024,14710,15202,N,N,N,N,N,N,N,52025,24658, 24659,52026,N,52027,N,N,N,52028,24661,52029,N,N,N,N,52030,52031,52032,52033,N, N,15683,N,N,52034,52035,24663,52036,24662,52037,52038,N,52039,52040,24664, 52041,13133,N,N,24666,N,52042,24665,52043,24668,24667,52044,N,N,N,52045,52046, N,52047,14396,52048,52049,20008,N,13900,N,12838,N,N,52050,N,52051,N,N,52052,N, 52053,13930,52054,52055,N,N,N,52056,N,52057,52058,52059,N,52060,N,N,52061, 52062,N,N,13409,52063,52064,N,52065,N,N,N,N,20072,24670,N,52066,N,52067,N, 52068,N,24672,52069,52070,N,52071,24673,N,12881,N,N,52072,52073,N,24669,52074, 15161,52075,52076,17473,24671,52077,N,N,52078,52079,N,N,52080,N,N,52081,N,N,N, 52082,24676,N,15470,52083,N,52084,N,24674,52085,52086,N,52087,14142,N,N,18505, 24675,N,N,24702,N,N,52088,52089,N,52090,24681,52091,52092,52093,N,52094,14397, 52257,52258,52259,N,13669,52260,24678,19837,52261,N,20016,52262,N,N,N,N,N,N, 52263,N,N,N,N,N,N,N,N,52264,52265,N,N,N,N,N,N,17014,N,52266,24680,52267,N, 52268,52269,52270,52271,52272,52273,52274,52275,52276,52277,24682,20054,13911, 18556,18250,N,N,52278,24683,N,N,N,N,24685,52279,24688,N,52280,52281,N,52282, 52283,N,N,N,52284,N,52285,N,N,N,52286,52287,N,N,24684,N,52288,N,24687,14442, 12621,24689,52289,16240,24686,20060,N,52290,24692,29732,N,52291,52292,52293, 24690,24693,52294,N,52295,52296,24679,24691,52297,52298,14908,N,N,24694,N,N,N, N,N,N,N,24695,N,52299,52300,N,19838,N,52301,52302,52303,N,52304,N,24696,N,N,N, 52305,52306,52307,52308,N,N,N,N,N,52309,52310,52311,N,52312,N,24697,52313, 52314,52315,24677,52316,N,N,52317,24698,52318,52319,52320,52321,N,N,52322, 52323,13380,52324,52325,N,N,52326,N,N,N,52327,N,52328,N,15397,N,52329,N,N,N,N, N,N,N,N,52330,52331,24699,N,52332,N,N,24700,52333,N,N,52334,24701,N,N,N,52335, N,52336,52337,12603,N,52338,52339,24865,N,18747,24866,52340,N,13348,24867, 52341,24868,52342,52343,N,N,24869,52344,24871,24872,24870,N,52345,N,18771, 24874,24873,N,52346,52347,52348,N,N,52349,24876,24875,24877,52350,N,N,N,N,N, 24878,24880,24879,N,N,14713,52513,24882,N,24881,52514,52515,13381,N,16211,N, 17724,N,24883,16440,52516,52517,N,15162,52518,12665,24884,52519,19793,52520, 52521,19043,24885,N,N,52522,17732,19763,14659,16189,N,N,52523,17227,21044, 52524,17454,12904,24886,52525,52526,52527,52528,N,N,52529,24887,N,24892,52530, 52531,24890,24889,23106,13094,24888,52532,12378,52533,18474,52534,N,18506,N,N, 52535,N,20017,24893,24891,17244,16422,52536,52537,18475,52538,18733,N,24895, 20012,14157,24896,N,24894,18518,24897,N,24898,N,52539,12379,52540,N,15990, 24903,N,24900,18029,24899,52541,52542,52543,52544,52545,52546,13606,N,52547, 24906,N,N,52548,24901,24902,N,24905,24904,18725,N,N,16706,16705,52549,13631, 52550,52551,24907,52552,N,N,N,52553,24908,N,52554,24909,N,N,N,N,52555,24911, 52556,24910,N,N,N,N,N,12630,N,N,N,N,N,24919,18536,24913,52557,24915,N,N,24917, 16190,52558,N,24918,24916,15424,52559,52560,52561,24912,24914,52562,18754, 52563,15945,N,N,24921,N,52564,24920,52565,52566,N,N,24922,N,15398,14895,N, 52567,17783,24923,N,17483,52568,N,24925,52569,52570,52571,20001,24924,52572,N, N,52573,N,16745,N,N,52574,N,52575,52576,24930,52577,24932,24933,17236,N,N,N,N, 52578,24931,N,24928,N,24926,24927,52579,24929,52580,52581,52582,N,N,52583, 52584,24936,52585,24934,52586,24935,N,52587,N,N,52588,52589,N,52590,52591,N,N, 52592,N,52593,52594,52595,52596,24937,24939,24940,24941,52597,24942,52598, 52599,24938,N,52600,N,N,N,52601,N,N,24944,N,52602,52603,24943,52604,N,N,52605, 52606,52769,24945,52770,N,N,N,52772,52773,20037,52774,52775,52776,24948,24946, 24947,52777,52771,52778,13410,N,N,N,N,N,19582,N,N,52779,19018,N,24950,52780,N, N,24949,N,N,52781,N,24951,24952,N,52782,52783,N,24956,24953,24954,24955,N, 24957,52784,52785,52786,24958,52787,25121,N,52788,N,25122,N,25123,N,18479, 17744,25124,18290,18740,N,25125,52789,N,25126,17706,52790,13095,14660,25127,N, N,25128,52791,52792,25129,N,15145,N,N,25131,N,52793,25130,N,N,25132,25133, 52794,52795,52796,N,52797,52798,N,52799,52800,52801,52802,52803,52804,52805,N, 52806,N,N,52807,18537,N,25134,N,N,N,25135,N,N,29545,25136,25137,25138,N,N, 52808,N,15150,N,52809,25139,18262,N,52810,19295,N,12622,52811,12631,52812, 52813,25140,52814,N,N,N,25142,N,52815,N,25141,17776,N,52816,N,16441,23865,N, 25143,19521,52817,25144,N,13382,18519,25145,52818,25146,52819,N,25147,N,52820, N,19548,N,52821,52822,19541,N,17470,N,52823,N,16746,52824,N,25149,52825,N, 15714,52826,15946,N,N,25152,N,52827,25151,25150,18557,52828,13383,14377,N, 52829,N,N,N,52830,N,52831,52832,N,52833,N,52834,52835,25158,52836,N,25155, 16191,19506,N,52837,N,25154,25156,25157,N,52838,25153,N,N,N,52839,52840,52841, N,N,N,N,52842,52843,52844,25159,25160,52845,17455,N,13411,52846,52847,N,17253, N,52848,N,N,52849,52850,25161,N,N,52851,N,N,52852,52853,52854,N,N,52855,N,N,N, 52856,52857,N,N,25162,25165,52858,N,52859,52860,52861,16231,52862,17988,53025, 25166,19283,53026,25163,N,53027,25164,53028,N,N,N,53029,N,53030,53031,53032,N, N,N,N,25169,53033,N,N,53034,25168,25167,53035,N,N,N,53036,N,N,N,N,N,N,25171, 53037,53038,25170,N,N,25172,N,N,53039,53040,53041,N,N,N,53042,N,N,N,25174, 53043,25173,N,53044,N,N,19021,N,53045,N,N,53046,N,15702,20038,53047,53048, 25175,53049,N,17975,N,53050,25176,N,N,25177,N,25181,25179,25180,53051,25178,N, N,N,53052,N,N,N,25182,N,53053,N,N,N,25183,N,N,N,53054,53055,N,N,53056,N,25184, N,53057,25185,19511,25186,N,53058,53059,53060,N,19568,25187,53061,17230,53062, 18282,N,13931,53063,N,53064,17211,25188,13882,53065,53066,N,16464,53067,N,N,N, 53068,N,N,53069,25189,14909,N,N,53070,53071,N,N,53072,N,N,25190,53073,53074,N, N,53075,25191,N,14374,14933,N,N,N,N,N,N,N,53076,N,N,25193,53077,53078,53079,N, 17750,14934,13646,N,N,N,N,N,53080,53081,N,53082,N,19236,N,18251,53083,N,53084, N,N,17751,N,N,N,N,14684,N,N,N,53085,53086,25195,N,53087,53088,N,N,N,53089,N, 53090,N,N,N,53091,N,N,N,N,N,N,N,N,N,53092,15947,53093,N,53094,53095,N,53096, 53097,N,N,N,53098,N,53099,20018,14661,N,53100,14375,N,N,18467,N,25197,N,N,N,N, N,53101,N,25199,N,53102,N,N,14443,N,N,N,N,25198,17526,N,N,53103,N,25201,13111, 25196,53104,N,18538,N,12592,53105,14956,N,20306,53106,N,25200,N,N,53108,53109, 53110,N,53107,N,25202,53111,N,N,19019,53112,16473,25204,N,53113,53114,N,25205, 53115,53116,53117,53118,N,25203,N,N,N,N,13134,53281,25211,53282,25210,53283,N, 15399,N,N,N,25212,25207,53284,53285,53286,25213,25208,53287,N,53288,N,18520, 25206,53289,53290,25209,53291,53292,N,N,N,25378,53294,N,N,N,53295,53296,53297, N,N,53293,N,53298,25377,19297,N,53299,N,25214,N,N,12395,N,N,53300,53301,25380, N,53303,53304,N,N,53305,53306,N,25379,N,53307,53302,15948,N,N,N,N,53308,25381, N,N,N,N,53309,N,16707,N,53310,25383,25382,N,N,N,N,N,N,25384,53311,N,53312,N, 53313,53314,53315,N,N,N,N,53316,25192,53317,N,53318,25194,25386,25385,53319,N, N,N,53320,N,N,53321,53322,N,N,N,N,15400,53323,20073,53324,15442,53325,25387, 14135,N,N,53326,53327,53328,13632,13607,15203,53329,53330,N,N,N,53331,19764, 53332,N,25393,53333,25392,16708,25389,53334,N,25391,53335,53336,15691,16192, 25390,25388,N,18218,N,N,15949,N,53337,18748,53338,N,53339,N,14935,N,N,N,N, 53340,N,N,N,N,17784,N,53341,25394,53342,53343,N,53344,25395,25417,13912,N,N, 20285,16693,N,N,N,N,25396,53345,53346,12882,17527,18977,N,53347,N,53348,53349, 53350,53351,N,53352,N,N,53353,53354,25397,N,N,N,53355,N,N,N,N,13690,25398, 53356,53357,25400,53358,N,N,25401,53359,18217,53360,N,25402,53361,N,N,N,53362, 25403,25404,53363,N,13913,12883,17989,15656,15204,53364,N,53365,N,N,53366, 53367,25405,53368,15657,N,N,N,53369,N,12874,18755,N,53370,25406,53371,N,18539, N,53372,N,N,53373,53374,16709,53537,25409,53538,25410,18281,53539,16193,25407, N,17249,53540,53541,25408,53542,N,N,15950,53543,N,N,N,N,N,N,53544,N,N,12380, 53545,13609,N,53546,53547,N,N,N,53548,25411,53549,53550,17528,53551,25412, 16455,N,N,53552,N,N,19501,53553,N,18723,25413,25414,17237,53554,20039,N,53555, 25416,25415,53556,N,N,N,N,N,53557,N,N,N,53558,N,53559,15471,53560,53561,25418, 12400,N,53562,53563,N,25421,53564,53565,53566,25419,12884,14158,25420,14662, 14706,N,19046,25422,53567,53568,19284,53569,53570,25424,N,N,53571,16465,12623, 12858,12332,N,N,N,N,53572,53573,25423,N,53574,N,N,53575,53576,N,53577,53578, 25425,25426,15991,N,53579,N,53580,N,25427,53581,13135,N,53582,N,N,25429,N,N,N, 14186,53583,13670,N,53584,25430,13941,N,N,25431,53585,16508,53586,17997,53587, 16480,14965,53588,53589,N,25432,N,53590,53591,N,N,N,N,53592,53593,17250,16747, 53594,25434,25436,25433,25435,N,N,N,N,N,53595,14114,53596,N,N,53597,N,N,N,N,N, 25437,14118,N,53598,N,13671,19794,25439,N,N,53599,N,53600,25440,N,N,53601, 12590,53602,53603,N,N,25443,N,N,N,13174,25442,25441,53604,25445,25438,53605, 25446,20009,53606,25447,53607,25448,N,53608,21620,25450,N,25449,N,N,N,25451, 25452,53609,20021,25453,N,28783,15951,25454,25455,15703,N,17976,25456,N,53610, 53611,17192,53612,53613,25457,N,17212,25458,53614,N,N,53615,N,13861,N,20799, 17245,15411,53616,N,53617,53618,13384,25459,N,25634,N,25462,53619,13672,N, 25461,25636,N,N,N,25460,N,15952,N,N,53620,N,N,N,25464,25465,N,17707,N,N,25466, 53621,13150,N,N,53622,N,16218,18788,53623,25468,53624,53625,53626,17000,53627, 53628,53629,53630,53793,N,25463,53794,25467,25469,N,N,14971,N,N,N,53795,N, 53796,53797,53798,N,N,N,25638,18734,53799,18470,17785,N,13914,25637,25635, 53800,18485,25470,17246,17787,N,17786,53801,14966,N,N,N,N,N,N,25656,N,N,53802, N,N,N,53803,25640,53804,25642,N,53805,53806,N,25645,53807,25646,53808,25643, 25644,53809,53810,25641,25639,N,53811,N,N,25633,N,N,N,N,N,N,N,N,N,53812,N, 19023,12885,N,53813,N,25653,N,25650,53814,25655,53815,53816,25654,N,18291, 19495,53817,15163,25648,25657,25652,53818,25651,25647,53819,25649,53820,13385, N,N,N,53821,N,N,N,N,17213,N,53822,16509,N,53823,53824,18466,53825,N,25662, 53826,53827,N,18468,N,53828,53829,53830,53831,N,N,16481,25659,53832,N,18511, 53833,25663,19027,53834,17243,53835,25658,25660,N,N,25661,N,N,N,N,53836,N, 53837,53838,N,53839,53840,53841,N,25664,N,N,15428,N,N,N,17990,25669,25668,N, 53842,25665,53843,N,N,20278,N,N,N,N,53844,25674,53845,53846,25678,25675,53847, 53848,53849,N,53850,N,53851,25671,53852,53853,53854,53855,N,53856,25672,N, 53857,N,53858,53859,25677,53860,53861,N,25666,21077,25673,25667,N,N,25676,N, 53862,N,53863,N,N,N,25682,53864,13386,N,25679,N,53865,53866,25680,53867,N, 25681,25684,53868,N,N,N,N,53869,N,53870,53871,N,53872,25683,18550,53873,53874, N,N,25685,20092,19053,25690,N,N,25687,N,N,53875,N,N,N,53876,N,25686,16466,N, 25689,25691,53878,53879,53880,25688,53877,25695,N,25692,53881,53882,53883, 53884,53885,53886,25693,25670,54049,N,54050,25694,25696,N,54051,N,54052,N,N, 25697,54053,54054,N,54055,N,54056,19014,N,25698,N,N,N,54057,N,N,54058,54059, 19554,N,N,13902,14121,25699,N,N,54060,54061,N,18996,N,16232,N,19504,N,54062, 25700,N,20019,N,54063,18292,N,16710,18228,N,N,15693,N,N,54064,12352,54065, 25705,25703,N,25701,13345,54066,15953,25706,N,N,25704,N,25702,25710,N,54067, 25709,25708,25707,N,N,54068,54069,N,25711,54070,54071,54072,25712,16442,54073, 25713,N,25715,N,54074,25714,N,54075,54076,54077,14418,N,N,54078,16696,54079,N, N,25717,54080,54081,54082,17788,54083,25716,54084,54085,N,25718,54086,18997, 16748,14663,N,25719,N,N,N,54087,20040,N,54088,N,54089,N,N,N,25721,N,N,25722,N, 25723,54090,25724,N,15205,N,25725,14159,N,N,13674,13610,N,25889,54091,19571, 14664,25726,54092,54093,54094,25892,19558,N,18236,N,54095,18739,54096,54097, 54098,15715,25891,54099,15443,14665,15206,13673,18998,25890,54100,54101,N, 16711,19266,14967,54102,N,N,54103,N,N,N,54104,15207,17501,54105,25895,20063, 14937,54106,25896,16194,N,25898,N,N,N,15954,14896,N,54107,54108,54109,25897, 54110,54111,15658,14398,16712,25893,25899,54112,54113,N,N,25894,14160,54114, 25902,25906,14187,54115,N,54116,N,N,25901,54117,N,54118,54119,25910,54120, 54121,14666,N,N,19821,12348,25907,N,54122,13675,54123,25904,N,54124,N,N,N, 25905,N,54125,17789,25903,25900,N,13096,16484,N,54126,14376,54127,54128,N, 25912,N,54129,N,54130,54131,54132,N,54133,54134,N,54135,25909,N,54136,54137, 54138,N,25911,N,54139,N,25908,N,N,54140,54141,N,14161,16947,25913,16750,54142, 54305,25926,N,N,25922,25916,N,N,54306,54307,N,N,54308,25920,15482,12381,25915, 25923,25927,14667,19542,54309,17494,25917,54310,54311,25925,54312,25914,17214, N,25919,12349,19530,N,N,54313,54314,54315,54316,54317,25918,N,N,13915,18540, 54318,54319,54320,16749,N,20048,15727,N,N,25966,N,54321,25928,54322,16510,N, 25924,25929,25931,N,17529,25934,54324,N,25930,54325,54326,N,19028,13387,54327, 54328,19531,54329,N,12382,N,54330,25933,N,20093,54331,54332,N,N,54333,54334, 25932,54323,12655,N,N,18028,25935,N,N,54335,25942,25936,25943,N,N,N,N,54336, 54337,25939,N,N,54338,N,54339,N,N,N,18299,54340,54341,15434,25941,54342,25938, 25944,25937,N,N,15684,54343,54344,N,N,19237,54345,54346,15692,54347,N,25940, 25952,54348,N,25948,54349,25951,N,25949,25953,25947,N,25921,16467,54350,N, 18507,N,25950,54351,54352,25945,54353,N,N,16673,14162,N,15659,54354,N,54355,N, 54356,N,16165,16694,25956,N,54357,25958,25959,N,N,25955,25957,54358,N,54359, 54360,N,N,54361,25946,25954,N,25962,25961,54362,N,19322,54363,54364,14123,N,N, 54365,N,N,N,N,54366,25960,N,25964,25963,25967,54367,25969,N,54368,15164,25965, N,N,54369,54370,25970,25971,54371,N,25972,54372,25978,17723,25974,54373,25973, 25975,25976,54374,25977,N,54375,N,54376,25979,25980,54377,54378,13388,N,25981, N,25982,54380,54379,54381,54382,54383,N,N,N,54384,54385,26145,N,54386,N,N,N,N, 26146,26147,26148,54387,26149,26150,54388,54389,26152,26151,N,N,26153,N,N, 54390,54391,54392,N,26154,26155,54393,N,54394,54395,54396,54397,26158,26156, 26157,14945,14163,N,54398,17238,N,18483,54561,15728,N,N,18253,N,18541,26159, 22637,N,N,N,54562,54563,54564,54565,N,26160,26162,N,19813,26161,26164,26163,N, 19795,54566,26165,54567,18558,54568,54569,54570,N,N,26166,N,54571,54572,N,N, 26169,N,54573,26168,26167,N,N,54574,54575,26170,14130,N,54576,N,16674,13633, 54577,N,N,54578,26174,26171,N,N,26172,N,54579,N,26175,N,26176,26173,N,N,54580, 12585,N,54581,54582,12839,N,54583,N,26178,26179,N,54584,N,26180,N,19810,N, 54585,54586,N,N,15660,N,26182,26181,N,N,N,N,N,54587,N,N,N,54588,16233,26183,N, 54589,N,54590,26184,N,54591,26185,N,13413,54592,N,54593,54594,13389,N,54595, 26186,N,N,N,N,N,26187,54596,19293,19811,54597,54598,54599,19796,20279,N,14669, 26190,15444,26189,54600,54601,N,54602,26191,15401,54603,54604,54605,16977, 54606,26192,54607,54608,14668,54609,19543,26193,26194,N,N,26195,54610,54611, 54612,54613,26196,N,N,54614,N,54615,N,26197,N,N,N,54616,N,54617,N,54618,N,N, 15402,54619,54620,19565,54621,N,54622,54623,26199,54624,17215,54625,26198, 54626,N,N,N,54627,N,26201,N,N,N,26200,N,N,N,N,N,N,N,26202,N,N,N,16443,N,26203, N,26204,N,N,N,19001,26205,54628,16751,26206,N,54629,N,54630,N,26207,N,N,N,N, 54631,N,20094,26210,54632,26209,26208,17456,54633,26211,16166,N,26212,N,N,N, 26213,20280,26214,N,54634,N,N,26215,26217,26216,18469,54635,18041,N,20286, 18473,N,54636,N,N,N,N,26219,N,N,15955,N,18730,N,26220,26218,54637,13390,54638, N,N,14420,15208,N,N,18542,54639,54640,N,14378,19267,54641,26223,26221,N,14670, N,14671,12393,N,14952,N,N,N,54642,54643,18265,N,N,N,N,N,N,N,N,12383,26228,N, 17216,N,54644,N,N,N,18264,54645,16987,54646,N,N,54647,N,54648,54649,26230, 54650,54651,26226,26229,26224,N,26227,19238,N,54652,14421,N,N,12413,26225,N,N, N,N,N,N,N,54653,54654,26232,54817,26233,54818,54819,17977,N,54820,N,13883, 54821,54822,N,26406,18237,54823,15209,54824,N,13884,16456,20294,19502,26231, 16468,54825,N,N,N,N,N,N,N,N,N,N,54826,54827,54828,N,13651,26234,54829,N,54830, N,54831,N,N,26236,54832,N,N,54833,N,26235,N,N,54834,N,N,26237,54835,17190,N, 18238,N,54836,N,N,N,17457,54837,N,54838,N,26403,N,N,N,N,N,N,54839,26402,54840, N,N,54841,26238,54842,N,16213,N,18789,26405,54843,26404,14672,20307,N,54844,N, N,N,N,N,N,N,26421,54845,54846,N,N,N,26409,26410,54847,54848,54849,N,15472,N, 54850,26408,54851,14712,26407,N,N,26411,N,N,54852,17458,18978,16675,N,N,N,N, 16988,26415,54853,26416,26412,54855,54856,54857,N,26413,N,26414,54858,N,N, 54859,14673,54854,N,N,26422,N,26418,54860,N,54861,N,18790,54862,19308,18728, 54863,N,26417,N,54864,26420,26419,N,N,N,19268,26423,N,N,N,N,54865,N,26424,N, 54866,16695,54867,26425,N,N,26427,N,26431,54868,N,26428,26426,18239,26429,N, 26430,54870,N,54871,12850,N,26437,26432,54872,54869,N,26433,54873,54874,N, 26434,N,16929,N,54875,N,54876,26436,26435,26438,54877,N,54878,54879,26439, 26440,54880,N,16195,54881,12905,N,26441,20055,N,15403,54882,54883,15661,N,N, 54884,54885,54886,15210,17239,54887,54888,N,54889,54890,26442,26443,12593, 54891,26444,54892,54893,26445,26446,54894,N,26447,N,26448,13885,23082,26449,N, 16485,26450,15435,54895,26451,N,20528,54896,54897,N,26452,19038,13404,54898, 54899,16676,15704,54900,18801,15662,N,54901,54902,N,N,N,N,N,54903,26453,14674, 26454,18508,N,26468,N,N,N,54904,26456,54905,16969,18293,14399,26455,16677, 54906,N,N,N,N,N,26457,N,N,54907,54908,54909,54910,17530,N,N,N,55073,N,N,55074, 55075,N,55076,N,N,N,N,55077,N,26459,26458,26461,N,55078,26460,N,26462,55079,N, 26464,55080,26463,N,13391,55081,26465,N,26466,26467,N,55082,14897,20041,N, 26469,16167,N,55083,N,12656,26470,26471,N,N,55084,N,55085,26472,55086,55087, 55088,N,55089,55090,N,N,55091,N,55092,55093,12402,N,26473,55094,N,N,55095, 26474,N,55096,N,55097,N,55098,18791,55099,55100,N,15431,N,26476,55101,55102,N, 55103,55104,13097,12338,55105,55106,55107,55108,26475,26478,18254,55109,16196, 55110,12886,55111,19239,55112,N,N,55113,14173,13916,55114,26477,55115,12906, 55116,55117,N,N,N,N,N,13347,55118,N,N,N,N,N,N,N,N,N,55119,12657,26482,20074, 16989,55120,N,18756,N,26494,55121,12887,26492,N,26490,26481,55122,26479,55123, 26480,55124,15459,13932,17271,55125,N,55126,18001,N,55127,N,55128,N,12625,N, 26484,26483,N,55129,55130,N,26489,26485,26488,N,55131,55132,55133,55134,19536, 26487,12888,13181,26491,55135,55136,26493,55137,55138,N,N,14164,N,N,N,N,N,N,N, 26659,26668,26669,N,N,55140,12331,55141,55142,55143,N,55144,55145,26676,N,N,N, N,12401,N,N,26667,55146,55147,55148,26666,55149,26661,26660,55150,26658,26657, 17251,55151,17019,26663,55152,N,55153,55154,N,N,26662,N,55155,55156,55157, 26665,N,55158,N,16752,14165,N,N,55159,55160,12609,26664,55161,14675,55358, 55139,55162,55163,55164,16753,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 55165,N,N,26682,N,26683,N,12889,55166,N,N,12846,26680,55329,N,55330,55331,N, 55332,N,55333,26670,55334,26678,N,26685,26679,N,N,55335,26677,N,N,N,55336, 26486,55337,55338,26675,N,55339,55340,26671,55341,55342,55343,13392,26673, 26684,N,26674,N,N,N,55344,55345,26686,55346,26672,18300,55347,55372,N,N,N, 19817,N,N,N,26681,N,N,N,N,N,N,N,26703,55348,55349,55350,26695,N,N,N,16251,N, 55351,N,55352,13638,N,13917,N,26690,55353,55354,55355,N,12891,55356,N,15956,N, 26693,N,N,N,14938,55357,N,17745,26698,N,N,N,N,N,N,N,55359,19054,55360,26689,N, N,N,12890,14422,18729,26699,N,26687,N,55361,26696,55362,55363,N,26706,55364, 26691,55365,N,26692,17978,N,55366,26697,N,N,55367,26694,19240,26700,12384, 55368,N,55369,N,26688,N,55370,N,N,N,55371,N,N,N,N,N,N,26702,N,26701,N,N,N,N,N, N,18283,26708,N,26719,N,N,55373,N,13182,N,N,N,26722,N,N,26704,55374,N,N,26709, 19822,N,N,N,N,N,N,N,55375,26718,55376,55377,19797,55378,N,N,55379,20010,55380, N,55381,55382,N,N,N,55383,17272,55384,55385,55386,13163,55387,N,N,N,55388, 18802,26724,17953,55389,55390,12337,55391,N,26717,55392,26713,16754,26707, 26715,26720,55393,18220,N,55394,55395,12330,55396,26712,55397,26721,18808,N, 55398,55399,N,N,N,55400,26716,N,26711,55401,N,N,N,N,N,15957,N,N,N,N,15663,N, 55402,55403,15404,55404,N,N,N,19544,N,N,18759,N,55405,26727,N,26736,N,N,N,N, 55406,N,55407,55408,55409,N,N,26714,N,55410,N,55411,13175,N,55412,N,N,N,15992, 26725,55413,26730,16755,55414,55415,26726,55416,26733,55417,N,17247,N,26734, 55418,55419,19798,26723,13112,55420,26729,N,55421,26732,19500,N,55422,N,N, 26735,N,N,26728,26731,N,55585,N,N,N,N,N,N,N,N,N,N,55586,N,N,55587,N,19241,N, 20257,55588,55589,55590,55591,N,26739,N,N,55592,N,N,55594,55595,26746,55596,N, 26738,15427,N,55597,55598,N,N,26705,55599,N,N,N,N,55600,N,55601,N,55602,19022, N,19490,26745,26744,N,26740,26741,N,12598,N,55603,N,55604,26743,N,26737,55605, 55606,55607,55608,17493,55609,N,N,55610,55611,26742,12414,N,55612,N,N,55593, 55613,55614,16930,55615,N,N,N,N,N,N,19011,N,55616,26747,26913,N,18521,N,N, 55617,N,26750,15958,15433,26915,N,N,13886,55618,55619,55620,55621,55622,N, 26916,55623,18809,26749,55624,26710,N,55625,55626,55627,55628,55629,55630, 55631,26748,55632,N,N,N,20303,17954,18803,55633,N,26923,N,55634,N,N,N,N,N,N,N, 26929,N,55635,55636,55637,N,55638,26930,55639,26917,55640,N,N,18294,55641, 55642,26927,26919,55643,26921,55644,55645,N,N,55646,26931,26920,N,55647,26924, N,N,12658,55648,18021,N,26925,26928,55649,N,55650,55651,N,55652,N,26918,55653, 16678,55654,26922,15143,16197,14128,19572,55668,19577,15730,N,N,N,N,55655,N, 55656,55657,55658,26935,26933,N,55659,55660,55661,55662,N,20302,55663,N,N,N,N, 55664,N,26932,55665,55666,N,19829,55667,26934,26936,N,N,N,N,26937,N,N,55669,N, 55670,N,26940,26938,N,55671,55672,N,N,N,17955,26939,55673,N,55674,18509,26926, N,N,55675,N,N,N,N,N,55676,N,N,55677,15731,N,26941,26946,16756,55678,N,26945, 55841,55842,N,26914,N,55843,55844,26947,16713,N,N,26942,26944,N,55845,55846,N, 55847,55848,55849,26943,N,N,23857,23842,55850,55851,26949,55852,N,N,55853,N,N, 55854,26948,N,N,N,N,55855,N,55856,N,N,N,19830,N,25148,26950,N,N,N,N,N,55857,N, 55858,N,55859,N,55860,55861,N,26951,55862,47206,55863,N,N,N,55864,N,N,N,N,N,N, 26952,14423,N,13652,N,55865,55866,26954,20829,55867,55868,55869,55870,13685,N, 20026,55871,13939,26955,55872,55873,55874,55875,55876,N,N,26956,N,55877,N, 17262,55878,N,N,55879,N,26957,N,N,N,55880,55881,55882,N,18042,55883,12346,N,N, N,N,N,N,N,N,N,N,N,N,55917,N,12899,26962,26963,55884,N,N,N,55885,N,26958,N, 15165,55886,N,55887,N,55888,N,55889,N,N,N,N,55890,N,26959,18242,N,55891,55892, 55893,26960,26961,26971,N,55894,N,26965,26968,55895,N,55896,55897,55898,26964, 55899,55900,55901,N,N,N,N,N,55902,55903,55904,N,55905,26966,55906,26967,15448, N,26969,N,17217,N,14166,13122,N,N,55907,55908,N,26972,55909,N,55910,N,13119, 55911,26977,55912,N,26973,26976,55913,N,N,55914,18490,55915,N,55916,N,26974,N, N,26975,18760,18522,26978,N,N,N,N,N,N,N,N,17021,26988,55918,26984,55919,55920, 12907,26982,N,19242,26983,55921,55922,26980,55923,26981,26986,26989,55924,N, 26987,55925,55926,55927,26985,26979,55928,55929,N,N,N,17240,55930,26996,N, 19498,N,55931,55932,N,55933,N,55934,N,26994,N,N,56097,26995,N,N,N,N,56098, 56099,N,56100,56101,N,26990,N,N,26992,N,56102,56103,26993,56104,56105,56106, 26991,56107,N,N,56108,N,56109,N,N,N,16486,N,20281,27000,56110,27001,N,N,N,N, 27169,N,16170,N,27003,56111,27006,N,N,N,56112,N,26998,26997,56113,N,27170, 56114,56115,12892,N,27004,N,27171,N,N,N,27005,56116,N,56117,56118,N,27002,N, 17459,N,26999,N,N,56119,N,N,N,18280,N,N,27175,56120,56121,56122,56123,56124, 56125,56126,N,56127,56128,19771,N,N,56129,N,N,56130,N,56131,N,56132,56133, 56134,N,N,N,N,56135,27174,56136,N,27173,56137,N,N,N,56138,N,N,N,27182,56139, 56140,56141,27176,N,56142,N,27184,N,56143,N,N,N,N,19814,27187,N,27178,56144, 56145,27179,56146,N,N,27183,N,27186,27185,56147,56148,56149,27177,N,N,56150,N, 27180,N,27197,N,N,56151,56152,N,N,56153,56154,N,56155,N,N,56156,27190,N,56157, 56158,56159,N,N,N,N,N,56160,56161,N,56162,N,27188,N,56163,27189,56164,N,N, 27194,27195,56165,13098,56166,13634,N,N,27193,56167,56168,N,56169,N,27172, 56170,N,N,56171,56172,56173,N,27192,27196,27191,56174,27198,56176,56177,56178, 27200,27199,N,56179,56175,56180,56181,56182,N,56183,56184,N,27202,27201,26970, N,N,N,27206,56185,N,N,N,N,56186,56187,N,56188,27203,56189,N,N,56190,27204,N,N, 27205,56353,27207,56354,N,N,N,14188,56355,27209,56356,27208,56357,15664,N, 56358,56359,56360,56361,14676,24103,56362,N,N,56363,27210,15697,N,56364,56365, 13113,56366,27211,56367,12626,56368,15959,27212,56369,56370,14677,27213,12385, 56371,N,N,N,18749,56372,N,27214,N,N,N,N,16234,56373,27221,N,N,27218,N,17263,N, 56374,N,56375,N,27219,27216,13918,56376,27215,27222,N,N,N,N,N,14134,N,N,16990, N,27228,N,N,N,N,27224,N,N,N,16949,27223,56377,27226,56378,56379,56380,N,27217, 56381,56382,N,27227,N,27229,N,N,N,56383,N,56384,18543,N,N,27225,N,27230,27232, N,N,14419,27220,N,12353,N,N,56385,N,N,56386,56387,27231,56388,14939,20086, 27233,27234,16757,N,N,N,N,56389,56390,56391,56392,56393,20002,N,56394,56395, 56396,27235,19765,N,N,27236,27237,N,56397,19044,27238,56398,14912,N,20003,N,N, N,N,N,56399,27243,N,N,N,N,N,N,56400,56401,56402,27244,15960,27242,56403,N, 56404,19815,27239,N,N,27241,16445,16254,56405,27240,N,27245,N,56406,18979,N,N, 27247,N,27246,56407,56408,56409,13164,N,19243,27248,N,56410,56411,N,56412, 56413,56414,N,56415,27260,27250,N,56416,N,N,N,N,27251,56417,56418,56419,N, 27252,27253,N,N,N,N,56420,56421,56422,N,N,56423,27257,N,27258,56424,56425, 27256,N,N,56426,N,56427,27254,56428,27249,27255,56429,56430,N,N,56431,N,N, 27259,28727,N,56432,N,N,56433,N,N,N,12840,56434,N,N,56435,56436,56437,N,27262, 13919,27261,56438,56439,56440,27426,N,27425,N,N,N,27428,56441,N,27427,56442, 27429,56443,N,15665,56444,27430,56445,N,27431,N,N,56446,56609,56610,56611, 27432,16446,N,19799,N,27433,N,N,18980,18246,27434,56612,27435,14379,N,56613,N, 13612,56614,N,N,27436,56615,56616,15211,18241,27437,N,13136,56617,56618,N,N, 56619,56620,27438,N,N,N,56621,27440,19831,N,27439,16198,N,27441,N,N,27442, 56622,N,27443,13393,56623,56624,56625,56626,N,N,27444,N,56627,27445,N,27446, 27447,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,13137,N,56628,56629,56630,56631,56632, N,27448,N,27449,27450,N,N,N,N,N,12914,N,56633,16168,27451,N,56634,N,56635,N, 56636,N,N,N,56637,N,56638,27452,N,56639,N,27453,56640,N,N,N,56641,N,56642, 14400,N,17531,27454,56643,56644,N,56645,14167,N,16214,N,27457,N,17956,56646, 27456,56647,56648,14129,56649,56650,27455,17015,13613,N,N,27458,N,27459,56651, 15961,56652,N,56653,14189,56654,27460,56655,N,N,N,19244,56656,56657,16479,N, 56658,N,13686,N,19573,16714,56659,27461,56660,N,N,16199,17264,15962,56661, 56662,N,56663,27462,N,56664,N,56665,27465,56666,27466,56667,N,N,N,56668,56669, N,14910,16962,27464,56670,15963,18750,56671,56672,56673,N,N,27463,56674,56675, 15212,N,12627,56676,27470,14168,N,56677,15214,56678,N,15213,N,20301,27469, 27468,16679,N,13645,20291,13114,15964,N,56679,56680,56681,N,56682,56683,56684, 27467,N,56685,56686,56687,N,27472,56688,27473,27471,56689,14424,N,19776,N, 56690,15215,18215,N,56691,56692,27476,56693,16448,N,17218,56694,56695,19766, 56696,27479,N,N,N,14444,56697,16447,27475,N,27480,14445,27477,27478,56698, 27474,56699,N,N,16482,17993,56700,56701,17199,N,12893,56702,N,N,56865,56866,N, 18544,N,56867,13635,N,56868,17460,N,N,27483,56869,27481,N,56870,17228,56871, 56872,56873,16449,13394,27482,N,16219,N,56874,20042,56875,56876,56877,20288, 56878,N,N,27484,27495,17461,56879,27494,56880,27491,27499,27492,N,27488,N, 17532,27487,N,N,N,27485,56881,19745,15216,N,56882,27489,N,27486,56883,56884, 56885,27493,15732,N,14401,N,56886,N,17018,56887,19269,12634,12386,N,17957, 56888,56889,27497,N,N,56895,56890,27496,N,18022,N,27501,56891,N,N,27490,N, 27500,27502,N,14380,27498,14678,56892,15445,56893,56894,27503,19800,N,N,N,N, 27506,N,27509,N,N,27507,18741,56896,N,N,56897,N,N,27504,N,N,N,56898,N,13920,N, N,56899,N,27508,N,N,27510,56900,56901,56902,56903,56904,N,56905,27514,N,N, 27511,56910,27513,27512,N,N,56906,56907,56908,N,27515,N,15409,56909,27517, 27516,18792,N,56911,27681,N,N,N,56912,N,N,14169,N,N,N,N,27518,27682,56913,N, 27683,13636,26177,15993,N,27684,N,56914,14446,56915,56916,N,N,56917,27685, 56918,N,27686,56919,N,15166,56920,56921,N,N,N,N,23118,56922,27687,56923,27688, 56924,15666,N,27689,27690,56925,56926,27691,N,N,27692,27693,N,56927,N,56928, 56929,17195,56930,56931,27694,N,N,56932,56933,27696,N,27695,N,N,N,56934,17958, 56935,27697,56936,19245,56937,27698,N,27699,56938,27700,56939,N,56940,56941, 27701,N,56942,56943,56946,18010,56944,N,56945,N,N,N,15965,27702,56947,56948,N, 56949,N,56950,56951,14699,20526,27703,56952,N,N,N,N,N,56953,N,56954,56955,N, 27704,18751,27705,56956,27713,N,56957,N,N,N,27706,N,N,27708,56958,57121,N, 27707,27709,57122,19270,27710,27711,N,57123,N,57124,57125,27712,N,N,N,27714, 57126,N,57127,57128,13101,17511,N,18793,14946,14679,N,57129,N,N,18767,12895, 18510,27717,13395,16469,27716,27721,17273,19555,N,27719,27720,13614,N,27722, 18275,16991,57130,57131,18545,17725,27718,N,19271,12908,27724,20264,17474, 20293,57132,57133,15217,27723,57134,16945,57135,N,27740,16680,57136,N,18040,N, 18768,N,57138,57137,N,N,57139,27727,15167,15218,57140,15966,N,18277,57141, 14381,27726,27725,N,18794,N,57142,N,15425,N,57143,17746,N,57144,57145,N,57146, N,N,57147,N,57148,57149,N,27729,27730,14680,27728,57150,57151,57152,N,57153, 27731,27732,N,27734,16931,57154,27733,13414,N,27736,N,27735,27737,N,57155, 27739,27741,N,27742,57156,N,N,N,57157,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,16470,57158,15439,27743,N,57159,N,13138,57160,27744, 57161,N,16758,27745,N,27746,18795,N,N,13615,N,N,N,N,N,N,N,57162,N,27747,57163, N,57164,17462,N,N,57165,N,12635,N,N,57166,N,N,57167,57168,N,N,N,57169,N,N,N, 27748,N,N,N,N,57170,57171,57172,N,N,15473,N,N,57173,N,16246,N,N,57174,57175,N, N,57176,N,N,57177,16941,N,57178,N,57179,N,57180,27751,57181,57199,N,27750,N, 57182,N,27749,N,N,57183,57184,57185,57186,N,57187,27757,27755,N,57188,27752,N, 57189,N,N,57190,57191,27754,57192,N,57193,27753,27756,N,13687,N,27760,N,16471, N,27761,57194,57195,N,57196,14425,N,27758,27759,57197,N,N,20265,57198,57200, 57201,17463,57202,16681,N,N,N,N,N,N,27762,57203,N,27765,57204,N,N,57205,57206, 57207,N,27763,27764,19801,57208,N,N,N,17959,27768,57209,N,N,57210,N,57211,N,N, N,N,N,N,27766,27767,27769,57212,57213,57214,57377,N,N,57378,57379,N,N,27945,N, N,N,N,N,27772,57380,N,57381,27773,27771,57382,57383,57384,57385,N,N,N,57386,N, N,57387,57388,27770,N,17533,N,N,27937,27941,27938,27774,57389,27939,57390, 57391,57392,27940,N,N,N,57393,27947,N,N,N,27942,N,57394,57395,57396,57397, 16472,27944,57398,57399,27946,27943,N,N,N,N,57400,N,N,57401,57402,N,57403, 57404,57405,27949,N,15667,N,27948,N,N,57406,57407,57408,27950,N,N,N,N,27951, 57409,57410,27954,27953,N,27952,N,57411,27956,27955,N,19574,N,N,57412,27958, 57413,27957,27959,57414,N,N,N,27960,57415,57416,N,57417,57418,N,N,27962,57419, N,N,N,N,57420,N,57421,27961,16200,27963,57422,57423,13933,27964,27966,N,57424, N,57425,N,N,N,N,57426,57427,N,N,27967,N,57428,57429,N,57430,57431,27968,27965, 57432,27969,N,15446,27970,13616,14131,N,57433,N,57434,14382,N,57435,N,N,N,N,N, N,27971,57436,N,N,18032,N,N,17726,27972,N,N,N,N,57437,N,N,27975,N,57444,57438, N,57439,57440,N,N,N,N,N,57441,15412,57442,57443,27974,27973,14170,27976,57445, N,57446,13139,N,27978,N,57447,57448,14940,27977,N,27986,N,N,57449,57450,N, 27980,27982,19045,27979,57451,57452,57453,27981,N,27985,27983,13617,57454, 27984,57455,57456,N,57457,N,57458,27987,57459,57460,18266,20056,N,57461,57462, 57463,15668,N,N,N,27988,57464,57465,57466,57467,19746,27990,57468,27989,N,N, 27993,19777,57469,57470,27992,57633,13165,27991,27996,57634,N,27995,N,N,27994, 17714,27997,57635,N,57636,57637,57638,57639,57640,N,27998,57641,N,N,N,27999, 57642,57643,14700,N,14117,28000,28001,28002,57644,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 16201,28003,57645,15405,28004,57646,57647,N,28005,57648,57649,57650,21025, 20862,N,N,N,N,28006,25968,28007,17188,16171,18240,N,N,57651,57652,28008,57653, N,19029,17492,14718,N,57654,17193,57655,57656,12586,N,19320,16215,57657,N,N,N, 57658,57659,N,57660,14174,N,57661,13921,57662,57663,19030,57664,N,N,N,N,28009, N,N,N,N,N,57665,N,28011,57666,57667,28010,12896,N,57668,18038,28012,18295,N, 17715,57669,28013,15698,57670,N,N,28015,57671,57672,19522,28030,28017,28018, 57673,N,17481,57674,16992,16759,57675,17960,57676,28016,13653,N,57677,N,N, 28025,57678,28022,28197,17961,17248,28019,N,17534,17747,28020,28024,16224, 57679,18279,17484,57680,N,16450,28023,16942,16932,28021,12329,20258,N,N,N, 28026,57681,57682,57684,N,57685,57686,16993,57683,N,15669,16202,57687,57688, 28028,28027,57689,12399,28029,N,N,18735,N,28199,57690,N,18011,16235,57691, 57692,17241,N,13944,N,28198,19767,12607,57693,19031,12897,28193,28194,28195, 28196,17979,17187,12387,28200,N,28201,29731,N,57694,16957,57695,28202,N,12659, 16716,57696,14383,N,19802,57697,57698,28203,17708,N,N,57699,16760,15447,28204, 57700,N,28207,N,57701,15717,28205,16683,16682,57702,12388,N,20043,28209,N, 18546,28211,28210,28208,25444,13396,57703,N,28014,57704,28213,28212,57705, 57706,N,57707,28214,57708,19768,N,N,N,57709,N,57710,57711,57712,N,57713,N,N,N, N,57714,57715,57716,18017,N,57717,19246,N,28215,N,15449,N,N,N,N,28216,57718, 28217,57719,57720,57721,28218,57722,N,17697,N,N,N,N,57723,57725,N,N,12394,N, 57726,57889,57890,N,57891,57892,N,14681,N,57724,N,20282,N,N,N,57901,N,N,57893, N,57894,57895,57896,N,28222,57897,57898,N,57899,N,14132,28219,N,28220,57900,N, N,18804,N,N,57903,N,13140,N,57904,57905,N,N,N,57906,19769,57902,13887,N,N,N,N, N,17748,57907,57908,57909,N,28223,N,57910,57911,57912,N,57913,N,N,N,N,57914,N, N,57915,N,28224,N,57916,N,57917,57918,57919,28225,57920,N,57921,N,57922,N, 57923,N,57925,57926,N,57924,N,57927,N,57928,N,N,N,17698,57929,57930,28227, 57931,28226,N,57932,N,57933,57934,N,57935,57936,N,57937,57938,N,N,N,N,N,57939, N,N,N,57940,57941,18003,28228,15670,15456,18267,17265,57942,N,N,15474,57943, 16236,N,28229,57944,28230,57945,57946,57947,N,N,N,N,N,57948,16221,28231,57949, 28232,N,57950,N,28233,19823,N,15671,57951,N,N,N,N,28235,28234,57952,14682,N, 14707,15168,57953,57954,57955,N,N,N,N,N,57956,28238,57957,N,57958,57959,15718, N,28237,57960,28236,N,17001,57961,N,14447,57962,16451,57963,57964,57965,N, 18480,57966,N,N,N,15673,N,57967,N,N,57968,28239,N,15967,N,57969,N,57970,N, 28242,28240,57971,57972,57973,28241,57974,57975,57976,57977,28244,28243,57978, N,15994,N,28245,57979,57980,57981,N,57982,28246,28247,58145,58146,N,58147, 18512,14931,15457,28248,N,28249,20004,15685,19566,20044,28250,13922,N,58148, 58149,N,28251,58150,17699,58151,58152,28254,13176,16203,58153,28252,N,28253,N, 17504,58154,58155,19285,13948,N,58156,58157,N,58158,58159,58160,58161,58162, 58163,N,N,N,28256,28257,58164,N,58165,N,58166,28255,58167,N,28259,58168,58169, N,N,58170,58171,58172,58173,N,58174,58175,N,58176,18015,13123,N,58177,28263, 58178,58179,28260,28262,58180,N,58181,N,N,N,58182,58183,28258,N,N,N,N,58184, 58185,58186,58187,N,58188,28495,N,N,28261,N,58189,58190,58191,N,N,58192,20075, 58193,58194,14426,58195,58196,58197,N,58198,N,58199,28271,58200,N,58201,58202, 17716,28266,58203,58204,28269,28267,58205,28272,N,58206,58207,58208,28273, 58209,N,N,N,N,N,28265,58210,58211,28278,12660,58212,58213,28264,N,58214,58215, 18477,N,28268,58216,15968,58217,58218,58219,N,N,N,N,58220,58221,58222,14683,N, N,N,58223,58224,58225,58226,58227,N,58228,58229,58230,19272,58231,13924,N,N, 15686,N,17980,N,N,58232,58233,58234,N,N,58235,58236,N,N,16685,58237,28276,N, 28270,28275,58238,19523,58401,17464,28277,28274,N,N,58402,58403,N,N,N,58404, 58405,N,58406,58407,N,N,58408,N,16684,N,58409,N,N,58410,N,N,N,58411,28281, 58412,28280,58413,58414,58415,58416,N,58417,58418,58419,58420,58421,N,58422, 58423,58424,58425,N,N,58426,58427,58428,58429,28279,58430,N,19247,58431,N, 58432,N,58433,58434,58435,N,N,58436,58437,N,58438,58439,58440,N,58441,15739, 58442,N,58443,58444,28282,19039,N,58445,12628,58446,N,58447,N,18758,17266,N,N, N,N,13688,58448,28284,58449,14685,N,N,58450,58451,N,58452,N,N,N,15148,N,58453, N,N,N,N,58454,N,28283,16237,58455,N,N,58456,58457,N,N,16238,28449,28451,N, 58458,58459,58460,58461,15995,58462,28450,28452,58463,58464,13907,58465,18757, 58466,58467,15458,20259,N,28286,14968,N,N,20287,58468,58469,28454,58470,58471, N,N,28453,28455,N,N,N,N,N,N,N,N,28285,N,N,58472,58473,58474,N,18025,N,17749,N, N,58475,58476,58477,N,17495,58478,28460,58479,58480,N,58481,17219,28456,N, 58482,N,28457,N,N,N,58483,58484,N,58485,N,58486,58487,N,14125,58488,28459, 58489,58490,58491,N,58492,58493,14384,58494,N,N,N,58657,N,28458,58658,15969, 58659,58660,58661,58662,N,N,N,N,N,58663,N,58664,58665,13177,58666,N,58667,N,N, 58668,N,28464,58669,14911,16761,58670,N,17482,58671,N,N,58672,N,N,58673,N, 58674,58675,N,58676,13115,58677,58683,N,58678,28462,28463,17475,N,28461,N,N,N, 58679,58680,58681,N,N,28465,58682,N,N,N,N,N,N,58684,N,28471,58685,58686,58687, 58688,28474,58689,58690,58691,58692,58693,N,N,28473,17709,N,58694,N,N,28466, 28467,28470,58695,N,N,58696,28472,58697,58698,N,13888,58699,N,28475,28469, 58700,58701,28468,N,N,N,N,N,N,N,N,N,N,N,N,N,N,58703,58704,58702,58705,58706,N, 58707,58708,58709,28479,58710,N,N,28480,58711,58712,N,N,N,58713,58714,58715, 28481,N,N,28478,28477,58716,58717,58718,15970,17962,28476,N,N,N,N,58719,N, 28485,N,N,N,N,N,N,N,N,N,28483,N,N,58720,58721,N,58722,58723,58724,58725,28484, 28482,N,17016,N,28486,58726,N,58728,N,58727,N,28487,N,58729,28489,58730,N,N, 58731,N,58732,N,58733,N,N,N,N,13397,28488,19578,N,58734,N,N,N,58735,28500, 28490,58736,N,28493,58737,28491,58738,28492,58739,N,N,N,N,58740,N,28494,58741, N,58742,58743,58744,28496,58745,58746,N,N,28497,N,28498,N,N,N,N,28501,28499, 28502,28504,N,28503,N,58748,58747,17465,58749,58750,N,N,N,N,58913,N,19559,N, 28505,16686,58914,N,N,28506,58915,19012,28507,13099,58916,58917,58918,12604,N, 13399,N,13398,28508,N,28509,N,28510,28511,N,N,N,58919,58920,58921,28512,58922, 13400,13141,14686,18486,58923,28514,28513,58924,N,58925,58926,28515,N,N,N,N, 12636,N,58927,N,58928,N,N,28518,58929,28517,28516,58930,28519,58931,N,N,N, 28522,N,N,58932,12359,58933,58934,28520,58935,28524,28523,N,N,58936,58937, 58938,58939,28526,28525,28527,N,17966,58940,58941,N,28528,58942,58943,58944, 58945,28529,28531,N,58946,28530,58947,18796,58948,58949,N,N,28532,58950,N, 58951,58952,58953,N,28533,N,14949,N,58954,N,28534,28535,N,58955,19273,58956,N, N,N,58957,58958,58959,58960,16715,58961,58962,N,12324,16971,58963,28536,N, 18797,N,N,N,N,N,N,28539,28537,14687,N,28538,14402,N,58964,N,58965,N,58966, 58967,58968,N,N,19013,28541,28705,28542,28706,N,58969,12577,16216,15740,13401, 28707,N,N,N,18278,N,28709,N,58970,N,12578,N,28708,17476,58971,20045,17963, 28540,20006,N,14385,58972,58973,19803,58974,58975,N,58976,58977,58978,58979, 13945,20020,N,14120,58980,16994,26401,N,28710,13100,16239,N,58981,N,N,13142, 28712,58982,28713,28711,14180,58983,14941,15971,58984,N,58985,12579,N,N,20057, 58986,58987,58988,28715,28206,58989,28714,N,N,N,58990,58991,28718,28716,28717, 58992,28719,N,28720,20076,28721,28722,58993,16457,18491,N,N,N,16253,13415,N,N, 19770,12909,15672,14427,N,28725,58994,28724,15219,28726,28723,N,N,15144,58995, N,N,28730,27181,N,58997,21078,58998,16247,28728,58999,59000,59001,N,N,20005, 18033,N,N,N,N,12587,59002,16483,15414,N,N,N,59003,18999,59004,12608,N,N,N, 20077,19819,N,28731,59005,17733,15483,N,59006,59169,28732,59170,28733,16204, 28734,59171,20078,N,N,28729,28736,28738,N,28737,N,28735,N,N,28739,N,N,28740, 59172,59173,16762,59174,12898,N,N,59175,59176,59177,28741,N,N,19512,59178,N, 28742,N,N,N,N,N,28743,59179,20266,59180,N,N,N,N,23345,28744,N,N,N,28745,28746, N,N,59181,28750,59182,28747,N,28748,N,28749,28751,59183,N,N,N,59184,59185,N,N, 16452,N,N,59186,19575,59187,59188,16453,59189,59190,28752,N,18547,N,28753, 29523,19532,59191,28754,N,28755,59192,28756,13143,59193,28758,N,16217,59194,N, N,28759,N,59195,14116,N,59196,59197,59198,28760,28764,59199,28762,59200,N, 59201,59202,28763,N,N,13171,28761,28765,N,N,59203,N,28766,N,12360,N,28767, 28768,N,N,N,N,59204,59205,59206,15972,59207,59208,N,28769,N,59209,59210,13639, N,59211,28772,N,N,28771,N,28770,N,N,27505,59212,19036,59213,N,N,59214,59215, 28773,28774,59216,59217,N,59218,59219,59220,N,59221,N,59222,59223,N,59224,N, 28775,59225,59226,28776,59227,28777,59228,59229,28778,59230,59231,59232,N, 59233,59234,N,13402,59235,N,N,59236,59237,59238,N,59242,28779,59239,59240,N, 59241,59243,N,N,59244,N,N,N,N,N,N,N,N,28780,18211,59245,N,59246,28782,12859, 59247,28785,28784,59248,59249,N,59250,12580,N,N,N,13889,19015,17466,14882,N, 14688,15719,59251,16220,N,59252,N,28787,59254,59255,28786,19778,13416,18514, 18012,59256,N,59257,16252,20046,59253,14171,N,59258,N,59259,N,59260,28790,N, 59261,28789,59432,59262,N,N,N,N,59425,19275,17964,59426,59427,59428,N,59429, 59430,12624,59431,N,28791,28788,N,N,18769,19818,28792,59433,N,N,N,N,N,59434,N, 28793,59435,N,N,59436,28795,17002,13147,13148,28794,N,59437,59438,59439,13417, 14386,59440,59441,13418,59442,59443,17727,N,N,20064,N,N,N,59444,59445,N,59446, 59447,14428,N,N,59448,28796,59449,N,N,28797,28798,28961,N,28963,28962,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,18807,N,28964,59450,N,59451,59452,28965,59453,28966,N,N,59454, N,28967,59455,59456,N,59457,59458,N,N,N,59459,N,N,59460,28969,28968,59461, 28970,N,59462,N,N,N,59463,N,N,N,N,N,N,N,N,N,N,N,N,N,N,18548,26188,N,N,16169,N, 59464,13618,59465,N,59466,59467,59468,N,28971,59469,28972,N,21036,23867,18515, N,N,12411,59470,12347,N,59471,N,N,N,N,N,15220,19248,15998,59472,28973,N,19551, N,59473,59474,28974,19804,N,12610,N,N,N,15169,59475,28975,12910,28976,59476, 59477,59478,28977,N,59479,59480,59481,28979,28980,59482,28982,28978,59483,N, 28981,N,59484,59485,13403,N,N,59486,28983,N,28984,N,N,59487,59488,59489,59490, 59491,N,N,N,59492,59493,59494,59495,28985,28986,N,59496,59497,28987,N,N,28989, 59498,59499,59500,28988,N,28991,28994,59501,59502,N,28990,28992,28993,N,59503, 28995,N,13890,59504,59505,N,59506,59507,N,59508,59509,59510,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,15475,28996,28997,14689,N,59511,N,59512,N,59513,N,N,N,N,N,28998, 59514,N,13118,N,N,N,18255,28999,29000,N,59515,59516,59517,17242,18027,59518,N, N,N,59681,59682,N,29001,59683,N,59684,N,18301,N,59685,16972,12632,13934,N, 13935,59686,N,N,N,N,N,N,17267,29006,13936,59687,59688,12911,N,N,29005,59689, 59690,29003,59691,29004,59692,29002,N,N,29016,N,N,N,N,59693,N,N,59694,59695, 59696,29007,29008,N,59697,29009,29010,N,59698,59699,N,N,29012,59700,N,29011,N, 59701,59702,15705,29013,59703,59704,59705,29015,N,N,N,N,N,59706,59707,N,13619, 29014,59708,59709,16763,14387,N,N,59710,N,N,29017,N,N,N,N,59711,N,59712,N, 59713,59714,59715,N,N,59716,16973,N,N,29018,N,59717,59718,N,17965,N,N,59719,N, 59720,59721,29019,59722,N,N,N,N,N,29024,N,29022,59724,29021,29023,59725,29020, N,59723,N,N,59726,59727,59728,29026,59729,N,N,59730,N,N,59731,29025,59732, 29028,N,N,13891,29027,N,59733,N,29029,N,N,29030,N,29032,29031,N,N,N,29033, 29035,29034,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,14716,N,59734,N,59735, 29036,59736,59737,29037,N,59738,N,59739,59740,59741,N,13116,59742,N,59743, 29038,N,59744,59745,29039,59746,N,59747,16241,N,59748,N,59749,N,N,N,N,N,59750, 29040,59751,29041,59752,29042,29043,59753,59754,59755,14690,N,N,59756,59757,N, 29044,29045,59758,N,29046,29047,59759,59760,29048,59761,N,59762,18481,29050, 59763,18726,29051,29049,N,29053,59764,59765,29052,59766,N,29054,N,59767,59768, 29217,N,59769,N,59770,59771,59772,59773,59774,59937,59938,29218,N,59939,59940, N,59941,59942,59943,59944,N,59945,N,59946,N,N,N,59947,N,29219,59948,29220, 59949,59950,N,N,29221,59951,N,29222,29223,N,29224,59952,29225,29226,29227, 29228,59953,N,59954,29229,29230,N,23861,29231,59955,59956,59957,N,59958,N, 59959,59960,25720,13620,59961,N,N,N,13089,14898,29233,29232,19493,N,N,59962,N, N,59963,59964,29235,29236,29234,N,29237,N,N,19298,59965,59966,59967,29238,N, 13691,59968,N,N,59969,N,N,59970,N,59971,N,59972,59973,N,59974,N,59975,59976, 59977,59978,59979,20261,N,N,N,59980,29239,59981,N,59982,59983,59984,N,N,N,N,N, 59985,59986,N,N,29241,59987,59988,59989,59990,N,59991,59992,59993,N,59994, 12350,59995,59996,29242,18987,29240,59997,N,29243,29244,N,N,59998,N,N,59999, 60000,29245,29246,N,N,N,N,N,60001,60002,29247,60003,19310,15149,60004,14970, 16687,N,60005,60006,60007,N,29248,N,N,60008,60009,29251,N,60010,60011,N,60012, 60013,29249,60014,N,N,N,N,29252,60015,60016,14449,29250,N,N,N,60017,29253, 60018,29254,29255,N,29259,N,15146,60019,60020,N,N,16996,N,60021,N,60022,N, 29260,29257,29256,29258,60023,N,60024,14175,N,60025,60026,N,N,N,60027,29264, 29263,29262,60028,N,12339,N,60029,60030,60193,60194,N,N,60195,N,60196,60197,N, 60198,N,29274,N,29270,N,29271,29267,29273,60199,29269,13154,N,60200,20300, 60201,29272,29268,29266,29265,60202,N,60203,60204,60205,29276,60206,N,60207,N, N,29279,60208,60209,29278,29277,60210,60211,60212,60213,60214,N,N,18761,29275, 12403,29280,60215,29282,N,N,60216,60217,60218,N,13167,29261,12599,N,60219, 29284,N,N,60220,N,60221,60222,60223,29283,29281,17197,60224,60225,N,N,N,60226, 60227,60228,N,19312,60229,60230,N,60231,20058,60232,N,29285,60233,60240,60234, 60235,60236,29286,N,N,60237,N,N,N,29287,60242,60238,60239,60241,N,N,60243,N, 60244,N,60245,N,N,60246,29288,60247,29289,N,N,60248,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,17467,60249,29290,N,18487,N,29295,29291,N,N,N, 29292,N,60250,19249,19524,N,18000,60251,N,60252,60254,29296,N,N,29297,17982, 29294,29293,N,60253,N,N,12842,N,N,60255,29305,N,N,29304,N,60256,60257,N,N, 12661,60258,60259,60260,29302,N,N,N,29301,N,N,29299,N,13179,N,29298,15410, 12841,N,N,60261,60262,N,60263,60264,60265,N,N,N,N,N,60266,14691,60267,60269, 29308,29307,N,29306,60270,60271,29303,60268,29309,60272,29310,N,60273,N,N,N,N, N,29477,29476,N,60274,60275,N,N,N,N,29478,N,N,12589,29473,29474,60276,14708, 19513,60278,60277,29475,60279,N,N,N,60280,60281,60282,19250,N,N,29483,60283,N, 29479,N,N,N,60284,60285,N,N,29484,60286,60449,N,60450,N,N,N,N,60451,60452,N, 60453,29481,N,29480,60454,N,N,60455,60456,14172,N,N,60457,60458,N,60459,60460, 60461,60462,N,29485,N,N,N,N,N,N,60463,N,N,29486,N,N,N,N,29487,60464,29482, 60465,N,60466,29300,N,60467,29488,N,17505,60468,N,N,29492,60469,29493,29491, 60470,N,N,60471,N,29490,29496,60472,29489,N,29494,60473,N,60474,60475,N,N,N,N, 29495,N,N,N,29498,60476,60477,60478,60479,N,29497,60480,N,N,N,60481,60482, 60483,N,N,N,N,60484,29500,60485,N,60486,N,60487,N,29501,60488,29502,60489,N, 20297,60490,60491,N,N,N,29499,17003,14957,N,N,29503,60492,60494,N,N,N,N,60495, N,N,60493,N,N,N,60496,N,60497,60498,60499,N,N,60500,60501,N,N,60502,29504, 29505,60503,60504,29506,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29507,N,N,14388,29508,60505,60506, 60507,29509,N,15407,60508,29510,60509,60510,60511,60512,N,60513,29511,N,N, 29512,29513,N,60514,60515,N,29516,29514,20284,N,29515,60516,20079,60517,N,N, 60518,N,29517,60519,20059,N,N,N,N,60520,29518,18302,N,60521,29519,29521,N, 60522,29522,60523,60524,60525,N,N,60526,60527,60528,N,N,29520,14701,19533, 19299,22135,N,23904,19323,N,N,N,N,12843,N,60529,N,60530,N,N,60531,29524,13648, 29525,29526,29527,N,14709,N,29528,60532,N,N,24660,19547,N,16995,29529,29531, 29530,60533,29532,N,N,N,60534,29533,N,60535,29534,N,N,N,60536,60537,60538, 29535,60539,60540,60541,N,29536,60542,29537,29538,60705,29539,N,29540,29541, 29542,N,60706,60707,60708,N,N,N,29543,29544,60709,N,N,N,N,17700,60710,60711, 60712,60713,14429,60714,29546,60715,60716,N,60717,60718,60719,N,N,N,60720, 16717,29547,60721,N,N,N,60722,N,N,N,60723,60724,29548,N,N,60725,N,60726,60727, N,60728,N,N,60729,N,60730,60731,18721,60732,60733,29549,60734,N,60735,N,60736, 60737,60738,60739,60740,N,N,29550,25399,N,N,27738,28781,N,N,29551,60741,29552, 60742,60743,60744,60745,N,60746,N,N,60747,60748,29554,29555,29556,20080,29553, N,N,29557,29558,60749,60750,29560,N,29559,60751,60752,60753,60754,60755,29562, 60756,N,60757,29563,29561,N,N,60758,N,N,60759,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 20022,N,60760,60761,60762,60763,N,60764,29564,60765,60766,N,N,N,N,29565,25428, 60767,N,29566,60768,60769,60770,N,60771,8490,N,8564,8560,8563,8565,N,8522, 8523,8566,8540,8484,N,8485,8511,9008,9009,9010,9011,9012,9013,9014,9015,9016, 9017,8487,8488,8547,8545,8548,8489,8567,9025,9026,9027,9028,9029,9030,9031, 9032,9033,9034,9035,9036,9037,9038,9039,9040,9041,9042,9043,9044,9045,9046, 9047,9048,9049,9050,8526,N,8527,8496,8498,8494,9057,9058,9059,9060,9061,9062, 9063,9064,9065,9066,9067,9068,9069,9070,9071,9072,9073,9074,9075,9076,9077, 9078,9079,9080,9081,9082,8528,8515,8529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8497, N,8559, }; static const struct unim_index jisxcommon_encmap[256] = { {__jisxcommon_encmap+0,92,255},{__jisxcommon_encmap+164,0,245},{ __jisxcommon_encmap+410,199,221},{__jisxcommon_encmap+433,132,206},{ __jisxcommon_encmap+508,1,95},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{__jisxcommon_encmap+603,16,59},{__jisxcommon_encmap+647,3,212},{ __jisxcommon_encmap+857,0,165},{__jisxcommon_encmap+1023,18,18},{0,0,0},{ __jisxcommon_encmap+1024,0,239},{__jisxcommon_encmap+1264,5,111},{0,0,0},{0,0, 0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __jisxcommon_encmap+1371,0,254},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisxcommon_encmap+1626,0,255},{ __jisxcommon_encmap+1882,0,255},{__jisxcommon_encmap+2138,0,254},{ __jisxcommon_encmap+2393,0,254},{__jisxcommon_encmap+2648,0,255},{ __jisxcommon_encmap+2904,0,250},{__jisxcommon_encmap+3155,1,255},{ __jisxcommon_encmap+3410,0,255},{__jisxcommon_encmap+3666,5,255},{ __jisxcommon_encmap+3917,0,255},{__jisxcommon_encmap+4173,0,253},{ __jisxcommon_encmap+4427,2,255},{__jisxcommon_encmap+4681,0,253},{ __jisxcommon_encmap+4935,0,255},{__jisxcommon_encmap+5191,1,253},{ __jisxcommon_encmap+5444,1,254},{__jisxcommon_encmap+5698,0,255},{ __jisxcommon_encmap+5954,1,255},{__jisxcommon_encmap+6209,7,253},{ __jisxcommon_encmap+6456,0,255},{__jisxcommon_encmap+6712,0,255},{ __jisxcommon_encmap+6968,1,250},{__jisxcommon_encmap+7218,6,255},{ __jisxcommon_encmap+7468,0,255},{__jisxcommon_encmap+7724,0,255},{ __jisxcommon_encmap+7980,0,255},{__jisxcommon_encmap+8236,2,253},{ __jisxcommon_encmap+8488,0,255},{__jisxcommon_encmap+8744,0,253},{ __jisxcommon_encmap+8998,2,255},{__jisxcommon_encmap+9252,2,244},{ __jisxcommon_encmap+9495,4,252},{__jisxcommon_encmap+9744,0,255},{ __jisxcommon_encmap+10000,1,254},{__jisxcommon_encmap+10254,0,253},{ __jisxcommon_encmap+10508,3,255},{__jisxcommon_encmap+10761,0,254},{ __jisxcommon_encmap+11016,2,255},{__jisxcommon_encmap+11270,0,255},{ __jisxcommon_encmap+11526,3,255},{__jisxcommon_encmap+11779,0,254},{ __jisxcommon_encmap+12034,0,252},{__jisxcommon_encmap+12287,2,255},{ __jisxcommon_encmap+12541,0,252},{__jisxcommon_encmap+12794,0,255},{ __jisxcommon_encmap+13050,2,254},{__jisxcommon_encmap+13303,0,254},{ __jisxcommon_encmap+13558,0,251},{__jisxcommon_encmap+13810,0,158},{ __jisxcommon_encmap+13969,54,255},{__jisxcommon_encmap+14171,0,254},{ __jisxcommon_encmap+14426,2,255},{__jisxcommon_encmap+14680,0,254},{ __jisxcommon_encmap+14935,0,253},{__jisxcommon_encmap+15189,1,255},{ __jisxcommon_encmap+15444,0,255},{__jisxcommon_encmap+15700,0,254},{ __jisxcommon_encmap+15955,0,255},{__jisxcommon_encmap+16211,1,254},{ __jisxcommon_encmap+16465,1,255},{__jisxcommon_encmap+16720,0,255},{ __jisxcommon_encmap+16976,0,159},{__jisxcommon_encmap+17136,55,255},{ __jisxcommon_encmap+17337,1,255},{__jisxcommon_encmap+17592,1,254},{ __jisxcommon_encmap+17846,0,254},{__jisxcommon_encmap+18101,0,255},{ __jisxcommon_encmap+18357,0,255},{__jisxcommon_encmap+18613,0,255},{ __jisxcommon_encmap+18869,0,253},{__jisxcommon_encmap+19123,1,132},{ __jisxcommon_encmap+19255,119,230},{__jisxcommon_encmap+19367,28,251},{ __jisxcommon_encmap+19591,0,255},{__jisxcommon_encmap+19847,1,254},{ __jisxcommon_encmap+20101,2,255},{__jisxcommon_encmap+20355,1,255},{ __jisxcommon_encmap+20610,0,255},{__jisxcommon_encmap+20866,0,249},{ __jisxcommon_encmap+21116,2,254},{__jisxcommon_encmap+21369,2,255},{ __jisxcommon_encmap+21623,2,165},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0, 0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{__jisxcommon_encmap+21787,1,229}, }; static const ucs2_t __cp932ext_decmap[969] = { 65340,65374,8741,65372,8230,8229,8216,8217,8220,8221,65288,65289,12308,12309, 65339,65341,65371,65373,12296,12297,12298,12299,12300,12301,12302,12303,12304, 12305,65291,65293,177,215,U,247,65309,8800,65308,65310,8806,8807,8734,8756, 9794,9792,176,8242,8243,8451,65509,65284,65504,65505,65285,65283,65286,65290, 65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660, 8251,12306,8594,8592,8593,8595,12307,U,U,U,U,U,U,U,U,U,U,U,8712,8715,8838, 8839,8834,8835,8746,8745,U,U,U,U,U,U,U,U,8743,8744,65506,9312,9313,9314,9315, 9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330, 9331,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,U,13129,13076,13090, 13133,13080,13095,13059,13110,13137,13143,13069,13094,13091,13099,13130,13115, 13212,13213,13214,13198,13199,13252,13217,U,U,U,U,U,U,U,U,13179,U,12317,12319, 8470,13261,8481,12964,12965,12966,12967,12968,12849,12850,12857,13182,13181, 13180,8786,8801,8747,8750,8721,8730,8869,8736,8735,8895,8757,8745,8746,32394, 35100,37704,37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193, 20220,20224,20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479, 20510,20550,20592,20546,20628,20724,20696,20810,20836,20893,20926,20972,21013, 21148,21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660, 21642,21673,21759,21894,22361,22373,22444,22472,22471,64015,U,64016,22686, 22706,22795,22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532, 23582,23718,23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353, 24372,24423,24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887, 24880,24984,25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121, 26158,26142,26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362, 26382,63785,26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032, 27106,27184,27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759, 27866,27908,28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199, 28220,28351,28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020, 28998,28999,64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654, 29667,29650,29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063, 30338,30364,30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024, 64024,64025,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072, 32092,32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782, 33864,33972,34131,34137,U,34155,64031,34224,64032,64033,34823,35061,35346, 35383,35449,35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214, 64035,36559,64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357, 37358,37348,37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433, 37479,37543,37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669, 37665,37627,64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880, 37937,37957,37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735, 38737,38741,38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797, 39794,39823,39857,39867,39936,40304,40299,64045,40473,40657,U,U,8560,8561, 8562,8563,8564,8565,8566,8567,8568,8569,65506,65508,65287,65282,8560,8561, 8562,8563,8564,8565,8566,8567,8568,8569,8544,8545,8546,8547,8548,8549,8550, 8551,8552,8553,65506,65508,65287,65282,12849,8470,8481,8757,32394,35100,37704, 37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193,20220,20224, 20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479,20510,20550, 20592,20546,20628,20724,20696,20810,U,20836,20893,20926,20972,21013,21148, 21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660,21642, 21673,21759,21894,22361,22373,22444,22472,22471,64015,64016,22686,22706,22795, 22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532,23582,23718, 23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353,24372,24423, 24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887,24880,24984, 25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121,26158,26142, 26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362,26382,63785, 26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032,27106,27184, 27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759,27866,27908, 28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199,28220,28351, 28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020,28998,28999, 64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654,29667,29650, 29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063,30338,30364, 30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024,64024,64025, U,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072,32092, 32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782,33864, 33972,34131,34137,34155,64031,34224,64032,64033,34823,35061,35346,35383,35449, 35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214,64035,36559, 64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357,37358,37348, 37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433,37479,37543, 37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669,37665,37627, 64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880,37937,37957, 37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735,38737,38741, 38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797,39794,39823, 39857,39867,39936,40304,40299,64045,40473,40657, }; static const struct dbcs_index cp932ext_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{__cp932ext_decmap+0,95,202},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{__cp932ext_decmap+108,64,156},{0,0,0},{0,0,0},{0,0,0},{0,0, 0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{__cp932ext_decmap+201,64,252},{__cp932ext_decmap+390,64,252},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __cp932ext_decmap+579,64,252},{__cp932ext_decmap+768,64,252},{ __cp932ext_decmap+957,64,75},{0,0,0},{0,0,0},{0,0,0}, }; static const DBCHAR __cp932ext_encmap[9686] = { 34690,N,N,N,N,N,N,N,N,N,N,34692,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 34644,34645,34646,34647,34648,34649,34650,34651,34652,34653,N,N,N,N,N,N,61167, 61168,61169,61170,61171,61172,61173,61174,61175,61176,34708,N,N,N,N,N,N,N,N,N, N,N,N,N,34712,N,N,N,N,N,33121,N,N,N,N,N,N,N,N,34707,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,34713,34624,34625,34626,34627,34628,34629,34630, 34631,34632,34633,34634,34635,34636,34637,34638,34639,34640,34641,34642,34643, 34688,N,34689,34698,34699,N,N,N,N,N,N,34700,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,34693,34694,34695,34696,34697,34661,N,N,N,N,N,N,N,N,N, 34665,N,N,N,N,N,N,34656,N,N,N,34659,N,N,N,N,N,N,N,N,N,34657,34667,N,N,34666, 34660,N,N,N,34668,N,N,N,N,N,N,N,N,N,N,34662,N,N,N,N,34670,N,N,N,N,N,N,N,N,N,N, N,N,N,34655,34669,N,N,34658,N,N,N,34663,N,N,N,N,N,34664,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34686,34703,34702,34701,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,34674,34675,N,N,N,N,N,N,N,N,N,N,N,N,34671,34672,34673, N,N,34677,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 34676,N,N,N,N,N,N,N,N,34691,60748,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,60749,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60750, 60751,N,N,60752,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60753,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,60754,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60756,N,N,N,N,N,N,N, 60755,N,60758,N,N,N,N,N,60757,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60741,N,N,N,60759,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,60762,60763,N,N,N,60761,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,60760,N,60766,N,N,N,60764,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60765,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60767,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,60769,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,60768,60770,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60771,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,60772,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,60773,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60774,60775,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,60776,N,N,N,N,N,N,N,N,N,60777,N,N,N,N,N,N,N,N,61019,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,60778,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60779, 60780,N,N,N,N,N,N,60781,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,60782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,60783,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 60784,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60785,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 60786,60789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60788,N,N,N,N,N,N,N,N,N,N,N,N, 60790,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,60791,60792,60793,N,N,N,N,N,N,N,N,N,N,N,60794,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60795,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60797,60796,60801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,60802,60803,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,60804,N,N,N,N,N,N,N,60805,N,60806,N,N,N,N,N,60807,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,60808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 60809,60810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60811,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60813,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,60814,60815,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60816,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,60817,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60818,60819,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60822,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,60820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60823,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60824,60825,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60826,60827,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,60828,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60747,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60829,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60830,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60831,60832,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60833,N,N, N,N,60834,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,60836,N,N,N,N,N,N,N,N,60835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60838, 60839,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60837,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60841,N, N,N,N,N,N,60840,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60842,60843,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60844,60845,60846,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,60847,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60848,60849,60850,N,N,N,N,N, N,N,N,60853,N,N,N,N,N,N,N,N,N,N,N,60851,N,N,N,N,N,N,N,N,60855,N,N,N,N,N,60856, N,N,N,N,N,N,N,N,N,60854,N,N,60743,N,N,N,N,N,N,N,N,N,60852,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60858,N,60859,N,N,N,N,N,N,N,N,N,N,N,60857,N, N,N,N,N,N,N,N,N,N,N,N,N,60861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,60862,N,N,N,N,N,N,60863,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,60864,N,N,N,N,N,N,N,N,N,N,N,N,60865,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,60866,60746,60867,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60869,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60870,N,N,N,N,60872, 60873,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60874,N,N,N,N,N,N, N,N,N,N,N,N,N,60871,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,60744,N,N,N,N,N,N,60875,60877,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60879,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60880,60881,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60883,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60882,N,N,N,N,N,N,N,60884,N,N,N,N,N,N,N, N,N,N,60885,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60886,N,60887,60888, 60889,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60890,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,60892,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 60891,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,60893,60894,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,60896,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60895,N,N,N,N,N,N,N, N,N,N,N,N,N,N,60897,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60898,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60899,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60901,N,N,N,N,N,60900,N, N,N,60902,60905,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60903,N,N,60906,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60904,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,60907,60908,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60909,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,60910,60911,N,60912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,60913,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60914,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60915,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,60742,60917,N,N,N,N,N,N,N,N,N,N,60916,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,60919,60920,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60918,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60922,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 60923,60924,N,N,N,N,N,N,N,N,N,N,N,N,60992,60993,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60995,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60996,N,N,N,N,N,N,N,N,N,N,N,60997, N,N,N,N,N,N,N,N,61000,N,N,N,60998,N,N,N,N,N,N,N,N,N,N,N,N,60999,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,61002,61001,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,61003,N,N,61005,61004,N,N,N,61006,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61007, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61008,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61009,61010,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60812, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61011,61012,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61015,61013,N,61014,N,N,N,N,N,N,N,61016,61018, 61020,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,61021,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61022,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61023,61024,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,61028,N,N,N,N,N,N,61030,61031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,61032,N,N,N,61034,61035,61037,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61038, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61040,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,61039,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,61041,61042,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60736,61043,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,61044,61046,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61047,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61048,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61049,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61050,61051,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61052,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60740,61053,N,N,N,N, N,61054,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61056,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,61058,61061,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61062,60737,61063,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61064,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61065,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61066,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,61067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,61068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61070, 61071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,61072,61073,N,N,N,61074,61075,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,61076,61078,61081,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,61082,61084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61085,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61087,N,N,61086,N,N,N,61088,N,N,N, N,N,61091,61092,N,N,N,N,N,N,N,61089,61090,61093,N,N,N,61095,N,N,N,N,N,61094,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61102,61096,N,61098,N,N,N,61097,N,N,N,N,N,N,N,N,N,N,N,N,N,61099,N,N,61101,N,N, N,N,N,N,N,61100,N,N,N,N,N,N,N,N,N,N,N,N,N,61103,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61105,61106,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60739,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61104,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61110,N,N,61114,N,61112,N,61108,N,61109, N,N,N,N,N,N,61113,N,N,N,N,N,N,61107,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60745,N, 61117,N,N,N,61120,61122,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61121,61119,N,N,61116,N,N,N,61115,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,60738,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61124,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61123,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61125,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61126,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61127,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,61128,61129,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61130,N,N,61131, 61132,61135,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61136,61137,N,N,N,N,N,N,N,61138, N,N,N,N,N,N,N,61139,N,N,N,N,N,N,N,N,N,61140,N,61141,N,61142,N,N,N,61143,61144, N,N,N,N,N,N,N,N,N,N,N,N,N,61145,61148,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61150,61151,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,61152,N,N,61153,61155,N,N,61154,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,61156,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,61157,N,N,N,N,N,N,N,N,N,61158,61159,61161,N,N,N,N,61160,61163,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61164,60868,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61133,60787,60798,60800,60821,60860,60876,60878, 60921,60994,61017,61025,61026,61027,61029,61033,61036,61045,61057,61059,61060, 61069,61077,61079,61080,61083,61111,61118,61134,61146,61147,61149,61162,61180, N,N,N,N,61179,N,N,N,N,N,33148,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,33119,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,33120,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,33169, 33170,33226,N,61178, }; static const struct unim_index cp932ext_encmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp932ext_encmap+0,22,121},{__cp932ext_encmap +100,17,191},{0,0,0},{__cp932ext_encmap+275,96,115},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __cp932ext_encmap+295,29,31},{0,0,0},{__cp932ext_encmap+298,49,168},{ __cp932ext_encmap+418,3,205},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{__cp932ext_encmap+621,40,252},{__cp932ext_encmap+834,0,255},{ __cp932ext_encmap+1090,30,244},{__cp932ext_encmap+1305,74,236},{ __cp932ext_encmap+1468,21,219},{__cp932ext_encmap+1667,0,221},{ __cp932ext_encmap+1889,138,255},{__cp932ext_encmap+2007,134,134},{0,0,0},{ __cp932ext_encmap+2008,89,200},{__cp932ext_encmap+2120,158,178},{ __cp932ext_encmap+2141,11,186},{0,0,0},{__cp932ext_encmap+2317,86,236},{ __cp932ext_encmap+2468,30,245},{__cp932ext_encmap+2684,39,208},{0,0,0},{ __cp932ext_encmap+2854,33,222},{__cp932ext_encmap+3044,93,242},{ __cp932ext_encmap+3194,17,152},{__cp932ext_encmap+3330,19,166},{ __cp932ext_encmap+3478,245,245},{__cp932ext_encmap+3479,96,206},{ __cp932ext_encmap+3590,78,78},{__cp932ext_encmap+3591,0,251},{ __cp932ext_encmap+3843,14,192},{__cp932ext_encmap+4022,1,207},{ __cp932ext_encmap+4229,104,226},{__cp932ext_encmap+4352,48,228},{ __cp932ext_encmap+4533,214,214},{__cp932ext_encmap+4534,63,218},{ __cp932ext_encmap+4690,4,252},{__cp932ext_encmap+4939,39,191},{ __cp932ext_encmap+5092,136,245},{__cp932ext_encmap+5202,5,187},{ __cp932ext_encmap+5385,4,254},{__cp932ext_encmap+5636,177,190},{ __cp932ext_encmap+5650,36,245},{__cp932ext_encmap+5860,7,159},{ __cp932ext_encmap+6013,1,111},{__cp932ext_encmap+6124,130,166},{ __cp932ext_encmap+6161,70,70},{__cp932ext_encmap+6162,33,122},{ __cp932ext_encmap+6252,48,155},{__cp932ext_encmap+6360,209,235},{ __cp932ext_encmap+6387,158,158},{0,0,0},{__cp932ext_encmap+6388,72,214},{ __cp932ext_encmap+6531,82,138},{__cp932ext_encmap+6588,71,161},{0,0,0},{0,0,0 },{0,0,0},{__cp932ext_encmap+6679,1,246},{__cp932ext_encmap+6925,72,220},{ __cp932ext_encmap+7074,83,176},{0,0,0},{0,0,0},{__cp932ext_encmap+7168,7,245}, {__cp932ext_encmap+7407,28,28},{__cp932ext_encmap+7408,18,246},{ __cp932ext_encmap+7637,83,127},{__cp932ext_encmap+7682,240,244},{ __cp932ext_encmap+7687,18,118},{__cp932ext_encmap+7788,207,207},{0,0,0},{ __cp932ext_encmap+7789,103,222},{__cp932ext_encmap+7909,21,238},{ __cp932ext_encmap+8127,6,255},{__cp932ext_encmap+8377,2,248},{ __cp932ext_encmap+8624,49,72},{__cp932ext_encmap+8648,146,146},{ __cp932ext_encmap+8649,157,175},{__cp932ext_encmap+8668,51,85},{ __cp932ext_encmap+8703,87,101},{__cp932ext_encmap+8718,39,158},{ __cp932ext_encmap+8838,78,220},{__cp932ext_encmap+8981,114,187},{ __cp932ext_encmap+9055,0,0},{__cp932ext_encmap+9056,107,112},{ __cp932ext_encmap+9062,25,209},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp932ext_encmap+9247 ,41,220},{__cp932ext_encmap+9427,14,45},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __cp932ext_encmap+9459,2,228}, }; static const ucs2_t __jisx0213_1_bmp_decmap[2197] = { 65287,65282,65293,126,12339,12340,12341,12347,12348,12543,12447,U,U,U,U,U,U,U, U,8836,8837,8842,8843,8713,8709,8965,8966,U,U,U,U,U,U,U,8853,8854,8855,8741, 8742,10629,10630,12312,12313,12310,12311,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,8802, 8771,8773,8776,8822,8823,8596,U,U,U,U,U,U,U,U,9838,9835,9836,9833,9655,9654, 9665,9664,8599,8600,8598,8601,8644,8680,8678,8679,8681,10548,10549,U,U,U,U,U, U,U,U,U,U,10687,9673,12349,65094,65093,9702,8226,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,8723,8501,8463,13259,8467,8487,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12448,8211,10746,10747,12363,U,12365,U,12367,U, 12369,U,12371,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12436,12437, 12438,12459,U,12461,U,12463,U,12465,U,12467,U,U,U,U,U,U,U,12475,U,U,U,U,U,U,U, U,12484,U,U,U,12488,9828,9824,9826,9830,9825,9829,9831,9827,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,962,9461,9462,9463,9464,9465,9466,9467,9468, 9469,9470,9750,9751,12320,9742,9728,9729,9730,9731,9832,9649,12784,12785, 12786,12787,12788,12789,12790,12791,12792,12793,U,12794,12795,12796,12797, 12798,12799,9150,9151,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162, 9163,9164,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, 12535,12536,12537,12538,8922,8923,8531,8532,8533,10003,8984,9251,9166,12881, 12882,12883,12884,12885,12886,12887,12888,12889,12890,12891,12892,12893,12894, 12895,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988, 12989,12990,12991,U,U,U,U,U,U,U,U,9680,9681,9682,9683,8252,8263,8264,8265,461, 462,464,7742,7743,504,505,465,466,468,470,472,474,476,8364,160,161,164,166, 169,170,171,173,174,175,178,179,183,184,185,186,187,188,189,190,191,192,193, 194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212, 213,214,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232, 233,234,235,236,237,238,239,240,241,242,243,244,245,246,248,249,250,251,252, 253,254,255,256,298,362,274,332,257,299,363,275,333,260,728,321,317,346,352, 350,356,377,381,379,261,731,322,318,347,711,353,351,357,378,733,382,380,340, 258,313,262,268,280,282,270,323,327,336,344,366,368,354,341,259,314,263,269, 281,283,271,273,324,328,337,345,367,369,355,729,264,284,292,308,348,364,265, 285,293,309,349,365,625,651,638,643,658,620,622,633,648,598,627,637,642,656, 635,621,607,626,669,654,609,331,624,641,295,661,660,614,664,450,595,599,644, 608,403,339,338,616,649,600,629,601,604,606,592,623,650,612,652,596,593,594, 653,613,674,673,597,657,634,615,602,U,509,8048,8049,U,U,U,U,U,U,U,U,8050,8051, 865,712,716,720,721,774,8255,779,769,772,768,783,780,770,741,742,743,744,745, U,U,805,812,825,796,799,800,776,829,809,815,734,804,816,828,820,797,798,792, 793,810,826,827,771,794,10102,10103,10104,10105,10106,10107,10108,10109,10110, 10111,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,8560,8561,8562,8563, 8564,8565,8566,8567,8568,8569,8570,8571,9424,9425,9426,9427,9428,9429,9430, 9431,9432,9433,9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445, 9446,9447,9448,9449,13008,13009,13010,13011,13012,13013,13014,13015,13016, 13017,13018,13019,13020,13021,13022,13023,13024,13025,13026,13027,13050,13033, 13029,13037,13036,U,U,U,U,U,U,U,U,U,8273,8258,9312,9313,9314,9315,9316,9317, 9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,8544, 8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,13129,13076,13090,13133, 13080,13095,13059,13110,13137,13143,13069,13094,13091,13099,13130,13115,13212, 13213,13214,13198,13199,13252,13217,8555,U,U,U,U,U,U,U,13179,12317,12319,8470, 13261,8481,12964,12965,12966,12967,12968,12849,12850,12857,13182,13181,13180, U,U,U,8750,U,U,U,U,8735,8895,U,U,U,10070,9758,20465,U,13314,20008,20015,20016, 20109,20193,20221,20223,20227,20235,20320,20296,20297,20310,20319,20330,20332, 20350,20362,20372,20375,64048,20425,20448,20481,20482,20494,20504,20519,20526, 20544,20539,20545,20628,20684,20722,20688,20710,64049,20742,20739,20747,20766, 20789,20810,64050,20821,20823,13493,20893,20931,20938,20958,20962,20974,20993, 13531,21011,21013,21065,21079,21089,21139,21192,64051,21196,21200,21206,21211, 64052,21232,21243,21248,21255,21276,64053,21345,21347,21373,21395,21405,21426, 21522,21543,21581,21660,21611,21620,21631,21640,21654,21665,21673,21702,21759, 21774,21803,21813,21840,21854,21889,21894,21902,64054,21933,21966,64055,22024, 22030,22075,22089,22134,22118,64056,22127,22129,22130,22169,22174,22185,22188, 22195,22217,22218,22282,U,22305,22319,22323,22324,22384,22391,22396,22428, 64015,U,22456,22471,22472,22479,22500,22509,22517,22518,22527,22537,64016, 22625,22628,64057,22652,22665,22686,64058,22697,U,22738,22734,22740,22746, 22752,22761,22796,34369,22877,22893,22923,22930,22948,22979,22994,23005,23059, 23075,23143,23149,23159,23166,23172,23198,23207,23236,U,23321,23333,21085, 23361,23382,23421,23443,23512,23532,23570,23582,23587,23595,14221,23650,64059, 64060,U,23674,23695,23711,23715,23722,23738,23755,23760,23762,23796,U,14306, 23821,23847,64017,23878,23879,23891,23882,23917,23937,23968,23972,23975,23992, 24011,21534,22099,24034,24084,24088,24152,24158,24254,63784,24267,24313,24320, 24322,24327,24349,24355,24372,24374,24381,24384,24389,24404,24408,24420,24423, 24445,24457,24476,24487,24495,24501,24503,24521,24542,24545,24553,24589,24596, 24600,24627,24629,24647,64061,24733,24734,24779,24788,24789,24797,24824,24860, 24875,24880,24887,64062,24973,64063,25020,25017,64064,25122,25150,25155,25174, 25178,25199,25221,25284,25302,25340,25354,25368,25401,25411,25445,25468,25573, 25581,25589,25616,25620,25634,25721,25681,25696,25709,25806,25790,25791,25796, 25802,25808,25847,25851,25890,25897,64065,25959,26013,64066,26112,26121,26133, 26142,26170,26146,26148,26155,26160,26161,26163,26363,26184,26188,U,26201, 26202,26209,26213,26227,26231,26232,26253,64067,26272,26290,26299,26310,26312, 15138,26331,26344,26362,26387,63785,26419,26470,26439,26440,26491,26497,26515, 26520,26523,26555,26617,26560,26583,26620,26625,26706,26653,26668,26673,26715, 26738,26741,64068,26787,26789,26802,26824,26832,26856,26861,26864,26865,26876, 26890,26953,U,26933,26946,26967,26979,26980,26984,27008,64020,27045,27053, 27087,15286,15299,27106,27113,27114,27125,27126,27151,27157,U,27195,27198, 27205,27216,27222,27227,27243,27251,U,27273,27284,27293,27294,27301,27364, 27367,15375,63773,27419,27422,27436,27445,27462,27478,27488,27493,27495,27511, 27522,27561,27565,63856,27599,27606,27607,27647,27653,27664,27699,27737,27740, 27818,27764,27766,27781,27782,27800,27804,27899,27846,27860,27872,27883,27886, U,27908,27918,27950,27953,27961,27967,27992,28005,64069,28034,28039,28041, 28052,28074,28076,28095,28100,28118,28122,28123,28125,28156,64070,28212,28228, 28252,28254,28331,28337,28353,28359,28366,28432,28442,64071,28458,28463,28467, 28497,28505,28510,28513,28514,28542,28552,28556,28557,28564,28576,28583,28598, 28604,28615,28618,28665,28656,28661,28677,28678,28712,28746,28765,28766,28750, 28772,28789,28805,28836,28843,28855,28884,28888,28900,28943,28971,28958,28960, 28974,28976,28998,28999,29009,64072,29010,29020,29024,29032,64021,29061,29063, 29074,29121,29114,29124,29182,29184,29205,29269,29270,15935,29325,29339,29374, 29376,29435,U,29479,29480,64022,29520,29542,29564,29589,29599,29600,29602, 29606,29611,29641,29647,29654,29657,29667,29673,29703,29706,29722,29723,64074, 29734,29736,29738,29739,29740,29742,29743,29744,29764,29766,29767,29771,29783, 29794,29803,29805,29830,29831,29833,29848,29852,29855,29859,29840,29862,29864, 29865,29877,29887,29896,29897,29914,29951,29953,29975,29999,30063,30073,30098, 16242,30158,30180,30208,30210,30216,30229,30230,30233,30238,30253,30261,30275, 30283,30308,30309,30317,30319,30321,30337,30363,30365,30366,30374,30378,30390, 30405,30412,30414,30420,30438,30449,30460,30474,30489,30516,30518,30534,30541, 30542,30556,30559,30562,30586,30592,30612,30634,30688,30765,30787,30798,30799, 30801,30824,30830,64075,30896,U,30893,30948,30962,30976,30967,31004,31022, 31025,31028,64076,64077,31045,31046,64078,64079,64080,31068,64081,64025,64026, 31097,64082,64083,64027,31128,31153,31160,31176,31178,U,31188,31198,31211, 31213,31235,64084,31289,31325,31341,64085,31365,31392,U,31411,31419,31438, 31467,31485,31506,31533,31547,31559,31566,31584,31597,31599,31602,31646,64086, 31703,31705,31745,31793,31774,31776,31795,31798,16996,U,31833,31853,31865, 31887,31892,31904,31932,31957,31961,31965,32007,32008,32019,32029,32035,32049, 32065,32072,32083,32092,32122,32131,32139,32160,32166,32194,32204,32214,32227, 64087,32296,32264,32273,32277,64089,32327,32338,32353,32394,32397,32583,64090, 32657,32663,32703,32718,32731,32735,32748,32750,32762,64091,32788,32806,32821, 32823,32828,32970,32983,32992,33011,33048,33098,33120,33127,33128,33133,33211, 33226,33231,33239,64092,17491,17499,33376,33396,U,33422,33441,33443,33444, 33449,33454,33463,33470,33471,33478,33493,33533,33534,33536,33537,33634,33570, 33581,33594,33603,33607,33617,33621,33661,33670,33682,33688,33703,33705,33727, 33728,33735,33743,33745,33761,33770,33793,33798,33802,64095,33864,33887,33904, 33907,33925,33950,33967,33972,33978,33984,33986,U,34098,34078,34083,34095, 34137,34148,64031,34221,34170,34188,34191,34210,34224,34251,34254,34285,34322, 34303,34308,34309,34320,U,34328,34345,34360,34391,34395,63798,34402,17821, 34412,34421,34456,34488,34554,34556,34557,34571,34673,34695,34696,34732,34733, 34741,17898,34774,34796,34822,34826,34832,34836,34847,34968,34986,35018,35022, U,35061,35100,64096,35096,35097,35098,35111,35120,35122,35129,35136,35220, 64097,35284,35301,35318,35346,35349,35362,35383,35399,35406,35421,35425,35445, 35449,35495,35536,35551,35572,35574,64034,64098,64099,35654,35668,35673,35689, 35741,35913,35944,64100,36065,36084,36088,36094,64101,36114,36123,36271,36302, 36305,36311,36384,36387,36413,36464,36475,U,36544,18500,36602,36638,36653, 36662,36692,U,36774,36789,36836,36840,36846,36872,36909,64103,37000,37013, 37015,37017,37019,37026,37043,37054,37060,37061,37063,37079,37085,37086,37103, 37108,64038,37140,37141,37142,37154,37155,37159,37167,37169,37172,37181,37192, 37211,37251,37278,37292,37297,37308,37335,37371,37348,37349,37357,37361,37383, 37392,37432,37433,37434,37436,37440,37443,37455,37496,37512,37570,37579,37580, 37587,37600,37631,37636,37663,37665,37669,37704,37705,37706,37732,37733,37738, 37744,37787,37795,37818,37830,37854,37855,37892,37885,37939,37962,37987,37995, 38001,38002,38286,38303,38310,38313,38316,38326,38333,38347,38352,38355,18864, 38362,38366,38488,38532,63964,38557,38564,38565,38610,38622,64104,38633,38639, 38707,38715,38733,38734,38735,38746,38766,38771,38805,38830,38842,38849,38857, 38878,38875,38900,64105,38922,38942,38955,38960,64106,38994,38995,38998,38999, 39001,39002,63952,39013,39020,39098,39112,39143,39256,39326,39426,39427,39460, 39469,39470,39480,39498,39502,39506,39606,39617,39619,39630,39638,39673,39682, 39688,39712,19479,39725,39774,39801,39782,39794,39797,39812,39818,39823,39838, 39847,39873,39886,39909,39928,39933,39936,39971,40001,40015,40016,40019,40035, 40037,40055,40221,40222,40259,40263,40274,40291,40304,40316,40330,40342,40384, 40364,40380,40407,U,40423,40455,40469,40572,40606,40612,40620,40623,40628, 40629,40643,40657,40720,40761,40791,40848,40852,40855,40866,23032,23643,24183, 30246,32363, }; static const struct dbcs_index jisx0213_1_bmp_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_1_bmp_decmap+0,47,125},{ __jisx0213_1_bmp_decmap+79,33,126},{__jisx0213_1_bmp_decmap+173,43,118},{ __jisx0213_1_bmp_decmap+249,43,72},{__jisx0213_1_bmp_decmap+279,57,126},{ __jisx0213_1_bmp_decmap+349,66,126},{__jisx0213_1_bmp_decmap+410,65,124},{ __jisx0213_1_bmp_decmap+470,33,126},{__jisx0213_1_bmp_decmap+564,33,126},{ __jisx0213_1_bmp_decmap+658,33,126},{__jisx0213_1_bmp_decmap+752,33,126},{ __jisx0213_1_bmp_decmap+846,33,126},{__jisx0213_1_bmp_decmap+940,33,126},{ __jisx0213_1_bmp_decmap+1034,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_1_bmp_decmap+ 1128,85,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __jisx0213_1_bmp_decmap+1170,39,126},{__jisx0213_1_bmp_decmap+1258,33,126},{ __jisx0213_1_bmp_decmap+1352,33,126},{__jisx0213_1_bmp_decmap+1446,33,126},{ __jisx0213_1_bmp_decmap+1540,33,125},{__jisx0213_1_bmp_decmap+1633,33,126},{ __jisx0213_1_bmp_decmap+1727,33,126},{__jisx0213_1_bmp_decmap+1821,33,126},{ __jisx0213_1_bmp_decmap+1915,33,126},{__jisx0213_1_bmp_decmap+2009,33,126},{ __jisx0213_1_bmp_decmap+2103,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, }; static const ucs2_t __jisx0213_2_bmp_decmap[2425] = { 19970,19983,19986,20009,20011,20014,20032,20039,20040,U,20049,13318,U,20058, 20073,20125,13356,13358,20153,20155,U,20156,20163,20168,20176,20203,20186, 20209,20213,20224,20246,20324,20279,20286,20308,20312,U,20343,20344,20346, 20349,20354,20357,20370,20378,20454,20402,20414,20421,20427,20431,20434,13418, 20466,20480,20496,20499,20508,20510,20514,13416,20546,20550,20558,20563,20567, 20579,20582,20586,20592,20643,20616,20626,20627,20629,20630,20636,20650,U, 20657,20666,20667,20676,20679,20723,U,20686,U,20692,20697,20705,20713,13458, 20744,U,20759,20763,U,20832,U,20851,20867,20875,13500,20888,20899,20909,13511, 20924,U,U,20979,20980,20994,21010,21014,U,21077,21084,21100,21111,21124,21122, U,21144,U,21156,21158,21167,21178,21179,21194,13599,21201,U,21239,21258,21259, 21284,21301,21310,21314,U,U,21351,21356,21370,21412,21428,U,21431,21440,U, 13661,13662,21461,21466,13667,21492,21493,21589,21540,21544,13678,21571,21602, 21606,21612,21642,21645,21653,21664,21670,21677,21678,21687,21690,21695,21699, U,21740,21743,21745,21747,21760,21761,21769,21820,21825,13734,21831,21834, 13736,21856,21857,21860,U,21885,21890,21896,21905,13765,21970,U,U,21951,21961, 21964,21969,21981,13786,21986,U,21993,22056,U,22023,22032,22064,22071,13812, 22077,22079,22080,22087,22110,22112,22125,13829,22152,22156,22165,22170,22173, 22184,22189,22194,22213,22221,22239,22248,22262,22263,U,22293,22307,U,22313,U, 22341,22342,22348,22349,U,22376,22383,22387,22388,22389,22395,U,U,22444,22426, 22429,22430,22440,22487,U,22476,U,U,22494,22502,22512,13898,22520,22523,22525, 22532,22558,22560,22567,22578,22585,U,22601,22604,22631,22666,22667,22669, 22671,22672,22676,22685,22698,22705,U,22723,22733,22754,22771,22772,22789, 22790,22795,22797,22804,22820,U,13969,22845,13977,22854,13974,U,22875,22879,U, 22901,22902,22908,22943,22958,22972,22984,22989,23006,23011,23012,23015,23022, U,U,14031,23052,23053,23063,23079,23085,23125,23141,23162,23179,23196,23199, 23200,23202,23217,23219,23221,23226,23231,23258,23260,23264,23269,23280,23278, 23285,23296,23304,23319,23348,23341,23372,23378,23400,23407,23420,23423,23425, 23428,23446,23468,14177,23488,14178,23502,23510,14188,14187,23537,23549,14197, 23555,23593,23600,U,23647,23651,23655,23656,23657,23664,U,U,23676,U,U,23688, 23690,14273,U,U,23712,23714,23718,23719,U,23725,23733,U,23753,U,U,23814,23824, 23851,23837,23840,23844,23846,23857,23865,23874,14312,23905,23914,14324,23920, U,14333,23944,14336,23954,23956,23959,23961,23984,23986,23988,U,23993,24017, 24023,24024,24032,U,24036,24041,14383,24064,14390,24082,24085,14400,24095, 24110,24126,24137,14428,24150,14433,24171,24172,24173,24174,U,24229,24234, 24236,24249,24255,24262,24274,24281,U,24317,24328,24334,24348,U,24350,24391, 24419,24434,24446,24463,24482,24484,24504,24516,14586,24519,24523,24530,24531, 24532,24546,24558,24559,24563,24572,14615,24599,24610,24612,14618,24652,24703, 24714,24725,24744,U,24752,24753,24766,24776,24793,24795,24814,24818,24821, 24848,24850,24851,24857,24862,24890,14703,24897,24902,24928,24956,U,24978, 24979,24983,24984,24997,25000,25005,U,25045,25053,25055,25077,U,25109,25123, 25129,25158,25164,25169,25170,25185,25188,25211,25197,25203,25241,25254,25301, U,25341,25347,25357,25360,U,U,25394,25397,25403,25404,25409,25412,25422,U, 25433,U,U,25452,25476,25497,U,25492,25533,25591,25556,25557,25564,25568,25579, 25580,25586,25609,25630,25637,25641,25647,25690,25691,25693,25715,25725,25735, 25745,25757,25759,25803,25804,25813,25815,U,25828,25829,25855,25860,14958, 25871,25876,25878,14963,25886,25906,25924,25940,25963,25978,25985,25988,25989, 25994,26034,26037,26040,26047,26050,26057,26068,15062,26098,26105,26108,26116, 26120,26145,26154,26181,26193,26190,15082,U,26199,26203,26211,U,U,26218,26219, 26220,26221,26235,26240,26256,26258,26265,15118,26285,26289,26293,15130,26303, 15132,26348,15063,26369,26373,26386,U,26393,U,U,26444,26445,26452,26461,U,U,U, 26484,26486,U,26514,U,33635,26640,26544,26546,26563,26568,26578,26585,26587, 26608,26615,U,U,U,26648,26655,26669,U,26675,26683,26686,26692,26693,26697, 26700,26709,26711,15223,26731,26734,26746,26748,26754,26768,26774,15213,26776, 26777,26778,26780,26794,26795,26804,26811,26875,U,U,64019,26819,26821,26828, 26831,26838,26841,26852,26853,26860,26871,26883,26887,15239,15240,U,26939, 15245,26950,26985,26988,26994,27002,27007,27026,15268,27030,27032,27046,27056, 27063,27066,27068,27072,27089,27094,U,U,27184,U,U,27107,27118,27119,27123, 15309,27124,27134,27153,27162,27165,U,27186,27187,27188,27199,27206,27209, 27258,27214,27218,27236,U,27262,27267,27275,15344,27281,27295,27297,U,27307, 27325,27334,27348,27344,27356,27357,U,U,27372,27377,27378,27379,27389,U,27403, 27407,27408,27409,U,27415,15398,27439,27466,27480,27500,27509,27514,27521, 27547,27566,U,27581,27582,27591,27592,27593,27610,27622,27623,27630,27633, 27650,27658,27662,27701,27702,27706,U,27711,27725,27739,27757,27780,27785, 15555,27796,27797,27799,27821,27842,27856,15570,27862,27866,27868,27881,27884, 27885,U,27904,27914,27940,27942,27943,27751,27951,27964,27995,27998,28000, 28016,28032,28033,28042,28045,28049,28056,U,28183,U,U,U,28075,28078,28084, 28098,27956,28104,28110,28111,28112,28127,28137,28150,28214,28190,28194,28199, 15633,28210,28220,28232,28233,28235,28236,28239,28241,28243,28244,28247,28259, 15646,28307,28327,28340,28351,28355,28362,28377,28469,28395,28409,28411,28426, 28428,28440,28453,28470,28476,U,28498,28503,28506,28512,28520,28568,28541, 28560,28566,28606,28575,28581,28591,15716,28597,28616,28617,28634,28638,28649, U,28668,28672,28679,28682,28707,U,28729,28730,28732,28739,28743,28747,15770, 28756,28773,28777,28780,28782,28790,28798,28801,28806,28821,28823,28859,U, 28831,28849,U,28908,28874,28881,28883,28892,28931,28932,28934,28935,28936, 28940,15808,28975,28977,29008,29002,29011,29022,15828,29078,29056,29083,29088, 29090,29102,29103,29107,U,29131,29139,29145,29148,29191,15877,64073,29227, 29236,29240,29241,20012,29250,29267,29271,29283,U,29294,29295,29304,29311, 29326,U,29357,29358,29360,29361,29377,15968,29388,15974,15976,29427,29434, 29447,29458,29464,29465,16003,29497,29484,29489,29491,29501,29522,16020,29547, 29548,U,29550,29551,29553,29559,29569,29573,29578,29588,29592,29596,29598, 29605,29608,29621,29623,29625,29628,29631,29637,29643,29665,29671,29689,29715, 29690,29697,29732,29745,29753,29779,29760,29763,29773,29778,29789,29809,29825, 29829,29832,U,29842,29847,29849,29856,29857,29861,29866,29867,29881,29883, 29882,29910,29912,29918,29935,29931,U,29946,U,29984,29988,29994,16215,U,30013, 30014,30016,30024,30030,30032,30034,30060,30066,30065,30074,30077,30078,30081, U,30092,16245,30114,16247,30128,30135,30143,30144,30150,30159,30163,30173, 30175,30176,30183,30188,30190,30193,30201,30211,30232,30215,30223,16302,U, 30227,30235,30236,U,30245,30248,30268,30259,U,16329,30273,U,30281,30293,16343, 30318,30357,30364,30369,30368,30375,30376,30383,U,30409,U,30440,30444,U,30487, 30490,30509,30517,16441,U,U,30552,30560,30570,U,30578,30588,30589,U,16472, 30618,30623,30626,30628,30633,30686,30687,30692,30694,30698,30700,16531,30704, 30708,30715,U,30725,30726,30729,30733,30745,30753,30764,30791,30820,30826,U, 30858,30868,30884,30877,30878,30879,30907,30920,30924,30926,30933,30944,30945, 30950,30969,30970,30971,30974,U,30992,31003,31024,31013,31035,31050,31064, 31067,16645,31079,31090,31124,31125,31126,31131,31137,31145,31156,31163,31170, 31175,31180,31181,31190,16712,U,U,16719,31242,31249,31253,31259,31262,16739, 31277,31288,31303,31308,31318,31321,31324,31327,31328,31335,31338,31349,31352, 31362,31370,31376,31395,31404,U,16820,31417,31420,31422,16831,31436,31441, 31463,31464,31476,U,U,31495,U,31549,31527,31530,31534,31535,31537,16870,16883, 31615,31553,16878,31573,31609,31588,31590,31593,31603,U,16903,31632,31633, 31643,16910,31663,31669,31676,31685,31690,U,U,31700,31702,31706,31722,31728, 31747,31755,31758,31759,31782,31813,31818,31825,31831,31838,31841,31849,31854, 31855,31856,U,U,U,31910,U,31926,31927,31935,U,31940,U,31944,31949,U,31959,U, 31974,31979,U,31989,32003,32009,17094,32018,32030,U,U,32061,32062,32064,32071, U,U,17110,32089,32090,32106,32112,17117,32127,U,32134,32136,32140,32151,U, 32157,32167,32170,32182,32183,32192,32215,32217,32230,32241,32249,17154,U, 64088,32272,32279,32285,32288,32295,32300,32325,32371,32373,32382,32390,32391, 17195,32401,32408,32410,17219,32572,32571,32574,32579,32580,32591,13505,U, 32594,U,32609,32611,32612,32621,32637,32638,U,32656,20859,U,32662,32668,32685, U,32707,32719,32739,32741,32751,32754,32770,32778,32776,32782,32785,32790, 32804,32812,32816,32835,32870,32881,32885,32891,32921,32924,32932,32935,32952, U,32965,32981,32984,32998,U,33037,33013,33019,17390,33077,33046,33054,17392, 33060,33063,33068,U,33085,17416,33129,17431,33153,17436,33156,33157,17442, 33176,33202,33217,33219,33238,33243,U,33252,U,33260,U,33277,33279,U,33284,U, 33305,33313,33314,U,33330,33332,33340,33350,33353,33349,U,33355,17526,33359, 17530,33367,U,33372,33379,U,64093,64094,33401,17553,33405,33407,33411,33418, 33427,33447,33448,33458,33460,33466,33468,33506,33512,33527,33543,33544,33548, 33620,33563,33565,33584,33596,33604,33623,17598,33663,17620,17587,33677,33684, 33685,33691,33693,33737,33744,33748,33757,33765,33785,33807,33809,33813,U, 33815,33849,33866,33871,33873,33874,33881,33882,33884,U,33893,33910,33912, 33916,33921,17677,34012,33943,33958,33982,17672,33998,33999,34003,U,34023, 34026,34031,34032,34033,34042,34045,34060,34075,34084,34085,34091,34100,34127, 34159,17701,17731,34110,34129,34131,34142,34145,34146,U,34171,34173,34175, 34177,34182,34195,34205,34207,34231,34236,34247,34250,34264,34265,34271,34273, 34278,34294,34304,34321,34334,34337,34340,34343,U,34361,34364,U,34368,64032, 34387,34390,34415,34423,34426,34439,34441,34445,34449,34460,34461,34472,64033, 34481,34483,34497,34499,34513,34517,34519,34531,34534,17848,34565,34567,34574, 34576,34579,34585,34591,34593,34595,34609,34618,34622,34624,34627,34641,34648, 34660,34661,34674,34684,U,U,34727,34697,34699,34707,34720,U,17893,34750,U, 34753,34766,34805,34783,U,34787,34789,34790,34794,34795,34797,34817,34819, 34827,34835,34856,34862,34866,34876,17935,34890,34904,34911,34916,U,U,34921,U, 34927,34976,35004,35005,35006,35008,35026,U,35025,35027,35035,35056,35057, 17985,35073,U,35127,U,35138,35141,35145,U,18021,35170,35200,35209,35216,35231, 35248,35255,35286,35288,35307,18081,35313,35315,35325,35327,18095,35345,35348, U,35361,35381,35390,35397,35405,35416,35502,35472,35511,35518,35543,35580,U, 35594,35589,35597,35612,35615,35629,35651,18188,35665,35678,35702,35711,35713, 35723,35732,35733,35740,35742,35897,U,35901,U,U,35909,35911,35919,35924,35927, 35945,35949,35955,U,35987,35986,35993,18276,35995,36004,36054,36053,36057,U, 36080,36081,U,36105,36110,36204,36228,36245,36262,U,36294,36296,36313,36332, 36364,18429,36349,36358,U,36372,36374,36385,36386,36391,U,18454,36406,36409, 36427,36436,36450,36460,36461,36463,36504,36510,36526,36531,36533,36534,36539, U,36561,36564,18510,36601,U,36608,36616,36631,36651,36672,36682,36696,U,36772, 36788,64102,36790,U,36801,36806,64036,36810,36813,36819,36821,36832,36849, 36853,36859,36866,36876,36919,U,36931,36932,36957,36997,37004,37008,38429, 37025,18613,37040,37046,37059,37064,U,37084,37087,U,37110,37106,37120,37099, 37118,37119,37124,37126,37144,37148,37150,37175,37177,37178,37190,37191,37207, 37209,37217,37220,37236,37241,37253,37262,37288,37294,37299,37302,37315,37316, 37338,U,U,37356,37358,37377,37386,37398,37399,U,37427,37442,37447,37450,37454, 37457,37462,37465,37472,37473,37477,37479,37480,U,U,37500,37501,37503,37513, 37517,37527,37529,37535,37543,37547,U,U,37554,37567,37568,37574,37582,37584, 37591,37593,37605,37607,37649,37623,37625,37627,37634,37645,37653,37661,37662, 37671,37673,U,U,37703,37713,37719,37722,37739,37745,37747,37793,U,U,37768, 37771,37775,37790,37877,U,U,37873,37825,37831,37852,37858,37863,37897,37903, 37910,37911,37883,37938,37940,37947,37957,U,U,37997,37999,38264,38265,38278, 38284,38285,U,38315,38324,U,38344,U,U,38444,38451,38452,U,38460,38465,38497,U, 38530,U,38554,U,18919,38569,38575,38579,38586,38589,18938,U,38616,38618,38621, 18948,38676,38691,18985,38710,38721,38727,38741,38743,38747,38762,U,U,38806, 38810,38814,38818,38833,38834,38846,38860,38865,38868,38872,38873,38881,38897, 38916,38925,38926,38932,38934,19132,U,38947,38962,38963,38949,38983,39014, 39083,39085,39088,U,39095,39096,39099,39100,39103,39106,39111,39115,39136,U, 39137,39139,39141,39146,39152,39153,39155,39176,19259,U,39190,39191,U,39194, 39195,39196,U,39217,39218,39219,39226,39227,39228,39232,39233,39238,39245, 39246,39260,39263,39264,39331,39334,39353,39357,39359,39363,39369,39380,39385, 39390,U,39408,39417,39420,39434,39441,39446,39450,39456,39473,39478,39492, 39500,39512,19394,39599,19402,39607,19410,39609,U,39622,39632,39634,39637, 19432,39644,39648,39653,39657,39683,39692,39696,39698,39702,39708,39723,39731, 39741,19488,39755,39779,39781,39787,39788,39795,39798,39799,39846,39852,39857, U,U,39858,39864,39870,39879,39923,39896,39901,39911,39914,39915,39919,39918,U, 39930,U,39927,U,39958,39960,39961,39962,39965,39970,39975,39977,39978,U,39985, 39990,39991,40005,40028,U,40009,40010,U,40020,40024,40027,40029,40031,40041, 40042,40043,40045,40046,40048,40050,40053,40058,40166,40178,40203,40194,U, 40209,40215,40216,U,19652,U,40242,19665,40258,40266,40287,40290,U,40297,40299, U,40307,40310,40311,40318,40324,40333,40345,40353,40383,40373,40377,40381, 40387,40391,40393,40406,40410,40415,40416,40419,40436,19719,40458,40450,40461, 40473,40476,40477,40571,U,40576,40581,40603,40616,U,40637,U,40671,40679,40686, 40703,40706,19831,40707,40727,40729,40751,40759,40762,40765,40769,40773,40774, 40787,40789,40792,U,40797,U,40809,U,40813,40816,40821, }; static const struct dbcs_index jisx0213_2_bmp_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_bmp_decmap+0,34,126},{0,0,0},{ __jisx0213_2_bmp_decmap+93,33,126},{__jisx0213_2_bmp_decmap+187,33,126},{ __jisx0213_2_bmp_decmap+281,33,125},{0,0,0},{0,0,0},{__jisx0213_2_bmp_decmap+ 374,33,126},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_bmp_decmap+468,33,126},{ __jisx0213_2_bmp_decmap+562,33,126},{__jisx0213_2_bmp_decmap+656,33,126},{ __jisx0213_2_bmp_decmap+750,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __jisx0213_2_bmp_decmap+844,33,126},{__jisx0213_2_bmp_decmap+938,33,126},{ __jisx0213_2_bmp_decmap+1032,33,126},{__jisx0213_2_bmp_decmap+1126,33,126},{ __jisx0213_2_bmp_decmap+1220,34,126},{__jisx0213_2_bmp_decmap+1313,33,126},{ __jisx0213_2_bmp_decmap+1407,33,126},{__jisx0213_2_bmp_decmap+1501,33,126},{ __jisx0213_2_bmp_decmap+1595,33,125},{__jisx0213_2_bmp_decmap+1688,35,126},{ __jisx0213_2_bmp_decmap+1780,33,126},{__jisx0213_2_bmp_decmap+1874,33,125},{ __jisx0213_2_bmp_decmap+1967,34,125},{__jisx0213_2_bmp_decmap+2059,34,126},{ __jisx0213_2_bmp_decmap+2152,33,126},{__jisx0213_2_bmp_decmap+2246,33,126},{ __jisx0213_2_bmp_decmap+2340,33,117},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, }; static const DBCHAR __jisx0213_bmp_encmap[27287] = { 8754,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10530, 10531,N,N,10532,N,10533,N,N,10534,10535,10536,N,10537,10538,10539,N,N,10540, 10541,N,N,N,10542,10543,10544,10545,10546,10547,10548,10549,10550,10551,10552, 10553,10554,10555,10556,10557,10558,10559,10560,10561,10562,10563,10564,10565, 10566,10567,10568,10569,10570,10571,10572,10573,N,10574,10575,10576,10577, 10578,10579,10580,10581,10582,10583,10584,10585,10586,10587,M,10589,10590, 10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602,10603, 10604,N,10605,10606,10607,10608,10609,10610,10611,10612,10613,10618,10810, 10825,10785,10796,10812,10827,10841,10847,N,N,10813,10828,10816,10831,N,10832, 10616,10621,N,N,N,N,10814,10829,10815,10830,10842,10848,N,N,N,N,N,N,10843, 10849,N,10877,N,N,10614,10619,N,N,N,N,N,N,N,N,10844,10850,N,N,N,10811,10826,N, N,10788,10799,N,N,10787,10798,10817,10833,N,N,10818,10834,N,N,10874,10617, 10622,N,N,10819,10835,11051,11050,10809,10824,N,N,10820,10836,10789,10800, 10845,10851,10791,10803,10790,10802,10823,10839,10792,10804,N,N,N,N,10615, 10620,10846,10852,10821,10837,10822,10838,N,N,N,N,N,N,N,10793,10805,10795, 10808,10794,10807,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11049,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 11044,N,N,N,N,N,N,N,N,N,N,10351,10352,N,10353,10358,10359,N,10360,N,10361,N, 10362,N,10363,N,10364,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 10356,10357,N,N,N,11077,11059,11065,11066,11045,M,11071,10862,11046,11054,M,M, N,11057,N,11058,10869,11048,10873,N,N,11062,11068,11042,11074,11052,N,N,N, 10858,10868,10859,11060,10875,10853,10870,10863,N,11055,N,N,N,10860,11073, 10867,N,10864,10855,N,N,10876,10865,10856,11047,N,N,N,10861,11053,11061,10854, M,11067,10872,N,10866,11072,10857,N,11041,10878,N,N,11043,N,N,N,N,10871,N,N,N, 11070,11069,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,10801,11091,N,N,N,11092,N,N,N,11093,11094,N,N,N,N,N,N,10786,10840,N, 10797,N,10806,11121,N,N,N,N,N,N,M,11105,11106,11107,M,11100,11098,11103,11133, 11099,N,11095,N,11117,N,N,11097,11102,N,N,11101,N,N,N,N,N,N,N,N,11128,11129, 11134,N,11114,11126,11127,11115,11116,N,N,N,11122,11111,N,N,N,11119,11130,N, 11112,N,N,11120,11123,N,N,N,11125,N,N,N,N,11113,11131,11132,11124,11118,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11090,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,9817,10354,10355,11078,11079,11088,11089,9084,N,N, N,N,N,N,N,N,N,N,N,N,N,N,9024,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,10347,N,N,11096,N,N,11390,N,N,N,N,10348,10349,10350,N,N,N,N,N,N,N,11389,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,10529,9053,N,N,N,9055,N,N,11618,N,N,N,N,N,N,N,N,N,N,11620, N,N,N,N,N,9056,N,N,N,N,N,N,N,N,N,N,N,N,N,9052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,10104,10105,10106,N,N,N,N,N,N,N,N,N,N,11573,11574, 11575,11576,11577,11578,11579,11580,11581,11582,11583,11607,N,N,N,N,11317, 11318,11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8817,N,8999,8997,8998,9000,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9001,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9003,9004, 9002,9005,8775,N,N,N,8774,N,N,N,N,N,N,N,N,N,9051,N,N,N,N,N,N,N,N,N,N,N,11640, N,N,N,N,N,8788,8789,N,N,N,N,N,N,N,11635,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,8812,N,8813,N,N,8814,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8811, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8815,8816,N,N,N,N,N,N,N,N,N,N,N,N,8770, 8771,N,N,N,N,8772,8773,N,N,N,N,N,N,N,N,N,8785,8786,8787,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11641,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10102,10103,8776,8777,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,10108,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10050,10051,10052,10053,10054,10055, 10056,10057,10058,10059,10060,10061,10062,10063,10064,N,10110,10109,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11553,11554,11555,11556,11557,11558,11559, 11560,11561,11562,11563,11564,11565,11566,11567,11568,11569,11570,11571,11572, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,11329,11330,11331,11332,11333,11334,11335,11336, 11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,11348,11349, 11350,11351,11352,11353,11354,N,11307,11308,11309,11310,11311,11312,11313, 11314,11315,11316,9818,9819,9820,9821,9822,9823,9824,9825,9826,9827,9837,N,N, N,N,8994,8993,N,N,N,N,N,N,N,N,8996,8995,N,N,N,N,N,N,N,9019,N,N,N,N,N,N,10343, 10344,10345,10346,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9023,9832,9833,9834, 9835,N,N,N,N,N,N,N,N,N,N,9831,N,N,N,N,N,N,N,9828,9829,N,N,N,N,N,N,11646,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9786,9789,9787,9792,9785,9790, 9788,9791,9836,8829,N,8827,8828,N,8826,10107,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,11645,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,11297,11298,11299,11300,11301,11302,11303,11304,11305,11306,9006, 9007,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,8790,8791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9018,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,9085,9086,8794,8795,8792,8793,N,N,N,11616,N,11617,9830,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8755,8756,8757,N,N,N,N,N,8758,8759,9020,N,N,N, N,N,N,N,N,N,N,N,N,N,M,N,M,N,M,N,M,N,M,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,9332,9333,9334,N,N,N,N,N,N,N,N,8761,9083,N,N,N,N,N,N,N,N,N,N,M,N,M, N,M,N,M,N,M,N,N,N,N,N,N,N,M,N,N,N,N,N,N,N,N,M,N,N,N,M,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10098, 10099,10100,10101,N,N,N,N,8760,9838,9839,9840,9841,9842,9843,9844,M,9846,9847, 9849,9850,9851,9852,9853,9854,11626,11627,N,N,N,N,N,N,11628,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,10305,10306,10307,10308,10309,10310,10311,10312, 10313,10314,10315,10316,10317,10318,10319,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,11621,11622,11623,11624,11625,N,N,N,N,N,N,N,N,10320, 10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333, 10334,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11355,11356,11357,11358,11359,11360, 11361,11362,11363,11364,11365,11366,11367,11368,11369,11370,11371,11372,11373, 11374,N,11377,N,N,N,11376,N,N,11379,11378,N,N,N,N,N,N,N,N,N,N,N,N,11375,11590, N,N,N,N,N,N,N,N,N,11594,N,N,N,N,N,N,11585,N,N,N,11588,N,N,N,N,N,N,N,N,N,11586, 11596,N,N,11595,11589,N,N,N,11597,N,N,N,N,N,N,N,N,N,N,11591,N,N,N,N,11599,N,N, N,N,N,N,N,N,N,N,N,N,N,11584,11598,N,N,11587,N,N,N,11592,N,N,N,N,N,11593,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11615,11631, 11630,11629,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11603,11604,N,N,N,N,N,N,N,N,N,N,N,N, 11600,11601,11602,N,N,11606,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,11605,N,N,N,N,N,N,9054,N,11619,11811,N,N,N,41261,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41266,N,41267, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41310,N,41302,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41342,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11859,N,N,N,N,N,N,41771,N,N,N,N, 62568,N,N,N,N,N,41775,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11867,41800,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41821,41822,N,N,N,N,41825,N,N,N,N,N,N,N, N,N,N,41831,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42019,N,42022,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,42040,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42050,42058,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42105,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42303,N,N,N,N,42307,N,N,42305,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,42327,43043,43045,N,N,N,N,N,N,N,N,43049,43048,N,N,N,N,N, N,N,N,43052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20319,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,43070,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,20335,N,N,N,N,N,43094,N,N,N,N,N,N,N,N,N,N,N,43097,N,N,N,N,N,N,N,N,43100, 43102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,43119,N,N,N,N,N,N,43121,N,N,N,N,N,N,N,N,N,43124,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43129,N,N,N,N,43131,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44091,44102,N,N,44106, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,44128,44379,N,N,N,N,44383,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 44401,44598,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44412,44590,N,N,N,N,N,N,N,N,N, N,N,44594,N,44596,N,N,N,N,N,30025,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,44653,N,N,N,N,N,N,N,N,N,44645,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,44840,44841,N,N,N,N,44844,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 44852,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30078,N,N,N,N,N,N,N,N,N,N,N,N,30241,N, N,N,N,N,N,N,N,N,44872,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,44893,30266,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44919,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 60987,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60994,61041,N,N,N,N,N,N,N,N,N,N,N,N,61054,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61248,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,61268,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,61296,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61303,61480,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30566,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,61503,N,N,N,N,N,61505,N,61506,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,61513,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61520,61748,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30797,N,N,61766,N,61768,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,61788,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,61799,N,N,N,N,N,N,N,N,N,N,N,N,N,61804,61986,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61997,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 62009,62052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62068,N,N,N, N,N,N,62071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62077,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62259,N,N,N,N,N,N, N,N,N,N,62263,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,62279,N,N,N,N,N,N,N,62283,N,N,N,N,62280,62291,N,N,N,N,N,N,62295,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,31085,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62507,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,62518,N,N,N,N,N,N,62523,62542,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62557,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,62561,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62782,N,62786,62792,N,N, N,N,N,N,N,N,N,N,N,N,N,N,62794,N,N,N,N,62796,N,N,N,N,N,62799,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 31321,N,N,N,N,N,N,N,31322,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 62828,N,N,N,62830,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62839,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63029,N,N,N,N,N,N,N,N, N,N,63026,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63028,63065,N,N,N,N,63060, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63085,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63086,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31569,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63340,N,N,N,N,31584, 63524,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,63546,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,63555,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63566,N, N,N,N,N,N,N,N,N,N,N,N,N,63571,63595,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63785,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63807,63817,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 31819,N,N,N,N,N,N,N,N,N,63836,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64039,32088,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64362,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,64368,64373,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,64376,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64567,64597,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64806,N,N,N,N,N,N,N,64808,N,N,N, N,N,N,N,64810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64817,32318,N,N,N,N,N, N,N,N,64831,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,65066,N,N,N,N,N,N,N,N,N,N,N,N,65069,65099,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65120,41250,N,N,N,N,N, N,N,N,N,N,N,N,41251,N,N,41252,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11812, 41253,N,41254,61486,N,41255,11813,11814,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41256,N, N,N,N,N,N,41257,41258,N,N,N,N,N,N,N,N,41260,N,N,N,N,N,N,N,N,41263,N,N,N,N,N,N, N,N,N,N,N,N,N,N,41264,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,11815,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41265,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41268,N,41269,41271,N,N,N,N,N,N,41272,N,N,N,N, 41273,N,N,N,N,N,N,N,41274,N,N,N,N,N,N,N,N,N,41276,N,N,N,N,N,N,11816,N,N,N,N,N, N,N,N,N,41275,N,N,N,N,N,41277,N,N,N,41278,N,N,N,N,N,N,N,11817,N,11818,41279,N, N,11819,N,N,N,N,N,N,N,11820,N,N,N,N,N,N,N,N,N,N,41280,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41282,N,N,N,N,N,N,41283,N,N,N,N,N,N,N, N,N,11822,11823,N,N,N,N,N,N,N,N,N,N,41284,N,11824,N,41285,N,N,N,N,N,N,11825, 11821,N,N,N,41281,N,N,N,N,N,11826,N,11827,N,N,N,N,N,N,N,N,N,N,41287,41288,N, 41289,N,N,41290,11828,N,N,N,41291,N,N,41292,N,N,N,N,11829,N,N,N,N,N,N,N,41293, N,11830,N,N,11831,N,N,41294,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 41296,N,N,N,N,N,N,N,N,N,N,N,41297,N,N,N,N,N,N,41298,N,N,N,11833,N,41299,N,N,N, 41300,N,N,41301,N,N,N,N,N,N,N,N,N,N,N,N,N,11834,N,N,N,N,N,41295,N,N,N,N,N,N,N, N,N,N,11809,41303,41304,11835,11836,N,N,N,N,N,N,N,N,N,N,N,11837,N,41305,N,N, 41306,N,N,N,N,11838,N,N,N,41307,N,41308,N,N,N,41309,N,N,N,N,11839,N,N,N,N,N,N, 11840,N,N,N,N,N,N,N,N,N,N,N,N,11842,N,N,N,N,11841,11843,41311,N,N,N,41312,N,N, N,N,N,N,N,41313,N,N,N,N,41314,N,N,N,41315,N,N,N,N,N,N,N,N,N,N,N,41316,N,N, 41317,N,N,N,41318,N,N,N,N,N,41319,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,41321,N,N,N,N,N,N,N,N,N,41322,41323,11844,41324,41325,N,N,N,N,N,41326,N,N,N, N,N,N,41320,N,N,N,N,N,N,41327,N,N,N,N,N,N,41329,N,N,N,N,N,N,N,N,41330,41331,N, N,N,N,N,N,N,N,41332,N,N,41333,N,N,N,N,11845,N,41336,N,11847,N,N,N,41338,N,N,N, N,41339,N,N,N,N,N,N,N,41340,N,N,N,N,11848,N,N,41341,N,N,N,N,N,N,N,N,11846, 41334,11851,N,N,11850,N,41761,N,N,11852,N,N,N,N,N,N,N,N,N,N,N,41763,N,N,N, 41764,N,N,11853,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11854,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,11855,N,N,N,N,N,N,N,N,N,N,11857,N,11858,N,N,N,N,N, N,N,N,41766,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41768,N,N,N,N,N,N,N,62580,N,N, N,N,N,N,N,41769,N,N,N,N,N,N,N,41770,N,N,N,N,N,N,N,N,N,N,N,N,41772,N,N,N,N, 11860,N,N,N,N,N,41773,N,N,N,N,N,N,N,N,N,41774,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 41776,N,N,N,N,N,N,11861,N,N,N,N,N,N,11862,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,11863,N,N,N,11864,N,N,N,N,N,N,N,N,N,N,N,11865,N,N,N,N,41779,41780,11866, 41781,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41782,11868,N,11869,41783,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,11870,N,N,N,N,N,N,N,N,N,N,N,41785,N,11871,N,N,N,N,41786,12158,N,N,N, 11872,N,N,N,N,N,N,N,N,N,N,41787,N,N,N,N,N,N,N,N,N,N,41788,N,N,N,N,N,N,N,N,N,N, 41790,N,41789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11873,N,N,N,N,41792,N,N,N,N,N,N,N,N, N,N,N,41794,N,41795,N,N,N,N,N,N,N,N,41796,N,N,N,N,N,N,N,N,N,N,41797,41798,N,N, N,N,N,N,N,N,N,N,N,N,11874,N,41799,N,11876,N,N,N,11877,41801,N,N,N,N,11878,N,N, N,N,11879,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11881,N,N,N,N,N,N,41803,N,N, N,11882,11883,N,N,N,N,N,N,11884,N,N,41804,41805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,11885,N,N,N,N,N,N,N,41806,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41807,N,N,N,N,N,N, N,N,41808,N,N,N,41809,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,11887,N,11888,N,N,N,41812,N,N,N,N,41813,N,N,N,N,N,N,N,N,N,N,N,N,N,41814,N, N,11889,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11890,N,N,N,N,N,N,N,N,N, 11891,N,N,N,N,N,N,41815,N,N,N,N,N,N,N,N,N,N,N,N,N,11892,N,41816,N,N,41818,N,N, N,N,N,N,N,N,41819,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41823,N,N,N,N,41824, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41826,41827,11893,N,N,N,N,N, N,N,N,N,N,N,20350,N,N,N,N,N,41829,N,N,11894,41830,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,41832,N,N,N,N,N,N,N,N,N,11895,N,N,N,N,N,N,N,41828,N,N, N,N,N,N,N,N,N,N,N,N,41833,N,N,N,41834,N,N,N,N,11897,41835,N,N,N,N,N,N,N,11898, N,N,N,N,N,N,N,N,N,N,11899,N,N,N,N,N,N,N,N,11900,N,41836,N,N,41837,N,N,N,N,N,N, N,41838,11901,N,N,N,N,N,11896,N,N,N,41839,11902,N,N,N,N,41840,N,N,12065,N,N,N, 41841,41842,N,N,N,N,N,N,N,N,41843,N,N,41844,N,N,N,N,41845,N,N,N,41846,N,N, 12066,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,41848,N,N,41849,N,41850,N,41851,N,N,N,N,N,N,N,N,N,N,N,12067,41852,41853,N,N, N,N,N,N,N,41854,N,N,N,N,12068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,12069,N,N,N,N,N,N,N,N,N,12070,N,N,N,N,N,N,42017,N,N,N,N,42018,N,N,N,N, N,42020,N,N,42021,N,N,N,N,N,12071,N,N,N,N,N,N,N,N,N,N,N,N,N,12072,N,42023, 42024,N,N,42025,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42027,N,N,N, 12073,42028,N,N,N,12074,N,42029,N,N,N,N,N,12075,N,N,42030,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,12077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 42035,N,N,N,N,N,N,N,N,N,42036,N,N,42037,N,12078,N,N,42038,42032,N,N,N,N,N,N,N, N,N,N,42039,N,N,N,N,42041,N,N,N,N,N,N,42043,42046,12080,N,N,N,N,N,12081,N, 42047,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42044,N,N,N,N,N,N,N,42048, N,N,N,N,N,N,42049,N,N,N,12082,N,42051,N,42052,42053,N,N,N,N,N,N,42054,N,12083, N,N,N,N,N,N,N,N,N,29735,N,N,N,N,N,N,N,N,N,N,42055,N,42056,N,N,N,N,N,12085,N,N, N,N,N,N,42057,N,12087,N,12088,12089,N,N,N,12084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,42059,N,N,N,42060,N,N,N,N,N,N,N,N,42061,N,N,N,12090,42062,N,N,42063,12091, N,N,N,N,N,N,N,N,N,42064,12092,N,N,12093,42065,N,N,N,N,42066,12094,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,42067,N,N,N,12095,12096,N,N,42068,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,42069,N,N,N,N,N,N,N,N,42070,N,N,N,N,N,N,N,N,N,N,N,N,N,42071,42072, 12097,N,N,N,N,N,N,N,N,N,N,42074,N,N,N,N,N,N,N,N,N,N,N,12099,N,42075,N,N,N,N,N, 42077,N,N,N,N,N,12100,N,N,N,12101,12102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42079, 42080,N,N,N,N,N,42081,42082,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,42084,N,N,N,N,N,N,42085,12103,N,N,42086,42087,42088,N,12104,N,N,N,42089, 12105,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42093,N,12106, 42094,42095,N,N,N,N,N,N,N,N,N,42096,N,N,N,42092,N,N,N,N,N,N,N,N,N,N,N,12109,N, N,N,N,N,N,N,N,N,N,N,N,N,N,12110,12111,N,N,N,42099,N,N,12112,N,N,N,N,N,N,N, 42097,N,N,N,N,N,N,42102,N,N,N,N,N,12113,N,42103,N,N,N,N,N,N,12114,N,N,42104,N, N,N,N,12115,12116,N,42106,N,N,42107,N,42108,N,12117,42109,N,N,N,N,12118,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42110,N,42273,N,N,N,N,N,N,42274,N,N,N,N,N,N, N,N,N,N,42275,N,N,N,N,N,N,42276,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42278,N,N,42279, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,12120,N,N,12121,N,N,42280,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,12123,N,N,N,N,N,N,N,N,N,N,N,N,12124,42281,42282,N, 42283,N,42284,42285,N,N,N,42286,N,N,N,N,N,N,N,N,42287,12125,N,N,N,N,N,N,N,N,N, N,12127,42288,N,N,N,N,N,N,42289,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42291,N,N,N, N,N,N,N,N,N,42292,12130,N,N,N,12129,N,12131,N,N,N,N,N,12132,N,N,N,N,N,12133,N, 42293,N,N,N,N,N,N,12134,N,N,N,N,N,N,N,N,N,42294,42295,42296,42297,N,N,N,N, 42298,12135,42299,N,N,N,N,N,N,42300,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42301,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42304,N,N,N,N,N,N,N,N,42306,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42309,N,12137,N,42310,N,N,N,N,N,N,N,N,N,N,N,N, N,12138,N,N,N,N,N,N,N,42312,42313,N,N,N,N,N,42314,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 12139,N,N,N,N,N,N,12140,N,N,N,N,N,N,N,N,N,N,N,N,42315,N,N,N,N,12141,N,N,N,N,N, N,N,N,N,42316,N,N,N,N,N,N,N,N,N,N,N,N,N,42317,N,N,N,N,N,N,12142,N,N,N,N,42318, N,N,N,N,42319,N,N,N,N,12143,N,N,N,N,N,N,N,N,N,N,12144,42320,N,N,N,N,42321, 42322,N,N,42323,N,N,N,N,N,N,42324,N,N,N,N,N,N,N,N,N,32378,42328,42329,N,N,N,N, N,12145,N,N,N,42330,N,N,N,N,N,N,N,N,N,N,N,12146,N,N,N,42331,N,N,N,N,N,42332,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 42333,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42334,N,12147,N,N,N,N,N,12148,N,N,N,N,N,N, N,N,N,12149,N,N,42335,N,N,N,12150,N,N,N,N,N,12151,N,N,N,N,N,N,42336,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,42337,N,12152,42338,42339,N,42340,N,N,N,N,12153,N,N,N,N, N,N,N,N,N,42341,N,42342,N,42343,N,N,N,N,42344,N,N,N,N,42345,N,N,N,N,12154,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42346,N,42347,N,N,N,42348,N,N,N,N,42349, N,N,N,N,N,N,N,N,42351,N,42350,N,N,N,N,42352,42353,N,N,N,N,N,N,N,42354,N,N,N,N, N,N,N,N,N,N,N,N,N,N,42355,N,12156,N,N,N,N,N,N,N,N,N,N,N,12157,N,N,N,N,N,N,N, 42357,N,N,N,N,N,N,42356,N,N,N,N,N,N,N,N,N,N,N,N,20309,N,N,N,N,N,N,N,N,N,N, 42358,N,N,N,N,N,42359,N,N,N,20310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42360,N,N, N,N,N,N,42361,N,N,N,N,N,N,N,N,N,N,N,N,42362,20311,N,42363,N,42364,N,N,42365,N, N,N,N,N,N,N,N,N,N,N,N,N,N,20312,N,N,43041,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,43042,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43044,N,N,N,N,N,N,N,N,N,N,N, N,N,43046,N,N,N,N,N,N,N,43047,N,20313,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 20314,N,N,N,N,43050,N,N,N,N,N,N,N,N,N,N,N,43051,43053,N,N,N,N,N,N,N,N,N,N,N,N, N,N,20315,N,N,N,N,N,N,N,N,N,N,N,20316,N,N,N,N,20317,N,N,N,N,N,43054,N,20318,N, N,N,N,43055,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,32379,N,N,N,43057,N,N,20320,43058,N,N,N,43059,43060,43061,N, N,N,N,N,N,43062,N,N,N,N,N,N,N,N,N,20324,N,43065,N,N,N,N,N,N,N,N,N,N,N,43068,N, 43069,N,N,N,N,20325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20326,43073,N,43074,20327,N, N,43075,43076,N,N,20328,N,N,43078,N,N,N,N,N,N,N,43079,N,N,N,N,20329,N,N,N,N,N, N,N,N,N,N,N,N,N,N,43081,N,20330,N,N,N,N,20331,N,20332,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20333,43084,N,N,N,N,N,N,20336,N,N, 43085,N,N,N,N,N,N,N,N,N,N,N,N,43087,N,N,43088,N,N,N,43089,N,43090,20337,N,N,N, 43086,N,N,N,N,N,43091,N,N,N,N,N,N,N,43092,N,N,N,N,N,N,N,N,43093,N,N,N,20339, 20340,N,N,20342,N,N,N,N,N,N,N,N,20341,N,N,N,N,N,N,N,N,N,N,N,N,N,43095,N,N,N,N, N,N,N,N,43096,N,N,20343,N,N,43098,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20344,N,N,N, N,N,N,43101,N,N,N,N,N,N,N,N,N,43103,N,43104,N,N,43105,N,43106,N,N,N,N,N,N, 20345,N,N,N,20346,N,N,20347,N,N,N,N,N,N,N,N,43107,N,43108,N,43109,N,N,N,20348, 43111,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20349,N,N,N,N,N,43112,N,N,N,N,N,43113, 43114,N,N,N,N,N,N,N,43115,N,29736,N,43117,N,N,N,N,43118,43120,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,43122,N,29737,43123,N,N,29738,N,N,N,N,N,N,43125,N,N,N,N,N,N, N,N,N,N,N,N,N,N,43126,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43127,N,N,N,N,N,N,N,N,N,N, 43128,N,N,N,N,N,N,N,N,N,N,N,N,43130,N,29739,N,N,N,N,N,29740,N,N,N,N,N,N,N,N,N, N,N,N,43132,43133,43134,44065,N,N,N,N,N,N,N,N,32380,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44067,N,N,N,N, 44068,N,44069,N,N,N,N,N,N,N,N,N,N,N,N,44070,N,N,N,N,29741,44071,N,N,N,N,N,N, 44072,N,N,N,N,29743,N,N,N,N,N,N,44073,N,N,N,N,N,N,44074,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29744,N,N,N,44076,29745,N,29746,N,N,N, N,29747,44077,N,N,N,N,N,44078,N,N,N,N,N,N,N,N,N,N,N,N,N,44079,29748,44081,N,N, N,N,29749,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29750,N,29751,N,N,N,N,N,N,29752,N,N, 29753,N,N,N,N,29754,N,44082,N,N,N,N,N,N,N,N,N,N,N,N,29755,N,N,N,29756,N,N,N,N, N,N,N,N,N,N,44083,29757,N,N,29758,N,N,N,N,N,N,N,N,N,N,44084,N,N,N,N,N,N,N,N,N, N,29759,44085,N,N,N,N,N,N,N,N,N,N,29760,N,N,N,N,N,44086,N,N,N,N,N,N,N,N,N,N,N, N,29761,N,N,N,N,N,44087,N,44088,N,N,29762,N,N,N,N,N,N,N,29763,N,N,N,N,N,29764, N,29765,44089,N,N,N,N,N,N,N,N,N,N,N,44090,N,N,44092,N,29766,N,44093,N,N,N,N,N, N,44094,44095,44096,N,N,N,N,N,N,N,N,N,29767,N,N,29768,44097,N,N,N,N,N,N,29769, N,N,N,N,44098,44099,N,N,N,44100,N,N,N,N,N,N,N,N,44101,29770,N,N,N,N,N,N,29771, N,N,44103,29772,N,N,N,N,N,N,N,N,N,44104,N,44105,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 29773,N,29774,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29775,N,N,N,N,44107,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,44108,N,N,N,N,N,N,N,N,N,N,44109,N,N,N,N,N,N,N,N,N,N,44110,N,N,N,N, N,N,N,29777,29778,N,N,N,N,N,N,N,N,N,44111,N,N,N,N,N,N,N,44113,44114,N,N,N,N,N, N,N,N,N,N,N,N,44115,N,N,N,N,N,N,N,N,N,44116,N,N,29779,N,N,N,N,N,N,N,N,29780, 29781,N,N,N,44117,N,44118,N,29782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44119,N,N,N, 44120,N,N,44121,N,N,29783,44122,N,44123,44124,N,N,N,N,N,44125,N,N,29784,N, 44126,N,N,N,N,N,N,N,N,N,N,N,N,29785,N,N,N,N,29786,N,N,N,N,N,N,29787,N,N,44127, N,N,N,N,N,N,44129,N,N,N,N,44130,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,44131,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44132,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,29789,N,N,N,N,44134,44135,N,N,N,44136,44137,N,N,N,N,N, N,N,N,N,N,N,N,44138,N,N,44139,N,N,N,N,44140,N,N,N,N,N,N,N,N,N,N,N,29792,N,N, 29791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44142,N,N,N,N,N,N,N, 44143,N,44144,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44145,44147,N,N,N,N,N, N,N,N,N,N,N,N,29794,44148,N,N,N,N,N,44149,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,29795,N,N,N,N,29796,N,N,44150,N,N,N,N,N,44151,N,N,N,N,44152,44153,N,N,N, 29797,N,N,N,29798,N,N,N,N,N,N,44154,N,N,44155,N,N,N,N,N,N,N,N,44157,N,29799,N, N,N,44158,N,N,N,N,N,N,N,44156,N,N,N,N,N,N,N,N,N,29800,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,44321,N,N,N,N,N,N,N,N,N,N,N,N,44322,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44323, 29802,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,29803,44325,44326,N,N,N,N,N,N,29804,N,N,44327,N,N,44328,N,N,N,N,N,N,N,29805, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44331,N,N,44332,N,N,N,29806, N,44333,44334,N,N,N,N,44335,N,29807,44336,N,N,N,N,N,N,N,N,N,44337,N,N,N,N,N,N, N,N,N,N,44339,N,N,N,N,N,N,N,N,N,N,N,29808,N,N,N,N,N,N,44342,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,29809,N,N,N,N,N,N,N,44343,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44346,N,N, N,N,44344,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,44347,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44349,44350,N,N,N,N,N,N, 44351,N,N,N,44352,N,N,N,N,29810,N,N,N,N,N,44353,44354,29811,N,N,N,N,44355,N,N, 29812,N,44348,44356,N,N,N,N,N,N,29813,N,N,N,29814,N,N,N,N,N,N,N,N,N,44357,N,N, N,29815,N,N,44358,N,N,N,44359,N,N,N,N,N,44360,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29817,N,N,N,N,N,N,N,N,44361,44362,N,44363,N, N,29818,N,N,N,N,N,N,N,N,N,N,N,N,29819,N,N,N,N,N,44364,N,N,N,N,N,29816,N,N,N, 44365,N,N,N,N,N,N,N,N,N,44366,N,N,N,N,N,N,N,N,N,44367,N,N,N,N,N,N,N,N,N,N,N, 44368,N,44369,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 29821,29822,N,N,N,N,29985,N,N,N,N,N,29986,44370,44371,N,29820,N,29987,N,N,N,N, 44372,N,44373,N,N,N,N,N,N,N,N,N,N,N,N,44375,44376,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,29988,N,N,N,29989,N,N,N,44377,44378,N,N,N,N,N,N,N,N,N,N,44380,N,N,N,N, 44381,N,44382,N,N,N,N,N,N,N,44384,N,N,N,29990,N,N,N,N,N,N,29991,N,N,N,N,N,N,N, N,44385,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44386,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 44387,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29993,N,N,N,44388,N,N,N,N,N,N,N,N,N, N,N,N,N,N,44389,N,N,N,N,N,N,44390,N,N,44391,44392,N,N,N,N,44393,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,29994,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44394,N,N, 44395,N,N,44396,N,N,N,N,N,N,44397,N,N,44398,N,N,N,N,N,N,44399,N,N,N,N,N,N,N,N, N,N,44400,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44402,N,N, N,N,N,N,44403,N,N,44404,29996,N,N,N,44405,N,N,N,44406,29997,N,N,N,N,N,N,N,N,N, N,N,29998,N,N,N,N,N,N,N,N,29999,N,N,44407,30001,N,30002,N,N,N,N,N,44408,30003, N,N,N,N,30004,30005,N,30006,N,N,N,N,N,N,30000,N,N,N,N,N,N,N,N,N,N,44409,N,N, 30008,N,N,N,30009,N,44411,N,N,44410,N,N,N,N,N,44414,N,30011,30012,44577,N,N,N, N,N,30013,N,44578,N,30014,N,N,N,N,44581,44582,44583,44584,N,N,N,N,N,30015,N,N, N,30016,30017,N,N,44585,N,N,N,N,44586,N,N,N,N,N,N,N,N,N,N,N,N,30018,N,N,44587, N,44588,N,N,N,N,N,N,44589,N,N,N,N,N,N,30020,N,N,N,N,N,N,N,N,N,N,N,N,44591,N,N, N,44592,30021,N,N,44593,N,N,N,N,N,30022,N,N,N,44595,N,N,N,N,N,N,30023,N,30024, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30026,N,N,N,N,N,N,N,N,N,N,N,N,30027,N,N,N, 44597,N,N,N,N,N,N,N,N,N,N,N,N,N,30028,30007,44599,N,N,N,44600,N,N,N,N,N,N,N,N, N,N,N,N,44601,30029,N,N,N,N,N,44603,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,30031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30033,30034,N,N,N,44606, 44607,N,N,N,N,N,N,44608,N,N,N,N,N,N,N,N,44609,N,N,N,N,N,N,N,N,30032,N,N,N,N,N, N,N,N,N,N,N,N,N,44613,N,44614,N,N,N,N,30035,N,N,N,N,N,30036,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,44616,30037,N,N,N,N,30038,N,N,30039,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,44620,N,44621,N,N,N,N,N,N,N,N,30040,N,N,N,N,30042,N,N,44622,N,N,N, N,44623,N,N,N,N,N,N,N,N,N,44624,N,N,N,N,30043,N,44625,N,44626,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,44627,N,N,N,N,N,N,44628,N,30041,N,N,30044,30045,N,N,N, N,N,N,N,N,N,N,N,N,N,N,44619,N,N,N,N,N,N,N,44632,N,N,N,N,30047,N,44633,N,N,N,N, N,N,N,N,N,N,N,N,30048,44634,N,N,N,30049,N,44636,N,N,N,N,N,N,N,44637,N,N,44638, N,N,N,N,N,44639,44640,N,N,N,44641,N,N,44642,N,N,N,N,N,30046,N,N,44643,N,44644, N,N,N,30050,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44646,N,N,44647,N,N,N,30051,N,N, 30052,N,N,N,N,44648,N,44649,N,N,N,N,N,44650,N,N,N,N,N,N,N,N,N,N,N,N,N,44651,N, N,N,N,N,44652,N,44654,44655,44656,N,44657,N,N,N,N,N,N,30054,N,30055,N,N,N,N, 44658,44659,N,N,N,N,N,N,30056,N,44660,N,N,N,N,N,N,44661,N,N,N,N,N,N,N,44666,N, 44667,N,N,30057,N,N,N,44668,N,N,44669,30058,N,N,N,N,N,44670,N,N,44833,N,N,N,N, N,N,N,N,N,N,44834,44835,N,N,30059,N,N,N,44836,30060,N,N,30061,30062,N,N,N,N,N, 44837,N,N,N,44662,30063,44838,N,N,N,44839,N,N,30064,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30067,N,N,N,N,N, 44843,N,N,N,N,N,N,30068,N,N,N,44845,N,N,30065,N,N,N,N,N,N,N,N,N,N,N,N,N,30069, N,N,N,N,N,N,N,N,N,N,N,30070,30071,N,N,N,30072,44846,N,N,44847,N,N,N,N,N,44848, N,N,N,N,N,N,N,44849,N,N,N,N,44850,30073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 44851,N,N,N,44853,N,44854,N,N,N,N,N,N,N,N,N,N,N,N,30075,44855,N,N,N,N,N,N, 30076,N,N,44856,N,N,N,N,N,N,44857,N,N,44858,N,44859,N,N,N,44860,N,N,N,N,N,N,N, N,N,N,N,N,N,N,30077,N,44861,N,N,N,N,44862,N,N,N,N,N,N,N,N,N,N,N,30242,44868,N, N,N,N,N,30243,30244,N,N,N,44869,44870,N,N,N,44871,44873,30245,30246,N,N,N,N,N, N,N,44874,30247,N,44875,N,N,N,30248,N,N,N,N,44876,N,N,44877,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,44865,N,44879,44880,44881,N,N,N,N,N,N,30250,N,N,30251,44882, N,N,N,N,N,30252,44883,N,N,44884,N,N,N,N,44886,N,30253,N,44887,N,N,N,30254,N,N, N,N,30255,N,N,N,N,N,N,N,N,44888,N,N,N,N,N,N,30256,N,N,N,N,N,N,N,30257,N,N,N,N, N,N,44885,N,N,N,44890,N,N,N,N,44891,N,N,N,N,N,30259,N,44892,N,N,N,N,N,44894,N, N,30260,N,N,N,N,N,N,N,N,30261,30262,44895,N,44896,N,N,N,30263,N,N,N,N,N,44898, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44899,N,N,N,N,N,N,N,N,44900,N,N,N,N,N,N,N,N, N,44902,N,N,N,44901,N,N,N,N,N,N,N,44903,44904,N,N,N,N,N,N,30264,N,N,30265,N,N, N,N,44907,N,N,N,N,44908,44909,44910,N,N,N,N,N,N,N,N,N,44911,44913,N,N,N,44914, 44915,44916,N,N,N,N,N,44918,N,N,N,30268,N,N,30269,N,N,N,N,N,N,N,N,N,N,N,N,N, 30270,N,N,44920,N,N,N,N,N,30271,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30272,N,N,N, 44921,N,N,N,N,N,N,N,N,N,N,N,30273,N,44922,N,N,N,N,N,N,N,30274,N,N,N,N,30275,N, 30276,N,N,N,N,44923,N,N,N,N,N,N,N,N,44924,N,30277,N,N,44925,N,N,N,N,N,N,44926, 30278,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60961,N,N,N,N,N,N,N,N,N, N,N,N,N,30279,N,N,N,30280,60962,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60964,60965,N,N,N, N,N,N,N,N,60966,60967,60968,N,N,N,N,N,30282,N,N,N,N,N,N,30283,30284,N,N,60969, N,N,N,N,N,N,N,N,N,N,N,60970,60971,N,N,N,N,N,N,60972,N,N,60973,N,N,N,N,N,N,N,N, N,N,N,N,N,30285,60974,N,N,30286,N,N,N,N,60975,N,N,N,60976,N,30287,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30288,N,60977,60978,N, N,N,60979,N,N,N,N,60981,N,N,N,N,N,N,N,N,N,N,N,N,N,60982,N,N,N,N,N,N,N,N,N,N,N, 30289,N,60983,30290,N,N,N,N,N,N,N,N,N,N,61007,N,N,N,N,N,60984,N,N,N,N,N,N, 30292,N,30293,N,N,N,N,N,N,N,N,N,N,N,N,N,60985,30294,30295,N,N,60986,N,N,N,N,N, N,N,N,N,N,60988,60989,N,60990,30296,N,N,N,30297,N,N,N,N,N,N,N,N,N,N,N,N,N, 30291,N,N,60991,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60992,N,N,N,30299,N,N, N,N,N,N,N,N,N,60993,N,N,N,30300,N,60995,N,N,N,60996,N,60997,N,N,N,30301,N,N,N, N,N,N,N,N,60998,N,30302,60999,61000,30303,N,N,N,N,N,N,N,N,N,N,N,N,30298,61002, N,N,N,30305,N,N,N,N,N,61003,N,N,N,30306,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,61004,N,61005,61006,N,N,N,N,N,N,30307,61008,N,30308,N,N,61029,N,N,N,N, 30309,N,N,61009,N,N,30310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 30311,N,N,61010,N,N,61011,N,61012,N,N,N,N,30312,N,N,N,N,N,N,N,N,N,N,61013,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,61014,61015,30314,N,N,N,N,30315,N,30316,61016,N,N, 61017,N,N,N,61018,N,N,30317,N,N,N,61019,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 30318,61025,30319,N,61026,N,N,N,N,N,61027,N,N,N,N,N,N,N,N,N,N,30320,N,N,61028, N,30321,N,N,N,61030,N,N,N,N,N,61031,61032,61033,N,N,N,N,N,30322,N,N,N,30323, 30324,N,30325,N,61034,N,N,N,N,N,N,N,N,N,61035,N,N,N,N,N,N,N,N,N,N,N,N,61036,N, N,N,N,N,30326,61021,N,N,N,N,N,N,61038,N,N,N,61039,N,N,N,N,61040,N,N,N,N,N,N,N, N,N,N,61042,N,30328,N,61037,N,N,N,N,N,61043,N,N,N,N,N,N,N,30329,N,N,N,61044, 61045,N,61046,61047,N,N,61048,N,61049,N,61050,61051,N,N,61052,N,N,N,N,30330,N, 30331,N,N,N,N,61053,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61217,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,61218,N,N,N,30332,N,N,N,N,N,30333,N,N,61219,N,N,N,N,N,N,N,N,N,N,61220,N, 30334,N,61221,N,N,N,30497,N,N,61222,N,N,N,30498,N,N,N,N,N,N,N,N,N,N,61223,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61225,N,N,N,N,N,N,N,N,N,N,N,N,N,61226,N,61227, 61228,N,61229,N,N,N,30499,N,N,N,N,N,N,N,61230,N,30500,N,N,N,N,N,N,N,N,N,N, 61231,N,N,N,N,30502,N,N,N,N,30503,N,N,N,30504,N,61224,61232,N,N,N,N,N,61233,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30505,61235,N,N,N,N,61236,N,30506,61237, N,N,N,30507,N,61238,30508,30509,N,N,N,N,N,61239,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,61241,30510,N,N,N,N,N,N,N,N,N,30511,N,N,N,30512,30513,N,N,61242,N,N, N,30514,N,61243,N,61240,N,N,N,N,N,N,61245,30515,N,N,N,N,61246,N,30516,N,N,N,N, N,N,N,61247,N,N,N,N,N,61249,30517,N,N,N,N,N,30518,N,61244,N,N,N,N,N,N,N,N, 30519,61250,61251,30520,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61252,N,N,N,61253,N,N,N, N,N,N,N,N,N,N,61254,N,N,N,N,N,N,30522,N,N,N,N,30523,N,N,N,30521,N,N,61256, 61257,N,N,N,N,30524,30525,61258,N,N,61259,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,61260,N,N,N,N,30526,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61262,61263,N, 61264,N,N,N,N,N,N,61265,N,N,N,61266,N,N,30527,61267,N,N,30530,N,N,N,N,N,61269, N,N,N,N,N,N,N,N,30528,30529,N,N,N,N,N,30531,61270,N,N,N,61271,N,N,61272,N, 61273,N,N,N,N,N,N,30532,61274,N,N,N,N,N,N,N,61275,N,N,61276,N,N,N,30533,61277, N,N,N,N,N,N,N,N,N,N,N,N,N,N,61278,N,61279,N,N,N,N,N,N,N,61282,N,N,N,N,30534,N, N,N,N,N,N,30535,N,N,N,N,N,61283,N,N,N,N,N,30536,N,N,N,61280,N,N,N,N,N,N,N,N,N, N,N,N,N,N,61286,N,N,N,N,N,N,61287,N,61288,30537,N,N,N,30538,N,N,N,61289,N,N,N, N,N,N,N,30539,N,N,N,N,N,N,N,61285,61290,61291,N,61292,61293,61294,N,N,N,61295, N,N,30540,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30542,N,30543,N,N,N,N,N,N,N,N,N,N,30541, N,N,30544,61297,30545,61298,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30546, 30547,N,N,61300,N,N,N,N,N,61299,30548,30550,61301,N,N,N,N,N,N,N,N,30551,N, 61302,N,30552,N,N,N,N,N,N,N,30553,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,61305,N,N,N,N,30555,N,30556,N,N,N,N,N,N,N,N,N,N,30557,N,N,N,61304,N,N,N,N, 61306,N,N,N,N,61307,N,61308,N,N,N,N,N,N,N,N,N,N,N,61309,61310,N,N,N,61473,N,N, N,N,N,N,30559,N,N,N,N,N,N,30558,N,N,30560,N,N,N,N,N,N,61475,N,N,N,N,N,N,N, 61476,N,N,N,N,N,61477,N,N,61478,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,30561,30562,N,N,N,N,N,N,61479,N,N,N,N,N,N,N,N,N,N,N,N,N, 30563,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61482,N,N,N,N,N,N,N,N,61483,N, N,N,61484,61485,N,N,N,N,N,N,N,N,61487,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61488,N, 30564,30565,61489,N,N,N,N,N,N,N,N,N,N,N,61490,N,N,N,N,N,N,N,N,N,N,61492,61493, N,N,N,N,N,N,N,N,61494,N,N,N,N,N,N,61495,N,N,N,N,N,N,N,N,N,N,N,N,N,30567,61496, N,N,N,N,N,N,N,N,N,N,N,N,30568,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61498,61499,N, 61500,61501,N,N,N,N,N,N,N,N,N,N,N,N,30569,N,30570,61502,N,N,N,N,N,N,N,N,N,N, 61504,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,61507,N,N,N,N,N,N,61508,30571,61509,N,N,N,N,N,N,N,N,N,N,61510,N,N,N,N,N, 61511,61512,N,N,N,N,N,N,N,N,N,N,N,N,N,30573,30574,N,N,N,61515,N,N,N,N,61516,N, 61517,N,N,N,N,N,61514,N,N,N,61518,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30576,N, 61519,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30577,N,N,N,N,61521,61522,N,61524, 61525,N,61526,N,N,N,N,N,61527,N,N,N,N,30578,N,N,N,N,61528,N,N,N,61529,N,N,N,N, 61530,N,N,N,N,N,N,N,N,N,61531,30579,N,N,61532,N,N,N,61533,N,61534,30580,30581, N,30582,N,N,61535,30583,N,61536,N,N,30584,N,N,N,N,N,N,N,N,N,61537,N,61538,N, 61539,N,N,61540,N,N,61541,N,N,N,N,N,61542,N,N,N,30585,N,61543,N,N,N,30586,N,N, N,N,N,N,30587,N,N,30588,N,N,N,N,N,N,N,61544,N,30589,N,N,N,61545,N,30590,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,61546,61548,61549,N,N,N,N,N,30753,N,N,30754,N,N,N,N,N, N,N,N,61547,N,N,N,N,N,N,30755,30756,N,N,N,N,N,N,N,N,61550,N,30758,N,30759,N, 30760,30761,30762,N,30763,30764,30765,61551,N,N,N,N,N,N,N,61552,N,N,N,N,N,N, 61554,N,N,61555,30766,N,30767,30768,N,N,N,30769,N,61556,N,N,N,N,61557,61553,N, N,N,30770,N,N,N,N,N,61558,N,N,N,N,30771,N,N,N,N,N,N,N,N,30772,N,30773,N,N,N, 61559,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61560,N,N,N,61561,30774,30775,61562,30776, N,N,N,N,N,N,30781,N,61564,N,N,N,N,61565,30777,61566,N,N,30778,N,N,30779,61729, 61730,N,30780,N,61731,30782,N,30783,30784,61732,61733,N,N,N,N,N,N,N,N,N,30785, N,N,N,61734,61736,61735,N,N,N,30786,N,N,N,N,N,N,N,N,30787,30788,N,N,N,N,N,N,N, N,N,N,N,N,61737,N,61738,N,30789,N,N,N,61739,N,N,N,N,N,N,N,N,N,N,N,N,61741,N,N, N,61740,N,N,N,N,N,N,N,N,N,N,61743,N,N,N,N,30790,30791,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,30792,N,N,N,N,N,N,N,N,61745,N,N,N,61746,N,N,N,N,N,61747,N,N, N,N,30793,N,N,N,N,N,N,N,N,N,N,N,N,N,61750,61751,N,61752,N,N,N,N,N,N,N,61753,N, N,N,N,N,61754,N,61755,N,61756,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,61757,N,N,30794,N,61759,61758,N,N,N,N,N,N,30795,61760,N,N,61761,61762,N,N, 61763,N,N,N,N,N,N,N,N,N,N,61765,N,N,N,N,N,30796,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61767,N,N,N,N,N,N,N,N,N,N,N,N,N,61769,N,N,N,N,N,N,61770,N,N,N,N,N,N,N,61771, 61772,N,N,N,N,N,61773,N,N,N,N,N,N,N,30798,61774,N,N,N,61775,N,N,N,N,N,N,N,N,N, 61776,N,61777,61778,N,N,N,30799,N,N,61779,N,N,N,N,61780,N,61781,N,N,61782,N,N, N,N,N,N,N,61783,30800,N,30801,61784,N,N,N,61786,30802,N,N,N,N,N,N,61787,N,N,N, 61790,N,30803,30804,N,61785,30805,N,61791,61792,N,30806,N,N,N,N,N,N,61794, 32381,N,61795,N,N,N,N,30807,N,N,N,N,N,61797,N,30808,N,N,N,N,N,N,61796,N,N,N,N, 61800,N,30809,N,N,N,N,N,61802,N,30810,N,N,N,N,N,N,N,N,N,61803,N,N,N,N,N,N,N,N, N,N,N,N,N,N,30811,30812,N,N,N,N,N,N,N,30813,61805,30814,N,30815,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,30816,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61806,N,N,N,N,N, 30817,61807,30818,30819,N,61809,61808,N,N,N,N,30820,61810,61811,N,30821,N,N,N, N,61812,N,N,N,N,N,N,30822,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30823,N,N,N,61814,N,N, 30824,N,30825,N,N,N,N,N,30826,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30827,N,61816, N,N,N,61817,N,N,N,N,30828,N,N,N,N,N,N,N,N,N,N,30829,30830,N,N,N,N,N,N,N,N,N,N, N,N,61819,N,30831,61820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61821,N,N,N,N,N,N, 30832,61822,30833,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30834,N,N,N,N,N,N,30835,30836, N,N,N,N,N,N,N,N,N,61989,N,N,N,30837,N,N,30838,61990,N,30839,N,N,N,N,N,N,N, 61991,N,N,N,N,N,N,N,61993,N,N,N,N,N,N,N,30840,N,61994,61995,N,N,30841,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30842,N,N,N,N,N,61998,N,N,N,N,61999,N,N,62000,N, 62001,N,N,N,N,62002,30843,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62003,62004,30844,N,N,N, 62005,N,62006,N,N,N,62007,N,62008,N,N,N,62010,N,N,N,62011,N,N,N,N,N,N,62012, 62014,62015,N,N,62016,N,N,N,62017,N,N,N,N,N,N,N,N,N,N,N,62018,N,N,N,N,N,N,N, 62019,N,N,N,N,N,N,N,N,N,N,62020,30845,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,31009,N,N,N,62021,N,N,N,N,N,N,31010,31011,N,31012,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,62022,N,N,N,31013,N,62023,N,N,N,31014,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,62025,N,N,N,N,N,N,N,N,N,62026,N,N,N,N,N,N,N,N,62028, 62029,62030,N,N,N,N,62027,N,N,N,N,N,N,N,N,31018,N,N,31016,N,N,N,N,N,N,N,N,N,N, 62031,N,N,N,N,N,N,N,N,N,N,N,N,62032,N,N,N,62033,N,62034,N,N,N,N,N,N,62035,N,N, N,N,N,N,N,N,N,N,62036,62037,N,N,31019,N,62038,N,N,N,N,N,N,N,N,N,N,N,31020,N,N, N,N,31022,N,62039,62040,62041,N,N,62042,31021,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 62044,N,N,N,N,N,N,N,N,N,N,62045,31023,N,N,N,N,N,N,N,N,62047,N,N,N,N,N,N,N,N, 31024,N,62046,31025,N,N,31026,N,N,N,N,N,N,62048,N,N,N,N,N,N,N,N,N,31029,31030, N,N,N,62049,N,N,N,N,N,N,N,N,N,N,N,N,N,62050,N,N,62051,31034,N,N,N,N,N,N,N,N,N, N,62053,N,N,N,N,N,N,N,N,N,N,62054,N,N,N,N,N,N,31038,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,62055,62056,62057,N,31042,N,N,62058,N,N,N,N,N,62059, N,N,N,N,N,N,N,62060,N,N,N,N,N,N,N,31043,N,N,62061,N,N,N,31044,N,N,62062,N,N,N, N,N,N,62063,N,N,N,N,62064,31045,N,31046,N,62065,62066,N,N,N,N,N,N,31048,N, 62067,N,N,N,N,N,N,N,31049,N,N,N,N,N,N,N,N,N,N,N,N,31050,N,31051,31052,N,N,N,N, N,N,62072,N,N,N,N,N,N,62073,N,N,N,62074,N,N,N,N,N,62075,N,N,62076,N,N,N,N,N,N, N,N,N,N,N,N,N,N,62078,N,N,N,N,N,N,N,N,N,N,62241,31054,N,N,N,N,N,N,N,N,N,N,N,N, N,62242,N,N,N,N,62243,N,N,N,N,N,N,N,N,N,62244,N,N,62245,N,N,62246,31055,N, 62247,62248,N,N,N,N,N,N,62249,N,N,62250,N,N,31056,N,N,N,N,N,N,N,62251,N,N, 62252,N,N,N,N,N,N,N,N,N,62253,N,N,31058,N,N,N,N,62254,N,N,N,N,N,62255,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,31059,N,N,62256,N,N,N,N,N,N,N,N,62257,N,N,N,N,N,N,31061, N,N,N,N,N,62260,N,31062,62261,N,62262,N,N,N,N,N,N,N,N,N,N,N,N,N,62264,N,31063, N,N,62265,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62266,62267,N,N,31064,N,N, N,N,N,N,N,N,62268,N,N,N,N,N,N,N,N,31065,62271,N,N,N,N,N,N,N,N,N,N,31066,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62274,N,N,62275,N,N,31067,62276,62277,N, 62278,N,N,N,N,N,N,N,N,N,31068,N,62273,N,N,N,62282,N,N,N,N,N,31069,N,N,N,N,N,N, 31070,N,N,N,N,N,N,62284,N,N,N,N,N,N,N,N,N,N,31071,N,N,N,62286,N,62287,N,N, 62288,N,N,N,31072,N,31073,N,N,31074,62289,N,N,N,N,N,62285,N,N,N,N,N,62281,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,62292,62293,N,N,N,N,N,N,N,N,N,62294,N,N,31075,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,62296,N,N,N,N,N,62297,N,N,N,N,N,N,62298,N,N,N,N,N, N,N,N,62299,N,N,N,N,62300,N,N,N,N,N,N,N,N,N,62303,N,62304,31077,N,31078,62305, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62306,N,N,N,N,N,62307,31079,N,62308,N,N,N,N,N,N, N,62309,N,N,62310,62311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31081,N,31082,N,N,N,N,N, 62312,N,N,N,N,N,N,N,N,N,N,31080,N,31083,N,N,31084,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 62313,N,N,N,N,62314,N,N,N,N,N,N,62315,N,N,N,N,N,62316,N,31087,N,N,N,N,62317,N, N,62318,N,N,N,N,N,N,N,62319,N,N,N,31088,62320,62321,62322,N,N,N,N,N,N,N,N, 31089,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31090,N,N,N,N,31091,N,N,N,N,N, N,N,N,N,N,N,31092,N,N,N,N,N,62326,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62328,62329,N, N,N,N,31093,N,N,62330,N,N,N,N,62332,N,N,N,62334,N,N,N,N,62497,N,N,N,N,N,N,N, 31094,N,62499,N,31095,N,N,N,31096,N,N,N,N,N,N,N,N,62501,N,N,N,N,62502,N,N,N,N, N,N,N,N,N,62504,62505,N,N,N,31097,31098,62506,N,N,N,N,N,N,N,N,62508,31099,N,N, N,N,N,N,N,N,N,31100,62509,N,N,N,N,31101,N,N,N,N,N,N,N,N,N,N,N,N,N,31102,N,N,N, N,N,N,N,N,N,N,N,62512,62513,N,62514,31265,N,N,N,N,N,62515,31266,N,N,N,N,N,N,N, N,N,N,31267,N,N,N,N,N,62519,62520,N,31268,N,N,N,N,N,N,N,N,N,N,N,N,N,62521,N,N, N,N,N,62522,N,N,N,N,N,N,N,N,N,31269,N,N,N,N,62524,N,N,N,31270,N,N,62526,N, 62527,N,N,31271,62528,N,N,N,N,N,N,N,N,N,N,62529,N,N,N,N,N,62531,N,N,31272,N,N, N,N,N,31273,62532,N,N,62533,N,N,N,N,N,N,N,N,N,N,N,62534,62535,N,N,N,N,N,N,N,N, 62536,N,31274,N,N,N,N,N,N,N,N,N,31275,N,N,N,N,N,N,N,N,N,31276,62537,N,62538,N, N,N,N,N,N,N,N,N,31277,N,N,62539,N,N,N,N,N,N,N,N,N,N,62540,N,N,N,N,N,N,N,62541, 31280,N,N,N,N,N,N,N,62545,31281,N,N,N,31282,N,62546,N,N,N,N,N,62547,N,N,62548, N,N,N,N,N,N,62549,31279,N,N,N,62550,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,62551,N,31284,N,N,N,N,N,N,N,N,N,N,31285,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 31286,N,N,N,N,N,N,N,N,N,32382,N,N,N,N,N,N,N,62552,N,62553,N,N,N,N,N,N,N,N, 62554,N,N,N,N,N,N,N,62555,62556,N,N,31287,N,N,31288,N,N,N,62558,N,N,N,N,N,N, 62559,N,62560,62563,62562,N,62564,N,N,N,N,62565,62566,N,N,31289,N,N,N,N,N,N,N, 62567,N,N,62570,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62572,N,62573,62574,N,N,N,N,N,N,N, N,62575,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62576,62577,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,62579,31291,N,N,N,N,62582,31292,N,N,N,N,62583,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,62584,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31293,N,N,N,62586,N,N,N,N,N,N,N, N,N,N,31294,62587,N,N,N,N,N,N,N,N,N,N,N,31295,N,N,N,31296,N,N,N,62588,N,62589, N,N,N,N,N,N,31297,N,31298,62590,N,N,62753,N,N,N,N,N,N,N,31299,62754,N,N,N,N,N, 62756,N,62755,N,N,N,62757,N,N,62758,N,N,31301,N,62759,N,N,N,N,N,N,N,N,N,N,N,N, N,62760,N,31302,N,N,N,N,N,62761,N,N,N,62762,N,N,N,N,31303,N,31304,N,N,N,N, 31305,N,N,N,N,N,N,62763,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,62764,N,N,N,N,N,N,N,N,N,N,62765,N,N,N,62766,N,N,N,N,N,62767,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62768,N,N,62769,N,N,N,N, N,N,N,62770,N,N,62771,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62772,N,N,N,N,N,N,N,N,N, N,N,N,62774,N,N,N,N,31306,N,N,N,N,N,N,N,N,N,N,62775,N,31307,62776,N,N,N,N,N,N, N,31308,N,N,N,N,N,62777,N,N,N,N,N,N,N,N,N,N,N,N,31309,N,62780,N,N,N,N,N,62781, 62779,N,N,N,N,N,N,N,N,62784,N,31310,N,N,N,N,N,62785,N,N,N,N,N,62787,N,N,62788, N,N,N,N,62789,N,N,N,N,N,N,N,N,62783,N,N,N,N,N,N,N,62791,N,N,N,N,N,N,N,N,N,N,N, N,31311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31312,N,N,N,N,N,N,31313, 31314,62793,N,N,N,31315,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62795,N,N,62797, 62798,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62800,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,62801,N,N,N,N,N,N,N,N,31316,N,N,N,N,N,62802,N,62803,N,N,N, N,N,N,31317,N,N,N,N,31318,N,N,N,N,N,N,62804,31319,N,N,N,62805,N,N,N,N,N,N,N,N, 62807,N,N,N,N,N,N,N,62809,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62811,N,62812,62814, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62816,N,N,N,N,N,N,N,62817,62818,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,62820,N,62821,N,N,N,N,N,N,N,62822,N,N,N,N,N,N,N,N, 62825,62823,N,N,62824,N,62827,N,N,N,62829,N,N,N,N,N,N,N,62831,N,N,N,N,62833,N, N,N,31323,N,N,62834,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31324,N,N,N,N,62838,N,N,N, 62840,N,62841,N,N,N,62842,N,N,N,N,N,N,62843,N,N,N,31326,N,N,N,N,62844,N,N,N,N, N,N,N,N,N,N,N,N,N,31327,N,31328,31329,N,N,62845,62846,31330,N,N,N,N,31331,N,N, N,63009,N,63010,N,N,31332,N,N,63011,N,63012,N,31333,31334,N,N,N,N,N,N,31335,N, N,N,N,N,N,N,N,N,N,N,N,N,N,31336,N,N,N,N,N,N,N,N,N,N,N,N,63013,N,N,N,N,N,63014, N,N,N,N,N,N,N,N,N,N,N,N,N,N,63015,N,N,N,N,N,31337,31338,31339,31340,N,N,N,N,N, 63016,63017,N,N,N,63018,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63020,N,63021,N,N,N,N, 31342,N,N,N,N,N,N,N,N,N,N,31343,N,N,63022,N,N,N,N,N,N,N,N,N,31344,N,63023,N,N, N,N,N,N,31345,63024,N,N,31346,N,N,N,N,N,N,N,N,N,31347,N,N,63019,31348,N,63025, N,N,N,N,N,N,N,N,N,N,31341,44618,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,31349,N,63027,N,N,N,N,N,N,31350,N,N,N,N,N,N,63030,N,N,N,N,31351,N,63031, 63032,N,N,31352,N,N,63033,N,63034,N,N,N,N,N,N,N,N,N,31353,N,31354,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31355,31356,N,N,N,N,N,N,31357,N,63035,N,N,N,N,N, 31358,63036,31521,N,N,63037,N,N,N,N,N,N,N,N,63038,N,N,N,31522,N,N,N,63039,N,N, N,N,31523,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63040,31524,N,N,N,N,31525,N,N,N,31526,N, N,N,N,63041,N,63042,N,N,N,63043,N,63045,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,63046,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31528,N,63047,N, N,N,N,63048,N,63049,63050,N,N,N,N,N,N,63051,63052,N,63053,N,N,31529,N,N,N,N,N, 63055,N,N,N,N,N,N,N,N,N,N,31530,N,N,31531,N,N,63056,N,63057,N,N,N,63058,N,N,N, N,63059,N,N,N,31532,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63062,N,N,N,N,N,N,31533, N,N,N,N,N,N,N,63063,N,N,N,N,N,N,N,N,31534,N,N,N,N,31535,N,N,N,N,N,31536,N,N,N, 63064,N,31537,N,31538,N,N,N,N,N,N,N,N,N,N,N,63066,63067,N,N,N,63068,N,N,N,N,N, N,N,N,63061,N,N,N,N,N,N,N,N,N,N,63070,N,N,63071,N,N,N,N,63072,63073,63074,N,N, N,N,N,N,N,N,63075,N,N,63076,63077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63078,N,N,31541, N,N,N,N,31542,63079,63080,N,N,N,N,N,63081,N,N,N,31543,N,N,31540,N,63082,N,N,N, N,N,N,N,N,N,63087,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63083,N,63088,N,63089,N,N,N, N,N,31544,N,N,N,N,63090,N,N,63091,63092,N,31545,N,N,N,N,N,N,N,N,N,N,63084,N,N, N,N,N,N,N,N,N,N,31548,63094,N,63095,N,63096,N,63097,N,N,N,N,63098,N,N,N,N,N, 31549,N,N,31550,N,N,N,63099,N,N,N,N,N,N,N,N,N,63100,N,63101,N,N,31551,N,N,N,N, N,N,N,N,N,N,31547,N,N,31552,N,N,N,N,N,N,63267,N,N,N,N,63268,N,N,N,N,N,N,N,N,N, N,63269,N,N,63270,31553,N,N,31554,N,N,N,N,N,N,N,N,N,63271,63272,N,N,N,N,N, 63273,N,63274,N,N,N,N,63275,N,N,N,N,N,N,31555,N,N,N,N,N,N,N,N,63276,N,N,N,N,N, N,N,N,31557,63277,N,N,N,31558,31559,N,N,N,N,N,N,N,N,N,N,31560,63278,31556,N,N, N,N,N,31562,N,N,N,N,N,63279,N,N,63280,N,N,63281,N,N,63282,N,31563,N,N,N,N,N,N, N,N,N,N,N,N,N,N,31564,63284,N,N,63285,N,N,N,63287,12136,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,63289,N,N,63290,31565,N,N,N,31566,N,N,N,N,N,N,31568,N,N,N,N,N,N,N, N,N,31570,N,N,63291,N,N,N,N,N,31571,N,63292,N,N,63293,N,N,N,N,N,N,N,N,N,N,N,N, 63294,N,63295,N,N,N,63296,N,N,N,63297,N,N,N,N,N,N,31572,N,N,N,63298,63299,N,N, N,N,N,N,N,N,N,N,63300,N,N,N,N,N,N,N,N,63302,N,63303,N,N,N,N,31573,N,N,N,N,N,N, N,N,63304,N,63305,N,N,N,N,N,N,N,N,N,N,N,N,N,63306,N,N,N,63307,N,63308,N,N,N,N, N,N,N,N,N,N,N,63309,N,N,63310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31574,N, 31575,31576,63312,N,63313,N,N,N,31577,N,N,63314,N,63315,N,N,63316,N,N,N,N,N, 63317,N,N,N,N,N,63318,N,63319,N,63320,N,N,N,N,N,N,N,N,N,N,N,N,N,63321,N,N,N,N, N,N,N,N,63322,N,N,N,63323,N,63324,N,N,63325,N,N,N,N,N,N,N,N,N,N,N,N,N,63326,N, N,N,N,N,N,63327,N,N,N,N,N,N,N,N,N,N,N,63328,63329,N,N,N,N,N,N,N,N,N,N,N,31578, 63330,N,N,N,N,N,N,N,N,N,63331,N,N,N,N,N,N,N,N,N,N,31579,31580,63335,N,63336,N, N,N,N,N,N,N,63337,N,N,N,N,N,N,N,N,N,N,N,N,63338,N,N,N,N,N,N,63334,N,N,N,N, 31581,31582,N,N,N,N,N,N,N,31583,N,N,N,N,N,N,N,N,63341,N,N,63343,N,N,N,N,N,N,N, N,N,N,N,N,63344,N,N,N,N,N,N,N,31585,N,N,N,N,N,N,N,N,63346,N,N,N,63348,N,63349, 63350,N,N,N,63351,63352,31586,63353,N,N,N,N,N,N,N,63345,63354,N,63355,N,N, 31587,N,N,N,31588,63356,N,N,N,N,31589,N,N,63357,31590,N,N,N,N,N,N,N,N,N,N, 31591,N,N,N,N,N,N,N,N,63358,N,N,N,N,N,63521,N,N,N,63522,N,N,N,N,N,N,N,N,N, 63523,N,N,N,N,N,N,N,N,N,N,N,N,N,63525,N,N,N,N,N,N,N,N,N,N,N,N,N,63526,N,N,N,N, N,N,63527,N,N,N,N,63528,N,N,N,N,63531,N,N,N,N,N,63533,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31592,N,N,N,N,N,N,N, 63534,N,N,N,N,N,N,N,N,N,31593,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63535,63536, 63537,N,63538,N,N,N,N,N,N,N,N,N,31594,N,N,N,31595,N,N,63541,63539,63542,N,N,N, N,N,N,N,63543,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63544,63545,N,N,N,31597, 63547,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31600,31601,31602,N,31598,N, N,N,N,N,N,N,N,N,N,31603,N,N,N,N,N,N,N,N,31604,N,31605,N,N,N,N,63549,N,31606,N, N,N,N,N,N,31607,N,63551,N,N,63552,N,N,N,63553,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,63556,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,63557,N,N,N,N,N,N,N,N,63558,N,N,N,N,N,N,63559,N,N,N,31608,N,N,N,N,N,N,N,N,N, N,63560,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63561,N,N,N,N,N,N,63562,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31610,N,63563,N,63564,N,N,N,N,N,N,N, N,N,N,N,N,31611,N,N,N,N,N,63565,N,N,N,N,N,63567,N,63568,N,N,31612,N,N,N,N,N,N, 63569,N,63570,63572,31613,N,63573,31614,N,N,N,N,N,N,N,N,N,N,N,63575,31777,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63576,N,31778,N,N,N,N,N,N,63577,N,N,N,N,N,N, 63578,N,31779,N,N,N,N,N,63579,31780,N,N,N,N,N,N,N,N,N,63580,N,N,N,N,31781,N,N, N,31782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31783,N,N,N,31784,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63582,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,31785,N,N,N,N,N,N,63581,N,N,N,N,N,N,N,N,63583,N,N,N,N,N,N,63584,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,31786,N,N,N,N,N,N,63585,N,N,N,N,N,N,N,31787,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,31788,N,31789,N,N,N,N,N,63586,63589,N,N,N,N,63588, N,N,63590,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63591,N,N,63592,N,N,N,N,N,N,N,N,N,N,N,N, N,63593,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63594,N,N,31793,N,N,N,N,N,N, N,N,N,N,63596,N,N,31794,N,N,N,N,31795,N,N,N,N,63597,N,N,N,N,N,N,N,N,N,N,31796, N,N,N,N,N,N,N,N,N,N,N,N,63598,N,N,N,N,N,N,N,N,63599,N,63600,N,N,N,N,N,N,N,N,N, 63601,N,N,N,N,N,N,N,N,63602,63603,N,N,N,N,N,N,63604,31797,63605,63606,N,N,N, 63608,N,N,N,N,N,N,N,63611,N,63612,N,31798,N,N,N,N,N,63613,N,N,N,N,63614,N,N, 63777,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31799,63778,N,N,N,63779,N,N,N,N,N,63780, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63783,63782,N,N,N, N,N,63784,N,63786,N,N,N,N,N,N,N,N,63787,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63789,63788,N,N, 63790,N,N,N,N,N,N,N,31801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63792,63793,N,N,31802,N, N,N,31803,N,N,N,N,N,31804,63795,N,N,N,N,63796,N,N,N,31806,N,N,N,N,N,N,N,N, 31807,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,63797,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63798,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,63799,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63800,N,N,N,N,N,N, N,N,31808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63802,N,63803,N,N,N,N,N, 31809,N,N,31810,N,N,N,N,N,31811,N,63804,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 63805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63808,63809,N,N,N,N,N,63806,N,N,N,N,N,N, N,63811,N,63812,N,N,N,N,N,N,N,N,N,31812,63813,63814,31813,N,N,N,63815,N,N,N,N, N,N,N,N,N,N,N,N,N,N,63818,N,N,63819,N,N,N,31814,N,N,N,N,N,N,N,N,N,N,N,N,N, 63820,N,N,N,N,N,N,N,N,63821,N,N,N,N,N,N,N,N,N,N,N,N,N,63822,N,N,N,N,N,N,N,N,N, 63823,63824,N,63825,31815,N,N,N,N,N,N,N,N,N,N,31816,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63826,N,N,N,N,N,63827,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,63828,N,N,N,N,63829,N,63830,63831,N,N,N,N,63832,N,N,N,N,31818,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,63834,N,N,63835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63837,31820,63839,N,N,N,N,N,N,N,63840,N,N,N,N,N, N,N,N,N,N,N,N,N,N,63841,N,N,N,N,N,N,31821,N,N,N,N,N,N,N,N,N,N,N,N,63842,N, 31822,N,N,N,N,N,N,N,N,31823,N,N,N,N,N,N,N,N,N,63843,N,N,N,N,N,N,N,N,N,63844,N, N,N,N,N,N,N,N,N,31824,N,N,N,63845,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,63847,N,31826,N,N,N,N,N,N,N,N,N,N,N,N,N,63848, 31827,63850,N,N,N,N,N,N,N,N,N,N,63852,N,N,N,N,63853,N,N,N,63855,N,N,63856,N,N, N,N,N,63857,N,63858,N,N,N,N,N,N,N,N,N,N,63859,N,N,N,31828,N,N,N,31829,N,N,N,N, N,31830,N,N,63860,N,N,N,63861,N,N,N,N,N,63862,63863,N,N,N,N,N,31831,N,N,N, 63864,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31832,N, N,N,N,N,N,N,N,N,63865,N,N,N,N,N,N,N,N,N,N,N,63867,63868,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,63869,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64034,N,N,31834,N,N,N,64035,N,N,N,64036,N,N,N, N,31835,N,31836,N,31837,N,31838,N,N,N,N,N,64038,31839,N,N,N,N,N,N,N,N,N,N,N,N, N,64040,N,N,31840,N,N,64041,N,N,N,N,N,N,N,31841,N,N,N,N,64042,31842,31843,N, 31844,64043,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31845,N,N,N,N,64045,31846,31847,64046, N,N,N,N,N,N,N,N,N,N,N,64051,N,N,N,31848,N,N,64049,N,31849,N,64048,N,N,N,N,N,N, N,64052,64053,64050,N,N,N,64054,N,64055,N,N,N,N,N,N,N,N,N,N,N,N,N,31851,31852, 31853,N,64056,N,N,N,64057,N,64058,N,N,N,31854,31855,N,N,N,31856,N,N,N,N,N,N,N, 31857,N,31858,N,N,31859,N,N,64059,N,64060,64061,N,N,31860,N,N,N,N,N,N,N,N, 64062,64063,31861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64064,N,64065,N,31862,N,N,N,N,N, 64066,N,N,64067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64068,N,N,N,N,64069,N,N,N,N,N,N, N,N,N,31863,N,64070,N,N,N,N,N,N,N,N,64071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31864, N,N,N,N,N,N,N,N,N,64072,N,N,N,31865,N,64073,N,N,31866,N,64074,N,N,64075,N,N,N, N,N,31867,N,N,N,N,N,N,64076,64077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31868,N, N,64078,N,N,N,N,N,N,N,N,N,31870,32033,N,N,N,N,N,N,64081,32034,64082,N,N,32035, N,N,N,N,N,N,N,N,N,31869,64083,N,N,N,N,N,32036,N,N,64084,N,N,N,N,N,32037,N,N,N, N,N,64085,64086,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64088,N, N,N,N,32038,32039,32040,N,32041,N,N,N,32042,N,64089,32043,N,N,N,64090,N,N, 64091,N,N,N,64092,32044,N,64093,N,N,N,N,64094,N,N,64095,N,N,N,N,N,N,64096, 64097,N,N,N,64098,N,64099,64100,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32045,N,N,N, 64103,64104,N,64105,N,N,N,N,N,N,N,N,32046,64106,N,N,N,64107,N,N,N,N,N,N,N,N,N, 64108,N,64109,N,N,N,N,N,64110,N,N,N,N,N,N,N,64111,N,N,N,64112,N,N,N,N,N,N, 64115,N,N,N,N,N,N,N,N,N,N,N,N,64116,64117,N,32047,N,N,N,64118,N,N,N,N,32048, 32049,N,64119,N,64120,N,N,32050,N,N,N,64121,N,64122,N,N,N,N,N,N,32051,N,N,N,N, 64123,N,64124,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64290,N,64291,N,64292,N,N,N,32052, 64293,N,32053,N,N,N,N,N,N,N,N,64294,N,N,N,64125,N,N,N,64295,N,N,N,N,N,N,N, 64296,64297,32054,N,32055,N,N,N,32056,N,64298,N,64299,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64302,32057,32058,32059,N,N,N,N,N,N,64303,N, N,N,N,N,64304,N,N,64305,N,N,N,N,N,N,N,N,N,32060,32061,N,N,N,N,32062,64306,N,N, N,N,32063,64307,N,64308,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64312,N,N, 64313,N,N,N,64314,N,N,N,N,N,N,N,N,N,N,N,32064,N,N,64315,N,N,64309,N,32065,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32066,N,N,N,N,N,N,64320,N,N,N,N,32067, 64321,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64322,N,32068,32069,N,N,64323,N, N,N,N,64324,N,N,N,N,N,N,N,N,N,64319,N,N,N,64316,N,N,N,N,N,64329,N,32071,32070, N,N,N,N,64325,N,N,N,N,N,64326,N,N,N,N,N,N,64327,64328,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,64330,32072,64331,N,N,N,N,N,N,64332,N,N,N,N,N,N,N, N,N,64333,N,N,N,N,32073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32074, N,N,N,N,N,N,N,32075,N,64336,N,64337,N,32076,32077,64338,64339,N,N,N,N,N,N,N,N, N,N,N,N,64340,N,N,N,N,N,64341,64342,32078,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 32079,N,N,N,N,N,N,32080,N,N,32081,N,64344,32082,N,N,N,N,N,N,N,64345,N,32083,N, N,N,N,N,N,32084,N,N,N,N,N,N,N,N,N,N,64347,N,N,32085,N,N,N,N,32086,N,N,32087,N, N,N,N,N,N,32089,N,N,N,32090,64037,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64350,N,N,N,N,N, N,64351,64352,N,N,N,N,N,N,N,64354,N,N,N,N,64355,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,32091,N,N,N,N,N,N,N,N,64356,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,64358,N,32092,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,64360,N,N,32094,N,N,N,N,N,N,32095,32096,N,N,N,64363,N,N,N,N,N,64364,N,N, N,64365,N,N,N,N,N,N,64366,N,N,64367,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 32097,N,N,N,N,N,64370,N,64371,N,N,64372,32098,N,N,N,N,N,N,N,N,N,N,32100,N,N,N, N,N,32101,64374,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64375,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,32102,N,N,64377,N,N,N,N,32103,N,N,N,N,N,64378,N,N,N,N,N,64379,N,N,N,N,N, 32104,32105,32106,N,N,N,N,N,64380,N,64381,N,N,32107,64382,N,N,N,N,N,N,N,N,N,N, N,N,N,N,64545,N,N,N,32108,N,N,N,N,32109,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,32110,64548,N,N,N,64549,N,N,N,64550,N,N,N,64551,N, N,N,N,N,N,N,N,N,N,N,32111,N,N,64552,64553,N,N,N,N,N,N,N,32112,N,N,N,64554,N,N, 32113,N,N,N,N,N,N,N,32114,N,N,64555,N,N,N,N,64556,N,N,64557,N,N,N,64558,64559, N,32116,N,N,32115,N,N,64560,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64561,N,N,32117, 64562,N,N,N,N,N,32119,N,N,64563,64564,N,N,N,N,N,64565,N,64566,N,N,N,N,N,N,N, 32120,N,N,N,N,64569,N,64572,N,N,N,N,N,32121,N,N,N,N,32122,N,64570,64571,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64573,N,N,N,N,N,N,N,N,N,N,32124,32125,N,N, 32126,32289,N,32290,32291,N,N,N,N,N,N,N,N,N,N,32293,64574,N,N,N,N,N,32294,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64575,N,64576,N,N,64577,N,N,N,N,N,N, 64579,64580,N,32295,64581,64582,N,N,64583,N,N,64584,N,N,N,N,64585,32296,N,N, 64586,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64587,64589,N,64590,N,64591,N, 32297,N,N,64592,N,N,N,N,N,64593,64594,N,64595,64596,N,N,N,N,N,N,N,N,N,N,N,N,N, 64599,64600,N,N,64602,64603,64604,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64606,64607,64608,N,N,N,N,N,N,64609,64610,64611,N,N,N,64612,64613,N,N,N,N, 64614,N,N,N,N,N,N,64615,64616,N,N,N,N,N,N,N,N,N,32298,N,N,N,64617,N,N,64618, 64619,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32299,N,N,N,N,64620,N,N, 64621,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64622,N,N,N,64623,N,64624,N,N,N, 64625,N,N,N,N,N,64626,N,N,N,N,N,N,N,N,N,N,64627,N,N,N,N,64628,N,N,N,N,64629,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64631,N,N,N,N,N,N,N,N,64632,N,N,64633,32300, 32301,N,N,N,N,N,N,64634,N,N,N,N,N,N,64635,N,N,N,N,64636,N,N,N,64637,N,N,N,N,N, 64638,N,N,N,32302,N,N,N,N,N,N,N,N,32303,32304,N,N,64801,N,N,N,N,64802,N,32305, N,N,N,N,N,N,N,N,N,N,N,64803,N,N,N,N,N,32306,N,64804,N,32307,N,N,N,32308,N,N,N, N,N,64805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,64807,N,N,N,N,N,N,32309,64809,N,64811,N,N,N,N,N,N,N, 32310,N,32311,N,N,64813,N,N,N,N,N,N,N,32312,N,64814,N,64815,N,N,64816,32313,N, N,N,N,N,64818,N,N,N,64819,N,N,N,N,64820,N,N,N,64821,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,32314,32315,64822,N,N,N,N,32316,N,N,N,64823,N,N,N,64824,N,64825,N,N,N, 64826,N,N,N,N,N,64827,N,N,N,32317,N,N,N,N,N,N,N,N,N,N,64828,N,32319,N,N,N,N,N, 64829,N,N,N,N,N,N,N,N,N,64830,N,N,N,N,N,N,N,N,N,N,N,N,N,64832,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,32320,N,N,N,N,64833,N,64834,32322,N,N,N,N,64835,64836,N,N, N,N,N,32323,64837,N,32324,64838,64839,N,32321,N,N,N,N,N,N,N,N,N,N,32325,N,N,N, N,N,32326,N,N,N,N,32327,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32328,N,N,N,N,N,N,N,64840, 32329,N,N,N,N,64841,N,N,N,N,64842,64845,N,N,N,N,N,64846,N,N,N,N,N,64847,N,N, 32330,N,N,N,N,N,64848,N,N,N,N,N,N,32331,N,N,N,N,N,N,N,N,N,64850,N,N,N,N,64851, N,N,N,N,N,N,N,32332,N,64852,N,N,64853,64854,N,N,64856,64855,N,N,N,64849,N,N,N, 64860,32333,N,64858,N,N,32334,32335,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64862,N,64863,64864,64865,N,N,64866,N,N,N,N,64867,32336,N,N,N,64868,N,64869, 64870,N,N,N,N,N,N,64872,N,N,N,N,64873,64874,N,N,N,N,N,N,N,N,N,32337,N,N,N, 64875,N,N,N,64878,64879,N,N,N,N,32338,32339,N,N,32340,64881,N,N,N,64882,N,N, 64883,64876,64884,N,64885,N,N,N,32341,N,32342,N,N,N,64886,64887,64888,N,64889, 64890,N,64891,N,64892,N,N,64893,N,32343,N,N,64894,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65057,N,N,N,N,N,N,N,N,N,N,N,65058,65060,N,N,N,N, N,N,N,N,65059,N,N,N,N,N,65062,N,N,N,N,N,65063,65064,N,N,N,N,32344,32345,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65070, 32346,N,N,N,32347,N,N,65071,N,N,N,N,N,N,N,32348,N,N,N,N,N,N,N,N,N,N,N,N,65072, N,N,65073,32349,N,N,N,N,N,65075,N,65076,N,N,N,N,32350,N,N,65078,N,N,65079, 65080,N,N,N,N,32351,N,65081,N,N,N,N,N,65082,N,N,N,N,N,32352,N,N,65083,N,N,N,N, N,N,N,N,32353,N,N,65084,N,N,N,N,N,N,N,65085,N,N,N,N,N,N,N,N,N,N,32355,N,N,N,N, N,N,N,N,65087,N,N,N,65088,N,N,32356,65089,N,65086,32354,N,N,65090,N,N,N,65091, N,65092,N,N,N,N,N,N,N,N,N,N,N,N,65093,32357,N,N,65094,N,N,N,N,65095,65096,N,N, 65097,N,N,N,32359,N,N,N,N,N,N,N,N,N,N,N,N,65098,65101,N,N,N,N,32360,N,N,65100, N,N,65102,N,N,N,N,N,N,N,32361,N,N,N,65103,N,N,65104,65105,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,65106,32362,N,N,N,65108,N,N,N,N,65109,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,65110,N,N,32363,N,N,N,N,N,32364,N,N,N,65111,N,N,N,32365,N,N,32366, N,N,N,N,32367,32368,N,N,N,N,N,N,N,65113,N,N,N,N,N,32369,N,N,N,N,N,N,N,N,N,N,N, N,N,32370,N,N,N,N,N,N,N,N,N,N,N,N,N,65115,N,N,N,N,N,N,N,65116,N,N,N,N,N,N, 65117,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65118,65119,65121,N,N,N,N,N,N,N,N,N,N,N, N,32371,N,N,N,N,N,N,65122,N,65123,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 65124,N,N,N,N,N,N,N,65125,N,32372,65126,N,N,65127,N,N,N,65128,N,N,N,65129, 65130,N,N,N,N,N,N,N,N,N,N,N,N,65131,N,65132,N,32373,65133,N,N,N,N,65135,N,N,N, N,N,N,N,N,N,N,N,65137,N,N,N,65139,N,N,65140,N,N,N,N,65141,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32374,N,N,N,32375,N,N,32376,N,N,N,N,N,N,N,N,N, N,32377,30267,N,N,N,N,N,N,N,N,N,N,29742,30030,N,N,N,N,N,N,N,N,N,N,N,N,31567,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30281,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 32292,N,N,N,N,N,N,N,N,N,N,N,32093,12107,12119,20338,N,44665,30074,30554,30575, N,N,31036,31037,31041,N,N,N,31546,63288,63301,31790,N,63854,N,31850,N,N,N,N,N, N,N,N,N,11832,11849,11856,11875,11880,11886,12076,12079,12086,12122,12126, 20321,20322,29776,29788,29790,29793,29992,29995,30019,30053,30313,30327,30501, 30549,61481,30757,31015,31027,31028,31031,31032,31033,31035,31039,31040,31053, 31057,31076,31278,62544,31283,31290,31300,31320,62836,62837,31527,31599,31609, 31791,31792,31800,31805,63849,31833,32099,32118,32123,9022,9021,8752,N,N,N,N, 8751,N,N,N,N,N,8753, }; static const struct unim_index jisx0213_bmp_encmap[256] = { {__jisx0213_bmp_encmap+0,126,255},{__jisx0213_bmp_encmap+130,0,253},{ __jisx0213_bmp_encmap+384,80,233},{__jisx0213_bmp_encmap+538,0,194},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_bmp_encmap+733,62,63 },{__jisx0213_bmp_encmap+735,112,115},{__jisx0213_bmp_encmap+739,19,172},{ __jisx0213_bmp_encmap+893,15,233},{__jisx0213_bmp_encmap+1112,5,219},{ __jisx0213_bmp_encmap+1327,5,206},{__jisx0213_bmp_encmap+1529,35,254},{ __jisx0213_bmp_encmap+1749,177,230},{__jisx0213_bmp_encmap+1803,0,110},{ __jisx0213_bmp_encmap+1914,19,127},{0,0,0},{__jisx0213_bmp_encmap+2023,52,251 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_bmp_encmap+2223, 22,255},{__jisx0213_bmp_encmap+2457,240,255},{__jisx0213_bmp_encmap+2473,49, 250},{__jisx0213_bmp_encmap+2675,3,205},{__jisx0213_bmp_encmap+2878,2,219},{ __jisx0213_bmp_encmap+3096,31,244},{__jisx0213_bmp_encmap+3310,5,207},{ __jisx0213_bmp_encmap+3513,97,253},{__jisx0213_bmp_encmap+3670,0,250},{ __jisx0213_bmp_encmap+3921,23,111},{__jisx0213_bmp_encmap+4010,110,234},{ __jisx0213_bmp_encmap+4135,14,240},{__jisx0213_bmp_encmap+4362,15,210},{ __jisx0213_bmp_encmap+4558,17,212},{__jisx0213_bmp_encmap+4754,5,148},{ __jisx0213_bmp_encmap+4898,87,215},{__jisx0213_bmp_encmap+5027,57,147},{ __jisx0213_bmp_encmap+5118,5,243},{__jisx0213_bmp_encmap+5357,7,221},{ __jisx0213_bmp_encmap+5572,2,240},{__jisx0213_bmp_encmap+5811,8,212},{ __jisx0213_bmp_encmap+6016,8,234},{__jisx0213_bmp_encmap+6243,15,175},{ __jisx0213_bmp_encmap+6404,12,253},{__jisx0213_bmp_encmap+6646,22,181},{ __jisx0213_bmp_encmap+6806,176,250},{__jisx0213_bmp_encmap+6881,4,188},{ __jisx0213_bmp_encmap+7066,59,232},{__jisx0213_bmp_encmap+7240,23,209},{ __jisx0213_bmp_encmap+7427,7,119},{__jisx0213_bmp_encmap+7540,2,255},{ __jisx0213_bmp_encmap+7794,0,242},{__jisx0213_bmp_encmap+8037,0,243},{ __jisx0213_bmp_encmap+8281,3,244},{__jisx0213_bmp_encmap+8523,1,251},{ __jisx0213_bmp_encmap+8774,0,245},{__jisx0213_bmp_encmap+9020,18,255},{ __jisx0213_bmp_encmap+9258,0,233},{__jisx0213_bmp_encmap+9492,7,247},{ __jisx0213_bmp_encmap+9733,10,255},{__jisx0213_bmp_encmap+9979,4,244},{ __jisx0213_bmp_encmap+10220,5,248},{__jisx0213_bmp_encmap+10464,12,245},{ __jisx0213_bmp_encmap+10698,0,253},{__jisx0213_bmp_encmap+10952,3,244},{ __jisx0213_bmp_encmap+11194,6,233},{__jisx0213_bmp_encmap+11422,0,253},{ __jisx0213_bmp_encmap+11676,0,252},{__jisx0213_bmp_encmap+11929,13,248},{ __jisx0213_bmp_encmap+12165,16,245},{__jisx0213_bmp_encmap+12395,21,253},{ __jisx0213_bmp_encmap+12628,3,247},{__jisx0213_bmp_encmap+12873,9,255},{ __jisx0213_bmp_encmap+13120,4,252},{__jisx0213_bmp_encmap+13369,0,251},{ __jisx0213_bmp_encmap+13621,1,252},{__jisx0213_bmp_encmap+13873,1,252},{ __jisx0213_bmp_encmap+14125,3,254},{__jisx0213_bmp_encmap+14377,15,253},{ __jisx0213_bmp_encmap+14616,11,255},{__jisx0213_bmp_encmap+14861,2,251},{ __jisx0213_bmp_encmap+15111,0,252},{__jisx0213_bmp_encmap+15364,23,251},{ __jisx0213_bmp_encmap+15593,10,252},{__jisx0213_bmp_encmap+15836,0,236},{ __jisx0213_bmp_encmap+16073,3,254},{__jisx0213_bmp_encmap+16325,0,251},{ __jisx0213_bmp_encmap+16577,7,250},{__jisx0213_bmp_encmap+16821,1,255},{ __jisx0213_bmp_encmap+17076,1,249},{__jisx0213_bmp_encmap+17325,0,252},{ __jisx0213_bmp_encmap+17578,10,251},{__jisx0213_bmp_encmap+17820,5,254},{ __jisx0213_bmp_encmap+18070,0,237},{__jisx0213_bmp_encmap+18308,3,253},{ __jisx0213_bmp_encmap+18559,7,240},{__jisx0213_bmp_encmap+18793,1,245},{ __jisx0213_bmp_encmap+19038,3,249},{__jisx0213_bmp_encmap+19285,8,154},{ __jisx0213_bmp_encmap+19432,59,250},{__jisx0213_bmp_encmap+19624,2,251},{ __jisx0213_bmp_encmap+19874,13,255},{__jisx0213_bmp_encmap+20117,4,254},{ __jisx0213_bmp_encmap+20368,0,249},{__jisx0213_bmp_encmap+20618,1,253},{ __jisx0213_bmp_encmap+20871,12,255},{__jisx0213_bmp_encmap+21115,0,253},{ __jisx0213_bmp_encmap+21369,5,245},{__jisx0213_bmp_encmap+21610,1,245},{ __jisx0213_bmp_encmap+21855,1,255},{__jisx0213_bmp_encmap+22110,17,252},{ __jisx0213_bmp_encmap+22346,5,158},{__jisx0213_bmp_encmap+22500,57,254},{ __jisx0213_bmp_encmap+22698,9,253},{__jisx0213_bmp_encmap+22943,6,250},{ __jisx0213_bmp_encmap+23188,0,251},{__jisx0213_bmp_encmap+23440,2,255},{ __jisx0213_bmp_encmap+23694,0,251},{__jisx0213_bmp_encmap+23946,1,255},{ __jisx0213_bmp_encmap+24201,2,253},{__jisx0213_bmp_encmap+24453,4,114},{ __jisx0213_bmp_encmap+24564,120,222},{__jisx0213_bmp_encmap+24667,29,239},{ __jisx0213_bmp_encmap+24878,20,244},{__jisx0213_bmp_encmap+25103,4,243},{ __jisx0213_bmp_encmap+25343,8,252},{__jisx0213_bmp_encmap+25588,2,249},{ __jisx0213_bmp_encmap+25836,2,253},{__jisx0213_bmp_encmap+26088,0,242},{ __jisx0213_bmp_encmap+26331,2,244},{__jisx0213_bmp_encmap+26574,2,255},{ __jisx0213_bmp_encmap+26828,2,162},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_bmp_encmap+26989 ,29,220},{__jisx0213_bmp_encmap+27181,15,106},{0,0,0},{0,0,0},{0,0,0},{ __jisx0213_bmp_encmap+27273,69,70},{__jisx0213_bmp_encmap+27275,2,13}, }; static const ucs2_t __jisx0213_1_emp_decmap[340] = { 11,4669,U,U,U,U,U,U,U,U,U,4891,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,5230,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,6333,2975,U,U,U,U,U,U,U,U,U,U, U,U,U,U,5812,U,U,U,U,U,U,U,U,U,U,7732,12740,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, 13764,14143,U,U,U,U,U,U,U,U,14179,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15614,18417,21646,21774,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22385,U,U,U,U,U,U,U,U,U,U,U, U,22980,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23969,27391,28224,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28916,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30340,33399,U,U,U,U,U,U,U,33741,41360, }; static const struct dbcs_index jisx0213_1_emp_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __jisx0213_1_emp_decmap+0,34,34},{__jisx0213_1_emp_decmap+1,66,123},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{__jisx0213_1_emp_decmap+59,84,110},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_1_emp_decmap+86,58,114},{ __jisx0213_1_emp_decmap+143,41,96},{__jisx0213_1_emp_decmap+199,108,108},{ __jisx0213_1_emp_decmap+200,126,126},{__jisx0213_1_emp_decmap+201,41,110},{ __jisx0213_1_emp_decmap+271,93,93},{__jisx0213_1_emp_decmap+272,51,108},{ __jisx0213_1_emp_decmap+330,73,81},{0,0,0},{__jisx0213_1_emp_decmap+339,102, 102},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0}, }; static const ucs2_t __jisx0213_2_emp_decmap[2053] = { 137,U,U,U,U,U,U,U,U,U,162,U,U,164,U,U,U,U,U,U,U,418,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,531,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,811,U,U,U,U,U,U,897,U,881,1017,U,U,1098,U,1289,U,U,U,U,U,U,U,U,U, 1494,1576,U,U,U,U,U,1871,U,U,U,U,U,U,2055,U,2106,U,U,U,U,U,U,U,U,2233,U,U,U,U, U,U,U,2428,2461,U,U,U,U,U,2771,U,U,2845,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,3397,3553,U,U,U,U,U,U,3733,3693,U,U,U,U,U,U,U,3684,U,U,3935,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,4609,U,U,4693,U,4731,U,U,U, U,4724,U,U,U,U,U,U,4836,4823,U,U,U,U,U,U,4861,U,4918,4932,5060,U,U,U,U,U,U,U, U,U,U,U,U,5229,U,U,U,U,U,U,U,U,U,U,U,5591,U,U,U,U,U,27689,U,U,5703,U,U,U,U,U, U,U,U,U,U,U,U,U,5894,5954,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,6595,7254,U,U,U,U,U,U,7469,7493,U,7544,7522,U,U,U, 7585,7580,U,U,U,U,7570,U,U,7607,U,7648,7731,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, 7966,U,U,U,U,U,U,U,U,U,U,8054,U,U,U,U,U,8186,8571,U,U,U,U,U,U,U,U,8990,U,U,U, U,9133,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,9971,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,10331,U,U,U,U,U,U,U,10411,U,U,U,U,10639, 10936,U,U,U,U,11087,11088,U,U,U,U,U,U,U,11078,U,11293,11174,U,U,U,11300,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,11745,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12739,12789,12726,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13170,U,13267,13266,U,U,U,U,13264,13284, 13269,U,U,13274,U,13279,U,U,U,U,U,U,U,U,U,U,U,13386,13393,13387,U,U,U,13413,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13540,13658,13716,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13881,13895,U,13880,13882,U,U,U,U,U,U,U,U,U,U, 14108,U,U,U,U,U,U,U,U,U,U,14092,U,U,U,U,U,U,U,14180,U,U,U,U,U,U,U,14335,14311, U,U,U,U,U,14372,U,U,U,U,14397,15000,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15487,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15616,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, 15680,U,15866,15865,15827,16254,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,16534, U,U,U,U,U,16643,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,16838,U,U,16894,17340,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,17961,U,U,U,U,U,18085,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,18582,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,19021,19286,U,19311,U,U,U,U,19478,U,U,U,U,U,U,U, U,U,U,U,U,U,U,19732,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,19982,U,U, U,20023,U,U,U,U,20074,U,U,20107,U,U,U,U,U,U,U,U,U,U,U,20554,U,20565,U,U,20770, 20905,U,20965,20941,U,U,U,21022,U,U,U,21068,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, 21550,U,U,U,U,U,U,U,U,U,U,21721,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,21927,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22441,22452,22996,U,U,U,U,U,U,U, U,U,U,23268,23267,U,23281,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23474,U,U,U,U,U,U, U,U,U,U,23627,23652,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24110,24150,24165, U,24162,U,U,U,24280,U,24258,24296,U,24355,U,U,24412,U,U,U,U,U,U,24544,24532,U, U,U,U,24588,24571,U,U,U,U,U,U,U,24599,U,U,U,U,24672,U,U,U,U,U,U,U,U,U,U,U,U, 24813,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25200,U,25222,U,U,U,U, U,U,25420,U,U,15630,U,U,U,25602,26238,U,U,U,U,26288,U,U,U,U,U,U,U,U,U,U,U, 26397,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,26845,U,26858,U,26961,U,U,26991,U,27101,U, U,U,27166,U,U,U,U,U,U,27224,U,U,U,U,U,27276,U,U,27319,27763,U,U,U,U,U,U,U,U,U, 27869,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28261,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,28564,U,U,U,U,U,U,U,U,28664,28662,28663,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,28941,U,U,28985,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29659,29658,U,U,U,U,U,29694,U,U,29712,U,U,U,U, 29769,30229,30228,U,30257,U,U,U,U,U,U,U,30355,U,U,U,U,U,U,U,30478,U,30499,U,U, U,30546,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31109,U,U,U,U,U,U,U,U,U,U,U,U, 31364,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31667,U,31678,31687,31928,U,U,U,U, U,U,U,U,U,32160,U,U,32272,U,U,U,U,U,U,32695,U,U,U,U,U,U,U,U,32906,U,U,U,U,U, 32955,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33410,U,U,U,U,33523,U,U,U,U,U,U,U,33804, U,U,U,U,33877,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34155,U,U,U,34248,34249,U,U,U,U,U,U, U,U,U,U,34519,U,U,34554,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,35145,35142,U,U,U,U,U,U,35179,U,U,U,U,U,U,U,U,U,U,U,U,U,35207,35208,U, U,U,U,U,U,U,U,U,U,35258,35259,U,U,U,U,U,U,U,U,U,U,U,35358,35369,U,U,U,U,U,U,U, U,U,U,35441,35395,U,U,U,U,U,U,U,U,35481,35533,U,U,U,U,U,35556,35549,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,35777,35823,U,U,U,U,U,U,U,36112,U,U,36209,U,36347,36383,U, U,U,36406,U,U,U,36489,U,36587,U,36658,U,U,U,U,U,U,U,36856,37536,37553,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38032,U,U,U,U,U,U,U,U,U,38351,U,U,U,U,U,U,U,U, U,38527,U,U,U,U,U,U,U,U,U,38640,U,U,38681,U,U,U,38736,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,U,U,U,39110,39538,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,U,U,U,U,U,U,U,40411,40509,U,U,U,U,U,U,U,U,U,U,U,U,40469,U,40586,U,40521,U, U,U,U,U,U,U,U,U,40644,U,U,U,U,U,40681,U,U,40667,40910,U,U,U,41007,U,40986,U,U, U,U,U,U,41209,U,U,41090,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, U,U,8728,U,U,U,U,41868,U,42039,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,42481,U, 42498,U,42522,U,U,U,42674, }; static const struct dbcs_index jisx0213_2_emp_decmap[256] = { {0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_emp_decmap+0,33,121},{0,0,0},{ __jisx0213_2_emp_decmap+89,34,119},{__jisx0213_2_emp_decmap+175,42,117},{ __jisx0213_2_emp_decmap+251,37,126},{0,0,0},{0,0,0},{__jisx0213_2_emp_decmap+ 341,48,108},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_emp_decmap+402,34,114},{ __jisx0213_2_emp_decmap+483,36,125},{__jisx0213_2_emp_decmap+573,35,120},{ __jisx0213_2_emp_decmap+659,42,117},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ __jisx0213_2_emp_decmap+735,35,96},{__jisx0213_2_emp_decmap+797,50,100},{ __jisx0213_2_emp_decmap+848,34,123},{__jisx0213_2_emp_decmap+938,46,122},{ __jisx0213_2_emp_decmap+1015,33,118},{__jisx0213_2_emp_decmap+1101,50,125},{ __jisx0213_2_emp_decmap+1177,34,121},{__jisx0213_2_emp_decmap+1265,53,115},{ __jisx0213_2_emp_decmap+1328,68,126},{__jisx0213_2_emp_decmap+1387,33,115},{ __jisx0213_2_emp_decmap+1470,41,122},{__jisx0213_2_emp_decmap+1552,37,126},{ __jisx0213_2_emp_decmap+1642,33,126},{__jisx0213_2_emp_decmap+1736,33,113},{ __jisx0213_2_emp_decmap+1817,34,118},{__jisx0213_2_emp_decmap+1902,44,112},{ __jisx0213_2_emp_decmap+1971,37,118},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, }; static const DBCHAR __jisx0213_emp_encmap[8787] = { 11810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,41249,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 41259,N,41262,41270,41286,41328,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,41337,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41335,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41762,41765,41767, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,41777,41778,41784,41791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41793,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,41802,41810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,41811,41817,41820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20308,41847,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42026,42042,N,N,N, N,N,N,N,N,42034,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,42033,42045,42073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 12098,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42076,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42083,N,N,N,N,N,N,42078,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,42091,N,N,N,N,N,N,N,N,N,N,N,N,42090,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,42098,12108,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,42100,N,N,N,N,N,N,N,N,N,N,N,N,N,42101,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42277,42290, 12128,42302,42311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 20323,42325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42326,12155,42366,43056, 43063,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43064,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,43066,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43077,N,N,N,N,N, N,N,N,N,43072,N,N,N,N,43071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43080,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 43082,43083,20334,43099,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43110,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 43116,44066,65107,44075,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 44080,44112,44133,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,44141,44146,44324,44338,N,N,N,N,N,N,N,N,44329,44330,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,44341,44340,N,N,N,N,N,N,44345,44374,44580,N,N,N,N,N,N,N,N,N,N,N,N, 44413,30010,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44579,44602,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44610, N,44605,44604,N,44612,N,N,N,N,44615,N,N,N,N,44617,N,N,N,N,44611,44629,44631,N, N,N,N,N,44630,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44635,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 44663,44664,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44842,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30066, 44866,44863,44867,N,N,N,N,N,N,N,N,N,N,N,N,44864,44889,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,44878,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,30249,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 30258,44897,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44906,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,44905,44912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44917, 60963,60980,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30304,61001,N,N,N,N,N,N,N,N,N,N,N,N,N,62581,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,61020,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,61024,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,61023,61022,61234,61255,61261,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61281,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61284, 61474,61491,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,61497,30572,61523,61563,61742,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,61744,61749,61764,61789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61793,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 61798,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61801, 61813,N,N,N,N,N,N,N,N,N,N,61815,61818,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61985, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61988,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61987,61992,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61996, 62013,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30846,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62024,31017,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62043,31047,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,62069,N,N,N,N,N,N,N,N,N,N,62070,31060,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 62258,62270,62269,N,N,N,N,N,N,N,N,N,N,N,N,62272,62290,62301,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62302,31086,62323,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62324,N,N,N,N,N,N,N,N,N,N,N, 62327,N,N,62325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62333,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,62331,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62498,62500,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,62503,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,62511,N,N,N,N,N,N,N,N,N,N,N,62510,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62517,62516,N,N,N,N,N,N,N,N,N,N,62525,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62530,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62543,62569,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,62571,62578,62585,62773,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62778,62790,62806,N,N, N,N,N,N,N,N,N,N,N,N,62808,62810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,62813,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,62815,62819,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62826,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,62832,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,62835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,31325,42308,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,63044,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63054, 31539,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 63069,63093,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63265,63266,63102,31561, 63283,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,63286,63333,63332,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,63339,63342,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63347, 63530,63529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63532,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,31596,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63540,63548,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,63550,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63554,63574,63587,63607,N,N,N,N,N,N,N,N,N,N, 63609,N,N,N,N,N,N,N,N,63610,63781,63791,63794,63801,63810,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 63816,31817,N,N,N,N,N,N,N,N,N,N,63833,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,63838,31825,63846,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63851,63866,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 63870,64033,64044,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,64047,64080,N,N,64079,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,64087,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64101,64102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64113,64114,64126,N,N,N,N,N,N,N,N,N,N,64289,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64301,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64300,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64310, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,64311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64318,N,N,N,N,N,N, 64317,64334,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,64335,64343,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64346, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64348,64349,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,64353,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64357,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64359,64361,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,64369,64546,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64547,64568,64578, 64588,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64598,64601,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64605,64630,64812,64843,64857,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64844, N,N,N,N,N,N,N,N,N,N,N,64861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, 64859,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64871,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,64880,N,N,N,N,N,N,N,N,N,N,N,N,N,64877,65061,65067,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,65065,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65074,32358,65112,65114,65134, 65136,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65138,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65142, }; static const struct unim_index jisx0213_emp_encmap[256] = { {__jisx0213_emp_encmap+0,11,164},{__jisx0213_emp_encmap+154,162,162},{ __jisx0213_emp_encmap+155,19,19},{__jisx0213_emp_encmap+156,43,249},{ __jisx0213_emp_encmap+363,74,74},{__jisx0213_emp_encmap+364,9,214},{ __jisx0213_emp_encmap+570,40,40},{__jisx0213_emp_encmap+571,79,79},{ __jisx0213_emp_encmap+572,7,185},{__jisx0213_emp_encmap+751,124,157},{ __jisx0213_emp_encmap+785,211,211},{__jisx0213_emp_encmap+786,29,159},{0,0,0}, {__jisx0213_emp_encmap+917,69,225},{__jisx0213_emp_encmap+1074,100,149},{ __jisx0213_emp_encmap+1124,95,95},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+1125, 1,253},{__jisx0213_emp_encmap+1378,27,196},{__jisx0213_emp_encmap+1548,109,110 },{__jisx0213_emp_encmap+1550,215,215},{__jisx0213_emp_encmap+1551,71,180},{ __jisx0213_emp_encmap+1661,6,66},{__jisx0213_emp_encmap+1722,189,189},{ __jisx0213_emp_encmap+1723,195,195},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+ 1724,86,86},{__jisx0213_emp_encmap+1725,45,224},{__jisx0213_emp_encmap+1905, 51,52},{__jisx0213_emp_encmap+1907,30,250},{0,0,0},{__jisx0213_emp_encmap+2128 ,123,123},{__jisx0213_emp_encmap+2129,24,24},{__jisx0213_emp_encmap+2130,30, 173},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+2274,243,243},{0,0,0},{ __jisx0213_emp_encmap+2275,91,171},{__jisx0213_emp_encmap+2356,143,143},{ __jisx0213_emp_encmap+2357,184,184},{__jisx0213_emp_encmap+2358,70,166},{ __jisx0213_emp_encmap+2455,29,36},{__jisx0213_emp_encmap+2463,225,225},{0,0,0 },{0,0,0},{0,0,0},{__jisx0213_emp_encmap+2464,182,245},{0,0,0},{ __jisx0213_emp_encmap+2528,114,228},{__jisx0213_emp_encmap+2643,74,228},{ __jisx0213_emp_encmap+2798,90,196},{__jisx0213_emp_encmap+2905,56,71},{ __jisx0213_emp_encmap+2921,12,255},{__jisx0213_emp_encmap+3165,36,61},{0,0,0}, {__jisx0213_emp_encmap+3191,152,152},{0,0,0},{__jisx0213_emp_encmap+3192,127, 254},{__jisx0213_emp_encmap+3320,0,250},{0,0,0},{__jisx0213_emp_encmap+3571, 126,126},{__jisx0213_emp_encmap+3572,150,150},{__jisx0213_emp_encmap+3573,3, 254},{0,0,0},{__jisx0213_emp_encmap+3825,188,188},{0,0,0},{0,0,0},{ __jisx0213_emp_encmap+3826,41,165},{__jisx0213_emp_encmap+3951,241,241},{ __jisx0213_emp_encmap+3952,150,150},{0,0,0},{__jisx0213_emp_encmap+3953,77,77 },{__jisx0213_emp_encmap+3954,86,111},{__jisx0213_emp_encmap+3980,22,22},{ __jisx0213_emp_encmap+3981,20,20},{__jisx0213_emp_encmap+3982,14,139},{0,0,0}, {__jisx0213_emp_encmap+4108,74,85},{__jisx0213_emp_encmap+4120,34,229},{ __jisx0213_emp_encmap+4316,30,76},{0,0,0},{__jisx0213_emp_encmap+4363,46,217}, {__jisx0213_emp_encmap+4535,14,167},{0,0,0},{__jisx0213_emp_encmap+4689,113, 180},{0,0,0},{__jisx0213_emp_encmap+4757,196,212},{__jisx0213_emp_encmap+4774, 227,241},{__jisx0213_emp_encmap+4789,178,178},{__jisx0213_emp_encmap+4790,75, 100},{__jisx0213_emp_encmap+4816,161,161},{__jisx0213_emp_encmap+4817,46,232}, {__jisx0213_emp_encmap+5004,35,251},{__jisx0213_emp_encmap+5221,12,237},{0,0,0 },{__jisx0213_emp_encmap+5447,112,134},{__jisx0213_emp_encmap+5470,76,76},{ __jisx0213_emp_encmap+5471,2,2},{0,0,0},{__jisx0213_emp_encmap+5472,126,176},{ __jisx0213_emp_encmap+5523,29,29},{__jisx0213_emp_encmap+5524,221,234},{ __jisx0213_emp_encmap+5538,81,221},{__jisx0213_emp_encmap+5679,30,255},{0,0,0 },{__jisx0213_emp_encmap+5905,41,221},{0,0,0},{__jisx0213_emp_encmap+6086,64, 101},{__jisx0213_emp_encmap+6124,148,248},{__jisx0213_emp_encmap+6225,244,244 },{__jisx0213_emp_encmap+6226,13,57},{0,0,0},{__jisx0213_emp_encmap+6271,218, 254},{__jisx0213_emp_encmap+6308,16,73},{0,0,0},{__jisx0213_emp_encmap+6366, 20,147},{__jisx0213_emp_encmap+6494,14,82},{0,0,0},{__jisx0213_emp_encmap+6563 ,133,133},{__jisx0213_emp_encmap+6564,132,132},{__jisx0213_emp_encmap+6565, 179,199},{__jisx0213_emp_encmap+6586,184,184},{__jisx0213_emp_encmap+6587,160, 160},{__jisx0213_emp_encmap+6588,16,16},{__jisx0213_emp_encmap+6589,183,183},{ __jisx0213_emp_encmap+6590,138,187},{0,0,0},{__jisx0213_emp_encmap+6640,119, 243},{__jisx0213_emp_encmap+6765,205,205},{__jisx0213_emp_encmap+6766,12,85},{ __jisx0213_emp_encmap+6840,107,201},{__jisx0213_emp_encmap+6935,215,250},{0,0, 0},{0,0,0},{__jisx0213_emp_encmap+6971,70,187},{__jisx0213_emp_encmap+7089,30, 228},{__jisx0213_emp_encmap+7288,193,239},{0,0,0},{__jisx0213_emp_encmap+7335, 16,251},{__jisx0213_emp_encmap+7571,31,235},{__jisx0213_emp_encmap+7776,50,248 },{0,0,0},{0,0,0},{__jisx0213_emp_encmap+7975,160,177},{0,0,0},{ __jisx0213_emp_encmap+7993,144,144},{__jisx0213_emp_encmap+7994,207,207},{ __jisx0213_emp_encmap+7995,127,240},{__jisx0213_emp_encmap+8109,25,80},{ __jisx0213_emp_encmap+8165,198,198},{0,0,0},{__jisx0213_emp_encmap+8166,114, 114},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+8167,219,219},{ __jisx0213_emp_encmap+8168,21,233},{__jisx0213_emp_encmap+8381,206,206},{ __jisx0213_emp_encmap+8382,26,249},{__jisx0213_emp_encmap+8606,144,144},{0,0,0 },{__jisx0213_emp_encmap+8607,140,140},{__jisx0213_emp_encmap+8608,55,55},{ __jisx0213_emp_encmap+8609,241,241},{__jisx0213_emp_encmap+8610,2,178},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, 0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ 0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 },{0,0,0}, };
c
github
https://github.com/python/cpython
Modules/cjkcodecs/mappings_jp.h
// Copyright 2015 The Prometheus Authors // 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. package aws import ( "github.com/prometheus/prometheus/discovery" ) type mskMetrics struct { refreshMetrics discovery.RefreshMetricsInstantiator } var _ discovery.DiscovererMetrics = (*mskMetrics)(nil) // Register implements discovery.DiscovererMetrics. func (*mskMetrics) Register() error { return nil } // Unregister implements discovery.DiscovererMetrics. func (*mskMetrics) Unregister() {}
go
github
https://github.com/prometheus/prometheus
discovery/aws/metrics_msk.go
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2014-2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # qutebrowser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. """Base class for vim-like key sequence parser.""" import re import functools import unicodedata from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject from qutebrowser.config import config from qutebrowser.utils import usertypes, log, utils, objreg class BaseKeyParser(QObject): """Parser for vim-like key sequences and shortcuts. Not intended to be instantiated directly. Subclasses have to override execute() to do whatever they want to. Class Attributes: Match: types of a match between a binding and the keystring. partial: No keychain matched yet, but it's still possible in the future. definitive: Keychain matches exactly. ambiguous: There are both a partial and a definitive match. none: No more matches possible. Types: type of a key binding. chain: execute() was called via a chain-like key binding special: execute() was called via a special key binding do_log: Whether to log keypresses or not. passthrough: Whether unbound keys should be passed through with this handler. Attributes: bindings: Bound key bindings special_bindings: Bound special bindings (<Foo>). _win_id: The window ID this keyparser is associated with. _warn_on_keychains: Whether a warning should be logged when binding keychains in a section which does not support them. _keystring: The currently entered key sequence _ambiguous_timer: Timer for delayed execution with ambiguous bindings. _modename: The name of the input mode associated with this keyparser. _supports_count: Whether count is supported _supports_chains: Whether keychains are supported Signals: keystring_updated: Emitted when the keystring is updated. arg: New keystring. """ keystring_updated = pyqtSignal(str) do_log = True passthrough = False Match = usertypes.enum('Match', ['partial', 'definitive', 'ambiguous', 'other', 'none']) Type = usertypes.enum('Type', ['chain', 'special']) def __init__(self, win_id, parent=None, supports_count=None, supports_chains=False): super().__init__(parent) self._win_id = win_id self._ambiguous_timer = usertypes.Timer(self, 'ambiguous-match') self._ambiguous_timer.setSingleShot(True) self._modename = None self._keystring = '' if supports_count is None: supports_count = supports_chains self._supports_count = supports_count self._supports_chains = supports_chains self._warn_on_keychains = True self.bindings = {} self.special_bindings = {} def __repr__(self): return utils.get_repr(self, supports_count=self._supports_count, supports_chains=self._supports_chains) def _debug_log(self, message): """Log a message to the debug log if logging is active. Args: message: The message to log. """ if self.do_log: log.keyboard.debug(message) def _handle_special_key(self, e): """Handle a new keypress with special keys (<Foo>). Return True if the keypress has been handled, and False if not. Args: e: the KeyPressEvent from Qt. Return: True if event has been handled, False otherwise. """ binding = utils.keyevent_to_string(e) if binding is None: self._debug_log("Ignoring only-modifier keyeevent.") return False binding = binding.lower() try: cmdstr = self.special_bindings[binding] except KeyError: self._debug_log("No binding found for {}.".format(binding)) return False self.execute(cmdstr, self.Type.special) return True def _split_count(self): """Get count and command from the current keystring. Return: A (count, command) tuple. """ if self._supports_count: (countstr, cmd_input) = re.match(r'^(\d*)(.*)', self._keystring).groups() count = int(countstr) if countstr else None if count == 0 and not cmd_input: cmd_input = self._keystring count = None else: cmd_input = self._keystring count = None return count, cmd_input def _handle_single_key(self, e): """Handle a new keypress with a single key (no modifiers). Separate the keypress into count/command, then check if it matches any possible command, and either run the command, ignore it, or display an error. Args: e: the KeyPressEvent from Qt. Return: A self.Match member. """ txt = e.text() key = e.key() self._debug_log("Got key: 0x{:x} / text: '{}'".format(key, txt)) if len(txt) == 1: category = unicodedata.category(txt) is_control_char = (category == 'Cc') else: is_control_char = False if (not txt) or is_control_char: self._debug_log("Ignoring, no text char") return self.Match.none self._stop_timers() self._keystring += txt count, cmd_input = self._split_count() if not cmd_input: # Only a count, no command yet, but we handled it return self.Match.other match, binding = self._match_key(cmd_input) if match == self.Match.definitive: self._debug_log("Definitive match for '{}'.".format( self._keystring)) self._keystring = '' self.execute(binding, self.Type.chain, count) elif match == self.Match.ambiguous: self._debug_log("Ambiguous match for '{}'.".format( self._keystring)) self._handle_ambiguous_match(binding, count) elif match == self.Match.partial: self._debug_log("No match for '{}' (added {})".format( self._keystring, txt)) elif match == self.Match.none: self._debug_log("Giving up with '{}', no matches".format( self._keystring)) self._keystring = '' else: raise AssertionError("Invalid match value {!r}".format(match)) return match def _match_key(self, cmd_input): """Try to match a given keystring with any bound keychain. Args: cmd_input: The command string to find. Return: A tuple (matchtype, binding). matchtype: Match.definitive, Match.ambiguous, Match.partial or Match.none binding: - None with Match.partial/Match.none - The found binding with Match.definitive/ Match.ambiguous """ # A (cmd_input, binding) tuple (k, v of bindings) or None. definitive_match = None partial_match = False # Check definitive match try: definitive_match = (cmd_input, self.bindings[cmd_input]) except KeyError: pass # Check partial match for binding in self.bindings: if definitive_match is not None and binding == definitive_match[0]: # We already matched that one continue elif binding.startswith(cmd_input): partial_match = True break if definitive_match is not None and partial_match: return (self.Match.ambiguous, definitive_match[1]) elif definitive_match is not None: return (self.Match.definitive, definitive_match[1]) elif partial_match: return (self.Match.partial, None) else: return (self.Match.none, None) def _stop_timers(self): """Stop a delayed execution if any is running.""" if self._ambiguous_timer.isActive() and self.do_log: log.keyboard.debug("Stopping delayed execution.") self._ambiguous_timer.stop() try: self._ambiguous_timer.timeout.disconnect() except TypeError: # no connections pass def _handle_ambiguous_match(self, binding, count): """Handle an ambiguous match. Args: binding: The command-string to execute. count: The count to pass. """ self._debug_log("Ambiguous match for '{}'".format(self._keystring)) time = config.get('input', 'timeout') if time == 0: # execute immediately self._keystring = '' self.execute(binding, self.Type.chain, count) else: # execute in `time' ms self._debug_log("Scheduling execution of {} in {}ms".format( binding, time)) self._ambiguous_timer.setInterval(time) self._ambiguous_timer.timeout.connect( functools.partial(self.delayed_exec, binding, count)) self._ambiguous_timer.start() def delayed_exec(self, command, count): """Execute a delayed command. Args: command/count: As if passed to self.execute() """ self._debug_log("Executing delayed command now!") self._keystring = '' self.keystring_updated.emit(self._keystring) self.execute(command, self.Type.chain, count) def handle(self, e): """Handle a new keypress and call the respective handlers. Args: e: the KeyPressEvent from Qt Return: True if the event was handled, False otherwise. """ handled = self._handle_special_key(e) if handled or not self._supports_chains: return handled match = self._handle_single_key(e) self.keystring_updated.emit(self._keystring) return match != self.Match.none def read_config(self, modename=None): """Read the configuration. Config format: key = command, e.g.: <Ctrl+Q> = quit Args: modename: Name of the mode to use. """ if modename is None: if self._modename is None: raise ValueError("read_config called with no mode given, but " "None defined so far!") modename = self._modename else: self._modename = modename self.bindings = {} self.special_bindings = {} keyconfparser = objreg.get('key-config') for (key, cmd) in keyconfparser.get_bindings_for(modename).items(): assert cmd self._parse_key_command(modename, key, cmd) def _parse_key_command(self, modename, key, cmd): """Parse the keys and their command and store them in the object.""" if key.startswith('<') and key.endswith('>'): keystr = utils.normalize_keystr(key[1:-1]) self.special_bindings[keystr] = cmd elif self._supports_chains: self.bindings[key] = cmd elif self._warn_on_keychains: log.keyboard.warning( "Ignoring keychain '{}' in mode '{}' because " "keychains are not supported there." .format(key, modename)) def execute(self, cmdstr, keytype, count=None): """Handle a completed keychain. Args: cmdstr: The command to execute as a string. keytype: Type.chain or Type.special count: The count if given. """ raise NotImplementedError @pyqtSlot(str) def on_keyconfig_changed(self, mode): """Re-read the config if a key binding was changed.""" if self._modename is None: raise AssertionError("on_keyconfig_changed called but no section " "defined!") if mode == self._modename: self.read_config() def clear_keystring(self): """Clear the currently entered key sequence.""" self._debug_log("discarding keystring '{}'.".format(self._keystring)) self._keystring = '' self.keystring_updated.emit(self._keystring)
unknown
codeparrot/codeparrot-clean
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import IuguLoader # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling optional imports. DEPRECATED_LOOKUP = {"IuguLoader": "langchain_community.document_loaders"} _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP) def __getattr__(name: str) -> Any: """Look up attributes dynamically.""" return _import_attribute(name) __all__ = [ "IuguLoader", ]
python
github
https://github.com/langchain-ai/langchain
libs/langchain/langchain_classic/document_loaders/iugu.py
# Copyright 2019 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. # ============================================================================== """Test configs for depth_to_space.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.compat.v1 as tf from tensorflow.lite.testing.zip_test_utils import create_tensor_data from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests from tensorflow.lite.testing.zip_test_utils import register_make_test_function @register_make_test_function() def make_depth_to_space_tests(options): """Make a set of tests to do depth_to_space.""" test_parameters = [{ "dtype": [tf.float32, tf.int32, tf.uint8, tf.int64], "input_shape": [[2, 3, 4, 16]], "block_size": [2, 4], }] def build_graph(parameters): input_tensor = tf.compat.v1.placeholder( dtype=parameters["dtype"], name="input", shape=parameters["input_shape"]) out = tf.compat.v1.depth_to_space( input_tensor, block_size=parameters["block_size"]) return [input_tensor], [out] def build_inputs(parameters, sess, inputs, outputs): input_values = create_tensor_data(parameters["dtype"], parameters["input_shape"]) return [input_values], sess.run( outputs, feed_dict=dict(zip(inputs, [input_values]))) make_zip_of_tests(options, test_parameters, build_graph, build_inputs)
unknown
codeparrot/codeparrot-clean
""" Purpose: Set of unit tests for nilsimsa package. Test data consists of 20 randomly selected documents from a Diffeo corpus. This software is released under an MIT/X11 open source license. Copyright 2012-2014 Diffeo, Inc. """ import cPickle as pickle import dircache import os import pytest import random from deprecated._deprecated_nilsimsa import Nilsimsa as orig_Nilsimsa from nilsimsa import Nilsimsa, compare_digests test_data_dir = "test_data/" sid_to_nil = pickle.load(open("test_data/test_dict.p", "rb")) def test_nilsimsa(): """ tests the nilsimsa hash by choosing a random test file computes the nilsimsa digest and compares to the true value stored in the pickled sid_to_nil dictionary """ fname = random.choice(dircache.listdir(test_data_dir)) f = open(os.path.join(test_data_dir, fname), "rb") nil = Nilsimsa(f.read()) f.close() assert nil.hexdigest() == sid_to_nil[fname.split(".")[0]] def test_compare_hex(): """ tests compare_digests by computing the nilsimsa score of two documents with a known score """ sid_1 = "1352396387-81c1161097f9f00914e1b152ca4c0f46" sid_2 = "1338103128-006193af403dcc90c962184df08960a3" assert compare_digests(sid_to_nil[sid_1], sid_to_nil[sid_2]) == 95 def test_compatability(): """ testing compat with deprecated version by comparing nilsimsa scores of 5 randomly selected documents from the test corpus and asserting that both give the same hexdigest """ names = dircache.listdir(test_data_dir) fnames = set([random.choice(names) for i in range(5)]) for fname in fnames: f = open(os.path.join(test_data_dir, fname), "rb") text = f.read() f.close() if not(Nilsimsa(text).hexdigest() == orig_Nilsimsa(text).hexdigest()): assert False assert True
unknown
codeparrot/codeparrot-clean
#!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2013,2014,2015,2016,2017 Contributor # # 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 unittest if __name__ == "__main__": import utils utils.import_depends() from brokertest import TestBrokerCommand class TestNetworkConstraints(TestBrokerCommand): def test_100_add_testnet(self): self.net.allocate_network(self, "bunker_mismatch1", 24, "unknown", "building", "ut") self.net.allocate_network(self, "bunker_mismatch2", 24, "unknown", "bunker", "bucket1.ut") def test_110_mismatch_1(self): # Rack is bunkerized, network is not net = self.net["bunker_mismatch1"] ip = net.usable[0] self.dsdb_expect_add("mismatch1.aqd-unittest.ms.com", ip, "eth0_bunkertest", primary="aquilon61.aqd-unittest.ms.com") command = ["add_interface_address", "--machine", "aquilon61.aqd-unittest.ms.com", "--interface", "eth0", "--label", "bunkertest", "--ip", ip, "--fqdn", "mismatch1.aqd-unittest.ms.com"] err = self.statustest(command) self.matchoutput(err, "Bunker violation: rack ut9 is inside bunker " "bucket2.ut, but network %s [%s] " "is not bunkerized." % (net.name, net), command) self.dsdb_verify() def test_120_mismatch_2(self): # Rack and network has different bunkers net = self.net["bunker_mismatch2"] ip = net.usable[0] self.dsdb_expect_add("mismatch2.aqd-unittest.ms.com", ip, "eth0_bunkertest", primary="aquilon62.aqd-unittest.ms.com") command = ["add_interface_address", "--machine", "aquilon62.aqd-unittest.ms.com", "--interface", "eth0", "--label", "bunkertest", "--ip", ip, "--fqdn", "mismatch2.aqd-unittest.ms.com"] err = self.statustest(command) self.matchoutput(err, "Bunker violation: rack ut9 is inside bunker " "bucket2.ut, but network %s [%s] is inside " "bunker bucket1.ut." % (net.name, net), command) self.dsdb_verify() def test_130_mismatch_3(self): # Network is bunkerized, rack is not net = self.net["bunker_mismatch2"] ip = net.usable[1] self.dsdb_expect_add("mismatch3.aqd-unittest.ms.com", ip, "eth0_bunkertest", primary="server9.aqd-unittest.ms.com") command = ["add_interface_address", "--machine", "server9.aqd-unittest.ms.com", "--interface", "eth0", "--label", "bunkertest", "--ip", net.usable[1], "--fqdn", "mismatch3.aqd-unittest.ms.com"] err = self.statustest(command) self.matchoutput(err, "Bunker violation: network %s [%s] is " "inside bunker bucket1.ut, but rack ut8 is not inside " "a bunker." % (net.name, net), command) self.dsdb_verify() def test_200_show_bunker_violations(self): command = ["show_bunker_violations"] out = self.commandtest(command) self.searchoutput(out, r"Warning: Rack ut8 is not part of a bunker, but it " r"uses bunkerized networks:\s*" r"BUCKET1: server9\.aqd-unittest\.ms\.com/eth0\s*" r"BUCKET2: aquilon91\.aqd-unittest\.ms\.com/eth0, server9\.aqd-unittest\.ms\.com/eth0", command) self.matchoutput(out, "aq update rack --rack np7 --building np", command) self.searchoutput(out, r"Warning: Rack ut9 is part of bunker bucket2.ut, but " r"also has networks from:\s*" r"\(No bucket\): aquilon61\.aqd-unittest\.ms\.com/eth0\s*" r"BUCKET1: aquilon62\.aqd-unittest\.ms\.com/eth0", command) def test_210_show_bunker_violations_management(self): command = ["show_bunker_violations", "--management_interfaces"] out = self.commandtest(command) self.searchoutput(out, r"Warning: Rack ut8 is not part of a bunker, but it " r"uses bunkerized networks:\s*" r"BUCKET1: server9\.aqd-unittest\.ms\.com/eth0\s*" r"BUCKET2: aquilon91\.aqd-unittest\.ms\.com/eth0, server9\.aqd-unittest\.ms\.com/eth0", command) self.matchoutput(out, "aq update rack --rack np7 --building np", command) self.searchoutput(out, r"Warning: Rack ut9 is part of bunker bucket2.ut, but " r"also has networks from:\s*" r"\(No bucket\): aquilon61\.aqd-unittest\.ms\.com/eth0, " r"aquilon61.aqd-unittest.ms.com/ilo, .*$\s*" r"BUCKET1: aquilon62\.aqd-unittest\.ms\.com/eth0", command) def test_300_mismatch1_cleanup(self): net = self.net["bunker_mismatch1"] ip = net.usable[0] self.dsdb_expect_delete(ip) command = ["del_interface_address", "--machine", "aquilon61.aqd-unittest.ms.com", "--interface", "eth0", "--label", "bunkertest"] self.noouttest(command) self.dsdb_verify() def test_300_mismatch2_cleanup(self): net = self.net["bunker_mismatch2"] ip = net.usable[0] self.dsdb_expect_delete(ip) command = ["del_interface_address", "--machine", "aquilon62.aqd-unittest.ms.com", "--interface", "eth0", "--label", "bunkertest"] self.noouttest(command) self.dsdb_verify() def test_300_mismatch3_cleanup(self): net = self.net["bunker_mismatch2"] ip = net.usable[1] self.dsdb_expect_delete(ip) command = ["del_interface_address", "--machine", "server9.aqd-unittest.ms.com", "--interface", "eth0", "--label", "bunkertest"] self.statustest(command) self.dsdb_verify() def test_310_network_cleanup(self): self.net.dispose_network(self, "bunker_mismatch1") self.net.dispose_network(self, "bunker_mismatch2") if __name__ == '__main__': suite = unittest.TestLoader().loadTestsFromTestCase(TestNetworkConstraints) unittest.TextTestRunner(verbosity=2).run(suite)
unknown
codeparrot/codeparrot-clean
#!/usr/bin/env bash # Copyright 2025 The Cockroach Authors. # # Use of this software is governed by the CockroachDB Software License # included in the /LICENSE file. set -exuo pipefail dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))" source "$dir/teamcity-support.sh" # For $root source "$dir/teamcity-bazel-support.sh" # For run_bazel cleanup() { rm -f ~/.config/gcloud/application_default_credentials.json } trap cleanup EXIT # Install `gh` CLI tool if not already available tc_start_block "Install gh CLI" if ! command -v gh &> /dev/null; then echo "Installing gh CLI tool..." wget -O /tmp/gh.tar.gz https://github.com/cli/cli/releases/download/v2.13.0/gh_2.13.0_linux_amd64.tar.gz echo "9e833e02428cd49e0af73bc7dc4cafa329fe3ecba1bfe92f0859bf5b11916401 /tmp/gh.tar.gz" | sha256sum -c - tar --strip-components 1 -xf /tmp/gh.tar.gz -C /tmp export PATH=/tmp/bin:$PATH echo "gh CLI installed successfully" fi tc_end_block "Install gh CLI" tc_start_block "Configuration" export TESTS="${TESTS:-tpcc-nowait/literal/w=1000/nodes=5/cpu=16}" export COUNT="${COUNT:-20}" export CLOUD="${CLOUD:-gce}" # Do not use spot instances for PGO profile generation to ensure consistent # performance and random VM preemptions. export USE_SPOT="${USE_SPOT:-never}" docker_env_args=( SELECT_PROBABILITY=1.0 ARM_PROBABILITY=0.0 COCKROACH_EA_PROBABILITY=0.0 FIPS_PROBABILITY=0.0 LITERAL_ARTIFACTS_DIR=$root/artifacts BUILD_VCS_NUMBER CLOUD COCKROACH_DEV_LICENSE COCKROACH_RANDOM_SEED COUNT EXPORT_OPENMETRICS GITHUB_API_TOKEN GITHUB_ORG GITHUB_REPO GOOGLE_CREDENTIALS_ASSUME_ROLE GOOGLE_EPHEMERAL_CREDENTIALS GOOGLE_KMS_KEY_A GOOGLE_KMS_KEY_B GOOGLE_SERVICE_ACCOUNT GRAFANA_SERVICE_ACCOUNT_AUDIENCE GRAFANA_SERVICE_ACCOUNT_JSON ROACHPERF_OPENMETRICS_CREDENTIALS ROACHTEST_ASSERTIONS_ENABLED_SEED ROACHTEST_FORCE_RUN_INVALID_RELEASE_BRANCH SELECTIVE_TESTS SLACK_TOKEN SNOWFLAKE_PVT_KEY SNOWFLAKE_USER TC_BUILDTYPE_ID TC_BUILD_BRANCH TC_BUILD_ID TC_SERVER_URL TESTS USE_SPOT ) BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="$(printf -- "-e %s " "${docker_env_args[@]}")" benchstat_before="artifacts/benchstat_before.txt" benchstat_after="artifacts/benchstat_after.txt" tc_end_block "Configuration" tc_start_block "Baseline tpcc-nowait tests" BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="$BAZEL_SUPPORT_EXTRA_DOCKER_ARGS" \ run_bazel build/teamcity/cockroach/nightlies/roachtest_nightly_impl.sh # Benchmark results are zipped in artifacts; extract them for analysis in a temp dir. tmp_artifacts_before="$(mktemp -d)" find "${root}/artifacts" -type f -name "artifacts.zip" -exec sh -c ' src="$1" dest="'"$tmp_artifacts_before"'" base="'"${root}/artifacts"'" rel="${src#$base/}" rel_dir="$(dirname "$rel")" outdir="$dest/$rel_dir" mkdir -p "$outdir" unzip -o "$src" -d "$outdir" ' _ {} \; bash -xe ./scripts/tpcc_results.sh "$tmp_artifacts_before" > "$benchstat_before" rm -rf "$tmp_artifacts_before" echo "=== Baseline benchstat saved to $benchstat_before ===" tc_end_block "Baseline tpcc-nowait tests" tc_start_block "Generate new PGO profile" echo "=== Step 2: Generating new PGO profile ===" filename="$(date +"%Y%m%d%H%M%S")-$(git rev-parse HEAD).pb.gz" bazel build //pkg/cmd/run-pgo-build "$(bazel info bazel-bin)"/pkg/cmd/run-pgo-build/run-pgo-build_/run-pgo-build -out "artifacts/$filename" sha256_hash=$(shasum -a 256 "artifacts/$filename" | awk '{print $1}') # Upload to GCS google_credentials="$GCS_GOOGLE_CREDENTIALS" log_into_gcloud gcs_url="gs://cockroach-profiles/$filename" gsutil cp "artifacts/$filename" "$gcs_url" # Convert GCS URL to HTTPS URL for WORKSPACE https_url="https://storage.googleapis.com/cockroach-profiles/$filename" echo "=== PGO profile uploaded to $gcs_url ===" echo "=== SHA256: $sha256_hash ===" # Use sed to update the sha256 and url in the pgo_profile block # This is more robust than string replacement sed -i.bak -e '/pgo_profile(/,/)/ { s|sha256 = ".*"|sha256 = "'"$sha256_hash"'"| s|url = ".*"|url = "'"$https_url"'"| }' WORKSPACE rm -f WORKSPACE.bak tc_end_block "Generate new PGO profile" tc_start_block "Rebuild with new PGO profile" # Clear build cache to ensure new profile is used bazel clean rm -rf "artifacts/tpcc-nowait" # Run the same tests again with the new PGO profile BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="$BAZEL_SUPPORT_EXTRA_DOCKER_ARGS" \ run_bazel build/teamcity/cockroach/nightlies/roachtest_nightly_impl.sh # Benchmark results are zipped in artifacts; extract them for analysis in a temp dir. tmp_artifacts_after="$(mktemp -d)" find "${root}/artifacts" -type f -name "artifacts.zip" -exec sh -c ' src="$1" dest="'"$tmp_artifacts_after"'" base="'"${root}/artifacts"'" rel="${src#$base/}" rel_dir="$(dirname "$rel")" outdir="$dest/$rel_dir" mkdir -p "$outdir" unzip -o "$src" -d "$outdir" ' _ {} \; bash -xe ./scripts/tpcc_results.sh "$tmp_artifacts_after" > "$benchstat_after" rm -rf "$tmp_artifacts_after" echo "=== Post-PGO benchstat saved to $benchstat_after ===" tc_end_block "Rebuild with new PGO profile" tc_start_block "Benchstat comparison" # Run benchstat comparison using bazel and save to file benchstat_comparison="artifacts/benchstat_comparison.txt" bazel build @org_golang_x_perf//cmd/benchstat "$(bazel info bazel-bin)"/external/org_golang_x_perf/cmd/benchstat/benchstat_/benchstat \ "$benchstat_before" "$benchstat_after" | tee "$benchstat_comparison" tc_end_block "Benchstat comparison" tc_start_block "Create PR" export GIT_AUTHOR_NAME="Justin Beaver" export GIT_COMMITTER_NAME="Justin Beaver" export GIT_AUTHOR_EMAIL="teamcity@cockroachlabs.com" export GIT_COMMITTER_EMAIL="teamcity@cockroachlabs.com" gh_username="cockroach-teamcity" # Create a new branch for the PR branch_name="pgo-profile-update-$(date +"%Y%m%d%H%M%S")" git checkout -b "$branch_name" # Stage the WORKSPACE file changes git add WORKSPACE # Create commit with descriptive message # Note: Full benchstat comparison is in the PR description, not in commit message commit_message="build: update PGO profile to $filename This commit updates the PGO profile used for building CockroachDB. The new profile was generated from tpcc-nowait benchmarks. See PR description for full benchmark comparison results. Epic: none Release note: none" git commit -m "$commit_message" set +x git push "https://$gh_username:$GH_TOKEN@github.com/$gh_username/cockroach.git" "$branch_name" set -x # Create PR using gh CLI pr_body="This PR updates the PGO (Profile-Guided Optimization) profile used for building CockroachDB. The new profile was validated using tpcc-nowait benchmarks. Results comparing the old profile (before) vs new profile (after): \`\`\` $(cat "$benchstat_comparison") \`\`\` Epic: none Release note: none" gh pr create \ --head "$gh_username:$branch_name" \ --title "build: update PGO profile to $filename" \ --body "$pr_body" \ --reviewer "cockroachdb/release-eng-prs" \ --base master | tee artifacts/pgo_profile_pr_url.txt tc_end_block "Create PR"
unknown
github
https://github.com/cockroachdb/cockroach
build/teamcity/internal/release/pgo_profile_update.sh
# Copyright 2011 OpenStack Foundation # 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. """ Module dedicated functions/classes dealing with rate limiting requests. This module handles rate liming at a per-user level, so it should not be used to prevent intentional Denial of Service attacks, as we can assume a DOS can easily come through multiple user accounts. DOS protection should be done at a different layer. Instead this module should be used to protect against unintentional user actions. With that in mind the limits set here should be high enough as to not rate-limit any intentional actions. To find good rate-limit values, check how long requests are taking (see logs) in your environment to assess your capabilities and multiply out to get figures. NOTE: As the rate-limiting here is done in memory, this only works per process (each process will have its own rate limiting counter). """ import collections import copy import httplib import math import re import time import webob.dec import webob.exc from nova.api.openstack.compute.views import limits as limits_views from nova.api.openstack import wsgi from nova.api.openstack import xmlutil from nova.openstack.common.gettextutils import _ from nova.openstack.common import importutils from nova.openstack.common import jsonutils from nova import quota from nova import utils from nova import wsgi as base_wsgi QUOTAS = quota.QUOTAS LIMITS_PREFIX = "limits." limits_nsmap = {None: xmlutil.XMLNS_COMMON_V10, 'atom': xmlutil.XMLNS_ATOM} class LimitsTemplate(xmlutil.TemplateBuilder): def construct(self): root = xmlutil.TemplateElement('limits', selector='limits') rates = xmlutil.SubTemplateElement(root, 'rates') rate = xmlutil.SubTemplateElement(rates, 'rate', selector='rate') rate.set('uri', 'uri') rate.set('regex', 'regex') limit = xmlutil.SubTemplateElement(rate, 'limit', selector='limit') limit.set('value', 'value') limit.set('verb', 'verb') limit.set('remaining', 'remaining') limit.set('unit', 'unit') limit.set('next-available', 'next-available') absolute = xmlutil.SubTemplateElement(root, 'absolute', selector='absolute') limit = xmlutil.SubTemplateElement(absolute, 'limit', selector=xmlutil.get_items) limit.set('name', 0) limit.set('value', 1) return xmlutil.MasterTemplate(root, 1, nsmap=limits_nsmap) class LimitsController(object): """Controller for accessing limits in the OpenStack API.""" @wsgi.serializers(xml=LimitsTemplate) def index(self, req): """Return all global and rate limit information.""" context = req.environ['nova.context'] quotas = QUOTAS.get_project_quotas(context, context.project_id, usages=False) abs_limits = dict((k, v['limit']) for k, v in quotas.items()) rate_limits = req.environ.get("nova.limits", []) builder = self._get_view_builder(req) return builder.build(rate_limits, abs_limits) def create(self, req, body): """Create a new limit.""" raise webob.exc.HTTPNotImplemented() def delete(self, req, id): """Delete the limit.""" raise webob.exc.HTTPNotImplemented() def detail(self, req): """Return limit details.""" raise webob.exc.HTTPNotImplemented() def show(self, req, id): """Show limit information.""" raise webob.exc.HTTPNotImplemented() def update(self, req, id, body): """Update existing limit.""" raise webob.exc.HTTPNotImplemented() def _get_view_builder(self, req): return limits_views.ViewBuilder() def create_resource(): return wsgi.Resource(LimitsController()) class Limit(object): """Stores information about a limit for HTTP requests.""" UNITS = dict([(v, k) for k, v in utils.TIME_UNITS.items()]) def __init__(self, verb, uri, regex, value, unit): """Initialize a new `Limit`. @param verb: HTTP verb (POST, PUT, etc.) @param uri: Human-readable URI @param regex: Regular expression format for this limit @param value: Integer number of requests which can be made @param unit: Unit of measure for the value parameter """ self.verb = verb self.uri = uri self.regex = regex self.value = int(value) self.unit = unit self.unit_string = self.display_unit().lower() self.remaining = int(value) if value <= 0: raise ValueError("Limit value must be > 0") self.last_request = None self.next_request = None self.water_level = 0 self.capacity = self.unit self.request_value = float(self.capacity) / float(self.value) msg = _("Only %(value)s %(verb)s request(s) can be " "made to %(uri)s every %(unit_string)s.") self.error_message = msg % self.__dict__ def __call__(self, verb, url): """Represents a call to this limit from a relevant request. @param verb: string http verb (POST, GET, etc.) @param url: string URL """ if self.verb != verb or not re.match(self.regex, url): return now = self._get_time() if self.last_request is None: self.last_request = now leak_value = now - self.last_request self.water_level -= leak_value self.water_level = max(self.water_level, 0) self.water_level += self.request_value difference = self.water_level - self.capacity self.last_request = now if difference > 0: self.water_level -= self.request_value self.next_request = now + difference return difference cap = self.capacity water = self.water_level val = self.value self.remaining = math.floor(((cap - water) / cap) * val) self.next_request = now def _get_time(self): """Retrieve the current time. Broken out for testability.""" return time.time() def display_unit(self): """Display the string name of the unit.""" return self.UNITS.get(self.unit, "UNKNOWN") def display(self): """Return a useful representation of this class.""" return { "verb": self.verb, "URI": self.uri, "regex": self.regex, "value": self.value, "remaining": int(self.remaining), "unit": self.display_unit(), "resetTime": int(self.next_request or self._get_time()), } # "Limit" format is a dictionary with the HTTP verb, human-readable URI, # a regular-expression to match, value and unit of measure (PER_DAY, etc.) DEFAULT_LIMITS = [ Limit("POST", "*", ".*", 120, utils.TIME_UNITS['MINUTE']), Limit("POST", "*/servers", "^/servers", 120, utils.TIME_UNITS['MINUTE']), Limit("PUT", "*", ".*", 120, utils.TIME_UNITS['MINUTE']), Limit("GET", "*changes-since*", ".*changes-since.*", 120, utils.TIME_UNITS['MINUTE']), Limit("DELETE", "*", ".*", 120, utils.TIME_UNITS['MINUTE']), Limit("GET", "*/os-fping", "^/os-fping", 12, utils.TIME_UNITS['MINUTE']), ] class RateLimitingMiddleware(base_wsgi.Middleware): """Rate-limits requests passing through this middleware. All limit information is stored in memory for this implementation. """ def __init__(self, application, limits=None, limiter=None, **kwargs): """Initialize new `RateLimitingMiddleware`. It wraps the given WSGI application and sets up the given limits. @param application: WSGI application to wrap @param limits: String describing limits @param limiter: String identifying class for representing limits Other parameters are passed to the constructor for the limiter. """ base_wsgi.Middleware.__init__(self, application) # Select the limiter class if limiter is None: limiter = Limiter else: limiter = importutils.import_class(limiter) # Parse the limits, if any are provided if limits is not None: limits = limiter.parse_limits(limits) self._limiter = limiter(limits or DEFAULT_LIMITS, **kwargs) @webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self, req): """Represents a single call through this middleware. We should record the request if we have a limit relevant to it. If no limit is relevant to the request, ignore it. If the request should be rate limited, return a fault telling the user they are over the limit and need to retry later. """ verb = req.method url = req.url context = req.environ.get("nova.context") if context: username = context.user_id else: username = None delay, error = self._limiter.check_for_delay(verb, url, username) if delay: msg = _("This request was rate-limited.") retry = time.time() + delay return wsgi.RateLimitFault(msg, error, retry) req.environ["nova.limits"] = self._limiter.get_limits(username) return self.application class Limiter(object): """Rate-limit checking class which handles limits in memory.""" def __init__(self, limits, **kwargs): """Initialize the new `Limiter`. @param limits: List of `Limit` objects """ self.limits = copy.deepcopy(limits) self.levels = collections.defaultdict(lambda: copy.deepcopy(limits)) # Pick up any per-user limit information for key, value in kwargs.items(): if key.startswith(LIMITS_PREFIX): username = key[len(LIMITS_PREFIX):] self.levels[username] = self.parse_limits(value) def get_limits(self, username=None): """Return the limits for a given user.""" return [limit.display() for limit in self.levels[username]] def check_for_delay(self, verb, url, username=None): """Check the given verb/user/user triplet for limit. @return: Tuple of delay (in seconds) and error message (or None, None) """ delays = [] for limit in self.levels[username]: delay = limit(verb, url) if delay: delays.append((delay, limit.error_message)) if delays: delays.sort() return delays[0] return None, None # Note: This method gets called before the class is instantiated, # so this must be either a static method or a class method. It is # used to develop a list of limits to feed to the constructor. We # put this in the class so that subclasses can override the # default limit parsing. @staticmethod def parse_limits(limits): """Convert a string into a list of Limit instances. This implementation expects a semicolon-separated sequence of parenthesized groups, where each group contains a comma-separated sequence consisting of HTTP method, user-readable URI, a URI reg-exp, an integer number of requests which can be made, and a unit of measure. Valid values for the latter are "SECOND", "MINUTE", "HOUR", and "DAY". @return: List of Limit instances. """ # Handle empty limit strings limits = limits.strip() if not limits: return [] # Split up the limits by semicolon result = [] for group in limits.split(';'): group = group.strip() if group[:1] != '(' or group[-1:] != ')': raise ValueError("Limit rules must be surrounded by " "parentheses") group = group[1:-1] # Extract the Limit arguments args = [a.strip() for a in group.split(',')] if len(args) != 5: raise ValueError("Limit rules must contain the following " "arguments: verb, uri, regex, value, unit") # Pull out the arguments verb, uri, regex, value, unit = args # Upper-case the verb verb = verb.upper() # Convert value--raises ValueError if it's not integer value = int(value) # Convert unit unit = unit.upper() if unit not in utils.TIME_UNITS: raise ValueError("Invalid units specified") unit = utils.TIME_UNITS[unit] # Build a limit result.append(Limit(verb, uri, regex, value, unit)) return result class WsgiLimiter(object): """Rate-limit checking from a WSGI application. Uses an in-memory `Limiter`. To use, POST ``/<username>`` with JSON data such as:: { "verb" : GET, "path" : "/servers" } and receive a 204 No Content, or a 403 Forbidden with an X-Wait-Seconds header containing the number of seconds to wait before the action would succeed. """ def __init__(self, limits=None): """Initialize the new `WsgiLimiter`. @param limits: List of `Limit` objects """ self._limiter = Limiter(limits or DEFAULT_LIMITS) @webob.dec.wsgify(RequestClass=wsgi.Request) def __call__(self, request): """Handles a call to this application. Returns 204 if the request is acceptable to the limiter, else a 403 is returned with a relevant header indicating when the request *will* succeed. """ if request.method != "POST": raise webob.exc.HTTPMethodNotAllowed() try: info = dict(jsonutils.loads(request.body)) except ValueError: raise webob.exc.HTTPBadRequest() username = request.path_info_pop() verb = info.get("verb") path = info.get("path") delay, error = self._limiter.check_for_delay(verb, path, username) if delay: headers = {"X-Wait-Seconds": "%.2f" % delay} return webob.exc.HTTPForbidden(headers=headers, explanation=error) else: return webob.exc.HTTPNoContent() class WsgiLimiterProxy(object): """Rate-limit requests based on answers from a remote source.""" def __init__(self, limiter_address): """Initialize the new `WsgiLimiterProxy`. @param limiter_address: IP/port combination of where to request limit """ self.limiter_address = limiter_address def check_for_delay(self, verb, path, username=None): body = jsonutils.dumps({"verb": verb, "path": path}) headers = {"Content-Type": "application/json"} conn = httplib.HTTPConnection(self.limiter_address) if username: conn.request("POST", "/%s" % (username), body, headers) else: conn.request("POST", "/", body, headers) resp = conn.getresponse() if 200 >= resp.status < 300: return None, None return resp.getheader("X-Wait-Seconds"), resp.read() or None # Note: This method gets called before the class is instantiated, # so this must be either a static method or a class method. It is # used to develop a list of limits to feed to the constructor. # This implementation returns an empty list, since all limit # decisions are made by a remote server. @staticmethod def parse_limits(limits): """Ignore a limits string--simply doesn't apply for the limit proxy. @return: Empty list. """ return []
unknown
codeparrot/codeparrot-clean
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and from lib.actions import OpsGenieBaseAction class ListUsersAction(OpsGenieBaseAction): def run(self): """ List users in OpsGenie. Returns: - dict: Data from OpsGenie. """ payload = {"apiKey": self.api_key} data = self._req("GET", "v1/json/user", payload=payload) return data
unknown
codeparrot/codeparrot-clean
""" /*************************************************************************** CartoDB Plugin A QGIS plugin ---------------------------------------------------------------------------- begin : 2014-09-08 copyright : (C) 2015 by Michael Salgado, Kudos Ltda. email : michaelsalgado@gkudos.com, info@gkudos.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ from PyQt4.QtCore import Qt, QSize from PyQt4.QtGui import QWidget, QLabel, QProgressBar from QgisCartoDB.ui.ListItem import Ui_ListItem class CartoDBDatasetsListItem(QWidget): def __init__(self, tableName=None, tableOwner=None, size=None, rows=None, multiuser=False, shared=False): QWidget.__init__(self) self.ui = Ui_ListItem() self.ui.setupUi(self) self.shared = shared self.multiuser = multiuser self.readonly = False self.tableOwner = tableOwner self.setTableName(tableName) self.setSize(size) self.setRows(rows) def setTableName(self, tableName): self.tableName = tableName text = tableName if tableName is not None: if self.shared: text = text + ' ({})'.format(self.tableOwner) self.ui.tableNameTX.setText(text) def setSize(self, size): self.size = size if size is not None: sizeText = float(size/1024) if sizeText >= 1000: sizeText = sizeText/1024 if sizeText >= 1000: sizeText = "{:.2f}".format(sizeText/1024) + ' GB' else: sizeText = "{:.2f}".format(sizeText) + ' MB' else: sizeText = "{:.2f}".format(sizeText) + ' KB' self.ui.sizeTX.setText(sizeText) def setRows(self, rows): self.rows = rows if rows is not None: self.ui.rowsTX.setText("{:,} rows".format(rows)) def setTextColor(self, color): self.ui.tableNameTX.setStyleSheet('color: ' + color) self.ui.rowsTX.setStyleSheet('color: ' + color) self.ui.sizeTX.setStyleSheet('color: ' + color) def clone(self): return CartoDBDatasetsListItem(self.tableName, self.tableOwner, self.size, self.rows) class CartoDBLayerListItem(CartoDBDatasetsListItem): def __init__(self, tableName=None, layer=None, size=None, rows=None): CartoDBDatasetsListItem.__init__(self, tableName, None, size, rows) ''' self.ui.statusLB = QLabel(self) self.ui.statusLB.setMaximumSize(QSize(100, 16777215)) self.ui.statusLB.setAlignment(Qt.AlignCenter | Qt.AlignTrailing | Qt.AlignVCenter) self.ui.statusLB.setWordWrap(True) self.ui.horizontalLayout.insertWidget(1, self.ui.statusLB) ''' self.ui.statusBar = QProgressBar(self) self.ui.statusBar.setProperty("value", 0) self.ui.statusBar.setFormat("Init") self.ui.statusBar.setAutoFillBackground(True) self.ui.statusBar.hide() self.ui.horizontalLayout.insertWidget(1, self.ui.statusBar) self.layer = layer def setStatus(self, status, value = 0): self.ui.statusBar.setProperty("value", value) self.ui.statusBar.setFormat(status.capitalize()) self.ui.statusBar.show() def clone(self): return CartoDBDatasetsListItem(self.tableName, self.layer, self.size, self.rows)
unknown
codeparrot/codeparrot-clean
#!/usr/bin/env python # ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2014, Numenta, Inc. Unless you have purchased from # Numenta, Inc. a separate commercial license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the GNU Affero Public License for more details. # # You should have received a copy of the GNU Affero Public License # along with this program. If not, see http://www.gnu.org/licenses. # # http://numenta.org/licenses/ # ---------------------------------------------------------------------- import copy import logging import time import unittest2 as unittest import cPickle import numpy from nupic.regions.PyRegion import RealNumpyDType from nupic.algorithms.KNNClassifier import KNNClassifier import pca_knn_data LOGGER = logging.getLogger(__name__) class KNNClassifierTest(unittest.TestCase): """Tests for k Nearest Neighbor classifier""" def runTestKNNClassifier(self, short = 0): """ Test the KNN classifier in this module. short can be: 0 (short), 1 (medium), or 2 (long) """ failures = "" if short != 2: numpy.random.seed(42) else: seed_value = int(time.time()) numpy.random.seed(seed_value) LOGGER.info('Seed used: %d', seed_value) f = open('seedval', 'a') f.write(str(seed_value)) f.write('\n') f.close() failures += simulateKMoreThanOne() LOGGER.info("\nTesting KNN Classifier on dense patterns") numPatterns, numClasses = getNumTestPatterns(short) patternSize = 100 patterns = numpy.random.rand(numPatterns, patternSize) patternDict = dict() testDict = dict() # Assume there are no repeated patterns -- if there are, then # numpy.random would be completely broken. # Patterns in testDict are identical to those in patternDict but for the # first 2% of items. for i in xrange(numPatterns): patternDict[i] = dict() patternDict[i]['pattern'] = patterns[i] patternDict[i]['category'] = numpy.random.randint(0, numClasses-1) testDict[i] = copy.deepcopy(patternDict[i]) testDict[i]['pattern'][:0.02*patternSize] = numpy.random.rand() testDict[i]['category'] = None LOGGER.info("\nTesting KNN Classifier with L2 norm") knn = KNNClassifier(k=1) failures += simulateClassifier(knn, patternDict, \ "KNN Classifier with L2 norm test") LOGGER.info("\nTesting KNN Classifier with L1 norm") knnL1 = KNNClassifier(k=1, distanceNorm=1.0) failures += simulateClassifier(knnL1, patternDict, \ "KNN Classifier with L1 norm test") # Test with exact matching classifications. LOGGER.info("\nTesting KNN Classifier with exact matching. For testing we " "slightly alter the training data and expect None to be returned for the " "classifications.") knnExact = KNNClassifier(k=1, exact=True) failures += simulateClassifier(knnExact, patternDict, "KNN Classifier with exact matching test", testDict=testDict) numPatterns, numClasses = getNumTestPatterns(short) patterns = (numpy.random.rand(numPatterns, 25) > 0.7).astype(RealNumpyDType) patternDict = dict() for i in patterns: iString = str(i.tolist()) if not patternDict.has_key(iString): randCategory = numpy.random.randint(0, numClasses-1) patternDict[iString] = dict() patternDict[iString]['pattern'] = i patternDict[iString]['category'] = randCategory LOGGER.info("\nTesting KNN on sparse patterns") knnDense = KNNClassifier(k=1) failures += simulateClassifier(knnDense, patternDict, \ "KNN Classifier on sparse pattern test") self.assertEqual(len(failures), 0, "Tests failed: \n" + failures) if short == 2: f = open('seedval', 'a') f.write('Pass\n') f.close() def runTestPCAKNN(self, short = 0): LOGGER.info('\nTesting PCA/k-NN classifier') LOGGER.info('Mode=%s', short) numDims = 10 numClasses = 10 k = 10 numPatternsPerClass = 100 numPatterns = int(.9 * numClasses * numPatternsPerClass) numTests = numClasses * numPatternsPerClass - numPatterns numSVDSamples = int(.1 * numPatterns) keep = 1 train_data, train_class, test_data, test_class = \ pca_knn_data.generate(numDims, numClasses, k, numPatternsPerClass, numPatterns, numTests, numSVDSamples, keep) pca_knn = KNNClassifier(k=k,numSVDSamples=numSVDSamples, numSVDDims=keep) knn = KNNClassifier(k=k) LOGGER.info('Training PCA k-NN') for i in range(numPatterns): knn.learn(train_data[i], train_class[i]) pca_knn.learn(train_data[i], train_class[i]) LOGGER.info('Testing PCA k-NN') numWinnerFailures = 0 numInferenceFailures = 0 numDistFailures = 0 numAbsErrors = 0 for i in range(numTests): winner, inference, dist, categoryDist = knn.infer(test_data[i]) pca_winner, pca_inference, pca_dist, pca_categoryDist \ = pca_knn.infer(test_data[i]) if winner != test_class[i]: numAbsErrors += 1 if pca_winner != winner: numWinnerFailures += 1 if (numpy.abs(pca_inference - inference) > 1e-4).any(): numInferenceFailures += 1 if (numpy.abs(pca_dist - dist) > 1e-4).any(): numDistFailures += 1 s0 = 100*float(numTests - numAbsErrors) / float(numTests) s1 = 100*float(numTests - numWinnerFailures) / float(numTests) s2 = 100*float(numTests - numInferenceFailures) / float(numTests) s3 = 100*float(numTests - numDistFailures) / float(numTests) LOGGER.info('PCA/k-NN success rate=%s%s', s0, '%') LOGGER.info('Winner success=%s%s', s1, '%') LOGGER.info('Inference success=%s%s', s2, '%') LOGGER.info('Distance success=%s%s', s3, '%') self.assertEqual(s1, 100.0, "PCA/k-NN test failed") def testKNNClassifierShort(self): self.runTestKNNClassifier(0) def testPCAKNNShort(self): self.runTestPCAKNN(0) def testKNNClassifierMedium(self): self.runTestKNNClassifier(1) def testPCAKNNMedium(self): self.runTestPCAKNN(1) def simulateKMoreThanOne(): """A small test with k=3""" failures = "" LOGGER.info("Testing the sparse KNN Classifier with k=3") knn = KNNClassifier(k=3) v = numpy.zeros((6, 2)) v[0] = [1.0, 0.0] v[1] = [1.0, 0.2] v[2] = [1.0, 0.2] v[3] = [1.0, 2.0] v[4] = [1.0, 4.0] v[5] = [1.0, 4.5] knn.learn(v[0], 0) knn.learn(v[1], 0) knn.learn(v[2], 0) knn.learn(v[3], 1) knn.learn(v[4], 1) knn.learn(v[5], 1) winner, _inferenceResult, _dist, _categoryDist = knn.infer(v[0]) if winner != 0: failures += "Inference failed with k=3\n" winner, _inferenceResult, _dist, _categoryDist = knn.infer(v[2]) if winner != 0: failures += "Inference failed with k=3\n" winner, _inferenceResult, _dist, _categoryDist = knn.infer(v[3]) if winner != 0: failures += "Inference failed with k=3\n" winner, _inferenceResult, _dist, _categoryDist = knn.infer(v[5]) if winner != 1: failures += "Inference failed with k=3\n" if len(failures) == 0: LOGGER.info("Tests passed.") return failures def simulateClassifier(knn, patternDict, testName, testDict=None): """Train this classifier instance with the given patterns.""" failures = "" numPatterns = len(patternDict) LOGGER.info("Training the classifier") tick = time.time() for i in patternDict.keys(): knn.learn(patternDict[i]['pattern'], patternDict[i]['category']) tock = time.time() LOGGER.info("Time Elapsed %s", tock-tick) knnString = cPickle.dumps(knn) LOGGER.info("Size of the classifier is %s", len(knnString)) # Run the classifier to infer categories on either the training data, or the # test data (of it's provided). error_count = 0 tick = time.time() if testDict: LOGGER.info("Testing the classifier on the test set") for i in testDict.keys(): winner, _inferenceResult, _dist, _categoryDist \ = knn.infer(testDict[i]['pattern']) if winner != testDict[i]['category']: error_count += 1 else: LOGGER.info("Testing the classifier on the training set") LOGGER.info("Number of patterns: %s", len(patternDict)) for i in patternDict.keys(): LOGGER.info("Testing %s - %s %s", i, patternDict[i]['category'], \ len(patternDict[i]['pattern'])) winner, _inferenceResult, _dist, _categoryDist \ = knn.infer(patternDict[i]['pattern']) if winner != patternDict[i]['category']: error_count += 1 tock = time.time() LOGGER.info("Time Elapsed %s", tock-tick) error_rate = float(error_count) / numPatterns LOGGER.info("Error rate is %s", error_rate) if error_rate == 0: LOGGER.info(testName + " passed") else: LOGGER.info(testName + " failed") failures += testName + " failed\n" return failures def getNumTestPatterns(short=0): """Return the number of patterns and classes the test should use.""" if short==0: LOGGER.info("Running short tests") numPatterns = numpy.random.randint(300, 600) numClasses = numpy.random.randint(50, 150) elif short==1: LOGGER.info("\nRunning medium tests") numPatterns = numpy.random.randint(500, 1500) numClasses = numpy.random.randint(50, 150) else: LOGGER.info("\nRunning long tests") numPatterns = numpy.random.randint(500, 3000) numClasses = numpy.random.randint(30, 1000) LOGGER.info("number of patterns is %s", numPatterns) LOGGER.info("number of classes is %s", numClasses) return numPatterns, numClasses if __name__ == "__main__": unittest.main()
unknown
codeparrot/codeparrot-clean
import unittest from tempfile import NamedTemporaryFile from centerpoints.cli import parse_arguments class TestArgumentParser(unittest.TestCase): @classmethod def setUpClass(cls): cls.ptsf = NamedTemporaryFile() @classmethod def tearDownClass(cls): cls.ptsf.truncate() cls.ptsf.close() def test_algorithm_choice(self): self.assertRaises(SystemExit, parse_arguments, ["-1", "-2"]) self.assertRaises(SystemExit, parse_arguments, ["-1", "-3"]) self.assertRaises(SystemExit, parse_arguments, ["-2", "-3"]) def test_format_choice(self): args = ["-1", "--json", "--csv", "", self.ptsf.name] self.assertRaises(SystemExit, parse_arguments, args) options = parse_arguments(["-1", "--json", self.ptsf.name]) self.assertEqual("json", options.format) options = parse_arguments(["-1", self.ptsf.name]) self.assertEqual("csv", options.format) options = parse_arguments(["-1", "--csv", ",", self.ptsf.name]) self.assertEqual("csv", options.format) self.assertEqual(options.separator, ",", ) options = parse_arguments(["-1", self.ptsf.name]) self.assertEqual(options.format, "csv", ) self.assertEqual(options.separator, "\t")
unknown
codeparrot/codeparrot-clean
/* Copyright 2016 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. ==============================================================================*/ // LINT.IfChange #ifndef TENSORFLOW_CORE_UTIL_CTC_CTC_BEAM_ENTRY_H_ #define TENSORFLOW_CORE_UTIL_CTC_CTC_BEAM_ENTRY_H_ #include <algorithm> #include <memory> #include <vector> #include "Eigen/Core" // from @eigen_archive #include "tensorflow/core/lib/gtl/flatmap.h" #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/macros.h" #include "tensorflow/core/platform/types.h" #include "tensorflow/core/util/ctc/ctc_loss_util.h" namespace tensorflow { namespace ctc { // The ctc_beam_search namespace holds several classes meant to be accessed only // in case of extending the CTCBeamSearch decoder to allow custom scoring // functions. // // BeamEntry is exposed through template arguments BeamScorer and BeamComparer // of CTCBeamSearch (ctc_beam_search.h). namespace ctc_beam_search { struct EmptyBeamState {}; template <typename T> struct BeamProbability { BeamProbability() : total(kLogZero<T>()), blank(kLogZero<T>()), label(kLogZero<T>()) {} void Reset() { total = kLogZero<T>(); blank = kLogZero<T>(); label = kLogZero<T>(); } T total; T blank; T label; }; template <class T, class CTCBeamState> class BeamRoot; template <class T, class CTCBeamState = EmptyBeamState> struct BeamEntry { // BeamRoot<CTCBeamState>::AddEntry() serves as the factory method. friend BeamEntry<T, CTCBeamState>* BeamRoot<T, CTCBeamState>::AddEntry( BeamEntry<T, CTCBeamState>* p, int l); inline bool Active() const { return newp.total != kLogZero<T>(); } // Return the child at the given index, or construct a new one in-place if // none was found. BeamEntry<T, CTCBeamState>& GetChild(int ind) { auto entry = children.emplace(ind, nullptr); auto& child_entry = entry.first->second; // If this is a new child, populate the BeamEntry<CTCBeamState>*. if (entry.second) { child_entry = beam_root->AddEntry(this, ind); } return *child_entry; } std::vector<int> LabelSeq(bool merge_repeated) const { std::vector<int> labels; int prev_label = -1; const BeamEntry<T, CTCBeamState>* c = this; while (c->parent != nullptr) { // Checking c->parent to skip root leaf. if (!merge_repeated || c->label != prev_label) { labels.push_back(c->label); } prev_label = c->label; c = c->parent; } std::reverse(labels.begin(), labels.end()); return labels; } BeamEntry<T, CTCBeamState>* parent; int label; // All instances of child BeamEntry are owned by *beam_root. gtl::FlatMap<int, BeamEntry<T, CTCBeamState>*> children; BeamProbability<T> oldp; BeamProbability<T> newp; CTCBeamState state; private: // Constructor giving parent, label, and the beam_root. // The object pointed to by p cannot be copied and should not be moved, // otherwise parent will become invalid. // This private constructor is only called through the factory method // BeamRoot<CTCBeamState>::AddEntry(). BeamEntry(BeamEntry* p, int l, BeamRoot<T, CTCBeamState>* beam_root) : parent(p), label(l), beam_root(beam_root) {} BeamRoot<T, CTCBeamState>* beam_root; BeamEntry(const BeamEntry&) = delete; void operator=(const BeamEntry&) = delete; }; // This class owns all instances of BeamEntry. This is used to avoid recursive // destructor call during destruction. template <class T, class CTCBeamState = EmptyBeamState> class BeamRoot { public: BeamRoot(BeamEntry<T, CTCBeamState>* p, int l) { root_entry_ = AddEntry(p, l); } BeamRoot(const BeamRoot&) = delete; BeamRoot& operator=(const BeamRoot&) = delete; BeamEntry<T, CTCBeamState>* AddEntry(BeamEntry<T, CTCBeamState>* p, int l) { auto* new_entry = new BeamEntry<T, CTCBeamState>(p, l, this); beam_entries_.emplace_back(new_entry); return new_entry; } BeamEntry<T, CTCBeamState>* RootEntry() const { return root_entry_; } private: BeamEntry<T, CTCBeamState>* root_entry_ = nullptr; std::vector<std::unique_ptr<BeamEntry<T, CTCBeamState>>> beam_entries_; }; // BeamComparer is the default beam comparer provided in CTCBeamSearch. template <class T, class CTCBeamState = EmptyBeamState> class BeamComparer { public: virtual ~BeamComparer() {} virtual bool inline operator()(const BeamEntry<T, CTCBeamState>* a, const BeamEntry<T, CTCBeamState>* b) const { return a->newp.total > b->newp.total; } }; } // namespace ctc_beam_search } // namespace ctc } // namespace tensorflow #endif // TENSORFLOW_CORE_UTIL_CTC_CTC_BEAM_ENTRY_H_ // LINT.ThenChange(//tensorflow/lite/kernels/ctc/ctc_beam_entry.h)
c
github
https://github.com/tensorflow/tensorflow
tensorflow/core/util/ctc/ctc_beam_entry.h
""" Tests for store_utilities.py """ import unittest from mock import Mock import ddt from xmodule.modulestore.store_utilities import ( get_draft_subtree_roots, draft_node_constructor ) @ddt.ddt class TestUtils(unittest.TestCase): """ Tests for store_utilities ASCII trees for ONLY_ROOTS and SOME_TREES: ONLY_ROOTS: 1) vertical (not draft) | url1 2) sequential (not draft) | url2 SOME_TREES: 1) sequential_1 (not draft) | vertical_1 / \ / \ child_1 child_2 2) great_grandparent_vertical (not draft) | grandparent_vertical | vertical_2 / \ / \ child_3 child_4 """ ONLY_ROOTS = [ draft_node_constructor(Mock(), 'url1', 'vertical'), draft_node_constructor(Mock(), 'url2', 'sequential'), ] ONLY_ROOTS_URLS = ['url1', 'url2'] SOME_TREES = [ draft_node_constructor(Mock(), 'child_1', 'vertical_1'), draft_node_constructor(Mock(), 'child_2', 'vertical_1'), draft_node_constructor(Mock(), 'vertical_1', 'sequential_1'), draft_node_constructor(Mock(), 'child_3', 'vertical_2'), draft_node_constructor(Mock(), 'child_4', 'vertical_2'), draft_node_constructor(Mock(), 'vertical_2', 'grandparent_vertical'), draft_node_constructor(Mock(), 'grandparent_vertical', 'great_grandparent_vertical'), ] SOME_TREES_ROOTS_URLS = ['vertical_1', 'grandparent_vertical'] @ddt.data( (ONLY_ROOTS, ONLY_ROOTS_URLS), (SOME_TREES, SOME_TREES_ROOTS_URLS), ) @ddt.unpack def test_get_draft_subtree_roots(self, module_nodes, expected_roots_urls): """tests for get_draft_subtree_roots""" subtree_roots_urls = [root.url for root in get_draft_subtree_roots(module_nodes)] # check that we return the expected urls self.assertEqual(set(subtree_roots_urls), set(expected_roots_urls))
unknown
codeparrot/codeparrot-clean
from __future__ import unicode_literals import logging from datetime import datetime from os.path import join, dirname import httpretty from udata.models import Dataset, License from udata.tests import TestCase, DBTestMixin from udata.core.organization.factories import OrganizationFactory from .factories import HarvestSourceFactory from .. import actions from ..backends.ods import OdsHarvester log = logging.getLogger(__name__) ODS_URL = 'http://etalab-sandbox.opendatasoft.com' json_filename = join(dirname(__file__), 'search-ods.json') with open(json_filename) as f: ODS_RESPONSE = f.read() class OdsHarvesterTest(DBTestMixin, TestCase): def setUp(self): # Create fake licenses for license_id in OdsHarvester.LICENSES.values(): License.objects.create(id=license_id, title=license_id) @httpretty.activate def test_simple(self): org = OrganizationFactory() source = HarvestSourceFactory(backend='ods', url=ODS_URL, organization=org) api_url = ''.join((ODS_URL, '/api/datasets/1.0/search/')) httpretty.register_uri(httpretty.GET, api_url, body=ODS_RESPONSE, content_type='application/json') actions.run(source.slug) self.assertEqual( httpretty.last_request().querystring, {'start': ['0'], 'rows': ['50']} ) source.reload() job = source.get_last_job() self.assertEqual(len(job.items), 3) self.assertEqual(job.status, 'done') datasets = {d.extras["harvest:remote_id"]: d for d in Dataset.objects} self.assertEqual(len(datasets), 2) self.assertIn("test-a", datasets) d = datasets["test-a"] self.assertEqual(d.title, "test-a") self.assertEqual(d.description, "test-a-description") self.assertEqual(d.tags, ['culture', 'environment', 'heritage', 'keyword1', 'keyword2']) self.assertEqual(d.extras["ods:references"], "http://example.com") self.assertTrue(d.extras["ods:has_records"]) self.assertEqual(d.extras["harvest:remote_id"], "test-a") self.assertEqual(d.extras["harvest:domain"], "etalab-sandbox.opendatasoft.com") self.assertEqual(d.extras["ods:url"], ("http://etalab-sandbox.opendatasoft.com" "/explore/dataset/test-a/")) self.assertEqual(d.license.id, "fr-lo") self.assertEqual(len(d.resources), 2) resource = d.resources[0] self.assertEqual(resource.title, 'Export au format CSV') self.assertIsNotNone(resource.description) self.assertEqual(resource.format, 'csv') self.assertEqual(resource.mime, 'text/csv') self.assertIsInstance(resource.modified, datetime) self.assertEqual(resource.url, ("http://etalab-sandbox.opendatasoft.com/" "explore/dataset/test-a/download" "?format=csv&timezone=Europe/Berlin" "&use_labels_for_header=true")) resource = d.resources[1] self.assertEqual(resource.title, 'Export au format JSON') self.assertIsNotNone(resource.description) self.assertEqual(resource.format, 'json') self.assertEqual(resource.mime, 'application/json') self.assertIsInstance(resource.modified, datetime) self.assertEqual(resource.url, ("http://etalab-sandbox.opendatasoft.com/" "explore/dataset/test-a/download" "?format=json&timezone=Europe/Berlin" "&use_labels_for_header=true")) # test-b has geo feature self.assertIn("test-b", datasets) test_b = datasets["test-b"] self.assertEqual(test_b.tags, ['buildings', 'equipment', 'housing', 'keyword1', 'spatial-planning', 'town-planning']) self.assertEqual(len(test_b.resources), 4) resource = test_b.resources[2] self.assertEqual(resource.title, 'Export au format GeoJSON') self.assertIsNotNone(resource.description) self.assertEqual(resource.format, 'json') self.assertEqual(resource.mime, 'application/vnd.geo+json') self.assertEqual(resource.url, ("http://etalab-sandbox.opendatasoft.com/" "explore/dataset/test-b/download" "?format=geojson&timezone=Europe/Berlin" "&use_labels_for_header=true")) resource = test_b.resources[3] self.assertEqual(resource.title, 'Export au format Shapefile') self.assertIsNotNone(resource.description) self.assertEqual(resource.format, 'shp') self.assertIsNone(resource.mime) self.assertEqual(resource.url, ("http://etalab-sandbox.opendatasoft.com/" "explore/dataset/test-b/download" "?format=shp&timezone=Europe/Berlin" "&use_labels_for_header=true")) # test-c has no data self.assertNotIn('test-c', datasets)
unknown
codeparrot/codeparrot-clean
import { flushSync } from 'svelte'; import { test } from '../../test'; export default test({ html: ` <input type="checkbox" value="a" data-index="x-1"> <input type="checkbox" value="b" data-index="x-1"> <input type="checkbox" value="c" data-index="x-1"> <input type="checkbox" value="a" data-index="x-2"> <input type="checkbox" value="b" data-index="x-2"> <input type="checkbox" value="c" data-index="x-2"> <input type="checkbox" value="a" data-index="y-1"> <input type="checkbox" value="b" data-index="y-1"> <input type="checkbox" value="c" data-index="y-1"> <input type="checkbox" value="a" data-index="y-2"> <input type="checkbox" value="b" data-index="y-2"> <input type="checkbox" value="c" data-index="y-2"> <input type="checkbox" value="a" data-index="z-1"> <input type="checkbox" value="b" data-index="z-1"> <input type="checkbox" value="c" data-index="z-1"> <input type="checkbox" value="a" data-index="z-2"> <input type="checkbox" value="b" data-index="z-2"> <input type="checkbox" value="c" data-index="z-2"> `, test({ assert, target, window }) { const inputs = target.querySelectorAll('input'); const checked = new Set(); /** @param {number} i */ const checkInbox = (i) => { checked.add(i); inputs[i].checked = true; inputs[i].dispatchEvent(event); }; for (let i = 0; i < 18; i++) { assert.equal(inputs[i].checked, checked.has(i)); } const event = new window.Event('change'); checkInbox(2); flushSync(); for (let i = 0; i < 18; i++) { assert.equal(inputs[i].checked, checked.has(i)); } checkInbox(12); flushSync(); for (let i = 0; i < 18; i++) { assert.equal(inputs[i].checked, checked.has(i)); } checkInbox(8); flushSync(); for (let i = 0; i < 18; i++) { assert.equal(inputs[i].checked, checked.has(i)); } } });
javascript
github
https://github.com/sveltejs/svelte
packages/svelte/tests/runtime-legacy/samples/binding-input-group-each-7/_config.js
from pyjsparserdata import * class BaseNode: def finish(self): pass def finishArrayExpression(self, elements): self.type = Syntax.ArrayExpression self.elements = elements self.finish() return self def finishArrayPattern(self, elements): self.type = Syntax.ArrayPattern self.elements = elements self.finish() return self def finishArrowFunctionExpression(self, params, defaults, body, expression): self.type = Syntax.ArrowFunctionExpression self.id = None self.params = params self.defaults = defaults self.body = body self.generator = False self.expression = expression self.finish() return self def finishAssignmentExpression(self, operator, left, right): self.type = Syntax.AssignmentExpression self.operator = operator self.left = left self.right = right self.finish() return self def finishAssignmentPattern(self, left, right): self.type = Syntax.AssignmentPattern self.left = left self.right = right self.finish() return self def finishBinaryExpression(self, operator, left, right): self.type = Syntax.LogicalExpression if (operator == '||' or operator == '&&') else Syntax.BinaryExpression self.operator = operator self.left = left self.right = right self.finish() return self def finishBlockStatement(self, body): self.type = Syntax.BlockStatement self.body = body self.finish() return self def finishBreakStatement(self, label): self.type = Syntax.BreakStatement self.label = label self.finish() return self def finishCallExpression(self, callee, args): self.type = Syntax.CallExpression self.callee = callee self.arguments = args self.finish() return self def finishCatchClause(self, param, body): self.type = Syntax.CatchClause self.param = param self.body = body self.finish() return self def finishClassBody(self, body): self.type = Syntax.ClassBody self.body = body self.finish() return self def finishClassDeclaration(self, id, superClass, body): self.type = Syntax.ClassDeclaration self.id = id self.superClass = superClass self.body = body self.finish() return self def finishClassExpression(self, id, superClass, body): self.type = Syntax.ClassExpression self.id = id self.superClass = superClass self.body = body self.finish() return self def finishConditionalExpression(self, test, consequent, alternate): self.type = Syntax.ConditionalExpression self.test = test self.consequent = consequent self.alternate = alternate self.finish() return self def finishContinueStatement(self, label): self.type = Syntax.ContinueStatement self.label = label self.finish() return self def finishDebuggerStatement(self, ): self.type = Syntax.DebuggerStatement self.finish() return self def finishDoWhileStatement(self, body, test): self.type = Syntax.DoWhileStatement self.body = body self.test = test self.finish() return self def finishEmptyStatement(self, ): self.type = Syntax.EmptyStatement self.finish() return self def finishExpressionStatement(self, expression): self.type = Syntax.ExpressionStatement self.expression = expression self.finish() return self def finishForStatement(self, init, test, update, body): self.type = Syntax.ForStatement self.init = init self.test = test self.update = update self.body = body self.finish() return self def finishForInStatement(self, left, right, body): self.type = Syntax.ForInStatement self.left = left self.right = right self.body = body self.each = False self.finish() return self def finishFunctionDeclaration(self, id, params, defaults, body): self.type = Syntax.FunctionDeclaration self.id = id self.params = params self.defaults = defaults self.body = body self.generator = False self.expression = False self.finish() return self def finishFunctionExpression(self, id, params, defaults, body): self.type = Syntax.FunctionExpression self.id = id self.params = params self.defaults = defaults self.body = body self.generator = False self.expression = False self.finish() return self def finishIdentifier(self, name): self.type = Syntax.Identifier self.name = name self.finish() return self def finishIfStatement(self, test, consequent, alternate): self.type = Syntax.IfStatement self.test = test self.consequent = consequent self.alternate = alternate self.finish() return self def finishLabeledStatement(self, label, body): self.type = Syntax.LabeledStatement self.label = label self.body = body self.finish() return self def finishLiteral(self, token): self.type = Syntax.Literal self.value = token['value'] self.raw = None # todo fix it? if token.get('regex'): self.regex = token['regex'] self.finish() return self def finishMemberExpression(self, accessor, object, property): self.type = Syntax.MemberExpression self.computed = accessor == '[' self.object = object self.property = property self.finish() return self def finishNewExpression(self, callee, args): self.type = Syntax.NewExpression self.callee = callee self.arguments = args self.finish() return self def finishObjectExpression(self, properties): self.type = Syntax.ObjectExpression self.properties = properties self.finish() return self def finishObjectPattern(self, properties): self.type = Syntax.ObjectPattern self.properties = properties self.finish() return self def finishPostfixExpression(self, operator, argument): self.type = Syntax.UpdateExpression self.operator = operator self.argument = argument self.prefix = False self.finish() return self def finishProgram(self, body): self.type = Syntax.Program self.body = body self.finish() return self def finishPyimport(self, imp): self.type = 'PyimportStatement' self.imp = imp self.finish() return self def finishProperty(self, kind, key, computed, value, method, shorthand): self.type = Syntax.Property self.key = key self.computed = computed self.value = value self.kind = kind self.method = method self.shorthand = shorthand self.finish() return self def finishRestElement(self, argument): self.type = Syntax.RestElement self.argument = argument self.finish() return self def finishReturnStatement(self, argument): self.type = Syntax.ReturnStatement self.argument = argument self.finish() return self def finishSequenceExpression(self, expressions): self.type = Syntax.SequenceExpression self.expressions = expressions self.finish() return self def finishSpreadElement(self, argument): self.type = Syntax.SpreadElement self.argument = argument self.finish() return self def finishSwitchCase(self, test, consequent): self.type = Syntax.SwitchCase self.test = test self.consequent = consequent self.finish() return self def finishSuper(self, ): self.type = Syntax.Super self.finish() return self def finishSwitchStatement(self, discriminant, cases): self.type = Syntax.SwitchStatement self.discriminant = discriminant self.cases = cases self.finish() return self def finishTaggedTemplateExpression(self, tag, quasi): self.type = Syntax.TaggedTemplateExpression self.tag = tag self.quasi = quasi self.finish() return self def finishTemplateElement(self, value, tail): self.type = Syntax.TemplateElement self.value = value self.tail = tail self.finish() return self def finishTemplateLiteral(self, quasis, expressions): self.type = Syntax.TemplateLiteral self.quasis = quasis self.expressions = expressions self.finish() return self def finishThisExpression(self, ): self.type = Syntax.ThisExpression self.finish() return self def finishThrowStatement(self, argument): self.type = Syntax.ThrowStatement self.argument = argument self.finish() return self def finishTryStatement(self, block, handler, finalizer): self.type = Syntax.TryStatement self.block = block self.guardedHandlers = [] self.handlers = [handler] if handler else [] self.handler = handler self.finalizer = finalizer self.finish() return self def finishUnaryExpression(self, operator, argument): self.type = Syntax.UpdateExpression if (operator == '++' or operator == '--') else Syntax.UnaryExpression self.operator = operator self.argument = argument self.prefix = True self.finish() return self def finishVariableDeclaration(self, declarations): self.type = Syntax.VariableDeclaration self.declarations = declarations self.kind = 'var' self.finish() return self def finishLexicalDeclaration(self, declarations, kind): self.type = Syntax.VariableDeclaration self.declarations = declarations self.kind = kind self.finish() return self def finishVariableDeclarator(self, id, init): self.type = Syntax.VariableDeclarator self.id = id self.init = init self.finish() return self def finishWhileStatement(self, test, body): self.type = Syntax.WhileStatement self.test = test self.body = body self.finish() return self def finishWithStatement(self, object, body): self.type = Syntax.WithStatement self.object = object self.body = body self.finish() return self def finishExportSpecifier(self, local, exported): self.type = Syntax.ExportSpecifier self.exported = exported or local self.local = local self.finish() return self def finishImportDefaultSpecifier(self, local): self.type = Syntax.ImportDefaultSpecifier self.local = local self.finish() return self def finishImportNamespaceSpecifier(self, local): self.type = Syntax.ImportNamespaceSpecifier self.local = local self.finish() return self def finishExportNamedDeclaration(self, declaration, specifiers, src): self.type = Syntax.ExportNamedDeclaration self.declaration = declaration self.specifiers = specifiers self.source = src self.finish() return self def finishExportDefaultDeclaration(self, declaration): self.type = Syntax.ExportDefaultDeclaration self.declaration = declaration self.finish() return self def finishExportAllDeclaration(self, src): self.type = Syntax.ExportAllDeclaration self.source = src self.finish() return self def finishImportSpecifier(self, local, imported): self.type = Syntax.ImportSpecifier self.local = local or imported self.imported = imported self.finish() return self def finishImportDeclaration(self, specifiers, src): self.type = Syntax.ImportDeclaration self.specifiers = specifiers self.source = src self.finish() return self def __getitem__(self, item): return getattr(self, item) def __setitem__(self, key, value): setattr(self, key, value) class Node(BaseNode): pass class WrappingNode(BaseNode): def __init__(self, startToken=None): pass def node_to_dict(node): if isinstance(node, list): return [node_to_dict(e) for e in node] elif isinstance(node, dict): for_ret = {} for k, v in node.iteritems(): for_ret[k] = node_to_dict(v) return for_ret elif not isinstance(node, BaseNode): return node for_ret = {} for k, v in node.__dict__.iteritems(): for_ret[k] = node_to_dict(v) return for_ret #return {k:node_to_dict(v) for k, v in node.__dict__.iteritems()}
unknown
codeparrot/codeparrot-clean
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """ Pretty-Print an Interface object as structured text (Yum) This module provides a function, asStructuredText, for rendering an interface as structured text. $Id: document.py 110536 2010-04-06 02:59:44Z tseaver $ """ import zope.interface def asStructuredText(I, munge=0): """ Output structured text format. Note, this will whack any existing 'structured' format of the text. """ r = [I.getName()] outp = r.append level = 1 if I.getDoc(): outp(_justify_and_indent(_trim_doc_string(I.getDoc()), level)) bases = [base for base in I.__bases__ if base is not zope.interface.Interface ] if bases: outp(_justify_and_indent("This interface extends:", level, munge)) level += 1 for b in bases: item = "o %s" % b.getName() outp(_justify_and_indent(_trim_doc_string(item), level, munge)) level -= 1 namesAndDescriptions = I.namesAndDescriptions() namesAndDescriptions.sort() outp(_justify_and_indent("Attributes:", level, munge)) level += 1 for name, desc in namesAndDescriptions: if not hasattr(desc, 'getSignatureString'): # ugh... item = "%s -- %s" % (desc.getName(), desc.getDoc() or 'no documentation') outp(_justify_and_indent(_trim_doc_string(item), level, munge)) level -= 1 outp(_justify_and_indent("Methods:", level, munge)) level += 1 for name, desc in namesAndDescriptions: if hasattr(desc, 'getSignatureString'): # ugh... item = "%s%s -- %s" % (desc.getName(), desc.getSignatureString(), desc.getDoc() or 'no documentation') outp(_justify_and_indent(_trim_doc_string(item), level, munge)) return "\n\n".join(r) + "\n\n" def _trim_doc_string(text): """ Trims a doc string to make it format correctly with structured text. """ lines = text.replace('\r\n', '\n').split('\n') nlines = [lines.pop(0)] if lines: min_indent = min([len(line) - len(line.lstrip()) for line in lines]) for line in lines: nlines.append(line[min_indent:]) return '\n'.join(nlines) def _justify_and_indent(text, level, munge=0, width=72): """ indent and justify text, rejustify (munge) if specified """ indent = " " * level if munge: lines = [] line = indent text = text.split() for word in text: line = ' '.join([line, word]) if len(line) > width: lines.append(line) line = indent else: lines.append(line) return '\n'.join(lines) else: return indent + \ text.strip().replace("\r\n", "\n") .replace("\n", "\n" + indent)
unknown
codeparrot/codeparrot-clean
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import unittest from frappe.utils import evaluate_filters, money_in_words, scrub_urls, get_url from frappe.utils import ceil, floor class TestFilters(unittest.TestCase): def test_simple_dict(self): self.assertTrue(evaluate_filters({'doctype': 'User', 'status': 'Open'}, {'status': 'Open'})) self.assertFalse(evaluate_filters({'doctype': 'User', 'status': 'Open'}, {'status': 'Closed'})) def test_multiple_dict(self): self.assertTrue(evaluate_filters({'doctype': 'User', 'status': 'Open', 'name': 'Test 1'}, {'status': 'Open', 'name':'Test 1'})) self.assertFalse(evaluate_filters({'doctype': 'User', 'status': 'Open', 'name': 'Test 1'}, {'status': 'Closed', 'name': 'Test 1'})) def test_list_filters(self): self.assertTrue(evaluate_filters({'doctype': 'User', 'status': 'Open', 'name': 'Test 1'}, [{'status': 'Open'}, {'name':'Test 1'}])) self.assertFalse(evaluate_filters({'doctype': 'User', 'status': 'Open', 'name': 'Test 1'}, [{'status': 'Open'}, {'name':'Test 2'}])) def test_list_filters_as_list(self): self.assertTrue(evaluate_filters({'doctype': 'User', 'status': 'Open', 'name': 'Test 1'}, [['status', '=', 'Open'], ['name', '=', 'Test 1']])) self.assertFalse(evaluate_filters({'doctype': 'User', 'status': 'Open', 'name': 'Test 1'}, [['status', '=', 'Open'], ['name', '=', 'Test 2']])) def test_lt_gt(self): self.assertTrue(evaluate_filters({'doctype': 'User', 'status': 'Open', 'age': 20}, {'status': 'Open', 'age': ('>', 10)})) self.assertFalse(evaluate_filters({'doctype': 'User', 'status': 'Open', 'age': 20}, {'status': 'Open', 'age': ('>', 30)})) class TestMoney(unittest.TestCase): def test_money_in_words(self): nums_bhd = [ (5000, "BHD Five Thousand only."), (5000.0, "BHD Five Thousand only."), (0.1, "One Hundred Fils only."), (0, "BHD Zero only."), ("Fail", "") ] nums_ngn = [ (5000, "NGN Five Thousand only."), (5000.0, "NGN Five Thousand only."), (0.1, "Ten Kobo only."), (0, "NGN Zero only."), ("Fail", "") ] for num in nums_bhd: self.assertEqual( money_in_words(num[0], "BHD"), num[1], "{0} is not the same as {1}". format(money_in_words(num[0], "BHD"), num[1]) ) for num in nums_ngn: self.assertEqual( money_in_words(num[0], "NGN"), num[1], "{0} is not the same as {1}". format(money_in_words(num[0], "NGN"), num[1]) ) class TestDataManipulation(unittest.TestCase): def test_scrub_urls(self): html = ''' <p>You have a new message from: <b>John</b></p> <p>Hey, wassup!</p> <div class="more-info"> <a href="http://test.com">Test link 1</a> <a href="/about">Test link 2</a> <a href="login">Test link 3</a> <img src="/assets/frappe/test.jpg"> </div> <div style="background-image: url('/assets/frappe/bg.jpg')"> Please mail us at <a href="mailto:test@example.com">email</a> </div> ''' html = scrub_urls(html) url = get_url() self.assertTrue('<a href="http://test.com">Test link 1</a>' in html) self.assertTrue('<a href="{0}/about">Test link 2</a>'.format(url) in html) self.assertTrue('<a href="{0}/login">Test link 3</a>'.format(url) in html) self.assertTrue('<img src="{0}/assets/frappe/test.jpg">'.format(url) in html) self.assertTrue('style="background-image: url(\'{0}/assets/frappe/bg.jpg\') !important"'.format(url) in html) self.assertTrue('<a href="mailto:test@example.com">email</a>' in html) class TestMathUtils(unittest.TestCase): def test_floor(self): from decimal import Decimal self.assertEqual(floor(2), 2 ) self.assertEqual(floor(12.32904), 12) self.assertEqual(floor(22.7330), 22) self.assertEqual(floor('24.7'), 24) self.assertEqual(floor('26.7'), 26) self.assertEqual(floor(Decimal(29.45)), 29) def test_ceil(self): from decimal import Decimal self.assertEqual(ceil(2), 2 ) self.assertEqual(ceil(12.32904), 13) self.assertEqual(ceil(22.7330), 23) self.assertEqual(ceil('24.7'), 25) self.assertEqual(ceil('26.7'), 27) self.assertEqual(ceil(Decimal(29.45)), 30) class TestHTMLUtils(unittest.TestCase): def test_clean_email_html(self): from frappe.utils.html_utils import clean_email_html sample = '''<script>a=b</script><h1>Hello</h1><p>Para</p>''' clean = clean_email_html(sample) self.assertFalse('<script>' in clean) self.assertTrue('<h1>Hello</h1>' in clean) sample = '''<style>body { font-family: Arial }</style><h1>Hello</h1><p>Para</p>''' clean = clean_email_html(sample) self.assertFalse('<style>' in clean) self.assertTrue('<h1>Hello</h1>' in clean) sample = '''<h1>Hello</h1><p>Para</p><a href="http://test.com">text</a>''' clean = clean_email_html(sample) self.assertTrue('<h1>Hello</h1>' in clean) self.assertTrue('<a href="http://test.com">text</a>' in clean)
unknown
codeparrot/codeparrot-clean
package kotlinx.coroutines import kotlinx.coroutines.testing.* import kotlinx.coroutines.flow.* import org.junit.* class ReusableContinuationStressTest : TestBase() { private val iterations = 1000 * stressTestMultiplierSqrt @Test // Originally reported by @denis-bezrukov in #2736 fun testDebounceWithStateFlow() = runBlocking<Unit> { withContext(Dispatchers.Default) { repeat(iterations) { launch { // <- load the dispatcher and OS scheduler runStressTestOnce(1, 1) } } } } private suspend fun runStressTestOnce(delay: Int, debounce: Int) = coroutineScope { val stateFlow = MutableStateFlow(0) val emitter = launch { repeat(1000) { i -> stateFlow.emit(i) delay(delay.toLong()) } } var last = 0 stateFlow.debounce(debounce.toLong()).take(100).collect { i -> if (i - last > 100) { last = i } } emitter.cancel() } }
kotlin
github
https://github.com/Kotlin/kotlinx.coroutines
kotlinx-coroutines-core/jvm/test/ReusableContinuationStressTest.kt
#! /usr/bin/env python import sys from optparse import OptionParser import random import math def hfunc(index): if index == -1: return 'MISS' else: return 'HIT ' def vfunc(victim): if victim == -1: return '-' else: return str(victim) # # main program # parser = OptionParser() parser.add_option('-a', '--addresses', default='-1', help='a set of comma-separated pages to access; -1 means randomly generate', action='store', type='string', dest='addresses') parser.add_option('-p', '--policy', default='FIFO', help='replacement policy: FIFO, LRU, OPT, CLOCK', action='store', type='string', dest='policy') parser.add_option('-b', '--clockbits', default=1, help='for CLOCK policy, how many clock bits to use', action='store', type='int', dest='clockbits') parser.add_option('-f', '--pageframesize', default='3', help='size of the physical page frame, in pages', action='store', type='string', dest='pageframesize') parser.add_option('-s', '--seed', default='0', help='random number seed', action='store', type='string', dest='seed') parser.add_option('-N', '--notrace', default=False, help='do not print out a detailed trace', action='store_true', dest='notrace') parser.add_option('-c', '--compute', default=False, help='compute answers for me', action='store_true', dest='solve') (options, args) = parser.parse_args() print 'ARG addresses', options.addresses print 'ARG policy', options.policy print 'ARG clockbits', options.clockbits print 'ARG pageframesize', options.pageframesize print 'ARG seed', options.seed print 'ARG notrace', options.notrace print '' addresses = str(options.addresses) pageframesize = int(options.pageframesize) seed = int(options.seed) policy = str(options.policy) notrace = options.notrace clockbits = int(options.clockbits) random.seed(seed) addrList = [] addrList = addresses.split(',') if options.solve == False: print 'Assuming a replacement policy of %s, and a physical page frame of size %d pages,' % (policy, pageframesize) print 'figure out whether each of the following page references hit or miss' for n in addrList: print 'Access: %d Hit/Miss? State of Memory?' % int(n) print '' else: if notrace == False: print 'Solving...\n' # init memory structure count = 0 memory = [] hits = 0 miss = 0 if policy == 'FIFO': leftStr = 'FirstIn' riteStr = 'Lastin ' elif policy == 'LRU': leftStr = 'LRU' riteStr = 'MRU' elif policy == 'OPT' or policy == 'CLOCK': leftStr = 'Left ' riteStr = 'Right' else: print 'Policy %s is not yet implemented' % policy exit(1) # track reference bits for clock ref = {} cdebug = False # need to generate addresses addrIndex = 0 for nStr in addrList: # first, lookup n = int(nStr) try: idx = memory.index(n) hits = hits + 1 if policy == 'LRU' : update = memory.remove(n) memory.append(n) # puts it on MRU side except: idx = -1 miss = miss + 1 victim = -1 if idx == -1: # miss, replace? # print 'BUG count, pageframesize:', count, pageframesize if count == pageframesize: # must replace if policy == 'FIFO' or policy == 'LRU': victim = memory.pop(0) elif policy == 'CLOCK': if cdebug: print 'REFERENCE TO PAGE', n print 'MEMORY ', memory print 'REF (b)', ref # hack: for now, do random # victim = memory.pop(int(random.random() * count)) victim = -1 while victim == -1: page = memory[int(random.random() * count)] if cdebug: print ' scan page:', page, ref[page] if ref[page] >= 1: ref[page] -= 1 else: # this is our victim victim = page memory.remove(page) break # remove old page's ref count if page in memory: assert('BROKEN') del ref[victim] if cdebug: print 'VICTIM', page print 'LEN', len(memory) print 'MEM', memory print 'REF (a)', ref elif policy == 'OPT': maxReplace = -1 replaceIdx = -1 replacePage = -1 # print 'OPT: access %d, memory %s' % (n, memory) # print 'OPT: replace from FUTURE (%s)' % addrList[addrIndex+1:] for pageIndex in range(0,count): page = memory[pageIndex] # now, have page 'page' at index 'pageIndex' in memory whenReferenced = len(addrList) # whenReferenced tells us when, in the future, this was referenced for futureIdx in range(addrIndex+1,len(addrList)): futurePage = int(addrList[futureIdx]) if page == futurePage: whenReferenced = futureIdx break # print 'OPT: page %d is referenced at %d' % (page, whenReferenced) if whenReferenced >= maxReplace: # print 'OPT: ??? updating maxReplace (%d %d %d)' % (replaceIdx, replacePage, maxReplace) replaceIdx = pageIndex replacePage = page maxReplace = whenReferenced # print 'OPT: --> updating maxReplace (%d %d %d)' % (replaceIdx, replacePage, maxReplace) victim = memory.pop(replaceIdx) # print 'OPT: replacing page %d (idx:%d) because I saw it in future at %d' % (victim, replaceIdx, whenReferenced) else: # miss, but no replacement needed (page frame not full) victim = -1 count = count + 1 # now add to memory memory.append(n) if cdebug: print 'LEN (a)', len(memory) if victim != -1: assert(victim not in memory) # after miss processing, update reference bit if n not in ref: ref[n] = 1 else: ref[n] += 1 if ref[n] > clockbits: ref[n] = clockbits if cdebug: print 'REF (a)', ref if notrace == False: print 'Access: %d %s %s -> %12s <- %s Replaced:%s [Hits:%d Misses:%d]' % (n, hfunc(idx), leftStr, memory, riteStr, vfunc(victim), hits, miss) addrIndex = addrIndex + 1 print '' print 'FINALSTATS hits %d misses %d hitrate %.2f' % (hits, miss, (100.0*float(hits))/(float(hits)+float(miss))) print ''
unknown
codeparrot/codeparrot-clean
""" Entry point TODO: event handler to RPC the Wit.ai event TODO: do we need a different person/default dict? we don't have one """ from wit import Wit from pprint import pprint from config import ( DEFAULT_DICT, DEFAULT_LANG, PERSONA_DICT, PERSONA_LANG, PERSONA, wit_token) from mic import Mic def event_loop(): wit = Wit(wit_token()) my_mic = Mic(DEFAULT_DICT, DEFAULT_LANG, DEFAULT_DICT, DEFAULT_LANG) while True: # listen for activation hotword try: threshold, text = my_mic.passiveListen(PERSONA) except: continue # detected hotword if threshold: audio_file = activeListenFile(threshold) if audio_file: data = None try: # retrieve wit intent data = wit.post_speech(open(audio_file)) # send to handler service raise NotImplementedError('no handler code yet') except Exception as e: print "Exception in audio_file handling:" print str(e) if data: print "Data: " print pprint(data) if __name__ == '__main__': event_loop()
unknown
codeparrot/codeparrot-clean
# -*- coding: utf-8 -*- # Copyright © 2012-2015 Roberto Alsina and others. # 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. """Install a theme.""" from __future__ import print_function import os import io import time import requests import pygments from pygments.lexers import PythonLexer from pygments.formatters import TerminalFormatter from nikola.plugin_categories import Command from nikola import utils LOGGER = utils.get_logger('install_theme', utils.STDERR_HANDLER) class CommandInstallTheme(Command): """Install a theme.""" name = "install_theme" doc_usage = "[[-u] theme_name] | [[-u] -l]" doc_purpose = "install theme into current site" output_dir = 'themes' cmd_options = [ { 'name': 'list', 'short': 'l', 'long': 'list', 'type': bool, 'default': False, 'help': 'Show list of available themes.' }, { 'name': 'url', 'short': 'u', 'long': 'url', 'type': str, 'help': "URL for the theme repository (default: " "https://themes.getnikola.com/v7/themes.json)", 'default': 'https://themes.getnikola.com/v7/themes.json' }, { 'name': 'getpath', 'short': 'g', 'long': 'get-path', 'type': bool, 'default': False, 'help': "Print the path for installed theme", }, ] def _execute(self, options, args): """Install theme into current site.""" listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if options['getpath'] and name: path = utils.get_theme_path(name) if path: print(path) else: print('not installed') return 0 if name is None and not listing: LOGGER.error("This command needs either a theme name or the -l option.") return False try: data = requests.get(url).json() except requests.exceptions.SSLError: LOGGER.warning("SSL error, using http instead of https (press ^C to abort)") time.sleep(1) url = url.replace('https', 'http', 1) data = requests.get(url).json() if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname)) def do_install(self, name, data): """Download and install a theme.""" if name in data: utils.makedirs(self.output_dir) url = data[name] LOGGER.info("Downloading '{0}'".format(url)) try: zip_data = requests.get(url).content except requests.exceptions.SSLError: LOGGER.warning("SSL error, using http instead of https (press ^C to abort)") time.sleep(1) url = url.replace('https', 'http', 1) zip_data = requests.get(url).content zip_file = io.BytesIO() zip_file.write(zip_data) LOGGER.info("Extracting '{0}' into themes/".format(name)) utils.extract_all(zip_file) dest_path = os.path.join(self.output_dir, name) else: dest_path = os.path.join(self.output_dir, name) try: theme_path = utils.get_theme_path(name) LOGGER.error("Theme '{0}' is already installed in {1}".format(name, theme_path)) except Exception: LOGGER.error("Can't find theme {0}".format(name)) return False confpypath = os.path.join(dest_path, 'conf.py.sample') if os.path.exists(confpypath): LOGGER.notice('This theme has a sample config file. Integrate it with yours in order to make this theme work!') print('Contents of the conf.py.sample file:\n') with io.open(confpypath, 'r', encoding='utf-8') as fh: if self.site.colorful: print(utils.indent(pygments.highlight( fh.read(), PythonLexer(), TerminalFormatter()), 4 * ' ')) else: print(utils.indent(fh.read(), 4 * ' ')) return True
unknown
codeparrot/codeparrot-clean
# Contributing to React Want to contribute to React? There are a few things you need to know. We wrote a **[contribution guide](https://reactjs.org/docs/how-to-contribute.html)** to help you get started.
unknown
github
https://github.com/facebook/react
CONTRIBUTING.md
name: Documentation description: Report a problem with the documentation labels: ["docs"] body: - type: markdown attributes: value: | > [!NOTE] > Trivial changes (for example typos) don’t require an issue before opening a PR. - type: textarea attributes: label: "Documentation" description: "A clear and concise description of the issue." validations: required: true
unknown
github
https://github.com/python/cpython
.github/ISSUE_TEMPLATE/documentation.yml
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry.page import shared_page_state from telemetry import story class ToughImageCasesPage(page_module.Page): def __init__(self, url, page_set): super(ToughImageCasesPage, self).__init__( url=url, page_set=page_set, shared_page_state_class=shared_page_state.SharedDesktopPageState) class ToughImageCasesPageSet(story.StorySet): """ A collection of image-heavy sites. """ def __init__(self): super(ToughImageCasesPageSet, self).__init__() urls_list = [ 'http://www.free-pictures-photos.com/aviation/airplane-306.jpg', ('http://upload.wikimedia.org/wikipedia/commons/c/cb/' 'General_history%2C_Alaska_Yukon_Pacific_Exposition%' '2C_fully_illustrated_-_meet_me_in_Seattle_1909_-_Page_78.jpg') ] for url in urls_list: self.AddStory(ToughImageCasesPage(url, self))
unknown
codeparrot/codeparrot-clean
# -*- mode: python; coding: utf-8 -*- import os import os.path import re import string import time import urlparse import logging from drydrop_handler import DRY_ROOT def cache_buster(html): def url_replacer(match): def get_stamp(files): stamp = "" for file in files: try: s = os.stat(file) stamp += time.strftime("%H%M%S", time.localtime(s.st_mtime)) except: # TODO: log this situation? missing main.html is a valid case pass return stamp def adhoc_remapper(path): return path.replace('drydrop-static', 'static').replace('.zip', '') # break url into parts url = match.groups(1)[1] parts = urlparse.urlparse(url) original = match.groups(1)[0] # do not touch absolute urls is_absolute = parts[1]!='' if is_absolute: return original path = os.path.join(DRY_ROOT, parts[2].lstrip('/')) path = adhoc_remapper(path) dir = os.path.dirname(path) files = [path] base = os.path.basename(path) stamp = get_stamp(files) if not stamp: return original if parts[3]=='': part3 = stamp else: part3 = parts[3] + "&" + stamp new_url = parts[2]+"?"+part3 result = string.replace(original, url, new_url) return result html = re.sub(r'(src="([^"]*)")', url_replacer, html) html = re.sub(r'(src=\'([^\']*)\')', url_replacer, html) html = re.sub(r'(href="([^#][^"]*)")', url_replacer, html) html = re.sub(r'(href=\'([^#][^\']*)\')', url_replacer, html) return html
unknown
codeparrot/codeparrot-clean
# Copyright (c) 2013 Intel, Inc. # Copyright (c) 2013 OpenStack Foundation # 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 jsonschema from nova import exception from nova.openstack.common import jsonutils from nova.openstack.common import log as logging from nova.pci import pci_utils from oslo.config import cfg pci_opts = [cfg.MultiStrOpt('pci_passthrough_whitelist', default=[], help='White list of PCI devices available to VMs. ' 'For example: pci_passthrough_whitelist = ' '[{"vendor_id": "8086", "product_id": "0443"}]' ) ] CONF = cfg.CONF CONF.register_opts(pci_opts) LOG = logging.getLogger(__name__) _PCI_VENDOR_PATTERN = "^(hex{4})$".replace("hex", "[\da-fA-F]") _WHITELIST_SCHEMA = { "type": "array", "items": { "type": "object", "additionalProperties": False, "properties": { "product_id": { "type": "string", "pattern": _PCI_VENDOR_PATTERN }, "vendor_id": { "type": "string", "pattern": _PCI_VENDOR_PATTERN }, }, "required": ["product_id", "vendor_id"] } } class PciHostDevicesWhiteList(object): """White list class to decide assignable pci devices. Not all devices on compute node can be assigned to guest, the cloud administrator decides the devices that can be assigned based on vendor_id or product_id etc. If no white list specified, no device will be assignable. """ def _parse_white_list_from_config(self, whitelists): """Parse and validate the pci whitelist from the nova config.""" specs = [] try: for jsonspecs in whitelists: spec = jsonutils.loads(jsonspecs) jsonschema.validate(spec, _WHITELIST_SCHEMA) specs.extend(spec) except Exception as e: raise exception.PciConfigInvalidWhitelist(reason=str(e)) return specs def __init__(self, whitelist_spec=None): """White list constructor For example, followed json string specifies that devices whose vendor_id is '8086' and product_id is '1520' can be assigned to guest. '[{"product_id":"1520", "vendor_id":"8086"}]' :param whitelist_spec: A json string for a list of dictionaries, each dictionary specifies the pci device properties requirement. """ super(PciHostDevicesWhiteList, self).__init__() if whitelist_spec: self.spec = self._parse_white_list_from_config(whitelist_spec) else: self.spec = None def device_assignable(self, dev): """Check if a device can be assigned to a guest. :param dev: A dictionary describing the device properties """ if self.spec is None: return False return pci_utils.pci_device_prop_match(dev, self.spec) def get_pci_devices_filter(): return PciHostDevicesWhiteList(CONF.pci_passthrough_whitelist)
unknown
codeparrot/codeparrot-clean
# =========================================================================== # eXe # Copyright 2004-2006, University of Auckland # Copyright 2004-2008 eXe Project, http://eXeLearning.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # =========================================================================== """ QuizTestBlock can render and process QuizTestIdevices as XHTML """ import logging from exe.webui.block import Block from exe.webui.testquestionelement import TestquestionElement from exe.webui import common log = logging.getLogger(__name__) # =========================================================================== class QuizTestBlock(Block): """ QuizTestBlock can render and process QuizTestIdevices as XHTML """ def __init__(self, parent, idevice): """ Initialize a new Block object """ Block.__init__(self, parent, idevice) self.idevice = idevice self.questionElements = [] self.message = False if not hasattr(self.idevice,'undo'): self.idevice.undo = True i = 0 for question in idevice.questions: self.questionElements.append(TestquestionElement(i, idevice, question)) i += 1 def process(self, request): """ Process the request arguments from the web server """ Block.process(self, request) is_cancel = common.requestHasCancel(request) if ("addQuestion"+unicode(self.id)) in request.args: self.idevice.addQuestion() self.idevice.edit = True # disable Undo once a question has been added: self.idevice.undo = False if "passrate" in request.args \ and not is_cancel: self.idevice.passRate = request.args["passrate"][0] for element in self.questionElements: element.process(request) if ("action" in request.args and request.args["action"][0] == "done" or not self.idevice.edit): self.idevice.isAnswered = True # remove the undo flag in order to reenable it next time: if hasattr(self.idevice,'undo'): del self.idevice.undo for question in self.idevice.questions: if question.correctAns == -2: self.idevice.isAnswered = False self.idevice.edit = True break if "submitScore" in request.args \ and not is_cancel: self.idevice.score = self.__calcScore() if "title"+self.id in request.args \ and not is_cancel: self.idevice.title = request.args["title"+self.id][0] def renderEdit(self, style): """ Returns an XHTML string with the form element for editing this block """ html = "<div class=\"iDevice\">\n" if not self.idevice.isAnswered: html += common.editModeHeading( _("Please select a correct answer for each question.")) html += common.textInput("title"+self.id, self.idevice.title) html += u"<br/><br/>\n" for element in self.questionElements: html += element.renderEdit() value = _("Add another Question") html += "<br/>" html += common.submitButton("addQuestion"+unicode(self.id), value) html += "<br/><br/>" + _("Select pass rate: ") html += "<select name=\"passrate\">\n" template = ' <option value="%s0"%s>%s0%%</option>\n' for i in range(1, 11): if str(i)+ "0" == self.idevice.passRate: html += template % (str(i), ' selected="selected"', str(i)) else: html += template % (str(i), '', str(i)) html += "</select>\n" html += "<br /><br />" + self.renderEditButtons(undo=self.idevice.undo) html += "</div>\n" self.idevice.isAnswered = True return html def renderView(self, style, preview=False): """ Returns an XHTML string for viewing this block """ html = u'<form name="quizForm%s" id="quizForm%s" ' % ( self.idevice.id, self.idevice.id) html += u'action="javascript:calcScore2();">\n' html += u'<div class="iDevice ' html += u'emphasis'+unicode(self.idevice.emphasis)+'">\n' html += u'<img alt="" class="iDevice_icon" ' html += u'src="icon_'+self.idevice.icon+'.gif" />\n' html += u'<span class="iDeviceTitle">' html += self.idevice.title+'</span>\n' html += u'<div class="iDevice_inner">\n' html += u'<div class="passrate" value="%s"></div>\n' % self.idevice.passRate for element in self.questionElements: if preview: html += element.renderPreview() + "<br/>" else: html += element.renderView() + "<br/>" html += '<input type="submit" name="submitB" ' html += 'value="%s"/>\n' % _(u"SUBMIT ANSWERS") html += "</div></div>\n" html += '</form>\n' return html def renderJavascriptForWeb(self): """ Return an XHTML string for generating the javascript for web export """ scriptStr = '<script type="text/javascript">\n' scriptStr += '<!-- //<![CDATA[\n' scriptStr += "var numQuestions = " scriptStr += str(len(self.questionElements))+";\n" scriptStr += "var rawScore = 0;\n" scriptStr += "var actualScore = 0;\n" answerStr = """function getAnswer() {""" varStrs = "" keyStrs = "" answers = "" rawScoreStr = """} function calcRawScore(){\n""" for element in self.questionElements: i = element.index varStr = "question" + str(i) keyStr = "key" + str(i) quesId = "key" + str(element.index) + "b" + self.id numOption = element.getNumOption() answers += "var key" + str(i) + " = " answers += str(element.question.correctAns) + ";\n" getEle = 'document.getElementById("quizForm%s")' % \ self.idevice.id chk = '%s.%s[i].checked'% (getEle, quesId) value = '%s.%s[i].value' % (getEle, quesId) varStrs += "var " + varStr + ";\n" keyStrs += "var key" + str(i)+ " = " keyStrs += str(element.question.correctAns) + ";\n" answerStr += """ for (var i=0; i < %s; i++) { if (%s) { %s = %s; break; } } """ % (numOption, chk, varStr, value) rawScoreStr += """ if (%s == %s) { rawScore++; }""" % (varStr, keyStr) scriptStr += varStrs scriptStr += keyStrs scriptStr += answerStr scriptStr += rawScoreStr scriptStr += """ } function calcScore2() { getAnswer(); calcRawScore(); actualScore = Math.round(rawScore / numQuestions * 100); document.getElementById("quizForm%s").submitB.disabled = true; alert("Your score is " + actualScore + "%%") } //]]> --> </script>\n""" % self.idevice.id return scriptStr def renderJavascriptForScorm(self): """ Return an XHTML string for generating the javascript for scorm export """ scriptStr = '<script type="text/javascript">\n' scriptStr += '<!-- //<![CDATA[\n' scriptStr += "var numQuestions = " scriptStr += unicode(len(self.questionElements))+";\n" scriptStr += "var rawScore = 0;\n" scriptStr += "var actualScore = 0;\n" answerStr = """function getAnswer() {""" varStrs = "" keyStrs = "" answers = "" rawScoreStr = """} function calcRawScore(){\n""" for element in self.questionElements: i = element.index varStr = "question" + unicode(i) keyStr = "key" + unicode(i) quesId = "key" + unicode(element.index) + "b" + self.id numOption = element.getNumOption() answers += "var key" + unicode(i) + " = " answers += unicode(element.question.correctAns) + ";\n" getEle = 'document.getElementById("quizForm%s")' % \ self.idevice.id chk = '%s.%s[i].checked'% (getEle, quesId) value = '%s.%s[i].value' % (getEle, quesId) varStrs += "var " + varStr + ";\n" keyStrs += "var key" + unicode(i)+ " = " keyStrs += unicode(element.question.correctAns) + ";\n" answerStr += """ doLMSSetValue("cmi.interactions.%s.id","%s"); doLMSSetValue("cmi.interactions.%s.type","choice"); doLMSSetValue("cmi.interactions.%s.correct_responses.0.pattern", "%s"); """ % (unicode(i), quesId, unicode(i), unicode(i), element.question.correctAns) answerStr += """ for (var i=0; i < %s; i++) { if (%s) { %s = %s; doLMSSetValue("cmi.interactions.%s.student_response",%s); break; } } """ % (numOption, chk, varStr, value, unicode(i), varStr) rawScoreStr += """ if (%s == %s) { doLMSSetValue("cmi.interactions.%s.result","correct"); rawScore++; } else { doLMSSetValue("cmi.interactions.%s.result","wrong"); }""" % (varStr, keyStr, unicode(i), unicode(i)) scriptStr += varStrs scriptStr += keyStrs scriptStr += answerStr scriptStr += rawScoreStr scriptStr += """ } function calcScore2() { computeTime(); // the student has stopped here. """ scriptStr += """ document.getElementById("quizForm%s").submitB.disabled = true; """ % (self.idevice.id) scriptStr += """ getAnswer(); calcRawScore(); actualScore = Math.round(rawScore / numQuestions * 100); """ scriptStr += 'alert("Your score is " + actualScore + "%")' scriptStr += """ doLMSSetValue( "cmi.core.score.raw", actualScore+"" ); doLMSSetValue( "cmi.core.score.max", "100" ); var mode = doLMSGetValue( "cmi.core.lesson_mode" ); if ( mode != "review" && mode != "browse" ){ if ( actualScore < %s ) { doLMSSetValue( "cmi.core.lesson_status", "failed" ); } else { doLMSSetValue( "cmi.core.lesson_status", "passed" ); } doLMSSetValue( "cmi.core.exit", "" ); } exitPageStatus = true; doLMSCommit(); doLMSFinish(); } //]]> --> </script>\n""" % self.idevice.passRate return scriptStr def renderPreview(self, style): """ Returns an XHTML string for previewing this block """ html = u"<div class=\"iDevice " html += u"emphasis"+unicode(self.idevice.emphasis)+"\" " html += u"ondblclick=\"submitLink('edit',"+self.id+", 0);\">\n" html += u'<img alt="" class="iDevice_icon" ' html += u"src=\"/style/"+style+"/icon_"+self.idevice.icon html += ".gif\" />\n" html += u"<span class=\"iDeviceTitle\">" html += self.idevice.title+"</span>\n" html += u'<div class="iDevice_inner">\n' for element in self.questionElements: html += element.renderPreview() + "<br/>" html += '<input type="submit" name="submitScore"' html += ' value="%s"/> ' % _("Submit Answer") if not self.idevice.score == -1: message = "Your score is " + unicode(self.idevice.score) + "%" html += "<b>"+ message+ "</b><br/>" self.idevice.score = -1 html += u"</div>\n" html += self.renderViewButtons() html += u"</div>\n" return html def __calcScore(self): """ Return a score for preview mode. """ rawScore = 0 numQuestion = len(self.questionElements) score = 0 for question in self.idevice.questions: if (question.userAns == question.correctAns): log.info("userAns " +unicode(question.userAns) + ": " + "correctans " +unicode(question.correctAns)) rawScore += 1 if numQuestion > 0: score = rawScore * 100 / numQuestion for question in self.idevice.questions: question.userAns = -1 return score # =========================================================================== """Register this block with the BlockFactory""" from exe.engine.quiztestidevice import QuizTestIdevice from exe.webui.blockfactory import g_blockFactory g_blockFactory.registerBlockType(QuizTestBlock, QuizTestIdevice) # ===========================================================================
unknown
codeparrot/codeparrot-clean
/* * Copyright 2002-present the original author or authors. * * 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. */ package org.springframework.context.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Beans on which the current bean depends. Any beans specified are guaranteed to be * created by the container before this bean. Used infrequently in cases where a bean * does not explicitly depend on another through properties or constructor arguments, * but rather depends on the side effects of another bean's initialization. * * <p>A depends-on declaration can specify both an initialization-time dependency and, * in the case of singleton beans only, a corresponding destruction-time dependency. * Dependent beans that define a depends-on relationship with a given bean are destroyed * first, prior to the given bean itself being destroyed. Thus, a depends-on declaration * can also control shutdown order. * * <p>May be used on any class directly or indirectly annotated with * {@link org.springframework.stereotype.Component} or on methods annotated * with {@link Bean}. * * <p>Using {@link DependsOn} at the class level has no effect unless component-scanning * is being used. If a {@link DependsOn}-annotated class is declared via XML, * {@link DependsOn} annotation metadata is ignored, and * {@code <bean depends-on="..."/>} is respected instead. * * @author Juergen Hoeller * @since 3.0 */ @Target({ElementType.TYPE, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface DependsOn { String[] value() default {}; }
java
github
https://github.com/spring-projects/spring-framework
spring-context/src/main/java/org/springframework/context/annotation/DependsOn.java
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2015, Sam Liu <sam.liu@activenetwork.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = r''' --- module: win_file_version version_added: "2.1" short_description: Get DLL or EXE file build version description: - Get DLL or EXE file build version. notes: - This module will always return no change. options: path: description: - File to get version. - Always provide absolute path. type: path required: yes seealso: - module: win_file author: - Sam Liu (@SamLiu79) ''' EXAMPLES = r''' - name: Get acm instance version win_file_version: path: C:\Windows\System32\cmd.exe register: exe_file_version - debug: msg: '{{ exe_file_version }}' ''' RETURN = r''' path: description: file path returned: always type: str file_version: description: File version number.. returned: no error type: str product_version: description: The version of the product this file is distributed with. returned: no error type: str file_major_part: description: the major part of the version number. returned: no error type: str file_minor_part: description: the minor part of the version number of the file. returned: no error type: str file_build_part: description: build number of the file. returned: no error type: str file_private_part: description: file private part number. returned: no error type: str '''
unknown
codeparrot/codeparrot-clean
def main(request, response): import simplejson as json f = file('config.json') source = f.read() s = json.JSONDecoder().decode(source) url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1]) url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0]) _CSP = "script-src 'self' 'unsafe-inline'" response.headers.set("Content-Security-Policy", _CSP) response.headers.set("X-Content-Security-Policy", _CSP) response.headers.set("X-WebKit-CSP", _CSP) return """<!DOCTYPE html> <html> <head> <title>CSP Test: script-src 'self' 'unsafe-inline'</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta description="Content-Security-Policy Test: script-src 'self' 'unsafe-inline'" /> <link rel="author" title="bhill@paypal-inc.com" /> <script src="../../resources/testharness.js"></script> <script src="../../resources/testharnessreport.js"></script> <script src="CSP_passTest001.py"></script> </head> <body> <div id=log></div> </body> <!-- This test demonstrates how to test something that shouldn't happen, or fail when something that should happend doesn't. Use script with conditional execution based on the policy being tested to set a variable, then use script we know will execute by policy to check if it is set. Some limitations on this approach, obviously, if policy enforcement is very broken - when we can't count on any script to execute - but this is a start, at least. --> <script> test(function() {assert_true(false)}, "assert_true with false from unsafe inline script"); </script> </html> """
unknown
codeparrot/codeparrot-clean
# # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # import unittest, setup_path from sys import version_info # For Python version check if version_info[0] >= 3: # Python >=3.0 from io import StringIO else: # Python <3.0 from StringIO import StringIO from svn import core, repos, fs, delta from svn.core import SubversionException import utils class ChangeReceiver(delta.Editor): """A delta editor which saves textdeltas for later use""" def __init__(self, src_root, tgt_root): self.src_root = src_root self.tgt_root = tgt_root self.textdeltas = [] def apply_textdelta(self, file_baton, base_checksum, pool=None): def textdelta_handler(textdelta): if textdelta is not None: self.textdeltas.append(textdelta) return textdelta_handler def _authz_callback(root, path, pool): "A dummy authz callback which always returns success." return 1 class SubversionRepositoryTestCase(unittest.TestCase): """Test cases for the Subversion repository layer""" def setUp(self): """Load a Subversion repository""" self.temper = utils.Temper() (self.repos, _, _) = self.temper.alloc_known_repo( 'trac/versioncontrol/tests/svnrepos.dump', suffix='-repository') self.fs = repos.fs(self.repos) self.rev = fs.youngest_rev(self.fs) def tearDown(self): self.fs = None self.repos = None self.temper.cleanup() def test_cease_invocation(self): """Test returning SVN_ERR_CEASE_INVOCATION from a callback""" revs = [] def history_lookup(path, rev, pool): revs.append(rev) raise core.SubversionException(apr_err=core.SVN_ERR_CEASE_INVOCATION, message="Hi from history_lookup") repos.history2(self.fs, '/trunk/README2.txt', history_lookup, None, 0, self.rev, True) self.assertEqual(len(revs), 1) def test_create(self): """Make sure that repos.create doesn't segfault when we set fs-type using a config hash""" fs_config = { "fs-type": "fsfs" } for i in range(5): path = self.temper.alloc_empty_dir(suffix='-repository-create%d' % i) repos.create(path, "", "", None, fs_config) def test_dump_fs2(self): """Test the dump_fs2 function""" self.callback_calls = 0 def is_cancelled(): self.callback_calls += 1 return None dumpstream = StringIO() feedbackstream = StringIO() repos.dump_fs2(self.repos, dumpstream, feedbackstream, 0, self.rev, 0, 0, is_cancelled) # Check that we can dump stuff dump = dumpstream.getvalue() feedback = feedbackstream.getvalue() expected_feedback = "* Dumped revision " + str(self.rev) self.assertEquals(dump.count("Node-path: trunk/README.txt"), 2) self.assertEquals(feedback.count(expected_feedback), 1) self.assertEquals(self.callback_calls, 13) # Check that the dump can be cancelled self.assertRaises(SubversionException, repos.dump_fs2, self.repos, dumpstream, feedbackstream, 0, self.rev, 0, 0, lambda: 1) dumpstream.close() feedbackstream.close() # Check that the dump fails when the dumpstream is closed self.assertRaises(ValueError, repos.dump_fs2, self.repos, dumpstream, feedbackstream, 0, self.rev, 0, 0, None) dumpstream = StringIO() feedbackstream = StringIO() # Check that we can grab the feedback stream, but not the dumpstream repos.dump_fs2(self.repos, None, feedbackstream, 0, self.rev, 0, 0, None) feedback = feedbackstream.getvalue() self.assertEquals(feedback.count(expected_feedback), 1) # Check that we can grab the dumpstream, but not the feedbackstream repos.dump_fs2(self.repos, dumpstream, None, 0, self.rev, 0, 0, None) dump = dumpstream.getvalue() self.assertEquals(dump.count("Node-path: trunk/README.txt"), 2) # Check that we can ignore both the dumpstream and the feedbackstream repos.dump_fs2(self.repos, dumpstream, None, 0, self.rev, 0, 0, None) self.assertEquals(feedback.count(expected_feedback), 1) # FIXME: The Python bindings don't check for 'NULL' values for # svn_repos_t objects, so the following call segfaults #repos.dump_fs2(None, None, None, 0, self.rev, 0, 0, None) def test_get_logs(self): """Test scope of get_logs callbacks""" logs = [] def addLog(paths, revision, author, date, message, pool): if paths is not None: logs.append(paths) # Run get_logs repos.get_logs(self.repos, ['/'], self.rev, 0, True, 0, addLog) # Count and verify changes change_count = 0 for log in logs: for path_changed in log.values(): change_count += 1 path_changed.assert_valid() self.assertEqual(logs[2]["/tags/v1.1"].action, "A") self.assertEqual(logs[2]["/tags/v1.1"].copyfrom_path, "/branches/v1x") self.assertEqual(len(logs), 12) self.assertEqual(change_count, 19) def test_dir_delta(self): """Test scope of dir_delta callbacks""" # Run dir_delta this_root = fs.revision_root(self.fs, self.rev) prev_root = fs.revision_root(self.fs, self.rev-1) editor = ChangeReceiver(this_root, prev_root) e_ptr, e_baton = delta.make_editor(editor) repos.dir_delta(prev_root, '', '', this_root, '', e_ptr, e_baton, _authz_callback, 1, 1, 0, 0) # Check results. # Ignore the order in which the editor delivers the two sibling files. self.assertEqual(set([editor.textdeltas[0].new_data, editor.textdeltas[1].new_data]), set(["This is a test.\n", "A test.\n"])) self.assertEqual(len(editor.textdeltas), 2) def test_retrieve_and_change_rev_prop(self): """Test playing with revprops""" self.assertEqual(repos.fs_revision_prop(self.repos, self.rev, "svn:log", _authz_callback), "''(a few years later)'' Argh... v1.1 was buggy, " "after all") # We expect this to complain because we have no pre-revprop-change # hook script for the repository. self.assertRaises(SubversionException, repos.fs_change_rev_prop3, self.repos, self.rev, "jrandom", "svn:log", "Youngest revision", True, True, _authz_callback) repos.fs_change_rev_prop3(self.repos, self.rev, "jrandom", "svn:log", "Youngest revision", False, False, _authz_callback) self.assertEqual(repos.fs_revision_prop(self.repos, self.rev, "svn:log", _authz_callback), "Youngest revision") def suite(): return unittest.defaultTestLoader.loadTestsFromTestCase( SubversionRepositoryTestCase) if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite())
unknown
codeparrot/codeparrot-clean
"""Arithmetics for dense recursive polynomials in ``K[x]`` or ``K[X]``. """ from __future__ import print_function, division from sympy.polys.densebasic import ( dup_slice, dup_LC, dmp_LC, dup_degree, dmp_degree, dup_strip, dmp_strip, dmp_zero_p, dmp_zero, dmp_one_p, dmp_one, dmp_ground, dmp_zeros) from sympy.polys.polyerrors import (ExactQuotientFailed, PolynomialDivisionFailed) from sympy.core.compatibility import range def dup_add_term(f, c, i, K): """ Add ``c*x**i`` to ``f`` in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_add_term(x**2 - 1, ZZ(2), 4) 2*x**4 + x**2 - 1 """ if not c: return f n = len(f) m = n - i - 1 if i == n - 1: return dup_strip([f[0] + c] + f[1:]) else: if i >= n: return [c] + [K.zero]*(i - n) + f else: return f[:m] + [f[m] + c] + f[m + 1:] def dmp_add_term(f, c, i, u, K): """ Add ``c(x_2..x_u)*x_0**i`` to ``f`` in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_add_term(x*y + 1, 2, 2) 2*x**2 + x*y + 1 """ if not u: return dup_add_term(f, c, i, K) v = u - 1 if dmp_zero_p(c, v): return f n = len(f) m = n - i - 1 if i == n - 1: return dmp_strip([dmp_add(f[0], c, v, K)] + f[1:], u) else: if i >= n: return [c] + dmp_zeros(i - n, v, K) + f else: return f[:m] + [dmp_add(f[m], c, v, K)] + f[m + 1:] def dup_sub_term(f, c, i, K): """ Subtract ``c*x**i`` from ``f`` in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_sub_term(2*x**4 + x**2 - 1, ZZ(2), 4) x**2 - 1 """ if not c: return f n = len(f) m = n - i - 1 if i == n - 1: return dup_strip([f[0] - c] + f[1:]) else: if i >= n: return [-c] + [K.zero]*(i - n) + f else: return f[:m] + [f[m] - c] + f[m + 1:] def dmp_sub_term(f, c, i, u, K): """ Subtract ``c(x_2..x_u)*x_0**i`` from ``f`` in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_sub_term(2*x**2 + x*y + 1, 2, 2) x*y + 1 """ if not u: return dup_add_term(f, -c, i, K) v = u - 1 if dmp_zero_p(c, v): return f n = len(f) m = n - i - 1 if i == n - 1: return dmp_strip([dmp_sub(f[0], c, v, K)] + f[1:], u) else: if i >= n: return [dmp_neg(c, v, K)] + dmp_zeros(i - n, v, K) + f else: return f[:m] + [dmp_sub(f[m], c, v, K)] + f[m + 1:] def dup_mul_term(f, c, i, K): """ Multiply ``f`` by ``c*x**i`` in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_mul_term(x**2 - 1, ZZ(3), 2) 3*x**4 - 3*x**2 """ if not c or not f: return [] else: return [ cf * c for cf in f ] + [K.zero]*i def dmp_mul_term(f, c, i, u, K): """ Multiply ``f`` by ``c(x_2..x_u)*x_0**i`` in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_mul_term(x**2*y + x, 3*y, 2) 3*x**4*y**2 + 3*x**3*y """ if not u: return dup_mul_term(f, c, i, K) v = u - 1 if dmp_zero_p(f, u): return f if dmp_zero_p(c, v): return dmp_zero(u) else: return [ dmp_mul(cf, c, v, K) for cf in f ] + dmp_zeros(i, v, K) def dup_add_ground(f, c, K): """ Add an element of the ground domain to ``f``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_add_ground(x**3 + 2*x**2 + 3*x + 4, ZZ(4)) x**3 + 2*x**2 + 3*x + 8 """ return dup_add_term(f, c, 0, K) def dmp_add_ground(f, c, u, K): """ Add an element of the ground domain to ``f``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_add_ground(x**3 + 2*x**2 + 3*x + 4, ZZ(4)) x**3 + 2*x**2 + 3*x + 8 """ return dmp_add_term(f, dmp_ground(c, u - 1), 0, u, K) def dup_sub_ground(f, c, K): """ Subtract an element of the ground domain from ``f``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_sub_ground(x**3 + 2*x**2 + 3*x + 4, ZZ(4)) x**3 + 2*x**2 + 3*x """ return dup_sub_term(f, c, 0, K) def dmp_sub_ground(f, c, u, K): """ Subtract an element of the ground domain from ``f``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_sub_ground(x**3 + 2*x**2 + 3*x + 4, ZZ(4)) x**3 + 2*x**2 + 3*x """ return dmp_sub_term(f, dmp_ground(c, u - 1), 0, u, K) def dup_mul_ground(f, c, K): """ Multiply ``f`` by a constant value in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_mul_ground(x**2 + 2*x - 1, ZZ(3)) 3*x**2 + 6*x - 3 """ if not c or not f: return [] else: return [ cf * c for cf in f ] def dmp_mul_ground(f, c, u, K): """ Multiply ``f`` by a constant value in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_mul_ground(2*x + 2*y, ZZ(3)) 6*x + 6*y """ if not u: return dup_mul_ground(f, c, K) v = u - 1 return [ dmp_mul_ground(cf, c, v, K) for cf in f ] def dup_quo_ground(f, c, K): """ Quotient by a constant in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x = ring("x", ZZ) >>> R.dup_quo_ground(3*x**2 + 2, ZZ(2)) x**2 + 1 >>> R, x = ring("x", QQ) >>> R.dup_quo_ground(3*x**2 + 2, QQ(2)) 3/2*x**2 + 1 """ if not c: raise ZeroDivisionError('polynomial division') if not f: return f if K.has_Field: return [ K.quo(cf, c) for cf in f ] else: return [ cf // c for cf in f ] def dmp_quo_ground(f, c, u, K): """ Quotient by a constant in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_quo_ground(2*x**2*y + 3*x, ZZ(2)) x**2*y + x >>> R, x,y = ring("x,y", QQ) >>> R.dmp_quo_ground(2*x**2*y + 3*x, QQ(2)) x**2*y + 3/2*x """ if not u: return dup_quo_ground(f, c, K) v = u - 1 return [ dmp_quo_ground(cf, c, v, K) for cf in f ] def dup_exquo_ground(f, c, K): """ Exact quotient by a constant in ``K[x]``. Examples ======== >>> from sympy.polys import ring, QQ >>> R, x = ring("x", QQ) >>> R.dup_exquo_ground(x**2 + 2, QQ(2)) 1/2*x**2 + 1 """ if not c: raise ZeroDivisionError('polynomial division') if not f: return f return [ K.exquo(cf, c) for cf in f ] def dmp_exquo_ground(f, c, u, K): """ Exact quotient by a constant in ``K[X]``. Examples ======== >>> from sympy.polys import ring, QQ >>> R, x,y = ring("x,y", QQ) >>> R.dmp_exquo_ground(x**2*y + 2*x, QQ(2)) 1/2*x**2*y + x """ if not u: return dup_exquo_ground(f, c, K) v = u - 1 return [ dmp_exquo_ground(cf, c, v, K) for cf in f ] def dup_lshift(f, n, K): """ Efficiently multiply ``f`` by ``x**n`` in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_lshift(x**2 + 1, 2) x**4 + x**2 """ if not f: return f else: return f + [K.zero]*n def dup_rshift(f, n, K): """ Efficiently divide ``f`` by ``x**n`` in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_rshift(x**4 + x**2, 2) x**2 + 1 >>> R.dup_rshift(x**4 + x**2 + 2, 2) x**2 + 1 """ return f[:-n] def dup_abs(f, K): """ Make all coefficients positive in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_abs(x**2 - 1) x**2 + 1 """ return [ K.abs(coeff) for coeff in f ] def dmp_abs(f, u, K): """ Make all coefficients positive in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_abs(x**2*y - x) x**2*y + x """ if not u: return dup_abs(f, K) v = u - 1 return [ dmp_abs(cf, v, K) for cf in f ] def dup_neg(f, K): """ Negate a polynomial in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_neg(x**2 - 1) -x**2 + 1 """ return [ -coeff for coeff in f ] def dmp_neg(f, u, K): """ Negate a polynomial in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_neg(x**2*y - x) -x**2*y + x """ if not u: return dup_neg(f, K) v = u - 1 return [ dmp_neg(cf, v, K) for cf in f ] def dup_add(f, g, K): """ Add dense polynomials in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_add(x**2 - 1, x - 2) x**2 + x - 3 """ if not f: return g if not g: return f df = dup_degree(f) dg = dup_degree(g) if df == dg: return dup_strip([ a + b for a, b in zip(f, g) ]) else: k = abs(df - dg) if df > dg: h, f = f[:k], f[k:] else: h, g = g[:k], g[k:] return h + [ a + b for a, b in zip(f, g) ] def dmp_add(f, g, u, K): """ Add dense polynomials in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_add(x**2 + y, x**2*y + x) x**2*y + x**2 + x + y """ if not u: return dup_add(f, g, K) df = dmp_degree(f, u) if df < 0: return g dg = dmp_degree(g, u) if dg < 0: return f v = u - 1 if df == dg: return dmp_strip([ dmp_add(a, b, v, K) for a, b in zip(f, g) ], u) else: k = abs(df - dg) if df > dg: h, f = f[:k], f[k:] else: h, g = g[:k], g[k:] return h + [ dmp_add(a, b, v, K) for a, b in zip(f, g) ] def dup_sub(f, g, K): """ Subtract dense polynomials in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_sub(x**2 - 1, x - 2) x**2 - x + 1 """ if not f: return dup_neg(g, K) if not g: return f df = dup_degree(f) dg = dup_degree(g) if df == dg: return dup_strip([ a - b for a, b in zip(f, g) ]) else: k = abs(df - dg) if df > dg: h, f = f[:k], f[k:] else: h, g = dup_neg(g[:k], K), g[k:] return h + [ a - b for a, b in zip(f, g) ] def dmp_sub(f, g, u, K): """ Subtract dense polynomials in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_sub(x**2 + y, x**2*y + x) -x**2*y + x**2 - x + y """ if not u: return dup_sub(f, g, K) df = dmp_degree(f, u) if df < 0: return dmp_neg(g, u, K) dg = dmp_degree(g, u) if dg < 0: return f v = u - 1 if df == dg: return dmp_strip([ dmp_sub(a, b, v, K) for a, b in zip(f, g) ], u) else: k = abs(df - dg) if df > dg: h, f = f[:k], f[k:] else: h, g = dmp_neg(g[:k], u, K), g[k:] return h + [ dmp_sub(a, b, v, K) for a, b in zip(f, g) ] def dup_add_mul(f, g, h, K): """ Returns ``f + g*h`` where ``f, g, h`` are in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_add_mul(x**2 - 1, x - 2, x + 2) 2*x**2 - 5 """ return dup_add(f, dup_mul(g, h, K), K) def dmp_add_mul(f, g, h, u, K): """ Returns ``f + g*h`` where ``f, g, h`` are in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_add_mul(x**2 + y, x, x + 2) 2*x**2 + 2*x + y """ return dmp_add(f, dmp_mul(g, h, u, K), u, K) def dup_sub_mul(f, g, h, K): """ Returns ``f - g*h`` where ``f, g, h`` are in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_sub_mul(x**2 - 1, x - 2, x + 2) 3 """ return dup_sub(f, dup_mul(g, h, K), K) def dmp_sub_mul(f, g, h, u, K): """ Returns ``f - g*h`` where ``f, g, h`` are in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_sub_mul(x**2 + y, x, x + 2) -2*x + y """ return dmp_sub(f, dmp_mul(g, h, u, K), u, K) def dup_mul(f, g, K): """ Multiply dense polynomials in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_mul(x - 2, x + 2) x**2 - 4 """ if f == g: return dup_sqr(f, K) if not (f and g): return [] df = dup_degree(f) dg = dup_degree(g) n = max(df, dg) + 1 if n < 100: h = [] for i in range(0, df + dg + 1): coeff = K.zero for j in range(max(0, i - dg), min(df, i) + 1): coeff += f[j]*g[i - j] h.append(coeff) return dup_strip(h) else: # Use Karatsuba's algorithm (divide and conquer), see e.g.: # Joris van der Hoeven, Relax But Don't Be Too Lazy, # J. Symbolic Computation, 11 (2002), section 3.1.1. n2 = n//2 fl, gl = dup_slice(f, 0, n2, K), dup_slice(g, 0, n2, K) fh = dup_rshift(dup_slice(f, n2, n, K), n2, K) gh = dup_rshift(dup_slice(g, n2, n, K), n2, K) lo, hi = dup_mul(fl, gl, K), dup_mul(fh, gh, K) mid = dup_mul(dup_add(fl, fh, K), dup_add(gl, gh, K), K) mid = dup_sub(mid, dup_add(lo, hi, K), K) return dup_add(dup_add(lo, dup_lshift(mid, n2, K), K), dup_lshift(hi, 2*n2, K), K) def dmp_mul(f, g, u, K): """ Multiply dense polynomials in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_mul(x*y + 1, x) x**2*y + x """ if not u: return dup_mul(f, g, K) if f == g: return dmp_sqr(f, u, K) df = dmp_degree(f, u) if df < 0: return f dg = dmp_degree(g, u) if dg < 0: return g h, v = [], u - 1 for i in range(0, df + dg + 1): coeff = dmp_zero(v) for j in range(max(0, i - dg), min(df, i) + 1): coeff = dmp_add(coeff, dmp_mul(f[j], g[i - j], v, K), v, K) h.append(coeff) return dmp_strip(h, u) def dup_sqr(f, K): """ Square dense polynomials in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_sqr(x**2 + 1) x**4 + 2*x**2 + 1 """ df, h = len(f) - 1, [] for i in range(0, 2*df + 1): c = K.zero jmin = max(0, i - df) jmax = min(i, df) n = jmax - jmin + 1 jmax = jmin + n // 2 - 1 for j in range(jmin, jmax + 1): c += f[j]*f[i - j] c += c if n & 1: elem = f[jmax + 1] c += elem**2 h.append(c) return dup_strip(h) def dmp_sqr(f, u, K): """ Square dense polynomials in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_sqr(x**2 + x*y + y**2) x**4 + 2*x**3*y + 3*x**2*y**2 + 2*x*y**3 + y**4 """ if not u: return dup_sqr(f, K) df = dmp_degree(f, u) if df < 0: return f h, v = [], u - 1 for i in range(0, 2*df + 1): c = dmp_zero(v) jmin = max(0, i - df) jmax = min(i, df) n = jmax - jmin + 1 jmax = jmin + n // 2 - 1 for j in range(jmin, jmax + 1): c = dmp_add(c, dmp_mul(f[j], f[i - j], v, K), v, K) c = dmp_mul_ground(c, K(2), v, K) if n & 1: elem = dmp_sqr(f[jmax + 1], v, K) c = dmp_add(c, elem, v, K) h.append(c) return dmp_strip(h, u) def dup_pow(f, n, K): """ Raise ``f`` to the ``n``-th power in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_pow(x - 2, 3) x**3 - 6*x**2 + 12*x - 8 """ if not n: return [K.one] if n < 0: raise ValueError("can't raise polynomial to a negative power") if n == 1 or not f or f == [K.one]: return f g = [K.one] while True: n, m = n//2, n if m % 2: g = dup_mul(g, f, K) if not n: break f = dup_sqr(f, K) return g def dmp_pow(f, n, u, K): """ Raise ``f`` to the ``n``-th power in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_pow(x*y + 1, 3) x**3*y**3 + 3*x**2*y**2 + 3*x*y + 1 """ if not u: return dup_pow(f, n, K) if not n: return dmp_one(u, K) if n < 0: raise ValueError("can't raise polynomial to a negative power") if n == 1 or dmp_zero_p(f, u) or dmp_one_p(f, u, K): return f g = dmp_one(u, K) while True: n, m = n//2, n if m & 1: g = dmp_mul(g, f, u, K) if not n: break f = dmp_sqr(f, u, K) return g def dup_pdiv(f, g, K): """ Polynomial pseudo-division in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_pdiv(x**2 + 1, 2*x - 4) (2*x + 4, 20) """ df = dup_degree(f) dg = dup_degree(g) q, r, dr = [], f, df if not g: raise ZeroDivisionError("polynomial division") elif df < dg: return q, r N = df - dg + 1 lc_g = dup_LC(g, K) while True: lc_r = dup_LC(r, K) j, N = dr - dg, N - 1 Q = dup_mul_ground(q, lc_g, K) q = dup_add_term(Q, lc_r, j, K) R = dup_mul_ground(r, lc_g, K) G = dup_mul_term(g, lc_r, j, K) r = dup_sub(R, G, K) _dr, dr = dr, dup_degree(r) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) c = lc_g**N q = dup_mul_ground(q, c, K) r = dup_mul_ground(r, c, K) return q, r def dup_prem(f, g, K): """ Polynomial pseudo-remainder in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_prem(x**2 + 1, 2*x - 4) 20 """ df = dup_degree(f) dg = dup_degree(g) r, dr = f, df if not g: raise ZeroDivisionError("polynomial division") elif df < dg: return r N = df - dg + 1 lc_g = dup_LC(g, K) while True: lc_r = dup_LC(r, K) j, N = dr - dg, N - 1 R = dup_mul_ground(r, lc_g, K) G = dup_mul_term(g, lc_r, j, K) r = dup_sub(R, G, K) _dr, dr = dr, dup_degree(r) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) return dup_mul_ground(r, lc_g**N, K) def dup_pquo(f, g, K): """ Polynomial exact pseudo-quotient in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_pquo(x**2 - 1, 2*x - 2) 2*x + 2 >>> R.dup_pquo(x**2 + 1, 2*x - 4) 2*x + 4 """ return dup_pdiv(f, g, K)[0] def dup_pexquo(f, g, K): """ Polynomial pseudo-quotient in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_pexquo(x**2 - 1, 2*x - 2) 2*x + 2 >>> R.dup_pexquo(x**2 + 1, 2*x - 4) Traceback (most recent call last): ... ExactQuotientFailed: [2, -4] does not divide [1, 0, 1] """ q, r = dup_pdiv(f, g, K) if not r: return q else: raise ExactQuotientFailed(f, g) def dmp_pdiv(f, g, u, K): """ Polynomial pseudo-division in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_pdiv(x**2 + x*y, 2*x + 2) (2*x + 2*y - 2, -4*y + 4) """ if not u: return dup_pdiv(f, g, K) df = dmp_degree(f, u) dg = dmp_degree(g, u) if dg < 0: raise ZeroDivisionError("polynomial division") q, r, dr = dmp_zero(u), f, df if df < dg: return q, r N = df - dg + 1 lc_g = dmp_LC(g, K) while True: lc_r = dmp_LC(r, K) j, N = dr - dg, N - 1 Q = dmp_mul_term(q, lc_g, 0, u, K) q = dmp_add_term(Q, lc_r, j, u, K) R = dmp_mul_term(r, lc_g, 0, u, K) G = dmp_mul_term(g, lc_r, j, u, K) r = dmp_sub(R, G, u, K) _dr, dr = dr, dmp_degree(r, u) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) c = dmp_pow(lc_g, N, u - 1, K) q = dmp_mul_term(q, c, 0, u, K) r = dmp_mul_term(r, c, 0, u, K) return q, r def dmp_prem(f, g, u, K): """ Polynomial pseudo-remainder in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_prem(x**2 + x*y, 2*x + 2) -4*y + 4 """ if not u: return dup_prem(f, g, K) df = dmp_degree(f, u) dg = dmp_degree(g, u) if dg < 0: raise ZeroDivisionError("polynomial division") r, dr = f, df if df < dg: return r N = df - dg + 1 lc_g = dmp_LC(g, K) while True: lc_r = dmp_LC(r, K) j, N = dr - dg, N - 1 R = dmp_mul_term(r, lc_g, 0, u, K) G = dmp_mul_term(g, lc_r, j, u, K) r = dmp_sub(R, G, u, K) _dr, dr = dr, dmp_degree(r, u) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) c = dmp_pow(lc_g, N, u - 1, K) return dmp_mul_term(r, c, 0, u, K) def dmp_pquo(f, g, u, K): """ Polynomial exact pseudo-quotient in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> f = x**2 + x*y >>> g = 2*x + 2*y >>> h = 2*x + 2 >>> R.dmp_pquo(f, g) 2*x >>> R.dmp_pquo(f, h) 2*x + 2*y - 2 """ return dmp_pdiv(f, g, u, K)[0] def dmp_pexquo(f, g, u, K): """ Polynomial pseudo-quotient in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> f = x**2 + x*y >>> g = 2*x + 2*y >>> h = 2*x + 2 >>> R.dmp_pexquo(f, g) 2*x >>> R.dmp_pexquo(f, h) Traceback (most recent call last): ... ExactQuotientFailed: [[2], [2]] does not divide [[1], [1, 0], []] """ q, r = dmp_pdiv(f, g, u, K) if dmp_zero_p(r, u): return q else: raise ExactQuotientFailed(f, g) def dup_rr_div(f, g, K): """ Univariate division with remainder over a ring. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_rr_div(x**2 + 1, 2*x - 4) (0, x**2 + 1) """ df = dup_degree(f) dg = dup_degree(g) q, r, dr = [], f, df if not g: raise ZeroDivisionError("polynomial division") elif df < dg: return q, r lc_g = dup_LC(g, K) while True: lc_r = dup_LC(r, K) if lc_r % lc_g: break c = K.exquo(lc_r, lc_g) j = dr - dg q = dup_add_term(q, c, j, K) h = dup_mul_term(g, c, j, K) r = dup_sub(r, h, K) _dr, dr = dr, dup_degree(r) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) return q, r def dmp_rr_div(f, g, u, K): """ Multivariate division with remainder over a ring. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_rr_div(x**2 + x*y, 2*x + 2) (0, x**2 + x*y) """ if not u: return dup_rr_div(f, g, K) df = dmp_degree(f, u) dg = dmp_degree(g, u) if dg < 0: raise ZeroDivisionError("polynomial division") q, r, dr = dmp_zero(u), f, df if df < dg: return q, r lc_g, v = dmp_LC(g, K), u - 1 while True: lc_r = dmp_LC(r, K) c, R = dmp_rr_div(lc_r, lc_g, v, K) if not dmp_zero_p(R, v): break j = dr - dg q = dmp_add_term(q, c, j, u, K) h = dmp_mul_term(g, c, j, u, K) r = dmp_sub(r, h, u, K) _dr, dr = dr, dmp_degree(r, u) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) return q, r def dup_ff_div(f, g, K): """ Polynomial division with remainder over a field. Examples ======== >>> from sympy.polys import ring, QQ >>> R, x = ring("x", QQ) >>> R.dup_ff_div(x**2 + 1, 2*x - 4) (1/2*x + 1, 5) """ df = dup_degree(f) dg = dup_degree(g) q, r, dr = [], f, df if not g: raise ZeroDivisionError("polynomial division") elif df < dg: return q, r lc_g = dup_LC(g, K) while True: lc_r = dup_LC(r, K) c = K.exquo(lc_r, lc_g) j = dr - dg q = dup_add_term(q, c, j, K) h = dup_mul_term(g, c, j, K) r = dup_sub(r, h, K) _dr, dr = dr, dup_degree(r) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) return q, r def dmp_ff_div(f, g, u, K): """ Polynomial division with remainder over a field. Examples ======== >>> from sympy.polys import ring, QQ >>> R, x,y = ring("x,y", QQ) >>> R.dmp_ff_div(x**2 + x*y, 2*x + 2) (1/2*x + 1/2*y - 1/2, -y + 1) """ if not u: return dup_ff_div(f, g, K) df = dmp_degree(f, u) dg = dmp_degree(g, u) if dg < 0: raise ZeroDivisionError("polynomial division") q, r, dr = dmp_zero(u), f, df if df < dg: return q, r lc_g, v = dmp_LC(g, K), u - 1 while True: lc_r = dmp_LC(r, K) c, R = dmp_ff_div(lc_r, lc_g, v, K) if not dmp_zero_p(R, v): break j = dr - dg q = dmp_add_term(q, c, j, u, K) h = dmp_mul_term(g, c, j, u, K) r = dmp_sub(r, h, u, K) _dr, dr = dr, dmp_degree(r, u) if dr < dg: break elif not (dr < _dr): raise PolynomialDivisionFailed(f, g, K) return q, r def dup_div(f, g, K): """ Polynomial division with remainder in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x = ring("x", ZZ) >>> R.dup_div(x**2 + 1, 2*x - 4) (0, x**2 + 1) >>> R, x = ring("x", QQ) >>> R.dup_div(x**2 + 1, 2*x - 4) (1/2*x + 1, 5) """ if K.has_Field: return dup_ff_div(f, g, K) else: return dup_rr_div(f, g, K) def dup_rem(f, g, K): """ Returns polynomial remainder in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x = ring("x", ZZ) >>> R.dup_rem(x**2 + 1, 2*x - 4) x**2 + 1 >>> R, x = ring("x", QQ) >>> R.dup_rem(x**2 + 1, 2*x - 4) 5 """ return dup_div(f, g, K)[1] def dup_quo(f, g, K): """ Returns exact polynomial quotient in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x = ring("x", ZZ) >>> R.dup_quo(x**2 + 1, 2*x - 4) 0 >>> R, x = ring("x", QQ) >>> R.dup_quo(x**2 + 1, 2*x - 4) 1/2*x + 1 """ return dup_div(f, g, K)[0] def dup_exquo(f, g, K): """ Returns polynomial quotient in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_exquo(x**2 - 1, x - 1) x + 1 >>> R.dup_exquo(x**2 + 1, 2*x - 4) Traceback (most recent call last): ... ExactQuotientFailed: [2, -4] does not divide [1, 0, 1] """ q, r = dup_div(f, g, K) if not r: return q else: raise ExactQuotientFailed(f, g) def dmp_div(f, g, u, K): """ Polynomial division with remainder in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_div(x**2 + x*y, 2*x + 2) (0, x**2 + x*y) >>> R, x,y = ring("x,y", QQ) >>> R.dmp_div(x**2 + x*y, 2*x + 2) (1/2*x + 1/2*y - 1/2, -y + 1) """ if K.has_Field: return dmp_ff_div(f, g, u, K) else: return dmp_rr_div(f, g, u, K) def dmp_rem(f, g, u, K): """ Returns polynomial remainder in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_rem(x**2 + x*y, 2*x + 2) x**2 + x*y >>> R, x,y = ring("x,y", QQ) >>> R.dmp_rem(x**2 + x*y, 2*x + 2) -y + 1 """ return dmp_div(f, g, u, K)[1] def dmp_quo(f, g, u, K): """ Returns exact polynomial quotient in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ, QQ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_quo(x**2 + x*y, 2*x + 2) 0 >>> R, x,y = ring("x,y", QQ) >>> R.dmp_quo(x**2 + x*y, 2*x + 2) 1/2*x + 1/2*y - 1/2 """ return dmp_div(f, g, u, K)[0] def dmp_exquo(f, g, u, K): """ Returns polynomial quotient in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> f = x**2 + x*y >>> g = x + y >>> h = 2*x + 2 >>> R.dmp_exquo(f, g) x >>> R.dmp_exquo(f, h) Traceback (most recent call last): ... ExactQuotientFailed: [[2], [2]] does not divide [[1], [1, 0], []] """ q, r = dmp_div(f, g, u, K) if dmp_zero_p(r, u): return q else: raise ExactQuotientFailed(f, g) def dup_max_norm(f, K): """ Returns maximum norm of a polynomial in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_max_norm(-x**2 + 2*x - 3) 3 """ if not f: return K.zero else: return max(dup_abs(f, K)) def dmp_max_norm(f, u, K): """ Returns maximum norm of a polynomial in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_max_norm(2*x*y - x - 3) 3 """ if not u: return dup_max_norm(f, K) v = u - 1 return max([ dmp_max_norm(c, v, K) for c in f ]) def dup_l1_norm(f, K): """ Returns l1 norm of a polynomial in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_l1_norm(2*x**3 - 3*x**2 + 1) 6 """ if not f: return K.zero else: return sum(dup_abs(f, K)) def dmp_l1_norm(f, u, K): """ Returns l1 norm of a polynomial in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_l1_norm(2*x*y - x - 3) 6 """ if not u: return dup_l1_norm(f, K) v = u - 1 return sum([ dmp_l1_norm(c, v, K) for c in f ]) def dup_expand(polys, K): """ Multiply together several polynomials in ``K[x]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x = ring("x", ZZ) >>> R.dup_expand([x**2 - 1, x, 2]) 2*x**3 - 2*x """ if not polys: return [K.one] f = polys[0] for g in polys[1:]: f = dup_mul(f, g, K) return f def dmp_expand(polys, u, K): """ Multiply together several polynomials in ``K[X]``. Examples ======== >>> from sympy.polys import ring, ZZ >>> R, x,y = ring("x,y", ZZ) >>> R.dmp_expand([x**2 + y**2, x + 1]) x**3 + x**2 + x*y**2 + y**2 """ if not polys: return dmp_one(u, K) f = polys[0] for g in polys[1:]: f = dmp_mul(f, g, u, K) return f
unknown
codeparrot/codeparrot-clean
"""Tests of comprehensive theming.""" import unittest from django.conf import settings from django.test import TestCase from path import path # pylint: disable=no-name-in-module from django.contrib import staticfiles from openedx.core.djangoapps.theming.test_util import with_comp_theme from openedx.core.lib.tempdir import mkdtemp_clean class TestComprehensiveTheming(TestCase): """Test comprehensive theming.""" def setUp(self): super(TestComprehensiveTheming, self).setUp() # Clear the internal staticfiles caches, to get test isolation. staticfiles.finders._finders.clear() # pylint: disable=protected-access @with_comp_theme(settings.REPO_ROOT / 'themes/red-theme') @unittest.skip("Disabled until we can release theming to production") def test_red_footer(self): resp = self.client.get('/') self.assertEqual(resp.status_code, 200) # This string comes from footer.html self.assertContains(resp, "super-ugly") # This string comes from header.html self.assertContains(resp, "This file is only for demonstration, and is horrendous!") def test_theme_outside_repo(self): # Need to create a temporary theme, and defer decorating the function # until it is done, which leads to this strange nested-function style # of test. # Make a temp directory as a theme. tmp_theme = path(mkdtemp_clean()) template_dir = tmp_theme / "lms/templates" template_dir.makedirs() with open(template_dir / "footer.html", "w") as footer: footer.write("<footer>TEMPORARY THEME</footer>") @with_comp_theme(tmp_theme) def do_the_test(self): """A function to do the work so we can use the decorator.""" resp = self.client.get('/') self.assertEqual(resp.status_code, 200) self.assertContains(resp, "TEMPORARY THEME") do_the_test(self) def test_theme_adjusts_staticfiles_search_path(self): # Test that a theme adds itself to the staticfiles search path. before_finders = list(settings.STATICFILES_FINDERS) before_dirs = list(settings.STATICFILES_DIRS) @with_comp_theme(settings.REPO_ROOT / 'themes/red-theme') def do_the_test(self): """A function to do the work so we can use the decorator.""" self.assertEqual(list(settings.STATICFILES_FINDERS), before_finders) self.assertEqual(settings.STATICFILES_DIRS[0], settings.REPO_ROOT / 'themes/red-theme/lms/static') self.assertEqual(settings.STATICFILES_DIRS[1:], before_dirs) do_the_test(self) @unittest.skip("Disabled until we can release theming to production") def test_default_logo_image(self): result = staticfiles.finders.find('images/logo.png') self.assertEqual(result, settings.REPO_ROOT / 'lms/static/images/logo.png') @with_comp_theme(settings.REPO_ROOT / 'themes/red-theme') def test_overridden_logo_image(self): result = staticfiles.finders.find('images/logo.png') self.assertEqual(result, settings.REPO_ROOT / 'themes/red-theme/lms/static/images/logo.png')
unknown
codeparrot/codeparrot-clean
#!/bin/python import select, signal, socket, struct, sys, time, traceback from random import randint from multiprocessing.managers import SyncManager DEFAULT_PORT=10009 WAHAB_ACK='!E!T!' def generateMulticastGroupPort(): return randint(10000,11001) def generateMulticastGroupIP(): return str(randint(224,239)) + '.' + str(randint(0,255)) + '.' + str(randint(0,255)) + '.' + str(randint(0,255)) def generateNumber(): return randint(1000000,9999999) def getListString(connected): s='' for peername in connected: s += str(peername) + '\n' return s def getConnectedString(uList, mList): s = 'Connected UDP clients:\n' s += getListString(uList) s += 'Connected MCast clients:\n' s += getListString(mList) return s def printConnected(uList, mList): print(getConnectedString(uList, mList)) def close(socketList): [s.close() for s in socketList] sys.exit() def startMulticastReceiver(group, port): ur = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) ur.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) ur.bind((group, port)) mreq = struct.pack("4sl", socket.inet_aton(group), socket.INADDR_ANY) ur.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) us = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) us.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2) return (ur,us) def removeClient(s,u,m): for item in u: if str(item) == str(s.getpeername()): u.remove(item) for item in m: if str(item) == str(s.getpeername()): m.remove(item) def handleClientMessage(src, m, p, l, e, uList, mList, ms): (data,address) = src.recvfrom(1024) if data == WAHAB_ACK: #don't know why he does this, skipping it return try: dataNumber = int(data) if dataNumber == l: print('Received l from ' + str(address) + ', sending list') ms.sendto(getConnectedString(uList, mList), address) elif dataNumber == e: print('Received e, goodbye ' + str(address)) removeClient(src,uList,mList) except: print(str(address) + ': ' + data) ms.sendto(data, (m,p)) for cli in uList: ms.sendto(data, cli) def handleNewClient(s, mList, uList, m, p, l, e): sockfd, _addr = s.accept() username = sockfd.recv(1024) sockfd.settimeout(2) try: #TCP self buffers, and usually appends the 0 or 1 on username. Catch that case here clientType = int(sockfd.recv(1)) except: clientType = int(username[-1]) username = username[0:-1] sockfd.settimeout(None) if clientType == 0: print('New MC Client: ' + str(sockfd.getpeername()) + '[' + username + ']') mList.append(sockfd.getpeername()) sockfd.send(str(m)) time.sleep(1) else: print('New UC Client: ' + str(sockfd.getpeername()) + '[' + username + ']') uList.append(sockfd.getpeername()) sockfd.send(str(p)) time.sleep(1) sockfd.send(str(l)) time.sleep(1) sockfd.send(str(e)) time.sleep(1) #sockfd.send(WAHAB_ACK) return sockfd def handleOther(sock, uList, mList, m, p, l, e): print "Client went offline" removeClient(sock,uList,mList) sock.close() return sock def getSharedLists(): manager = SyncManager() manager.start(lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)) return (manager.list(), manager.list()) def startServer(port): l=generateNumber() e=generateNumber() p=generateMulticastGroupPort() m=generateMulticastGroupIP() s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((socket.gethostname(), port)) s.listen(1) u = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) u.bind((socket.gethostname(), p)) (mr,ms) = startMulticastReceiver(m, p) print("Using l=" + str(l) + ' e=' + str(e) + ' p=' + str(p) + ' m=' + str(m) + "\ns on %s" % str(s.getsockname()) + " u on %s" % str(u.getsockname()) + "\nmr on %s" % str(mr.getsockname())) (mList, uList) = getSharedLists() signal.signal(signal.SIGINT, lambda signum,frame: printConnected(uList, mList)) signal.signal(signal.SIGQUIT, lambda signum,frame: close([s,u,mr,ms]))#ctrl-/ socket_list = [sys.stdin, s, u, mr] while True: try: read_sockets,_w,_e = select.select(socket_list,[],[]) for sock in read_sockets: if sock == s: socket_list.append(handleNewClient(s, mList, uList, m, p, l, e)) elif sock == u: handleClientMessage(u, m, p, l, e, uList, mList, ms) elif sock == mr: handleClientMessage(u, m, p, l, e, uList, mList, ms) elif sock == sys.stdin: if sys.stdin.readline() == 'exit': close([s,u,mr,ms]) else: socket_list.remove(handleOther(sock, uList, mList, m, p, l, e)) except: #traceback.print_exc() #Ctrl-c perhaps, just pass pass if __name__ == "__main__": if len(sys.argv) != 2: print('No port given as argument 1, defaulting to ' + str(DEFAULT_PORT)) port=DEFAULT_PORT else: port=int(sys.argv[1]) startServer(port)
unknown
codeparrot/codeparrot-clean
// Copyright (c) HashiCorp, Inc. // SPDX-License-Identifier: BUSL-1.1 package backendbase import ( "testing" "github.com/google/go-cmp/cmp" "github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2/hcltest" "github.com/zclconf/go-cty-debug/ctydebug" "github.com/zclconf/go-cty/cty" "github.com/hashicorp/terraform/internal/configs/configschema" "github.com/hashicorp/terraform/internal/tfdiags" ) func TestBase_coerceError(t *testing.T) { // This tests that we return errors if type coersion fails. // This doesn't thoroughly test all cases because we're just delegating // to the configschema package's coersion function, which is already // tested in its own package. b := Base{ Schema: &configschema.Block{ Attributes: map[string]*configschema.Attribute{ "foo": { Type: cty.String, Optional: true, }, }, }, } // This is a fake body just to give us something to correlate the // diagnostic attribute paths against so we can test that the // errors are properly annotated. In the real implementation // the command package logic would evaluate the diagnostics against // the real HCL body written by the end-user. // // Because we're using MockExprLiteral for the expressions here, // the source range for each expression is just the fake filename // "MockExprLiteral". If the PrepareConfig function fails to properly // annotate its diagnostics then the source range won't be populated // at all. body := hcltest.MockBody(&hcl.BodyContent{ Attributes: hcl.Attributes{ "foo": { Expr: hcltest.MockExprLiteral(cty.StringVal("")), }, }, }) t.Run("error", func(t *testing.T) { _, diags := b.PrepareConfig(cty.ObjectVal(map[string]cty.Value{ // This is incorrect because the schema wants a string "foo": cty.MapValEmpty(cty.String), })) gotDiags := diags.InConfigBody(body, "") var wantDiags tfdiags.Diagnostics wantDiags = wantDiags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: "Invalid backend configuration", Detail: "The backend configuration is incorrect: .foo: string required, but have map of string.", Subject: &hcl.Range{Filename: "MockExprLiteral"}, }) tfdiags.AssertDiagnosticsMatch(t, gotDiags, wantDiags) }) } func TestBase_deprecatedArg(t *testing.T) { b := Base{ Schema: &configschema.Block{ Attributes: map[string]*configschema.Attribute{ "not_deprecated": { Type: cty.String, Optional: true, }, "deprecated": { Type: cty.String, Optional: true, Deprecated: true, }, }, BlockTypes: map[string]*configschema.NestedBlock{ "nested": { Nesting: configschema.NestingList, Block: configschema.Block{ Attributes: map[string]*configschema.Attribute{ "deprecated": { Type: cty.String, Optional: true, Deprecated: true, }, }, }, }, }, }, } // This is a fake body just to give us something to correlate the // diagnostic attribute paths against so we can test that the // warnings are properly annotated. In the real implementation // the command package logic would evaluate the diagnostics against // the real HCL body written by the end-user. // // Because we're using MockExprLiteral for the expressions here, // the source range for each expression is just the fake filename // "MockExprLiteral". If the PrepareConfig function fails to properly // annotate its diagnostics then the source range won't be populated // at all. body := hcltest.MockBody(&hcl.BodyContent{ Attributes: hcl.Attributes{ "deprecated": { Expr: hcltest.MockExprLiteral(cty.StringVal("")), }, }, Blocks: hcl.Blocks{ { Type: "nested", Body: hcltest.MockBody(&hcl.BodyContent{ Attributes: hcl.Attributes{ "deprecated": { Expr: hcltest.MockExprLiteral(cty.StringVal("")), }, }, }), }, { Type: "nested", Body: hcltest.MockBody(&hcl.BodyContent{ Attributes: hcl.Attributes{ "deprecated": { Expr: hcltest.MockExprLiteral(cty.StringVal("")), }, }, }), }, }, }) t.Run("nothing deprecated", func(t *testing.T) { got, diags := b.PrepareConfig(cty.ObjectVal(map[string]cty.Value{ "not_deprecated": cty.StringVal("hello"), })) if len(diags) != 0 { t.Errorf("unexpected diagnostics: %s", diags.ErrWithWarnings().Error()) } want := cty.ObjectVal(map[string]cty.Value{ "deprecated": cty.NullVal(cty.String), "not_deprecated": cty.StringVal("hello"), "nested": cty.ListValEmpty(cty.Object(map[string]cty.Type{ "deprecated": cty.String, })), }) if diff := cmp.Diff(want, got, ctydebug.CmpOptions); diff != "" { t.Errorf("wrong result\n%s", diff) } }) t.Run("toplevel deprecated", func(t *testing.T) { _, diags := b.PrepareConfig(cty.ObjectVal(map[string]cty.Value{ "deprecated": cty.StringVal("hello"), })) gotDiags := diags.InConfigBody(body, "") var wantDiags tfdiags.Diagnostics wantDiags = wantDiags.Append(&hcl.Diagnostic{ Severity: hcl.DiagWarning, Summary: "Deprecated provider argument", Detail: "The argument .deprecated is deprecated. Refer to the backend documentation for more information.", Subject: &hcl.Range{Filename: "MockExprLiteral"}, }) tfdiags.AssertDiagnosticsMatch(t, wantDiags, gotDiags) }) t.Run("nested deprecated", func(t *testing.T) { _, diags := b.PrepareConfig(cty.ObjectVal(map[string]cty.Value{ "nested": cty.TupleVal([]cty.Value{ cty.ObjectVal(map[string]cty.Value{ "deprecated": cty.StringVal("hello"), }), cty.ObjectVal(map[string]cty.Value{ "deprecated": cty.StringVal("hello"), }), }), })) gotDiags := diags.InConfigBody(body, "") var wantDiags tfdiags.Diagnostics wantDiags = wantDiags.Append(&hcl.Diagnostic{ Severity: hcl.DiagWarning, Summary: "Deprecated provider argument", Detail: "The argument .nested[0].deprecated is deprecated. Refer to the backend documentation for more information.", Subject: &hcl.Range{Filename: "MockExprLiteral"}, }) wantDiags = wantDiags.Append(&hcl.Diagnostic{ Severity: hcl.DiagWarning, Summary: "Deprecated provider argument", Detail: "The argument .nested[1].deprecated is deprecated. Refer to the backend documentation for more information.", Subject: &hcl.Range{Filename: "MockExprLiteral"}, }) tfdiags.AssertDiagnosticsMatch(t, wantDiags, gotDiags) }) } func TestBase_nullCrash(t *testing.T) { // This test ensures that we don't crash while applying defaults to // a null value b := Base{ Schema: &configschema.Block{ Attributes: map[string]*configschema.Attribute{ "foo": { Type: cty.String, Required: true, }, }, }, SDKLikeDefaults: SDKLikeDefaults{ "foo": { Fallback: "fallback", }, }, } t.Run("error", func(t *testing.T) { // We pass an explicit null value here to simulate an interrupt _, gotDiags := b.PrepareConfig(cty.NullVal(cty.Object(map[string]cty.Type{ "foo": cty.String, }))) var wantDiags tfdiags.Diagnostics wantDiags = wantDiags.Append( &hcl.Diagnostic{ Severity: hcl.DiagError, Summary: "Invalid backend configuration", Detail: "The backend configuration is incorrect: attribute \"foo\" is required.", }) if diff := cmp.Diff(wantDiags.ForRPC(), gotDiags.ForRPC()); diff != "" { t.Errorf("wrong diagnostics\n%s", diff) } }) }
go
github
https://github.com/hashicorp/terraform
internal/backend/backendbase/base_test.go
import webapp2 import cgi import json from google.appengine.api import users from google.appengine.ext import ndb from google.appengine.api import urlfetch class CoreTeamMember(ndb.Model): username = ndb.StringProperty(indexed=True) @classmethod def forUsername(cls, username): return CoreTeamMember.query().filter(CoreTeamMember.username == username).get(); class AuthToken(ndb.Model): service = ndb.StringProperty(indexed=True) token = ndb.StringProperty(indexed=True) @classmethod def forService(cls, service): auth = AuthToken.query().filter(AuthToken.service == service).get(); if (auth is None): auth = AuthToken(service=service, token="-missing-") auth.put() return None else: return auth.token class Audit(ndb.Model): date = ndb.DateTimeProperty(auto_now_add=True) event = ndb.StringProperty(indexed=False) delivery = ndb.StringProperty(indexed=False) body = ndb.StringProperty(indexed=False) class MainPage(webapp2.RequestHandler): def get(self): user = users.get_current_user() if user: self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, ' + user.nickname()) else: self.redirect(users.create_login_url(self.request.uri)) class WebHookPage(webapp2.RequestHandler): def urlMethod(self, method, token, url, payload): fullUrl = "https://api.github.com/repos/angular/angular/" + url; headers = {"Authorization": "token " + token} if (payload != None): payload = json.dumps(payload) self.response.out.write(method) self.response.out.write(' ') self.response.out.write(fullUrl) self.response.out.write(' => ') response = urlfetch.Fetch(fullUrl, method = method, headers = headers, payload = payload) self.response.out.write(response.status_code) self.response.out.write('\n') return response def urlGET(self, token, url): return self.urlMethod(urlfetch.GET, token, url, None); def urlDELETE(self, token, url): return self.urlMethod(urlfetch.DELETE, token, url, None); def urlPOST(self, token, url, content): return self.urlMethod(urlfetch.POST, token, url, content); def urlPATCH(self, token, url, content): return self.urlMethod(urlfetch.PATCH, token, url, content); def get(self): AuthToken.forService('github') self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello WebHook!') def post(self): # labels applied by the onduty to automate merges merge_label = 'zomg_admin: do merge' merge_label_uri_esc = 'zomg_admin:%20do%20merge' if (CoreTeamMember.forUsername('*') == None): CoreTeamMember(username = '*').put() event = self.request.headers["X-Github-Event"], if (event[0] != 'pull_request'): self.response.out.write('Not pull_request got ' + event[0]) return data = json.loads(self.request.body) if (data['action'] != 'labeled'): return audit = Audit( event = event[0], delivery = self.request.headers["X-GitHub-Delivery"], body = self.request.body) audit.put() tokenComment = AuthToken.forService('github-comment') tokenPush = AuthToken.forService('github-push') if (tokenComment is None): self.response.out.write('No comment token') return if (tokenPush is None): self.response.out.write('No push token') return pr_number = str(data['number']) sha = data['pull_request']['merge_commit_sha'] issueUrl = 'issues/' + pr_number labelsResult = self.urlGET(tokenPush, issueUrl + '/labels') hasMerge = False for l in json.loads(labelsResult.content): if l['name'] == merge_label: hasMerge = True if not hasMerge: return result = self.urlGET(tokenPush, issueUrl + '/events') if result.status_code == 200: mergeUser = None for e in json.loads(result.content): if e['event'] == 'labeled' and e['label']['name'] == merge_label: mergeUser = e['actor']['login']; if e['event'] == 'unlabeled' and e['label']['name'] == merge_label: mergeUser = None if (mergeUser == None): return self.response.out.write('Merge action? ' + str(mergeUser) + '\n') result = self.urlDELETE(tokenPush, issueUrl + '/labels/' + merge_label_uri_esc); if (CoreTeamMember.forUsername(mergeUser) == None): self.response.out.write(mergeUser + ' is not a core team member with merge privileges.') self.urlPOST(tokenComment, issueUrl + '/comments', {'body': 'User @' + mergeUser + ' does not have PR merging privileges.'}) return if (mergeUser != None): branch = 'presubmit-' + mergeUser + '-pr-' + pr_number self.urlPOST(tokenComment, issueUrl + '/comments', {'body': 'Merging PR #' + pr_number + ' on behalf of @' + mergeUser + ' to branch [' + branch + '](https://github.com/angular/angular/tree/' + branch + ').'}) response = self.urlPOST(tokenPush, 'git/refs', {'ref': 'refs/heads/' + branch, 'sha': sha}) if (response.status_code == 422): self.urlPATCH(tokenPush, 'git/refs/heads/' + branch, {'sha': sha, 'force': True}) app = webapp2.WSGIApplication([ ('/', MainPage), ('/web_hook', WebHookPage) ], debug=True)
unknown
codeparrot/codeparrot-clean
########################################################################## # # Copyright (c) 2007-2009, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # * 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. # # * Neither the name of Image Engine Design nor the names of any # other contributors to this software may be used to endorse or # promote products derived from this software without specific prior # written permission. # # 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. # ########################################################################## import IECore import IECoreRI ## This convenience function loads a named and versioned procedural # using the default IECore procedural loader, parses the args string # to set the procedural parameters and then renders the procedural. It's # useful to use this in the command string for a dynamicload procedural # that executes python. def executeProcedural( name, version, args ) : procedural = IECore.ClassLoader.defaultProceduralLoader().load( name, version )() if procedural : IECore.ParameterParser().parse( args, procedural.parameters() ) renderer = IECoreRI.Renderer() procedural.render( renderer, inAttributeBlock=False, withState=False, withGeometry=True, immediateGeometry=True )
unknown
codeparrot/codeparrot-clean
# # (c) 2017, Simon Dodsley <simon@purestorage.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see <http://www.gnu.org/licenses/>. class ModuleDocFragment(object): # Standard Pure Storage documentation fragment DOCUMENTATION = ''' options: fa_url: description: - FlashArray management IPv4 address or Hostname. required: true api_token: description: - FlashArray API token for admin privilaged user. required: true notes: - This module requires purestorage python library - You must set C(PUREFA_URL) and C(PUREFA_API) environment variables if I(url) and I(api_token) arguments are not passed to the module directly requirements: - "python >= 2.7" - purestorage '''
unknown
codeparrot/codeparrot-clean
use super::AtomicU64; use crate::loom::sync::Mutex; pub(crate) type StaticAtomicU64 = AtomicU64; impl AtomicU64 { pub(crate) const fn new(val: u64) -> Self { Self { inner: Mutex::const_new(val), } } }
rust
github
https://github.com/tokio-rs/tokio
tokio/src/loom/std/atomic_u64_static_const_new.rs
#!/usr/bin/python2.4 # # Copyright 2011 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. """Handler for assisting with the machine install process.""" # Disable 'Import not at top of file' lint error. # pylint: disable-msg=C6204, C6205, W0611 import logging from django.utils import simplejson from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.ext import deferred from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from common import ec2_manager from common import enum from handlers import base from handlers import launch_tasks from models import client_machine INIT_START = '/init/start' INSTALL_FAILED = '/init/install_failed' INSTALL_SUCEEDED = '/init/install_succeeded' class InitializationStart(base.BaseHandler): """Handler to acknowledge a machine starting initialization.""" # Disable 'Invalid method name' lint error. # pylint: disable-msg=C6409 def get(self): """Updates the status of a machine starting initialization.""" instance_id = self.GetRequiredParameter('instance_id') instance = db.GqlQuery('SELECT * FROM ClientMachine WHERE client_id = :1', instance_id).get() if not instance: logging.error('The given instance id "%s" does not match any machines.', instance_id) self.error(500) return if instance.status != enum.MACHINE_STATUS.PROVISIONED: logging.error('The machine with instance id "%s" was in an unexpected ' 'state for initialization: "%s"', instance_id, enum.MACHINE_STATUS.LookupKey(instance.status)) instance.status = enum.MACHINE_STATUS.INITIALIZING instance.put() self.response.out.write('Initialization acknowledged.') class InstallFailed(base.BaseHandler): """Handler to deal with a machine that fails to properly setup and install.""" # Disable 'Invalid method name' lint error. # pylint: disable-msg=C6409 def post(self): """Updates the status of a machine that failed with initialization.""" instance_id = self.GetRequiredParameter('instance_id') log = self.GetOptionalParameter('log', None) old_instance = db.GqlQuery( 'SELECT * FROM ClientMachine WHERE client_id = :1', instance_id).get() if not old_instance: logging.error('The given instance id "%s" does not match any machines.', instance_id) self.error(500) return if old_instance.status != enum.MACHINE_STATUS.INITIALIZING: logging.error('The machine with instance id "%s" was in an unexpected ' 'state for initialization: "%s"', instance_id, enum.MACHINE_STATUS.LookupKey(old_instance.status)) old_instance.status = enum.MACHINE_STATUS.FAILED if log: old_instance.initialization_log = log old_instance.put() if old_instance.retry_count >= client_machine.MAX_RETRIES: logging.error('Reached the maximum number of retries for starting this ' 'machine: %s.', str(old_instance.key())) logging.info('Terminating the failed instance.') deferred.defer(launch_tasks.TerminateFailedMachine, instance_id, _countdown=launch_tasks.DEFAULT_COUNTDOWN, _queue=launch_tasks.DEFAULT_QUEUE) self.error(500) return logging.info('Rebooting the failed instance.') deferred.defer(launch_tasks.RebootMachine, instance_id, _countdown=launch_tasks.DEFAULT_COUNTDOWN, _queue=launch_tasks.DEFAULT_QUEUE) self.response.out.write('Initialization failure acknowledged.') class InstallSucceeded(base.BaseHandler): """Handler to deal with a machine that installs successfully.""" # Disable 'Invalid method name' lint error. # pylint: disable-msg=C6409 def post(self): """Updates the status of a machine that succeeded with initialization.""" instance_id = self.GetRequiredParameter('instance_id') log = self.GetOptionalParameter('log', None) instance = db.GqlQuery('SELECT * FROM ClientMachine WHERE client_id = :1', instance_id).get() if not instance: logging.error('The given instance id "%s" does not match any machines.', instance_id) self.error(500) return if instance.status != enum.MACHINE_STATUS.INITIALIZING: logging.error('The machine with instance id "%s" was in an unexpected ' 'state for initialization: "%s"', instance_id, enum.MACHINE_STATUS.LookupKey(instance.status)) instance.status = enum.MACHINE_STATUS.RUNNING if log: instance.initialization_log = log instance.put() self.response.out.write('Initialization success acknowledged.') application = webapp.WSGIApplication( [(INIT_START, InitializationStart), (INSTALL_FAILED, InstallFailed), (INSTALL_SUCEEDED, InstallSucceeded)], debug=True) def main(): run_wsgi_app(application) if __name__ == '__main__': main()
unknown
codeparrot/codeparrot-clean
#!/usr/bin/env bash # Copyright 2014 The Kubernetes Authors. # # 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. # This script is convenience to download and install etcd in third_party. # Mostly just used by CI. # Usage: `hack/install-etcd.sh`. set -o errexit set -o nounset set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" FOUND="$(echo "${PATH}" | sed 's/:/\n/g' | grep -q "^${KUBE_ROOT}/third_party/etcd$" || true)" kube::etcd::install test -n "${FOUND}" || echo "export PATH=\"\${PATH}:${KUBE_ROOT}/third_party/etcd\""
unknown
github
https://github.com/kubernetes/kubernetes
hack/install-etcd.sh
# Copyright 2016 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. # ============================================================================== """Tests for tensorflow.ops.check_ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.eager import context from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors from tensorflow.python.framework import ops from tensorflow.python.framework import sparse_tensor from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import check_ops from tensorflow.python.platform import test class AssertProperIterableTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_single_tensor_raises(self): tensor = constant_op.constant(1) with self.assertRaisesRegexp(TypeError, "proper"): check_ops.assert_proper_iterable(tensor) @test_util.run_in_graph_and_eager_modes() def test_single_sparse_tensor_raises(self): ten = sparse_tensor.SparseTensor( indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4]) with self.assertRaisesRegexp(TypeError, "proper"): check_ops.assert_proper_iterable(ten) @test_util.run_in_graph_and_eager_modes() def test_single_ndarray_raises(self): array = np.array([1, 2, 3]) with self.assertRaisesRegexp(TypeError, "proper"): check_ops.assert_proper_iterable(array) @test_util.run_in_graph_and_eager_modes() def test_single_string_raises(self): mystr = "hello" with self.assertRaisesRegexp(TypeError, "proper"): check_ops.assert_proper_iterable(mystr) @test_util.run_in_graph_and_eager_modes() def test_non_iterable_object_raises(self): non_iterable = 1234 with self.assertRaisesRegexp(TypeError, "to be iterable"): check_ops.assert_proper_iterable(non_iterable) @test_util.run_in_graph_and_eager_modes() def test_list_does_not_raise(self): list_of_stuff = [ constant_op.constant([11, 22]), constant_op.constant([1, 2]) ] check_ops.assert_proper_iterable(list_of_stuff) @test_util.run_in_graph_and_eager_modes() def test_generator_does_not_raise(self): generator_of_stuff = (constant_op.constant([11, 22]), constant_op.constant( [1, 2])) check_ops.assert_proper_iterable(generator_of_stuff) class AssertEqualTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_equal(self): small = constant_op.constant([1, 2], name="small") with ops.control_dependencies([check_ops.assert_equal(small, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_scalar_comparison(self): const_true = constant_op.constant(True, name="true") const_false = constant_op.constant(False, name="false") with self.assertRaisesRegexp(errors.InvalidArgumentError, "fail"): check_ops.assert_equal(const_true, const_false, message="fail") def test_returns_none_with_eager(self): with context.eager_mode(): small = constant_op.constant([1, 2], name="small") x = check_ops.assert_equal(small, small) assert x is None @test_util.run_in_graph_and_eager_modes() def test_raises_when_greater(self): # Static check static_small = constant_op.constant([1, 2], name="small") static_big = constant_op.constant([3, 4], name="big") with self.assertRaisesRegexp(errors.InvalidArgumentError, "fail"): check_ops.assert_equal(static_big, static_small, message="fail") def test_raises_when_greater_dynamic(self): with self.test_session(): small = array_ops.placeholder(dtypes.int32, name="small") big = array_ops.placeholder(dtypes.int32, name="big") with ops.control_dependencies( [check_ops.assert_equal(big, small, message="fail")]): out = array_ops.identity(small) with self.assertRaisesOpError("fail.*big.*small"): out.eval(feed_dict={small: [1, 2], big: [3, 4]}) def test_error_message_eager(self): expected_error_msg_full = r"""big does not equal small Condition x == y did not hold. Indices of first 3 different values: \[\[0 0\] \[1 1\] \[2 0\]\] Corresponding x values: \[2 3 6\] Corresponding y values: \[20 30 60\] First 6 elements of x: \[2 2 3 3 6 6\] First 6 elements of y: \[20 2 3 30 60 6\] """ expected_error_msg_default = r"""big does not equal small Condition x == y did not hold. Indices of first 3 different values: \[\[0 0\] \[1 1\] \[2 0\]\] Corresponding x values: \[2 3 6\] Corresponding y values: \[20 30 60\] First 3 elements of x: \[2 2 3\] First 3 elements of y: \[20 2 3\] """ expected_error_msg_short = r"""big does not equal small Condition x == y did not hold. Indices of first 2 different values: \[\[0 0\] \[1 1\]\] Corresponding x values: \[2 3\] Corresponding y values: \[20 30\] First 2 elements of x: \[2 2\] First 2 elements of y: \[20 2\] """ with context.eager_mode(): big = constant_op.constant([[2, 2], [3, 3], [6, 6]]) small = constant_op.constant([[20, 2], [3, 30], [60, 6]]) with self.assertRaisesRegexp(errors.InvalidArgumentError, expected_error_msg_full): check_ops.assert_equal(big, small, message="big does not equal small", summarize=10) with self.assertRaisesRegexp(errors.InvalidArgumentError, expected_error_msg_default): check_ops.assert_equal(big, small, message="big does not equal small") with self.assertRaisesRegexp(errors.InvalidArgumentError, expected_error_msg_short): check_ops.assert_equal(big, small, message="big does not equal small", summarize=2) @test_util.run_in_graph_and_eager_modes() def test_raises_when_less(self): # Static check static_small = constant_op.constant([3, 1], name="small") static_big = constant_op.constant([4, 2], name="big") with self.assertRaisesRegexp(errors.InvalidArgumentError, "fail"): check_ops.assert_equal(static_big, static_small, message="fail") def test_raises_when_less_dynamic(self): with self.test_session(): small = array_ops.placeholder(dtypes.int32, name="small") big = array_ops.placeholder(dtypes.int32, name="big") with ops.control_dependencies([check_ops.assert_equal(small, big)]): out = array_ops.identity(small) with self.assertRaisesOpError("small.*big"): out.eval(feed_dict={small: [3, 1], big: [4, 2]}) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_equal_and_broadcastable_shapes(self): small = constant_op.constant([[1, 2], [1, 2]], name="small") small_2 = constant_op.constant([1, 2], name="small_2") with ops.control_dependencies([check_ops.assert_equal(small, small_2)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_equal_but_non_broadcastable_shapes(self): small = constant_op.constant([1, 1, 1], name="small") small_2 = constant_op.constant([1, 1], name="small_2") # The exception in eager and non-eager mode is different because # eager mode relies on shape check done as part of the C++ op, while # graph mode does shape checks when creating the `Operation` instance. with self.assertRaisesRegexp( (errors.InvalidArgumentError, ValueError), (r"Incompatible shapes: \[3\] vs. \[2\]|" r"Dimensions must be equal, but are 3 and 2")): with ops.control_dependencies([check_ops.assert_equal(small, small_2)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_not_equal_and_broadcastable_shapes(self): cond = constant_op.constant([True, False], name="small") with self.assertRaisesRegexp(errors.InvalidArgumentError, "fail"): check_ops.assert_equal(cond, False, message="fail") @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies([check_ops.assert_equal(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) class AssertNoneEqualTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_not_equal(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([10, 20], name="small") with ops.control_dependencies( [check_ops.assert_none_equal(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_equal(self): small = constant_op.constant([3, 1], name="small") with self.assertRaisesOpError("x != y did not hold"): with ops.control_dependencies( [check_ops.assert_none_equal(small, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_not_equal_and_broadcastable_shapes(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3], name="big") with ops.control_dependencies( [check_ops.assert_none_equal(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_not_equal_but_non_broadcastable_shapes(self): with self.test_session(): small = constant_op.constant([1, 1, 1], name="small") big = constant_op.constant([10, 10], name="big") # The exception in eager and non-eager mode is different because # eager mode relies on shape check done as part of the C++ op, while # graph mode does shape checks when creating the `Operation` instance. with self.assertRaisesRegexp( (ValueError, errors.InvalidArgumentError), (r"Incompatible shapes: \[3\] vs. \[2\]|" r"Dimensions must be equal, but are 3 and 2")): with ops.control_dependencies( [check_ops.assert_none_equal(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): with self.test_session(): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies( [check_ops.assert_none_equal(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) def test_returns_none_with_eager(self): with context.eager_mode(): t1 = constant_op.constant([1, 2]) t2 = constant_op.constant([3, 4]) x = check_ops.assert_none_equal(t1, t2) assert x is None class AssertAllCloseTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_equal(self): x = constant_op.constant(1., name="x") y = constant_op.constant(1., name="y") with ops.control_dependencies( [check_ops.assert_near(x, y, message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_close_enough_32_bit_due_to_default_rtol(self): eps = np.finfo(np.float32).eps # Default rtol/atol is 10*eps x = constant_op.constant(1., name="x") y = constant_op.constant(1. + 2 * eps, name="y", dtype=np.float32) with ops.control_dependencies( [check_ops.assert_near(x, y, atol=0., message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_close_enough_32_bit_due_to_default_atol(self): eps = np.finfo(np.float32).eps # Default rtol/atol is 10*eps x = constant_op.constant(0., name="x") y = constant_op.constant(0. + 2 * eps, name="y", dtype=np.float32) with ops.control_dependencies( [check_ops.assert_near(x, y, rtol=0., message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_close_enough_64_bit_due_to_default_rtol(self): eps = np.finfo(np.float64).eps # Default rtol/atol is 10*eps x = constant_op.constant(1., name="x", dtype=np.float64) y = constant_op.constant(1. + 2 * eps, name="y", dtype=np.float64) with ops.control_dependencies( [check_ops.assert_near(x, y, atol=0., message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_close_enough_64_bit_due_to_default_atol(self): eps = np.finfo(np.float64).eps # Default rtol/atol is 10*eps x = constant_op.constant(0., name="x", dtype=np.float64) y = constant_op.constant(0. + 2 * eps, name="y", dtype=np.float64) with ops.control_dependencies( [check_ops.assert_near(x, y, rtol=0., message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_close_enough_due_to_custom_rtol(self): x = constant_op.constant(1., name="x") y = constant_op.constant(1.1, name="y") with ops.control_dependencies( [check_ops.assert_near(x, y, atol=0., rtol=0.5, message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_close_enough_due_to_custom_atol(self): x = constant_op.constant(0., name="x") y = constant_op.constant(0.1, name="y", dtype=np.float32) with ops.control_dependencies( [check_ops.assert_near(x, y, atol=0.5, rtol=0., message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies([check_ops.assert_near(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_atol_violated(self): x = constant_op.constant(10., name="x") y = constant_op.constant(10.2, name="y") with self.assertRaisesOpError("x and y not equal to tolerance"): with ops.control_dependencies( [check_ops.assert_near(x, y, atol=0.1, message="failure message")]): out = array_ops.identity(x) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_default_rtol_violated(self): x = constant_op.constant(0.1, name="x") y = constant_op.constant(0.0, name="y") with self.assertRaisesOpError("x and y not equal to tolerance"): with ops.control_dependencies( [check_ops.assert_near(x, y, message="failure message")]): out = array_ops.identity(x) self.evaluate(out) def test_returns_none_with_eager(self): with context.eager_mode(): t1 = constant_op.constant([1., 2.]) t2 = constant_op.constant([1., 2.]) x = check_ops.assert_near(t1, t2) assert x is None class AssertLessTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_raises_when_equal(self): small = constant_op.constant([1, 2], name="small") with self.assertRaisesOpError("failure message.*\n*.* x < y did not hold"): with ops.control_dependencies( [check_ops.assert_less( small, small, message="failure message")]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_greater(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3, 4], name="big") with self.assertRaisesOpError("x < y did not hold"): with ops.control_dependencies([check_ops.assert_less(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_less(self): small = constant_op.constant([3, 1], name="small") big = constant_op.constant([4, 2], name="big") with ops.control_dependencies([check_ops.assert_less(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_less_and_broadcastable_shapes(self): small = constant_op.constant([1], name="small") big = constant_op.constant([3, 2], name="big") with ops.control_dependencies([check_ops.assert_less(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_less_but_non_broadcastable_shapes(self): small = constant_op.constant([1, 1, 1], name="small") big = constant_op.constant([3, 2], name="big") # The exception in eager and non-eager mode is different because # eager mode relies on shape check done as part of the C++ op, while # graph mode does shape checks when creating the `Operation` instance. with self.assertRaisesRegexp( (ValueError, errors.InvalidArgumentError), (r"Incompatible shapes: \[3\] vs. \[2\]|" "Dimensions must be equal, but are 3 and 2")): with ops.control_dependencies([check_ops.assert_less(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies([check_ops.assert_less(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) def test_returns_none_with_eager(self): with context.eager_mode(): t1 = constant_op.constant([1, 2]) t2 = constant_op.constant([3, 4]) x = check_ops.assert_less(t1, t2) assert x is None class AssertLessEqualTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_equal(self): small = constant_op.constant([1, 2], name="small") with ops.control_dependencies( [check_ops.assert_less_equal(small, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_greater(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3, 4], name="big") with self.assertRaisesOpError("fail"): with ops.control_dependencies( [check_ops.assert_less_equal( big, small, message="fail")]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_less_equal(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3, 2], name="big") with ops.control_dependencies([check_ops.assert_less_equal(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_less_equal_and_broadcastable_shapes(self): small = constant_op.constant([1], name="small") big = constant_op.constant([3, 1], name="big") with ops.control_dependencies([check_ops.assert_less_equal(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_less_equal_but_non_broadcastable_shapes(self): small = constant_op.constant([3, 1], name="small") big = constant_op.constant([1, 1, 1], name="big") # The exception in eager and non-eager mode is different because # eager mode relies on shape check done as part of the C++ op, while # graph mode does shape checks when creating the `Operation` instance. with self.assertRaisesRegexp( (errors.InvalidArgumentError, ValueError), (r"Incompatible shapes: \[2\] vs. \[3\]|" r"Dimensions must be equal, but are 2 and 3")): with ops.control_dependencies( [check_ops.assert_less_equal(small, big)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies( [check_ops.assert_less_equal(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) class AssertGreaterTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_raises_when_equal(self): small = constant_op.constant([1, 2], name="small") with self.assertRaisesOpError("fail"): with ops.control_dependencies( [check_ops.assert_greater( small, small, message="fail")]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_less(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3, 4], name="big") with self.assertRaisesOpError("x > y did not hold"): with ops.control_dependencies([check_ops.assert_greater(small, big)]): out = array_ops.identity(big) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_greater(self): small = constant_op.constant([3, 1], name="small") big = constant_op.constant([4, 2], name="big") with ops.control_dependencies([check_ops.assert_greater(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_greater_and_broadcastable_shapes(self): small = constant_op.constant([1], name="small") big = constant_op.constant([3, 2], name="big") with ops.control_dependencies([check_ops.assert_greater(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_greater_but_non_broadcastable_shapes(self): small = constant_op.constant([1, 1, 1], name="small") big = constant_op.constant([3, 2], name="big") # The exception in eager and non-eager mode is different because # eager mode relies on shape check done as part of the C++ op, while # graph mode does shape checks when creating the `Operation` instance. with self.assertRaisesRegexp( (errors.InvalidArgumentError, ValueError), (r"Incompatible shapes: \[2\] vs. \[3\]|" r"Dimensions must be equal, but are 2 and 3")): with ops.control_dependencies([check_ops.assert_greater(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies([check_ops.assert_greater(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) class AssertGreaterEqualTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_equal(self): small = constant_op.constant([1, 2], name="small") with ops.control_dependencies( [check_ops.assert_greater_equal(small, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_less(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3, 4], name="big") with self.assertRaisesOpError("fail"): with ops.control_dependencies( [check_ops.assert_greater_equal( small, big, message="fail")]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_greater_equal(self): small = constant_op.constant([1, 2], name="small") big = constant_op.constant([3, 2], name="big") with ops.control_dependencies( [check_ops.assert_greater_equal(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_greater_equal_and_broadcastable_shapes(self): small = constant_op.constant([1], name="small") big = constant_op.constant([3, 1], name="big") with ops.control_dependencies( [check_ops.assert_greater_equal(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_less_equal_but_non_broadcastable_shapes(self): small = constant_op.constant([1, 1, 1], name="big") big = constant_op.constant([3, 1], name="small") # The exception in eager and non-eager mode is different because # eager mode relies on shape check done as part of the C++ op, while # graph mode does shape checks when creating the `Operation` instance. with self.assertRaisesRegexp( (errors.InvalidArgumentError, ValueError), (r"Incompatible shapes: \[2\] vs. \[3\]|" r"Dimensions must be equal, but are 2 and 3")): with ops.control_dependencies( [check_ops.assert_greater_equal(big, small)]): out = array_ops.identity(small) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_both_empty(self): larry = constant_op.constant([]) curly = constant_op.constant([]) with ops.control_dependencies( [check_ops.assert_greater_equal(larry, curly)]): out = array_ops.identity(larry) self.evaluate(out) class AssertNegativeTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_negative(self): frank = constant_op.constant([-1, -2], name="frank") with ops.control_dependencies([check_ops.assert_negative(frank)]): out = array_ops.identity(frank) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_positive(self): doug = constant_op.constant([1, 2], name="doug") with self.assertRaisesOpError("fail"): with ops.control_dependencies( [check_ops.assert_negative( doug, message="fail")]): out = array_ops.identity(doug) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_zero(self): claire = constant_op.constant([0], name="claire") with self.assertRaisesOpError("x < 0 did not hold"): with ops.control_dependencies([check_ops.assert_negative(claire)]): out = array_ops.identity(claire) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_empty_tensor_doesnt_raise(self): # A tensor is negative when it satisfies: # For every element x_i in x, x_i < 0 # and an empty tensor has no elements, so this is trivially satisfied. # This is standard set theory. empty = constant_op.constant([], name="empty") with ops.control_dependencies([check_ops.assert_negative(empty)]): out = array_ops.identity(empty) self.evaluate(out) class AssertPositiveTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_raises_when_negative(self): freddie = constant_op.constant([-1, -2], name="freddie") with self.assertRaisesOpError("fail"): with ops.control_dependencies( [check_ops.assert_positive( freddie, message="fail")]): out = array_ops.identity(freddie) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_positive(self): remmy = constant_op.constant([1, 2], name="remmy") with ops.control_dependencies([check_ops.assert_positive(remmy)]): out = array_ops.identity(remmy) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_zero(self): meechum = constant_op.constant([0], name="meechum") with self.assertRaisesOpError("x > 0 did not hold"): with ops.control_dependencies([check_ops.assert_positive(meechum)]): out = array_ops.identity(meechum) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_empty_tensor_doesnt_raise(self): # A tensor is positive when it satisfies: # For every element x_i in x, x_i > 0 # and an empty tensor has no elements, so this is trivially satisfied. # This is standard set theory. empty = constant_op.constant([], name="empty") with ops.control_dependencies([check_ops.assert_positive(empty)]): out = array_ops.identity(empty) self.evaluate(out) class AssertRankTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_rank_zero_tensor_raises_if_rank_too_small_static_rank(self): tensor = constant_op.constant(1, name="my_tensor") desired_rank = 1 with self.assertRaisesRegexp(ValueError, "fail.*must have rank 1"): with ops.control_dependencies( [check_ops.assert_rank( tensor, desired_rank, message="fail")]): self.evaluate(array_ops.identity(tensor)) def test_rank_zero_tensor_raises_if_rank_too_small_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 1 with ops.control_dependencies( [check_ops.assert_rank( tensor, desired_rank, message="fail")]): with self.assertRaisesOpError("fail.*my_tensor.*rank"): array_ops.identity(tensor).eval(feed_dict={tensor: 0}) @test_util.run_in_graph_and_eager_modes() def test_rank_zero_tensor_doesnt_raise_if_rank_just_right_static_rank(self): tensor = constant_op.constant(1, name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_zero_tensor_doesnt_raise_if_rank_just_right_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): array_ops.identity(tensor).eval(feed_dict={tensor: 0}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_raises_if_rank_too_large_static_rank(self): tensor = constant_op.constant([1, 2], name="my_tensor") desired_rank = 0 with self.assertRaisesRegexp(ValueError, "rank"): with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_one_tensor_raises_if_rank_too_large_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): with self.assertRaisesOpError("my_tensor.*rank"): array_ops.identity(tensor).eval(feed_dict={tensor: [1, 2]}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_doesnt_raise_if_rank_just_right_static_rank(self): tensor = constant_op.constant([1, 2], name="my_tensor") desired_rank = 1 with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_one_tensor_doesnt_raise_if_rank_just_right_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 1 with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): array_ops.identity(tensor).eval(feed_dict={tensor: [1, 2]}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_raises_if_rank_too_small_static_rank(self): tensor = constant_op.constant([1, 2], name="my_tensor") desired_rank = 2 with self.assertRaisesRegexp(ValueError, "rank"): with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_one_tensor_raises_if_rank_too_small_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 2 with ops.control_dependencies( [check_ops.assert_rank(tensor, desired_rank)]): with self.assertRaisesOpError("my_tensor.*rank"): array_ops.identity(tensor).eval(feed_dict={tensor: [1, 2]}) @test_util.run_in_graph_and_eager_modes() def test_raises_if_rank_is_not_scalar_static(self): tensor = constant_op.constant([1, 2], name="my_tensor") with self.assertRaisesRegexp(ValueError, "Rank must be a scalar"): check_ops.assert_rank(tensor, np.array([], dtype=np.int32)) def test_raises_if_rank_is_not_scalar_dynamic(self): with self.test_session(): tensor = constant_op.constant( [1, 2], dtype=dtypes.float32, name="my_tensor") rank_tensor = array_ops.placeholder(dtypes.int32, name="rank_tensor") with self.assertRaisesOpError("Rank must be a scalar"): with ops.control_dependencies( [check_ops.assert_rank(tensor, rank_tensor)]): array_ops.identity(tensor).eval(feed_dict={rank_tensor: [1, 2]}) @test_util.run_in_graph_and_eager_modes() def test_raises_if_rank_is_not_integer_static(self): tensor = constant_op.constant([1, 2], name="my_tensor") with self.assertRaisesRegexp(TypeError, "must be of type <dtype: 'int32'>"): check_ops.assert_rank(tensor, .5) def test_raises_if_rank_is_not_integer_dynamic(self): with self.test_session(): tensor = constant_op.constant( [1, 2], dtype=dtypes.float32, name="my_tensor") rank_tensor = array_ops.placeholder(dtypes.float32, name="rank_tensor") with self.assertRaisesRegexp(TypeError, "must be of type <dtype: 'int32'>"): with ops.control_dependencies( [check_ops.assert_rank(tensor, rank_tensor)]): array_ops.identity(tensor).eval(feed_dict={rank_tensor: .5}) class AssertRankInTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_rank_zero_tensor_raises_if_rank_mismatch_static_rank(self): tensor_rank0 = constant_op.constant(42, name="my_tensor") with self.assertRaisesRegexp( ValueError, "fail.*must have rank.*in.*1.*2"): with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank0, (1, 2), message="fail")]): self.evaluate(array_ops.identity(tensor_rank0)) def test_rank_zero_tensor_raises_if_rank_mismatch_dynamic_rank(self): with self.test_session(): tensor_rank0 = array_ops.placeholder(dtypes.float32, name="my_tensor") with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank0, (1, 2), message="fail")]): with self.assertRaisesOpError("fail.*my_tensor.*rank"): array_ops.identity(tensor_rank0).eval(feed_dict={tensor_rank0: 42.0}) @test_util.run_in_graph_and_eager_modes() def test_rank_zero_tensor_doesnt_raise_if_rank_matches_static_rank(self): tensor_rank0 = constant_op.constant(42, name="my_tensor") for desired_ranks in ((0, 1, 2), (1, 0, 2), (1, 2, 0)): with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank0, desired_ranks)]): self.evaluate(array_ops.identity(tensor_rank0)) def test_rank_zero_tensor_doesnt_raise_if_rank_matches_dynamic_rank(self): with self.test_session(): tensor_rank0 = array_ops.placeholder(dtypes.float32, name="my_tensor") for desired_ranks in ((0, 1, 2), (1, 0, 2), (1, 2, 0)): with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank0, desired_ranks)]): array_ops.identity(tensor_rank0).eval(feed_dict={tensor_rank0: 42.0}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_doesnt_raise_if_rank_matches_static_rank(self): tensor_rank1 = constant_op.constant([42, 43], name="my_tensor") for desired_ranks in ((0, 1, 2), (1, 0, 2), (1, 2, 0)): with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank1, desired_ranks)]): self.evaluate(array_ops.identity(tensor_rank1)) def test_rank_one_tensor_doesnt_raise_if_rank_matches_dynamic_rank(self): with self.test_session(): tensor_rank1 = array_ops.placeholder(dtypes.float32, name="my_tensor") for desired_ranks in ((0, 1, 2), (1, 0, 2), (1, 2, 0)): with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank1, desired_ranks)]): array_ops.identity(tensor_rank1).eval(feed_dict={ tensor_rank1: (42.0, 43.0) }) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_raises_if_rank_mismatches_static_rank(self): tensor_rank1 = constant_op.constant((42, 43), name="my_tensor") with self.assertRaisesRegexp(ValueError, "rank"): with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank1, (0, 2))]): self.evaluate(array_ops.identity(tensor_rank1)) def test_rank_one_tensor_raises_if_rank_mismatches_dynamic_rank(self): with self.test_session(): tensor_rank1 = array_ops.placeholder(dtypes.float32, name="my_tensor") with ops.control_dependencies([ check_ops.assert_rank_in(tensor_rank1, (0, 2))]): with self.assertRaisesOpError("my_tensor.*rank"): array_ops.identity(tensor_rank1).eval(feed_dict={ tensor_rank1: (42.0, 43.0) }) @test_util.run_in_graph_and_eager_modes() def test_raises_if_rank_is_not_scalar_static(self): tensor = constant_op.constant((42, 43), name="my_tensor") desired_ranks = ( np.array(1, dtype=np.int32), np.array((2, 1), dtype=np.int32)) with self.assertRaisesRegexp(ValueError, "Rank must be a scalar"): check_ops.assert_rank_in(tensor, desired_ranks) def test_raises_if_rank_is_not_scalar_dynamic(self): with self.test_session(): tensor = constant_op.constant( (42, 43), dtype=dtypes.float32, name="my_tensor") desired_ranks = ( array_ops.placeholder(dtypes.int32, name="rank0_tensor"), array_ops.placeholder(dtypes.int32, name="rank1_tensor")) with self.assertRaisesOpError("Rank must be a scalar"): with ops.control_dependencies( (check_ops.assert_rank_in(tensor, desired_ranks),)): array_ops.identity(tensor).eval(feed_dict={ desired_ranks[0]: 1, desired_ranks[1]: [2, 1], }) @test_util.run_in_graph_and_eager_modes() def test_raises_if_rank_is_not_integer_static(self): tensor = constant_op.constant((42, 43), name="my_tensor") with self.assertRaisesRegexp(TypeError, "must be of type <dtype: 'int32'>"): check_ops.assert_rank_in(tensor, (1, .5,)) def test_raises_if_rank_is_not_integer_dynamic(self): with self.test_session(): tensor = constant_op.constant( (42, 43), dtype=dtypes.float32, name="my_tensor") rank_tensor = array_ops.placeholder(dtypes.float32, name="rank_tensor") with self.assertRaisesRegexp(TypeError, "must be of type <dtype: 'int32'>"): with ops.control_dependencies( [check_ops.assert_rank_in(tensor, (1, rank_tensor))]): array_ops.identity(tensor).eval(feed_dict={rank_tensor: .5}) class AssertRankAtLeastTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_rank_zero_tensor_raises_if_rank_too_small_static_rank(self): tensor = constant_op.constant(1, name="my_tensor") desired_rank = 1 with self.assertRaisesRegexp(ValueError, "rank at least 1"): with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_zero_tensor_raises_if_rank_too_small_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 1 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): with self.assertRaisesOpError("my_tensor.*rank"): array_ops.identity(tensor).eval(feed_dict={tensor: 0}) @test_util.run_in_graph_and_eager_modes() def test_rank_zero_tensor_doesnt_raise_if_rank_just_right_static_rank(self): tensor = constant_op.constant(1, name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_zero_tensor_doesnt_raise_if_rank_just_right_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): array_ops.identity(tensor).eval(feed_dict={tensor: 0}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_ten_doesnt_raise_raise_if_rank_too_large_static_rank(self): tensor = constant_op.constant([1, 2], name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_one_ten_doesnt_raise_if_rank_too_large_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 0 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): array_ops.identity(tensor).eval(feed_dict={tensor: [1, 2]}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_doesnt_raise_if_rank_just_right_static_rank(self): tensor = constant_op.constant([1, 2], name="my_tensor") desired_rank = 1 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_one_tensor_doesnt_raise_if_rank_just_right_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 1 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): array_ops.identity(tensor).eval(feed_dict={tensor: [1, 2]}) @test_util.run_in_graph_and_eager_modes() def test_rank_one_tensor_raises_if_rank_too_small_static_rank(self): tensor = constant_op.constant([1, 2], name="my_tensor") desired_rank = 2 with self.assertRaisesRegexp(ValueError, "rank at least 2"): with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): self.evaluate(array_ops.identity(tensor)) def test_rank_one_tensor_raises_if_rank_too_small_dynamic_rank(self): with self.test_session(): tensor = array_ops.placeholder(dtypes.float32, name="my_tensor") desired_rank = 2 with ops.control_dependencies( [check_ops.assert_rank_at_least(tensor, desired_rank)]): with self.assertRaisesOpError("my_tensor.*rank"): array_ops.identity(tensor).eval(feed_dict={tensor: [1, 2]}) class AssertNonNegativeTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_raises_when_negative(self): zoe = constant_op.constant([-1, -2], name="zoe") with self.assertRaisesOpError("x >= 0 did not hold"): with ops.control_dependencies([check_ops.assert_non_negative(zoe)]): out = array_ops.identity(zoe) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_zero_and_positive(self): lucas = constant_op.constant([0, 2], name="lucas") with ops.control_dependencies([check_ops.assert_non_negative(lucas)]): out = array_ops.identity(lucas) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_empty_tensor_doesnt_raise(self): # A tensor is non-negative when it satisfies: # For every element x_i in x, x_i >= 0 # and an empty tensor has no elements, so this is trivially satisfied. # This is standard set theory. empty = constant_op.constant([], name="empty") with ops.control_dependencies([check_ops.assert_non_negative(empty)]): out = array_ops.identity(empty) self.evaluate(out) class AssertNonPositiveTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_zero_and_negative(self): tom = constant_op.constant([0, -2], name="tom") with ops.control_dependencies([check_ops.assert_non_positive(tom)]): out = array_ops.identity(tom) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_positive(self): rachel = constant_op.constant([0, 2], name="rachel") with self.assertRaisesOpError("x <= 0 did not hold"): with ops.control_dependencies([check_ops.assert_non_positive(rachel)]): out = array_ops.identity(rachel) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_empty_tensor_doesnt_raise(self): # A tensor is non-positive when it satisfies: # For every element x_i in x, x_i <= 0 # and an empty tensor has no elements, so this is trivially satisfied. # This is standard set theory. empty = constant_op.constant([], name="empty") with ops.control_dependencies([check_ops.assert_non_positive(empty)]): out = array_ops.identity(empty) self.evaluate(out) class AssertIntegerTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_integer(self): integers = constant_op.constant([1, 2], name="integers") with ops.control_dependencies([check_ops.assert_integer(integers)]): out = array_ops.identity(integers) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_float(self): floats = constant_op.constant([1.0, 2.0], name="floats") with self.assertRaisesRegexp(TypeError, "Expected.*integer"): check_ops.assert_integer(floats) class AssertTypeTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_doesnt_raise_when_correct_type(self): integers = constant_op.constant([1, 2], dtype=dtypes.int64) with ops.control_dependencies([ check_ops.assert_type(integers, dtypes.int64)]): out = array_ops.identity(integers) self.evaluate(out) @test_util.run_in_graph_and_eager_modes() def test_raises_when_wrong_type(self): floats = constant_op.constant([1.0, 2.0], dtype=dtypes.float16) with self.assertRaisesRegexp(TypeError, "must be of type.*float32"): check_ops.assert_type(floats, dtypes.float32) class IsStrictlyIncreasingTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_constant_tensor_is_not_strictly_increasing(self): self.assertFalse(self.evaluate(check_ops.is_strictly_increasing([1, 1, 1]))) @test_util.run_in_graph_and_eager_modes() def test_decreasing_tensor_is_not_strictly_increasing(self): self.assertFalse(self.evaluate( check_ops.is_strictly_increasing([1, 0, -1]))) @test_util.run_in_graph_and_eager_modes() def test_2d_decreasing_tensor_is_not_strictly_increasing(self): self.assertFalse( self.evaluate(check_ops.is_strictly_increasing([[1, 3], [2, 4]]))) @test_util.run_in_graph_and_eager_modes() def test_increasing_tensor_is_increasing(self): self.assertTrue(self.evaluate(check_ops.is_strictly_increasing([1, 2, 3]))) @test_util.run_in_graph_and_eager_modes() def test_increasing_rank_two_tensor(self): self.assertTrue( self.evaluate(check_ops.is_strictly_increasing([[-1, 2], [3, 4]]))) @test_util.run_in_graph_and_eager_modes() def test_tensor_with_one_element_is_strictly_increasing(self): self.assertTrue(self.evaluate(check_ops.is_strictly_increasing([1]))) @test_util.run_in_graph_and_eager_modes() def test_empty_tensor_is_strictly_increasing(self): self.assertTrue(self.evaluate(check_ops.is_strictly_increasing([]))) class IsNonDecreasingTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_constant_tensor_is_non_decreasing(self): self.assertTrue(self.evaluate(check_ops.is_non_decreasing([1, 1, 1]))) @test_util.run_in_graph_and_eager_modes() def test_decreasing_tensor_is_not_non_decreasing(self): self.assertFalse(self.evaluate(check_ops.is_non_decreasing([3, 2, 1]))) @test_util.run_in_graph_and_eager_modes() def test_2d_decreasing_tensor_is_not_non_decreasing(self): self.assertFalse(self.evaluate( check_ops.is_non_decreasing([[1, 3], [2, 4]]))) @test_util.run_in_graph_and_eager_modes() def test_increasing_rank_one_tensor_is_non_decreasing(self): self.assertTrue(self.evaluate(check_ops.is_non_decreasing([1, 2, 3]))) @test_util.run_in_graph_and_eager_modes() def test_increasing_rank_two_tensor(self): self.assertTrue(self.evaluate( check_ops.is_non_decreasing([[-1, 2], [3, 3]]))) @test_util.run_in_graph_and_eager_modes() def test_tensor_with_one_element_is_non_decreasing(self): self.assertTrue(self.evaluate(check_ops.is_non_decreasing([1]))) @test_util.run_in_graph_and_eager_modes() def test_empty_tensor_is_non_decreasing(self): self.assertTrue(self.evaluate(check_ops.is_non_decreasing([]))) class FloatDTypeTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_assert_same_float_dtype(self): self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype(None, None)) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype([], None)) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype([], dtypes.float32)) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype(None, dtypes.float32)) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype([None, None], None)) self.assertIs( dtypes.float32, check_ops.assert_same_float_dtype([None, None], dtypes.float32)) const_float = constant_op.constant(3.0, dtype=dtypes.float32) self.assertIs( dtypes.float32, check_ops.assert_same_float_dtype([const_float], dtypes.float32)) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [const_float], dtypes.int32) sparse_float = sparse_tensor.SparseTensor( constant_op.constant([[111], [232]], dtypes.int64), constant_op.constant([23.4, -43.2], dtypes.float32), constant_op.constant([500], dtypes.int64)) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype([sparse_float], dtypes.float32)) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [sparse_float], dtypes.int32) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [const_float, None, sparse_float], dtypes.float64) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype( [const_float, sparse_float])) self.assertIs(dtypes.float32, check_ops.assert_same_float_dtype( [const_float, sparse_float], dtypes.float32)) const_int = constant_op.constant(3, dtype=dtypes.int32) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [sparse_float, const_int]) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [sparse_float, const_int], dtypes.int32) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [sparse_float, const_int], dtypes.float32) self.assertRaises(ValueError, check_ops.assert_same_float_dtype, [const_int]) class AssertScalarTest(test.TestCase): @test_util.run_in_graph_and_eager_modes() def test_assert_scalar(self): check_ops.assert_scalar(constant_op.constant(3)) check_ops.assert_scalar(constant_op.constant("foo")) check_ops.assert_scalar(3) check_ops.assert_scalar("foo") with self.assertRaisesRegexp(ValueError, "Expected scalar"): check_ops.assert_scalar(constant_op.constant([3, 4])) if __name__ == "__main__": test.main()
unknown
codeparrot/codeparrot-clean
# -*- coding: utf-8 -*- """ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. @author: mkaay """ from PyQt4.QtCore import * from PyQt4.QtGui import * from module.utils import formatSpeed, formatSize class OverviewModel(QAbstractListModel): PackageName = 10 Progress = 11 PartsFinished = 12 Parts = 13 ETA = 14 Speed = 15 CurrentSize = 16 MaxSize = 17 Status = 18 def __init__(self, view, connector): QAbstractListModel.__init__(self) self.packages = [] def queueChanged(self): #dirty.. self.beginResetModel() self.packages = [] def partsFinished(p): f = 0 for c in p.children: if c.data["status"] == 0: f += 1 return f def maxSize(p): ms = 0 cs = 0 for c in p.children: try: s = c.data["downloading"]["size"] except: s = c.data["size"] if c.data["downloading"]: cs += s - c.data["downloading"]["bleft"] elif self.queue.getProgress(c, False) == 100: cs += s ms += s return ms, cs def getProgress(p): for c in p.children: if c.data["status"] == 13: pass # TODO return _("Unpacking"), int(c.data["progress"]) return _("Downloading"), self.queue.getProgress(p) d = self.queue._data for p in d: status, progress = getProgress(p) maxsize, currentsize = maxSize(p) speed = self.queue.getSpeed(p) if speed: eta = (maxsize - (maxsize * (progress/100.0)))/speed else: eta = 0 if not speed and not progress: status = _("Queued") info = { OverviewModel.PackageName: p.data["name"], OverviewModel.Progress: progress, OverviewModel.PartsFinished: partsFinished(p), OverviewModel.Parts: len(p.children), OverviewModel.ETA: int(eta), OverviewModel.Speed: speed, OverviewModel.CurrentSize: currentsize, OverviewModel.MaxSize: maxsize, OverviewModel.Status: status, } self.packages.append(info) self.endResetModel() def headerData(self, section, orientation, role=Qt.DisplayRole): return QVariant(_("Package")) def rowCount(self, parent=QModelIndex()): return len(self.packages) def data(self, index, role=Qt.DisplayRole): if role in [OverviewModel.PackageName, OverviewModel.Progress, OverviewModel.PartsFinished, OverviewModel.Parts, OverviewModel.ETA, OverviewModel.Speed, OverviewModel.CurrentSize, OverviewModel.MaxSize, OverviewModel.Status]: return QVariant(self.packages[index.row()][role]) return QVariant() class OverviewView(QListView): def __init__(self, connector): QListView.__init__(self) self.setModel(OverviewModel(self, connector)) self.setAlternatingRowColors(True) self.delegate = OverviewDelegate(self) self.setItemDelegate(self.delegate) class OverviewDelegate(QItemDelegate): def __init__(self, parent): QItemDelegate.__init__(self, parent) self.parent = parent self.model = parent.model() def paint(self, painter, option, index): option.rect.setHeight(59+16) option.rect.setWidth(self.parent.width()-20) #if option.state & QStyle.State_Selected: # painter.fillRect(option.rect, option.palette.color(QPalette.Highlight)) packagename = index.data(OverviewModel.PackageName).toString() partsf = index.data(OverviewModel.PartsFinished).toString() parts = index.data(OverviewModel.Parts).toString() eta = int(index.data(OverviewModel.ETA).toString()) speed = index.data(OverviewModel.Speed).toString() or 0 progress = int(index.data(OverviewModel.Progress).toString()) currentSize = int(index.data(OverviewModel.CurrentSize).toString()) maxSize = int(index.data(OverviewModel.MaxSize).toString()) status = index.data(OverviewModel.Status).toString() def formatEta(seconds): #TODO add to utils if seconds <= 0: return "" hours, seconds = divmod(seconds, 3600) minutes, seconds = divmod(seconds, 60) return _("ETA: ") + "%.2i:%.2i:%.2i" % (hours, minutes, seconds) statusline = QString(_("Parts: ") + "%s/%s" % (partsf, parts)) if partsf == parts: speedline = _("Finished") elif not status == _("Downloading"): speedline = QString(status) else: speedline = QString(formatEta(eta) + " " + _("Speed: %s") % formatSpeed(speed)) if progress in (0,100): sizeline = QString(_("Size:") + "%s" % formatSize(maxSize)) else: sizeline = QString(_("Size:") + "%s / %s" % (formatSize(currentSize), formatSize(maxSize))) f = painter.font() f.setPointSize(12) f.setBold(True) painter.setFont(f) r = option.rect.adjusted(4, 4, -4, -4) painter.drawText(r.left(), r.top(), r.width(), r.height(), Qt.AlignTop | Qt.AlignLeft, packagename) newr = painter.boundingRect(r.left(), r.top(), r.width(), r.height(), Qt.AlignTop | Qt.AlignLeft, packagename) f.setPointSize(10) f.setBold(False) painter.setFont(f) painter.drawText(r.left(), newr.bottom()+5, r.width(), r.height(), Qt.AlignTop | Qt.AlignLeft, statusline) painter.drawText(r.left(), newr.bottom()+5, r.width(), r.height(), Qt.AlignTop | Qt.AlignHCenter, sizeline) painter.drawText(r.left(), newr.bottom()+5, r.width(), r.height(), Qt.AlignTop | Qt.AlignRight, speedline) newr = painter.boundingRect(r.left(), newr.bottom()+2, r.width(), r.height(), Qt.AlignTop | Qt.AlignLeft, statusline) newr.setTop(newr.bottom()+8) newr.setBottom(newr.top()+20) newr.setRight(self.parent.width()-25) f.setPointSize(10) painter.setFont(f) opts = QStyleOptionProgressBarV2() opts.maximum = 100 opts.minimum = 0 opts.progress = progress opts.rect = newr opts.textVisible = True opts.textAlignment = Qt.AlignCenter opts.text = QString.number(opts.progress) + "%" QApplication.style().drawControl(QStyle.CE_ProgressBar, opts, painter) def sizeHint(self, option, index): return QSize(self.parent.width()-22, 59+16)
unknown
codeparrot/codeparrot-clean
import socket # Import socket module from gopigo import * #Has the basic functions for controlling the GoPiGo Robot import sys #Used for closing the running program import pygame #Gives access to KEYUP/KEYDOWN events import picamera import os, os.path import numpy as np import argparse import os import sys camera=picamera.PiCamera() charpre='p' accelerate=0 if __name__ == '__main__': iteration=0 while True: imagename='/home/pi/Desktop/capture.jpg' camera.capture(imagename) s = socket.socket() # Create a socket object host = '192.168.1.10' # Get local machine name port = 8800 # Reserve a port for your service. s.connect((host, port)) f = open('capture.jpg','rb') print 'Sending...' l = f.read(1024) while (l): print 'Sending...' s.send(l) l = f.read(1024) f.close() print "Done Sending" s.shutdown(socket.SHUT_WR) char=s.recv(1024) print('character received is ',char) s.close() if char=='w': motor1(1,100) motor2(1,100) print('running in w') time.sleep(0.5) motor1(1,0) motor2(1,0) elif char=='a': motor1(1,130+accelerate) motor2(1,100) time.sleep(0.5) motor1(1,100) motor2(1,100) motor1(1,0) motor2(1,0) print('running in a') elif char=='d': #right();# Turn Right motor1(1,100) motor2(1,130+accelerate) time.sleep(0.5) motor1(1,100) motor2(1,100) motor1(1,0) motor2(1,0) print('running in d') elif char=='s': motor1(0,100) motor2(0,100) print('running in s') time.sleep(0.5) elif char=='t': increase_speed(); # Increase speed print('running in t') elif char=='g': decrease_speed(); # Decrease speed print('running in g') if (charpre==char) and (charpre=='a' or charpre=='d'): accelerate=accelerate+5 else: accelerate=0 charpre=char print('acceleration is ',accelerate) iteration=iteration+1
unknown
codeparrot/codeparrot-clean
from __future__ import absolute_import import datetime from django.db import models from django.utils.translation import ugettext_lazy as _ def standalone_number(self): return 1 class Numbers(object): @staticmethod def get_static_number(self): return 2 @classmethod def get_class_number(self): return 3 def get_member_number(self): return 4 nn = Numbers() class Group(models.Model): name = models.CharField(_('name'), max_length=100) class Event(models.Model): group = models.ForeignKey(Group) class Happening(models.Model): when = models.DateTimeField(blank=True, default=datetime.datetime.now) name = models.CharField(blank=True, max_length=100, default=lambda:"test") number1 = models.IntegerField(blank=True, default=standalone_number) number2 = models.IntegerField(blank=True, default=Numbers.get_static_number) number3 = models.IntegerField(blank=True, default=Numbers.get_class_number) number4 = models.IntegerField(blank=True, default=nn.get_member_number)
unknown
codeparrot/codeparrot-clean
#!/usr/bin/env python """ @file statistics.py @author Michael Behrisch @author Daniel Krajzewicz @date 2008-10-17 @version $Id: statistics.py 12898 2012-10-26 08:58:14Z behrisch $ Collecting statistics for the CityMobil parking lot SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ Copyright (C) 2008-2012 DLR (http://www.dlr.de/) and contributors All rights reserved """ persons = {} personsRunning = 0 class Person: def __init__(self, id, source, target, step): self.id = id self.source = source self.target = target self.waitStart = step self.depart = None self.arrive = None def personArrived(personID, edge, target, step): global personsRunning persons[personID] = Person(personID, edge, target, step) personsRunning += 1 def personLoaded(personID, step): persons[personID].depart = step def personUnloaded(personID, step): global personsRunning persons[personID].arrive = step personsRunning -= 1 def evaluate(forTest=False): try: import numpy, math except ImportError: print "No numpy available, skipping statistics" return waitTimes = [] routeTimes = {} for person in persons.itervalues(): waitTimes.append(person.depart - person.waitStart) route = (person.source, person.target) if not route in routeTimes: routeTimes[route] = [] routeTimes[route].append(person.arrive - person.depart) waitArray = numpy.array(waitTimes) if forTest: print "waiting time (max, mean, dev):", waitArray.max() < 1000, waitArray.mean() < 1000, math.sqrt(waitArray.var()) < 100 else: print "waiting time (max, mean, dev):", waitArray.max(), waitArray.mean(), math.sqrt(waitArray.var()) for route, times in sorted(routeTimes.iteritems()): timeArray = numpy.array(times) if forTest: print route, timeArray.max() < 1000, timeArray.mean() < 1000, math.sqrt(timeArray.var()) < 100 else: print route, timeArray.max(), timeArray.mean(), math.sqrt(timeArray.var()) co2 = 0. for line in open("aggregated.xml"): if "cyber" in line: pos = line.find('CO2_abs="') + 9 if pos >= 9: endpos = line.find('"', pos) co2 += float(line[pos:endpos]) if forTest: print "CO2:", co2 < 10000000 else: print "CO2:", co2 if __name__ == "__main__": from pylab import * stats = open(sys.argv[1]) demand = [] simpleWaitMean = [] agentWaitMean = [] simpleWaitDev = [] agentWaitDev = [] simpleRouteMean = [] agentRouteMean = [] simpleRouteDev = [] agentRouteDev = [] for line in stats: if "simple" in line: mean = simpleWaitMean dev = simpleWaitDev rmean = simpleRouteMean rdev = simpleRouteDev demand.append(int(line.split()[-1])) if "agent" in line: mean = agentWaitMean dev = agentWaitDev rmean = agentRouteMean rdev = agentRouteDev if "waiting" in line: mean.append(float(line.split()[-2])) dev.append(float(line.split()[-1])) if line.startswith("('footmain0to1'"): rmean.append(float(line.split()[-2])) rdev.append(float(line.split()[-1])) stats.close() figure() errorbar(demand, simpleWaitMean, simpleWaitDev, lw=2, ms=10, fmt='o', label='standard bus scenario') errorbar(demand, agentWaitMean, agentWaitDev, lw=2, ms=10, color="red", fmt='o', label='agent controlled cyber cars') xlim(0, 50) ylim(0, 3300) xlabel('Repeater interval (s)') ylabel('Waiting time (s)') title('Mean and standard deviation of waiting time') legend(numpoints=1) savefig("waitingtime.png") figure() errorbar(demand, simpleRouteMean, simpleRouteDev, lw=2, ms=10, fmt='o', label='standard bus scenario') errorbar(demand, agentRouteMean, agentRouteDev, lw=2, ms=10, color="red", fmt='o', label='agent controlled cyber cars') xlim(0, 50) ylim(0, 300) xlabel('Repeater interval (s)') ylabel('Travel time (s)') title('Mean and standard deviation of travel time on the longest route') legend(numpoints=1) savefig("traveltime.png") show()
unknown
codeparrot/codeparrot-clean
:host { font-family: var(--inter-font); display: flex; justify-content: center; } [ngTabs] { overflow: hidden; width: 600px; border-radius: 0.5rem; border: 1px solid color-mix(in srgb, var(--primary-contrast) 10%, transparent); } [ngTabList] { padding: 0; display: flex; list-style: none; position: relative; border-bottom: 1px solid color-mix(in srgb, var(--primary-contrast) 10%, transparent); } [ngTab] { flex: 1; outline: none; padding: 0.75rem 0; cursor: pointer; text-align: center; color: color-mix(in srgb, var(--primary-contrast) 60%, transparent); } [ngTab][aria-selected='false']:focus { outline-offset: -8px; border-radius: 0.7rem; outline: 2px solid var(--bright-blue); } [ngTab]:hover { background-color: color-mix(in srgb, var(--bright-blue) 5%, transparent); } [ngTab][aria-selected='true'] { color: var(--page-background); background-color: var(--bright-blue); border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; } .sliding-window { width: 300%; display: flex; transition: all 0.2s ease-in-out; } [ngTabList]:has([ngTab]:nth-child(1)[aria-selected='true']) ~ .sliding-window { transform: translateX(0%); } [ngTabList]:has([ngTab]:nth-child(2)[aria-selected='true']) ~ .sliding-window { transform: translateX(-33.333%); } [ngTabList]:has([ngTab]:nth-child(3)[aria-selected='true']) ~ .sliding-window { transform: translateX(-66.666%); } [ngTabPanel] { display: grid; place-items: center; padding: 1rem; min-height: 100px; flex: 1; border-bottom-right-radius: 0.5rem; border-bottom-left-radius: 0.5rem; } [ngTabPanel]:focus { outline-offset: -4px; border-radius: 0.5rem; outline: 2px solid var(--bright-blue); }
css
github
https://github.com/angular/angular
adev/src/content/examples/aria/tabs/src/explicit-selection/app/app.css
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import time from openerp.osv import osv from openerp.report import report_sxw class report_print_check(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(report_print_check, self).__init__(cr, uid, name, context) self.number_lines = 0 self.number_add = 0 self.localcontext.update({ 'time': time, 'get_lines': self.get_lines, 'fill_stars' : self.fill_stars, }) def fill_stars(self, amount): if len(amount) < 100: stars = 100 - len(amount) return ' '.join([amount,'*'*stars]) else: return amount def get_lines(self, voucher_lines): result = [] self.number_lines = len(voucher_lines) for i in range(0, min(10,self.number_lines)): if i < self.number_lines: res = { 'date_due' : voucher_lines[i].date_due, 'name' : voucher_lines[i].name, 'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False, 'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False, 'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False, } else : res = { 'date_due' : False, 'name' : False, 'amount_original' : False, 'amount_due' : False, 'amount' : False, } result.append(res) return result class report_check(osv.AbstractModel): _name = 'report.account_check_writing.report_check' _inherit = 'report.abstract_report' _template = 'account_check_writing.report_check' _wrapped_report_class = report_print_check # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
unknown
codeparrot/codeparrot-clean
# -*- coding: utf-8 -*- from factopy.models import Stream, Material, MaterialStatus, InvalidStatus from django.test import TestCase class TestMaterialStatuses(TestCase): fixtures = ['initial_data.yaml', '*'] def setUp(self): self.stream = Stream() self.stream.save() self.second_stream = Stream() self.second_stream.save() self.material = Material() self.material.save() self.material_status = MaterialStatus.objects.get_or_create( material=self.material, stream=self.stream )[0] self.material_status.save() def test_serialization(self): material_status = u'%s -> %s' % ( unicode(self.material_status.stream), unicode(self.material_status.material)) # check if the __str__ method return the created and modified datetime. self.assertEquals(str(self.material_status), str(material_status)) # check if the __unicode__ method is defined to return the created and # modified datetime. self.assertEquals(unicode(self.material_status), material_status) def test_statuses_number(self): # check if return the list of statuses indexed by number. self.assertEquals(MaterialStatus.statuses_number().keys(), [0, 1, 2]) self.assertEquals(MaterialStatus.statuses_number().values(), [u'unprocessed', u'processing', u'processed']) def test_statuses_name(self): # check if return the list of statuses indexed by name. self.assertEquals(MaterialStatus.statuses_name().keys(), [u'unprocessed', u'processing', u'processed']) self.assertEquals(MaterialStatus.statuses_name().values(), [0, 1, 2]) def test_clone_for(self): # check if the clone method create a new file_status. clone = self.material_status.clone_for(self.second_stream) self.assertNotEquals(clone, self.material_status) # check if the cloned material_status has the second_stream # and the same material object. self.assertEquals(self.material_status.stream, self.stream) self.assertEquals(clone.stream, self.second_stream) self.assertEquals(clone.material, self.material_status.material) def test_status(self): # check if return the status as a name. for i, name in MaterialStatus.statuses_number().items(): self.material_status.state = i self.assertEquals(self.material_status.status(), name) def test_change_status(self): # check if set the right status when use valid ids. for name in MaterialStatus.statuses_name().keys(): self.material_status.change_status(name) self.assertEquals(self.material_status.status(), name) # check if rise an exception when use invalid ids. self.material_status.change_status(u'unprocessed') for name in [u'just an invalid status', u'invalid key']: with self.assertRaises(InvalidStatus): self.material_status.change_status(name) self.assertEquals(self.material_status.status(), u'unprocessed') def test_processed(self): # check if the processed getter return true when the material # was processed. for name in MaterialStatus.statuses_name().keys(): self.material_status.change_status(name) self.assertEquals(self.material_status.processed, self.material_status.status() == u'processed') # check if the processed setter change the processed attribute. self.material_status.change_status(u'unprocessed') self.assertFalse(self.material_status.processed) self.material_status.processed = True self.assertEquals(self.material_status.status(), u'processed') self.assertTrue(self.material_status.processed) self.material_status.processed = False self.assertEquals(self.material_status.status(), u'unprocessed')
unknown
codeparrot/codeparrot-clean
# -*- coding: latin1 -*- ################################################################################################ # # import snap, datetime, sys, time, json, os, os.path, shutil, time, random, math import numpy as np from math import* # Script auxiliar para cálculos matemáticos que deve estar no mesmo diretório deste aqui. import calc reload(sys) sys.setdefaultencoding('utf-8') ###################################################################################################################################################################### ## Status - Versão 1 - Script para gerar propriedades estruturais das redes-ego ## ###################################################################################################################################################################### ###################################################################################################################################################################### # # Armazenar as propriedades do dataset # ###################################################################################################################################################################### def statistics(dataset_dir,output_dir,net,isdir): print("\n######################################################################\n") print ("Dataset statistics - " +str(dataset_dir)) IsDir=isdir n = [] # Média dos nós por rede-ego e = [] # Média das arestas por rede-ego d = [] # Média dos diametros por rede-ego cc = [] # Média dos coeficientes de clusterings por rede-ego bc_n = [] # média de betweenness centrality dos nós bc_e = [] # média de betweenness centrality das arestas i = 0 for file in os.listdir(dataset_dir): i+=1 print ("Calculando propriedades para o ego %d..." % (i)) G = snap.LoadEdgeList(snap.PNGraph, dataset_dir+file, 0, 1) # load from a text file n.append(G.GetNodes()) # Numero de vertices e.append(G.GetEdges()) # Numero de arestas d.append(snap.GetBfsFullDiam(G, 100, IsDir)) # get diameter of G # cc.append(snap.GetClustCf(G)) # clustering coefficient of G Nodes = snap.TIntFltH() Edges = snap.TIntPrFltH() snap.GetBetweennessCentr(G, Nodes, Edges, 1.0, IsDir) _bc_n = [] _bc_e = [] for node in Nodes: _bc_n.append(Nodes[node]) for edge in Edges: _bc_e.append(Edges[edge]) result = calc.calcular(_bc_n) bc_n.append(result['media']) result = calc.calcular(_bc_e) bc_e.append(result['media']) ##################################################################################### N = calc.calcular_full(n) E = calc.calcular_full(e) D = calc.calcular_full(d) BC_N = calc.calcular_full(bc_n) BC_E = calc.calcular_full(bc_e) print("\n######################################################################\n") print ("NET: %s -- Egos-net: %d" % (net,len(n))) print ("Nodes: Média: %5.3f -- Var:%5.3f -- Des. Padrão: %5.3f"% (N['media'],N['variancia'],N['desvio_padrao'])) print ("Edges: Média: %5.3f -- Var:%5.3f -- Des. Padrão: %5.3f"% (E['media'],E['variancia'],E['desvio_padrao'])) print ("Diameter: Média: %5.3f -- Var:%5.3f -- Des. Padrão: %5.3f"% (D['media'],D['variancia'],D['desvio_padrao'])) print ("Betweenness Centr Nodes: Média: %5.3f -- Var:%5.3f -- Des. Padrão: %5.3f"% (BC_N['media'],BC_N['variancia'],BC_N['desvio_padrao'])) print ("Betweenness Centr Edges: Média: %5.3f -- Var:%5.3f -- Des. Padrão: %5.3f"% (BC_E['media'],BC_E['variancia'],BC_E['desvio_padrao'])) print("\n######################################################################\n") #Average clustering coefficient 0.5653 #Number of triangles 13082506 #Fraction of closed triangles 0.06415 #Diameter (longest shortest path) 7 #90-percentile effective diameter 4.5 #Dataset N E C K S A #Twitter 125,120 2,248,406 3,140 33,569 15.54 0.39 #DATASET STATISTICS. #N: NUMBER OF NODES, #E: NUMBER OF EDGES, #C: NUMBER OF COMMUNITIES, #K: NUMBER OF NODE ATTRIBUTES, #S: AVERAGE COMMUNITY SIZE, #A: COMMUNITY MEMBERSHIPS PER NODE print("\n######################################################################\n") ###################################################################################################################################################################### ###################################################################################################################################################################### # # Método principal do programa. # ###################################################################################################################################################################### ###################################################################################################################################################################### def main(): os.system('clear') print "################################################################################" print" " print" Script para apresentação de propriedades do dataset (rede-ego) " print" " print"#################################################################################" print print" 1 - Follow" print" 9 - Follwowers" print" 2 - Retweets" print" 3 - Likes" print" 3 - Mentions" print " " print" 5 - Co-Follow" print" 10 - Co-Followers" print" 6 - Co-Retweets" print" 7 - Co-Likes" print" 8 - Co-Mentions" print op = int(raw_input("Escolha uma opção acima: ")) if op in (5,6,7,8,10): # Testar se é um grafo direcionado ou não isdir = False else: isdir = True net = "n"+str(op) ###################################################################### ###################################################################### dataset_dir = "/home/amaury/graphs/"+str(net)+"/graphs_with_ego/" ############### Arquivo contendo arquivos com a lista de arestas das redes-ego dataset_dir = "/home/amaury/snappy/twitter/edges/" #Testes... REMOVER DEPOIS! if not os.path.isdir(dataset_dir): print("Diretório dos grafos não encontrado: "+str(dataset_dir)) else: output_dir = "/home/amaury/Dropbox/properties/"+str(net)+"/graphs_with_ego/" if not os.path.exists(output_dir): os.makedirs(output_dir) statistics(dataset_dir,output_dir,net,isdir) # Inicia os cálculos... ###################################################################### ###################################################################### # dataset_dir2 = "/home/amaury/graphs/"+str(net)+"/graphs_without_ego/" ############### Arquivo contendo arquivos com a lista de arestas das redes-ego # if not os.path.isdir(dataset_dir2): # print("Diretório dos grafos não encontrado: "+str(dataset_dir2)) # else: # output_dir2 = "/home/amaury/Dropbox/properties/"+str(net)+"/graphs_with_ego/" # if not os.path.exists(output_dir): # os.makedirs(output_dir) # statistics(dataset_dir2,output_dir2,net,isdir) # Inicia os cálculos... ###################################################################### ###################################################################### print("\n######################################################################\n") print("Script finalizado!") print("\n######################################################################\n") ############################################ ###################################################################################################################################################################### # # INÍCIO DO PROGRAMA # ###################################################################################################################################################################### ###################################################################################################################### #Executa o método main if __name__ == "__main__": main()
unknown
codeparrot/codeparrot-clean
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 --- $id: http://devicetree.org/schemas/extcon/wlf,arizona.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# title: Cirrus Logic/Wolfson Microelectronics Arizona class audio SoCs maintainers: - patches@opensource.cirrus.com description: | These devices are audio SoCs with extensive digital capabilities and a range of analogue I/O. This document lists Extcon specific bindings, see the primary binding document ../mfd/arizona.yaml properties: wlf,hpdet-channel: description: Headphone detection channel. ARIZONA_ACCDET_MODE_HPL/1 sets the headphone detect mode to HPDETL, ARIZONA_ACCDET_MODE_HPR/2 sets it to HPDETR. If this node is not included or if the value is unknown, then headphone detection mode is set to HPDETL. $ref: /schemas/types.yaml#/definitions/uint32 minimum: 1 maximum: 2 wlf,use-jd2: description: Use the additional JD input along with JD1 for dual pin jack detection. type: boolean wlf,use-jd2-nopull: description: Internal pull on JD2 is disabled when used for jack detection. type: boolean wlf,jd-invert: description: Invert the polarity of the jack detection switch. type: boolean wlf,micd-software-compare: description: Use a software comparison to determine mic presence. type: boolean wlf,micd-detect-debounce: description: Additional software microphone detection debounce specified in milliseconds. $ref: /schemas/types.yaml#/definitions/uint32 wlf,micd-pol-gpio: description: GPIO specifier for the GPIO controlling the headset polarity if one exists. maxItems: 1 wlf,micd-bias-start-time: description: Time allowed for MICBIAS to startup prior to performing microphone detection, specified as per the ARIZONA_MICD_TIME_XXX defines. $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0 maximum: 12 wlf,micd-rate: description: Delay between successive microphone detection measurements, specified as per the ARIZONA_MICD_TIME_XXX defines. $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0 maximum: 12 wlf,micd-dbtime: description: Microphone detection hardware debounces specified as the number of measurements to take. $ref: /schemas/types.yaml#/definitions/uint32 enum: [2, 4] wlf,micd-timeout-ms: description: Timeout for microphone detection, specified in milliseconds. wlf,micd-force-micbias: description: Force MICBIAS continuously on during microphone detection. type: boolean wlf,micd-configs: description: Headset polarity configurations (generally used for detection of CTIA / OMTP headsets), the field can be of variable length but should always be a multiple of 3 cells long, each three cell group represents one polarity configuration. $ref: /schemas/types.yaml#/definitions/uint32-matrix items: items: - description: The first cell defines the accessory detection pin, zero will use MICDET1 and 0x2000 will use MICDET2. enum: [ 0, 0x2000 ] - description: The second cell represents the MICBIAS to be used. Zero will use MICVDD, 1-3 will use MICBIASx. minimum: 0 maximum: 3 - description: The third cell represents the value of the micd-pol-gpio pin. minimum: 0 maximum: 1 wlf,gpsw: description: Settings for the general purpose switch, set as one of the ARIZONA_GPSW_XXX defines. $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0 maximum: 3 additionalProperties: true
unknown
github
https://github.com/torvalds/linux
Documentation/devicetree/bindings/extcon/wlf,arizona.yaml
# Copyright 2018 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. # ============================================================================== """Tests for BatchReshape.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.contrib.distributions.python.ops import batch_reshape as batch_reshape_lib from tensorflow.contrib.distributions.python.ops import mvn_diag as mvn_lib from tensorflow.contrib.distributions.python.ops import poisson as poisson_lib from tensorflow.contrib.distributions.python.ops import wishart as wishart_lib from tensorflow.python.framework import constant_op from tensorflow.python.ops import array_ops from tensorflow.python.ops.distributions import normal as normal_lib from tensorflow.python.platform import test class _BatchReshapeTest(object): def make_wishart(self, dims, new_batch_shape, old_batch_shape): new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) scale = self.dtype([ [[1., 0.5], [0.5, 1.]], [[0.5, 0.25], [0.25, 0.75]], ]) scale = np.reshape(np.concatenate([scale, scale], axis=0), old_batch_shape + [dims, dims]) scale_ph = array_ops.placeholder_with_default( scale, shape=scale.shape if self.is_static_shape else None) wishart = wishart_lib.WishartFull(df=5, scale=scale_ph) reshape_wishart = batch_reshape_lib.BatchReshape( distribution=wishart, batch_shape=new_batch_shape_ph, validate_args=True) return wishart, reshape_wishart def test_matrix_variate_sample_and_log_prob(self): dims = 2 new_batch_shape = [4] old_batch_shape = [2, 2] wishart, reshape_wishart = self.make_wishart( dims, new_batch_shape, old_batch_shape) batch_shape = reshape_wishart.batch_shape_tensor() event_shape = reshape_wishart.event_shape_tensor() expected_sample_shape = [3, 1] + new_batch_shape + [dims, dims] x = wishart.sample([3, 1], seed=42) expected_sample = array_ops.reshape(x, expected_sample_shape) actual_sample = reshape_wishart.sample([3, 1], seed=42) expected_log_prob_shape = [3, 1] + new_batch_shape expected_log_prob = array_ops.reshape( wishart.log_prob(x), expected_log_prob_shape) actual_log_prob = reshape_wishart.log_prob(expected_sample) with self.cached_session() as sess: [ batch_shape_, event_shape_, expected_sample_, actual_sample_, expected_log_prob_, actual_log_prob_, ] = sess.run([ batch_shape, event_shape, expected_sample, actual_sample, expected_log_prob, actual_log_prob, ]) self.assertAllEqual(new_batch_shape, batch_shape_) self.assertAllEqual([dims, dims], event_shape_) self.assertAllClose(expected_sample_, actual_sample_, atol=0., rtol=1e-6) self.assertAllClose(expected_log_prob_, actual_log_prob_, atol=0., rtol=1e-6) if not self.is_static_shape: return self.assertAllEqual(new_batch_shape, reshape_wishart.batch_shape) self.assertAllEqual([dims, dims], reshape_wishart.event_shape) self.assertAllEqual(expected_sample_shape, actual_sample.shape) self.assertAllEqual(expected_log_prob_shape, actual_log_prob.shape) def test_matrix_variate_stats(self): dims = 2 new_batch_shape = [4] old_batch_shape = [2, 2] wishart, reshape_wishart = self.make_wishart( dims, new_batch_shape, old_batch_shape) expected_scalar_stat_shape = new_batch_shape expected_matrix_stat_shape = new_batch_shape + [dims, dims] expected_entropy = array_ops.reshape( wishart.entropy(), expected_scalar_stat_shape) actual_entropy = reshape_wishart.entropy() expected_mean = array_ops.reshape( wishart.mean(), expected_matrix_stat_shape) actual_mean = reshape_wishart.mean() expected_mode = array_ops.reshape( wishart.mode(), expected_matrix_stat_shape) actual_mode = reshape_wishart.mode() expected_stddev = array_ops.reshape( wishart.stddev(), expected_matrix_stat_shape) actual_stddev = reshape_wishart.stddev() expected_variance = array_ops.reshape( wishart.variance(), expected_matrix_stat_shape) actual_variance = reshape_wishart.variance() with self.cached_session() as sess: [ expected_entropy_, actual_entropy_, expected_mean_, actual_mean_, expected_mode_, actual_mode_, expected_stddev_, actual_stddev_, expected_variance_, actual_variance_, ] = sess.run([ expected_entropy, actual_entropy, expected_mean, actual_mean, expected_mode, actual_mode, expected_stddev, actual_stddev, expected_variance, actual_variance, ]) self.assertAllClose(expected_entropy_, actual_entropy_, atol=0., rtol=1e-6) self.assertAllClose(expected_mean_, actual_mean_, atol=0., rtol=1e-6) self.assertAllClose(expected_mode_, actual_mode_, atol=0., rtol=1e-6) self.assertAllClose(expected_stddev_, actual_stddev_, atol=0., rtol=1e-6) self.assertAllClose(expected_variance_, actual_variance_, atol=0., rtol=1e-6) if not self.is_static_shape: return self.assertAllEqual(expected_scalar_stat_shape, actual_entropy.shape) self.assertAllEqual(expected_matrix_stat_shape, actual_mean.shape) self.assertAllEqual(expected_matrix_stat_shape, actual_mode.shape) self.assertAllEqual(expected_matrix_stat_shape, actual_stddev.shape) self.assertAllEqual(expected_matrix_stat_shape, actual_variance.shape) def make_normal(self, new_batch_shape, old_batch_shape): new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) scale = self.dtype(0.5 + np.arange( np.prod(old_batch_shape)).reshape(old_batch_shape)) scale_ph = array_ops.placeholder_with_default( scale, shape=scale.shape if self.is_static_shape else None) normal = normal_lib.Normal(loc=self.dtype(0), scale=scale_ph) reshape_normal = batch_reshape_lib.BatchReshape( distribution=normal, batch_shape=new_batch_shape_ph, validate_args=True) return normal, reshape_normal def test_scalar_variate_sample_and_log_prob(self): new_batch_shape = [2, 2] old_batch_shape = [4] normal, reshape_normal = self.make_normal( new_batch_shape, old_batch_shape) batch_shape = reshape_normal.batch_shape_tensor() event_shape = reshape_normal.event_shape_tensor() expected_sample_shape = new_batch_shape x = normal.sample(seed=52) expected_sample = array_ops.reshape(x, expected_sample_shape) actual_sample = reshape_normal.sample(seed=52) expected_log_prob_shape = new_batch_shape expected_log_prob = array_ops.reshape( normal.log_prob(x), expected_log_prob_shape) actual_log_prob = reshape_normal.log_prob(expected_sample) with self.cached_session() as sess: [ batch_shape_, event_shape_, expected_sample_, actual_sample_, expected_log_prob_, actual_log_prob_, ] = sess.run([ batch_shape, event_shape, expected_sample, actual_sample, expected_log_prob, actual_log_prob, ]) self.assertAllEqual(new_batch_shape, batch_shape_) self.assertAllEqual([], event_shape_) self.assertAllClose(expected_sample_, actual_sample_, atol=0., rtol=1e-6) self.assertAllClose(expected_log_prob_, actual_log_prob_, atol=0., rtol=1e-6) if not self.is_static_shape: return self.assertAllEqual(new_batch_shape, reshape_normal.batch_shape) self.assertAllEqual([], reshape_normal.event_shape) self.assertAllEqual(expected_sample_shape, actual_sample.shape) self.assertAllEqual(expected_log_prob_shape, actual_log_prob.shape) def test_scalar_variate_stats(self): new_batch_shape = [2, 2] old_batch_shape = [4] normal, reshape_normal = self.make_normal(new_batch_shape, old_batch_shape) expected_scalar_stat_shape = new_batch_shape expected_entropy = array_ops.reshape( normal.entropy(), expected_scalar_stat_shape) actual_entropy = reshape_normal.entropy() expected_mean = array_ops.reshape( normal.mean(), expected_scalar_stat_shape) actual_mean = reshape_normal.mean() expected_mode = array_ops.reshape( normal.mode(), expected_scalar_stat_shape) actual_mode = reshape_normal.mode() expected_stddev = array_ops.reshape( normal.stddev(), expected_scalar_stat_shape) actual_stddev = reshape_normal.stddev() expected_variance = array_ops.reshape( normal.variance(), expected_scalar_stat_shape) actual_variance = reshape_normal.variance() with self.cached_session() as sess: [ expected_entropy_, actual_entropy_, expected_mean_, actual_mean_, expected_mode_, actual_mode_, expected_stddev_, actual_stddev_, expected_variance_, actual_variance_, ] = sess.run([ expected_entropy, actual_entropy, expected_mean, actual_mean, expected_mode, actual_mode, expected_stddev, actual_stddev, expected_variance, actual_variance, ]) self.assertAllClose(expected_entropy_, actual_entropy_, atol=0., rtol=1e-6) self.assertAllClose(expected_mean_, actual_mean_, atol=0., rtol=1e-6) self.assertAllClose(expected_mode_, actual_mode_, atol=0., rtol=1e-6) self.assertAllClose(expected_stddev_, actual_stddev_, atol=0., rtol=1e-6) self.assertAllClose(expected_variance_, actual_variance_, atol=0., rtol=1e-6) if not self.is_static_shape: return self.assertAllEqual(expected_scalar_stat_shape, actual_entropy.shape) self.assertAllEqual(expected_scalar_stat_shape, actual_mean.shape) self.assertAllEqual(expected_scalar_stat_shape, actual_mode.shape) self.assertAllEqual(expected_scalar_stat_shape, actual_stddev.shape) self.assertAllEqual(expected_scalar_stat_shape, actual_variance.shape) def make_mvn(self, dims, new_batch_shape, old_batch_shape): new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) scale = np.ones(old_batch_shape + [dims], self.dtype) scale_ph = array_ops.placeholder_with_default( scale, shape=scale.shape if self.is_static_shape else None) mvn = mvn_lib.MultivariateNormalDiag(scale_diag=scale_ph) reshape_mvn = batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True) return mvn, reshape_mvn def test_vector_variate_sample_and_log_prob(self): dims = 3 new_batch_shape = [2, 1] old_batch_shape = [2] mvn, reshape_mvn = self.make_mvn( dims, new_batch_shape, old_batch_shape) batch_shape = reshape_mvn.batch_shape_tensor() event_shape = reshape_mvn.event_shape_tensor() expected_sample_shape = [3] + new_batch_shape + [dims] x = mvn.sample(3, seed=62) expected_sample = array_ops.reshape(x, expected_sample_shape) actual_sample = reshape_mvn.sample(3, seed=62) expected_log_prob_shape = [3] + new_batch_shape expected_log_prob = array_ops.reshape( mvn.log_prob(x), expected_log_prob_shape) actual_log_prob = reshape_mvn.log_prob(expected_sample) with self.cached_session() as sess: [ batch_shape_, event_shape_, expected_sample_, actual_sample_, expected_log_prob_, actual_log_prob_, ] = sess.run([ batch_shape, event_shape, expected_sample, actual_sample, expected_log_prob, actual_log_prob, ]) self.assertAllEqual(new_batch_shape, batch_shape_) self.assertAllEqual([dims], event_shape_) self.assertAllClose(expected_sample_, actual_sample_, atol=0., rtol=1e-6) self.assertAllClose(expected_log_prob_, actual_log_prob_, atol=0., rtol=1e-6) if not self.is_static_shape: return self.assertAllEqual(new_batch_shape, reshape_mvn.batch_shape) self.assertAllEqual([dims], reshape_mvn.event_shape) self.assertAllEqual(expected_sample_shape, actual_sample.shape) self.assertAllEqual(expected_log_prob_shape, actual_log_prob.shape) def test_vector_variate_stats(self): dims = 3 new_batch_shape = [2, 1] old_batch_shape = [2] mvn, reshape_mvn = self.make_mvn( dims, new_batch_shape, old_batch_shape) expected_scalar_stat_shape = new_batch_shape expected_entropy = array_ops.reshape( mvn.entropy(), expected_scalar_stat_shape) actual_entropy = reshape_mvn.entropy() expected_vector_stat_shape = new_batch_shape + [dims] expected_mean = array_ops.reshape( mvn.mean(), expected_vector_stat_shape) actual_mean = reshape_mvn.mean() expected_mode = array_ops.reshape( mvn.mode(), expected_vector_stat_shape) actual_mode = reshape_mvn.mode() expected_stddev = array_ops.reshape( mvn.stddev(), expected_vector_stat_shape) actual_stddev = reshape_mvn.stddev() expected_variance = array_ops.reshape( mvn.variance(), expected_vector_stat_shape) actual_variance = reshape_mvn.variance() expected_matrix_stat_shape = new_batch_shape + [dims, dims] expected_covariance = array_ops.reshape( mvn.covariance(), expected_matrix_stat_shape) actual_covariance = reshape_mvn.covariance() with self.cached_session() as sess: [ expected_entropy_, actual_entropy_, expected_mean_, actual_mean_, expected_mode_, actual_mode_, expected_stddev_, actual_stddev_, expected_variance_, actual_variance_, expected_covariance_, actual_covariance_, ] = sess.run([ expected_entropy, actual_entropy, expected_mean, actual_mean, expected_mode, actual_mode, expected_stddev, actual_stddev, expected_variance, actual_variance, expected_covariance, actual_covariance, ]) self.assertAllClose(expected_entropy_, actual_entropy_, atol=0., rtol=1e-6) self.assertAllClose(expected_mean_, actual_mean_, atol=0., rtol=1e-6) self.assertAllClose(expected_mode_, actual_mode_, atol=0., rtol=1e-6) self.assertAllClose(expected_stddev_, actual_stddev_, atol=0., rtol=1e-6) self.assertAllClose(expected_variance_, actual_variance_, atol=0., rtol=1e-6) self.assertAllClose(expected_covariance_, actual_covariance_, atol=0., rtol=1e-6) if not self.is_static_shape: return self.assertAllEqual(expected_scalar_stat_shape, actual_entropy.shape) self.assertAllEqual(expected_vector_stat_shape, actual_mean.shape) self.assertAllEqual(expected_vector_stat_shape, actual_mode.shape) self.assertAllEqual(expected_vector_stat_shape, actual_stddev.shape) self.assertAllEqual(expected_vector_stat_shape, actual_variance.shape) self.assertAllEqual(expected_matrix_stat_shape, actual_covariance.shape) def test_bad_reshape_size(self): dims = 2 new_batch_shape = [2, 3] old_batch_shape = [2] # 2 != 2*3 new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) scale = np.ones(old_batch_shape + [dims], self.dtype) scale_ph = array_ops.placeholder_with_default( scale, shape=scale.shape if self.is_static_shape else None) mvn = mvn_lib.MultivariateNormalDiag(scale_diag=scale_ph) if self.is_static_shape: with self.assertRaisesRegexp( ValueError, (r"`batch_shape` size \(6\) must match " r"`distribution\.batch_shape` size \(2\)")): batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True) else: with self.cached_session(): with self.assertRaisesOpError(r"Shape sizes do not match."): batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True).sample().eval() def test_non_positive_shape(self): dims = 2 old_batch_shape = [4] if self.is_static_shape: # Unknown first dimension does not trigger size check. Note that # any dimension < 0 is treated statically as unknown. new_batch_shape = [-1, 0] else: new_batch_shape = [-2, -2] # -2 * -2 = 4, same size as the old shape. new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) scale = np.ones(old_batch_shape + [dims], self.dtype) scale_ph = array_ops.placeholder_with_default( scale, shape=scale.shape if self.is_static_shape else None) mvn = mvn_lib.MultivariateNormalDiag(scale_diag=scale_ph) if self.is_static_shape: with self.assertRaisesRegexp(ValueError, r".*must be >=-1.*"): batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True) else: with self.cached_session(): with self.assertRaisesOpError(r".*must be >=-1.*"): batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True).sample().eval() def test_non_vector_shape(self): dims = 2 new_batch_shape = 2 old_batch_shape = [2] new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) scale = np.ones(old_batch_shape + [dims], self.dtype) scale_ph = array_ops.placeholder_with_default( scale, shape=scale.shape if self.is_static_shape else None) mvn = mvn_lib.MultivariateNormalDiag(scale_diag=scale_ph) if self.is_static_shape: with self.assertRaisesRegexp(ValueError, r".*must be a vector.*"): batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True) else: with self.cached_session(): with self.assertRaisesOpError(r".*must be a vector.*"): batch_reshape_lib.BatchReshape( distribution=mvn, batch_shape=new_batch_shape_ph, validate_args=True).sample().eval() def test_broadcasting_explicitly_unsupported(self): old_batch_shape = [4] new_batch_shape = [1, 4, 1] rate_ = self.dtype([1, 10, 2, 20]) rate = array_ops.placeholder_with_default( rate_, shape=old_batch_shape if self.is_static_shape else None) poisson_4 = poisson_lib.Poisson(rate) new_batch_shape_ph = ( constant_op.constant(np.int32(new_batch_shape)) if self.is_static_shape else array_ops.placeholder_with_default( np.int32(new_batch_shape), shape=None)) poisson_141_reshaped = batch_reshape_lib.BatchReshape( poisson_4, new_batch_shape_ph, validate_args=True) x_4 = self.dtype([2, 12, 3, 23]) x_114 = self.dtype([2, 12, 3, 23]).reshape(1, 1, 4) if self.is_static_shape: with self.assertRaisesRegexp(NotImplementedError, "too few batch and event dims"): poisson_141_reshaped.log_prob(x_4) with self.assertRaisesRegexp(NotImplementedError, "unexpected batch and event shape"): poisson_141_reshaped.log_prob(x_114) return with self.assertRaisesOpError("too few batch and event dims"): with self.cached_session(): poisson_141_reshaped.log_prob(x_4).eval() with self.assertRaisesOpError("unexpected batch and event shape"): with self.cached_session(): poisson_141_reshaped.log_prob(x_114).eval() class BatchReshapeStaticTest(_BatchReshapeTest, test.TestCase): dtype = np.float32 is_static_shape = True class BatchReshapeDynamicTest(_BatchReshapeTest, test.TestCase): dtype = np.float64 is_static_shape = False if __name__ == "__main__": test.main()
unknown
codeparrot/codeparrot-clean
/** * \file pk.h * * \brief Public Key abstraction layer */ /* * Copyright The Mbed TLS Contributors * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ #ifndef MBEDTLS_PK_H #define MBEDTLS_PK_H #include "mbedtls/private_access.h" #include "mbedtls/build_info.h" #include "mbedtls/md.h" #if defined(MBEDTLS_RSA_C) #include "mbedtls/rsa.h" #endif #if defined(MBEDTLS_ECP_C) #include "mbedtls/ecp.h" #endif #if defined(MBEDTLS_ECDSA_C) #include "mbedtls/ecdsa.h" #endif #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) #include "psa/crypto.h" #endif /** Memory allocation failed. */ #define MBEDTLS_ERR_PK_ALLOC_FAILED -0x3F80 /** Type mismatch, eg attempt to encrypt with an ECDSA key */ #define MBEDTLS_ERR_PK_TYPE_MISMATCH -0x3F00 /** Bad input parameters to function. */ #define MBEDTLS_ERR_PK_BAD_INPUT_DATA -0x3E80 /** Read/write of file failed. */ #define MBEDTLS_ERR_PK_FILE_IO_ERROR -0x3E00 /** Unsupported key version */ #define MBEDTLS_ERR_PK_KEY_INVALID_VERSION -0x3D80 /** Invalid key tag or value. */ #define MBEDTLS_ERR_PK_KEY_INVALID_FORMAT -0x3D00 /** Key algorithm is unsupported (only RSA and EC are supported). */ #define MBEDTLS_ERR_PK_UNKNOWN_PK_ALG -0x3C80 /** Private key password can't be empty. */ #define MBEDTLS_ERR_PK_PASSWORD_REQUIRED -0x3C00 /** Given private key password does not allow for correct decryption. */ #define MBEDTLS_ERR_PK_PASSWORD_MISMATCH -0x3B80 /** The pubkey tag or value is invalid (only RSA and EC are supported). */ #define MBEDTLS_ERR_PK_INVALID_PUBKEY -0x3B00 /** The algorithm tag or value is invalid. */ #define MBEDTLS_ERR_PK_INVALID_ALG -0x3A80 /** Elliptic curve is unsupported (only NIST curves are supported). */ #define MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE -0x3A00 /** Unavailable feature, e.g. RSA disabled for RSA key. */ #define MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE -0x3980 /** The buffer contains a valid signature followed by more data. */ #define MBEDTLS_ERR_PK_SIG_LEN_MISMATCH -0x3900 /** The output buffer is too small. */ #define MBEDTLS_ERR_PK_BUFFER_TOO_SMALL -0x3880 #ifdef __cplusplus extern "C" { #endif /** * \brief Public key types */ typedef enum { MBEDTLS_PK_NONE=0, MBEDTLS_PK_RSA, MBEDTLS_PK_ECKEY, MBEDTLS_PK_ECKEY_DH, MBEDTLS_PK_ECDSA, MBEDTLS_PK_RSA_ALT, MBEDTLS_PK_RSASSA_PSS, MBEDTLS_PK_OPAQUE, } mbedtls_pk_type_t; /** * \brief Options for RSASSA-PSS signature verification. * See \c mbedtls_rsa_rsassa_pss_verify_ext() */ typedef struct mbedtls_pk_rsassa_pss_options { /** The digest to use for MGF1 in PSS. * * \note When #MBEDTLS_USE_PSA_CRYPTO is enabled and #MBEDTLS_RSA_C is * disabled, this must be equal to the \c md_alg argument passed * to mbedtls_pk_verify_ext(). In a future version of the library, * this constraint may apply whenever #MBEDTLS_USE_PSA_CRYPTO is * enabled regardless of the status of #MBEDTLS_RSA_C. */ mbedtls_md_type_t mgf1_hash_id; /** The expected length of the salt, in bytes. This may be * #MBEDTLS_RSA_SALT_LEN_ANY to accept any salt length. * * \note When #MBEDTLS_USE_PSA_CRYPTO is enabled, only * #MBEDTLS_RSA_SALT_LEN_ANY is valid. Any other value may be * ignored (allowing any salt length). */ int expected_salt_len; } mbedtls_pk_rsassa_pss_options; /** * \brief Maximum size of a signature made by mbedtls_pk_sign(). */ /* We need to set MBEDTLS_PK_SIGNATURE_MAX_SIZE to the maximum signature * size among the supported signature types. Do it by starting at 0, * then incrementally increasing to be large enough for each supported * signature mechanism. * * The resulting value can be 0, for example if MBEDTLS_ECDH_C is enabled * (which allows the pk module to be included) but neither MBEDTLS_ECDSA_C * nor MBEDTLS_RSA_C nor any opaque signature mechanism (PSA or RSA_ALT). */ #define MBEDTLS_PK_SIGNATURE_MAX_SIZE 0 #if (defined(MBEDTLS_RSA_C) || defined(MBEDTLS_PK_RSA_ALT_SUPPORT)) && \ MBEDTLS_MPI_MAX_SIZE > MBEDTLS_PK_SIGNATURE_MAX_SIZE /* For RSA, the signature can be as large as the bignum module allows. * For RSA_ALT, the signature size is not necessarily tied to what the * bignum module can do, but in the absence of any specific setting, * we use that (rsa_alt_sign_wrap in library/pk_wrap.h will check). */ #undef MBEDTLS_PK_SIGNATURE_MAX_SIZE #define MBEDTLS_PK_SIGNATURE_MAX_SIZE MBEDTLS_MPI_MAX_SIZE #endif #if defined(MBEDTLS_ECDSA_C) && \ MBEDTLS_ECDSA_MAX_LEN > MBEDTLS_PK_SIGNATURE_MAX_SIZE /* For ECDSA, the ecdsa module exports a constant for the maximum * signature size. */ #undef MBEDTLS_PK_SIGNATURE_MAX_SIZE #define MBEDTLS_PK_SIGNATURE_MAX_SIZE MBEDTLS_ECDSA_MAX_LEN #endif #if defined(MBEDTLS_USE_PSA_CRYPTO) #if PSA_SIGNATURE_MAX_SIZE > MBEDTLS_PK_SIGNATURE_MAX_SIZE /* PSA_SIGNATURE_MAX_SIZE is the maximum size of a signature made * through the PSA API in the PSA representation. */ #undef MBEDTLS_PK_SIGNATURE_MAX_SIZE #define MBEDTLS_PK_SIGNATURE_MAX_SIZE PSA_SIGNATURE_MAX_SIZE #endif #if PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE + 11 > MBEDTLS_PK_SIGNATURE_MAX_SIZE /* The Mbed TLS representation is different for ECDSA signatures: * PSA uses the raw concatenation of r and s, * whereas Mbed TLS uses the ASN.1 representation (SEQUENCE of two INTEGERs). * Add the overhead of ASN.1: up to (1+2) + 2 * (1+2+1) for the * types, lengths (represented by up to 2 bytes), and potential leading * zeros of the INTEGERs and the SEQUENCE. */ #undef MBEDTLS_PK_SIGNATURE_MAX_SIZE #define MBEDTLS_PK_SIGNATURE_MAX_SIZE (PSA_VENDOR_ECDSA_SIGNATURE_MAX_SIZE + 11) #endif #endif /* defined(MBEDTLS_USE_PSA_CRYPTO) */ /* Internal helper to define which fields in the pk_context structure below * should be used for EC keys: legacy ecp_keypair or the raw (PSA friendly) * format. It should be noted that this only affects how data is stored, not * which functions are used for various operations. The overall picture looks * like this: * - if USE_PSA is not defined and ECP_C is defined then use ecp_keypair data * structure and legacy functions * - if USE_PSA is defined and * - if ECP_C then use ecp_keypair structure, convert data to a PSA friendly * format and use PSA functions * - if !ECP_C then use new raw data and PSA functions directly. * * The main reason for the "intermediate" (USE_PSA + ECP_C) above is that as long * as ECP_C is defined mbedtls_pk_ec() gives the user a read/write access to the * ecp_keypair structure inside the pk_context so they can modify it using * ECP functions which are not under PK module's control. */ #if defined(MBEDTLS_USE_PSA_CRYPTO) && defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) && \ !defined(MBEDTLS_ECP_C) #define MBEDTLS_PK_USE_PSA_EC_DATA #endif /** * \brief Types for interfacing with the debug module */ typedef enum { MBEDTLS_PK_DEBUG_NONE = 0, MBEDTLS_PK_DEBUG_MPI, MBEDTLS_PK_DEBUG_ECP, MBEDTLS_PK_DEBUG_PSA_EC, } mbedtls_pk_debug_type; /** * \brief Item to send to the debug module */ typedef struct mbedtls_pk_debug_item { mbedtls_pk_debug_type MBEDTLS_PRIVATE(type); const char *MBEDTLS_PRIVATE(name); void *MBEDTLS_PRIVATE(value); } mbedtls_pk_debug_item; /** Maximum number of item send for debugging, plus 1 */ #define MBEDTLS_PK_DEBUG_MAX_ITEMS 3 /** * \brief Public key information and operations * * \note The library does not support custom pk info structures, * only built-in structures returned by * mbedtls_cipher_info_from_type(). */ typedef struct mbedtls_pk_info_t mbedtls_pk_info_t; #define MBEDTLS_PK_MAX_EC_PUBKEY_RAW_LEN \ PSA_KEY_EXPORT_ECC_PUBLIC_KEY_MAX_SIZE(PSA_VENDOR_ECC_MAX_CURVE_BITS) /** * \brief Public key container */ typedef struct mbedtls_pk_context { const mbedtls_pk_info_t *MBEDTLS_PRIVATE(pk_info); /**< Public key information */ void *MBEDTLS_PRIVATE(pk_ctx); /**< Underlying public key context */ /* The following field is used to store the ID of a private key in the * following cases: * - opaque key when MBEDTLS_USE_PSA_CRYPTO is defined * - normal key when MBEDTLS_PK_USE_PSA_EC_DATA is defined. In this case: * - the pk_ctx above is not not used to store the private key anymore. * Actually that field not populated at all in this case because also * the public key will be stored in raw format as explained below * - this ID is used for all private key operations (ex: sign, check * key pair, key write, etc) using PSA functions * * Note: this private key storing solution only affects EC keys, not the * other ones. The latters still use the pk_ctx to store their own * context. */ #if defined(MBEDTLS_USE_PSA_CRYPTO) mbedtls_svc_key_id_t MBEDTLS_PRIVATE(priv_id); /**< Key ID for opaque keys */ #endif /* MBEDTLS_USE_PSA_CRYPTO */ /* The following fields are meant for storing the public key in raw format * which is handy for: * - easily importing it into the PSA context * - reducing the ECP module dependencies in the PK one. * * When MBEDTLS_PK_USE_PSA_EC_DATA is enabled: * - the pk_ctx above is not used anymore for storing the public key * inside the ecp_keypair structure * - the following fields are used for all public key operations: signature * verify, key pair check and key write. * - For a key pair, priv_id contains the private key. For a public key, * priv_id is null. * Of course, when MBEDTLS_PK_USE_PSA_EC_DATA is not enabled, the legacy * ecp_keypair structure is used for storing the public key and performing * all the operations. * * Note: This new public key storing solution only works for EC keys, not * other ones. The latters still use pk_ctx to store their own * context. */ #if defined(MBEDTLS_PK_USE_PSA_EC_DATA) uint8_t MBEDTLS_PRIVATE(pub_raw)[MBEDTLS_PK_MAX_EC_PUBKEY_RAW_LEN]; /**< Raw public key */ size_t MBEDTLS_PRIVATE(pub_raw_len); /**< Valid bytes in "pub_raw" */ psa_ecc_family_t MBEDTLS_PRIVATE(ec_family); /**< EC family of pk */ size_t MBEDTLS_PRIVATE(ec_bits); /**< Curve's bits of pk */ #endif /* MBEDTLS_PK_USE_PSA_EC_DATA */ } mbedtls_pk_context; #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE) /** * \brief Context for resuming operations */ typedef struct { const mbedtls_pk_info_t *MBEDTLS_PRIVATE(pk_info); /**< Public key information */ void *MBEDTLS_PRIVATE(rs_ctx); /**< Underlying restart context */ } mbedtls_pk_restart_ctx; #else /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ /* Now we can declare functions that take a pointer to that */ typedef void mbedtls_pk_restart_ctx; #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) /** * \brief Types for RSA-alt abstraction */ typedef int (*mbedtls_pk_rsa_alt_decrypt_func)(void *ctx, size_t *olen, const unsigned char *input, unsigned char *output, size_t output_max_len); typedef int (*mbedtls_pk_rsa_alt_sign_func)(void *ctx, mbedtls_f_rng_t *f_rng, void *p_rng, mbedtls_md_type_t md_alg, unsigned int hashlen, const unsigned char *hash, unsigned char *sig); typedef size_t (*mbedtls_pk_rsa_alt_key_len_func)(void *ctx); #endif /* MBEDTLS_PK_RSA_ALT_SUPPORT */ /** * \brief Return information associated with the given PK type * * \param pk_type PK type to search for. * * \return The PK info associated with the type or NULL if not found. */ const mbedtls_pk_info_t *mbedtls_pk_info_from_type(mbedtls_pk_type_t pk_type); /** * \brief Initialize a #mbedtls_pk_context (as NONE). * * \param ctx The context to initialize. * This must not be \c NULL. */ void mbedtls_pk_init(mbedtls_pk_context *ctx); /** * \brief Free the components of a #mbedtls_pk_context. * * \param ctx The context to clear. It must have been initialized. * If this is \c NULL, this function does nothing. * * \note For contexts that have been set up with * mbedtls_pk_setup_opaque(), this does not free the underlying * PSA key and you still need to call psa_destroy_key() * independently if you want to destroy that key. */ void mbedtls_pk_free(mbedtls_pk_context *ctx); #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE) /** * \brief Initialize a restart context * * \param ctx The context to initialize. * This must not be \c NULL. */ void mbedtls_pk_restart_init(mbedtls_pk_restart_ctx *ctx); /** * \brief Free the components of a restart context * * \param ctx The context to clear. It must have been initialized. * If this is \c NULL, this function does nothing. */ void mbedtls_pk_restart_free(mbedtls_pk_restart_ctx *ctx); #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ /** * \brief Initialize a PK context with the information given * and allocates the type-specific PK subcontext. * * \param ctx Context to initialize. It must not have been set * up yet (type #MBEDTLS_PK_NONE). * \param info Information to use * * \return 0 on success, * MBEDTLS_ERR_PK_BAD_INPUT_DATA on invalid input, * MBEDTLS_ERR_PK_ALLOC_FAILED on allocation failure. * * \note For contexts holding an RSA-alt key, use * \c mbedtls_pk_setup_rsa_alt() instead. */ int mbedtls_pk_setup(mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info); #if defined(MBEDTLS_USE_PSA_CRYPTO) /** * \brief Initialize a PK context to wrap a PSA key. * * This function creates a PK context which wraps a PSA key. The PSA wrapped * key must be an EC or RSA key pair (DH is not suported in the PK module). * * Under the hood PSA functions will be used to perform the required * operations and, based on the key type, used algorithms will be: * * EC: * * verify, verify_ext, sign, sign_ext: ECDSA. * * RSA: * * sign, decrypt: use the primary algorithm in the wrapped PSA key; * * sign_ext: RSA PSS if the pk_type is #MBEDTLS_PK_RSASSA_PSS, otherwise * it falls back to the sign() case; * * verify, verify_ext, encrypt: not supported. * * In order for the above operations to succeed, the policy of the wrapped PSA * key must allow the specified algorithm. * * Opaque PK contexts wrapping an EC keys also support \c mbedtls_pk_check_pair(), * whereas RSA ones do not. * * \warning The PSA wrapped key must remain valid as long as the wrapping PK * context is in use, that is at least between the point this function * is called and the point mbedtls_pk_free() is called on this context. * * \param ctx The context to initialize. It must be empty (type NONE). * \param key The PSA key to wrap, which must hold an ECC or RSA key pair. * * \return \c 0 on success. * \return #MBEDTLS_ERR_PK_BAD_INPUT_DATA on invalid input (context already * used, invalid key identifier). * \return #MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE if the key is not an ECC or * RSA key pair. * \return #MBEDTLS_ERR_PK_ALLOC_FAILED on allocation failure. */ int mbedtls_pk_setup_opaque(mbedtls_pk_context *ctx, const mbedtls_svc_key_id_t key); #endif /* MBEDTLS_USE_PSA_CRYPTO */ #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) /** * \brief Initialize an RSA-alt context * * \param ctx Context to initialize. It must not have been set * up yet (type #MBEDTLS_PK_NONE). * \param key RSA key pointer * \param decrypt_func Decryption function * \param sign_func Signing function * \param key_len_func Function returning key length in bytes * * \return 0 on success, or MBEDTLS_ERR_PK_BAD_INPUT_DATA if the * context wasn't already initialized as RSA_ALT. * * \note This function replaces \c mbedtls_pk_setup() for RSA-alt. */ int mbedtls_pk_setup_rsa_alt(mbedtls_pk_context *ctx, void *key, mbedtls_pk_rsa_alt_decrypt_func decrypt_func, mbedtls_pk_rsa_alt_sign_func sign_func, mbedtls_pk_rsa_alt_key_len_func key_len_func); #endif /* MBEDTLS_PK_RSA_ALT_SUPPORT */ /** * \brief Get the size in bits of the underlying key * * \param ctx The context to query. It must have been initialized. * * \return Key size in bits, or 0 on error */ size_t mbedtls_pk_get_bitlen(const mbedtls_pk_context *ctx); /** * \brief Get the length in bytes of the underlying key * * \param ctx The context to query. It must have been initialized. * * \return Key length in bytes, or 0 on error */ static inline size_t mbedtls_pk_get_len(const mbedtls_pk_context *ctx) { return (mbedtls_pk_get_bitlen(ctx) + 7) / 8; } /** * \brief Tell if a context can do the operation given by type * * \param ctx The context to query. It must have been initialized. * \param type The desired type. * * \return 1 if the context can do operations on the given type. * \return 0 if the context cannot do the operations on the given * type. This is always the case for a context that has * been initialized but not set up, or that has been * cleared with mbedtls_pk_free(). */ int mbedtls_pk_can_do(const mbedtls_pk_context *ctx, mbedtls_pk_type_t type); #if defined(MBEDTLS_USE_PSA_CRYPTO) /** * \brief Tell if context can do the operation given by PSA algorithm * * \param ctx The context to query. It must have been initialized. * \param alg PSA algorithm to check against, the following are allowed: * PSA_ALG_RSA_PKCS1V15_SIGN(hash), * PSA_ALG_RSA_PSS(hash), * PSA_ALG_RSA_PKCS1V15_CRYPT, * PSA_ALG_ECDSA(hash), * PSA_ALG_ECDH, where hash is a specific hash. * \param usage PSA usage flag to check against, must be composed of: * PSA_KEY_USAGE_SIGN_HASH * PSA_KEY_USAGE_DECRYPT * PSA_KEY_USAGE_DERIVE. * Context key must match all passed usage flags. * * \warning Since the set of allowed algorithms and usage flags may be * expanded in the future, the return value \c 0 should not * be taken in account for non-allowed algorithms and usage * flags. * * \return 1 if the context can do operations on the given type. * \return 0 if the context cannot do the operations on the given * type, for non-allowed algorithms and usage flags, or * for a context that has been initialized but not set up * or that has been cleared with mbedtls_pk_free(). */ int mbedtls_pk_can_do_ext(const mbedtls_pk_context *ctx, psa_algorithm_t alg, psa_key_usage_t usage); #endif /* MBEDTLS_USE_PSA_CRYPTO */ #if defined(MBEDTLS_PSA_CRYPTO_CLIENT) /** * \brief Determine valid PSA attributes that can be used to * import a key into PSA. * * The attributes determined by this function are suitable * for calling mbedtls_pk_import_into_psa() to create * a PSA key with the same key material. * * The typical flow of operations involving this function is * ``` * psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; * int ret = mbedtls_pk_get_psa_attributes(pk, &attributes); * if (ret != 0) ...; // error handling omitted * // Tweak attributes if desired * psa_key_id_t key_id = 0; * ret = mbedtls_pk_import_into_psa(pk, &attributes, &key_id); * if (ret != 0) ...; // error handling omitted * ``` * * \note This function does not support RSA-alt contexts * (set up with mbedtls_pk_setup_rsa_alt()). * * \param[in] pk The PK context to use. It must have been set up. * It can either contain a key pair or just a public key. * \param usage A single `PSA_KEY_USAGE_xxx` flag among the following: * - #PSA_KEY_USAGE_DECRYPT: \p pk must contain a * key pair. The output \p attributes will contain a * key pair type, and the usage policy will allow * #PSA_KEY_USAGE_ENCRYPT as well as * #PSA_KEY_USAGE_DECRYPT. * - #PSA_KEY_USAGE_DERIVE: \p pk must contain a * key pair. The output \p attributes will contain a * key pair type. * - #PSA_KEY_USAGE_ENCRYPT: The output * \p attributes will contain a public key type. * - #PSA_KEY_USAGE_SIGN_HASH: \p pk must contain a * key pair. The output \p attributes will contain a * key pair type, and the usage policy will allow * #PSA_KEY_USAGE_VERIFY_HASH as well as * #PSA_KEY_USAGE_SIGN_HASH. * - #PSA_KEY_USAGE_SIGN_MESSAGE: \p pk must contain a * key pair. The output \p attributes will contain a * key pair type, and the usage policy will allow * #PSA_KEY_USAGE_VERIFY_MESSAGE as well as * #PSA_KEY_USAGE_SIGN_MESSAGE. * - #PSA_KEY_USAGE_VERIFY_HASH: The output * \p attributes will contain a public key type. * - #PSA_KEY_USAGE_VERIFY_MESSAGE: The output * \p attributes will contain a public key type. * \param[out] attributes * On success, valid attributes to import the key into PSA. * - The lifetime and key identifier are unchanged. If the * attribute structure was initialized or reset before * calling this function, this will result in a volatile * key. Call psa_set_key_identifier() before or after this * function if you wish to create a persistent key. Call * psa_set_key_lifetime() before or after this function if * you wish to import the key in a secure element. * - The key type and bit-size are determined by the contents * of the PK context. If the PK context contains a key * pair, the key type can be either a key pair type or * the corresponding public key type, depending on * \p usage. If the PK context contains a public key, * the key type is a public key type. * - The key's policy is determined by the key type and * the \p usage parameter. The usage always allows * \p usage, exporting and copying the key, and * possibly other permissions as documented for the * \p usage parameter. * The permitted algorithm policy is determined as follows * based on the #mbedtls_pk_type_t type of \p pk, * the chosen \p usage and other factors: * - #MBEDTLS_PK_RSA whose underlying * #mbedtls_rsa_context has the padding mode * #MBEDTLS_RSA_PKCS_V15: * #PSA_ALG_RSA_PKCS1V15_SIGN(#PSA_ALG_ANY_HASH) * if \p usage is SIGN/VERIFY, and * #PSA_ALG_RSA_PKCS1V15_CRYPT * if \p usage is ENCRYPT/DECRYPT. * - #MBEDTLS_PK_RSA whose underlying * #mbedtls_rsa_context has the padding mode * #MBEDTLS_RSA_PKCS_V21 and the digest type * corresponding to the PSA algorithm \c hash: * #PSA_ALG_RSA_PSS_ANY_SALT(#PSA_ALG_ANY_HASH) * if \p usage is SIGN/VERIFY, and * #PSA_ALG_RSA_OAEP(\c hash) * if \p usage is ENCRYPT/DECRYPT. * - #MBEDTLS_PK_RSA_ALT: not supported. * - #MBEDTLS_PK_ECDSA or #MBEDTLS_PK_ECKEY * if \p usage is SIGN/VERIFY: * #PSA_ALG_DETERMINISTIC_ECDSA(#PSA_ALG_ANY_HASH) * if #MBEDTLS_ECDSA_DETERMINISTIC is enabled, * otherwise #PSA_ALG_ECDSA(#PSA_ALG_ANY_HASH). * - #MBEDTLS_PK_ECKEY_DH or #MBEDTLS_PK_ECKEY * if \p usage is DERIVE: * #PSA_ALG_ECDH. * - #MBEDTLS_PK_OPAQUE: same as the primary algorithm * set for the underlying PSA key, except that * sign/decrypt flags are removed if the type is * set to a public key type. * The underlying key must allow \p usage. * Note that the enrollment algorithm set with * psa_set_key_enrollment_algorithm() is not copied. * * \return 0 on success. * #MBEDTLS_ERR_PK_TYPE_MISMATCH if \p pk does not contain * a key of the type identified in \p attributes. * Another error code on other failures. */ int mbedtls_pk_get_psa_attributes(const mbedtls_pk_context *pk, psa_key_usage_t usage, psa_key_attributes_t *attributes); /** * \brief Import a key into the PSA key store. * * This function is equivalent to calling psa_import_key() * with the key material from \p pk. * * The typical way to use this function is: * -# Call mbedtls_pk_get_psa_attributes() to obtain * attributes for the given key. * -# If desired, modify the attributes, for example: * - To create a persistent key, call * psa_set_key_identifier() and optionally * psa_set_key_lifetime(). * - To import only the public part of a key pair: * * psa_set_key_type(&attributes, * PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR( * psa_get_key_type(&attributes))); * - Restrict the key usage if desired. * -# Call mbedtls_pk_import_into_psa(). * * \note This function does not support RSA-alt contexts * (set up with mbedtls_pk_setup_rsa_alt()). * * \param[in] pk The PK context to use. It must have been set up. * It can either contain a key pair or just a public key. * \param[in] attributes * The attributes to use for the new key. They must be * compatible with \p pk. In particular, the key type * must match the content of \p pk. * If \p pk contains a key pair, the key type in * attributes can be either the key pair type or the * corresponding public key type (to import only the * public part). * \param[out] key_id * On success, the identifier of the newly created key. * On error, this is #MBEDTLS_SVC_KEY_ID_INIT. * * \return 0 on success. * #MBEDTLS_ERR_PK_TYPE_MISMATCH if \p pk does not contain * a key of the type identified in \p attributes. * Another error code on other failures. */ int mbedtls_pk_import_into_psa(const mbedtls_pk_context *pk, const psa_key_attributes_t *attributes, mbedtls_svc_key_id_t *key_id); /** * \brief Create a PK context starting from a key stored in PSA. * This key: * - must be exportable and * - must be an RSA or EC key pair or public key (FFDH is not supported in PK). * * The resulting PK object will be a transparent type: * - #MBEDTLS_PK_RSA for RSA keys or * - #MBEDTLS_PK_ECKEY for EC keys. * * Once this functions returns the PK object will be completely * independent from the original PSA key that it was generated * from. * Calling mbedtls_pk_sign(), mbedtls_pk_verify(), * mbedtls_pk_encrypt(), mbedtls_pk_decrypt() on the resulting * PK context will perform the corresponding algorithm for that * PK context type. * * For ECDSA, the choice of deterministic vs randomized will * be based on the compile-time setting #MBEDTLS_ECDSA_DETERMINISTIC. * * For an RSA key, the output PK context will allow both * encrypt/decrypt and sign/verify regardless of the original * key's policy. * The original key's policy determines the output key's padding * mode: PCKS1 v2.1 is set if the PSA key policy is OAEP or PSS, * otherwise PKCS1 v1.5 is set. * * \param key_id The key identifier of the key stored in PSA. * \param pk The PK context that will be filled. It must be initialized, * but not set up. * * \return 0 on success. * \return #MBEDTLS_ERR_PK_BAD_INPUT_DATA in case the provided input * parameters are not correct. */ int mbedtls_pk_copy_from_psa(mbedtls_svc_key_id_t key_id, mbedtls_pk_context *pk); /** * \brief Create a PK context for the public key of a PSA key. * * The key must be an RSA or ECC key. It can be either a * public key or a key pair, and only the public key is copied. * The resulting PK object will be a transparent type: * - #MBEDTLS_PK_RSA for RSA keys or * - #MBEDTLS_PK_ECKEY for EC keys. * * Once this functions returns the PK object will be completely * independent from the original PSA key that it was generated * from. * Calling mbedtls_pk_verify() or * mbedtls_pk_encrypt() on the resulting * PK context will perform the corresponding algorithm for that * PK context type. * * For an RSA key, the output PK context will allow both * encrypt and verify regardless of the original key's policy. * The original key's policy determines the output key's padding * mode: PCKS1 v2.1 is set if the PSA key policy is OAEP or PSS, * otherwise PKCS1 v1.5 is set. * * \param key_id The key identifier of the key stored in PSA. * \param pk The PK context that will be filled. It must be initialized, * but not set up. * * \return 0 on success. * \return MBEDTLS_ERR_PK_BAD_INPUT_DATA in case the provided input * parameters are not correct. */ int mbedtls_pk_copy_public_from_psa(mbedtls_svc_key_id_t key_id, mbedtls_pk_context *pk); #endif /* MBEDTLS_PSA_CRYPTO_CLIENT */ /** * \brief Verify signature (including padding if relevant). * * \param ctx The PK context to use. It must have been set up. * \param md_alg Hash algorithm used. * This can be #MBEDTLS_MD_NONE if the signature algorithm * does not rely on a hash algorithm (non-deterministic * ECDSA, RSA PKCS#1 v1.5). * For PKCS#1 v1.5, if \p md_alg is #MBEDTLS_MD_NONE, then * \p hash is the DigestInfo structure used by RFC 8017 * &sect;9.2 steps 3&ndash;6. If \p md_alg is a valid hash * algorithm then \p hash is the digest itself, and this * function calculates the DigestInfo encoding internally. * \param hash Hash of the message to sign * \param hash_len Hash length * \param sig Signature to verify * \param sig_len Signature length * * \note For keys of type #MBEDTLS_PK_RSA, the signature algorithm is * either PKCS#1 v1.5 or PSS (accepting any salt length), * depending on the padding mode in the underlying RSA context. * For a pk object constructed by parsing, this is PKCS#1 v1.5 * by default. Use mbedtls_pk_verify_ext() to explicitly select * a different algorithm. * * \return 0 on success (signature is valid), * #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid * signature in \p sig but its length is less than \p sig_len, * or a specific error code. */ int mbedtls_pk_verify(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len); /** * \brief Restartable version of \c mbedtls_pk_verify() * * \note Performs the same job as \c mbedtls_pk_verify(), but can * return early and restart according to the limit set with * \c mbedtls_ecp_set_max_ops() to reduce blocking for ECC * operations. For RSA, same as \c mbedtls_pk_verify(). * * \param ctx The PK context to use. It must have been set up. * \param md_alg Hash algorithm used (see notes) * \param hash Hash of the message to sign * \param hash_len Hash length or 0 (see notes) * \param sig Signature to verify * \param sig_len Signature length * \param rs_ctx Restart context (NULL to disable restart) * * \return See \c mbedtls_pk_verify(), or * \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of * operations was reached: see \c mbedtls_ecp_set_max_ops(). */ int mbedtls_pk_verify_restartable(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len, mbedtls_pk_restart_ctx *rs_ctx); /** * \brief Verify signature, with options. * (Includes verification of the padding depending on type.) * * \param type Signature type (inc. possible padding type) to verify * \param options Pointer to type-specific options, or NULL * \param ctx The PK context to use. It must have been set up. * \param md_alg Hash algorithm used (see notes) * \param hash Hash of the message to sign * \param hash_len Hash length or 0 (see notes) * \param sig Signature to verify * \param sig_len Signature length * * \return 0 on success (signature is valid), * #MBEDTLS_ERR_PK_TYPE_MISMATCH if the PK context can't be * used for this type of signatures, * #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid * signature in \p sig but its length is less than \p sig_len, * or a specific error code. * * \note If hash_len is 0, then the length associated with md_alg * is used instead, or an error returned if it is invalid. * * \note md_alg may be MBEDTLS_MD_NONE, only if hash_len != 0 * * \note If type is MBEDTLS_PK_RSASSA_PSS, then options must point * to a mbedtls_pk_rsassa_pss_options structure, * otherwise it must be NULL. Note that if * #MBEDTLS_USE_PSA_CRYPTO is defined, the salt length is not * verified as PSA_ALG_RSA_PSS_ANY_SALT is used. */ int mbedtls_pk_verify_ext(mbedtls_pk_type_t type, const void *options, mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, const unsigned char *sig, size_t sig_len); /** * \brief Make signature, including padding if relevant. * * \param ctx The PK context to use. It must have been set up * with a private key. * \param md_alg Hash algorithm used (see notes) * \param hash Hash of the message to sign * \param hash_len Hash length * \param sig Place to write the signature. * It must have enough room for the signature. * #MBEDTLS_PK_SIGNATURE_MAX_SIZE is always enough. * You may use a smaller buffer if it is large enough * given the key type. * \param sig_size The size of the \p sig buffer in bytes. * \param sig_len On successful return, * the number of bytes written to \p sig. * \param f_rng RNG function, must not be \c NULL. * \param p_rng RNG parameter * * \note For keys of type #MBEDTLS_PK_RSA, the signature algorithm is * either PKCS#1 v1.5 or PSS (using the largest possible salt * length up to the hash length), depending on the padding mode * in the underlying RSA context. For a pk object constructed * by parsing, this is PKCS#1 v1.5 by default. Use * mbedtls_pk_verify_ext() to explicitly select a different * algorithm. * * \return 0 on success, or a specific error code. * * \note For RSA, md_alg may be MBEDTLS_MD_NONE if hash_len != 0. * For ECDSA, md_alg may never be MBEDTLS_MD_NONE. */ int mbedtls_pk_sign(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, unsigned char *sig, size_t sig_size, size_t *sig_len, mbedtls_f_rng_t *f_rng, void *p_rng); /** * \brief Make signature given a signature type. * * \param pk_type Signature type. * \param ctx The PK context to use. It must have been set up * with a private key. * \param md_alg Hash algorithm used (see notes) * \param hash Hash of the message to sign * \param hash_len Hash length * \param sig Place to write the signature. * It must have enough room for the signature. * #MBEDTLS_PK_SIGNATURE_MAX_SIZE is always enough. * You may use a smaller buffer if it is large enough * given the key type. * \param sig_size The size of the \p sig buffer in bytes. * \param sig_len On successful return, * the number of bytes written to \p sig. * \param f_rng RNG function, must not be \c NULL. * \param p_rng RNG parameter * * \return 0 on success, or a specific error code. * * \note When \p pk_type is #MBEDTLS_PK_RSASSA_PSS, * see #PSA_ALG_RSA_PSS for a description of PSS options used. * * \note For RSA, md_alg may be MBEDTLS_MD_NONE if hash_len != 0. * For ECDSA, md_alg may never be MBEDTLS_MD_NONE. * */ int mbedtls_pk_sign_ext(mbedtls_pk_type_t pk_type, mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, unsigned char *sig, size_t sig_size, size_t *sig_len, mbedtls_f_rng_t *f_rng, void *p_rng); /** * \brief Restartable version of \c mbedtls_pk_sign() * * \note Performs the same job as \c mbedtls_pk_sign(), but can * return early and restart according to the limit set with * \c mbedtls_ecp_set_max_ops() to reduce blocking for ECC * operations. For RSA, same as \c mbedtls_pk_sign(). * * \param ctx The PK context to use. It must have been set up * with a private key. * \param md_alg Hash algorithm used (see notes for mbedtls_pk_sign()) * \param hash Hash of the message to sign * \param hash_len Hash length * \param sig Place to write the signature. * It must have enough room for the signature. * #MBEDTLS_PK_SIGNATURE_MAX_SIZE is always enough. * You may use a smaller buffer if it is large enough * given the key type. * \param sig_size The size of the \p sig buffer in bytes. * \param sig_len On successful return, * the number of bytes written to \p sig. * \param f_rng RNG function, must not be \c NULL. * \param p_rng RNG parameter * \param rs_ctx Restart context (NULL to disable restart) * * \return See \c mbedtls_pk_sign(). * \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of * operations was reached: see \c mbedtls_ecp_set_max_ops(). */ int mbedtls_pk_sign_restartable(mbedtls_pk_context *ctx, mbedtls_md_type_t md_alg, const unsigned char *hash, size_t hash_len, unsigned char *sig, size_t sig_size, size_t *sig_len, mbedtls_f_rng_t *f_rng, void *p_rng, mbedtls_pk_restart_ctx *rs_ctx); /** * \brief Decrypt message (including padding if relevant). * * \param ctx The PK context to use. It must have been set up * with a private key. * \param input Input to decrypt * \param ilen Input size * \param output Decrypted output * \param olen Decrypted message length * \param osize Size of the output buffer * \param f_rng RNG function, must not be \c NULL. * \param p_rng RNG parameter * * \note For keys of type #MBEDTLS_PK_RSA, the signature algorithm is * either PKCS#1 v1.5 or OAEP, depending on the padding mode in * the underlying RSA context. For a pk object constructed by * parsing, this is PKCS#1 v1.5 by default. * * \return 0 on success, or a specific error code. */ int mbedtls_pk_decrypt(mbedtls_pk_context *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen, size_t osize, mbedtls_f_rng_t *f_rng, void *p_rng); /** * \brief Encrypt message (including padding if relevant). * * \param ctx The PK context to use. It must have been set up. * \param input Message to encrypt * \param ilen Message size * \param output Encrypted output * \param olen Encrypted output length * \param osize Size of the output buffer * \param f_rng RNG function, must not be \c NULL. * \param p_rng RNG parameter * * \note For keys of type #MBEDTLS_PK_RSA, the signature algorithm is * either PKCS#1 v1.5 or OAEP, depending on the padding mode in * the underlying RSA context. For a pk object constructed by * parsing, this is PKCS#1 v1.5 by default. * * \note \p f_rng is used for padding generation. * * \return 0 on success, or a specific error code. */ int mbedtls_pk_encrypt(mbedtls_pk_context *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen, size_t osize, mbedtls_f_rng_t *f_rng, void *p_rng); /** * \brief Check if a public-private pair of keys matches. * * \param pub Context holding a public key. * \param prv Context holding a private (and public) key. * \param f_rng RNG function, must not be \c NULL. * \param p_rng RNG parameter * * \return \c 0 on success (keys were checked and match each other). * \return #MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE if the keys could not * be checked - in that case they may or may not match. * \return #MBEDTLS_ERR_PK_BAD_INPUT_DATA if a context is invalid. * \return Another non-zero value if the keys do not match. */ int mbedtls_pk_check_pair(const mbedtls_pk_context *pub, const mbedtls_pk_context *prv, mbedtls_f_rng_t *f_rng, void *p_rng); /** * \brief Export debug information * * \param ctx The PK context to use. It must have been initialized. * \param items Place to write debug items * * \return 0 on success or MBEDTLS_ERR_PK_BAD_INPUT_DATA */ int mbedtls_pk_debug(const mbedtls_pk_context *ctx, mbedtls_pk_debug_item *items); /** * \brief Access the type name * * \param ctx The PK context to use. It must have been initialized. * * \return Type name on success, or "invalid PK" */ const char *mbedtls_pk_get_name(const mbedtls_pk_context *ctx); /** * \brief Get the key type * * \param ctx The PK context to use. It must have been initialized. * * \return Type on success. * \return #MBEDTLS_PK_NONE for a context that has not been set up. */ mbedtls_pk_type_t mbedtls_pk_get_type(const mbedtls_pk_context *ctx); #if defined(MBEDTLS_RSA_C) /** * Quick access to an RSA context inside a PK context. * * \warning This function can only be used when the type of the context, as * returned by mbedtls_pk_get_type(), is #MBEDTLS_PK_RSA. * Ensuring that is the caller's responsibility. * Alternatively, you can check whether this function returns NULL. * * \return The internal RSA context held by the PK context, or NULL. */ static inline mbedtls_rsa_context *mbedtls_pk_rsa(const mbedtls_pk_context pk) { switch (mbedtls_pk_get_type(&pk)) { case MBEDTLS_PK_RSA: return (mbedtls_rsa_context *) (pk).MBEDTLS_PRIVATE(pk_ctx); default: return NULL; } } #endif /* MBEDTLS_RSA_C */ #if defined(MBEDTLS_ECP_C) /** * Quick access to an EC context inside a PK context. * * \warning This function can only be used when the type of the context, as * returned by mbedtls_pk_get_type(), is #MBEDTLS_PK_ECKEY, * #MBEDTLS_PK_ECKEY_DH, or #MBEDTLS_PK_ECDSA. * Ensuring that is the caller's responsibility. * Alternatively, you can check whether this function returns NULL. * * \return The internal EC context held by the PK context, or NULL. */ static inline mbedtls_ecp_keypair *mbedtls_pk_ec(const mbedtls_pk_context pk) { switch (mbedtls_pk_get_type(&pk)) { case MBEDTLS_PK_ECKEY: case MBEDTLS_PK_ECKEY_DH: case MBEDTLS_PK_ECDSA: return (mbedtls_ecp_keypair *) (pk).MBEDTLS_PRIVATE(pk_ctx); default: return NULL; } } #endif /* MBEDTLS_ECP_C */ #if defined(MBEDTLS_PK_PARSE_C) /** \ingroup pk_module */ /** * \brief Parse a private key in PEM or DER format * * \note If #MBEDTLS_USE_PSA_CRYPTO is enabled, the PSA crypto * subsystem must have been initialized by calling * psa_crypto_init() before calling this function. * * \param ctx The PK context to fill. It must have been initialized * but not set up. * \param key Input buffer to parse. * The buffer must contain the input exactly, with no * extra trailing material. For PEM, the buffer must * contain a null-terminated string. * \param keylen Size of \b key in bytes. * For PEM data, this includes the terminating null byte, * so \p keylen must be equal to `strlen(key) + 1`. * \param pwd Optional password for decryption. * Pass \c NULL if expecting a non-encrypted key. * Pass a string of \p pwdlen bytes if expecting an encrypted * key; a non-encrypted key will also be accepted. * The empty password is not supported. * \param pwdlen Size of the password in bytes. * Ignored if \p pwd is \c NULL. * \param f_rng RNG function, must not be \c NULL. Used for blinding. * \param p_rng RNG parameter * * \note On entry, ctx must be empty, either freshly initialised * with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a * specific key type, check the result with mbedtls_pk_can_do(). * * \note The key is also checked for correctness. * * \return 0 if successful, or a specific PK or PEM error code */ int mbedtls_pk_parse_key(mbedtls_pk_context *ctx, const unsigned char *key, size_t keylen, const unsigned char *pwd, size_t pwdlen, mbedtls_f_rng_t *f_rng, void *p_rng); /** \ingroup pk_module */ /** * \brief Parse a public key in PEM or DER format * * \note If #MBEDTLS_USE_PSA_CRYPTO is enabled, the PSA crypto * subsystem must have been initialized by calling * psa_crypto_init() before calling this function. * * \param ctx The PK context to fill. It must have been initialized * but not set up. * \param key Input buffer to parse. * The buffer must contain the input exactly, with no * extra trailing material. For PEM, the buffer must * contain a null-terminated string. * \param keylen Size of \b key in bytes. * For PEM data, this includes the terminating null byte, * so \p keylen must be equal to `strlen(key) + 1`. * * \note On entry, ctx must be empty, either freshly initialised * with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a * specific key type, check the result with mbedtls_pk_can_do(). * * \note For compressed points, see #MBEDTLS_ECP_PF_COMPRESSED for * limitations. * * \note The key is also checked for correctness. * * \return 0 if successful, or a specific PK or PEM error code */ int mbedtls_pk_parse_public_key(mbedtls_pk_context *ctx, const unsigned char *key, size_t keylen); #if defined(MBEDTLS_FS_IO) /** \ingroup pk_module */ /** * \brief Load and parse a private key * * \note If #MBEDTLS_USE_PSA_CRYPTO is enabled, the PSA crypto * subsystem must have been initialized by calling * psa_crypto_init() before calling this function. * * \param ctx The PK context to fill. It must have been initialized * but not set up. * \param path filename to read the private key from * \param password Optional password to decrypt the file. * Pass \c NULL if expecting a non-encrypted key. * Pass a null-terminated string if expecting an encrypted * key; a non-encrypted key will also be accepted. * The empty password is not supported. * \param f_rng RNG function, must not be \c NULL. Used for blinding. * \param p_rng RNG parameter * * \note On entry, ctx must be empty, either freshly initialised * with mbedtls_pk_init() or reset with mbedtls_pk_free(). If you need a * specific key type, check the result with mbedtls_pk_can_do(). * * \note The key is also checked for correctness. * * \return 0 if successful, or a specific PK or PEM error code */ int mbedtls_pk_parse_keyfile(mbedtls_pk_context *ctx, const char *path, const char *password, mbedtls_f_rng_t *f_rng, void *p_rng); /** \ingroup pk_module */ /** * \brief Load and parse a public key * * \param ctx The PK context to fill. It must have been initialized * but not set up. * \param path filename to read the public key from * * \note On entry, ctx must be empty, either freshly initialised * with mbedtls_pk_init() or reset with mbedtls_pk_free(). If * you need a specific key type, check the result with * mbedtls_pk_can_do(). * * \note The key is also checked for correctness. * * \return 0 if successful, or a specific PK or PEM error code */ int mbedtls_pk_parse_public_keyfile(mbedtls_pk_context *ctx, const char *path); #endif /* MBEDTLS_FS_IO */ #endif /* MBEDTLS_PK_PARSE_C */ #if defined(MBEDTLS_PK_WRITE_C) /** * \brief Write a private key to a PKCS#1 or SEC1 DER structure * Note: data is written at the end of the buffer! Use the * return value to determine where you should start * using the buffer * * \param ctx PK context which must contain a valid private key. * \param buf buffer to write to * \param size size of the buffer * * \return length of data written if successful, or a specific * error code */ int mbedtls_pk_write_key_der(const mbedtls_pk_context *ctx, unsigned char *buf, size_t size); /** * \brief Write a public key to a SubjectPublicKeyInfo DER structure * Note: data is written at the end of the buffer! Use the * return value to determine where you should start * using the buffer * * \param ctx PK context which must contain a valid public or private key. * \param buf buffer to write to * \param size size of the buffer * * \return length of data written if successful, or a specific * error code */ int mbedtls_pk_write_pubkey_der(const mbedtls_pk_context *ctx, unsigned char *buf, size_t size); #if defined(MBEDTLS_PEM_WRITE_C) /** * \brief Write a public key to a PEM string * * \param ctx PK context which must contain a valid public or private key. * \param buf Buffer to write to. The output includes a * terminating null byte. * \param size Size of the buffer in bytes. * * \return 0 if successful, or a specific error code */ int mbedtls_pk_write_pubkey_pem(const mbedtls_pk_context *ctx, unsigned char *buf, size_t size); /** * \brief Write a private key to a PKCS#1 or SEC1 PEM string * * \param ctx PK context which must contain a valid private key. * \param buf Buffer to write to. The output includes a * terminating null byte. * \param size Size of the buffer in bytes. * * \return 0 if successful, or a specific error code */ int mbedtls_pk_write_key_pem(const mbedtls_pk_context *ctx, unsigned char *buf, size_t size); #endif /* MBEDTLS_PEM_WRITE_C */ #endif /* MBEDTLS_PK_WRITE_C */ /* * WARNING: Low-level functions. You probably do not want to use these unless * you are certain you do ;) */ #if defined(MBEDTLS_PK_PARSE_C) /** * \brief Parse a SubjectPublicKeyInfo DER structure * * \param p the position in the ASN.1 data * \param end end of the buffer * \param pk The PK context to fill. It must have been initialized * but not set up. * * \return 0 if successful, or a specific PK error code */ int mbedtls_pk_parse_subpubkey(unsigned char **p, const unsigned char *end, mbedtls_pk_context *pk); #endif /* MBEDTLS_PK_PARSE_C */ #if defined(MBEDTLS_PK_WRITE_C) /** * \brief Write a subjectPublicKey to ASN.1 data * Note: function works backwards in data buffer * * \param p reference to current position pointer * \param start start of the buffer (for bounds-checking) * \param key PK context which must contain a valid public or private key. * * \return the length written or a negative error code */ int mbedtls_pk_write_pubkey(unsigned char **p, unsigned char *start, const mbedtls_pk_context *key); #endif /* MBEDTLS_PK_WRITE_C */ #ifdef __cplusplus } #endif #endif /* MBEDTLS_PK_H */
c
github
https://github.com/nodejs/node
deps/LIEF/third-party/mbedtls/include/mbedtls/pk.h
require_relative '../app_aobench'
ruby
github
https://github.com/ruby/ruby
benchmark/gc/aobench.rb
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import os from shutil import rmtree import nibabel as nif import numpy as np from tempfile import mkdtemp from nipype.testing import (assert_equal, assert_false, assert_true, assert_raises, skipif) import nipype.interfaces.freesurfer as freesurfer def no_freesurfer(): if freesurfer.Info().version is None: return True else: return False def create_files_in_directory(): outdir = os.path.realpath(mkdtemp()) cwd = os.getcwd() os.chdir(outdir) filelist = ['a.nii','b.nii'] for f in filelist: hdr = nif.Nifti1Header() shape = (3,3,3,4) hdr.set_data_shape(shape) img = np.random.random(shape) nif.save(nif.Nifti1Image(img,np.eye(4),hdr), os.path.join(outdir,f)) return filelist, outdir, cwd def clean_directory(outdir, old_wd): if os.path.exists(outdir): rmtree(outdir) os.chdir(old_wd) @skipif(no_freesurfer) def test_robustregister(): filelist, outdir, cwd = create_files_in_directory() reg = freesurfer.RobustRegister() # make sure command gets called yield assert_equal, reg.cmd, 'mri_robust_register' # test raising error with mandatory args absent yield assert_raises, ValueError, reg.run # .inputs based parameters setting reg.inputs.source_file = filelist[0] reg.inputs.target_file = filelist[1] reg.inputs.auto_sens = True yield assert_equal, reg.cmdline, ('mri_robust_register ' '--satit --lta %s_robustreg.lta --mov %s --dst %s'%(filelist[0][:-4],filelist[0],filelist[1])) # constructor based parameter setting reg2 = freesurfer.RobustRegister(source_file=filelist[0],target_file=filelist[1],outlier_sens=3.0, out_reg_file='foo.lta', half_targ=True) yield assert_equal, reg2.cmdline, ('mri_robust_register --halfdst %s_halfway.nii --lta foo.lta ' '--sat 3.0000 --mov %s --dst %s' %(os.path.join(outdir,filelist[1][:-4]),filelist[0],filelist[1])) clean_directory(outdir, cwd) @skipif(no_freesurfer) def test_fitmsparams(): filelist, outdir, cwd = create_files_in_directory() fit = freesurfer.FitMSParams() # make sure command gets called yield assert_equal, fit.cmd, 'mri_ms_fitparms' # test raising error with mandatory args absent yield assert_raises, ValueError, fit.run # .inputs based parameters setting fit.inputs.in_files = filelist fit.inputs.out_dir = outdir yield assert_equal, fit.cmdline, 'mri_ms_fitparms %s %s %s'%(filelist[0],filelist[1],outdir) # constructor based parameter setting fit2 = freesurfer.FitMSParams(in_files=filelist,te_list=[1.5,3.5],flip_list=[20,30],out_dir=outdir) yield assert_equal, fit2.cmdline, ('mri_ms_fitparms -te %.3f -fa %.1f %s -te %.3f -fa %.1f %s %s' %(1.500,20.0,filelist[0],3.500,30.0,filelist[1],outdir)) clean_directory(outdir, cwd) @skipif(no_freesurfer) def test_synthesizeflash(): filelist, outdir, cwd = create_files_in_directory() syn = freesurfer.SynthesizeFLASH() # make sure command gets called yield assert_equal, syn.cmd, 'mri_synthesize' # test raising error with mandatory args absent yield assert_raises, ValueError, syn.run # .inputs based parameters setting syn.inputs.t1_image = filelist[0] syn.inputs.pd_image = filelist[1] syn.inputs.flip_angle = 30 syn.inputs.te = 4.5 syn.inputs.tr = 20 yield assert_equal, syn.cmdline, ('mri_synthesize 20.00 30.00 4.500 %s %s %s' %(filelist[0],filelist[1],os.path.join(outdir,'synth-flash_30.mgz'))) # constructor based parameters setting syn2 = freesurfer.SynthesizeFLASH(t1_image=filelist[0],pd_image=filelist[1],flip_angle=20,te=5,tr=25) yield assert_equal, syn2.cmdline, ('mri_synthesize 25.00 20.00 5.000 %s %s %s' %(filelist[0],filelist[1],os.path.join(outdir,'synth-flash_20.mgz')))
unknown
codeparrot/codeparrot-clean
# Owner(s): ["module: PrivateUse1"] import numpy as np import torch import torch._C from torch.testing._internal.common_utils import run_tests, TestCase from torch.utils.backend_registration import _setup_privateuseone_for_python_backend _setup_privateuseone_for_python_backend("npy") aten = torch.ops.aten # NOTE: From https://github.com/albanD/subclass_zoo/blob/main/new_device.py # but using torch.library instead of `__torch_dispatch__` class MyDeviceTensor(torch.Tensor): @staticmethod def __new__(cls, size, dtype, raw_data=None, requires_grad=False): # Use a meta Tensor here to be used as the wrapper res = torch._C._acc.create_empty_tensor(size, dtype) res.__class__ = MyDeviceTensor return res def __init__(self, size, dtype, raw_data=None, requires_grad=False): # Store any provided user raw_data self.raw_data = raw_data def __repr__(self): return "MyDeviceTensor" + str(self.raw_data) __str__ = __repr__ def wrap(arr, shape, dtype): # hard code float32 for tests return MyDeviceTensor(shape, dtype, arr) def unwrap(arr): return arr.raw_data # Add some ops @torch.library.impl("aten::add.Tensor", "privateuseone") def add(t1, t2): out = unwrap(t1) + unwrap(t2) return wrap(out, out.shape, torch.float32) @torch.library.impl("aten::mul.Tensor", "privateuseone") def mul(t1, t2): # If unsure what should be the result's properties, you can # use the super_fn (can be useful for type promotion) out = unwrap(t1) * unwrap(t2) return wrap(out, out.shape, torch.float32) @torch.library.impl("aten::detach", "privateuseone") def detach(self): out = unwrap(self) return wrap(out, out.shape, torch.float32) @torch.library.impl("aten::empty_strided", "privateuseone") def empty_strided( size, stride, *, dtype=None, layout=None, device=None, pin_memory=None ): out = np.empty(size) return wrap(out, out.shape, torch.float32) @torch.library.impl("aten::_copy_from", "privateuseone") def _copy_from(a, b): if a.device.type == "npy": npy_data = unwrap(a) else: npy_data = a.numpy() b.raw_data = npy_data @torch.library.impl("aten::view", "privateuseone") def _view(a, b): ans = unwrap(a) return wrap(ans, a.shape, a.dtype) @torch.library.impl("aten::empty.memory_format", "privateuseone") def empty_memory_format( size, *, dtype=None, layout=None, device=None, pin_memory=None, memory_format=None ): ans = np.empty(size) return wrap(ans, ans.shape, torch.float32) @torch.library.impl("aten::sum", "privateuseone") def sum_int_list(*args, **kwargs): ans = unwrap(args[0]).sum() return wrap(ans, ans.shape, torch.float32) @torch.library.impl("aten::ones_like", "privateuseone") def ones_like( self, *, dtype=None, layout=None, device=None, pin_memory=None, memory_format=None ): ans = np.ones_like(unwrap(self)) return wrap(ans, ans.shape, torch.float32) @torch.library.impl("aten::expand", "privateuseone") def expand(self, size, *, implicit=False): ans = np.broadcast_to(self.raw_data, size) return wrap(ans, ans.shape, torch.float32) @torch.library.impl("aten::as_strided", "privateuseone") def as_strided(self, size, stride, storage_offset=None): ans = np.lib.stride_tricks.as_strided(self.raw_data, size, stride) return wrap(ans, ans.shape, torch.float32) class PrivateUse1BackendTest(TestCase): @classmethod def setupClass(cls): pass def test_accessing_is_pinned(self): a_cpu = torch.randn((2, 2)) # Assert this don't throw: _ = a_cpu.is_pinned() def test_backend_simple(self): a_cpu = torch.randn((2, 2)) b_cpu = torch.randn((2, 2)) # Assert this don't throw: a = a_cpu.to("privateuseone") b = b_cpu.to("privateuseone") a.requires_grad = True b.requires_grad = True c = (a + b).sum() c.backward() self.assertTrue(np.allclose(a.grad.raw_data, np.ones((2, 2)))) if __name__ == "__main__": run_tests()
python
github
https://github.com/pytorch/pytorch
test/test_privateuseone_python_backend.py
import json import requests import contextlib from six import u from . import exceptions RECEIPT_PRODUCTION_VALIDATION_URL = "https://buy.itunes.apple.com/verifyReceipt" RECEIPT_SANDBOX_VALIDATION_URL = "https://sandbox.itunes.apple.com/verifyReceipt" USE_PRODUCTION = True USE_SANDBOX = False def config_from_mode(mode): if mode not in ('production', 'sandbox', 'review', 'reject'): raise exceptions.ModeNotAvailable(mode) production = mode in ('production', 'review') sandbox = mode in ('sandbox', 'review') return production, sandbox def set_verification_mode(mode): """Set global verification mode that where allows production or sandbox. `production`, `sandbox`, `review` or `reject` availble. Or raise an exception. `production`: Allows production receipts only. Default. `sandbox`: Allows sandbox receipts only. `review`: Allows production receipts but use sandbox as fallback. `reject`: Reject all receipts. """ global USE_PRODUCTION, USE_SANDBOX USE_PRODUCTION, USE_SANDBOX = config_from_mode(mode) def get_verification_mode(): if USE_PRODUCTION and USE_SANDBOX: return 'review' if USE_PRODUCTION: return 'production' if USE_SANDBOX: return 'sandbox' return 'reject' class Request(object): """Validation request with raw receipt. Receipt must be base64 encoded string. Use `verify` method to try verification and get Receipt or exception. """ def __init__(self, receipt, password='', **kwargs): self.receipt = receipt self.password = password self.use_production = kwargs.get('use_production', USE_PRODUCTION) self.use_sandbox = kwargs.get('use_sandbox', USE_SANDBOX) self.response = None self.result = None def __repr__(self): valid = None if self.result: valid = self.result['status'] == 0 return u'<Request(valid:{0}, data:{1}...)>'.format(valid, self.receipt[:20]) def verify_from(self, url): """Try verification from given url.""" # If the password exists from kwargs, pass it up with the request, otherwise leave it alone if len(self.password) > 1: self.response = requests.post(url, json.dumps({'receipt-data': self.receipt, 'password': self.password}), verify=False) else: self.response = requests.post(url, json.dumps({'receipt-data': self.receipt}), verify=False) if self.response.status_code != 200: raise exceptions.ItunesServerNotAvailable(self.response.status_code, self.response.content) self.result = self._extract_receipt(self.response.json()) status = self.result['status'] if status != 0: raise exceptions.InvalidReceipt(status, receipt=self.result.get('receipt', None)) return self.result def _extract_receipt(self, receipt_data): """There are two formats that itunes iap purchase receipts are sent back in """ if 'receipt' not in receipt_data: return receipt_data in_app_purchase = receipt_data['receipt'].get('in_app', []) if len(in_app_purchase) > 0: receipt_data['receipt'].update(in_app_purchase[-1]) return receipt_data def validate(self): return self.verify() def verify(self): """Try verification with settings. Returns a Receipt object if successed. Or raise an exception. See `self.response` or `self.result` to see details. """ ex = None receipt = None assert (self.use_production or self.use_sandbox) if self.use_production: try: receipt = self.verify_from(RECEIPT_PRODUCTION_VALIDATION_URL) except exceptions.InvalidReceipt as e: ex = e if not receipt and self.use_sandbox: try: receipt = self.verify_from(RECEIPT_SANDBOX_VALIDATION_URL) except exceptions.InvalidReceipt as e: if not self.use_production: ex = e if not receipt: raise ex # raise original error return Receipt(receipt) @contextlib.contextmanager def verification_mode(self, mode): configs = self.use_production, self.use_sandbox self.use_production, self.use_sandbox = config_from_mode(mode) yield self.use_production, self.use_sandbox = configs class Receipt(object): """Pretty interface for decoded receipt obejct. """ def __init__(self, data): self.data = data self.receipt = data['receipt'] self.receipt_keys = list(self.receipt.keys()) def __repr__(self): return u'<Receipt({0}, {1})>'.format(self.status, self.receipt) @property def status(self): return self.data['status'] @property def latest_receipt(self): return self.data['latest_receipt'] def __getattr__(self, key): if key in self.receipt_keys: return self.receipt[key] try: return super(Receipt, self).__getattr__(key) except AttributeError: return super(Receipt, self).__getattribute__(key)
unknown
codeparrot/codeparrot-clean
use crate::cursor; use crate::extractor::bracket_stack::BracketStack; use crate::extractor::machine::{Machine, MachineState}; use crate::extractor::string_machine::StringMachine; use classification_macros::ClassifyBytes; /// Extracts arbitrary values including the brackets. /// /// E.g.: /// /// ```text /// bg-[#0088cc] /// ^^^^^^^^^ /// /// bg-red-500/[20%] /// ^^^^^ /// ``` #[derive(Debug, Default)] pub struct ArbitraryValueMachine { /// Track brackets to ensure they are balanced bracket_stack: BracketStack, string_machine: StringMachine, } impl Machine for ArbitraryValueMachine { #[inline(always)] fn reset(&mut self) { self.bracket_stack.reset(); } #[inline] fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState { // An arbitrary value must start with an open bracket if Class::OpenBracket != cursor.curr.into() { return MachineState::Idle; } let start_pos = cursor.pos; cursor.advance(); let len = cursor.input.len(); while cursor.pos < len { match cursor.curr.into() { Class::Escape => match cursor.next.into() { // An escaped whitespace character is not allowed // // E.g.: `[color:var(--my-\ color)]` // ^ Class::Whitespace => { cursor.advance_twice(); return self.restart(); } // An escaped character, skip the next character, resume after // // E.g.: `[color:var(--my-\#color)]` // ^ _ => cursor.advance_twice(), }, Class::OpenParen | Class::OpenBracket | Class::OpenCurly => { if !self.bracket_stack.push(cursor.curr) { return self.restart(); } cursor.advance(); } Class::CloseParen | Class::CloseBracket | Class::CloseCurly if !self.bracket_stack.is_empty() => { if !self.bracket_stack.pop(cursor.curr) { return self.restart(); } cursor.advance(); } // End of an arbitrary value // // 1. All brackets must be balanced // 2. There must be at least a single character inside the brackets Class::CloseBracket if start_pos + 1 != cursor.pos && self.bracket_stack.is_empty() => { return self.done(start_pos, cursor); } // Start of a string Class::Quote => match self.string_machine.next(cursor) { MachineState::Idle => return self.restart(), MachineState::Done(_) => cursor.advance(), }, // Any kind of whitespace is not allowed Class::Whitespace => return self.restart(), // String interpolation-like syntax is not allowed. E.g.: `[${x}]` Class::Dollar if matches!(cursor.next.into(), Class::OpenCurly) => { return self.restart() } // Everything else is valid _ => cursor.advance(), }; } self.restart() } } #[derive(Clone, Copy, PartialEq, ClassifyBytes)] enum Class { #[bytes(b'\\')] Escape, #[bytes(b'(')] OpenParen, #[bytes(b')')] CloseParen, #[bytes(b'[')] OpenBracket, #[bytes(b']')] CloseBracket, #[bytes(b'{')] OpenCurly, #[bytes(b'}')] CloseCurly, #[bytes(b'"', b'\'', b'`')] Quote, #[bytes(b' ', b'\t', b'\n', b'\r', b'\x0C')] Whitespace, #[bytes(b'$')] Dollar, #[fallback] Other, } #[cfg(test)] mod tests { use super::ArbitraryValueMachine; use crate::extractor::machine::Machine; use pretty_assertions::assert_eq; #[test] #[ignore] fn test_arbitrary_value_machine_performance() { let input = r#"<div class="[color:red] [[data-foo]] [url('https://tailwindcss.com')] [url(https://tailwindcss.com)]"></div>"#.repeat(100); ArbitraryValueMachine::test_throughput(100_000, &input); ArbitraryValueMachine::test_duration_once(&input); todo!() } #[test] fn test_arbitrary_value_machine_extraction() { for (input, expected) in [ // Simple variable ("[#0088cc]", vec!["[#0088cc]"]), // With parentheses ( "[url(https://tailwindcss.com)]", vec!["[url(https://tailwindcss.com)]"], ), // With strings, where bracket balancing doesn't matter ("['[({])}']", vec!["['[({])}']"]), // With strings later in the input ( "[url('https://tailwindcss.com?[{]}')]", vec!["[url('https://tailwindcss.com?[{]}')]"], ), // With nested brackets ("[[data-foo]]", vec!["[[data-foo]]"]), ( "[&>[data-slot=icon]:last-child]", vec!["[&>[data-slot=icon]:last-child]"], ), // With data types ("[length:32rem]", vec!["[length:32rem]"]), // Spaces are not allowed ("[ #0088cc ]", vec![]), // Unbalanced brackets are not allowed ("[foo[bar]", vec![]), // Empty brackets are not allowed ("[]", vec![]), ] { assert_eq!(ArbitraryValueMachine::test_extract_all(input), expected); } } #[test] fn test_exceptions() { for (input, expected) in [ // JS string interpolation ("[${x}]", vec![]), ("[url(${x})]", vec![]), // Allowed in strings ("[url('${x}')]", vec!["[url('${x}')]"]), ] { assert_eq!(ArbitraryValueMachine::test_extract_all(input), expected); } } }
rust
github
https://github.com/tailwindlabs/tailwindcss
crates/oxide/src/extractor/arbitrary_value_machine.rs
# This file is part of beets. # Copyright 2015, Thomas Scholtes. # # 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. from _common import unittest from helper import TestHelper from beets.mediafile import MediaFile class InfoTest(unittest.TestCase, TestHelper): def setUp(self): self.setup_beets() self.load_plugins('info') def tearDown(self): self.unload_plugins() self.teardown_beets() def run_command(self, *args): super(InfoTest, self).run_command('info', *args) def test_path(self): path = self.create_mediafile_fixture() mediafile = MediaFile(path) mediafile.albumartist = 'AAA' mediafile.disctitle = 'DDD' mediafile.genres = ['a', 'b', 'c'] mediafile.composer = None mediafile.save() out = self.run_with_output(path) self.assertIn(path, out) self.assertIn('albumartist: AAA', out) self.assertIn('disctitle: DDD', out) self.assertIn('genres: a; b; c', out) self.assertNotIn('composer:', out) def test_item_query(self): items = self.add_item_fixtures(count=2) items[0].album = 'xxxx' items[0].write() items[0].album = 'yyyy' items[0].store() out = self.run_with_output('album:yyyy') self.assertIn(items[0].path, out) self.assertIn('album: xxxx', out) self.assertNotIn(items[1].path, out) def test_item_library_query(self): item, = self.add_item_fixtures() item.album = 'xxxx' item.store() out = self.run_with_output('--library', 'album:xxxx') self.assertIn(item.path, out) self.assertIn('album: xxxx', out) def test_collect_item_and_path(self): path = self.create_mediafile_fixture() mediafile = MediaFile(path) item, = self.add_item_fixtures() item.album = mediafile.album = 'AAA' item.tracktotal = mediafile.tracktotal = 5 item.title = 'TTT' mediafile.title = 'SSS' item.write() item.store() mediafile.save() out = self.run_with_output('--summarize', 'album:AAA', path) self.assertIn('album: AAA', out) self.assertIn('tracktotal: 5', out) self.assertIn('title: [various]', out) def suite(): return unittest.TestLoader().loadTestsFromName(__name__) if __name__ == '__main__': unittest.main(defaultTest='suite')
unknown
codeparrot/codeparrot-clean
/* * Copyright 2002-2025 the original author or authors. * * 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. */ package org.springframework.docs.web.webmvc.mvcservlet.mvccontainerconfig import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer // tag::snippet[] class MyWebAppInitializer : AbstractAnnotationConfigDispatcherServletInitializer() { override fun getRootConfigClasses(): Array<Class<*>>? { return null } override fun getServletConfigClasses(): Array<Class<*>>? { return arrayOf(MyWebConfig::class.java) } override fun getServletMappings(): Array<String> { return arrayOf("/") } } // end::snippet[] class MyWebConfig
kotlin
github
https://github.com/spring-projects/spring-framework
framework-docs/src/main/kotlin/org/springframework/docs/web/webmvc/mvcservlet/mvccontainerconfig/MyWebAppInitializer.kt
# Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * 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. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # 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. import hashlib import os import shutil import sys import tarfile import imp from testrunner.local import testsuite from testrunner.local import utils from testrunner.objects import testcase TEST_262_ARCHIVE_REVISION = "61113db" # This is the 2014-10-23 revision. TEST_262_ARCHIVE_MD5 = "261e69b4a97a4bfc18225cf3938daf50" TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" TEST_262_HARNESS_FILES = ["sta.js"] TEST_262_SUITE_PATH = ["data", "test", "suite"] TEST_262_HARNESS_PATH = ["data", "test", "harness"] TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] class Test262TestSuite(testsuite.TestSuite): def __init__(self, name, root): super(Test262TestSuite, self).__init__(name, root) self.testroot = os.path.join(self.root, *TEST_262_SUITE_PATH) self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_PATH) self.harness = [os.path.join(self.harnesspath, f) for f in TEST_262_HARNESS_FILES] self.harness += [os.path.join(self.root, "harness-adapt.js")] self.ParseTestRecord = None def CommonTestName(self, testcase): return testcase.path.split(os.path.sep)[-1] def ListTests(self, context): tests = [] for dirname, dirs, files in os.walk(self.testroot): for dotted in [x for x in dirs if x.startswith(".")]: dirs.remove(dotted) if context.noi18n and "intl402" in dirs: dirs.remove("intl402") dirs.sort() files.sort() for filename in files: if filename.endswith(".js"): testname = os.path.join(dirname[len(self.testroot) + 1:], filename[:-3]) case = testcase.TestCase(self, testname) tests.append(case) return tests def GetFlagsForTestCase(self, testcase, context): return (testcase.flags + context.mode_flags + self.harness + self.GetIncludesForTest(testcase) + ["--harmony"] + [os.path.join(self.testroot, testcase.path + ".js")]) def LoadParseTestRecord(self): if not self.ParseTestRecord: root = os.path.join(self.root, *TEST_262_TOOLS_PATH) f = None try: (f, pathname, description) = imp.find_module("parseTestRecord", [root]) module = imp.load_module("parseTestRecord", f, pathname, description) self.ParseTestRecord = module.parseTestRecord except: raise ImportError("Cannot load parseTestRecord; you may need to " "--download-data for test262") finally: if f: f.close() return self.ParseTestRecord def GetTestRecord(self, testcase): if not hasattr(testcase, "test_record"): ParseTestRecord = self.LoadParseTestRecord() testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase), testcase.path) return testcase.test_record def GetIncludesForTest(self, testcase): test_record = self.GetTestRecord(testcase) if "includes" in test_record: includes = [os.path.join(self.harnesspath, f) for f in test_record["includes"]] else: includes = [] return includes def GetSourceForTest(self, testcase): filename = os.path.join(self.testroot, testcase.path + ".js") with open(filename) as f: return f.read() def IsNegativeTest(self, testcase): test_record = self.GetTestRecord(testcase) return "negative" in test_record def IsFailureOutput(self, output, testpath): if output.exit_code != 0: return True return "FAILED!" in output.stdout def DownloadData(self): revision = TEST_262_ARCHIVE_REVISION archive_url = TEST_262_URL % revision archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) directory_name = os.path.join(self.root, "data") directory_old_name = os.path.join(self.root, "data.old") if not os.path.exists(archive_name): print "Downloading test data from %s ..." % archive_url utils.URLRetrieve(archive_url, archive_name) if os.path.exists(directory_name): if os.path.exists(directory_old_name): shutil.rmtree(directory_old_name) os.rename(directory_name, directory_old_name) if not os.path.exists(directory_name): print "Extracting test262-%s.tar.gz ..." % revision md5 = hashlib.md5() with open(archive_name, "rb") as f: for chunk in iter(lambda: f.read(8192), ""): md5.update(chunk) print "MD5 hash is %s" % md5.hexdigest() if md5.hexdigest() != TEST_262_ARCHIVE_MD5: os.remove(archive_name) print "MD5 expected %s" % TEST_262_ARCHIVE_MD5 raise Exception("MD5 hash mismatch of test data file") archive = tarfile.open(archive_name, "r:gz") if sys.platform in ("win32", "cygwin"): # Magic incantation to allow longer path names on Windows. archive.extractall(u"\\\\?\\%s" % self.root) else: archive.extractall(self.root) os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), directory_name) def GetSuite(name, root): return Test262TestSuite(name, root)
unknown
codeparrot/codeparrot-clean
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Mark Pilgrim - port to Python # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301 USA ######################### END LICENSE BLOCK ######################### from .charsetprober import CharSetProber from .codingstatemachine import CodingStateMachine from .enums import LanguageFilter, ProbingState, MachineState from .escsm import (HZ_SM_MODEL, ISO2022CN_SM_MODEL, ISO2022JP_SM_MODEL, ISO2022KR_SM_MODEL) class EscCharSetProber(CharSetProber): """ This CharSetProber uses a "code scheme" approach for detecting encodings, whereby easily recognizable escape or shift sequences are relied on to identify these encodings. """ def __init__(self, lang_filter=None): super(EscCharSetProber, self).__init__(lang_filter=lang_filter) self.coding_sm = [] if self.lang_filter & LanguageFilter.CHINESE_SIMPLIFIED: self.coding_sm.append(CodingStateMachine(HZ_SM_MODEL)) self.coding_sm.append(CodingStateMachine(ISO2022CN_SM_MODEL)) if self.lang_filter & LanguageFilter.JAPANESE: self.coding_sm.append(CodingStateMachine(ISO2022JP_SM_MODEL)) if self.lang_filter & LanguageFilter.KOREAN: self.coding_sm.append(CodingStateMachine(ISO2022KR_SM_MODEL)) self.active_sm_count = None self._detected_charset = None self._detected_language = None self._state = None self.reset() def reset(self): super(EscCharSetProber, self).reset() for coding_sm in self.coding_sm: if not coding_sm: continue coding_sm.active = True coding_sm.reset() self.active_sm_count = len(self.coding_sm) self._detected_charset = None self._detected_language = None @property def charset_name(self): return self._detected_charset @property def language(self): return self._detected_language def get_confidence(self): if self._detected_charset: return 0.99 else: return 0.00 def feed(self, byte_str): for c in byte_str: for coding_sm in self.coding_sm: if not coding_sm or not coding_sm.active: continue coding_state = coding_sm.next_state(c) if coding_state == MachineState.ERROR: coding_sm.active = False self.active_sm_count -= 1 if self.active_sm_count <= 0: self._state = ProbingState.NOT_ME return self.state elif coding_state == MachineState.ITS_ME: self._state = ProbingState.FOUND_IT self._detected_charset = coding_sm.get_coding_state_machine() self._detected_language = coding_sm.language return self.state return self.state
unknown
codeparrot/codeparrot-clean
import {throwInput} from 'shared-runtime'; function Component(props) { const object = { foo() { try { throwInput([props.value]); } catch (e) { return e; } }, }; return object.foo(); } export const FIXTURE_ENTRYPOINT = { fn: Component, params: [{value: 42}], };
javascript
github
https://github.com/facebook/react
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/try-catch-within-object-method-returns-caught-value.js
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.kafka.clients.producer.internals; import org.apache.kafka.clients.ApiVersions; import org.apache.kafka.clients.ClientResponse; import org.apache.kafka.clients.NodeApiVersions; import org.apache.kafka.clients.RequestCompletionHandler; import org.apache.kafka.clients.consumer.CommitFailedException; import org.apache.kafka.clients.consumer.ConsumerGroupMetadata; import org.apache.kafka.clients.consumer.OffsetAndMetadata; import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.common.KafkaException; import org.apache.kafka.common.Node; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.errors.AuthenticationException; import org.apache.kafka.common.errors.ClusterAuthorizationException; import org.apache.kafka.common.errors.GroupAuthorizationException; import org.apache.kafka.common.errors.InvalidPidMappingException; import org.apache.kafka.common.errors.InvalidProducerEpochException; import org.apache.kafka.common.errors.InvalidTxnStateException; import org.apache.kafka.common.errors.OutOfOrderSequenceException; import org.apache.kafka.common.errors.ProducerFencedException; import org.apache.kafka.common.errors.RetriableException; import org.apache.kafka.common.errors.TopicAuthorizationException; import org.apache.kafka.common.errors.TransactionAbortableException; import org.apache.kafka.common.errors.TransactionalIdAuthorizationException; import org.apache.kafka.common.errors.UnknownProducerIdException; import org.apache.kafka.common.errors.UnsupportedVersionException; import org.apache.kafka.common.message.AddOffsetsToTxnRequestData; import org.apache.kafka.common.message.ApiVersionsResponseData.ApiVersion; import org.apache.kafka.common.message.EndTxnRequestData; import org.apache.kafka.common.message.FindCoordinatorRequestData; import org.apache.kafka.common.message.FindCoordinatorResponseData.Coordinator; import org.apache.kafka.common.message.InitProducerIdRequestData; import org.apache.kafka.common.protocol.ApiKeys; import org.apache.kafka.common.protocol.Errors; import org.apache.kafka.common.record.internal.RecordBatch; import org.apache.kafka.common.requests.AbstractRequest; import org.apache.kafka.common.requests.AbstractResponse; import org.apache.kafka.common.requests.AddOffsetsToTxnRequest; import org.apache.kafka.common.requests.AddOffsetsToTxnResponse; import org.apache.kafka.common.requests.AddPartitionsToTxnRequest; import org.apache.kafka.common.requests.AddPartitionsToTxnResponse; import org.apache.kafka.common.requests.EndTxnRequest; import org.apache.kafka.common.requests.EndTxnResponse; import org.apache.kafka.common.requests.FindCoordinatorRequest; import org.apache.kafka.common.requests.FindCoordinatorRequest.CoordinatorType; import org.apache.kafka.common.requests.FindCoordinatorResponse; import org.apache.kafka.common.requests.InitProducerIdRequest; import org.apache.kafka.common.requests.InitProducerIdResponse; import org.apache.kafka.common.requests.ProduceResponse; import org.apache.kafka.common.requests.TransactionResult; import org.apache.kafka.common.requests.TxnOffsetCommitRequest; import org.apache.kafka.common.requests.TxnOffsetCommitRequest.CommittedOffset; import org.apache.kafka.common.requests.TxnOffsetCommitResponse; import org.apache.kafka.common.utils.LogContext; import org.apache.kafka.common.utils.ProducerIdAndEpoch; import org.slf4j.Logger; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.OptionalInt; import java.util.OptionalLong; import java.util.PriorityQueue; import java.util.Set; import java.util.function.Supplier; /** * A class which maintains state for transactions. Also keeps the state necessary to ensure idempotent production. */ public class TransactionManager { private static final int NO_INFLIGHT_REQUEST_CORRELATION_ID = -1; private final Logger log; private final String transactionalId; private final int transactionTimeoutMs; private final ApiVersions apiVersions; private final TxnPartitionMap txnPartitionMap; private final Map<TopicPartition, CommittedOffset> pendingTxnOffsetCommits; // If a batch bound for a partition expired locally after being sent at least once, the partition is considered // to have an unresolved state. We keep track of such partitions here, and cannot assign any more sequence numbers // for this partition until the unresolved state gets cleared. This may happen if other inflight batches returned // successfully (indicating that the expired batch actually made it to the broker). If we don't get any successful // responses for the partition once the inflight request count falls to zero, we reset the producer id and // consequently clear this data structure as well. // The value of the map is the sequence number of the batch following the expired one, computed by adding its // record count to its sequence number. This is used to tell if a subsequent batch is the one immediately following // the expired one. private final Map<TopicPartition, Integer> partitionsWithUnresolvedSequences; // The partitions that have received an error that triggers an epoch bump. When the epoch is bumped, these // partitions will have the sequences of their in-flight batches rewritten private final Set<TopicPartition> partitionsToRewriteSequences; private final PriorityQueue<TxnRequestHandler> pendingRequests; private final Set<TopicPartition> newPartitionsInTransaction; private final Set<TopicPartition> pendingPartitionsInTransaction; private final Set<TopicPartition> partitionsInTransaction; private PendingStateTransition pendingTransition; // This is used by the TxnRequestHandlers to control how long to back off before a given request is retried. // For instance, this value is lowered by the AddPartitionsToTxnHandler when it receives a CONCURRENT_TRANSACTIONS // error for the first AddPartitionsRequest in a transaction. private final long retryBackoffMs; // The retryBackoff is overridden to the following value if the first AddPartitions receives a // CONCURRENT_TRANSACTIONS error. private static final long ADD_PARTITIONS_RETRY_BACKOFF_MS = 20L; private int inFlightRequestCorrelationId = NO_INFLIGHT_REQUEST_CORRELATION_ID; private Node transactionCoordinator; private Node consumerGroupCoordinator; private boolean coordinatorSupportsBumpingEpoch; private volatile State currentState = State.UNINITIALIZED; private volatile RuntimeException lastError = null; private volatile ProducerIdAndEpoch producerIdAndEpoch; private volatile boolean transactionStarted = false; private volatile boolean clientSideEpochBumpRequired = false; private volatile long latestFinalizedFeaturesEpoch = -1; private volatile boolean isTransactionV2Enabled = false; private final boolean enable2PC; private volatile ProducerIdAndEpoch preparedTxnState = ProducerIdAndEpoch.NONE; private enum State { UNINITIALIZED, INITIALIZING, READY, IN_TRANSACTION, PREPARED_TRANSACTION, COMMITTING_TRANSACTION, ABORTING_TRANSACTION, ABORTABLE_ERROR, FATAL_ERROR; private boolean isTransitionValid(State source, State target) { switch (target) { case UNINITIALIZED: return source == READY || source == ABORTABLE_ERROR; case INITIALIZING: return source == UNINITIALIZED || source == COMMITTING_TRANSACTION || source == ABORTING_TRANSACTION; case READY: return source == INITIALIZING || source == COMMITTING_TRANSACTION || source == ABORTING_TRANSACTION; case IN_TRANSACTION: return source == READY; case PREPARED_TRANSACTION: return source == IN_TRANSACTION || source == INITIALIZING; case COMMITTING_TRANSACTION: return source == IN_TRANSACTION || source == PREPARED_TRANSACTION; case ABORTING_TRANSACTION: return source == IN_TRANSACTION || source == PREPARED_TRANSACTION || source == ABORTABLE_ERROR; case ABORTABLE_ERROR: return source == IN_TRANSACTION || source == COMMITTING_TRANSACTION || source == ABORTABLE_ERROR || source == INITIALIZING; case FATAL_ERROR: default: // We can transition to FATAL_ERROR unconditionally. // FATAL_ERROR is never a valid starting state for any transition. So the only option is to close the // producer or do purely non transactional requests. return true; } } } // We use the priority to determine the order in which requests need to be sent out. For instance, if we have // a pending FindCoordinator request, that must always go first. Next, If we need a producer id, that must go second. // The endTxn request must always go last, unless we are bumping the epoch (a special case of InitProducerId) as // part of ending the transaction. private enum Priority { FIND_COORDINATOR(0), INIT_PRODUCER_ID(1), ADD_PARTITIONS_OR_OFFSETS(2), END_TXN(3), EPOCH_BUMP(4); final int priority; Priority(int priority) { this.priority = priority; } } private enum TransactionOperation { SEND("send"), BEGIN_TRANSACTION("beginTransaction"), PREPARE_TRANSACTION("prepareTransaction"), SEND_OFFSETS_TO_TRANSACTION("sendOffsetsToTransaction"); final String displayName; TransactionOperation(String displayName) { this.displayName = displayName; } @Override public String toString() { return displayName; } } public TransactionManager(final LogContext logContext, final String transactionalId, final int transactionTimeoutMs, final long retryBackoffMs, final ApiVersions apiVersions, final boolean enable2PC) { this.producerIdAndEpoch = ProducerIdAndEpoch.NONE; this.transactionalId = transactionalId; this.log = logContext.logger(TransactionManager.class); this.transactionTimeoutMs = transactionTimeoutMs; this.transactionCoordinator = null; this.consumerGroupCoordinator = null; this.newPartitionsInTransaction = new HashSet<>(); this.pendingPartitionsInTransaction = new HashSet<>(); this.partitionsInTransaction = new HashSet<>(); this.pendingRequests = new PriorityQueue<>(10, Comparator.comparingInt(o -> o.priority().priority)); this.pendingTxnOffsetCommits = new HashMap<>(); this.partitionsWithUnresolvedSequences = new HashMap<>(); this.partitionsToRewriteSequences = new HashSet<>(); this.retryBackoffMs = retryBackoffMs; this.txnPartitionMap = new TxnPartitionMap(logContext); this.apiVersions = apiVersions; this.enable2PC = enable2PC; } /** * During its normal course of operations, the transaction manager transitions through different internal * states (i.e. by updating {@link #currentState}) to one of those defined in {@link State}. These state transitions * result from actions on one of the following classes of threads: * * <ul> * <li><em>Application</em> threads that invokes {@link Producer} API calls</li> * <li><em>{@link Sender}</em> thread operations</li> * </ul> * * When an invalid state transition is detected during execution on an <em>application</em> thread, the * {@link #currentState} is <em>not updated</em> and an {@link IllegalStateException} is thrown. This gives the * application the opportunity to fix the issue without permanently poisoning the state of the * transaction manager. The {@link Producer} API calls that perform a state transition include: * * <ul> * <li>{@link Producer#initTransactions()} calls {@link #initializeTransactions(boolean)}</li> * <li>{@link Producer#beginTransaction()} calls {@link #beginTransaction()}</li> * <li>{@link Producer#commitTransaction()}} calls {@link #beginCommit()}</li> * <li>{@link Producer#abortTransaction()} calls {@link #beginAbort()} * </li> * <li>{@link Producer#sendOffsetsToTransaction(Map, ConsumerGroupMetadata)} calls * {@link #sendOffsetsToTransaction(Map, ConsumerGroupMetadata)} * </li> * <li>{@link Producer#send(ProducerRecord)} (and its variants) calls * {@link #maybeAddPartition(TopicPartition)} and * {@link #maybeTransitionToErrorState(RuntimeException)} * </li> * </ul> * * <p/> * * The {@link Producer} is implemented such that much of its work delegated to and performed asynchronously on the * <em>{@link Sender}</em> thread. This includes record batching, network I/O, broker response handlers, etc. If an * invalid state transition is detected in the <em>{@link Sender}</em> thread, in addition to throwing an * {@link IllegalStateException}, the transaction manager intentionally "poisons" itself by setting its * {@link #currentState} to {@link State#FATAL_ERROR}, a state from which it cannot recover. * * <p/> * * It's important to prevent possible corruption when the transaction manager has determined that it is in a * fatal state. Subsequent transaction operations attempted via either the <em>application</em> or the * <em>{@link Sender}</em> thread should fail. This is achieved when these operations invoke the * {@link #maybeFailWithError()} method, as it causes a {@link KafkaException} to be thrown, ensuring the stated * transactional guarantees are not violated. * * <p/> * * See KAFKA-14831 for more detail. * * @return {@code true} to set state to {@link State#FATAL_ERROR} before throwing an exception, * {@code false} to throw an exception without first changing the state */ protected boolean shouldPoisonStateOnInvalidTransition() { return Thread.currentThread() instanceof Sender.SenderThread; } synchronized TransactionalRequestResult initializeTransactions(ProducerIdAndEpoch producerIdAndEpoch) { return initializeTransactions(producerIdAndEpoch, false); } public synchronized TransactionalRequestResult initializeTransactions(boolean keepPreparedTxn) { return initializeTransactions(ProducerIdAndEpoch.NONE, keepPreparedTxn); } synchronized TransactionalRequestResult initializeTransactions( ProducerIdAndEpoch producerIdAndEpoch, boolean keepPreparedTxn ) { maybeFailWithError(); boolean isEpochBump = producerIdAndEpoch != ProducerIdAndEpoch.NONE; return handleCachedTransactionRequestResult(() -> { // If this is an epoch bump, we will transition the state as part of handling the EndTxnRequest if (!isEpochBump) { transitionTo(State.INITIALIZING); log.info("Invoking InitProducerId for the first time in order to acquire a producer ID"); if (keepPreparedTxn) { log.info("Invoking InitProducerId with keepPreparedTxn set to true for 2PC transactions"); } } else { log.info("Invoking InitProducerId with current producer ID and epoch {} in order to bump the epoch", producerIdAndEpoch); } InitProducerIdRequestData requestData = new InitProducerIdRequestData() .setTransactionalId(transactionalId) .setTransactionTimeoutMs(transactionTimeoutMs) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setEnable2Pc(enable2PC) .setKeepPreparedTxn(keepPreparedTxn); InitProducerIdHandler handler = new InitProducerIdHandler(new InitProducerIdRequest.Builder(requestData), isEpochBump); enqueueRequest(handler); return handler.result; }, State.INITIALIZING, "initTransactions"); } public synchronized void beginTransaction() { ensureTransactional(); throwIfPendingState(TransactionOperation.BEGIN_TRANSACTION); maybeFailWithError(); transitionTo(State.IN_TRANSACTION); } /** * Prepare a transaction for a two-phase commit. * This transitions the transaction to the PREPARED_TRANSACTION state. * The preparedTxnState is set with the current producer ID and epoch. */ public synchronized void prepareTransaction() { ensureTransactional(); throwIfPendingState(TransactionOperation.PREPARE_TRANSACTION); maybeFailWithError(); transitionTo(State.PREPARED_TRANSACTION); this.preparedTxnState = new ProducerIdAndEpoch( this.producerIdAndEpoch.producerId, this.producerIdAndEpoch.epoch ); } public synchronized TransactionalRequestResult beginCommit() { return handleCachedTransactionRequestResult(() -> { maybeFailWithError(); transitionTo(State.COMMITTING_TRANSACTION); return beginCompletingTransaction(TransactionResult.COMMIT); }, State.COMMITTING_TRANSACTION, "commitTransaction"); } public synchronized TransactionalRequestResult beginAbort() { return handleCachedTransactionRequestResult(() -> { if (currentState != State.ABORTABLE_ERROR) maybeFailWithError(); transitionTo(State.ABORTING_TRANSACTION); // We're aborting the transaction, so there should be no need to add new partitions newPartitionsInTransaction.clear(); return beginCompletingTransaction(TransactionResult.ABORT); }, State.ABORTING_TRANSACTION, "abortTransaction"); } private TransactionalRequestResult beginCompletingTransaction(TransactionResult transactionResult) { if (!newPartitionsInTransaction.isEmpty()) enqueueRequest(addPartitionsToTransactionHandler()); EndTxnRequest.Builder builder = new EndTxnRequest.Builder( new EndTxnRequestData() .setTransactionalId(transactionalId) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setCommitted(transactionResult.id), isTransactionV2Enabled ); // Maybe update the transaction version here before we enqueue the EndTxn request so there are no races with // completion of the EndTxn request. Since this method may update clientSideEpochBumpRequired, we want to update // before the check below, but we also want to call it after the EndTxnRequest.Builder so we complete the transaction // with the same version as it started. maybeUpdateTransactionV2Enabled(false); EndTxnHandler handler = new EndTxnHandler(builder); enqueueRequest(handler); // If an epoch bump is required for recovery, initialize the transaction after completing the EndTxn request. // If we are upgrading to TV2 transactions on the next transaction, also bump the epoch. if (clientSideEpochBumpRequired) { return initializeTransactions(this.producerIdAndEpoch); } return handler.result; } public synchronized TransactionalRequestResult sendOffsetsToTransaction(final Map<TopicPartition, OffsetAndMetadata> offsets, final ConsumerGroupMetadata groupMetadata) { ensureTransactional(); throwIfPendingState(TransactionOperation.SEND_OFFSETS_TO_TRANSACTION); maybeFailWithError(); if (currentState != State.IN_TRANSACTION) { throw new IllegalStateException("Cannot send offsets if a transaction is not in progress " + "(currentState= " + currentState + ")"); } // In transaction V2, the client will skip sending AddOffsetsToTxn before sending txnOffsetCommit. TxnRequestHandler handler; if (isTransactionV2Enabled()) { log.debug("Begin adding offsets {} for consumer group {} to transaction with transaction protocol V2", offsets, groupMetadata); handler = txnOffsetCommitHandler(null, offsets, groupMetadata); transactionStarted = true; } else { log.debug("Begin adding offsets {} for consumer group {} to transaction", offsets, groupMetadata); AddOffsetsToTxnRequest.Builder builder = new AddOffsetsToTxnRequest.Builder( new AddOffsetsToTxnRequestData() .setTransactionalId(transactionalId) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setGroupId(groupMetadata.groupId()) ); handler = new AddOffsetsToTxnHandler(builder, offsets, groupMetadata); } enqueueRequest(handler); return handler.result; } public synchronized void maybeAddPartition(TopicPartition topicPartition) { maybeFailWithError(); throwIfPendingState(TransactionOperation.SEND); if (isTransactional()) { if (!hasProducerId()) { throw new IllegalStateException("Cannot add partition " + topicPartition + " to transaction before completing a call to initTransactions"); } else if (currentState != State.IN_TRANSACTION) { throw new IllegalStateException("Cannot add partition " + topicPartition + " to transaction while in state " + currentState); } else if (isTransactionV2Enabled()) { txnPartitionMap.getOrCreate(topicPartition); partitionsInTransaction.add(topicPartition); transactionStarted = true; } else if (transactionContainsPartition(topicPartition) || isPartitionPendingAdd(topicPartition)) { return; } else { log.debug("Begin adding new partition {} to transaction", topicPartition); txnPartitionMap.getOrCreate(topicPartition); newPartitionsInTransaction.add(topicPartition); } } } RuntimeException lastError() { return lastError; } synchronized boolean isSendToPartitionAllowed(TopicPartition tp) { if (hasFatalError()) return false; return !isTransactional() || partitionsInTransaction.contains(tp); } public String transactionalId() { return transactionalId; } public boolean hasProducerId() { return producerIdAndEpoch.isValid(); } public boolean isTransactional() { return transactionalId != null; } /** * Check all the finalized features from apiVersions to verify whether the transaction V2 is enabled. * Sets clientSideEpochBumpRequired if upgrading to V2 since we need to bump the epoch. * This is because V2 no longer adds partitions explicitly and there are some edge cases on upgrade * that can be avoided by fencing the old V1 transaction epoch. For example, we won't consider * partitions from the previous transaction as already added to the new V2 transaction if the epoch is fenced. */ public synchronized void maybeUpdateTransactionV2Enabled(boolean onInitiatialization) { if (latestFinalizedFeaturesEpoch >= apiVersions.getMaxFinalizedFeaturesEpoch()) { return; } ApiVersions.FinalizedFeaturesInfo info = apiVersions.getFinalizedFeaturesInfo(); latestFinalizedFeaturesEpoch = info.finalizedFeaturesEpoch; Short transactionVersion = info.finalizedFeatures.get("transaction.version"); boolean wasTransactionV2Enabled = isTransactionV2Enabled; isTransactionV2Enabled = transactionVersion != null && transactionVersion >= 2; log.debug("Updating isTV2 enabled to {} with FinalizedFeaturesEpoch {}", isTransactionV2Enabled, latestFinalizedFeaturesEpoch); if (!onInitiatialization && !wasTransactionV2Enabled && isTransactionV2Enabled) clientSideEpochBumpRequired = true; } public boolean isTransactionV2Enabled() { return isTransactionV2Enabled; } public boolean is2PCEnabled() { return enable2PC; } synchronized boolean hasPartitionsToAdd() { return !newPartitionsInTransaction.isEmpty() || !pendingPartitionsInTransaction.isEmpty(); } synchronized boolean isCompleting() { return currentState == State.COMMITTING_TRANSACTION || currentState == State.ABORTING_TRANSACTION; } synchronized boolean hasError() { return currentState == State.ABORTABLE_ERROR || currentState == State.FATAL_ERROR; } synchronized boolean isAborting() { return currentState == State.ABORTING_TRANSACTION; } synchronized void transitionToAbortableError(RuntimeException exception) { if (currentState == State.ABORTING_TRANSACTION) { log.debug("Skipping transition to abortable error state since the transaction is already being " + "aborted. Underlying exception: ", exception); return; } log.info("Transiting to abortable error state due to {}", exception.toString()); transitionTo(State.ABORTABLE_ERROR, exception); } synchronized void transitionToFatalError(RuntimeException exception) { log.info("Transiting to fatal error state due to {}", exception.toString()); transitionTo(State.FATAL_ERROR, exception); if (pendingTransition != null) { pendingTransition.result.fail(exception); } } /** * Transitions to an abortable error state if the coordinator can handle an abortable error or * to a fatal error if not. * * @param abortableException The exception in case of an abortable error. * @param fatalException The exception in case of a fatal error. */ private void transitionToAbortableErrorOrFatalError( RuntimeException abortableException, RuntimeException fatalException ) { if (canHandleAbortableError()) { if (needToTriggerEpochBumpFromClient()) clientSideEpochBumpRequired = true; transitionToAbortableError(abortableException); } else { transitionToFatalError(fatalException); } } // visible for testing synchronized boolean isPartitionPendingAdd(TopicPartition partition) { return newPartitionsInTransaction.contains(partition) || pendingPartitionsInTransaction.contains(partition); } /** * Get the current producer id and epoch without blocking. Callers must use {@link ProducerIdAndEpoch#isValid()} to * verify that the result is valid. * * @return the current ProducerIdAndEpoch. */ ProducerIdAndEpoch producerIdAndEpoch() { return producerIdAndEpoch; } public synchronized void maybeUpdateProducerIdAndEpoch(TopicPartition topicPartition) { if (hasFatalError()) { log.debug("Ignoring producer ID and epoch update request since the producer is in fatal error state"); return; } if (hasStaleProducerIdAndEpoch(topicPartition) && !hasInflightBatches(topicPartition)) { // If the batch was on a different ID and/or epoch (due to an epoch bump) and all its in-flight batches // have completed, reset the partition sequence so that the next batch (with the new epoch) starts from 0 txnPartitionMap.startSequencesAtBeginning(topicPartition, this.producerIdAndEpoch); log.debug("ProducerId of partition {} set to {} with epoch {}. Reinitialize sequence at beginning.", topicPartition, producerIdAndEpoch.producerId, producerIdAndEpoch.epoch); } } /** * Set the producer id and epoch atomically. */ private void setProducerIdAndEpoch(ProducerIdAndEpoch producerIdAndEpoch) { // With TV2, the epoch bump is common and frequent. Only log if it is at debug level or the producer ID is changed. if (!isTransactional() || !isTransactionV2Enabled || producerIdAndEpoch.producerId != this.producerIdAndEpoch.producerId) { log.info("ProducerId set to {} with epoch {}", producerIdAndEpoch.producerId, producerIdAndEpoch.epoch); } else { log.debug("ProducerId set to {} with epoch {}", producerIdAndEpoch.producerId, producerIdAndEpoch.epoch); } this.producerIdAndEpoch = producerIdAndEpoch; } /** * This method resets the producer ID and epoch and sets the state to UNINITIALIZED, which will trigger a new * InitProducerId request. This method is only called when the producer epoch is exhausted; we will bump the epoch * instead. */ private void resetIdempotentProducerId() { if (isTransactional()) throw new IllegalStateException("Cannot reset producer state for a transactional producer. " + "You must either abort the ongoing transaction or reinitialize the transactional producer instead"); log.debug("Resetting idempotent producer ID. ID and epoch before reset are {}", this.producerIdAndEpoch); setProducerIdAndEpoch(ProducerIdAndEpoch.NONE); transitionTo(State.UNINITIALIZED); } private void resetSequenceForPartition(TopicPartition topicPartition) { txnPartitionMap.remove(topicPartition); this.partitionsWithUnresolvedSequences.remove(topicPartition); } private void resetSequenceNumbers() { txnPartitionMap.reset(); this.partitionsWithUnresolvedSequences.clear(); } /** * This method is used to trigger an epoch bump for non-transactional idempotent producers. */ synchronized void requestIdempotentEpochBumpForPartition(TopicPartition tp) { clientSideEpochBumpRequired = true; this.partitionsToRewriteSequences.add(tp); } private void bumpIdempotentProducerEpoch() { if (this.producerIdAndEpoch.epoch == Short.MAX_VALUE) { resetIdempotentProducerId(); } else { setProducerIdAndEpoch(new ProducerIdAndEpoch(this.producerIdAndEpoch.producerId, (short) (this.producerIdAndEpoch.epoch + 1))); log.debug("Incremented producer epoch, current producer ID and epoch are now {}", this.producerIdAndEpoch); } // When the epoch is bumped, rewrite all in-flight sequences for the partition(s) that triggered the epoch bump for (TopicPartition topicPartition : this.partitionsToRewriteSequences) { this.txnPartitionMap.startSequencesAtBeginning(topicPartition, this.producerIdAndEpoch); this.partitionsWithUnresolvedSequences.remove(topicPartition); } this.partitionsToRewriteSequences.clear(); clientSideEpochBumpRequired = false; } synchronized void bumpIdempotentEpochAndResetIdIfNeeded() { if (!isTransactional()) { if (clientSideEpochBumpRequired) { bumpIdempotentProducerEpoch(); } if (currentState != State.INITIALIZING && !hasProducerId()) { transitionTo(State.INITIALIZING); InitProducerIdRequestData requestData = new InitProducerIdRequestData() .setTransactionalId(null) .setTransactionTimeoutMs(Integer.MAX_VALUE); InitProducerIdHandler handler = new InitProducerIdHandler(new InitProducerIdRequest.Builder(requestData), false); enqueueRequest(handler); } } } /** * Returns the next sequence number to be written to the given TopicPartition. */ synchronized int sequenceNumber(TopicPartition topicPartition) { return txnPartitionMap.getOrCreate(topicPartition).nextSequence(); } /** * Returns the current producer id/epoch of the given TopicPartition. */ synchronized ProducerIdAndEpoch producerIdAndEpoch(TopicPartition topicPartition) { return txnPartitionMap.getOrCreate(topicPartition).producerIdAndEpoch(); } synchronized void incrementSequenceNumber(TopicPartition topicPartition, int increment) { txnPartitionMap.get(topicPartition).incrementSequence(increment); } synchronized void addInFlightBatch(ProducerBatch batch) { if (!batch.hasSequence()) throw new IllegalStateException("Can't track batch for partition " + batch.topicPartition + " when sequence is not set."); txnPartitionMap.get(batch.topicPartition).addInflightBatch(batch); } /** * Returns the first inflight sequence for a given partition. This is the base sequence of an inflight batch with * the lowest sequence number. * @return the lowest inflight sequence if the transaction manager is tracking inflight requests for this partition. * If there are no inflight requests being tracked for this partition, this method will return * RecordBatch.NO_SEQUENCE. */ synchronized int firstInFlightSequence(TopicPartition topicPartition) { if (!hasInflightBatches(topicPartition)) return RecordBatch.NO_SEQUENCE; ProducerBatch batch = nextBatchBySequence(topicPartition); return batch == null ? RecordBatch.NO_SEQUENCE : batch.baseSequence(); } synchronized ProducerBatch nextBatchBySequence(TopicPartition topicPartition) { return txnPartitionMap.nextBatchBySequence(topicPartition); } synchronized void removeInFlightBatch(ProducerBatch batch) { if (hasInflightBatches(batch.topicPartition)) txnPartitionMap.removeInFlightBatch(batch); } private int maybeUpdateLastAckedSequence(TopicPartition topicPartition, int sequence) { return txnPartitionMap.maybeUpdateLastAckedSequence(topicPartition, sequence); } synchronized OptionalInt lastAckedSequence(TopicPartition topicPartition) { return txnPartitionMap.lastAckedSequence(topicPartition); } synchronized OptionalLong lastAckedOffset(TopicPartition topicPartition) { return txnPartitionMap.lastAckedOffset(topicPartition); } private void updateLastAckedOffset(ProduceResponse.PartitionResponse response, ProducerBatch batch) { if (response.baseOffset == ProduceResponse.INVALID_OFFSET) return; long lastOffset = response.baseOffset + batch.recordCount - 1; txnPartitionMap.updateLastAckedOffset(batch.topicPartition, isTransactional(), lastOffset); } public synchronized void handleCompletedBatch(ProducerBatch batch, ProduceResponse.PartitionResponse response) { int lastAckedSequence = maybeUpdateLastAckedSequence(batch.topicPartition, batch.lastSequence()); log.trace("ProducerId: {}; Set last ack'd sequence number for topic-partition {} to {}", batch.producerId(), batch.topicPartition, lastAckedSequence); updateLastAckedOffset(response, batch); removeInFlightBatch(batch); } public synchronized void transitionToUninitialized(RuntimeException exception) { transitionTo(State.UNINITIALIZED); if (pendingTransition != null) { pendingTransition.result.fail(exception); } lastError = null; } public synchronized void maybeTransitionToErrorState(RuntimeException exception) { if (exception instanceof ClusterAuthorizationException || exception instanceof TransactionalIdAuthorizationException || exception instanceof ProducerFencedException || exception instanceof UnsupportedVersionException || exception instanceof InvalidPidMappingException) { transitionToFatalError(exception); } else if (isTransactional()) { // RetriableExceptions from the Sender thread are converted to Abortable errors // because they indicate that the transaction cannot be completed after all retry attempts. // This conversion ensures the application layer treats these errors as abortable, // preventing duplicate message delivery. if (exception instanceof RetriableException || exception instanceof InvalidTxnStateException) { exception = new TransactionAbortableException("Transaction Request was aborted after exhausting retries.", exception); } if (needToTriggerEpochBumpFromClient() && !isCompleting()) { clientSideEpochBumpRequired = true; } transitionToAbortableError(exception); } } synchronized void handleFailedBatch(ProducerBatch batch, RuntimeException exception, boolean adjustSequenceNumbers) { maybeTransitionToErrorState(exception); removeInFlightBatch(batch); if (hasFatalError()) { log.debug("Ignoring batch {} with producer id {}, epoch {}, and sequence number {} " + "since the producer is already in fatal error state", batch, batch.producerId(), batch.producerEpoch(), batch.baseSequence(), exception); return; } if (exception instanceof OutOfOrderSequenceException && !isTransactional()) { log.error("The broker returned {} for topic-partition {} with producerId {}, epoch {}, and sequence number {}", exception, batch.topicPartition, batch.producerId(), batch.producerEpoch(), batch.baseSequence()); // If we fail with an OutOfOrderSequenceException, we have a gap in the log. Bump the epoch for this // partition, which will reset the sequence number to 0 and allow us to continue requestIdempotentEpochBumpForPartition(batch.topicPartition); } else if (exception instanceof UnknownProducerIdException) { // If we get an UnknownProducerId for a partition, then the broker has no state for that producer. It will // therefore accept a write with sequence number 0. We reset the sequence number for the partition here so // that the producer can continue after aborting the transaction. All inflight-requests to this partition // will also fail with an UnknownProducerId error, so the sequence will remain at 0. Note that if the // broker supports bumping the epoch, we will later reset all sequence numbers after calling InitProducerId resetSequenceForPartition(batch.topicPartition); } else { if (adjustSequenceNumbers) { if (!isTransactional()) { requestIdempotentEpochBumpForPartition(batch.topicPartition); } else { txnPartitionMap.adjustSequencesDueToFailedBatch(batch); } } } } synchronized boolean hasInflightBatches(TopicPartition topicPartition) { return txnPartitionMap.getOrCreate(topicPartition).hasInflightBatches(); } synchronized boolean hasStaleProducerIdAndEpoch(TopicPartition topicPartition) { return !producerIdAndEpoch.equals(txnPartitionMap.getOrCreate(topicPartition).producerIdAndEpoch()); } synchronized boolean hasUnresolvedSequences() { return !partitionsWithUnresolvedSequences.isEmpty(); } synchronized boolean hasUnresolvedSequence(TopicPartition topicPartition) { return partitionsWithUnresolvedSequences.containsKey(topicPartition); } synchronized void markSequenceUnresolved(ProducerBatch batch) { int nextSequence = batch.lastSequence() + 1; partitionsWithUnresolvedSequences.compute(batch.topicPartition, (k, v) -> v == null ? nextSequence : Math.max(v, nextSequence)); log.debug("Marking partition {} unresolved with next sequence number {}", batch.topicPartition, partitionsWithUnresolvedSequences.get(batch.topicPartition)); } // Attempts to resolve unresolved sequences. If all in-flight requests are complete and some partitions are still // unresolved, either bump the epoch if possible, or transition to a fatal error synchronized void maybeResolveSequences() { for (Iterator<TopicPartition> iter = partitionsWithUnresolvedSequences.keySet().iterator(); iter.hasNext(); ) { TopicPartition topicPartition = iter.next(); if (!hasInflightBatches(topicPartition)) { // The partition has been fully drained. At this point, the last ack'd sequence should be one less than // next sequence destined for the partition. If so, the partition is fully resolved. If not, we should // reset the sequence number if necessary. if (isNextSequence(topicPartition, sequenceNumber(topicPartition))) { // This would happen when a batch was expired, but subsequent batches succeeded. iter.remove(); } else { // We would enter this branch if all in flight batches were ultimately expired in the producer. if (isTransactional()) { // For the transactional producer, we bump the epoch if possible, otherwise we transition to a fatal error String unackedMessagesErr = "The client hasn't received acknowledgment for some previously " + "sent messages and can no longer retry them. "; KafkaException abortableException = new KafkaException(unackedMessagesErr + "It is safe to abort " + "the transaction and continue."); KafkaException fatalException = new KafkaException(unackedMessagesErr + "It isn't safe to continue."); transitionToAbortableErrorOrFatalError(abortableException, fatalException); } else { // For the idempotent producer, bump the epoch log.info("No inflight batches remaining for {}, last ack'd sequence for partition is {}, next sequence is {}. " + "Going to bump epoch and reset sequence numbers.", topicPartition, lastAckedSequence(topicPartition).orElse(TxnPartitionEntry.NO_LAST_ACKED_SEQUENCE_NUMBER), sequenceNumber(topicPartition)); requestIdempotentEpochBumpForPartition(topicPartition); } iter.remove(); } } } } private boolean isNextSequence(TopicPartition topicPartition, int sequence) { return sequence - lastAckedSequence(topicPartition).orElse(TxnPartitionEntry.NO_LAST_ACKED_SEQUENCE_NUMBER) == 1; } private boolean isNextSequenceForUnresolvedPartition(TopicPartition topicPartition, int sequence) { return this.hasUnresolvedSequence(topicPartition) && sequence == this.partitionsWithUnresolvedSequences.get(topicPartition); } synchronized TxnRequestHandler nextRequest(boolean hasIncompleteBatches) { if (!newPartitionsInTransaction.isEmpty()) enqueueRequest(addPartitionsToTransactionHandler()); TxnRequestHandler nextRequestHandler = pendingRequests.peek(); if (nextRequestHandler == null) return null; // Do not send the EndTxn until all batches have been flushed if (nextRequestHandler.isEndTxn() && hasIncompleteBatches) return null; pendingRequests.poll(); if (maybeTerminateRequestWithError(nextRequestHandler)) { log.trace("Not sending transactional request {} because we are in an error state", nextRequestHandler.requestBuilder()); return null; } if (nextRequestHandler.isEndTxn() && !transactionStarted) { nextRequestHandler.result.done(); if (currentState != State.FATAL_ERROR) { if (isTransactionV2Enabled) { log.debug("Not sending EndTxn for completed transaction since no send " + "or sendOffsetsToTransaction were triggered"); } else { log.debug("Not sending EndTxn for completed transaction since no partitions " + "or offsets were successfully added"); } resetTransactionState(); } nextRequestHandler = pendingRequests.poll(); } if (nextRequestHandler != null) log.trace("Request {} dequeued for sending", nextRequestHandler.requestBuilder()); return nextRequestHandler; } synchronized void retry(TxnRequestHandler request) { request.setRetry(); enqueueRequest(request); } synchronized void authenticationFailed(AuthenticationException e) { for (TxnRequestHandler request : pendingRequests) request.fatalError(e); } synchronized void failPendingRequests(RuntimeException exception) { pendingRequests.forEach(handler -> handler.abortableError(exception)); } synchronized void close() { KafkaException shutdownException = new KafkaException("The producer closed forcefully"); pendingRequests.forEach(handler -> handler.fatalError(shutdownException)); if (pendingTransition != null) { pendingTransition.result.fail(shutdownException); } } Node coordinator(FindCoordinatorRequest.CoordinatorType type) { switch (type) { case GROUP: return consumerGroupCoordinator; case TRANSACTION: return transactionCoordinator; default: throw new IllegalStateException("Received an invalid coordinator type: " + type); } } void lookupCoordinator(TxnRequestHandler request) { lookupCoordinator(request.coordinatorType(), request.coordinatorKey()); } void setInFlightCorrelationId(int correlationId) { inFlightRequestCorrelationId = correlationId; } private void clearInFlightCorrelationId() { inFlightRequestCorrelationId = NO_INFLIGHT_REQUEST_CORRELATION_ID; } boolean hasInFlightRequest() { return inFlightRequestCorrelationId != NO_INFLIGHT_REQUEST_CORRELATION_ID; } // visible for testing. boolean hasFatalError() { return currentState == State.FATAL_ERROR; } // visible for testing. boolean hasAbortableError() { return currentState == State.ABORTABLE_ERROR; } // visible for testing public synchronized boolean transactionContainsPartition(TopicPartition topicPartition) { return partitionsInTransaction.contains(topicPartition); } // visible for testing synchronized boolean hasPendingOffsetCommits() { return !pendingTxnOffsetCommits.isEmpty(); } synchronized boolean hasPendingRequests() { return !pendingRequests.isEmpty(); } // visible for testing synchronized boolean hasOngoingTransaction() { // transactions are considered ongoing once started until completion or a fatal error return currentState == State.IN_TRANSACTION || isCompleting() || hasAbortableError(); } synchronized boolean canRetry(ProduceResponse.PartitionResponse response, ProducerBatch batch) { Errors error = response.error; // An UNKNOWN_PRODUCER_ID means that we have lost the producer state on the broker. Depending on the log start // offset, we may want to retry these, as described for each case below. If none of those apply, then for the // idempotent producer, we will locally bump the epoch and reset the sequence numbers of in-flight batches from // sequence 0, then retry the failed batch, which should now succeed. For the transactional producer, allow the // batch to fail. When processing the failed batch, we will transition to an abortable error and set a flag // indicating that we need to bump the epoch (if supported by the broker). if (error == Errors.UNKNOWN_PRODUCER_ID) { if (response.logStartOffset == -1) { // We don't know the log start offset with this response. We should just retry the request until we get it. // The UNKNOWN_PRODUCER_ID error code was added along with the new ProduceResponse which includes the // logStartOffset. So the '-1' sentinel is not for backward compatibility. Instead, it is possible for // a broker to not know the logStartOffset at when it is returning the response because the partition // may have moved away from the broker from the time the error was initially raised to the time the // response was being constructed. In these cases, we should just retry the request: we are guaranteed // to eventually get a logStartOffset once things settle down. return true; } if (batch.sequenceHasBeenReset()) { // When the first inflight batch fails due to the truncation case, then the sequences of all the other // in flight batches would have been restarted from the beginning. However, when those responses // come back from the broker, they would also come with an UNKNOWN_PRODUCER_ID error. In this case, we should not // reset the sequence numbers to the beginning. return true; } else if (lastAckedOffset(batch.topicPartition).orElse(TxnPartitionEntry.NO_LAST_ACKED_SEQUENCE_NUMBER) < response.logStartOffset) { // The head of the log has been removed, probably due to the retention time elapsing. In this case, // we expect to lose the producer state. For the transactional producer, reset the sequences of all // inflight batches to be from the beginning and retry them, so that the transaction does not need to // be aborted. For the idempotent producer, bump the epoch to avoid reusing (sequence, epoch) pairs if (isTransactional()) { txnPartitionMap.startSequencesAtBeginning(batch.topicPartition, this.producerIdAndEpoch); } else { requestIdempotentEpochBumpForPartition(batch.topicPartition); } return true; } if (!isTransactional()) { // For the idempotent producer, always retry UNKNOWN_PRODUCER_ID errors. If the batch has the current // producer ID and epoch, request a bump of the epoch. Otherwise just retry the produce. requestIdempotentEpochBumpForPartition(batch.topicPartition); return true; } } else if (error == Errors.OUT_OF_ORDER_SEQUENCE_NUMBER) { if (!hasUnresolvedSequence(batch.topicPartition) && (batch.sequenceHasBeenReset() || !isNextSequence(batch.topicPartition, batch.baseSequence()))) { // We should retry the OutOfOrderSequenceException if the batch is _not_ the next batch, ie. its base // sequence isn't the lastAckedSequence + 1. return true; } else if (!isTransactional()) { // For the idempotent producer, retry all OUT_OF_ORDER_SEQUENCE_NUMBER errors. If there are no // unresolved sequences, or this batch is the one immediately following an unresolved sequence, we know // there is actually a gap in the sequences, and we bump the epoch. Otherwise, retry without bumping // and wait to see if the sequence resolves if (!hasUnresolvedSequence(batch.topicPartition) || isNextSequenceForUnresolvedPartition(batch.topicPartition, batch.baseSequence())) { requestIdempotentEpochBumpForPartition(batch.topicPartition); } return true; } } // If neither of the above cases are true, retry if the exception is retriable return error.exception() instanceof RetriableException; } // visible for testing synchronized boolean isReady() { return isTransactional() && currentState == State.READY; } // visible for testing synchronized boolean isInitializing() { return isTransactional() && currentState == State.INITIALIZING; } /** * Check if the transaction is in the prepared state. * * @return true if the current state is PREPARED_TRANSACTION */ public synchronized boolean isPrepared() { return currentState == State.PREPARED_TRANSACTION; } void handleCoordinatorReady() { NodeApiVersions nodeApiVersions = transactionCoordinator != null ? apiVersions.get(transactionCoordinator.idString()) : null; ApiVersion initProducerIdVersion = nodeApiVersions != null ? nodeApiVersions.apiVersion(ApiKeys.INIT_PRODUCER_ID) : null; this.coordinatorSupportsBumpingEpoch = initProducerIdVersion != null && initProducerIdVersion.maxVersion() >= 3; } private void transitionTo(State target) { transitionTo(target, null); } private void transitionTo(State target, RuntimeException error) { if (!currentState.isTransitionValid(currentState, target)) { String idString = transactionalId == null ? "" : "TransactionalId " + transactionalId + ": "; String message = idString + "Invalid transition attempted from state " + currentState.name() + " to state " + target.name(); if (shouldPoisonStateOnInvalidTransition()) { currentState = State.FATAL_ERROR; lastError = new IllegalStateException(message); throw lastError; } else { throw new IllegalStateException(message); } } else if (target == State.FATAL_ERROR || target == State.ABORTABLE_ERROR) { if (error == null) throw new IllegalArgumentException("Cannot transition to " + target + " with a null exception"); lastError = error; } else { lastError = null; } if (lastError != null) log.debug("Transition from state {} to error state {}", currentState, target, lastError); else log.debug("Transition from state {} to {}", currentState, target); currentState = target; } private void ensureTransactional() { if (!isTransactional()) throw new IllegalStateException("Transactional method invoked on a non-transactional producer."); } private void maybeFailWithError() { if (!hasError()) { return; } // for ProducerFencedException, do not wrap it as a KafkaException // but create a new instance without the call trace since it was not thrown because of the current call if (lastError instanceof ProducerFencedException) { throw new ProducerFencedException("Producer with transactionalId '" + transactionalId + "' and " + producerIdAndEpoch + " has been fenced by another producer " + "with the same transactionalId"); } if (lastError instanceof InvalidProducerEpochException) { throw new InvalidProducerEpochException("Producer with transactionalId '" + transactionalId + "' and " + producerIdAndEpoch + " attempted to produce with an old epoch"); } if (lastError instanceof IllegalStateException) { throw new IllegalStateException("Producer with transactionalId '" + transactionalId + "' and " + producerIdAndEpoch + " cannot execute transactional method because of previous invalid state transition attempt", lastError); } throw new KafkaException("Cannot execute transactional method because we are in an error state", lastError); } private boolean maybeTerminateRequestWithError(TxnRequestHandler requestHandler) { if (hasError()) { if (hasAbortableError() && requestHandler instanceof FindCoordinatorHandler) // No harm letting the FindCoordinator request go through if we're expecting to abort return false; requestHandler.fail(lastError); return true; } return false; } private void enqueueRequest(TxnRequestHandler requestHandler) { log.debug("Enqueuing transactional request {}", requestHandler.requestBuilder()); pendingRequests.add(requestHandler); } private void lookupCoordinator(FindCoordinatorRequest.CoordinatorType type, String coordinatorKey) { switch (type) { case GROUP: consumerGroupCoordinator = null; break; case TRANSACTION: transactionCoordinator = null; break; default: throw new IllegalStateException("Invalid coordinator type: " + type); } FindCoordinatorRequestData data = new FindCoordinatorRequestData() .setKeyType(type.id()) .setKey(coordinatorKey); FindCoordinatorRequest.Builder builder = new FindCoordinatorRequest.Builder(data); enqueueRequest(new FindCoordinatorHandler(builder)); } private TxnRequestHandler addPartitionsToTransactionHandler() { pendingPartitionsInTransaction.addAll(newPartitionsInTransaction); newPartitionsInTransaction.clear(); AddPartitionsToTxnRequest.Builder builder = AddPartitionsToTxnRequest.Builder.forClient(transactionalId, producerIdAndEpoch.producerId, producerIdAndEpoch.epoch, new ArrayList<>(pendingPartitionsInTransaction)); return new AddPartitionsToTxnHandler(builder); } private TxnOffsetCommitHandler txnOffsetCommitHandler(TransactionalRequestResult result, Map<TopicPartition, OffsetAndMetadata> offsets, ConsumerGroupMetadata groupMetadata) { for (Map.Entry<TopicPartition, OffsetAndMetadata> entry : offsets.entrySet()) { OffsetAndMetadata offsetAndMetadata = entry.getValue(); CommittedOffset committedOffset = new CommittedOffset(offsetAndMetadata.offset(), offsetAndMetadata.metadata(), offsetAndMetadata.leaderEpoch()); pendingTxnOffsetCommits.put(entry.getKey(), committedOffset); } final TxnOffsetCommitRequest.Builder builder = new TxnOffsetCommitRequest.Builder(transactionalId, groupMetadata.groupId(), producerIdAndEpoch.producerId, producerIdAndEpoch.epoch, pendingTxnOffsetCommits, groupMetadata.memberId(), groupMetadata.generationId(), groupMetadata.groupInstanceId(), isTransactionV2Enabled() ); if (result == null) { // In this case, transaction V2 is in use. return new TxnOffsetCommitHandler(builder); } return new TxnOffsetCommitHandler(result, builder); } private void throwIfPendingState(TransactionOperation operation) { if (pendingTransition != null) { if (pendingTransition.result.isAcked()) { pendingTransition = null; } else { throw new IllegalStateException("Cannot attempt operation `" + operation + "` " + "because the previous call to `" + pendingTransition.operation + "` " + "timed out and must be retried"); } } } private TransactionalRequestResult handleCachedTransactionRequestResult( Supplier<TransactionalRequestResult> transactionalRequestResultSupplier, State nextState, String operation ) { ensureTransactional(); if (pendingTransition != null) { if (pendingTransition.result.isAcked()) { pendingTransition = null; } else if (nextState != pendingTransition.state) { throw new IllegalStateException("Cannot attempt operation `" + operation + "` " + "because the previous call to `" + pendingTransition.operation + "` " + "timed out and must be retried"); } else { return pendingTransition.result; } } TransactionalRequestResult result = transactionalRequestResultSupplier.get(); pendingTransition = new PendingStateTransition(result, nextState, operation); return result; } /** * Determines if an epoch bump can be triggered manually based on the api versions. * * <b>NOTE:</b> * This method should only be used for transactional producers. * For non-transactional producers epoch bumping is always allowed. * * <ol> * <li><b>Client-Triggered Epoch Bump</b>: * If the coordinator supports epoch bumping (initProducerIdVersion.maxVersion() >= 3), * client-triggered epoch bumping is allowed, returns true. * <code>clientSideEpochBumpTriggerRequired</code> must be set to true in this case.</li> * * <li><b>No Epoch Bump Allowed</b>: * If the coordinator does not support epoch bumping, returns false.</li> * * <li><b>Server-Triggered Only</b>: * When TransactionV2 is enabled, epoch bumping is handled automatically * by the server in EndTxn, so manual epoch bumping is not required, returns false.</li> * </ol> * * @return true if a client-triggered epoch bump is allowed, otherwise false. */ // package-private for testing boolean needToTriggerEpochBumpFromClient() { return coordinatorSupportsBumpingEpoch && !isTransactionV2Enabled; } /** * Determines if the coordinator can handle an abortable error. * Recovering from an abortable error requires an epoch bump which can be triggered by the client * or automatically taken care of at the end of every transaction (Transaction V2). * Use <code>needToTriggerEpochBumpFromClient</code> to check whether the epoch bump needs to be triggered * manually. * * <b>NOTE:</b> * This method should only be used for transactional producers. * There is no concept of abortable errors for idempotent producers. * * @return true if an abortable error can be handled, otherwise false. */ boolean canHandleAbortableError() { return coordinatorSupportsBumpingEpoch || isTransactionV2Enabled; } private void resetTransactionState() { if (clientSideEpochBumpRequired) { transitionTo(State.INITIALIZING); } else { transitionTo(State.READY); } lastError = null; clientSideEpochBumpRequired = false; transactionStarted = false; newPartitionsInTransaction.clear(); pendingPartitionsInTransaction.clear(); partitionsInTransaction.clear(); preparedTxnState = ProducerIdAndEpoch.NONE; } abstract class TxnRequestHandler implements RequestCompletionHandler { protected final TransactionalRequestResult result; private boolean isRetry = false; TxnRequestHandler(TransactionalRequestResult result) { this.result = result; } TxnRequestHandler(String operation) { this(new TransactionalRequestResult(operation)); } void fatalError(RuntimeException e) { result.fail(e); transitionToFatalError(e); } void abortableError(RuntimeException e) { result.fail(e); transitionToAbortableError(e); } /** * Determines if an error should be treated as abortable or fatal, based on transaction state and configuration. * <ol><l> NOTE: Only use this method for transactional producers </l></ol> * * - <b>Abortable Error</b>: * An abortable error can be handled effectively, if epoch bumping is supported. * 1) If transactionV2 is enabled, automatic epoch bumping happens at the end of every transaction. * 2) If the client can trigger an epoch bump, the abortable error can be handled. * *- <b>Fatal Error</b>: * If epoch bumping is not supported, the system cannot recover and the error must be treated as fatal. * @param e the error to determine as either abortable or fatal. */ void abortableErrorIfPossible(RuntimeException e) { if (canHandleAbortableError()) { if (needToTriggerEpochBumpFromClient()) clientSideEpochBumpRequired = true; abortableError(e); } else { fatalError(e); } } void fail(RuntimeException e) { result.fail(e); } void reenqueue() { synchronized (TransactionManager.this) { this.isRetry = true; enqueueRequest(this); } } long retryBackoffMs() { return retryBackoffMs; } @Override public void onComplete(ClientResponse response) { if (response.requestHeader().correlationId() != inFlightRequestCorrelationId) { fatalError(new RuntimeException("Detected more than one in-flight transactional request.")); } else { clearInFlightCorrelationId(); if (response.wasDisconnected()) { log.debug("Disconnected from {}. Will retry.", response.destination()); if (this.needsCoordinator()) lookupCoordinator(this.coordinatorType(), this.coordinatorKey()); reenqueue(); } else if (response.versionMismatch() != null) { fatalError(response.versionMismatch()); } else if (response.hasResponse()) { log.trace("Received transactional response {} for request {}", response.responseBody(), requestBuilder()); synchronized (TransactionManager.this) { handleResponse(response.responseBody()); } } else { fatalError(new KafkaException("Could not execute transactional request for unknown reasons")); } } } boolean needsCoordinator() { return coordinatorType() != null; } FindCoordinatorRequest.CoordinatorType coordinatorType() { return FindCoordinatorRequest.CoordinatorType.TRANSACTION; } String coordinatorKey() { return transactionalId; } void setRetry() { this.isRetry = true; } boolean isRetry() { return isRetry; } boolean isEndTxn() { return false; } abstract AbstractRequest.Builder<?> requestBuilder(); abstract void handleResponse(AbstractResponse responseBody); abstract Priority priority(); } private class InitProducerIdHandler extends TxnRequestHandler { private final InitProducerIdRequest.Builder builder; private final boolean isEpochBump; private InitProducerIdHandler(InitProducerIdRequest.Builder builder, boolean isEpochBump) { super("InitProducerId"); this.builder = builder; this.isEpochBump = isEpochBump; } @Override InitProducerIdRequest.Builder requestBuilder() { return builder; } @Override Priority priority() { return this.isEpochBump ? Priority.EPOCH_BUMP : Priority.INIT_PRODUCER_ID; } @Override FindCoordinatorRequest.CoordinatorType coordinatorType() { if (isTransactional()) { return FindCoordinatorRequest.CoordinatorType.TRANSACTION; } else { return null; } } @Override public void handleResponse(AbstractResponse response) { InitProducerIdResponse initProducerIdResponse = (InitProducerIdResponse) response; Errors error = initProducerIdResponse.error(); if (error == Errors.NONE) { ProducerIdAndEpoch producerIdAndEpoch = new ProducerIdAndEpoch(initProducerIdResponse.data().producerId(), initProducerIdResponse.data().producerEpoch()); setProducerIdAndEpoch(producerIdAndEpoch); // If this is a transaction with keepPreparedTxn=true, transition directly // to PREPARED_TRANSACTION state IFF there is an ongoing transaction. if (builder.data.keepPreparedTxn() && initProducerIdResponse.data().ongoingTxnProducerId() != RecordBatch.NO_PRODUCER_ID ) { transitionTo(State.PREPARED_TRANSACTION); // Update the preparedTxnState with the ongoing pid and epoch from the response. // This will be used to complete the transaction later. TransactionManager.this.preparedTxnState = new ProducerIdAndEpoch( initProducerIdResponse.data().ongoingTxnProducerId(), initProducerIdResponse.data().ongoingTxnProducerEpoch() ); } else { transitionTo(State.READY); } lastError = null; if (this.isEpochBump) { resetSequenceNumbers(); } result.done(); } else if (error == Errors.NOT_COORDINATOR || error == Errors.COORDINATOR_NOT_AVAILABLE) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error.exception() instanceof RetriableException) { reenqueue(); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.CLUSTER_AUTHORIZATION_FAILED) { log.info("Abortable authorization error: {}. Transition the producer state to {}", error.message(), State.ABORTABLE_ERROR); lastError = error.exception(); abortableError(error.exception()); } else if (error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.PRODUCER_FENCED) { // We could still receive INVALID_PRODUCER_EPOCH from old versioned transaction coordinator, // just treat it the same as PRODUCE_FENCED. fatalError(Errors.PRODUCER_FENCED.exception()); } else if (error == Errors.TRANSACTION_ABORTABLE) { abortableError(error.exception()); } else { fatalError(new KafkaException("Unexpected error in InitProducerIdResponse; " + error.message())); } } } private class AddPartitionsToTxnHandler extends TxnRequestHandler { private final AddPartitionsToTxnRequest.Builder builder; private long retryBackoffMs; private AddPartitionsToTxnHandler(AddPartitionsToTxnRequest.Builder builder) { super("AddPartitionsToTxn"); this.builder = builder; this.retryBackoffMs = TransactionManager.this.retryBackoffMs; } @Override AddPartitionsToTxnRequest.Builder requestBuilder() { return builder; } @Override Priority priority() { return Priority.ADD_PARTITIONS_OR_OFFSETS; } @Override public void handleResponse(AbstractResponse response) { AddPartitionsToTxnResponse addPartitionsToTxnResponse = (AddPartitionsToTxnResponse) response; Map<TopicPartition, Errors> errors = addPartitionsToTxnResponse.errors().get(AddPartitionsToTxnResponse.V3_AND_BELOW_TXN_ID); boolean hasPartitionErrors = false; Set<String> unauthorizedTopics = new HashSet<>(); retryBackoffMs = TransactionManager.this.retryBackoffMs; for (Map.Entry<TopicPartition, Errors> topicPartitionErrorEntry : errors.entrySet()) { TopicPartition topicPartition = topicPartitionErrorEntry.getKey(); Errors error = topicPartitionErrorEntry.getValue(); if (error == Errors.NONE) { continue; } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); return; } else if (error == Errors.CONCURRENT_TRANSACTIONS) { maybeOverrideRetryBackoffMs(); reenqueue(); return; } else if (error.exception() instanceof RetriableException) { reenqueue(); return; } else if (error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.PRODUCER_FENCED) { // We could still receive INVALID_PRODUCER_EPOCH from old versioned transaction coordinator, // just treat it the same as PRODUCE_FENCED. fatalError(Errors.PRODUCER_FENCED.exception()); return; } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.INVALID_TXN_STATE || error == Errors.INVALID_PRODUCER_ID_MAPPING) { fatalError(error.exception()); return; } else if (error == Errors.TOPIC_AUTHORIZATION_FAILED) { unauthorizedTopics.add(topicPartition.topic()); } else if (error == Errors.OPERATION_NOT_ATTEMPTED) { log.debug("Did not attempt to add partition {} to transaction because other partitions in the " + "batch had errors.", topicPartition); hasPartitionErrors = true; } else if (error == Errors.UNKNOWN_PRODUCER_ID) { abortableErrorIfPossible(error.exception()); return; } else if (error == Errors.TRANSACTION_ABORTABLE) { abortableError(error.exception()); return; } else { log.error("Could not add partition {} due to unexpected error {}", topicPartition, error); hasPartitionErrors = true; } } Set<TopicPartition> partitions = errors.keySet(); // Remove the partitions from the pending set regardless of the result. We use the presence // of partitions in the pending set to know when it is not safe to send batches. However, if // the partitions failed to be added and we enter an error state, we expect the batches to be // aborted anyway. In this case, we must be able to continue sending the batches which are in // retry for partitions that were successfully added. pendingPartitionsInTransaction.removeAll(partitions); if (!unauthorizedTopics.isEmpty()) { abortableError(new TopicAuthorizationException(unauthorizedTopics)); } else if (hasPartitionErrors) { abortableError(new KafkaException("Could not add partitions to transaction due to errors: " + errors)); } else { log.debug("Successfully added partitions {} to transaction", partitions); partitionsInTransaction.addAll(partitions); transactionStarted = true; result.done(); } } @Override public long retryBackoffMs() { return Math.min(TransactionManager.this.retryBackoffMs, this.retryBackoffMs); } private void maybeOverrideRetryBackoffMs() { // We only want to reduce the backoff when retrying the first AddPartition which errored out due to a // CONCURRENT_TRANSACTIONS error since this means that the previous transaction is still completing and // we don't want to wait too long before trying to start the new one. // // This is only a temporary fix, the long term solution is being tracked in // https://issues.apache.org/jira/browse/KAFKA-5482 if (partitionsInTransaction.isEmpty()) this.retryBackoffMs = ADD_PARTITIONS_RETRY_BACKOFF_MS; } } private class FindCoordinatorHandler extends TxnRequestHandler { private final FindCoordinatorRequest.Builder builder; private FindCoordinatorHandler(FindCoordinatorRequest.Builder builder) { super("FindCoordinator"); this.builder = builder; } @Override FindCoordinatorRequest.Builder requestBuilder() { return builder; } @Override Priority priority() { return Priority.FIND_COORDINATOR; } @Override FindCoordinatorRequest.CoordinatorType coordinatorType() { return null; } @Override String coordinatorKey() { return null; } @Override public void handleResponse(AbstractResponse response) { CoordinatorType coordinatorType = CoordinatorType.forId(builder.data().keyType()); List<Coordinator> coordinators = ((FindCoordinatorResponse) response).coordinators(); if (coordinators.size() != 1) { log.error("Group coordinator lookup failed: Invalid response containing more than a single coordinator"); fatalError(new IllegalStateException("Group coordinator lookup failed: Invalid response containing more than a single coordinator")); } Coordinator coordinatorData = coordinators.get(0); // For older versions without batching, obtain key from request data since it is not included in response String key = coordinatorData.key() == null ? builder.data().key() : coordinatorData.key(); Errors error = Errors.forCode(coordinatorData.errorCode()); if (error == Errors.NONE) { Node node = new Node(coordinatorData.nodeId(), coordinatorData.host(), coordinatorData.port()); switch (coordinatorType) { case GROUP: consumerGroupCoordinator = node; break; case TRANSACTION: transactionCoordinator = node; break; default: log.error("Group coordinator lookup failed: Unexpected coordinator type in response"); fatalError(new IllegalStateException("Group coordinator lookup failed: Unexpected coordinator type in response")); } result.done(); log.info("Discovered {} coordinator {}", coordinatorType.toString().toLowerCase(Locale.ROOT), node); } else if (error.exception() instanceof RetriableException) { reenqueue(); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED) { fatalError(error.exception()); } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { abortableError(GroupAuthorizationException.forGroupId(key)); } else if (error == Errors.TRANSACTION_ABORTABLE) { abortableError(error.exception()); } else { fatalError(new KafkaException(String.format("Could not find a coordinator with type %s with key %s due to " + "unexpected error: %s", coordinatorType, key, coordinatorData.errorMessage()))); } } } private class EndTxnHandler extends TxnRequestHandler { private final EndTxnRequest.Builder builder; private EndTxnHandler(EndTxnRequest.Builder builder) { super("EndTxn(" + builder.data.committed() + ")"); this.builder = builder; } @Override EndTxnRequest.Builder requestBuilder() { return builder; } @Override Priority priority() { return Priority.END_TXN; } @Override boolean isEndTxn() { return true; } @Override public void handleResponse(AbstractResponse response) { EndTxnResponse endTxnResponse = (EndTxnResponse) response; Errors error = endTxnResponse.error(); boolean isAbort = !builder.data.committed(); if (error == Errors.NONE) { // For End Txn version 5+, the broker includes the producerId and producerEpoch in the EndTxnResponse. // For versions lower than 5, the producer Id and epoch are set to -1 by default. // When Transaction Version 2 is enabled, the end txn request 5+ is used, // it mandates bumping the epoch after every transaction. // If the epoch overflows, a new producerId is returned with epoch set to 0. // Note, we still may see EndTxn TV1 (< 5) responses when the producer has upgraded to TV2 due to the upgrade // occurring at the end of beginCompletingTransaction. The next transaction started should be TV2. if (endTxnResponse.data().producerId() != -1) { ProducerIdAndEpoch producerIdAndEpoch = new ProducerIdAndEpoch( endTxnResponse.data().producerId(), endTxnResponse.data().producerEpoch() ); setProducerIdAndEpoch(producerIdAndEpoch); resetSequenceNumbers(); } resetTransactionState(); result.done(); } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error.exception() instanceof RetriableException) { reenqueue(); } else if (error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.PRODUCER_FENCED) { // We could still receive INVALID_PRODUCER_EPOCH from old versioned transaction coordinator, // just treat it the same as PRODUCE_FENCED. fatalError(Errors.PRODUCER_FENCED.exception()); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.INVALID_TXN_STATE || error == Errors.INVALID_PRODUCER_ID_MAPPING) { fatalError(error.exception()); } else if (error == Errors.UNKNOWN_PRODUCER_ID) { abortableErrorIfPossible(error.exception()); } else if (isAbort && error.exception() instanceof TransactionAbortableException) { // When aborting a transaction, we must convert TRANSACTION_ABORTABLE errors to KafkaException // because if an abort operation itself encounters an abortable error, retrying the abort would create a cycle. // Instead, we treat this as fatal error at the application layer to ensure the transaction can be cleanly terminated. fatalError(new KafkaException("Failed to abort transaction", error.exception())); } else if (error == Errors.TRANSACTION_ABORTABLE) { abortableError(error.exception()); } else { fatalError(new KafkaException("Unhandled error in EndTxnResponse: " + error.message())); } } } private class AddOffsetsToTxnHandler extends TxnRequestHandler { private final AddOffsetsToTxnRequest.Builder builder; private final Map<TopicPartition, OffsetAndMetadata> offsets; private final ConsumerGroupMetadata groupMetadata; private AddOffsetsToTxnHandler(AddOffsetsToTxnRequest.Builder builder, Map<TopicPartition, OffsetAndMetadata> offsets, ConsumerGroupMetadata groupMetadata) { super("AddOffsetsToTxn"); this.builder = builder; this.offsets = offsets; this.groupMetadata = groupMetadata; } @Override AddOffsetsToTxnRequest.Builder requestBuilder() { return builder; } @Override Priority priority() { return Priority.ADD_PARTITIONS_OR_OFFSETS; } @Override public void handleResponse(AbstractResponse response) { AddOffsetsToTxnResponse addOffsetsToTxnResponse = (AddOffsetsToTxnResponse) response; Errors error = Errors.forCode(addOffsetsToTxnResponse.data().errorCode()); if (error == Errors.NONE) { log.debug("Successfully added partition for consumer group {} to transaction", builder.data.groupId()); // note the result is not completed until the TxnOffsetCommit returns pendingRequests.add(txnOffsetCommitHandler(result, offsets, groupMetadata)); transactionStarted = true; } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR) { lookupCoordinator(FindCoordinatorRequest.CoordinatorType.TRANSACTION, transactionalId); reenqueue(); } else if (error.exception() instanceof RetriableException) { reenqueue(); } else if (error == Errors.UNKNOWN_PRODUCER_ID) { abortableErrorIfPossible(error.exception()); } else if (error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.PRODUCER_FENCED) { // We could still receive INVALID_PRODUCER_EPOCH from old versioned transaction coordinator, // just treat it the same as PRODUCE_FENCED. fatalError(Errors.PRODUCER_FENCED.exception()); } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.INVALID_TXN_STATE || error == Errors.INVALID_PRODUCER_ID_MAPPING) { fatalError(error.exception()); } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { abortableError(GroupAuthorizationException.forGroupId(builder.data.groupId())); } else if (error == Errors.TRANSACTION_ABORTABLE) { abortableError(error.exception()); } else { fatalError(new KafkaException("Unexpected error in AddOffsetsToTxnResponse: " + error.message())); } } } private class TxnOffsetCommitHandler extends TxnRequestHandler { private final TxnOffsetCommitRequest.Builder builder; private TxnOffsetCommitHandler(TransactionalRequestResult result, TxnOffsetCommitRequest.Builder builder) { super(result); this.builder = builder; } private TxnOffsetCommitHandler(TxnOffsetCommitRequest.Builder builder) { super("TxnOffsetCommitHandler"); this.builder = builder; } @Override TxnOffsetCommitRequest.Builder requestBuilder() { return builder; } @Override Priority priority() { return Priority.ADD_PARTITIONS_OR_OFFSETS; } @Override FindCoordinatorRequest.CoordinatorType coordinatorType() { return FindCoordinatorRequest.CoordinatorType.GROUP; } @Override String coordinatorKey() { return builder.data.groupId(); } @Override public void handleResponse(AbstractResponse response) { TxnOffsetCommitResponse txnOffsetCommitResponse = (TxnOffsetCommitResponse) response; boolean coordinatorReloaded = false; Map<TopicPartition, Errors> errors = txnOffsetCommitResponse.errors(); log.debug("Received TxnOffsetCommit response for consumer group {}: {}", builder.data.groupId(), errors); for (Map.Entry<TopicPartition, Errors> entry : errors.entrySet()) { TopicPartition topicPartition = entry.getKey(); Errors error = entry.getValue(); if (error == Errors.NONE) { pendingTxnOffsetCommits.remove(topicPartition); } else if (error == Errors.COORDINATOR_NOT_AVAILABLE || error == Errors.NOT_COORDINATOR || error == Errors.REQUEST_TIMED_OUT) { if (!coordinatorReloaded) { coordinatorReloaded = true; lookupCoordinator(FindCoordinatorRequest.CoordinatorType.GROUP, builder.data.groupId()); } } else if (error.exception() instanceof RetriableException) { // If the topic is unknown, the coordinator is loading, or is another retriable error, retry with the current coordinator continue; } else if (error == Errors.GROUP_AUTHORIZATION_FAILED) { abortableError(GroupAuthorizationException.forGroupId(builder.data.groupId())); break; } else if (error == Errors.FENCED_INSTANCE_ID || error == Errors.TRANSACTION_ABORTABLE) { abortableError(error.exception()); break; } else if (error == Errors.UNKNOWN_MEMBER_ID || error == Errors.ILLEGAL_GENERATION) { abortableError(new CommitFailedException("Transaction offset Commit failed " + "due to consumer group metadata mismatch: " + error.exception().getMessage())); break; } else if (error == Errors.INVALID_PRODUCER_EPOCH || error == Errors.PRODUCER_FENCED) { // We could still receive INVALID_PRODUCER_EPOCH from old versioned transaction coordinator, // just treat it the same as PRODUCE_FENCED. fatalError(Errors.PRODUCER_FENCED.exception()); break; } else if (error == Errors.TRANSACTIONAL_ID_AUTHORIZATION_FAILED || error == Errors.UNSUPPORTED_FOR_MESSAGE_FORMAT) { fatalError(error.exception()); break; } else { fatalError(new KafkaException("Unexpected error in TxnOffsetCommitResponse: " + error.message())); break; } } if (result.isCompleted()) { pendingTxnOffsetCommits.clear(); } else if (pendingTxnOffsetCommits.isEmpty()) { result.done(); } else { // Retry the commits which failed with a retriable error reenqueue(); } } } private static final class PendingStateTransition { private final TransactionalRequestResult result; private final State state; private final String operation; private PendingStateTransition( TransactionalRequestResult result, State state, String operation ) { this.result = result; this.state = state; this.operation = operation; } } /** * Returns a ProducerIdAndEpoch object containing the producer ID and epoch * of the ongoing transaction. * This is used when preparing a transaction for a two-phase commit. * * @return a ProducerIdAndEpoch with the current producer ID and epoch. */ public ProducerIdAndEpoch preparedTransactionState() { return this.preparedTxnState; } }
java
github
https://github.com/apache/kafka
clients/src/main/java/org/apache/kafka/clients/producer/internals/TransactionManager.java
// Copyright 2017 The etcd Authors // // 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. package ordering import ( "context" "sync" "testing" pb "go.etcd.io/etcd/api/v3/etcdserverpb" clientv3 "go.etcd.io/etcd/client/v3" ) type mockKV struct { clientv3.KV response clientv3.OpResponse } func (kv *mockKV) Do(ctx context.Context, op clientv3.Op) (clientv3.OpResponse, error) { return kv.response, nil } var rangeTests = []struct { prevRev int64 response *clientv3.GetResponse }{ { 5, &clientv3.GetResponse{ Header: &pb.ResponseHeader{ Revision: 5, }, }, }, { 5, &clientv3.GetResponse{ Header: &pb.ResponseHeader{ Revision: 4, }, }, }, { 5, &clientv3.GetResponse{ Header: &pb.ResponseHeader{ Revision: 6, }, }, }, } func TestKvOrdering(t *testing.T) { for i, tt := range rangeTests { mKV := &mockKV{clientv3.NewKVFromKVClient(nil, nil), tt.response.OpResponse()} kv := &kvOrdering{ mKV, func(r *clientv3.GetResponse) OrderViolationFunc { return func(op clientv3.Op, resp clientv3.OpResponse, prevRev int64) error { r.Header.Revision++ return nil } }(tt.response), tt.prevRev, sync.RWMutex{}, } res, err := kv.Get(t.Context(), "mockKey") if err != nil { t.Errorf("#%d: expected response %+v, got error %+v", i, tt.response, err) } if rev := res.Header.Revision; rev < tt.prevRev { t.Errorf("#%d: expected revision %d, got %d", i, tt.prevRev, rev) } } } var txnTests = []struct { prevRev int64 response *clientv3.TxnResponse }{ { 5, &clientv3.TxnResponse{ Header: &pb.ResponseHeader{ Revision: 5, }, }, }, { 5, &clientv3.TxnResponse{ Header: &pb.ResponseHeader{ Revision: 8, }, }, }, { 5, &clientv3.TxnResponse{ Header: &pb.ResponseHeader{ Revision: 4, }, }, }, } func TestTxnOrdering(t *testing.T) { for i, tt := range txnTests { mKV := &mockKV{clientv3.NewKVFromKVClient(nil, nil), tt.response.OpResponse()} kv := &kvOrdering{ mKV, func(r *clientv3.TxnResponse) OrderViolationFunc { return func(op clientv3.Op, resp clientv3.OpResponse, prevRev int64) error { r.Header.Revision++ return nil } }(tt.response), tt.prevRev, sync.RWMutex{}, } txn := &txnOrdering{ kv.Txn(t.Context()), kv, t.Context(), sync.Mutex{}, []clientv3.Cmp{}, []clientv3.Op{}, []clientv3.Op{}, } res, err := txn.Commit() if err != nil { t.Errorf("#%d: expected response %+v, got error %+v", i, tt.response, err) } if rev := res.Header.Revision; rev < tt.prevRev { t.Errorf("#%d: expected revision %d, got %d", i, tt.prevRev, rev) } } }
go
github
https://github.com/etcd-io/etcd
client/v3/ordering/kv_test.go
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. """ .. _opt-matmul-auto-tensorcore: How to optimize matmul with Auto TensorCore CodeGen =================================================== **Author**: `Minmin Sun <https://github.com/minminsun>`_, \ `Lanbo Li <https://github.com/Orion34C>`_, \ `Chenfan Jia <https://github.com/jcf94>`_, \ `Jun Yang <https://github.com/yangjunpro>`_ In this tutorial, we will demonstrate how to write a high performance matmul schedule on Volta/Turing GPUs with TVM Auto TensorCore CodeGen. This is a transparent solution to generate tensorcore kernel with most transformations done in ir passes. Users can also write schedule with tensorization to generate TensorCore code. Both solutions use the same tensorcore intrinsics. Please refer to :ref:`opt-conv-tensorcore` tutorial for more details. """ ################################################################ # Preparation and Algorithm # ------------------------- # 2 kinds of input data types are supported: float16 and int8. # For float16, the accumulator is float32. # For int8, the accumulator is int32. # For data layouts, 'N' means None-transpose while 'T' means Transpose. import logging import sys import numpy as np import tvm from tvm import te from tvm import autotvm from tvm.contrib import nvcc def matmul_nn(A, B, L, dtype="float16", layout="NN"): k = te.reduce_axis((0, L), name="k") if dtype == "float16": out_type = "float" elif dtype == "int8": out_type = "int" elif dtype == "int4" or dtype == "int1": out_type = "int" if layout == "NN": return te.compute( (N, M), lambda i, j: te.sum(A[i, k].astype(out_type) * B[k, j].astype(out_type), axis=k) ) if layout == "NT": return te.compute( (N, M), lambda i, j: te.sum(A[k, i].astype(out_type) * B[k, j].astype(out_type), axis=k) ) if layout == "TN": return te.compute( (N, M), lambda i, j: te.sum(A[i, k].astype(out_type) * B[j, k].astype(out_type), axis=k) ) if layout == "TT": return te.compute( (N, M), lambda i, j: te.sum(A[k, i].astype(out_type) * B[j, k].astype(out_type), axis=k) ) ############################################################################### # Scheduling the Computation # -------------------------- # This schedule is no different than a non-tensorcore matmul schedule on GPU. # Please refer to :ref:`opt-gemm` tutorial for basics of optimizing matmul schedule. # When the "tensor_core" pragma is set, the "rewrite for tensorcore" ir pass # will automatically transform the schedule for tensorcore codegen, # otherwise normal CUDA code, with lower performance but equal functionality, will be generated. # # .. note:: # # *Requirements of TesnsorCore* # # Note that in the following 2 cases, even though the "tensor_core" pragma is set, TVM will still fall back to normal CUDA codegen: # (1) The m, n or k of input matrices is not multiple of 16; # (2) The warp tile size is not 16x16x16 on CUDA9, or not one of {16x16x16, 32x8x16, 8x32x16} on CUDA version >= 10.0. # # In this schedule, storage_align is used to reduce bank conflicts of shared memory. Please refer to this # `doc <https://tvm.apache.org/docs/api/python/te.html#tvm.te.Stage.storage_align>`_ # for the usage of storage_align primitive. In short, we need to add an offset to some shared memory buffer # to reduce bank conflicts. # According to the `wmma doc <https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#wmma-description>`_, # the stride of load_matrix_sync must be a multiple of 16 bytes, # so we choose 8 as offset for float16 and 16 as offset for int8. # # We use AutoTVM to search for best configurations in this schedule. @autotvm.template("tutorial/auto_tensorcore/test_gemm") def test_gemm(N, L, M, dtype, layout): if layout == "NN": shape_a = (N, L) shape_b = (L, M) elif layout == "NT": shape_a = (L, N) shape_b = (L, M) elif layout == "TN": shape_a = (N, L) shape_b = (M, L) elif layout == "TT": shape_a = (L, N) shape_b = (M, L) else: print("Unsupported layout:", layout) sys.exit(1) A = te.placeholder(shape_a, name="A", dtype=dtype) B = te.placeholder(shape_b, name="B", dtype=dtype) C = matmul_nn(A, B, L, dtype, layout) s = te.create_schedule(C.op) y, x = s[C].op.axis k = s[C].op.reduce_axis[0] # storage_align params factor = 16 offset = 8 if dtype == "int8": factor = 32 offset = 16 elif dtype == "int4": factor = 64 offset = 32 elif dtype == "int1": factor = 256 offset = 128 # create cache stages AA = s.cache_read(A, "shared", [C]) if layout == "NN" or layout == "TN": s[AA].storage_align(AA.op.axis[0], factor, offset) AL = s.cache_read(AA, "local", [C]) BB = s.cache_read(B, "shared", [C]) if layout == "TT" or layout == "NT": s[BB].storage_align(BB.op.axis[0], factor, offset) BL = s.cache_read(BB, "local", [C]) CL = s.cache_write(C, "local") # autotvm search space definition cfg = autotvm.get_config() cfg.define_knob("bx", [2, 4, 8]) cfg.define_knob("by", [8, 16, 32, 64]) cfg.define_knob("step_k", [1, 2, 4, 8, 16, 32]) cfg.define_knob("v", [4, 8, 16, 32]) by = cfg["by"].val bx = cfg["bx"].val step_k = cfg["step_k"].val v = cfg["v"].val # thread tile TX = 8 TY = 1 if dtype == "int4" or dtype == "int1": TX = 2 # warp tile warp_tile_m = 16 # it could also be 8 or 32 on CUDA version >= 10.0 warp_tile_k = 16 # it must be 16 for fp16/int8 data type if dtype == "int4": warp_tile_m = 8 warp_tile_k = 32 elif dtype == "int1": warp_tile_m = 8 warp_tile_k = 128 # block tile tile_x = bx * TX tile_y = by * TY yo, ty = s[C].split(y, tile_y) ty, yi = s[C].split(ty, TY) # schedule for C stage xo, xi = s[C].split(x, tile_x) WX = min(warp_tile_m, tile_x) tz, xi = s[C].split(xi, WX) tx, xi = s[C].split(xi, TX) s[C].reorder(yo, xo, tz, ty, tx, yi, xi) s[C].bind(yo, te.thread_axis("blockIdx.y")) s[C].bind(xo, te.thread_axis("blockIdx.x")) s[C].bind(ty, te.thread_axis("threadIdx.y")) s[C].bind(tz, te.thread_axis("threadIdx.z")) s[C].bind(tx, te.thread_axis("threadIdx.x")) # schedule for CL stage ko, ki = s[CL].split(k, step_k * warp_tile_k) kl, ki = s[CL].split(ki, warp_tile_k) s[CL].compute_at(s[C], tx) yo, xo = CL.op.axis s[CL].reorder(ko, kl, ki, yo, xo) # schedule for AA stage s[AA].compute_at(s[CL], ko) xo, xi = s[AA].split(s[AA].op.axis[1], factor=bx * v) tz, tx = s[AA].split(xi, factor=(WX // TX) * v) tx, vec = s[AA].split(tx, factor=v) fused = s[AA].fuse(s[AA].op.axis[0], xo) _, ty = s[AA].split(fused, factor=by) s[AA].bind(ty, te.thread_axis("threadIdx.y")) s[AA].bind(tz, te.thread_axis("threadIdx.z")) s[AA].bind(tx, te.thread_axis("threadIdx.x")) # vectorization is very important for float16/int8 inputs s[AA].vectorize(vec) # schedule for BB stage s[BB].compute_at(s[CL], ko) xo, xi = s[BB].split(s[BB].op.axis[1], factor=bx * v) tz, tx = s[BB].split(xi, factor=(WX // TX) * v) tx, vec = s[BB].split(tx, factor=v) fused = s[BB].fuse(s[BB].op.axis[0], xo) _, ty = s[BB].split(fused, factor=by) s[BB].bind(ty, te.thread_axis("threadIdx.y")) s[BB].bind(tz, te.thread_axis("threadIdx.z")) s[BB].bind(tx, te.thread_axis("threadIdx.x")) s[BB].vectorize(vec) s[AL].compute_at(s[CL], kl) s[BL].compute_at(s[CL], kl) # set the 'tensor_core' pragma for tensorcore codegen s[CL].pragma(ko, "tensor_core") return s, [A, B, C] ############################################################################### # AutoTune and Test # ----------------- # Finally we use a tuner to tune the schedule, generate code with best config # and run the kernel to compare with numpy to check whether the results are correct. # check whether the gpu has tensorcore if not tvm.gpu(0).exist or not tvm.runtime.enabled("cuda"): raise Exception("skip building this tutorial because cuda is not enabled..") ctx = tvm.gpu() if not nvcc.have_tensorcore(ctx.compute_version): raise Exception("the gpu has no tensorcore, skipping...") M, N, L = 512, 32, 512 dtype = "float16" layout = "NN" if len(sys.argv) >= 4: M, N, L = int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]) if len(sys.argv) >= 5: dtype = sys.argv[4] if len(sys.argv) >= 6: layout = sys.argv[5] # check whether current gpu arch support support current dtype's wmma codegen cuda_compute_capability = tvm.runtime._ffi_api.GetDeviceAttr(2, 0, 4) major, minor = nvcc.parse_compute_version(cuda_compute_capability) if dtype == "int8": assert major == 7 and minor >= 2 elif dtype == "int4" or dtype == "int1": # int4/int1 only support layout TN assert major == 7 and minor == 5 and layout == "TN" def tune_and_evaluate(M, N, L, dtype, layout): task = autotvm.task.create( "tutorial/auto_tensorcore/test_gemm", args=(N, L, M, dtype, layout), target="cuda" ) print(task.config_space) logging.getLogger("autotvm").setLevel(logging.DEBUG) logging.getLogger("autotvm").addHandler(logging.StreamHandler(sys.stdout)) measure_option = autotvm.measure_option(builder="local", runner=autotvm.LocalRunner(number=5)) tuner = autotvm.tuner.XGBTuner(task) tuner.tune( n_trial=1000, measure_option=measure_option, callbacks=[autotvm.callback.log_to_file("matmul.log")], ) dispatch_context = autotvm.apply_history_best("matmul.log") best_config = dispatch_context.query(task.target, task.workload) print("\nBest config:") print(best_config) with autotvm.apply_history_best("matmul.log"): with tvm.target.Target("cuda"): s, arg_bufs = test_gemm(N, L, M, dtype, layout) print(tvm.lower(s, arg_bufs, simple_mode=True)) func = tvm.build(s, arg_bufs) dev_module = func.imported_modules[0] print(dev_module.get_source()) # check correctness if layout == "NN": shape_a = (N, L) shape_b = (L, M) elif layout == "NT": shape_a = (L, N) shape_b = (L, M) elif layout == "TN": shape_a = (N, L) shape_b = (M, L) elif layout == "TT": shape_a = (L, N) shape_b = (M, L) a_np = None b_np = None c_np = None c_np_type = None if dtype == "float16": c_np_type = np.float32 a_np = np.random.uniform(size=shape_a).astype(np.float16) b_np = np.random.uniform(size=shape_b).astype(np.float16) if layout == "NN": c_np = np.dot(a_np, b_np) elif layout == "NT": c_np = np.dot(a_np.T, b_np) elif layout == "TN": c_np = np.dot(a_np, b_np.T) elif layout == "TT": c_np = np.dot(a_np.T, b_np.T) elif dtype == "int8": c_np_type = np.int32 a_np = np.random.randint(low=-128, high=127, size=shape_a).astype(np.int8) b_np = np.random.randint(low=-128, high=127, size=shape_b).astype(np.int8) if layout == "NN": c_np = np.dot(a_np.astype(np.int32), b_np.astype(np.int32)) elif layout == "NT": c_np = np.dot(a_np.astype(np.int32).T, b_np.astype(np.int32)) elif layout == "TN": c_np = np.dot(a_np.astype(np.int32), b_np.astype(np.int32).T) elif layout == "TT": c_np = np.dot(a_np.astype(np.int32).T, b_np.astype(np.int32).T) elif dtype == "int4": c_np_type = np.int32 a_np_int = np.random.randint(low=-8, high=7, size=shape_a).astype(np.int32) b_np_int = np.random.randint(low=-8, high=7, size=shape_b).astype(np.int32) # "TN" c_np = np.dot(a_np_int.astype(np.int32), b_np_int.astype(np.int32).T) a_np = np.zeros(shape=(N, int(L / 8)), dtype=np.int32) b_np = np.zeros(shape=(M, int(L / 8)), dtype=np.int32) # a_np --> col_major for i in range(N): for j in range(int(L / 8)): for k in range(8): a_np[i, j] = a_np[i, j] | ((a_np_int[i, j * 8 + k] & 0xF) << ((7 - k) * 4)) # b_np --> row_major for i in range(M): for j in range(int(L / 8)): for k in range(8): b_np[i, j] = b_np[i, j] | ((b_np_int[i, j * 8 + k] & 0xF) << ((7 - k) * 4)) elif dtype == "int1": c_np_type = np.int32 a_np_int = np.random.randint(low=0, high=1, size=shape_a).astype(np.int32) b_np_int = np.random.randint(low=0, high=1, size=shape_b).astype(np.int32) # "TN" c_np = np.dot(a_np_int.astype(np.int32), b_np_int.astype(np.int32).T) a_np = np.zeros(shape=(N, int(L / 32)), dtype=np.int32) b_np = np.zeros(shape=(M, int(L / 32)), dtype=np.int32) for i in range(N): for j in range(int(L / 32)): for k in range(32): a_np[i, j] = a_np[i, j] | ((a_np_int[i, j * 32 + k] & 0xF) << (31 - k)) for i in range(M): for j in range(int(L / 32)): for k in range(32): b_np[i, j] = b_np[i, j] | ((b_np_int[i, j * 32 + k] & 0xF) << (31 - k)) c_tvm = tvm.nd.array(np.zeros(c_np.shape, dtype=c_np_type), ctx=ctx) a_tvm = tvm.nd.array(a_np, ctx=ctx) b_tvm = tvm.nd.array(b_np, ctx=ctx) func(a_tvm, b_tvm, c_tvm) tvm.testing.assert_allclose(c_np, c_tvm.asnumpy(), rtol=1e-3) evaluator = func.time_evaluator(func.entry_name, ctx, number=100) print("Time cost of this operator: %f" % evaluator(a_tvm, b_tvm, c_tvm).mean) # We do not run the tuning in our webpage server since it takes some time. # Uncomment the following line to run it by yourself. # tune_and_evaluate(M, N, L, dtype, layout) ###################################################################### # Sample Output # ------------- # .. code-block:: bash # # Best config: # [('bx', 4), ('by', 32), ('step_k', 16), ('v', 8)],,None,40 # Finish loading 162 records # produce compute { # // attr [iter_var(blockIdx.y, , blockIdx.y)] thread_extent = 1 # // attr [compute.local] storage_scope = "wmma.accumulator" # allocate compute.local[float32 * 256] # // attr [A.shared] storage_scope = "shared" # allocate A.shared[float16 * 8448] # // attr [B.shared] storage_scope = "shared" # allocate B.shared[float16 * 8192] # // attr [A.shared.local] storage_scope = "wmma.matrix_b" # allocate A.shared.local[float16 * 256] # // attr [B.shared.local] storage_scope = "wmma.matrix_a" # allocate B.shared.local[float16 * 256] # // attr [iter_var(blockIdx.x, , blockIdx.x)] thread_extent = 16 # // attr [iter_var(threadIdx.z, , threadIdx.z)] thread_extent = 2 # // attr [iter_var(threadIdx.y, , threadIdx.y)] thread_extent = 32 # // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 2 # produce compute.local { # for (j.c.init, 0, 1) { # tvm_fill_fragment(compute.local, 16, 16, 16, 0, 0f) # } # // attr [iter_var(k.outer, )] pragma_tensor_core = 1 # for (k.outer, 0, 2) { # produce A.shared { # for (ax0.ax1.outer.fused.outer, 0, 8) { # // attr [iter_var(threadIdx.y, , threadIdx.y)] thread_extent = 32 # // attr [iter_var(threadIdx.z, , threadIdx.z)] thread_extent = 2 # // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 2 # A.shared[ramp((((((ax0.ax1.outer.fused.outer*1056) + (floordiv(threadIdx.y, 8)*264)) + (floormod(threadIdx.y, 8)*32)) + (threadIdx.z*16)) + (threadIdx.x*8)), 1, 8)] = A[ramp(((((((ax0.ax1.outer.fused.outer*2048) + (floordiv(threadIdx.y, 8)*512)) + (k.outer*256)) + (floormod(threadIdx.y, 8)*32)) + (threadIdx.z*16)) + (threadIdx.x*8)), 1, 8)] # } # } # produce B.shared { # for (ax0.ax1.outer.fused.outer, 0, 8) { # // attr [iter_var(threadIdx.y, , threadIdx.y)] thread_extent = 32 # // attr [iter_var(threadIdx.z, , threadIdx.z)] thread_extent = 2 # // attr [iter_var(threadIdx.x, , threadIdx.x)] thread_extent = 2 # B.shared[ramp(((((ax0.ax1.outer.fused.outer*1024) + (threadIdx.y*32)) + (threadIdx.z*16)) + (threadIdx.x*8)), 1, 8)] = B[ramp(((((((k.outer*131072) + (ax0.ax1.outer.fused.outer*16384)) + (threadIdx.y*512)) + (blockIdx.x*32)) + (threadIdx.z*16)) + (threadIdx.x*8)), 1, 8)] # } # } # for (k.inner.outer, 0, 16) { # produce A.shared.local { # for (ax1, 0, 1) { # tvm_load_matrix_sync(A.shared.local, 16, 16, 16, 0, &(A.shared[(((threadIdx.y/16)*4224) + (k.inner.outer*16))]), 264, "col_major") # } # } # produce B.shared.local { # for (ax0, 0, 1) { # for (ax1, 0, 1) { # tvm_load_matrix_sync(B.shared.local, 16, 16, 16, 0, &(B.shared[((k.inner.outer*512) + (threadIdx.z*16))]), 32, "col_major") # } # } # } # for (k.inner.inner, 0, 1) { # for (j.c, 0, 1) { # tvm_mma_sync(compute.local, 0, B.shared.local, 0, A.shared.local, 0, compute.local, 0) # } # } # } # } # } # for (j.inner.inner.inner, 0, 1) { # tvm_store_matrix_sync(compute.local, 16, 16, 16, 0, &(compute[((((threadIdx.y/16)*8192) + (blockIdx.x*32)) + (threadIdx.z*16))]), 512, "col_major") # } # } # # #include <cuda_fp16.h> # __device__ half max(const half a, const half b) # { # return __hgt(__half(a), __half(b)) ? a : b; # } # __device__ half min(const half a, const half b) # { # return __hlt(__half(a), __half(b)) ? a : b; # } # __device__ half operator+(const volatile __half &a, const volatile __half &b) # { # return __hadd(a, b); # } # __device__ half operator<=(const volatile __half &a, const volatile __half &b) # { # return __hlt(a, b); # } # __device__ half operator*(const volatile __half &a, const volatile __half &b) # { # return __hmul(a, b); # } # #include <mma.h> # extern "C" __global__ void default_function_kernel0( half* __restrict__ A, half* __restrict__ B, float* __restrict__ compute) { # nvcuda::wmma::fragment<nvcuda::wmma::accumulator, 16, 16, 16, float> compute_local[1]; # __shared__ half A_shared[8448]; # __shared__ half B_shared[8192]; # nvcuda::wmma::fragment<nvcuda::wmma::matrix_b, 16, 16, 16, half, nvcuda::wmma::col_major> A_shared_local[1]; # nvcuda::wmma::fragment<nvcuda::wmma::matrix_a, 16, 16, 16, half, nvcuda::wmma::col_major> B_shared_local[1]; # for (int j_c_init = 0; j_c_init < 1; ++j_c_init) { # (void)nvcuda::wmma::fill_fragment(compute_local[0], 0.000000e+00f); # } # for (int k_outer = 0; k_outer < 2; ++k_outer) { # __syncthreads(); # for (int ax0_ax1_outer_fused_outer = 0; ax0_ax1_outer_fused_outer < 8; ++ax0_ax1_outer_fused_outer) { # ((__shared__ float4*)(A_shared + (((((ax0_ax1_outer_fused_outer * 1056) + ((((int)threadIdx.y) >> 3) * 264)) + ((((int)threadIdx.y) & 7) * 32)) + (((int)threadIdx.z) * 16)) + (((int)threadIdx.x) * 8))))[0] = (( float4*)(A + ((((((ax0_ax1_outer_fused_outer * 2048) + ((((int)threadIdx.y) >> 3) * 512)) + (k_outer * 256)) + ((((int)threadIdx.y) & 7) * 32)) + (((int)threadIdx.z) * 16)) + (((int)threadIdx.x) * 8))))[0]; # } # for (int ax0_ax1_outer_fused_outer1 = 0; ax0_ax1_outer_fused_outer1 < 8; ++ax0_ax1_outer_fused_outer1) { # ((__shared__ float4*)(B_shared + ((((ax0_ax1_outer_fused_outer1 * 1024) + (((int)threadIdx.y) * 32)) + (((int)threadIdx.z) * 16)) + (((int)threadIdx.x) * 8))))[0] = (( float4*)(B + ((((((k_outer * 131072) + (ax0_ax1_outer_fused_outer1 * 16384)) + (((int)threadIdx.y) * 512)) + (((int)blockIdx.x) * 32)) + (((int)threadIdx.z) * 16)) + (((int)threadIdx.x) * 8))))[0]; # } # __syncthreads(); # for (int k_inner_outer = 0; k_inner_outer < 16; ++k_inner_outer) { # for (int ax1 = 0; ax1 < 1; ++ax1) { # (void)nvcuda::wmma::load_matrix_sync(A_shared_local[0], &(A_shared[(((((int)threadIdx.y) / 16) * 4224) + (k_inner_outer * 16))]), 264); # } # for (int ax0 = 0; ax0 < 1; ++ax0) { # for (int ax11 = 0; ax11 < 1; ++ax11) { # (void)nvcuda::wmma::load_matrix_sync(B_shared_local[0], &(B_shared[((k_inner_outer * 512) + (((int)threadIdx.z) * 16))]), 32); # } # } # for (int k_inner_inner = 0; k_inner_inner < 1; ++k_inner_inner) { # for (int j_c = 0; j_c < 1; ++j_c) { # (void)nvcuda::wmma::mma_sync(compute_local[0], B_shared_local[0], A_shared_local[0], compute_local[0]); # } # } # } # } # for (int j_inner_inner_inner = 0; j_inner_inner_inner < 1; ++j_inner_inner_inner) { # (void)nvcuda::wmma::store_matrix_sync(&(compute[((((((int)threadIdx.y) / 16) * 8192) + (((int)blockIdx.x) * 32)) + (((int)threadIdx.z) * 16))]), compute_local[0], 512, nvcuda::wmma::mem_col_major); # } # } # # # Time cost of this operator: 0.000008 ############################################################################### # Summary # ------- # This tutorial demonstrates how to use the AutoTensorCoreCodeGen of TVM # to generate tensorcore kernels.
unknown
codeparrot/codeparrot-clean
from __future__ import annotations from typing import TYPE_CHECKING from scrapy.commands import ScrapyCommand from scrapy.spiderloader import get_spider_loader if TYPE_CHECKING: import argparse class Command(ScrapyCommand): requires_project = True requires_crawler_process = False default_settings = {"LOG_ENABLED": False} def short_desc(self) -> str: return "List available spiders" def run(self, args: list[str], opts: argparse.Namespace) -> None: assert self.settings is not None spider_loader = get_spider_loader(self.settings) for s in sorted(spider_loader.list()): print(s)
python
github
https://github.com/scrapy/scrapy
scrapy/commands/list.py
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings import GradientEmbeddings # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation warnings and # handling optional imports. DEPRECATED_LOOKUP = {"GradientEmbeddings": "langchain_community.embeddings"} _import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP) def __getattr__(name: str) -> Any: """Look up attributes dynamically.""" return _import_attribute(name) __all__ = [ "GradientEmbeddings", ]
python
github
https://github.com/langchain-ai/langchain
libs/langchain/langchain_classic/embeddings/gradient_ai.py
#include <ATen/core/dispatch/Dispatcher.h> #include <ATen/record_function.h> #include <c10/macros/Macros.h> #include <c10/util/ThreadLocal.h> #include <c10/util/overloaded.h> #include <algorithm> #include <cstdlib> #include <random> namespace at { extern const std::string kParamCommsCallName = "record_param_comms"; namespace { // Used to generate unique callback handles CallbackHandle next_unique_callback_handle() { static std::atomic<uint64_t> unique_cb_id{1}; return CallbackHandle(unique_cb_id++); } RecordFunctionHandle next_unique_record_function_handle() { static std::atomic<uint64_t> unique_rf_id{1}; return RecordFunctionHandle(unique_rf_id++); } std::atomic<int64_t> defaultNodeId(-1); // Enumerates thread ids logically; // note: std::this_thread::get_id may return potentially // reused thread id std::atomic<uint64_t> next_thread_id_{0}; thread_local uint64_t current_thread_id_ = 0; constexpr size_t NumRecordScopes = static_cast<size_t>(RecordScope::NUM_SCOPES); RecordFunctionCallbacks::iterator findCallback( RecordFunctionCallbacks& entries, CallbackHandle handle) { auto match_handle = [handle](const auto& el) { return el.handle_ == handle; }; return std::find_if(entries.begin(), entries.end(), match_handle); } std::optional<RecordFunctionCallback> extractCallback( RecordFunctionCallbacks& entries, CallbackHandle handle) { auto it = findCallback(entries, handle); if (it == entries.end()) { return std::nullopt; } auto out = it->callback_; entries.erase(it); return out; } // ============================================================================ // == Callback manager ======================================================== // ============================================================================ // The high level idea of the RecordFunction callback machinery is based on the // observation that the set of callbacks to be run changes infrequently. // However, in order to reuse the active set we have to be able to invalidate // when the active set changes. There are three events that can change which // callbacks should be run: // 1) The set of global callbacks changes // 2) The set of local callbacks changes // 3) A sampling callback is present, and should run on this iteration // // Global callbacks rely on thread local replication and an atomic version // counter to maintain consistency. Whenever we change the set of active global // callbacks (add / remove / enable / disable) the `GlobalCallbackManager` // increments the version number and updates the global state while holding // a mutex. The local callback manager snapshots the global callbacks and // lazily rebuilds by comparing`GlobalCallbackManager::version()` (which is // a simple atomic read) to the version of the last rebuild. In the // overwhelmingly common case that they match it can reuse the existing // snapshot. Otherwise it must call the much more expensive (and locked) // `GlobalCallbackManager::getSnapshot()`. // // Handling changes to the thread local callbacks is trivial; functions that // change them can simply force a cache rebuild for that thread after the // changes are made. // // Sampling is by far the most challenging to handle efficiently. In general // sampling callbacks are expected to have very low frequency. (e.g. 1 per // million) Random number generation is rather expensive, so flipping a coin on // every call for every sampling callback is wasteful. We can significantly // reduce this cost by noting that the number of failures of a Bernoulli random // variable is a geometric distribution, and thus we can sample the geometric // distribution to determine the next time a callback should run. This reduces // the cost from a random sample to a simple integer decrement. // // We can further note that Bernoulli samples are independent. (In contrast to, // say, sampling without replacement.) This means that we can generate a // counter for each scope that a given callback supports and then decrement the // counter corresponding to the RecordScope being called. Conceptually, this is // analogous to flipping different coins with the same probability. By sharding // on RecordScope, we can consolidate the decrement to a single shared counter // and update individual counters during rebuild. class GlobalCallbackManager { public: static GlobalCallbackManager& get(); // Singleton private: GlobalCallbackManager() = default; public: static constexpr size_t NoVersion = 0; using snapshot_t = std::pair<size_t, RecordFunctionCallbacks>; // Locking? size_t version() const; // No snapshot_t getSnapshot() const; // Yes CallbackHandle addCallback(RecordFunctionCallback cb); // Yes void setCallbackEnabled(CallbackHandle handle, bool enabled); // Yes void removeCallback(CallbackHandle handle); // Yes void clearCallbacks(); // Yes private: std::atomic<size_t> version_{NoVersion + 1}; RecordFunctionCallbacks global_callbacks_; // Source of truth. mutable std::mutex update_mutex_; }; class CacheEntry { public: CacheEntry() = default; CacheEntry(std::mt19937* generator, RecordScope scope); // The caller is expected to check `GlobalCallbackManager::get().version()' // and call CacheEntry::update() if necessary. StepCallbacks getActiveCallbacks(); std::optional<StepCallbacks> getActiveCallbacksUnlessEmpty(); // Full rebuild. (E.g. during registration) void update(const std::vector<RecordFunctionCallback>& callbacks); private: struct CallbackAndCounter { RecordFunctionCallback callback_; // `-1` indicates that a callback is not sampled. int tries_left_{-1}; }; C10_ALWAYS_INLINE void getActiveCallbacksImpl(); void rebuildActiveCallbacks(); int sampleTries(double p) const; // std::mt19937 is quite large, so all scopes share the same generator. std::mt19937* generator_{nullptr}; // Includes sampling callbacks which are waiting to run. c10::SmallVector<CallbackAndCounter, kSoftLimitCallbacks> callbacks_; RecordScope scope_{RecordScope::FUNCTION}; StepCallbacks active_callbacks_; // For managing sampling callbacks int sampling_countdown_{0}; int steps_for_this_update_{0}; }; class LocalCallbackManager { public: static LocalCallbackManager& get(); // Singleton private: LocalCallbackManager(); public: const RecordFunctionTLS& getTLS() const; StepCallbacks getActiveCallbacks(const RecordScope scope); std::optional<StepCallbacks> getActiveCallbacksUnlessEmpty( const RecordScope scope); void setTLS(const RecordFunctionTLS& tls); void seed(uint32_t seed); CallbackHandle addCallback(RecordFunctionCallback callback); bool setCallbackEnabled(CallbackHandle handle, bool enabled); bool removeCallback(CallbackHandle handle); void clearCallbacks(); private: void rebuildActiveCallbacksIfNeeded(); void rebuild_all(const GlobalCallbackManager::snapshot_t& global_snapshot); void rebuild_callback_scopes( const GlobalCallbackManager::snapshot_t& global_snapshot, const RecordFunctionCallback& callback); void rebuild_scope( const GlobalCallbackManager::snapshot_t& global_snapshot, const RecordScope scope); // Source of truth. RecordFunctionTLS registered_callbacks_; // Runtime cache. size_t global_version_{GlobalCallbackManager::NoVersion}; std::array<CacheEntry, NumRecordScopes> active_callbacks_; std::mt19937 generator_; }; // ============================================================================ // == GlobalCallbackManager: Implementation =================================== // ============================================================================ GlobalCallbackManager& GlobalCallbackManager::get() { static GlobalCallbackManager manager; return manager; } size_t GlobalCallbackManager::version() const { return version_.load(std::memory_order_relaxed); } std::pair<size_t, RecordFunctionCallbacks> GlobalCallbackManager::getSnapshot() const { std::lock_guard<std::mutex> guard(update_mutex_); return {version_.load(std::memory_order_seq_cst), global_callbacks_}; } CallbackHandle GlobalCallbackManager::addCallback(RecordFunctionCallback cb) { std::lock_guard<std::mutex> guard(update_mutex_); ++version_; auto handle = next_unique_callback_handle(); global_callbacks_.emplace_back(cb, handle); return handle; } void GlobalCallbackManager::setCallbackEnabled( CallbackHandle handle, bool enabled) { std::lock_guard<std::mutex> guard(update_mutex_); auto it = findCallback(global_callbacks_, handle); if (it != global_callbacks_.end()) { if (it->enabled_ != enabled) { ++version_; it->enabled_ = enabled; } } else { LOG(WARNING) << "Requested callback is not found"; } } void GlobalCallbackManager::removeCallback(CallbackHandle handle) { std::lock_guard<std::mutex> guard(update_mutex_); if (extractCallback(global_callbacks_, handle).has_value()) { ++version_; } else { LOG(WARNING) << "Requested callback is not found"; } } void GlobalCallbackManager::clearCallbacks() { std::lock_guard<std::mutex> guard(update_mutex_); ++version_; global_callbacks_.clear(); } // ============================================================================ // == CacheEntry: Implementation ============================================== // ============================================================================ CacheEntry::CacheEntry(std::mt19937* generator, RecordScope scope) : generator_{generator}, scope_{scope} { rebuildActiveCallbacks(); } void CacheEntry::update(const std::vector<RecordFunctionCallback>& callbacks) { callbacks_.clear(); callbacks_.reserve(callbacks.size()); for (const auto& callback : callbacks) { const auto p = callback.samplingProb(); callbacks_.push_back({callback, p < 1.0 ? sampleTries(p) : -1}); } rebuildActiveCallbacks(); } void CacheEntry::getActiveCallbacksImpl() { // We rebuild the active set when `sampling_countdown_` reaches zero, so if it // reaches zero at the start of this function something has gone wrong. TORCH_INTERNAL_ASSERT(sampling_countdown_ > 0, sampling_countdown_); if (C10_UNLIKELY(!(--sampling_countdown_))) { // Use inferred steps to update sampled callbacks. for (auto& i : callbacks_) { if (i.tries_left_ > 0) { TORCH_INTERNAL_ASSERT(i.tries_left_ >= steps_for_this_update_); i.tries_left_ -= steps_for_this_update_; } } // Determine which callbacks to run and for how long. rebuildActiveCallbacks(); // Resample any sampled callbacks that ran this call. for (auto& i : callbacks_) { if (!i.tries_left_) { i.tries_left_ = sampleTries(i.callback_.samplingProb()); } } } } StepCallbacks CacheEntry::getActiveCallbacks() { getActiveCallbacksImpl(); return active_callbacks_; } std::optional<StepCallbacks> CacheEntry::getActiveCallbacksUnlessEmpty() { getActiveCallbacksImpl(); if (C10_LIKELY(active_callbacks_.empty())) { return std::nullopt; } return active_callbacks_; } void CacheEntry::rebuildActiveCallbacks() { // We could store thread ID in CacheEntry, but rebuilds are infrequent and // this saves us from having to plumb it through. const auto thread_id = RecordFunction::currentThreadId(); active_callbacks_ = StepCallbacks(thread_id, scope_); sampling_countdown_ = std::numeric_limits<int>::max(); for (const auto& i : callbacks_) { if (i.tries_left_ < 0) { // Callback is not sampled. Unconditionally push. active_callbacks_.callbacks_.push_back( {i.callback_.start(), i.callback_.end()}); } else if (i.tries_left_ == 0) { // Callback is sampled and we have reached a sampling event. Push and // set `sampling_countdown_` to one so we trigger a rebuild after one // call. active_callbacks_.callbacks_.push_back( {i.callback_.start(), i.callback_.end()}); sampling_countdown_ = 1; } else { // Callback is sampled and we have not reached sampling event. Set // `sampling_countdown_` to rebuild when it is time for this callback to // execute. sampling_countdown_ = std::min(sampling_countdown_, i.tries_left_); } active_callbacks_.needs_inputs_ |= i.callback_.needsInputs(); active_callbacks_.needs_outputs_ |= i.callback_.needsOutputs(); active_callbacks_.needs_ids_ |= i.callback_.needsIds(); } steps_for_this_update_ = sampling_countdown_; } int CacheEntry::sampleTries(double p) const { TORCH_INTERNAL_ASSERT(generator_ != nullptr); TORCH_INTERNAL_ASSERT(p > 0.0 && p <= 1.0); // The geometric distribution returns the number of failures. We add one to // also account for the call where we succeed. return std::geometric_distribution<int>(p)(*generator_) + 1; } // ============================================================================ // == LocalCallbackManager: Implementation ==================================== // ============================================================================ LocalCallbackManager& LocalCallbackManager::get() { #if defined(C10_PREFER_CUSTOM_THREAD_LOCAL_STORAGE) static c10::ThreadLocal<LocalCallbackManager> manager; return manager.get(); #else // defined(C10_PREFER_CUSTOM_THREAD_LOCAL_STORAGE) static thread_local LocalCallbackManager manager; return manager; #endif // defined(C10_PREFER_CUSTOM_THREAD_LOCAL_STORAGE) } LocalCallbackManager::LocalCallbackManager() { for (auto i : c10::irange(NumRecordScopes)) { active_callbacks_[i] = CacheEntry(&generator_, static_cast<RecordScope>(i)); } rebuild_all(GlobalCallbackManager::get().getSnapshot()); } const RecordFunctionTLS& LocalCallbackManager::getTLS() const { return registered_callbacks_; } void LocalCallbackManager::rebuildActiveCallbacksIfNeeded() { const auto global_version = GlobalCallbackManager::get().version(); if (C10_UNLIKELY(global_version != global_version_)) { rebuild_all(GlobalCallbackManager::get().getSnapshot()); } } StepCallbacks LocalCallbackManager::getActiveCallbacks( const RecordScope scope) { rebuildActiveCallbacksIfNeeded(); return active_callbacks_[static_cast<size_t>(scope)].getActiveCallbacks(); } std::optional<StepCallbacks> LocalCallbackManager:: getActiveCallbacksUnlessEmpty(const RecordScope scope) { rebuildActiveCallbacksIfNeeded(); return active_callbacks_[static_cast<size_t>(scope)] .getActiveCallbacksUnlessEmpty(); } void LocalCallbackManager::setTLS(const RecordFunctionTLS& tls) { registered_callbacks_ = tls; rebuild_all(GlobalCallbackManager::get().getSnapshot()); } void LocalCallbackManager::seed(uint32_t seed) { generator_.seed(seed); } CallbackHandle LocalCallbackManager::addCallback( RecordFunctionCallback callback) { auto handle = next_unique_callback_handle(); auto& callbacks = registered_callbacks_.sorted_tls_callbacks_; callbacks.emplace_back(callback, handle); rebuild_callback_scopes( GlobalCallbackManager::get().getSnapshot(), callbacks.back().callback_); return handle; } bool LocalCallbackManager::setCallbackEnabled( CallbackHandle handle, bool enabled) { auto it = findCallback(registered_callbacks_.sorted_tls_callbacks_, handle); auto found = (it != registered_callbacks_.sorted_tls_callbacks_.end()); if (found && it->enabled_ != enabled) { it->enabled_ = enabled; rebuild_callback_scopes( GlobalCallbackManager::get().getSnapshot(), it->callback_); } return found; } bool LocalCallbackManager::removeCallback(CallbackHandle handle) { auto& callbacks = registered_callbacks_.sorted_tls_callbacks_; auto callback = extractCallback(callbacks, handle); if (callback.has_value()) { rebuild_callback_scopes( GlobalCallbackManager::get().getSnapshot(), *callback); } return callback.has_value(); } void LocalCallbackManager::clearCallbacks() { registered_callbacks_.sorted_tls_callbacks_.clear(); rebuild_all(GlobalCallbackManager::get().getSnapshot()); } void LocalCallbackManager::rebuild_all( const GlobalCallbackManager::snapshot_t& global_snapshot) { global_version_ = global_snapshot.first; for (auto i : c10::irange(NumRecordScopes)) { rebuild_scope(global_snapshot, static_cast<RecordScope>(i)); } } void LocalCallbackManager::rebuild_callback_scopes( const GlobalCallbackManager::snapshot_t& global_snapshot, const RecordFunctionCallback& callback) { if (global_snapshot.first == global_version_) { // Only rebuild scopes associated with `callback` for (auto i : c10::irange(NumRecordScopes)) { if (callback.checkScope(static_cast<RecordScope>(i))) { rebuild_scope(global_snapshot, static_cast<RecordScope>(i)); } } } else { rebuild_all(global_snapshot); } } void LocalCallbackManager::rebuild_scope( const GlobalCallbackManager::snapshot_t& global_snapshot, const RecordScope scope) { std::vector<RecordFunctionCallback> callbacks; if (registered_callbacks_.tls_record_function_enabled_) { auto populate_callbacks = [&](const RecordFunctionCallbacks& raw_callbacks) { for (const auto& i : raw_callbacks) { if (i.enabled_ && i.callback_.checkScope(scope) && i.callback_.samplingProb() > 0) { callbacks.push_back(i.callback_); } } }; populate_callbacks(global_snapshot.second); populate_callbacks(registered_callbacks_.sorted_tls_callbacks_); } active_callbacks_[static_cast<size_t>(scope)].update(callbacks); } // ============================================================================ // == Callback execution ====================================================== // ============================================================================ void logTryRunCallbackError(const char* what, const char* name) { LOG(WARNING) << "Exception in RecordFunction callback: " << what << " , for the range " << name; } template <bool is_start> C10_ALWAYS_INLINE bool tryRunCallback( const StepCallbacks::StartEndPair callback_ptrs, const RecordFunction& rf, std::unique_ptr<ObserverContext>& ctx) { try { if (is_start && callback_ptrs.start_) { ctx = callback_ptrs.start_(rf); } if (!is_start && callback_ptrs.end_) { callback_ptrs.end_(rf, ctx.get()); } return true; } catch (const std::exception& e) { logTryRunCallbackError(e.what(), rf.name()); return false; } catch (...) { logTryRunCallbackError("unknown", rf.name()); return false; } } } // namespace RecordFunction::RecordFunction(RecordScope scope) : RecordFunction(getStepCallbacks(scope)) {} RecordFunction::RecordFunction(StepCallbacks&& step_callbacks) : step_callbacks_{std::move(step_callbacks)} { ctx_.resize(step_callbacks_.callbacks_.size()); if (step_callbacks_.needs_ids_) { setHandle(next_unique_record_function_handle()); } } void RecordFunction::runStartCallbacks() { for (const auto i : c10::irange(step_callbacks_.callbacks_.size())) { tryRunCallback</*is_start=*/true>( step_callbacks_.callbacks_[i], *this, ctx_[i]); } called_start_callbacks_ = true; } void RecordFunction::end() { if (called_start_callbacks_) { for (const auto i : c10::irange(step_callbacks_.callbacks_.size())) { tryRunCallback</*is_start=*/false>( step_callbacks_.callbacks_[i], *this, ctx_[i]); } step_callbacks_.callbacks_.clear(); } } const char* RecordFunction::name() const { return std::visit( c10::overloaded( [](const std::string& name) { return name.c_str(); }, [](const schema_ref_t schema) { return schema.get().name().c_str(); }), fn_); } size_t RecordFunction::num_inputs() const { return std::visit( c10::overloaded( [&](const std::string&) { return inputs_.size(); }, [](const schema_ref_t schema) { return schema.get().arguments().size(); }), fn_); } size_t RecordFunction::num_outputs() const { return std::visit( c10::overloaded( [&](const std::string&) { return outputs_.size(); }, [](const schema_ref_t schema) { return schema.get().returns().size(); }), fn_); } std::optional<OperatorName> RecordFunction::operator_name() const { return std::visit( c10::overloaded( [&](const std::string&) -> std::optional<OperatorName> { return std::nullopt; }, [](const schema_ref_t schema) -> std::optional<OperatorName> { return schema.get().operator_name(); }), fn_); } std::optional<c10::FunctionSchema> RecordFunction::operator_schema() const { return std::visit( c10::overloaded( [&](const std::string&) -> std::optional<c10::FunctionSchema> { return std::nullopt; }, [](const schema_ref_t schema) -> std::optional<c10::FunctionSchema> { return schema.get(); }), fn_); } const char* RecordFunction::overload_name() const { return std::visit( c10::overloaded( [&](const std::string&) -> const char* { return ""; }, [](const schema_ref_t schema) -> const char* { return schema.get().overload_name().c_str(); }), fn_); } StepCallbacks getStepCallbacks(RecordScope scope) { return LocalCallbackManager::get().getActiveCallbacks(scope); } std::optional<StepCallbacks> getStepCallbacksUnlessEmpty(RecordScope scope) { return LocalCallbackManager::get().getActiveCallbacksUnlessEmpty(scope); } const RecordFunctionTLS& get_record_function_tls_() { return LocalCallbackManager::get().getTLS(); } void set_record_function_tls_(const RecordFunctionTLS& tls) { LocalCallbackManager::get().setTLS(tls); } namespace { bool anyEnabled(const RecordFunctionCallbacks& callbacks) { return std::any_of(callbacks.begin(), callbacks.end(), [](const auto& cb) { return cb.enabled_; }); } } // namespace bool hasCallbacks() { return hasThreadLocalCallbacks() || hasGlobalCallbacks(); } bool hasGlobalCallbacks() { return anyEnabled(GlobalCallbackManager::get().getSnapshot().second); } bool hasThreadLocalCallbacks() { return anyEnabled(get_record_function_tls_().sorted_tls_callbacks_); } CallbackHandle addThreadLocalCallback(RecordFunctionCallback cb) { return LocalCallbackManager::get().addCallback(cb); } CallbackHandle addGlobalCallback(RecordFunctionCallback cb) { return GlobalCallbackManager::get().addCallback(cb); } void removeCallback(CallbackHandle handle) { if (!LocalCallbackManager::get().removeCallback(handle)) { GlobalCallbackManager::get().removeCallback(handle); } } void disableCallback(CallbackHandle handle) { if (!LocalCallbackManager::get().setCallbackEnabled(handle, false)) { GlobalCallbackManager::get().setCallbackEnabled(handle, false); } } void reenableCallback(CallbackHandle handle) { if (!LocalCallbackManager::get().setCallbackEnabled(handle, true)) { GlobalCallbackManager::get().setCallbackEnabled(handle, true); } } void clearGlobalCallbacks() { GlobalCallbackManager::get().clearCallbacks(); } void clearThreadLocalCallbacks() { LocalCallbackManager::get().clearCallbacks(); } void clearCallbacks() { clearGlobalCallbacks(); clearThreadLocalCallbacks(); } bool isRecordFunctionEnabled() { return LocalCallbackManager::get().getTLS().tls_record_function_enabled_; } void enableRecordFunction(bool enable) { auto tls = LocalCallbackManager::get().getTLS(); if (tls.tls_record_function_enabled_ != enable) { tls.tls_record_function_enabled_ = enable; LocalCallbackManager::get().setTLS(tls); } } void set_record_function_seed_for_testing(uint32_t seed) { LocalCallbackManager::get().seed(seed); } /* static */ uint64_t RecordFunction::currentThreadId() { if (!current_thread_id_) { // happens only once per thread current_thread_id_ = ++next_thread_id_; } return current_thread_id_; } void RecordFunction::before(RecordFunction::FunctionDescriptor fn, int64_t sequence_nr) { std::visit([this](auto&& fn) { if constexpr (std::is_same_v<std::decay_t<decltype(fn)>, std::string_view>) { is_nccl_meta_ = (fn == kParamCommsCallName); fn_ = std::string(fn); } else { is_nccl_meta_ = (fn.get().name() == kParamCommsCallName); fn_ = fn; } }, fn); sequence_nr_ = sequence_nr; #ifndef NDEBUG inputs_valid_ = true; #endif runStartCallbacks(); invalidateInputs(); } /* static */ void RecordFunction::setDefaultNodeId(int64_t newDefaultNodeId) { TORCH_CHECK(newDefaultNodeId >= 0, "setDefaultNodeId expects an id >= 0."); defaultNodeId = newDefaultNodeId; } /* static */ int64_t RecordFunction::getDefaultNodeId() { return defaultNodeId; } RecordFunction::~RecordFunction() { end(); } void RecordFunction::_setAsync() { is_async_ = true; } bool RecordFunction::isAsync() const { return is_async_; } void RecordFunction::_setStaticRuntimeOutVariant() { if (isActive()) { is_static_runtime_out_variant_ = true; } } bool RecordFunction::isStaticRuntimeOutVariant() const { if (isActive()) { return is_static_runtime_out_variant_; } return false; } } // namespace at
cpp
github
https://github.com/pytorch/pytorch
aten/src/ATen/record_function.cpp
# -*- coding: utf-8 -*- # ########################## Copyrights and license ############################ # # # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> # # Copyright 2012 Zearin <zearin@gonk.net> # # Copyright 2013 AKFish <akfish@gmail.com> # # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # # # # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # # # # PyGithub is free software: you can redistribute it and/or modify it under # # the terms of the GNU Lesser General Public License as published by the Free # # Software Foundation, either version 3 of the License, or (at your option) # # any later version. # # # # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # # # # ############################################################################## import github.GithubObject import github.Issue import github.NamedUser class IssueEvent(github.GithubObject.CompletableGithubObject): """ This class represents IssueEvents as returned for example by http://developer.github.com/v3/todo """ @property def actor(self): """ :type: :class:`github.NamedUser.NamedUser` """ self._completeIfNotSet(self._actor) return self._actor.value @property def commit_id(self): """ :type: string """ self._completeIfNotSet(self._commit_id) return self._commit_id.value @property def created_at(self): """ :type: datetime.datetime """ self._completeIfNotSet(self._created_at) return self._created_at.value @property def event(self): """ :type: string """ self._completeIfNotSet(self._event) return self._event.value @property def id(self): """ :type: integer """ self._completeIfNotSet(self._id) return self._id.value @property def issue(self): """ :type: :class:`github.Issue.Issue` """ self._completeIfNotSet(self._issue) return self._issue.value @property def url(self): """ :type: string """ self._completeIfNotSet(self._url) return self._url.value def _initAttributes(self): self._actor = github.GithubObject.NotSet self._commit_id = github.GithubObject.NotSet self._created_at = github.GithubObject.NotSet self._event = github.GithubObject.NotSet self._id = github.GithubObject.NotSet self._issue = github.GithubObject.NotSet self._url = github.GithubObject.NotSet def _useAttributes(self, attributes): if "actor" in attributes: # pragma no branch self._actor = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["actor"]) if "commit_id" in attributes: # pragma no branch self._commit_id = self._makeStringAttribute(attributes["commit_id"]) if "created_at" in attributes: # pragma no branch self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) if "event" in attributes: # pragma no branch self._event = self._makeStringAttribute(attributes["event"]) if "id" in attributes: # pragma no branch self._id = self._makeIntAttribute(attributes["id"]) if "issue" in attributes: # pragma no branch self._issue = self._makeClassAttribute(github.Issue.Issue, attributes["issue"]) if "url" in attributes: # pragma no branch self._url = self._makeStringAttribute(attributes["url"])
unknown
codeparrot/codeparrot-clean
#! /usr/bin/env python3 import sqlite3 import os import hashlib import codecs import bcrypt from Crypto.Cipher import AES from password import encrypt, decrypt, toHex, fromHex import config pwdatabase = config.dbfile '''This utility only needs to be run once to convert from an unencrypted database.''' '''Fill in password here before running''' password = '' conn = sqlite3.connect(pwdatabase) salt = [i for i in conn.execute('select salt from master_pass')][0][0] print(salt) aes_key = bcrypt.kdf(password, salt, 16, 32) print(toHex(aes_key)) rowids = [i[0] for i in conn.execute('select rowid from passwords')] print(rowids) for rowid in rowids: password = [i for i in conn.execute('select password from passwords where rowid=?', (rowid,))][0][0] other = [i for i in conn.execute('select other from passwords where rowid=?', (rowid,))][0][0] print(rowid, password, other) enc_password = encrypt(aes_key, password) enc_other = encrypt(aes_key, other) print(rowid, enc_password, enc_other) conn.execute('update passwords set password=?, other=? where rowid=?', (enc_password, enc_other, rowid)) conn.commit() conn.close()
unknown
codeparrot/codeparrot-clean