query_name
stringlengths
13
55
code_file_path
stringlengths
14
194
context_blocks
list
answer_spans
list
supporting_fact_spans
list
example_type
int8
0
1
single_hop
bool
2 classes
subtokenized_input_sequence
list
label_sequence
list
Missing call to `__init__` during object initialization
testing-cabal/mock/mock/mock.py
[ { "content": " def __init__(self, *args, **kwargs):\n pass", "metadata": "root.Base.__init__", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 479 }, { "content": " def __init__(\n self, spec=None, wraps=None, name=None, spec_set=None,\n parent=None, _spec_state=None, _new_name='', _new_parent=None,\n _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs\n ):\n if _new_parent is None:\n _new_parent = parent\n\n __dict__ = self.__dict__\n __dict__['_mock_parent'] = parent\n __dict__['_mock_name'] = name\n __dict__['_mock_new_name'] = _new_name\n __dict__['_mock_new_parent'] = _new_parent\n\n if spec_set is not None:\n spec = spec_set\n spec_set = True\n if _eat_self is None:\n _eat_self = parent is not None\n\n self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)\n\n __dict__['_mock_children'] = {}\n __dict__['_mock_wraps'] = wraps\n __dict__['_mock_delegate'] = None\n\n __dict__['_mock_called'] = False\n __dict__['_mock_call_args'] = None\n __dict__['_mock_call_count'] = 0\n __dict__['_mock_call_args_list'] = _CallList()\n __dict__['_mock_mock_calls'] = _CallList()\n\n __dict__['method_calls'] = _CallList()\n __dict__['_mock_unsafe'] = unsafe\n\n if kwargs:\n self.configure_mock(**kwargs)\n\n _safe_super(NonCallableMock, self).__init__(\n spec, wraps, name, spec_set, parent,\n _spec_state\n )", "metadata": "root.NonCallableMock.__init__", "header": "['class', 'NonCallableMock', '(', 'Base', ')', ':', '___EOS___']", "index": 496 }, { "content": " def __init__(self, spec=None, side_effect=None, return_value=DEFAULT,\n wraps=None, name=None, spec_set=None, parent=None,\n _spec_state=None, _new_name='', _new_parent=None, **kwargs):\n self.__dict__['_mock_return_value'] = return_value\n\n _safe_super(CallableMixin, self).__init__(\n spec, wraps, name, spec_set, parent,\n _spec_state, _new_name, _new_parent, **kwargs\n )\n\n self.side_effect = side_effect", "metadata": "root.CallableMixin.__init__", "header": "['class', 'CallableMixin', '(', 'Base', ')', ':', '___EOS___']", "index": 1039 }, { "content": "class Mock(CallableMixin, NonCallableMock):\n \"\"\"\n Create a new `Mock` object. `Mock` takes several optional arguments\n that specify the behaviour of the Mock object:\n\n * `spec`: This can be either a list of strings or an existing object (a\n class or instance) that acts as the specification for the mock object. If\n you pass in an object then a list of strings is formed by calling dir on\n the object (excluding unsupported magic attributes and methods). Accessing\n any attribute not in this list will raise an `AttributeError`.\n\n If `spec` is an object (rather than a list of strings) then\n `mock.__class__` returns the class of the spec object. This allows mocks\n to pass `isinstance` tests.\n\n * `spec_set`: A stricter variant of `spec`. If used, attempting to *set*\n or get an attribute on the mock that isn't on the object passed as\n `spec_set` will raise an `AttributeError`.\n\n * `side_effect`: A function to be called whenever the Mock is called. See\n the `side_effect` attribute. Useful for raising exceptions or\n dynamically changing return values. The function is called with the same\n arguments as the mock, and unless it returns `DEFAULT`, the return\n value of this function is used as the return value.\n\n Alternatively `side_effect` can be an exception class or instance. In\n this case the exception will be raised when the mock is called.\n\n If `side_effect` is an iterable then each call to the mock will return\n the next value from the iterable. If any of the members of the iterable\n are exceptions they will be raised instead of returned.\n\n * `return_value`: The value returned when the mock is called. By default\n this is a new Mock (created on first access). See the\n `return_value` attribute.\n\n * `wraps`: Item for the mock object to wrap. If `wraps` is not None then\n calling the Mock will pass the call through to the wrapped object\n (returning the real result). Attribute access on the mock will return a\n Mock object that wraps the corresponding attribute of the wrapped object\n (so attempting to access an attribute that doesn't exist will raise an\n `AttributeError`).\n\n If the mock has an explicit `return_value` set then calls are not passed\n to the wrapped object and the `return_value` is returned instead.\n\n * `name`: If the mock has a name then it will be used in the repr of the\n mock. This can be useful for debugging. The name is propagated to child\n mocks.\n\n Mocks can also be called with arbitrary keyword arguments. These will be\n used to set attributes on the mock after it is created.\n \"\"\"", "metadata": "root.Mock", "header": "['module', '___EOS___']", "index": 1138 }, { "content": " def __init__(self, *args, **kw):\n self._mock_set_magics() # make magic work for kwargs in init\n _safe_super(MagicMixin, self).__init__(*args, **kw)\n self._mock_set_magics() # fix magic broken by upper level init", "metadata": "root.MagicMixin.__init__", "header": "['class', 'MagicMixin', '(', 'object', ')', ':', '___EOS___']", "index": 1960 }, { "content": "class NonCallableMagicMock(MagicMixin, NonCallableMock):\n \"\"\"A version of `MagicMock` that isn't callable.\"\"\"", "metadata": "root.NonCallableMagicMock", "header": "['module', '___EOS___']", "index": 1989 }, { "content": "class MagicMock(MagicMixin, Mock):\n \"\"\"\n MagicMock is a subclass of Mock with default implementations\n of most of the magic methods. You can use MagicMock without having to\n configure the magic methods yourself.\n\n If you use the `spec` or `spec_set` arguments then *only* magic\n methods that exist in the spec will be created.\n\n Attributes and the return value of a `MagicMock` will also be `MagicMocks`.\n \"\"\"", "metadata": "root.MagicMock", "header": "['module', '___EOS___']", "index": 2002 } ]
[ { "span": "class Mock(CallableMixin, NonCallableMock):", "start_line": 1138, "start_column": 0, "end_line": 1138, "end_column": 43 }, { "span": "class NonCallableMagicMock(MagicMixin, NonCallableMock):", "start_line": 1989, "start_column": 0, "end_line": 1989, "end_column": 56 }, { "span": "class MagicMock(MagicMixin, Mock):", "start_line": 2002, "start_column": 0, "end_line": 2002, "end_column": 34 } ]
[ { "span": "def __init__(\n self, spec=None, wraps=None, name=None, spec_set=None,\n parent=None, _spec_state=None, _new_name='', _new_parent=None,\n _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs\n ):", "start_line": 496, "start_column": 4, "end_line": 500, "end_column": 10 }, { "span": "def __init__(self, spec=None, side_effect=None, return_value=DEFAULT,\n wraps=None, name=None, spec_set=None, parent=None,\n _spec_state=None, _new_name='', _new_parent=None, **kwargs):", "start_line": 1039, "start_column": 4, "end_line": 1041, "end_column": 77 }, { "span": "def __init__(self, *args, **kw):", "start_line": 1960, "start_column": 4, "end_line": 1960, "end_column": 36 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Non", "Call", "able", "Mock_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "spec_", "=_", "None_", ",_", "wraps_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "spec", "\\u", "set_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "None_", ",_", "\\u", "spec", "\\u", "state_", "=_", "None_", ",_", "\\u", "new", "\\u", "name_", "=_", "''_", ",_", "\\u", "new", "\\u", "parent_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "spec", "\\u", "as", "\\u", "instance_", "=_", "False_", ",_", "\\u", "eat", "\\u", "self_", "=_", "None_", ",_", "unsafe", "_", "=_", "False_", ",_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "new", "\\u", "parent_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "new", "\\u", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "=_", "self_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "parent", "'_", "]_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "name", "'_", "]_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "new", "\\u", "name", "'_", "]_", "=_", "\\u", "new", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "new", "\\u", "parent", "'_", "]_", "=_", "\\u", "new", "\\u", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "spec", "\\u", "set_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spec_", "=_", "spec", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spec", "\\u", "set_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "eat", "\\u", "self_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "eat", "\\u", "self_", "=_", "parent_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "add", "\\u", "spec_", "(_", "spec_", ",_", "spec", "\\u", "set_", ",_", "\\u", "spec", "\\u", "as", "\\u", "instance_", ",_", "\\u", "eat", "\\u", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "child", "ren", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "wrap", "s", "'_", "]_", "=_", "wraps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "delegate", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "call", "ed", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "call", "\\u", "args", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "call", "\\u", "count", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "call", "\\u", "args", "\\u", "list", "'_", "]_", "=_", "\\u", "Call", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "mock", "\\u", "calls", "'_", "]_", "=_", "\\u", "Call", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'", "method", "\\u", "calls", "'_", "]_", "=_", "\\u", "Call", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "unsafe", "'_", "]_", "=_", "unsafe", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "configur", "e\\u", "mock_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "safe", "\\u", "super_", "(_", "Non", "Call", "able", "Mock_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "wraps_", ",_", "name_", ",_", "spec", "\\u", "set_", ",_", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "spec", "\\u", "state_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Call", "able", "Mixin_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "spec_", "=_", "None_", ",_", "side", "\\u", "effect_", "=_", "None_", ",_", "return", "\\u", "value_", "=_", "DEFAULT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wraps_", "=_", "None_", ",_", "name_", "=_", "None_", ",_", "spec", "\\u", "set_", "=_", "None_", ",_", "parent_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "spec", "\\u", "state_", "=_", "None_", ",_", "\\u", "new", "\\u", "name_", "=_", "''_", ",_", "\\u", "new", "\\u", "parent_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "'\\u", "mock", "\\u", "return", "\\u", "value", "'_", "]_", "=_", "return", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "safe", "\\u", "super_", "(_", "Call", "able", "Mixin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "spec_", ",_", "wraps_", ",_", "name_", ",_", "spec", "\\u", "set_", ",_", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "spec", "\\u", "state_", ",_", "\\u", "new", "\\u", "name_", ",_", "\\u", "new", "\\u", "parent_", ",_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "side", "\\u", "effect_", "=_", "side", "\\u", "effect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mock_", "(_", "Call", "able", "Mixin_", ",_", "Non", "Call", "able", "Mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "new", " ", "`", "Moc", "k", "`", " ", "object", ".", " ", "`", "Moc", "k", "`", " ", "take", "s", " ", "sever", "al", " ", "option", "al", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "speci", "fy", " ", "the", " ", "behaviour", " ", "of", " ", "the", " ", "Moc", "k", " ", "object", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "`", "spec", "`", ":", " ", "Thi", "s", " ", "can", " ", "be", " ", "eit", "her", " ", "a", " ", "list", " ", "of", " ", "string", "s", " ", "or", " ", "an", " ", "exist", "ing", " ", "object", " ", "(", "a", "\\", "10", ";", " ", " ", "class", " ", "or", " ", "instance", ")", " ", "tha", "t", " ", "acts", " ", "as", " ", "the", " ", "specifica", "tion", " ", "for", " ", "the", " ", "mock", " ", "object", ".", " ", "If", "\\", "10", ";", " ", " ", "you", " ", "pass", " ", "in", " ", "an", " ", "object", " ", "then", " ", "a", " ", "list", " ", "of", " ", "string", "s", " ", "is", " ", "formed", " ", "by", " ", "calling", " ", "dir", " ", "on", "\\", "10", ";", " ", " ", "the", " ", "object", " ", "(", "excluding", " ", "unsup", "porte", "d", " ", "magic", " ", "attribute", "s", " ", "and", " ", "method", "s", ").", " ", "Access", "ing", "\\", "10", ";", " ", " ", "any", " ", "attribute", " ", "not", " ", "in", " ", "this", " ", "list", " ", "will", " ", "raise", " ", "an", " ", "`", "Attribute", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "`", "spec", "`", " ", "is", " ", "an", " ", "object", " ", "(", "rat", "her", " ", "than", " ", "a", " ", "list", " ", "of", " ", "string", "s", ")", " ", "then", "\\", "10", ";", " ", " ", "`", "mock", ".\\u", "\\u", "class", "\\u\\u", "`", " ", "return", "s", " ", "the", " ", "class", " ", "of", " ", "the", " ", "spec", " ", "object", ".", " ", "Thi", "s", " ", "allow", "s", " ", "mock", "s", "\\", "10", ";", " ", " ", "to", " ", "pass", " ", "`", "isin", "stance", "`", " ", "tests", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "`", "spec", "\\u", "set", "`", ":", " ", "A", " ", "strict", "er", " ", "variant", " ", "of", " ", "`", "spec", "`.", " ", "If", " ", "used", ",", " ", "atte", "mpt", "ing", " ", "to", " ", "*", "set", "*", "\\", "10", ";", " ", " ", "or", " ", "get", " ", "an", " ", "attribute", " ", "on", " ", "the", " ", "mock", " ", "tha", "t", " ", "isn", "'", "t", " ", "on", " ", "the", " ", "object", " ", "pass", "ed", " ", "as", "\\", "10", ";", " ", " ", "`", "spec", "\\u", "set", "`", " ", "will", " ", "raise", " ", "an", " ", "`", "Attribute", "Error", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "`", "side", "\\u", "effect", "`", ":", " ", "A", " ", "function", " ", "to", " ", "be", " ", "call", "ed", " ", "whe", "neve", "r", " ", "the", " ", "Moc", "k", " ", "is", " ", "call", "ed", ".", " ", "See", "\\", "10", ";", " ", " ", "the", " ", "`", "side", "\\u", "effect", "`", " ", "attribute", ".", " ", "Us", "efu", "l", " ", "for", " ", "rais", "ing", " ", "exception", "s", " ", "or", "\\", "10", ";", " ", " ", "dynami", "call", "y", " ", "chang", "ing", " ", "return", " ", "values", ".", " ", "The", " ", "function", " ", "is", " ", "call", "ed", " ", "with", " ", "the", " ", "same", "\\", "10", ";", " ", " ", "argu", "ment", "s", " ", "as", " ", "the", " ", "mock", ",", " ", "and", " ", "unl", "ess", " ", "it", " ", "return", "s", " ", "`", "DEF", "AUL", "T", "`", ",", " ", "the", " ", "return", "\\", "10", ";", " ", " ", "value", " ", "of", " ", "this", " ", "function", " ", "is", " ", "used", " ", "as", " ", "the", " ", "return", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Alternative", "ly", " ", "`", "side", "\\u", "effect", "`", " ", "can", " ", "be", " ", "an", " ", "exception", " ", "class", " ", "or", " ", "instance", ".", " ", "In", "\\", "10", ";", " ", " ", "this", " ", "case", " ", "the", " ", "exception", " ", "will", " ", "be", " ", "raise", "d", " ", "whe", "n", " ", "the", " ", "mock", " ", "is", " ", "call", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "`", "side", "\\u", "effect", "`", " ", "is", " ", "an", " ", "iterable", " ", "then", " ", "each", " ", "call", " ", "to", " ", "the", " ", "mock", " ", "will", " ", "return", "\\", "10", ";", " ", " ", "the", " ", "next", " ", "value", " ", "from", " ", "the", " ", "iterable", ".", " ", "If", " ", "any", " ", "of", " ", "the", " ", "member", "s", " ", "of", " ", "the", " ", "iterable", "\\", "10", ";", " ", " ", "are", " ", "exception", "s", " ", "the", "y", " ", "will", " ", "be", " ", "raise", "d", " ", "inst", "ead", " ", "of", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "`", "return", "\\u", "value", "`", ":", " ", "The", " ", "value", " ", "return", "ed", " ", "whe", "n", " ", "the", " ", "mock", " ", "is", " ", "call", "ed", ".", " ", "By", " ", "default", "\\", "10", ";", " ", " ", "this", " ", "is", " ", "a", " ", "new", " ", "Moc", "k", " ", "(", "created", " ", "on", " ", "first", " ", "access", ").", " ", "See", " ", "the", "\\", "10", ";", " ", " ", "`", "return", "\\u", "value", "`", " ", "attribute", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "`", "wrap", "s", "`", ":", " ", "Item", " ", "for", " ", "the", " ", "mock", " ", "object", " ", "to", " ", "wrap", ".", " ", "If", " ", "`", "wrap", "s", "`", " ", "is", " ", "not", " ", "Non", "e", " ", "then", "\\", "10", ";", " ", " ", "calling", " ", "the", " ", "Moc", "k", " ", "will", " ", "pass", " ", "the", " ", "call", " ", "through", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "object", "\\", "10", ";", " ", " ", "(", "return", "ing", " ", "the", " ", "real", " ", "result", ").", " ", "Attribute", " ", "access", " ", "on", " ", "the", " ", "mock", " ", "will", " ", "return", " ", "a", "\\", "10", ";", " ", " ", "Moc", "k", " ", "object", " ", "tha", "t", " ", "wrap", "s", " ", "the", " ", "correspond", "ing", " ", "attribute", " ", "of", " ", "the", " ", "wrapp", "ed", " ", "object", "\\", "10", ";", " ", " ", "(", "so", " ", "atte", "mpt", "ing", " ", "to", " ", "access", " ", "an", " ", "attribute", " ", "tha", "t", " ", "doe", "sn", "'", "t", " ", "exist", " ", "will", " ", "raise", " ", "an", "\\", "10", ";", " ", " ", "`", "Attribute", "Error", "`)", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "the", " ", "mock", " ", "has", " ", "an", " ", "explicit", " ", "`", "return", "\\u", "value", "`", " ", "set", " ", "then", " ", "calls", " ", "are", " ", "not", " ", "pass", "ed", "\\", "10", ";", " ", " ", "to", " ", "the", " ", "wrapp", "ed", " ", "object", " ", "and", " ", "the", " ", "`", "return", "\\u", "value", "`", " ", "is", " ", "return", "ed", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "`", "name", "`", ":", " ", "If", " ", "the", " ", "mock", " ", "has", " ", "a", " ", "name", " ", "then", " ", "it", " ", "will", " ", "be", " ", "used", " ", "in", " ", "the", " ", "repr", " ", "of", " ", "the", "\\", "10", ";", " ", " ", "mock", ".", " ", "Thi", "s", " ", "can", " ", "be", " ", "usef", "ul", " ", "for", " ", "debugg", "ing", ".", " ", "The", " ", "name", " ", "is", " ", "propagate", "d", " ", "to", " ", "child", "\\", "10", ";", " ", " ", "mock", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Moc", "ks", " ", "can", " ", "als", "o", " ", "be", " ", "call", "ed", " ", "with", " ", "arbitra", "ry", " ", "keyw", "ord", " ", "argu", "ment", "s", ".", " ", "The", "se", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "to", " ", "set", " ", "attribute", "s", " ", "on", " ", "the", " ", "mock", " ", "after", " ", "it", " ", "is", " ", "created", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mag", "ic", "Mixin_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mock", "\\u", "set\\u", "magic", "s_", "(_", ")_", "#", " ", "make", " ", "magic", " ", "work", " ", "for", " ", "kwarg", "s", " ", "in", " ", "init_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "safe", "\\u", "super_", "(_", "Mag", "ic", "Mixin_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mock", "\\u", "set\\u", "magic", "s_", "(_", ")_", "#", " ", "fix", " ", "magic", " ", "broken", " ", "by", " ", "upper", " ", "level", " ", "init_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Non", "Call", "able", "Mag", "ic", "Mock_", "(_", "Mag", "ic", "Mixin_", ",_", "Non", "Call", "able", "Mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "version", " ", "of", " ", "`", "Mag", "ic", "Moc", "k", "`", " ", "tha", "t", " ", "isn", "'", "t", " ", "calla", "ble", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mag", "ic", "Mock_", "(_", "Mag", "ic", "Mixin_", ",_", "Mock_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Mag", "ic", "Moc", "k", " ", "is", " ", "a", " ", "subclass", " ", "of", " ", "Moc", "k", " ", "with", " ", "default", " ", "implementation", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "most", " ", "of", " ", "the", " ", "magic", " ", "method", "s", ".", " ", "You", " ", "can", " ", "use", " ", "Mag", "ic", "Moc", "k", " ", "with", "out", " ", "hav", "ing", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "configur", "e", " ", "the", " ", "magic", " ", "method", "s", " ", "your", "self", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "use", " ", "the", " ", "`", "spec", "`", " ", "or", " ", "`", "spec", "\\u", "set", "`", " ", "argu", "ment", "s", " ", "then", " ", "*", "only", "*", " ", "magic", "\\", "10", ";", " ", " ", " ", " ", "method", "s", " ", "tha", "t", " ", "exist", " ", "in", " ", "the", " ", "spec", " ", "will", " ", "be", " ", "created", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Attribute", "s", " ", "and", " ", "the", " ", "return", " ", "value", " ", "of", " ", "a", " ", "`", "Mag", "ic", "Moc", "k", "`", " ", "will", " ", "als", "o", " ", "be", " ", "`", "Mag", "ic", "Moc", "ks", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
dnanexus/dx-toolkit/src/python/dxpy/cli/cp.py
[ { "content": "def cp_to_noexistent_destination(args, dest_path, dx_dest, dest_proj):\n ''' Copy the source to a destination that does not currently\n exist. This involves creating the target file/folder.\n '''\n # Destination folder path is new => renaming\n if len(args.sources) != 1:\n # Can't copy and rename more than one object\n raise DXCLIError('The destination folder does not exist')\n last_slash_pos = get_last_pos_of_char('/', dest_path)\n if last_slash_pos == 0:\n dest_folder = '/'\n else:\n dest_folder = dest_path[:last_slash_pos]\n dest_name = dest_path[last_slash_pos + 1:].replace('\\/', '/')\n try:\n dx_dest.list_folder(folder=dest_folder, only='folders')\n except dxpy.DXAPIError as details:\n if details.code == requests.codes['not_found']:\n raise DXCLIError('The destination folder does not exist')\n else:\n raise\n except:\n err_exit()\n\n # Clone and rename either the data object or the folder.\n # src_result is None if it could not be resolved to an object.\n src_proj, src_path, src_results = try_call(resolve_existing_path,\n args.sources[0],\n allow_mult=True, all_mult=args.all)\n\n if src_proj == dest_proj:\n if is_hashid(args.sources[0]):\n # This is the only case in which the source project is\n # purely assumed, so give a better error message.\n raise DXCLIError(fill('Error: You must specify a source project for ' + args.sources[0]))\n else:\n raise DXCLIError(fill('A source path and the destination path resolved to the ' +\n 'same project or container. Please specify different source ' +\n 'and destination containers, e.g.') +\n '\\n dx cp source-project:source-id-or-path dest-project:dest-path')\n\n if src_results is None:\n try:\n contents = dxpy.api.project_list_folder(src_proj,\n {\"folder\": src_path, \"includeHidden\": True})\n dxpy.api.project_new_folder(dest_proj, {\"folder\": dest_path})\n exists = dxpy.api.project_clone(src_proj,\n {\"folders\": contents['folders'],\n \"objects\": [result['id'] for result in contents['objects']],\n \"project\": dest_proj,\n \"destination\": dest_path})['exists']\n if len(exists) > 0:\n print(fill('The following objects already existed in the destination ' +\n 'container and were not copied:') + '\\n ' + '\\n '.join(exists))\n return\n except:\n err_exit()\n else:\n try:\n exists = dxpy.api.project_clone(src_proj,\n {\"objects\": [result['id'] for result in src_results],\n \"project\": dest_proj,\n \"destination\": dest_folder})['exists']\n if len(exists) > 0:\n print(fill('The following objects already existed in the destination ' +\n 'container and were not copied:') + '\\n ' + '\\n '.join(exists))\n for result in src_results:\n if result['id'] not in exists:\n dxpy.DXHTTPRequest('/' + result['id'] + '/rename',\n {\"project\": dest_proj,\n \"name\": dest_name})\n return\n except:\n err_exit()", "metadata": "root.cp_to_noexistent_destination", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def cp(args):\n dest_proj, dest_path, _none = try_call(resolve_path, args.destination, expected='folder')\n if dest_path is None:\n raise DXCLIError('Cannot copy to a hash ID')\n dx_dest = dxpy.get_handler(dest_proj)\n try:\n # check if the destination exists\n dx_dest.list_folder(folder=dest_path, only='folders')\n except:\n cp_to_noexistent_destination(args, dest_path, dx_dest, dest_proj)\n return\n\n # The destination exists, we need to copy all of the sources to it.\n if len(args.sources) == 0:\n raise DXCLIError('No sources provided to copy to another project')\n src_objects = []\n src_folders = []\n for source in args.sources:\n src_proj, src_folderpath, src_results = try_call(resolve_existing_path,\n source,\n allow_mult=True, all_mult=args.all)\n if src_proj == dest_proj:\n if is_hashid(source):\n # This is the only case in which the source project is\n # purely assumed, so give a better error message.\n raise DXCLIError(fill('Error: You must specify a source project for ' + source))\n else:\n raise DXCLIError(fill('Error: A source path and the destination path resolved ' +\n 'to the same project or container. Please specify ' +\n 'different source and destination containers, e.g.') +\n '\\n dx cp source-project:source-id-or-path dest-project:dest-path')\n\n if src_proj is None:\n raise DXCLIError(fill('Error: A source project must be specified or a current ' +\n 'project set in order to clone objects between projects'))\n\n if src_results is None:\n src_folders.append(src_folderpath)\n else:\n src_objects += [result['id'] for result in src_results]\n try:\n exists = dxpy.DXHTTPRequest('/' + src_proj + '/clone',\n {\"objects\": src_objects,\n \"folders\": src_folders,\n \"project\": dest_proj,\n \"destination\": dest_path})['exists']\n if len(exists) > 0:\n print(fill('The following objects already existed in the destination container ' +\n 'and were left alone:') + '\\n ' + '\\n '.join(exists))\n except:\n err_exit()", "metadata": "root.cp", "header": "['module', '___EOS___']", "index": 109 } ]
[ { "span": "except:", "start_line": 54, "start_column": 4, "end_line": 54, "end_column": 11 }, { "span": "except:", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 15 }, { "span": "except:", "start_line": 105, "start_column": 8, "end_line": 105, "end_column": 15 }, { "span": "except:", "start_line": 117, "start_column": 4, "end_line": 117, "end_column": 11 }, { "span": "except:", "start_line": 158, "start_column": 4, "end_line": 158, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "cp", "\\u", "to", "\\u", "noe", "xist", "ent", "\\u", "destination_", "(_", "args_", ",_", "dest", "\\u", "path_", ",_", "dx", "\\u", "dest_", ",_", "dest", "\\u", "proj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Copy", " ", "the", " ", "source", " ", "to", " ", "a", " ", "destinat", "ion", " ", "tha", "t", " ", "doe", "s", " ", "not", " ", "currentl", "y", "\\", "10", ";", " ", " ", " ", " ", "exist", ".", " ", "Thi", "s", " ", "involv", "es", " ", "creati", "ng", " ", "the", " ", "target", " ", "file", "/", "folder", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dest", "ination", " ", "folder", " ", "path", " ", "is", " ", "new", " ", "=>", " ", "rena", "ming", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", "._", "sources_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Can", "'", "t", " ", "copy", " ", "and", " ", "rename", " ", "more", " ", "than", " ", "one", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "'", "The", " ", "destinat", "ion", " ", "folder", " ", "doe", "s", " ", "not", " ", "exist", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "last", "\\u", "slash", "\\u", "pos_", "=_", "get", "\\u", "last", "\\u", "pos", "\\u", "of", "\\u", "char_", "(_", "'/'_", ",_", "dest", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "last", "\\u", "slash", "\\u", "pos_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "folder_", "=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "folder_", "=_", "dest", "\\u", "path_", "[_", ":_", "last", "\\u", "slash", "\\u", "pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dest", "\\u", "name_", "=_", "dest", "\\u", "path_", "[_", "last", "\\u", "slash", "\\u", "pos_", "+_", "1_", ":_", "]_", "._", "replace_", "(_", "'\\\\", "/'_", ",_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx", "\\u", "dest_", "._", "list", "\\u", "folder_", "(_", "folder_", "=_", "dest", "\\u", "folder_", ",_", "only_", "=_", "'", "folder", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "dxp", "y_", "._", "DX", "API", "Error_", "as_", "details_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "details_", "._", "code_", "==_", "requests_", "._", "codes_", "[_", "'", "not", "\\u", "found", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "'", "The", " ", "destinat", "ion", " ", "folder", " ", "doe", "s", " ", "not", " ", "exist", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clone", " ", "and", " ", "rename", " ", "eit", "her", " ", "the", " ", "data", " ", "object", " ", "or", " ", "the", " ", "folder", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "src", "\\u", "result", " ", "is", " ", "Non", "e", " ", "if", " ", "it", " ", "coul", "d", " ", "not", " ", "be", " ", "resolve", "d", " ", "to", " ", "an", " ", "object", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src", "\\u", "proj_", ",_", "src", "\\u", "path_", ",_", "src", "\\u", "results_", "=_", "try", "\\u", "call_", "(_", "resolve", "\\u", "exist", "ing", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "._", "sources_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "mult_", "=_", "True_", ",_", "all", "\\u", "mult_", "=_", "args_", "._", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "src", "\\u", "proj_", "==_", "dest", "\\u", "proj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "hash", "id_", "(_", "args_", "._", "sources_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "only", " ", "case", " ", "in", " ", "whi", "ch", " ", "the", " ", "source", " ", "project", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pure", "ly", " ", "assume", "d", ",", " ", "so", " ", "give", " ", "a", " ", "bett", "er", " ", "error", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "fill_", "(_", "'", "Error", ":", " ", "You", " ", "must", " ", "speci", "fy", " ", "a", " ", "source", " ", "project", " ", "for", " ", "'_", "+_", "args_", "._", "sources_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "fill_", "(_", "'", "A", " ", "source", " ", "path", " ", "and", " ", "the", " ", "destinat", "ion", " ", "path", " ", "resolve", "d", " ", "to", " ", "the", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "same", " ", "project", " ", "or", " ", "container", ".", " ", " ", "Ple", "ase", " ", "speci", "fy", " ", "different", " ", "source", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "destinat", "ion", " ", "container", "s", ",", " ", "e", ".", "g", ".'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", " ", " ", "dx", " ", "cp", " ", "source", "-", "project", ":", "source", "-", "id", "-", "or", "-", "path", " ", "dest", "-", "project", ":", "dest", "-", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "src", "\\u", "results_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contents_", "=_", "dxp", "y_", "._", "api_", "._", "project", "\\u", "list", "\\u", "folder_", "(_", "src", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "folder", "\"_", ":_", "src", "\\u", "path_", ",_", "\"", "include", "Hi", "dde", "n", "\"_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dxp", "y_", "._", "api_", "._", "project", "\\u", "new", "\\u", "folder_", "(_", "dest", "\\u", "proj_", ",_", "{_", "\"", "folder", "\"_", ":_", "dest", "\\u", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exists_", "=_", "dxp", "y_", "._", "api_", "._", "project", "\\u", "clone_", "(_", "src", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "folder", "s", "\"_", ":_", "contents_", "[_", "'", "folder", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "object", "s", "\"_", ":_", "[_", "result_", "[_", "'", "id", "'_", "]_", "for_", "result_", "in_", "contents_", "[_", "'", "object", "s", "'_", "]_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\"_", ":_", "dest", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "destinat", "ion", "\"_", ":_", "dest", "\\u", "path_", "}_", ")_", "[_", "'", "exist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "exists_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "fill_", "(_", "'", "The", " ", "follow", "ing", " ", "object", "s", " ", "alr", "ead", "y", " ", "existed", " ", "in", " ", "the", " ", "destinat", "ion", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "container", " ", "and", " ", "wer", "e", " ", "not", " ", "copie", "d", ":'_", ")_", "+_", "'\\\\", "n", " ", "'_", "+_", "'\\\\", "n", " ", "'_", "._", "join_", "(_", "exists_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exists_", "=_", "dxp", "y_", "._", "api_", "._", "project", "\\u", "clone_", "(_", "src", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "object", "s", "\"_", ":_", "[_", "result_", "[_", "'", "id", "'_", "]_", "for_", "result_", "in_", "src", "\\u", "results_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\"_", ":_", "dest", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "destinat", "ion", "\"_", ":_", "dest", "\\u", "folder_", "}_", ")_", "[_", "'", "exist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "exists_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "fill_", "(_", "'", "The", " ", "follow", "ing", " ", "object", "s", " ", "alr", "ead", "y", " ", "existed", " ", "in", " ", "the", " ", "destinat", "ion", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "container", " ", "and", " ", "wer", "e", " ", "not", " ", "copie", "d", ":'_", ")_", "+_", "'\\\\", "n", " ", "'_", "+_", "'\\\\", "n", " ", "'_", "._", "join_", "(_", "exists_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "result_", "in_", "src", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "[_", "'", "id", "'_", "]_", "not_", "in_", "exists_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "dxp", "y_", "._", "DX", "HTTP", "Request_", "(_", "'/'_", "+_", "result_", "[_", "'", "id", "'_", "]_", "+_", "'/", "rename", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "project", "\"_", ":_", "dest", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "dest", "\\u", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "exit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cp_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest", "\\u", "proj_", ",_", "dest", "\\u", "path_", ",_", "\\u", "none_", "=_", "try", "\\u", "call_", "(_", "resolve", "\\u", "path_", ",_", "args_", "._", "destination_", ",_", "expected_", "=_", "'", "folder", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dest", "\\u", "path_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "'", "Cann", "ot", " ", "copy", " ", "to", " ", "a", " ", "hash", " ", "ID", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dx", "\\u", "dest_", "=_", "dxp", "y_", "._", "get", "\\u", "handler_", "(_", "dest", "\\u", "proj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "the", " ", "destinat", "ion", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx", "\\u", "dest_", "._", "list", "\\u", "folder_", "(_", "folder_", "=_", "dest", "\\u", "path_", ",_", "only_", "=_", "'", "folder", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cp", "\\u", "to", "\\u", "noe", "xist", "ent", "\\u", "destination_", "(_", "args_", ",_", "dest", "\\u", "path_", ",_", "dx", "\\u", "dest_", ",_", "dest", "\\u", "proj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "destinat", "ion", " ", "exist", "s", ",", " ", "we", " ", "need", " ", "to", " ", "copy", " ", "all", " ", "of", " ", "the", " ", "source", "s", " ", "to", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "args_", "._", "sources_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "'", "No", " ", "source", "s", " ", "provided", " ", "to", " ", "copy", " ", "to", " ", "anot", "her", " ", "project", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src", "\\u", "objects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "\\u", "folders_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "source_", "in_", "args_", "._", "sources_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "proj_", ",_", "src", "\\u", "folder", "path_", ",_", "src", "\\u", "results_", "=_", "try", "\\u", "call_", "(_", "resolve", "\\u", "exist", "ing", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "mult_", "=_", "True_", ",_", "all", "\\u", "mult_", "=_", "args_", "._", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "src", "\\u", "proj_", "==_", "dest", "\\u", "proj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "hash", "id_", "(_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "only", " ", "case", " ", "in", " ", "whi", "ch", " ", "the", " ", "source", " ", "project", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pure", "ly", " ", "assume", "d", ",", " ", "so", " ", "give", " ", "a", " ", "bett", "er", " ", "error", " ", "message", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "fill_", "(_", "'", "Error", ":", " ", "You", " ", "must", " ", "speci", "fy", " ", "a", " ", "source", " ", "project", " ", "for", " ", "'_", "+_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "fill_", "(_", "'", "Error", ":", " ", "A", " ", "source", " ", "path", " ", "and", " ", "the", " ", "destinat", "ion", " ", "path", " ", "resolve", "d", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "the", " ", "same", " ", "project", " ", "or", " ", "container", ".", " ", "Ple", "ase", " ", "speci", "fy", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "different", " ", "source", " ", "and", " ", "destinat", "ion", " ", "container", "s", ",", " ", "e", ".", "g", ".'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", " ", " ", "dx", " ", "cp", " ", "source", "-", "project", ":", "source", "-", "id", "-", "or", "-", "path", " ", "dest", "-", "project", ":", "dest", "-", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "src", "\\u", "proj_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "DX", "CLI", "Error_", "(_", "fill_", "(_", "'", "Error", ":", " ", "A", " ", "source", " ", "project", " ", "must", " ", "be", " ", "specified", " ", "or", " ", "a", " ", "current", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", " ", "set", " ", "in", " ", "order", " ", "to", " ", "clone", " ", "object", "s", " ", "bet", "ween", " ", "project", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "src", "\\u", "results_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "folders_", "._", "append_", "(_", "src", "\\u", "folder", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "src", "\\u", "objects_", "+=_", "[_", "result_", "[_", "'", "id", "'_", "]_", "for_", "result_", "in_", "src", "\\u", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exists_", "=_", "dxp", "y_", "._", "DX", "HTTP", "Request_", "(_", "'/'_", "+_", "src", "\\u", "proj_", "+_", "'/", "clone", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "object", "s", "\"_", ":_", "src", "\\u", "objects_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "folder", "s", "\"_", ":_", "src", "\\u", "folders_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\"_", ":_", "dest", "\\u", "proj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "destinat", "ion", "\"_", ":_", "dest", "\\u", "path_", "}_", ")_", "[_", "'", "exist", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "exists_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "fill_", "(_", "'", "The", " ", "follow", "ing", " ", "object", "s", " ", "alr", "ead", "y", " ", "existed", " ", "in", " ", "the", " ", "destinat", "ion", " ", "container", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", " ", "wer", "e", " ", "left", " ", "alo", "ne", ":'_", ")_", "+_", "'\\\\", "n", " ", "'_", "+_", "'\\\\", "n", " ", "'_", "._", "join_", "(_", "exists_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "\\u", "exit_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
openstack/neutron/neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py
[ { "content": " @staticmethod\n def _check_pci_vendor_config(pci_vendor_list):\n for pci_vendor_info in pci_vendor_list:\n try:\n vendor_id, product_id = [\n item.strip() for item in pci_vendor_info.split(':')\n if item.strip()]\n except ValueError:\n raise ValueError(_('Incorrect pci_vendor_info: \"%s\", should be'\n ' pair vendor_id:product_id') %\n pci_vendor_info)", "metadata": "root.SriovNicSwitchMechanismDriver._check_pci_vendor_config", "header": "['class', 'SriovNicSwitchMechanismDriver', '(', 'api', '.', 'MechanismDriver', ')', ':', '___EOS___']", "index": 202 } ]
[ { "span": "vendor_id,", "start_line": 206, "start_column": 16, "end_line": 206, "end_column": 25 }, { "span": "product_id ", "start_line": 206, "start_column": 27, "end_line": 206, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sr", "io", "v", "Nic", "Switch", "Mechani", "sm", "Driver_", "(_", "api_", "._", "Mechani", "sm", "Driver_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "pci", "\\u", "vendor", "\\u", "config_", "(_", "pci", "\\u", "vendor", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pci", "\\u", "vendor", "\\u", "info_", "in_", "pci", "\\u", "vendor", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vendor", "\\u", "id_", ",_", "product", "\\u", "id_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "._", "strip_", "(_", ")_", "for_", "item_", "in_", "pci", "\\u", "vendor", "\\u", "info_", "._", "split_", "(_", "':'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item_", "._", "strip_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u_", "(_", "'", "Inco", "rrect", " ", "pci", "\\u", "vendor", "\\u", "info", ":", " ", "\"%", "s", "\",", " ", "shou", "ld", " ", "be", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "pair", " ", "vendor", "\\u", "id", ":", "product", "\\u", "id", "'_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "pci", "\\u", "vendor", "\\u", "info_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
srob650/pytvmaze/setup.py
[ { "content": "from setuptools import setup, find_packages\n\nsetup(\n name = 'pytvmaze',\n version = '1.5.1',\n description = 'Python interface to the TV Maze API (www.tvmaze.com)',\n url = 'https://github.com/srob650/pytvmaze',\n author = 'Spencer Roberts',\n author_email = '[email protected]',\n license='MIT',\n\n classifiers = [\n 'Development Status :: 5 - Production/Stable',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: MIT License',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7',\n 'Programming Language :: Python :: 3.5'\n ],\n\n keywords = 'python tv television tvmaze',\n packages=['pytvmaze']\n\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from setuptools import setup, find_packages", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", ",_", "find", "\\u", "packages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "pyt", "vma", "ze", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "1.5", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Pyth", "on", " ", "interface", " ", "to", " ", "the", " ", "TV", " ", "Ma", "ze", " ", "API", " ", "(", "www", ".", "tvm", "az", "e", ".", "com", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "sr", "ob", "650", "/", "pyt", "vma", "ze", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Spe", "nce", "r", " ", "Robert", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "pyt", "vma", "ze", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "5", " ", "-", " ", "Product", "ion", "/", "Sta", "ble", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.6", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.5", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "'", "python", " ", "tv", " ", "tele", "vision", " ", "tvm", "az", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "pyt", "vma", "ze", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
StackHut/stackhut/stackhut_toolkit/res/shims/python/stackhut.py
[ { "content": "# Copyright 2015 StackHut Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport logging\nimport requests\nimport json\nimport os\n\nurl = \"http://localhost:4000/jsonrpc\"\nheaders = {'content-type': 'application/json'}\n\nid_val = 0\nreq_id = None\n\n\n\n\n###############################################################################\n# Runtime Lib\n\n# stackhut fields\nroot_dir = os.getcwd()\nin_container = True if os.path.exists('/workdir') else False\n\n# stackhut library functions\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Service:\n\n\n\n\n", "metadata": "root.Service", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self):\n pass", "metadata": "root.Service.__init__", "header": "['class', 'Service', ':', '___EOS___']", "index": 25 }, { "content": " def shutdown(self):\n pass", "metadata": "root.Service.shutdown", "header": "['class', 'Service', ':', '___EOS___']", "index": 28 }, { "content": " def preBatch(self):\n pass", "metadata": "root.Service.preBatch", "header": "['class', 'Service', ':', '___EOS___']", "index": 31 }, { "content": " def postBatch(self):\n pass", "metadata": "root.Service.postBatch", "header": "['class', 'Service', ':', '___EOS___']", "index": 34 }, { "content": " def preRequest(self):\n pass", "metadata": "root.Service.preRequest", "header": "['class', 'Service', ':', '___EOS___']", "index": 37 }, { "content": " def postRequest(self):\n pass", "metadata": "root.Service.postRequest", "header": "['class', 'Service', ':', '___EOS___']", "index": 40 }, { "content": "class ServiceError(Exception):", "metadata": "root.ServiceError", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self, msg, data=None):\n self.msg = msg\n self.data = data", "metadata": "root.ServiceError.__init__", "header": "['class', 'ServiceError', '(', 'Exception', ')', ':', '___EOS___']", "index": 44 }, { "content": "def make_call(method, *_params):\n global id_val\n global req_id\n\n params = list(_params)\n params.insert(0, req_id)\n\n payload = {\n 'method': method,\n 'params': params,\n 'jsonrpc': '2.0',\n 'id': id_val,\n }\n\n response = requests.post(url, data=json.dumps(payload), headers=headers).json()\n\n id_val += 1\n\n if 'result' in response:\n return response['result']\n else:\n raise RuntimeError(response['error'])", "metadata": "root.make_call", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def get_stackhut_user():\n return make_call('get_stackhut_user')", "metadata": "root.get_stackhut_user", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def get_service_author():\n return make_call('get_service_author')", "metadata": "root.get_service_author", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def is_author():\n return make_call('is_author')", "metadata": "root.is_author", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def put_file(fname, make_public=True):\n return make_call('put_file', fname, make_public)", "metadata": "root.put_file", "header": "['module', '___EOS___']", "index": 88 }, { "content": "def get_file(key):\n return make_call('get_file', key)", "metadata": "root.get_file", "header": "['module', '___EOS___']", "index": 91 }, { "content": "def download_file(url, fname=None):\n return make_call('download_file', url, fname)", "metadata": "root.download_file", "header": "['module', '___EOS___']", "index": 94 }, { "content": "def run_command(cmd, stdin=''):\n return make_call('run_command', cmd)", "metadata": "root.run_command", "header": "['module', '___EOS___']", "index": 97 } ]
[ { "span": "import logging", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Stack", "Hu", "t", " ", "Lt", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "http", "://", "local", "host", ":", "4000", "/", "jsonrpc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "'", "content", "-", "type", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u", "val_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", "time", " ", "Lib_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stack", "hut", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "\\u", "dir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "container_", "=_", "True_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "'/", "workdir", "'_", ")_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stack", "hut", " ", "librar", "y", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Service_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Service_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pre", "Batch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "Batch_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pre", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "Request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Service", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Service", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "msg_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "msg_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "call_", "(_", "method_", ",_", "*_", "\\u", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "id", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "req", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "list_", "(_", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "._", "insert_", "(_", "0_", ",_", "req", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "payload_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "method", "'_", ":_", "method_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "params", "'_", ":_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "jsonrpc", "'_", ":_", "'", "2.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "id", "\\u", "val_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "requests_", "._", "post_", "(_", "url_", ",_", "data_", "=_", "json_", "._", "dumps_", "(_", "payload_", ")_", ",_", "headers_", "=_", "headers_", ")_", "._", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "\\u", "val_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "result", "'_", "in_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "[_", "'", "result", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "response_", "[_", "'", "error", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "stack", "hut", "\\u", "user_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "get", "\\u", "stack", "hut", "\\u", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "service", "\\u", "author_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "get", "\\u", "service", "\\u", "author", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "author_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "is", "\\u", "author", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put", "\\u", "file_", "(_", "fname_", ",_", "make", "\\u", "public_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "put", "\\u", "file", "'_", ",_", "fname_", ",_", "make", "\\u", "public_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "file_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "get", "\\u", "file", "'_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "file_", "(_", "url_", ",_", "fname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "download", "\\u", "file", "'_", ",_", "url_", ",_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "command_", "(_", "cmd_", ",_", "stdin_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "make", "\\u", "call_", "(_", "'", "run", "\\u", "command", "'_", ",_", "cmd_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2,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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Lasagne/Lasagne/lasagne/tests/layers/test_helper.py
[ { "content": " def test_get_output_with_single_argument_fails(self, layers, get_output):\n l1, l2, l3 = layers\n inputs, kwarg = theano.tensor.matrix(), object()\n # expected to fail: only gave one expression for two input layers\n with pytest.raises(ValueError):\n output = get_output(l3, inputs, kwarg=kwarg)", "metadata": "root.TestGetOutput_MergeLayer.test_get_output_with_single_argument_fails", "header": "['class', 'TestGetOutput_MergeLayer', ':', '___EOS___']", "index": 319 }, { "content": " def test_get_output_shape_with_single_argument_fails(self, layers,\n get_output_shape):\n l1, l2, l3 = layers\n shp = (4, 5, 6)\n # expected to fail: only gave one shape tuple for two input layers\n with pytest.raises(ValueError):\n output_shape = get_output_shape(l3, shp)", "metadata": "root.TestGetOutputShape_MergeLayer.test_get_output_shape_with_single_argument_fails", "header": "['class', 'TestGetOutputShape_MergeLayer', ':', '___EOS___']", "index": 619 } ]
[ { "span": "output ", "start_line": 324, "start_column": 12, "end_line": 324, "end_column": 18 }, { "span": "output_shape ", "start_line": 625, "start_column": 12, "end_line": 625, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Get", "Output", "\\u", "Merge", "Layer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "output", "\\u", "with", "\\u", "single", "\\u", "argu", "ment", "\\u", "fails_", "(_", "self_", ",_", "layers_", ",_", "get", "\\u", "output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l1_", ",_", "l2_", ",_", "l3_", "=_", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", ",_", "kwarg_", "=_", "theano_", "._", "tensor_", "._", "matrix_", "(_", ")_", ",_", "object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "expected", " ", "to", " ", "fail", ":", " ", "only", " ", "ga", "ve", " ", "one", " ", "express", "ion", " ", "for", " ", "two", " ", "input", " ", "layers_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "get", "\\u", "output_", "(_", "l3_", ",_", "inputs_", ",_", "kwarg_", "=_", "kwarg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Get", "Output", "Shape", "\\u", "Merge", "Layer_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "output", "\\u", "shape", "\\u", "with", "\\u", "single", "\\u", "argu", "ment", "\\u", "fails_", "(_", "self_", ",_", "layers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "output", "\\u", "shape_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l1_", ",_", "l2_", ",_", "l3_", "=_", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shp_", "=_", "(_", "4_", ",_", "5_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "expected", " ", "to", " ", "fail", ":", " ", "only", " ", "ga", "ve", " ", "one", " ", "shape", " ", "tuple", " ", "for", " ", "two", " ", "input", " ", "layers_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output", "\\u", "shape_", "=_", "get", "\\u", "output", "\\u", "shape_", "(_", "l3_", ",_", "shp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
django-oscar/django-oscar/src/oscar/apps/partner/migrations/0004_auto_20160107_1755.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('partner', '0003_auto_20150604_1450'),\n ]\n\n operations = [\n migrations.AlterModelOptions(\n name='partner',\n options={'ordering': ('name', 'code'), 'verbose_name': 'Fulfillment partner', 'verbose_name_plural': 'Fulfillment partners', 'permissions': (('dashboard_access', 'Can access dashboard'),)},\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "from django.db import models, migrations", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "part", "ner", "'_", ",_", "'", "0003", "\\u", "auto", "\\u", "20150", "604", "\\u", "145", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Alter", "Model", "Options_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "part", "ner", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "{_", "'", "orderi", "ng", "'_", ":_", "(_", "'", "name", "'_", ",_", "'", "code", "'_", ")_", ",_", "'", "verbo", "se", "\\u", "name", "'_", ":_", "'", "Fu", "lfil", "lm", "ent", " ", "part", "ner", "'_", ",_", "'", "verbo", "se", "\\u", "name", "\\u", "plural", "'_", ":_", "'", "Fu", "lfil", "lm", "ent", " ", "partners", "'_", ",_", "'", "permissi", "ons", "'_", ":_", "(_", "(_", "'", "dash", "board", "\\u", "access", "'_", ",_", "'", "Can", " ", "access", " ", "dash", "board", "'_", ")_", ",_", ")_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
XiaoMi/minos/supervisor/supervisor/supervisorctl.py
[ { "content": " def do_remove(self, arg):\n names = arg.strip().split()\n\n supervisor = self.ctl.get_supervisor()\n for name in names:\n try:\n result = supervisor.removeProcessGroup(name)\n except xmlrpclib.Fault, e:\n if e.faultCode == xmlrpc.Faults.STILL_RUNNING:\n self.ctl.output('ERROR: process/group still running: %s'\n % name)\n elif e.faultCode == xmlrpc.Faults.BAD_NAME:\n self.ctl.output(\n \"ERROR: no such process/group: %s\" % name)\n else:\n raise\n else:\n self.ctl.output(\"%s: removed process group\" % name)", "metadata": "root.DefaultControllerPlugin.do_remove", "header": "['class', 'DefaultControllerPlugin', '(', 'ControllerPluginBase', ')', ':', '___EOS___']", "index": 911 }, { "content": " def do_update(self, arg):\n def log(name, message):\n self.ctl.output(\"%s: %s\" % (name, message))\n\n supervisor = self.ctl.get_supervisor()\n try:\n result = supervisor.reloadConfig()\n except xmlrpclib.Fault, e:\n if e.faultCode == xmlrpc.Faults.SHUTDOWN_STATE:\n self.ctl.output('ERROR: already shutting down')\n return\n else:\n raise e\n\n added, changed, removed = result[0]\n\n for gname in removed:\n results = supervisor.stopProcessGroup(gname)\n log(gname, \"stopped\")\n\n fails = [res for res in results\n if res['status'] == xmlrpc.Faults.FAILED]\n if fails:\n log(gname, \"has problems; not removing\")\n continue\n supervisor.removeProcessGroup(gname)\n log(gname, \"removed process group\")\n\n for gname in changed:\n results = supervisor.stopProcessGroup(gname)\n log(gname, \"stopped\")\n\n supervisor.removeProcessGroup(gname)\n supervisor.addProcessGroup(gname)\n log(gname, \"updated process group\")\n\n for gname in added:\n supervisor.addProcessGroup(gname)\n log(gname, \"added process group\")", "metadata": "root.DefaultControllerPlugin.do_update", "header": "['class', 'DefaultControllerPlugin', '(', 'ControllerPluginBase', ')', ':', '___EOS___']", "index": 934 } ]
[ { "span": "result ", "start_line": 917, "start_column": 16, "end_line": 917, "end_column": 22 }, { "span": "results ", "start_line": 963, "start_column": 12, "end_line": 963, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Default", "Controlle", "r", "Plugin_", "(_", "Controlle", "r", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "remove_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "=_", "arg_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "supervisor", "_", "=_", "self_", "._", "ctl_", "._", "get", "\\u", "supervisor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "supervisor", "_", "._", "remove", "Process", "Group_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "xmlrpclib_", "._", "Fault_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "STI", "LL", "\\u", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ctl_", "._", "output_", "(_", "'", "ERROR", ":", " ", "process", "/", "group", " ", "still", " ", "runn", "ing", ":", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "BAD", "\\u", "NAME_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "ctl_", "._", "output_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ERROR", ":", " ", "no", " ", "suc", "h", " ", "process", "/", "group", ":", " ", "%", "s", "\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "\"%", "s", ":", " ", "remove", "d", " ", "process", " ", "group", "\"_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Default", "Controlle", "r", "Plugin_", "(_", "Controlle", "r", "Plug", "in", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "update_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "log_", "(_", "name_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "name_", ",_", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "supervisor", "_", "=_", "self_", "._", "ctl_", "._", "get", "\\u", "supervisor", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "supervisor", "_", "._", "relo", "ad", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "xmlrpclib_", "._", "Fault_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "fault", "Code_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "SHUTDOWN", "\\u", "STATE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ctl_", "._", "output_", "(_", "'", "ERROR", ":", " ", "alr", "ead", "y", " ", "shutt", "ing", " ", "down", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "added_", ",_", "changed_", ",_", "removed_", "=_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "gname", "_", "in_", "removed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "supervisor", "_", "._", "stop", "Process", "Group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "(_", "gname", "_", ",_", "\"", "stopp", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fails_", "=_", "[_", "res_", "for_", "res_", "in_", "results_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "res_", "[_", "'", "status", "'_", "]_", "==_", "xmlrpc", "_", "._", "Fau", "lts", "_", "._", "FAILED_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fails_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "(_", "gname", "_", ",_", "\"", "has", " ", "problem", "s", ";", " ", "not", " ", "remo", "ving", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "supervisor", "_", "._", "remove", "Process", "Group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "(_", "gname", "_", ",_", "\"", "remove", "d", " ", "process", " ", "group", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "gname", "_", "in_", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "supervisor", "_", "._", "stop", "Process", "Group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "(_", "gname", "_", ",_", "\"", "stopp", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "supervisor", "_", "._", "remove", "Process", "Group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "supervisor", "_", "._", "add", "Process", "Group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "(_", "gname", "_", ",_", "\"", "update", "d", " ", "process", " ", "group", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "gname", "_", "in_", "added_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "supervisor", "_", "._", "add", "Process", "Group_", "(_", "gname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "(_", "gname", "_", ",_", "\"", "adde", "d", " ", "process", " ", "group", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pascanur/GroundHog/scripts/DT_RNN_Tut_Ex.py
[ { "content": "\"\"\"\nTest of the classical LM model for language modelling\n\"\"\"\nfrom groundhog.datasets import LMIterator\nfrom groundhog.trainer.SGD_momentum import SGD as SGD_m\nfrom groundhog.trainer.SGD import SGD\nfrom groundhog.mainLoop import MainLoop\nfrom groundhog.layers import MultiLayer, \\\n RecurrentMultiLayer, \\\n RecurrentMultiLayerInp, \\\n RecurrentMultiLayerShortPath, \\\n RecurrentMultiLayerShortPathInp, \\\n RecurrentMultiLayerShortPathInpAll, \\\n SoftmaxLayer, \\\n LastState,\\\n UnaryOp, \\\n DropOp, \\\n Operator, \\\n Shift, \\\n GaussianNoise, \\\n SigmoidLayer\nfrom groundhog.layers import maxpool, \\\n maxpool_ntimes, \\\n last, \\\n last_ntimes,\\\n tanh, \\\n sigmoid, \\\n rectifier,\\\n hard_sigmoid, \\\n hard_tanh\nfrom groundhog.models import LM_Model\nfrom theano.sandbox.scan import scan\n\nimport numpy\nimport theano\nimport theano.tensor as TT\n\nlinear = lambda x:x\nrect = lambda x:TT.maximum(0., x)\n\ntheano.config.allow_gc = False\n\n\n\n\nif __name__=='__main__':\n state = {}\n # complete path to data (cluster specific)\n state['seqlen'] = 100\n state['path']= \"/data/lisa/data/PennTreebankCorpus/pentree_char_and_word.npz\"\n state['dictionary']= \"/data/lisa/data/PennTreebankCorpus/dictionaries.npz\"\n state['chunks'] = 'chars'\n state['seed'] = 123\n\n # flag .. don't need to change it. It says what to do if you get cost to\n # be nan .. you could raise, though I would leave it to this\n state['on_nan'] = 'warn'\n\n # DATA\n\n # For wikipedia validation set is extremely large. Is very time\n # wasteful. This value is only used for validation set, and IMHO should\n # be something like seqlen * 10000 (i.e. the validation should be only\n # 10000 steps\n state['reset'] = -1\n # For music/ word level I think 50 is a good idea. For character this\n # should be at least 100 (I think there are problems with getting state\n # of the art otherwise). Note most people use 200 !\n\n # The job stops when learning rate declines to this value. It can be\n # useful, because sometimes is hopeless to wait for validation error to\n # get below minerr, or for the time to expire\n state['minlr'] = float(5e-7)\n\n # Layers\n # Input\n\n # Input weights are sampled from a gaussian with std=scale; this is the\n # standard way to initialize\n state['rank_n_approx'] = 0\n state['inp_nhids'] = '[200]'\n state['inp_activ'] = '[linear]'\n state['inp_bias'] = '[0.]'\n state['inp_sparse']= -1 # dense\n state['inp_scale'] = .1\n\n # This is for the output weights\n state['out_scale'] = .1\n state['out_bias_scale'] = -.5\n state['out_sparse'] = -1\n\n state['dout_nhid'] = '200'\n state['dout_activ'] = '\"TT.nnet.sigmoid\"'\n state['dout_sparse']= 20\n state['dout_scale'] = 1.\n state['dout_bias'] = '[0]'\n state['dout_init'] = \"'sample_weights'\"\n state['dout_rank_n_approx'] = 0\n state['dropout'] = .5\n\n # HidLayer\n # Hidden units on for the internal layers of DT-RNN. Having a single\n # value results in a standard RNN\n state['nhids'] = '[100, 100]'\n # Activation of each layer\n state['rec_activ'] = '\"TT.nnet.sigmoid\"'\n state['rec_bias'] = '.0'\n state['rec_sparse'] ='20'\n state['rec_scale'] = '1.'\n # sample_weights - you rescale the weights such that the largest\n # singular value is scale\n # sample_weights_classic : just sample weights from a gaussian with std\n # equal to scale\n state['rec_init'] = \"'sample_weights'\"\n state['rec_layer'] = 'RecurrentMultiLayerShortPathInpAll'\n\n # SGD params\n state['bs'] = 1 # the size of the minibatch\n state['lr'] = 1. # initial learning rate\n state['cutoff'] = 1. # threshold for gradient rescaling\n state['moment'] = 0.995 #-.1 # momentum\n\n # Do not optimize these\n state['weight_noise'] = True # white Gaussian noise in weights\n state['weight_noise_amount'] = 0.075 # standard deviation\n\n # maximal number of updates\n state['loopIters'] = int(1e8)\n # maximal number of minutes to wait until killing job\n state['timeStop'] = 48*60 # 48 hours\n\n # Construct linear connections from input to output. These are factored\n # (like the rank_n) to deal with the possible high dimensionality of the\n # input, but it is a linear projection that feeds into the softmax\n state['shortcut_inpout'] = False\n state['shortcut_rank'] = 200\n\n # Main Loop\n # Make this to be a decently large value. Otherwise you waste a lot of\n # memory keeping track of the training error (and other things) at each\n # step + the stdout becomes extremely large\n state['trainFreq'] = 100\n state['hookFreq'] = 5000\n state['validFreq'] = 1000\n\n state['saveFreq'] = 15 # save every 15 minutes\n state['prefix'] = 'model_' # prefix of the save files\n state['reload'] = False # reload\n state['overwrite'] = 1\n\n # Threhold should be 1.004 for PPL, for entropy (which is what\n # everything returns, it should be much smaller. Running value is 1.0002\n # We should not hyperoptimize this\n state['divide_lr'] = 2.\n state['cost_threshold'] = 1.0002\n state['patience'] = 1\n state['validate_postprocess'] = 'lambda x:10**(x/numpy.log(10))'\n\n state['truncate_gradient'] = 80 # truncated BPTT\n state['lr_adapt'] = 0 # 1/(1 + n/n0) scheduling\n state['lr_beta'] = 10*1900.\n state['lr_start'] = 'on_error'\n\n state['no_noise_bias'] = True # do not use weight noise for biases\n state['carry_h0'] = True # carry over h0 across updates\n\n state['sample_steps'] = 80\n\n # Do not change these\n state['minerr'] = -1\n state['shift'] = 1 # n-step forward prediction\n state['cutoff_rescale_length'] = False\n\n jobman(state, None)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_text_data(state):\n def out_format (x, y, r):\n return {'x':x, 'y' :y, 'reset': r}\n def out_format_valid (x, y, r):\n return {'x':x, 'y' :y, 'reset': r}\n\n train_data = LMIterator(\n batch_size=state['bs'],\n path = state['path'],\n stop=-1,\n seq_len = state['seqlen'],\n mode=\"train\",\n chunks=state['chunks'],\n shift = state['shift'],\n output_format = out_format,\n can_fit=True)\n\n valid_data = LMIterator(\n batch_size=state['bs'],\n path=state['path'],\n stop=-1,\n use_infinite_loop=False,\n allow_short_sequences = True,\n seq_len= state['seqlen'],\n mode=\"valid\",\n reset =state['reset'],\n chunks=state['chunks'],\n shift = state['shift'],\n output_format = out_format_valid,\n can_fit=True)\n\n test_data = LMIterator(\n batch_size=state['bs'],\n path = state['path'],\n stop=-1,\n use_infinite_loop=False,\n allow_short_sequences=True,\n seq_len= state['seqlen'],\n mode=\"test\",\n chunks=state['chunks'],\n shift = state['shift'],\n output_format = out_format_valid,\n can_fit=True)\n if 'wiki' in state['path']:\n test_data = None\n return train_data, valid_data, test_data", "metadata": "root.get_text_data", "header": "['module', '___EOS___']", "index": 42 }, { "content": "def jobman(state, channel):\n # load dataset\n rng = numpy.random.RandomState(state['seed'])\n\n # declare the dimensionalies of the input and output\n if state['chunks'] == 'words':\n state['n_in'] = 10000\n state['n_out'] = 10000\n else:\n state['n_in'] = 50\n state['n_out'] = 50\n train_data, valid_data, test_data = get_text_data(state)\n\n ## BEGIN Tutorial\n ### Define Theano Input Variables\n x = TT.lvector('x')\n y = TT.lvector('y')\n h0 = theano.shared(numpy.zeros((eval(state['nhids'])[-1],), dtype='float32'))\n\n ### Neural Implementation of the Operators: \\oplus\n #### Word Embedding\n emb_words = MultiLayer(\n rng,\n n_in=state['n_in'],\n n_hids=eval(state['inp_nhids']),\n activation=eval(state['inp_activ']),\n init_fn='sample_weights_classic',\n weight_noise=state['weight_noise'],\n rank_n_approx = state['rank_n_approx'],\n scale=state['inp_scale'],\n sparsity=state['inp_sparse'],\n learn_bias = True,\n bias_scale=eval(state['inp_bias']),\n name='emb_words')\n\n #### Deep Transition Recurrent Layer\n rec = eval(state['rec_layer'])(\n rng,\n eval(state['nhids']),\n activation = eval(state['rec_activ']),\n #activation = 'TT.nnet.sigmoid',\n bias_scale = eval(state['rec_bias']),\n scale=eval(state['rec_scale']),\n sparsity=eval(state['rec_sparse']),\n init_fn=eval(state['rec_init']),\n weight_noise=state['weight_noise'],\n name='rec')\n\n #### Stiching them together\n ##### (1) Get the embedding of a word\n x_emb = emb_words(x, no_noise_bias=state['no_noise_bias'])\n ##### (2) Embedding + Hidden State via DT Recurrent Layer\n reset = TT.scalar('reset')\n rec_layer = rec(x_emb, n_steps=x.shape[0],\n init_state=h0*reset,\n no_noise_bias=state['no_noise_bias'],\n truncate_gradient=state['truncate_gradient'],\n batch_size=1)\n\n ## BEGIN Exercise: DOT-RNN\n ### Neural Implementation of the Operators: \\lhd\n\n #### Exercise (1)\n #### Hidden state -> Intermediate Layer\n emb_state = MultiLayer(\n rng,\n n_in=eval(state['nhids'])[-1],\n n_hids=eval(state['dout_nhid']),\n activation=linear,\n init_fn=eval(state['dout_init']),\n weight_noise=state['weight_noise'],\n scale=state['dout_scale'],\n sparsity=state['dout_sparse'],\n learn_bias = True,\n bias_scale=eval(state['dout_bias']),\n name='emb_state')\n\n #### Exercise (1)\n #### Input -> Intermediate Layer\n emb_words_out = MultiLayer(\n rng,\n n_in=state['n_in'],\n n_hids=eval(state['dout_nhid']),\n activation=linear,\n init_fn='sample_weights_classic',\n weight_noise=state['weight_noise'],\n scale=state['dout_scale'],\n sparsity=state['dout_sparse'],\n rank_n_approx=state['dout_rank_n_approx'],\n learn_bias = False,\n bias_scale=eval(state['dout_bias']),\n name='emb_words_out')\n\n #### Hidden State: Combine emb_state and emb_words_out\n #### Exercise (1)\n outhid_activ = UnaryOp(activation=eval(state['dout_activ']))\n #### Exercise (2)\n outhid_dropout = DropOp(dropout=state['dropout'], rng=rng)\n\n #### Softmax Layer\n output_layer = SoftmaxLayer(\n rng,\n eval(state['dout_nhid']),\n state['n_out'],\n scale=state['out_scale'],\n bias_scale=state['out_bias_scale'],\n init_fn=\"sample_weights_classic\",\n weight_noise=state['weight_noise'],\n sparsity=state['out_sparse'],\n sum_over_time=True,\n name='out')\n\n ### Few Optional Things\n #### Direct shortcut from x to y\n if state['shortcut_inpout']:\n shortcut = MultiLayer(\n rng,\n n_in=state['n_in'],\n n_hids=eval(state['inpout_nhids']),\n activations=eval(state['inpout_activ']),\n init_fn='sample_weights_classic',\n weight_noise = state['weight_noise'],\n scale=eval(state['inpout_scale']),\n sparsity=eval(state['inpout_sparse']),\n learn_bias=eval(state['inpout_learn_bias']),\n bias_scale=eval(state['inpout_bias']),\n name='shortcut')\n\n #### Learning rate scheduling (1/(1+n/beta))\n state['clr'] = state['lr']\n def update_lr(obj, cost):\n stp = obj.step\n if isinstance(obj.state['lr_start'], int) and stp > obj.state['lr_start']:\n time = float(stp - obj.state['lr_start'])\n new_lr = obj.state['clr']/(1+time/obj.state['lr_beta'])\n obj.lr = new_lr\n if state['lr_adapt']:\n rec.add_schedule(update_lr)\n\n ### Neural Implementations of the Language Model\n #### Training\n if state['shortcut_inpout']:\n additional_inputs = [rec_layer, shortcut(x)]\n else:\n additional_inputs = [rec_layer]\n\n ##### Exercise (1): Compute the output intermediate layer\n outhid = outhid_activ(emb_state(rec_layer) + emb_words_out(x))\n ##### Exercise (2): Apply Dropout\n outhid = outhid_dropout(outhid)\n\n train_model = output_layer(outhid,\n no_noise_bias=state['no_noise_bias'],\n additional_inputs=additional_inputs).train(target=y,\n scale=numpy.float32(1./state['seqlen']))\n\n nw_h0 = rec_layer.out[rec_layer.out.shape[0]-1]\n if state['carry_h0']:\n train_model.updates += [(h0, nw_h0)]\n\n #### Validation\n h0val = theano.shared(numpy.zeros((eval(state['nhids'])[-1],), dtype='float32'))\n rec_layer = rec(emb_words(x, use_noise=False),\n n_steps = x.shape[0],\n batch_size=1,\n init_state=h0val*reset,\n use_noise=False)\n nw_h0 = rec_layer.out[rec_layer.out.shape[0]-1]\n\n ##### Exercise (1): Compute the output intermediate layer\n outhid = outhid_activ(emb_state(rec_layer) + emb_words_out(x))\n ##### Exercise (2): Apply Dropout\n outhid = outhid_dropout(outhid, use_noise=False)\n\n if state['shortcut_inpout']:\n additional_inputs=[rec_layer, shortcut(x, use_noise=False)]\n else:\n additional_inputs=[rec_layer]\n valid_model = output_layer(outhid,\n additional_inputs=additional_inputs,\n use_noise=False).validate(target=y, sum_over_time=True)\n\n valid_updates = []\n if state['carry_h0']:\n valid_updates = [(h0val, nw_h0)]\n\n valid_fn = theano.function([x,y, reset], valid_model.out,\n name='valid_fn', updates=valid_updates)\n\n #### Sampling\n ##### single-step sampling\n def sample_fn(word_tm1, h_tm1):\n x_emb = emb_words(word_tm1, use_noise = False, one_step=True)\n h0 = rec(x_emb, state_before=h_tm1, one_step=True, use_noise=False)[-1]\n outhid = outhid_dropout(outhid_activ(emb_state(h0, use_noise=False, one_step=True) +\n emb_words_out(word_tm1, use_noise=False, one_step=True), one_step=True), \n use_noise=False, one_step=True)\n word = output_layer.get_sample(state_below=outhid, additional_inputs=[h0], temp=1.)\n return word, h0\n\n ##### scan for iterating the single-step sampling multiple times\n [samples, summaries], updates = scan(sample_fn,\n states = [\n TT.alloc(numpy.int64(0), state['sample_steps']),\n TT.alloc(numpy.float32(0), 1, eval(state['nhids'])[-1])],\n n_steps= state['sample_steps'],\n name='sampler_scan')\n\n ##### build a Theano function for sampling\n sample_fn = theano.function([], [samples],\n updates=updates, profile=False, name='sample_fn')\n\n ##### Load a dictionary\n dictionary = numpy.load(state['dictionary'])\n if state['chunks'] == 'chars':\n dictionary = dictionary['unique_chars']\n else:\n dictionary = dictionary['unique_words']\n def hook_fn():\n sample = sample_fn()[0]\n print 'Sample:',\n if state['chunks'] == 'chars':\n print \"\".join(dictionary[sample])\n else:\n for si in sample:\n print dictionary[si],\n print\n\n ### Build and Train a Model\n #### Define a model\n model = LM_Model(\n cost_layer = train_model,\n weight_noise_amount=state['weight_noise_amount'],\n valid_fn = valid_fn,\n clean_before_noise_fn = False,\n noise_fn = None,\n rng = rng)\n\n if state['reload']:\n model.load(state['prefix']+'model.npz')\n\n #### Define a trainer\n ##### Training algorithm (SGD)\n if state['moment'] < 0:\n algo = SGD(model, state, train_data)\n else:\n algo = SGD_m(model, state, train_data)\n ##### Main loop of the trainer\n main = MainLoop(train_data,\n valid_data,\n test_data,\n model,\n algo,\n state,\n channel,\n train_cost = False,\n hooks = hook_fn,\n validate_postprocess = eval(state['validate_postprocess']))\n ## Run!\n main.main()", "metadata": "root.jobman", "header": "['module', '___EOS___']", "index": 89 } ]
[ { "span": "from groundhog.layers import MultiLayer, \\\n RecurrentMultiLayer, \\\n RecurrentMultiLayerInp, \\\n RecurrentMultiLayerShortPath, \\\n RecurrentMultiLayerShortPathInp, \\\n RecurrentMultiLayerShortPathInpAll, \\\n SoftmaxLayer, \\\n LastState,\\\n UnaryOp, \\\n DropOp, \\\n Operator, \\\n Shift, \\\n GaussianNoise, \\\n SigmoidLayer", "start_line": 7, "start_column": 0, "end_line": 20, "end_column": 19 }, { "span": "from groundhog.layers import maxpool, \\\n maxpool_ntimes, \\\n last, \\\n last_ntimes,\\\n tanh, \\\n sigmoid, \\\n rectifier,\\\n hard_sigmoid, \\\n hard_tanh", "start_line": 21, "start_column": 0, "end_line": 29, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", " ", "of", " ", "the", " ", "classic", "al", " ", "LM", " ", "model", " ", "for", " ", "language", " ", "modell", "ing", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "datasets_", "import_", "LM", "Iterator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "trainer_", "._", "SGD", "\\u", "momentum_", "import_", "SGD", "_", "as_", "SGD", "\\u", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "trainer_", "._", "SGD", "_", "import_", "SGD", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "main", "Loop_", "import_", "Main", "Loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "layers_", "import_", "Multi", "Layer_", ",_", "Recurren", "t", "Multi", "Layer_", ",_", "Recurren", "t", "Multi", "Layer", "Inp", "_", ",_", "Recurren", "t", "Multi", "Layer", "Short", "Path_", ",_", "Recurren", "t", "Multi", "Layer", "Short", "Path", "Inp", "_", ",_", "Recurren", "t", "Multi", "Layer", "Short", "Path", "Inp", "All_", ",_", "Softmax", "Layer_", ",_", "Las", "t", "State_", ",_", "Una", "ry", "Op_", ",_", "Drop", "Op_", ",_", "Operator_", ",_", "Shift_", ",_", "Gaussian", "Noise_", ",_", "Sigm", "oid", "Layer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "layers_", "import_", "maxp", "ool_", ",_", "maxp", "ool", "\\u", "ntime", "s_", ",_", "last_", ",_", "last", "\\u", "ntime", "s_", ",_", "tanh_", ",_", "sigmoid_", ",_", "recti", "fier", "_", ",_", "hard", "\\u", "sigmoid_", ",_", "hard", "\\u", "tanh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ground", "hog", "_", "._", "models_", "import_", "LM", "\\u", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "sandbox_", "._", "scan_", "import_", "scan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "TT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "linear_", "=_", "lambda_", "x_", ":_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rect_", "=_", "lambda_", "x_", ":_", "TT_", "._", "maximum_", "(_", "0._", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "theano_", "._", "config_", "._", "allow", "\\u", "gc_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "complete", " ", "path", " ", "to", " ", "data", " ", "(", "cluster", " ", "specific", ")_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "seq", "len", "'_", "]_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "path", "'_", "]_", "=_", "\"/", "data", "/", "lis", "a", "/", "data", "/", "Pen", "n", "Tree", "bank", "Cor", "pus", "/", "pent", "ree", "\\u", "char", "\\u", "and", "\\u", "word", ".", "np", "z", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dictionar", "y", "'_", "]_", "=_", "\"/", "data", "/", "lis", "a", "/", "data", "/", "Pen", "n", "Tree", "bank", "Cor", "pus", "/", "dictionar", "ies", ".", "np", "z", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "chunks", "'_", "]_", "=_", "'", "char", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "seed", "'_", "]_", "=_", "123_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flag", " ", "..", " ", "don", "'", "t", " ", "need", " ", "to", " ", "change", " ", "it", ".", " ", "It", " ", "say", "s", " ", "what", " ", "to", " ", "do", " ", "if", " ", "you", " ", "get", " ", "cost", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "nan", " ", "..", " ", "you", " ", "coul", "d", " ", "raise", ",", " ", "tho", "ugh", " ", "I", " ", "wou", "ld", " ", "lea", "ve", " ", "it", " ", "to", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "on", "\\u", "nan", "'_", "]_", "=_", "'", "warn", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DATA_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "wikip", "edia", " ", "validation", " ", "set", " ", "is", " ", "extreme", "ly", " ", "large", ".", " ", "Is", " ", "very", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wast", "efu", "l", ".", " ", "Thi", "s", " ", "value", " ", "is", " ", "only", " ", "used", " ", "for", " ", "validation", " ", "set", ",", " ", "and", " ", "IM", "HO", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "somet", "hing", " ", "like", " ", "seq", "len", " ", "*", " ", "10000", " ", "(", "i", ".", "e", ".", " ", "the", " ", "validation", " ", "shou", "ld", " ", "be", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "10000", " ", "steps_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "reset", "'_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "music", "/", " ", "word", " ", "level", " ", "I", " ", "think", " ", "50", " ", "is", " ", "a", " ", "good", " ", "idea", ".", " ", "For", " ", "character", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "at", " ", "leas", "t", " ", "100", " ", "(", "I", " ", "think", " ", "there", " ", "are", " ", "problem", "s", " ", "with", " ", "getti", "ng", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "art", " ", "other", "wis", "e", ").", " ", "Not", "e", " ", "most", " ", "people", " ", "use", " ", "200", " ", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "job", " ", "stop", "s", " ", "whe", "n", " ", "learn", "ing", " ", "rate", " ", "declin", "es", " ", "to", " ", "this", " ", "value", ".", " ", "It", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usef", "ul", ",", " ", "bec", "aus", "e", " ", "somet", "imes", " ", "is", " ", "hop", "ele", "ss", " ", "to", " ", "wait", " ", "for", " ", "validation", " ", "error", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "belo", "w", " ", "miner", "r", ",", " ", "or", " ", "for", " ", "the", " ", "time", " ", "to", " ", "expire_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "minl", "r", "'_", "]_", "=_", "float_", "(_", "5e-", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Layers_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inp", "ut", " ", "weight", "s", " ", "are", " ", "sample", "d", " ", "from", " ", "a", " ", "gauss", "ian", " ", "with", " ", "std", "=", "scale", ";", " ", "this", " ", "is", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "standard", " ", "way", " ", "to", " ", "initialize_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "rank", "\\u", "n", "\\u", "approx", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "inp", "\\u", "nh", "ids", "'_", "]_", "=_", "'[", "200", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "inp", "\\u", "activ", "'_", "]_", "=_", "'[", "linear", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "inp", "\\u", "bias", "'_", "]_", "=_", "'[", "0.", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "inp", "\\u", "spars", "e", "'_", "]_", "=_", "-_", "1_", "#", " ", "dense_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "inp", "\\u", "scale", "'_", "]_", "=_", ".1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "for", " ", "the", " ", "output", " ", "weights_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "out", "\\u", "scale", "'_", "]_", "=_", ".1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "out", "\\u", "bias", "\\u", "scale", "'_", "]_", "=_", "-_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "out", "\\u", "spars", "e", "'_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "nh", "id", "'_", "]_", "=_", "'", "200", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "activ", "'_", "]_", "=_", "'\"", "TT", ".", "nnet", ".", "sigm", "oid", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "spars", "e", "'_", "]_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "scale", "'_", "]_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "bias", "'_", "]_", "=_", "'[", "0", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "init", "'_", "]_", "=_", "\"'", "sample", "\\u", "weight", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "dout", "\\u", "rank", "\\u", "n", "\\u", "approx", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "drop", "out", "'_", "]_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hi", "d", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hi", "dde", "n", " ", "unit", "s", " ", "on", " ", "for", " ", "the", " ", "internal", " ", "layer", "s", " ", "of", " ", "DT", "-", "RN", "N", ".", " ", "Ha", "ving", " ", "a", " ", "single_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "results", " ", "in", " ", "a", " ", "standard", " ", "RN", "N_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "nh", "ids", "'_", "]_", "=_", "'[", "100", ",", " ", "100", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Activat", "ion", " ", "of", " ", "each", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "rec", "\\u", "activ", "'_", "]_", "=_", "'\"", "TT", ".", "nnet", ".", "sigm", "oid", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "rec", "\\u", "bias", "'_", "]_", "=_", "'.", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "rec", "\\u", "spars", "e", "'_", "]_", "=_", "'", "20", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "rec", "\\u", "scale", "'_", "]_", "=_", "'", "1", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sample", "\\u", "weight", "s", " ", "-", " ", "you", " ", "rescale", " ", "the", " ", "weight", "s", " ", "suc", "h", " ", "tha", "t", " ", "the", " ", "large", "st_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "singular", " ", "value", " ", "is", " ", "scale_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sample", "\\u", "weight", "s", "\\u", "classic", " ", ":", " ", "just", " ", "sample", " ", "weight", "s", " ", "from", " ", "a", " ", "gauss", "ian", " ", "with", " ", "std_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equal", " ", "to", " ", "scale_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "rec", "\\u", "init", "'_", "]_", "=_", "\"'", "sample", "\\u", "weight", "s", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "rec", "\\u", "layer", "'_", "]_", "=_", "'", "Recurren", "t", "Multi", "Layer", "Short", "Path", "Inp", "All", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SGD", " ", "params_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "bs", "'_", "]_", "=_", "1_", "#", " ", "the", " ", "size", " ", "of", " ", "the", " ", "minibatch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "lr", "'_", "]_", "=_", "1._", "#", " ", "initial", " ", "learn", "ing", " ", "rate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "cuto", "ff", "'_", "]_", "=_", "1._", "#", " ", "threshol", "d", " ", "for", " ", "gradi", "ent", " ", "resc", "alin", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "moment", "'_", "]_", "=_", "0.99", "5_", "#-", ".1", " ", "#", " ", "momentum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "optimize", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", "=_", "True_", "#", " ", "white", " ", "Gaussian", " ", "noise", " ", "in", " ", "weights_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "weight", "\\u", "noise", "\\u", "amo", "unt", "'_", "]_", "=_", "0.07", "5_", "#", " ", "standard", " ", "deviation", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "maximal", " ", "number", " ", "of", " ", "updates_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "loop", "It", "ers", "'_", "]_", "=_", "int_", "(_", "1e", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "maximal", " ", "number", " ", "of", " ", "minute", "s", " ", "to", " ", "wait", " ", "unti", "l", " ", "kill", "ing", " ", "job_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "time", "Sto", "p", "'_", "]_", "=_", "48_", "*_", "60_", "#", " ", "4", "8", " ", "hours_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Construct", " ", "linear", " ", "connections", " ", "from", " ", "input", " ", "to", " ", "output", ".", " ", "The", "se", " ", "are", " ", "factor", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "like", " ", "the", " ", "rank", "\\u", "n", ")", " ", "to", " ", "deal", " ", "with", " ", "the", " ", "possib", "le", " ", "high", " ", "dimensionality", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ",", " ", "but", " ", "it", " ", "is", " ", "a", " ", "linear", " ", "projecti", "on", " ", "tha", "t", " ", "feed", "s", " ", "int", "o", " ", "the", " ", "softmax_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "shortcut", "\\u", "inp", "out", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "shortcut", "\\u", "rank", "'_", "]_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "Loop_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "this", " ", "to", " ", "be", " ", "a", " ", "dece", "ntl", "y", " ", "large", " ", "value", ".", " ", "Ot", "her", "wis", "e", " ", "you", " ", "wast", "e", " ", "a", " ", "lot", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "memory", " ", "keep", "ing", " ", "track", " ", "of", " ", "the", " ", "train", "ing", " ", "error", " ", "(", "and", " ", "other", " ", "thing", "s", ")", " ", "at", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "step", " ", "+", " ", "the", " ", "stdout", " ", "bec", "ome", "s", " ", "extreme", "ly", " ", "large_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "train", "Freq", "'_", "]_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "hook", "Freq", "'_", "]_", "=_", "5000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "valid", "Freq", "'_", "]_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "save", "Freq", "'_", "]_", "=_", "15_", "#", " ", "save", " ", "every", " ", "15", " ", "minutes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "prefix", "'_", "]_", "=_", "'", "model", "\\u'_", "#", " ", "prefix", " ", "of", " ", "the", " ", "save", " ", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "relo", "ad", "'_", "]_", "=_", "False_", "#", " ", "reload_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "overwrit", "e", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thre", "hold", " ", "shou", "ld", " ", "be", " ", "1.00", "4", " ", "for", " ", "PP", "L", ",", " ", "for", " ", "entr", "opy", " ", "(", "whi", "ch", " ", "is", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "every", "thing", " ", "return", "s", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "muc", "h", " ", "small", "er", ".", " ", "Run", "ning", " ", "value", " ", "is", " ", "1.00", "02_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "not", " ", "hyper", "optimize", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "divide", "\\u", "lr", "'_", "]_", "=_", "2._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "cost", "\\u", "threshol", "d", "'_", "]_", "=_", "1.00", "02_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "patien", "ce", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "validat", "e\\u", "postprocess", "'_", "]_", "=_", "'", "lambda", " ", "x", ":", "10", "**", "(", "x", "/", "nump", "y", ".", "log", "(", "10", "))'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "truncat", "e\\u", "gradi", "ent", "'_", "]_", "=_", "80_", "#", " ", "truncat", "ed", " ", "BP", "TT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "lr", "\\u", "adapt", "'_", "]_", "=_", "0_", "#", " ", "1", "/(", "1", " ", "+", " ", "n", "/", "n", "0", ")", " ", "sched", "ulin", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "lr", "\\u", "beta", "'_", "]_", "=_", "10_", "*_", "1900", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "lr", "\\u", "start", "'_", "]_", "=_", "'", "on", "\\u", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "no", "\\u", "noise", "\\u", "bias", "'_", "]_", "=_", "True_", "#", " ", "do", " ", "not", " ", "use", " ", "weight", " ", "noise", " ", "for", " ", "biases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "carry", "\\u", "h", "0", "'_", "]_", "=_", "True_", "#", " ", "carry", " ", "over", " ", "h", "0", " ", "acro", "ss", " ", "updates_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "sample", "\\u", "step", "s", "'_", "]_", "=_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "change", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "miner", "r", "'_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "shift", "'_", "]_", "=_", "1_", "#", " ", "n", "-", "step", " ", "forward", " ", "prediction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "cuto", "ff", "\\u", "rescale", "\\u", "length", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "job", "man_", "(_", "state_", ",_", "None_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "text", "\\u", "data_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "out", "\\u", "format_", "(_", "x_", ",_", "y_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "x", "'_", ":_", "x_", ",_", "'", "y", "'_", ":_", "y_", ",_", "'", "reset", "'_", ":_", "r_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "out", "\\u", "format\\u", "valid_", "(_", "x_", ",_", "y_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "'", "x", "'_", ":_", "x_", ",_", "'", "y", "'_", ":_", "y_", ",_", "'", "reset", "'_", ":_", "r_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "data_", "=_", "LM", "Iterator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "state_", "[_", "'", "bs", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "state_", "[_", "'", "path", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "\\u", "len_", "=_", "state_", "[_", "'", "seq", "len", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "\"", "train", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chunks_", "=_", "state_", "[_", "'", "chunks", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shift_", "=_", "state_", "[_", "'", "shift", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "format_", "=_", "out", "\\u", "format_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "fit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "data_", "=_", "LM", "Iterator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "state_", "[_", "'", "bs", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "state_", "[_", "'", "path", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "infini", "te", "\\u", "loop_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "short", "\\u", "sequences_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "\\u", "len_", "=_", "state_", "[_", "'", "seq", "len", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "\"", "valid", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reset_", "=_", "state_", "[_", "'", "reset", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chunks_", "=_", "state_", "[_", "'", "chunks", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shift_", "=_", "state_", "[_", "'", "shift", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "format_", "=_", "out", "\\u", "format\\u", "valid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "fit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", "=_", "LM", "Iterator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "state_", "[_", "'", "bs", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "state_", "[_", "'", "path", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "infini", "te", "\\u", "loop_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "short", "\\u", "sequences_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "seq", "\\u", "len_", "=_", "state_", "[_", "'", "seq", "len", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "\"", "test", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "chunks_", "=_", "state_", "[_", "'", "chunks", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shift_", "=_", "state_", "[_", "'", "shift", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "format_", "=_", "out", "\\u", "format\\u", "valid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "can", "\\u", "fit_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "wiki", "'_", "in_", "state_", "[_", "'", "path", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "train", "\\u", "data_", ",_", "valid", "\\u", "data_", ",_", "test\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "job", "man_", "(_", "state_", ",_", "channel_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", " ", "dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rng_", "=_", "numpy_", "._", "random_", "._", "Random", "State_", "(_", "state_", "[_", "'", "seed", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "declar", "e", " ", "the", " ", "dimension", "alie", "s", " ", "of", " ", "the", " ", "input", " ", "and", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "[_", "'", "chunks", "'_", "]_", "==_", "'", "words", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "[_", "'", "n", "\\u", "in", "'_", "]_", "=_", "10000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "n", "\\u", "out", "'_", "]_", "=_", "10000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "[_", "'", "n", "\\u", "in", "'_", "]_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "state_", "[_", "'", "n", "\\u", "out", "'_", "]_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "train", "\\u", "data_", ",_", "valid", "\\u", "data_", ",_", "test\\u", "data_", "=_", "get", "\\u", "text", "\\u", "data_", "(_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "BEGIN", " ", "Tu", "tori", "al_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Define", " ", "The", "ano", " ", "Inp", "ut", " ", "Variables_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "TT_", "._", "lve", "ctor_", "(_", "'", "x", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "TT_", "._", "lve", "ctor_", "(_", "'", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h0_", "=_", "theano_", "._", "shared_", "(_", "numpy_", "._", "zeros_", "(_", "(_", "eval_", "(_", "state_", "[_", "'", "nh", "ids", "'_", "]_", ")_", "[_", "-_", "1_", "]_", ",_", ")_", ",_", "dtype_", "=_", "'", "float", "32", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Neu", "ral", " ", "Implementation", " ", "of", " ", "the", " ", "Operators", ":", " ", "\\\\", "opl", "us_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Word", " ", "Embedding", "_", "\\u\\u\\uNL\\u\\u\\u_", "emb", "\\u", "words_", "=_", "Multi", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "in_", "=_", "state_", "[_", "'", "n", "\\u", "in", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "hid", "s_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "\\u", "nh", "ids", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activation_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "\\u", "activ", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "fn_", "=_", "'", "sample", "\\u", "weight", "s", "\\u", "classic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank", "\\u", "n", "\\u", "approx_", "=_", "state_", "[_", "'", "rank", "\\u", "n", "\\u", "approx", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "state_", "[_", "'", "inp", "\\u", "scale", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sparsity", "_", "=_", "state_", "[_", "'", "inp", "\\u", "spars", "e", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "\\u", "bias_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "\\u", "bias", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "emb", "\\u", "words", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "De", "ep", " ", "Transiti", "on", " ", "Recurren", "t", " ", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "rec_", "=_", "eval_", "(_", "state_", "[_", "'", "rec", "\\u", "layer", "'_", "]_", ")_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eval_", "(_", "state_", "[_", "'", "nh", "ids", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activation_", "=_", "eval_", "(_", "state_", "[_", "'", "rec", "\\u", "activ", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "activation", " ", "=", " ", "'", "TT", ".", "nnet", ".", "sigm", "oid", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "rec", "\\u", "bias", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "rec", "\\u", "scale", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sparsity", "_", "=_", "eval_", "(_", "state_", "[_", "'", "rec", "\\u", "spars", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "fn_", "=_", "eval_", "(_", "state_", "[_", "'", "rec", "\\u", "init", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "rec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Sti", "chin", "g", " ", "them", " ", "together_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "(", "1", ")", " ", "Get", " ", "the", " ", "embed", "ding", " ", "of", " ", "a", " ", "word_", "\\u\\u\\uNL\\u\\u\\u_", "x", "\\u", "emb_", "=_", "emb", "\\u", "words_", "(_", "x_", ",_", "no", "\\u", "noise", "\\u", "bias_", "=_", "state_", "[_", "'", "no", "\\u", "noise", "\\u", "bias", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#####", " ", "(", "2", ")", " ", "Embedding", " ", "+", " ", "Hi", "dde", "n", " ", "State", " ", "via", " ", "DT", " ", "Recurren", "t", " ", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "reset_", "=_", "TT_", "._", "scalar_", "(_", "'", "reset", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "\\u", "layer_", "=_", "rec_", "(_", "x", "\\u", "emb_", ",_", "n", "\\u", "steps_", "=_", "x_", "._", "shape_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "state_", "=_", "h0_", "*_", "reset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "noise", "\\u", "bias_", "=_", "state_", "[_", "'", "no", "\\u", "noise", "\\u", "bias", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "truncat", "e\\u", "gradient_", "=_", "state_", "[_", "'", "truncat", "e\\u", "gradi", "ent", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "BEGIN", " ", "Exercise", ":", " ", "DOT", "-", "RN", "N_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Neu", "ral", " ", "Implementation", " ", "of", " ", "the", " ", "Operators", ":", " ", "\\\\", "lh", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Exercise", " ", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Hi", "dde", "n", " ", "state", " ", "->", " ", "Intermediat", "e", " ", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "emb", "\\u", "state_", "=_", "Multi", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "in_", "=_", "eval_", "(_", "state_", "[_", "'", "nh", "ids", "'_", "]_", ")_", "[_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "hid", "s_", "=_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "nh", "id", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activation_", "=_", "linear_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "fn_", "=_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "init", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "state_", "[_", "'", "dout", "\\u", "scale", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sparsity", "_", "=_", "state_", "[_", "'", "dout", "\\u", "spars", "e", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "\\u", "bias_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "bias", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "emb", "\\u", "state", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Exercise", " ", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Inp", "ut", " ", "->", " ", "Intermediat", "e", " ", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "emb", "\\u", "words", "\\u", "out_", "=_", "Multi", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "in_", "=_", "state_", "[_", "'", "n", "\\u", "in", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "hid", "s_", "=_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "nh", "id", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activation_", "=_", "linear_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "fn_", "=_", "'", "sample", "\\u", "weight", "s", "\\u", "classic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "state_", "[_", "'", "dout", "\\u", "scale", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sparsity", "_", "=_", "state_", "[_", "'", "dout", "\\u", "spars", "e", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rank", "\\u", "n", "\\u", "approx_", "=_", "state_", "[_", "'", "dout", "\\u", "rank", "\\u", "n", "\\u", "approx", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "\\u", "bias_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "bias", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "emb", "\\u", "words", "\\u", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Hi", "dde", "n", " ", "State", ":", " ", "Combine", " ", "emb", "\\u", "state", " ", "and", " ", "emb", "\\u", "words", "\\u", "out_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Exercise", " ", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "out", "hid", "\\u", "activ", "_", "=_", "Una", "ry", "Op_", "(_", "activation_", "=_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "activ", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "#", " ", "Exercise", " ", "(", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "out", "hid", "\\u", "dropout_", "=_", "Drop", "Op_", "(_", "dropout_", "=_", "state_", "[_", "'", "drop", "out", "'_", "]_", ",_", "rng_", "=_", "rng_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Softmax", " ", "Layer_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "layer_", "=_", "Softmax", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "eval_", "(_", "state_", "[_", "'", "dout", "\\u", "nh", "id", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "[_", "'", "n", "\\u", "out", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "state_", "[_", "'", "out", "\\u", "scale", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "scale_", "=_", "state_", "[_", "'", "out", "\\u", "bias", "\\u", "scale", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "fn_", "=_", "\"", "sample", "\\u", "weight", "s", "\\u", "classic", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sparsity", "_", "=_", "state_", "[_", "'", "out", "\\u", "spars", "e", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sum", "\\u", "over", "\\u", "time_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Fe", "w", " ", "Optio", "nal", " ", "Thin", "gs_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Direct", " ", "shortcut", " ", "from", " ", "x", " ", "to", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "[_", "'", "shortcut", "\\u", "inp", "out", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shortcut_", "=_", "Multi", "Layer_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "in_", "=_", "state_", "[_", "'", "n", "\\u", "in", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "hid", "s_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "out", "\\u", "nh", "ids", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activations_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "out", "\\u", "activ", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "fn_", "=_", "'", "sample", "\\u", "weight", "s", "\\u", "classic", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "out", "\\u", "scale", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sparsity", "_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "out", "\\u", "spars", "e", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "learn", "\\u", "bias_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "out", "\\u", "learn", "\\u", "bias", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bias", "\\u", "scale_", "=_", "eval_", "(_", "state_", "[_", "'", "inp", "out", "\\u", "bias", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "shortcut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Learn", "ing", " ", "rate", " ", "sched", "ulin", "g", " ", "(", "1", "/(", "1", "+", "n", "/", "beta", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "state_", "[_", "'", "clr", "'_", "]_", "=_", "state_", "[_", "'", "lr", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "update", "\\u", "lr_", "(_", "obj_", ",_", "cost_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stp", "_", "=_", "obj_", "._", "step_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "obj_", "._", "state_", "[_", "'", "lr", "\\u", "start", "'_", "]_", ",_", "int_", ")_", "and_", "stp", "_", ">_", "obj_", "._", "state_", "[_", "'", "lr", "\\u", "start", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "=_", "float_", "(_", "stp", "_", "-_", "obj_", "._", "state_", "[_", "'", "lr", "\\u", "start", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "lr_", "=_", "obj_", "._", "state_", "[_", "'", "clr", "'_", "]_", "/_", "(_", "1_", "+_", "time_", "/_", "obj_", "._", "state_", "[_", "'", "lr", "\\u", "beta", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "lr_", "=_", "new", "\\u", "lr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "[_", "'", "lr", "\\u", "adapt", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rec_", "._", "add", "\\u", "schedule_", "(_", "update", "\\u", "lr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Neu", "ral", " ", "Implementation", "s", " ", "of", " ", "the", " ", "Lang", "ua", "ge", " ", "Model_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Train", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "[_", "'", "shortcut", "\\u", "inp", "out", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "inputs_", "=_", "[_", "rec", "\\u", "layer_", ",_", "shortcut_", "(_", "x_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "inputs_", "=_", "[_", "rec", "\\u", "layer_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Exercise", " ", "(", "1", "):", " ", "Compute", " ", "the", " ", "output", " ", "intermediate", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "hid_", "=_", "out", "hid", "\\u", "activ", "_", "(_", "emb", "\\u", "state_", "(_", "rec", "\\u", "layer_", ")_", "+_", "emb", "\\u", "words", "\\u", "out_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#####", " ", "Exercise", " ", "(", "2", "):", " ", "Apply", " ", "Dropout_", "\\u\\u\\uNL\\u\\u\\u_", "out", "hid_", "=_", "out", "hid", "\\u", "dropout_", "(_", "out", "hid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "model_", "=_", "output", "\\u", "layer_", "(_", "out", "hid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "noise", "\\u", "bias_", "=_", "state_", "[_", "'", "no", "\\u", "noise", "\\u", "bias", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addition", "al", "\\u", "inputs_", "=_", "addition", "al", "\\u", "inputs_", ")_", "._", "train_", "(_", "target_", "=_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scale_", "=_", "numpy_", "._", "float32_", "(_", "1._", "/_", "state_", "[_", "'", "seq", "len", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nw", "\\u", "h0_", "=_", "rec", "\\u", "layer_", "._", "out_", "[_", "rec", "\\u", "layer_", "._", "out_", "._", "shape_", "[_", "0_", "]_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "[_", "'", "carry", "\\u", "h", "0", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "train", "\\u", "model_", "._", "updates_", "+=_", "[_", "(_", "h0_", ",_", "nw", "\\u", "h0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "h", "0", "val_", "=_", "theano_", "._", "shared_", "(_", "numpy_", "._", "zeros_", "(_", "(_", "eval_", "(_", "state_", "[_", "'", "nh", "ids", "'_", "]_", ")_", "[_", "-_", "1_", "]_", ",_", ")_", ",_", "dtype_", "=_", "'", "float", "32", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rec", "\\u", "layer_", "=_", "rec_", "(_", "emb", "\\u", "words_", "(_", "x_", ",_", "use", "\\u", "noise_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "steps_", "=_", "x_", "._", "shape_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "batch", "\\u", "size_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "state_", "=_", "h", "0", "val_", "*_", "reset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "noise_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nw", "\\u", "h0_", "=_", "rec", "\\u", "layer_", "._", "out_", "[_", "rec", "\\u", "layer_", "._", "out_", "._", "shape_", "[_", "0_", "]_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Exercise", " ", "(", "1", "):", " ", "Compute", " ", "the", " ", "output", " ", "intermediate", " ", "layer_", "\\u\\u\\uNL\\u\\u\\u_", "out", "hid_", "=_", "out", "hid", "\\u", "activ", "_", "(_", "emb", "\\u", "state_", "(_", "rec", "\\u", "layer_", ")_", "+_", "emb", "\\u", "words", "\\u", "out_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#####", " ", "Exercise", " ", "(", "2", "):", " ", "Apply", " ", "Dropout_", "\\u\\u\\uNL\\u\\u\\u_", "out", "hid_", "=_", "out", "hid", "\\u", "dropout_", "(_", "out", "hid_", ",_", "use", "\\u", "noise_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "[_", "'", "shortcut", "\\u", "inp", "out", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "inputs_", "=_", "[_", "rec", "\\u", "layer_", ",_", "shortcut_", "(_", "x_", ",_", "use", "\\u", "noise_", "=_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "inputs_", "=_", "[_", "rec", "\\u", "layer_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "model_", "=_", "output", "\\u", "layer_", "(_", "out", "hid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addition", "al", "\\u", "inputs_", "=_", "addition", "al", "\\u", "inputs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "noise_", "=_", "False_", ")_", "._", "validate_", "(_", "target_", "=_", "y_", ",_", "sum", "\\u", "over", "\\u", "time_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "updates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "[_", "'", "carry", "\\u", "h", "0", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "\\u", "updates_", "=_", "[_", "(_", "h", "0", "val_", ",_", "nw", "\\u", "h0_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "fn_", "=_", "theano_", "._", "function_", "(_", "[_", "x_", ",_", "y_", ",_", "reset_", "]_", ",_", "valid", "\\u", "model_", "._", "out_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "valid", "\\u", "fn", "'_", ",_", "updates_", "=_", "valid", "\\u", "updates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Sampl", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "single", "-", "step", " ", "sampling_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "sample", "\\u", "fn_", "(_", "word", "\\u", "tm1", "_", ",_", "h", "\\u", "tm1", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "emb_", "=_", "emb", "\\u", "words_", "(_", "word", "\\u", "tm1", "_", ",_", "use", "\\u", "noise_", "=_", "False_", ",_", "one", "\\u", "step_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h0_", "=_", "rec_", "(_", "x", "\\u", "emb_", ",_", "state", "\\u", "before_", "=_", "h", "\\u", "tm1", "_", ",_", "one", "\\u", "step_", "=_", "True_", ",_", "use", "\\u", "noise_", "=_", "False_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "hid_", "=_", "out", "hid", "\\u", "dropout_", "(_", "out", "hid", "\\u", "activ", "_", "(_", "emb", "\\u", "state_", "(_", "h0_", ",_", "use", "\\u", "noise_", "=_", "False_", ",_", "one", "\\u", "step_", "=_", "True_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "emb", "\\u", "words", "\\u", "out_", "(_", "word", "\\u", "tm1", "_", ",_", "use", "\\u", "noise_", "=_", "False_", ",_", "one", "\\u", "step_", "=_", "True_", ")_", ",_", "one", "\\u", "step_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "noise_", "=_", "False_", ",_", "one", "\\u", "step_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word_", "=_", "output", "\\u", "layer_", "._", "get", "\\u", "sample_", "(_", "state", "\\u", "below_", "=_", "out", "hid_", ",_", "addition", "al", "\\u", "inputs_", "=_", "[_", "h0_", "]_", ",_", "temp_", "=_", "1._", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "word_", ",_", "h0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "scan", " ", "for", " ", "iterati", "ng", " ", "the", " ", "single", "-", "step", " ", "samp", "ling", " ", "multiple", " ", "times_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "samples_", ",_", "summaries_", "]_", ",_", "updates_", "=_", "scan_", "(_", "sample", "\\u", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "states_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "TT_", "._", "alloc_", "(_", "numpy_", "._", "int64_", "(_", "0_", ")_", ",_", "state_", "[_", "'", "sample", "\\u", "step", "s", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "TT_", "._", "alloc_", "(_", "numpy_", "._", "float32_", "(_", "0_", ")_", ",_", "1_", ",_", "eval_", "(_", "state_", "[_", "'", "nh", "ids", "'_", "]_", ")_", "[_", "-_", "1_", "]_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "n", "\\u", "steps_", "=_", "state_", "[_", "'", "sample", "\\u", "step", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "sampler", "\\u", "scan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "build", " ", "a", " ", "The", "ano", " ", "function", " ", "for", " ", "sampling_", "\\u\\u\\uNL\\u\\u\\u_", "sample", "\\u", "fn_", "=_", "theano_", "._", "function_", "(_", "[_", "]_", ",_", "[_", "samples_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "updates_", "=_", "updates_", ",_", "profile_", "=_", "False_", ",_", "name_", "=_", "'", "sample", "\\u", "fn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Load", " ", "a", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "dictionary_", "=_", "numpy_", "._", "load_", "(_", "state_", "[_", "'", "dictionar", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "[_", "'", "chunks", "'_", "]_", "==_", "'", "char", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dictionary_", "=_", "dictionary_", "[_", "'", "unique", "\\u", "char", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dictionary_", "=_", "dictionary_", "[_", "'", "unique", "\\u", "words", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hook", "\\u", "fn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample_", "=_", "sample", "\\u", "fn_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Sampl", "e", ":'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "[_", "'", "chunks", "'_", "]_", "==_", "'", "char", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\"_", "._", "join_", "(_", "dictionary_", "[_", "sample_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "si_", "in_", "sample_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "dictionary_", "[_", "si_", "]_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Build", " ", "and", " ", "Train", " ", "a", " ", "Model_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Define", " ", "a", " ", "model_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "=_", "LM", "\\u", "Model_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cost", "\\u", "layer_", "=_", "train", "\\u", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "weight", "\\u", "noise", "\\u", "amount_", "=_", "state_", "[_", "'", "weight", "\\u", "noise", "\\u", "amo", "unt", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "fn_", "=_", "valid", "\\u", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clean", "\\u", "bef", "ore", "\\u", "noise", "\\u", "fn_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "noise", "\\u", "fn_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rng_", "=_", "rng_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "state_", "[_", "'", "relo", "ad", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "._", "load_", "(_", "state_", "[_", "'", "prefix", "'_", "]_", "+_", "'", "model", ".", "np", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Define", " ", "a", " ", "trainer_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Train", "ing", " ", "algo", "rit", "hm", " ", "(", "SGD", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "[_", "'", "moment", "'_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "SGD", "_", "(_", "model_", ",_", "state_", ",_", "train", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "SGD", "\\u", "m_", "(_", "model_", ",_", "state_", ",_", "train", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#####", " ", "Main", " ", "loop", " ", "of", " ", "the", " ", "trainer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "main_", "=_", "Main", "Loop_", "(_", "train", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "algo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "channel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "train", "\\u", "cost_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hooks_", "=_", "hook", "\\u", "fn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validat", "e\\u", "postprocess", "_", "=_", "eval_", "(_", "state_", "[_", "'", "validat", "e\\u", "postprocess", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "Run", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "main_", "._", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Craig-Macomber/Panda3D-Terrain-System/renderer/renderer.py
[ { "content": "from direct.showbase.ShowBase import ShowBase\nimport direct.directbase.DirectStart\nfrom pandac.PandaModules import *\n\nfrom terrain.bakery.bakery import Tile, parseFile, loadTex\nimport math\n\n\"\"\"\nPlanned Renderers\nRenderNode - Basic Tile Renderer\nRenderAutoTiler(RenderNode) - Fetches tiles near a ficuse from a tile source and renders them\nGeoClipMapper - \n\n\"\"\"\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RenderNode(NodePath):", "metadata": "root.RenderNode", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def __init__(self,path,terrainNode,heightScale):\n NodePath.__init__(self,path+\"_render\")\n \n self.heightScale=heightScale\n \n d=parseFile(path+'/texList.txt')\n \n def getRenderMapType(name):\n return getattr(TextureStage,name)\n \n def getCombineMode(name):\n return getattr(TextureStage,name)\n \n self.mapTexStages={}\n self.specialMaps={}\n for m in d['Special']:\n s=m.split('\\t')\n self.specialMaps[s[1]]=s[0]\n \n # terrainNode holds all the terrain tiles\n self.terrainNode=terrainNode\n self.terrainNode.reparentTo(self)\n #self.terrainNode.setShader(loader.loadShader(path+\"/render.sha\"))\n #self.terrainNode.setShaderAuto()\n \n # List on non map texture stages, and their sizes\n # (TexStage,Size)\n self.texList=[]\n \n if \"Tex2D\" in d:\n sort=0;\n for m in d[\"Tex2D\"]:\n sort+=1\n s=m.split()\n name=s[0]\n texStage=TextureStage(name+'stage'+str(sort))\n texStage.setSort(sort)\n source=s[1]\n \n def setTexModes(modeText):\n combineMode=[]\n for t in modeText:\n if t[:1]=='M':\n texStage.setMode(getRenderMapType(t))\n elif t[:1]=='C':\n combineMode.append(getCombineMode(t))\n elif t=='Save':\n texStage.setSavedResult(True)\n else:\n print \"Illegal mode info for \"+name\n if len(combineMode)>0:\n texStage.setCombineRgb(*combineMode)\n if len(modeText)==0:\n texStage.setMode(TextureStage.MModulate)\n \n if source=='file':\n \n setTexModes(s[3:])\n tex=loadTex(path+\"/textures/\"+name)\n self.terrainNode.setTexture(texStage,tex)\n self.terrainNode.setShaderInput('tex2D_'+name,tex)\n self.texList.append((texStage,float(s[2])))\n \n elif source=='map':\n setTexModes(s[2:])\n self.mapTexStages[s[0]]=texStage\n\n else:\n print 'Invalid source for '+name+' int Tex2D'", "metadata": "root.RenderNode.__init__", "header": "['class', 'RenderNode', '(', 'NodePath', ')', ':', '___EOS___']", "index": 16 } ]
[ { "span": "from direct.showbase.ShowBase import ShowBase", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 45 }, { "span": "import direct.directbase.DirectStart", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 36 }, { "span": "from terrain.bakery.bakery import Tile, parseFile, loadTex", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 58 }, { "span": "import math", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "direct_", "._", "show", "base_", "._", "Show", "Base_", "import_", "Show", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "direct_", "._", "direct", "base_", "._", "Direct", "Start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "panda", "c_", "._", "Pan", "da", "Modules_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "terrain", "_", "._", "bake", "ry_", "._", "bake", "ry_", "import_", "Tile_", ",_", "parse", "File_", ",_", "load", "Tex", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Plann", "ed", " ", "Render", "ers", "\\", "10", ";", "Render", "Node", " ", "-", " ", "Basic", " ", "Til", "e", " ", "Render", "er", "\\", "10", ";", "Render", "Auto", "Til", "er", "(", "Render", "Node", ")", " ", "-", " ", "Fetche", "s", " ", "tiles", " ", "near", " ", "a", " ", "fic", "use", " ", "from", " ", "a", " ", "tile", " ", "source", " ", "and", " ", "render", "s", " ", "them", "\\", "10", ";", "Geo", "Clip", "Map", "per", " ", "-", " ", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Render", "Node_", "(_", "Node", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Render", "Node_", "(_", "Node", "Path_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "path_", ",_", "terrain", "Node_", ",_", "height", "Scale_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Node", "Path_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "path_", "+_", "\"\\u", "render", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "height", "Scale_", "=_", "height", "Scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "parse", "File_", "(_", "path_", "+_", "'/", "tex", "List", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Render", "Map", "Type_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "Text", "ure", "Stage_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Combine", "Mode_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "getattr_", "(_", "Text", "ure", "Stage_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "map", "Tex", "Stage", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "special", "Maps_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "d_", "[_", "'", "Special", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "m_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "special", "Maps_", "[_", "s_", "[_", "1_", "]_", "]_", "=_", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "terrain", "Node", " ", "hold", "s", " ", "all", " ", "the", " ", "terrain", " ", "tiles_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "terrain", "Node_", "=_", "terrain", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "terrain", "Node_", "._", "repar", "ent", "To_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "terrain", "Node", ".", "set", "Shader", "(", "load", "er", ".", "load", "Shader", "(", "path", "+\"", "/", "render", ".", "sha", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "terrain", "Node", ".", "set", "Shader", "Auto", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "on", " ", "non", " ", "map", " ", "textu", "re", " ", "stage", "s", ",", " ", "and", " ", "thei", "r", " ", "sizes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "Tex", "Stage", ",", "Size", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tex", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "Tex", "2", "D", "\"_", "in_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sort_", "=_", "0_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "d_", "[_", "\"", "Tex", "2", "D", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sort_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "m_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tex", "Stage_", "=_", "Text", "ure", "Stage_", "(_", "name_", "+_", "'", "stage", "'_", "+_", "str_", "(_", "sort_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tex", "Stage_", "._", "set", "Sort_", "(_", "sort_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "s_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Tex", "Modes_", "(_", "mode", "Text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "combin", "e", "Mode_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "t_", "in_", "mode", "Text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "t_", "[_", ":_", "1_", "]_", "==_", "'", "M", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tex", "Stage_", "._", "set", "Mode_", "(_", "get", "Render", "Map", "Type_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "[_", ":_", "1_", "]_", "==_", "'", "C", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "combin", "e", "Mode_", "._", "append_", "(_", "get", "Combine", "Mode_", "(_", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "t_", "==_", "'", "Save", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tex", "Stage_", "._", "set", "Save", "d", "Result_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "Il", "lega", "l", " ", "mode", " ", "info", " ", "for", " ", "\"_", "+_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "combin", "e", "Mode_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tex", "Stage_", "._", "set", "Combine", "Rg", "b_", "(_", "*_", "combin", "e", "Mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "mode", "Text_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tex", "Stage_", "._", "set", "Mode_", "(_", "Text", "ure", "Stage_", "._", "MM", "od", "ulate", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "source_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "set", "Tex", "Modes_", "(_", "s_", "[_", "3_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tex_", "=_", "load", "Tex", "_", "(_", "path_", "+_", "\"/", "textures", "/\"_", "+_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "terrain", "Node_", "._", "set", "Texture_", "(_", "tex", "Stage_", ",_", "tex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "terrain", "Node_", "._", "set", "Shader", "Input_", "(_", "'", "tex", "2", "D", "\\u'_", "+_", "name_", ",_", "tex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tex", "List_", "._", "append_", "(_", "(_", "tex", "Stage_", ",_", "float_", "(_", "s_", "[_", "2_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "source_", "==_", "'", "map", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "set", "Tex", "Modes_", "(_", "s_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map", "Tex", "Stage", "s_", "[_", "s_", "[_", "0_", "]_", "]_", "=_", "tex", "Stage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Inva", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/apps/impala/gen-py/fb303/ttypes.py
[ { "content": "#\n# Autogenerated by Thrift Compiler (0.9.3)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n# options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\n\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n from thrift.protocol import fastbinary\nexcept:\n fastbinary = None\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class fb_status(object):\n \"\"\"\n Common status reporting mechanism across all services\n \"\"\"\n DEAD = 0\n STARTING = 1\n ALIVE = 2\n STOPPING = 3\n STOPPED = 4\n WARNING = 5\n\n _VALUES_TO_NAMES = {\n 0: \"DEAD\",\n 1: \"STARTING\",\n 2: \"ALIVE\",\n 3: \"STOPPING\",\n 4: \"STOPPED\",\n 5: \"WARNING\",\n }\n\n _NAMES_TO_VALUES = {\n \"DEAD\": 0,\n \"STARTING\": 1,\n \"ALIVE\": 2,\n \"STOPPING\": 3,\n \"STOPPED\": 4,\n \"WARNING\": 5,\n }", "metadata": "root.fb_status", "header": "['module', '___EOS___']", "index": 18 } ]
[ { "span": "from thrift.Thrift import TType, TMessageType, TException, TApplicationException", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 80 }, { "span": "from thrift.transport import TTransport", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 39 }, { "span": "from thrift.protocol import TBinaryProtocol, TProtocol", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 54 }, { "span": "from thrift.protocol import fastbinary", "start_line": 13, "start_column": 2, "end_line": 13, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auto", "generat", "ed", " ", "by", " ", "Thri", "ft", " ", "Compil", "er", " ", "(", "0.", "9.3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "EDIT", " ", "UNL", "ESS", " ", "YOU", " ", "ARE", " ", "SUR", "E", " ", "THA", "T", " ", "YOU", " ", "KN", "OW", " ", "WH", "AT", " ", "YOU", " ", "ARE", " ", "DOI", "NG_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "options", " ", "string", ":", " ", "py", ":", "new", "\\u", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "Thri", "ft_", "import_", "TT", "ype_", ",_", "TM", "essage", "Type_", ",_", "TE", "xcept", "ion_", ",_", "TA", "ppl", "ication", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TB", "inary", "Protocol_", ",_", "TP", "roto", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "thrift", "_", "._", "protocol_", "import_", "fastbinary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fastbinary_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "fb", "\\u", "status_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Common", " ", "status", " ", "reporting", " ", "mechanism", " ", "acro", "ss", " ", "all", " ", "service", "s", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEAD", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "START", "ING_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALI", "VE_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STOP", "PING", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STOPPED", "_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WARNING_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "VALU", "ES", "\\u", "TO", "\\u", "NAMES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ":_", "\"", "DEAD", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "\"", "START", "ING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "\"", "ALI", "VE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "3_", ":_", "\"", "STOP", "PING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "\"", "STOPPED", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ":_", "\"", "WARN", "ING", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "NAMES", "\\u", "TO", "\\u", "VALUES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "DEAD", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "START", "ING", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ALI", "VE", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STOP", "PING", "\"_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STOPPED", "\"_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tryolabs/daywatch/daywatch/core/tasks.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import absolute_import\nfrom core.settings import BROKER_URL\nfrom celery import Celery\n\ncelery = Celery('core.tasks', broker=BROKER_URL)\n\nfrom django.conf import settings\nfrom core.models import SITE_MODEL, Currency\n\nfrom core.spiders import run_site_spider\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@celery.task\ndef run_spiders(site_ids):\n '''Run all the spiders belonging to the sites in `site_ids`.\n\n '''\n sites = [SITE_MODEL.objects.get(id=id)\n for id in site_ids]\n for site in sites:\n run_site_spider(site)", "metadata": "root.run_spiders", "header": "['module', '___EOS___']", "index": 15 }, { "content": "@celery.task\ndef update_currencies():\n Currency.update_currencies()", "metadata": "root.update_currencies", "header": "['module', '___EOS___']", "index": 26 } ]
[ { "span": "from django.conf import settings", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "settings_", "import_", "BROKER", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "celery_", "import_", "Celery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "celery_", "=_", "Celery", "_", "(_", "'", "core", ".", "task", "s", "'_", ",_", "broker_", "=_", "BROKER", "\\u", "URL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "SITE", "\\u", "MODEL_", ",_", "Currenc", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core_", "._", "spiders", "_", "import_", "run", "\\u", "site", "\\u", "spider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "celery_", "._", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "spiders", "_", "(_", "site", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Run", " ", "all", " ", "the", " ", "spiders", " ", "belonging", " ", "to", " ", "the", " ", "sites", " ", "in", " ", "`", "site", "\\u", "ids", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sites_", "=_", "[_", "SITE", "\\u", "MODEL_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "id_", "in_", "site", "\\u", "ids_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "site_", "in_", "sites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "\\u", "site", "\\u", "spider_", "(_", "site_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "celery_", "._", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "update", "\\u", "currencies", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Currenc", "y_", "._", "update", "\\u", "currencies", "_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
JoelBender/bacpypes/pcap_tools/ReadPropertySummaryFilter.py
[ { "content": "#!/usr/bin/python\n\n\"\"\"\nRead Property Summary Filter - Summarize Read Property Requests/Responses\n\"\"\"\n\nimport sys\n\nfrom bacpypes.debugging import Logging, function_debugging, ModuleLogger\nfrom bacpypes.consolelogging import ConsoleLogHandler\n\nfrom bacpypes.pdu import Address\nfrom bacpypes.analysis import trace, strftimestamp, Tracer\nfrom bacpypes.apdu import ReadPropertyRequest, ReadPropertyACK\n\ntry:\n from CSStat import Statistics\nexcept ImportError:\n Statistics = lambda: None\n\n# some debugging\n_debug = 0\n_log = ModuleLogger(globals())\n\n# globals\nfilterSource = None\nfilterDestination = None\nfilterHost = None\nfilterEval = None\n\n# dictionary of pending requests\nrequests = {}\n\n# all traffic\ntraffic = []\n\n#\n# Traffic\n#\n\n\n#\n# Match\n#\n\n\n#\n# ReadPropertySummary\n#\n\n\n#\n# __main__\n#\n\ntry:\n if ('--debug' in sys.argv):\n indx = sys.argv.index('--debug')\n for i in range(indx+1, len(sys.argv)):\n ConsoleLogHandler(sys.argv[i])\n del sys.argv[indx:]\n\n if _debug: _log.debug(\"initialization\")\n\n # check for src\n if ('--src' in sys.argv):\n i = sys.argv.index('--src')\n filterSource = Address(sys.argv[i+1])\n if _debug: _log.debug(\" - filterSource: %r\", filterSource)\n del sys.argv[i:i+2]\n\n # check for dest\n if ('--dest' in sys.argv):\n i = sys.argv.index('--dest')\n filterDestination = Address(sys.argv[i+1])\n if _debug: _log.debug(\" - filterDestination: %r\", filterDestination)\n del sys.argv[i:i+2]\n\n # check for host\n if ('--host' in sys.argv):\n i = sys.argv.index('--host')\n filterHost = Address(sys.argv[i+1])\n if _debug: _log.debug(\" - filterHost: %r\", filterHost)\n del sys.argv[i:i+2]\n\n # check for eval\n if ('--eval' in sys.argv):\n i = sys.argv.index('--eval')\n filterEval = sys.argv[i+1]\n if _debug: _log.debug(\" - filterEval: %r\", filterEval)\n del sys.argv[i:i+2]\n\n # start out with no unmatched requests\n requests = {}\n\n # trace the file(s)\n for fname in sys.argv[1:]:\n trace(fname, [ReadPropertySummary])\n\n # print some stats at the end\n stats = Statistics()\n\n # dump everything\n for msg in traffic:\n req = msg.req\n resp = msg.resp\n\n if resp:\n deltatime = (resp._timestamp - req._timestamp) * 1000\n if stats:\n stats.Record(deltatime, req._timestamp)\n print strftimestamp(req._timestamp), '\\t', req.pduSource, '\\t', resp.pduSource, '\\t', (\"%6.2fms\" % (deltatime,)), '\\t', msg.retry if (msg.retry != 1) else \"\"\n else:\n print strftimestamp(req._timestamp), '\\t', req.pduSource, '\\t', \"----------\", '\\t', \"----------\", '\\t', msg.retry if (msg.retry != 1) else \"\"\n\n if stats:\n xlw, lw, q1, m, q3, uw, xuw = stats.Whisker()\n if m is not None:\n print \"\\t %-6.1f\" % xuw\n print \"\\t--- %-6.1f\" % uw\n print \"\\t | \"\n print \"\\t.'. %-6.1f\" % q3\n print \"\\t| |\"\n print \"\\t|-| %-6.1f\" % m\n print \"\\t| |\"\n print \"\\t'-' %-6.1f\" % q1\n print \"\\t | \"\n print \"\\t--- %-6.1f\" % lw\n print \"\\t %-6.1f\" % xlw\n else:\n print \"No stats\"\n\nexcept KeyboardInterrupt:\n pass\nexcept Exception, e:\n _log.exception(\"an error has occurred: %s\", e)\nfinally:\n if _debug: _log.debug(\"finally\")\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "_log.debug(\"initialization\")", "start_line": 151, "start_column": 15, "end_line": 151, "end_column": 43 }, { "span": "_log.debug(\" - filterSource: %r\", filterSource)", "start_line": 157, "start_column": 19, "end_line": 157, "end_column": 69 }, { "span": "_log.debug(\" - filterDestination: %r\", filterDestination)", "start_line": 164, "start_column": 19, "end_line": 164, "end_column": 79 }, { "span": "_log.debug(\" - filterHost: %r\", filterHost)", "start_line": 171, "start_column": 19, "end_line": 171, "end_column": 65 }, { "span": "_log.debug(\" - filterEval: %r\", filterEval)", "start_line": 178, "start_column": 19, "end_line": 178, "end_column": 65 }, { "span": "_log.debug(\"finally\")", "start_line": 226, "start_column": 15, "end_line": 226, "end_column": 36 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Read", " ", "Proper", "ty", " ", "Summ", "ary", " ", "Filter", " ", "-", " ", "Summari", "ze", " ", "Read", " ", "Proper", "ty", " ", "Request", "s", "/", "Responses", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "debugg", "ing_", "import_", "Logging_", ",_", "function", "\\u", "debugg", "ing_", ",_", "Modul", "e", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "console", "logging_", "import_", "Cons", "ole", "Log", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "pdu_", "import_", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "analysis_", "import_", "trace_", ",_", "strf", "timestamp_", ",_", "Tracer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bac", "pype", "s_", "._", "apd", "u_", "import_", "Read", "Proper", "ty", "Request_", ",_", "Read", "Proper", "ty", "ACK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "CS", "Stat_", "import_", "Statistics_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Statistics_", "=_", "lambda_", ":_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "debugg", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "debug_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "log_", "=_", "Modul", "e", "Logger_", "(_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "globals_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "Source_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Destination_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Host_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Eval_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dictionar", "y", " ", "of", " ", "pend", "ing", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "requests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "traffic", "_", "\\u\\u\\uNL\\u\\u\\u_", "traffic", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Tra", "ffic", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Match_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Read", "Proper", "ty", "Summary_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\\u\\u", "main\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "'--", "debug", "'_", "in_", "sys_", "._", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "indx_", "=_", "sys_", "._", "argv_", "._", "index_", "(_", "'--", "debug", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "indx_", "+_", "1_", ",_", "len_", "(_", "sys_", "._", "argv_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Cons", "ole", "Log", "Handler_", "(_", "sys_", "._", "argv_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "sys_", "._", "argv_", "[_", "indx_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", "initialization", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "src_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "'--", "src", "'_", "in_", "sys_", "._", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "sys_", "._", "argv_", "._", "index_", "(_", "'--", "src", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Source_", "=_", "Address_", "(_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "filter", "Sou", "rce", ":", " ", "%", "r", "\"_", ",_", "filter", "Source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "sys_", "._", "argv_", "[_", "i_", ":_", "i_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "dest_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'--", "dest", "'_", "in_", "sys_", "._", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "sys_", "._", "argv_", "._", "index_", "(_", "'--", "dest", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Destination_", "=_", "Address_", "(_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "filter", "Dest", "ination", ":", " ", "%", "r", "\"_", ",_", "filter", "Destination_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "sys_", "._", "argv_", "[_", "i_", ":_", "i_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "host_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'--", "host", "'_", "in_", "sys_", "._", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "sys_", "._", "argv_", "._", "index_", "(_", "'--", "host", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Host_", "=_", "Address_", "(_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "filter", "Host", ":", " ", "%", "r", "\"_", ",_", "filter", "Host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "sys_", "._", "argv_", "[_", "i_", ":_", "i_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "eval_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'--", "eval", "'_", "in_", "sys_", "._", "argv_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "sys_", "._", "argv_", "._", "index_", "(_", "'--", "eval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "Eval_", "=_", "sys_", "._", "argv_", "[_", "i_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_", "(_", "\"", " ", " ", " ", " ", "-", " ", "filter", "Eval", ":", " ", "%", "r", "\"_", ",_", "filter", "Eval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "sys_", "._", "argv_", "[_", "i_", ":_", "i_", "+_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "start", " ", "out", " ", "with", " ", "no", " ", "unmatched", " ", "requests_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "requests_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trace", " ", "the", " ", "file", "(", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fname_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "trace_", "(_", "fname_", ",_", "[_", "Read", "Proper", "ty", "Summary_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "some", " ", "stats", " ", "at", " ", "the", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stats_", "=_", "Statistics_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "dump", " ", "every", "thing_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "msg_", "in_", "traffic", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "msg_", "._", "req_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "msg_", "._", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "resp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delta", "time_", "=_", "(_", "resp_", "._", "\\u", "timestamp_", "-_", "req_", "._", "\\u", "timestamp_", ")_", "*_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "._", "Record_", "(_", "delta", "time_", ",_", "req_", "._", "\\u", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "strf", "timestamp_", "(_", "req_", "._", "\\u", "timestamp_", ")_", ",_", "'\\\\", "t", "'_", ",_", "req_", "._", "pdu", "Source_", ",_", "'\\\\", "t", "'_", ",_", "resp_", "._", "pdu", "Source_", ",_", "'\\\\", "t", "'_", ",_", "(_", "\"%", "6.2", "fm", "s", "\"_", "%_", "(_", "delta", "time_", ",_", ")_", ")_", ",_", "'\\\\", "t", "'_", ",_", "msg_", "._", "retry_", "if_", "(_", "msg_", "._", "retry_", "!=_", "1_", ")_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "strf", "timestamp_", "(_", "req_", "._", "\\u", "timestamp_", ")_", ",_", "'\\\\", "t", "'_", ",_", "req_", "._", "pdu", "Source_", ",_", "'\\\\", "t", "'_", ",_", "\"-------", "---\"_", ",_", "'\\\\", "t", "'_", ",_", "\"-------", "---\"_", ",_", "'\\\\", "t", "'_", ",_", "msg_", "._", "retry_", "if_", "(_", "msg_", "._", "retry_", "!=_", "1_", ")_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xl", "w_", ",_", "lw_", ",_", "q1_", ",_", "m_", ",_", "q3_", ",_", "uw", "_", ",_", "xu", "w_", "=_", "stats_", "._", "Whi", "ske", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "t", " ", " ", " ", " ", "%", "-", "6.1", "f", "\"_", "%_", "xu", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "---", " ", "%", "-", "6.1", "f", "\"_", "%_", "uw", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", " ", "|", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", ".'", ".", " ", "%", "-", "6.1", "f", "\"_", "%_", "q3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "|", " ", "|\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "|", "-|", " ", "%", "-", "6.1", "f", "\"_", "%_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "|", " ", "|\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "'-'", " ", "%", "-", "6.1", "f", "\"_", "%_", "q1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", " ", "|", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", "---", " ", "%", "-", "6.1", "f", "\"_", "%_", "lw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\\\\", "t", " ", " ", " ", " ", "%", "-", "6.1", "f", "\"_", "%_", "xl", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "No", " ", "stats", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "board", "Interrupt_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "log_", "._", "exception_", "(_", "\"", "an", " ", "error", " ", "has", " ", "occur", "red", ":", " ", "%", "s", "\"_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "debug_", ":_", "\\u", "log_", "._", "debug_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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
alimanfoo/petl/petl/test/transform/test_intervals.py
[ { "content": "from __future__ import absolute_import, print_function, division\n\n\nimport logging\nimport sys\n\n\nimport petl as etl\nfrom petl.test.helpers import ieq, eq_\nfrom petl.util.vis import lookall\nfrom petl.errors import DuplicateKeyError\nfrom petl.transform.intervals import intervallookup, intervallookupone, \\\n facetintervallookup, facetintervallookupone, intervaljoin, \\\n intervalleftjoin, intervaljoinvalues, intervalsubtract, \\\n collapsedintervals, _Interval, intervalantijoin\n\n\nlogger = logging.getLogger(__name__)\ndebug = logger.debug\n\n\ntry:\n # noinspection PyUnresolvedReferences\n import intervaltree\nexcept ImportError as e:\n print('SKIP interval tests: %s' % e, file=sys.stderr)\nelse:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def test_intervallookup():\n\n table = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n lkp = intervallookup(table, 'start', 'stop')\n\n actual = lkp.search(0, 1)\n expect = []\n eq_(expect, actual)\n\n actual = lkp.search(1, 2)\n expect = [(1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp.search(2, 4)\n expect = [(1, 4, 'foo'), (3, 7, 'bar')]\n eq_(expect, actual)\n\n actual = lkp.search(2, 5)\n expect = [(1, 4, 'foo'), (3, 7, 'bar'), (4, 9, 'baz')]\n eq_(expect, actual)\n\n actual = lkp.search(9, 14)\n expect = []\n eq_(expect, actual)\n\n actual = lkp.search(19, 140)\n expect = []\n eq_(expect, actual)\n\n actual = lkp.search(1)\n expect = [(1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp.search(2)\n expect = [(1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp.search(4)\n expect = [(3, 7, 'bar'), (4, 9, 'baz')]\n eq_(expect, actual)\n\n actual = lkp.search(5)\n expect = [(3, 7, 'bar'), (4, 9, 'baz')]\n eq_(expect, actual)", "metadata": "root.test_intervallookup", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def test_intervallookup_include_stop():\n\n table = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, None))\n\n lkp = intervallookup(table, 'start', 'stop', value='value',\n include_stop=True)\n\n actual = lkp.search(0, 1)\n expect = ['foo']\n eq_(expect, actual)\n\n actual = lkp.search(1, 2)\n expect = ['foo']\n eq_(expect, actual)\n\n actual = lkp.search(2, 4)\n expect = ['foo', 'bar', None]\n eq_(expect, actual)\n\n actual = lkp.search(2, 5)\n expect = ['foo', 'bar', None]\n eq_(expect, actual)\n\n actual = lkp.search(9, 14)\n expect = [None]\n eq_(expect, actual)\n\n actual = lkp.search(19, 140)\n expect = []\n eq_(expect, actual)\n\n actual = lkp.search(1)\n expect = ['foo']\n eq_(expect, actual)\n\n actual = lkp.search(2)\n expect = ['foo']\n eq_(expect, actual)\n\n actual = lkp.search(4)\n expect = ['foo', 'bar', None]\n eq_(expect, actual)\n\n actual = lkp.search(5)\n expect = ['bar', None]\n eq_(expect, actual)", "metadata": "root.test_intervallookup_include_stop", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def test_intervallookupone():\n\n table = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n lkp = intervallookupone(table, 'start', 'stop', value='value')\n\n actual = lkp.search(0, 1)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(1, 2)\n expect = 'foo'\n eq_(expect, actual)\n\n try:\n lkp.search(2, 4)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n try:\n lkp.search(2, 5)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n try:\n lkp.search(4, 5)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n try:\n lkp.search(5, 7)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n actual = lkp.search(8, 9)\n expect = 'baz'\n eq_(expect, actual)\n\n actual = lkp.search(9, 14)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(19, 140)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(0)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(1)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp.search(2)\n expect = 'foo'\n eq_(expect, actual)\n\n try:\n lkp.search(4)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n try:\n lkp.search(5)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n actual = lkp.search(8)\n expect = 'baz'\n eq_(expect, actual)", "metadata": "root.test_intervallookupone", "header": "['module', '___EOS___']", "index": 127 }, { "content": " def test_intervallookupone_not_strict():\n\n table = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n lkp = intervallookupone(table, 'start', 'stop', value='value',\n strict=False)\n\n actual = lkp.search(0, 1)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(1, 2)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp.search(2, 4)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp.search(2, 5)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp.search(4, 5)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp.search(5, 7)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp.search(8, 9)\n expect = 'baz'\n eq_(expect, actual)\n\n actual = lkp.search(9, 14)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(19, 140)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(0)\n expect = None\n eq_(expect, actual)\n\n actual = lkp.search(1)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp.search(2)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp.search(4)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp.search(5)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp.search(8)\n expect = 'baz'\n eq_(expect, actual)", "metadata": "root.test_intervallookupone_not_strict", "header": "['module', '___EOS___']", "index": 214 }, { "content": " def test_facetintervallookup():\n\n table = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'),\n ('apple', 3, 7, 'bar'),\n ('orange', 4, 9, 'baz'))\n\n lkp = facetintervallookup(table, key='type', start='start', stop='stop')\n\n actual = lkp['apple'].search(0, 1)\n expect = []\n eq_(expect, actual)\n\n actual = lkp['apple'].search(1, 2)\n expect = [('apple', 1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp['apple'].search(2, 4)\n expect = [('apple', 1, 4, 'foo'), ('apple', 3, 7, 'bar')]\n eq_(expect, actual)\n\n actual = lkp['apple'].search(2, 5)\n expect = [('apple', 1, 4, 'foo'), ('apple', 3, 7, 'bar')]\n eq_(expect, actual)\n\n actual = lkp['orange'].search(2, 5)\n expect = [('orange', 4, 9, 'baz')]\n eq_(expect, actual)\n\n actual = lkp['orange'].search(9, 14)\n expect = []\n eq_(expect, actual)\n\n actual = lkp['orange'].search(19, 140)\n expect = []\n eq_(expect, actual)\n\n actual = lkp['apple'].search(0)\n expect = []\n eq_(expect, actual)\n\n actual = lkp['apple'].search(1)\n expect = [('apple', 1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp['apple'].search(2)\n expect = [('apple', 1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp['apple'].search(4)\n expect = [('apple', 3, 7, 'bar')]\n eq_(expect, actual)\n\n actual = lkp['apple'].search(5)\n expect = [('apple', 3, 7, 'bar')]\n eq_(expect, actual)\n\n actual = lkp['orange'].search(5)\n expect = [('orange', 4, 9, 'baz')]\n eq_(expect, actual)", "metadata": "root.test_facetintervallookup", "header": "['module', '___EOS___']", "index": 284 }, { "content": " def test_facetintervallookupone():\n\n table = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'),\n ('apple', 3, 7, 'bar'),\n ('orange', 4, 9, 'baz'))\n\n lkp = facetintervallookupone(table, key='type', start='start',\n stop='stop', value='value')\n\n actual = lkp['apple'].search(0, 1)\n expect = None\n eq_(expect, actual)\n\n actual = lkp['apple'].search(1, 2)\n expect = 'foo'\n eq_(expect, actual)\n\n try:\n lkp['apple'].search(2, 4)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n try:\n lkp['apple'].search(2, 5)\n except DuplicateKeyError:\n pass\n else:\n assert False, 'expected error'\n\n actual = lkp['apple'].search(4, 5)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp['orange'].search(4, 5)\n expect = 'baz'\n eq_(expect, actual)\n\n actual = lkp['apple'].search(5, 7)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp['orange'].search(5, 7)\n expect = 'baz'\n eq_(expect, actual)\n\n actual = lkp['apple'].search(8, 9)\n expect = None\n eq_(expect, actual)\n\n actual = lkp['orange'].search(8, 9)\n expect = 'baz'\n eq_(expect, actual)\n\n actual = lkp['orange'].search(9, 14)\n expect = None\n eq_(expect, actual)\n\n actual = lkp['orange'].search(19, 140)\n expect = None\n eq_(expect, actual)\n\n actual = lkp['apple'].search(0)\n expect = None\n eq_(expect, actual)\n\n actual = lkp['apple'].search(1)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp['apple'].search(2)\n expect = 'foo'\n eq_(expect, actual)\n\n actual = lkp['apple'].search(4)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp['apple'].search(5)\n expect = 'bar'\n eq_(expect, actual)\n\n actual = lkp['orange'].search(5)\n expect = 'baz'\n eq_(expect, actual)\n\n actual = lkp['apple'].search(8)\n expect = None\n eq_(expect, actual)\n\n actual = lkp['orange'].search(8)\n expect = 'baz'\n eq_(expect, actual)", "metadata": "root.test_facetintervallookupone", "header": "['module', '___EOS___']", "index": 345 }, { "content": " def test_facetintervallookup_compound():\n\n table = (('type', 'variety', 'start', 'stop', 'value'),\n ('apple', 'cox', 1, 4, 'foo'),\n ('apple', 'fuji', 3, 7, 'bar'),\n ('orange', 'mandarin', 4, 9, 'baz'))\n\n lkp = facetintervallookup(table, key=('type', 'variety'), start='start',\n stop='stop')\n\n actual = lkp['apple', 'cox'].search(1, 2)\n expect = [('apple', 'cox', 1, 4, 'foo')]\n eq_(expect, actual)\n\n actual = lkp['apple', 'cox'].search(2, 4)\n expect = [('apple', 'cox', 1, 4, 'foo')]\n eq_(expect, actual)", "metadata": "root.test_facetintervallookup_compound", "header": "['module', '___EOS___']", "index": 441 }, { "content": " def test_intervaljoin():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervaljoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n expect = (('begin', 'end', 'quux', 'start', 'stop', 'value'),\n (1, 2, 'a', 1, 4, 'foo'),\n (2, 4, 'b', 1, 4, 'foo'),\n (2, 4, 'b', 3, 7, 'bar'),\n (2, 5, 'c', 1, 4, 'foo'),\n (2, 5, 'c', 3, 7, 'bar'),\n (2, 5, 'c', 4, 9, 'baz'),\n (1, 8, 'j', 1, 4, 'foo'),\n (1, 8, 'j', 3, 7, 'bar'),\n (1, 8, 'j', 4, 9, 'baz'))\n debug(lookall(actual))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervaljoin", "header": "['module', '___EOS___']", "index": 459 }, { "content": " def test_intervaljoin_include_stop():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervaljoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop',\n include_stop=True)\n expect = (('begin', 'end', 'quux', 'start', 'stop', 'value'),\n (1, 2, 'a', 1, 4, 'foo'),\n (2, 4, 'b', 1, 4, 'foo'),\n (2, 4, 'b', 3, 7, 'bar'),\n (2, 4, 'b', 4, 9, 'baz'),\n (2, 5, 'c', 1, 4, 'foo'),\n (2, 5, 'c', 3, 7, 'bar'),\n (2, 5, 'c', 4, 9, 'baz'),\n (9, 14, 'd', 4, 9, 'baz'),\n (9, 140, 'e', 4, 9, 'baz'),\n (1, 1, 'f', 1, 4, 'foo'),\n (2, 2, 'g', 1, 4, 'foo'),\n (4, 4, 'h', 1, 4, 'foo'),\n (4, 4, 'h', 3, 7, 'bar'),\n (4, 4, 'h', 4, 9, 'baz'),\n (5, 5, 'i', 3, 7, 'bar'),\n (5, 5, 'i', 4, 9, 'baz'),\n (1, 8, 'j', 1, 4, 'foo'),\n (1, 8, 'j', 3, 7, 'bar'),\n (1, 8, 'j', 4, 9, 'baz'))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervaljoin_include_stop", "header": "['module', '___EOS___']", "index": 495 }, { "content": " def test_intervaljoin_prefixes():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervaljoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop',\n lprefix='l_', rprefix='r_')\n expect = (('l_begin', 'l_end', 'l_quux', 'r_start', 'r_stop', 'r_value'),\n (1, 2, 'a', 1, 4, 'foo'),\n (2, 4, 'b', 1, 4, 'foo'),\n (2, 4, 'b', 3, 7, 'bar'),\n (2, 5, 'c', 1, 4, 'foo'),\n (2, 5, 'c', 3, 7, 'bar'),\n (2, 5, 'c', 4, 9, 'baz'),\n (1, 8, 'j', 1, 4, 'foo'),\n (1, 8, 'j', 3, 7, 'bar'),\n (1, 8, 'j', 4, 9, 'baz'))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervaljoin_prefixes", "header": "['module', '___EOS___']", "index": 541 }, { "content": " def test_intervalleftjoin():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervalleftjoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n expect = (('begin', 'end', 'quux', 'start', 'stop', 'value'),\n (1, 2, 'a', 1, 4, 'foo'),\n (2, 4, 'b', 1, 4, 'foo'),\n (2, 4, 'b', 3, 7, 'bar'),\n (2, 5, 'c', 1, 4, 'foo'),\n (2, 5, 'c', 3, 7, 'bar'),\n (2, 5, 'c', 4, 9, 'baz'),\n (9, 14, 'd', None, None, None),\n (9, 140, 'e', None, None, None),\n (1, 1, 'f', None, None, None),\n (2, 2, 'g', None, None, None),\n (4, 4, 'h', None, None, None),\n (5, 5, 'i', None, None, None),\n (1, 8, 'j', 1, 4, 'foo'),\n (1, 8, 'j', 3, 7, 'bar'),\n (1, 8, 'j', 4, 9, 'baz'))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalleftjoin", "header": "['module', '___EOS___']", "index": 577 }, { "content": " def test_intervaljoin_faceted():\n\n left = (('fruit', 'begin', 'end'),\n ('apple', 1, 2),\n ('apple', 2, 4),\n ('apple', 2, 5),\n ('orange', 2, 5),\n ('orange', 9, 14),\n ('orange', 19, 140),\n ('apple', 1, 1),\n ('apple', 2, 2),\n ('apple', 4, 4),\n ('apple', 5, 5),\n ('orange', 5, 5))\n\n right = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'),\n ('apple', 3, 7, 'bar'),\n ('orange', 4, 9, 'baz'))\n\n expect = (('fruit', 'begin', 'end', 'type', 'start', 'stop', 'value'),\n ('apple', 1, 2, 'apple', 1, 4, 'foo'),\n ('apple', 2, 4, 'apple', 1, 4, 'foo'),\n ('apple', 2, 4, 'apple', 3, 7, 'bar'),\n ('apple', 2, 5, 'apple', 1, 4, 'foo'),\n ('apple', 2, 5, 'apple', 3, 7, 'bar'),\n ('orange', 2, 5, 'orange', 4, 9, 'baz'))\n actual = intervaljoin(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop', lkey='fruit',\n rkey='type')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervaljoin_faceted", "header": "['module', '___EOS___']", "index": 618 }, { "content": " def test_intervalleftjoin_faceted():\n\n left = (('fruit', 'begin', 'end'),\n ('apple', 1, 2),\n ('apple', 2, 4),\n ('apple', 2, 5),\n ('orange', 2, 5),\n ('orange', 9, 14),\n ('orange', 19, 140),\n ('apple', 1, 1),\n ('apple', 2, 2),\n ('apple', 4, 4),\n ('apple', 5, 5),\n ('orange', 5, 5))\n\n right = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'),\n ('apple', 3, 7, 'bar'),\n ('orange', 4, 9, 'baz'))\n\n expect = (('fruit', 'begin', 'end', 'type', 'start', 'stop', 'value'),\n ('apple', 1, 2, 'apple', 1, 4, 'foo'),\n ('apple', 2, 4, 'apple', 1, 4, 'foo'),\n ('apple', 2, 4, 'apple', 3, 7, 'bar'),\n ('apple', 2, 5, 'apple', 1, 4, 'foo'),\n ('apple', 2, 5, 'apple', 3, 7, 'bar'),\n ('orange', 2, 5, 'orange', 4, 9, 'baz'),\n ('orange', 9, 14, None, None, None, None),\n ('orange', 19, 140, None, None, None, None),\n ('apple', 1, 1, None, None, None, None),\n ('apple', 2, 2, None, None, None, None),\n ('apple', 4, 4, None, None, None, None),\n ('apple', 5, 5, None, None, None, None),\n ('orange', 5, 5, None, None, None, None))\n\n actual = intervalleftjoin(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop', lkey='fruit',\n rkey='type')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalleftjoin_faceted", "header": "['module', '___EOS___']", "index": 652 }, { "content": " def test_intervalleftjoin_faceted_rkeymissing():\n\n left = (('fruit', 'begin', 'end'),\n ('apple', 1, 2),\n ('orange', 5, 5))\n\n right = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'))\n\n expect = (('fruit', 'begin', 'end', 'type', 'start', 'stop', 'value'),\n ('apple', 1, 2, 'apple', 1, 4, 'foo'),\n ('orange', 5, 5, None, None, None, None))\n\n actual = intervalleftjoin(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop', lkey='fruit',\n rkey='type')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalleftjoin_faceted_rkeymissing", "header": "['module', '___EOS___']", "index": 694 }, { "content": " def test_intervaljoins_faceted_compound():\n\n left = (('fruit', 'sort', 'begin', 'end'),\n ('apple', 'cox', 1, 2),\n ('apple', 'fuji', 2, 4))\n right = (('type', 'variety', 'start', 'stop', 'value'),\n ('apple', 'cox', 1, 4, 'foo'),\n ('apple', 'fuji', 3, 7, 'bar'),\n ('orange', 'mandarin', 4, 9, 'baz'))\n\n expect = (('fruit', 'sort', 'begin', 'end', 'type', 'variety', 'start',\n 'stop', 'value'),\n ('apple', 'cox', 1, 2, 'apple', 'cox', 1, 4, 'foo'),\n ('apple', 'fuji', 2, 4, 'apple', 'fuji', 3, 7, 'bar'))\n\n actual = intervaljoin(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop',\n lkey=('fruit', 'sort'),\n rkey=('type', 'variety'))\n ieq(expect, actual)\n ieq(expect, actual)\n\n actual = intervalleftjoin(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop',\n lkey=('fruit', 'sort'),\n rkey=('type', 'variety'))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervaljoins_faceted_compound", "header": "['module', '___EOS___']", "index": 714 }, { "content": " def test_intervalleftjoin_prefixes():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervalleftjoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop',\n lprefix='l_', rprefix='r_')\n expect = (('l_begin', 'l_end', 'l_quux', 'r_start', 'r_stop', 'r_value'),\n (1, 2, 'a', 1, 4, 'foo'),\n (2, 4, 'b', 1, 4, 'foo'),\n (2, 4, 'b', 3, 7, 'bar'),\n (2, 5, 'c', 1, 4, 'foo'),\n (2, 5, 'c', 3, 7, 'bar'),\n (2, 5, 'c', 4, 9, 'baz'),\n (9, 14, 'd', None, None, None),\n (9, 140, 'e', None, None, None),\n (1, 1, 'f', None, None, None),\n (2, 2, 'g', None, None, None),\n (4, 4, 'h', None, None, None),\n (5, 5, 'i', None, None, None),\n (1, 8, 'j', 1, 4, 'foo'),\n (1, 8, 'j', 3, 7, 'bar'),\n (1, 8, 'j', 4, 9, 'baz'))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalleftjoin_prefixes", "header": "['module', '___EOS___']", "index": 743 }, { "content": " def test_intervalantijoin():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervalantijoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n expect = (('begin', 'end', 'quux'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'))\n debug(lookall(actual))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalantijoin", "header": "['module', '___EOS___']", "index": 785 }, { "content": " def test_intervalantijoin_include_stop():\n\n left = (('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (10, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j'))\n\n right = (('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz'))\n\n actual = intervalantijoin(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop',\n include_stop=True)\n expect = (('begin', 'end', 'quux'),\n (10, 140, 'e'))\n debug(lookall(actual))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalantijoin_include_stop", "header": "['module', '___EOS___']", "index": 818 }, { "content": " def test_intervalantijoin_faceted():\n\n left = (('fruit', 'begin', 'end'),\n ('apple', 1, 2),\n ('apple', 2, 4),\n ('apple', 2, 5),\n ('orange', 2, 5),\n ('orange', 9, 14),\n ('orange', 19, 140),\n ('apple', 1, 1),\n ('apple', 2, 2),\n ('apple', 4, 4),\n ('apple', 5, 5),\n ('orange', 5, 5))\n\n right = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'),\n ('apple', 3, 7, 'bar'),\n ('orange', 4, 9, 'baz'))\n\n expect = (('fruit', 'begin', 'end'),\n ('orange', 9, 14),\n ('orange', 19, 140),\n ('apple', 1, 1),\n ('apple', 2, 2),\n ('apple', 4, 4),\n ('apple', 5, 5),\n ('orange', 5, 5))\n\n actual = intervalantijoin(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop', lkey='fruit',\n rkey='type')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervalantijoin_faceted", "header": "['module', '___EOS___']", "index": 848 }, { "content": " def test_intervaljoinvalues_faceted():\n\n left = (('fruit', 'begin', 'end'),\n ('apple', 1, 2),\n ('apple', 2, 4),\n ('apple', 2, 5),\n ('orange', 2, 5),\n ('orange', 9, 14),\n ('orange', 19, 140),\n ('apple', 1, 1),\n ('apple', 2, 2),\n ('apple', 4, 4),\n ('apple', 5, 5),\n ('orange', 5, 5))\n\n right = (('type', 'start', 'stop', 'value'),\n ('apple', 1, 4, 'foo'),\n ('apple', 3, 7, 'bar'),\n ('orange', 4, 9, 'baz'))\n\n expect = (('fruit', 'begin', 'end', 'value'),\n ('apple', 1, 2, ['foo']),\n ('apple', 2, 4, ['foo', 'bar']),\n ('apple', 2, 5, ['foo', 'bar']),\n ('orange', 2, 5, ['baz']),\n ('orange', 9, 14, []),\n ('orange', 19, 140, []),\n ('apple', 1, 1, []),\n ('apple', 2, 2, []),\n ('apple', 4, 4, []),\n ('apple', 5, 5, []),\n ('orange', 5, 5, []))\n\n actual = intervaljoinvalues(left, right, lstart='begin', lstop='end',\n rstart='start', rstop='stop', lkey='fruit',\n rkey='type', value='value')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_intervaljoinvalues_faceted", "header": "['module', '___EOS___']", "index": 884 }, { "content": " def test_subtract_1():\n\n left = (('begin', 'end', 'label'),\n (1, 6, 'apple'),\n (3, 6, 'orange'),\n (5, 9, 'banana'))\n\n right = (('start', 'stop', 'foo'),\n (3, 4, True))\n\n expect = (('begin', 'end', 'label'),\n (1, 3, 'apple'),\n (4, 6, 'apple'),\n (4, 6, 'orange'),\n (5, 9, 'banana'))\n\n actual = intervalsubtract(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_subtract_1", "header": "['module', '___EOS___']", "index": 924 }, { "content": " def test_subtract_2():\n\n left = (('begin', 'end', 'label'),\n (1, 6, 'apple'),\n (3, 6, 'orange'),\n (5, 9, 'banana'))\n\n right = (('start', 'stop', 'foo'),\n (3, 4, True),\n (5, 6, True))\n\n expect = (('begin', 'end', 'label'),\n (1, 3, 'apple'),\n (4, 5, 'apple'),\n (4, 5, 'orange'),\n (6, 9, 'banana'))\n\n actual = intervalsubtract(left, right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_subtract_2", "header": "['module', '___EOS___']", "index": 947 }, { "content": " def test_subtract_faceted():\n\n left = (('region', 'begin', 'end', 'label'),\n ('north', 1, 6, 'apple'),\n ('south', 3, 6, 'orange'),\n ('west', 5, 9, 'banana'))\n\n right = (('place', 'start', 'stop', 'foo'),\n ('south', 3, 4, True),\n ('north', 5, 6, True))\n\n expect = (('region', 'begin', 'end', 'label'),\n ('north', 1, 5, 'apple'),\n ('south', 4, 6, 'orange'),\n ('west', 5, 9, 'banana'))\n\n actual = intervalsubtract(left, right,\n lkey='region', rkey='place',\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_subtract_faceted", "header": "['module', '___EOS___']", "index": 971 }, { "content": " def test_collapse():\n\n # no facet key\n tbl = (('begin', 'end', 'label'),\n (1, 6, 'apple'),\n (3, 6, 'orange'),\n (5, 9, 'banana'),\n (12, 14, 'banana'),\n (13, 17, 'kiwi'))\n expect = [_Interval(1, 9), _Interval(12, 17)]\n actual = collapsedintervals(tbl, start='begin', stop='end')\n ieq(expect, actual)\n\n # faceted\n tbl = (('region', 'begin', 'end', 'label'),\n ('north', 1, 6, 'apple'),\n ('north', 3, 6, 'orange'),\n ('north', 5, 9, 'banana'),\n ('south', 12, 14, 'banana'),\n ('south', 13, 17, 'kiwi'))\n expect = [('north', 1, 9), ('south', 12, 17)]\n actual = collapsedintervals(tbl, start='begin', stop='end',\n key='region')\n ieq(expect, actual)", "metadata": "root.test_collapse", "header": "['module', '___EOS___']", "index": 995 }, { "content": " def test_integration():\n\n left = etl.wrap((('begin', 'end', 'quux'),\n (1, 2, 'a'),\n (2, 4, 'b'),\n (2, 5, 'c'),\n (9, 14, 'd'),\n (9, 140, 'e'),\n (1, 1, 'f'),\n (2, 2, 'g'),\n (4, 4, 'h'),\n (5, 5, 'i'),\n (1, 8, 'j')))\n\n right = etl.wrap((('start', 'stop', 'value'),\n (1, 4, 'foo'),\n (3, 7, 'bar'),\n (4, 9, 'baz')))\n\n actual = left.intervaljoin(right,\n lstart='begin', lstop='end',\n rstart='start', rstop='stop')\n expect = (('begin', 'end', 'quux', 'start', 'stop', 'value'),\n (1, 2, 'a', 1, 4, 'foo'),\n (2, 4, 'b', 1, 4, 'foo'),\n (2, 4, 'b', 3, 7, 'bar'),\n (2, 5, 'c', 1, 4, 'foo'),\n (2, 5, 'c', 3, 7, 'bar'),\n (2, 5, 'c', 4, 9, 'baz'),\n (1, 8, 'j', 1, 4, 'foo'),\n (1, 8, 'j', 3, 7, 'bar'),\n (1, 8, 'j', 4, 9, 'baz'))\n ieq(expect, actual)\n ieq(expect, actual)", "metadata": "root.test_integration", "header": "['module', '___EOS___']", "index": 1020 } ]
[ { "span": "import intervaltree", "start_line": 23, "start_column": 4, "end_line": 23, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "print", "\\u", "function_", ",_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pet", "l_", "as_", "etl", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pet", "l_", "._", "test_", "._", "helpers_", "import_", "ie", "q_", ",_", "eq\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pet", "l_", "._", "util_", "._", "vis_", "import_", "looka", "ll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pet", "l_", "._", "errors_", "import_", "Duplicate", "Key", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pet", "l_", "._", "transform_", "._", "intervals_", "import_", "interval", "lookup_", ",_", "interval", "look", "upo", "ne_", ",_", "face", "tint", "erv", "allo", "oku", "p_", ",_", "face", "tint", "erv", "allo", "oku", "pon", "e_", ",_", "interval", "join_", ",_", "interval", "left", "join_", ",_", "interval", "join", "values_", ",_", "interval", "subtract_", ",_", "collapsed", "intervals_", ",_", "\\u", "Interval_", ",_", "interval", "anti", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "=_", "logger_", "._", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "noin", "spect", "ion", " ", "Py", "Unre", "solved", "Reference", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "interval", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "SKIP", " ", "interval", " ", "tests", ":", " ", "%", "s", "'_", "%_", "e_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "interval", "lookup_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "interval", "lookup_", "(_", "table_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "9_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "19_", ",_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "look", "up", "\\u", "include", "\\u", "stop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "interval", "lookup_", "(_", "table_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "value_", "=_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "stop_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "9_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "19_", ",_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", ",_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "'", "bar", "'_", ",_", "None_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "look", "upo", "ne_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "interval", "look", "upo", "ne_", "(_", "table_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "value_", "=_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "._", "search_", "(_", "4_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "._", "search_", "(_", "5_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "8_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "9_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "19_", ",_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "._", "search_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "look", "upo", "ne", "\\u", "not", "\\u", "strict_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "interval", "look", "upo", "ne_", "(_", "table_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "value_", "=_", "'", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strict_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "4_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "5_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "8_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "9_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "19_", ",_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "._", "search_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "face", "tint", "erv", "allo", "oku", "p_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "face", "tint", "erv", "allo", "oku", "p_", "(_", "table_", ",_", "key_", "=_", "'", "type", "'_", ",_", "start_", "=_", "'", "start", "'_", ",_", "stop_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "9_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "19_", ",_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "face", "tint", "erv", "allo", "oku", "pon", "e_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "face", "tint", "erv", "allo", "oku", "pon", "e_", "(_", "table_", ",_", "key_", "=_", "'", "type", "'_", ",_", "start_", "=_", "'", "start", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "'", "stop", "'_", ",_", "value_", "=_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "2_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Duplicate", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "'", "expected", " ", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "4_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "4_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "5_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "5_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "8_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "8_", ",_", "9_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "9_", ",_", "14_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "19_", ",_", "140_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", "]_", "._", "search_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "orange", "'_", "]_", "._", "search_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "'", "ba", "z", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "face", "tint", "erv", "allo", "oku", "p", "\\u", "compound_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "variet", "y", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "fu", "ji", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "'", "mand", "ari", "n", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lk", "p_", "=_", "face", "tint", "erv", "allo", "oku", "p_", "(_", "table_", ",_", "key_", "=_", "(_", "'", "type", "'_", ",_", "'", "variet", "y", "'_", ")_", ",_", "start_", "=_", "'", "start", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", "]_", "._", "search_", "(_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "lk", "p_", "[_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", "]_", "._", "search_", "(_", "2_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "join_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "(_", "looka", "ll_", "(_", "actual_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "join", "\\u", "include", "\\u", "stop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "stop_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "join", "\\u", "prefixes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lpr", "efi", "x_", "=_", "'", "l\\u", "'_", ",_", "rpr", "efi", "x_", "=_", "'", "r", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "l\\u", "begin", "'_", ",_", "'", "l\\u", "end", "'_", ",_", "'", "l\\u", "quu", "x", "'_", ",_", "'", "r", "\\u", "start", "'_", ",_", "'", "r", "\\u", "stop", "'_", ",_", "'", "r", "\\u", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "left", "join_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "left", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "join", "\\u", "face", "ted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ",_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ",_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ",_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "interval", "join_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "lke", "y_", "=_", "'", "fruit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "left", "join", "\\u", "face", "ted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ",_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ",_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ",_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "left", "join_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "lke", "y_", "=_", "'", "fruit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "left", "join", "\\u", "face", "ted", "\\u", "rke", "ym", "iss", "ing_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ",_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "left", "join_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "lke", "y_", "=_", "'", "fruit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "joins", "\\u", "face", "ted", "\\u", "compound_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "sort", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "fu", "ji", "'_", ",_", "2_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "variet", "y", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "fu", "ji", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "'", "mand", "ari", "n", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "sort", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "type", "'_", ",_", "'", "variet", "y", "'_", ",_", "'", "start", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "2_", ",_", "'", "apple", "'_", ",_", "'", "co", "x", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "'", "fu", "ji", "'_", ",_", "2_", ",_", "4_", ",_", "'", "apple", "'_", ",_", "'", "fu", "ji", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "join_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lke", "y_", "=_", "(_", "'", "fruit", "'_", ",_", "'", "sort", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "(_", "'", "type", "'_", ",_", "'", "variet", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "left", "join_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lke", "y_", "=_", "(_", "'", "fruit", "'_", ",_", "'", "sort", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "(_", "'", "type", "'_", ",_", "'", "variet", "y", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "left", "join", "\\u", "prefixes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "left", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lpr", "efi", "x_", "=_", "'", "l\\u", "'_", ",_", "rpr", "efi", "x_", "=_", "'", "r", "\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "l\\u", "begin", "'_", ",_", "'", "l\\u", "end", "'_", ",_", "'", "l\\u", "quu", "x", "'_", ",_", "'", "r", "\\u", "start", "'_", ",_", "'", "r", "\\u", "stop", "'_", ",_", "'", "r", "\\u", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "anti", "join_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "anti", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "(_", "looka", "ll_", "(_", "actual_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "anti", "join", "\\u", "include", "\\u", "stop_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "anti", "join_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "stop_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", ",_", "140_", ",_", "'", "e", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "(_", "looka", "ll_", "(_", "actual_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "anti", "join", "\\u", "face", "ted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "anti", "join_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "lke", "y_", "=_", "'", "fruit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "interval", "join", "values", "\\u", "face", "ted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "type", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "fruit", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "2_", ",_", "[_", "'", "foo", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "4_", ",_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "5_", ",_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "2_", ",_", "5_", ",_", "[_", "'", "ba", "z", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "9_", ",_", "14_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "19_", ",_", "140_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "1_", ",_", "1_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "2_", ",_", "2_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "4_", ",_", "4_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "apple", "'_", ",_", "5_", ",_", "5_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "orange", "'_", ",_", "5_", ",_", "5_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "join", "values_", "(_", "left_", ",_", "right_", ",_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ",_", "lke", "y_", "=_", "'", "fruit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rke", "y_", "=_", "'", "type", "'_", ",_", "value_", "=_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subtract", "\\u", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "6_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "4_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "3_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "6_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "subtract_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subtract", "\\u", "2_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "6_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "4_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "6_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "3_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "5_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "5_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "6_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "subtract_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subtract", "\\u", "face", "ted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "(_", "(_", "'", "region", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "north", "'_", ",_", "1_", ",_", "6_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "south", "'_", ",_", "3_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "west", "'_", ",_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "(_", "(_", "'", "place", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "south", "'_", ",_", "3_", ",_", "4_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "north", "'_", ",_", "5_", ",_", "6_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "region", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "north", "'_", ",_", "1_", ",_", "5_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "south", "'_", ",_", "4_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "west", "'_", ",_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "interval", "subtract_", "(_", "left_", ",_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lke", "y_", "=_", "'", "region", "'_", ",_", "rke", "y_", "=_", "'", "place", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "collapse", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "face", "t", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tbl_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "6_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "12_", ",_", "14_", ",_", "'", "banana", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "13_", ",_", "17_", ",_", "'", "kiwi", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "\\u", "Interval_", "(_", "1_", ",_", "9_", ")_", ",_", "\\u", "Interval_", "(_", "12_", ",_", "17_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "collapsed", "intervals_", "(_", "tbl_", ",_", "start_", "=_", "'", "begin", "'_", ",_", "stop_", "=_", "'", "end", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "face", "ted_", "\\u\\u\\uNL\\u\\u\\u_", "tbl_", "=_", "(_", "(_", "'", "region", "'_", ",_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "label", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "north", "'_", ",_", "1_", ",_", "6_", ",_", "'", "apple", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "north", "'_", ",_", "3_", ",_", "6_", ",_", "'", "orange", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "north", "'_", ",_", "5_", ",_", "9_", ",_", "'", "banana", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "south", "'_", ",_", "12_", ",_", "14_", ",_", "'", "banana", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "south", "'_", ",_", "13_", ",_", "17_", ",_", "'", "kiwi", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "[_", "(_", "'", "north", "'_", ",_", "1_", ",_", "9_", ")_", ",_", "(_", "'", "south", "'_", ",_", "12_", ",_", "17_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "collapsed", "intervals_", "(_", "tbl_", ",_", "start_", "=_", "'", "begin", "'_", ",_", "stop_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "'", "region", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "integration_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", "=_", "etl", "_", "._", "wrap_", "(_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "14_", ",_", "'", "d", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "9_", ",_", "140_", ",_", "'", "e", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "1_", ",_", "'", "f", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "2_", ",_", "'", "g", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "4_", ",_", "'", "h", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ",_", "'", "i", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "right_", "=_", "etl", "_", "._", "wrap_", "(_", "(_", "(_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "actual_", "=_", "left_", "._", "interval", "join_", "(_", "right_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lsta", "rt_", "=_", "'", "begin", "'_", ",_", "lst", "op_", "=_", "'", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rsta", "rt_", "=_", "'", "start", "'_", ",_", "rst", "op_", "=_", "'", "stop", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "(_", "(_", "'", "begin", "'_", ",_", "'", "end", "'_", ",_", "'", "quu", "x", "'_", ",_", "'", "start", "'_", ",_", "'", "stop", "'_", ",_", "'", "value", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "2_", ",_", "'", "a", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "4_", ",_", "'", "b", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "2_", ",_", "5_", ",_", "'", "c", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "1_", ",_", "4_", ",_", "'", "foo", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "3_", ",_", "7_", ",_", "'", "bar", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "1_", ",_", "8_", ",_", "'", "j", "'_", ",_", "4_", ",_", "9_", ",_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ie", "q_", "(_", "expect_", ",_", "actual_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_windowwithtimeorcount.py
[ { "content": "import unittest\nfrom datetime import timedelta\n\nfrom rx import Observable\nfrom rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable\nfrom rx.disposables import Disposable, SerialDisposable\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n \n \n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestWindowWithTime(unittest.TestCase):\n \n ", "metadata": "root.TestWindowWithTime", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def test_window_with_time_or_count_basic(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(205, 1), on_next(210, 2), on_next(240, 3), on_next(280, 4), on_next(320, 5), on_next(350, 6), on_next(370, 7), on_next(420, 8), on_next(470, 9), on_completed(600))\n \n def create():\n def projection(w, i):\n def inner_proj(x):\n return \"%s %s\" % (i, x)\n return w.map(inner_proj)\n return xs.window_with_time_or_count(70, 3, scheduler).map(projection).merge_observable()\n \n results = scheduler.start(create)\n results.messages.assert_equal(on_next(205, \"0 1\"), on_next(210, \"0 2\"), on_next(240, \"0 3\"), on_next(280, \"1 4\"), on_next(320, \"2 5\"), on_next(350, \"2 6\"), on_next(370, \"2 7\"), on_next(420, \"3 8\"), on_next(470, \"4 9\"), on_completed(600))\n xs.subscriptions.assert_equal(subscribe(200, 600))", "metadata": "root.TestWindowWithTime.test_window_with_time_or_count_basic", "header": "['class', 'TestWindowWithTime', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def test_window_with_time_or_count_error(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(205, 1), on_next(210, 2), on_next(240, 3), on_next(280, 4), on_next(320, 5), on_next(350, 6), on_next(370, 7), on_next(420, 8), on_next(470, 9), on_error(600, ex))\n \n def create():\n def projection(w, i):\n def inner_proj(x):\n return \"%s %s\" % (i, x)\n return w.map(inner_proj)\n return xs.window_with_time_or_count(70, 3, scheduler).map(projection).merge_observable()\n \n results = scheduler.start(create)\n \n results.messages.assert_equal(on_next(205, \"0 1\"), on_next(210, \"0 2\"), on_next(240, \"0 3\"), on_next(280, \"1 4\"), on_next(320, \"2 5\"), on_next(350, \"2 6\"), on_next(370, \"2 7\"), on_next(420, \"3 8\"), on_next(470, \"4 9\"), on_error(600, ex))\n xs.subscriptions.assert_equal(subscribe(200, 600))", "metadata": "root.TestWindowWithTime.test_window_with_time_or_count_error", "header": "['class', 'TestWindowWithTime', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_window_with_time_or_count_disposed(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(205, 1), on_next(210, 2), on_next(240, 3), on_next(280, 4), on_next(320, 5), on_next(350, 6), on_next(370, 7), on_next(420, 8), on_next(470, 9), on_completed(600))\n \n def create():\n def projection(w, i):\n def inner_proj(x):\n return \"%s %s\" % (i, x)\n return w.map(inner_proj)\n return xs.window_with_time_or_count(70, 3, scheduler).map(projection).merge_observable()\n \n results = scheduler.start(create, disposed=370)\n results.messages.assert_equal(on_next(205, \"0 1\"), on_next(210, \"0 2\"), on_next(240, \"0 3\"), on_next(280, \"1 4\"), on_next(320, \"2 5\"), on_next(350, \"2 6\"), on_next(370, \"2 7\"))\n xs.subscriptions.assert_equal(subscribe(200, 370))", "metadata": "root.TestWindowWithTime.test_window_with_time_or_count_disposed", "header": "['class', 'TestWindowWithTime', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 48 } ]
[ { "span": "from rx import Observable", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 25 }, { "span": "from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 76 }, { "span": "from rx.disposables import Disposable, SerialDisposable", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", ",_", "is", "\\u", "prime_", ",_", "Moc", "k", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", ",_", "Ser", "ial", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Window", "With", "Time_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Window", "With", "Time_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "window", "\\u", "with", "\\u", "time", "\\u", "or", "\\u", "count", "\\u", "basic_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "205_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "370", "_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "470", "_", ",_", "9_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "projection_", "(_", "w_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "inner", "\\u", "proj_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "i_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "w_", "._", "map_", "(_", "inner", "\\u", "proj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "window", "\\u", "with", "\\u", "time", "\\u", "or", "\\u", "count_", "(_", "70_", ",_", "3_", ",_", "scheduler_", ")_", "._", "map_", "(_", "projection_", ")_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "205_", ",_", "\"", "0", " ", "1", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "\"", "0", " ", "2", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "\"", "0", " ", "3", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "\"", "1", " ", "4", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "\"", "2", " ", "5", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "2", " ", "6", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "370", "_", ",_", "\"", "2", " ", "7", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "\"", "3", " ", "8", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "470", "_", ",_", "\"", "4", " ", "9", "\"_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Window", "With", "Time_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "window", "\\u", "with", "\\u", "time", "\\u", "or", "\\u", "count", "\\u", "error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "205_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "370", "_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "470", "_", ",_", "9_", ")_", ",_", "on", "\\u", "error_", "(_", "600_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "projection_", "(_", "w_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "inner", "\\u", "proj_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "i_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "w_", "._", "map_", "(_", "inner", "\\u", "proj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "window", "\\u", "with", "\\u", "time", "\\u", "or", "\\u", "count_", "(_", "70_", ",_", "3_", ",_", "scheduler_", ")_", "._", "map_", "(_", "projection_", ")_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "205_", ",_", "\"", "0", " ", "1", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "\"", "0", " ", "2", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "\"", "0", " ", "3", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "\"", "1", " ", "4", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "\"", "2", " ", "5", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "2", " ", "6", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "370", "_", ",_", "\"", "2", " ", "7", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "\"", "3", " ", "8", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "470", "_", ",_", "\"", "4", " ", "9", "\"_", ")_", ",_", "on", "\\u", "error_", "(_", "600_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Window", "With", "Time_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "window", "\\u", "with", "\\u", "time", "\\u", "or", "\\u", "count", "\\u", "dispose", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "205_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "4_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "5_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "6_", ")_", ",_", "on", "\\u", "next_", "(_", "370", "_", ",_", "7_", ")_", ",_", "on", "\\u", "next_", "(_", "420_", ",_", "8_", ")_", ",_", "on", "\\u", "next_", "(_", "470", "_", ",_", "9_", ")_", ",_", "on", "\\u", "completed_", "(_", "600_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "projection_", "(_", "w_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "inner", "\\u", "proj_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "i_", ",_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "w_", "._", "map_", "(_", "inner", "\\u", "proj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "window", "\\u", "with", "\\u", "time", "\\u", "or", "\\u", "count_", "(_", "70_", ",_", "3_", ",_", "scheduler_", ")_", "._", "map_", "(_", "projection_", ")_", "._", "merge", "\\u", "observable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "scheduler_", "._", "start_", "(_", "create_", ",_", "dispose", "d_", "=_", "370", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "205_", ",_", "\"", "0", " ", "1", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "\"", "0", " ", "2", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "240_", ",_", "\"", "0", " ", "3", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "280_", ",_", "\"", "1", " ", "4", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "320_", ",_", "\"", "2", " ", "5", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "350_", ",_", "\"", "2", " ", "6", "\"_", ")_", ",_", "on", "\\u", "next_", "(_", "370", "_", ",_", "\"", "2", " ", "7", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "370", "_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Ali-Razmjoo/OWASP-ZSC/module/readline_windows/pyreadline/keysyms/common.py
[ { "content": "# -*- coding: utf-8 -*-\n#*****************************************************************************\n# Copyright (C) 2003-2006 Gary Bishop.\n# Copyright (C) 2006 Jorgen Stenarson. <[email protected]>\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#*****************************************************************************\n# table for translating virtual keys to X windows key symbols\nfrom __future__ import print_function, unicode_literals, absolute_import\n\ntry:\n set\nexcept NameError:\n from sets import Set as set\n \nfrom pyreadline.unicode_helper import ensure_unicode\n\nvalidkey =set(['cancel', 'backspace', 'tab', 'clear',\n 'return', 'shift_l', 'control_l', 'alt_l',\n 'pause', 'caps_lock', 'escape', 'space',\n 'prior', 'next', 'end', 'home',\n 'left', 'up', 'right', 'down',\n 'select', 'print', 'execute', 'snapshot',\n 'insert', 'delete', 'help', 'f1',\n 'f2', 'f3', 'f4', 'f5',\n 'f6', 'f7', 'f8', 'f9',\n 'f10', 'f11', 'f12', 'f13',\n 'f14', 'f15', 'f16', 'f17',\n 'f18', 'f19', 'f20', 'f21',\n 'f22', 'f23', 'f24', 'num_lock',\n 'scroll_lock', 'vk_apps', 'vk_processkey','vk_attn',\n 'vk_crsel', 'vk_exsel', 'vk_ereof', 'vk_play',\n 'vk_zoom', 'vk_noname', 'vk_pa1', 'vk_oem_clear',\n 'numpad0', 'numpad1', 'numpad2', 'numpad3',\n 'numpad4', 'numpad5', 'numpad6', 'numpad7',\n 'numpad8', 'numpad9', 'divide', 'multiply',\n 'add', 'subtract', 'vk_decimal'])\n\nescape_sequence_to_special_key = {\"\\\\e[a\" : \"up\", \"\\\\e[b\" : \"down\", \"del\" : \"delete\"}\n\n\n\nif __name__ == \"__main__\":\n import startup\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class KeyPress(object):\n \n char = create(\"char\")\n shift = create(\"shift\")\n control = create(\"control\")\n meta = create(\"meta\")\n keyname = create(\"keyname\")\n \n\n", "metadata": "root.KeyPress", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def __init__(self, char=\"\", shift=False, control=False, meta=False, keyname=\"\"):\n if control or meta or shift:\n char = char.upper()\n self.info = dict(char=char,\n shift=shift,\n control=control,\n meta=meta,\n keyname=keyname)", "metadata": "root.KeyPress.__init__", "header": "['class', 'KeyPress', '(', 'object', ')', ':', '___EOS___']", "index": 42 }, { "content": " def create(name):\n def get(self):\n return self.info[name]\n\n def set(self, value):\n self.info[name] = value\n return property(get, set)", "metadata": "root.KeyPress.create", "header": "['class', 'KeyPress', '(', 'object', ')', ':', '___EOS___']", "index": 51 }, { "content": " def __repr__(self):\n return \"(%s,%s,%s,%s)\"%tuple(map(ensure_unicode, self.tuple()))", "metadata": "root.KeyPress.__repr__", "header": "['class', 'KeyPress', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def tuple(self):\n if self.keyname:\n return (self.control, self.meta, self.shift, self.keyname)\n else:\n if self.control or self.meta or self.shift:\n return (self.control, self.meta, self.shift, self.char.upper())\n else:\n return (self.control, self.meta, self.shift, self.char)", "metadata": "root.KeyPress.tuple", "header": "['class', 'KeyPress', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def __eq__(self, other):\n if isinstance(other, KeyPress):\n s = self.tuple()\n o = other.tuple()\n return s == o\n else:\n return False", "metadata": "root.KeyPress.__eq__", "header": "['class', 'KeyPress', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": "def make_KeyPress_from_keydescr(keydescr):\n keyinfo = KeyPress()\n if len(keydescr) > 2 and keydescr[:1] == '\"' and keydescr[-1:] == '\"':\n keydescr = keydescr[1:-1]\n \n while 1:\n lkeyname = keydescr.lower()\n if lkeyname.startswith('control-'):\n keyinfo.control = True\n keydescr = keydescr[8:]\n elif lkeyname.startswith('ctrl-'):\n keyinfo.control = True\n keydescr = keydescr[5:]\n elif keydescr.lower().startswith('\\\\c-'):\n keyinfo.control = True\n keydescr = keydescr[3:]\n elif keydescr.lower().startswith('\\\\m-'):\n keyinfo.meta = True\n keydescr = keydescr[3:]\n elif keydescr in escape_sequence_to_special_key:\n keydescr = escape_sequence_to_special_key[keydescr]\n elif lkeyname.startswith('meta-'):\n keyinfo.meta = True\n keydescr = keydescr[5:]\n elif lkeyname.startswith('alt-'):\n keyinfo.meta = True\n keydescr = keydescr[4:]\n elif lkeyname.startswith('shift-'):\n keyinfo.shift = True\n keydescr = keydescr[6:]\n else:\n if len(keydescr) > 1:\n if keydescr.strip().lower() in validkey:\n keyinfo.keyname = keydescr.strip().lower()\n keyinfo.char = \"\"\n else:\n raise IndexError(\"Not a valid key: '%s'\"%keydescr)\n else:\n keyinfo.char = keydescr\n return keyinfo", "metadata": "root.make_KeyPress_from_keydescr", "header": "['module', '___EOS___']", "index": 84 } ]
[ { "span": "import startup", "start_line": 126, "start_column": 4, "end_line": 126, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "***********", "***********", "***********", "***********", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2003", "-", "2006", " ", "Gar", "y", " ", "Bis", "hop", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", " ", " ", "Jo", "rge", "n", " ", "Ste", "nar", "son", ".", " ", "<", "jor", "gen", ".", "sten", "ars", "on", "@", "bos", "tream", ".", "nu", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", ".", " ", " ", "The", " ", "full", " ", "license", " ", "is", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "the", " ", "file", " ", "COPY", "ING", ",", " ", "distributed", " ", "as", " ", "part", " ", "of", " ", "this", " ", "software", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "***********", "***********", "***********", "***********", "***********", "***********", "***********", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "table", " ", "for", " ", "translat", "ing", " ", "virtual", " ", "keys", " ", "to", " ", "X", " ", "windows", " ", "key", " ", "symbols_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", ",_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sets_", "import_", "Set_", "as_", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "pyre", "adl", "ine_", "._", "unicode", "\\u", "helper_", "import_", "ensure", "\\u", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid", "key_", "=_", "set_", "(_", "[_", "'", "cancel", "'_", ",_", "'", "backs", "pace", "'_", ",_", "'", "tab", "'_", ",_", "'", "clear", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "return", "'_", ",_", "'", "shift", "\\u", "l", "'_", ",_", "'", "control", "\\u", "l", "'_", ",_", "'", "alt", "\\u", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "paus", "e", "'_", ",_", "'", "caps", "\\u", "lock", "'_", ",_", "'", "escape", "'_", ",_", "'", "space", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prior", "'_", ",_", "'", "next", "'_", ",_", "'", "end", "'_", ",_", "'", "home", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "left", "'_", ",_", "'", "up", "'_", ",_", "'", "right", "'_", ",_", "'", "down", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "select", "'_", ",_", "'", "print", "'_", ",_", "'", "execute", "'_", ",_", "'", "snapshot", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "insert", "'_", ",_", "'", "delete", "'_", ",_", "'", "help", "'_", ",_", "'", "f1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f2", "'_", ",_", "'", "f3", "'_", ",_", "'", "f4", "'_", ",_", "'", "f5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f6", "'_", ",_", "'", "f7", "'_", ",_", "'", "f8", "'_", ",_", "'", "f9", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "0", "'_", ",_", "'", "f1", "1", "'_", ",_", "'", "f1", "2", "'_", ",_", "'", "f1", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "4", "'_", ",_", "'", "f1", "5", "'_", ",_", "'", "f1", "6", "'_", ",_", "'", "f1", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f1", "8", "'_", ",_", "'", "f1", "9", "'_", ",_", "'", "f2", "0", "'_", ",_", "'", "f2", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "f2", "2", "'_", ",_", "'", "f2", "3", "'_", ",_", "'", "f2", "4", "'_", ",_", "'", "num", "\\u", "lock", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "scroll", "\\u", "lock", "'_", ",_", "'", "vk", "\\u", "apps", "'_", ",_", "'", "vk", "\\u", "process", "key", "'_", ",_", "'", "vk", "\\u", "attn", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vk", "\\u", "cr", "sel", "'_", ",_", "'", "vk", "\\u", "ex", "sel", "'_", ",_", "'", "vk", "\\u", "ere", "of", "'_", ",_", "'", "vk", "\\u", "play", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vk", "\\u", "zoom", "'_", ",_", "'", "vk", "\\u", "nona", "me", "'_", ",_", "'", "vk", "\\u", "pa", "1", "'_", ",_", "'", "vk", "\\u", "oem", "\\u", "clear", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nump", "ad", "0", "'_", ",_", "'", "nump", "ad", "1", "'_", ",_", "'", "nump", "ad", "2", "'_", ",_", "'", "nump", "ad", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nump", "ad", "4", "'_", ",_", "'", "nump", "ad", "5", "'_", ",_", "'", "nump", "ad", "6", "'_", ",_", "'", "nump", "ad", "7", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nump", "ad", "8", "'_", ",_", "'", "nump", "ad", "9", "'_", ",_", "'", "divide", "'_", ",_", "'", "multipl", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "'_", ",_", "'", "subtract", "'_", ",_", "'", "vk", "\\u", "decima", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "escape", "\\u", "sequence", "\\u", "to", "\\u", "special", "\\u", "key_", "=_", "{_", "\"\\\\\\\\", "e", "[", "a", "\"_", ":_", "\"", "up", "\"_", ",_", "\"\\\\\\\\", "e", "[", "b", "\"_", ":_", "\"", "down", "\"_", ",_", "\"", "del", "\"_", ":_", "\"", "delete", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "startup_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Key", "Press_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "char_", "=_", "create_", "(_", "\"", "char", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shift_", "=_", "create_", "(_", "\"", "shift", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "=_", "create_", "(_", "\"", "control", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "create_", "(_", "\"", "meta", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyname_", "=_", "create_", "(_", "\"", "keyn", "ame", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Key", "Press_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "char_", "=_", "\"\"_", ",_", "shift_", "=_", "False_", ",_", "control_", "=_", "False_", ",_", "meta_", "=_", "False_", ",_", "keyname_", "=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "control_", "or_", "meta_", "or_", "shift_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "char_", "=_", "char_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "info_", "=_", "dict_", "(_", "char_", "=_", "char_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shift_", "=_", "shift_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "control_", "=_", "control_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "meta_", "=_", "meta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keyname_", "=_", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Press_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "info_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "info_", "[_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "property_", "(_", "get_", ",_", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Press_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"(", "%", "s", ",%", "s", ",%", "s", ",%", "s", ")\"_", "%_", "tuple_", "(_", "map_", "(_", "ensure", "\\u", "unicode_", ",_", "self_", "._", "tuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Press_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tuple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "keyname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "control_", ",_", "self_", "._", "meta_", ",_", "self_", "._", "shift_", ",_", "self_", "._", "keyname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "control_", "or_", "self_", "._", "meta_", "or_", "self_", "._", "shift_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "control_", ",_", "self_", "._", "meta_", ",_", "self_", "._", "shift_", ",_", "self_", "._", "char_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "control_", ",_", "self_", "._", "meta_", ",_", "self_", "._", "shift_", ",_", "self_", "._", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Press_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "Key", "Press_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "self_", "._", "tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "=_", "other_", "._", "tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "==_", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "Key", "Press", "\\u", "from", "\\u", "keyd", "esc", "r_", "(_", "keyd", "esc", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "=_", "Key", "Press_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "keyd", "esc", "r_", ")_", ">_", "2_", "and_", "keyd", "esc", "r_", "[_", ":_", "1_", "]_", "==_", "'\"'_", "and_", "keyd", "esc", "r_", "[_", "-_", "1_", ":_", "]_", "==_", "'\"'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "1_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lke", "yname", "_", "=_", "keyd", "esc", "r_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lke", "yname", "_", "._", "startswith_", "(_", "'", "control", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "control_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "8_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lke", "yname", "_", "._", "startswith_", "(_", "'", "ctrl", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "control_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "5_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "keyd", "esc", "r_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "'\\\\\\\\", "c", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "control_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "keyd", "esc", "r_", "._", "lower_", "(_", ")_", "._", "startswith_", "(_", "'\\\\\\\\", "m", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "meta_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "3_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "keyd", "esc", "r_", "in_", "escape", "\\u", "sequence", "\\u", "to", "\\u", "special", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keyd", "esc", "r_", "=_", "escape", "\\u", "sequence", "\\u", "to", "\\u", "special", "\\u", "key_", "[_", "keyd", "esc", "r_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lke", "yname", "_", "._", "startswith_", "(_", "'", "meta", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "meta_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "5_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lke", "yname", "_", "._", "startswith_", "(_", "'", "alt", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "meta_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "4_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "lke", "yname", "_", "._", "startswith_", "(_", "'", "shift", "-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "info_", "._", "shift_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyd", "esc", "r_", "=_", "keyd", "esc", "r_", "[_", "6_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "keyd", "esc", "r_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyd", "esc", "r_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "in_", "valid", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "key", "info_", "._", "keyname_", "=_", "keyd", "esc", "r_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "info_", "._", "char_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Index", "Error_", "(_", "\"", "Not", " ", "a", " ", "valid", " ", "key", ":", " ", "'%", "s", "'\"_", "%_", "keyd", "esc", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
babble/babble/include/jython/Lib/difflib.py
[ { "content": "#! /usr/bin/env python\n\n\"\"\"\nModule difflib -- helpers for computing deltas between objects.\n\nFunction get_close_matches(word, possibilities, n=3, cutoff=0.6):\n Use SequenceMatcher to return list of the best \"good enough\" matches.\n\nFunction context_diff(a, b):\n For two lists of strings, return a delta in context diff format.\n\nFunction ndiff(a, b):\n Return a delta: the difference between `a` and `b` (lists of strings).\n\nFunction restore(delta, which):\n Return one of the two sequences that generated an ndiff delta.\n\nFunction unified_diff(a, b):\n For two lists of strings, return a delta in unified diff format.\n\nClass SequenceMatcher:\n A flexible class for comparing pairs of sequences of any type.\n\nClass Differ:\n For producing human-readable deltas from sequences of lines of text.\n\nClass HtmlDiff:\n For producing HTML side by side comparison with change highlights.\n\"\"\"\n\n__all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher',\n 'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'context_diff',\n 'unified_diff', 'HtmlDiff']\n\nimport heapq\n\n\n\n\n\n\n# With respect to junk, an earlier version of ndiff simply refused to\n# *start* a match with a junk element. The result was cases like this:\n# before: private Thread currentThread;\n# after: private volatile Thread currentThread;\n# If you consider whitespace to be junk, the longest contiguous match\n# not starting with junk is \"e Thread currentThread\". So ndiff reported\n# that \"e volatil\" was inserted between the 't' and the 'e' in \"private\".\n# While an accurate view, to people that's absurd. The current version\n# looks for matching blocks that are entirely junk-free, then extends the\n# longest one of those as far as possible but only with matching junk.\n# So now \"currentThread\" is matched, then extended to suck up the\n# preceding blank; then \"private\" is matched, and extended to suck up the\n# following blank; then \"Thread\" is matched; and finally ndiff reports\n# that \"volatile \" was inserted before \"Thread\". The only quibble\n# remaining is that perhaps it was really the case that \" volatile\"\n# was inserted after \"private\". I can live with that <wink>.\n\nimport re\n\n\n\n\n\n# See http://www.unix.org/single_unix_specification/\n\n\n\n\n_file_template = \"\"\"\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html>\n\n<head>\n <meta http-equiv=\"Content-Type\"\n content=\"text/html; charset=ISO-8859-1\" />\n <title></title>\n <style type=\"text/css\">%(styles)s\n </style>\n</head>\n\n<body>\n %(table)s%(legend)s\n</body>\n\n</html>\"\"\"\n\n_styles = \"\"\"\n table.diff {font-family:Courier; border:medium;}\n .diff_header {background-color:#e0e0e0}\n td.diff_header {text-align:right}\n .diff_next {background-color:#c0c0c0}\n .diff_add {background-color:#aaffaa}\n .diff_chg {background-color:#ffff77}\n .diff_sub {background-color:#ffaaaa}\"\"\"\n\n_table_template = \"\"\"\n <table class=\"diff\" id=\"difflib_chg_%(prefix)s_top\"\n cellspacing=\"0\" cellpadding=\"0\" rules=\"groups\" >\n <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>\n <colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>\n %(header_row)s\n <tbody>\n%(data_rows)s </tbody>\n </table>\"\"\"\n\n_legend = \"\"\"\n <table class=\"diff\" summary=\"Legends\">\n <tr> <th colspan=\"2\"> Legends </th> </tr>\n <tr> <td> <table border=\"\" summary=\"Colors\">\n <tr><th> Colors </th> </tr>\n <tr><td class=\"diff_add\">&nbsp;Added&nbsp;</td></tr>\n <tr><td class=\"diff_chg\">Changed</td> </tr>\n <tr><td class=\"diff_sub\">Deleted</td> </tr>\n </table></td>\n <td> <table border=\"\" summary=\"Links\">\n <tr><th colspan=\"2\"> Links </th> </tr>\n <tr><td>(f)irst change</td> </tr>\n <tr><td>(n)ext change</td> </tr>\n <tr><td>(t)op</td> </tr>\n </table></td> </tr>\n </table>\"\"\"\n\n\ndel re\n\n\n\nif __name__ == \"__main__\":\n _test()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _mdiff(fromlines, tolines, context=None, linejunk=None,\n charjunk=IS_CHARACTER_JUNK):\n r\"\"\"Returns generator yielding marked up from/to side by side differences.\n\n Arguments:\n fromlines -- list of text lines to compared to tolines\n tolines -- list of text lines to be compared to fromlines\n context -- number of context lines to display on each side of difference,\n if None, all from/to text lines will be generated.\n linejunk -- passed on to ndiff (see ndiff documentation)\n charjunk -- passed on to ndiff (see ndiff documentation)\n\n This function returns an interator which returns a tuple:\n (from line tuple, to line tuple, boolean flag)\n\n from/to line tuple -- (line num, line text)\n line num -- integer or None (to indicate a context seperation)\n line text -- original line text with following markers inserted:\n '\\0+' -- marks start of added text\n '\\0-' -- marks start of deleted text\n '\\0^' -- marks start of changed text\n '\\1' -- marks end of added/deleted/changed text\n\n boolean flag -- None indicates context separation, True indicates\n either \"from\" or \"to\" line contains a change, otherwise False.\n\n This function/iterator was originally developed to generate side by side\n file difference for making HTML pages (see HtmlDiff class for example\n usage).\n\n Note, this function utilizes the ndiff function to generate the side by\n side difference markup. Optional ndiff arguments may be passed to this\n function and they in turn will be passed to ndiff.\n \"\"\"\n import re\n\n # regular expression for finding intraline change indices\n change_re = re.compile('(\\++|\\-+|\\^+)')\n\n # create the difference iterator to generate the differences\n diff_lines_iterator = ndiff(fromlines,tolines,linejunk,charjunk)\n\n def _make_line(lines, format_key, side, num_lines=[0,0]):\n \"\"\"Returns line of text with user's change markup and line formatting.\n\n lines -- list of lines from the ndiff generator to produce a line of\n text from. When producing the line of text to return, the\n lines used are removed from this list.\n format_key -- '+' return first line in list with \"add\" markup around\n the entire line.\n '-' return first line in list with \"delete\" markup around\n the entire line.\n '?' return first line in list with add/delete/change\n intraline markup (indices obtained from second line)\n None return first line in list with no markup\n side -- indice into the num_lines list (0=from,1=to)\n num_lines -- from/to current line number. This is NOT intended to be a\n passed parameter. It is present as a keyword argument to\n maintain memory of the current line numbers between calls\n of this function.\n\n Note, this function is purposefully not defined at the module scope so\n that data it needs from its parent function (within whose context it\n is defined) does not need to be of module scope.\n \"\"\"\n num_lines[side] += 1\n # Handle case where no user markup is to be added, just return line of\n # text with user's line format to allow for usage of the line number.\n if format_key is None:\n return (num_lines[side],lines.pop(0)[2:])\n # Handle case of intraline changes\n if format_key == '?':\n text, markers = lines.pop(0), lines.pop(0)\n # find intraline changes (store change type and indices in tuples)\n sub_info = []\n def record_sub_info(match_object,sub_info=sub_info):\n sub_info.append([match_object.group(1)[0],match_object.span()])\n return match_object.group(1)\n change_re.sub(record_sub_info,markers)\n # process each tuple inserting our special marks that won't be\n # noticed by an xml/html escaper.\n for key,(begin,end) in sub_info[::-1]:\n text = text[0:begin]+'\\0'+key+text[begin:end]+'\\1'+text[end:]\n text = text[2:]\n # Handle case of add/delete entire line\n else:\n text = lines.pop(0)[2:]\n # if line of text is just a newline, insert a space so there is\n # something for the user to highlight and see.\n if not text:\n text = ' '\n # insert marks that won't be noticed by an xml/html escaper.\n text = '\\0' + format_key + text + '\\1'\n # Return line of text, first allow user's line formatter to do its\n # thing (such as adding the line number) then replace the special\n # marks with what the user's change markup.\n return (num_lines[side],text)\n\n def _line_iterator():\n \"\"\"Yields from/to lines of text with a change indication.\n\n This function is an iterator. It itself pulls lines from a\n differencing iterator, processes them and yields them. When it can\n it yields both a \"from\" and a \"to\" line, otherwise it will yield one\n or the other. In addition to yielding the lines of from/to text, a\n boolean flag is yielded to indicate if the text line(s) have\n differences in them.\n\n Note, this function is purposefully not defined at the module scope so\n that data it needs from its parent function (within whose context it\n is defined) does not need to be of module scope.\n \"\"\"\n lines = []\n num_blanks_pending, num_blanks_to_yield = 0, 0\n while True:\n # Load up next 4 lines so we can look ahead, create strings which\n # are a concatenation of the first character of each of the 4 lines\n # so we can do some very readable comparisons.\n while len(lines) < 4:\n try:\n lines.append(diff_lines_iterator.next())\n except StopIteration:\n lines.append('X')\n s = ''.join([line[0] for line in lines])\n if s.startswith('X'):\n # When no more lines, pump out any remaining blank lines so the\n # corresponding add/delete lines get a matching blank line so\n # all line pairs get yielded at the next level.\n num_blanks_to_yield = num_blanks_pending\n elif s.startswith('-?+?'):\n # simple intraline change\n yield _make_line(lines,'?',0), _make_line(lines,'?',1), True\n continue\n elif s.startswith('--++'):\n # in delete block, add block coming: we do NOT want to get\n # caught up on blank lines yet, just process the delete line\n num_blanks_pending -= 1\n yield _make_line(lines,'-',0), None, True\n continue\n elif s.startswith(('--?+', '--+', '- ')):\n # in delete block and see a intraline change or unchanged line\n # coming: yield the delete line and then blanks\n from_line,to_line = _make_line(lines,'-',0), None\n num_blanks_to_yield,num_blanks_pending = num_blanks_pending-1,0\n elif s.startswith('-+?'):\n # intraline change\n yield _make_line(lines,None,0), _make_line(lines,'?',1), True\n continue\n elif s.startswith('-?+'):\n # intraline change\n yield _make_line(lines,'?',0), _make_line(lines,None,1), True\n continue\n elif s.startswith('-'):\n # delete FROM line\n num_blanks_pending -= 1\n yield _make_line(lines,'-',0), None, True\n continue\n elif s.startswith('+--'):\n # in add block, delete block coming: we do NOT want to get\n # caught up on blank lines yet, just process the add line\n num_blanks_pending += 1\n yield None, _make_line(lines,'+',1), True\n continue\n elif s.startswith(('+ ', '+-')):\n # will be leaving an add block: yield blanks then add line\n from_line, to_line = None, _make_line(lines,'+',1)\n num_blanks_to_yield,num_blanks_pending = num_blanks_pending+1,0\n elif s.startswith('+'):\n # inside an add block, yield the add line\n num_blanks_pending += 1\n yield None, _make_line(lines,'+',1), True\n continue\n elif s.startswith(' '):\n # unchanged text, yield it to both sides\n yield _make_line(lines[:],None,0),_make_line(lines,None,1),False\n continue\n # Catch up on the blank lines so when we yield the next from/to\n # pair, they are lined up.\n while(num_blanks_to_yield < 0):\n num_blanks_to_yield += 1\n yield None,('','\\n'),True\n while(num_blanks_to_yield > 0):\n num_blanks_to_yield -= 1\n yield ('','\\n'),None,True\n if s.startswith('X'):\n raise StopIteration\n else:\n yield from_line,to_line,True\n\n def _line_pair_iterator():\n \"\"\"Yields from/to lines of text with a change indication.\n\n This function is an iterator. It itself pulls lines from the line\n iterator. Its difference from that iterator is that this function\n always yields a pair of from/to text lines (with the change\n indication). If necessary it will collect single from/to lines\n until it has a matching pair from/to pair to yield.\n\n Note, this function is purposefully not defined at the module scope so\n that data it needs from its parent function (within whose context it\n is defined) does not need to be of module scope.\n \"\"\"\n line_iterator = _line_iterator()\n fromlines,tolines=[],[]\n while True:\n # Collecting lines of text until we have a from/to pair\n while (len(fromlines)==0 or len(tolines)==0):\n from_line, to_line, found_diff =line_iterator.next()\n if from_line is not None:\n fromlines.append((from_line,found_diff))\n if to_line is not None:\n tolines.append((to_line,found_diff))\n # Once we have a pair, remove them from the collection and yield it\n from_line, fromDiff = fromlines.pop(0)\n to_line, to_diff = tolines.pop(0)\n yield (from_line,to_line,fromDiff or to_diff)\n\n # Handle case where user does not want context differencing, just yield\n # them up without doing anything else with them.\n line_pair_iterator = _line_pair_iterator()\n if context is None:\n while True:\n yield line_pair_iterator.next()\n # Handle case where user wants context differencing. We must do some\n # storage of lines until we know for sure that they are to be yielded.\n else:\n context += 1\n lines_to_write = 0\n while True:\n # Store lines up until we find a difference, note use of a\n # circular queue because we only need to keep around what\n # we need for context.\n index, contextLines = 0, [None]*(context)\n found_diff = False\n while(found_diff is False):\n from_line, to_line, found_diff = line_pair_iterator.next()\n i = index % context\n contextLines[i] = (from_line, to_line, found_diff)\n index += 1\n # Yield lines that we have collected so far, but first yield\n # the user's separator.\n if index > context:\n yield None, None, None\n lines_to_write = context\n else:\n lines_to_write = index\n index = 0\n while(lines_to_write):\n i = index % context\n index += 1\n yield contextLines[i]\n lines_to_write -= 1\n # Now yield the context lines after the change\n lines_to_write = context-1\n while(lines_to_write):\n from_line, to_line, found_diff = line_pair_iterator.next()\n # If another change within the context, extend the context\n if found_diff:\n lines_to_write = context-1\n else:\n lines_to_write -= 1\n yield from_line, to_line, found_diff", "metadata": "root._mdiff", "header": "['module', '___EOS___']", "index": 1311 } ]
[ { "span": "import re", "start_line": 1345, "start_column": 4, "end_line": 1345, "end_column": 13 } ]
[ { "span": "import re", "start_line": 1101, "start_column": 0, "end_line": 1101, "end_column": 9 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", " ", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Modul", "e", " ", "difflib", " ", "--", " ", "help", "ers", " ", "for", " ", "compu", "ting", " ", "deltas", " ", "bet", "ween", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", "Function", " ", "get", "\\u", "close", "\\u", "matche", "s", "(", "word", ",", " ", "possibilit", "ies", ",", " ", "n", "=", "3", ",", " ", "cuto", "ff", "=", "0.", "6", "):", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "Sequ", "ence", "Match", "er", " ", "to", " ", "return", " ", "list", " ", "of", " ", "the", " ", "best", " ", "\"", "good", " ", "eno", "ugh", "\"", " ", "matche", "s", ".", "\\", "10", ";", "\\", "10", ";", "Function", " ", "context", "\\u", "diff", "(", "a", ",", " ", "b", "):", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "two", " ", "lists", " ", "of", " ", "string", "s", ",", " ", "return", " ", "a", " ", "delta", " ", "in", " ", "context", " ", "diff", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", "Function", " ", "ndi", "ff", "(", "a", ",", " ", "b", "):", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "delta", ":", " ", "the", " ", "difference", " ", "bet", "ween", " ", "`", "a", "`", " ", "and", " ", "`", "b", "`", " ", "(", "lists", " ", "of", " ", "string", "s", ").", "\\", "10", ";", "\\", "10", ";", "Function", " ", "restore", "(", "delta", ",", " ", "whi", "ch", "):", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "one", " ", "of", " ", "the", " ", "two", " ", "sequence", "s", " ", "tha", "t", " ", "generat", "ed", " ", "an", " ", "ndi", "ff", " ", "delta", ".", "\\", "10", ";", "\\", "10", ";", "Function", " ", "unifie", "d\\u", "diff", "(", "a", ",", " ", "b", "):", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "two", " ", "lists", " ", "of", " ", "string", "s", ",", " ", "return", " ", "a", " ", "delta", " ", "in", " ", "unifie", "d", " ", "diff", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", "Class", " ", "Sequ", "ence", "Match", "er", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "flexib", "le", " ", "class", " ", "for", " ", "compa", "ring", " ", "pair", "s", " ", "of", " ", "sequence", "s", " ", "of", " ", "any", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", "Class", " ", "Diff", "er", ":", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "produc", "ing", " ", "human", "-", "reada", "ble", " ", "deltas", " ", "from", " ", "sequence", "s", " ", "of", " ", "lines", " ", "of", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", "Class", " ", "Ht", "ml", "Diff", ":", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "produc", "ing", " ", "HTM", "L", " ", "side", " ", "by", " ", "side", " ", "compa", "ris", "on", " ", "with", " ", "change", " ", "highlight", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "get", "\\u", "close", "\\u", "matche", "s", "'_", ",_", "'", "ndi", "ff", "'_", ",_", "'", "restore", "'_", ",_", "'", "Sequ", "ence", "Match", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Diff", "er", "'_", ",_", "'", "IS", "\\u", "CHARACTER", "\\u", "JU", "NK", "'_", ",_", "'", "IS", "\\u", "LINE", "\\u", "JU", "NK", "'_", ",_", "'", "context", "\\u", "diff", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unifie", "d\\u", "diff", "'_", ",_", "'", "Ht", "ml", "Diff", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "heapq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "With", " ", "respec", "t", " ", "to", " ", "junk", ",", " ", "an", " ", "ear", "lie", "r", " ", "version", " ", "of", " ", "ndi", "ff", " ", "simp", "ly", " ", "refuse", "d", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", "start", "*", " ", "a", " ", "match", " ", "with", " ", "a", " ", "junk", " ", "element", ".", " ", " ", "The", " ", "result", " ", "was", " ", "case", "s", " ", "like", " ", "this", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", ":", " ", "private", " ", "Thread", " ", "current", "Thread", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", ":", " ", " ", "private", " ", "volatile", " ", "Thread", " ", "current", "Thread", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "consider", " ", "whitespace", " ", "to", " ", "be", " ", "junk", ",", " ", "the", " ", "long", "est", " ", "contiguous", " ", "match_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "startin", "g", " ", "with", " ", "junk", " ", "is", " ", "\"", "e", " ", "Thread", " ", "current", "Thread", "\".", " ", " ", "So", " ", "ndi", "ff", " ", "reporte", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "\"", "e", " ", "vol", "ati", "l", "\"", " ", "was", " ", "inserted", " ", "bet", "ween", " ", "the", " ", "'", "t", "'", " ", "and", " ", "the", " ", "'", "e", "'", " ", "in", " ", "\"", "private", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whi", "le", " ", "an", " ", "accurate", " ", "view", ",", " ", "to", " ", "people", " ", "tha", "t", "'", "s", " ", "abs", "ur", "d", ".", " ", " ", "The", " ", "current", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "look", "s", " ", "for", " ", "matchi", "ng", " ", "blocks", " ", "tha", "t", " ", "are", " ", "entire", "ly", " ", "junk", "-", "free", ",", " ", "then", " ", "extend", "s", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "long", "est", " ", "one", " ", "of", " ", "tho", "se", " ", "as", " ", "far", " ", "as", " ", "possib", "le", " ", "but", " ", "only", " ", "with", " ", "matchi", "ng", " ", "junk", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "So", " ", "now", " ", "\"", "current", "Thread", "\"", " ", "is", " ", "matche", "d", ",", " ", "then", " ", "extend", "ed", " ", "to", " ", "suc", "k", " ", "up", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "preceding", " ", "blank", ";", " ", "then", " ", "\"", "private", "\"", " ", "is", " ", "matche", "d", ",", " ", "and", " ", "extend", "ed", " ", "to", " ", "suc", "k", " ", "up", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "follow", "ing", " ", "blank", ";", " ", "then", " ", "\"", "Thread", "\"", " ", "is", " ", "matche", "d", ";", " ", "and", " ", "final", "ly", " ", "ndi", "ff", " ", "reports_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "\"", "volatile", " ", "\"", " ", "was", " ", "inserted", " ", "bef", "ore", " ", "\"", "Thread", "\".", " ", " ", "The", " ", "only", " ", "qui", "bble", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rema", "inin", "g", " ", "is", " ", "tha", "t", " ", "per", "hap", "s", " ", "it", " ", "was", " ", "reall", "y", " ", "the", " ", "case", " ", "tha", "t", " ", "\"", " ", "volatile", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "was", " ", "inserted", " ", "after", " ", "\"", "private", "\".", " ", " ", "I", " ", "can", " ", "live", " ", "with", " ", "tha", "t", " ", "<", "win", "k", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "www", ".", "unix", ".", "org", "/", "single", "\\u", "unix", "\\u", "specifica", "tion", "/_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "file", "\\u", "template_", "=_", "\"\"\"", "\\", "10", ";<", "!", "DOC", "TYPE", " ", "html", " ", "PUBLIC", " ", "\"-", "//", "W3", "C", "//", "DT", "D", " ", "XH", "TML", " ", "1.0", " ", "Transiti", "onal", "//", "EN", "\"", "\\", "10", ";", " ", " ", "\"", "http", "://", "www", ".", "w3", ".", "org", "/", "TR", "/", "xh", "tml", "1", "/", "DT", "D", "/", "xh", "tml", "1", "-", "transiti", "onal", ".", "dtd", "\">", "\\", "10", ";", "\\", "10", ";<", "html", ">", "\\", "10", ";", "\\", "10", ";<", "head", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "meta", " ", "http", "-", "equiv", "=\"", "Conten", "t", "-", "Type", "\"", "\\", "10", ";", " ", " ", "content", "=\"", "text", "/", "html", ";", " ", "charset", "=", "ISO", "-", "8859", "-1", "\"", " ", "/>", "\\", "10", ";", " ", " ", " ", " ", "<", "title", "><", "/", "title", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "style", " ", "type", "=\"", "text", "/", "css", "\">", "%", "(", "style", "s", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "</", "style", ">", "\\", "10", ";<", "/", "head", ">", "\\", "10", ";", "\\", "10", ";<", "body", ">", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "table", ")", "s", "%", "(", "legend", ")", "s", "\\", "10", ";<", "/", "body", ">", "\\", "10", ";", "\\", "10", ";<", "/", "html", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "styles_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "table", ".", "diff", " ", "{", "font", "-", "famil", "y", ":", "Cour", "ier", ";", " ", "border", ":", "medium", ";}", "\\", "10", ";", " ", " ", " ", " ", ".", "diff", "\\u", "header", " ", "{", "background", "-", "color", ":", "#", "e0", "e0", "e0", "}", "\\", "10", ";", " ", " ", " ", " ", "td", ".", "diff", "\\u", "header", " ", "{", "text", "-", "align", ":", "right", "}", "\\", "10", ";", " ", " ", " ", " ", ".", "diff", "\\u", "next", " ", "{", "background", "-", "color", ":", "#", "c0", "c0", "c0", "}", "\\", "10", ";", " ", " ", " ", " ", ".", "diff", "\\u", "add", " ", "{", "background", "-", "color", ":", "#", "aa", "ffa", "a", "}", "\\", "10", ";", " ", " ", " ", " ", ".", "diff", "\\u", "chg", " ", "{", "background", "-", "color", ":", "#", "fff", "f7", "7", "}", "\\", "10", ";", " ", " ", " ", " ", ".", "diff", "\\u", "sub", " ", "{", "background", "-", "color", ":", "#", "ffa", "aaa", "}\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "table", "\\u", "template_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "table", " ", "class", "=\"", "diff", "\"", " ", "id", "=\"", "difflib", "\\u", "chg", "\\u", "%", "(", "prefix", ")", "s", "\\u", "top", "\"", "\\", "10", ";", " ", " ", " ", "cells", "pacing", "=\"", "0", "\"", " ", "cellp", "addin", "g", "=\"", "0", "\"", " ", "rule", "s", "=\"", "group", "s", "\"", " ", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "col", "group", "><", "/", "col", "group", ">", " ", "<", "col", "group", "><", "/", "col", "group", ">", " ", "<", "col", "group", "><", "/", "col", "group", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "col", "group", "><", "/", "col", "group", ">", " ", "<", "col", "group", "><", "/", "col", "group", ">", " ", "<", "col", "group", "><", "/", "col", "group", ">", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "header", "\\u", "row", ")", "s", "\\", "10", ";", " ", " ", " ", " ", "<", "tbo", "dy", ">", "\\", "10", ";", "%", "(", "data\\u", "rows", ")", "s", " ", " ", " ", " ", "</", "tbo", "dy", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "table", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "legend_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "table", " ", "class", "=\"", "diff", "\"", " ", "summar", "y", "=\"", "Legend", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", ">", " ", "<", "th", " ", "colsp", "an", "=\"", "2", "\">", " ", "Legend", "s", " ", "</", "th", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", ">", " ", "<", "td", ">", " ", "<", "table", " ", "border", "=\"\"", " ", "summar", "y", "=\"", "Color", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "th", ">", " ", "Color", "s", " ", "</", "th", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "td", " ", "class", "=\"", "diff", "\\u", "add", "\">", "&", "nb", "sp", ";", "Added", "&", "nb", "sp", ";<", "/", "td", "><", "/", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "td", " ", "class", "=\"", "diff", "\\u", "chg", "\">", "Change", "d", "</", "td", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "td", " ", "class", "=\"", "diff", "\\u", "sub", "\">", "Delete", "d", "</", "td", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "</", "table", "><", "/", "td", ">", "\\", "10", ";", " ", " ", " ", " ", " ", "<", "td", ">", " ", "<", "table", " ", "border", "=\"\"", " ", "summar", "y", "=\"", "Link", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "th", " ", "colsp", "an", "=\"", "2", "\">", " ", "Link", "s", " ", "</", "th", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "td", ">(", "f", ")", "irs", "t", " ", "change", "</", "td", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "td", ">(", "n", ")", "ext", " ", "change", "</", "td", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", "><", "td", ">(", "t", ")", "op", "</", "td", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "</", "table", "><", "/", "td", ">", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "table", ">\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "test_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mdi", "ff_", "(_", "froml", "ines_", ",_", "tol", "ines_", ",_", "context_", "=_", "None_", ",_", "line", "junk", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "char", "junk", "_", "=_", "IS", "\\u", "CHARACTER", "\\u", "JU", "NK", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r", "\"\"\"", "Return", "s", " ", "generat", "or", " ", "yield", "ing", " ", "marked", " ", "up", " ", "from", "/", "to", " ", "side", " ", "by", " ", "side", " ", "difference", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "froml", "ine", "s", " ", "--", " ", "list", " ", "of", " ", "text", " ", "lines", " ", "to", " ", "compare", "d", " ", "to", " ", "tol", "ine", "s", "\\", "10", ";", " ", " ", " ", " ", "tol", "ine", "s", " ", "--", " ", "list", " ", "of", " ", "text", " ", "lines", " ", "to", " ", "be", " ", "compare", "d", " ", "to", " ", "froml", "ine", "s", "\\", "10", ";", " ", " ", " ", " ", "context", " ", "--", " ", "number", " ", "of", " ", "context", " ", "lines", " ", "to", " ", "display", " ", "on", " ", "each", " ", "side", " ", "of", " ", "difference", ",", "\\", "10", ";", " ", " ", " ", "if", " ", "Non", "e", ",", " ", "all", " ", "from", "/", "to", " ", "text", " ", "lines", " ", "will", " ", "be", " ", "generat", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "line", "junk", " ", "--", " ", "pass", "ed", " ", "on", " ", "to", " ", "ndi", "ff", " ", "(", "see", " ", "ndi", "ff", " ", "documentation", ")", "\\", "10", ";", " ", " ", " ", " ", "char", "junk", " ", "--", " ", "pass", "ed", " ", "on", " ", "to", " ", "ndi", "ff", " ", "(", "see", " ", "ndi", "ff", " ", "documentation", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "return", "s", " ", "an", " ", "inter", "ator", " ", "whi", "ch", " ", "return", "s", " ", "a", " ", "tuple", ":", "\\", "10", ";", " ", " ", " ", " ", "(", "from", " ", "line", " ", "tuple", ",", " ", "to", " ", "line", " ", "tuple", ",", " ", "boolean", " ", "flag", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "from", "/", "to", " ", "line", " ", "tuple", " ", "--", " ", "(", "line", " ", "num", ",", " ", "line", " ", "text", ")", "\\", "10", ";", " ", " ", " ", " ", "line", " ", "num", " ", "--", " ", "integ", "er", " ", "or", " ", "Non", "e", " ", "(", "to", " ", "indicat", "e", " ", "a", " ", "context", " ", "seperat", "ion", ")", "\\", "10", ";", " ", " ", " ", " ", "line", " ", "text", " ", "--", " ", "original", " ", "line", " ", "text", " ", "with", " ", "follow", "ing", " ", "marker", "s", " ", "inserted", ":", "\\", "10", ";", " ", " ", " ", " ", "'\\\\", "0", "+'", " ", "--", " ", "mark", "s", " ", "start", " ", "of", " ", "adde", "d", " ", "text", "\\", "10", ";", " ", " ", " ", " ", "'\\\\", "0", "-'", " ", "--", " ", "mark", "s", " ", "start", " ", "of", " ", "delete", "d", " ", "text", "\\", "10", ";", " ", " ", " ", " ", "'\\\\", "0", "^", "'", " ", "--", " ", "mark", "s", " ", "start", " ", "of", " ", "change", "d", " ", "text", "\\", "10", ";", " ", " ", " ", " ", "'\\\\", "1", "'", " ", "--", " ", "mark", "s", " ", "end", " ", "of", " ", "adde", "d", "/", "delete", "d", "/", "change", "d", " ", "text", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "boolean", " ", "flag", " ", "--", " ", "Non", "e", " ", "indicat", "es", " ", "context", " ", "separation", ",", " ", "Tru", "e", " ", "indicat", "es", "\\", "10", ";", " ", " ", " ", " ", "eit", "her", " ", "\"", "from", "\"", " ", "or", " ", "\"", "to", "\"", " ", "line", " ", "contain", "s", " ", "a", " ", "change", ",", " ", "other", "wis", "e", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", "/", "iter", "ator", " ", "was", " ", "original", "ly", " ", "develop", "ed", " ", "to", " ", "generat", "e", " ", "side", " ", "by", " ", "side", "\\", "10", ";", " ", " ", " ", " ", "file", " ", "difference", " ", "for", " ", "mak", "ing", " ", "HTM", "L", " ", "page", "s", " ", "(", "see", " ", "Ht", "ml", "Diff", " ", "class", " ", "for", " ", "example", "\\", "10", ";", " ", " ", " ", " ", "usage", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ",", " ", "this", " ", "function", " ", "utiliz", "es", " ", "the", " ", "ndi", "ff", " ", "function", " ", "to", " ", "generat", "e", " ", "the", " ", "side", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "side", " ", "difference", " ", "markup", ".", " ", " ", "Optio", "nal", " ", "ndi", "ff", " ", "argu", "ment", "s", " ", "may", " ", "be", " ", "pass", "ed", " ", "to", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "and", " ", "the", "y", " ", "in", " ", "turn", " ", "will", " ", "be", " ", "pass", "ed", " ", "to", " ", "ndi", "ff", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regular", " ", "express", "ion", " ", "for", " ", "finding", " ", "intra", "line", " ", "change", " ", "indices_", "\\u\\u\\uNL\\u\\u\\u_", "change", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "'(\\\\", "++", "|\\\\", "-+", "|\\\\", "^", "+)'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "difference", " ", "iter", "ator", " ", "to", " ", "generat", "e", " ", "the", " ", "difference", "s_", "\\u\\u\\uNL\\u\\u\\u_", "diff", "\\u", "lines", "\\u", "iterator_", "=_", "ndi", "ff_", "(_", "froml", "ines_", ",_", "tol", "ines_", ",_", "line", "junk", "_", ",_", "char", "junk", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "format\\u", "key_", ",_", "side_", ",_", "num", "\\u", "lines_", "=_", "[_", "0_", ",_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "line", " ", "of", " ", "text", " ", "with", " ", "user", "'", "s", " ", "change", " ", "markup", " ", "and", " ", "line", " ", "format", "ting", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "lines", " ", "--", " ", "list", " ", "of", " ", "lines", " ", "from", " ", "the", " ", "ndi", "ff", " ", "generat", "or", " ", "to", " ", "produce", " ", "a", " ", "line", " ", "of", "\\", "10", ";", " ", " ", " ", " ", " ", "text", " ", "from", ".", " ", " ", "Whe", "n", " ", "produc", "ing", " ", "the", " ", "line", " ", "of", " ", "text", " ", "to", " ", "return", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", " ", "lines", " ", "used", " ", "are", " ", "remove", "d", " ", "from", " ", "this", " ", "list", ".", "\\", "10", ";", " ", " ", " ", " ", "format\\u", "key", " ", "--", " ", "'+", "'", " ", "return", " ", "first", " ", "line", " ", "in", " ", "list", " ", "with", " ", "\"", "add", "\"", " ", "markup", " ", "aro", "und", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "entire", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "'-'", " ", "return", " ", "first", " ", "line", " ", "in", " ", "list", " ", "with", " ", "\"", "delete", "\"", " ", "markup", " ", "aro", "und", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "entire", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "'?", "'", " ", "return", " ", "first", " ", "line", " ", "in", " ", "list", " ", "with", " ", "add", "/", "delete", "/", "change", "\\", "10", ";", " ", " ", " ", " ", "intra", "line", " ", "markup", " ", "(", "indice", "s", " ", "obtain", "ed", " ", "from", " ", "second", " ", "line", ")", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "return", " ", "first", " ", "line", " ", "in", " ", "list", " ", "with", " ", "no", " ", "markup", "\\", "10", ";", " ", " ", " ", " ", "side", " ", "--", " ", "indice", " ", "int", "o", " ", "the", " ", "num", "\\u", "lines", " ", "list", " ", "(", "0", "=", "from", ",", "1", "=", "to", ")", "\\", "10", ";", " ", " ", " ", " ", "num", "\\u", "lines", " ", "--", " ", "from", "/", "to", " ", "current", " ", "line", " ", "number", ".", " ", " ", "Thi", "s", " ", "is", " ", "NOT", " ", "inten", "ded", " ", "to", " ", "be", " ", "a", "\\", "10", ";", " ", " ", " ", "pass", "ed", " ", "parameter", ".", " ", " ", "It", " ", "is", " ", "presen", "t", " ", "as", " ", "a", " ", "keyw", "ord", " ", "argu", "ment", " ", "to", "\\", "10", ";", " ", " ", " ", "maintain", " ", "memory", " ", "of", " ", "the", " ", "current", " ", "line", " ", "numbers", " ", "bet", "ween", " ", "calls", "\\", "10", ";", " ", " ", " ", "of", " ", "this", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ",", " ", "this", " ", "function", " ", "is", " ", "purpose", "full", "y", " ", "not", " ", "defin", "ed", " ", "at", " ", "the", " ", "module", " ", "scope", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "data", " ", "it", " ", "need", "s", " ", "from", " ", "its", " ", "parent", " ", "function", " ", "(", "within", " ", "who", "se", " ", "context", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "defin", "ed", ")", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "of", " ", "module", " ", "scope", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "lines_", "[_", "side_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "case", " ", "where", " ", "no", " ", "user", " ", "markup", " ", "is", " ", "to", " ", "be", " ", "adde", "d", ",", " ", "just", " ", "return", " ", "line", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "text", " ", "with", " ", "user", "'", "s", " ", "line", " ", "format", " ", "to", " ", "allow", " ", "for", " ", "usage", " ", "of", " ", "the", " ", "line", " ", "number", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "format\\u", "key_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "num", "\\u", "lines_", "[_", "side_", "]_", ",_", "lines_", "._", "pop_", "(_", "0_", ")_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "case", " ", "of", " ", "intra", "line", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format\\u", "key_", "==_", "'?'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", ",_", "markers_", "=_", "lines_", "._", "pop_", "(_", "0_", ")_", ",_", "lines_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "intra", "line", " ", "change", "s", " ", "(", "store", " ", "change", " ", "type", " ", "and", " ", "indice", "s", " ", "in", " ", "tuple", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "sub\\u", "info_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "record", "\\u", "sub\\u", "info_", "(_", "match", "\\u", "object_", ",_", "sub\\u", "info_", "=_", "sub\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub\\u", "info_", "._", "append_", "(_", "[_", "match", "\\u", "object_", "._", "group_", "(_", "1_", ")_", "[_", "0_", "]_", ",_", "match", "\\u", "object_", "._", "span_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "match", "\\u", "object_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "change", "\\u", "re_", "._", "sub_", "(_", "record", "\\u", "sub\\u", "info_", ",_", "markers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "each", " ", "tuple", " ", "insert", "ing", " ", "our", " ", "special", " ", "mark", "s", " ", "tha", "t", " ", "won", "'", "t", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", "d", " ", "by", " ", "an", " ", "xml", "/", "html", " ", "escape", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "(_", "begin_", ",_", "end_", ")_", "in_", "sub\\u", "info_", "[_", ":_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "text_", "[_", "0_", ":_", "begin_", "]_", "+_", "'\\\\", "0", "'_", "+_", "key_", "+_", "text_", "[_", "begin_", ":_", "end_", "]_", "+_", "'\\\\", "1", "'_", "+_", "text_", "[_", "end_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "text_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "case", " ", "of", " ", "add", "/", "delete", " ", "entire", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "lines_", "._", "pop_", "(_", "0_", ")_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "line", " ", "of", " ", "text", " ", "is", " ", "just", " ", "a", " ", "newline", ",", " ", "insert", " ", "a", " ", "space", " ", "so", " ", "there", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "somet", "hing", " ", "for", " ", "the", " ", "user", " ", "to", " ", "highlight", " ", "and", " ", "see", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insert", " ", "mark", "s", " ", "tha", "t", " ", "won", "'", "t", " ", "be", " ", "notice", "d", " ", "by", " ", "an", " ", "xml", "/", "html", " ", "escape", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "'\\\\", "0", "'_", "+_", "format\\u", "key_", "+_", "text_", "+_", "'\\\\", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Return", " ", "line", " ", "of", " ", "text", ",", " ", "first", " ", "allow", " ", "user", "'", "s", " ", "line", " ", "formatter", " ", "to", " ", "do", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "thing", " ", "(", "suc", "h", " ", "as", " ", "addin", "g", " ", "the", " ", "line", " ", "number", ")", " ", "then", " ", "replace", " ", "the", " ", "special_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mark", "s", " ", "with", " ", "what", " ", "the", " ", "user", "'", "s", " ", "change", " ", "markup", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "num", "\\u", "lines_", "[_", "side_", "]_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "line", "\\u", "iterator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "elds", " ", "from", "/", "to", " ", "lines", " ", "of", " ", "text", " ", "with", " ", "a", " ", "change", " ", "indicati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "is", " ", "an", " ", "iter", "ator", ".", " ", " ", "It", " ", "its", "elf", " ", "pull", "s", " ", "lines", " ", "from", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "differ", "enci", "ng", " ", "iter", "ator", ",", " ", "process", "es", " ", "them", " ", "and", " ", "yield", "s", " ", "them", ".", " ", " ", "Whe", "n", " ", "it", " ", "can", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "yield", "s", " ", "bot", "h", " ", "a", " ", "\"", "from", "\"", " ", "and", " ", "a", " ", "\"", "to", "\"", " ", "line", ",", " ", "other", "wis", "e", " ", "it", " ", "will", " ", "yield", " ", "one", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "the", " ", "other", ".", " ", " ", "In", " ", "addition", " ", "to", " ", "yield", "ing", " ", "the", " ", "lines", " ", "of", " ", "from", "/", "to", " ", "text", ",", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "boolean", " ", "flag", " ", "is", " ", "yield", "ed", " ", "to", " ", "indicat", "e", " ", "if", " ", "the", " ", "text", " ", "line", "(", "s", ")", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "difference", "s", " ", "in", " ", "them", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ",", " ", "this", " ", "function", " ", "is", " ", "purpose", "full", "y", " ", "not", " ", "defin", "ed", " ", "at", " ", "the", " ", "module", " ", "scope", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "data", " ", "it", " ", "need", "s", " ", "from", " ", "its", " ", "parent", " ", "function", " ", "(", "within", " ", "who", "se", " ", "context", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "defin", "ed", ")", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "of", " ", "module", " ", "scope", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "blank", "s", "\\u", "pending_", ",_", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", "=_", "0_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Load", " ", "up", " ", "next", " ", "4", " ", "lines", " ", "so", " ", "we", " ", "can", " ", "look", " ", "ahe", "ad", ",", " ", "create", " ", "string", "s", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "a", " ", "concate", "nati", "on", " ", "of", " ", "the", " ", "first", " ", "character", " ", "of", " ", "each", " ", "of", " ", "the", " ", "4", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "we", " ", "can", " ", "do", " ", "some", " ", "very", " ", "reada", "ble", " ", "comparisons", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "len_", "(_", "lines_", ")_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "diff", "\\u", "lines", "\\u", "iterator_", "._", "next_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "._", "append_", "(_", "'", "X", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "''_", "._", "join_", "(_", "[_", "line_", "[_", "0_", "]_", "for_", "line_", "in_", "lines_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "s_", "._", "startswith_", "(_", "'", "X", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "no", " ", "more", " ", "lines", ",", " ", "pump", " ", "out", " ", "any", " ", "rema", "inin", "g", " ", "blank", " ", "lines", " ", "so", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correspond", "ing", " ", "add", "/", "delete", " ", "lines", " ", "get", " ", "a", " ", "matchi", "ng", " ", "blank", " ", "line", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "line", " ", "pair", "s", " ", "get", " ", "yield", "ed", " ", "at", " ", "the", " ", "next", " ", "level", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", "=_", "num", "\\u", "blank", "s", "\\u", "pending_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'-", "?", "+?", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "simple", " ", "intra", "line", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'?'_", ",_", "0_", ")_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'?'_", ",_", "1_", ")_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'--", "++'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "delete", " ", "block", ",", " ", "add", " ", "block", " ", "comi", "ng", ":", " ", "we", " ", "do", " ", "NOT", " ", "want", " ", "to", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cau", "ght", " ", "up", " ", "on", " ", "blank", " ", "lines", " ", "ye", "t", ",", " ", "just", " ", "process", " ", "the", " ", "delete", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "pending_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'-'_", ",_", "0_", ")_", ",_", "None_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "(_", "'--", "?", "+'_", ",_", "'--", "+'_", ",_", "'-", " ", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "delete", " ", "block", " ", "and", " ", "see", " ", "a", " ", "intra", "line", " ", "change", " ", "or", " ", "unchanged", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", ":", " ", "yield", " ", "the", " ", "delete", " ", "line", " ", "and", " ", "then", " ", "blanks_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "line_", ",_", "to", "\\u", "line_", "=_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'-'_", ",_", "0_", ")_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", ",_", "num", "\\u", "blank", "s", "\\u", "pending_", "=_", "num", "\\u", "blank", "s", "\\u", "pending_", "-_", "1_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'-", "+?", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "intra", "line", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "None_", ",_", "0_", ")_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'?'_", ",_", "1_", ")_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'-", "?", "+'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "intra", "line", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'?'_", ",_", "0_", ")_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "None_", ",_", "1_", ")_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "FROM", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "pending_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'-'_", ",_", "0_", ")_", ",_", "None_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'+", "--'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "in", " ", "add", " ", "block", ",", " ", "delete", " ", "block", " ", "comi", "ng", ":", " ", "we", " ", "do", " ", "NOT", " ", "want", " ", "to", " ", "get_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cau", "ght", " ", "up", " ", "on", " ", "blank", " ", "lines", " ", "ye", "t", ",", " ", "just", " ", "process", " ", "the", " ", "add", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "pending_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "None_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'+'_", ",_", "1_", ")_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "(_", "'+", " ", "'_", ",_", "'+", "-'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "will", " ", "be", " ", "leaving", " ", "an", " ", "add", " ", "block", ":", " ", "yield", " ", "blank", "s", " ", "then", " ", "add", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "line_", ",_", "to", "\\u", "line_", "=_", "None_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'+'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", ",_", "num", "\\u", "blank", "s", "\\u", "pending_", "=_", "num", "\\u", "blank", "s", "\\u", "pending_", "+_", "1_", ",_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'+'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "insi", "de", " ", "an", " ", "add", " ", "block", ",", " ", "yield", " ", "the", " ", "add", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "pending_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "None_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "'+'_", ",_", "1_", ")_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "s_", "._", "startswith_", "(_", "'", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unchanged", " ", "text", ",", " ", "yield", " ", "it", " ", "to", " ", "bot", "h", " ", "sides_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\u", "make", "\\u", "line_", "(_", "lines_", "[_", ":_", "]_", ",_", "None_", ",_", "0_", ")_", ",_", "\\u", "make", "\\u", "line_", "(_", "lines_", ",_", "None_", ",_", "1_", ")_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Catch", " ", "up", " ", "on", " ", "the", " ", "blank", " ", "lines", " ", "so", " ", "whe", "n", " ", "we", " ", "yield", " ", "the", " ", "next", " ", "from", "/", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pair", ",", " ", "the", "y", " ", "are", " ", "line", "d", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "(_", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", "<_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "None_", ",_", "(_", "''_", ",_", "'\\\\", "n", "'_", ")_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "(_", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", ">_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "blank", "s", "\\u", "to", "\\u", "yield_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "''_", ",_", "'\\\\", "n", "'_", ")_", ",_", "None_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "s_", "._", "startswith_", "(_", "'", "X", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sto", "p", "Iteration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "line", "\\u", "pair", "\\u", "iterator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Yi", "elds", " ", "from", "/", "to", " ", "lines", " ", "of", " ", "text", " ", "with", " ", "a", " ", "change", " ", "indicati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "function", " ", "is", " ", "an", " ", "iter", "ator", ".", " ", " ", "It", " ", "its", "elf", " ", "pull", "s", " ", "lines", " ", "from", " ", "the", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "iter", "ator", ".", " ", " ", "It", "s", " ", "difference", " ", "from", " ", "tha", "t", " ", "iter", "ator", " ", "is", " ", "tha", "t", " ", "this", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "alw", "ay", "s", " ", "yield", "s", " ", "a", " ", "pair", " ", "of", " ", "from", "/", "to", " ", "text", " ", "lines", " ", "(", "with", " ", "the", " ", "change", "\\", "10", ";", " ", " ", " ", " ", "indicati", "on", ").", " ", " ", "If", " ", "necessar", "y", " ", "it", " ", "will", " ", "collect", " ", "single", " ", "from", "/", "to", " ", "lines", "\\", "10", ";", " ", " ", " ", " ", "unti", "l", " ", "it", " ", "has", " ", "a", " ", "matchi", "ng", " ", "pair", " ", "from", "/", "to", " ", "pair", " ", "to", " ", "yield", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ",", " ", "this", " ", "function", " ", "is", " ", "purpose", "full", "y", " ", "not", " ", "defin", "ed", " ", "at", " ", "the", " ", "module", " ", "scope", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "data", " ", "it", " ", "need", "s", " ", "from", " ", "its", " ", "parent", " ", "function", " ", "(", "within", " ", "who", "se", " ", "context", " ", "it", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "defin", "ed", ")", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "of", " ", "module", " ", "scope", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "iterator_", "=_", "\\u", "line", "\\u", "iterator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "froml", "ines_", ",_", "tol", "ines_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Collecti", "ng", " ", "lines", " ", "of", " ", "text", " ", "unti", "l", " ", "we", " ", "have", " ", "a", " ", "from", "/", "to", " ", "pair_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "(_", "len_", "(_", "froml", "ines_", ")_", "==_", "0_", "or_", "len_", "(_", "tol", "ines_", ")_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "found", "\\u", "diff_", "=_", "line", "\\u", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "from", "\\u", "line_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "froml", "ines_", "._", "append_", "(_", "(_", "from", "\\u", "line_", ",_", "found", "\\u", "diff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "to", "\\u", "line_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tol", "ines_", "._", "append_", "(_", "(_", "to", "\\u", "line_", ",_", "found", "\\u", "diff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ce", " ", "we", " ", "have", " ", "a", " ", "pair", ",", " ", "remove", " ", "them", " ", "from", " ", "the", " ", "collection", " ", "and", " ", "yield", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "\\u", "line_", ",_", "from", "Diff_", "=_", "froml", "ines_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "line_", ",_", "to", "\\u", "diff_", "=_", "tol", "ines_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "from", "Diff_", "or_", "to", "\\u", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Handle", " ", "case", " ", "where", " ", "user", " ", "doe", "s", " ", "not", " ", "want", " ", "context", " ", "differ", "enci", "ng", ",", " ", "just", " ", "yield_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "them", " ", "up", " ", "with", "out", " ", "doi", "ng", " ", "anyt", "hing", " ", "else", " ", "with", " ", "them", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line", "\\u", "pair", "\\u", "iterator_", "=_", "\\u", "line", "\\u", "pair", "\\u", "iterator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "line", "\\u", "pair", "\\u", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "case", " ", "where", " ", "user", " ", "want", "s", " ", "context", " ", "differ", "enci", "ng", ".", " ", " ", "We", " ", "must", " ", "do", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "storage", " ", "of", " ", "lines", " ", "unti", "l", " ", "we", " ", "know", " ", "for", " ", "sure", " ", "tha", "t", " ", "the", "y", " ", "are", " ", "to", " ", "be", " ", "yield", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines", "\\u", "to", "\\u", "write_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Stor", "e", " ", "lines", " ", "up", " ", "unti", "l", " ", "we", " ", "find", " ", "a", " ", "difference", ",", " ", "note", " ", "use", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "circular", " ", "queue", " ", "bec", "aus", "e", " ", "we", " ", "only", " ", "need", " ", "to", " ", "keep", " ", "aro", "und", " ", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "for", " ", "context", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", ",_", "context", "Lines_", "=_", "0_", ",_", "[_", "None_", "]_", "*_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "\\u", "diff_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "found", "\\u", "diff_", "is_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "found", "\\u", "diff_", "=_", "line", "\\u", "pair", "\\u", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "index_", "%_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context", "Lines_", "[_", "i_", "]_", "=_", "(_", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "found", "\\u", "diff_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Yi", "eld", " ", "lines", " ", "tha", "t", " ", "we", " ", "have", " ", "collected", " ", "so", " ", "far", ",", " ", "but", " ", "first", " ", "yield_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "user", "'", "s", " ", "separator", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "index_", ">_", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines", "\\u", "to", "\\u", "write_", "=_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines", "\\u", "to", "\\u", "write_", "=_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "(_", "lines", "\\u", "to", "\\u", "write_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "index_", "%_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "context", "Lines_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines", "\\u", "to", "\\u", "write_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "yield", " ", "the", " ", "context", " ", "lines", " ", "after", " ", "the", " ", "change_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines", "\\u", "to", "\\u", "write_", "=_", "context_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "(_", "lines", "\\u", "to", "\\u", "write_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "found", "\\u", "diff_", "=_", "line", "\\u", "pair", "\\u", "iterator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "anot", "her", " ", "change", " ", "within", " ", "the", " ", "context", ",", " ", "extend", " ", "the", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "found", "\\u", "diff_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines", "\\u", "to", "\\u", "write_", "=_", "context_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines", "\\u", "to", "\\u", "write_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "from", "\\u", "line_", ",_", "to", "\\u", "line_", ",_", "found", "\\u", "diff_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
sunlightlabs/read_FEC/fecreader/summary_data/management/commands/export_bulk_files_to_s3.py
[ { "content": "from boto.s3.connection import S3Connection\nfrom boto.s3.key import Key\n\nimport time, os\n\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.conf import settings\n\nfrom formdata.utils.dump_utils import dump_all_sked\nfrom summary_data.utils.update_utils import set_update\n\n\nAWS_ACCESS_KEY_ID = getattr(settings, 'AWS_ACCESS_KEY_ID')\nAWS_SECRET_ACCESS_KEY = getattr(settings, 'AWS_SECRET_ACCESS_KEY')\nCSV_EXPORT_DIR = getattr(settings, 'CSV_EXPORT_DIR')\nAWS_STORAGE_BUCKET_NAME = getattr(settings, 'AWS_STORAGE_BUCKET_NAME')\nAWS_BULK_EXPORT_PATH = getattr(settings, 'AWS_BULK_EXPORT_PATH')\nBULK_EXPORT_KEY = getattr(settings, 'BULK_EXPORT_KEY')\n\n\ntry:\n ACTIVE_CYCLES = settings.ACTIVE_CYCLES\nexcept:\n print \"Missing active cycle list. Defaulting to 2016. \"\n ACTIVE_CYCLES = '2016'\n\n\n ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(BaseCommand):\n help = \"Dump the big files to a predefined spot in the filesystem. They need to then get moved to S3\"\n requires_model_validation = False\n \n ", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def handle(self, *args, **options):\n \n for CYCLE in ACTIVE_CYCLES:\n \n \n conn = S3Connection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)\n b = conn.get_bucket(AWS_STORAGE_BUCKET_NAME)\n \n for sked in ['e','b', 'a']:\n filename = \"sked%s_%s.csv\" % (sked, CYCLE)\n \n local_skedfile = \"%s/%s\" % (CSV_EXPORT_DIR, filename)\n print \"Dumping sked %s to %s\" % (sked, local_skedfile)\n dump_all_sked(sked, local_skedfile, CYCLE)\n \n # need to gzip these\n gzip_cmd = \"gzip -f %s\" % (local_skedfile)\n filename_zipped = filename + \".gz\"\n local_skedfile_zipped = local_skedfile + \".gz\"\n # old style os.system just works - subprocess sucks. \n proc = os.system(gzip_cmd)\n \n s3_path = \"%s/%s\" % (AWS_BULK_EXPORT_PATH,filename_zipped)\n print \"pushing %s to S3: bucket=%s path=%s\" % (local_skedfile_zipped, AWS_STORAGE_BUCKET_NAME,s3_path)\n start = time.time()\n k = Key(b)\n k.key = s3_path\n k.set_contents_from_filename(local_skedfile_zipped, policy='public-read')\n elapsed_time = time.time() - start\n print \"elapsed time for pushing to s3 is %s\" % (elapsed_time)\n \n \n # if we didn't die, set the update time\n set_update(BULK_EXPORT_KEY)", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "boto_", "._", "s3_", "._", "connection_", "import_", "S", "3", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "s3_", "._", "key_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "form", "data_", "._", "utils_", "._", "dump", "\\u", "utils_", "import_", "dump", "\\u", "all", "\\u", "ske", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "summar", "y", "\\u", "data_", "._", "utils_", "._", "update", "\\u", "utils_", "import_", "set\\u", "update_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID_", "=_", "getattr_", "(_", "settings_", ",_", "'", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY_", "=_", "getattr_", "(_", "settings_", ",_", "'", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CSV", "\\u", "EXPORT", "\\u", "DIR_", "=_", "getattr_", "(_", "settings_", ",_", "'", "CSV", "\\u", "EXPORT", "\\u", "DIR", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "STOR", "AGE", "\\u", "BUCKET", "\\u", "NAME_", "=_", "getattr_", "(_", "settings_", ",_", "'", "AW", "S", "\\u", "STOR", "AGE", "\\u", "BUCKET", "\\u", "NAME", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "BUL", "K", "\\u", "EXPORT", "\\u", "PATH_", "=_", "getattr_", "(_", "settings_", ",_", "'", "AW", "S", "\\u", "BUL", "K", "\\u", "EXPORT", "\\u", "PATH", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BUL", "K", "\\u", "EXPORT", "\\u", "KEY_", "=_", "getattr_", "(_", "settings_", ",_", "'", "BUL", "K", "\\u", "EXPORT", "\\u", "KEY", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ACTI", "VE", "\\u", "CYCLE", "S_", "=_", "settings_", "._", "ACTI", "VE", "\\u", "CYCLE", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Missing", " ", "active", " ", "cycle", " ", "list", ".", " ", "Default", "ing", " ", "to", " ", "2016", ".", " ", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ACTI", "VE", "\\u", "CYCLE", "S_", "=_", "'", "2016", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "\"", "Dump", " ", "the", " ", "big", " ", "files", " ", "to", " ", "a", " ", "prede", "fined", " ", "spot", " ", "in", " ", "the", " ", "filesystem", ".", " ", "The", "y", " ", "need", " ", "to", " ", "then", " ", "get", " ", "moved", " ", "to", " ", "S", "3", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "s", "\\u", "model", "\\u", "validation_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "CYCLE", "_", "in_", "ACTI", "VE", "\\u", "CYCLE", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "S", "3", "Connection_", "(_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY", "\\u", "ID_", ",_", "AW", "S", "\\u", "SEC", "RET", "\\u", "ACCESS", "\\u", "KEY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "conn_", "._", "get", "\\u", "bucket_", "(_", "AW", "S", "\\u", "STOR", "AGE", "\\u", "BUCKET", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ske", "d_", "in_", "[_", "'", "e", "'_", ",_", "'", "b", "'_", ",_", "'", "a", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "\"", "ske", "d", "%", "s", "\\u", "%", "s", ".", "csv", "\"_", "%_", "(_", "ske", "d_", ",_", "CYCLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "ske", "dfile", "_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "CSV", "\\u", "EXPORT", "\\u", "DIR_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Dump", "ing", " ", "ske", "d", " ", "%", "s", " ", "to", " ", "%", "s", "\"_", "%_", "(_", "ske", "d_", ",_", "local", "\\u", "ske", "dfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dump", "\\u", "all", "\\u", "ske", "d_", "(_", "ske", "d_", ",_", "local", "\\u", "ske", "dfile", "_", ",_", "CYCLE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "gzip", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "gzip", "\\u", "cmd_", "=_", "\"", "gzip", " ", "-", "f", " ", "%", "s", "\"_", "%_", "(_", "local", "\\u", "ske", "dfile", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename", "\\u", "zipped", "_", "=_", "filename_", "+_", "\".", "gz", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "ske", "dfile", "\\u", "zipped", "_", "=_", "local", "\\u", "ske", "dfile", "_", "+_", "\".", "gz", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "old", " ", "style", " ", "os", ".", "system", " ", "just", " ", "works", " ", "-", " ", "subproc", "ess", " ", "suc", "ks", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "os_", "._", "system_", "(_", "gzip", "\\u", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "path_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "AW", "S", "\\u", "BUL", "K", "\\u", "EXPORT", "\\u", "PATH_", ",_", "filename", "\\u", "zipped", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "push", "ing", " ", "%", "s", " ", "to", " ", "S", "3", ":", " ", "bucket", "=", "%", "s", " ", "path", "=", "%", "s", "\"_", "%_", "(_", "local", "\\u", "ske", "dfile", "\\u", "zipped", "_", ",_", "AW", "S", "\\u", "STOR", "AGE", "\\u", "BUCKET", "\\u", "NAME_", ",_", "s3", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "=_", "Key_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "._", "key_", "=_", "s3", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k_", "._", "set\\u", "content", "s", "\\u", "from", "\\u", "filename_", "(_", "local", "\\u", "ske", "dfile", "\\u", "zipped", "_", ",_", "policy_", "=_", "'", "public", "-", "read", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ela", "pse", "d\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "-_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "ela", "pse", "d", " ", "time", " ", "for", " ", "push", "ing", " ", "to", " ", "s3", " ", "is", " ", "%", "s", "\"_", "%_", "(_", "ela", "pse", "d\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
STIXProject/python-stix/stix/bindings/campaign.py
[ { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='NamesType', fromsubclass_=False, pretty_print=True):\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Name_ in self.Name:\n Name_.export(lwrite, level, nsmap, namespace_, name_='Name', pretty_print=pretty_print)", "metadata": "root.NamesType.exportChildren", "header": "['class', 'NamesType', '(', 'GeneratedsSuper', ')', ':', '___EOS___']", "index": 68 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='AssociatedCampaignsType', fromsubclass_=False, pretty_print=True):\n super(AssociatedCampaignsType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Associated_Campaign_ in self.Associated_Campaign:\n Associated_Campaign_.export(lwrite, level, nsmap, namespace_, name_='Associated_Campaign', pretty_print=pretty_print)", "metadata": "root.AssociatedCampaignsType.exportChildren", "header": "['class', 'AssociatedCampaignsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 135 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='RelatedIndicatorsType', fromsubclass_=False, pretty_print=True):\n super(RelatedIndicatorsType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Related_Indicator_ in self.Related_Indicator:\n Related_Indicator_.export(lwrite, level, nsmap, namespace_, name_='Related_Indicator', pretty_print=pretty_print)", "metadata": "root.RelatedIndicatorsType.exportChildren", "header": "['class', 'RelatedIndicatorsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 204 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='RelatedIncidentsType', fromsubclass_=False, pretty_print=True):\n super(RelatedIncidentsType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Related_Incident_ in self.Related_Incident:\n Related_Incident_.export(lwrite, level, nsmap, namespace_, name_='Related_Incident', pretty_print=pretty_print)", "metadata": "root.RelatedIncidentsType.exportChildren", "header": "['class', 'RelatedIncidentsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 273 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='RelatedTTPsType', fromsubclass_=False, pretty_print=True):\n super(RelatedTTPsType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Related_TTP_ in self.Related_TTP:\n Related_TTP_.export(lwrite, level, nsmap, namespace_, name_='Related_TTP', pretty_print=pretty_print)", "metadata": "root.RelatedTTPsType.exportChildren", "header": "['class', 'RelatedTTPsType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 342 }, { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='AttributionType', fromsubclass_=False, pretty_print=True):\n super(AttributionType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n for Attributed_Threat_Actor_ in self.Attributed_Threat_Actor:\n Attributed_Threat_Actor_.export(lwrite, level, nsmap, namespace_, name_='Attributed_Threat_Actor', pretty_print=pretty_print)", "metadata": "root.AttributionType.exportChildren", "header": "['class', 'AttributionType', '(', 'stix_common_binding', '.', 'GenericRelationshipListType', ')', ':', '___EOS___']", "index": 413 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Campaign'\n rootClass = CampaignType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n # sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n # rootObj.export(sys.stdout, 0, name_=rootTag,\n # namespacedef_='',\n # pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 722 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Campaign'\n rootClass = CampaignType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 739 }, { "content": "def parseString(inString):\n from StringIO import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'Campaign'\n rootClass = CampaignType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n # sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n # rootObj.export(sys.stdout, 0, name_=\"Campaign\",\n # namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 757 } ]
[ { "span": "eol_ ", "start_line": 70, "start_column": 12, "end_line": 70, "end_column": 16 }, { "span": "eol_ ", "start_line": 72, "start_column": 12, "end_line": 72, "end_column": 16 }, { "span": "eol_ ", "start_line": 138, "start_column": 12, "end_line": 138, "end_column": 16 }, { "span": "eol_ ", "start_line": 140, "start_column": 12, "end_line": 140, "end_column": 16 }, { "span": "eol_ ", "start_line": 207, "start_column": 12, "end_line": 207, "end_column": 16 }, { "span": "eol_ ", "start_line": 209, "start_column": 12, "end_line": 209, "end_column": 16 }, { "span": "eol_ ", "start_line": 276, "start_column": 12, "end_line": 276, "end_column": 16 }, { "span": "eol_ ", "start_line": 278, "start_column": 12, "end_line": 278, "end_column": 16 }, { "span": "eol_ ", "start_line": 345, "start_column": 12, "end_line": 345, "end_column": 16 }, { "span": "eol_ ", "start_line": 347, "start_column": 12, "end_line": 347, "end_column": 16 }, { "span": "eol_ ", "start_line": 416, "start_column": 12, "end_line": 416, "end_column": 16 }, { "span": "eol_ ", "start_line": 418, "start_column": 12, "end_line": 418, "end_column": 16 }, { "span": "rootTag ", "start_line": 727, "start_column": 8, "end_line": 727, "end_column": 15 }, { "span": "doc ", "start_line": 732, "start_column": 4, "end_line": 732, "end_column": 7 }, { "span": "doc ", "start_line": 749, "start_column": 4, "end_line": 749, "end_column": 7 }, { "span": "rootTag ", "start_line": 763, "start_column": 8, "end_line": 763, "end_column": 15 }, { "span": "doc ", "start_line": 768, "start_column": 4, "end_line": 768, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Names", "Type_", "(_", "Generate", "ds", "Super", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Names", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Name\\u_", "in_", "self_", "._", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Name\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Name", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Associate", "d", "Camp", "aig", "ns", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Associate", "d", "Camp", "aig", "ns", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Associate", "d", "Camp", "aig", "ns", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Associate", "d\\u", "Camp", "aig", "n", "\\u_", "in_", "self_", "._", "Associate", "d\\u", "Camp", "aig", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Associate", "d\\u", "Camp", "aig", "n", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Associate", "d\\u", "Camp", "aig", "n", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rela", "ted", "Indicat", "ors", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "Indicat", "ors", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rela", "ted", "Indicat", "ors", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Rela", "ted", "\\u", "Indicat", "or\\u_", "in_", "self_", "._", "Rela", "ted", "\\u", "Indicator_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rela", "ted", "\\u", "Indicat", "or\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "\\u", "Indicat", "or", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rela", "ted", "Inciden", "ts", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "Inciden", "ts", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rela", "ted", "Inciden", "ts", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Rela", "ted", "\\u", "Inciden", "t", "\\u_", "in_", "self_", "._", "Rela", "ted", "\\u", "Inciden", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rela", "ted", "\\u", "Inciden", "t", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "\\u", "Inciden", "t", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rela", "ted", "TT", "Ps", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "TT", "Ps", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rela", "ted", "TT", "Ps", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Rela", "ted", "\\u", "TT", "P", "\\u_", "in_", "self_", "._", "Rela", "ted", "\\u", "TT", "P_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Rela", "ted", "\\u", "TT", "P", "\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Rela", "ted", "\\u", "TT", "P", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attrib", "uti", "on", "Type_", "(_", "sti", "x", "\\u", "common", "\\u", "binding_", "._", "Gene", "ric", "Relationship", "List", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "Attrib", "uti", "on", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Attrib", "uti", "on", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "Attribute", "d\\u", "Thre", "at", "\\u", "Act", "or\\u_", "in_", "self_", "._", "Attribute", "d\\u", "Thre", "at", "\\u", "Actor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Attribute", "d\\u", "Thre", "at", "\\u", "Act", "or\\u_", "._", "export_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", "=_", "'", "Attribute", "d\\u", "Thre", "at", "\\u", "Act", "or", "'_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Camp", "aig", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Camp", "aig", "n", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ",", " ", "0", ",", " ", "name", "\\u", "=", "root", "Ta", "g", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", "def", "\\u", "=''", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Camp", "aig", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Camp", "aig", "n", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "Camp", "aig", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "Camp", "aig", "n", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sys", ".", "stdout", ".", "write", "('", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "root", "Obj", ".", "export", "(", "sys", ".", "stdout", ",", " ", "0", ",", " ", "name", "\\u", "=\"", "Camp", "aig", "n", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "namespace", "def", "\\u", "=''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tryolabs/daywatch/daywatch/api/serializers.py
[ { "content": "from core.models import ITEM_MODEL, MERCHANT_MODEL, SoldCount, \\\n SITE_MODEL, Run\n\nfrom rest_framework import serializers\nimport json\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ItemSerializer(serializers.ModelSerializer):\n category = serializers.Field(source='category_name')\n currency = serializers.Field(source='currency_code')\n start = serializers.Field(source='date_time')\n end = serializers.Field(source='end_date_time')\n sales_log = serializers.Field(source='get_sold_count_log')\n\n class Meta:\n model = ITEM_MODEL\n fields = (\n # Model fields\n 'hash_id', 'offer', 'url', 'category', 'description', 'site',\n 'currency', 'price', 'discount', 'sold_count', 'city',\n 'merchant', 'image_url', 'start', 'end', 'active',\n 'sold_count',\n # Computed fields\n 'sales_log',\n )", "metadata": "root.ItemSerializer", "header": "['module', '___EOS___']", "index": 7 }, { "content": "class MerchantSerializer(serializers.ModelSerializer):\n items_sold = serializers.Field(source='items_sold')\n sales_volume = serializers.Field(source='sales_volume')\n items_offered = serializers.Field(source='items_offered')\n\n class Meta:\n model = MERCHANT_MODEL\n fields = (\n # Model fields\n 'id', 'name', 'lat', 'lon', 'address', 'phone', 'website', 'email',\n # Computed fields\n 'items_sold', 'sales_volume', 'items_offered'\n )", "metadata": "root.MerchantSerializer", "header": "['module', '___EOS___']", "index": 27 }, { "content": "class SiteSerializer(serializers.ModelSerializer):\n runs = serializers.Field(source='get_runs')\n\n class Meta:\n model = SITE_MODEL\n fields = (\n # Model fields\n 'id', 'name', 'url', 'spider_name', 'spider_enabled', 'country',\n # Computed fields\n 'runs',\n )", "metadata": "root.SiteSerializer", "header": "['module', '___EOS___']", "index": 42 } ]
[ { "span": "from core.models import ITEM_MODEL, MERCHANT_MODEL, SoldCount, \\\n SITE_MODEL, Run", "start_line": 0, "start_column": 0, "end_line": 1, "end_column": 19 }, { "span": "import json", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "core_", "._", "models_", "import_", "ITEM", "\\u", "MODEL_", ",_", "MER", "CHAN", "T", "\\u", "MODEL_", ",_", "Sol", "d", "Count_", ",_", "SITE", "\\u", "MODEL_", ",_", "Run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rest", "\\u", "framework_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Item", "Serializer_", "(_", "serializers_", "._", "Model", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "category_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "category", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "currency_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "curr", "ency", "\\u", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "date", "\\u", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "end", "\\u", "date", "\\u", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "\\u", "log_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "get", "\\u", "sold", "\\u", "count", "\\u", "log", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "ITEM", "\\u", "MODEL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Model", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hash", "\\u", "id", "'_", ",_", "'", "off", "er", "'_", ",_", "'", "url", "'_", ",_", "'", "category", "'_", ",_", "'", "description", "'_", ",_", "'", "site", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "curr", "ency", "'_", ",_", "'", "price", "'_", ",_", "'", "discou", "nt", "'_", ",_", "'", "sold", "\\u", "count", "'_", ",_", "'", "city", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "merchant", "'_", ",_", "'", "image", "\\u", "url", "'_", ",_", "'", "start", "'_", ",_", "'", "end", "'_", ",_", "'", "active", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sold", "\\u", "count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Computed", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sales", "\\u", "log", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Merc", "hant", "Serializer_", "(_", "serializers_", "._", "Model", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items", "\\u", "sold", "_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "items", "\\u", "sold", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sales", "\\u", "volume_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "sales", "\\u", "volume", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items", "\\u", "offered", "_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "items", "\\u", "offered", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "MER", "CHAN", "T", "\\u", "MODEL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Model", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ",_", "'", "name", "'_", ",_", "'", "lat", "'_", ",_", "'", "lon", "'_", ",_", "'", "address", "'_", ",_", "'", "phone", "'_", ",_", "'", "webs", "ite", "'_", ",_", "'", "email", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Computed", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "\\u", "sold", "'_", ",_", "'", "sales", "\\u", "volume", "'_", ",_", "'", "items", "\\u", "offered", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Site", "Serializer_", "(_", "serializers_", "._", "Model", "Serializer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "runs_", "=_", "serializers_", "._", "Field_", "(_", "source_", "=_", "'", "get", "\\u", "runs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "SITE", "\\u", "MODEL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Model", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ",_", "'", "name", "'_", ",_", "'", "url", "'_", ",_", "'", "spider", "\\u", "name", "'_", ",_", "'", "spider", "\\u", "enable", "d", "'_", ",_", "'", "countr", "y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Computed", " ", "fields_", "\\u\\u\\uNL\\u\\u\\u_", "'", "runs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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n\tdef manageEthernetRanges(request, server, totalMacRanges):\n\n\t\tjustUnsubscribed = []\n\t\tfor macRange in server.getSubscribedMacRangesNoGlobal():\n\t\t\ttry:\n\t\t\t\trequest.POST['subscribe_'+str(macRange.id)]\n\t\t\texcept:\n\t\t\t\tserver.unsubscribeToMacRange(macRange)\n\t\t\t\tjustUnsubscribed.append(macRange)\n\n\t\tfor macRange in totalMacRanges:\n\t\t\tif macRange not in (server.getSubscribedMacRangesNoGlobal() or justUnsubscribed):\n\t\t\t\ttry:\n\t\t\t\t\trequest.POST['subscribe_'+str(macRange.id)]\n\t\t\t\t\tserver.subscribeToMacRange(macRange)\n\t\t\t\texcept:\n\t\t\t\t\tpass", "metadata": "root.VTDriver.manageEthernetRanges", "header": "['class', 'VTDriver', '(', ')', ':', '___EOS___']", "index": 160 }, { "content": "\t@staticmethod\n\tdef manageIp4Ranges(request, server, totalIpRanges):\n\n\t\tjustUnsubscribed = []\n\t\tfor ipRange in server.getSubscribedIp4RangesNoGlobal():\n\t\t\t#if not ipRange.getIsGlobal():\n\t\t\ttry:\n\t\t\t\trequest.POST['subscribe_'+str(ipRange.id)]\n\t\t\texcept:\n\t\t\t\tserver.unsubscribeToIp4Range(ipRange)\n\t\t\t\tjustUnsubscribed.append(ipRange)\n\n\t\tfor ipRange in totalIpRanges:\n\t\t\tif ipRange not in (server.getSubscribedIp4RangesNoGlobal() or justUnsubscribed):\n\t\t\t\ttry:\n\t\t\t\t\trequest.POST['subscribe_'+str(ipRange.id)]\n\t\t\t\t\tserver.subscribeToIp4Range(ipRange)\n\t\t\t\texcept Exception as e:\n\t\t\t\t\tpass", "metadata": "root.VTDriver.manageIp4Ranges", "header": "['class', 'VTDriver', '(', ')', ':', '___EOS___']", "index": 179 } ]
[ { "span": "except:", "start_line": 167, "start_column": 3, "end_line": 167, "end_column": 10 }, { "span": "except:", "start_line": 176, "start_column": 4, "end_line": 176, "end_column": 11 }, { "span": "except:", "start_line": 187, "start_column": 3, "end_line": 187, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "VT", "Driver_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "manage", "Ether", "net", "Ranges_", "(_", "request_", ",_", "server_", ",_", "total", "Mac", "Ranges_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "just", "Unsu", "bsc", "ribe", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mac", "Range_", "in_", "server_", "._", "get", "Subscrib", "ed", "Mac", "Range", "s", "No", "Global_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "request_", "._", "POST_", "[_", "'", "subscribe", "\\u'_", "+_", "str_", "(_", "mac", "Range_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "server_", "._", "unsubscribe", "To", "Mac", "Range_", "(_", "mac", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "Unsu", "bsc", "ribe", "d_", "._", "append_", "(_", "mac", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mac", "Range_", "in_", "total", "Mac", "Ranges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mac", "Range_", "not_", "in_", "(_", "server_", "._", "get", "Subscrib", "ed", "Mac", "Range", "s", "No", "Global_", "(_", ")_", "or_", "just", "Unsu", "bsc", "ribe", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "request_", "._", "POST_", "[_", "'", "subscribe", "\\u'_", "+_", "str_", "(_", "mac", "Range_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "subscribe", "To", "Mac", "Range_", "(_", "mac", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "VT", "Driver_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "manage", "Ip", "4", "Ranges_", "(_", "request_", ",_", "server_", ",_", "total", "Ip", "Ranges_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "just", "Unsu", "bsc", "ribe", "d_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ip", "Range_", "in_", "server_", "._", "get", "Subscrib", "ed", "Ip", "4", "Range", "s", "No", "Global_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "not", " ", "ip", "Range", ".", "get", "Is", "Global", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "request_", "._", "POST_", "[_", "'", "subscribe", "\\u'_", "+_", "str_", "(_", "ip", "Range_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "server_", "._", "unsubscribe", "To", "Ip", "4", "Range_", "(_", "ip", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "just", "Unsu", "bsc", "ribe", "d_", "._", "append_", "(_", "ip", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ip", "Range_", "in_", "total", "Ip", "Ranges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "ip", "Range_", "not_", "in_", "(_", "server_", "._", "get", "Subscrib", "ed", "Ip", "4", "Range", "s", "No", "Global_", "(_", ")_", "or_", "just", "Unsu", "bsc", "ribe", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "request_", "._", "POST_", "[_", "'", "subscribe", "\\u'_", "+_", "str_", "(_", "ip", "Range_", "._", "id_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "subscribe", "To", "Ip", "4", "Range_", "(_", "ip", "Range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
circus-tent/circus/circus/tests/test_stream.py
[ { "content": " @skipIf(IS_WINDOWS, \"Streams not supported\")\n @tornado.testing.gen_test\n def test_timed_rotating_file_stream(self):\n yield self._start_arbiter()\n stream = TimedRotatingFileStream(self.stdout,\n rotate_when='H',\n rotate_interval='5',\n backup_count='3',\n utc='True')\n self.assertTrue(isinstance(stream._interval, int))\n self.assertTrue(isinstance(stream._backup_count, int))\n self.assertTrue(isinstance(stream._utc, bool))\n self.assertTrue(stream._suffix is not None)\n self.assertTrue(stream._ext_match is not None)\n self.assertTrue(stream._rollover_at > 0)\n yield self.stop_arbiter()\n stream.close()", "metadata": "root.TestWatcher.test_timed_rotating_file_stream", "header": "['class', 'TestWatcher', '(', 'TestCircus', ')', ':', '___EOS___']", "index": 89 } ]
[ { "span": "self.assertTrue(stream._suffix is not None)", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 51 }, { "span": "self.assertTrue(stream._ext_match is not None)", "start_line": 102, "start_column": 8, "end_line": 102, "end_column": 54 }, { "span": "self.assertTrue(stream._rollover_at > 0)", "start_line": 103, "start_column": 8, "end_line": 103, "end_column": 48 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Watcher", "_", "(_", "Test", "Circ", "us_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "skip", "If_", "(_", "IS", "\\u", "WINDOWS", "_", ",_", "\"", "Stream", "s", " ", "not", " ", "support", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "timed", "\\u", "rotati", "ng", "\\u", "file", "\\u", "stream_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "\\u", "start", "\\u", "arb", "iter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "=_", "Time", "d", "Rot", "ati", "ng", "File", "Stream_", "(_", "self_", "._", "stdout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rota", "te", "\\u", "when_", "=_", "'", "H", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rota", "te", "\\u", "interval_", "=_", "'", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backup", "\\u", "count_", "=_", "'", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "utc_", "=_", "'", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "stream_", "._", "\\u", "interval_", ",_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "stream_", "._", "\\u", "backup", "\\u", "count_", ",_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "stream_", "._", "\\u", "utc_", ",_", "bool_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "stream_", "._", "\\u", "suffix_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "stream_", "._", "\\u", "ext", "\\u", "match_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "stream_", "._", "\\u", "rollo", "ver", "\\u", "at_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "stop", "\\u", "arb", "iter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
turbulenz/turbulenz_local/turbulenz_local/lib/deploy.py
[ { "content": " def batch_check_files(self, files, checked_queue_put):\n urlopen = self.hub_pool.urlopen\n base_url = self._base_check_url\n url_format = self._check_url_format\n get_upload_token = _get_upload_file_token\n timeout = self.hub_timeout\n if self._batch_checks:\n query = '&'.join((url_format % (get_upload_token(i, f[1]), f[3], f[2])) for i, f in enumerate(files))\n r = urlopen('GET',\n base_url + query,\n redirect=False,\n assert_same_host=False,\n timeout=timeout)\n if r.status == 200:\n # pylint: disable=E1103\n missing_files = set(json_loads(r.data).get('missing', []))\n # pylint: enable=E1103\n for i, f in enumerate(files):\n if get_upload_token(i, f[1]) in missing_files:\n # Update meta data cache and upload\n checked_queue_put(f)\n else:\n # Only needs to update meta data cache\n checked_queue_put((f[1], f[2], f[3], f[4], f[5]))\n return\n\n else:\n f = files.pop(0)\n if r.status == 304:\n # First one only needs to update meta data cache\n checked_queue_put((f[1], f[2], f[3], f[4], f[5]))\n elif r.status == 404:\n # First one needs to update meta data cache and to upload\n checked_queue_put(f)\n else:\n raise Exception(r.reason)\n if len(files) == 1:\n return\n # Legacy format, check one by one...\n self._batch_checks = False\n r = None\n\n for f in files:\n query = url_format % (basename(f[1]), f[3], f[2])\n if urlopen('GET',\n base_url + query,\n redirect=False,\n assert_same_host=False,\n timeout=timeout).status == 304:\n # Only needs to update meta data cache\n checked_queue_put((f[1], f[2], f[3], f[4], f[5]))\n else:\n # Update meta data cache and upload\n checked_queue_put(f)", "metadata": "root.Deployment.batch_check_files", "header": "['class', 'Deployment', '(', 'object', ')', ':', '___EOS___']", "index": 196 } ]
[ { "span": "r ", "start_line": 236, "start_column": 16, "end_line": 236, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Deployment", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "batch", "\\u", "check", "\\u", "files_", "(_", "self_", ",_", "files_", ",_", "checke", "d\\u", "queue", "\\u", "put_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urlopen_", "=_", "self_", "._", "hub", "\\u", "pool_", "._", "urlopen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "url_", "=_", "self_", "._", "\\u", "base", "\\u", "check", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "\\u", "format_", "=_", "self_", "._", "\\u", "check", "\\u", "url", "\\u", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "upload", "\\u", "token_", "=_", "\\u", "get", "\\u", "upload", "\\u", "file", "\\u", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeout_", "=_", "self_", "._", "hub", "\\u", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "batch", "\\u", "checks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "'&'_", "._", "join_", "(_", "(_", "url", "\\u", "format_", "%_", "(_", "get", "\\u", "upload", "\\u", "token_", "(_", "i_", ",_", "f_", "[_", "1_", "]_", ")_", ",_", "f_", "[_", "3_", "]_", ",_", "f_", "[_", "2_", "]_", ")_", ")_", "for_", "i_", ",_", "f_", "in_", "enumerate_", "(_", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "urlopen_", "(_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "+_", "query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirect_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "same", "\\u", "host_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "status_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "disable", "=", "E1", "103_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missi", "ng", "\\u", "files_", "=_", "set_", "(_", "json", "\\u", "loads_", "(_", "r_", "._", "data_", ")_", "._", "get_", "(_", "'", "missi", "ng", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pylint", ":", " ", "enable", "=", "E1", "103_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", ",_", "f_", "in_", "enumerate_", "(_", "files_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "get", "\\u", "upload", "\\u", "token_", "(_", "i_", ",_", "f_", "[_", "1_", "]_", ")_", "in_", "missi", "ng", "\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "meta", " ", "data", " ", "cache", " ", "and", " ", "upload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "checke", "d\\u", "queue", "\\u", "put_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "need", "s", " ", "to", " ", "update", " ", "meta", " ", "data", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "checke", "d\\u", "queue", "\\u", "put_", "(_", "(_", "f_", "[_", "1_", "]_", ",_", "f_", "[_", "2_", "]_", ",_", "f_", "[_", "3_", "]_", ",_", "f_", "[_", "4_", "]_", ",_", "f_", "[_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "files_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", "._", "status_", "==_", "304_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "one", " ", "only", " ", "need", "s", " ", "to", " ", "update", " ", "meta", " ", "data", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "checke", "d\\u", "queue", "\\u", "put_", "(_", "(_", "f_", "[_", "1_", "]_", ",_", "f_", "[_", "2_", "]_", ",_", "f_", "[_", "3_", "]_", ",_", "f_", "[_", "4_", "]_", ",_", "f_", "[_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "r_", "._", "status_", "==_", "404_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "one", " ", "need", "s", " ", "to", " ", "update", " ", "meta", " ", "data", " ", "cache", " ", "and", " ", "to", " ", "upload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "checke", "d\\u", "queue", "\\u", "put_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "r_", "._", "reason_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "files_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Leg", "ac", "y", " ", "format", ",", " ", "check", " ", "one", " ", "by", " ", "one", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "batch", "\\u", "checks_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "url", "\\u", "format_", "%_", "(_", "basename_", "(_", "f_", "[_", "1_", "]_", ")_", ",_", "f_", "[_", "3_", "]_", ",_", "f_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "urlopen_", "(_", "'", "GET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "+_", "query_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "redirect_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "same", "\\u", "host_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "timeout_", ")_", "._", "status_", "==_", "304_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "need", "s", " ", "to", " ", "update", " ", "meta", " ", "data", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checke", "d\\u", "queue", "\\u", "put_", "(_", "(_", "f_", "[_", "1_", "]_", ",_", "f_", "[_", "2_", "]_", ",_", "f_", "[_", "3_", "]_", ",_", "f_", "[_", "4_", "]_", ",_", "f_", "[_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "meta", " ", "data", " ", "cache", " ", "and", " ", "upload_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checke", "d\\u", "queue", "\\u", "put_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ufora/ufora/test_scripts/gpu/gpuPythonTests.py
[ { "content": "# Copyright 2015 Ufora Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport unittest\nimport pyfora\nimport ufora.config.Setup as Setup\nimport ufora.FORA.CUDA.GpuTestCases as GpuTestCases\nimport ufora.FORA.python.FORA as FORA\n\n\nif __name__ == '__main__':\n import ufora.config.Mainline as Mainline\n Mainline.UnitTestMainline([FORA])\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GpuPythonTests(\n unittest.TestCase,\n GpuTestCases.GpuTestCases\n ):\n pass", "metadata": "root.GpuPythonTests", "header": "['module', '___EOS___']", "index": 20 } ]
[ { "span": "import pyfora", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 13 }, { "span": "import ufora.config.Setup as Setup", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 34 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "201", "5", " ", "Uf", "ora", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyf", "ora", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "config_", "._", "Setup_", "as_", "Setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "CU", "DA_", "._", "Gp", "u", "Test", "Cases_", "as_", "Gp", "u", "Test", "Cases_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ufo", "ra_", "._", "FOR", "A_", "._", "python_", "._", "FOR", "A_", "as_", "FOR", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "ufo", "ra_", "._", "config_", "._", "Main", "line_", "as_", "Main", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Main", "line_", "._", "Unit", "Test", "Main", "line_", "(_", "[_", "FOR", "A_", "]_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Gp", "u", "Pyth", "on", "Tests_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "unittest_", "._", "Test", "Case_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gp", "u", "Test", "Cases_", "._", "Gp", "u", "Test", "Cases_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
taoliu/taolib/Assoc/inout.py
[ { "content": " def max(self,chrom=''):\n \"\"\"Return the max of wig\n \n Parameters:\n 1. chrom: if '', return the max of the whole wig; otherwise, return the maxi of the chrom\n \"\"\"\n \n if chrom:\n try: \n return max(self[chrom][1])\n except (KeyError, IndexError):\n return None\n else:\n mx=None\n for chrom in self.get_chroms():\n if mx==None:\n mx=max(self[chrom][1])\n else:\n mx=max(mx, max(self[chrom][1]))\n return mx", "metadata": "root.Wig.max", "header": "['class', 'Wig', ':', '___EOS___']", "index": 1069 }, { "content": " def min(self,chrom=''):\n \"\"\"Return the min of wig\n \n Parameters:\n 1. chrom: if '', return the max of the whole wig; otherwise, return the maxi of the chrom\n \"\"\"\n \n if chrom:\n try: \n return min(self[chrom][1])\n except (KeyError, IndexError):\n return None\n else:\n mn=None\n for chrom in self.get_chroms():\n if mn==None:\n mn=min(self[chrom][1])\n else:\n mn=min(mn, min(self[chrom][1]))\n return mn", "metadata": "root.Wig.min", "header": "['class', 'Wig', ':', '___EOS___']", "index": 1091 } ]
[ { "span": "mx==None:", "start_line": 1084, "start_column": 19, "end_line": 1084, "end_column": 27 }, { "span": "mn==None:", "start_line": 1106, "start_column": 19, "end_line": 1106, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Wi", "g_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "max_", "(_", "self_", ",_", "chrom_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "max", " ", "of", " ", "wig", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "chrom", ":", " ", "if", " ", "''", ",", " ", "return", " ", "the", " ", "max", " ", "of", " ", "the", " ", "whole", " ", "wig", ";", " ", "other", "wis", "e", ",", " ", "return", " ", "the", " ", "maxi", " ", "of", " ", "the", " ", "chrom", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "chrom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "max_", "(_", "self_", "[_", "chrom_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "Error_", ",_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mx_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chrom_", "in_", "self_", "._", "get", "\\u", "chrom", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mx_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mx_", "=_", "max_", "(_", "self_", "[_", "chrom_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mx_", "=_", "max_", "(_", "mx_", ",_", "max_", "(_", "self_", "[_", "chrom_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Wi", "g_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "min_", "(_", "self_", ",_", "chrom_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "min", " ", "of", " ", "wig", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "chrom", ":", " ", "if", " ", "''", ",", " ", "return", " ", "the", " ", "max", " ", "of", " ", "the", " ", "whole", " ", "wig", ";", " ", "other", "wis", "e", ",", " ", "return", " ", "the", " ", "maxi", " ", "of", " ", "the", " ", "chrom", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "chrom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "min_", "(_", "self_", "[_", "chrom_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "Error_", ",_", "Index", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chrom_", "in_", "self_", "._", "get", "\\u", "chrom", "s_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mn_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mn_", "=_", "min_", "(_", "self_", "[_", "chrom_", "]_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mn_", "=_", "min_", "(_", "mn_", ",_", "min_", "(_", "self_", "[_", "chrom_", "]_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mn_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kangasbros/django-bitcoin/django_bitcoin/utils.py
[ { "content": "# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8\n\nimport os\nimport json\nimport jsonrpc\nimport sys\nimport urllib\nimport urllib2\nimport random\nimport hashlib\nimport base64\nfrom decimal import Decimal\nimport decimal\nimport warnings\n\nfrom django.core.cache import cache\nfrom django.db import transaction\n\nfrom django_bitcoin import settings\nfrom django_bitcoin import currency\n\nfrom pywallet import privkey2address\n\n# BITCOIND COMMANDS\n\n\n\n\n\n\n\nbitcoind = BitcoindConnection(settings.BITCOIND_CONNECTION_STRING,\n settings.MAIN_ACCOUNT)\n\n\n\n\n\n# --------\n\n\n\n\n# ------\n\n# generate a random hash\n\nimport string\n\nALPHABET = string.ascii_uppercase + string.ascii_lowercase + \\\n string.digits + '_-'\nALPHABET_REVERSE = dict((c, i) for (i, c) in enumerate(ALPHABET))\nBASE = len(ALPHABET)\nSIGN_CHARACTER = '%'\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def quantitize_bitcoin(d):\n return d.quantize(Decimal(\"0.00000001\"))", "metadata": "root.quantitize_bitcoin", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def decimal_float(d):\n return float(d.quantize(Decimal(\"0.00000001\")))", "metadata": "root.decimal_float", "header": "['module', '___EOS___']", "index": 30 }, { "content": "class BitcoindConnection(object):\n\n\n\n\n\n\n # if address_to is defined, also empties the private key to that address\n", "metadata": "root.BitcoindConnection", "header": "['module', '___EOS___']", "index": 34 }, { "content": " def __init__(self, connection_string, main_account_name):\n self.bitcoind_api = jsonrpc.ServiceProxy(connection_string)\n self.account_name = main_account_name", "metadata": "root.BitcoindConnection.__init__", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def total_received(self, address, minconf=settings.BITCOIN_MINIMUM_CONFIRMATIONS):\n if settings.BITCOIN_TRANSACTION_CACHING:\n cache_key=address+\"_\"+str(minconf)\n cached = cache.get(cache_key)\n if cached!=None:\n return cached\n cached=decimal.Decimal(\n self.bitcoind_api.getreceivedbyaddress(address, minconf))\n cache.set(cache_key, cached, 5)\n return cached\n return decimal.Decimal(\n self.bitcoind_api.getreceivedbyaddress(address, minconf))", "metadata": "root.BitcoindConnection.total_received", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " def send(self, address, amount, *args, **kwargs):\n #print \"sending\", address, amount\n return self.bitcoind_api.sendtoaddress(address, float(amount), *args, **kwargs)", "metadata": "root.BitcoindConnection.send", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def sendmany(self, address_amount_dict, *args, **kwargs):\n #print \"sending\", address, amount\n return self.bitcoind_api.sendmany(self.account_name, address_amount_dict, *args, **kwargs)", "metadata": "root.BitcoindConnection.sendmany", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 56 }, { "content": " def create_address(self, for_account=None, *args, **kwargs):\n return self.bitcoind_api.getnewaddress(\n for_account or self.account_name, *args, **kwargs)", "metadata": "root.BitcoindConnection.create_address", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def gettransaction(self, txid, *args, **kwargs):\n # dir (self.bitcoind_api)\n return self.bitcoind_api.gettransaction(txid, *args, **kwargs)", "metadata": "root.BitcoindConnection.gettransaction", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def importprivatekey(self, key):\n # import private key functionality here later\n # NOTE: only\n label = \"import\"\n address_from = privkey2address(key)\n if not address_from or not address_from.startswith(\"1\"):\n print address_from\n return None\n # print address_from\n try:\n self.bitcoind_api.importprivkey(key, label)\n except jsonrpc.JSONRPCException:\n pass\n unspent_transactions = self.bitcoind_api.listunspent(1, 9999999, [address_from])\n return (address_from, quantitize_bitcoin(Decimal(sum([Decimal(x['amount']) for x in unspent_transactions]))))", "metadata": "root.BitcoindConnection.importprivatekey", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 69 }, { "content": " def redeemprivatekey(self, key, address_from, address_to):\n if type(address_to) == str or type(address_to) == unicode:\n address_to = ((address_to, None),)\n if address_from != privkey2address(key):\n return None\n unspent_transactions = self.bitcoind_api.listunspent(1, 9999999, [address_from])\n tot_amount = sum([Decimal(x['amount']) for x in unspent_transactions])\n tot_fee = len(unspent_transactions) * settings.BITCOIN_PRIVKEY_FEE\n tot_spend = tot_fee\n if tot_amount > tot_spend:\n final_arr = {}\n for addr in address_to:\n if addr[1] and addr[1]<0:\n raise Exception(\"No negative spend values allowed\")\n if addr[1] and tot_amount > addr[1] + tot_spend:\n final_arr[addr[0]] = decimal_float(addr[1])\n tot_spend += addr[1]\n elif not addr[1] and tot_amount > tot_spend:\n final_arr[addr[0]] = decimal_float((tot_amount - tot_spend))\n break\n else:\n return None # raise Exception(\"Invalid amount parameters\")\n # print final_arr\n # print unspent_transactions\n spend_transactions = [{\"txid\": ut['txid'], \"vout\": ut['vout']} for ut in unspent_transactions]\n spend_transactions_sign = [{\"txid\": ut['txid'], \"vout\": ut['vout'], \"scriptPubKey\": ut['scriptPubKey']} for ut in unspent_transactions]\n raw_transaction = self.bitcoind_api.createrawtransaction(spend_transactions, final_arr)\n raw_transaction_signed = self.bitcoind_api.signrawtransaction(raw_transaction, spend_transactions_sign, [key])\n # print raw_transaction, raw_transaction_signed\n return self.bitcoind_api.sendrawtransaction(raw_transaction_signed['hex'])\n else:\n return None\n\n # return self.bitcoind_api.gettransaction(txid, *args, **kwargs)", "metadata": "root.BitcoindConnection.redeemprivatekey", "header": "['class', 'BitcoindConnection', '(', 'object', ')', ':', '___EOS___']", "index": 85 }, { "content": "def bitcoin_getnewaddress(account_name=None):\n warnings.warn(\"Use bitcoind.create_address(...) instead\",\n DeprecationWarning)\n return bitcoind.create_address(account_name=account_name)", "metadata": "root.bitcoin_getnewaddress", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def bitcoin_getbalance(address, minconf=1):\n warnings.warn(\"Use bitcoind.total_received(...) instead\",\n DeprecationWarning)\n return bitcoind.total_received(address, minconf)", "metadata": "root.bitcoin_getbalance", "header": "['module', '___EOS___']", "index": 128 }, { "content": "def bitcoin_getreceived(address, minconf=settings.BITCOIN_MINIMUM_CONFIRMATIONS):\n warnings.warn(\"Use bitcoind.total_received(...) instead\",\n DeprecationWarning)\n return bitcoind.total_received(address, minconf)", "metadata": "root.bitcoin_getreceived", "header": "['module', '___EOS___']", "index": 133 }, { "content": "def bitcoin_sendtoaddress(address, amount):\n warnings.warn(\"Use bitcoind.send(...) instead\",\n DeprecationWarning)\n return bitcoind.send(address, amount)", "metadata": "root.bitcoin_sendtoaddress", "header": "['module', '___EOS___']", "index": 138 }, { "content": "def bitcoinprice_usd():\n \"\"\"return bitcoin price from any service we can get it\"\"\"\n warnings.warn(\"Use django_bitcoin.currency.exchange.get_rate('USD')\",\n DeprecationWarning)\n return {\"24h\": currency.exchange.get_rate(\"USD\")}", "metadata": "root.bitcoinprice_usd", "header": "['module', '___EOS___']", "index": 145 }, { "content": "def bitcoinprice_eur():\n warnings.warn(\"Use django_bitcoin.currency.exchange.get_rate('EUR')\",\n DeprecationWarning)\n return {\"24h\": currency.exchange.get_rate(\"EUR\")}", "metadata": "root.bitcoinprice_eur", "header": "['module', '___EOS___']", "index": 151 }, { "content": "def bitcoinprice(currency):\n warnings.warn(\"Use django_bitcoin.currency.exchange.get_rate(currency)\",\n DeprecationWarning)\n return currency.exchange.get_rate(currency)", "metadata": "root.bitcoinprice", "header": "['module', '___EOS___']", "index": 156 }, { "content": "def generateuniquehash(length=43, extradata=''):\n # cryptographically safe random\n r=str(os.urandom(64))\n m = hashlib.sha256()\n m.update(r+str(extradata))\n key=m.digest()\n key=base64.urlsafe_b64encode(key)\n return key[:min(length, 43)]", "metadata": "root.generateuniquehash", "header": "['module', '___EOS___']", "index": 164 }, { "content": "def int2base64(n):\n if n < 0:\n return SIGN_CHARACTER + num_encode(-n)\n s = []\n while True:\n n, r = divmod(n, BASE)\n s.append(ALPHABET[r])\n if n == 0: break\n return ''.join(reversed(s))", "metadata": "root.int2base64", "header": "['module', '___EOS___']", "index": 181 }, { "content": "def base642int(s):\n if s[0] == SIGN_CHARACTER:\n return -num_decode(s[1:])\n n = 0\n for c in s:\n n = n * BASE + ALPHABET_REVERSE[c]\n return n", "metadata": "root.base642int", "header": "['module', '___EOS___']", "index": 191 } ]
[ { "span": "import json", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 11 }, { "span": "import sys", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 }, { "span": "import urllib", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 13 }, { "span": "import urllib2", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 14 }, { "span": "import random", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "from django.db import transaction", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "expand", "tab", " ", "autoi", "nden", "t", " ", "shift", "widt", "h", "=", "4", " ", "file", "encoding", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "jsonrpc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "cache_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "\\u", "bitcoin", "_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "bitcoin", "_", "import_", "currency_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyw", "alle", "t_", "import_", "priv", "key", "2a", "ddress", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BIT", "COI", "ND", " ", "COMMANDS_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bitcoin", "d_", "=_", "Bit", "coin", "d", "Connection_", "(_", "settings_", "._", "BIT", "COI", "ND", "\\u", "CONNECTION", "\\u", "STRING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "MAIN", "\\u", "ACCOUNT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generat", "e", " ", "a", " ", "random", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ALPHA", "BET", "_", "=_", "string_", "._", "ascii", "\\u", "uppercase_", "+_", "string_", "._", "ascii", "\\u", "lowercase_", "+_", "string_", "._", "digits_", "+_", "'\\u", "-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALPHA", "BET", "\\u", "REVERSE", "_", "=_", "dict_", "(_", "(_", "c_", ",_", "i_", ")_", "for_", "(_", "i_", ",_", "c_", ")_", "in_", "enumerate_", "(_", "ALPHA", "BET", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BASE_", "=_", "len_", "(_", "ALPHA", "BET", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SIGN", "\\u", "CHARACTER", "_", "=_", "'%'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "quanti", "tize", "\\u", "bitcoin", "_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "quantize", "_", "(_", "Decimal_", "(_", "\"", "0.0000000", "1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decima", "l\\u", "float_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "d_", "._", "quantize", "_", "(_", "Decimal_", "(_", "\"", "0.0000000", "1", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "address", "\\u", "to", " ", "is", " ", "defin", "ed", ",", " ", "als", "o", " ", "emp", "ties", " ", "the", " ", "private", " ", "key", " ", "to", " ", "tha", "t", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "connecti", "on", "\\u", "string_", ",_", "main", "\\u", "account", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bitcoin", "d\\u", "api_", "=_", "jsonrpc", "_", "._", "Service", "Proxy_", "(_", "connecti", "on", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "account", "\\u", "name_", "=_", "main", "\\u", "account", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "total", "\\u", "received_", "(_", "self_", ",_", "address_", ",_", "minco", "nf_", "=_", "settings_", "._", "BIT", "COI", "N", "\\u", "MINIM", "UM", "\\u", "CONFIRM", "ATION", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "settings_", "._", "BIT", "COI", "N", "\\u", "TRANSACTION", "\\u", "CAC", "HING", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "\\u", "key_", "=_", "address_", "+_", "\"\\u\"_", "+_", "str_", "(_", "minco", "nf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cached_", "=_", "cache_", "._", "get_", "(_", "cache", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cached_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cached_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cached_", "=_", "decimal_", "._", "Decimal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "getre", "ce", "ive", "db", "ya", "ddress", "_", "(_", "address_", ",_", "minco", "nf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "._", "set_", "(_", "cache", "\\u", "key_", ",_", "cached_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cached_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decimal_", "._", "Decimal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "getre", "ce", "ive", "db", "ya", "ddress", "_", "(_", "address_", ",_", "minco", "nf_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "address_", ",_", "amount_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "sendin", "g", "\",", " ", "address", ",", " ", "amount_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "send", "toadd", "ress_", "(_", "address_", ",_", "float_", "(_", "amount_", ")_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sendm", "any_", "(_", "self_", ",_", "address", "\\u", "amo", "unt", "\\u", "dict_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "sendin", "g", "\",", " ", "address", ",", " ", "amount_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "sendm", "any_", "(_", "self_", "._", "account", "\\u", "name_", ",_", "address", "\\u", "amo", "unt", "\\u", "dict_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "address_", "(_", "self_", ",_", "for", "\\u", "account_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "getne", "wad", "dress", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "for", "\\u", "account_", "or_", "self_", "._", "account", "\\u", "name_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gett", "ransact", "ion_", "(_", "self_", ",_", "txid_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dir", " ", "(", "self", ".", "bitcoin", "d\\u", "api", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "gett", "ransact", "ion_", "(_", "txid_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "private", "key_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "import", " ", "private", " ", "key", " ", "functional", "it", "y", " ", "here", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "\"", "import", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "address", "\\u", "from_", "=_", "priv", "key", "2a", "ddress", "_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "address", "\\u", "from_", "or_", "not_", "address", "\\u", "from_", "._", "startswith_", "(_", "\"", "1", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "address", "\\u", "from_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "address", "\\u", "from_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bitcoin", "d\\u", "api_", "._", "import", "privkey_", "(_", "key_", ",_", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "jsonrpc", "_", "._", "JSONR", "PC", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unspe", "nt", "\\u", "transactions_", "=_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "list", "unspe", "nt_", "(_", "1_", ",_", "9999999", "_", ",_", "[_", "address", "\\u", "from_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "address", "\\u", "from_", ",_", "quanti", "tize", "\\u", "bitcoin", "_", "(_", "Decimal_", "(_", "sum_", "(_", "[_", "Decimal_", "(_", "x_", "[_", "'", "amo", "unt", "'_", "]_", ")_", "for_", "x_", "in_", "unspe", "nt", "\\u", "transactions_", "]_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "coin", "d", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rede", "emp", "riv", "ate", "key_", "(_", "self_", ",_", "key_", ",_", "address", "\\u", "from_", ",_", "address", "\\u", "to_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "address", "\\u", "to_", ")_", "==_", "str_", "or_", "type_", "(_", "address", "\\u", "to_", ")_", "==_", "unicode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "address", "\\u", "to_", "=_", "(_", "(_", "address", "\\u", "to_", ",_", "None_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "address", "\\u", "from_", "!=_", "priv", "key", "2a", "ddress", "_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unspe", "nt", "\\u", "transactions_", "=_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "list", "unspe", "nt_", "(_", "1_", ",_", "9999999", "_", ",_", "[_", "address", "\\u", "from_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "\\u", "amount_", "=_", "sum_", "(_", "[_", "Decimal_", "(_", "x_", "[_", "'", "amo", "unt", "'_", "]_", ")_", "for_", "x_", "in_", "unspe", "nt", "\\u", "transactions_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "\\u", "fee_", "=_", "len_", "(_", "unspe", "nt", "\\u", "transactions_", ")_", "*_", "settings_", "._", "BIT", "COI", "N", "\\u", "PRIV", "KEY", "\\u", "FE", "E_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "\\u", "spend", "_", "=_", "tot", "\\u", "fee_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tot", "\\u", "amount_", ">_", "tot", "\\u", "spend", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "final", "\\u", "arr_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "addr_", "in_", "address", "\\u", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "addr_", "[_", "1_", "]_", "and_", "addr_", "[_", "1_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "\"", "No", " ", "negati", "ve", " ", "spend", " ", "values", " ", "allow", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "addr_", "[_", "1_", "]_", "and_", "tot", "\\u", "amount_", ">_", "addr_", "[_", "1_", "]_", "+_", "tot", "\\u", "spend", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "final", "\\u", "arr_", "[_", "addr_", "[_", "0_", "]_", "]_", "=_", "decima", "l\\u", "float_", "(_", "addr_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tot", "\\u", "spend", "_", "+=_", "addr_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "addr_", "[_", "1_", "]_", "and_", "tot", "\\u", "amount_", ">_", "tot", "\\u", "spend", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "final", "\\u", "arr_", "[_", "addr_", "[_", "0_", "]_", "]_", "=_", "decima", "l\\u", "float_", "(_", "(_", "tot", "\\u", "amount_", "-_", "tot", "\\u", "spend", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "None_", "#", " ", "raise", " ", "Except", "ion", "(\"", "Inva", "lid", " ", "amo", "unt", " ", "parameter", "s", "\")", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "final", "\\u", "arr_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "unspe", "nt", "\\u", "transactions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "spend", "\\u", "transactions_", "=_", "[_", "{_", "\"", "txi", "d", "\"_", ":_", "ut_", "[_", "'", "txi", "d", "'_", "]_", ",_", "\"", "vout", "\"_", ":_", "ut_", "[_", "'", "vout", "'_", "]_", "}_", "for_", "ut_", "in_", "unspe", "nt", "\\u", "transactions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spend", "\\u", "transaction", "s", "\\u", "sign_", "=_", "[_", "{_", "\"", "txi", "d", "\"_", ":_", "ut_", "[_", "'", "txi", "d", "'_", "]_", ",_", "\"", "vout", "\"_", ":_", "ut_", "[_", "'", "vout", "'_", "]_", ",_", "\"", "script", "Pub", "Key", "\"_", ":_", "ut_", "[_", "'", "script", "Pub", "Key", "'_", "]_", "}_", "for_", "ut_", "in_", "unspe", "nt", "\\u", "transactions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "transaction_", "=_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "create", "rawt", "ransact", "ion_", "(_", "spend", "\\u", "transactions_", ",_", "final", "\\u", "arr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "transaction", "\\u", "signed_", "=_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "sign", "rawt", "ransact", "ion_", "(_", "raw", "\\u", "transaction_", ",_", "spend", "\\u", "transaction", "s", "\\u", "sign_", ",_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "raw", "\\u", "transaction", ",", " ", "raw", "\\u", "transaction", "\\u", "signed_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "bitcoin", "d\\u", "api_", "._", "send", "rawt", "ransact", "ion_", "(_", "raw", "\\u", "transaction", "\\u", "signed_", "[_", "'", "hex", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "self", ".", "bitcoin", "d\\u", "api", ".", "gett", "ransact", "ion", "(", "txi", "d", ",", " ", "*", "args", ",", " ", "**", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "bitcoin", "\\u", "getne", "wad", "dress", "_", "(_", "account", "\\u", "name_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "bitcoin", "d", ".", "create", "\\u", "address", "(...)", " ", "inst", "ead", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bitcoin", "d_", "._", "create", "\\u", "address_", "(_", "account", "\\u", "name_", "=_", "account", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bitcoin", "\\u", "getb", "alance", "_", "(_", "address_", ",_", "minco", "nf_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "bitcoin", "d", ".", "total", "\\u", "receive", "d", "(...)", " ", "inst", "ead", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bitcoin", "d_", "._", "total", "\\u", "received_", "(_", "address_", ",_", "minco", "nf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bitcoin", "\\u", "getre", "ce", "ive", "d_", "(_", "address_", ",_", "minco", "nf_", "=_", "settings_", "._", "BIT", "COI", "N", "\\u", "MINIM", "UM", "\\u", "CONFIRM", "ATION", "S_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "bitcoin", "d", ".", "total", "\\u", "receive", "d", "(...)", " ", "inst", "ead", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bitcoin", "d_", "._", "total", "\\u", "received_", "(_", "address_", ",_", "minco", "nf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bitcoin", "\\u", "send", "toadd", "ress_", "(_", "address_", ",_", "amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "bitcoin", "d", ".", "send", "(...)", " ", "inst", "ead", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "bitcoin", "d_", "._", "send_", "(_", "address_", ",_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bitcoin", "price", "\\u", "usd", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "return", " ", "bitcoin", " ", "price", " ", "from", " ", "any", " ", "service", " ", "we", " ", "can", " ", "get", " ", "it", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "django", "\\u", "bitcoin", ".", "curr", "ency", ".", "exchange", ".", "get", "\\u", "rate", "('", "US", "D", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "24", "h", "\"_", ":_", "currency_", "._", "exchange_", "._", "get", "\\u", "rate_", "(_", "\"", "US", "D", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bitcoin", "price", "\\u", "eur_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "django", "\\u", "bitcoin", ".", "curr", "ency", ".", "exchange", ".", "get", "\\u", "rate", "('", "EU", "R", "')\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\"", "24", "h", "\"_", ":_", "currency_", "._", "exchange_", "._", "get", "\\u", "rate_", "(_", "\"", "EU", "R", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "bitcoin", "price_", "(_", "currency_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Us", "e", " ", "django", "\\u", "bitcoin", ".", "curr", "ency", ".", "exchange", ".", "get", "\\u", "rate", "(", "curr", "ency", ")\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "currency_", "._", "exchange_", "._", "get", "\\u", "rate_", "(_", "currency_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "eu", "ni", "que", "hash_", "(_", "length_", "=_", "43_", ",_", "extra", "data_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "crypto", "graphical", "ly", " ", "safe", " ", "random_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "str_", "(_", "os_", "._", "urandom_", "(_", "64_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "=_", "hashlib_", "._", "sha256_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "update_", "(_", "r_", "+_", "str_", "(_", "extra", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "m_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "base64_", "._", "urlsafe", "\\u", "b64encode_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "key_", "[_", ":_", "min_", "(_", "length_", ",_", "43_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "int2", "base64_", "(_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "SIGN", "\\u", "CHARACTER", "_", "+_", "num", "\\u", "encode_", "(_", "-_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", ",_", "r_", "=_", "divmod_", "(_", "n_", ",_", "BASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "append_", "(_", "ALPHA", "BET", "_", "[_", "r_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "==_", "0_", ":_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "''_", "._", "join_", "(_", "reversed_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "base64", "2in", "t_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "s_", "[_", "0_", "]_", "==_", "SIGN", "\\u", "CHARACTER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "-_", "num", "\\u", "decode_", "(_", "s_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "n_", "*_", "BASE_", "+_", "ALPHA", "BET", "\\u", "REVERSE", "_", "[_", "c_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "n_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
daeilkim/refinery/refinery/bnpy/bnpy-dev/bnpy/obsmodel/ZMGaussObsModel.py
[ { "content": "'''\nZMGaussObsModel.py\n\nMultivariate, zero-mean Gaussian observation model for bnpy.\n\nContains information for accessing and updating\n* data-generating parameters for all K components \n* parameters for the prior distribution on these data-generating parameters\n'''\nimport numpy as np\nimport scipy.linalg\nimport os\nimport copy\n\nfrom ObsModel import ObsModel\nfrom bnpy.distr import ZMGaussDistr\nfrom bnpy.distr import WishartDistr\nfrom bnpy.util import np2flatstr, dotATA, dotATB, dotABT\nfrom bnpy.util import LOGPI, LOGTWOPI, LOGTWO, EPS\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ZMGaussObsModel(ObsModel):\n\n ######################################################### Constructors\n #########################################################\n\n\n\n ######################################################### Accessors\n ######################################################### \n \n\n ######################################################### Local Params\n ######################################################### E-step\n ''' Inherited directly from ObsModel.py\n '''\n\n ######################################################### Suff Stats\n #########################################################\n\n ######################################################### Global Params\n ######################################################### M-step\n\n\n\n\n ######################################################### Evidence\n ######################################################### \n\n \n \n \n \n\n\n ######################################################### I/O Utils\n ######################################################### for humans\n \n \n\n ######################################################### I/O Utils\n ######################################################### for machines", "metadata": "root.ZMGaussObsModel", "header": "['module', '___EOS___']", "index": 20 }, { "content": " def __init__(self, inferType, D=None, obsPrior=None, min_covar=None):\n self.inferType = inferType\n self.D = D\n self.obsPrior = obsPrior\n self.comp = list()\n self.K = 0\n if min_covar is not None:\n self.min_covar = min_covar", "metadata": "root.ZMGaussObsModel.__init__", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 24 }, { "content": " @classmethod\n def CreateWithPrior(cls, inferType, priorArgDict, Data):\n D = Data.dim\n if inferType == 'EM':\n obsPrior = None\n return cls(inferType, D, obsPrior, min_covar=priorArgDict['min_covar'])\n else:\n obsPrior = WishartDistr.CreateAsPrior(priorArgDict, Data)\n return cls(inferType, D, obsPrior)", "metadata": "root.ZMGaussObsModel.CreateWithPrior", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 33 }, { "content": " @classmethod\n def CreateWithAllComps(cls, oDict, obsPrior, compDictList):\n if 'min_covar' in oDict:\n mc = oDict['min_covar']\n self = cls(oDict['inferType'], obsPrior=obsPrior, min_covar=mc)\n else:\n self = cls(oDict['inferType'], obsPrior=obsPrior)\n self.K = len(compDictList)\n self.comp = [None for k in range(self.K)]\n if self.inferType == 'EM':\n for k in xrange(self.K):\n self.comp[k] = ZMGaussDistr( **compDictList[k] )\n self.D = self.comp[k].D\n elif self.inferType.count('VB') > 0:\n for k in xrange(self.K):\n self.comp[k] = WishartDistr( **compDictList[k] )\n self.D = self.comp[k].D\n return self", "metadata": "root.ZMGaussObsModel.CreateWithAllComps", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 43 }, { "content": " def get_mean_for_comp( self, k):\n return np.zeros( self.D )", "metadata": "root.ZMGaussObsModel.get_mean_for_comp", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 64 }, { "content": " def get_covar_mat_for_comp(self, k):\n return self.comp[k].ECovMat()", "metadata": "root.ZMGaussObsModel.get_covar_mat_for_comp", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 67 }, { "content": " def get_global_suff_stats(self, Data, SS, LP, **kwargs):\n ''' Calculate suff stats for the covariance matrix of each component\n xxT[k] = E[ x * x.T ] where x is the col vector of each observation\n = sum_{n=1}^N r_nk * outer(x_n, x_n)\n '''\n sqrtResp = np.sqrt(LP['resp'])\n K = sqrtResp.shape[1]\n xxT = np.zeros((K, self.D, self.D))\n for k in xrange(K):\n xxT[k] = dotATA(sqrtResp[:,k][:,np.newaxis]*Data.X )\n SS.setField('xxT', xxT, dims=('K','D','D'))\n return SS", "metadata": "root.ZMGaussObsModel.get_global_suff_stats", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 77 }, { "content": " def update_obs_params_EM( self, SS, **kwargs):\n for k in xrange(self.K):\n covMat = SS.xxT[k]/SS.N[k]\n covMat += self.min_covar * np.eye(self.D)\n self.comp[k] = ZMGaussDistr( Sigma=covMat )", "metadata": "root.ZMGaussObsModel.update_obs_params_EM", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 92 }, { "content": " def update_obs_params_VB( self, SS, mergeCompA=None, **kwargs):\n if mergeCompA is None:\n for k in xrange(self.K):\n self.comp[k] = self.obsPrior.get_post_distr(SS, k)\n else:\n self.comp[mergeCompA] = self.obsPrior.get_post_distr(SS, mergeCompA)", "metadata": "root.ZMGaussObsModel.update_obs_params_VB", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 98 }, { "content": " def update_obs_params_soVB( self, SS, rho, **kwargs):\n for k in xrange(self.K):\n Dstar = self.obsPrior.get_post_distr(SS, k)\n self.comp[k].post_update_soVB( rho, Dstar)", "metadata": "root.ZMGaussObsModel.update_obs_params_soVB", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 105 }, { "content": " def set_global_params(self, hmodel=None, Sigma=None, **kwargs):\n ''' Set global parameters to provided values\n '''\n if hmodel is not None:\n self.comp = [copy.deepcopy(c) for c in hmodel.obsModel.comp]\n self.K = hmodel.obsModel.K\n if Sigma is not None:\n self.K = Sigma.shape[0]\n self.comp = [None for k in range(self.K)]\n for k in range(self.K):\n self.comp[k] = ZMGaussDistr(Sigma=Sigma[k])", "metadata": "root.ZMGaussObsModel.set_global_params", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 110 }, { "content": " def calc_evidence( self, Data, SS, LP=None):\n if self.inferType == 'EM': \n # handled in alloc model and aggregated in HModel\n return 0\n else:\n return self.E_logpX(SS) + self.E_logpPhi() - self.E_logqPhi() ", "metadata": "root.ZMGaussObsModel.calc_evidence", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 124 }, { "content": " def E_logpX( self, SS ):\n lpX = np.zeros( self.K )\n for k in range(self.K):\n if SS.N[k] == 0:\n continue\n lpX[k] = SS.N[k]*self.comp[k].ElogdetLam() - \\\n self.comp[k].E_traceLam( SS.xxT[k] )\n return 0.5*np.sum( lpX ) - 0.5*np.sum(SS.N)*self.D*LOGTWOPI", "metadata": "root.ZMGaussObsModel.E_logpX", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 131 }, { "content": " def E_logpPhi( self ):\n return self.E_logpLam()", "metadata": "root.ZMGaussObsModel.E_logpPhi", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 140 }, { "content": " def E_logqPhi( self ):\n return self.E_logqLam() ", "metadata": "root.ZMGaussObsModel.E_logqPhi", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 143 }, { "content": " def E_logpLam( self ):\n lp = np.zeros( self.K) \n for k in xrange( self.K ):\n lp[k] = 0.5*(self.obsPrior.v - self.D -1)*self.comp[k].ElogdetLam()\n lp[k] -= 0.5*self.comp[k].E_traceLam( cholS=self.obsPrior.cholinvW())\n return lp.sum() - self.K * self.obsPrior.get_log_norm_const()", "metadata": "root.ZMGaussObsModel.E_logpLam", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 146 }, { "content": " def E_logqLam( self ):\n lp = np.zeros( self.K)\n for k in xrange( self.K):\n lp[k] = -1*self.comp[k].get_entropy()\n return lp.sum()", "metadata": "root.ZMGaussObsModel.E_logqLam", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 153 }, { "content": " def get_name(self):\n return 'ZMGauss'", "metadata": "root.ZMGaussObsModel.get_name", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 162 }, { "content": " def get_info_string(self):\n return 'Zero-mean Gaussian distribution'", "metadata": "root.ZMGaussObsModel.get_info_string", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 165 }, { "content": " def get_info_string_prior(self):\n if self.obsPrior is None:\n return 'None'\n else:\n return 'Wishart on precision matrix \\Lam \\n' + self.obsPrior.to_string()", "metadata": "root.ZMGaussObsModel.get_info_string_prior", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 168 }, { "content": " def get_prior_dict( self ):\n if self.obsPrior is None:\n PDict = dict(min_covar=self.min_covar, name=\"NoneType\")\n else:\n PDict = self.obsPrior.to_dict()\n return PDict", "metadata": "root.ZMGaussObsModel.get_prior_dict", "header": "['class', 'ZMGaussObsModel', '(', 'ObsModel', ')', ':', '___NEWLINE___', '___NL___', '######################################################### Constructors', '___NL___', '#########################################################', '___NL___', '___EOS___']", "index": 176 } ]
[ { "span": "import scipy.linalg", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 19 }, { "span": "import os", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 9 }, { "span": "from bnpy.util import np2flatstr, dotATA, dotATB, dotABT", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 56 }, { "span": "from bnpy.util import LOGPI, LOGTWOPI, LOGTWO, EPS", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "ZM", "Gau", "ss", "Obs", "Model", ".", "py", "\\", "10", ";", "\\", "10", ";", "Multi", "varia", "te", ",", " ", "zero", "-", "mean", " ", "Gaussian", " ", "observa", "tion", " ", "model", " ", "for", " ", "bn", "py", ".", "\\", "10", ";", "\\", "10", ";", "Contain", "s", " ", "informati", "on", " ", "for", " ", "accessi", "ng", " ", "and", " ", "updat", "ing", "\\", "10", ";", "*", " ", "data", "-", "generat", "ing", " ", "parameter", "s", " ", "for", " ", "all", " ", "K", " ", "component", "s", " ", "\\", "10", ";", "*", " ", "parameter", "s", " ", "for", " ", "the", " ", "prior", " ", "distribu", "tion", " ", "on", " ", "these", " ", "data", "-", "generat", "ing", " ", "parameter", "s", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "linalg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Obs", "Model_", "import_", "Obs", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bn", "py_", "._", "distr", "_", "import_", "ZM", "Gau", "ss", "Distr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bn", "py_", "._", "distr", "_", "import_", "Wis", "hart", "Distr", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bn", "py_", "._", "util_", "import_", "np", "2f", "lat", "str_", ",_", "dot", "ATA", "_", ",_", "dot", "AT", "B_", ",_", "dot", "AB", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bn", "py_", "._", "util_", "import_", "LOG", "PI_", ",_", "LOG", "TWO", "PI_", ",_", "LOG", "TWO", "_", ",_", "EPS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Accessor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Local", " ", "Params_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", " ", "E-", "step_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", " ", "Inherit", "ed", " ", "direct", "ly", " ", "from", " ", "Obs", "Model", ".", "py", "\\", "10", ";", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Su", "ff", " ", "Stats_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Global", " ", "Params_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", " ", "M", "-", "step_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Evi", "denc", "e_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "I", "/", "O", " ", "Utils_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", " ", " ", "for", " ", "human", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "I", "/", "O", " ", "Utils_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", " ", " ", "for", " ", "machines_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "infer", "Type_", ",_", "D_", "=_", "None_", ",_", "obs", "Prior", "_", "=_", "None_", ",_", "min", "\\u", "covar", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "infer", "Type_", "=_", "infer", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "D_", "=_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "obs", "Prior", "_", "=_", "obs", "Prior", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "K_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min", "\\u", "covar", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "min", "\\u", "covar", "_", "=_", "min", "\\u", "covar", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Creat", "e", "With", "Prior", "_", "(_", "cls_", ",_", "infer", "Type_", ",_", "prior", "Arg", "Dict_", ",_", "Data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "D_", "=_", "Data_", "._", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "infer", "Type_", "==_", "'", "EM", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obs", "Prior", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "infer", "Type_", ",_", "D_", ",_", "obs", "Prior", "_", ",_", "min", "\\u", "covar", "_", "=_", "prior", "Arg", "Dict_", "[_", "'", "min", "\\u", "covar", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obs", "Prior", "_", "=_", "Wis", "hart", "Distr", "_", "._", "Creat", "e", "As", "Prior", "_", "(_", "prior", "Arg", "Dict_", ",_", "Data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "infer", "Type_", ",_", "D_", ",_", "obs", "Prior", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Creat", "e", "With", "All", "Comp", "s_", "(_", "cls_", ",_", "o", "Dict_", ",_", "obs", "Prior", "_", ",_", "comp", "Dict", "List_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "min", "\\u", "covar", "'_", "in_", "o", "Dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mc_", "=_", "o", "Dict_", "[_", "'", "min", "\\u", "covar", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "=_", "cls_", "(_", "o", "Dict_", "[_", "'", "infer", "Type", "'_", "]_", ",_", "obs", "Prior", "_", "=_", "obs", "Prior", "_", ",_", "min", "\\u", "covar", "_", "=_", "mc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "=_", "cls_", "(_", "o", "Dict_", "[_", "'", "infer", "Type", "'_", "]_", ",_", "obs", "Prior", "_", "=_", "obs", "Prior", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "K_", "=_", "len_", "(_", "comp", "Dict", "List_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "=_", "[_", "None_", "for_", "k_", "in_", "range_", "(_", "self_", "._", "K_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "infer", "Type_", "==_", "'", "EM", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "[_", "k_", "]_", "=_", "ZM", "Gau", "ss", "Distr", "_", "(_", "**_", "comp", "Dict", "List_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "D_", "=_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "infer", "Type_", "._", "count_", "(_", "'", "VB", "'_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "[_", "k_", "]_", "=_", "Wis", "hart", "Distr", "_", "(_", "**_", "comp", "Dict", "List_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "D_", "=_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "mean", "\\u", "for", "\\u", "comp_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "np_", "._", "zeros_", "(_", "self_", "._", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "covar", "\\u", "mat", "\\u", "for", "\\u", "comp_", "(_", "self_", ",_", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "EC", "ov", "Mat_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "global", "\\u", "suff", "\\u", "stats_", "(_", "self_", ",_", "Data_", ",_", "SS_", ",_", "LP", "_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Calculat", "e", " ", "suff", " ", "stats", " ", "for", " ", "the", " ", "covariance", " ", "matrix", " ", "of", " ", "each", " ", "component", "\\", "10", ";", " ", " ", " ", " ", "xx", "T", "[", "k", "]", " ", "=", " ", "E", "[", " ", "x", " ", "*", " ", "x", ".", "T", " ", "]", " ", "where", " ", "x", " ", "is", " ", "the", " ", "col", " ", "vector", " ", "of", " ", "each", " ", "observa", "tion", "\\", "10", ";", " ", " ", " ", "=", " ", "sum", "\\u{", "n", "=", "1", "}", "^", "N", " ", "r", "\\u", "nk", " ", "*", " ", "outer", "(", "x", "\\u", "n", ",", " ", "x", "\\u", "n", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sqrt", "Resp_", "=_", "np_", "._", "sqrt_", "(_", "LP", "_", "[_", "'", "resp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "K_", "=_", "sqrt", "Resp_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xx", "T_", "=_", "np_", "._", "zeros_", "(_", "(_", "K_", ",_", "self_", "._", "D_", ",_", "self_", "._", "D_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xx", "T_", "[_", "k_", "]_", "=_", "dot", "ATA", "_", "(_", "sqrt", "Resp_", "[_", ":_", ",_", "k_", "]_", "[_", ":_", ",_", "np_", "._", "newaxis_", "]_", "*_", "Data_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "SS_", "._", "set", "Field_", "(_", "'", "xx", "T", "'_", ",_", "xx", "T_", ",_", "dims_", "=_", "(_", "'", "K", "'_", ",_", "'", "D", "'_", ",_", "'", "D", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "SS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "obs", "\\u", "params", "\\u", "EM", "_", "(_", "self_", ",_", "SS_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cov", "Mat_", "=_", "SS_", "._", "xx", "T_", "[_", "k_", "]_", "/_", "SS_", "._", "N_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cov", "Mat_", "+=_", "self_", "._", "min", "\\u", "covar", "_", "*_", "np_", "._", "eye_", "(_", "self_", "._", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "[_", "k_", "]_", "=_", "ZM", "Gau", "ss", "Distr", "_", "(_", "Sigma_", "=_", "cov", "Mat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "obs", "\\u", "params", "\\u", "VB", "_", "(_", "self_", ",_", "SS_", ",_", "merge", "Comp", "A_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "merge", "Comp", "A_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "[_", "k_", "]_", "=_", "self_", "._", "obs", "Prior", "_", "._", "get", "\\u", "post", "\\u", "distr", "_", "(_", "SS_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "[_", "merge", "Comp", "A_", "]_", "=_", "self_", "._", "obs", "Prior", "_", "._", "get", "\\u", "post", "\\u", "distr", "_", "(_", "SS_", ",_", "merge", "Comp", "A_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "obs", "\\u", "params", "\\u", "so", "VB", "_", "(_", "self_", ",_", "SS_", ",_", "rho_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Ds", "tar_", "=_", "self_", "._", "obs", "Prior", "_", "._", "get", "\\u", "post", "\\u", "distr", "_", "(_", "SS_", ",_", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "post", "\\u", "update", "\\u", "so", "VB", "_", "(_", "rho_", ",_", "Ds", "tar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "global", "\\u", "params_", "(_", "self_", ",_", "hm", "odel_", "=_", "None_", ",_", "Sigma_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Set", " ", "global", " ", "parameter", "s", " ", "to", " ", "provided", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hm", "odel_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "=_", "[_", "copy_", "._", "deepcopy_", "(_", "c_", ")_", "for_", "c_", "in_", "hm", "odel_", "._", "obs", "Model_", "._", "comp_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "K_", "=_", "hm", "odel_", "._", "obs", "Model_", "._", "K_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Sigma_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "K_", "=_", "Sigma_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comp_", "=_", "[_", "None_", "for_", "k_", "in_", "range_", "(_", "self_", "._", "K_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comp_", "[_", "k_", "]_", "=_", "ZM", "Gau", "ss", "Distr", "_", "(_", "Sigma_", "=_", "Sigma_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "\\u", "evidence_", "(_", "self_", ",_", "Data_", ",_", "SS_", ",_", "LP", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "infer", "Type_", "==_", "'", "EM", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "handle", "d", " ", "in", " ", "allo", "c", " ", "model", " ", "and", " ", "aggregated", " ", "in", " ", "HM", "odel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "E", "\\u", "logp", "X_", "(_", "SS_", ")_", "+_", "self_", "._", "E", "\\u", "logp", "Phi", "_", "(_", ")_", "-_", "self_", "._", "E", "\\u", "log", "q", "Phi", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "E", "\\u", "logp", "X_", "(_", "self_", ",_", "SS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp", "X_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "SS_", "._", "N_", "[_", "k_", "]_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lp", "X_", "[_", "k_", "]_", "=_", "SS_", "._", "N_", "[_", "k_", "]_", "*_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "El", "og", "det", "Lam", "_", "(_", ")_", "-_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "E", "\\u", "trace", "Lam", "_", "(_", "SS_", "._", "xx", "T_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "0.5_", "*_", "np_", "._", "sum_", "(_", "lp", "X_", ")_", "-_", "0.5_", "*_", "np_", "._", "sum_", "(_", "SS_", "._", "N_", ")_", "*_", "self_", "._", "D_", "*_", "LOG", "TWO", "PI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "E", "\\u", "logp", "Phi", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "E", "\\u", "logp", "Lam", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "E", "\\u", "log", "q", "Phi", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "E", "\\u", "log", "q", "Lam", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "E", "\\u", "logp", "Lam", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp_", "[_", "k_", "]_", "=_", "0.5_", "*_", "(_", "self_", "._", "obs", "Prior", "_", "._", "v_", "-_", "self_", "._", "D_", "-_", "1_", ")_", "*_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "El", "og", "det", "Lam", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lp_", "[_", "k_", "]_", "-=_", "0.5_", "*_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "E", "\\u", "trace", "Lam", "_", "(_", "chol", "S_", "=_", "self_", "._", "obs", "Prior", "_", "._", "chol", "inv", "W_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lp_", "._", "sum_", "(_", ")_", "-_", "self_", "._", "K_", "*_", "self_", "._", "obs", "Prior", "_", "._", "get", "\\u", "log", "\\u", "norm", "\\u", "const_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "E", "\\u", "log", "q", "Lam", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp_", "=_", "np_", "._", "zeros_", "(_", "self_", "._", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "xrange_", "(_", "self_", "._", "K_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lp_", "[_", "k_", "]_", "=_", "-_", "1_", "*_", "self_", "._", "comp_", "[_", "k_", "]_", "._", "get", "\\u", "entropy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lp_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "ZM", "Gau", "ss", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "info", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Zero", "-", "mean", " ", "Gaussian", " ", "distribu", "tion", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "info", "\\u", "string", "\\u", "prior_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "obs", "Prior", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Non", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Wis", "hart", " ", "on", " ", "preci", "sion", " ", "matrix", " ", "\\\\", "Lam", " ", "\\\\", "n", "'_", "+_", "self_", "._", "obs", "Prior", "_", "._", "to", "\\u", "string_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "ZM", "Gau", "ss", "Obs", "Model_", "(_", "Obs", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", " ", "Constructor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "prior", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "obs", "Prior", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PD", "ict_", "=_", "dict_", "(_", "min", "\\u", "covar", "_", "=_", "self_", "._", "min", "\\u", "covar", "_", ",_", "name_", "=_", "\"", "Non", "e", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PD", "ict_", "=_", "self_", "._", "obs", "Prior", "_", "._", "to", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "PD", "ict_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
hwaf/hwaf/py-hwaftools/find_python.py
[ { "content": "@conf\ndef find_python(ctx, **kwargs):\n \n ctx.load('hwaf-base', tooldir=_heptooldir)\n\n # prevent hysteresis\n if ctx.env.HWAF_FOUND_PYTHON and not kwargs.get('override', False):\n return\n\n if not ctx.env.HWAF_FOUND_C_COMPILER:\n ctx.fatal('load a C compiler first')\n pass\n\n if not ctx.env.HWAF_FOUND_CXX_COMPILER:\n ctx.fatal('load a C++ compiler first')\n pass\n\n # FIXME: take it from a user configuration file ?\n pyversion = kwargs.get(\"version\", None)\n\n # find python\n path_list = waflib.Utils.to_list(kwargs.get('path_list', []))\n if getattr(ctx.options, 'with_python', None):\n topdir = ctx.options.with_python\n topdir = ctx.hwaf_subst_vars(topdir)\n path_list.append(osp.join(topdir, \"bin\"))\n pass\n kwargs['path_list']=path_list\n\n\n ctx.find_program('python', var='PYTHON', **kwargs)\n ctx.hwaf_declare_runtime_env('PYTHON')\n try:\n # temporary hack for clang and glibc-2.16\n # see: \n # http://sourceware.org/git/?p=glibc.git;a=blobdiff;f=misc/sys/cdefs.h;h=fb6c959d903474b38fd0fcc36e17c5290dcd867c;hp=b94147efe8c5bbba718cb2f9d5911a92414864b6;hb=b7bfe116;hpb=43c4edba7ee8224134132fb38df5f63895cbb326\n ctx.check_cxx(\n msg=\"checking for __extern_always_inline\",\n okmsg=\"ok\",\n features=\"cxx cxxshlib\",\n fragment=textwrap.dedent(\n '''\\\n #define _FORTIFY_SOURCE 2\n #include <string.h>\n #include <sys/cdefs.h>\n int foo() { return 42; }\n '''),\n mandatory=True,\n )\n except waflib.Errors.ConfigurationError:\n ctx.env.append_unique('DEFINES',\n ['__extern_always_inline=inline',])\n pass\n\n ctx.load('python')\n if pyversion:\n ctx.check_python_version(pyversion)\n # we remove the -m32 and -m64 options from these flags as they\n # can confuse 'check_python_headers' on darwin...\n save_flags = {}\n for n in ('CXXFLAGS','CFLAGS', 'LINKFLAGS'):\n save_flags[n] = ctx.env[n][:]\n if ctx.is_darwin():\n for n in ('CXXFLAGS','CFLAGS', 'LINKFLAGS'):\n ctx.env[n] = []\n for v in save_flags[n]:\n if v not in ('-m32', '-m64'):\n ctx.env.append_unique(n, [v])\n\n pass\n ctx.check_python_headers()\n\n # restore these flags:\n for n in ('CXXFLAGS','CFLAGS', 'LINKFLAGS'):\n ctx.env[n] = save_flags[n][:]\n pass\n \n # hack for ROOT on macosx: LIBPATH_PYEMBED won't point at\n # the directory holding libpython.{so,a}\n pylibdir = ctx.env['LIBPATH_PYEMBED']\n cmd = ctx.hwaf_subst_vars('${PYTHON_CONFIG}')\n for arg in [#('--includes', 'INCLUDES'),\n ('--ldflags', 'LIBPATH'),\n #('--cflags', 'CXXFLAGS'),\n ]:\n o = subprocess.check_output(\n [cmd, arg[0]]\n )\n o = str(o)\n ctx.parse_flags(o, 'python')\n pylibdir = waflib.Utils.to_list(ctx.env['LIBPATH_python'])[:]\n\n # rename the uselib variables from PYEMBED to python\n ctx.copy_uselib_defs(dst='python', src='PYEMBED')\n \n ## the / in PYTHONARCHDIR and PYTHONDIR can confuse some clever software (rootcint)\n ## remove them from the DEFINES list, keep them in DEFINES_PYEMBED and DEFINES_PYEXT\n defines = [x for x in ctx.env[\"DEFINES\"]\n if not (x.startswith(\"PYTHONARCHDIR=\") or\n x.startswith(\"PYTHONDIR\"))]\n ctx.env[\"DEFINES\"] = defines\n ctx.env[\"define_key\"] = [\n k for k in ctx.env[\"define_key\"]\n if not (x in (\"PYTHONARCHDIR\", \"PYTHONDIR\"))\n ]\n for py in (\"PYEXT\", \"PYEMBED\"):\n for k in (\"PYTHONARCHDIR\", \"PYTHONDIR\"):\n ctx.env.append_unique(\"DEFINES_%s\" % py, \"%s=%s\" % (k, ctx.env.get_flat(k)))\n pass\n pass\n ####\n \n # FIXME: hack for python-lcg.\n # python-config --ldflags returns the wrong directory .../config...\n if pylibdir and \\\n (osp.exists(osp.join(pylibdir[0],\n 'libpython%s.so'%ctx.env['PYTHON_VERSION']))\n or\n osp.exists(osp.join(pylibdir[0],\n 'libpython%s.a'%ctx.env['PYTHON_VERSION']))):\n ctx.env['LIBPATH_python'] = pylibdir[:]\n else:\n # PYEMBED value should be ok.\n pass\n \n # disable fat/universal archives on darwin\n if ctx.is_darwin():\n for n in ('CFLAGS', 'CXXFLAGS', 'LINKFLAGS'):\n args = []\n indices = []\n for i,a in enumerate(ctx.env['%s_python'%n]):\n if a == '-arch':\n # removes ['-arch', 'x86_64']\n indices.append(i)\n indices.append(i+1)\n args = [a for i,a in enumerate(ctx.env['%s_python'%n])\n if not (i in indices)]\n ctx.env['%s_python'%n] = args[:]\n \n # make sure the correct arch is built (32/64 !!)\n arch_flag = []\n if ctx.is_darwin():\n if ctx.is_32b(): arch_flag = ['-arch', 'i386']\n else: arch_flag = ['-arch', 'x86_64']\n elif ctx.is_linux(): \n if ctx.is_32b(): arch_flag = ['-m32',]\n else: arch_flag = ['-m64',]\n elif ctx.is_freebsd(): \n if ctx.is_32b(): arch_flag = ['-m32',]\n else: arch_flag = ['-m64',]\n else:\n pass\n \n for n in ('CFLAGS', 'CXXFLAGS', 'LINKFLAGS'):\n ctx.env.append_unique('%s_python'%n, arch_flag)\n \n # disable the creation of .pyo files\n ctx.env['PYO'] = 0\n\n # retrieve the prefix\n cmd = [ctx.env.PYTHON_CONFIG, \"--prefix\"]\n lines=ctx.cmd_and_log(cmd).split()\n ctx.env[\"PYTHON_PREFIX\"] = lines[0]\n ctx.env[\"LIBPATH_python\"] = [l.replace(\"6464\", \"64\")\n for l in ctx.env[\"LIBPATH_python\"]]\n\n # register the python module\n import sys\n fname = sys.modules['waflib.Tools.python'].__file__\n if fname.endswith('.pyc'): fname = fname[:-1]\n ctx.hwaf_export_module(ctx.root.find_node(fname).abspath())\n\n ctx.env.HWAF_FOUND_PYTHON = 1\n return", "metadata": "root.find_python", "header": "['module', '___EOS___']", "index": 64 } ]
[ { "span": "pylibdir ", "start_line": 143, "start_column": 4, "end_line": 143, "end_column": 12 } ]
[ { "span": "pylibdir ", "start_line": 154, "start_column": 4, "end_line": 154, "end_column": 12 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find", "\\u", "python_", "(_", "ctx_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "load_", "(_", "'", "hwa", "f", "-", "base", "'_", ",_", "tool", "dir_", "=_", "\\u", "hep", "tool", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prevent", " ", "hys", "tere", "sis_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "PYTHON", "_", "and_", "not_", "kwargs_", "._", "get_", "(_", "'", "override", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "C", "\\u", "COMPILER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "fatal_", "(_", "'", "load", " ", "a", " ", "C", " ", "compiler", " ", "first", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "CXX", "\\u", "COMPILER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "fatal_", "(_", "'", "load", " ", "a", " ", "C", "++", " ", "compiler", " ", "first", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "take", " ", "it", " ", "from", " ", "a", " ", "user", " ", "configura", "tion", " ", "file", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyv", "ersion_", "=_", "kwargs_", "._", "get_", "(_", "\"", "version", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "list_", "=_", "waf", "lib_", "._", "Utils_", "._", "to", "\\u", "list_", "(_", "kwargs_", "._", "get_", "(_", "'", "path", "\\u", "list", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "getattr_", "(_", "ctx_", "._", "options_", ",_", "'", "with", "\\u", "python", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "topdi", "r_", "=_", "ctx_", "._", "options_", "._", "with", "\\u", "python_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topdi", "r_", "=_", "ctx_", "._", "hwa", "f", "\\u", "subst", "\\u", "vars_", "(_", "topdi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "list_", "._", "append_", "(_", "osp_", "._", "join_", "(_", "topdi", "r_", ",_", "\"", "bin", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "[_", "'", "path", "\\u", "list", "'_", "]_", "=_", "path", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "find", "\\u", "program_", "(_", "'", "python", "'_", ",_", "var_", "=_", "'", "PYTHON", "'_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "hwa", "f", "\\u", "declar", "e\\u", "runt", "ime", "\\u", "env_", "(_", "'", "PYTHON", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "temporar", "y", " ", "hack", " ", "for", " ", "clang", " ", "and", " ", "glib", "c", "-", "2.1", "6_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", ":", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "source", "ware", ".", "org", "/", "git", "/?", "p", "=", "glib", "c", ".", "git", ";", "a", "=", "blob", "diff", ";", "f", "=", "misc", "/", "sys", "/", "cdef", "s", ".", "h", ";", "h", "=", "fb", "6c", "959", "d", "903", "474", "b3", "8f", "d0", "fcc", "3", "6e", "1", "7c", "529", "0d", "cd", "867", "c", ";", "hp", "=", "b9", "414", "7e", "fe", "8c", "5b", "bba", "718", "cb", "2f", "9", "d5", "911", "a9", "241", "486", "4b", "6", ";", "hb", "=", "b7", "bf", "e1", "16", ";", "hp", "b", "=", "4", "3c", "4e", "dba", "7e", "e8", "224", "134", "132", "fb", "3", "8d", "f5", "f6", "389", "5c", "bb", "326", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "check", "\\u", "cxx", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "msg_", "=_", "\"", "checking", " ", "for", " ", "\\u\\u", "extern", "\\u", "alw", "ay", "s", "\\u", "inline", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ok", "msg_", "=_", "\"", "ok", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "features_", "=_", "\"", "cxx", " ", "cxx", "shl", "ib", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fragment_", "=_", "textwrap_", "._", "dedent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\\\", "\\", "10", ";", " ", " ", " ", " ", "#", "defin", "e", " ", "\\u", "FORT", "IF", "Y", "\\u", "SOU", "RC", "E", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "#", "include", " ", "<", "string", ".", "h", ">", "\\", "10", ";", " ", " ", " ", " ", "#", "include", " ", "<", "sys", "/", "cdef", "s", ".", "h", ">", "\\", "10", ";", " ", " ", " ", " ", "int", " ", "foo", "()", " ", "{", " ", "return", " ", "4", "2", ";", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "'''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mandatory_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "waf", "lib_", "._", "Errors_", "._", "Configura", "tion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "._", "append", "\\u", "unique_", "(_", "'", "DEFINE", "S", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'\\u", "\\u", "extern", "\\u", "alw", "ay", "s", "\\u", "inline", "=", "inline", "'_", ",_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "load_", "(_", "'", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pyv", "ersion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "check", "\\u", "python", "\\u", "version_", "(_", "pyv", "ersion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "remove", " ", "the", " ", "-", "m3", "2", " ", "and", " ", "-", "m", "64", " ", "options", " ", "from", " ", "these", " ", "flags", " ", "as", " ", "the", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "conf", "use", " ", "'", "check", "\\u", "python", "\\u", "header", "s", "'", " ", "on", " ", "dar", "win", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save", "\\u", "flags_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "(_", "'", "CXX", "FLAG", "S", "'_", ",_", "'", "CFLAGS", "'_", ",_", "'", "LINK", "FLAG", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "\\u", "flags_", "[_", "n_", "]_", "=_", "ctx_", "._", "env_", "[_", "n_", "]_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ctx_", "._", "is", "\\u", "dar", "win_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "(_", "'", "CXX", "FLAG", "S", "'_", ",_", "'", "CFLAGS", "'_", ",_", "'", "LINK", "FLAG", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "[_", "n_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "v_", "in_", "save", "\\u", "flags_", "[_", "n_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "not_", "in_", "(_", "'-", "m3", "2", "'_", ",_", "'-", "m", "64", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ctx_", "._", "env_", "._", "append", "\\u", "unique_", "(_", "n_", ",_", "[_", "v_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "check", "\\u", "python", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restore", " ", "these", " ", "flags", ":_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "(_", "'", "CXX", "FLAG", "S", "'_", ",_", "'", "CFLAGS", "'_", ",_", "'", "LINK", "FLAG", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "[_", "n_", "]_", "=_", "save", "\\u", "flags_", "[_", "n_", "]_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hack", " ", "for", " ", "ROO", "T", " ", "on", " ", "macos", "x", ":", " ", "LIB", "PATH", "\\u", "PY", "EMBED", " ", "won", "'", "t", " ", "point", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "director", "y", " ", "holding", " ", "libp", "yth", "on", ".", "{", "so", ",", "a", "}_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyli", "bdi", "r_", "=_", "ctx_", "._", "env_", "[_", "'", "LIB", "PATH", "\\u", "PY", "EMBED", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "ctx_", "._", "hwa", "f", "\\u", "subst", "\\u", "vars_", "(_", "'$", "{", "PYTHON", "\\u", "CONFIG", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "[_", "#(", "'--", "include", "s", "',", " ", "'", "INCLUDE", "S", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'--", "ldf", "lags", "'_", ",_", "'", "LIB", "PATH", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#(", "'--", "cflags", "',", " ", "'", "CXX", "FLAG", "S", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "cmd_", ",_", "arg_", "[_", "0_", "]_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "=_", "str_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "parse", "\\u", "flags_", "(_", "o_", ",_", "'", "python", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pyli", "bdi", "r_", "=_", "waf", "lib_", "._", "Utils_", "._", "to", "\\u", "list_", "(_", "ctx_", "._", "env_", "[_", "'", "LIB", "PATH", "\\u", "python", "'_", "]_", ")_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rename", " ", "the", " ", "usel", "ib", " ", "variab", "les", " ", "from", " ", "PY", "EMBED", " ", "to", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "copy", "\\u", "usel", "ib", "\\u", "defs_", "(_", "dst_", "=_", "'", "python", "'_", ",_", "src_", "=_", "'", "PY", "EMBED", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "the", " ", "/", " ", "in", " ", "PYTHON", "ARCH", "DIR", " ", "and", " ", "PYTHON", "DIR", " ", "can", " ", "conf", "use", " ", "some", " ", "clev", "er", " ", "software", " ", "(", "root", "cin", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "remove", " ", "them", " ", "from", " ", "the", " ", "DEFINE", "S", " ", "list", ",", " ", "keep", " ", "them", " ", "in", " ", "DEFINE", "S", "\\u", "PY", "EMBED", " ", "and", " ", "DEFINE", "S", "\\u", "PY", "EXT_", "\\u\\u\\uNL\\u\\u\\u_", "defines_", "=_", "[_", "x_", "for_", "x_", "in_", "ctx_", "._", "env_", "[_", "\"", "DEFINE", "S", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "x_", "._", "startswith_", "(_", "\"", "PYTHON", "ARCH", "DIR", "=\"_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "._", "startswith_", "(_", "\"", "PYTHON", "DIR", "\"_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "[_", "\"", "DEFINE", "S", "\"_", "]_", "=_", "defines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "[_", "\"", "defin", "e\\u", "key", "\"_", "]_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "for_", "k_", "in_", "ctx_", "._", "env_", "[_", "\"", "defin", "e\\u", "key", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "x_", "in_", "(_", "\"", "PYTHON", "ARCH", "DIR", "\"_", ",_", "\"", "PYTHON", "DIR", "\"_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "py_", "in_", "(_", "\"", "PY", "EXT", "\"_", ",_", "\"", "PY", "EMBED", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "k_", "in_", "(_", "\"", "PYTHON", "ARCH", "DIR", "\"_", ",_", "\"", "PYTHON", "DIR", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "._", "append", "\\u", "unique_", "(_", "\"", "DEFINE", "S", "\\u", "%", "s", "\"_", "%_", "py_", ",_", "\"%", "s", "=", "%", "s", "\"_", "%_", "(_", "k_", ",_", "ctx_", "._", "env_", "._", "get", "\\u", "flat_", "(_", "k_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "hack", " ", "for", " ", "python", "-", "lc", "g", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", "-", "config", " ", "--", "ldf", "lags", " ", "return", "s", " ", "the", " ", "wrong", " ", "director", "y", " ", "...", "/", "config", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pyli", "bdi", "r_", "and_", "(_", "osp_", "._", "exists_", "(_", "osp_", "._", "join_", "(_", "pyli", "bdi", "r_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "libp", "yth", "on", "%", "s", ".", "so", "'_", "%_", "ctx_", "._", "env_", "[_", "'", "PYTHON", "\\u", "VERSI", "ON", "'_", "]_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "osp_", "._", "exists_", "(_", "osp_", "._", "join_", "(_", "pyli", "bdi", "r_", "[_", "0_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "libp", "yth", "on", "%", "s", ".", "a", "'_", "%_", "ctx_", "._", "env_", "[_", "'", "PYTHON", "\\u", "VERSI", "ON", "'_", "]_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "[_", "'", "LIB", "PATH", "\\u", "python", "'_", "]_", "=_", "pyli", "bdi", "r_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "PY", "EMBED", " ", "value", " ", "shou", "ld", " ", "be", " ", "ok", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disable", " ", "fat", "/", "universal", " ", "archives", " ", "on", " ", "dar", "win_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ctx_", "._", "is", "\\u", "dar", "win_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "(_", "'", "CFLAGS", "'_", ",_", "'", "CXX", "FLAG", "S", "'_", ",_", "'", "LINK", "FLAG", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "a_", "in_", "enumerate_", "(_", "ctx_", "._", "env_", "[_", "'%", "s", "\\u", "python", "'_", "%_", "n_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "a_", "==_", "'-", "arch", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", "s", " ", "['", "-", "arch", "',", " ", "'", "x8", "6", "\\u", "64", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "indices_", "._", "append_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indices_", "._", "append_", "(_", "i_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "a_", "for_", "i_", ",_", "a_", "in_", "enumerate_", "(_", "ctx_", "._", "env_", "[_", "'%", "s", "\\u", "python", "'_", "%_", "n_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "(_", "i_", "in_", "indices_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "[_", "'%", "s", "\\u", "python", "'_", "%_", "n_", "]_", "=_", "args_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "sure", " ", "the", " ", "correct", " ", "arch", " ", "is", " ", "bui", "lt", " ", "(", "32", "/", "64", " ", "!!", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arch", "\\u", "flag_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ctx_", "._", "is", "\\u", "dar", "win_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ctx_", "._", "is", "\\u", "32", "b_", "(_", ")_", ":_", "arch", "\\u", "flag_", "=_", "[_", "'-", "arch", "'_", ",_", "'", "i3", "86", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "arch", "\\u", "flag_", "=_", "[_", "'-", "arch", "'_", ",_", "'", "x8", "6", "\\u", "64", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ctx_", "._", "is", "\\u", "linux_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ctx_", "._", "is", "\\u", "32", "b_", "(_", ")_", ":_", "arch", "\\u", "flag_", "=_", "[_", "'-", "m3", "2", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "arch", "\\u", "flag_", "=_", "[_", "'-", "m", "64", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ctx_", "._", "is", "\\u", "freeb", "sd_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ctx_", "._", "is", "\\u", "32", "b_", "(_", ")_", ":_", "arch", "\\u", "flag_", "=_", "[_", "'-", "m3", "2", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "arch", "\\u", "flag_", "=_", "[_", "'-", "m", "64", "'_", ",_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "(_", "'", "CFLAGS", "'_", ",_", "'", "CXX", "FLAG", "S", "'_", ",_", "'", "LINK", "FLAG", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "env_", "._", "append", "\\u", "unique_", "(_", "'%", "s", "\\u", "python", "'_", "%_", "n_", ",_", "arch", "\\u", "flag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "disable", " ", "the", " ", "creati", "on", " ", "of", " ", ".", "pyo", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "env_", "[_", "'", "PY", "O", "'_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "retrieve", " ", "the", " ", "prefix_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "ctx_", "._", "env_", "._", "PYTHON", "\\u", "CONFIG_", ",_", "\"--", "prefix", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "ctx_", "._", "cmd", "\\u", "and", "\\u", "log_", "(_", "cmd_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "[_", "\"", "PYTHON", "\\u", "PREF", "IX", "\"_", "]_", "=_", "lines_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "[_", "\"", "LIB", "PATH", "\\u", "python", "\"_", "]_", "=_", "[_", "l_", "._", "replace_", "(_", "\"", "646", "4", "\"_", ",_", "\"", "64", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "l_", "in_", "ctx_", "._", "env_", "[_", "\"", "LIB", "PATH", "\\u", "python", "\"_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "register", " ", "the", " ", "python", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fname_", "=_", "sys_", "._", "modules_", "[_", "'", "waf", "lib", ".", "Tool", "s", ".", "python", "'_", "]_", "._", "\\u\\u", "file\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fname_", "._", "endswith_", "(_", "'.", "pyc", "'_", ")_", ":_", "fname_", "=_", "fname_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "hwa", "f", "\\u", "export", "\\u", "module_", "(_", "ctx_", "._", "root_", "._", "find", "\\u", "node_", "(_", "fname_", ")_", "._", "abspath_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "env_", "._", "HW", "AF", "\\u", "FO", "UND", "\\u", "PYTHON", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
aparo/pyes/tests/test_percolator.py
[ { "content": " def test_percolator(self):\n results = self.conn.percolate('test-index', 'test-type', PercolatorQuery({'name': 'iphone'}))\n self.assertTrue({'_id': 'test-perc1', '_index': 'test-index'} not in results['matches'])\n self.assertTrue({'_id': 'test-perc2','_index': 'test-index'} in results['matches'])\n self.assertTrue({'_id': 'test-perc3', '_index': 'test-index'} not in results['matches'])", "metadata": "root.PercolatorTestCase.test_percolator", "header": "['class', 'PercolatorTestCase', '(', 'ESTestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_or(self):\n results = self.conn.percolate('test-index', 'test-type', PercolatorQuery({'name': 'apple'}))\n self.assertTrue({'_id': 'test-perc1', '_index': 'test-index'} in results['matches'])\n self.assertTrue({'_id': 'test-perc2', '_index': 'test-index'} in results['matches'])\n self.assertTrue({'_id': 'test-perc3', '_index': 'test-index'} not in results['matches'])", "metadata": "root.PercolatorTestCase.test_or", "header": "['class', 'PercolatorTestCase', '(', 'ESTestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_and(self):\n results = self.conn.percolate('test-index', 'test-type', PercolatorQuery({'name': 'apple iphone'}))\n self.assertTrue({'_id': 'test-perc1', '_index': 'test-index'} in results['matches'])\n self.assertTrue({'_id': 'test-perc2', '_index': 'test-index'} in results['matches'])\n self.assertTrue({'_id': 'test-perc3', '_index': 'test-index'} in results['matches'])", "metadata": "root.PercolatorTestCase.test_and", "header": "['class', 'PercolatorTestCase', '(', 'ESTestCase', ')', ':', '___EOS___']", "index": 62 } ]
[ { "span": "self.assertTrue({'_id': 'test-perc1', '_index': 'test-index'} not in results['matches'])", "start_line": 52, "start_column": 8, "end_line": 52, "end_column": 96 }, { "span": "self.assertTrue({'_id': 'test-perc2','_index': 'test-index'} in results['matches'])", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 91 }, { "span": "self.assertTrue({'_id': 'test-perc3', '_index': 'test-index'} not in results['matches'])", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 96 }, { "span": "self.assertTrue({'_id': 'test-perc1', '_index': 'test-index'} in results['matches'])", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 92 }, { "span": "self.assertTrue({'_id': 'test-perc2', '_index': 'test-index'} in results['matches'])", "start_line": 59, "start_column": 8, "end_line": 59, "end_column": 92 }, { "span": "self.assertTrue({'_id': 'test-perc3', '_index': 'test-index'} not in results['matches'])", "start_line": 60, "start_column": 8, "end_line": 60, "end_column": 96 }, { "span": "self.assertTrue({'_id': 'test-perc1', '_index': 'test-index'} in results['matches'])", "start_line": 64, "start_column": 8, "end_line": 64, "end_column": 92 }, { "span": "self.assertTrue({'_id': 'test-perc2', '_index': 'test-index'} in results['matches'])", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 92 }, { "span": "self.assertTrue({'_id': 'test-perc3', '_index': 'test-index'} in results['matches'])", "start_line": 66, "start_column": 8, "end_line": 66, "end_column": 92 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Per", "colat", "or", "Test", "Case_", "(_", "EST", "est", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "perc", "ola", "tor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "conn_", "._", "perc", "ola", "te_", "(_", "'", "test", "-", "index", "'_", ",_", "'", "test", "-", "type", "'_", ",_", "Per", "colat", "or", "Query_", "(_", "{_", "'", "name", "'_", ":_", "'", "iph", "one", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "1", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "not_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "2", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "3", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "not_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "colat", "or", "Test", "Case_", "(_", "EST", "est", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "or_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "conn_", "._", "perc", "ola", "te_", "(_", "'", "test", "-", "index", "'_", ",_", "'", "test", "-", "type", "'_", ",_", "Per", "colat", "or", "Query_", "(_", "{_", "'", "name", "'_", ":_", "'", "apple", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "1", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "2", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "3", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "not_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "colat", "or", "Test", "Case_", "(_", "EST", "est", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "and_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "self_", "._", "conn_", "._", "perc", "ola", "te_", "(_", "'", "test", "-", "index", "'_", ",_", "'", "test", "-", "type", "'_", ",_", "Per", "colat", "or", "Query_", "(_", "{_", "'", "name", "'_", ":_", "'", "apple", " ", "iph", "one", "'_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "1", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "2", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "{_", "'\\u", "id", "'_", ":_", "'", "test", "-", "perc", "3", "'_", ",_", "'\\u", "index", "'_", ":_", "'", "test", "-", "index", "'_", "}_", "in_", "results_", "[_", "'", "matche", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
skyostil/tracy/src/generator/Cheetah/Tests/unittest_local_copy.py
[ { "content": " def __call__(self, result=None):\n if result is None:\n result = self.defaultTestResult()\n \n result.startTest(self)\n try:\n try:\n self.setUp()\n except:\n result.addError(self, self.__exc_info())\n return\n \n ok = 0\n try:\n self._testMethod()\n ok = 1\n except self.failureException, e:\n result.addFailure(self, self.__exc_info())\n except:\n result.addError(self, self.__exc_info())\n try:\n self.tearDown()\n except:\n result.addError(self, self.__exc_info())\n ok = 0\n if ok:\n result.addSuccess(self)\n finally:\n result.stopTest(self)\n \n return result", "metadata": "root.TestCase.__call__", "header": "['class', 'TestCase', ':', '___EOS___']", "index": 321 } ]
[ { "span": "except:", "start_line": 329, "start_column": 12, "end_line": 329, "end_column": 19 }, { "span": "except:", "start_line": 339, "start_column": 12, "end_line": 339, "end_column": 19 }, { "span": "except:", "start_line": 343, "start_column": 12, "end_line": 343, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Case_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "result_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "self_", "._", "default", "Test", "Result_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "start", "Test_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Error_", "(_", "self_", ",_", "self_", "._", "\\u\\u", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ok_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "test", "Method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "fail", "ure", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Failure_", "(_", "self_", ",_", "self_", "._", "\\u\\u", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Error_", "(_", "self_", ",_", "self_", "._", "\\u\\u", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tear", "Down_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Error_", "(_", "self_", ",_", "self_", "._", "\\u\\u", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "add", "Success_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "stop", "Test_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
spaam/svtplay-dl/lib/svtplay_dl/service/raw.py
[ { "content": " def get(self):\n data = self.get_urldata()\n\n if self.exclude(self.options):\n return\n\n extention = False\n filename = os.path.basename(self.url[:self.url.rfind(\"/\")-1])\n if self.options.output and os.path.isdir(self.options.output):\n self.options.output = os.path.join(os.path.dirname(self.options.output), filename)\n extention = True\n elif self.options.output is None:\n self.options.output = \"%s\" % filename\n extention = True\n\n if self.url.find(\".f4m\") > 0:\n if extention:\n self.options.output = \"%s.flv\" % self.options.output\n\n streams = hdsparse(self.options, self.http.request(\"get\", self.url, params={\"hdcore\": \"3.7.0\"}), self.url)\n if streams:\n for n in list(streams.keys()):\n yield streams[n]\n if self.url.find(\".m3u8\") > 0:\n streams = hlsparse(self.options, self.http.request(\"get\", self.url), self.url)\n if extention:\n self.options.output = \"%s.ts\" % self.options.output\n\n for n in list(streams.keys()):\n yield streams[n]", "metadata": "root.Raw.get", "header": "['class', 'Raw', '(', 'Service', ')', ':', '___EOS___']", "index": 9 } ]
[ { "span": "data ", "start_line": 10, "start_column": 8, "end_line": 10, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Raw_", "(_", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "url", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "exclude_", "(_", "self_", "._", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extent", "ion_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "self_", "._", "url_", "[_", ":_", "self_", "._", "url_", "._", "rfind_", "(_", "\"/\"_", ")_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "options_", "._", "output_", "and_", "os_", "._", "path_", "._", "isdir_", "(_", "self_", "._", "options_", "._", "output_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "options_", "._", "output_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "self_", "._", "options_", "._", "output_", ")_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extent", "ion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "options_", "._", "output_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "options_", "._", "output_", "=_", "\"%", "s", "\"_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extent", "ion_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "url_", "._", "find_", "(_", "\".", "f4", "m", "\"_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "extent", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "options_", "._", "output_", "=_", "\"%", "s", ".", "fl", "v", "\"_", "%_", "self_", "._", "options_", "._", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "streams_", "=_", "hd", "sparse_", "(_", "self_", "._", "options_", ",_", "self_", "._", "http_", "._", "request_", "(_", "\"", "get", "\"_", ",_", "self_", "._", "url_", ",_", "params_", "=_", "{_", "\"", "hd", "core", "\"_", ":_", "\"", "3.7", ".0", "\"_", "}_", ")_", ",_", "self_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "streams_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "n_", "in_", "list_", "(_", "streams_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "streams_", "[_", "n_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "url_", "._", "find_", "(_", "\".", "m3u8", "\"_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "streams_", "=_", "hls", "parse_", "(_", "self_", "._", "options_", ",_", "self_", "._", "http_", "._", "request_", "(_", "\"", "get", "\"_", ",_", "self_", "._", "url_", ")_", ",_", "self_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "extent", "ion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "options_", "._", "output_", "=_", "\"%", "s", ".", "ts", "\"_", "%_", "self_", "._", "options_", "._", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "n_", "in_", "list_", "(_", "streams_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "streams_", "[_", "n_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
mrknow/filmkodi/plugin.video.specto/resources/lib/sources/moviefarsiv2_mv_tv.py
[ { "content": " def get_sources(self, url, hosthdDict, hostDict, locDict):\n return\n\n try:\n sources = []\n\n if url == None: return sources\n\n data = os.path.join(control.dataPath, 'moviefarsi.db')\n\n download = True\n\n try: download = abs(datetime.datetime.fromtimestamp(os.path.getmtime(data)) - (datetime.datetime.now())) > datetime.timedelta(days=7)\n except: pass\n\n if download == True:\n result = client.source(base64.b64decode(self.data_link))\n zip = zipfile.ZipFile(StringIO.StringIO(result))\n zip.extractall(control.dataPath)\n zip.close()\n\n dbcon = database.connect(data)\n dbcur = dbcon.cursor()\n\n content = re.compile('(.+?)\\sS\\d*E\\d*$').findall(url)\n\n\n if len(content) == 0:\n title, year = re.compile('(.+?) (\\d{4})$').findall(url)[0]\n title = cleantitle.movie(title)\n\n dbcur.execute(\"SELECT * FROM movies WHERE year = '%s'\" % year)\n result = dbcur.fetchone()\n result = eval(result[1].encode('utf-8'))\n\n links = [(i, re.sub('(\\.|\\(|\\[|\\s)(\\d{4}|3D)(\\.|\\)|\\]|\\s|)(.+|)', '', i)) for i in result]\n links = [i[0] for i in links if title == cleantitle.movie(os.path.basename(i[1]))]\n\n for i in links:\n try:\n url = client.replaceHTMLCodes(i)\n url = url.encode('utf-8')\n\n if not url.endswith(('mp4', 'mkv')): raise Exception()\n\n fmt = re.sub('(.+)(\\.|\\(|\\[|\\s)(\\d{4})(\\.|\\)|\\]|\\s)', '', i)\n fmt = re.split('\\.|\\(|\\)|\\[|\\]|\\s|\\-|\\_', fmt)\n fmt = [x.lower() for x in fmt]\n\n if '1080p' in fmt: quality = '1080p'\n elif '720p' in fmt or 'hd' in fmt: quality = 'HD'\n else: quality = 'SD'\n\n if '3d' in fmt: info = '3D'\n else: info = ''\n control.log('### FARSI ')\n sources.append({'source': 'Moviefarsi', 'quality': quality, 'provider': 'Moviefarsiv2', 'url': url, 'info': info})\n except:\n pass\n\n\n else:\n tvshowtitle, season, episode = re.compile('(.+?)\\sS(\\d*)E(\\d*)$').findall(url)[0]\n tvshowtitle = cleantitle.tv(tvshowtitle)\n\n dbcur.execute(\"SELECT * FROM tvshows WHERE tvshowtitle = '%s'\" % tvshowtitle)\n result = dbcur.fetchone()\n result = eval(result[1].encode('utf-8'))\n\n match = ['S%sE%s' % (season, episode), 'S%s E%s' % (season, episode)]\n\n links = [(i, os.path.basename(i)) for i in result]\n links = [i[0] for i in links if any(x in i[1] for x in match)]\n\n for i in links:\n try:\n url = client.replaceHTMLCodes(i)\n url = url.encode('utf-8')\n\n fmt = os.path.basename(url).lower()\n\n if '1080p' in fmt: quality = '1080p'\n elif '720p' in fmt or 'hd' in fmt: quality = 'HD'\n else: quality = 'SD'\n\n sources.append({'source': 'Moviefarsi', 'quality': quality, 'provider': 'Moviefarsiv2', 'url': url})\n except:\n pass\n\n return sources\n except:\n return sources", "metadata": "root.source.get_sources", "header": "['class', 'source', ':', '___EOS___']", "index": 70 }, { "content": " def resolve(self, url):\n return\n url = '%s|User-Agent=%s' % (url, urllib.quote_plus(client.agent()))\n return url", "metadata": "root.source.resolve", "header": "['class', 'source', ':', '___EOS___']", "index": 164 } ]
[ { "span": "try:", "start_line": 73, "start_column": 8, "end_line": 73, "end_column": 12 }, { "span": "url = '%s|User-Agent=%s' % (url, urllib.quote_plus(client.agent()))", "start_line": 166, "start_column": 8, "end_line": 166, "end_column": 75 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "source_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sources_", "(_", "self_", ",_", "url_", ",_", "host", "hd", "Dict_", ",_", "host", "Dict_", ",_", "loc", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sources_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "url_", "==_", "None_", ":_", "return_", "sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "os_", "._", "path_", "._", "join_", "(_", "control_", "._", "data", "Path_", ",_", "'", "movie", "far", "si", ".", "db", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "download_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "download_", "=_", "abs_", "(_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "os_", "._", "path_", "._", "getmtime_", "(_", "data_", ")_", ")_", "-_", "(_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", ")_", ")_", ">_", "datetime_", "._", "timedelta_", "(_", "days_", "=_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "download_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "client_", "._", "source_", "(_", "base64_", "._", "b64decode_", "(_", "self_", "._", "data\\u", "link_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip_", "=_", "zipfile_", "._", "Zip", "File_", "(_", "String", "IO_", "._", "String", "IO_", "(_", "result_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip_", "._", "extracta", "ll_", "(_", "control_", "._", "data", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dbco", "n_", "=_", "database_", "._", "connect_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbc", "ur_", "=_", "dbco", "n_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content_", "=_", "re_", "._", "compile_", "(_", "'(", ".+?)", "\\\\", "s", "S", "\\\\", "d", "*", "E", "\\\\", "d", "*$'_", ")_", "._", "findall_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "content_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", ",_", "year_", "=_", "re_", "._", "compile_", "(_", "'(", ".+?)", " ", "(\\\\", "d", "{", "4", "})", "$'_", ")_", "._", "findall_", "(_", "url_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "clean", "title_", "._", "movie_", "(_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "movie", "s", " ", "WHE", "RE", " ", "year", " ", "=", " ", "'%", "s", "'\"_", "%_", "year_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "eval_", "(_", "result_", "[_", "1_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "[_", "(_", "i_", ",_", "re_", "._", "sub_", "(_", "'(\\\\", ".|", "\\\\(", "|\\\\", "[", "|\\\\", "s", ")(", "\\\\", "d", "{", "4", "}|", "3", "D", ")(", "\\\\.", "|\\\\", ")|", "\\\\]", "|\\\\", "s", "|)", "(.+", "|)", "'_", ",_", "''_", ",_", "i_", ")_", ")_", "for_", "i_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "i_", "[_", "0_", "]_", "for_", "i_", "in_", "links_", "if_", "title_", "==_", "clean", "title_", "._", "movie_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "i_", "[_", "1_", "]_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url_", "=_", "client_", "._", "replace", "HTM", "LC", "odes_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "url_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "url_", "._", "endswith_", "(_", "(_", "'", "mp", "4", "'_", ",_", "'", "mkv", "'_", ")_", ")_", ":_", "raise_", "Exception_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fmt_", "=_", "re_", "._", "sub_", "(_", "'(", ".+)", "(\\\\", ".|", "\\\\(", "|\\\\", "[", "|\\\\", "s", ")(", "\\\\", "d", "{", "4", "})(", "\\\\.", "|\\\\", ")|", "\\\\]", "|\\\\", "s", ")'_", ",_", "''_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "re_", "._", "split_", "(_", "'\\\\.", "|\\\\", "(", "|\\\\", ")|", "\\\\[", "|\\\\", "]|", "\\\\", "s", "|\\\\", "-|", "\\\\\\u", "'_", ",_", "fmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fmt_", "=_", "[_", "x_", "._", "lower_", "(_", ")_", "for_", "x_", "in_", "fmt_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "1080", "p", "'_", "in_", "fmt_", ":_", "quality_", "=_", "'", "1080", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'", "720", "p", "'_", "in_", "fmt_", "or_", "'", "hd", "'_", "in_", "fmt_", ":_", "quality_", "=_", "'", "HD", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "quality_", "=_", "'", "SD", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "3d", "'_", "in_", "fmt_", ":_", "info_", "=_", "'", "3", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "info_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "control_", "._", "log_", "(_", "'###", " ", "FAR", "SI", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sources_", "._", "append_", "(_", "{_", "'", "source", "'_", ":_", "'", "Movi", "efa", "rsi", "'_", ",_", "'", "quali", "ty", "'_", ":_", "quality_", ",_", "'", "provide", "r", "'_", ":_", "'", "Movi", "efa", "rsi", "v2", "'_", ",_", "'", "url", "'_", ":_", "url_", ",_", "'", "info", "'_", ":_", "info_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tvshow", "title_", ",_", "season_", ",_", "episode_", "=_", "re_", "._", "compile_", "(_", "'(", ".+?)", "\\\\", "s", "S", "(\\\\", "d", "*)", "E", "(\\\\", "d", "*)", "$'_", ")_", "._", "findall_", "(_", "url_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tvshow", "title_", "=_", "clean", "title_", "._", "tv_", "(_", "tvshow", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dbc", "ur_", "._", "execute_", "(_", "\"", "SELECT", " ", "*", " ", "FROM", " ", "tvshow", "s", " ", "WHE", "RE", " ", "tvshow", "title", " ", "=", " ", "'%", "s", "'\"_", "%_", "tvshow", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dbc", "ur_", "._", "fetchone_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "eval_", "(_", "result_", "[_", "1_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "[_", "'", "S", "%", "s", "E", "%", "s", "'_", "%_", "(_", "season_", ",_", "episode_", ")_", ",_", "'", "S", "%", "s", " ", "E", "%", "s", "'_", "%_", "(_", "season_", ",_", "episode_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "[_", "(_", "i_", ",_", "os_", "._", "path_", "._", "basename_", "(_", "i_", ")_", ")_", "for_", "i_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "i_", "[_", "0_", "]_", "for_", "i_", "in_", "links_", "if_", "any_", "(_", "x_", "in_", "i_", "[_", "1_", "]_", "for_", "x_", "in_", "match_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url_", "=_", "client_", "._", "replace", "HTM", "LC", "odes_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "url_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fmt_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "url_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "1080", "p", "'_", "in_", "fmt_", ":_", "quality_", "=_", "'", "1080", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "'", "720", "p", "'_", "in_", "fmt_", "or_", "'", "hd", "'_", "in_", "fmt_", ":_", "quality_", "=_", "'", "HD", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "quality_", "=_", "'", "SD", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sources_", "._", "append_", "(_", "{_", "'", "source", "'_", ":_", "'", "Movi", "efa", "rsi", "'_", ",_", "'", "quali", "ty", "'_", ":_", "quality_", ",_", "'", "provide", "r", "'_", ":_", "'", "Movi", "efa", "rsi", "v2", "'_", ",_", "'", "url", "'_", ":_", "url_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "source_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "'%", "s", "|", "User", "-", "Agent", "=", "%", "s", "'_", "%_", "(_", "url_", ",_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "client_", "._", "agent_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "url_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 ]
Except block handles 'BaseException'
sjuxax/raggregate/raggregate/views/user.py
[ { "content": "@view_config(renderer='login.mak', route_name='twit_sign')\ndef twit_sign(request):\n from raggregate.login_adapters import twitter\n if 'oauth_verifier' not in request.session['safe_params']:\n auth_toks = twitter.start_auth(request)\n request.session['tmp_tok_store'] = auth_toks\n return HTTPFound(auth_toks['auth_url'])\n else:\n twit_auth = twitter.complete_auth(request, request.session['tmp_tok_store'])\n del request.session['tmp_tok_store']\n try:\n users.login_user(request, twit_auth['u'], None, bypass_password = True)\n except:\n request.session['last_login_status'] = 'Sorry, your password was wrong.'\n #raise\n return HTTPFound('/post')", "metadata": "root.twit_sign", "header": "['module', '___EOS___']", "index": 143 } ]
[ { "span": "except:", "start_line": 155, "start_column": 8, "end_line": 155, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "view", "\\u", "config_", "(_", "renderer_", "=_", "'", "login", ".", "mak", "'_", ",_", "route", "\\u", "name_", "=_", "'", "twit", "\\u", "sign", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "twit", "\\u", "sign_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ragg", "rega", "te_", "._", "login", "\\u", "adapters_", "import_", "twitter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "oauth", "\\u", "verifier", "'_", "not_", "in_", "request_", "._", "session_", "[_", "'", "safe", "\\u", "params", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "\\u", "toks_", "=_", "twitter_", "._", "start", "\\u", "auth_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "session_", "[_", "'", "tmp", "\\u", "tok", "\\u", "store", "'_", "]_", "=_", "auth", "\\u", "toks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "HTTP", "Found_", "(_", "auth", "\\u", "toks_", "[_", "'", "auth", "\\u", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "twit", "\\u", "auth_", "=_", "twitter_", "._", "complete", "\\u", "auth_", "(_", "request_", ",_", "request_", "._", "session_", "[_", "'", "tmp", "\\u", "tok", "\\u", "store", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "request_", "._", "session_", "[_", "'", "tmp", "\\u", "tok", "\\u", "store", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "users_", "._", "login", "\\u", "user_", "(_", "request_", ",_", "twit", "\\u", "auth_", "[_", "'", "u", "'_", "]_", ",_", "None_", ",_", "bypass", "\\u", "password_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "._", "session_", "[_", "'", "last", "\\u", "login", "\\u", "status", "'_", "]_", "=_", "'", "So", "rr", "y", ",", " ", "your", " ", "password", " ", "was", " ", "wrong", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "HTTP", "Found_", "(_", "'/", "post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
SALib/SALib/SALib/tests/test_morris_util.py
[ { "content": "def test_distance_fail_with_difference_size_ip():\n input_1 = np.matrix([[0, 1 / 3.], [0, 1.]], dtype=np.float32)\n input_3 = np.matrix([[2 / 3., 0], [2 / 3., 2 / 3.], [0, 2 / 3.]], dtype=np.float32)\n try:\n compute_distance(input_1, input_3, 2)\n except:\n pass\n else:\n raise AssertionError(\"Different size matrices did not trigger error\")", "metadata": "root.test_distance_fail_with_difference_size_ip", "header": "['module', '___EOS___']", "index": 111 }, { "content": "def test_catch_combos_too_large():\n N = 1e6\n k_choices = 4\n num_params = 2\n input_sample = np.random.random_sample((N, num_params))\n\n try:\n find_most_distant(input_sample, N, num_params, k_choices)\n except:\n pass\n else:\n raise AssertionError(\"Test did not fail when number of \\\n combinations exceeded system size\")", "metadata": "root.test_catch_combos_too_large", "header": "['module', '___EOS___']", "index": 254 } ]
[ { "span": "except:", "start_line": 116, "start_column": 4, "end_line": 116, "end_column": 11 }, { "span": "except:", "start_line": 262, "start_column": 4, "end_line": 262, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "distance", "\\u", "fail", "\\u", "with", "\\u", "difference", "\\u", "size", "\\u", "ip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "\\u", "1_", "=_", "np_", "._", "matrix_", "(_", "[_", "[_", "0_", ",_", "1_", "/_", "3._", "]_", ",_", "[_", "0_", ",_", "1._", "]_", "]_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "3_", "=_", "np_", "._", "matrix_", "(_", "[_", "[_", "2_", "/_", "3._", ",_", "0_", "]_", ",_", "[_", "2_", "/_", "3._", ",_", "2_", "/_", "3._", "]_", ",_", "[_", "0_", ",_", "2_", "/_", "3._", "]_", "]_", ",_", "dtype_", "=_", "np_", "._", "float32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute", "\\u", "distance_", "(_", "input", "\\u", "1_", ",_", "input", "\\u", "3_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Different", " ", "size", " ", "matric", "es", " ", "did", " ", "not", " ", "trigger", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "catch", "\\u", "combo", "s", "\\u", "too", "\\u", "large_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "N_", "=_", "1e6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "choices_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "params_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "sample_", "=_", "np_", "._", "random_", "._", "random", "\\u", "sample_", "(_", "(_", "N_", ",_", "num", "\\u", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "find", "\\u", "most", "\\u", "distan", "t_", "(_", "input", "\\u", "sample_", ",_", "N_", ",_", "num", "\\u", "params_", ",_", "k", "\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Test", " ", "did", " ", "not", " ", "fail", " ", "whe", "n", " ", "number", " ", "of", " ", "\\\\", "\\", "10", ";", " ", " ", " ", "combinat", "ion", "s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
[ { "content": "from hearthbreaker.cards.minions.neutral import (\n BloodfenRaptor,\n IronbeakOwl,\n NoviceEngineer,\n StonetuskBoar,\n WarGolem,\n MogushanWarden,\n FaerieDragon,\n KoboldGeomancer,\n ElvenArcher,\n ArgentSquire,\n SilvermoonGuardian,\n TwilightDrake,\n MagmaRager,\n DireWolfAlpha,\n WorgenInfiltrator,\n Archmage,\n DalaranMage,\n Malygos,\n AzureDrake,\n OgreMagi,\n Spellbreaker,\n BloodmageThalnos,\n LootHoarder,\n LeperGnome,\n IronforgeRifleman,\n GnomishInventor,\n GoldshireFootman,\n FrostwolfGrunt,\n IronfurGrizzly,\n LordOfTheArena,\n MurlocRaider,\n ManaAddict,\n OasisSnapjaw,\n RecklessRocketeer,\n RiverCrocolisk,\n SenjinShieldmasta,\n ScarletCrusader,\n Shieldbearer,\n SilverbackPatriarch,\n JunglePanther,\n RavenholdtAssassin,\n StormpikeCommando,\n StormwindKnight,\n StranglethornTiger,\n Sunwalker,\n ThrallmarFarseer,\n WindfuryHarpy,\n YoungDragonhawk,\n Wolfrider,\n BootyBayBodyguard,\n BoulderfistOgre,\n ChillwindYeti,\n CoreHound,\n VoodooDoctor,\n EarthenRingFarseer,\n ArcaneGolem,\n PriestessOfElune,\n DarkscaleHealer,\n ArgentCommander,\n BluegillWarrior,\n Wisp,\n Nightblade,\n ShatteredSunCleric,\n TheBlackKnight,\n AbusiveSergeant,\n DarkIronDwarf,\n Abomination,\n AmaniBerserker,\n SilverHandKnight,\n FenCreeper,\n VentureCoMercenary,\n StormwindChampion,\n Deathwing,\n Alexstrasza,\n EmperorCobra,\n CrazedAlchemist,\n AcidicSwampOoze,\n AncientBrewmaster,\n YouthfulBrewmaster,\n BaronGeddon,\n AngryChicken,\n RagingWorgen,\n TaurenWarrior,\n SpitefulSmith,\n BloodKnight,\n FrostwolfWarlord,\n RaidLeader,\n DragonlingMechanic,\n MurlocTidehunter,\n RazorfenHunter,\n KnifeJuggler,\n CairneBloodhoof,\n HarvestGolem,\n TheBeast,\n SylvanasWindrunner,\n StampedingKodo,\n FrostElemental,\n Demolisher,\n Doomsayer,\n Gruul,\n Hogger,\n ImpMaster,\n InjuredBlademaster,\n MasterSwordsmith,\n NatPagle,\n Nozdormu,\n RagnarosTheFirelord,\n ColdlightOracle,\n ColdlightSeer,\n GrimscaleOracle,\n MurlocWarleader,\n AncientWatcher,\n BigGameHunter,\n BloodsailCorsair,\n BloodsailRaider,\n CaptainGreenskin,\n HungryCrab,\n MadBomber,\n ManaWraith,\n MindControlTech,\n MurlocTidecaller,\n Onyxia,\n SouthseaCaptain,\n SouthseaDeckhand,\n YoungPriestess,\n AcolyteOfPain,\n CultMaster,\n Secretkeeper,\n VioletTeacher,\n GadgetzanAuctioneer,\n IllidanStormrage,\n Lightwarden,\n FlesheatingGhoul,\n QuestingAdventurer,\n GurubashiBerserker,\n AncientMage,\n DefenderOfArgus,\n SunfuryProtector,\n HarrisonJones,\n KingMukla,\n LeeroyJenkins,\n SeaGiant,\n MoltenGiant,\n MountainGiant,\n DreadCorsair,\n CaptainsParrot,\n TinkmasterOverspark,\n AlarmoBot,\n EliteTaurenChieftain,\n MillhouseManastorm,\n PintSizedSummoner,\n OldMurkEye,\n Ysera,\n GelbinMekkatorque,\n LorewalkerCho,\n WildPyromancer,\n FacelessManipulator,\n NerubianEgg,\n Maexxna,\n HauntedCreeper,\n NerubarWeblord,\n UnstableGhoul,\n Loatheb,\n StoneskinGargoyle,\n SludgeBelcher,\n BaronRivendare,\n DancingSwords,\n Deathlord,\n SpectralKnight,\n Undertaker,\n WailingSoul,\n ZombieChow,\n Feugen,\n Stalagg,\n MadScientist,\n EchoingOoze,\n ShadeOfNaxxramas,\n KelThuzad,\n PilotedShredder,\n PilotedSkyGolem,\n SneedsOldShredder,\n AntiqueHealbot,\n AnnoyoTron,\n ArcaneNullifierX21,\n Blingtron3000,\n BombLobber,\n BurlyRockjawTrogg,\n Mechwarper,\n Frog,\n ClockworkGiant,\n ClockworkGnome,\n BoomBot,\n DoctorBoom,\n TargetDummy,\n ExplosiveSheep,\n Puddlestomper,\n MicroMachine,\n MechanicalYeti,\n SpiderTank,\n GilblinStalker,\n ShipsCannon,\n OgreBrute,\n MogorTheOgre,\n Toshley,\n ForceTankMAX,\n FelReaver,\n MadderBomber,\n Gazlowe,\n MiniMage,\n SaltyDog,\n GnomereganInfantry,\n FlyingMachine,\n LostTallstrider,\n HemetNesingwary,\n Illuminator,\n MekgineerThermaplugg,\n StonesplinterTrogg,\n TroggzorTheEarthinator,\n Hobgoblin,\n Cogmaster,\n GoblinSapper,\n TinkertownTechnician,\n Junkbot,\n Jeeves,\n Recombobulator,\n LilExorcist,\n EnhanceoMechano,\n FoeReaper4000,\n KezanMystic,\n MimironsHead,\n GnomishExperimenter,\n HungryDragon,\n GrimPatron,\n BlackwingTechnician,\n EmperorThaurissan,\n MajordomoExecutus,\n VolcanicDrake,\n BlackwingCorruptor,\n DrakonidCrusher,\n DragonEgg,\n Chromaggus,\n DragonkinSorcerer,\n RendBlackhand,\n Nefarian,\n TournamentMedic,\n ArgentHorserider,\n ArgentWatchman,\n ArmoredWarhorse,\n)\n\nfrom hearthbreaker.cards.minions.druid import (\n KeeperOfTheGrove,\n DruidOfTheClaw,\n AncientOfLore,\n AncientOfWar,\n IronbarkProtector,\n Cenarius,\n AnodizedRoboCub,\n MechBearCat,\n DruidOfTheFang,\n Malorne,\n GroveTender,\n DruidOfTheFlame,\n VolcanicLumberer,\n)\n\nfrom hearthbreaker.cards.minions.hunter import (\n TimberWolf,\n SavannahHighmane,\n Houndmaster,\n KingKrush,\n StarvingBuzzard,\n TundraRhino,\n ScavengingHyena,\n Webspinner,\n Hound,\n Huffer,\n Misha,\n Leokk,\n Snake,\n MetaltoothLeaper,\n KingOfBeasts,\n Gahzrilla,\n SteamwheedleSniper,\n CoreRager,\n Acidmaw,\n)\n\nfrom hearthbreaker.cards.minions.mage import (\n ManaWyrm,\n SorcerersApprentice,\n KirinTorMage,\n EtherealArcanist,\n WaterElemental,\n ArchmageAntonidas,\n Snowchugger,\n GoblinBlastmage,\n SootSpewer,\n WeeSpellstopper,\n FlameLeviathan,\n Flamewaker\n)\n\nfrom hearthbreaker.cards.minions.paladin import (\n AldorPeacekeeper,\n ArgentProtector,\n GuardianOfKings,\n TirionFordring,\n CobaltGuardian,\n SilverHandRecruit,\n ShieldedMinibot,\n Quartermaster,\n ScarletPurifier,\n BolvarFordragon,\n DragonConsort,\n)\n\nfrom hearthbreaker.cards.minions.priest import (\n AuchenaiSoulpriest,\n CabalShadowPriest,\n Lightspawn,\n Lightwell,\n NorthshireCleric,\n ProphetVelen,\n TempleEnforcer,\n DarkCultist,\n Shrinkmeister,\n UpgradedRepairBot,\n Shadowbomber,\n Shadowboxer,\n Voljin,\n TwilightWhelp,\n)\n\nfrom hearthbreaker.cards.minions.rogue import (\n AnubarAmbusher,\n DefiasRingleader,\n EdwinVanCleef,\n Kidnapper,\n MasterOfDisguise,\n PatientAssassin,\n SI7Agent,\n OneeyedCheat,\n IronSensei,\n OgreNinja,\n TradePrinceGallywix,\n GoblinAutoBarber,\n DarkIronSkulker,\n Anubarak,\n)\n\nfrom hearthbreaker.cards.minions.shaman import (\n AlAkirTheWindlord,\n DustDevil,\n EarthElemental,\n FireElemental,\n FlametongueTotem,\n ManaTideTotem,\n UnboundElemental,\n Windspeaker,\n HealingTotem,\n SearingTotem,\n StoneclawTotem,\n WrathOfAirTotem,\n SpiritWolf,\n VitalityTotem,\n SiltfinSpiritwalker,\n WhirlingZapomatic,\n DunemaulShaman,\n Neptulon,\n FireguardDestroyer,\n)\n\nfrom hearthbreaker.cards.minions.warlock import (\n FlameImp,\n PitLord,\n Voidwalker,\n DreadInfernal,\n Felguard,\n Doomguard,\n Succubus,\n SummoningPortal,\n BloodImp,\n LordJaraxxus,\n VoidTerror,\n Voidcaller,\n AnimaGolem,\n WorthlessImp,\n FelCannon,\n MalGanis,\n FloatingWatcher,\n MistressOfPain,\n ImpGangBoss,\n)\n\nfrom hearthbreaker.cards.minions.warrior import (\n ArathiWeaponsmith,\n Armorsmith,\n CruelTaskmaster,\n FrothingBerserker,\n GrommashHellscream,\n KorkronElite,\n WarsongCommander,\n Warbot,\n Shieldmaiden,\n SiegeEngine,\n IronJuggernaut,\n ScrewjankClunker,\n AxeFlinger,\n AlexstraszasChampion,\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from hearthbreaker.cards.minions.neutral import (\n BloodfenRaptor,\n IronbeakOwl,\n NoviceEngineer,\n StonetuskBoar,\n WarGolem,\n MogushanWarden,\n FaerieDragon,\n KoboldGeomancer,\n ElvenArcher,\n ArgentSquire,\n SilvermoonGuardian,\n TwilightDrake,\n MagmaRager,\n DireWolfAlpha,\n WorgenInfiltrator,\n Archmage,\n DalaranMage,\n Malygos,\n AzureDrake,\n OgreMagi,\n Spellbreaker,\n BloodmageThalnos,\n LootHoarder,\n LeperGnome,\n IronforgeRifleman,\n GnomishInventor,\n GoldshireFootman,\n FrostwolfGrunt,\n IronfurGrizzly,\n LordOfTheArena,\n MurlocRaider,\n ManaAddict,\n OasisSnapjaw,\n RecklessRocketeer,\n RiverCrocolisk,\n SenjinShieldmasta,\n ScarletCrusader,\n Shieldbearer,\n SilverbackPatriarch,\n JunglePanther,\n RavenholdtAssassin,\n StormpikeCommando,\n StormwindKnight,\n StranglethornTiger,\n Sunwalker,\n ThrallmarFarseer,\n WindfuryHarpy,\n YoungDragonhawk,\n Wolfrider,\n BootyBayBodyguard,\n BoulderfistOgre,\n ChillwindYeti,\n CoreHound,\n VoodooDoctor,\n EarthenRingFarseer,\n ArcaneGolem,\n PriestessOfElune,\n DarkscaleHealer,\n ArgentCommander,\n BluegillWarrior,\n Wisp,\n Nightblade,\n ShatteredSunCleric,\n TheBlackKnight,\n AbusiveSergeant,\n DarkIronDwarf,\n Abomination,\n AmaniBerserker,\n SilverHandKnight,\n FenCreeper,\n VentureCoMercenary,\n StormwindChampion,\n Deathwing,\n Alexstrasza,\n EmperorCobra,\n CrazedAlchemist,\n AcidicSwampOoze,\n AncientBrewmaster,\n YouthfulBrewmaster,\n BaronGeddon,\n AngryChicken,\n RagingWorgen,\n TaurenWarrior,\n SpitefulSmith,\n BloodKnight,\n FrostwolfWarlord,\n RaidLeader,\n DragonlingMechanic,\n MurlocTidehunter,\n RazorfenHunter,\n KnifeJuggler,\n CairneBloodhoof,\n HarvestGolem,\n TheBeast,\n SylvanasWindrunner,\n StampedingKodo,\n FrostElemental,\n Demolisher,\n Doomsayer,\n Gruul,\n Hogger,\n ImpMaster,\n InjuredBlademaster,\n MasterSwordsmith,\n NatPagle,\n Nozdormu,\n RagnarosTheFirelord,\n ColdlightOracle,\n ColdlightSeer,\n GrimscaleOracle,\n MurlocWarleader,\n AncientWatcher,\n BigGameHunter,\n BloodsailCorsair,\n BloodsailRaider,\n CaptainGreenskin,\n HungryCrab,\n MadBomber,\n ManaWraith,\n MindControlTech,\n MurlocTidecaller,\n Onyxia,\n SouthseaCaptain,\n SouthseaDeckhand,\n YoungPriestess,\n AcolyteOfPain,\n CultMaster,\n Secretkeeper,\n VioletTeacher,\n GadgetzanAuctioneer,\n IllidanStormrage,\n Lightwarden,\n FlesheatingGhoul,\n QuestingAdventurer,\n GurubashiBerserker,\n AncientMage,\n DefenderOfArgus,\n SunfuryProtector,\n HarrisonJones,\n KingMukla,\n LeeroyJenkins,\n SeaGiant,\n MoltenGiant,\n MountainGiant,\n DreadCorsair,\n CaptainsParrot,\n TinkmasterOverspark,\n AlarmoBot,\n EliteTaurenChieftain,\n MillhouseManastorm,\n PintSizedSummoner,\n OldMurkEye,\n Ysera,\n GelbinMekkatorque,\n LorewalkerCho,\n WildPyromancer,\n FacelessManipulator,\n NerubianEgg,\n Maexxna,\n HauntedCreeper,\n NerubarWeblord,\n UnstableGhoul,\n Loatheb,\n StoneskinGargoyle,\n SludgeBelcher,\n BaronRivendare,\n DancingSwords,\n Deathlord,\n SpectralKnight,\n Undertaker,\n WailingSoul,\n ZombieChow,\n Feugen,\n Stalagg,\n MadScientist,\n EchoingOoze,\n ShadeOfNaxxramas,\n KelThuzad,\n PilotedShredder,\n PilotedSkyGolem,\n SneedsOldShredder,\n AntiqueHealbot,\n AnnoyoTron,\n ArcaneNullifierX21,\n Blingtron3000,\n BombLobber,\n BurlyRockjawTrogg,\n Mechwarper,\n Frog,\n ClockworkGiant,\n ClockworkGnome,\n BoomBot,\n DoctorBoom,\n TargetDummy,\n ExplosiveSheep,\n Puddlestomper,\n MicroMachine,\n MechanicalYeti,\n SpiderTank,\n GilblinStalker,\n ShipsCannon,\n OgreBrute,\n MogorTheOgre,\n Toshley,\n ForceTankMAX,\n FelReaver,\n MadderBomber,\n Gazlowe,\n MiniMage,\n SaltyDog,\n GnomereganInfantry,\n FlyingMachine,\n LostTallstrider,\n HemetNesingwary,\n Illuminator,\n MekgineerThermaplugg,\n StonesplinterTrogg,\n TroggzorTheEarthinator,\n Hobgoblin,\n Cogmaster,\n GoblinSapper,\n TinkertownTechnician,\n Junkbot,\n Jeeves,\n Recombobulator,\n LilExorcist,\n EnhanceoMechano,\n FoeReaper4000,\n KezanMystic,\n MimironsHead,\n GnomishExperimenter,\n HungryDragon,\n GrimPatron,\n BlackwingTechnician,\n EmperorThaurissan,\n MajordomoExecutus,\n VolcanicDrake,\n BlackwingCorruptor,\n DrakonidCrusher,\n DragonEgg,\n Chromaggus,\n DragonkinSorcerer,\n RendBlackhand,\n Nefarian,\n TournamentMedic,\n ArgentHorserider,\n ArgentWatchman,\n ArmoredWarhorse,\n)", "start_line": 0, "start_column": 0, "end_line": 249, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.druid import (\n KeeperOfTheGrove,\n DruidOfTheClaw,\n AncientOfLore,\n AncientOfWar,\n IronbarkProtector,\n Cenarius,\n AnodizedRoboCub,\n MechBearCat,\n DruidOfTheFang,\n Malorne,\n GroveTender,\n DruidOfTheFlame,\n VolcanicLumberer,\n)", "start_line": 251, "start_column": 0, "end_line": 265, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.hunter import (\n TimberWolf,\n SavannahHighmane,\n Houndmaster,\n KingKrush,\n StarvingBuzzard,\n TundraRhino,\n ScavengingHyena,\n Webspinner,\n Hound,\n Huffer,\n Misha,\n Leokk,\n Snake,\n MetaltoothLeaper,\n KingOfBeasts,\n Gahzrilla,\n SteamwheedleSniper,\n CoreRager,\n Acidmaw,\n)", "start_line": 267, "start_column": 0, "end_line": 287, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.mage import (\n ManaWyrm,\n SorcerersApprentice,\n KirinTorMage,\n EtherealArcanist,\n WaterElemental,\n ArchmageAntonidas,\n Snowchugger,\n GoblinBlastmage,\n SootSpewer,\n WeeSpellstopper,\n FlameLeviathan,\n Flamewaker\n)", "start_line": 289, "start_column": 0, "end_line": 302, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.paladin import (\n AldorPeacekeeper,\n ArgentProtector,\n GuardianOfKings,\n TirionFordring,\n CobaltGuardian,\n SilverHandRecruit,\n ShieldedMinibot,\n Quartermaster,\n ScarletPurifier,\n BolvarFordragon,\n DragonConsort,\n)", "start_line": 304, "start_column": 0, "end_line": 316, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.priest import (\n AuchenaiSoulpriest,\n CabalShadowPriest,\n Lightspawn,\n Lightwell,\n NorthshireCleric,\n ProphetVelen,\n TempleEnforcer,\n DarkCultist,\n Shrinkmeister,\n UpgradedRepairBot,\n Shadowbomber,\n Shadowboxer,\n Voljin,\n TwilightWhelp,\n)", "start_line": 318, "start_column": 0, "end_line": 333, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.rogue import (\n AnubarAmbusher,\n DefiasRingleader,\n EdwinVanCleef,\n Kidnapper,\n MasterOfDisguise,\n PatientAssassin,\n SI7Agent,\n OneeyedCheat,\n IronSensei,\n OgreNinja,\n TradePrinceGallywix,\n GoblinAutoBarber,\n DarkIronSkulker,\n Anubarak,\n)", "start_line": 335, "start_column": 0, "end_line": 350, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.shaman import (\n AlAkirTheWindlord,\n DustDevil,\n EarthElemental,\n FireElemental,\n FlametongueTotem,\n ManaTideTotem,\n UnboundElemental,\n Windspeaker,\n HealingTotem,\n SearingTotem,\n StoneclawTotem,\n WrathOfAirTotem,\n SpiritWolf,\n VitalityTotem,\n SiltfinSpiritwalker,\n WhirlingZapomatic,\n DunemaulShaman,\n Neptulon,\n FireguardDestroyer,\n)", "start_line": 352, "start_column": 0, "end_line": 372, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.warlock import (\n FlameImp,\n PitLord,\n Voidwalker,\n DreadInfernal,\n Felguard,\n Doomguard,\n Succubus,\n SummoningPortal,\n BloodImp,\n LordJaraxxus,\n VoidTerror,\n Voidcaller,\n AnimaGolem,\n WorthlessImp,\n FelCannon,\n MalGanis,\n FloatingWatcher,\n MistressOfPain,\n ImpGangBoss,\n)", "start_line": 374, "start_column": 0, "end_line": 394, "end_column": 1 }, { "span": "from hearthbreaker.cards.minions.warrior import (\n ArathiWeaponsmith,\n Armorsmith,\n CruelTaskmaster,\n FrothingBerserker,\n GrommashHellscream,\n KorkronElite,\n WarsongCommander,\n Warbot,\n Shieldmaiden,\n SiegeEngine,\n IronJuggernaut,\n ScrewjankClunker,\n AxeFlinger,\n AlexstraszasChampion,\n)", "start_line": 396, "start_column": 0, "end_line": 411, "end_column": 1 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "neutral", "_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Bloo", "df", "en", "Ra", "pto", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Iron", "bea", "k", "Ow", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Nov", "ice", "Engine", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stone", "tus", "k", "Boa", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "War", "Gol", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mo", "gus", "han", "War", "den_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fa", "eri", "e", "Drag", "on_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ko", "bold", "Geo", "man", "cer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "El", "ven", "Arch", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Argent", "Squ", "ire_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sil", "ver", "moon", "Guard", "ian_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Twi", "light", "Dra", "ke_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mag", "ma", "Rag", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dir", "e", "Wolf", "Alpha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wor", "gen", "Inf", "ilt", "rator", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Arch", "mage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dal", "aran", "Mag", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mal", "yg", "os_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Az", "ure", "Dra", "ke_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Og", "re", "Mag", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spell", "break", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bloo", "dma", "ge", "Tha", "lno", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lo", "ot", "Ho", "ard", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Le", "per", "Gn", "ome_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Iron", "forge", "Ri", "fle", "man_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gn", "omi", "sh", "Inven", "tor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gold", "shir", "e", "Foot", "man_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fro", "st", "wolf", "Gr", "unt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Iron", "fur", "Gri", "zz", "ly_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lor", "d", "Of", "The", "Are", "na_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mur", "loc", "Rai", "der_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mana", "Add", "ict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Oa", "sis", "Snap", "ja", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Rec", "kle", "ss", "Rock", "ete", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "River", "Cro", "coli", "sk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sen", "jin", "Shield", "mas", "ta_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sca", "rle", "t", "Cru", "sad", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Shield", "bear", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sil", "verba", "ck", "Patr", "iar", "ch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Jun", "gle", "Pant", "her_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ra", "ven", "hold", "t", "Ass", "assi", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stor", "mpi", "ke", "Command", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stor", "mw", "ind", "Kn", "ight_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stra", "ngle", "thor", "n", "Ti", "ger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sun", "walker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Thr", "all", "mar", "Far", "see", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wind", "fur", "y", "Har", "py_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "You", "ng", "Drag", "on", "haw", "k_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wolf", "ride", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Boot", "y", "Ba", "y", "Bod", "yg", "uar", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bou", "lder", "fis", "t", "Og", "re_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Chil", "lw", "ind", "Ye", "ti_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Core", "Hou", "nd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vo", "odo", "o", "Doc", "tor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ear", "then", "Ring", "Far", "see", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Arc", "ane", "Gol", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pri", "este", "ss", "Of", "El", "une", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dar", "ks", "cale", "Hea", "ler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Argent", "Command", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Blue", "gil", "l", "War", "rior", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wis", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Night", "blade", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sha", "tter", "ed", "Sun", "Cle", "ric", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "The", "Black", "Kn", "ight_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Abu", "sive", "Ser", "ge", "ant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dar", "k", "Iron", "Dw", "arf", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Abo", "minat", "ion_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ama", "ni", "Ber", "ser", "ker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sil", "ver", "Hand", "Kn", "ight_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fen", "Cre", "epe", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vent", "ure", "Co", "Merc", "ena", "ry_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stor", "mw", "ind", "Cham", "pio", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Death", "wing", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Alex", "stra", "sz", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Emp", "ero", "r", "Cob", "ra_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cra", "zed", "Al", "chemi", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Aci", "dic", "Swa", "mp", "Oo", "ze_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anc", "ient", "Bre", "wma", "ster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "You", "th", "ful", "Bre", "wma", "ster_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bar", "on", "Ge", "ddo", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ang", "ry", "Chi", "cke", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Rag", "ing", "Wor", "gen_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tau", "ren", "War", "rior", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spi", "tef", "ul", "Smi", "th_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bloo", "d", "Kn", "ight_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fro", "st", "wolf", "War", "lord", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Rai", "d", "Leader", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Drag", "onli", "ng", "Mechani", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mur", "loc", "Tid", "eh", "unter", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ra", "zor", "fen", "Hunt", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Kn", "ife", "Ju", "ggle", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cai", "rne", "Bloo", "dh", "oo", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Harvest", "Gol", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "The", "Bea", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sy", "lv", "ana", "s", "Wind", "runner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stampe", "ding", "Ko", "do_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fro", "st", "Element", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Demo", "lish", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Doo", "msa", "yer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gr", "uu", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ho", "gger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Imp", "Master_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In", "jur", "ed", "Bla", "dem", "aster", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Master", "Sw", "ords", "mit", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Nat", "Pag", "le_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "No", "zd", "orm", "u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Rag", "nar", "os", "The", "Fire", "lord", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Col", "dli", "ght", "Ora", "cle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Col", "dli", "ght", "See", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gri", "msc", "ale", "Ora", "cle_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mur", "loc", "War", "leader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anc", "ient", "Watcher", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Big", "Game", "Hunt", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bloo", "dsa", "il", "Cor", "sai", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bloo", "dsa", "il", "Rai", "der_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Capt", "ain", "Green", "skin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hun", "gr", "y", "Cra", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mad", "Bom", "ber_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mana", "Wra", "ith", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Min", "d", "Control", "Te", "ch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mur", "loc", "Tid", "eca", "ller", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "On", "yx", "ia_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "South", "sea", "Capt", "ain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "South", "sea", "Deck", "hand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "You", "ng", "Pri", "este", "ss_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Aco", "ly", "te", "Of", "Pai", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cul", "t", "Master_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sec", "ret", "keeper", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vio", "let", "Teacher", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "dget", "zan", "Auc", "tion", "eer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Il", "lida", "n", "Stor", "mr", "age_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Light", "ward", "en_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fle", "she", "ati", "ng", "Gh", "oul", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Quest", "ing", "Adv", "ent", "ure", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gu", "rub", "ash", "i", "Ber", "ser", "ker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anc", "ient", "Mag", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Defen", "der", "Of", "Arg", "us_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sun", "fur", "y", "Protect", "or_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Har", "ris", "on", "Jones", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "King", "Mu", "kla", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lee", "roy", "Jen", "kins", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sea", "Gi", "ant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mol", "ten", "Gi", "ant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mount", "ain", "Gi", "ant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dre", "ad", "Cor", "sai", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Capt", "ain", "s", "Par", "rot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tin", "kma", "ster", "Over", "spark_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Alarm", "o", "Bot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Eli", "te", "Tau", "ren", "Chi", "eft", "ain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mill", "house", "Mana", "storm", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pin", "t", "Size", "d", "Summ", "oner", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Old", "Mur", "k", "Ey", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ys", "era", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ge", "lb", "in", "Me", "kka", "torque", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lore", "walker", "Cho", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wild", "Pyro", "man", "cer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Face", "less", "Manipulat", "or_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ne", "rub", "ian", "Egg", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ma", "ex", "xn", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ha", "unt", "ed", "Cre", "epe", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ne", "rub", "ar", "Web", "lord", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Uns", "table", "Gh", "oul", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Loa", "the", "b_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stone", "skin", "Gar", "go", "yle", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sl", "ud", "ge", "Bel", "cher", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bar", "on", "Ri", "vend", "are", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dan", "cing", "Sw", "ords_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Death", "lord", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spectra", "l", "Kn", "ight_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Under", "take", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wa", "ilin", "g", "Sou", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Zo", "mbi", "e", "Cho", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fe", "ugen", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sta", "lag", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mad", "Sci", "enti", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ech", "oin", "g", "Oo", "ze_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Shad", "e", "Of", "Na", "xx", "rama", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Kel", "Thu", "zad", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pilo", "ted", "Sh", "red", "der_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pilo", "ted", "Sky", "Gol", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sn", "eed", "s", "Old", "Sh", "red", "der_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anti", "que", "Hea", "lbo", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ann", "oy", "o", "Tro", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Arc", "ane", "Null", "ifie", "r", "X", "21_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Blin", "gt", "ron", "3000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bom", "b", "Lo", "bber", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bur", "ly", "Rock", "ja", "w", "Tro", "gg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Me", "ch", "warp", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fro", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Clo", "ck", "work", "Gi", "ant_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Clo", "ck", "work", "Gn", "ome_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Boo", "m", "Bot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Doc", "tor", "Boo", "m_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Target", "Dummy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Explo", "sive", "She", "ep_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pu", "ddl", "esto", "mpe", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Micro", "Machine_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mechani", "cal", "Ye", "ti_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spi", "der", "Tank", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gi", "lbl", "in", "Sta", "lke", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ship", "s", "Cann", "on_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Og", "re", "Bru", "te_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mo", "gor", "The", "Og", "re_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tos", "hle", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Force", "Tank", "MAX_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fel", "Rea", "ver_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mad", "der", "Bom", "ber_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "zl", "owe", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mini", "Mag", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sal", "ty", "Dog", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gn", "ome", "rega", "n", "Inf", "ant", "ry_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fly", "ing", "Machine_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lost", "Tal", "lst", "ride", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "He", "met", "Ne", "sing", "war", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Illu", "minat", "or_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Me", "kg", "ine", "er", "The", "rma", "plug", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stone", "spl", "inter", "Tro", "gg_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tro", "gg", "zor", "The", "Ear", "thin", "ator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ho", "bg", "obli", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cog", "master_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Go", "blin", "Sap", "per_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tin", "ker", "town", "Techni", "cia", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Jun", "kb", "ot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Je", "eve", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Reco", "mbo", "bul", "ator_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lil", "Exo", "rci", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Enhance", "o", "Me", "chan", "o_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fo", "e", "Rea", "per", "4000_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ke", "zan", "Mys", "tic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mim", "iron", "s", "Head_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gn", "omi", "sh", "Experiment", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hun", "gr", "y", "Drag", "on_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gri", "m", "Patr", "on_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Black", "wing", "Techni", "cia", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Emp", "ero", "r", "Tha", "uris", "san", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Maj", "ord", "omo", "Execut", "us_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vol", "can", "ic", "Dra", "ke_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Black", "wing", "Corr", "upto", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dra", "kon", "id", "Cru", "sher", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Drag", "on", "Egg", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Chrom", "agg", "us_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Drag", "onk", "in", "So", "rce", "rer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ren", "d", "Black", "hand_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ne", "far", "ian_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tourn", "ament", "Medi", "c_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Argent", "Hor", "seri", "der_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Argent", "Watch", "man_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Armor", "ed", "War", "horse", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "dru", "id_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Keep", "er", "Of", "The", "Gro", "ve_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dru", "id", "Of", "The", "Cla", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anc", "ient", "Of", "Lore", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anc", "ient", "Of", "War", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Iron", "bar", "k", "Protect", "or_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cen", "ari", "us_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ano", "di", "zed", "Rob", "o", "Cub", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Me", "ch", "Bear", "Cat_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dru", "id", "Of", "The", "Fan", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mal", "orn", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gro", "ve", "Tend", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dru", "id", "Of", "The", "Fla", "me_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vol", "can", "ic", "Lum", "ber", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "hunt", "er_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Tim", "ber", "Wolf", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sav", "anna", "h", "Hig", "hma", "ne_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hou", "ndm", "aster", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "King", "Kr", "ush_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Star", "ving", "Bu", "zza", "rd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Tun", "dra", "Rh", "ino_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sca", "ven", "ging", "Hy", "ena", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Webs", "pin", "ner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hou", "nd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hu", "ffer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mis", "ha_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Leo", "kk_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sna", "ke_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Meta", "lto", "oth", "Lea", "per_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "King", "Of", "Bea", "sts_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ga", "hz", "rill", "a_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ste", "am", "whe", "edl", "e", "Sni", "per_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Core", "Rag", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Aci", "dma", "w_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "mage_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Mana", "Wy", "rm_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "So", "rce", "rer", "s", "App", "rent", "ice_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ki", "rin", "Tor", "Mag", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ether", "eal", "Arc", "ani", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Water", "Element", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Arch", "mage", "Ant", "oni", "das_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Snow", "chu", "gger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Go", "blin", "Blast", "mage_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "So", "ot", "Spe", "wer", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "We", "e", "Spell", "stopp", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fla", "me", "Lev", "iat", "han", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fla", "me", "wake", "r_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "pala", "din", "_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Al", "dor", "Pea", "ce", "keeper", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Argent", "Protect", "or_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Guard", "ian", "Of", "King", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ti", "rio", "n", "For", "dri", "ng_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cob", "alt", "Guard", "ian_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sil", "ver", "Hand", "Rec", "rui", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Shield", "ed", "Mini", "bot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Quart", "erm", "aster", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sca", "rle", "t", "Pur", "ifie", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bol", "var", "For", "dragon", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Drag", "on", "Cons", "ort_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "pri", "est_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Auc", "hen", "ai", "Sou", "lpr", "ies", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cab", "al", "Shad", "ow", "Pri", "est_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Light", "spawn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Light", "well_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "North", "shir", "e", "Cle", "ric", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Prop", "het", "Vel", "en_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Temp", "le", "Enf", "orce", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dar", "k", "Cul", "tis", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sh", "rin", "km", "eis", "ter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Upgrade", "d", "Repair", "Bot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Shad", "ow", "bomb", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Shad", "ow", "box", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vol", "jin", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Twi", "light", "Whe", "lp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "rog", "ue_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "An", "uba", "r", "Amb", "ush", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Def", "ias", "Ring", "leader_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ed", "win", "Van", "Cle", "ef_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ki", "dna", "pper", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Master", "Of", "Dis", "gui", "se_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pat", "ient", "Ass", "assi", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SI", "7", "Agent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "One", "eye", "d", "Che", "at_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Iron", "Sense", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Og", "re", "Nin", "ja_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Trade", "Pri", "nce", "Gal", "ly", "wi", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Go", "blin", "Auto", "Bar", "ber_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dar", "k", "Iron", "Sku", "lke", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "An", "uba", "rak", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "sha", "man_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Al", "Ak", "ir", "The", "Wind", "lord", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Du", "st", "Dev", "il_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ear", "th", "Element", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fire", "Element", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fla", "met", "ong", "ue", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mana", "Tid", "e", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Unb", "ound", "Element", "al_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wind", "speaker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hea", "ling", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sear", "ing", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Stone", "cla", "w", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wra", "th", "Of", "Air", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Spi", "rit", "Wolf", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Vit", "ality", "Tot", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sil", "tfi", "n", "Spi", "rit", "walker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Whi", "rli", "ng", "Za", "pom", "atic", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dun", "ema", "ul", "Sha", "man_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Ne", "ptu", "lon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fire", "guard", "Destr", "oy", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "war", "lock_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Fla", "me", "Imp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pit", "Lor", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Voi", "dwa", "lke", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dre", "ad", "Infer", "nal_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fel", "guard_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Doo", "mg", "uar", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Suc", "cub", "us_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Summ", "oni", "ng", "Porta", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Bloo", "d", "Imp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Lor", "d", "Jar", "ax", "xu", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Voi", "d", "Ter", "ror_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Voi", "dca", "ller", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Anima", "Gol", "em_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Wor", "th", "less", "Imp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fel", "Cann", "on_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mal", "Gan", "is_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Float", "ing", "Watcher", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mis", "tres", "s", "Of", "Pai", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Imp", "Gan", "g", "Boss", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "heart", "hb", "reak", "er_", "._", "cards_", "._", "minions_", "._", "warr", "ior_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Ara", "thi", "Weapon", "smit", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Armor", "smit", "h_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cru", "el", "Task", "master_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Fro", "thing", "Ber", "ser", "ker_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Gro", "mma", "sh", "Hell", "scre", "am_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Kor", "kron", "Eli", "te_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "War", "song", "Command", "er_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "War", "bot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Shield", "maid", "en_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sie", "ge", "Engine_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Iron", "Ju", "gger", "naut", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Scr", "ew", "jan", "k", "Clu", "nke", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Axe", "Fli", "nger", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Alex", "stra", "sz", "as", "Cham", "pio", "n_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused local variable
mollyproject/mollyproject/molly/geolocation/providers/cloudmade.py
[ { "content": " def reverse_geocode(self, lon, lat):\n\n params = {\n 'api_key': settings.API_KEYS['cloudmade'],\n 'lon': lon,\n 'lat': lat,\n 'type': 'road',\n }\n\n try:\n request_url = self.REVERSE_GEOCODE_URL % params\n response = urllib2.urlopen(request_url)\n logger.debug(\"Reverse geocode request: %s\" % request_url)\n if response.code != 200:\n logger.error(\"Request to %s returned response code %d\" % (request_url, response.code))\n return []\n json = simplejson.loads(response.read().replace('&apos;', \"'\"), 'utf8')\n except urllib2.HTTPError, e:\n logger.error(\"Cloudmade returned a non-OK response code %d\", e.code)\n return []\n except urllib2.URLError, e:\n logger.error(\"Encountered an error reaching Cloudmade: %s\", str(e))\n return []\n\n if not json:\n return []\n else:\n name = json['features'][0]['properties'].get('name')\n if self.get_area:\n try:\n params['type'] = 'area'\n data = simplejson.load(urllib2.urlopen(self.REVERSE_GEOCODE_URL % params))\n logger.debug(\"Reverse geocode request: %s\" % (self.REVERSE_GEOCODE_URL % params))\n name = '%s, %s' % (name, data['features'][0]['properties']['name'])\n except Exception:\n pass\n return [{\n 'name': json['features'][0]['properties'].get('name'),\n 'location': (lon, lat),\n 'accuracy': 100,\n }]", "metadata": "root.CloudmadeGeolocationProvider.reverse_geocode", "header": "['class', 'CloudmadeGeolocationProvider', '(', 'BaseGeolocationProvider', ')', ':', '___EOS___']", "index": 42 } ]
[ { "span": "name ", "start_line": 75, "start_column": 20, "end_line": 75, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Cloud", "made", "Geo", "location", "Provider_", "(_", "Base", "Geo", "location", "Provider_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reverse", "\\u", "geocode", "_", "(_", "self_", ",_", "lon_", ",_", "lat_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "api", "\\u", "key", "'_", ":_", "settings_", "._", "API", "\\u", "KEYS_", "[_", "'", "cloud", "made", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lon", "'_", ":_", "lon_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "lat", "'_", ":_", "lat_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "road", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "url_", "=_", "self_", "._", "REVERSE", "\\u", "GEO", "CODE", "\\u", "URL_", "%_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "request", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Revers", "e", " ", "geocode", " ", "request", ":", " ", "%", "s", "\"_", "%_", "request", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "code_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Request", " ", "to", " ", "%", "s", " ", "return", "ed", " ", "response", " ", "code", " ", "%", "d", "\"_", "%_", "(_", "request", "\\u", "url_", ",_", "response_", "._", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json_", "=_", "simplejson_", "._", "loads_", "(_", "response_", "._", "read_", "(_", ")_", "._", "replace_", "(_", "'&", "apos", ";'_", ",_", "\"'\"_", ")_", ",_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "HTTP", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Cloud", "made", " ", "return", "ed", " ", "a", " ", "non", "-", "OK", " ", "response", " ", "code", " ", "%", "d", "\"_", ",_", "e_", "._", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "error_", "(_", "\"", "Enco", "unter", "ed", " ", "an", " ", "error", " ", "reach", "ing", " ", "Cloud", "made", ":", " ", "%", "s", "\"_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "json_", "[_", "'", "features", "'_", "]_", "[_", "0_", "]_", "[_", "'", "proper", "ties", "'_", "]_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "get", "\\u", "area_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "params_", "[_", "'", "type", "'_", "]_", "=_", "'", "area", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "simplejson_", "._", "load_", "(_", "urllib2_", "._", "urlopen_", "(_", "self_", "._", "REVERSE", "\\u", "GEO", "CODE", "\\u", "URL_", "%_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "debug_", "(_", "\"", "Revers", "e", " ", "geocode", " ", "request", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "REVERSE", "\\u", "GEO", "CODE", "\\u", "URL_", "%_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'%", "s", ",", " ", "%", "s", "'_", "%_", "(_", "name_", ",_", "data_", "[_", "'", "features", "'_", "]_", "[_", "0_", "]_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "json_", "[_", "'", "features", "'_", "]_", "[_", "0_", "]_", "[_", "'", "proper", "ties", "'_", "]_", "._", "get_", "(_", "'", "name", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "location", "'_", ":_", "(_", "lon_", ",_", "lat_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "accu", "rac", "y", "'_", ":_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2 ]
`__init__` method calls overridden method
erickrf/nlpnet/nlpnet/taggers.py
[ { "content": "class Tagger(object):\n \"\"\"\n Base class for taggers. It should not be instantiated.\n \"\"\"\n ", "metadata": "root.Tagger", "header": "['module', '___EOS___']", "index": 177 }, { "content": " def __init__(self, data_dir=None, language='en'):\n \"\"\"Creates a tagger and loads data preemptively\"\"\"\n asrt_msg = \"nlpnet data directory is not set. \\\nIf you don't have the trained models, download them from http://nilc.icmc.usp.br/nlpnet/models.html\"\n if data_dir is None:\n assert config.data_dir is not None, asrt_msg\n self.paths = config.FILES\n else:\n self.paths = config.get_config_paths(data_dir)\n \n self.data_dir = data_dir\n self.language = language\n self._load_data()", "metadata": "root.Tagger.__init__", "header": "['class', 'Tagger', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def _load_data(self):\n \"\"\"Implemented by subclasses\"\"\"\n pass", "metadata": "root.Tagger._load_data", "header": "['class', 'Tagger', '(', 'object', ')', ':', '___EOS___']", "index": 195 }, { "content": "class SRLTagger(Tagger):\n \"\"\"\n An SRLTagger loads the models and performs SRL on text.\n\n It works on three stages: predicate identification, argument detection and\n argument classification.\n \"\"\"\n\n \n \n ", "metadata": "root.SRLTagger", "header": "['module', '___EOS___']", "index": 200 }, { "content": " def _load_data(self):\n \"\"\"Loads data for SRL\"\"\"\n # load boundary identification network and reader\n md_boundary = Metadata.load_from_file('srl_boundary', self.paths)\n self.boundary_nn = load_network(md_boundary)\n self.boundary_reader = create_reader(md_boundary)\n self.boundary_reader.create_converter()\n self.boundary_itd = self.boundary_reader.get_inverse_tag_dictionary()\n \n # same for arg classification\n md_classify = Metadata.load_from_file('srl_classify', self.paths)\n self.classify_nn = load_network(md_classify)\n self.classify_reader = create_reader(md_classify)\n self.classify_reader.create_converter()\n self.classify_itd = self.classify_reader.get_inverse_tag_dictionary()\n \n # predicate detection\n md_pred = Metadata.load_from_file('srl_predicates', self.paths)\n self.pred_nn = load_network(md_pred)\n self.pred_reader = create_reader(md_pred)\n self.pred_reader.create_converter()", "metadata": "root.SRLTagger._load_data", "header": "['class', 'SRLTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 208 }, { "content": " def find_predicates(self, tokens):\n \"\"\"\n Finds out which tokens are predicates.\n\n :param tokens: a list of attribute.Token elements\n :returns: the indices of predicate tokens\n \"\"\"\n sent_codified = np.array([self.pred_reader.converter.convert(token)\n for token in tokens])\n answer = np.array(self.pred_nn.tag_sentence(sent_codified))\n return answer.nonzero()[0]", "metadata": "root.SRLTagger.find_predicates", "header": "['class', 'SRLTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 230 }, { "content": " def tag(self, text):\n \"\"\"\n Runs the SRL process on the given text.\n\n :param text: unicode or str encoded in utf-8.\n :param no_repeats: whether to prevent repeated argument labels\n :returns: a list of SRLAnnotatedSentence objects\n \"\"\"\n tokens = utils.tokenize(text, self.language)\n result = []\n for sent in tokens:\n tagged = self.tag_tokens(sent)\n result.append(tagged)\n \n return result", "metadata": "root.SRLTagger.tag", "header": "['class', 'SRLTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 242 }, { "content": " def tag_tokens(self, tokens, no_repeats=False):\n \"\"\"\n Runs the SRL process on the given tokens.\n\n :param tokens: a list of tokens (as strings)\n :param no_repeats: whether to prevent repeated argument labels\n :returns: a list of lists (one list for each sentence). Sentences have tuples\n (all_tokens, predicate, arg_structure), where arg_structure is a dictionary\n mapping argument labels to the words it includes.\n \"\"\"\n if self.language == 'pt':\n tokens_obj = [attributes.Token(utils.clean_text(t, False)) for t in tokens]\n else:\n tokens_obj = [attributes.Token(t) for t in tokens]\n \n converted_bound = np.array([self.boundary_reader.converter.convert(t) \n for t in tokens_obj])\n converted_class = np.array([self.classify_reader.converter.convert(t)\n for t in tokens_obj])\n \n pred_positions = self.find_predicates(tokens_obj)\n \n # first, argument boundary detection\n # the answer includes all predicates\n answers = self.boundary_nn.tag_sentence(converted_bound, pred_positions)\n boundaries = [[self.boundary_itd[x] for x in pred_answer]\n for pred_answer in answers]\n arg_limits = [utils.boundaries_to_arg_limits(pred_boundaries)\n for pred_boundaries in boundaries]\n \n # now, argument classification\n answers = self.classify_nn.tag_sentence(converted_class,\n pred_positions, arg_limits,\n allow_repeats=not no_repeats)\n arguments = [[self.classify_itd[x] for x in pred_answer]\n for pred_answer in answers]\n \n structures = _group_arguments(tokens, pred_positions, boundaries, arguments)\n return SRLAnnotatedSentence(tokens, structures)", "metadata": "root.SRLTagger.tag_tokens", "header": "['class', 'SRLTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 258 }, { "content": "class DependencyParser(Tagger):\n \"\"\"A Dependency Parser based on a neural network tagger.\"\"\"\n \n \n \n \n \n ", "metadata": "root.DependencyParser", "header": "['module', '___EOS___']", "index": 298 }, { "content": " def __init__(self, *args, **kwargs):\n \"\"\"\n Set the data directory for the POS tagger, if one is used,\n and call the parent constructor. \n \"\"\"\n super(DependencyParser, self).__init__(*args, **kwargs)", "metadata": "root.DependencyParser.__init__", "header": "['class', 'DependencyParser', '(', 'Tagger', ')', ':', '___EOS___']", "index": 301 }, { "content": " def _load_data(self):\n \"\"\"Loads data for Dependency Parsing\"\"\"\n md_udep = Metadata.load_from_file('unlabeled_dependency', paths=self.paths)\n self.unlabeled_nn = load_network(md_udep)\n self.unlabeled_reader = create_reader(md_udep)\n \n md_ldep = Metadata.load_from_file('labeled_dependency', paths=self.paths)\n self.labeled_nn = load_network(md_ldep)\n self.labeled_reader = create_reader(md_ldep)\n self.itd = self.labeled_reader.get_inverse_tag_dictionary()\n \n self.use_pos = md_udep.use_pos or md_ldep.use_pos\n if self.use_pos:\n self.pos_tagger = POSTagger(self.data_dir, language=self.language)", "metadata": "root.DependencyParser._load_data", "header": "['class', 'DependencyParser', '(', 'Tagger', ')', ':', '___EOS___']", "index": 308 }, { "content": " def parse(self, text):\n \"\"\"\n Split the given text into sentences and determines their \n dependency trees. If you want to provide your own tokenized\n text, use `parse_sentence` instead.\n \n :param text: a string\n :returns: a list of ParsedSentence's\n \"\"\"\n sentences = utils.tokenize(text, self.language)\n result = []\n for sent in sentences:\n parsed = self.parse_sentence(sent)\n result.append(parsed)\n \n return result", "metadata": "root.DependencyParser.parse", "header": "['class', 'DependencyParser', '(', 'Tagger', ')', ':', '___EOS___']", "index": 323 }, { "content": " def tag_tokens(self, tokens):\n \"\"\"\n Parse the given sentence. This function is just an alias for\n `parse_sentence`.\n \"\"\"\n return self.parse_sentence(tokens)", "metadata": "root.DependencyParser.tag_tokens", "header": "['class', 'DependencyParser', '(', 'Tagger', ')', ':', '___EOS___']", "index": 340 }, { "content": " def parse_sentence(self, tokens):\n \"\"\"\n Parse the given sentence. It must be already tokenized; if you\n want nlpnet to tokenize the text, use the method `parse` instead.\n \n :param tokens: a list of strings\n :return: a ParsedSentence instance\n \"\"\"\n original_tokens = tokens\n tokens_obj = []\n \n # if the parser uses POS a feature, have a tagger tag it first\n if self.use_pos:\n tokens = self.pos_tagger.tag_tokens(tokens, return_tokens=True)\n \n for token in tokens:\n if self.use_pos:\n # if we tagged for POS, each item is a tuple\n word, pos = token\n else:\n pos = None\n tokens_obj.append(attributes.Token(word, pos=pos))\n \n converted_tokens = self.unlabeled_reader.codify_sentence(tokens_obj)\n heads = self.unlabeled_nn.tag_sentence(converted_tokens)\n \n # the root is returned having a value == len(sentence)\n root = heads.argmax()\n heads[root] = root\n \n converted_tokens = self.labeled_reader.codify_sentence(tokens_obj)\n label_codes = self.labeled_nn.tag_sentence(converted_tokens, heads)\n labels = [self.itd[code] for code in label_codes]\n \n # to the final answer, signal the root with -1\n heads[root] = -1\n if self.use_pos:\n # unzip\n pos_tags = zip(*tokens)[1]\n else:\n pos_tags = None\n \n parsed = ParsedSentence(original_tokens, heads, labels, pos_tags)\n return parsed", "metadata": "root.DependencyParser.parse_sentence", "header": "['class', 'DependencyParser', '(', 'Tagger', ')', ':', '___EOS___']", "index": 347 }, { "content": " def tag(self, text):\n \"\"\"\n Parse the given text. This is just an alias for the \n `parse` method.\n \"\"\"\n return self.parse(text)", "metadata": "root.DependencyParser.tag", "header": "['class', 'DependencyParser', '(', 'Tagger', ')', ':', '___EOS___']", "index": 392 }, { "content": "class POSTagger(Tagger):\n \"\"\"A POSTagger loads the models and performs POS tagging on text.\"\"\"\n\n\n", "metadata": "root.POSTagger", "header": "['module', '___EOS___']", "index": 399 }, { "content": " def _load_data(self):\n \"\"\"Loads data for POS\"\"\"\n md = Metadata.load_from_file('pos', self.paths)\n self.nn = load_network(md)\n self.reader = create_reader(md)\n self.reader.create_converter()\n self.itd = self.reader.get_inverse_tag_dictionary()", "metadata": "root.POSTagger._load_data", "header": "['class', 'POSTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 402 }, { "content": " def tag(self, text):\n \"\"\"\n Tags the given text.\n\n :param text: a string or unicode object. Strings assumed to be utf-8\n :returns: a list of lists (sentences with tokens).\n Each sentence has (token, tag) tuples.\n \"\"\"\n tokens = utils.tokenize(text, self.language)\n result = []\n for sent in tokens:\n tagged = self.tag_tokens(sent, return_tokens=True)\n result.append(tagged)\n\n return result", "metadata": "root.POSTagger.tag", "header": "['class', 'POSTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 410 }, { "content": " def tag_tokens(self, tokens, return_tokens=False):\n \"\"\"\n Tags a given list of tokens.\n\n Tokens should be produced with the nlpnet tokenizer in order to\n match the entries in the vocabulary. If you have non-tokenized text,\n use POSTagger.tag(text).\n\n :param tokens: a list of strings\n :param return_tokens: if True, includes the tokens in the return,\n as a list of tuples (token, tag).\n :returns: a list of strings (the tags)\n \"\"\"\n converter = self.reader.converter\n converted_tokens = np.array([converter.convert(token) \n for token in tokens])\n \n answer = self.nn.tag_sentence(converted_tokens)\n tags = [self.itd[tag] for tag in answer]\n\n if return_tokens:\n return zip(tokens, tags)\n\n return tags", "metadata": "root.POSTagger.tag_tokens", "header": "['class', 'POSTagger', '(', 'Tagger', ')', ':', '___EOS___']", "index": 426 } ]
[ { "span": "self._load_data()", "start_line": 193, "start_column": 8, "end_line": 193, "end_column": 25 } ]
[ { "span": "def _load_data(self):", "start_line": 195, "start_column": 4, "end_line": 195, "end_column": 25 }, { "span": "def _load_data(self):", "start_line": 208, "start_column": 4, "end_line": 208, "end_column": 25 }, { "span": "def _load_data(self):", "start_line": 308, "start_column": 4, "end_line": 308, "end_column": 25 }, { "span": "def _load_data(self):", "start_line": 402, "start_column": 4, "end_line": 402, "end_column": 25 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Tagger", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "for", " ", "tagger", "s", ".", " ", "It", " ", "shou", "ld", " ", "not", " ", "be", " ", "instantiate", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tagger", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "data\\u", "dir_", "=_", "None_", ",_", "language_", "=_", "'", "en", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "tagger", " ", "and", " ", "load", "s", " ", "data", " ", "pree", "mpt", "ively", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "as", "rt", "\\u", "msg_", "=_", "\"", "nlp", "net", " ", "data", " ", "director", "y", " ", "is", " ", "not", " ", "set", ".", " ", "\\\\", "\\", "10", ";", "If", " ", "you", " ", "don", "'", "t", " ", "have", " ", "the", " ", "trained", " ", "model", "s", ",", " ", "download", " ", "them", " ", "from", " ", "http", "://", "nil", "c", ".", "ic", "mc", ".", "usp", ".", "br", "/", "nlp", "net", "/", "model", "s", ".", "html", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data\\u", "dir_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "config_", "._", "data\\u", "dir_", "is_", "not_", "None_", ",_", "as", "rt", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "paths_", "=_", "config_", "._", "FILES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "paths_", "=_", "config_", "._", "get", "\\u", "config", "\\u", "paths_", "(_", "data\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "data\\u", "dir_", "=_", "data\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "language_", "=_", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "load", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tagger", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Impl", "ement", "ed", " ", "by", " ", "subclasses", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "SR", "LT", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "SR", "LT", "agg", "er", " ", "load", "s", " ", "the", " ", "model", "s", " ", "and", " ", "perform", "s", " ", "SR", "L", " ", "on", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "works", " ", "on", " ", "three", " ", "stage", "s", ":", " ", "predica", "te", " ", "identifica", "tion", ",", " ", "argu", "ment", " ", "detect", "ion", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", " ", "classificati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SR", "LT", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "load", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", "s", " ", "data", " ", "for", " ", "SR", "L", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "load", " ", "bound", "ary", " ", "identifica", "tion", " ", "network", " ", "and", " ", "reader_", "\\u\\u\\uNL\\u\\u\\u_", "md", "\\u", "boundary_", "=_", "Metadata_", "._", "load", "\\u", "from", "\\u", "file_", "(_", "'", "sr", "l\\u", "bound", "ary", "'_", ",_", "self_", "._", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bound", "ary", "\\u", "nn_", "=_", "load", "\\u", "network_", "(_", "md", "\\u", "boundary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bound", "ary", "\\u", "reader_", "=_", "create", "\\u", "reader_", "(_", "md", "\\u", "boundary_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bound", "ary", "\\u", "reader_", "._", "create", "\\u", "converter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bound", "ary", "\\u", "it", "d_", "=_", "self_", "._", "bound", "ary", "\\u", "reader_", "._", "get", "\\u", "inv", "erse", "\\u", "tag", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "same", " ", "for", " ", "arg", " ", "classification_", "\\u\\u\\uNL\\u\\u\\u_", "md", "\\u", "classify_", "=_", "Metadata_", "._", "load", "\\u", "from", "\\u", "file_", "(_", "'", "sr", "l\\u", "classify", "'_", ",_", "self_", "._", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classify", "\\u", "nn_", "=_", "load", "\\u", "network_", "(_", "md", "\\u", "classify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classify", "\\u", "reader_", "=_", "create", "\\u", "reader_", "(_", "md", "\\u", "classify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classify", "\\u", "reader_", "._", "create", "\\u", "converter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "classify", "\\u", "it", "d_", "=_", "self_", "._", "classify", "\\u", "reader_", "._", "get", "\\u", "inv", "erse", "\\u", "tag", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "predica", "te", " ", "detection_", "\\u\\u\\uNL\\u\\u\\u_", "md", "\\u", "pred_", "=_", "Metadata_", "._", "load", "\\u", "from", "\\u", "file_", "(_", "'", "sr", "l\\u", "predica", "tes", "'_", ",_", "self_", "._", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pred", "\\u", "nn_", "=_", "load", "\\u", "network_", "(_", "md", "\\u", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pred", "\\u", "reader_", "=_", "create", "\\u", "reader_", "(_", "md", "\\u", "pred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pred", "\\u", "reader_", "._", "create", "\\u", "converter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SR", "LT", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "predicates_", "(_", "self_", ",_", "tokens_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fin", "ds", " ", "out", " ", "whi", "ch", " ", "token", "s", " ", "are", " ", "predica", "tes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "token", "s", ":", " ", "a", " ", "list", " ", "of", " ", "attribute", ".", "Token", " ", "element", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "the", " ", "indice", "s", " ", "of", " ", "predica", "te", " ", "token", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sent", "\\u", "codi", "fied", "_", "=_", "np_", "._", "array_", "(_", "[_", "self_", "._", "pred", "\\u", "reader_", "._", "converter_", "._", "convert_", "(_", "token_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "token_", "in_", "tokens_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "answer_", "=_", "np_", "._", "array_", "(_", "self_", "._", "pred", "\\u", "nn_", "._", "tag", "\\u", "sentence_", "(_", "sent", "\\u", "codi", "fied", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "answer_", "._", "nonzero_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SR", "LT", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "SR", "L", " ", "process", " ", "on", " ", "the", " ", "give", "n", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "text", ":", " ", "unicode", " ", "or", " ", "str", " ", "encode", "d", " ", "in", " ", "utf", "-", "8", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "no", "\\u", "repeat", "s", ":", " ", "whe", "ther", " ", "to", " ", "prevent", " ", "repeated", " ", "argu", "ment", " ", "labels", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "a", " ", "list", " ", "of", " ", "SR", "LA", "nno", "tate", "d", "Sentence", " ", "object", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "utils_", "._", "tokenize_", "(_", "text_", ",_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sent_", "in_", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tagged_", "=_", "self_", "._", "tag", "\\u", "tokens_", "(_", "sent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "tagged_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SR", "LT", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag", "\\u", "tokens_", "(_", "self_", ",_", "tokens_", ",_", "no", "\\u", "repeats_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "SR", "L", " ", "process", " ", "on", " ", "the", " ", "give", "n", " ", "token", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "token", "s", ":", " ", "a", " ", "list", " ", "of", " ", "token", "s", " ", "(", "as", " ", "string", "s", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "no", "\\u", "repeat", "s", ":", " ", "whe", "ther", " ", "to", " ", "prevent", " ", "repeated", " ", "argu", "ment", " ", "labels", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "a", " ", "list", " ", "of", " ", "lists", " ", "(", "one", " ", "list", " ", "for", " ", "each", " ", "sentence", ").", " ", "Sentence", "s", " ", "have", " ", "tuple", "s", "\\", "10", ";", " ", " ", " ", " ", "(", "all", "\\u", "token", "s", ",", " ", "predica", "te", ",", " ", "arg", "\\u", "structure", "),", " ", "where", " ", "arg", "\\u", "structure", " ", "is", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "mapping", " ", "argu", "ment", " ", "labels", " ", "to", " ", "the", " ", "words", " ", "it", " ", "include", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "language_", "==_", "'", "pt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token", "s", "\\u", "obj_", "=_", "[_", "attributes_", "._", "Token_", "(_", "utils_", "._", "clean", "\\u", "text_", "(_", "t_", ",_", "False_", ")_", ")_", "for_", "t_", "in_", "tokens_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token", "s", "\\u", "obj_", "=_", "[_", "attributes_", "._", "Token_", "(_", "t_", ")_", "for_", "t_", "in_", "tokens_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "convert", "ed", "\\u", "bound_", "=_", "np_", "._", "array_", "(_", "[_", "self_", "._", "bound", "ary", "\\u", "reader_", "._", "converter_", "._", "convert_", "(_", "t_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "token", "s", "\\u", "obj_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "convert", "ed", "\\u", "class_", "=_", "np_", "._", "array_", "(_", "[_", "self_", "._", "classify", "\\u", "reader_", "._", "converter_", "._", "convert_", "(_", "t_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "t_", "in_", "token", "s", "\\u", "obj_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pred", "\\u", "positions_", "=_", "self_", "._", "find", "\\u", "predicates_", "(_", "token", "s", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", ",", " ", "argu", "ment", " ", "bound", "ary", " ", "detection_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "answer", " ", "include", "s", " ", "all", " ", "predicates_", "\\u\\u\\uNL\\u\\u\\u_", "answers_", "=_", "self_", "._", "bound", "ary", "\\u", "nn_", "._", "tag", "\\u", "sentence_", "(_", "convert", "ed", "\\u", "bound_", ",_", "pred", "\\u", "positions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "boundaries_", "=_", "[_", "[_", "self_", "._", "bound", "ary", "\\u", "it", "d_", "[_", "x_", "]_", "for_", "x_", "in_", "pred", "\\u", "answer_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pred", "\\u", "answer_", "in_", "answers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "\\u", "limits_", "=_", "[_", "utils_", "._", "bound", "aries", "\\u", "to", "\\u", "arg", "\\u", "limits_", "(_", "pred", "\\u", "boundaries_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pred", "\\u", "boundaries_", "in_", "boundaries_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", ",", " ", "argu", "ment", " ", "classification_", "\\u\\u\\uNL\\u\\u\\u_", "answers_", "=_", "self_", "._", "classify", "\\u", "nn_", "._", "tag", "\\u", "sentence_", "(_", "convert", "ed", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pred", "\\u", "positions_", ",_", "arg", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "repeats_", "=_", "not_", "no", "\\u", "repeats_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arguments_", "=_", "[_", "[_", "self_", "._", "classify", "\\u", "it", "d_", "[_", "x_", "]_", "for_", "x_", "in_", "pred", "\\u", "answer_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pred", "\\u", "answer_", "in_", "answers_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "structures_", "=_", "\\u", "group", "\\u", "arguments_", "(_", "tokens_", ",_", "pred", "\\u", "positions_", ",_", "boundaries_", ",_", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "SR", "LA", "nno", "tate", "d", "Sentence", "_", "(_", "tokens_", ",_", "structures_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Dependenc", "y", " ", "Parser", " ", "based", " ", "on", " ", "a", " ", "neural", " ", "network", " ", "tagger", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "the", " ", "data", " ", "director", "y", " ", "for", " ", "the", " ", "POS", " ", "tagger", ",", " ", "if", " ", "one", " ", "is", " ", "used", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "call", " ", "the", " ", "parent", " ", "construct", "or", ".", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Dependenc", "y", "Parser_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "load", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", "s", " ", "data", " ", "for", " ", "Dependenc", "y", " ", "Pars", "ing", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md", "\\u", "ude", "p_", "=_", "Metadata_", "._", "load", "\\u", "from", "\\u", "file_", "(_", "'", "unla", "bele", "d\\u", "dependen", "cy", "'_", ",_", "paths_", "=_", "self_", "._", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unla", "bele", "d\\u", "nn_", "=_", "load", "\\u", "network_", "(_", "md", "\\u", "ude", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unla", "bele", "d\\u", "reader_", "=_", "create", "\\u", "reader_", "(_", "md", "\\u", "ude", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "md", "\\u", "lde", "p_", "=_", "Metadata_", "._", "load", "\\u", "from", "\\u", "file_", "(_", "'", "label", "ed", "\\u", "dependen", "cy", "'_", ",_", "paths_", "=_", "self_", "._", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "ed", "\\u", "nn_", "=_", "load", "\\u", "network_", "(_", "md", "\\u", "lde", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "ed", "\\u", "reader_", "=_", "create", "\\u", "reader_", "(_", "md", "\\u", "lde", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "it", "d_", "=_", "self_", "._", "label", "ed", "\\u", "reader_", "._", "get", "\\u", "inv", "erse", "\\u", "tag", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "use", "\\u", "pos_", "=_", "md", "\\u", "ude", "p_", "._", "use", "\\u", "pos_", "or_", "md", "\\u", "lde", "p_", "._", "use", "\\u", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "use", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pos", "\\u", "tagger_", "=_", "POST", "agg", "er_", "(_", "self_", "._", "data\\u", "dir_", ",_", "language_", "=_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Split", " ", "the", " ", "give", "n", " ", "text", " ", "int", "o", " ", "sentence", "s", " ", "and", " ", "dete", "rmin", "es", " ", "thei", "r", " ", "\\", "10", ";", " ", " ", " ", " ", "dependen", "cy", " ", "trees", ".", " ", "If", " ", "you", " ", "want", " ", "to", " ", "provide", " ", "your", " ", "own", " ", "tokenized", "\\", "10", ";", " ", " ", " ", " ", "text", ",", " ", "use", " ", "`", "parse", "\\u", "sentence", "`", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "text", ":", " ", "a", " ", "string", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "a", " ", "list", " ", "of", " ", "Pars", "ed", "Sentence", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sentences_", "=_", "utils_", "._", "tokenize_", "(_", "text_", ",_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sent_", "in_", "sentences_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "=_", "self_", "._", "parse", "\\u", "sentence_", "(_", "sent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "parsed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag", "\\u", "tokens_", "(_", "self_", ",_", "tokens_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "the", " ", "give", "n", " ", "sentence", ".", " ", "Thi", "s", " ", "function", " ", "is", " ", "just", " ", "an", " ", "alias", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "`", "parse", "\\u", "sentence", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "parse", "\\u", "sentence_", "(_", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "\\u", "sentence_", "(_", "self_", ",_", "tokens_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "the", " ", "give", "n", " ", "sentence", ".", " ", "It", " ", "must", " ", "be", " ", "alr", "ead", "y", " ", "tokenized", ";", " ", "if", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "want", " ", "nlp", "net", " ", "to", " ", "tokenize", " ", "the", " ", "text", ",", " ", "use", " ", "the", " ", "method", " ", "`", "parse", "`", " ", "inst", "ead", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "token", "s", ":", " ", "a", " ", "list", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "a", " ", "Pars", "ed", "Sentence", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "tokens_", "=_", "tokens_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "token", "s", "\\u", "obj_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "parser", " ", "use", "s", " ", "POS", " ", "a", " ", "feature", ",", " ", "have", " ", "a", " ", "tagger", " ", "tag", " ", "it", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "use", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tokens_", "=_", "self_", "._", "pos", "\\u", "tagger_", "._", "tag", "\\u", "tokens_", "(_", "tokens_", ",_", "return", "\\u", "tokens_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "token_", "in_", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "use", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "tagg", "ed", " ", "for", " ", "POS", ",", " ", "each", " ", "item", " ", "is", " ", "a", " ", "tuple_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "word_", ",_", "pos_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "token", "s", "\\u", "obj_", "._", "append_", "(_", "attributes_", "._", "Token_", "(_", "word_", ",_", "pos_", "=_", "pos_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "convert", "ed", "\\u", "tokens_", "=_", "self_", "._", "unla", "bele", "d\\u", "reader_", "._", "codi", "fy", "\\u", "sentence_", "(_", "token", "s", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heads_", "=_", "self_", "._", "unla", "bele", "d\\u", "nn_", "._", "tag", "\\u", "sentence_", "(_", "convert", "ed", "\\u", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "root", " ", "is", " ", "return", "ed", " ", "hav", "ing", " ", "a", " ", "value", " ", "==", " ", "len", "(", "sentence", ")_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "=_", "heads_", "._", "argmax_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "heads_", "[_", "root_", "]_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "ed", "\\u", "tokens_", "=_", "self_", "._", "label", "ed", "\\u", "reader_", "._", "codi", "fy", "\\u", "sentence_", "(_", "token", "s", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "\\u", "codes_", "=_", "self_", "._", "label", "ed", "\\u", "nn_", "._", "tag", "\\u", "sentence_", "(_", "convert", "ed", "\\u", "tokens_", ",_", "heads_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "[_", "self_", "._", "it", "d_", "[_", "code_", "]_", "for_", "code_", "in_", "label", "\\u", "codes_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "final", " ", "answer", ",", " ", "signal", " ", "the", " ", "root", " ", "with", " ", "-1", "_", "\\u\\u\\uNL\\u\\u\\u_", "heads_", "[_", "root_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "use", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unzip", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos", "\\u", "tags_", "=_", "zip_", "(_", "*_", "tokens_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos", "\\u", "tags_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parsed_", "=_", "Pars", "ed", "Sentence", "_", "(_", "original", "\\u", "tokens_", ",_", "heads_", ",_", "labels_", ",_", "pos", "\\u", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parsed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dependenc", "y", "Parser_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "the", " ", "give", "n", " ", "text", ".", " ", "Thi", "s", " ", "is", " ", "just", " ", "an", " ", "alias", " ", "for", " ", "the", " ", "\\", "10", ";", " ", " ", " ", " ", "`", "parse", "`", " ", "method", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "parse_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "POST", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "POST", "agg", "er", " ", "load", "s", " ", "the", " ", "model", "s", " ", "and", " ", "perform", "s", " ", "POS", " ", "tagging", " ", "on", " ", "text", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "POST", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "load", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", "s", " ", "data", " ", "for", " ", "POS", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md_", "=_", "Metadata_", "._", "load", "\\u", "from", "\\u", "file_", "(_", "'", "pos", "'_", ",_", "self_", "._", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nn_", "=_", "load", "\\u", "network_", "(_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reader_", "=_", "create", "\\u", "reader_", "(_", "md_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reader_", "._", "create", "\\u", "converter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "it", "d_", "=_", "self_", "._", "reader_", "._", "get", "\\u", "inv", "erse", "\\u", "tag", "\\u", "dictionary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "POST", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ta", "gs", " ", "the", " ", "give", "n", " ", "text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "text", ":", " ", "a", " ", "string", " ", "or", " ", "unicode", " ", "object", ".", " ", "String", "s", " ", "assume", "d", " ", "to", " ", "be", " ", "utf", "-", "8", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "a", " ", "list", " ", "of", " ", "lists", " ", "(", "sentence", "s", " ", "with", " ", "token", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "sentence", " ", "has", " ", "(", "token", ",", " ", "tag", ")", " ", "tuple", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokens_", "=_", "utils_", "._", "tokenize_", "(_", "text_", ",_", "self_", "._", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sent_", "in_", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tagged_", "=_", "self_", "._", "tag", "\\u", "tokens_", "(_", "sent_", ",_", "return", "\\u", "tokens_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "tagged_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "POST", "agg", "er_", "(_", "Tagger", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tag", "\\u", "tokens_", "(_", "self_", ",_", "tokens_", ",_", "return", "\\u", "tokens_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ta", "gs", " ", "a", " ", "give", "n", " ", "list", " ", "of", " ", "token", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Token", "s", " ", "shou", "ld", " ", "be", " ", "produce", "d", " ", "with", " ", "the", " ", "nlp", "net", " ", "tokenize", "r", " ", "in", " ", "order", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "match", " ", "the", " ", "entri", "es", " ", "in", " ", "the", " ", "vocab", "ular", "y", ".", " ", "If", " ", "you", " ", "have", " ", "non", "-", "tokenized", " ", "text", ",", "\\", "10", ";", " ", " ", " ", " ", "use", " ", "POST", "agg", "er", ".", "tag", "(", "text", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "token", "s", ":", " ", "a", " ", "list", " ", "of", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "return", "\\u", "token", "s", ":", " ", "if", " ", "Tru", "e", ",", " ", "include", "s", " ", "the", " ", "token", "s", " ", "in", " ", "the", " ", "return", ",", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", " ", "(", "token", ",", " ", "tag", ").", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "a", " ", "list", " ", "of", " ", "string", "s", " ", "(", "the", " ", "tags", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "converter_", "=_", "self_", "._", "reader_", "._", "converter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "convert", "ed", "\\u", "tokens_", "=_", "np_", "._", "array_", "(_", "[_", "converter_", "._", "convert_", "(_", "token_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "token_", "in_", "tokens_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "answer_", "=_", "self_", "._", "nn_", "._", "tag", "\\u", "sentence_", "(_", "convert", "ed", "\\u", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "[_", "self_", "._", "it", "d_", "[_", "tag_", "]_", "for_", "tag_", "in_", "answer_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "return", "\\u", "tokens_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDEN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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kirankoduru/arachne/arachne/tests/test_pipelines.py
[ { "content": "\"\"\"\nTo see if we have the right pipelines in place\n\"\"\"\nimport inspect\nfrom unittest import TestCase\nfrom scrapy import signals, Field, Item\nfrom mock import patch, mock_open, Mock, call\nfrom arachne.pipelines import ExportCSV, ExportData, ExportJSON\nfrom scrapy.contrib.exporter import CsvItemExporter, JsonItemExporter\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ScrapyItem(Item):\n field1 = Field()\n field2 = Field()\n field3 = Field()", "metadata": "root.ScrapyItem", "header": "['module', '___EOS___']", "index": 10 }, { "content": "class TestPipelines(TestCase):\n\n", "metadata": "root.TestPipelines", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def test_cls_export_data(self):\n cls = ExportData()\n self.assertTrue(inspect.ismethod(cls.from_crawler))\n\n with self.assertRaises(NotImplementedError):\n cls.spider_opened('test')\n\n # TODO: test extension signals connect using `mock.assert_has_calls`\n crawler_mock = Mock()\n cls.from_crawler(crawler_mock)\n assert crawler_mock.signals.connect.called\n \n self.assertEquals(cls.files, {})\n self.assertIsNone(cls.exporter)", "metadata": "root.TestPipelines.test_cls_export_data", "header": "['class', 'TestPipelines', '(', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_export_cls(self):\n\n test_classes = [\n {'cls': ExportJSON, \n 'file_type': 'json', \n 'exporter': JsonItemExporter},\n {'cls': ExportCSV, \n 'file_type': 'csv', \n 'exporter': CsvItemExporter}\n ]\n for test_cls in test_classes:\n cls = test_cls['cls']()\n mock_open_func = mock_open(read_data='Hello')\n spider = Mock()\n spider.name = 'abc'\n\n with patch('arachne.pipelines.open', mock_open_func):\n cls.spider_opened(spider)\n path = 'exports/%s/abc.%s' % (test_cls['file_type'], \n test_cls['file_type'])\n mock_open_func.assert_called_with(path, 'w+b')\n self.assertIsInstance(cls.exporter, test_cls['exporter'])\n\n # test if cls.files is empty \n cls.spider_closed(spider)\n self.assertEquals(cls.files, {})\n\n # test exporter.export_item\n item = ScrapyItem()\n result = cls.process_item(item, spider)\n self.assertEquals(item, result)", "metadata": "root.TestPipelines.test_export_cls", "header": "['class', 'TestPipelines', '(', 'TestCase', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "from scrapy import signals, Field, Item", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 39 }, { "span": "from mock import patch, mock_open, Mock, call", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "To", " ", "see", " ", "if", " ", "we", " ", "have", " ", "the", " ", "right", " ", "pipeline", "s", " ", "in", " ", "place", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scrapy_", "import_", "signals_", ",_", "Field_", ",_", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "patch_", ",_", "mock", "\\u", "open_", ",_", "Mock_", ",_", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ara", "chn", "e_", "._", "pipeline", "s_", "import_", "Export", "CSV_", ",_", "Export", "Data_", ",_", "Export", "JSON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scrapy_", "._", "contrib_", "._", "exporter_", "import_", "Cs", "v", "Item", "Exporter_", ",_", "Js", "on", "Item", "Exporter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Scra", "py", "Item_", "(_", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "field", "1_", "=_", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "2_", "=_", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "3_", "=_", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Pipe", "lines_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pipe", "lines_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "cls", "\\u", "export", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "Export", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "inspect_", "._", "isme", "thod", "_", "(_", "cls_", "._", "from", "\\u", "crawler_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "spider", "\\u", "opened_", "(_", "'", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "test", " ", "extensi", "on", " ", "signal", "s", " ", "connect", " ", "usi", "ng", " ", "`", "mock", ".", "assert", "\\u", "has", "\\u", "calls", "`_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "crawle", "r", "\\u", "mock_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "from", "\\u", "crawler_", "(_", "crawle", "r", "\\u", "mock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "crawle", "r", "\\u", "mock_", "._", "signals_", "._", "connect_", "._", "called_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "cls_", "._", "files_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "cls_", "._", "exporter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Pipe", "lines_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "export", "\\u", "cls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "classes_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "cls", "'_", ":_", "Export", "JSON_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "type", "'_", ":_", "'", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exporter", "'_", ":_", "Js", "on", "Item", "Exporter_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "cls", "'_", ":_", "Export", "CSV_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "\\u", "type", "'_", ":_", "'", "csv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exporter", "'_", ":_", "Cs", "v", "Item", "Exporter_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "test\\u", "cls_", "in_", "test\\u", "classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "test\\u", "cls_", "[_", "'", "cls", "'_", "]_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "open", "\\u", "func_", "=_", "mock", "\\u", "open_", "(_", "read", "\\u", "data_", "=_", "'", "Hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spider_", "=_", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spider_", "._", "name_", "=_", "'", "abc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "patch_", "(_", "'", "ara", "chn", "e", ".", "pipeline", "s", ".", "open", "'_", ",_", "mock", "\\u", "open", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "spider", "\\u", "opened_", "(_", "spider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "'", "export", "s", "/", "%", "s", "/", "abc", ".", "%", "s", "'_", "%_", "(_", "test\\u", "cls_", "[_", "'", "file", "\\u", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "cls_", "[_", "'", "file", "\\u", "type", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "open", "\\u", "func_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "path_", ",_", "'", "w", "+", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "cls_", "._", "exporter_", ",_", "test\\u", "cls_", "[_", "'", "exporter", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "if", " ", "cls", ".", "files", " ", "is", " ", "empty", " _", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "spider", "\\u", "closed_", "(_", "spider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "cls_", "._", "files_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "exporter", ".", "export", "\\u", "item_", "\\u\\u\\uNL\\u\\u\\u_", "item_", "=_", "Scra", "py", "Item_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "cls_", "._", "process", "\\u", "item_", "(_", "item_", ",_", "spider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "item_", ",_", "result_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ssut/choco/modules/__init__.py
[ { "content": "import os\nimport sys\nimport imp\nimport pickle\nimport traceback\nimport md5\nfrom collections import namedtuple\n\nResult = namedtuple('Result', ['type', 'content'])\nchoco = None\nmodule = None\nmodules = []\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def init_module(cc, ep):\n global choco, module\n choco = cc\n module = ep", "metadata": "root.init_module", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def dispatch(room, message):\n choco.dispatch(room, message, True)", "metadata": "root.dispatch", "header": "['module', '___EOS___']", "index": 18 }, { "content": "def module_loader(home, config):\n for fn in os.listdir(os.path.join(home, 'modules')):\n name = os.path.basename(fn)[:-3]\n if name in config.EXCLUDED_MODULES: continue\n if fn.endswith('.py') and not fn.startswith('_'):\n fn = os.path.join(os.path.dirname(os.path.realpath(__file__)), fn)\n try: modules.append(imp.load_source(name, fn))\n except Exception, e:\n traceback.print_exc()\n print >> sys.stderr, \"Error loading %s: %s\" % (name, e)\n sys.exit(1)", "metadata": "root.module_loader", "header": "['module', '___EOS___']", "index": 21 } ]
[ { "span": "import pickle", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 }, { "span": "import md5", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Result_", "=_", "namedtuple_", "(_", "'", "Result", "'_", ",_", "[_", "'", "type", "'_", ",_", "'", "content", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cho", "co_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "init", "\\u", "module_", "(_", "cc_", ",_", "ep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "global_", "cho", "co_", ",_", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cho", "co_", "=_", "cc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "ep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch_", "(_", "room_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cho", "co_", "._", "dispatch_", "(_", "room_", ",_", "message_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "module", "\\u", "loader_", "(_", "home_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fn_", "in_", "os_", "._", "listdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "home_", ",_", "'", "module", "s", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "fn_", ")_", "[_", ":_", "-_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "config_", "._", "EXCLUDE", "D", "\\u", "MODULES_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fn_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", "and_", "not_", "fn_", "._", "startswith_", "(_", "'\\u'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fn_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ",_", "fn_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "modules_", "._", "append_", "(_", "imp_", "._", "load", "\\u", "source_", "(_", "name_", ",_", "fn_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "Error", " ", "load", "ing", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "name_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kuri65536/python-for-android/python-modules/twisted/twisted/pair/test/test_ethernet.py
[ { "content": "# Copyright (c) 2001-2004 Twisted Matrix Laboratories.\n# See LICENSE for details.\n\n#\nfrom twisted.trial import unittest\n\nfrom twisted.internet import protocol, reactor, error\nfrom twisted.python import failure, components\nfrom twisted.pair import ethernet, raw\nfrom zope.interface import implements\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MyProtocol:\n implements(raw.IRawPacketProtocol)\n \n", "metadata": "root.MyProtocol", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self, expecting):\n self.expecting = list(expecting)", "metadata": "root.MyProtocol.__init__", "header": "['class', 'MyProtocol', ':', '___EOS___']", "index": 14 }, { "content": " def datagramReceived(self, data, **kw):\n assert self.expecting, 'Got a packet when not expecting anymore.'\n expect = self.expecting.pop(0)\n assert expect == (data, kw), \\\n \"Expected %r, got %r\" % (\n expect, (data, kw),\n )", "metadata": "root.MyProtocol.datagramReceived", "header": "['class', 'MyProtocol', ':', '___EOS___']", "index": 17 }, { "content": "class EthernetTestCase(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.EthernetTestCase", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def testPacketParsing(self):\n proto = ethernet.EthernetProtocol()\n p1 = MyProtocol([\n\n ('foobar', {\n 'partial': 0,\n 'dest': \"123456\",\n 'source': \"987654\",\n 'protocol': 0x0800,\n }),\n\n ])\n proto.addProto(0x0800, p1)\n\n proto.datagramReceived(\"123456987654\\x08\\x00foobar\",\n partial=0)\n\n assert not p1.expecting, \\\n 'Should not expect any more packets, but still want %r' % p1.expecting", "metadata": "root.EthernetTestCase.testPacketParsing", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def testMultiplePackets(self):\n proto = ethernet.EthernetProtocol()\n p1 = MyProtocol([\n\n ('foobar', {\n 'partial': 0,\n 'dest': \"123456\",\n 'source': \"987654\",\n 'protocol': 0x0800,\n }),\n\n ('quux', {\n 'partial': 1,\n 'dest': \"012345\",\n 'source': \"abcdef\",\n 'protocol': 0x0800,\n }),\n\n ])\n proto.addProto(0x0800, p1)\n\n proto.datagramReceived(\"123456987654\\x08\\x00foobar\",\n partial=0)\n proto.datagramReceived(\"012345abcdef\\x08\\x00quux\",\n partial=1)\n\n assert not p1.expecting, \\\n 'Should not expect any more packets, but still want %r' % p1.expecting", "metadata": "root.EthernetTestCase.testMultiplePackets", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def testMultipleSameProtos(self):\n proto = ethernet.EthernetProtocol()\n p1 = MyProtocol([\n\n ('foobar', {\n 'partial': 0,\n 'dest': \"123456\",\n 'source': \"987654\",\n 'protocol': 0x0800,\n }),\n\n ])\n\n p2 = MyProtocol([\n\n ('foobar', {\n 'partial': 0,\n 'dest': \"123456\",\n 'source': \"987654\",\n 'protocol': 0x0800,\n }),\n\n ])\n\n proto.addProto(0x0800, p1)\n proto.addProto(0x0800, p2)\n\n proto.datagramReceived(\"123456987654\\x08\\x00foobar\",\n partial=0)\n\n assert not p1.expecting, \\\n 'Should not expect any more packets, but still want %r' % p1.expecting\n assert not p2.expecting, \\\n 'Should not expect any more packets, but still want %r' % p2.expecting", "metadata": "root.EthernetTestCase.testMultipleSameProtos", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 77 }, { "content": " def testWrongProtoNotSeen(self):\n proto = ethernet.EthernetProtocol()\n p1 = MyProtocol([])\n proto.addProto(0x0801, p1)\n\n proto.datagramReceived(\"123456987654\\x08\\x00foobar\",\n partial=0)\n proto.datagramReceived(\"012345abcdef\\x08\\x00quux\",\n partial=1)", "metadata": "root.EthernetTestCase.testWrongProtoNotSeen", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 112 }, { "content": " def testDemuxing(self):\n proto = ethernet.EthernetProtocol()\n p1 = MyProtocol([\n\n ('foobar', {\n 'partial': 0,\n 'dest': \"123456\",\n 'source': \"987654\",\n 'protocol': 0x0800,\n }),\n\n ('quux', {\n 'partial': 1,\n 'dest': \"012345\",\n 'source': \"abcdef\",\n 'protocol': 0x0800,\n }),\n\n ])\n proto.addProto(0x0800, p1)\n\n p2 = MyProtocol([\n\n ('quux', {\n 'partial': 1,\n 'dest': \"012345\",\n 'source': \"abcdef\",\n 'protocol': 0x0806,\n }),\n\n ('foobar', {\n 'partial': 0,\n 'dest': \"123456\",\n 'source': \"987654\",\n 'protocol': 0x0806,\n }),\n\n ])\n proto.addProto(0x0806, p2)\n\n proto.datagramReceived(\"123456987654\\x08\\x00foobar\",\n partial=0)\n proto.datagramReceived(\"012345abcdef\\x08\\x06quux\",\n partial=1)\n proto.datagramReceived(\"123456987654\\x08\\x06foobar\",\n partial=0)\n proto.datagramReceived(\"012345abcdef\\x08\\x00quux\",\n partial=1)\n\n assert not p1.expecting, \\\n 'Should not expect any more packets, but still want %r' % p1.expecting\n assert not p2.expecting, \\\n 'Should not expect any more packets, but still want %r' % p2.expecting", "metadata": "root.EthernetTestCase.testDemuxing", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " def testAddingBadProtos_WrongLevel(self):\n \"\"\"Adding a wrong level protocol raises an exception.\"\"\"\n e = ethernet.EthernetProtocol()\n try:\n e.addProto(42, \"silliness\")\n except components.CannotAdapt:\n pass\n else:\n raise AssertionError, 'addProto must raise an exception for bad protocols'", "metadata": "root.EthernetTestCase.testAddingBadProtos_WrongLevel", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 176 }, { "content": " def testAddingBadProtos_TooSmall(self):\n \"\"\"Adding a protocol with a negative number raises an exception.\"\"\"\n e = ethernet.EthernetProtocol()\n try:\n e.addProto(-1, MyProtocol([]))\n except TypeError, e:\n if e.args == ('Added protocol must be positive or zero',):\n pass\n else:\n raise\n else:\n raise AssertionError, 'addProto must raise an exception for bad protocols'", "metadata": "root.EthernetTestCase.testAddingBadProtos_TooSmall", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 187 }, { "content": " def testAddingBadProtos_TooBig(self):\n \"\"\"Adding a protocol with a number >=2**16 raises an exception.\"\"\"\n e = ethernet.EthernetProtocol()\n try:\n e.addProto(2**16, MyProtocol([]))\n except TypeError, e:\n if e.args == ('Added protocol must fit in 16 bits',):\n pass\n else:\n raise\n else:\n raise AssertionError, 'addProto must raise an exception for bad protocols'", "metadata": "root.EthernetTestCase.testAddingBadProtos_TooBig", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 201 }, { "content": " def testAddingBadProtos_TooBig2(self):\n \"\"\"Adding a protocol with a number >=2**16 raises an exception.\"\"\"\n e = ethernet.EthernetProtocol()\n try:\n e.addProto(2**16+1, MyProtocol([]))\n except TypeError, e:\n if e.args == ('Added protocol must fit in 16 bits',):\n pass\n else:\n raise\n else:\n raise AssertionError, 'addProto must raise an exception for bad protocols'", "metadata": "root.EthernetTestCase.testAddingBadProtos_TooBig2", "header": "['class', 'EthernetTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 214 } ]
[ { "span": "from twisted.internet import protocol, reactor, error", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 53 }, { "span": "from twisted.python import failure, components", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "1", "-", "2004", " ", "Twi", "sted", " ", "Matrix", " ", "Labo", "rator", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "trial_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "internet_", "import_", "protocol_", ",_", "reactor_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "import_", "failure_", ",_", "components_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "pair_", "import_", "ethernet", "_", ",_", "raw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zope_", "._", "interface_", "import_", "implements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "Protocol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "implements_", "(_", "raw_", "._", "IR", "aw", "Packe", "t", "Protocol_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "My", "Protocol_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "expect", "ing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "expect", "ing_", "=_", "list_", "(_", "expect", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Protocol_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "datagram", "Received_", "(_", "self_", ",_", "data_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "self_", "._", "expect", "ing_", ",_", "'", "Got", " ", "a", " ", "packet", " ", "whe", "n", " ", "not", " ", "expect", "ing", " ", "any", "more", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect_", "=_", "self_", "._", "expect", "ing_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "expect_", "==_", "(_", "data_", ",_", "kw_", ")_", ",_", "\"", "Expect", "ed", " ", "%", "r", ",", " ", "got", " ", "%", "r", "\"_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expect_", ",_", "(_", "data_", ",_", "kw_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Packe", "t", "Pars", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proto_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "My", "Protocol_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fooba", "r", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "12345", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "9876", "5", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "00_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "12345", "698", "765", "4", "\\\\", "x0", "8", "\\\\", "x0", "0f", "oob", "ar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "p1_", "._", "expect", "ing_", ",_", "'", "Sho", "ul", "d", " ", "not", " ", "expect", " ", "any", " ", "more", " ", "packet", "s", ",", " ", "but", " ", "still", " ", "want", " ", "%", "r", "'_", "%_", "p1_", "._", "expect", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Multipl", "e", "Packe", "ts_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proto_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "My", "Protocol_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fooba", "r", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "12345", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "9876", "5", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "quu", "x", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "0123", "4", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "abcde", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "00_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "12345", "698", "765", "4", "\\\\", "x0", "8", "\\\\", "x0", "0f", "oob", "ar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "0123", "4", "5a", "bcd", "ef", "\\\\", "x0", "8", "\\\\", "x0", "0", "quu", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "p1_", "._", "expect", "ing_", ",_", "'", "Sho", "ul", "d", " ", "not", " ", "expect", " ", "any", " ", "more", " ", "packet", "s", ",", " ", "but", " ", "still", " ", "want", " ", "%", "r", "'_", "%_", "p1_", "._", "expect", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Multipl", "e", "Sam", "e", "Proto", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proto_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "My", "Protocol_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fooba", "r", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "12345", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "9876", "5", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p2_", "=_", "My", "Protocol_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fooba", "r", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "12345", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "9876", "5", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "00_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "00_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "12345", "698", "765", "4", "\\\\", "x0", "8", "\\\\", "x0", "0f", "oob", "ar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "p1_", "._", "expect", "ing_", ",_", "'", "Sho", "ul", "d", " ", "not", " ", "expect", " ", "any", " ", "more", " ", "packet", "s", ",", " ", "but", " ", "still", " ", "want", " ", "%", "r", "'_", "%_", "p1_", "._", "expect", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "p2_", "._", "expect", "ing_", ",_", "'", "Sho", "ul", "d", " ", "not", " ", "expect", " ", "any", " ", "more", " ", "packet", "s", ",", " ", "but", " ", "still", " ", "want", " ", "%", "r", "'_", "%_", "p2_", "._", "expect", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Proto", "Not", "Seen", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proto_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "My", "Protocol_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "01_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "12345", "698", "765", "4", "\\\\", "x0", "8", "\\\\", "x0", "0f", "oob", "ar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "0123", "4", "5a", "bcd", "ef", "\\\\", "x0", "8", "\\\\", "x0", "0", "quu", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Dem", "ux", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proto_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "My", "Protocol_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fooba", "r", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "12345", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "9876", "5", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "quu", "x", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "0123", "4", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "abcde", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "00_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "00_", ",_", "p1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p2_", "=_", "My", "Protocol_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "quu", "x", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "0123", "4", "5", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "abcde", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "06_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "fooba", "r", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "partial", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "'_", ":_", "\"", "12345", "6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "\"", "9876", "5", "4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "protoc", "ol", "'_", ":_", "0x08", "06_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "add", "Proto_", "(_", "0x08", "06_", ",_", "p2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "12345", "698", "765", "4", "\\\\", "x0", "8", "\\\\", "x0", "0f", "oob", "ar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "0123", "4", "5a", "bcd", "ef", "\\\\", "x0", "8", "\\\\", "x0", "6", "quu", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "12345", "698", "765", "4", "\\\\", "x0", "8", "\\\\", "x0", "6f", "oob", "ar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "._", "datagram", "Received_", "(_", "\"", "0123", "4", "5a", "bcd", "ef", "\\\\", "x0", "8", "\\\\", "x0", "0", "quu", "x", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partial_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "not_", "p1_", "._", "expect", "ing_", ",_", "'", "Sho", "ul", "d", " ", "not", " ", "expect", " ", "any", " ", "more", " ", "packet", "s", ",", " ", "but", " ", "still", " ", "want", " ", "%", "r", "'_", "%_", "p1_", "._", "expect", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "p2_", "._", "expect", "ing_", ",_", "'", "Sho", "ul", "d", " ", "not", " ", "expect", " ", "any", " ", "more", " ", "packet", "s", ",", " ", "but", " ", "still", " ", "want", " ", "%", "r", "'_", "%_", "p2_", "._", "expect", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Add", "ing", "Ba", "d", "Proto", "s", "\\u", "Wro", "ng", "Level_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "ing", " ", "a", " ", "wrong", " ", "level", " ", "protoc", "ol", " ", "raise", "s", " ", "an", " ", "exception", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "add", "Proto_", "(_", "42_", ",_", "\"", "sil", "lines", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "components_", "._", "Cann", "ot", "Adapt", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", ",_", "'", "add", "Proto", " ", "must", " ", "raise", " ", "an", " ", "exception", " ", "for", " ", "bad", " ", "protoc", "ols", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Add", "ing", "Ba", "d", "Proto", "s", "\\u", "Too", "Small", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "ing", " ", "a", " ", "protoc", "ol", " ", "with", " ", "a", " ", "negati", "ve", " ", "number", " ", "raise", "s", " ", "an", " ", "exception", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "add", "Proto_", "(_", "-_", "1_", ",_", "My", "Protocol_", "(_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "args_", "==_", "(_", "'", "Added", " ", "protoc", "ol", " ", "must", " ", "be", " ", "posit", "ive", " ", "or", " ", "zero", "'_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", ",_", "'", "add", "Proto", " ", "must", " ", "raise", " ", "an", " ", "exception", " ", "for", " ", "bad", " ", "protoc", "ols", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Add", "ing", "Ba", "d", "Proto", "s", "\\u", "Too", "Big", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "ing", " ", "a", " ", "protoc", "ol", " ", "with", " ", "a", " ", "number", " ", ">=", "2", "**", "16", " ", "raise", "s", " ", "an", " ", "exception", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "add", "Proto_", "(_", "2_", "**_", "16_", ",_", "My", "Protocol_", "(_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "args_", "==_", "(_", "'", "Added", " ", "protoc", "ol", " ", "must", " ", "fit", " ", "in", " ", "16", " ", "bits", "'_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", ",_", "'", "add", "Proto", " ", "must", " ", "raise", " ", "an", " ", "exception", " ", "for", " ", "bad", " ", "protoc", "ols", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ether", "net", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Add", "ing", "Ba", "d", "Proto", "s", "\\u", "Too", "Big", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "ing", " ", "a", " ", "protoc", "ol", " ", "with", " ", "a", " ", "number", " ", ">=", "2", "**", "16", " ", "raise", "s", " ", "an", " ", "exception", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "ethernet", "_", "._", "Ether", "net", "Protocol_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "add", "Proto_", "(_", "2_", "**_", "16_", "+_", "1_", ",_", "My", "Protocol_", "(_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "args_", "==_", "(_", "'", "Added", " ", "protoc", "ol", " ", "must", " ", "fit", " ", "in", " ", "16", " ", "bits", "'_", ",_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", ",_", "'", "add", "Proto", " ", "must", " ", "raise", " ", "an", " ", "exception", " ", "for", "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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/internal/factories.py
[ { "content": " @classmethod\n def register(cls, apiTypeName, pymelType, inCast=None, outCast=None, apiArrayItemType=None):\n \"\"\"\n pymelType is the type to be used internally by pymel. apiType will be hidden from the user\n and converted to the pymel type.\n apiTypeName is the name of an apiType as a string\n if apiArrayItemType is set, it should be the api type that represents each item in the array\"\"\"\n\n #apiTypeName = pymelType.__class__.__name__\n capType = util.capitalize( apiTypeName )\n\n # register type\n cls.types[apiTypeName] = pymelType.__name__\n\n if apiArrayItemType:\n cls.arrayItemTypes[apiTypeName] = apiArrayItemType\n # register result casting\n if outCast:\n cls.outCast[apiTypeName] = outCast\n elif apiArrayItemType is not None:\n pass\n else:\n cls.outCast[apiTypeName] = lambda self, x: pymelType(x)\n\n # register argument casting\n if inCast:\n cls.inCast[apiTypeName] = inCast\n elif apiArrayItemType is not None:\n pass # filled out below\n else:\n cls.inCast[apiTypeName] = pymelType\n\n if apiTypeName in ['float', 'double', 'bool', 'int', 'short', 'long', 'uint']:\n initFunc = cls._makeRefFunc( capType )\n getFunc = api.SafeApiPtr.get\n cls.refInit[apiTypeName] = initFunc\n cls.refCast[apiTypeName] = getFunc\n for i in [2,3,4]:\n # Register arrays for this up to size for - ie,\n # int myVar[2];\n iapiArrayTypename = apiTypeName + '__array' + str(i)\n arrayInitFunc = cls._makeRefFunc( capType, size=i)\n cls.refInit[iapiArrayTypename] = arrayInitFunc\n cls.inCast[iapiArrayTypename] = cls._makeArraySetter( apiTypeName, i, arrayInitFunc )\n cls.refCast[iapiArrayTypename] = cls._makeArrayGetter( apiTypeName, i )\n cls.types[iapiArrayTypename] = tuple([pymelType.__name__]*i)\n # Check if there is an explicit maya type for n of these - ie,\n # int2 myVar;\n apiTypeNameN = apiTypeName + str(i)\n castNFuncName = 'as' + capType + str(i) + 'Ptr'\n if hasattr(api.MScriptUtil, castNFuncName):\n nInitFunc = cls._makeRefFunc(apiTypeName, size=i, asTypeNPtr=True)\n cls.refInit[apiTypeNameN] = nInitFunc\n cls.inCast[apiTypeNameN] = cls._makeArraySetter( apiTypeName, i, nInitFunc )\n cls.refCast[apiTypeNameN] = cls._makeArrayGetter( apiTypeName, i )\n cls.types[apiTypeNameN] = tuple([pymelType.__name__]*i)\n else:\n try:\n apiType = getattr( api, apiTypeName )\n except AttributeError:\n if apiArrayItemType:\n cls.refInit[apiTypeName] = list\n cls.inCast[apiTypeName] = lambda x: [ apiArrayItemType(y) for y in x ]\n cls.refCast[apiTypeName] = None\n cls.outCast[apiTypeName] = None\n\n else:\n #-- Api Array types\n if apiArrayItemType:\n\n cls.refInit[apiTypeName] = apiType\n cls.inCast[apiTypeName] = cls._makeApiArraySetter( apiType, apiArrayItemType )\n # this is double wrapped because of the crashes occuring with MDagPathArray. not sure if it's applicable to all arrays\n if apiType == api.MDagPathArray:\n cls.refCast[apiTypeName] = lambda x: [ pymelType( apiArrayItemType(x[i]) ) for i in range( x.length() ) ]\n cls.outCast[apiTypeName] = lambda self, x: [ pymelType( apiArrayItemType(x[i]) ) for i in range( x.length() ) ]\n else:\n cls.refCast[apiTypeName] = lambda x: [ pymelType( x[i] ) for i in range( x.length() ) ]\n cls.outCast[apiTypeName] = lambda self, x: [ pymelType( x[i] ) for i in range( x.length() ) ]\n\n #-- Api types\n else:\n cls.refInit[apiTypeName] = apiType\n cls.refCast[apiTypeName] = pymelType\n try:\n # automatically handle array types that correspond to this api type (e.g. MColor and MColorArray )\n arrayTypename = apiTypeName + 'Array'\n apiArrayType = getattr( api, arrayTypename )\n # e.g. 'MColorArray', Color, api.MColor\n ApiTypeRegister.register(arrayTypename, pymelType, apiArrayItemType=apiType)\n except AttributeError:\n pass", "metadata": "root.ApiTypeRegister.register", "header": "['class', 'ApiTypeRegister', '(', 'object', ')', ':', '___EOS___']", "index": 1256 }, { "content": " def getDefaults(self):\n \"get a list of defaults\"\n defaults = []\n defaultInfo = self.methodInfo['defaults']\n inArgs = self.methodInfo['inArgs']\n nargs = len(inArgs)\n for i, arg in enumerate( inArgs ):\n if arg in defaultInfo:\n default = defaultInfo[arg]\n\n # FIXME : these defaults should probably not be set here since this is supposed to be\n # a \"dumb\" registry of data. perhaps move them to the controlPanel\n\n # set MSpace.Space enum to object space by default, but only if it is the last arg or\n # the next arg has a default ( i.e. kwargs must always come after args )\n# elif str(self.methodInfo['types'][arg]) == 'MSpace.Space' and \\\n# ( i==(nargs-1) or ( i<(nargs-1) and inArgs[i+1] in defaultInfo ) ):\n# default = apicache.ApiEnum(['MSpace', 'Space', 'kWorld']) # should be kPostTransform? this is what xform defaults to...\n\n else:\n continue\n\n if isinstance(default, apicache.ApiEnum ):\n # convert enums from apiName to pymelName. the default will be the readable string name\n apiClassName, enumName, enumValue = default\n try:\n enumList = apiClassInfo[apiClassName]['enums'][enumName]['values']\n except KeyError:\n _logger.warning(\"Could not find enumerator %s\", default)\n else:\n index = enumList.getIndex(enumValue)\n default = apiClassInfo[apiClassName]['pymelEnums'][enumName][index]\n defaults.append( default )\n\n return defaults", "metadata": "root.ApiArgUtil.getDefaults", "header": "['class', 'ApiArgUtil', '(', 'object', ')', ':', '___EOS___']", "index": 1714 }, { "content": "def wrapApiMethod( apiClass, methodName, newName=None, proxy=True, overloadIndex=None ):\n \"\"\"\n create a wrapped, user-friendly API method that works the way a python method should: no MScriptUtil and\n no special API classes required. Inputs go in the front door, and outputs come out the back door.\n\n\n Regarding Undo\n --------------\n\n The API provides many methods which are pairs -- one sets a value\n while the other one gets the value. the naming convention of these\n methods follows a fairly consistent pattern. so what I did was\n determine all the get and set pairs, which I can use to automatically\n register api undo items: prior to setting something, we first *get*\n it's existing value, which we can later use to reset when undo is\n triggered.\n\n This API undo is only for PyMEL methods which are derived from API\n methods. it's not meant to be used with plugins. and since it just\n piggybacks maya's MEL undo system, it won't get cross-mojonated.\n\n Take `MFnTransform.setTranslation`, for example. PyMEL provides a wrapped copy of this as\n `Transform.setTranslation`. when pymel.Transform.setTranslation is\n called, here's what happens in relation to undo:\n\n #. process input args, if any\n #. call MFnTransform.getTranslation() to get the current translation.\n #. append to the api undo queue, with necessary info to undo/redo\n later (the current method, the current args, and the current\n translation)\n #. call MFnTransform.setTranslation() with the passed args\n #. process result and return it\n\n\n :Parameters:\n\n apiClass : class\n the api class\n methodName : string\n the name of the api method\n newName : string\n optionally provided if a name other than that of api method is desired\n proxy : bool\n If True, then __apimfn__ function used to retrieve the proxy class. If False,\n then we assume that the class being wrapped inherits from the underlying api class.\n overloadIndex : None or int\n which of the overloaded C++ signatures to use as the basis of our wrapped function.\n\n\n \"\"\"\n\n #getattr( api, apiClassName )\n\n apiClassName = apiClass.__name__\n try:\n method = getattr( apiClass, methodName )\n except AttributeError:\n return\n\n argHelper = ApiArgUtil(apiClassName, methodName, overloadIndex)\n undoable = True # controls whether we print a warning in the docs\n\n if newName is None:\n pymelName = argHelper.getPymelName()\n else:\n pymelName = newName\n\n if argHelper.canBeWrapped() :\n\n if argHelper.isDeprecated():\n# _logger.info( \"%s.%s is deprecated\" % (apiClassName, methodName) )\n _logger.debug( \"%s.%s is deprecated\" % (apiClassName, methodName) )\n inArgs = argHelper.inArgs()\n outArgs = argHelper.outArgs()\n argList = argHelper.argList()\n argInfo = argHelper.argInfo()\n\n getterArgHelper = argHelper.getGetterInfo()\n\n if argHelper.hasOutput() :\n getterInArgs = []\n # query method ( getter )\n #if argHelper.getGetterInfo() is not None:\n\n # temporarily supress this warning, until we get a deeper level\n# if getterArgHelper is not None:\n# _logger.warn( \"%s.%s has an inverse %s, but it has outputs, which is not allowed for a 'setter'\" % (\n# apiClassName, methodName, getterArgHelper.methodName ) )\n\n else:\n # edit method ( setter )\n if getterArgHelper is None:\n #_logger.debug( \"%s.%s has no inverse: undo will not be supported\" % ( apiClassName, methodName ) )\n getterInArgs = []\n undoable = False\n else:\n getterInArgs = getterArgHelper.inArgs()\n\n\n # create the function\n def wrappedApiFunc( self, *args ):\n do_args = []\n outTypeList = []\n\n undoEnabled = getterArgHelper is not None and cmds.undoInfo(q=1, state=1) and apiUndo.cb_enabled\n #outTypeIndex = []\n\n if len(args) != len(inArgs):\n raise TypeError, \"%s() takes exactly %s arguments (%s given)\" % ( methodName, len(inArgs), len(args) )\n\n # get the value we are about to set\n if undoEnabled:\n getterArgs = [] # args required to get the current state before setting it\n undo_args = [] # args required to reset back to the original (starting) state ( aka \"undo\" )\n missingUndoIndices = [] # indices for undo args that are not shared with the setter and which need to be filled by the result of the getter\n inCount = 0\n for name, argtype, direction in argList :\n if direction == 'in':\n arg = args[inCount]\n undo_args.append(arg)\n if name in getterInArgs:\n # gather up args that are required to get the current value we are about to set.\n # these args are shared between getter and setter pairs\n getterArgs.append(arg)\n #undo_args.append(arg)\n else:\n # store the indices for\n missingUndoIndices.append(inCount)\n #undo_args.append(None)\n inCount +=1\n\n getter = getattr( self, getterArgHelper.getPymelName() )\n setter = getattr( self, pymelName )\n\n try:\n getterResult = getter( *getterArgs )\n except RuntimeError:\n _logger.error( \"the arguments at time of error were %r\" % getterArgs)\n raise\n\n # when a command returns results normally and passes additional outputs by reference, the result is returned as a tuple\n # otherwise, always as a list\n if not isinstance( getterResult, tuple ):\n getterResult = (getterResult,)\n\n for index, result in zip(missingUndoIndices, getterResult ):\n undo_args[index] = result\n\n\n inCount = totalCount = 0\n for name, argtype, direction in argList :\n if direction == 'in':\n arg = args[inCount]\n do_args.append( argHelper.castInput( name, arg, self.__class__ ) )\n inCount +=1\n else:\n val = argHelper.initReference(argtype)\n do_args.append( val )\n outTypeList.append( (argtype, totalCount) )\n #outTypeIndex.append( totalCount )\n totalCount += 1\n\n\n if undoEnabled:\n undoItem = ApiUndoItem(setter, do_args, undo_args)\n apiUndo.append( undoItem )\n\n # Do final SafeApiPtr => 'true' ptr conversion\n final_do_args = []\n for arg in do_args:\n if isinstance(arg, api.SafeApiPtr):\n final_do_args.append(arg())\n else:\n final_do_args.append(arg)\n if argHelper.isStatic():\n result = method( *final_do_args )\n else:\n if proxy:\n # due to the discrepancies between the API and Maya node hierarchies, our __apimfn__ might not be a\n # subclass of the api class being wrapped, however, the api object can still be used with this mfn explicitly.\n mfn = self.__apimfn__()\n if not isinstance(mfn, apiClass):\n mfn = apiClass( self.__apiobject__() )\n result = method( mfn, *final_do_args )\n else:\n result = method( self, *final_do_args )\n result = argHelper.castResult( self, result )\n\n if len(outArgs):\n if result is not None:\n result = [result]\n else:\n result = []\n\n for outType, index in outTypeList:\n outArgVal = do_args[index]\n res = argHelper.castReferenceResult( outType, outArgVal )\n result.append( res )\n\n if len(result) == 1:\n result = result[0]\n else:\n result = tuple(result)\n return result\n\n wrappedApiFunc.__name__ = pymelName\n\n _addApiDocs( wrappedApiFunc, apiClass, methodName, overloadIndex, undoable )\n\n # format EnumValue defaults\n defaults = []\n for default in argHelper.getDefaults():\n if isinstance( default, util.EnumValue ):\n defaults.append( str(default) )\n else:\n defaults.append( default )\n\n if defaults:\n pass\n #_logger.debug(\"defaults: %s\" % defaults)\n\n wrappedApiFunc = util.interface_wrapper( wrappedApiFunc, ['self'] + inArgs, defaults=defaults )\n wrappedApiFunc._argHelper = argHelper\n\n if argHelper.isStatic():\n wrappedApiFunc = classmethod(wrappedApiFunc)\n\n return wrappedApiFunc", "metadata": "root.wrapApiMethod", "header": "['module', '___EOS___']", "index": 1967 }, { "content": "def addApiDocsCallback( apiClass, methodName, overloadIndex=None, undoable=True, origDocstring=''):\n apiClassName = apiClass.__name__\n\n argHelper = ApiArgUtil(apiClassName, methodName, overloadIndex)\n inArgs = argHelper.inArgs()\n outArgs = argHelper.outArgs()\n argList = argHelper.argList()\n argInfo = argHelper.argInfo()\n\n def formatDocstring(type):\n \"\"\"\n convert\n \"['one', 'two', 'three', ['1', '2', '3']]\"\n to\n \"[`one`, `two`, `three`, [`1`, `2`, `3`]]\"\n \"\"\"\n if not isinstance(type, list):\n pymelType = ApiTypeRegister.types.get(type,type)\n else:\n pymelType = type\n\n if isinstance(pymelType, apicache.ApiEnum):\n pymelType = pymelType.pymelName()\n\n doc = repr(pymelType).replace(\"'\", \"`\")\n if type in ApiTypeRegister.arrayItemTypes.keys():\n doc += ' list'\n return doc\n\n # Docstrings\n docstring = argHelper.getMethodDocs()\n # api is no longer in specific units, it respect UI units like MEL\n docstring = docstring.replace( 'centimeter', 'linear unit' )\n docstring = docstring.replace( 'radian', 'angular unit' )\n\n S = ' '\n if len(inArgs):\n docstring += '\\n\\n:Parameters:\\n'\n for name in inArgs :\n info = argInfo[name]\n type = info['type']\n typeStr = formatDocstring(type)\n\n docstring += S + '%s : %s\\n' % (name, typeStr )\n docstring += S*2 + '%s\\n' % (info['doc'])\n if isinstance( type, apicache.ApiEnum ):\n apiClassName, enumName = type\n enumValues = apiClassInfo[apiClassName]['pymelEnums'][enumName].keys()\n docstring += '\\n' + S*2 + 'values: %s\\n' % ', '.join( [ '%r' % x for x in enumValues if x not in ['invalid', 'last' ] ] )\n\n\n\n # Results doc strings\n results = []\n returnType = argHelper.getReturnType()\n if returnType:\n rtype = formatDocstring(returnType)\n results.append( rtype )\n for argname in outArgs:\n rtype = argInfo[argname]['type']\n rtype = formatDocstring(rtype)\n results.append( rtype )\n\n if len(results) == 1:\n results = results[0]\n docstring += '\\n\\n:rtype: %s\\n' % results\n elif results:\n docstring += '\\n\\n:rtype: (%s)\\n' % ', '.join(results)\n\n docstring += '\\nDerived from api method `%s.%s.%s`\\n' % (apiClass.__module__, apiClassName, methodName)\n if not undoable:\n docstring += '\\n**Undo is not currently supported for this method**\\n'\n\n if origDocstring:\n docstring = origDocstring + '\\n' + docstring\n\n return docstring", "metadata": "root.addApiDocsCallback", "header": "['module', '___EOS___']", "index": 2212 }, { "content": " def __new__(cls, classname, bases, classdict):\n # If the class explicitly gives it's mel ui command name, use that - otherwise, assume it's\n # the name of the PyNode, uncapitalized\n uiType= classdict.setdefault('__melui__', util.uncapitalize(classname))\n\n # TODO: implement a option at the cmdlist level that triggers listForNone\n # TODO: create labelArray for *Grp ui elements, which passes to the correct arg ( labelArray3, labelArray4, etc ) based on length of passed array\n\n return super(MetaMayaUIWrapper, cls).__new__(cls, classname, bases, classdict)", "metadata": "root.MetaMayaUIWrapper.__new__", "header": "['class', 'MetaMayaUIWrapper', '(', '_MetaMayaCommandWrapper', ')', ':', '___EOS___']", "index": 2733 } ]
[ { "span": "apiArrayType ", "start_line": 1343, "start_column": 24, "end_line": 1343, "end_column": 36 }, { "span": "nargs ", "start_line": 1719, "start_column": 8, "end_line": 1719, "end_column": 13 }, { "span": "argInfo ", "start_line": 2042, "start_column": 8, "end_line": 2042, "end_column": 15 }, { "span": "argList ", "start_line": 2218, "start_column": 4, "end_line": 2218, "end_column": 11 }, { "span": "uiType=", "start_line": 2736, "start_column": 8, "end_line": 2736, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Ap", "i", "Type", "Register_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "api", "Type", "Name_", ",_", "pym", "el", "Type_", ",_", "in", "Cast", "_", "=_", "None_", ",_", "out", "Cast", "_", "=_", "None_", ",_", "api", "Array", "Item", "Type_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "pym", "el", "Type", " ", "is", " ", "the", " ", "type", " ", "to", " ", "be", " ", "used", " ", "internal", "ly", " ", "by", " ", "pym", "el", ".", " ", " ", "api", "Type", " ", "will", " ", "be", " ", "hidden", " ", "from", " ", "the", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "convert", "ed", " ", "to", " ", "the", " ", "pym", "el", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "api", "Type", "Name", " ", "is", " ", "the", " ", "name", " ", "of", " ", "an", " ", "api", "Type", " ", "as", " ", "a", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "api", "Array", "Item", "Type", " ", "is", " ", "set", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "the", " ", "api", " ", "type", " ", "tha", "t", " ", "represent", "s", " ", "each", " ", "item", " ", "in", " ", "the", " ", "array", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "api", "Type", "Name", " ", "=", " ", "pym", "el", "Type", ".\\u", "\\u", "class", "\\u\\u", ".\\u", "\\u", "name\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cap", "Type_", "=_", "util_", "._", "capitalize_", "(_", "api", "Type", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "register", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "types_", "[_", "api", "Type", "Name_", "]_", "=_", "pym", "el", "Type_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "api", "Array", "Item", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "array", "Item", "Types_", "[_", "api", "Type", "Name_", "]_", "=_", "api", "Array", "Item", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "register", " ", "result", " ", "casting", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "out", "Cast", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "out", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "out", "Cast", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "api", "Array", "Item", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "out", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "lambda_", "self_", ",_", "x_", ":_", "pym", "el", "Type_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "register", " ", "argu", "ment", " ", "casting", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "in", "Cast", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "in", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "in", "Cast", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "api", "Array", "Item", "Type_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "filled", " ", "out", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "._", "in", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "pym", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "api", "Type", "Name_", "in_", "[_", "'", "float", "'_", ",_", "'", "double", "'_", ",_", "'", "bool", "'_", ",_", "'", "int", "'_", ",_", "'", "short", "'_", ",_", "'", "long", "'_", ",_", "'", "uint", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "init", "Func_", "=_", "cls_", "._", "\\u", "make", "Ref", "Func_", "(_", "cap", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "Func_", "=_", "api_", "._", "Safe", "Ap", "i", "Ptr_", "._", "get_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Init_", "[_", "api", "Type", "Name_", "]_", "=_", "init", "Func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "get", "Func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Register", " ", "arrays", " ", "for", " ", "this", " ", "up", " ", "to", " ", "size", " ", "for", " ", "-", " ", "ie", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "int", " ", "my", "Var", "[", "2", "];", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "iap", "i", "Array", "Type", "name_", "=_", "api", "Type", "Name_", "+_", "'\\u", "\\u", "array", "'_", "+_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "Ini", "t", "Func_", "=_", "cls_", "._", "\\u", "make", "Ref", "Func_", "(_", "cap", "Type_", ",_", "size_", "=_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Init_", "[_", "iap", "i", "Array", "Type", "name_", "]_", "=_", "array", "Ini", "t", "Func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "in", "Cast", "_", "[_", "iap", "i", "Array", "Type", "name_", "]_", "=_", "cls_", "._", "\\u", "make", "Array", "Setter", "_", "(_", "api", "Type", "Name_", ",_", "i_", ",_", "array", "Ini", "t", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Cast", "_", "[_", "iap", "i", "Array", "Type", "name_", "]_", "=_", "cls_", "._", "\\u", "make", "Array", "Getter", "_", "(_", "api", "Type", "Name_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "types_", "[_", "iap", "i", "Array", "Type", "name_", "]_", "=_", "tuple_", "(_", "[_", "pym", "el", "Type_", "._", "\\u\\u", "name\\u\\u_", "]_", "*_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "there", " ", "is", " ", "an", " ", "explicit", " ", "maya", " ", "type", " ", "for", " ", "n", " ", "of", " ", "these", " ", "-", " ", "ie", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "int2", " ", "my", "Var", ";_", "\\u\\u\\uNL\\u\\u\\u_", "api", "Type", "Name", "N_", "=_", "api", "Type", "Name_", "+_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cast", "NF", "unc", "Name_", "=_", "'", "as", "'_", "+_", "cap", "Type_", "+_", "str_", "(_", "i_", ")_", "+_", "'", "Pt", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "api_", "._", "MS", "cript", "Util_", ",_", "cast", "NF", "unc", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "n", "Ini", "t", "Func_", "=_", "cls_", "._", "\\u", "make", "Ref", "Func_", "(_", "api", "Type", "Name_", ",_", "size_", "=_", "i_", ",_", "as", "Type", "NP", "tr_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Init_", "[_", "api", "Type", "Name", "N_", "]_", "=_", "n", "Ini", "t", "Func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "in", "Cast", "_", "[_", "api", "Type", "Name", "N_", "]_", "=_", "cls_", "._", "\\u", "make", "Array", "Setter", "_", "(_", "api", "Type", "Name_", ",_", "i_", ",_", "n", "Ini", "t", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Cast", "_", "[_", "api", "Type", "Name", "N_", "]_", "=_", "cls_", "._", "\\u", "make", "Array", "Getter", "_", "(_", "api", "Type", "Name_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "types_", "[_", "api", "Type", "Name", "N_", "]_", "=_", "tuple_", "(_", "[_", "pym", "el", "Type_", "._", "\\u\\u", "name\\u\\u_", "]_", "*_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "Type_", "=_", "getattr_", "(_", "api_", ",_", "api", "Type", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "api", "Array", "Item", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls_", "._", "ref", "Init_", "[_", "api", "Type", "Name_", "]_", "=_", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "in", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "lambda_", "x_", ":_", "[_", "api", "Array", "Item", "Type_", "(_", "y_", ")_", "for_", "y_", "in_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "out", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "-", " ", "Ap", "i", " ", "Array", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "api", "Array", "Item", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls_", "._", "ref", "Init_", "[_", "api", "Type", "Name_", "]_", "=_", "api", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "in", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "cls_", "._", "\\u", "make", "Ap", "i", "Array", "Setter", "_", "(_", "api", "Type_", ",_", "api", "Array", "Item", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "double", " ", "wrapp", "ed", " ", "bec", "aus", "e", " ", "of", " ", "the", " ", "crashes", " ", "occur", "ing", " ", "with", " ", "MD", "ag", "Path", "Array", ".", " ", "not", " ", "sure", " ", "if", " ", "it", "'", "s", " ", "applica", "ble", " ", "to", " ", "all", " ", "arrays_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "api", "Type_", "==_", "api_", "._", "MD", "ag", "Path", "Array_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cls_", "._", "ref", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "lambda_", "x_", ":_", "[_", "pym", "el", "Type_", "(_", "api", "Array", "Item", "Type_", "(_", "x_", "[_", "i_", "]_", ")_", ")_", "for_", "i_", "in_", "range_", "(_", "x_", "._", "length_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "out", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "lambda_", "self_", ",_", "x_", ":_", "[_", "pym", "el", "Type_", "(_", "api", "Array", "Item", "Type_", "(_", "x_", "[_", "i_", "]_", ")_", ")_", "for_", "i_", "in_", "range_", "(_", "x_", "._", "length_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "cls_", "._", "ref", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "lambda_", "x_", ":_", "[_", "pym", "el", "Type_", "(_", "x_", "[_", "i_", "]_", ")_", "for_", "i_", "in_", "range_", "(_", "x_", "._", "length_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "out", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "lambda_", "self_", ",_", "x_", ":_", "[_", "pym", "el", "Type_", "(_", "x_", "[_", "i_", "]_", ")_", "for_", "i_", "in_", "range_", "(_", "x_", "._", "length_", "(_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-", " ", "Ap", "i", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "cls_", "._", "ref", "Init_", "[_", "api", "Type", "Name_", "]_", "=_", "api", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "ref", "Cast", "_", "[_", "api", "Type", "Name_", "]_", "=_", "pym", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "automati", "call", "y", " ", "handle", " ", "array", " ", "types", " ", "tha", "t", " ", "correspond", " ", "to", " ", "this", " ", "api", " ", "type", " ", "(", "e", ".", "g", ".", " ", " ", "MC", "olor", " ", "and", " ", "MC", "olor", "Array", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "array", "Type", "name_", "=_", "api", "Type", "Name_", "+_", "'", "Array", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "Array", "Type_", "=_", "getattr_", "(_", "api_", ",_", "array", "Type", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", " ", "'", "MC", "olor", "Array", "',", " ", "Color", ",", " ", "api", ".", "MC", "olor_", "\\u\\u\\uNL\\u\\u\\u_", "Ap", "i", "Type", "Register_", "._", "register_", "(_", "array", "Type", "name_", ",_", "pym", "el", "Type_", ",_", "api", "Array", "Item", "Type_", "=_", "api", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ap", "i", "Arg", "Util_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Defaults_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "get", " ", "a", " ", "list", " ", "of", " ", "default", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defaults_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "Info_", "=_", "self_", "._", "method", "Info_", "[_", "'", "default", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Args_", "=_", "self_", "._", "method", "Info_", "[_", "'", "in", "Arg", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nargs_", "=_", "len_", "(_", "in", "Args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "arg_", "in_", "enumerate_", "(_", "in", "Args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "in_", "default", "Info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default_", "=_", "default", "Info_", "[_", "arg_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", " ", ":", " ", "these", " ", "default", "s", " ", "shou", "ld", " ", "probab", "ly", " ", "not", " ", "be", " ", "set", " ", "here", " ", "sinc", "e", " ", "this", " ", "is", " ", "supposed", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "\"", "dumb", "\"", " ", "registr", "y", " ", "of", " ", "data", ".", " ", " ", "per", "hap", "s", " ", "move", " ", "them", " ", "to", " ", "the", " ", "control", "Panel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "MS", "pace", ".", "Spac", "e", " ", "enum", " ", "to", " ", "object", " ", "space", " ", "by", " ", "default", ",", " ", "but", " ", "only", " ", "if", " ", "it", " ", "is", " ", "the", " ", "last", " ", "arg", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "next", " ", "arg", " ", "has", " ", "a", " ", "default", " ", "(", " ", "i", ".", "e", ".", " ", "kwarg", "s", " ", "must", " ", "alw", "ay", "s", " ", "come", " ", "after", " ", "args", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "eli", "f", " ", "str", "(", "self", ".", "method", "Info", "['", "types", "']", "[", "arg", "])", " ", "==", " ", "'", "MS", "pace", ".", "Spac", "e", "'", " ", "and", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "(", " ", " ", " ", "i", "==", "(", "narg", "s", "-1", ")", " ", "or", " ", "(", " ", "i", "<", "(", "narg", "s", "-1", ")", " ", "and", " ", "in", "Arg", "s", "[", "i", "+", "1", "]", " ", "in", " ", "default", "Info", " ", ")", " ", " ", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "default", " ", "=", " ", "apic", "ache", ".", "Ap", "i", "Enum", "([", "'", "MS", "pace", "',", " ", "'", "Spac", "e", "',", " ", "'", "k", "Wor", "ld", "'])", " ", " ", "#", " ", "shou", "ld", " ", "be", " ", "k", "Post", "Transform", "?", " ", " ", "this", " ", "is", " ", "what", " ", "xform", " ", "default", "s", " ", "to", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "default_", ",_", "apic", "ache_", "._", "Ap", "i", "Enum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", " ", "enum", "s", " ", "from", " ", "api", "Name", " ", "to", " ", "pym", "el", "Name", ".", " ", "the", " ", "default", " ", "will", " ", "be", " ", "the", " ", "reada", "ble", " ", "string", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "Class", "Name_", ",_", "enum", "Name_", ",_", "enum", "Value_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "enum", "List_", "=_", "api", "Class", "Info_", "[_", "api", "Class", "Name_", "]_", "[_", "'", "enum", "s", "'_", "]_", "[_", "enum", "Name_", "]_", "[_", "'", "values", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "logger_", "._", "warning_", "(_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "enum", "erator", " ", "%", "s", "\"_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "index_", "=_", "enum", "List_", "._", "get", "Index_", "(_", "enum", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default_", "=_", "api", "Class", "Info_", "[_", "api", "Class", "Name_", "]_", "[_", "'", "pym", "el", "Enum", "s", "'_", "]_", "[_", "enum", "Name_", "]_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "defaults_", "._", "append_", "(_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wrap", "Ap", "i", "Method_", "(_", "api", "Class_", ",_", "method", "Name_", ",_", "new", "Name_", "=_", "None_", ",_", "proxy_", "=_", "True_", ",_", "overload", "Index_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "create", " ", "a", " ", "wrapp", "ed", ",", " ", "user", "-", "frie", "ndl", "y", " ", "API", " ", "method", " ", "tha", "t", " ", "works", " ", "the", " ", "way", " ", "a", " ", "python", " ", "method", " ", "shou", "ld", ":", " ", "no", " ", "MS", "cript", "Ut", "il", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "no", " ", "special", " ", "API", " ", "classe", "s", " ", "require", "d", ".", " ", " ", "Inp", "uts", " ", "go", " ", "in", " ", "the", " ", "front", " ", "door", ",", " ", "and", " ", "output", "s", " ", "come", " ", "out", " ", "the", " ", "back", " ", "door", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Reg", "ard", "ing", " ", "Und", "o", "\\", "10", ";", " ", " ", " ", " ", "--------------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "API", " ", "provide", "s", " ", "many", " ", "method", "s", " ", "whi", "ch", " ", "are", " ", "pair", "s", " ", "--", " ", "one", " ", "sets", " ", "a", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "whi", "le", " ", "the", " ", "other", " ", "one", " ", "gets", " ", "the", " ", "value", ".", " ", " ", "the", " ", "nami", "ng", " ", "convention", " ", "of", " ", "these", "\\", "10", ";", " ", " ", " ", " ", "method", "s", " ", "follow", "s", " ", "a", " ", "fair", "ly", " ", "consistent", " ", "pattern", ".", " ", " ", "so", " ", "what", " ", "I", " ", "did", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "dete", "rmin", "e", " ", "all", " ", "the", " ", "get", " ", "and", " ", "set", " ", "pair", "s", ",", " ", "whi", "ch", " ", "I", " ", "can", " ", "use", " ", "to", " ", "automati", "call", "y", "\\", "10", ";", " ", " ", " ", " ", "register", " ", "api", " ", "undo", " ", "items", ":", " ", " ", "prior", " ", "to", " ", "setti", "ng", " ", "somet", "hing", ",", " ", "we", " ", "first", " ", "*", "get", "*", "\\", "10", ";", " ", " ", " ", " ", "it", "'", "s", " ", "exist", "ing", " ", "value", ",", " ", "whi", "ch", " ", "we", " ", "can", " ", "late", "r", " ", "use", " ", "to", " ", "reset", " ", "whe", "n", " ", "undo", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "trigger", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "API", " ", "undo", " ", "is", " ", "only", " ", "for", " ", "Py", "ME", "L", " ", "method", "s", " ", "whi", "ch", " ", "are", " ", "derive", "d", " ", "from", " ", "API", "\\", "10", ";", " ", " ", " ", " ", "method", "s", ".", " ", " ", "it", "'", "s", " ", "not", " ", "mean", "t", " ", "to", " ", "be", " ", "used", " ", "with", " ", "plugin", "s", ".", " ", " ", "and", " ", "sinc", "e", " ", "it", " ", "just", "\\", "10", ";", " ", " ", " ", " ", "pig", "gy", "backs", " ", "maya", "'", "s", " ", "ME", "L", " ", "undo", " ", "system", ",", " ", "it", " ", "won", "'", "t", " ", "get", " ", "cross", "-", "mo", "jon", "ated", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Tak", "e", " ", "`", "MF", "n", "Transform", ".", "set", "Translat", "ion", "`", ",", " ", "for", " ", "example", ".", " ", "Py", "ME", "L", " ", "provide", "s", " ", "a", " ", "wrapp", "ed", " ", "copy", " ", "of", " ", "this", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "`", "Transform", ".", "set", "Translat", "ion", "`.", " ", " ", " ", "whe", "n", " ", "pym", "el", ".", "Transform", ".", "set", "Translat", "ion", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", ",", " ", "here", "'", "s", " ", "what", " ", "happ", "ens", " ", "in", " ", "relation", " ", "to", " ", "undo", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#.", " ", "process", " ", "input", " ", "args", ",", " ", "if", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "#.", " ", "call", " ", "MF", "n", "Transform", ".", "get", "Translat", "ion", "()", " ", "to", " ", "get", " ", "the", " ", "current", " ", "translatio", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "#.", " ", "append", " ", "to", " ", "the", " ", "api", " ", "undo", " ", "queue", ",", " ", "with", " ", "necessar", "y", " ", "info", " ", "to", " ", "undo", "/", "redo", "\\", "10", ";", " ", " ", " ", "late", "r", " ", "(", "the", " ", "current", " ", "method", ",", " ", "the", " ", "current", " ", "args", ",", " ", "and", " ", "the", " ", "current", "\\", "10", ";", " ", " ", " ", "translatio", "n", ")", "\\", "10", ";", " ", " ", " ", " ", "#.", " ", "call", " ", "MF", "n", "Transform", ".", "set", "Translat", "ion", "()", " ", "with", " ", "the", " ", "pass", "ed", " ", "args", "\\", "10", ";", " ", " ", " ", " ", "#.", " ", "process", " ", "result", " ", "and", " ", "return", " ", "it", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "api", "Class", " ", ":", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "api", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "method", "Name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "of", " ", "the", " ", "api", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "new", "Name", " ", ":", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "option", "ally", " ", "provided", " ", "if", " ", "a", " ", "name", " ", "other", " ", "than", " ", "tha", "t", " ", "of", " ", "api", " ", "method", " ", "is", " ", "desi", "red", "\\", "10", ";", " ", " ", " ", " ", "proxy", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "then", " ", "\\u\\u", "api", "mf", "n", "\\u\\u", " ", "function", " ", "used", " ", "to", " ", "retrieve", " ", "the", " ", "proxy", " ", "class", ".", " ", "If", " ", "Fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "we", " ", "assume", " ", "tha", "t", " ", "the", " ", "class", " ", "bei", "ng", " ", "wrapp", "ed", " ", "inherits", " ", "from", " ", "the", " ", "underl", "ying", " ", "api", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "overload", "Index", " ", ":", " ", "Non", "e", " ", "or", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "of", " ", "the", " ", "overload", "ed", " ", "C", "++", " ", "signa", "tures", " ", "to", " ", "use", " ", "as", " ", "the", " ", "basi", "s", " ", "of", " ", "our", " ", "wrapp", "ed", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "getattr", "(", " ", "api", ",", " ", "api", "Class", "Name", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "api", "Class", "Name_", "=_", "api", "Class_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "method_", "=_", "getattr_", "(_", "api", "Class_", ",_", "method", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "arg", "Helper_", "=_", "Ap", "i", "Arg", "Util_", "(_", "api", "Class", "Name_", ",_", "method", "Name_", ",_", "overload", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "undo", "able_", "=_", "True_", "#", " ", "controls", " ", "whe", "ther", " ", "we", " ", "print", " ", "a", " ", "warn", "ing", " ", "in", " ", "the", " ", "docs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "Name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pym", "el", "Name_", "=_", "arg", "Helper_", "._", "get", "Py", "mel", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pym", "el", "Name_", "=_", "new", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arg", "Helper_", "._", "can", "Be", "Wrapp", "ed_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg", "Helper_", "._", "is", "Dep", "reca", "ted_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "logg", "er", ".", "info", "(", " ", " ", "\"%", "s", ".", "%", "s", " ", "is", " ", "depre", "cated", "\"", " ", "%", " ", "(", "api", "Class", "Name", ",", " ", "method", "Name", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "logger_", "._", "debug_", "(_", "\"%", "s", ".", "%", "s", " ", "is", " ", "depre", "cated", "\"_", "%_", "(_", "api", "Class", "Name_", ",_", "method", "Name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Args_", "=_", "arg", "Helper_", "._", "in", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Args_", "=_", "arg", "Helper_", "._", "out", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "List_", "=_", "arg", "Helper_", "._", "arg", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "Info_", "=_", "arg", "Helper_", "._", "arg", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "getter", "Arg", "Helper_", "=_", "arg", "Helper_", "._", "get", "Getter", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "arg", "Helper_", "._", "has", "Output_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter", "In", "Args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "query", " ", "method", " ", "(", " ", "getter", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "arg", "Help", "er", ".", "get", "Getter", "Info", "()", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "temporar", "il", "y", " ", "sup", "ress", " ", "this", " ", "warn", "ing", ",", " ", "unti", "l", " ", "we", " ", "get", " ", "a", " ", "deep", "er", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "getter", "Arg", "Help", "er", " ", "is", " ", "not", " ", "Non", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "\\u", "logg", "er", ".", "warn", "(", " ", "\"%", "s", ".", "%", "s", " ", "has", " ", "an", " ", "inv", "erse", " ", "%", "s", ",", " ", "but", " ", "it", " ", "has", " ", "output", "s", ",", " ", "whi", "ch", " ", "is", " ", "not", " ", "allow", "ed", " ", "for", " ", "a", " ", "'", "sette", "r", "'\"", " ", "%", " ", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "api", "Class", "Name", ",", " ", "method", "Name", ",", " ", "getter", "Arg", "Help", "er", ".", "method", "Name", " ", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "edit", " ", "method", " ", "(", " ", "sette", "r", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "getter", "Arg", "Helper_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#\\u", "logg", "er", ".", "debug", "(", " ", "\"%", "s", ".", "%", "s", " ", "has", " ", "no", " ", "inv", "erse", ":", " ", "undo", " ", "will", " ", "not", " ", "be", " ", "support", "ed", "\"", " ", "%", " ", "(", " ", "api", "Class", "Name", ",", " ", "method", "Name", " ", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter", "In", "Args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "undo", "able_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter", "In", "Args_", "=_", "getter", "Arg", "Helper_", "._", "in", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "the", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wrapp", "ed", "Ap", "i", "Func_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "do", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Type", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "undo", "Enabled_", "=_", "getter", "Arg", "Helper_", "is_", "not_", "None_", "and_", "cmds_", "._", "undo", "Info_", "(_", "q_", "=_", "1_", ",_", "state_", "=_", "1_", ")_", "and_", "api", "Und", "o_", "._", "cb", "\\u", "enabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "out", "Type", "Index", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "!=_", "len_", "(_", "in", "Args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", ",_", "\"%", "s", "()", " ", "take", "s", " ", "exact", "ly", " ", "%", "s", " ", "argu", "ment", "s", " ", "(%", "s", " ", "give", "n", ")\"_", "%_", "(_", "method", "Name_", ",_", "len_", "(_", "in", "Args_", ")_", ",_", "len_", "(_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "the", " ", "value", " ", "we", " ", "are", " ", "abo", "ut", " ", "to", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "undo", "Enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "getter", "Args_", "=_", "[_", "]_", "#", " ", "args", " ", "require", "d", " ", "to", " ", "get", " ", "the", " ", "current", " ", "state", " ", "bef", "ore", " ", "setti", "ng", " ", "it_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "undo", "\\u", "args_", "=_", "[_", "]_", "#", " ", "args", " ", "require", "d", " ", "to", " ", "reset", " ", "back", " ", "to", " ", "the", " ", "original", " ", "(", "startin", "g", ")", " ", "state", " ", " ", "(", " ", "aka", " ", "\"", "undo", "\"", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "missi", "ng", "Und", "o", "Indices_", "=_", "[_", "]_", "#", " ", "indice", "s", " ", "for", " ", "undo", " ", "args", " ", "tha", "t", " ", "are", " ", "not", " ", "shared", " ", "with", " ", "the", " ", "sette", "r", " ", "and", " ", "whi", "ch", " ", "need", " ", "to", " ", "be", " ", "filled", " ", "by", " ", "the", " ", "result", " ", "of", " ", "the", " ", "getter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "arg", "type_", ",_", "direction_", "in_", "arg", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "direction_", "==_", "'", "in", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "arg_", "=_", "args_", "[_", "in", "Count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "undo", "\\u", "args_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "getter", "In", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "gather", " ", "up", " ", "args", " ", "tha", "t", " ", "are", " ", "require", "d", " ", "to", " ", "get", " ", "the", " ", "current", " ", "value", " ", "we", " ", "are", " ", "abo", "ut", " ", "to", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "these", " ", "args", " ", "are", " ", "shared", " ", "bet", "ween", " ", "getter", " ", "and", " ", "sette", "r", " ", "pairs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "getter", "Args_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "undo", "\\u", "args", ".", "append", "(", "arg", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "indice", "s", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "missi", "ng", "Und", "o", "Indices_", "._", "append_", "(_", "in", "Count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "undo", "\\u", "args", ".", "append", "(", "Non", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "getter_", "=_", "getattr_", "(_", "self_", ",_", "getter", "Arg", "Helper_", "._", "get", "Py", "mel", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setter_", "=_", "getattr_", "(_", "self_", ",_", "pym", "el", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "getter", "Result_", "=_", "getter_", "(_", "*_", "getter", "Args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "logger_", "._", "error_", "(_", "\"", "the", " ", "argu", "ment", "s", " ", "at", " ", "time", " ", "of", " ", "error", " ", "wer", "e", " ", "%", "r", "\"_", "%_", "getter", "Args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whe", "n", " ", "a", " ", "command", " ", "return", "s", " ", "results", " ", "normal", "ly", " ", "and", " ", "pass", "es", " ", "addition", "al", " ", "output", "s", " ", "by", " ", "reference", ",", " ", "the", " ", "result", " ", "is", " ", "return", "ed", " ", "as", " ", "a", " ", "tuple_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", ",", " ", "alw", "ay", "s", " ", "as", " ", "a", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "getter", "Result_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "getter", "Result_", "=_", "(_", "getter", "Result_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "index_", ",_", "result_", "in_", "zip_", "(_", "missi", "ng", "Und", "o", "Indices_", ",_", "getter", "Result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "undo", "\\u", "args_", "[_", "index_", "]_", "=_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Count_", "=_", "total", "Count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "arg", "type_", ",_", "direction_", "in_", "arg", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "direction_", "==_", "'", "in", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "arg_", "=_", "args_", "[_", "in", "Count_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "args_", "._", "append_", "(_", "arg", "Helper_", "._", "cast", "Input_", "(_", "name_", ",_", "arg_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "val_", "=_", "arg", "Helper_", "._", "init", "Reference_", "(_", "arg", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "do", "\\u", "args_", "._", "append_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Type", "List_", "._", "append_", "(_", "(_", "arg", "type_", ",_", "total", "Count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "out", "Type", "Index", ".", "append", "(", " ", "total", "Count", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total", "Count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "undo", "Enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "undo", "Item_", "=_", "Ap", "i", "Und", "o", "Item_", "(_", "setter_", ",_", "do", "\\u", "args_", ",_", "undo", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "Und", "o_", "._", "append_", "(_", "undo", "Item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "final", " ", "Safe", "Ap", "i", "Pt", "r", " ", "=>", " ", "'", "true", "'", " ", "ptr", " ", "conversion_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "final", "\\u", "do", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "do", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "arg_", ",_", "api_", "._", "Safe", "Ap", "i", "Ptr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "final", "\\u", "do", "\\u", "args_", "._", "append_", "(_", "arg_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "final", "\\u", "do", "\\u", "args_", "._", "append_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "arg", "Helper_", "._", "is", "Static", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "method_", "(_", "*_", "final", "\\u", "do", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "proxy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "due", " ", "to", " ", "the", " ", "discr", "epa", "ncie", "s", " ", "bet", "ween", " ", "the", " ", "API", " ", "and", " ", "Maya", " ", "node", " ", "hier", "archi", "es", ",", " ", "our", " ", "\\u\\u", "api", "mf", "n", "\\u\\u", " ", "mig", "ht", " ", "not", " ", "be", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "subclass", " ", "of", " ", "the", " ", "api", " ", "class", " ", "bei", "ng", " ", "wrapp", "ed", ",", " ", "how", "ever", ",", " ", "the", " ", "api", " ", "object", " ", "can", " ", "still", " ", "be", " ", "used", " ", "with", " ", "this", " ", "mf", "n", " ", "explicit", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mf", "n_", "=_", "self_", "._", "\\u\\u", "api", "mf", "n", "\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "mf", "n_", ",_", "api", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "mf", "n_", "=_", "api", "Class_", "(_", "self_", "._", "\\u\\u", "api", "object\\u", "\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "method_", "(_", "mf", "n_", ",_", "*_", "final", "\\u", "do", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "method_", "(_", "self_", ",_", "*_", "final", "\\u", "do", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "arg", "Helper_", "._", "cast", "Result_", "(_", "self_", ",_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "out", "Args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "result_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "[_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "out", "Type_", ",_", "index_", "in_", "out", "Type", "List_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "out", "Arg", "Val_", "=_", "do", "\\u", "args_", "[_", "index_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "arg", "Helper_", "._", "cast", "Reference", "Result_", "(_", "out", "Type_", ",_", "out", "Arg", "Val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "res_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "result_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "tuple_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapp", "ed", "Ap", "i", "Func_", "._", "\\u\\u", "name\\u\\u_", "=_", "pym", "el", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "add", "Ap", "i", "Docs", "_", "(_", "wrapp", "ed", "Ap", "i", "Func_", ",_", "api", "Class_", ",_", "method", "Name_", ",_", "overload", "Index_", ",_", "undo", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", " ", "Enum", "Value", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "defaults_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "default_", "in_", "arg", "Helper_", "._", "get", "Defaults_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "default_", ",_", "util_", "._", "Enum", "Value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "._", "append_", "(_", "str_", "(_", "default_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "._", "append_", "(_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "defaults_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#\\u", "logg", "er", ".", "debug", "(\"", "default", "s", ":", " ", "%", "s", "\"", " ", "%", " ", "default", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wrapp", "ed", "Ap", "i", "Func_", "=_", "util_", "._", "interface", "\\u", "wrapper_", "(_", "wrapp", "ed", "Ap", "i", "Func_", ",_", "[_", "'", "self", "'_", "]_", "+_", "in", "Args_", ",_", "defaults_", "=_", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wrapp", "ed", "Ap", "i", "Func_", "._", "\\u", "arg", "Helper_", "=_", "arg", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "arg", "Helper_", "._", "is", "Static", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapp", "ed", "Ap", "i", "Func_", "=_", "classmethod_", "(_", "wrapp", "ed", "Ap", "i", "Func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "wrapp", "ed", "Ap", "i", "Func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Ap", "i", "Docs", "Callback_", "(_", "api", "Class_", ",_", "method", "Name_", ",_", "overload", "Index_", "=_", "None_", ",_", "undo", "able_", "=_", "True_", ",_", "orig", "Docs", "tring_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "Class", "Name_", "=_", "api", "Class_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arg", "Helper_", "=_", "Ap", "i", "Arg", "Util_", "(_", "api", "Class", "Name_", ",_", "method", "Name_", ",_", "overload", "Index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "Args_", "=_", "arg", "Helper_", "._", "in", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Args_", "=_", "arg", "Helper_", "._", "out", "Args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "List_", "=_", "arg", "Helper_", "._", "arg", "List_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "Info_", "=_", "arg", "Helper_", "._", "arg", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "format", "Docs", "tring_", "(_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "convert", "\\", "10", ";", " ", " ", " ", " ", "\"[", "'", "one", "',", " ", "'", "two", "',", " ", "'", "three", "',", " ", "['", "1", "',", " ", "'", "2", "',", " ", "'", "3", "']]", "\"", "\\", "10", ";", " ", " ", " ", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\"[", "`", "one", "`", ",", " ", "`", "two", "`", ",", " ", "`", "three", "`", ",", " ", "[", "`", "1", "`", ",", " ", "`", "2", "`", ",", " ", "`", "3", "`]", "]\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "type_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pym", "el", "Type_", "=_", "Ap", "i", "Type", "Register_", "._", "types_", "._", "get_", "(_", "type_", ",_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pym", "el", "Type_", "=_", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "pym", "el", "Type_", ",_", "apic", "ache_", "._", "Ap", "i", "Enum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pym", "el", "Type_", "=_", "pym", "el", "Type_", "._", "pym", "el", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc_", "=_", "repr_", "(_", "pym", "el", "Type_", ")_", "._", "replace_", "(_", "\"'\"_", ",_", "\"`", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "in_", "Ap", "i", "Type", "Register_", "._", "array", "Item", "Types_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "+=_", "'", " ", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Docs", "tring", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "docstring_", "=_", "arg", "Helper_", "._", "get", "Meth", "od", "Docs", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "api", " ", "is", " ", "no", " ", "long", "er", " ", "in", " ", "specific", " ", "unit", "s", ",", " ", "it", " ", "respec", "t", " ", "UI", " ", "unit", "s", " ", "like", " ", "ME", "L_", "\\u\\u\\uNL\\u\\u\\u_", "docstring_", "=_", "docstring_", "._", "replace_", "(_", "'", "cent", "ime", "ter", "'_", ",_", "'", "linear", " ", "unit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstring_", "=_", "docstring_", "._", "replace_", "(_", "'", "radian", "'_", ",_", "'", "angular", " ", "unit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "'", " ", " ", " ", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "in", "Args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docstring_", "+=_", "'\\\\", "n", "\\\\", "n", ":", "Parameter", "s", ":\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "in", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "=_", "arg", "Info_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "info_", "[_", "'", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type", "Str_", "=_", "format", "Docs", "tring_", "(_", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docstring_", "+=_", "S_", "+_", "'%", "s", " ", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "name_", ",_", "type", "Str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstring_", "+=_", "S_", "*_", "2_", "+_", "'%", "s", "\\\\", "n", "'_", "%_", "(_", "info_", "[_", "'", "doc", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "type_", ",_", "apic", "ache_", "._", "Ap", "i", "Enum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "Class", "Name_", ",_", "enum", "Name_", "=_", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enum", "Values_", "=_", "api", "Class", "Info_", "[_", "api", "Class", "Name_", "]_", "[_", "'", "pym", "el", "Enum", "s", "'_", "]_", "[_", "enum", "Name_", "]_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstring_", "+=_", "'\\\\", "n", "'_", "+_", "S_", "*_", "2_", "+_", "'", "values", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "',", " ", "'_", "._", "join_", "(_", "[_", "'%", "r", "'_", "%_", "x_", "for_", "x_", "in_", "enum", "Values_", "if_", "x_", "not_", "in_", "[_", "'", "invalid", "'_", ",_", "'", "last", "'_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Result", "s", " ", "doc", " ", "strings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "Type_", "=_", "arg", "Helper_", "._", "get", "Return", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "return", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rtype_", "=_", "format", "Docs", "tring_", "(_", "return", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "argname", "_", "in_", "out", "Args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rtype_", "=_", "arg", "Info_", "[_", "argname", "_", "]_", "[_", "'", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rtype_", "=_", "format", "Docs", "tring_", "(_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "._", "append_", "(_", "rtype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "results_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstring_", "+=_", "'\\\\", "n", "\\\\", "n", ":", "rty", "pe", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docstring_", "+=_", "'\\\\", "n", "\\\\", "n", ":", "rty", "pe", ":", " ", "(%", "s", ")\\\\", "n", "'_", "%_", "',", " ", "'_", "._", "join_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "docstring_", "+=_", "'\\\\", "n", "Derive", "d", " ", "from", " ", "api", " ", "method", " ", "`", "%", "s", ".", "%", "s", ".", "%", "s", "`", "\\\\", "n", "'_", "%_", "(_", "api", "Class_", "._", "\\u\\u", "module\\u\\u_", ",_", "api", "Class", "Name_", ",_", "method", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "undo", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docstring_", "+=_", "'\\\\", "n", "**", "Und", "o", " ", "is", " ", "not", " ", "currentl", "y", " ", "support", "ed", " ", "for", " ", "this", " ", "method", "**", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "orig", "Docs", "tring_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "docstring_", "=_", "orig", "Docs", "tring_", "+_", "'\\\\", "n", "'_", "+_", "docstring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "docstring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Meta", "Maya", "UI", "Wrapper_", "(_", "\\u", "Meta", "Maya", "Command", "Wrapper_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "classname_", ",_", "bases_", ",_", "classd", "ict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "class", " ", "explicit", "ly", " ", "give", "s", " ", "it", "'", "s", " ", "mel", " ", "ui", " ", "command", " ", "name", ",", " ", "use", " ", "tha", "t", " ", "-", " ", "other", "wis", "e", ",", " ", "assume", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "name", " ", "of", " ", "the", " ", "Py", "Node", ",", " ", "unca", "pit", "alize", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui", "Type_", "=_", "classd", "ict_", "._", "setdefault_", "(_", "'\\u", "\\u", "mel", "ui", "\\u\\u'_", ",_", "util_", "._", "unca", "pit", "alize", "_", "(_", "classname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "implement", " ", "a", " ", "option", " ", "at", " ", "the", " ", "cmdli", "st", " ", "level", " ", "tha", "t", " ", "trigger", "s", " ", "list", "For", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "create", " ", "label", "Array", " ", "for", " ", "*", "Grp", " ", "ui", " ", "element", "s", ",", " ", "whi", "ch", " ", "pass", "es", " ", "to", " ", "the", " ", "correct", " ", "arg", " ", "(", " ", "label", "Array", "3", ",", " ", "label", "Array", "4", ",", " ", "etc", " ", ")", " ", "based", " ", "on", " ", "length", " ", "of", " ", "pass", "ed", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "Meta", "Maya", "UI", "Wrapper_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "classname_", ",_", "bases_", ",_", "classd", "ict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
bizreach/common-ml/commonml/sklearn/rnn_estimator.py
[ { "content": "# coding: utf-8\n\nfrom logging import getLogger\nimport time\n\nfrom chainer import Link, Chain, ChainList, optimizer, cuda, Function, gradient_check, Variable, optimizers, serializers, utils\nimport chainer\nimport six\nfrom sklearn.base import BaseEstimator\n\nimport chainer.functions as F\nimport chainer.links as L\nfrom commonml.sklearn import ChainerEstimator\nimport numpy as np\nimport math\n\nlogger = getLogger('commonml.sklearn.rnn_estimator')\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RnnEstimator(ChainerEstimator):\n\n\n", "metadata": "root.RnnEstimator", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self, bprop_len=35, **params):\n super(RnnEstimator, self).__init__(**params)\n self.bprop_len = bprop_len", "metadata": "root.RnnEstimator.__init__", "header": "['class', 'RnnEstimator', '(', 'ChainerEstimator', ')', ':', '___EOS___']", "index": 21 }, { "content": " def fit(self, X, y, report_interval=1000):\n if X is None or y is None:\n raise ValueError('X and/or y is None.')\n\n xp = np if self.gpu < 0 else cuda.cupy\n\n data_size = len(X)\n jump = data_size // self.batch_size\n cur_log_perp = xp.zeros(())\n start_at = time.time()\n cur_at = start_at\n accum_loss = 0\n batch_idxs = list(range(self.batch_size))\n self.model.predictor.reset_state()\n self.model.zerograds()\n for i in six.moves.range(jump * self.n_epoch):\n x = Variable(xp.asarray([X[(jump * j + i) % data_size] for j in batch_idxs]))\n t = Variable(xp.asarray([y[(jump * j + i) % data_size] for j in batch_idxs]))\n\n loss_i = self.model(x, t)\n accum_loss += loss_i\n cur_log_perp += loss_i.data\n\n if (i + 1) % self.bprop_len == 0:\n #logger.info('Updating parameters')\n accum_loss.backward()\n accum_loss.unchain_backward()\n accum_loss = 0\n self.optimizer.update()\n self.model.predictor.reset_state()\n self.model.zerograds()\n\n if (i + 1) % report_interval == 0:\n now = time.time()\n throuput = float(report_interval) / (now - cur_at)\n perp = math.exp(float(cur_log_perp) / report_interval)\n logger.info('iter {}/{} training perplexity: {:.2f} ({:.2f} iters/sec)'.format(i + 1, jump * self.n_epoch, perp, throuput))\n cur_at = now\n cur_log_perp.fill(0)", "metadata": "root.RnnEstimator.fit", "header": "['class', 'RnnEstimator', '(', 'ChainerEstimator', ')', ':', '___EOS___']", "index": 25 }, { "content": " def predict(self, X):\n xp = np if self.gpu < 0 else cuda.cupy\n\n data_size = len(X)\n\n results = None\n for i in six.moves.range(0, data_size, self.batch_size):\n end = i + self.batch_size\n x1 = X[i: end if end < data_size else data_size]\n x2 = Variable(xp.asarray(x1))\n pred = F.softmax(self.model.predictor(x2, train=False))\n if results is None:\n results = cuda.to_cpu(pred.data)\n else:\n results = xp.concatenate((results, cuda.to_cpu(pred.data)), axis=0)\n\n return results", "metadata": "root.RnnEstimator.predict", "header": "['class', 'RnnEstimator', '(', 'ChainerEstimator', ')', ':', '___EOS___']", "index": 65 } ]
[ { "span": "from chainer import Link, Chain, ChainList, optimizer, cuda, Function, gradient_check, Variable, optimizers, serializers, utils", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 127 }, { "span": "import chainer", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 14 }, { "span": "from sklearn.base import BaseEstimator", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 38 }, { "span": "import chainer.links as L", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 25 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "logging_", "import_", "get", "Logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "chainer_", "import_", "Link_", ",_", "Chain_", ",_", "Chain", "List_", ",_", "optimizer_", ",_", "cuda_", ",_", "Function_", ",_", "gradi", "ent", "\\u", "check_", ",_", "Variable_", ",_", "optimizers_", ",_", "serializers_", ",_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chainer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sklearn_", "._", "base_", "import_", "Base", "Estimator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "chainer_", "._", "functions_", "as_", "F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "chainer_", "._", "links_", "as_", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "common", "ml_", "._", "sklearn_", "import_", "Chain", "er", "Estimator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "get", "Logger_", "(_", "'", "common", "ml", ".", "skl", "earn", ".", "rn", "n", "\\u", "esti", "mat", "or", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Rn", "n", "Estimator_", "(_", "Chain", "er", "Estimator_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Rn", "n", "Estimator_", "(_", "Chain", "er", "Estimator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "bpr", "op", "\\u", "len_", "=_", "35_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Rn", "n", "Estimator_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bpr", "op", "\\u", "len_", "=_", "bpr", "op", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rn", "n", "Estimator_", "(_", "Chain", "er", "Estimator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fit_", "(_", "self_", ",_", "X_", ",_", "y_", ",_", "report", "\\u", "interval_", "=_", "1000_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "X_", "is_", "None_", "or_", "y_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "X", " ", "and", "/", "or", " ", "y", " ", "is", " ", "Non", "e", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xp_", "=_", "np_", "if_", "self_", "._", "gpu_", "<_", "0_", "else_", "cuda_", "._", "cupy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "size_", "=_", "len_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jump_", "=_", "data\\u", "size_", "//_", "self_", "._", "batch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "log", "\\u", "perp", "_", "=_", "xp_", "._", "zeros_", "(_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "at_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "at_", "=_", "start", "\\u", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accum", "\\u", "loss_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "batch", "\\u", "idxs_", "=_", "list_", "(_", "range_", "(_", "self_", "._", "batch", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "predictor_", "._", "reset", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "zero", "grads_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "six_", "._", "moves_", "._", "range_", "(_", "jump_", "*_", "self_", "._", "n", "\\u", "epoch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "Variable_", "(_", "xp_", "._", "asarray_", "(_", "[_", "X_", "[_", "(_", "jump_", "*_", "j_", "+_", "i_", ")_", "%_", "data\\u", "size_", "]_", "for_", "j_", "in_", "batch", "\\u", "idxs_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "Variable_", "(_", "xp_", "._", "asarray_", "(_", "[_", "y_", "[_", "(_", "jump_", "*_", "j_", "+_", "i_", ")_", "%_", "data\\u", "size_", "]_", "for_", "j_", "in_", "batch", "\\u", "idxs_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "loss", "\\u", "i_", "=_", "self_", "._", "model_", "(_", "x_", ",_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accum", "\\u", "loss_", "+=_", "loss", "\\u", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "log", "\\u", "perp", "_", "+=_", "loss", "\\u", "i_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "i_", "+_", "1_", ")_", "%_", "self_", "._", "bpr", "op", "\\u", "len_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "er", ".", "info", "('", "Up", "dati", "ng", " ", "parameter", "s", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "accum", "\\u", "loss_", "._", "backward_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accum", "\\u", "loss_", "._", "unc", "hain", "\\u", "backward_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accum", "\\u", "loss_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "optimizer_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "predictor_", "._", "reset", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "._", "zero", "grads_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "+_", "1_", ")_", "%_", "report", "\\u", "interval_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thro", "up", "ut_", "=_", "float_", "(_", "report", "\\u", "interval_", ")_", "/_", "(_", "now_", "-_", "cur", "\\u", "at_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "perp", "_", "=_", "math_", "._", "exp_", "(_", "float_", "(_", "cur", "\\u", "log", "\\u", "perp", "_", ")_", "/_", "report", "\\u", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "iter", " ", "{}/{}", " ", "train", "ing", " ", "perp", "lexi", "ty", ":", " ", "{:", ".2", "f", "}", " ", "({", ":.", "2f", "}", " ", "iters", "/", "sec", ")'_", "._", "format_", "(_", "i_", "+_", "1_", ",_", "jump_", "*_", "self_", "._", "n", "\\u", "epoch_", ",_", "perp", "_", ",_", "thro", "up", "ut_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "at_", "=_", "now_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "log", "\\u", "perp", "_", "._", "fill_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rn", "n", "Estimator_", "(_", "Chain", "er", "Estimator_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "predict_", "(_", "self_", ",_", "X_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xp_", "=_", "np_", "if_", "self_", "._", "gpu_", "<_", "0_", "else_", "cuda_", "._", "cupy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "size_", "=_", "len_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "results_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "six_", "._", "moves_", "._", "range_", "(_", "0_", ",_", "data\\u", "size_", ",_", "self_", "._", "batch", "\\u", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "i_", "+_", "self_", "._", "batch", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x1_", "=_", "X_", "[_", "i_", ":_", "end_", "if_", "end_", "<_", "data\\u", "size_", "else_", "data\\u", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x2_", "=_", "Variable_", "(_", "xp_", "._", "asarray_", "(_", "x1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pred_", "=_", "F_", "._", "softmax_", "(_", "self_", "._", "model_", "._", "predictor_", "(_", "x2_", ",_", "train_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "results_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "cuda_", "._", "to", "\\u", "cpu_", "(_", "pred_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "xp_", "._", "concatenate_", "(_", "(_", "results_", ",_", "cuda_", "._", "to", "\\u", "cpu_", "(_", "pred_", "._", "data_", ")_", ")_", ",_", "axis_", "=_", "0_", ")_", "\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
edgewall/trac/trac/web/main.py
[ { "content": "def dispatch_request(environ, start_response):\n \"\"\"Main entry point for the Trac web interface.\n\n :param environ: the WSGI environment dict\n :param start_response: the WSGI callback for starting the response\n \"\"\"\n\n global _warn_setuptools\n if _warn_setuptools is False:\n _warn_setuptools = True\n warn_setuptools_issue(out=environ.get('wsgi.errors'))\n\n if sys.flags.optimize != 0:\n raise EnvironmentError(\"Python with optimizations is not supported.\")\n\n # SCRIPT_URL is an Apache var containing the URL before URL rewriting\n # has been applied, so we can use it to reconstruct logical SCRIPT_NAME\n script_url = environ.get('SCRIPT_URL')\n if script_url is not None:\n path_info = environ.get('PATH_INFO')\n if not path_info:\n environ['SCRIPT_NAME'] = script_url\n else:\n # mod_wsgi squashes slashes in PATH_INFO (!)\n script_url = _slashes_re.sub('/', script_url)\n path_info = _slashes_re.sub('/', path_info)\n if script_url.endswith(path_info):\n environ['SCRIPT_NAME'] = script_url[:-len(path_info)]\n\n # If the expected configuration keys aren't found in the WSGI environment,\n # try looking them up in the process environment variables\n environ.setdefault('trac.env_path', os.getenv('TRAC_ENV'))\n environ.setdefault('trac.env_parent_dir',\n os.getenv('TRAC_ENV_PARENT_DIR'))\n environ.setdefault('trac.env_index_template',\n os.getenv('TRAC_ENV_INDEX_TEMPLATE'))\n environ.setdefault('trac.template_vars',\n os.getenv('TRAC_TEMPLATE_VARS'))\n environ.setdefault('trac.locale', '')\n environ.setdefault('trac.base_url',\n os.getenv('TRAC_BASE_URL'))\n\n\n locale.setlocale(locale.LC_ALL, environ['trac.locale'])\n\n # Determine the environment\n env_path = environ.get('trac.env_path')\n if not env_path:\n env_parent_dir = environ.get('trac.env_parent_dir')\n env_paths = environ.get('trac.env_paths')\n if env_parent_dir or env_paths:\n # The first component of the path is the base name of the\n # environment\n path_info = environ.get('PATH_INFO', '').lstrip('/').split('/')\n env_name = path_info.pop(0)\n\n if not env_name:\n # No specific environment requested, so render an environment\n # index page\n send_project_index(environ, start_response, env_parent_dir,\n env_paths)\n return []\n\n errmsg = None\n\n # To make the matching patterns of request handlers work, we append\n # the environment name to the `SCRIPT_NAME` variable, and keep only\n # the remaining path in the `PATH_INFO` variable.\n script_name = environ.get('SCRIPT_NAME', '')\n try:\n script_name = unicode(script_name, 'utf-8')\n # (as Href expects unicode parameters)\n environ['SCRIPT_NAME'] = Href(script_name)(env_name)\n environ['PATH_INFO'] = '/' + '/'.join(path_info)\n\n if env_parent_dir:\n env_path = os.path.join(env_parent_dir, env_name)\n else:\n env_path = get_environments(environ).get(env_name)\n\n if not env_path or not os.path.isdir(env_path):\n errmsg = 'Environment not found'\n except UnicodeDecodeError:\n errmsg = 'Invalid URL encoding (was %r)' % script_name\n\n if errmsg:\n start_response('404 Not Found',\n [('Content-Type', 'text/plain'),\n ('Content-Length', str(len(errmsg)))])\n return [errmsg]\n\n if not env_path:\n raise EnvironmentError('The environment options \"TRAC_ENV\" or '\n '\"TRAC_ENV_PARENT_DIR\" or the mod_python '\n 'options \"TracEnv\" or \"TracEnvParentDir\" are '\n 'missing. Trac requires one of these options '\n 'to locate the Trac environment(s).')\n run_once = environ['wsgi.run_once']\n\n env = env_error = None\n try:\n env = open_environment(env_path, use_cache=not run_once)\n if env.base_url_for_redirect:\n environ['trac.base_url'] = env.base_url\n\n # Web front-end type and version information\n if not hasattr(env, 'webfrontend'):\n mod_wsgi_version = environ.get('mod_wsgi.version')\n if mod_wsgi_version:\n mod_wsgi_version = (\n \"%s (WSGIProcessGroup %s WSGIApplicationGroup %s)\" %\n ('.'.join([str(x) for x in mod_wsgi_version]),\n environ.get('mod_wsgi.process_group'),\n environ.get('mod_wsgi.application_group') or\n '%{GLOBAL}'))\n environ.update({\n 'trac.web.frontend': 'mod_wsgi',\n 'trac.web.version': mod_wsgi_version})\n env.webfrontend = environ.get('trac.web.frontend')\n if env.webfrontend:\n env.webfrontend_version = environ['trac.web.version']\n except Exception as e:\n env_error = e\n\n req = RequestWithSession(environ, start_response)\n translation.make_activable(lambda: req.locale, env.path if env else None)\n try:\n return _dispatch_request(req, env, env_error)\n finally:\n translation.deactivate()\n if env and not run_once:\n env.shutdown(threading._get_ident())\n # Now it's a good time to do some clean-ups\n #\n # Note: enable the '##' lines as soon as there's a suspicion\n # of memory leak due to uncollectable objects (typically\n # objects with a __del__ method caught in a cycle)\n #\n ##gc.set_debug(gc.DEBUG_UNCOLLECTABLE)\n unreachable = gc.collect()\n ##env.log.debug(\"%d unreachable objects found.\", unreachable)\n ##uncollectable = len(gc.garbage)\n ##if uncollectable:\n ## del gc.garbage[:]\n ## env.log.warn(\"%d uncollectable objects found.\", uncollectable)", "metadata": "root.dispatch_request", "header": "['module', '___EOS___']", "index": 453 } ]
[ { "span": "unreachable ", "start_line": 592, "start_column": 12, "end_line": 592, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dispatch", "\\u", "request_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Main", " ", "entry", " ", "point", " ", "for", " ", "the", " ", "Trac", " ", "web", " ", "interface", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "environ", ":", " ", "the", " ", "WS", "GI", " ", "environ", "ment", " ", "dict", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "start", "\\u", "response", ":", " ", "the", " ", "WS", "GI", " ", "callback", " ", "for", " ", "startin", "g", " ", "the", " ", "response", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "\\u", "warn", "\\u", "setuptools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "warn", "\\u", "setuptools_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "warn", "\\u", "setuptools_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn", "\\u", "setup", "tool", "s", "\\u", "issue_", "(_", "out_", "=_", "environ_", "._", "get_", "(_", "'", "wsgi", ".", "error", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "flags_", "._", "optimize_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Environ", "ment", "Error_", "(_", "\"", "Pyth", "on", " ", "with", " ", "optimization", "s", " ", "is", " ", "not", " ", "support", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SCRIPT", "\\u", "URL", " ", "is", " ", "an", " ", "Ap", "ache", " ", "var", " ", "contain", "ing", " ", "the", " ", "URL", " ", "bef", "ore", " ", "URL", " ", "rew", "riti", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", " ", "bee", "n", " ", "applied", ",", " ", "so", " ", "we", " ", "can", " ", "use", " ", "it", " ", "to", " ", "reconstruct", " ", "logical", " ", "SCRIPT", "\\u", "NAME_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "script", "\\u", "url_", "=_", "environ_", "._", "get_", "(_", "'", "SCRIPT", "\\u", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "script", "\\u", "url_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "info_", "=_", "environ_", "._", "get_", "(_", "'", "PATH", "\\u", "INFO", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "path", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "environ_", "[_", "'", "SCRIPT", "\\u", "NAME", "'_", "]_", "=_", "script", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mod", "\\u", "wsgi", " ", "squash", "es", " ", "slash", "es", " ", "in", " ", "PATH", "\\u", "INFO", " ", "(!", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "\\u", "url_", "=_", "\\u", "slash", "es", "\\u", "re_", "._", "sub_", "(_", "'/'_", ",_", "script", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "info_", "=_", "\\u", "slash", "es", "\\u", "re_", "._", "sub_", "(_", "'/'_", ",_", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "script", "\\u", "url_", "._", "endswith_", "(_", "path", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "environ_", "[_", "'", "SCRIPT", "\\u", "NAME", "'_", "]_", "=_", "script", "\\u", "url_", "[_", ":_", "-_", "len_", "(_", "path", "\\u", "info_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "configura", "tion", " ", "keys", " ", "are", "n", "'", "t", " ", "found", " ", "in", " ", "the", " ", "WS", "GI", " ", "environ", "ment", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "look", "ing", " ", "them", " ", "up", " ", "in", " ", "the", " ", "process", " ", "environ", "ment", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "environ_", "._", "setdefault_", "(_", "'", "trac", ".", "env", "\\u", "path", "'_", ",_", "os_", "._", "getenv_", "(_", "'", "TRA", "C", "\\u", "ENV", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "setdefault_", "(_", "'", "trac", ".", "env", "\\u", "parent", "\\u", "dir", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "'", "TRA", "C", "\\u", "ENV", "\\u", "PARENT", "\\u", "DIR", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "setdefault_", "(_", "'", "trac", ".", "env", "\\u", "index", "\\u", "template", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "'", "TRA", "C", "\\u", "ENV", "\\u", "INDE", "X", "\\u", "TEMPL", "ATE", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "setdefault_", "(_", "'", "trac", ".", "template", "\\u", "vars", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "'", "TRA", "C", "\\u", "TEMPL", "ATE", "\\u", "VARS", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "setdefault_", "(_", "'", "trac", ".", "locale", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "setdefault_", "(_", "'", "trac", ".", "base", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "getenv_", "(_", "'", "TRA", "C", "\\u", "BASE", "\\u", "URL", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "locale_", "._", "setlocal", "e_", "(_", "locale_", "._", "LC", "\\u", "ALL_", ",_", "environ_", "[_", "'", "trac", ".", "locale", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "the", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "path_", "=_", "environ_", "._", "get_", "(_", "'", "trac", ".", "env", "\\u", "path", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "env", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env", "\\u", "parent", "\\u", "dir_", "=_", "environ_", "._", "get_", "(_", "'", "trac", ".", "env", "\\u", "parent", "\\u", "dir", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "paths_", "=_", "environ_", "._", "get_", "(_", "'", "trac", ".", "env", "\\u", "path", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env", "\\u", "parent", "\\u", "dir_", "or_", "env", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "first", " ", "component", " ", "of", " ", "the", " ", "path", " ", "is", " ", "the", " ", "base", " ", "name", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "info_", "=_", "environ_", "._", "get_", "(_", "'", "PATH", "\\u", "INFO", "'_", ",_", "''_", ")_", "._", "lstrip_", "(_", "'/'_", ")_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env", "\\u", "name_", "=_", "path", "\\u", "info_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "env", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "specific", " ", "environ", "ment", " ", "request", "ed", ",", " ", "so", " ", "render", " ", "an", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "index", " ", "page_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "send", "\\u", "project", "\\u", "index_", "(_", "environ_", ",_", "start", "\\u", "response_", ",_", "env", "\\u", "parent", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env", "\\u", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "errmsg_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "To", " ", "make", " ", "the", " ", "matchi", "ng", " ", "pattern", "s", " ", "of", " ", "request", " ", "handler", "s", " ", "work", ",", " ", "we", " ", "append_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "environ", "ment", " ", "name", " ", "to", " ", "the", " ", "`", "SCRIPT", "\\u", "NAME", "`", " ", "variab", "le", ",", " ", "and", " ", "keep", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "rema", "inin", "g", " ", "path", " ", "in", " ", "the", " ", "`", "PATH", "\\u", "INFO", "`", " ", "variab", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "script", "\\u", "name_", "=_", "environ_", "._", "get_", "(_", "'", "SCRIPT", "\\u", "NAME", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "\\u", "name_", "=_", "unicode_", "(_", "script", "\\u", "name_", ",_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "as", " ", "Hr", "ef", " ", "expect", "s", " ", "unicode", " ", "parameter", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "environ_", "[_", "'", "SCRIPT", "\\u", "NAME", "'_", "]_", "=_", "Hr", "ef_", "(_", "script", "\\u", "name_", ")_", "(_", "env", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "=_", "'/'_", "+_", "'/'_", "._", "join_", "(_", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "env", "\\u", "parent", "\\u", "dir_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "env", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "env", "\\u", "parent", "\\u", "dir_", ",_", "env", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "env", "\\u", "path_", "=_", "get", "\\u", "environments_", "(_", "environ_", ")_", "._", "get_", "(_", "env", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "env", "\\u", "path_", "or_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "env", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "errmsg_", "=_", "'", "Environ", "ment", " ", "not", " ", "found", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errmsg_", "=_", "'", "Inva", "lid", " ", "URL", " ", "encoding", " ", "(", "was", " ", "%", "r", ")'_", "%_", "script", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errmsg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "response_", "(_", "'", "404", " ", "Not", " ", "Foun", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "text", "/", "plain", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "str_", "(_", "len_", "(_", "errmsg_", ")_", ")_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "errmsg_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "env", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Environ", "ment", "Error_", "(_", "'", "The", " ", "environ", "ment", " ", "options", " ", "\"", "TRA", "C", "\\u", "ENV", "\"", " ", "or", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'\"", "TRA", "C", "\\u", "ENV", "\\u", "PARENT", "\\u", "DIR", "\"", " ", "or", " ", "the", " ", "mod", "\\u", "python", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "options", " ", "\"", "Trac", "Env", "\"", " ", "or", " ", "\"", "Trac", "Env", "Parent", "Dir", "\"", " ", "are", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "missi", "ng", ".", " ", "Trac", " ", "require", "s", " ", "one", " ", "of", " ", "these", " ", "options", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "locat", "e", " ", "the", " ", "Trac", " ", "environ", "ment", "(", "s", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "once_", "=_", "environ_", "[_", "'", "wsgi", ".", "run", "\\u", "onc", "e", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "env", "\\u", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "open", "\\u", "environment_", "(_", "env", "\\u", "path_", ",_", "use", "\\u", "cache_", "=_", "not_", "run", "\\u", "once_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env_", "._", "base", "\\u", "url", "\\u", "for", "\\u", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "environ_", "[_", "'", "trac", ".", "base", "\\u", "url", "'_", "]_", "=_", "env_", "._", "base", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Web", " ", "front", "-", "end", " ", "type", " ", "and", " ", "version", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "env_", ",_", "'", "web", "front", "end", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod", "\\u", "wsgi", "\\u", "version_", "=_", "environ_", "._", "get_", "(_", "'", "mod", "\\u", "wsgi", ".", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod", "\\u", "wsgi", "\\u", "version_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod", "\\u", "wsgi", "\\u", "version_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", " ", "(", "WS", "GI", "Process", "Group", " ", "%", "s", " ", "WS", "GI", "Applica", "tion", "Group", " ", "%", "s", ")\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.'_", "._", "join_", "(_", "[_", "str_", "(_", "x_", ")_", "for_", "x_", "in_", "mod", "\\u", "wsgi", "\\u", "version_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "environ_", "._", "get_", "(_", "'", "mod", "\\u", "wsgi", ".", "process", "\\u", "group", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "environ_", "._", "get_", "(_", "'", "mod", "\\u", "wsgi", ".", "applica", "tion", "\\u", "group", "'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "{", "GLOB", "AL", "}'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "environ_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trac", ".", "web", ".", "front", "end", "'_", ":_", "'", "mod", "\\u", "wsgi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trac", ".", "web", ".", "version", "'_", ":_", "mod", "\\u", "wsgi", "\\u", "version_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "web", "frontend_", "=_", "environ_", "._", "get_", "(_", "'", "trac", ".", "web", ".", "front", "end", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env_", "._", "web", "frontend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "web", "front", "end", "\\u", "version_", "=_", "environ_", "[_", "'", "trac", ".", "web", ".", "version", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env", "\\u", "error_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "Request", "With", "Session_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "translation_", "._", "make", "\\u", "activ", "able_", "(_", "lambda_", ":_", "req_", "._", "locale_", ",_", "env_", "._", "path_", "if_", "env_", "else_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "dispatch", "\\u", "request_", "(_", "req_", ",_", "env_", ",_", "env", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "translation_", "._", "deactivate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "env_", "and_", "not_", "run", "\\u", "once_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "shutdown_", "(_", "threading_", "._", "\\u", "get", "\\u", "ident_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "it", "'", "s", " ", "a", " ", "good", " ", "time", " ", "to", " ", "do", " ", "some", " ", "clean", "-", "ups_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "enable", " ", "the", " ", "'#", "#'", " ", "lines", " ", "as", " ", "soo", "n", " ", "as", " ", "there", "'", "s", " ", "a", " ", "sus", "picio", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "of", " ", "memory", " ", "leak", " ", "due", " ", "to", " ", "unco", "lle", "ctab", "le", " ", "object", "s", " ", "(", "typical", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "object", "s", " ", "with", " ", "a", " ", "\\u\\u", "del", "\\u\\u", " ", "method", " ", "cau", "ght", " ", "in", " ", "a", " ", "cycle", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "gc", ".", "set\\u", "debug", "(", "gc", ".", "DEBU", "G", "\\u", "UNC", "OL", "LE", "CTA", "BL", "E", ")_", "\\u\\u\\uNL\\u\\u\\u_", "unreachable", "_", "=_", "gc_", "._", "collect_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", "env", ".", "log", ".", "debug", "(\"", "%", "d", " ", "unreachable", " ", "object", "s", " ", "found", ".\",", " ", "unreachable", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", "unco", "lle", "ctab", "le", " ", "=", " ", "len", "(", "gc", ".", "gar", "bage", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", "if", " ", "unco", "lle", "ctab", "le", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "del", " ", "gc", ".", "gar", "bage", "[:", "]_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "env", ".", "log", ".", "warn", "(\"", "%", "d", " ", "unco", "lle", "ctab", "le", " ", "object", "s", " ", "found", ".\",", " ", "unco", "lle", "ctab", "le", ")_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2,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preprocessing/pipeline_template.py
[ { "content": "def do_preprocessing(contrast):\n\n # Loop across subjects\n for i in range(0,len(SUBJECTS_LIST)):\n subject = SUBJECTS_LIST[i][0]\n\n # Should check all inputs before starting the processing of the data\n\n # Create and go to output folder\n print '\\nCreate -if not existing- and go to output folder '+ PATH_OUTPUT + '/subjects/'+subject+'/'+contrast\n if not os.path.isdir(PATH_OUTPUT + '/subjects/'+subject):\n os.makedirs(PATH_OUTPUT + '/subjects/'+subject)\n if not os.path.isdir(PATH_OUTPUT + '/subjects/'+subject+'/'+contrast):\n os.makedirs(PATH_OUTPUT + '/subjects/'+subject+'/'+contrast)\n os.chdir(PATH_OUTPUT + '/subjects/'+subject+'/'+contrast)\n\n # convert to nii\n print '\\nChecking if dicoms have already been imported...'\n list_file = os.listdir(PATH_OUTPUT + '/subjects/'+subject+'/'+contrast)\n if 'data.nii.gz' not in list_file:\n print '\\nImporting dicoms and converting to nii...'\n if contrast == 'T1':\n sct.run('dcm2nii -o . -r N ' + SUBJECTS_LIST[i][1] + '/*.dcm')\n if contrast == 'T2':\n sct.run('dcm2nii -o . -r N ' + SUBJECTS_LIST[i][2] + '/*.dcm')\n\n # change file name\n print '\\nChanging file name to data.nii.gz...'\n sct.run('mv *.nii.gz data.nii.gz')\n\n # Convert to RPI\n # Input:\n # - data.nii.gz\n # - data_RPI.nii.gz\n print '\\nConverting to RPI...'\n sct.run('sct_image -i data.nii.gz -setorient RPI')\n\n # Get info from txt file\n print '\\nRecover infos from text file' + PATH_INFO + '/' + contrast + '/' + subject+ '/' + 'crop.txt'\n file_name = 'crop.txt'\n os.chdir(PATH_INFO + '/' + contrast + '/' + subject)\n\n file_results = open(PATH_INFO + '/' + contrast + '/' +subject+ '/' +file_name, 'r')\n ymin_anatomic = None\n ymax_anatomic = None\n for line in file_results:\n line_list = line.split(',')\n zmin_anatomic = line.split(',')[0]\n zmax_anatomic = line.split(',')[1]\n zmin_seg = line.split(',')[2]\n zmax_seg = line.split(',')[3]\n if len(line_list) == 6:\n ymin_anatomic = line.split(',')[4]\n ymax_anatomic = line.split(',')[5]\n file_results.close()\n\n os.chdir(PATH_OUTPUT + '/subjects/'+subject+ '/' + contrast)\n\n # Crop image\n print '\\nCropping image at L2-L3 and a little above brainstem...'\n if ymin_anatomic == None and ymax_anatomic == None:\n sct.run('sct_crop_image -i data_RPI.nii.gz -o data_RPI_crop.nii.gz -dim 2 -start ' + zmin_anatomic + ' -end ' + zmax_anatomic )\n else: sct.run('sct_crop_image -i data_RPI.nii.gz -o data_RPI_crop.nii.gz -dim 1,2 -start ' + ymin_anatomic +','+zmin_anatomic+ ' -end ' + ymax_anatomic+','+zmax_anatomic )\n\n # propseg\n # input:\n # - data_RPI_crop.nii.gz\n # - labels_propseg.nii.gz\n # output:\n # - data_RPI_crop_seg.nii.gz\n print '\\nExtracting segmentation...'\n list_dir = os.listdir(PATH_INFO + '/' + contrast + '/'+subject)\n centerline_proseg = False\n for k in range(len(list_dir)):\n if list_dir[k] == 'centerline_propseg_RPI.nii.gz':\n centerline_proseg = True\n if centerline_proseg == True:\n if contrast == 'T1':\n sct.run('sct_propseg -i data_RPI_crop.nii.gz -t t1 -init-centerline ' + PATH_INFO + '/' + contrast + '/' + subject + '/centerline_propseg_RPI.nii.gz')\n if contrast == 'T2':\n sct.run('sct_propseg -i data_RPI_crop.nii.gz -t t2 -init-centerline ' + PATH_INFO + '/' + contrast + '/' + subject + '/centerline_propseg_RPI.nii.gz')\n else:\n if contrast == 'T1':\n sct.run('sct_propseg -i data_RPI_crop.nii.gz -t t1')\n if contrast == 'T2':\n sct.run('sct_propseg -i data_RPI_crop.nii.gz -t t2')\n\n # Erase 3 top and 3 bottom slices of the segmentation to avoid edge effects (Done because propseg tends to diverge on edges)\n print '\\nErasing 3 top and 3 bottom slices of the segmentation to avoid edge effects of propseg...'\n path_seg, file_seg, ext_seg = sct.extract_fname('data_RPI_crop_seg.nii.gz')\n image_seg = nibabel.load('data_RPI_crop_seg.nii.gz')\n from msct_image import Image\n nx, ny, nz, nt, px, py, pz, pt = Image('data_RPI_crop_seg.nii.gz').dim\n data_seg = image_seg.get_data()\n hdr_seg = image_seg.get_header()\n # List slices that contain non zero values\n z_centerline = [iz for iz in range(0, nz, 1) if data_seg[:,:,iz].any() ]\n for k in range(0,3):\n data_seg[:,:,z_centerline[-1]-k] = 0\n if z_centerline[0]+k < nz:\n data_seg[:,:,z_centerline[0]+k] = 0\n img_seg = nibabel.Nifti1Image(data_seg, None, hdr_seg)\n nibabel.save(img_seg, file_seg + '_mod' + ext_seg)\n\n # crop segmentation (but keep same dimension)\n # input:\n # - data_crop_denoised_seg_mod.nii.gz\n # - crop.txt\n # output:\n # - data_crop_denoised_seg_mod_crop.nii.gz\n print '\\nCropping segmentation...'\n if zmax_seg == 'max':\n nx, ny, nz, nt, px, py, pz, pt = Image('data_RPI_crop_seg.nii.gz').dim\n sct.run('sct_crop_image -i data_RPI_crop_seg_mod.nii.gz -o data_RPI_crop_seg_mod_crop.nii.gz -start ' + zmin_seg + ' -end ' + str(nz) + ' -dim 2 -b 0')\n else:\n sct.run('sct_crop_image -i data_RPI_crop_seg_mod.nii.gz -o data_RPI_crop_seg_mod_crop.nii.gz -start ' + zmin_seg + ' -end ' + zmax_seg + ' -dim 2 -b 0')\n\n # Concatenate segmentation and labels_updown if labels_updown is inputed. If not, it concatenates the segmentation and centerline_propseg_RPI.\n print '\\nConcatenating segmentation and label files...'\n labels_updown = False\n list_file_info = os.listdir(PATH_INFO+ '/' + contrast + '/' + subject)\n for k in range(0,len(list_file_info)):\n if list_file_info[k] == 'labels_updown.nii.gz':\n labels_updown = True\n if centerline_proseg == False and labels_updown == False:\n print '\\nERROR: No label file centerline_propseg_RPI.nii.gz or labels_updown.nii.gz in '+PATH_INFO+ '/' + contrast + '/' + subject +'. There must be at least one. Check '+ path_sct+'/dev/template_preprocessing/Readme.md for necessary inputs.'\n sys.exit(2)\n if labels_updown:\n # Creation of centerline from seg and labels for intensity normalization.\n print '\\nExtracting centerline for intensity normalization...'\n sct.run('sct_get_centerline -i data_RPI_crop_seg_mod_crop.nii.gz -method labels -l ' + PATH_INFO + '/' + contrast + '/' + subject + '/labels_updown.nii.gz')\n sct.run('fslmaths data_RPI_crop_seg_mod_crop.nii.gz -add '+ PATH_INFO + '/' + contrast + '/' + subject + '/labels_updown.nii.gz seg_and_labels.nii.gz')\n else:\n sct.run('sct_get_centerline -i data_RPI_crop_seg_mod_crop.nii.gz -method labels -l ' + PATH_INFO + '/' + contrast + '/' + subject + '/centerline_propseg_RPI.nii.gz')\n sct.run('fslmaths data_RPI_crop_seg_mod_crop.nii.gz -add '+ PATH_INFO + '/' + contrast + '/' + subject + '/centerline_propseg_RPI.nii.gz seg_and_labels.nii.gz')\n\n\n\n\n # Normalisation of intensity with centerline before straightening (pb of brainstem with bad centerline)\n print '\\nNormalizing intensity...'\n sct.run('sct_normalize.py -i data_RPI_crop.nii.gz -c generated_centerline.nii.gz')\n\n # straighten image using the concatenation of the segmentation and the labels\n # function: sct_straighten_spinalcord (option: nurbs)\n # input:\n # - data_crop_normalized.nii.gz\n # output:\n # - warp_curve2straight.nii.gz\n # - data_RPI_crop_normalized_straight.nii.gz\n print '\\nStraightening image using centerline...'\n cmd_straighten = ('sct_straighten_spinalcord -i data_RPI_crop_normalized.nii.gz -s ' + PATH_OUTPUT + '/subjects/' + subject + '/' + contrast + '/seg_and_labels.nii.gz -o data_RPI_crop_normalized_straight.nii.gz '+straightening_parameters)\n #sct.printv(cmd_straighten)\n sct.run(cmd_straighten)\n\n # # # normalize intensity\n # print '\\nNormalizing intensity of the straightened image...'\n # sct.run('sct_normalize.py -i data_RPI_crop_straight.nii.gz')\n\n # Crop labels_vertebral file\n print '\\nCropping labels_vertebral file...'\n if ymin_anatomic == None and ymax_anatomic == None:\n sct.run('sct_crop_image -i '+PATH_INFO + '/' + contrast + '/' + subject+ '/labels_vertebral.nii.gz -o labels_vertebral_crop.nii.gz -start ' + zmin_anatomic + ' -end ' + zmax_anatomic + ' -dim 2')\n else: sct.run('sct_crop_image -i '+PATH_INFO + '/' + contrast + '/' + subject+ '/labels_vertebral.nii.gz -o labels_vertebral_crop.nii.gz -start ' + ymin_anatomic+','+zmin_anatomic + ' -end ' + ymax_anatomic+','+ zmax_anatomic + ' -dim 1,2')\n # Dilate labels from labels_vertebral file before straightening\n print '\\nDilating labels from labels_vertebral file...'\n sct.run('fslmaths '+ PATH_OUTPUT + '/subjects/' + subject+ '/' + contrast + '/labels_vertebral_crop.nii.gz -dilF labels_vertebral_dilated.nii.gz')\n\n # apply straightening to labels_vertebral_dilated.nii.gz and to seg_and_labels.nii.gz\n # function: sct_apply_transfo\n # input:\n # - labels_vertebral_dilated.nii.gz\n # - warp_curve2straight.nii.gz\n # output:\n # - labels_vertebral_dilated_reg.nii.gz\n print '\\nApplying straightening to labels_vertebral_dilated.nii.gz...'\n sct.run('sct_apply_transfo -i labels_vertebral_dilated.nii.gz -d data_RPI_crop_normalized_straight.nii.gz -w warp_curve2straight.nii.gz -x nn')\n\n # Select center of mass of labels volume due to past dilatation\n # REMOVE IF NOT REQUIRED\n print '\\nSelecting center of mass of labels volume due to past dilatation...'\n sct.run('sct_label_utils -i labels_vertebral_dilated_reg.nii.gz -o labels_vertebral_dilated_reg_2point.nii.gz -t cubic-to-point')\n\n # Apply straightening to seg_and_labels.nii.gz\n print'\\nApplying transfo to seg_and_labels.nii.gz ...'\n sct.run('sct_apply_transfo -i seg_and_labels.nii.gz -d data_RPI_crop_normalized_straight.nii.gz -w warp_curve2straight.nii.gz -x nn')\n\n ##Calculate the extrem non zero points of the straightened centerline file to crop image one last time\n file = nibabel.load('seg_and_labels_reg.nii.gz')\n data_c = file.get_data()\n\n X,Y,Z = (data_c>0).nonzero()\n\n z_max = max(Z)\n\n z_min = min(Z)\n\n # Crop image one last time\n print'\\nCrop image one last time and create cross to push into template space...'\n sct.run('sct_crop_image -i data_RPI_crop_normalized_straight.nii.gz -o data_RPI_crop_normalized_straight_crop.nii.gz -dim 2 -start '+ str(z_min)+' -end '+ str(z_max))\n\n # Crop labels_vertebral_reg.nii.gz\n print'\\nCrop labels_vertebral_reg.nii.gz and use cross to push into template space...'\n sct.run('sct_crop_image -i labels_vertebral_dilated_reg_2point.nii.gz -o labels_vertebral_dilated_reg_2point_crop.nii.gz -dim 2 -start '+ str(z_min)+' -end '+ str(z_max))", "metadata": "root.do_preprocessing", "header": "['module', '___EOS___']", "index": 223 } ]
[ { "span": "ymin_anatomic == None ", "start_line": 283, "start_column": 11, "end_line": 283, "end_column": 32 }, { "span": "ymax_anatomic == None:", "start_line": 283, "start_column": 37, "end_line": 283, "end_column": 58 }, { "span": "ymin_anatomic == None ", "start_line": 384, "start_column": 11, "end_line": 384, "end_column": 32 }, { "span": "ymax_anatomic == None:", "start_line": 384, "start_column": 37, "end_line": 384, "end_column": 58 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "preprocessing_", "(_", "contrast", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "acro", "ss", " ", "subjects_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "SUBJECT", "S", "\\u", "LIST_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subject_", "=_", "SUBJECT", "S", "\\u", "LIST_", "[_", "i_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sho", "ul", "d", " ", "check", " ", "all", " ", "inputs", " ", "bef", "ore", " ", "startin", "g", " ", "the", " ", "process", "ing", " ", "of", " ", "the", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "and", " ", "go", " ", "to", " ", "output", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Creat", "e", " ", "-", "if", " ", "not", " ", "exist", "ing", "-", " ", "and", " ", "go", " ", "to", " ", "output", " ", "folder", " ", "'_", "+_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "makedirs_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "chdir_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "to", " ", "ni", "i_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Check", "ing", " ", "if", " ", "dicom", "s", " ", "have", " ", "alr", "ead", "y", " ", "bee", "n", " ", "import", "ed", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "file_", "=_", "os_", "._", "listdir_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "data", ".", "ni", "i", ".", "gz", "'_", "not_", "in_", "list", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "Import", "ing", " ", "dicom", "s", " ", "and", " ", "convert", "ing", " ", "to", " ", "ni", "i", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "contrast", "_", "==_", "'", "T1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "dcm", "2n", "ii", " ", "-", "o", " ", ".", " ", "-", "r", " ", "N", " ", "'_", "+_", "SUBJECT", "S", "\\u", "LIST_", "[_", "i_", "]_", "[_", "1_", "]_", "+_", "'/*", ".", "dcm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "contrast", "_", "==_", "'", "T2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "dcm", "2n", "ii", " ", "-", "o", " ", ".", " ", "-", "r", " ", "N", " ", "'_", "+_", "SUBJECT", "S", "\\u", "LIST_", "[_", "i_", "]_", "[_", "2_", "]_", "+_", "'/*", ".", "dcm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "file", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Chang", "ing", " ", "file", " ", "name", " ", "to", " ", "data", ".", "ni", "i", ".", "gz", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "mv", " ", "*.", "ni", "i", ".", "gz", " ", "data", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "to", " ", "RP", "I_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inp", "ut", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "RP", "I", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Converti", "ng", " ", "to", " ", "RP", "I", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "image", " ", "-", "i", " ", "data", ".", "ni", "i", ".", "gz", " ", "-", "seto", "rien", "t", " ", "RP", "I", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "info", " ", "from", " ", "txt", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Recover", " ", "infos", " ", "from", " ", "text", " ", "file", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/'_", "+_", "'", "crop", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "name_", "=_", "'", "crop", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "results_", "=_", "open_", "(_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/'_", "+_", "file", "\\u", "name_", ",_", "'", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymin", "\\u", "anat", "omic", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax", "\\u", "anat", "omic", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "file", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line", "\\u", "list_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zmin", "\\u", "anat", "omic", "_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zmax", "\\u", "anat", "omic", "_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zmin", "\\u", "seg_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zmax", "\\u", "seg_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "line", "\\u", "list_", ")_", "==_", "6_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ymin", "\\u", "anat", "omic", "_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ymax", "\\u", "anat", "omic", "_", "=_", "line_", "._", "split_", "(_", "','_", ")_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "\\u", "results_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cro", "p", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Cro", "ppi", "ng", " ", "image", " ", "at", " ", "L", "2", "-", "L3", " ", "and", " ", "a", " ", "litt", "le", " ", "above", " ", "brain", "stem", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ymin", "\\u", "anat", "omic", "_", "==_", "None_", "and_", "ymax", "\\u", "anat", "omic", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "data\\u", "RP", "I", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "dim", " ", "2", " ", "-", "start", " ", "'_", "+_", "zmin", "\\u", "anat", "omic", "_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "zmax", "\\u", "anat", "omic", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "data\\u", "RP", "I", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "dim", " ", "1", ",", "2", " ", "-", "start", " ", "'_", "+_", "ymin", "\\u", "anat", "omic", "_", "+_", "','_", "+_", "zmin", "\\u", "anat", "omic", "_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "ymax", "\\u", "anat", "omic", "_", "+_", "','_", "+_", "zmax", "\\u", "anat", "omic", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "props", "eg_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "labels", "\\u", "props", "eg", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Extract", "ing", " ", "segmentation", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "dir_", "=_", "os_", "._", "listdir_", "(_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "center", "line", "\\u", "pros", "eg_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "len_", "(_", "list", "\\u", "dir_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "list", "\\u", "dir_", "[_", "k_", "]_", "==_", "'", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "center", "line", "\\u", "pros", "eg_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "center", "line", "\\u", "pros", "eg_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contrast", "_", "==_", "'", "T1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "props", "eg", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "t", " ", "t1", " ", "-", "init", "-", "center", "line", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "contrast", "_", "==_", "'", "T2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "props", "eg", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "t", " ", "t2", " ", "-", "init", "-", "center", "line", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "contrast", "_", "==_", "'", "T1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "props", "eg", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "t", " ", "t1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "contrast", "_", "==_", "'", "T2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "props", "eg", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "t", " ", "t2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Erase", " ", "3", " ", "top", " ", "and", " ", "3", " ", "bottom", " ", "slice", "s", " ", "of", " ", "the", " ", "segmentation", " ", "to", " ", "avoid", " ", "edge", " ", "effect", "s", " ", " ", "(", "Don", "e", " ", "bec", "aus", "e", " ", "props", "eg", " ", "tend", "s", " ", "to", " ", "dive", "rge", " ", "on", " ", "edge", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Er", "asin", "g", " ", "3", " ", "top", " ", "and", " ", "3", " ", "bottom", " ", "slice", "s", " ", "of", " ", "the", " ", "segmentation", " ", "to", " ", "avoid", " ", "edge", " ", "effect", "s", " ", "of", " ", "props", "eg", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "seg_", ",_", "file", "\\u", "seg_", ",_", "ext", "\\u", "seg_", "=_", "sct", "_", "._", "extract", "\\u", "fname_", "(_", "'", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "seg_", "=_", "nib", "abel_", "._", "load_", "(_", "'", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "msc", "t", "\\u", "image_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nx_", ",_", "ny_", ",_", "nz_", ",_", "nt_", ",_", "px_", ",_", "py_", ",_", "pz", "_", ",_", "pt_", "=_", "Image_", "(_", "'", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "._", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "seg_", "=_", "image", "\\u", "seg_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr", "\\u", "seg_", "=_", "image", "\\u", "seg_", "._", "get", "\\u", "header_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "List", " ", "slice", "s", " ", "tha", "t", " ", "contain", " ", "non", " ", "zero", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "z", "\\u", "center", "line_", "=_", "[_", "iz_", "for_", "iz_", "in_", "range_", "(_", "0_", ",_", "nz_", ",_", "1_", ")_", "if_", "data\\u", "seg_", "[_", ":_", ",_", ":_", ",_", "iz_", "]_", "._", "any_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "0_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "seg_", "[_", ":_", ",_", ":_", ",_", "z", "\\u", "center", "line_", "[_", "-_", "1_", "]_", "-_", "k_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "z", "\\u", "center", "line_", "[_", "0_", "]_", "+_", "k_", "<_", "nz_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "seg_", "[_", ":_", ",_", ":_", ",_", "z", "\\u", "center", "line_", "[_", "0_", "]_", "+_", "k_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "img", "\\u", "seg_", "=_", "nib", "abel_", "._", "Ni", "fti", "1", "Image_", "(_", "data\\u", "seg_", ",_", "None_", ",_", "hdr", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nib", "abel_", "._", "save_", "(_", "img", "\\u", "seg_", ",_", "file", "\\u", "seg_", "+_", "'\\u", "mod", "'_", "+_", "ext", "\\u", "seg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "crop", " ", "segmentation", " ", "(", "but", " ", "keep", " ", "same", " ", "dimension", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "crop", "\\u", "deno", "ise", "d\\u", "seg", "\\u", "mod", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "crop", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "crop", "\\u", "deno", "ise", "d\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Cro", "ppi", "ng", " ", "segmentation", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "zmax", "\\u", "seg_", "==_", "'", "max", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nx_", ",_", "ny_", ",_", "nz_", ",_", "nt_", ",_", "px_", ",_", "py_", ",_", "pz", "_", ",_", "pt_", "=_", "Image_", "(_", "'", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", ".", "ni", "i", ".", "gz", "'_", ")_", "._", "dim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "start", " ", "'_", "+_", "zmin", "\\u", "seg_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "str_", "(_", "nz_", ")_", "+_", "'", " ", "-", "dim", " ", "2", " ", "-", "b", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "start", " ", "'_", "+_", "zmin", "\\u", "seg_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "zmax", "\\u", "seg_", "+_", "'", " ", "-", "dim", " ", "2", " ", "-", "b", " ", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Concat", "enat", "e", " ", "segmentation", " ", "and", " ", "labels", "\\u", "upd", "own", " ", "if", " ", "labels", "\\u", "upd", "own", " ", "is", " ", "input", "ed", ".", " ", "If", " ", "not", ",", " ", "it", " ", "concatenate", "s", " ", "the", " ", "segmentation", " ", "and", " ", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Concat", "enat", "ing", " ", "segmentation", " ", "and", " ", "label", " ", "files", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels", "\\u", "upd", "own_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "file", "\\u", "info_", "=_", "os_", "._", "listdir_", "(_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "list", "\\u", "file", "\\u", "info_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "list", "\\u", "file", "\\u", "info_", "[_", "k_", "]_", "==_", "'", "labels", "\\u", "upd", "own", ".", "ni", "i", ".", "gz", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labels", "\\u", "upd", "own_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "center", "line", "\\u", "pros", "eg_", "==_", "False_", "and_", "labels", "\\u", "upd", "own_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "ERROR", ":", " ", "No", " ", "label", " ", "file", " ", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", " ", "or", " ", "labels", "\\u", "upd", "own", ".", "ni", "i", ".", "gz", " ", "in", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'.", " ", "There", " ", "must", " ", "be", " ", "at", " ", "leas", "t", " ", "one", ".", " ", "Check", " ", "'_", "+_", "path", "\\u", "sct", "_", "+_", "'/", "dev", "/", "template", "\\u", "preproc", "essi", "ng", "/", "Read", "me", ".", "md", " ", "for", " ", "necessar", "y", " ", "inputs", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "labels", "\\u", "upd", "own_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "ion", " ", "of", " ", "center", "line", " ", "from", " ", "seg", " ", "and", " ", "labels", " ", "for", " ", "intensity", " ", "normaliza", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'\\\\", "n", "Extract", "ing", " ", "center", "line", " ", "for", " ", "intensity", " ", "normaliza", "tion", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "get", "\\u", "center", "line", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "method", " ", "labels", " ", "-", "l", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "labels", "\\u", "upd", "own", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "fs", "lma", "ths", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "add", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "labels", "\\u", "upd", "own", ".", "ni", "i", ".", "gz", " ", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "get", "\\u", "center", "line", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "method", " ", "labels", " ", "-", "l", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "fs", "lma", "ths", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "seg", "\\u", "mod", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "add", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "center", "line", "\\u", "props", "eg", "\\u", "RP", "I", ".", "ni", "i", ".", "gz", " ", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Normal", "isat", "ion", " ", "of", " ", "intensity", " ", "with", " ", "center", "line", " ", "bef", "ore", " ", "straight", "eni", "ng", " ", "(", "pb", " ", "of", " ", "brain", "stem", " ", "with", " ", "bad", " ", "center", "line", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'\\\\", "n", "Normal", "izi", "ng", " ", "intensity", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "normali", "ze", ".", "py", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "c", " ", "generat", "ed", "\\u", "center", "line", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "straight", "en", " ", "image", " ", "usi", "ng", " ", "the", " ", "concate", "nati", "on", " ", "of", " ", "the", " ", "segmentation", " ", "and", " ", "the", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", ":", " ", "sct", "\\u", "straight", "en", "\\u", "spin", "alc", "ord", " ", "(", "option", ":", " ", "nur", "bs", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "crop", "\\u", "normali", "zed", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "warp", "\\u", "curve", "2s", "tra", "ight", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", "\\u", "straight", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Strai", "ghte", "ning", " ", "image", " ", "usi", "ng", " ", "center", "line", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "straight", "en_", "=_", "(_", "'", "sct", "\\u", "straight", "en", "\\u", "spin", "alc", "ord", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", ".", "ni", "i", ".", "gz", " ", "-", "s", " ", "'_", "+_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", "\\u", "straight", ".", "ni", "i", ".", "gz", " ", "'_", "+_", "straight", "eni", "ng", "\\u", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "sct", ".", "print", "v", "(", "cmd", "\\u", "straight", "en", ")_", "\\u\\u\\uNL\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "cmd", "\\u", "straight", "en_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "#", " ", "normali", "ze", " ", "intensity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'\\\\", "n", "Normal", "izi", "ng", " ", "intensity", " ", "of", " ", "the", " ", "straight", "ened", " ", "image", "...'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sct", ".", "run", "('", "sct", "\\u", "normali", "ze", ".", "py", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "straight", ".", "ni", "i", ".", "gz", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cro", "p", " ", "labels", "\\u", "vert", "ebra", "l", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Cro", "ppi", "ng", " ", "labels", "\\u", "vert", "ebra", "l", " ", "file", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ymin", "\\u", "anat", "omic", "_", "==_", "None_", "and_", "ymax", "\\u", "anat", "omic", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "labels", "\\u", "vert", "ebra", "l", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "labels", "\\u", "vert", "ebra", "l\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "start", " ", "'_", "+_", "zmin", "\\u", "anat", "omic", "_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "zmax", "\\u", "anat", "omic", "_", "+_", "'", " ", "-", "dim", " ", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "'_", "+_", "PATH", "\\u", "INFO_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/'_", "+_", "subject_", "+_", "'/", "labels", "\\u", "vert", "ebra", "l", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "labels", "\\u", "vert", "ebra", "l\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "start", " ", "'_", "+_", "ymin", "\\u", "anat", "omic", "_", "+_", "','_", "+_", "zmin", "\\u", "anat", "omic", "_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "ymax", "\\u", "anat", "omic", "_", "+_", "','_", "+_", "zmax", "\\u", "anat", "omic", "_", "+_", "'", " ", "-", "dim", " ", "1", ",", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Di", "late", " ", "labels", " ", "from", " ", "labels", "\\u", "vert", "ebra", "l", " ", "file", " ", "bef", "ore", " ", "straight", "eni", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Di", "latin", "g", " ", "labels", " ", "from", " ", "labels", "\\u", "vert", "ebra", "l", " ", "file", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "fs", "lma", "ths", " ", "'_", "+_", "PATH", "\\u", "OUTPUT_", "+_", "'/", "subject", "s", "/'_", "+_", "subject_", "+_", "'/'_", "+_", "contrast", "_", "+_", "'/", "labels", "\\u", "vert", "ebra", "l\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "dil", "F", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "appl", "y", " ", "straight", "eni", "ng", " ", "to", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d", ".", "ni", "i", ".", "gz", " ", "and", " ", "to", " ", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", ":", " ", "sct", "\\u", "appl", "y", "\\u", "transf", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "warp", "\\u", "curve", "2s", "tra", "ight", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d\\u", "reg", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Apply", "ing", " ", "straight", "eni", "ng", " ", "to", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d", ".", "ni", "i", ".", "gz", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "appl", "y", "\\u", "transf", "o", " ", "-", "i", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d", ".", "ni", "i", ".", "gz", " ", "-", "d", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", "\\u", "straight", ".", "ni", "i", ".", "gz", " ", "-", "w", " ", "warp", "\\u", "curve", "2s", "tra", "ight", ".", "ni", "i", ".", "gz", " ", "-", "x", " ", "nn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "center", " ", "of", " ", "mass", " ", "of", " ", "labels", " ", "volume", " ", "due", " ", "to", " ", "past", " ", "dila", "tation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "REMOVE", " ", "IF", " ", "NOT", " ", "REQUIRED_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Selecti", "ng", " ", "center", " ", "of", " ", "mass", " ", "of", " ", "labels", " ", "volume", " ", "due", " ", "to", " ", "past", " ", "dila", "tation", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "label", "\\u", "util", "s", " ", "-", "i", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d\\u", "reg", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d\\u", "reg", "\\u", "2p", "oint", ".", "ni", "i", ".", "gz", " ", "-", "t", " ", "cubi", "c", "-", "to", "-", "point", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "straight", "eni", "ng", " ", "to", " ", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Apply", "ing", " ", "transf", "o", " ", "to", " ", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz", " ", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "appl", "y", "\\u", "transf", "o", " ", "-", "i", " ", "seg", "\\u", "and", "\\u", "labels", ".", "ni", "i", ".", "gz", " ", "-", "d", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", "\\u", "straight", ".", "ni", "i", ".", "gz", " ", "-", "w", " ", "warp", "\\u", "curve", "2s", "tra", "ight", ".", "ni", "i", ".", "gz", " ", "-", "x", " ", "nn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", "Calculat", "e", " ", "the", " ", "extre", "m", " ", "non", " ", "zero", " ", "points", " ", "of", " ", "the", " ", "straight", "ened", " ", "center", "line", " ", "file", " ", "to", " ", "crop", " ", "image", " ", "one", " ", "last", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "file_", "=_", "nib", "abel_", "._", "load_", "(_", "'", "seg", "\\u", "and", "\\u", "labels", "\\u", "reg", ".", "ni", "i", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "c_", "=_", "file_", "._", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "Y_", ",_", "Z_", "=_", "(_", "data\\u", "c_", ">_", "0_", ")_", "._", "nonzero_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z", "\\u", "max_", "=_", "max_", "(_", "Z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "z", "\\u", "min_", "=_", "min_", "(_", "Z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cro", "p", " ", "image", " ", "one", " ", "last", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Cro", "p", " ", "image", " ", "one", " ", "last", " ", "time", " ", "and", " ", "create", " ", "cross", " ", "to", " ", "push", " ", "int", "o", " ", "template", " ", "space", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", "\\u", "straight", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "data\\u", "RP", "I", "\\u", "crop", "\\u", "normali", "zed", "\\u", "straight", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "dim", " ", "2", " ", "-", "start", " ", "'_", "+_", "str_", "(_", "z", "\\u", "min_", ")_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "str_", "(_", "z", "\\u", "max_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cro", "p", " ", "labels", "\\u", "vert", "ebra", "l\\u", "reg", ".", "ni", "i", ".", "gz_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Cro", "p", " ", "labels", "\\u", "vert", "ebra", "l\\u", "reg", ".", "ni", "i", ".", "gz", " ", "and", " ", "use", " ", "cross", " ", "to", " ", "push", " ", "int", "o", " ", "template", " ", "space", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sct", "_", "._", "run_", "(_", "'", "sct", "\\u", "crop", "\\u", "image", " ", "-", "i", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d\\u", "reg", "\\u", "2p", "oint", ".", "ni", "i", ".", "gz", " ", "-", "o", " ", "labels", "\\u", "vert", "ebra", "l\\u", "dilate", "d\\u", "reg", "\\u", "2p", "oint", "\\u", "crop", ".", "ni", "i", ".", "gz", " ", "-", "dim", " ", "2", " ", "-", "start", " ", "'_", "+_", "str_", "(_", "z", "\\u", "min_", ")_", "+_", "'", " ", "-", "end", " ", "'_", "+_", "str_", "(_", "z", "\\u", "max_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
apache/libcloud/docs/examples/dns/worldwidedns/instantiate_driver.py
[ { "content": "from libcloud.dns.types import Provider\nfrom libcloud.dns.providers import get_driver\n\ncls = get_driver(Provider.WORLDWIDEDNS)\n\n# Normal account\ndriver = cls('username', 'apikey')\n\n# Reseller account\ndriver = cls('username', 'apikey', reseller_id='reseller_id')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "driver ", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 6 } ]
[ { "span": "driver ", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 6 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "dns_", "._", "types_", "import_", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "dns_", "._", "providers_", "import_", "get", "\\u", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "=_", "get", "\\u", "driver_", "(_", "Provider_", "._", "WORLD", "WID", "ED", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Normal", " ", "account_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "cls_", "(_", "'", "user", "name", "'_", ",_", "'", "api", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rese", "ller", " ", "account_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "cls_", "(_", "'", "user", "name", "'_", ",_", "'", "api", "key", "'_", ",_", "rese", "ller", "\\u", "id_", "=_", "'", "rese", "ller", "\\u", "id", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
dimagi/commcare-hq/corehq/apps/sms/api.py
[ { "content": "def process_sms_registration(msg):\n \"\"\"\n This method handles registration via sms.\n Returns True if a contact was registered, False if not.\n\n To have a case register itself, do the following:\n\n 1) Select \"Enable Case Registration Via SMS\" in project settings, and fill in the\n associated Case Registration settings.\n\n 2) Text in \"join <domain>\", where <domain> is the domain to join. If the sending\n number does not exist in the system, a case will be registered tied to that number.\n The \"join\" keyword can be any keyword in REGISTRATION_KEYWORDS. This is meant to\n support multiple translations.\n\n To have a mobile worker register itself, do the following:\n\n 1) Select \"Enable Mobile Worker Registration via SMS\" in project settings.\n\n 2) Text in \"join <domain> worker <username>\", where <domain> is the domain to join and <username> is the\n requested username. If the username doesn't exist it will be created, otherwise the registration will error.\n If the username argument is not specified, the username will be the mobile number\n\n The \"join\" and \"worker\" keywords can be any keyword in REGISTRATION_KEYWORDS and\n REGISTRATION_MOBILE_WORKER_KEYWORDS, respectively. This is meant to support multiple\n translations.\n \"\"\"\n registration_processed = False\n text_words = msg.text.upper().split()\n keyword1 = text_words[0] if len(text_words) > 0 else \"\"\n keyword2 = text_words[1].lower() if len(text_words) > 1 else \"\"\n keyword3 = text_words[2] if len(text_words) > 2 else \"\"\n keyword4 = text_words[3] if len(text_words) > 3 else \"\"\n cleaned_phone_number = strip_plus(msg.phone_number)\n if is_registration_text(msg.text) and keyword2 != \"\":\n domain = Domain.get_by_name(keyword2, strict=True)\n if domain is not None:\n if domain_has_privilege(domain, privileges.INBOUND_SMS):\n if keyword3 in REGISTRATION_MOBILE_WORKER_KEYWORDS and domain.sms_mobile_worker_registration_enabled:\n if keyword4 != '':\n username = keyword4\n else:\n username = cleaned_phone_number\n try:\n username = process_username(username, domain)\n password = random_password()\n new_user = CommCareUser.create(domain.name, username, password)\n new_user.add_phone_number(cleaned_phone_number)\n new_user.save_verified_number(domain.name, cleaned_phone_number, True, None)\n new_user.save()\n registration_processed = True\n\n invitation = SelfRegistrationInvitation.by_phone(msg.phone_number)\n if invitation:\n invitation.completed()\n\n if domain.enable_registration_welcome_sms_for_mobile_worker:\n send_sms(domain.name, None, cleaned_phone_number,\n get_message(MSG_REGISTRATION_WELCOME_MOBILE_WORKER, domain=domain.name))\n except ValidationError as e:\n send_sms(domain.name, None, cleaned_phone_number, e.messages[0])\n\n elif domain.sms_case_registration_enabled:\n register_sms_contact(\n domain=domain.name,\n case_type=domain.sms_case_registration_type,\n case_name=\"unknown\",\n user_id=domain.sms_case_registration_user_id,\n contact_phone_number=cleaned_phone_number,\n contact_phone_number_is_verified=\"1\",\n owner_id=domain.sms_case_registration_owner_id,\n )\n registration_processed = True\n if domain.enable_registration_welcome_sms_for_case:\n send_sms(domain.name, None, cleaned_phone_number,\n get_message(MSG_REGISTRATION_WELCOME_CASE, domain=domain.name))\n msg.domain = domain.name\n msg.save()\n\n return registration_processed", "metadata": "root.process_sms_registration", "header": "['module', '___EOS___']", "index": 351 } ]
[ { "span": "keyword1 ", "start_line": 380, "start_column": 4, "end_line": 380, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "\\u", "sms", "\\u", "registration_", "(_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "handle", "s", " ", "registration", " ", "via", " ", "sms", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "Tru", "e", " ", "if", " ", "a", " ", "contact", " ", "was", " ", "register", "ed", ",", " ", "Fal", "se", " ", "if", " ", "not", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "have", " ", "a", " ", "case", " ", "register", " ", "its", "elf", ",", " ", "do", " ", "the", " ", "follow", "ing", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Select", " ", "\"", "Enable", " ", "Case", " ", "Registration", " ", "Via", " ", "SMS", "\"", " ", "in", " ", "project", " ", "settings", ",", " ", "and", " ", "fill", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "associate", "d", " ", "Case", " ", "Registration", " ", "settings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "Text", " ", "in", " ", "\"", "join", " ", "<", "domain", ">\"", ",", " ", "where", " ", "<", "domain", ">", " ", "is", " ", "the", " ", "domain", " ", "to", " ", "join", ".", " ", "If", " ", "the", " ", "sendin", "g", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "doe", "s", " ", "not", " ", "exist", " ", "in", " ", "the", " ", "system", ",", " ", "a", " ", "case", " ", "will", " ", "be", " ", "register", "ed", " ", "tied", " ", "to", " ", "tha", "t", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "\"", "join", "\"", " ", "keyw", "ord", " ", "can", " ", "be", " ", "any", " ", "keyw", "ord", " ", "in", " ", "REGI", "STRAT", "ION", "\\u", "KEYWORDS", ".", " ", "Thi", "s", " ", "is", " ", "mean", "t", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "support", " ", "multiple", " ", "translatio", "ns", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "have", " ", "a", " ", "mobile", " ", "worker", " ", "register", " ", "its", "elf", ",", " ", "do", " ", "the", " ", "follow", "ing", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Select", " ", "\"", "Enable", " ", "Mob", "ile", " ", "Worke", "r", " ", "Registration", " ", "via", " ", "SMS", "\"", " ", "in", " ", "project", " ", "settings", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "Text", " ", "in", " ", "\"", "join", " ", "<", "domain", ">", " ", "worker", " ", "<", "user", "name", ">\"", ",", " ", "where", " ", "<", "domain", ">", " ", "is", " ", "the", " ", "domain", " ", "to", " ", "join", " ", "and", " ", "<", "user", "name", ">", " ", "is", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "request", "ed", " ", "user", "name", ".", " ", " ", "If", " ", "the", " ", "user", "name", " ", "doe", "sn", "'", "t", " ", "exist", " ", "it", " ", "will", " ", "be", " ", "created", ",", " ", "other", "wis", "e", " ", "the", " ", "registration", " ", "will", " ", "error", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "user", "name", " ", "argu", "ment", " ", "is", " ", "not", " ", "specified", ",", " ", "the", " ", "user", "name", " ", "will", " ", "be", " ", "the", " ", "mobile", " ", "number", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "\"", "join", "\"", " ", "and", " ", "\"", "worker", "\"", " ", "keywords", " ", "can", " ", "be", " ", "any", " ", "keyw", "ord", " ", "in", " ", "REGI", "STRAT", "ION", "\\u", "KEYWORDS", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "REGI", "STRAT", "ION", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "KEYWORDS", ",", " ", "respec", "tiv", "el", "y", ".", " ", "Thi", "s", " ", "is", " ", "mean", "t", " ", "to", " ", "support", " ", "multiple", "\\", "10", ";", " ", " ", " ", " ", "translatio", "ns", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registration", "\\u", "processed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "words_", "=_", "msg_", "._", "text_", "._", "upper_", "(_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyw", "ord", "1_", "=_", "text", "\\u", "words_", "[_", "0_", "]_", "if_", "len_", "(_", "text", "\\u", "words_", ")_", ">_", "0_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyw", "ord", "2_", "=_", "text", "\\u", "words_", "[_", "1_", "]_", "._", "lower_", "(_", ")_", "if_", "len_", "(_", "text", "\\u", "words_", ")_", ">_", "1_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyw", "ord", "3_", "=_", "text", "\\u", "words_", "[_", "2_", "]_", "if_", "len_", "(_", "text", "\\u", "words_", ")_", ">_", "2_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyw", "ord", "4_", "=_", "text", "\\u", "words_", "[_", "3_", "]_", "if_", "len_", "(_", "text", "\\u", "words_", ")_", ">_", "3_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "ed", "\\u", "phone", "\\u", "number_", "=_", "strip", "\\u", "plus_", "(_", "msg_", "._", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "registration", "\\u", "text_", "(_", "msg_", "._", "text_", ")_", "and_", "keyw", "ord", "2_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "Domain_", "._", "get", "\\u", "by", "\\u", "name_", "(_", "keyw", "ord", "2_", ",_", "strict_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "domain_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "domain", "\\u", "has", "\\u", "privilege", "_", "(_", "domain_", ",_", "privilege", "s_", "._", "IN", "BOUND", "\\u", "SMS", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyw", "ord", "3_", "in_", "REGI", "STRAT", "ION", "\\u", "MOB", "ILE", "\\u", "WORKER", "\\u", "KEYWORDS", "_", "and_", "domain_", "._", "sms", "\\u", "mobile", "\\u", "worker", "\\u", "registration", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "keyw", "ord", "4_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "username_", "=_", "keyw", "ord", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "username_", "=_", "clean", "ed", "\\u", "phone", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "username_", "=_", "process", "\\u", "username_", "(_", "username_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "random", "\\u", "password_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "=_", "Comm", "Care", "User_", "._", "create_", "(_", "domain_", "._", "name_", ",_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "add", "\\u", "phone", "\\u", "number_", "(_", "clean", "ed", "\\u", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "save", "\\u", "verifie", "d\\u", "number_", "(_", "domain_", "._", "name_", ",_", "clean", "ed", "\\u", "phone", "\\u", "number_", ",_", "True_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registration", "\\u", "processed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "invitation", "_", "=_", "Self", "Registration", "Invitation", "_", "._", "by", "\\u", "phone_", "(_", "msg_", "._", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "invitation", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "invitation", "_", "._", "completed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "domain_", "._", "enable", "\\u", "registration", "\\u", "welcome", "\\u", "sms", "\\u", "for", "\\u", "mobile", "\\u", "worker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "send", "\\u", "sms_", "(_", "domain_", "._", "name_", ",_", "None_", ",_", "clean", "ed", "\\u", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "message_", "(_", "MS", "G", "\\u", "REGI", "STRAT", "ION", "\\u", "WEL", "COM", "E", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ",_", "domain_", "=_", "domain_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Validat", "ion", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "send", "\\u", "sms_", "(_", "domain_", "._", "name_", ",_", "None_", ",_", "clean", "ed", "\\u", "phone", "\\u", "number_", ",_", "e_", "._", "messages_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "domain_", "._", "sms", "\\u", "case", "\\u", "registration", "\\u", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "register", "\\u", "sms", "\\u", "contact_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domain_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "type_", "=_", "domain_", "._", "sms", "\\u", "case", "\\u", "registration", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "name_", "=_", "\"", "unknown", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", "=_", "domain_", "._", "sms", "\\u", "case", "\\u", "registration", "\\u", "user", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "phone", "\\u", "number_", "=_", "clean", "ed", "\\u", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contact", "\\u", "phone", "\\u", "number", "\\u", "is", "\\u", "verified_", "=_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "owner", "\\u", "id_", "=_", "domain_", "._", "sms", "\\u", "case", "\\u", "registration", "\\u", "owner", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registration", "\\u", "processed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "domain_", "._", "enable", "\\u", "registration", "\\u", "welcome", "\\u", "sms", "\\u", "for", "\\u", "case_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "send", "\\u", "sms_", "(_", "domain_", "._", "name_", ",_", "None_", ",_", "clean", "ed", "\\u", "phone", "\\u", "number_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "message_", "(_", "MS", "G", "\\u", "REGI", "STRAT", "ION", "\\u", "WEL", "COM", "E", "\\u", "CASE", "_", ",_", "domain_", "=_", "domain_", "._", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
hyperion-rt/hyperion/hyperion/model/model_output.py
[ { "content": " @on_the_fly_hdf5\n def get_sed(self, stokes='I', group=0, technique='peeled',\n distance=None, component='total', inclination='all',\n aperture='all', uncertainties=False, units=None,\n source_id=None, dust_id=None, n_scat=None):\n '''\n Retrieve SEDs for a specific image group and Stokes component.\n\n Parameters\n ----------\n\n stokes : str, optional\n The Stokes component to return. This can be:\n\n * 'I': Total intensity [default]\n * 'Q': Q Stokes parameter (linear polarization)\n * 'U': U Stokes parameter (linear polarization)\n * 'V': V Stokes parameter (circular polarization)\n * 'linpol': Total linear polarization fraction\n * 'circpol': Total circular polariation fraction\n\n Note that if the SED was set up with ``set_stokes(False)``, then\n only the ``I`` component is available.\n\n technique : str, optional\n Whether to retrieve SED(s) computed with photon peeling-off\n ('peeled') or binning ('binned'). Default is 'peeled'.\n\n group : int, optional\n The peeloff group (zero-based). If multiple peeloff image groups\n were requested, this can be used to select between them. The\n default is to return the first group. This option is only used if\n technique='peeled'.\n\n distance : float, optional\n The distance to the observer, in cm.\n\n component : str, optional\n The component to return based on origin and last interaction.\n This can be:\n\n * 'total': Total flux\n\n * 'source_emit': The photons were last emitted from a source\n and did not undergo any subsequent interactions.\n\n * 'dust_emit': The photons were last emitted dust and did not\n undergo any subsequent interactions\n\n * 'source_scat': The photons were last emitted from a source\n and were subsequently scattered\n\n * 'dust_scat': The photons were last emitted from dust and\n were subsequently scattered\n\n * 'source': The photons that were last emitted from a source\n\n * 'dust': The photons that were last emitted from dust\n\n aperture : int, optional\n The index of the aperture to plot (zero-based). Use 'all' to\n return all apertures, and -1 to show the largest aperture.\n\n inclination : int, optional\n The index of the viewing angle to plot (zero-based). Use 'all'\n to return all viewing angles.\n\n uncertainties : bool, optional\n Whether to compute and return uncertainties\n\n units : str, optional\n The output units for the SED(s). Valid options if a distance is\n specified are:\n\n * ``'ergs/cm^2/s'``\n * ``'ergs/cm^2/s/Hz'``\n * ``'Jy'``\n * ``'mJy'``\n\n The default is ``'ergs/cm^2/s'``. If a distance is not specified,\n then this option is ignored, and the output units are ergs/s.\n\n source_id, dust_id : int or str, optional\n If the output file was made with track_origin='detailed', a\n specific source and dust component can be specified (where 0 is\n the first source or dust type). If 'all' is specified, then all\n components are returned individually. If neither of these are\n not specified, then the total component requested for all\n sources or dust types is returned. For sources, it is also possible\n to specify a source name as a string, if the source name was set\n during the set-up.\n\n n_scat : int, optional\n If the output file was made with track_origin='scatterings', the\n number of scatterings can be specified here. If specified, the\n image is constructed only from photons that have scattered\n ``n_scat`` times since being last emitted.\n\n Returns\n -------\n\n wav : numpy.ndarray\n The wavelengths for which the SEDs are defined, in microns\n\n flux or degree of polarization : numpy.ndarray\n The flux or degree of polarization. This is a data cube which has\n at most three dimensions (n_inclinations, n_apertures,\n n_wavelengths). If an aperture or inclination is specified, this\n reduces the number of dimensions in the flux cube. If `stokes` is\n one of 'I', 'Q', 'U', or 'V', the flux is either returned in\n ergs/s (if distance is not specified) or in the units specified by\n units= (if distance is specified). If `stokes` is one of 'linpol'\n or 'circpol', the degree of polarization is returned as a fraction\n in the range 0 to 1.\n\n uncertainty : numpy.ndarray\n The uncertainties on the flux or degree of polarization. This\n has the same dimensions as the flux or degree of polarization\n array. This is only returned if uncertainties were requested.\n '''\n\n # Check argument types\n if not isinstance(stokes, basestring):\n raise ValueError(\"stokes argument should be a string\")\n\n # Check for inconsistent parameters\n if distance is not None and stokes in ['linpol', 'circpol']:\n raise Exception(\"Cannot scale linear or circular polarization degree by distance\")\n\n if technique == 'peeled':\n n_groups = len(self.file['Peeled'])\n if (group < 0 and -group <= n_groups) or (group >= 0 and group < n_groups):\n g = self.file['Peeled/group_%05i' % (group + 1)]\n else:\n raise ValueError('File only contains %i image/SED group(s)' % n_groups)\n else:\n g = self.file['Binned']\n\n if not 'seds' in g:\n raise Exception(\"Group %i does not contain any SEDs\" % group)\n\n # Check that uncertainties are present if requested\n if uncertainties and not 'seds_unc' in g:\n raise Exception(\"Uncertainties requested but not present in file\")\n\n if 'track_origin' in g['seds'].attrs and component != 'total':\n io = self._get_origin_slice(g['seds'], component=component,\n source_id=source_id, dust_id=dust_id, n_scat=n_scat)\n\n # Set up wavelength space\n if 'use_filters' in g.attrs and g.attrs['use_filters'].decode('utf-8').lower() == 'yes':\n nu = g['filt_nu0'].value\n wav = c / nu * 1.e4\n elif 'numin' in g['seds'].attrs:\n numin = g['seds'].attrs['numin']\n numax = g['seds'].attrs['numax']\n wavmin, wavmax = c / numax * 1.e4, c / numin * 1.e4\n wav = np.logspace(np.log10(wavmax), np.log10(wavmin), g['seds'].shape[-1] * 2 + 1)[1::2]\n nu = c / wav * 1.e4\n else:\n nu = g['frequencies']['nu']\n wav = c / nu * 1.e4\n\n flux = g['seds'].value\n if uncertainties:\n unc = g['seds_unc'].value\n\n try:\n inside_observer = g.attrs['inside_observer'].decode('utf-8').lower() == 'yes'\n except:\n inside_observer = False\n\n if inside_observer and distance is not None:\n raise ValueError(\"Cannot specify distance for inside observers\")\n\n # Set default units\n if units is None:\n if distance is None and not inside_observer:\n units = 'ergs/s'\n else:\n units = 'ergs/cm^2/s'\n\n # Optionally scale by distance\n if distance is not None or inside_observer:\n\n # Convert to the correct units\n if units == 'ergs/cm^2/s':\n scale = 1.\n elif units == 'ergs/cm^2/s/Hz':\n scale = 1. / nu\n elif units == 'Jy':\n scale = 1.e23 / nu\n elif units == 'mJy':\n scale = 1.e26 / nu\n else:\n raise ValueError(\"Unknown units: %s\" % units)\n\n # Scale by distance\n if distance:\n scale *= 1. / (4. * pi * distance ** 2)\n\n else:\n\n if units != 'ergs/s':\n raise ValueError(\"Since distance= is not specified, units should be set to ergs/s\")\n\n # Units here are not technically ergs/cm^2/s but ergs/s\n scale = 1.\n\n # If in 32-bit mode, need to convert to 64-bit because of scaling/polarization to be safe\n if flux.dtype == np.float32:\n flux = flux.astype(np.float64)\n if uncertainties and unc.dtype == np.float32:\n unc = unc.astype(np.float64)\n\n # If a stokes component is requested, scale the images. Frequency is\n # the last dimension, so this compact notation can be used.\n\n if stokes in STOKESD:\n flux *= scale\n if uncertainties:\n unc *= scale\n\n # We now slice the SED array to end up with what the user requested.\n # Note that we slice from the last to the first dimension to ensure that\n # we always know what the slices are. In this section, we make use of\n # the fact that when writing array[i] with a multi-dimensional array,\n # the index i applies only to the first dimension. So flux[1] really\n # means flux[1, :, :, :, :].\n\n if aperture == 'all':\n pass\n else:\n if not isinstance(aperture, int):\n raise TypeError('aperture should be an integer (it should'\n ' be the index of the aperture, not the '\n 'value itself)')\n flux = flux[:, :, :, aperture]\n if uncertainties:\n unc = unc[:, :, :, aperture]\n\n if inclination == 'all':\n pass\n else:\n if not isinstance(inclination, int):\n raise TypeError('inclination should be an integer (it should'\n ' be the index of the inclination, not the '\n 'value itself)')\n flux = flux[:, :, inclination]\n if uncertainties:\n unc = unc[:, :, inclination]\n\n # Select correct origin component\n\n if component == 'total':\n flux = np.sum(flux, axis=1)\n if uncertainties:\n unc = np.sqrt(np.sum(unc ** 2, axis=1))\n elif component in ['source_emit', 'dust_emit', 'source_scat', 'dust_scat', 'dust', 'source']:\n if type(io) is tuple:\n start, end = io\n flux = flux[:, start:end]\n if uncertainties:\n unc = unc[:, start:end]\n if (component.startswith('source') and source_id is None) or \\\n (component.startswith('dust') and dust_id is None):\n flux = np.sum(flux, axis=1)\n if uncertainties:\n unc = np.sqrt(np.sum(unc ** 2, axis=1))\n else:\n flux = flux[:, io]\n if uncertainties:\n unc = unc[:, io]\n else:\n raise Exception(\"Unknown component: %s\" % component)\n\n # Select correct Stokes component\n\n if flux.shape[0] == 1 and stokes != 'I':\n raise ValueError(\"Only the Stokes I value was stored for this SED\")\n\n if stokes in STOKESD:\n flux = flux[STOKESD[stokes]]\n if uncertainties:\n unc = unc[STOKESD[stokes]]\n elif stokes == 'linpol':\n if uncertainties:\n flux, unc = mc_linear_polarization(flux[0], unc[0], flux[1], unc[1], flux[2], unc[2])\n else:\n flux = np.sqrt((flux[1] ** 2 + flux[2] ** 2) / flux[0] ** 2)\n flux[np.isnan(flux)] = 0.\n elif stokes == 'circpol':\n if uncertainties:\n flux, unc = mc_circular_polarization(flux[0], unc[0], flux[3], unc[3])\n else:\n flux = np.abs(flux[3] / flux[0])\n flux[np.isnan(flux)] = 0.\n else:\n raise ValueError(\"Unknown Stokes parameter: %s\" % stokes)\n\n from .sed import SED\n sed = SED(nu=nu, val=flux, unc=unc if uncertainties else None, units=units)\n\n # Add aperture information\n sed.ap_min = g['seds'].attrs['apmin']\n sed.ap_max = g['seds'].attrs['apmax']\n\n # Add depth information\n try:\n sed.d_min = g.attrs['d_min']\n sed.d_max = g.attrs['d_max']\n except KeyError: # Older versions of Hyperion\n sed.d_min = None\n sed.d_max = None\n\n # Add distance\n sed.distance = distance\n\n # Save whether the SED was from an inside observer\n sed.inside_observer = inside_observer\n\n return sed", "metadata": "root.ModelOutput.get_sed", "header": "['class', 'ModelOutput', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 209 }, { "content": " @on_the_fly_hdf5\n def get_image(self, stokes='I', group=0, technique='peeled',\n distance=None, component='total', inclination='all',\n uncertainties=False, units=None,\n source_id=None, dust_id=None, n_scat=None):\n '''\n Retrieve images for a specific image group and Stokes component.\n\n Parameters\n ----------\n\n stokes : str, optional\n The Stokes component to return. This can be:\n\n * 'I': Total intensity [default]\n * 'Q': Q Stokes parameter (linear polarization)\n * 'U': U Stokes parameter (linear polarization)\n * 'V': V Stokes parameter (circular polarization)\n * 'linpol': Total linear polarization fraction\n * 'circpol': Total circular polariation fraction\n\n Note that if the image was set up with ``set_stokes(False)``, then\n only the ``I`` component is available.\n\n technique : str, optional\n Whether to retrieve an image computed with photon peeling-off\n ('peeled') or binning ('binned'). Default is 'peeled'.\n\n group : int, optional\n The peeloff group (zero-based). If multiple peeloff image groups\n were requested, this can be used to select between them. The\n default is to return the first group. This option is only used if\n technique='peeled'.\n\n distance : float, optional\n The distance to the observer, in cm.\n\n component : str, optional\n The component to return based on origin and last interaction.\n This can be:\n\n * 'total': Total flux\n\n * 'source_emit': The photons were last emitted from a source\n and did not undergo any subsequent interactions.\n\n * 'dust_emit': The photons were last emitted dust and did not\n undergo any subsequent interactions\n\n * 'source_scat': The photons were last emitted from a source\n and were subsequently scattered\n\n * 'dust_scat': The photons were last emitted from dust and\n were subsequently scattered\n\n * 'source': The photons that were last emitted from a source\n\n * 'dust': The photons that were last emitted from dust\n\n inclination : int, optional\n The index of the viewing angle to plot (zero-based). Use 'all'\n to return all viewing angles.\n\n uncertainties : bool, optional\n Whether to compute and return uncertainties\n\n units : str, optional\n The output units for the image(s). Valid options if a distance is\n specified are:\n\n * ``'ergs/cm^2/s'``\n * ``'ergs/cm^2/s/Hz'``\n * ``'Jy'``\n * ``'mJy'``\n * ``'MJy/sr'``\n\n The default is ``'ergs/cm^2/s'``. If a distance is not specified,\n then this option is ignored, and the output units are ergs/s.\n\n source_id, dust_id : int or str, optional\n If the output file was made with track_origin='detailed', a\n specific source and dust component can be specified (where 0 is\n the first source or dust type). If 'all' is specified, then all\n components are returned individually. If neither of these are\n not specified, then the total component requested for all\n sources or dust types is returned. For sources, it is also possible\n to specify a source name as a string, if the source name was set\n during the set-up.\n\n n_scat : int, optional\n If the output file was made with track_origin='scatterings', the\n number of scatterings can be specified here. If specified, the\n image is constructed only from photons that have scattered\n ``n_scat`` times since being last emitted.\n\n Returns\n -------\n\n wav : numpy.ndarray\n The wavelengths for which the SEDs are defined, in microns\n\n flux or degree of polarization : numpy.ndarray\n The flux or degree of polarization. This is a data cube which has\n at most three dimensions (n_inclinations, n_wavelengths). If an\n aperture or inclination is specified, this reduces the number of\n dimensions in the flux cube. If `stokes` is one of 'I', 'Q', 'U',\n or 'V', the flux is either returned in ergs/s (if distance is not\n specified) or in the units specified by units= (if distance is\n specified). If `stokes` is one of 'linpol' or 'circpol', the\n degree of polarization is returned as a fraction in the range 0 to\n 1.\n\n uncertainty : numpy.ndarray\n The uncertainties on the flux or degree of polarization. This\n has the same dimensions as the flux or degree of polarization\n array. This is only returned if uncertainties were requested.\n '''\n\n # Check argument types\n if not isinstance(stokes, basestring):\n raise ValueError(\"stokes argument should be a string\")\n\n # Check for inconsistent parameters\n if distance is not None and stokes in ['linpol', 'circpol']:\n raise Exception(\"Cannot scale linear or circular polarization degree by distance\")\n\n if technique == 'peeled':\n n_groups = len(self.file['Peeled'])\n if (group < 0 and -group <= n_groups) or (group >= 0 and group < n_groups):\n g = self.file['Peeled/group_%05i' % (group + 1)]\n else:\n raise ValueError('File only contains %i image/SED group(s)' % n_groups)\n else:\n g = self.file['Binned']\n\n if not 'images' in g:\n raise Exception(\"Group %i does not contain any images\" % group)\n\n # Check that uncertainties are present if requested\n if uncertainties and not 'images_unc' in g:\n raise Exception(\"Uncertainties requested but not present in file\")\n\n if 'track_origin' in g['images'].attrs and component != 'total':\n io = self._get_origin_slice(g['images'], component=component,\n source_id=source_id, dust_id=dust_id, n_scat=n_scat)\n\n\n # Set up wavelength space\n if 'use_filters' in g.attrs and g.attrs['use_filters'].decode('utf-8').lower() == 'yes':\n nu = g['filt_nu0'].value\n wav = c / nu * 1.e4\n elif 'numin' in g['images'].attrs:\n numin = g['images'].attrs['numin']\n numax = g['images'].attrs['numax']\n wavmin, wavmax = c / numax * 1.e4, c / numin * 1.e4\n wav = np.logspace(np.log10(wavmax), np.log10(wavmin), g['images'].shape[-1] * 2 + 1)[1::2]\n nu = c / wav * 1.e4\n else:\n nu = g['frequencies']['nu']\n wav = c / nu * 1.e4\n\n flux = g['images'].value\n if uncertainties:\n unc = g['images_unc'].value\n\n try:\n inside_observer = g.attrs['inside_observer'].decode('utf-8').lower() == 'yes'\n except:\n inside_observer = False\n\n if inside_observer and distance is not None:\n raise ValueError(\"Cannot specify distance for inside observers\")\n\n # Set default units\n if units is None:\n if distance is None and not inside_observer:\n units = 'ergs/s'\n else:\n units = 'ergs/cm^2/s'\n\n # Find pixel dimensions of image\n ny, nx = flux.shape[-3:-1]\n\n # Find physical and angular extent, and pixel area in steradians\n if inside_observer:\n\n # Physical extent cannot be set\n x_min = x_max = y_min = y_max = None\n\n # Find extent of the image\n lon_min = g['images'].attrs['xmin']\n lon_max = g['images'].attrs['xmax']\n lat_min = g['images'].attrs['ymin']\n lat_max = g['images'].attrs['ymax']\n\n # Need to construct a mesh since every pixel might have a\n # different size\n lon = np.linspace(np.radians(lon_min), np.radians(lon_max), nx + 1)\n lat = np.cos(np.linspace(np.radians(90. - lat_min), np.radians(90. - lat_max), ny + 1))\n dlon = lon[1:] - lon[:-1]\n dlat = lat[:-1] - lat[1:]\n DLON, DLAT = np.meshgrid(dlon, dlat)\n\n # Find pixel area in steradians\n pix_area_sr = DLON * DLAT\n\n else:\n\n # Find physical extent of the image\n x_min = g['images'].attrs['xmin']\n x_max = g['images'].attrs['xmax']\n y_min = g['images'].attrs['ymin']\n y_max = g['images'].attrs['ymax']\n\n if distance is not None:\n\n # Find angular extent\n lon_min_rad = np.arctan(x_min / distance)\n lon_max_rad = np.arctan(x_max / distance)\n lat_min_rad = np.arctan(y_min / distance)\n lat_max_rad = np.arctan(y_max / distance)\n\n # Find pixel size in arcseconds\n pix_dx = abs(lon_max_rad - lon_min_rad) / float(nx)\n pix_dy = abs(lat_max_rad - lat_min_rad) / float(ny)\n\n # Find pixel area in steradians\n pix_area_sr = pix_dx * pix_dy\n\n # Find angular extent in degrees\n lon_min = np.degrees(lon_min_rad)\n lon_max = np.degrees(lon_max_rad)\n lat_min = np.degrees(lat_min_rad)\n lat_max = np.degrees(lat_max_rad)\n\n else:\n\n # Angular extent cannot be set\n lon_min = lon_max = lat_min = lat_max = None\n\n # Pixel area in steradians cannot be set\n pix_area_sr = None\n\n # Optionally scale by distance\n if distance is not None or inside_observer:\n\n # Convert to the correct units\n if units == 'ergs/cm^2/s':\n scale = 1.\n elif units == 'ergs/cm^2/s/Hz':\n scale = 1. / nu\n elif units == 'Jy':\n scale = 1.e23 / nu\n elif units == 'mJy':\n scale = 1.e26 / nu\n elif units == 'MJy/sr':\n if inside_observer:\n scale = 1.e17 / nu[np.newaxis, np.newaxis, :] / pix_area_sr[:, :, np.newaxis]\n else:\n scale = 1.e17 / nu / pix_area_sr\n else:\n raise ValueError(\"Unknown units: %s\" % units)\n\n # Scale by distance\n if distance:\n scale *= 1. / (4. * pi * distance ** 2)\n\n else:\n\n if units != 'ergs/s':\n raise ValueError(\"Since distance= is not specified, units should be set to ergs/s\")\n\n scale = 1.\n\n # If in 32-bit mode, need to convert to 64-bit because of\n # scaling/polarization to be safe\n if flux.dtype == np.float32:\n flux = flux.astype(np.float64)\n if uncertainties and unc.dtype == np.float32:\n unc = unc.astype(np.float64)\n\n # If a stokes component is requested, scale the images. Frequency is\n # the last dimension, so this compact notation can be used.\n\n if stokes in STOKESD:\n flux *= scale\n if uncertainties:\n unc *= scale\n\n # We now slice the image array to end up with what the user requested.\n # Note that we slice from the last to the first dimension to ensure that\n # we always know what the slices are. In this section, we make use of\n # the fact that when writing array[i] with a multi-dimensional array,\n # the index i applies only to the first dimension. So flux[1] really\n # means flux[1, :, :, :, :].\n\n if inclination == 'all':\n pass\n else:\n if not isinstance(inclination, int):\n raise TypeError('inclination should be an integer (it should'\n ' be the index of the inclination, not the '\n 'value itself)')\n flux = flux[:, :, inclination]\n if uncertainties:\n unc = unc[:, :, inclination]\n\n # Select correct origin component\n\n if component == 'total':\n flux = np.sum(flux, axis=1)\n if uncertainties:\n unc = np.sqrt(np.sum(unc ** 2, axis=1))\n elif component in ['source_emit', 'dust_emit', 'source_scat', 'dust_scat', 'dust', 'source']:\n if type(io) is tuple:\n start, end = io\n flux = flux[:, start:end]\n if uncertainties:\n unc = unc[:, start:end]\n if (component.startswith('source') and source_id is None) or \\\n (component.startswith('dust') and dust_id is None):\n flux = np.sum(flux, axis=1)\n if uncertainties:\n unc = np.sqrt(np.sum(unc ** 2, axis=1))\n else:\n flux = flux[:, io]\n if uncertainties:\n unc = unc[:, io]\n else:\n raise Exception(\"Unknown component: %s\" % component)\n\n # Select correct Stokes component\n\n if flux.shape[0] == 1 and stokes != 'I':\n raise ValueError(\"Only the Stokes I value was stored for this image\")\n\n if stokes in STOKESD:\n flux = flux[STOKESD[stokes]]\n if uncertainties:\n unc = unc[STOKESD[stokes]]\n elif stokes == 'linpol':\n if uncertainties:\n flux, unc = mc_linear_polarization(flux[0], unc[0], flux[1], unc[1], flux[2], unc[2])\n else:\n flux = np.sqrt((flux[1] ** 2 + flux[2] ** 2) / flux[0] ** 2)\n flux[np.isnan(flux)] = 0.\n elif stokes == 'circpol':\n if uncertainties:\n flux, unc = mc_circular_polarization(flux[0], unc[0], flux[3], unc[3])\n else:\n flux = np.abs(flux[3] / flux[0])\n flux[np.isnan(flux)] = 0.\n else:\n raise ValueError(\"Unknown Stokes parameter: %s\" % stokes)\n\n from .image import Image\n image = Image(nu=nu, val=flux, unc=unc if uncertainties else None, units=units)\n\n # Add physical extent\n image.x_min = x_min\n image.x_max = x_max\n image.y_min = y_min\n image.y_max = y_max\n\n # Add depth information\n try:\n image.d_min = g.attrs['d_min']\n image.d_max = g.attrs['d_max']\n except KeyError: # Older versions of Hyperion\n image.d_min = None\n image.d_max = None\n\n # Add angular extent\n image.lon_min = lon_min\n image.lon_max = lon_max\n image.lat_min = lat_min\n image.lat_max = lat_max\n\n # Add pixel area in steradians\n image.pix_area_sr = pix_area_sr\n\n # Add distance\n image.distance = distance\n\n # Save whether the image was from an inside observer\n image.inside_observer = inside_observer\n\n return image", "metadata": "root.ModelOutput.get_image", "header": "['class', 'ModelOutput', '(', 'FreezableClass', ')', ':', '___EOS___']", "index": 532 } ]
[ { "span": "wav ", "start_line": 361, "start_column": 12, "end_line": 361, "end_column": 15 }, { "span": "wav ", "start_line": 370, "start_column": 12, "end_line": 370, "end_column": 15 }, { "span": "wav ", "start_line": 682, "start_column": 12, "end_line": 682, "end_column": 15 }, { "span": "wav ", "start_line": 691, "start_column": 12, "end_line": 691, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Model", "Output_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "on", "\\u", "the", "\\u", "fly", "\\u", "hdf5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "sed_", "(_", "self_", ",_", "sto", "kes", "_", "=_", "'", "I", "'_", ",_", "group_", "=_", "0_", ",_", "technique", "_", "=_", "'", "pee", "led", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "None_", ",_", "component_", "=_", "'", "total", "'_", ",_", "incl", "ination", "_", "=_", "'", "all", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aperture", "_", "=_", "'", "all", "'_", ",_", "uncertain", "ties_", "=_", "False_", ",_", "units_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "id_", "=_", "None_", ",_", "dust", "\\u", "id_", "=_", "None_", ",_", "n", "\\u", "scat", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "SED", "s", " ", "for", " ", "a", " ", "specific", " ", "image", " ", "group", " ", "and", " ", "Sto", "kes", " ", "component", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sto", "kes", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Sto", "kes", " ", "component", " ", "to", " ", "return", ".", " ", "Thi", "s", " ", "can", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "I", "':", " ", "Total", " ", "intensity", " ", "[", "default", "]", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "Q", "':", " ", "Q", " ", "Sto", "kes", " ", "parameter", " ", "(", "linear", " ", "polariza", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "U", "':", " ", "U", " ", "Sto", "kes", " ", "parameter", " ", "(", "linear", " ", "polariza", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "V", "':", " ", "V", " ", "Sto", "kes", " ", "parameter", " ", "(", "circular", " ", "polariza", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "lin", "pol", "':", " ", " ", "Total", " ", "linear", " ", "polariza", "tion", " ", "fract", "ion", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "circ", "pol", "':", " ", "Total", " ", "circular", " ", "polar", "iation", " ", "fract", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "if", " ", "the", " ", "SED", " ", "was", " ", "set", " ", "up", " ", "with", " ", "``", "set\\u", "sto", "kes", "(", "Fal", "se", ")`", "`", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "the", " ", "``", "I", "``", " ", "component", " ", "is", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "technique", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "retrieve", " ", "SED", "(", "s", ")", " ", "compute", "d", " ", "with", " ", "photon", " ", "pee", "ling", "-", "off", "\\", "10", ";", " ", " ", " ", " ", "('", "pee", "led", "')", " ", "or", " ", "binning", " ", "('", "binned", "')", ".", " ", "Default", " ", "is", " ", "'", "pee", "led", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "group", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "pee", "lof", "f", " ", "group", " ", "(", "zero", "-", "based", ").", " ", "If", " ", "multiple", " ", "pee", "lof", "f", " ", "image", " ", "group", "s", "\\", "10", ";", " ", " ", " ", " ", "wer", "e", " ", "request", "ed", ",", " ", "this", " ", "can", " ", "be", " ", "used", " ", "to", " ", "select", " ", "bet", "ween", " ", "them", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "default", " ", "is", " ", "to", " ", "return", " ", "the", " ", "first", " ", "group", ".", " ", "Thi", "s", " ", "option", " ", "is", " ", "only", " ", "used", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "technique", "='", "pee", "led", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "distance", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "distance", " ", "to", " ", "the", " ", "observer", ",", " ", "in", " ", "cm", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "component", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "component", " ", "to", " ", "return", " ", "based", " ", "on", " ", "orig", "in", " ", "and", " ", "last", " ", "interacti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "total", "':", " ", "Total", " ", "flux", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "source", "\\u", "emit", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "a", " ", "source", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "and", " ", "did", " ", "not", " ", "under", "go", " ", "any", " ", "subsequen", "t", " ", "interacti", "ons", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "dust", "\\u", "emit", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "dust", " ", "and", " ", "did", " ", "not", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "under", "go", " ", "any", " ", "subsequen", "t", " ", "interacti", "ons", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "source", "\\u", "scat", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "a", " ", "source", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "and", " ", "wer", "e", " ", "subsequen", "tl", "y", " ", "scatter", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "dust", "\\u", "scat", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "dust", " ", "and", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "wer", "e", " ", "subsequen", "tl", "y", " ", "scatter", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "source", "':", " ", "The", " ", "photon", "s", " ", "tha", "t", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "a", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "dust", "':", " ", "The", " ", "photon", "s", " ", "tha", "t", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "dust", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "aperture", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "index", " ", "of", " ", "the", " ", "aperture", " ", "to", " ", "plot", " ", "(", "zero", "-", "based", ").", " ", "Us", "e", " ", "'", "all", "'", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "all", " ", "aperture", "s", ",", " ", "and", " ", "-1", " ", "to", " ", "show", " ", "the", " ", "large", "st", " ", "aperture", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "incl", "ination", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "index", " ", "of", " ", "the", " ", "viewin", "g", " ", "angle", " ", "to", " ", "plot", " ", "(", "zero", "-", "based", ").", " ", "Us", "e", " ", "'", "all", "'", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "return", " ", "all", " ", "viewin", "g", " ", "angle", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "uncertain", "ties", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "compute", " ", "and", " ", "return", " ", "uncertain", "ties", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unit", "s", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "output", " ", "unit", "s", " ", "for", " ", "the", " ", "SED", "(", "s", ").", " ", "Valid", " ", "options", " ", "if", " ", "a", " ", "distance", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "specified", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "/", "H", "z", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "Jy", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "m", "Jy", "'``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "``", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'``", ".", " ", "If", " ", "a", " ", "distance", " ", "is", " ", "not", " ", "specified", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "this", " ", "option", " ", "is", " ", "ignore", "d", ",", " ", "and", " ", "the", " ", "output", " ", "unit", "s", " ", "are", " ", "erg", "s", "/", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "source", "\\u", "id", ",", " ", "dust", "\\u", "id", " ", ":", " ", "int", " ", "or", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "output", " ", "file", " ", "was", " ", "made", " ", "with", " ", "track", "\\u", "orig", "in", "='", "detailed", "',", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "specific", " ", "source", " ", "and", " ", "dust", " ", "component", " ", "can", " ", "be", " ", "specified", " ", "(", "where", " ", "0", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "first", " ", "source", " ", "or", " ", "dust", " ", "type", ").", " ", "If", " ", "'", "all", "'", " ", "is", " ", "specified", ",", " ", "then", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "component", "s", " ", "are", " ", "return", "ed", " ", "individual", "ly", ".", " ", "If", " ", "nei", "ther", " ", "of", " ", "these", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "specified", ",", " ", "then", " ", "the", " ", "total", " ", "component", " ", "request", "ed", " ", "for", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "source", "s", " ", "or", " ", "dust", " ", "types", " ", "is", " ", "return", "ed", ".", " ", "For", " ", "source", "s", ",", " ", "it", " ", "is", " ", "als", "o", " ", "possib", "le", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "speci", "fy", " ", "a", " ", "source", " ", "name", " ", "as", " ", "a", " ", "string", ",", " ", "if", " ", "the", " ", "source", " ", "name", " ", "was", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "dur", "ing", " ", "the", " ", "set", "-", "up", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "n", "\\u", "scat", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "output", " ", "file", " ", "was", " ", "made", " ", "with", " ", "track", "\\u", "orig", "in", "='", "scatter", "ings", "',", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "of", " ", "scatter", "ings", " ", "can", " ", "be", " ", "specified", " ", "here", ".", " ", "If", " ", "specified", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "image", " ", "is", " ", "construct", "ed", " ", "only", " ", "from", " ", "photon", "s", " ", "tha", "t", " ", "have", " ", "scatter", "ed", "\\", "10", ";", " ", " ", " ", " ", "``", "n", "\\u", "scat", "``", " ", "times", " ", "sinc", "e", " ", "bei", "ng", " ", "last", " ", "emitte", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "wav", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "wavelengths", " ", "for", " ", "whi", "ch", " ", "the", " ", "SED", "s", " ", "are", " ", "defin", "ed", ",", " ", "in", " ", "micro", "ns", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "data", " ", "cube", " ", "whi", "ch", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "at", " ", "most", " ", "three", " ", "dimension", "s", " ", "(", "n", "\\u", "incl", "ination", "s", ",", " ", "n", "\\u", "aperture", "s", ",", "\\", "10", ";", " ", " ", " ", " ", "n", "\\u", "wavelengths", ").", " ", "If", " ", "an", " ", "aperture", " ", "or", " ", "incl", "ination", " ", "is", " ", "specified", ",", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "reduce", "s", " ", "the", " ", "number", " ", "of", " ", "dimension", "s", " ", "in", " ", "the", " ", "flux", " ", "cube", ".", " ", "If", " ", "`", "sto", "kes", "`", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "of", " ", "'", "I", "',", " ", "'", "Q", "',", " ", "'", "U", "',", " ", "or", " ", "'", "V", "',", " ", "the", " ", "flux", " ", "is", " ", "eit", "her", " ", "return", "ed", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "erg", "s", "/", "s", " ", "(", "if", " ", "distance", " ", "is", " ", "not", " ", "specified", ")", " ", "or", " ", "in", " ", "the", " ", "unit", "s", " ", "specified", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "unit", "s", "=", " ", "(", "if", " ", "distance", " ", "is", " ", "specified", ").", " ", "If", " ", "`", "sto", "kes", "`", " ", "is", " ", "one", " ", "of", " ", "'", "lin", "pol", "'", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "'", "circ", "pol", "',", " ", "the", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", " ", "is", " ", "return", "ed", " ", "as", " ", "a", " ", "fract", "ion", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "range", " ", "0", " ", "to", " ", "1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "uncertainty", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "uncertain", "ties", " ", "on", " ", "the", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "the", " ", "same", " ", "dimension", "s", " ", "as", " ", "the", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", "\\", "10", ";", " ", " ", " ", " ", "array", ".", " ", "Thi", "s", " ", "is", " ", "only", " ", "return", "ed", " ", "if", " ", "uncertain", "ties", " ", "wer", "e", " ", "request", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "argu", "ment", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "sto", "kes", "_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "sto", "kes", " ", "argu", "ment", " ", "shou", "ld", " ", "be", " ", "a", " ", "string", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "inconsistent", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distance_", "is_", "not_", "None_", "and_", "sto", "kes", "_", "in_", "[_", "'", "lin", "pol", "'_", ",_", "'", "circ", "pol", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Cann", "ot", " ", "scale", " ", "linear", " ", "or", " ", "circular", " ", "polariza", "tion", " ", "degr", "ee", " ", "by", " ", "distance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "technique", "_", "==_", "'", "pee", "led", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "\\u", "groups_", "=_", "len_", "(_", "self_", "._", "file_", "[_", "'", "Pe", "ele", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "group_", "<_", "0_", "and_", "-_", "group_", "<=_", "n", "\\u", "groups_", ")_", "or_", "(_", "group_", ">=_", "0_", "and_", "group_", "<_", "n", "\\u", "groups_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "self_", "._", "file_", "[_", "'", "Pe", "ele", "d", "/", "group", "\\u", "%", "05", "i", "'_", "%_", "(_", "group_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "File", " ", "only", " ", "contain", "s", " ", "%", "i", " ", "image", "/", "SED", " ", "group", "(", "s", ")'_", "%_", "n", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "self_", "._", "file_", "[_", "'", "Bin", "ned", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "'", "sed", "s", "'_", "in_", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Group", " ", "%", "i", " ", "doe", "s", " ", "not", " ", "contain", " ", "any", " ", "SED", "s", "\"_", "%_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "uncertain", "ties", " ", "are", " ", "presen", "t", " ", "if", " ", "requested_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "uncertain", "ties_", "and_", "not_", "'", "sed", "s", "\\u", "unc", "'_", "in_", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Unc", "erta", "inti", "es", " ", "request", "ed", " ", "but", " ", "not", " ", "presen", "t", " ", "in", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "track", "\\u", "orig", "in", "'_", "in_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "attrs_", "and_", "component_", "!=_", "'", "total", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "=_", "self_", "._", "\\u", "get", "\\u", "orig", "in", "\\u", "slice_", "(_", "g_", "[_", "'", "sed", "s", "'_", "]_", ",_", "component_", "=_", "component_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "id_", "=_", "source", "\\u", "id_", ",_", "dust", "\\u", "id_", "=_", "dust", "\\u", "id_", ",_", "n", "\\u", "scat", "_", "=_", "n", "\\u", "scat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "wavelen", "gth", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "use", "\\u", "filter", "s", "'_", "in_", "g_", "._", "attrs_", "and_", "g_", "._", "attrs_", "[_", "'", "use", "\\u", "filter", "s", "'_", "]_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "ye", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nu_", "=_", "g_", "[_", "'", "filt", "\\u", "nu", "0", "'_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav_", "=_", "c_", "/_", "nu_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "num", "in", "'_", "in_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "in_", "=_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "attrs_", "[_", "'", "num", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numa", "x_", "=_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "attrs_", "[_", "'", "numa", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav", "min_", ",_", "wav", "max_", "=_", "c_", "/_", "numa", "x_", "*_", "1.e", "4_", ",_", "c_", "/_", "num", "in_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav_", "=_", "np_", "._", "logs", "pace_", "(_", "np_", "._", "log10_", "(_", "wav", "max_", ")_", ",_", "np_", "._", "log10_", "(_", "wav", "min_", ")_", ",_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "shape_", "[_", "-_", "1_", "]_", "*_", "2_", "+_", "1_", ")_", "[_", "1_", ":_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu_", "=_", "c_", "/_", "wav_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nu_", "=_", "g_", "[_", "'", "freque", "ncie", "s", "'_", "]_", "[_", "'", "nu", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav_", "=_", "c_", "/_", "nu_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flux_", "=_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "g_", "[_", "'", "sed", "s", "\\u", "unc", "'_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insi", "de", "\\u", "observer_", "=_", "g_", "._", "attrs_", "[_", "'", "insi", "de", "\\u", "observer", "'_", "]_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insi", "de", "\\u", "observer_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "insi", "de", "\\u", "observer_", "and_", "distance_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cann", "ot", " ", "speci", "fy", " ", "distance", " ", "for", " ", "insi", "de", " ", "observer", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "default", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "units_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "distance_", "is_", "None_", "and_", "not_", "insi", "de", "\\u", "observer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "units_", "=_", "'", "erg", "s", "/", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "units_", "=_", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", "ly", " ", "scale", " ", "by", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distance_", "is_", "not_", "None_", "or_", "insi", "de", "\\u", "observer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "to", " ", "the", " ", "correct", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "units_", "==_", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "/", "H", "z", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1._", "/_", "nu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "Jy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1.e", "23_", "/_", "nu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "m", "Jy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1.e", "26_", "/_", "nu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "unit", "s", ":", " ", "%", "s", "\"_", "%_", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Scale", " ", "by", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "*=_", "1._", "/_", "(_", "4._", "*_", "pi_", "*_", "distance_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "units_", "!=_", "'", "erg", "s", "/", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sin", "ce", " ", "distance", "=", " ", "is", " ", "not", " ", "specified", ",", " ", "unit", "s", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "erg", "s", "/", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unit", "s", " ", "here", " ", "are", " ", "not", " ", "technical", "ly", " ", "erg", "s", "/", "cm", "^", "2", "/", "s", " ", "but", " ", "erg", "s", "/", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "in", " ", "32", "-", "bit", " ", "mode", ",", " ", "need", " ", "to", " ", "convert", " ", "to", " ", "64", "-", "bit", " ", "bec", "aus", "e", " ", "of", " ", "scal", "ing", "/", "polariza", "tion", " ", "to", " ", "be", " ", "safe_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flux_", "._", "dtype_", "==_", "np_", "._", "float32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "flux_", "._", "astype_", "(_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "uncertain", "ties_", "and_", "unc_", "._", "dtype_", "==_", "np_", "._", "float32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "._", "astype_", "(_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "sto", "kes", " ", "component", " ", "is", " ", "request", "ed", ",", " ", "scale", " ", "the", " ", "images", ".", " ", "Freq", "uenc", "y", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "dimension", ",", " ", "so", " ", "this", " ", "compact", " ", "notation", " ", "can", " ", "be", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sto", "kes", "_", "in_", "STO", "KE", "SD_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "*=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "*=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "slice", " ", "the", " ", "SED", " ", "array", " ", "to", " ", "end", " ", "up", " ", "with", " ", "what", " ", "the", " ", "user", " ", "request", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "slice", " ", "from", " ", "the", " ", "last", " ", "to", " ", "the", " ", "first", " ", "dimension", " ", "to", " ", "ensure", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "alw", "ay", "s", " ", "know", " ", "what", " ", "the", " ", "slice", "s", " ", "are", ".", " ", "In", " ", "this", " ", "section", ",", " ", "we", " ", "make", " ", "use", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "fact", " ", "tha", "t", " ", "whe", "n", " ", "writ", "ing", " ", "array", "[", "i", "]", " ", "with", " ", "a", " ", "multi", "-", "dimension", "al", " ", "array", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "index", " ", "i", " ", "appli", "es", " ", "only", " ", "to", " ", "the", " ", "first", " ", "dimension", ".", " ", "So", " ", "flux", "[", "1", "]", " ", "reall", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "means", " ", "flux", "[", "1", ",", " ", ":,", " ", ":,", " ", ":,", " ", ":]", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "aperture", "_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "aperture", "_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "aperture", " ", "shou", "ld", " ", "be", " ", "an", " ", "integ", "er", " ", "(", "it", " ", "shou", "ld", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "be", " ", "the", " ", "index", " ", "of", " ", "the", " ", "aperture", ",", " ", "not", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", " ", "its", "elf", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flux_", "=_", "flux_", "[_", ":_", ",_", ":_", ",_", ":_", ",_", "aperture", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "[_", ":_", ",_", ":_", ",_", ":_", ",_", "aperture", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "incl", "ination", "_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "incl", "ination", "_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "incl", "ination", " ", "shou", "ld", " ", "be", " ", "an", " ", "integ", "er", " ", "(", "it", " ", "shou", "ld", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "be", " ", "the", " ", "index", " ", "of", " ", "the", " ", "incl", "ination", ",", " ", "not", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", " ", "its", "elf", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flux_", "=_", "flux_", "[_", ":_", ",_", ":_", ",_", "incl", "ination", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "[_", ":_", ",_", ":_", ",_", "incl", "ination", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "correct", " ", "orig", "in", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "component_", "==_", "'", "total", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "np_", "._", "sum_", "(_", "flux_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "unc_", "**_", "2_", ",_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "component_", "in_", "[_", "'", "source", "\\u", "emit", "'_", ",_", "'", "dust", "\\u", "emit", "'_", ",_", "'", "source", "\\u", "scat", "'_", ",_", "'", "dust", "\\u", "scat", "'_", ",_", "'", "dust", "'_", ",_", "'", "source", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "io_", ")_", "is_", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "end_", "=_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux_", "=_", "flux_", "[_", ":_", ",_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "unc_", "=_", "unc_", "[_", ":_", ",_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "component_", "._", "startswith_", "(_", "'", "source", "'_", ")_", "and_", "source", "\\u", "id_", "is_", "None_", ")_", "or_", "(_", "component_", "._", "startswith_", "(_", "'", "dust", "'_", ")_", "and_", "dust", "\\u", "id_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "flux_", "=_", "np_", "._", "sum_", "(_", "flux_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unc_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "unc_", "**_", "2_", ",_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "flux_", "[_", ":_", ",_", "io_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "unc_", "=_", "unc_", "[_", ":_", ",_", "io_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Un", "know", "n", " ", "component", ":", " ", "%", "s", "\"_", "%_", "component_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "correct", " ", "Sto", "kes", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flux_", "._", "shape_", "[_", "0_", "]_", "==_", "1_", "and_", "sto", "kes", "_", "!=_", "'", "I", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "On", "ly", " ", "the", " ", "Sto", "kes", " ", "I", " ", "value", " ", "was", " ", "store", "d", " ", "for", " ", "this", " ", "SED", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sto", "kes", "_", "in_", "STO", "KE", "SD_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "flux_", "[_", "STO", "KE", "SD_", "[_", "sto", "kes", "_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "[_", "STO", "KE", "SD_", "[_", "sto", "kes", "_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sto", "kes", "_", "==_", "'", "lin", "pol", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", ",_", "unc_", "=_", "mc", "\\u", "linear", "\\u", "polariza", "tion_", "(_", "flux_", "[_", "0_", "]_", ",_", "unc_", "[_", "0_", "]_", ",_", "flux_", "[_", "1_", "]_", ",_", "unc_", "[_", "1_", "]_", ",_", "flux_", "[_", "2_", "]_", ",_", "unc_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "np_", "._", "sqrt_", "(_", "(_", "flux_", "[_", "1_", "]_", "**_", "2_", "+_", "flux_", "[_", "2_", "]_", "**_", "2_", ")_", "/_", "flux_", "[_", "0_", "]_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux_", "[_", "np_", "._", "isnan_", "(_", "flux_", ")_", "]_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sto", "kes", "_", "==_", "'", "circ", "pol", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", ",_", "unc_", "=_", "mc", "\\u", "circular", "\\u", "polariza", "tion_", "(_", "flux_", "[_", "0_", "]_", ",_", "unc_", "[_", "0_", "]_", ",_", "flux_", "[_", "3_", "]_", ",_", "unc_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "np_", "._", "abs_", "(_", "flux_", "[_", "3_", "]_", "/_", "flux_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux_", "[_", "np_", "._", "isnan_", "(_", "flux_", ")_", "]_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "Sto", "kes", " ", "parameter", ":", " ", "%", "s", "\"_", "%_", "sto", "kes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "sed_", "import_", "SED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sed_", "=_", "SED", "_", "(_", "nu_", "=_", "nu_", ",_", "val_", "=_", "flux_", ",_", "unc_", "=_", "unc_", "if_", "uncertain", "ties_", "else_", "None_", ",_", "units_", "=_", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "aperture", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "sed_", "._", "ap", "\\u", "min_", "=_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "attrs_", "[_", "'", "ap", "min", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sed_", "._", "ap", "\\u", "max_", "=_", "g_", "[_", "'", "sed", "s", "'_", "]_", "._", "attrs_", "[_", "'", "ap", "max", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "depth", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sed_", "._", "d\\u", "min_", "=_", "g_", "._", "attrs_", "[_", "'", "d\\u", "min", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sed_", "._", "d\\u", "max_", "=_", "g_", "._", "attrs_", "[_", "'", "d\\u", "max", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "#", " ", "Old", "er", " ", "version", "s", " ", "of", " ", "Hyper", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sed_", "._", "d\\u", "min_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sed_", "._", "d\\u", "max_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sed_", "._", "distance_", "=_", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "whe", "ther", " ", "the", " ", "SED", " ", "was", " ", "from", " ", "an", " ", "insi", "de", " ", "observer_", "\\u\\u\\uNL\\u\\u\\u_", "sed_", "._", "insi", "de", "\\u", "observer_", "=_", "insi", "de", "\\u", "observer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "sed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Output_", "(_", "Freez", "able", "Class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "on", "\\u", "the", "\\u", "fly", "\\u", "hdf5", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "image_", "(_", "self_", ",_", "sto", "kes", "_", "=_", "'", "I", "'_", ",_", "group_", "=_", "0_", ",_", "technique", "_", "=_", "'", "pee", "led", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distance_", "=_", "None_", ",_", "component_", "=_", "'", "total", "'_", ",_", "incl", "ination", "_", "=_", "'", "all", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "uncertain", "ties_", "=_", "False_", ",_", "units_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "id_", "=_", "None_", ",_", "dust", "\\u", "id_", "=_", "None_", ",_", "n", "\\u", "scat", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", " ", "images", " ", "for", " ", "a", " ", "specific", " ", "image", " ", "group", " ", "and", " ", "Sto", "kes", " ", "component", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "sto", "kes", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Sto", "kes", " ", "component", " ", "to", " ", "return", ".", " ", "Thi", "s", " ", "can", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "I", "':", " ", "Total", " ", "intensity", " ", "[", "default", "]", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "Q", "':", " ", "Q", " ", "Sto", "kes", " ", "parameter", " ", "(", "linear", " ", "polariza", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "U", "':", " ", "U", " ", "Sto", "kes", " ", "parameter", " ", "(", "linear", " ", "polariza", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "V", "':", " ", "V", " ", "Sto", "kes", " ", "parameter", " ", "(", "circular", " ", "polariza", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "lin", "pol", "':", " ", " ", "Total", " ", "linear", " ", "polariza", "tion", " ", "fract", "ion", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "circ", "pol", "':", " ", "Total", " ", "circular", " ", "polar", "iation", " ", "fract", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "if", " ", "the", " ", "image", " ", "was", " ", "set", " ", "up", " ", "with", " ", "``", "set\\u", "sto", "kes", "(", "Fal", "se", ")`", "`", ",", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "the", " ", "``", "I", "``", " ", "component", " ", "is", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "technique", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "retrieve", " ", "an", " ", "image", " ", "compute", "d", " ", "with", " ", "photon", " ", "pee", "ling", "-", "off", "\\", "10", ";", " ", " ", " ", " ", "('", "pee", "led", "')", " ", "or", " ", "binning", " ", "('", "binned", "')", ".", " ", "Default", " ", "is", " ", "'", "pee", "led", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "group", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "pee", "lof", "f", " ", "group", " ", "(", "zero", "-", "based", ").", " ", "If", " ", "multiple", " ", "pee", "lof", "f", " ", "image", " ", "group", "s", "\\", "10", ";", " ", " ", " ", " ", "wer", "e", " ", "request", "ed", ",", " ", "this", " ", "can", " ", "be", " ", "used", " ", "to", " ", "select", " ", "bet", "ween", " ", "them", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "default", " ", "is", " ", "to", " ", "return", " ", "the", " ", "first", " ", "group", ".", " ", "Thi", "s", " ", "option", " ", "is", " ", "only", " ", "used", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "technique", "='", "pee", "led", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "distance", " ", ":", " ", "float", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "distance", " ", "to", " ", "the", " ", "observer", ",", " ", "in", " ", "cm", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "component", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "component", " ", "to", " ", "return", " ", "based", " ", "on", " ", "orig", "in", " ", "and", " ", "last", " ", "interacti", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "can", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "total", "':", " ", "Total", " ", "flux", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "source", "\\u", "emit", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "a", " ", "source", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "and", " ", "did", " ", "not", " ", "under", "go", " ", "any", " ", "subsequen", "t", " ", "interacti", "ons", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "dust", "\\u", "emit", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "dust", " ", "and", " ", "did", " ", "not", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "under", "go", " ", "any", " ", "subsequen", "t", " ", "interacti", "ons", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "source", "\\u", "scat", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "a", " ", "source", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "and", " ", "wer", "e", " ", "subsequen", "tl", "y", " ", "scatter", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "dust", "\\u", "scat", "':", " ", "The", " ", "photon", "s", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "dust", " ", "and", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "wer", "e", " ", "subsequen", "tl", "y", " ", "scatter", "ed", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "source", "':", " ", "The", " ", "photon", "s", " ", "tha", "t", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "a", " ", "source", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "'", "dust", "':", " ", "The", " ", "photon", "s", " ", "tha", "t", " ", "wer", "e", " ", "last", " ", "emitte", "d", " ", "from", " ", "dust", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "incl", "ination", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "index", " ", "of", " ", "the", " ", "viewin", "g", " ", "angle", " ", "to", " ", "plot", " ", "(", "zero", "-", "based", ").", " ", "Us", "e", " ", "'", "all", "'", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "return", " ", "all", " ", "viewin", "g", " ", "angle", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "uncertain", "ties", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Whe", "ther", " ", "to", " ", "compute", " ", "and", " ", "return", " ", "uncertain", "ties", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "unit", "s", " ", ":", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "output", " ", "unit", "s", " ", "for", " ", "the", " ", "image", "(", "s", ").", " ", "Valid", " ", "options", " ", "if", " ", "a", " ", "distance", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "specified", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "/", "H", "z", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "Jy", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "m", "Jy", "'``", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "'", "MJ", "y", "/", "sr", "'``", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "``", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'``", ".", " ", "If", " ", "a", " ", "distance", " ", "is", " ", "not", " ", "specified", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "this", " ", "option", " ", "is", " ", "ignore", "d", ",", " ", "and", " ", "the", " ", "output", " ", "unit", "s", " ", "are", " ", "erg", "s", "/", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "source", "\\u", "id", ",", " ", "dust", "\\u", "id", " ", ":", " ", "int", " ", "or", " ", "str", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "output", " ", "file", " ", "was", " ", "made", " ", "with", " ", "track", "\\u", "orig", "in", "='", "detailed", "',", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "specific", " ", "source", " ", "and", " ", "dust", " ", "component", " ", "can", " ", "be", " ", "specified", " ", "(", "where", " ", "0", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "first", " ", "source", " ", "or", " ", "dust", " ", "type", ").", " ", "If", " ", "'", "all", "'", " ", "is", " ", "specified", ",", " ", "then", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "component", "s", " ", "are", " ", "return", "ed", " ", "individual", "ly", ".", " ", "If", " ", "nei", "ther", " ", "of", " ", "these", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "specified", ",", " ", "then", " ", "the", " ", "total", " ", "component", " ", "request", "ed", " ", "for", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "source", "s", " ", "or", " ", "dust", " ", "types", " ", "is", " ", "return", "ed", ".", " ", "For", " ", "source", "s", ",", " ", "it", " ", "is", " ", "als", "o", " ", "possib", "le", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "speci", "fy", " ", "a", " ", "source", " ", "name", " ", "as", " ", "a", " ", "string", ",", " ", "if", " ", "the", " ", "source", " ", "name", " ", "was", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "dur", "ing", " ", "the", " ", "set", "-", "up", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "n", "\\u", "scat", " ", ":", " ", "int", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "output", " ", "file", " ", "was", " ", "made", " ", "with", " ", "track", "\\u", "orig", "in", "='", "scatter", "ings", "',", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "of", " ", "scatter", "ings", " ", "can", " ", "be", " ", "specified", " ", "here", ".", " ", "If", " ", "specified", ",", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "image", " ", "is", " ", "construct", "ed", " ", "only", " ", "from", " ", "photon", "s", " ", "tha", "t", " ", "have", " ", "scatter", "ed", "\\", "10", ";", " ", " ", " ", " ", "``", "n", "\\u", "scat", "``", " ", "times", " ", "sinc", "e", " ", "bei", "ng", " ", "last", " ", "emitte", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "wav", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "wavelengths", " ", "for", " ", "whi", "ch", " ", "the", " ", "SED", "s", " ", "are", " ", "defin", "ed", ",", " ", "in", " ", "micro", "ns", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "data", " ", "cube", " ", "whi", "ch", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "at", " ", "most", " ", "three", " ", "dimension", "s", " ", "(", "n", "\\u", "incl", "ination", "s", ",", " ", "n", "\\u", "wavelengths", ").", " ", "If", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "aperture", " ", "or", " ", "incl", "ination", " ", "is", " ", "specified", ",", " ", "this", " ", "reduce", "s", " ", "the", " ", "number", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "dimension", "s", " ", "in", " ", "the", " ", "flux", " ", "cube", ".", " ", "If", " ", "`", "sto", "kes", "`", " ", "is", " ", "one", " ", "of", " ", "'", "I", "',", " ", "'", "Q", "',", " ", "'", "U", "',", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "'", "V", "',", " ", "the", " ", "flux", " ", "is", " ", "eit", "her", " ", "return", "ed", " ", "in", " ", "erg", "s", "/", "s", " ", "(", "if", " ", "distance", " ", "is", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "specified", ")", " ", "or", " ", "in", " ", "the", " ", "unit", "s", " ", "specified", " ", "by", " ", "unit", "s", "=", " ", "(", "if", " ", "distance", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "specified", ").", " ", "If", " ", "`", "sto", "kes", "`", " ", "is", " ", "one", " ", "of", " ", "'", "lin", "pol", "'", " ", "or", " ", "'", "circ", "pol", "',", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", " ", "is", " ", "return", "ed", " ", "as", " ", "a", " ", "fract", "ion", " ", "in", " ", "the", " ", "range", " ", "0", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "1", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "uncertainty", " ", ":", " ", "nump", "y", ".", "ndar", "ray", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "uncertain", "ties", " ", "on", " ", "the", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "the", " ", "same", " ", "dimension", "s", " ", "as", " ", "the", " ", "flux", " ", "or", " ", "degr", "ee", " ", "of", " ", "polariza", "tion", "\\", "10", ";", " ", " ", " ", " ", "array", ".", " ", "Thi", "s", " ", "is", " ", "only", " ", "return", "ed", " ", "if", " ", "uncertain", "ties", " ", "wer", "e", " ", "request", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "argu", "ment", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "sto", "kes", "_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "sto", "kes", " ", "argu", "ment", " ", "shou", "ld", " ", "be", " ", "a", " ", "string", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "inconsistent", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distance_", "is_", "not_", "None_", "and_", "sto", "kes", "_", "in_", "[_", "'", "lin", "pol", "'_", ",_", "'", "circ", "pol", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Cann", "ot", " ", "scale", " ", "linear", " ", "or", " ", "circular", " ", "polariza", "tion", " ", "degr", "ee", " ", "by", " ", "distance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "technique", "_", "==_", "'", "pee", "led", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n", "\\u", "groups_", "=_", "len_", "(_", "self_", "._", "file_", "[_", "'", "Pe", "ele", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "group_", "<_", "0_", "and_", "-_", "group_", "<=_", "n", "\\u", "groups_", ")_", "or_", "(_", "group_", ">=_", "0_", "and_", "group_", "<_", "n", "\\u", "groups_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "self_", "._", "file_", "[_", "'", "Pe", "ele", "d", "/", "group", "\\u", "%", "05", "i", "'_", "%_", "(_", "group_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "File", " ", "only", " ", "contain", "s", " ", "%", "i", " ", "image", "/", "SED", " ", "group", "(", "s", ")'_", "%_", "n", "\\u", "groups_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "=_", "self_", "._", "file_", "[_", "'", "Bin", "ned", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "'", "images", "'_", "in_", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Group", " ", "%", "i", " ", "doe", "s", " ", "not", " ", "contain", " ", "any", " ", "images", "\"_", "%_", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "uncertain", "ties", " ", "are", " ", "presen", "t", " ", "if", " ", "requested_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "uncertain", "ties_", "and_", "not_", "'", "images", "\\u", "unc", "'_", "in_", "g_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Unc", "erta", "inti", "es", " ", "request", "ed", " ", "but", " ", "not", " ", "presen", "t", " ", "in", " ", "file", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "track", "\\u", "orig", "in", "'_", "in_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "and_", "component_", "!=_", "'", "total", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "io_", "=_", "self_", "._", "\\u", "get", "\\u", "orig", "in", "\\u", "slice_", "(_", "g_", "[_", "'", "images", "'_", "]_", ",_", "component_", "=_", "component_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "id_", "=_", "source", "\\u", "id_", ",_", "dust", "\\u", "id_", "=_", "dust", "\\u", "id_", ",_", "n", "\\u", "scat", "_", "=_", "n", "\\u", "scat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "wavelen", "gth", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "use", "\\u", "filter", "s", "'_", "in_", "g_", "._", "attrs_", "and_", "g_", "._", "attrs_", "[_", "'", "use", "\\u", "filter", "s", "'_", "]_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "ye", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nu_", "=_", "g_", "[_", "'", "filt", "\\u", "nu", "0", "'_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav_", "=_", "c_", "/_", "nu_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "num", "in", "'_", "in_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "in_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "num", "in", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numa", "x_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "numa", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav", "min_", ",_", "wav", "max_", "=_", "c_", "/_", "numa", "x_", "*_", "1.e", "4_", ",_", "c_", "/_", "num", "in_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav_", "=_", "np_", "._", "logs", "pace_", "(_", "np_", "._", "log10_", "(_", "wav", "max_", ")_", ",_", "np_", "._", "log10_", "(_", "wav", "min_", ")_", ",_", "g_", "[_", "'", "images", "'_", "]_", "._", "shape_", "[_", "-_", "1_", "]_", "*_", "2_", "+_", "1_", ")_", "[_", "1_", ":_", ":_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu_", "=_", "c_", "/_", "wav_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nu_", "=_", "g_", "[_", "'", "freque", "ncie", "s", "'_", "]_", "[_", "'", "nu", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav_", "=_", "c_", "/_", "nu_", "*_", "1.e", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flux_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "g_", "[_", "'", "images", "\\u", "unc", "'_", "]_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insi", "de", "\\u", "observer_", "=_", "g_", "._", "attrs_", "[_", "'", "insi", "de", "\\u", "observer", "'_", "]_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "._", "lower_", "(_", ")_", "==_", "'", "ye", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "insi", "de", "\\u", "observer_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "insi", "de", "\\u", "observer_", "and_", "distance_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Cann", "ot", " ", "speci", "fy", " ", "distance", " ", "for", " ", "insi", "de", " ", "observer", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "default", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "units_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "distance_", "is_", "None_", "and_", "not_", "insi", "de", "\\u", "observer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "units_", "=_", "'", "erg", "s", "/", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "units_", "=_", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "pixel", " ", "dimension", "s", " ", "of", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ny_", ",_", "nx_", "=_", "flux_", "._", "shape_", "[_", "-_", "3_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "physical", " ", "and", " ", "angular", " ", "extent", ",", " ", "and", " ", "pixel", " ", "area", " ", "in", " ", "ster", "adi", "ans_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "insi", "de", "\\u", "observer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Phys", "ical", " ", "extent", " ", "cann", "ot", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "min_", "=_", "x", "\\u", "max_", "=_", "y", "\\u", "min_", "=_", "y", "\\u", "max_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "extent", " ", "of", " ", "the", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "lon", "\\u", "min_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "xmi", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lon", "\\u", "max_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "xma", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat", "\\u", "min_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "ymin", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat", "\\u", "max_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "ymax", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "construct", " ", "a", " ", "mesh", " ", "sinc", "e", " ", "every", " ", "pixel", " ", "mig", "ht", " ", "have", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "different", " ", "size_", "\\u\\u\\uNL\\u\\u\\u_", "lon_", "=_", "np_", "._", "linspace_", "(_", "np_", "._", "radians_", "(_", "lon", "\\u", "min_", ")_", ",_", "np_", "._", "radians_", "(_", "lon", "\\u", "max_", ")_", ",_", "nx_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat_", "=_", "np_", "._", "cos_", "(_", "np_", "._", "linspace_", "(_", "np_", "._", "radians_", "(_", "90.", "_", "-_", "lat", "\\u", "min_", ")_", ",_", "np_", "._", "radians_", "(_", "90.", "_", "-_", "lat", "\\u", "max_", ")_", ",_", "ny_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dlo", "n_", "=_", "lon_", "[_", "1_", ":_", "]_", "-_", "lon_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dla", "t_", "=_", "lat_", "[_", ":_", "-_", "1_", "]_", "-_", "lat_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DL", "ON_", ",_", "DL", "AT_", "=_", "np_", "._", "meshgrid_", "(_", "dlo", "n_", ",_", "dla", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "pixel", " ", "area", " ", "in", " ", "ster", "adi", "ans_", "\\u\\u\\uNL\\u\\u\\u_", "pix", "\\u", "area", "\\u", "sr_", "=_", "DL", "ON_", "*_", "DL", "AT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "physical", " ", "extent", " ", "of", " ", "the", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x", "\\u", "min_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "xmi", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "max_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "xma", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "min_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "ymin", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "max_", "=_", "g_", "[_", "'", "images", "'_", "]_", "._", "attrs_", "[_", "'", "ymax", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "distance_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "angular", " ", "extent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lon", "\\u", "min", "\\u", "rad_", "=_", "np_", "._", "arctan", "_", "(_", "x", "\\u", "min_", "/_", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lon", "\\u", "max", "\\u", "rad_", "=_", "np_", "._", "arctan", "_", "(_", "x", "\\u", "max_", "/_", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat", "\\u", "min", "\\u", "rad_", "=_", "np_", "._", "arctan", "_", "(_", "y", "\\u", "min_", "/_", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat", "\\u", "max", "\\u", "rad_", "=_", "np_", "._", "arctan", "_", "(_", "y", "\\u", "max_", "/_", "distance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "pixel", " ", "size", " ", "in", " ", "arcsec", "ond", "s_", "\\u\\u\\uNL\\u\\u\\u_", "pix", "\\u", "dx_", "=_", "abs_", "(_", "lon", "\\u", "max", "\\u", "rad_", "-_", "lon", "\\u", "min", "\\u", "rad_", ")_", "/_", "float_", "(_", "nx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pix", "\\u", "dy_", "=_", "abs_", "(_", "lat", "\\u", "max", "\\u", "rad_", "-_", "lat", "\\u", "min", "\\u", "rad_", ")_", "/_", "float_", "(_", "ny_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "pixel", " ", "area", " ", "in", " ", "ster", "adi", "ans_", "\\u\\u\\uNL\\u\\u\\u_", "pix", "\\u", "area", "\\u", "sr_", "=_", "pix", "\\u", "dx_", "*_", "pix", "\\u", "dy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "angular", " ", "extent", " ", "in", " ", "degrees_", "\\u\\u\\uNL\\u\\u\\u_", "lon", "\\u", "min_", "=_", "np_", "._", "degrees_", "(_", "lon", "\\u", "min", "\\u", "rad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lon", "\\u", "max_", "=_", "np_", "._", "degrees_", "(_", "lon", "\\u", "max", "\\u", "rad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat", "\\u", "min_", "=_", "np_", "._", "degrees_", "(_", "lat", "\\u", "min", "\\u", "rad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lat", "\\u", "max_", "=_", "np_", "._", "degrees_", "(_", "lat", "\\u", "max", "\\u", "rad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Angul", "ar", " ", "extent", " ", "cann", "ot", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lon", "\\u", "min_", "=_", "lon", "\\u", "max_", "=_", "lat", "\\u", "min_", "=_", "lat", "\\u", "max_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pix", "el", " ", "area", " ", "in", " ", "ster", "adi", "ans", " ", "cann", "ot", " ", "be", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "pix", "\\u", "area", "\\u", "sr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", "ly", " ", "scale", " ", "by", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distance_", "is_", "not_", "None_", "or_", "insi", "de", "\\u", "observer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Convert", " ", "to", " ", "the", " ", "correct", " ", "units_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "units_", "==_", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "erg", "s", "/", "cm", "^", "2", "/", "s", "/", "H", "z", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1._", "/_", "nu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "Jy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1.e", "23_", "/_", "nu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "m", "Jy", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "=_", "1.e", "26_", "/_", "nu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "units_", "==_", "'", "MJ", "y", "/", "sr", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "insi", "de", "\\u", "observer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "scale_", "=_", "1.e", "17_", "/_", "nu_", "[_", "np_", "._", "newaxis_", ",_", "np_", "._", "newaxis_", ",_", ":_", "]_", "/_", "pix", "\\u", "area", "\\u", "sr_", "[_", ":_", ",_", ":_", ",_", "np_", "._", "newaxis_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "scale_", "=_", "1.e", "17_", "/_", "nu_", "/_", "pix", "\\u", "area", "\\u", "sr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "unit", "s", ":", " ", "%", "s", "\"_", "%_", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Scale", " ", "by", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "distance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scale_", "*=_", "1._", "/_", "(_", "4._", "*_", "pi_", "*_", "distance_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "units_", "!=_", "'", "erg", "s", "/", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Sin", "ce", " ", "distance", "=", " ", "is", " ", "not", " ", "specified", ",", " ", "unit", "s", " ", "shou", "ld", " ", "be", " ", "set", " ", "to", " ", "erg", "s", "/", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scale_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "in", " ", "32", "-", "bit", " ", "mode", ",", " ", "need", " ", "to", " ", "convert", " ", "to", " ", "64", "-", "bit", " ", "bec", "aus", "e", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "scal", "ing", "/", "polariza", "tion", " ", "to", " ", "be", " ", "safe_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flux_", "._", "dtype_", "==_", "np_", "._", "float32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "flux_", "._", "astype_", "(_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "uncertain", "ties_", "and_", "unc_", "._", "dtype_", "==_", "np_", "._", "float32_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "._", "astype_", "(_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "sto", "kes", " ", "component", " ", "is", " ", "request", "ed", ",", " ", "scale", " ", "the", " ", "images", ".", " ", "Freq", "uenc", "y", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "last", " ", "dimension", ",", " ", "so", " ", "this", " ", "compact", " ", "notation", " ", "can", " ", "be", " ", "used", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sto", "kes", "_", "in_", "STO", "KE", "SD_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "*=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "*=_", "scale_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "now", " ", "slice", " ", "the", " ", "image", " ", "array", " ", "to", " ", "end", " ", "up", " ", "with", " ", "what", " ", "the", " ", "user", " ", "request", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "slice", " ", "from", " ", "the", " ", "last", " ", "to", " ", "the", " ", "first", " ", "dimension", " ", "to", " ", "ensure", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "alw", "ay", "s", " ", "know", " ", "what", " ", "the", " ", "slice", "s", " ", "are", ".", " ", "In", " ", "this", " ", "section", ",", " ", "we", " ", "make", " ", "use", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "fact", " ", "tha", "t", " ", "whe", "n", " ", "writ", "ing", " ", "array", "[", "i", "]", " ", "with", " ", "a", " ", "multi", "-", "dimension", "al", " ", "array", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "index", " ", "i", " ", "appli", "es", " ", "only", " ", "to", " ", "the", " ", "first", " ", "dimension", ".", " ", "So", " ", "flux", "[", "1", "]", " ", "reall", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "means", " ", "flux", "[", "1", ",", " ", ":,", " ", ":,", " ", ":,", " ", ":]", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "incl", "ination", "_", "==_", "'", "all", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "incl", "ination", "_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "incl", "ination", " ", "shou", "ld", " ", "be", " ", "an", " ", "integ", "er", " ", "(", "it", " ", "shou", "ld", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "be", " ", "the", " ", "index", " ", "of", " ", "the", " ", "incl", "ination", ",", " ", "not", " ", "the", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", " ", "its", "elf", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "flux_", "=_", "flux_", "[_", ":_", ",_", ":_", ",_", "incl", "ination", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "[_", ":_", ",_", ":_", ",_", "incl", "ination", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "correct", " ", "orig", "in", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "component_", "==_", "'", "total", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "np_", "._", "sum_", "(_", "flux_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "unc_", "**_", "2_", ",_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "component_", "in_", "[_", "'", "source", "\\u", "emit", "'_", ",_", "'", "dust", "\\u", "emit", "'_", ",_", "'", "source", "\\u", "scat", "'_", ",_", "'", "dust", "\\u", "scat", "'_", ",_", "'", "dust", "'_", ",_", "'", "source", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "io_", ")_", "is_", "tuple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "end_", "=_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux_", "=_", "flux_", "[_", ":_", ",_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "unc_", "=_", "unc_", "[_", ":_", ",_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "component_", "._", "startswith_", "(_", "'", "source", "'_", ")_", "and_", "source", "\\u", "id_", "is_", "None_", ")_", "or_", "(_", "component_", "._", "startswith_", "(_", "'", "dust", "'_", ")_", "and_", "dust", "\\u", "id_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "flux_", "=_", "np_", "._", "sum_", "(_", "flux_", ",_", "axis_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "unc_", "=_", "np_", "._", "sqrt_", "(_", "np_", "._", "sum_", "(_", "unc_", "**_", "2_", ",_", "axis_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "flux_", "[_", ":_", ",_", "io_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "unc_", "=_", "unc_", "[_", ":_", ",_", "io_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Un", "know", "n", " ", "component", ":", " ", "%", "s", "\"_", "%_", "component_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Select", " ", "correct", " ", "Sto", "kes", " ", "component_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flux_", "._", "shape_", "[_", "0_", "]_", "==_", "1_", "and_", "sto", "kes", "_", "!=_", "'", "I", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "On", "ly", " ", "the", " ", "Sto", "kes", " ", "I", " ", "value", " ", "was", " ", "store", "d", " ", "for", " ", "this", " ", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sto", "kes", "_", "in_", "STO", "KE", "SD_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "flux_", "[_", "STO", "KE", "SD_", "[_", "sto", "kes", "_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unc_", "=_", "unc_", "[_", "STO", "KE", "SD_", "[_", "sto", "kes", "_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sto", "kes", "_", "==_", "'", "lin", "pol", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", ",_", "unc_", "=_", "mc", "\\u", "linear", "\\u", "polariza", "tion_", "(_", "flux_", "[_", "0_", "]_", ",_", "unc_", "[_", "0_", "]_", ",_", "flux_", "[_", "1_", "]_", ",_", "unc_", "[_", "1_", "]_", ",_", "flux_", "[_", "2_", "]_", ",_", "unc_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "np_", "._", "sqrt_", "(_", "(_", "flux_", "[_", "1_", "]_", "**_", "2_", "+_", "flux_", "[_", "2_", "]_", "**_", "2_", ")_", "/_", "flux_", "[_", "0_", "]_", "**_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux_", "[_", "np_", "._", "isnan_", "(_", "flux_", ")_", "]_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sto", "kes", "_", "==_", "'", "circ", "pol", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "uncertain", "ties_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", ",_", "unc_", "=_", "mc", "\\u", "circular", "\\u", "polariza", "tion_", "(_", "flux_", "[_", "0_", "]_", ",_", "unc_", "[_", "0_", "]_", ",_", "flux_", "[_", "3_", "]_", ",_", "unc_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flux_", "=_", "np_", "._", "abs_", "(_", "flux_", "[_", "3_", "]_", "/_", "flux_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flux_", "[_", "np_", "._", "isnan_", "(_", "flux_", ")_", "]_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Un", "know", "n", " ", "Sto", "kes", " ", "parameter", ":", " ", "%", "s", "\"_", "%_", "sto", "kes", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "image_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "Image_", "(_", "nu_", "=_", "nu_", ",_", "val_", "=_", "flux_", ",_", "unc_", "=_", "unc_", "if_", "uncertain", "ties_", "else_", "None_", ",_", "units_", "=_", "units_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "physical", " ", "extent_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "x", "\\u", "min_", "=_", "x", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "x", "\\u", "max_", "=_", "x", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "y", "\\u", "min_", "=_", "y", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "y", "\\u", "max_", "=_", "y", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "depth", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "._", "d\\u", "min_", "=_", "g_", "._", "attrs_", "[_", "'", "d\\u", "min", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "d\\u", "max_", "=_", "g_", "._", "attrs_", "[_", "'", "d\\u", "max", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "#", " ", "Old", "er", " ", "version", "s", " ", "of", " ", "Hyper", "ion_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "._", "d\\u", "min_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "d\\u", "max_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "angular", " ", "extent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image_", "._", "lon", "\\u", "min_", "=_", "lon", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "lon", "\\u", "max_", "=_", "lon", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "lat", "\\u", "min_", "=_", "lat", "\\u", "min_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "._", "lat", "\\u", "max_", "=_", "lat", "\\u", "max_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "pixel", " ", "area", " ", "in", " ", "ster", "adi", "ans_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "pix", "\\u", "area", "\\u", "sr_", "=_", "pix", "\\u", "area", "\\u", "sr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "distance_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "distance_", "=_", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "whe", "ther", " ", "the", " ", "image", " ", "was", " ", "from", " ", "an", " ", "insi", "de", " ", "observer_", "\\u\\u\\uNL\\u\\u\\u_", "image_", "._", "insi", "de", "\\u", "observer_", "=_", "insi", "de", "\\u", "observer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
babble/babble/include/jython/Lib/test/test_zipimport.py
[ { "content": " def doTraceback(self, module):\n try:\n module.do_raise()\n except:\n tb = sys.exc_info()[2].tb_next\n\n f,lno,n,line = extract_tb(tb, 1)[0]\n self.assertEqual(line, raise_src.strip())\n\n f,lno,n,line = extract_stack(tb.tb_frame, 1)[0]\n self.assertEqual(line, raise_src.strip())\n\n s = StringIO.StringIO()\n print_tb(tb, 1, s)\n self.failUnless(s.getvalue().endswith(raise_src))\n else:\n raise AssertionError(\"This ought to be impossible\")", "metadata": "root.UncompressedZipImportTestCase.doTraceback", "header": "['class', 'UncompressedZipImportTestCase', '(', 'ImportHooksBaseTestCase', ')', ':', '___EOS___']", "index": 307 } ]
[ { "span": "except:", "start_line": 310, "start_column": 8, "end_line": 310, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Unco", "mpr", "esse", "d", "Zip", "Import", "Test", "Case_", "(_", "Import", "Hook", "s", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "Trace", "back_", "(_", "self_", ",_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "._", "do", "\\u", "raise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tb_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", ",_", "lno", "_", ",_", "n_", ",_", "line_", "=_", "extract", "\\u", "tb_", "(_", "tb_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "raise", "\\u", "src_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", ",_", "lno", "_", ",_", "n_", ",_", "line_", "=_", "extract", "\\u", "stack_", "(_", "tb_", "._", "tb", "\\u", "frame_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "line_", ",_", "raise", "\\u", "src_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print", "\\u", "tb_", "(_", "tb_", ",_", "1_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Unless_", "(_", "s_", "._", "getvalue_", "(_", ")_", "._", "endswith_", "(_", "raise", "\\u", "src_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Thi", "s", " ", "ou", "ght", " ", "to", " ", "be", " ", "impossible", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
agiliq/Dinette/forum/settings_travis.py
[ { "content": "# Django settings for forum project.\n\nDEBUG = True\nTEMPLATE_DEBUG = DEBUG\n\nADMINS = (\n # ('Your Name', '[email protected]'),\n)\n\nMANAGERS = ADMINS\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.\n 'NAME': 'dinette.db', # Or path to database file if using sqlite3.\n 'USER': '', # Not used with sqlite3.\n 'PASSWORD': '', # Not used with sqlite3.\n 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.\n 'PORT': '', # Set to empty string for default. Not used with sqlite3.\n }\n}\n\n# Local time zone for this installation. Choices can be found here:\n# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name\n# although not all choices may be available on all operating systems.\n# On Unix systems, a value of None will cause Django to use the same\n# timezone as the operating system.\n# If running in a Windows environment this must be set to the same as your\n# system time zone.\nTIME_ZONE = 'America/Chicago'\n\n# Language code for this installation. All choices can be found here:\n# http://www.i18nguy.com/unicode/language-identifiers.html\nLANGUAGE_CODE = 'en-us'\n\nSITE_ID = 1\n\n# If you set this to False, Django will make some optimizations so as not\n# to load the internationalization machinery.\nUSE_I18N = True\n\n# If you set this to False, Django will not format dates, numbers and\n# calendars according to the current locale\nUSE_L10N = True\n\n# Absolute path to the directory that holds media.\n# Example: \"/home/media/media.lawrence.com/\"\nMEDIA_ROOT = 'dinette/media/'\n\n# URL that handles the media served from MEDIA_ROOT. Make sure to use a\n# trailing slash if there is a path component (optional in other cases).\n# Examples: \"http://media.lawrence.com\", \"http://example.com/media/\"\nMEDIA_URL = '/site_media/'\n\n# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a\n# trailing slash.\n# Examples: \"http://foo.com/media/\", \"/media/\".\nADMIN_MEDIA_PREFIX = '/media/'\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = '9oezy17)u&_!3n%@qb^iqz%ur2%v(5=0uas@@#4)=n@5xy3m1j'\n\n# List of callables that know how to import templates from various sources.\nTEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n# 'django.template.loaders.eggs.Loader',\n)\n\nMIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n 'pagination.middleware.PaginationMiddleware',\n)\n\nROOT_URLCONF = 'urls'\n\nTEMPLATE_DIRS = (\n # Put strings here, like \"/home/html/django_templates\" or \"C:/www/django/templates\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n)\nTEMPLATE_CONTEXT_PROCESSORS = (\n 'django.contrib.auth.context_processors.auth',\n 'django.core.context_processors.debug',\n 'django.core.context_processors.i18n',\n 'django.core.context_processors.media',\n 'django.contrib.messages.context_processors.messages',\n 'django.core.context_processors.request',\n 'django.core.context_processors.static',\n)\n\n\n\nINSTALLED_APPS = (\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n 'django.contrib.messages',\n # Uncomment the next line to enable the admin:\n 'django.contrib.admin',\n 'django.contrib.staticfiles',\n 'dinette',\n\n 'compressor',\n 'sorl.thumbnail',\n 'pagination'\n)\n\n\nDATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.\n 'NAME': 'dev.db', # Or path to database file if using sqlite3.\n 'USER': '', # Not used with sqlite3.\n 'PASSWORD': '', # Not used with sqlite3.\n 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.\n 'PORT': '', # Set to empty string for default. Not used with sqlite3.\n }\n}\n\nfrom dinette.extra_settings import *\n\nimport os\nfrom subprocess import call\n\nfrom markupfield.markup import DEFAULT_MARKUP_TYPES\nfrom dinette.libs.postmarkup import render_bbcode\nfrom settings import STATIC_ROOT\n\nCOMPRESS = False\nDEFAULT_MARKUP_TYPES.append(('bbcode', render_bbcode))\nMARKUP_RENDERERS = DEFAULT_MARKUP_TYPES\nDEFAULT_MARKUP_TYPE = \"bbcode\"\n\nAUTH_PROFILE_MODULE = \"dinette.DinetteUserProfile\"\nREPLY_PAGE_SIZE = 10\nFLOOD_TIME = 0\nSTATICFILES_FINDERS = (\n 'django.contrib.staticfiles.finders.FileSystemFinder',\n 'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n 'compressor.finders.CompressorFinder',\n)\nSTATIC_URL = '/static/'\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "DATABASES ", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 9 } ]
[ { "span": "DATABASES ", "start_line": 114, "start_column": 0, "end_line": 114, "end_column": 9 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "settings", " ", "for", " ", "forum", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DEBUG_", "=_", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ADMINS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "('", "You", "r", " ", "Name", "',", " ", "'", "your", "\\u", "email", "@", "domain", ".", "com", "')", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MANAGER", "S_", "=_", "ADMINS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DATABASES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "sql", "ite", "3", "'_", ",_", "#", " ", "Add", " ", "'", "postgres", "ql", "\\u", "psy", "cop", "g2", "',", " ", "'", "postgres", "ql", "',", " ", "'", "mysql", "',", " ", "'", "sql", "ite", "3", "'", " ", "or", " ", "'", "oracle", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "din", "ette", ".", "db", "'_", ",_", "#", " ", "Or", " ", "path", " ", "to", " ", "databa", "se", " ", "file", " ", "if", " ", "usi", "ng", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "USER", "'_", ":_", "''_", ",_", "#", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "PASS", "WORD", "'_", ":_", "''_", ",_", "#", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOST", "'_", ":_", "''_", ",_", "#", " ", "Set", " ", "to", " ", "empty", " ", "string", " ", "for", " ", "local", "host", ".", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "PORT", "'_", ":_", "''_", ",_", "#", " ", "Set", " ", "to", " ", "empty", " ", "string", " ", "for", " ", "default", ".", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Local", " ", "time", " ", "zone", " ", "for", " ", "this", " ", "installation", ".", " ", "Choi", "ces", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "List", "\\u", "of", "\\u", "tz", "\\u", "zone", "s", "\\u", "by", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alth", "ou", "gh", " ", "not", " ", "all", " ", "choice", "s", " ", "may", " ", "be", " ", "avail", "able", " ", "on", " ", "all", " ", "operati", "ng", " ", "system", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "Uni", "x", " ", "system", "s", ",", " ", "a", " ", "value", " ", "of", " ", "Non", "e", " ", "will", " ", "caus", "e", " ", "Dj", "ang", "o", " ", "to", " ", "use", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "timezon", "e", " ", "as", " ", "the", " ", "operati", "ng", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "runn", "ing", " ", "in", " ", "a", " ", "Window", "s", " ", "environ", "ment", " ", "this", " ", "must", " ", "be", " ", "set", " ", "to", " ", "the", " ", "same", " ", "as", " ", "your", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "system", " ", "time", " ", "zone", "._", "\\u\\u\\uNL\\u\\u\\u_", "TIME", "\\u", "ZONE_", "=_", "'", "Ame", "rica", "/", "Chi", "cag", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lang", "ua", "ge", " ", "code", " ", "for", " ", "this", " ", "installation", ".", " ", "All", " ", "choice", "s", " ", "can", " ", "be", " ", "found", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "i18n", "guy", ".", "com", "/", "unicode", "/", "language", "-", "identifi", "ers", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "LANGUAGE", "\\u", "CODE_", "=_", "'", "en", "-", "us", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SITE", "\\u", "ID_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", ",", " ", "Dj", "ang", "o", " ", "will", " ", "make", " ", "some", " ", "optimization", "s", " ", "so", " ", "as", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "load", " ", "the", " ", "international", "izatio", "n", " ", "machine", "ry", "._", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "I1", "8", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "you", " ", "set", " ", "this", " ", "to", " ", "Fal", "se", ",", " ", "Dj", "ang", "o", " ", "will", " ", "not", " ", "format", " ", "dates", ",", " ", "numbers", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calendar", "s", " ", "according", " ", "to", " ", "the", " ", "current", " ", "locale_", "\\u\\u\\uNL\\u\\u\\u_", "USE", "\\u", "L1", "0", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abs", "olute", " ", "path", " ", "to", " ", "the", " ", "director", "y", " ", "tha", "t", " ", "hold", "s", " ", "media", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ple", ":", " ", "\"/", "home", "/", "media", "/", "media", ".", "law", "ren", "ce", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "MEDIA", "\\u", "ROOT_", "=_", "'", "din", "ette", "/", "media", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "tha", "t", " ", "handle", "s", " ", "the", " ", "media", " ", "serve", "d", " ", "from", " ", "MEDIA", "\\u", "ROO", "T", ".", " ", "Make", " ", "sure", " ", "to", " ", "use", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trail", "ing", " ", "slash", " ", "if", " ", "there", " ", "is", " ", "a", " ", "path", " ", "component", " ", "(", "option", "al", " ", "in", " ", "other", " ", "case", "s", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", ":", " ", "\"", "http", "://", "media", ".", "law", "ren", "ce", ".", "com", "\",", " ", "\"", "http", "://", "example", ".", "com", "/", "media", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "MEDIA", "\\u", "URL_", "=_", "'/", "site", "\\u", "media", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "URL", " ", "prefix", " ", "for", " ", "admin", " ", "media", " ", "--", " ", "CS", "S", ",", " ", "Ja", "va", "Script", " ", "and", " ", "images", ".", " ", "Make", " ", "sure", " ", "to", " ", "use", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trail", "ing", " ", "slash", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exam", "ples", ":", " ", "\"", "http", "://", "foo", ".", "com", "/", "media", "/\"", ",", " ", "\"/", "media", "/\"", "._", "\\u\\u\\uNL\\u\\u\\u_", "ADM", "IN", "\\u", "MEDIA", "\\u", "PREFIX_", "=_", "'/", "media", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "this", " ", "unique", ",", " ", "and", " ", "don", "'", "t", " ", "share", " ", "it", " ", "with", " ", "any", "body", "._", "\\u\\u\\uNL\\u\\u\\u_", "SEC", "RET", "\\u", "KEY_", "=_", "'", "9", "oe", "zy", "1", "7", ")", "u", "&\\u", "!", "3", "n", "%", "@", "qb", "^", "iq", "z", "%", "ur", "2", "%", "v", "(", "5", "=", "0", "ua", "s", "@@", "#", "4", ")=", "n", "@", "5", "xy", "3", "m1", "j", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "calla", "bles", " ", "tha", "t", " ", "know", " ", "how", " ", "to", " ", "import", " ", "template", "s", " ", "from", " ", "vari", "ous", " ", "source", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "LOADER", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "filesystem", ".", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "template", ".", "load", "ers", ".", "app", "\\u", "director", "ies", ".", "Load", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "django", ".", "template", ".", "load", "ers", ".", "egg", "s", ".", "Load", "er", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MIDDLE", "WARE", "\\u", "CLASSES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "middle", "ware", ".", "common", ".", "Common", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "session", "s", ".", "middle", "ware", ".", "Sess", "ion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "middle", "ware", ".", "csr", "f", ".", "Cs", "rf", "View", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", ".", "middle", "ware", ".", "Auth", "entica", "tion", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "message", "s", ".", "middle", "ware", ".", "Messag", "e", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pagina", "tion", ".", "middle", "ware", ".", "Pagination", "Mid", "dle", "ware", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ROO", "T", "\\u", "URLCONF_", "=_", "'", "urls", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEMPL", "ATE", "\\u", "DIRS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "string", "s", " ", "here", ",", " ", "like", " ", "\"/", "home", "/", "html", "/", "django", "\\u", "template", "s", "\"", " ", "or", " ", "\"", "C", ":/", "www", "/", "django", "/", "template", "s", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Al", "way", "s", " ", "use", " ", "forward", " ", "slash", "es", ",", " ", "even", " ", "on", " ", "Window", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "forget", " ", "to", " ", "use", " ", "abs", "olute", " ", "path", "s", ",", " ", "not", " ", "relative", " ", "path", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TEMPL", "ATE", "\\u", "CONTE", "XT", "\\u", "PROCESSOR", "S_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", ".", "context", "\\u", "process", "ors", ".", "auth", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "debug", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "i18n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "media", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "message", "s", ".", "context", "\\u", "process", "ors", ".", "message", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "request", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "core", ".", "context", "\\u", "process", "ors", ".", "static", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INSTALLE", "D", "\\u", "APPS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "auth", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "contenttype", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "session", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "sites", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "message", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Unco", "mmen", "t", " ", "the", " ", "next", " ", "line", " ", "to", " ", "enable", " ", "the", " ", "admin", ":_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "admin", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "din", "ette", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compressor", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sor", "l", ".", "thumbnail", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pagina", "tion", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DATABASES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "default", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ENGINE", "'_", ":_", "'", "django", ".", "db", ".", "back", "ends", ".", "sql", "ite", "3", "'_", ",_", "#", " ", "Add", " ", "'", "postgres", "ql", "\\u", "psy", "cop", "g2", "',", " ", "'", "postgres", "ql", "',", " ", "'", "mysql", "',", " ", "'", "sql", "ite", "3", "'", " ", "or", " ", "'", "oracle", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "NAME", "'_", ":_", "'", "dev", ".", "db", "'_", ",_", "#", " ", "Or", " ", "path", " ", "to", " ", "databa", "se", " ", "file", " ", "if", " ", "usi", "ng", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "USER", "'_", ":_", "''_", ",_", "#", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "PASS", "WORD", "'_", ":_", "''_", ",_", "#", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "HOST", "'_", ":_", "''_", ",_", "#", " ", "Set", " ", "to", " ", "empty", " ", "string", " ", "for", " ", "local", "host", ".", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "'", "PORT", "'_", ":_", "''_", ",_", "#", " ", "Set", " ", "to", " ", "empty", " ", "string", " ", "for", " ", "default", ".", " ", "Not", " ", "used", " ", "with", " ", "sql", "ite", "3._", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "din", "ette", "_", "._", "extra", "\\u", "settings_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "call_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "markup", "field_", "._", "markup_", "import_", "DEF", "AUL", "T", "\\u", "MARK", "UP", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "din", "ette", "_", "._", "libs_", "._", "post", "markup_", "import_", "render", "\\u", "bb", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "STATI", "C", "\\u", "ROOT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "COMPRESS", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "MARK", "UP", "\\u", "TYPES_", "._", "append_", "(_", "(_", "'", "bb", "code", "'_", ",_", "render", "\\u", "bb", "code_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MARK", "UP", "\\u", "RENDER", "ERS_", "=_", "DEF", "AUL", "T", "\\u", "MARK", "UP", "\\u", "TYPES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "MARK", "UP", "\\u", "TYPE_", "=_", "\"", "bb", "code", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "AUTH", "\\u", "PROFILE", "\\u", "MODULE_", "=_", "\"", "din", "ette", ".", "Din", "ette", "User", "Profil", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REPLY", "\\u", "PAGE", "\\u", "SIZE_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FLO", "OD", "\\u", "TIME_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATI", "CF", "ILE", "S", "\\u", "FIND", "ERS_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", ".", "finde", "rs", ".", "File", "System", "Fin", "der", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "django", ".", "contrib", ".", "static", "files", ".", "finde", "rs", ".", "App", "Director", "ies", "Fin", "der", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compressor", ".", "finde", "rs", ".", "Compress", "or", "Fin", "der", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATI", "C", "\\u", "URL_", "=_", "'/", "static", "/'_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
danrobinson/tracestack/tracestack/debugger.py
[ { "content": "import sys\nimport traceback\nfrom tracestack.handler import ExceptionHandler, _get_ipython_handler\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def pm(*args, **kwargs):\n \"\"\"Post-mortem function that searches the last exception.\"\"\"\n\n if hasattr(sys, \"last_type\"):\n einfo = (sys.last_type, sys.last_value, sys.last_traceback)\n handler = ExceptionHandler(*args, **kwargs)\n try:\n ipython_shell = get_ipython()\n ipython_shell.showtraceback()\n handler.handle_error(*einfo)\n except NameError:\n handler(*einfo)\n else:\n raise ValueError(\"no last exception\")", "metadata": "root.pm", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def on(*args, **kwargs):\n \"\"\"Install the tracestack exception handler as the system exception \n handler.\"\"\"\n\n try:\n ipython_shell = get_ipython()\n handler = ExceptionHandler(*args, **kwargs)\n\n def _get_ipython_handler(*args, **kwargs):\n def handle_ipython(shell, etype, value, tb, tb_offset=None):\n shell.showtraceback((etype, value, tb), tb_offset=tb_offset)\n handler.handle_error(etype, value, tb)\n return traceback.format_tb(tb)\n return handle_ipython\n\n ipython_shell.set_custom_exc((Exception,), \n _get_ipython_handler(*args, **kwargs))\n except NameError:\n sys.excepthook = ExceptionHandler(*args, **kwargs)", "metadata": "root.on", "header": "['module', '___EOS___']", "index": 20 }, { "content": "def off():\n \"\"\"Revert to the default exception handler.\"\"\"\n\n try:\n ipython_shell = get_ipython()\n ipython_shell.set_custom_exc((), None)\n except NameError:\n sys.excepthook = sys.__excepthook__", "metadata": "root.off", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "from tracestack.handler import ExceptionHandler, _get_ipython_handler", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 69 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trace", "stack_", "._", "handler_", "import_", "Except", "ion", "Handler_", ",_", "\\u", "get", "\\u", "ipython", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "pm_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Post", "-", "mort", "em", " ", "function", " ", "tha", "t", " ", "searche", "s", " ", "the", " ", "last", " ", "exception", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "sys_", ",_", "\"", "last", "\\u", "type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ein", "fo_", "=_", "(_", "sys_", "._", "last", "\\u", "type_", ",_", "sys_", "._", "last", "\\u", "value_", ",_", "sys_", "._", "last", "\\u", "traceback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "Except", "ion", "Handler_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipython", "\\u", "shell_", "=_", "get", "\\u", "ipython", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipython", "\\u", "shell_", "._", "showt", "race", "back_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "handle", "\\u", "error_", "(_", "*_", "ein", "fo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "(_", "*_", "ein", "fo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "no", " ", "last", " ", "exception", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Install", " ", "the", " ", "trace", "stack", " ", "exception", " ", "handler", " ", "as", " ", "the", " ", "system", " ", "exception", " ", "\\", "10", ";", " ", " ", " ", " ", "handler", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipython", "\\u", "shell_", "=_", "get", "\\u", "ipython", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "=_", "Except", "ion", "Handler_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "get", "\\u", "ipython", "\\u", "handler_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "handle", "\\u", "ipython", "_", "(_", "shell_", ",_", "etype_", ",_", "value_", ",_", "tb_", ",_", "tb", "\\u", "offset_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shell_", "._", "showt", "race", "back_", "(_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", ",_", "tb", "\\u", "offset_", "=_", "tb", "\\u", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "handle", "\\u", "error_", "(_", "etype_", ",_", "value_", ",_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "traceback_", "._", "format\\u", "tb_", "(_", "tb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "handle", "\\u", "ipython", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ipython", "\\u", "shell_", "._", "set\\u", "custom", "\\u", "exc_", "(_", "(_", "Exception_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "get", "\\u", "ipython", "\\u", "handler_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "except", "hook_", "=_", "Except", "ion", "Handler_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "off_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rever", "t", " ", "to", " ", "the", " ", "default", " ", "exception", " ", "handler", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipython", "\\u", "shell_", "=_", "get", "\\u", "ipython", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipython", "\\u", "shell_", "._", "set\\u", "custom", "\\u", "exc_", "(_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "except", "hook_", "=_", "sys_", "._", "\\u\\u", "except", "hook", "\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
munki/munki/code/apps/Managed Software Center/Managed Software Center/mschtml.py
[ { "content": "def build_update_status_page():\n '''returns our update status page'''\n page_name = u'updates.html'\n item_list = []\n other_updates = []\n \n status_title_default = NSLocalizedString(u\"Checking for updates...\",\n u\"Checking For Updates message\")\n page = {}\n page['update_rows'] = u''\n page['hide_progress_spinner'] = u''\n page['hide_other_updates'] = u'hidden'\n page['other_updates_header_message'] = u''\n page['other_update_rows'] = u''\n \n # don't like this bit as it ties us to a different object\n status_controller = NSApp.delegate().statusController\n status_results_template = get_template('status_results_template.html')\n alert = {}\n alert['primary_status_text'] = (\n status_controller._status_message\n or NSLocalizedString(u\"Update in progress.\", u\"Update In Progress primary text\"))\n alert['secondary_status_text'] = (status_controller._status_detail or '&nbsp;')\n alert['hide_progress_bar'] = u''\n if status_controller._status_percent < 0:\n alert['progress_bar_attributes'] = u'class=\"indeterminate\"'\n else:\n alert['progress_bar_attributes'] = (u'style=\"width: %s%%\"'\n % status_controller._status_percent)\n page['update_rows'] = status_results_template.safe_substitute(alert)\n \n install_all_button_classes = []\n if status_controller._status_stopBtnHidden:\n install_all_button_classes.append(u'hidden')\n if status_controller._status_stopBtnDisabled:\n install_all_button_classes.append(u'disabled')\n page['install_all_button_classes'] = u' '.join(install_all_button_classes)\n\n # don't like this bit as it ties us yet another object\n page['update_count'] = NSApp.delegate().mainWindowController._status_title or status_title_default\n page['install_btn_label'] = NSLocalizedString(u\"Cancel\", u\"Cancel button title/short action text\")\n page['warning_text'] = u''\n\n footer = get_template('footer_template.html', raw=True)\n generate_page(page_name, 'updates_template.html', page, footer=footer)", "metadata": "root.build_update_status_page", "header": "['module', '___EOS___']", "index": 566 } ]
[ { "span": "item_list ", "start_line": 569, "start_column": 4, "end_line": 569, "end_column": 13 }, { "span": "other_updates ", "start_line": 570, "start_column": 4, "end_line": 570, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "update", "\\u", "status", "\\u", "page_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "return", "s", " ", "our", " ", "update", " ", "status", " ", "page", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "name_", "=_", "u", "'", "update", "s", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "other", "\\u", "updates_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "title", "\\u", "default_", "=_", "NS", "Locali", "zed", "String_", "(_", "u", "\"", "Check", "ing", " ", "for", " ", "update", "s", "...\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "\"", "Check", "ing", " ", "For", " ", "Update", "s", " ", "message", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "update", "\\u", "rows", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "hide", "\\u", "progress", "\\u", "spinn", "er", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "hide", "\\u", "other", "\\u", "update", "s", "'_", "]_", "=_", "u", "'", "hidden", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "other", "\\u", "update", "s", "\\u", "header", "\\u", "message", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "other", "\\u", "update", "\\u", "rows", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "like", " ", "this", " ", "bit", " ", "as", " ", "it", " ", "ties", " ", "us", " ", "to", " ", "a", " ", "different", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "controller_", "=_", "NS", "App_", "._", "delegate_", "(_", ")_", "._", "status", "Controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "results", "\\u", "template_", "=_", "get", "\\u", "template_", "(_", "'", "status", "\\u", "results", "\\u", "template", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "[_", "'", "primary", "\\u", "status", "\\u", "text", "'_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "controller_", "._", "\\u", "status", "\\u", "message_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "NS", "Locali", "zed", "String_", "(_", "u", "\"", "Update", " ", "in", " ", "progress", ".\"_", ",_", "u", "\"", "Update", " ", "In", " ", "Progres", "s", " ", "primary", " ", "text", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "[_", "'", "second", "ary", "\\u", "status", "\\u", "text", "'_", "]_", "=_", "(_", "status", "\\u", "controller_", "._", "\\u", "status", "\\u", "detail_", "or_", "'&", "nb", "sp", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert_", "[_", "'", "hide", "\\u", "progress", "\\u", "bar", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status", "\\u", "controller_", "._", "\\u", "status", "\\u", "percent_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alert_", "[_", "'", "progress", "\\u", "bar", "\\u", "attribute", "s", "'_", "]_", "=_", "u", "'", "class", "=\"", "inde", "terminate", "\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alert_", "[_", "'", "progress", "\\u", "bar", "\\u", "attribute", "s", "'_", "]_", "=_", "(_", "u", "'", "style", "=\"", "widt", "h", ":", " ", "%", "s", "%%", "\"'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "status", "\\u", "controller_", "._", "\\u", "status", "\\u", "percent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "[_", "'", "update", "\\u", "rows", "'_", "]_", "=_", "status", "\\u", "results", "\\u", "template_", "._", "safe", "\\u", "substitute_", "(_", "alert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "all", "\\u", "button", "\\u", "classes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status", "\\u", "controller_", "._", "\\u", "status", "\\u", "stop", "Bt", "n", "Hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "\\u", "all", "\\u", "button", "\\u", "classes_", "._", "append_", "(_", "u", "'", "hidden", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status", "\\u", "controller_", "._", "\\u", "status", "\\u", "stop", "Bt", "n", "Disabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "install", "\\u", "all", "\\u", "button", "\\u", "classes_", "._", "append_", "(_", "u", "'", "disable", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "page_", "[_", "'", "install", "\\u", "all", "\\u", "button", "\\u", "classe", "s", "'_", "]_", "=_", "u", "'", " ", "'_", "._", "join_", "(_", "install", "\\u", "all", "\\u", "button", "\\u", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "like", " ", "this", " ", "bit", " ", "as", " ", "it", " ", "ties", " ", "us", " ", "ye", "t", " ", "anot", "her", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "[_", "'", "update", "\\u", "count", "'_", "]_", "=_", "NS", "App_", "._", "delegate_", "(_", ")_", "._", "main", "Window", "Controller_", "._", "\\u", "status", "\\u", "title_", "or_", "status", "\\u", "title", "\\u", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "install", "\\u", "btn", "\\u", "label", "'_", "]_", "=_", "NS", "Locali", "zed", "String_", "(_", "u", "\"", "Cancel", "\"_", ",_", "u", "\"", "Cancel", " ", "button", " ", "title", "/", "short", " ", "action", " ", "text", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "[_", "'", "warn", "ing", "\\u", "text", "'_", "]_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "footer_", "=_", "get", "\\u", "template_", "(_", "'", "footer", "\\u", "template", ".", "html", "'_", ",_", "raw_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "generat", "e\\u", "page_", "(_", "page", "\\u", "name_", ",_", "'", "update", "s", "\\u", "template", ".", "html", "'_", ",_", "page_", ",_", "footer_", "=_", "footer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
benoitc/gunicorn/docs/sitemap_gen.py
[ { "content": " def NarrowText(self, text, encoding):\n \"\"\" Narrow a piece of arbitrary text \"\"\"\n if type(text) != types.UnicodeType:\n return text\n\n # Try the passed in preference\n if encoding:\n try:\n result = text.encode(encoding)\n if not encoding in self._learned:\n self._learned.append(encoding)\n return result\n except UnicodeError:\n pass\n except LookupError:\n output.Warn('Unknown encoding: %s' % encoding)\n\n # Try the user preference\n if self._user:\n try:\n return text.encode(self._user)\n except UnicodeError:\n pass\n except LookupError:\n temp = self._user\n self._user = None\n output.Warn('Unknown default_encoding: %s' % temp)\n\n # Look through learned defaults, knock any failing ones out of the list\n while self._learned:\n try:\n return text.encode(self._learned[0])\n except:\n del self._learned[0]\n\n # When all other defaults are exhausted, use UTF-8\n try:\n return text.encode(ENC_UTF8)\n except UnicodeError:\n pass\n\n # Something is seriously wrong if we get to here\n return text.encode(ENC_ASCII, 'ignore')", "metadata": "root.Encoder.NarrowText", "header": "['class', 'Encoder', ':', '___EOS___']", "index": 249 }, { "content": " def WidenText(self, text, encoding):\n \"\"\" Widen a piece of arbitrary text \"\"\"\n if type(text) != types.StringType:\n return text\n\n # Try the passed in preference\n if encoding:\n try:\n result = unicode(text, encoding)\n if not encoding in self._learned:\n self._learned.append(encoding)\n return result\n except UnicodeError:\n pass\n except LookupError:\n output.Warn('Unknown encoding: %s' % encoding)\n\n # Try the user preference\n if self._user:\n try:\n return unicode(text, self._user)\n except UnicodeError:\n pass\n except LookupError:\n temp = self._user\n self._user = None\n output.Warn('Unknown default_encoding: %s' % temp)\n\n # Look through learned defaults, knock any failing ones out of the list\n while self._learned:\n try:\n return unicode(text, self._learned[0])\n except:\n del self._learned[0]\n\n # When all other defaults are exhausted, use UTF-8\n try:\n return unicode(text, ENC_UTF8)\n except UnicodeError:\n pass\n\n # Getting here means it wasn't UTF-8 and we had no working default.\n # We really don't have anything \"right\" we can do anymore.\n output.Warn('Unrecognized encoding in text: %s' % text)\n if not self._user:\n output.Warn('You may need to set a default_encoding in your '\n 'configuration file.')\n return text.decode(ENC_ASCII, 'ignore')", "metadata": "root.Encoder.WidenText", "header": "['class', 'Encoder', ':', '___EOS___']", "index": 301 } ]
[ { "span": "except:", "start_line": 281, "start_column": 6, "end_line": 281, "end_column": 13 }, { "span": "except:", "start_line": 333, "start_column": 6, "end_line": 333, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Encoder_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Nar", "row", "Text_", "(_", "self_", ",_", "text_", ",_", "encoding_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Nar", "row", " ", "a", " ", "piece", " ", "of", " ", "arbitra", "ry", " ", "text", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "text_", ")_", "!=_", "types_", "._", "Unic", "ode", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "the", " ", "pass", "ed", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "text_", "._", "encode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "encoding_", "in_", "self_", "._", "\\u", "learned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "learned", "_", "._", "append_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Look", "up", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "Warn", "_", "(_", "'", "Un", "know", "n", " ", "encoding", ":", " ", "%", "s", "'_", "%_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "the", " ", "user", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "._", "encode_", "(_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Look", "up", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "self_", "._", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "Warn", "_", "(_", "'", "Un", "know", "n", " ", "default", "\\u", "encoding", ":", " ", "%", "s", "'_", "%_", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", " ", "through", " ", "learned", " ", "default", "s", ",", " ", "kno", "ck", " ", "any", " ", "faili", "ng", " ", "ones", " ", "out", " ", "of", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "self_", "._", "\\u", "learned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "._", "encode_", "(_", "self_", "._", "\\u", "learned", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "learned", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "all", " ", "other", " ", "default", "s", " ", "are", " ", "exhaust", "ed", ",", " ", "use", " ", "UT", "F", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "._", "encode_", "(_", "ENC", "\\u", "UT", "F8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Some", "thing", " ", "is", " ", "seri", "ously", " ", "wrong", " ", "if", " ", "we", " ", "get", " ", "to", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "._", "encode_", "(_", "ENC", "\\u", "ASCII", "_", ",_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Encoder_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Wide", "n", "Text_", "(_", "self_", ",_", "text_", ",_", "encoding_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Wide", "n", " ", "a", " ", "piece", " ", "of", " ", "arbitra", "ry", " ", "text", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "text_", ")_", "!=_", "types_", "._", "String", "Type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "the", " ", "pass", "ed", " ", "in", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "encoding_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "unicode_", "(_", "text_", ",_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "encoding_", "in_", "self_", "._", "\\u", "learned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "learned", "_", "._", "append_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Look", "up", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "Warn", "_", "(_", "'", "Un", "know", "n", " ", "encoding", ":", " ", "%", "s", "'_", "%_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "the", " ", "user", " ", "preference_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "text_", ",_", "self_", "._", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Look", "up", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "=_", "self_", "._", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "user_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "Warn", "_", "(_", "'", "Un", "know", "n", " ", "default", "\\u", "encoding", ":", " ", "%", "s", "'_", "%_", "temp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", " ", "through", " ", "learned", " ", "default", "s", ",", " ", "kno", "ck", " ", "any", " ", "faili", "ng", " ", "ones", " ", "out", " ", "of", " ", "the", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "self_", "._", "\\u", "learned", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "text_", ",_", "self_", "._", "\\u", "learned", "_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "learned", "_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Whe", "n", " ", "all", " ", "other", " ", "default", "s", " ", "are", " ", "exhaust", "ed", ",", " ", "use", " ", "UT", "F", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "unicode_", "(_", "text_", ",_", "ENC", "\\u", "UT", "F8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "ting", " ", "here", " ", "means", " ", "it", " ", "was", "n", "'", "t", " ", "UT", "F", "-", "8", " ", "and", " ", "we", " ", "had", " ", "no", " ", "working", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "reall", "y", " ", "don", "'", "t", " ", "have", " ", "anyt", "hing", " ", "\"", "right", "\"", " ", "we", " ", "can", " ", "do", " ", "any", "more", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "Warn", "_", "(_", "'", "Unre", "cogni", "zed", " ", "encoding", " ", "in", " ", "text", ":", " ", "%", "s", "'_", "%_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "Warn", "_", "(_", "'", "You", " ", "may", " ", "need", " ", "to", " ", "set", " ", "a", " ", "default", "\\u", "encoding", " ", "in", " ", "your", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "configura", "tion", " ", "file", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "._", "decode_", "(_", "ENC", "\\u", "ASCII", "_", ",_", "'", "ignore", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
amrdraz/kodr/app/brython/www/src/Lib/unittest/test/testmock/testmock.py
[ { "content": "import copy\nimport sys\n\nimport unittest\nfrom unittest.test.testmock.support import is_instance\nfrom unittest import mock\nfrom unittest.mock import (\n call, DEFAULT, patch, sentinel,\n MagicMock, Mock, NonCallableMock,\n NonCallableMagicMock, _CallList,\n create_autospec\n)\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import unittest", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "._", "test_", "._", "testm", "ock_", "._", "support_", "import_", "is", "\\u", "instance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "._", "mock_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "call_", ",_", "DEFAULT_", ",_", "patch_", ",_", "sentinel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Mag", "ic", "Mock_", ",_", "Mock_", ",_", "Non", "Call", "able", "Mock_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Non", "Call", "able", "Mag", "ic", "Mock_", ",_", "\\u", "Call", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "autospec_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pixelogik/NearPy/nearpy/examples/example1.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2013 Ole Krause-Sparmann\n\n# Permission is hereby granted, free of charge, to any person obtaining a copy\n# of this software and associated documentation files (the \"Software\"), to deal\n# in the Software without restriction, including without limitation the rights\n# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n# copies of the Software, and to permit persons to whom the Software is\n# furnished to do so, subject to the following conditions:\n\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n\nimport numpy\nimport scipy\nimport unittest\n\nfrom nearpy import Engine\nfrom nearpy.distances import CosineDistance\n\nfrom nearpy.hashes import RandomBinaryProjections, RandomBinaryProjectionTree, HashPermutations, HashPermutationMapper\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def example1():\n\n # Dimension of feature space\n DIM = 100\n\n # Number of data points (dont do too much because of exact search)\n POINTS = 10000\n\n print 'Creating engines'\n\n # We want 12 projections, 20 results at least\n rbpt = RandomBinaryProjectionTree('rbpt', 20, 20)\n\n # Create engine 1\n engine_rbpt = Engine(DIM, lshashes=[rbpt], distance=CosineDistance())\n\n # Create binary hash as child hash\n rbp = RandomBinaryProjections('rbp1', 20)\n\n # Create engine 2\n engine = Engine(DIM, lshashes=[rbp], distance=CosineDistance())\n\n # Create permutations meta-hash\n permutations = HashPermutations('permut')\n\n # Create binary hash as child hash\n rbp_perm = RandomBinaryProjections('rbp_perm', 20)\n rbp_conf = {'num_permutation':50,'beam_size':10,'num_neighbour':100}\n\n # Add rbp as child hash of permutations hash\n permutations.add_child_hash(rbp_perm, rbp_conf)\n\n # Create engine 3\n engine_perm = Engine(DIM, lshashes=[permutations], distance=CosineDistance())\n\n # Create permutations meta-hash\n permutations2 = HashPermutationMapper('permut2')\n\n # Create binary hash as child hash\n rbp_perm2 = RandomBinaryProjections('rbp_perm2', 12)\n\n # Add rbp as child hash of permutations hash\n permutations2.add_child_hash(rbp_perm2)\n\n # Create engine 3\n engine_perm2 = Engine(DIM, lshashes=[permutations2], distance=CosineDistance())\n\n print 'Indexing %d random vectors of dimension %d' % (POINTS, DIM)\n\n # First index some random vectors\n matrix = numpy.zeros((POINTS,DIM))\n for i in xrange(POINTS):\n v = numpy.random.randn(DIM)\n matrix[i] = v\n engine.store_vector(v)\n engine_rbpt.store_vector(v)\n engine_perm.store_vector(v)\n engine_perm2.store_vector(v)\n\n print 'Buckets 1 = %d' % len(engine.storage.buckets['rbp1'].keys())\n print 'Buckets 2 = %d' % len(engine_rbpt.storage.buckets['rbpt'].keys())\n\n print 'Building permuted index for HashPermutations'\n\n # Then update permuted index\n permutations.build_permuted_index()\n\n print 'Generate random data'\n\n # Get random query vector\n query = numpy.random.randn(DIM)\n\n # Do random query on engine 1\n print '\\nNeighbour distances with RandomBinaryProjectionTree:'\n print ' -> Candidate count is %d' % engine_rbpt.candidate_count(query)\n results = engine_rbpt.neighbours(query)\n dists = [x[2] for x in results]\n print dists\n\n # Do random query on engine 2\n print '\\nNeighbour distances with RandomBinaryProjections:'\n print ' -> Candidate count is %d' % engine.candidate_count(query)\n results = engine.neighbours(query)\n dists = [x[2] for x in results]\n print dists\n\n # Do random query on engine 3\n print '\\nNeighbour distances with HashPermutations:'\n print ' -> Candidate count is %d' % engine_perm.candidate_count(query)\n results = engine_perm.neighbours(query)\n dists = [x[2] for x in results]\n print dists\n\n # Do random query on engine 4\n print '\\nNeighbour distances with HashPermutations2:'\n print ' -> Candidate count is %d' % engine_perm2.candidate_count(query)\n results = engine_perm2.neighbours(query)\n dists = [x[2] for x in results]\n print dists\n\n # Real neighbours\n print '\\nReal neighbour distances:'\n query = query.reshape((1,DIM))\n dists = CosineDistance().distance(matrix,query)\n dists = dists.reshape((-1,))\n dists = sorted(dists)\n print dists[:10]", "metadata": "root.example1", "header": "['module', '___EOS___']", "index": 31 } ]
[ { "span": "import scipy", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 12 }, { "span": "import unittest", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Ol", "e", " ", "Kra", "use", "-", "Spar", "man", "n_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", " ", "obtain", "ing", " ", "a", " ", "copy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "near", "py_", "import_", "Engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "near", "py_", "._", "distances_", "import_", "Cos", "ine", "Distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "near", "py_", "._", "hashes_", "import_", "Random", "Bin", "ary", "Projection", "s_", ",_", "Random", "Bin", "ary", "Projection", "Tree_", ",_", "Hash", "Permut", "ations_", ",_", "Hash", "Permut", "ation", "Mapper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "example", "1_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dimen", "sion", " ", "of", " ", "feature", " ", "space_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DIM_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Number", " ", "of", " ", "data", " ", "points", " ", "(", "don", "t", " ", "do", " ", "too", " ", "muc", "h", " ", "bec", "aus", "e", " ", "of", " ", "exact", " ", "search", ")_", "\\u\\u\\uNL\\u\\u\\u_", "POINTS_", "=_", "10000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Creat", "ing", " ", "engines", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "want", " ", "1", "2", " ", "projections", ",", " ", "20", " ", "results", " ", "at", " ", "leas", "t_", "\\u\\u\\uNL\\u\\u\\u_", "rb", "pt_", "=_", "Random", "Bin", "ary", "Projection", "Tree_", "(_", "'", "rb", "pt", "'_", ",_", "20_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "eng", "ine", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "rb", "pt_", "=_", "Engine_", "(_", "DIM_", ",_", "lsh", "ash", "es_", "=_", "[_", "rb", "pt_", "]_", ",_", "distance_", "=_", "Cos", "ine", "Distance_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "binar", "y", " ", "hash", " ", "as", " ", "child", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "rb", "p_", "=_", "Random", "Bin", "ary", "Projection", "s_", "(_", "'", "rb", "p1", "'_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "eng", "ine", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "engine_", "=_", "Engine_", "(_", "DIM_", ",_", "lsh", "ash", "es_", "=_", "[_", "rb", "p_", "]_", ",_", "distance_", "=_", "Cos", "ine", "Distance_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "permutation", "s", " ", "meta", "-", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "permutations_", "=_", "Hash", "Permut", "ations_", "(_", "'", "perm", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "binar", "y", " ", "hash", " ", "as", " ", "child", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "rb", "p", "\\u", "perm_", "=_", "Random", "Bin", "ary", "Projection", "s_", "(_", "'", "rb", "p", "\\u", "perm", "'_", ",_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rb", "p", "\\u", "conf_", "=_", "{_", "'", "num", "\\u", "permutation", "'_", ":_", "50_", ",_", "'", "beam", "\\u", "size", "'_", ":_", "10_", ",_", "'", "num", "\\u", "neighbour", "'_", ":_", "100_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "rb", "p", " ", "as", " ", "child", " ", "hash", " ", "of", " ", "permutation", "s", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "permutations_", "._", "add", "\\u", "child", "\\u", "hash_", "(_", "rb", "p", "\\u", "perm_", ",_", "rb", "p", "\\u", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "eng", "ine", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "perm_", "=_", "Engine_", "(_", "DIM_", ",_", "lsh", "ash", "es_", "=_", "[_", "permutations_", "]_", ",_", "distance_", "=_", "Cos", "ine", "Distance_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "permutation", "s", " ", "meta", "-", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "permutation", "s2_", "=_", "Hash", "Permut", "ation", "Mapper_", "(_", "'", "perm", "ut", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "binar", "y", " ", "hash", " ", "as", " ", "child", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "rb", "p", "\\u", "perm", "2_", "=_", "Random", "Bin", "ary", "Projection", "s_", "(_", "'", "rb", "p", "\\u", "perm", "2", "'_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "rb", "p", " ", "as", " ", "child", " ", "hash", " ", "of", " ", "permutation", "s", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "permutation", "s2_", "._", "add", "\\u", "child", "\\u", "hash_", "(_", "rb", "p", "\\u", "perm", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "eng", "ine", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "eng", "ine", "\\u", "perm", "2_", "=_", "Engine_", "(_", "DIM_", ",_", "lsh", "ash", "es_", "=_", "[_", "permutation", "s2_", "]_", ",_", "distance_", "=_", "Cos", "ine", "Distance_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Index", "ing", " ", "%", "d", " ", "random", " ", "vector", "s", " ", "of", " ", "dimension", " ", "%", "d", "'_", "%_", "(_", "POINTS_", ",_", "DIM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "index", " ", "some", " ", "random", " ", "vectors_", "\\u\\u\\uNL\\u\\u\\u_", "matrix_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "POINTS_", ",_", "DIM_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "POINTS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "numpy_", "._", "random_", "._", "randn_", "(_", "DIM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matrix_", "[_", "i_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "engine_", "._", "store", "\\u", "vector_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "rb", "pt_", "._", "store", "\\u", "vector_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "perm_", "._", "store", "\\u", "vector_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eng", "ine", "\\u", "perm", "2_", "._", "store", "\\u", "vector_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Buck", "ets", " ", "1", " ", "=", " ", "%", "d", "'_", "%_", "len_", "(_", "engine_", "._", "storage_", "._", "buckets_", "[_", "'", "rb", "p1", "'_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Buck", "ets", " ", "2", " ", "=", " ", "%", "d", "'_", "%_", "len_", "(_", "eng", "ine", "\\u", "rb", "pt_", "._", "storage_", "._", "buckets_", "[_", "'", "rb", "pt", "'_", "]_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Building", " ", "permute", "d", " ", "index", " ", "for", " ", "Hash", "Permut", "ation", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "update", " ", "permute", "d", " ", "index_", "\\u\\u\\uNL\\u\\u\\u_", "permutations_", "._", "build", "\\u", "permute", "d\\u", "index_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'", "Generate", " ", "random", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "random", " ", "query", " ", "vector_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "numpy_", "._", "random_", "._", "randn_", "(_", "DIM_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "random", " ", "query", " ", "on", " ", "eng", "ine", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Neigh", "bour", " ", "distance", "s", " ", "with", " ", "Random", "Bin", "ary", "Projection", "Tree", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", " ", "->", " ", "Candidate", " ", "count", " ", "is", " ", "%", "d", "'_", "%_", "eng", "ine", "\\u", "rb", "pt_", "._", "candidate", "\\u", "count_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "eng", "ine", "\\u", "rb", "pt_", "._", "neighbours_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "[_", "x_", "[_", "2_", "]_", "for_", "x_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "dists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "random", " ", "query", " ", "on", " ", "eng", "ine", " ", "2_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Neigh", "bour", " ", "distance", "s", " ", "with", " ", "Random", "Bin", "ary", "Projection", "s", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", " ", "->", " ", "Candidate", " ", "count", " ", "is", " ", "%", "d", "'_", "%_", "engine_", "._", "candidate", "\\u", "count_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "engine_", "._", "neighbours_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "[_", "x_", "[_", "2_", "]_", "for_", "x_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "dists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "random", " ", "query", " ", "on", " ", "eng", "ine", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Neigh", "bour", " ", "distance", "s", " ", "with", " ", "Hash", "Permut", "ation", "s", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", " ", "->", " ", "Candidate", " ", "count", " ", "is", " ", "%", "d", "'_", "%_", "eng", "ine", "\\u", "perm_", "._", "candidate", "\\u", "count_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "eng", "ine", "\\u", "perm_", "._", "neighbours_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "[_", "x_", "[_", "2_", "]_", "for_", "x_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "dists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "random", " ", "query", " ", "on", " ", "eng", "ine", " ", "4_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Neigh", "bour", " ", "distance", "s", " ", "with", " ", "Hash", "Permut", "ation", "s2", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", " ", " ", "->", " ", "Candidate", " ", "count", " ", "is", " ", "%", "d", "'_", "%_", "eng", "ine", "\\u", "perm", "2_", "._", "candidate", "\\u", "count_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "eng", "ine", "\\u", "perm", "2_", "._", "neighbours_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "[_", "x_", "[_", "2_", "]_", "for_", "x_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "dists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Real", " ", "neighbours_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "'\\\\", "n", "Real", " ", "neighbour", " ", "distance", "s", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "query_", "._", "reshape_", "(_", "(_", "1_", ",_", "DIM_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "Cos", "ine", "Distance_", "(_", ")_", "._", "distance_", "(_", "matrix_", ",_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "dists_", "._", "reshape_", "(_", "(_", "-_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dists_", "=_", "sorted_", "(_", "dists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "dists_", "[_", ":_", "10_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/apps/beeswax/src/beeswax/create_table_tests.py
[ { "content": "#!/usr/bin/env python\n# Licensed to Cloudera, Inc. under one\n# or more contributor license agreements. See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership. Cloudera, Inc. licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport logging\n\nfrom nose.tools import assert_equal, assert_true, assert_raises\n\nfrom django import forms\nfrom beeswax.forms import _clean_terminator\n\n\nLOG = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCreateTable():\n", "metadata": "root.TestCreateTable", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def test_custom_delimiter(self):\n # Any thing is good\n assert_equal('\\x01', _clean_terminator('\\001'))\n assert_raises(forms.ValidationError, _clean_terminator, '')", "metadata": "root.TestCreateTable.test_custom_delimiter", "header": "['class', 'TestCreateTable', '(', ')', ':', '___EOS___']", "index": 30 } ]
[ { "span": "from nose.tools import assert_equal, assert_true, assert_raises", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 63 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "to", " ", "Cloud", "era", ",", " ", "Inc", ".", " ", "under", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "more", " ", "contributor", " ", "license", " ", "agreement", "s", ".", " ", " ", "See", " ", "the", " ", "NOTICE", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "with", " ", "this", " ", "work", " ", "for", " ", "addition", "al", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "regarding", " ", "copyr", "ight", " ", "owner", "ship", ".", " ", " ", "Cloud", "era", ",", " ", "Inc", ".", " ", "license", "s", " ", "this", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "you", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "License", "\");", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "ance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "the", " ", "License", ".", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "equal_", ",_", "assert", "\\u", "true_", ",_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bee", "swa", "x_", "._", "forms_", "import_", "\\u", "clean", "\\u", "terminator", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Creat", "e", "Table_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Creat", "e", "Table_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "custom", "\\u", "delimiter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Any", " ", "thing", " ", "is", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "equal_", "(_", "'\\\\", "x0", "1", "'_", ",_", "\\u", "clean", "\\u", "terminator", "_", "(_", "'\\\\", "001", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "forms_", "._", "Validat", "ion", "Error_", ",_", "\\u", "clean", "\\u", "terminator", "_", ",_", "''_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
operasoftware/tlsprober/scan/scan_extractcvs.py
[ { "content": "# Copyright 2010-2012 Opera Software ASA \n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n'''\nCreated on 2. okt. 2010\n\n@author: Yngve\n'''\n\n\"\"\"\nExtract a scan result as a CSV list of servernames\n\"\"\"\n\nimport sys,os,subprocess,time,os.path\n\nsys.path.insert(1, os.path.join(\"..\"))\nsys.path.insert(1, os.path.join(\"..\",\"tlslite\"))\n\nimport libinit\n\nfrom optparse import OptionParser\nimport probedb.standalone\nimport probedb.probedata2.models as ProbeData\nimport probedb.scanner.models as Scanner\nimport threading\nimport socket\nfrom tlslite import TLSConnection, HandshakeSettings\noptions_config = OptionParser()\n\noptions_config.add_option(\"--run-id\", action=\"store\", type=\"int\", dest=\"run_id\", default=0)\noptions_config.add_option(\"--testbase2\", action=\"store_true\", dest=\"use_testbase2\")\noptions_config.add_option(\"--output\", action=\"store\", type=\"string\", dest=\"output_filename\", default=\"output.csv\")\n\n(options, args) = options_config.parse_args()\n\nrun = Scanner.ScannerRun.objects.get(id=options.run_id)\n\nimport csv\nfile = csv.writer(open(options.output_filename,\"wb\"))\n\ni=0\nfor item in run.scannerresults_set.all().iterator():\n\ti += 1\n\tfile.writerow([i,item.server, item.port, item.protocol])\n\tif i%100 == 0:\n\t\tprint i \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys,os,subprocess,time,os.path", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 37 }, { "span": "import libinit", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 14 }, { "span": "import probedb.standalone", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 25 }, { "span": "import probedb.probedata2.models as ProbeData", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 45 }, { "span": "import threading", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 16 }, { "span": "import socket", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 13 }, { "span": "from tlslite import TLSConnection, HandshakeSettings", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 52 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2010", "-", "2012", " ", "Opera", " ", "Sof", "twa", "re", " ", "AS", "A", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "2", ".", " ", "ok", "t", ".", " ", "2010", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Y", "ng", "ve", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Extract", " ", "a", " ", "scan", " ", "result", " ", "as", " ", "a", " ", "CSV", " ", "list", " ", "of", " ", "server", "names", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "subprocess_", ",_", "time_", ",_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "1_", ",_", "os_", "._", "path_", "._", "join_", "(_", "\"..\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "1_", ",_", "os_", "._", "path_", "._", "join_", "(_", "\"..\"_", ",_", "\"", "tls", "lite", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "lib", "init_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "optparse_", "import_", "Optio", "n", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prob", "edb", "_", "._", "standalone", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prob", "edb", "_", "._", "prob", "edat", "a2_", "._", "models_", "as_", "Probe", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prob", "edb", "_", "._", "scanner_", "._", "models_", "as_", "Scanner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tls", "lite_", "import_", "TLS", "Connection_", ",_", "Handsha", "ke", "Settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options", "\\u", "config_", "=_", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "run", "-", "id", "\"_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "\"", "int", "\"_", ",_", "dest_", "=_", "\"", "run", "\\u", "id", "\"_", ",_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "testb", "ase", "2", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "use", "\\u", "testb", "ase", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options", "\\u", "config_", "._", "add", "\\u", "option_", "(_", "\"--", "output", "\"_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "\"", "string", "\"_", ",_", "dest_", "=_", "\"", "output", "\\u", "filename", "\"_", ",_", "default_", "=_", "\"", "output", ".", "csv", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "options", "\\u", "config_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "run_", "=_", "Scanner_", "._", "Scann", "er", "Run_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "options_", "._", "run", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "options_", "._", "output", "\\u", "filename_", ",_", "\"", "wb", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "run_", "._", "scanner", "results", "\\u", "set_", "._", "all_", "(_", ")_", "._", "iterator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file_", "._", "writerow_", "(_", "[_", "i_", ",_", "item_", "._", "server_", ",_", "item_", "._", "port_", ",_", "item_", "._", "protocol_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "%_", "100_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "print_", "i_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/corehq/apps/cloudcare/views.py
[ { "content": "import HTMLParser\nimport json\nfrom xml.etree import ElementTree\n\nfrom django.conf import settings\nfrom django.contrib import messages\nfrom django.core.urlresolvers import reverse\nfrom django.http import HttpResponseRedirect, HttpResponse, HttpResponseBadRequest, Http404\nfrom django.shortcuts import get_object_or_404\nfrom django.shortcuts import render\nfrom django.template.loader import render_to_string\nfrom django.utils.decorators import method_decorator\nfrom django.utils.translation import ugettext as _, ugettext_noop\nfrom django.views.decorators.cache import cache_page\nfrom django.views.generic import View\n\nfrom couchdbkit import ResourceConflict, ResourceNotFound\n\nfrom casexml.apps.case.models import CASE_STATUS_OPEN\nfrom casexml.apps.case.xml import V2\nfrom casexml.apps.phone.fixtures import generator\nfrom casexml.apps.stock.models import StockTransaction\nfrom casexml.apps.stock.utils import get_current_ledger_transactions\nfrom corehq.form_processor.utils import should_use_sql_backend\nfrom dimagi.utils.logging import notify_exception\nfrom dimagi.utils.parsing import string_to_boolean\nfrom dimagi.utils.web import json_response, get_url_base, json_handler\nfrom touchforms.formplayer.api import DjangoAuth, get_raw_instance, sync_db\nfrom touchforms.formplayer.models import EntrySession\nfrom xml2json.lib import xml2json\n\nfrom corehq import toggles, privileges\nfrom corehq.apps.accounting.decorators import requires_privilege_for_commcare_user, requires_privilege_with_fallback\nfrom corehq.apps.app_manager.dbaccessors import get_app, get_latest_build_doc, \\\n get_brief_apps_in_domain\nfrom corehq.apps.app_manager.exceptions import FormNotFoundException, ModuleNotFoundException\nfrom corehq.apps.app_manager.models import Application, ApplicationBase\nfrom corehq.apps.app_manager.suite_xml.sections.details import get_instances_for_module\nfrom corehq.apps.app_manager.suite_xml.sections.entries import EntriesHelper\nfrom corehq.apps.app_manager.util import get_cloudcare_session_data\nfrom corehq.apps.cloudcare.api import (\n api_closed_to_status,\n CaseAPIResult,\n get_app_json,\n get_filtered_cases,\n get_filters_from_request_params,\n get_open_form_sessions,\n look_up_app_json,\n)\nfrom corehq.apps.cloudcare.dbaccessors import get_cloudcare_apps\nfrom corehq.apps.cloudcare.decorators import require_cloudcare_access\nfrom corehq.apps.cloudcare.exceptions import RemoteAppError\nfrom corehq.apps.cloudcare.models import ApplicationAccess\nfrom corehq.apps.cloudcare.touchforms_api import BaseSessionDataHelper, CaseSessionDataHelper\nfrom corehq.apps.domain.decorators import login_and_domain_required, login_or_digest_ex, domain_admin_required\nfrom corehq.apps.groups.models import Group\nfrom corehq.apps.reports.formdetails import readable\nfrom corehq.apps.style.decorators import (\n use_datatables,\n use_bootstrap3,\n use_jquery_ui,\n)\nfrom corehq.apps.users.models import CouchUser, CommCareUser\nfrom corehq.apps.users.views import BaseUserSettingsView\nfrom corehq.form_processor.interfaces.dbaccessors import CaseAccessors, FormAccessors\nfrom corehq.form_processor.exceptions import XFormNotFound, CaseNotFound\nfrom corehq.util.couch import get_document_or_404\nfrom corehq.util.quickcache import skippable_quickcache\nfrom corehq.util.xml_utils import indent_xml\n\n\n\n\n\n\n\n\n\ncloudcare_api = login_or_digest_ex(allow_cc_users=True)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@require_cloudcare_access\ndef default(request, domain):\n return HttpResponseRedirect(reverse('cloudcare_main', args=[domain, '']))", "metadata": "root.default", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def insufficient_privilege(request, domain, *args, **kwargs):\n context = {\n 'domain': domain,\n }\n\n return render(request, \"cloudcare/insufficient_privilege.html\", context)", "metadata": "root.insufficient_privilege", "header": "['module', '___EOS___']", "index": 75 }, { "content": "class CloudcareMain(View):\n\n", "metadata": "root.CloudcareMain", "header": "['module', '___EOS___']", "index": 83 }, { "content": " @use_bootstrap3\n @use_datatables\n @use_jquery_ui\n @method_decorator(require_cloudcare_access)\n @method_decorator(requires_privilege_for_commcare_user(privileges.CLOUDCARE))\n def dispatch(self, request, *args, **kwargs):\n return super(CloudcareMain, self).dispatch(request, *args, **kwargs)", "metadata": "root.CloudcareMain.dispatch", "header": "['class', 'CloudcareMain', '(', 'View', ')', ':', '___EOS___']", "index": 85 }, { "content": " def get(self, request, domain, urlPath):\n try:\n preview = string_to_boolean(request.GET.get(\"preview\", \"false\"))\n except ValueError:\n # this is typically only set at all if it's intended to be true so this\n # is a reasonable default for \"something went wrong\"\n preview = True\n\n app_access = ApplicationAccess.get_by_domain(domain)\n accessor = CaseAccessors(domain)\n\n if not preview:\n apps = get_cloudcare_apps(domain)\n if request.project.use_cloudcare_releases:\n # replace the apps with the last starred build of each app, removing the ones that aren't starred\n apps = filter(\n lambda app: app.is_released,\n [get_app(domain, app['_id'], latest=True) for app in apps]\n )\n # convert to json\n apps = [get_app_json(app) for app in apps]\n else:\n # legacy functionality - use the latest build regardless of stars\n apps = [get_latest_build_doc(domain, app['_id']) for app in apps]\n apps = [get_app_json(ApplicationBase.wrap(app)) for app in apps if app]\n\n else:\n apps = get_brief_apps_in_domain(domain)\n apps = [get_app_json(app) for app in apps if app and app.application_version == V2]\n\n # trim out empty apps\n apps = filter(lambda app: app, apps)\n apps = filter(lambda app: app_access.user_can_access_app(request.couch_user, app), apps)\n\n def _default_lang():\n if apps:\n # unfortunately we have to go back to the DB to find this\n return Application.get(apps[0][\"_id\"]).build_langs[0]\n else:\n return \"en\"\n\n # default language to user's preference, followed by\n # first app's default, followed by english\n language = request.couch_user.language or _default_lang()\n\n def _url_context():\n # given a url path, returns potentially the app, parent, and case, if\n # they're selected. the front end optimizes with these to avoid excess\n # server calls\n\n # there's an annoying dependency between this logic and backbone's\n # url routing that seems hard to solve well. this needs to be synced\n # with apps.js if anything changes\n\n # for apps anything with \"view/app/\" works\n\n # for cases it will be:\n # \"view/:app/:module/:form/case/:case/\"\n\n # if there are parent cases, it will be:\n # \"view/:app/:module/:form/parent/:parent/case/:case/\n\n # could use regex here but this is actually simpler with the potential\n # absence of a trailing slash\n split = urlPath.split('/')\n app_id = split[1] if len(split) >= 2 else None\n\n if len(split) >= 5 and split[4] == \"parent\":\n parent_id = split[5]\n case_id = split[7] if len(split) >= 7 else None\n else:\n parent_id = None\n case_id = split[5] if len(split) >= 6 else None\n\n app = None\n if app_id:\n if app_id in [a['_id'] for a in apps]:\n app = look_up_app_json(domain, app_id)\n else:\n messages.info(request, _(\"That app is no longer valid. Try using the \"\n \"navigation links to select an app.\"))\n if app is None and len(apps) == 1:\n app = look_up_app_json(domain, apps[0]['_id'])\n\n def _get_case(domain, case_id):\n case = accessor.get_case(case_id)\n assert case.domain == domain, \"case %s not in %s\" % (case_id, domain)\n return case.to_api_json()\n\n case = _get_case(domain, case_id) if case_id else None\n if parent_id is None and case is not None:\n parent_id = case.get('indices', {}).get('parent', {}).get('case_id', None)\n parent = _get_case(domain, parent_id) if parent_id else None\n\n return {\n \"app\": app,\n \"case\": case,\n \"parent\": parent\n }\n\n context = {\n \"domain\": domain,\n \"language\": language,\n \"apps\": apps,\n \"apps_raw\": apps,\n \"preview\": preview,\n \"maps_api_key\": settings.GMAPS_API_KEY,\n \"offline_enabled\": toggles.OFFLINE_CLOUDCARE.enabled(request.user.username),\n \"sessions_enabled\": request.couch_user.is_commcare_user(),\n \"use_cloudcare_releases\": request.project.use_cloudcare_releases,\n \"username\": request.user.username,\n }\n context.update(_url_context())\n return render(request, \"cloudcare/cloudcare_home.html\", context)", "metadata": "root.CloudcareMain.get", "header": "['class', 'CloudcareMain', '(', 'View', ')', ':', '___EOS___']", "index": 93 }, { "content": "@login_and_domain_required\n@requires_privilege_for_commcare_user(privileges.CLOUDCARE)\ndef form_context(request, domain, app_id, module_id, form_id):\n app = Application.get(app_id)\n form_url = '{}{}'.format(\n settings.CLOUDCARE_BASE_URL or get_url_base(),\n reverse('download_xform', args=[domain, app_id, module_id, form_id])\n )\n case_id = request.GET.get('case_id')\n instance_id = request.GET.get('instance_id')\n try:\n form = app.get_module(module_id).get_form(form_id)\n except (FormNotFoundException, ModuleNotFoundException):\n raise Http404()\n\n form_name = form.name.values()[0]\n\n # make the name for the session we will use with the case and form\n session_name = u'{app} > {form}'.format(\n app=app.name,\n form=form_name,\n )\n\n if case_id:\n case = CaseAccessors(domain).get_case(case_id)\n session_name = u'{0} - {1}'.format(session_name, case.name)\n\n root_context = {\n 'form_url': form_url,\n }\n if instance_id:\n try:\n root_context['instance_xml'] = FormAccessors(domain).get_form(instance_id).get_xml()\n except XFormNotFound:\n raise Http404()\n\n session_extras = {'session_name': session_name, 'app_id': app._id}\n session_extras.update(get_cloudcare_session_data(domain, form, request.couch_user))\n\n delegation = request.GET.get('task-list') == 'true'\n session_helper = CaseSessionDataHelper(domain, request.couch_user, case_id, app, form, delegation=delegation)\n return json_response(session_helper.get_full_context(\n root_context,\n session_extras\n ))", "metadata": "root.form_context", "header": "['module', '___EOS___']", "index": 209 }, { "content": "def get_cases_vary_on(request, domain):\n request_params = request.GET\n\n return [\n request.couch_user.get_id\n if request.couch_user.is_commcare_user() else request_params.get('user_id', ''),\n request_params.get('ids_only', 'false'),\n request_params.get('case_id', ''),\n request_params.get('footprint', 'false'),\n request_params.get('closed', 'false'),\n json.dumps(get_filters_from_request_params(request_params)),\n domain,\n ]", "metadata": "root.get_cases_vary_on", "header": "['module', '___EOS___']", "index": 259 }, { "content": "def get_cases_skip_arg(request, domain):\n \"\"\"\n When this function returns True, skippable_quickcache will not go to the cache for the result. By default,\n if neither of these params are passed into the function, nothing will be cached. Cache will always be\n skipped if ids_only is false.\n\n The caching is mainly a hack for touchforms to respond more quickly. Touchforms makes repeated requests to\n get the list of case_ids associated with a user.\n \"\"\"\n if not toggles.CLOUDCARE_CACHE.enabled(domain):\n return True\n request_params = request.GET\n return (not string_to_boolean(request_params.get('use_cache', 'false')) or\n not string_to_boolean(request_params.get('ids_only', 'false')))", "metadata": "root.get_cases_skip_arg", "header": "['module', '___EOS___']", "index": 274 }, { "content": "@cloudcare_api\n@skippable_quickcache(get_cases_vary_on, get_cases_skip_arg, timeout=240 * 60)\ndef get_cases(request, domain):\n request_params = request.GET\n\n if request.couch_user.is_commcare_user():\n user_id = request.couch_user.get_id\n else:\n user_id = request_params.get(\"user_id\", \"\")\n\n if not user_id and not request.couch_user.is_web_user():\n return HttpResponseBadRequest(\"Must specify user_id!\")\n\n ids_only = string_to_boolean(request_params.get(\"ids_only\", \"false\"))\n case_id = request_params.get(\"case_id\", \"\")\n footprint = string_to_boolean(request_params.get(\"footprint\", \"false\"))\n accessor = CaseAccessors(domain)\n\n if toggles.HSPH_HACK.enabled(domain):\n hsph_case_id = request_params.get('hsph_hack', None)\n if hsph_case_id != 'None' and hsph_case_id and user_id:\n case = accessor.get_case(hsph_case_id)\n usercase_id = CommCareUser.get_by_user_id(user_id).get_usercase_id()\n usercase = accessor.get_case(usercase_id) if usercase_id else None\n return json_response(map(\n lambda case: CaseAPIResult(id=case['_id'], couch_doc=case, id_only=ids_only),\n filter(None, [case, case.parent, usercase])\n ))\n\n if case_id and not footprint:\n # short circuit everything else and just return the case\n # NOTE: this allows any user in the domain to access any case given\n # they know its ID, which is slightly different from the previous\n # behavior (can only access things you own + footprint). If we want to\n # change this contract we would need to update this to check the\n # owned case list + footprint\n case = accessor.get_case(case_id)\n assert case.domain == domain\n cases = [CaseAPIResult(id=case_id, couch_doc=case, id_only=ids_only)]\n else:\n filters = get_filters_from_request_params(request_params)\n status = api_closed_to_status(request_params.get('closed', 'false'))\n case_type = filters.get('properties/case_type', None)\n cases = get_filtered_cases(domain, status=status, case_type=case_type,\n user_id=user_id, filters=filters,\n footprint=footprint, ids_only=ids_only,\n strip_history=True)\n return json_response(cases)", "metadata": "root.get_cases", "header": "['module', '___EOS___']", "index": 290 }, { "content": "@cloudcare_api\ndef filter_cases(request, domain, app_id, module_id, parent_id=None):\n app = Application.get(app_id)\n module = app.get_module(module_id)\n auth_cookie = request.COOKIES.get('sessionid')\n requires_parent_cases = string_to_boolean(request.GET.get('requires_parent_cases', 'false'))\n\n xpath = EntriesHelper.get_filter_xpath(module)\n instances = get_instances_for_module(app, module, additional_xpaths=[xpath])\n extra_instances = [{'id': inst.id, 'src': inst.src} for inst in instances]\n use_formplayer = toggles.USE_FORMPLAYER.enabled(domain)\n accessor = CaseAccessors(domain)\n\n # touchforms doesn't like this to be escaped\n xpath = HTMLParser.HTMLParser().unescape(xpath)\n case_type = module.case_type\n\n if xpath or should_use_sql_backend(domain):\n # if we need to do a custom filter, send it to touchforms for processing\n additional_filters = {\n \"properties/case_type\": case_type,\n \"footprint\": True\n }\n\n helper = BaseSessionDataHelper(domain, request.couch_user)\n result = helper.filter_cases(xpath, additional_filters, DjangoAuth(auth_cookie),\n extra_instances=extra_instances, use_formplayer=use_formplayer)\n if result.get('status', None) == 'error':\n code = result.get('code', 500)\n message = result.get('message', _(\"Something went wrong filtering your cases.\"))\n if code == 500:\n notify_exception(None, message=message)\n return json_response(message, status_code=code)\n\n case_ids = result.get(\"cases\", [])\n else:\n # otherwise just use our built in api with the defaults\n case_ids = [res.id for res in get_filtered_cases(\n domain,\n status=CASE_STATUS_OPEN,\n case_type=case_type,\n user_id=request.couch_user._id,\n footprint=True,\n ids_only=True,\n )]\n\n cases = accessor.get_cases(case_ids)\n\n if parent_id:\n cases = filter(lambda c: c.parent and c.parent.case_id == parent_id, cases)\n\n # refilter these because we might have accidentally included footprint cases\n # in the results from touchforms. this is a little hacky but the easiest\n # (quick) workaround. should be revisted when we optimize the case list.\n cases = filter(lambda c: c.type == case_type, cases)\n cases = [c.to_api_json(lite=True) for c in cases if c]\n\n response = {'cases': cases}\n if requires_parent_cases:\n # Subtract already fetched cases from parent list\n parent_ids = set(map(lambda c: c['indices']['parent']['case_id'], cases)) - \\\n set(map(lambda c: c['case_id'], cases))\n parents = accessor.get_cases(list(parent_ids))\n parents = [c.to_api_json(lite=True) for c in parents]\n response.update({'parents': parents})\n\n return json_response(response)", "metadata": "root.filter_cases", "header": "['module', '___EOS___']", "index": 340 }, { "content": "@cloudcare_api\ndef get_apps_api(request, domain):\n return json_response(get_cloudcare_apps(domain))", "metadata": "root.get_apps_api", "header": "['module', '___EOS___']", "index": 409 }, { "content": "@cloudcare_api\ndef get_app_api(request, domain, app_id):\n try:\n return json_response(look_up_app_json(domain, app_id))\n except RemoteAppError:\n raise Http404()", "metadata": "root.get_app_api", "header": "['module', '___EOS___']", "index": 413 }, { "content": "@cloudcare_api\n@cache_page(60 * 30)\ndef get_fixtures(request, domain, user_id, fixture_id=None):\n try:\n user = CommCareUser.get_by_user_id(user_id)\n except CouchUser.AccountTypeError:\n err = (\"You can't use case sharing or fixtures as a %s. \" \n \"Login as a mobile worker and try again.\") % settings.WEB_USER_TERM,\n return HttpResponse(err, status=412, content_type=\"text/plain\")\n \n if not user:\n raise Http404\n\n assert user.is_member_of(domain)\n casexml_user = user.to_casexml_user()\n if not fixture_id:\n ret = ElementTree.Element(\"fixtures\")\n for fixture in generator.get_fixtures(casexml_user, version=V2):\n ret.append(fixture)\n return HttpResponse(ElementTree.tostring(ret), content_type=\"text/xml\")\n else:\n fixture = generator.get_fixture_by_id(fixture_id, casexml_user, version=V2)\n if not fixture:\n raise Http404\n assert len(fixture.getchildren()) == 1, 'fixture {} expected 1 child but found {}'.format(\n fixture_id, len(fixture.getchildren())\n )\n return HttpResponse(ElementTree.tostring(fixture.getchildren()[0]), content_type=\"text/xml\")", "metadata": "root.get_fixtures", "header": "['module', '___EOS___']", "index": 421 }, { "content": "@cloudcare_api\ndef get_sessions(request, domain):\n # is it ok to pull user from the request? other api calls seem to have an explicit 'user' param\n skip = request.GET.get('skip') or 0\n limit = request.GET.get('limit') or 10\n return json_response(get_open_form_sessions(request.user, skip=skip, limit=limit))", "metadata": "root.get_sessions", "header": "['module', '___EOS___']", "index": 451 }, { "content": "@cloudcare_api\ndef get_session_context(request, domain, session_id):\n # NOTE: although this view does not appeared to be called from anywhere it is, and cannot be deleted.\n # The javascript routing in cloudcare depends on it, though constructs it manually in a hardcoded way.\n # see getSessionContextUrl in cloudcare/util.js\n # Adding 'cloudcare_get_session_context' to this comment so that the url name passes a grep test\n try:\n session = EntrySession.objects.get(session_id=session_id)\n except EntrySession.DoesNotExist:\n session = None\n if request.method == 'DELETE':\n if session:\n session.delete()\n return json_response({'status': 'success'})\n else:\n helper = BaseSessionDataHelper(domain, request.couch_user)\n return json_response(helper.get_full_context({\n 'session_id': session_id,\n 'app_id': session.app_id if session else None\n }))", "metadata": "root.get_session_context", "header": "['module', '___EOS___']", "index": 459 }, { "content": "@cloudcare_api\ndef get_ledgers(request, domain):\n \"\"\"\n Returns ledgers associated with a case in the format:\n {\n \"section_id\": {\n \"product_id\": amount,\n \"product_id\": amount,\n ...\n },\n ...\n }\n\n Note: this only works for the Couch backend\n \"\"\"\n request_params = request.GET\n case_id = request_params.get('case_id')\n if not case_id:\n return json_response(\n {'message': 'You must specify a case id to make this query.'},\n status_code=400\n )\n try:\n case = CaseAccessors(domain).get_case(case_id)\n except CaseNotFound:\n raise Http404()\n ledger_map = get_current_ledger_transactions(case.case_id)\n def custom_json_handler(obj):\n if isinstance(obj, StockTransaction):\n return obj.stock_on_hand\n return json_handler(obj)\n\n return json_response(\n {\n 'entity_id': case_id,\n 'ledger': ledger_map,\n },\n default=custom_json_handler,\n )", "metadata": "root.get_ledgers", "header": "['module', '___EOS___']", "index": 481 }, { "content": "@cloudcare_api\ndef sync_db_api(request, domain):\n auth_cookie = request.COOKIES.get('sessionid')\n username = request.GET.get('username')\n try:\n sync_db(username, domain, DjangoAuth(auth_cookie))\n return json_response({\n 'status': 'OK'\n })\n except Exception, e:\n return HttpResponse(e, status=500, content_type=\"text/plain\")", "metadata": "root.sync_db_api", "header": "['module', '___EOS___']", "index": 522 }, { "content": "@cloudcare_api\ndef render_form(request, domain):\n # get session\n session_id = request.GET.get('session_id')\n\n session = get_object_or_404(EntrySession, session_id=session_id)\n\n try:\n raw_instance = get_raw_instance(session_id, domain)\n except Exception, e:\n return HttpResponse(e, status=500, content_type=\"text/plain\")\n\n xmlns = raw_instance[\"xmlns\"]\n form_data_xml = raw_instance[\"output\"]\n\n _, form_data_json = xml2json(form_data_xml)\n pretty_questions = readable.get_questions(domain, session.app_id, xmlns)\n\n readable_form = readable.get_readable_form_data(form_data_json, pretty_questions)\n\n rendered_readable_form = render_to_string(\n 'reports/form/partials/readable_form.html',\n {'questions': readable_form}\n )\n\n return json_response({\n 'form_data': rendered_readable_form,\n 'instance_xml': indent_xml(form_data_xml)\n })", "metadata": "root.render_form", "header": "['module', '___EOS___']", "index": 535 }, { "content": "class HttpResponseConflict(HttpResponse):\n status_code = 409", "metadata": "root.HttpResponseConflict", "header": "['module', '___EOS___']", "index": 566 }, { "content": "class EditCloudcareUserPermissionsView(BaseUserSettingsView):\n template_name = 'cloudcare/config.html'\n urlname = 'cloudcare_app_settings'\n page_title = ugettext_noop(\"CloudCare Permissions\")\n\n\n", "metadata": "root.EditCloudcareUserPermissionsView", "header": "['module', '___EOS___']", "index": 570 }, { "content": " @method_decorator(domain_admin_required)\n @method_decorator(requires_privilege_with_fallback(privileges.CLOUDCARE))\n @use_bootstrap3\n def dispatch(self, request, *args, **kwargs):\n return super(EditCloudcareUserPermissionsView, self).dispatch(request, *args, **kwargs)", "metadata": "root.EditCloudcareUserPermissionsView.dispatch", "header": "['class', 'EditCloudcareUserPermissionsView', '(', 'BaseUserSettingsView', ')', ':', '___EOS___']", "index": 575 }, { "content": " @property\n def page_context(self):\n apps = get_cloudcare_apps(self.domain)\n access = ApplicationAccess.get_template_json(self.domain, apps)\n groups = Group.by_domain(self.domain)\n return {\n 'apps': apps,\n 'groups': groups,\n 'access': access,\n }", "metadata": "root.EditCloudcareUserPermissionsView.page_context", "header": "['class', 'EditCloudcareUserPermissionsView', '(', 'BaseUserSettingsView', ')', ':', '___EOS___']", "index": 581 }, { "content": " def put(self, request, *args, **kwargs):\n j = json.loads(request.body)\n old = ApplicationAccess.get_by_domain(self.domain)\n new = ApplicationAccess.wrap(j)\n old.restrict = new.restrict\n old.app_groups = new.app_groups\n try:\n if old._rev != new._rev or old._id != new._id:\n raise ResourceConflict()\n old.save()\n except ResourceConflict:\n return HttpResponseConflict()\n else:\n return json_response({'_rev': old._rev})", "metadata": "root.EditCloudcareUserPermissionsView.put", "header": "['class', 'EditCloudcareUserPermissionsView', '(', 'BaseUserSettingsView', ')', ':', '___EOS___']", "index": 592 } ]
[ { "span": "from couchdbkit import ResourceConflict, ResourceNotFound", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 57 }, { "span": "from corehq.util.couch import get_document_or_404", "start_line": 66, "start_column": 0, "end_line": 66, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "HTM", "LP", "arser", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "etree_", "import_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Response_", ",_", "Http", "Respons", "e", "Ba", "d", "Request_", ",_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "._", "loader_", "import_", "render", "\\u", "to", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "decorators_", "import_", "method", "\\u", "decorator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", ",_", "uge", "ttext", "\\u", "noop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "decorators_", "._", "cache_", "import_", "cache", "\\u", "page_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "generic_", "import_", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "couchdb", "kit_", "import_", "Reso", "urc", "e", "Conflict_", ",_", "Reso", "urc", "e", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "case_", "._", "models_", "import_", "CASE", "\\u", "STATUS", "\\u", "OPEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "case_", "._", "xml_", "import_", "V2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "phone_", "._", "fixtures_", "import_", "generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "stock_", "._", "models_", "import_", "Stock", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "case", "xml_", "._", "apps_", "._", "stock_", "._", "utils_", "import_", "get", "\\u", "current", "\\u", "ledger", "\\u", "transactions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "utils_", "import_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "logging_", "import_", "notif", "y", "\\u", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "parsing_", "import_", "string", "\\u", "to", "\\u", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "web_", "import_", "json", "\\u", "response_", ",_", "get", "\\u", "url", "\\u", "base_", ",_", "json", "\\u", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "touch", "forms_", "._", "form", "player_", "._", "api_", "import_", "Dj", "ang", "o", "Auth_", ",_", "get", "\\u", "raw", "\\u", "instance_", ",_", "sync", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "touch", "forms_", "._", "form", "player_", "._", "models_", "import_", "Entr", "y", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml", "2j", "son_", "._", "lib_", "import_", "xml", "2j", "son_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core", "hq", "_", "import_", "toggle", "s_", ",_", "privilege", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "accounti", "ng_", "._", "decorators_", "import_", "require", "s", "\\u", "privilege", "\\u", "for", "\\u", "comm", "care", "\\u", "user_", ",_", "require", "s", "\\u", "privilege", "\\u", "with", "\\u", "fallback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "dba", "ccess", "ors_", "import_", "get", "\\u", "app_", ",_", "get", "\\u", "late", "st", "\\u", "build", "\\u", "doc_", ",_", "get", "\\u", "brief", "\\u", "apps", "\\u", "in", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "exceptions_", "import_", "Form", "Not", "Foun", "d", "Exception_", ",_", "Modul", "e", "Not", "Foun", "d", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "models_", "import_", "Application_", ",_", "Applica", "tion", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "suit", "e\\u", "xml_", "._", "sections_", "._", "details_", "import_", "get", "\\u", "instance", "s", "\\u", "for", "\\u", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "suit", "e\\u", "xml_", "._", "sections_", "._", "entries_", "import_", "Entr", "ies", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "util_", "import_", "get", "\\u", "cloud", "care", "\\u", "session", "\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "cloud", "care", "_", "._", "api_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "close", "d\\u", "to", "\\u", "status_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Case", "API", "Result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "app", "\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "filter", "ed", "\\u", "cases_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "filter", "s", "\\u", "from", "\\u", "request", "\\u", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "open", "\\u", "form", "\\u", "sessions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "look", "\\u", "up", "\\u", "app", "\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "cloud", "care", "_", "._", "dba", "ccess", "ors_", "import_", "get", "\\u", "cloud", "care", "\\u", "apps_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "cloud", "care", "_", "._", "decorators_", "import_", "require", "\\u", "cloud", "care", "\\u", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "cloud", "care", "_", "._", "exceptions_", "import_", "Remo", "te", "App", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "cloud", "care", "_", "._", "models_", "import_", "Applica", "tion", "Access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "cloud", "care", "_", "._", "touch", "forms", "\\u", "api_", "import_", "Base", "Sess", "ion", "Data", "Helper_", ",_", "Case", "Sess", "ion", "Data", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "domain_", "._", "decorators_", "import_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", ",_", "login", "\\u", "or", "\\u", "digest", "\\u", "ex_", ",_", "domain", "\\u", "admin", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "groups_", "._", "models_", "import_", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "reports_", "._", "form", "details_", "import_", "readable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "style_", "._", "decorators_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "datata", "bles_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "boots", "trap", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "jq", "uer", "y", "\\u", "ui_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "models_", "import_", "Cou", "ch", "User_", ",_", "Comm", "Care", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "views_", "import_", "Base", "User", "Sett", "ings", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "interfaces_", "._", "dba", "ccess", "ors_", "import_", "Case", "Accessor", "s_", ",_", "Form", "Accessor", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "form", "\\u", "processor_", "._", "exceptions_", "import_", "XF", "orm", "Not", "Found_", ",_", "Case", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "couch", "_", "import_", "get", "\\u", "document", "\\u", "or", "\\u", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "quick", "cache_", "import_", "skip", "pab", "le", "\\u", "quick", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "util_", "._", "xml", "\\u", "utils_", "import_", "indent", "\\u", "xml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cloud", "care", "\\u", "api_", "=_", "login", "\\u", "or", "\\u", "digest", "\\u", "ex_", "(_", "allow", "\\u", "cc", "\\u", "users_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "require", "\\u", "cloud", "care", "\\u", "access_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "default_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "reverse_", "(_", "'", "cloud", "care", "\\u", "main", "'_", ",_", "args_", "=_", "[_", "domain_", ",_", "''_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "insuf", "ficient", "\\u", "privilege", "_", "(_", "request_", ",_", "domain_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "domain", "'_", ":_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "\"", "cloud", "care", "/", "insuf", "ficient", "\\u", "privilege", ".", "html", "\"_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Cloud", "care", "Main_", "(_", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "care", "Main_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "datata", "bles_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "jq", "uer", "y", "\\u", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "require", "\\u", "cloud", "care", "\\u", "access_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "require", "s", "\\u", "privilege", "\\u", "for", "\\u", "comm", "care", "\\u", "user_", "(_", "privilege", "s_", "._", "CLOUD", "CAR", "E_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Cloud", "care", "Main_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cloud", "care", "Main_", "(_", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "request_", ",_", "domain_", ",_", "url", "Path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preview_", "=_", "string", "\\u", "to", "\\u", "boolean_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "\"", "previe", "w", "\"_", ",_", "\"", "fal", "se", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "typical", "ly", " ", "only", " ", "set", " ", "at", " ", "all", " ", "if", " ", "it", "'", "s", " ", "inten", "ded", " ", "to", " ", "be", " ", "true", " ", "so", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "a", " ", "reason", "able", " ", "default", " ", "for", " ", "\"", "somet", "hing", " ", "wen", "t", " ", "wrong", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preview_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "access_", "=_", "Applica", "tion", "Access_", "._", "get", "\\u", "by", "\\u", "domain_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accessor_", "=_", "Case", "Accessor", "s_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "preview_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "get", "\\u", "cloud", "care", "\\u", "apps_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "project_", "._", "use", "\\u", "cloud", "care", "\\u", "releases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "the", " ", "apps", " ", "with", " ", "the", " ", "last", " ", "starred", " ", "build", " ", "of", " ", "each", " ", "app", ",", " ", "remo", "ving", " ", "the", " ", "ones", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "starred", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "app_", ":_", "app_", "._", "is", "\\u", "released", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "get", "\\u", "app_", "(_", "domain_", ",_", "app_", "[_", "'\\u", "id", "'_", "]_", ",_", "latest_", "=_", "True_", ")_", "for_", "app_", "in_", "apps_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", " ", "to", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "apps_", "=_", "[_", "get", "\\u", "app", "\\u", "json_", "(_", "app_", ")_", "for_", "app_", "in_", "apps_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "lega", "cy", " ", "functional", "it", "y", " ", "-", " ", "use", " ", "the", " ", "late", "st", " ", "build", " ", "rega", "rd", "less", " ", "of", " ", "stars_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "[_", "get", "\\u", "late", "st", "\\u", "build", "\\u", "doc_", "(_", "domain_", ",_", "app_", "[_", "'\\u", "id", "'_", "]_", ")_", "for_", "app_", "in_", "apps_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps_", "=_", "[_", "get", "\\u", "app", "\\u", "json_", "(_", "Applica", "tion", "Base_", "._", "wrap_", "(_", "app_", ")_", ")_", "for_", "app_", "in_", "apps_", "if_", "app_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "get", "\\u", "brief", "\\u", "apps", "\\u", "in", "\\u", "domain_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps_", "=_", "[_", "get", "\\u", "app", "\\u", "json_", "(_", "app_", ")_", "for_", "app_", "in_", "apps_", "if_", "app_", "and_", "app_", "._", "applica", "tion", "\\u", "version_", "==_", "V2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "trim", " ", "out", " ", "empty", " ", "apps_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "apps_", "=_", "filter_", "(_", "lambda_", "app_", ":_", "app_", ",_", "apps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apps_", "=_", "filter_", "(_", "lambda_", "app_", ":_", "app", "\\u", "access_", "._", "user", "\\u", "can", "\\u", "access", "\\u", "app_", "(_", "request_", "._", "couch", "\\u", "user_", ",_", "app_", ")_", ",_", "apps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "default", "\\u", "lang_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "apps_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "unfo", "rtu", "nat", "el", "y", " ", "we", " ", "have", " ", "to", " ", "go", " ", "back", " ", "to", " ", "the", " ", "DB", " ", "to", " ", "find", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Application_", "._", "get_", "(_", "apps_", "[_", "0_", "]_", "[_", "\"\\u", "id", "\"_", "]_", ")_", "._", "build", "\\u", "langs_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "en", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "language", " ", "to", " ", "user", "'", "s", " ", "preference", ",", " ", "followe", "d", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "app", "'", "s", " ", "default", ",", " ", "followe", "d", " ", "by", " ", "english", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "language_", "=_", "request_", "._", "couch", "\\u", "user_", "._", "language_", "or_", "\\u", "default", "\\u", "lang_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "url", "\\u", "context_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "give", "n", " ", "a", " ", "url", " ", "path", ",", " ", "return", "s", " ", "potenti", "ally", " ", "the", " ", "app", ",", " ", "parent", ",", " ", "and", " ", "case", ",", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", "'", "re", " ", "selecte", "d", ".", " ", "the", " ", "front", " ", "end", " ", "optimize", "s", " ", "with", " ", "these", " ", "to", " ", "avoid", " ", "excess", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "server", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", "'", "s", " ", "an", " ", "anno", "ying", " ", "dependen", "cy", " ", "bet", "ween", " ", "this", " ", "logic", " ", "and", " ", "backbone", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "url", " ", "routin", "g", " ", "tha", "t", " ", "see", "ms", " ", "hard", " ", "to", " ", "solve", " ", "well", ".", " ", "this", " ", "need", "s", " ", "to", " ", "be", " ", "synced", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "apps", ".", "js", " ", "if", " ", "anyt", "hing", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "apps", " ", "anyt", "hing", " ", "with", " ", "\"", "view", "/", "app", "/\"", " ", "works_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "case", "s", " ", "it", " ", "will", " ", "be", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "view", "/", ":", "app", "/", ":", "module", "/", ":", "form", "/", "case", "/", ":", "case", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "are", " ", "parent", " ", "case", "s", ",", " ", "it", " ", "will", " ", "be", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "view", "/", ":", "app", "/", ":", "module", "/", ":", "form", "/", "parent", "/", ":", "parent", "/", "case", "/", ":", "case", "/_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "coul", "d", " ", "use", " ", "regex", " ", "here", " ", "but", " ", "this", " ", "is", " ", "actual", "ly", " ", "simple", "r", " ", "with", " ", "the", " ", "potential_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "absen", "ce", " ", "of", " ", "a", " ", "trail", "ing", " ", "slash_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "split_", "=_", "url", "Path_", "._", "split_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "id_", "=_", "split_", "[_", "1_", "]_", "if_", "len_", "(_", "split_", ")_", ">=_", "2_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "split_", ")_", ">=_", "5_", "and_", "split_", "[_", "4_", "]_", "==_", "\"", "parent", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "id_", "=_", "split_", "[_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "id_", "=_", "split_", "[_", "7_", "]_", "if_", "len_", "(_", "split_", ")_", ">=_", "7_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "id_", "=_", "split_", "[_", "5_", "]_", "if_", "len_", "(_", "split_", ")_", ">=_", "6_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "app", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "app", "\\u", "id_", "in_", "[_", "a_", "[_", "'\\u", "id", "'_", "]_", "for_", "a_", "in_", "apps_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "app_", "=_", "look", "\\u", "up", "\\u", "app", "\\u", "json_", "(_", "domain_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "messages_", "._", "info_", "(_", "request_", ",_", "\\u_", "(_", "\"", "Tha", "t", " ", "app", " ", "is", " ", "no", " ", "long", "er", " ", "valid", ".", " ", "Tr", "y", " ", "usi", "ng", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "navigation", " ", "link", "s", " ", "to", " ", "select", " ", "an", " ", "app", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app_", "is_", "None_", "and_", "len_", "(_", "apps_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "look", "\\u", "up", "\\u", "app", "\\u", "json_", "(_", "domain_", ",_", "apps_", "[_", "0_", "]_", "[_", "'\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "case_", "(_", "domain_", ",_", "case", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case_", "=_", "accessor_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "case_", "._", "domain_", "==_", "domain_", ",_", "\"", "case", " ", "%", "s", " ", "not", " ", "in", " ", "%", "s", "\"_", "%_", "(_", "case", "\\u", "id_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "case_", "._", "to", "\\u", "api", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "case_", "=_", "\\u", "get", "\\u", "case_", "(_", "domain_", ",_", "case", "\\u", "id_", ")_", "if_", "case", "\\u", "id_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parent", "\\u", "id_", "is_", "None_", "and_", "case_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "id_", "=_", "case_", "._", "get_", "(_", "'", "indice", "s", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "'", "parent", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "'", "case", "\\u", "id", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent_", "=_", "\\u", "get", "\\u", "case_", "(_", "domain_", ",_", "parent", "\\u", "id_", ")_", "if_", "parent", "\\u", "id_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "app", "\"_", ":_", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "case", "\"_", ":_", "case_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "parent", "\"_", ":_", "parent_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "domain", "\"_", ":_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "language", "\"_", ":_", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apps", "\"_", ":_", "apps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "apps", "\\u", "raw", "\"_", ":_", "apps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "previe", "w", "\"_", ":_", "preview_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "maps", "\\u", "api", "\\u", "key", "\"_", ":_", "settings_", "._", "GMA", "PS", "\\u", "API", "\\u", "KEY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "offline", "\\u", "enable", "d", "\"_", ":_", "toggle", "s_", "._", "OFF", "LINE", "\\u", "CLOUD", "CAR", "E_", "._", "enabled_", "(_", "request_", "._", "user_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "session", "s", "\\u", "enable", "d", "\"_", ":_", "request_", "._", "couch", "\\u", "user_", "._", "is", "\\u", "comm", "care", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "cloud", "care", "\\u", "release", "s", "\"_", ":_", "request_", "._", "project_", "._", "use", "\\u", "cloud", "care", "\\u", "releases_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "name", "\"_", ":_", "request_", "._", "user_", "._", "username_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "._", "update_", "(_", "\\u", "url", "\\u", "context_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "\"", "cloud", "care", "/", "cloud", "care", "\\u", "home", ".", "html", "\"_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "and", "\\u", "domain", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "privilege", "\\u", "for", "\\u", "comm", "care", "\\u", "user_", "(_", "privilege", "s_", "._", "CLOUD", "CAR", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "form", "\\u", "context_", "(_", "request_", ",_", "domain_", ",_", "app", "\\u", "id_", ",_", "module", "\\u", "id_", ",_", "form", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "Application_", "._", "get_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "url_", "=_", "'{}{}", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "CLOUD", "CAR", "E", "\\u", "BASE", "\\u", "URL_", "or_", "get", "\\u", "url", "\\u", "base_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reverse_", "(_", "'", "download", "\\u", "xform", "'_", ",_", "args_", "=_", "[_", "domain_", ",_", "app", "\\u", "id_", ",_", "module", "\\u", "id_", ",_", "form", "\\u", "id_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "id_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "case", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "instance", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "app_", "._", "get", "\\u", "module_", "(_", "module", "\\u", "id_", ")_", "._", "get", "\\u", "form_", "(_", "form", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Form", "Not", "Foun", "d", "Exception_", ",_", "Modul", "e", "Not", "Foun", "d", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "form", "\\u", "name_", "=_", "form_", "._", "name_", "._", "values_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "make", " ", "the", " ", "name", " ", "for", " ", "the", " ", "session", " ", "we", " ", "will", " ", "use", " ", "with", " ", "the", " ", "case", " ", "and", " ", "form_", "\\u\\u\\uNL\\u\\u\\u_", "session", "\\u", "name_", "=_", "u", "'{", "app", "}", " ", ">", " ", "{", "form", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "app_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "form", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "case", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case_", "=_", "Case", "Accessor", "s_", "(_", "domain_", ")_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "name_", "=_", "u", "'{", "0", "}", " ", "-", " ", "{", "1", "}'_", "._", "format_", "(_", "session", "\\u", "name_", ",_", "case_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "url", "'_", ":_", "form", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "\\u", "context_", "[_", "'", "instance", "\\u", "xml", "'_", "]_", "=_", "Form", "Accessor", "s_", "(_", "domain_", ")_", "._", "get", "\\u", "form_", "(_", "instance", "\\u", "id_", ")_", "._", "get", "\\u", "xml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "XF", "orm", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session", "\\u", "extras_", "=_", "{_", "'", "session", "\\u", "name", "'_", ":_", "session", "\\u", "name_", ",_", "'", "app", "\\u", "id", "'_", ":_", "app_", "._", "\\u", "id_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "extras_", "._", "update_", "(_", "get", "\\u", "cloud", "care", "\\u", "session", "\\u", "data_", "(_", "domain_", ",_", "form_", ",_", "request_", "._", "couch", "\\u", "user_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delegat", "ion_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "task", "-", "list", "'_", ")_", "==_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session", "\\u", "helper_", "=_", "Case", "Sess", "ion", "Data", "Helper_", "(_", "domain_", ",_", "request_", "._", "couch", "\\u", "user_", ",_", "case", "\\u", "id_", ",_", "app_", ",_", "form_", ",_", "delegat", "ion_", "=_", "delegat", "ion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "session", "\\u", "helper_", "._", "get", "\\u", "full", "\\u", "context_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "root", "\\u", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "session", "\\u", "extras_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "case", "s", "\\u", "vary", "\\u", "on_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "params_", "=_", "request_", "._", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "couch", "\\u", "user_", "._", "get", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "couch", "\\u", "user_", "._", "is", "\\u", "comm", "care", "\\u", "user_", "(_", ")_", "else_", "request", "\\u", "params_", "._", "get_", "(_", "'", "user", "\\u", "id", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "params_", "._", "get_", "(_", "'", "ids", "\\u", "only", "'_", ",_", "'", "fal", "se", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "params_", "._", "get_", "(_", "'", "case", "\\u", "id", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "params_", "._", "get_", "(_", "'", "footprint", "'_", ",_", "'", "fal", "se", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "params_", "._", "get_", "(_", "'", "close", "d", "'_", ",_", "'", "fal", "se", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "json_", "._", "dumps_", "(_", "get", "\\u", "filter", "s", "\\u", "from", "\\u", "request", "\\u", "params_", "(_", "request", "\\u", "params_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "case", "s", "\\u", "skip", "\\u", "arg_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "this", " ", "function", " ", "return", "s", " ", "Tru", "e", ",", " ", "skip", "pab", "le", "\\u", "quick", "cache", " ", "will", " ", "not", " ", "go", " ", "to", " ", "the", " ", "cache", " ", "for", " ", "the", " ", "result", ".", " ", "By", " ", "default", ",", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "nei", "ther", " ", "of", " ", "these", " ", "params", " ", "are", " ", "pass", "ed", " ", "int", "o", " ", "the", " ", "function", ",", " ", "not", "hing", " ", "will", " ", "be", " ", "cache", "d", ".", " ", "Cache", " ", "will", " ", "alw", "ay", "s", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "skip", "ped", " ", "if", " ", "ids", "\\u", "only", " ", "is", " ", "fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "caching", " ", "is", " ", "mainl", "y", " ", "a", " ", "hack", " ", "for", " ", "touch", "forms", " ", "to", " ", "respond", " ", "more", " ", "quickl", "y", ".", " ", "Tou", "ch", "forms", " ", "make", "s", " ", "repeated", " ", "request", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "the", " ", "list", " ", "of", " ", "case", "\\u", "ids", " ", "associate", "d", " ", "with", " ", "a", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "toggle", "s_", "._", "CLOUD", "CAR", "E", "\\u", "CACHE_", "._", "enabled_", "(_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request", "\\u", "params_", "=_", "request_", "._", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "not_", "string", "\\u", "to", "\\u", "boolean_", "(_", "request", "\\u", "params_", "._", "get_", "(_", "'", "use", "\\u", "cache", "'_", ",_", "'", "fal", "se", "'_", ")_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "string", "\\u", "to", "\\u", "boolean_", "(_", "request", "\\u", "params_", "._", "get_", "(_", "'", "ids", "\\u", "only", "'_", ",_", "'", "fal", "se", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "skip", "pab", "le", "\\u", "quick", "cache_", "(_", "get", "\\u", "case", "s", "\\u", "vary", "\\u", "on_", ",_", "get", "\\u", "case", "s", "\\u", "skip", "\\u", "arg_", ",_", "timeout_", "=_", "240_", "*_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "cases_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "params_", "=_", "request_", "._", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "couch", "\\u", "user_", "._", "is", "\\u", "comm", "care", "\\u", "user_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "id_", "=_", "request_", "._", "couch", "\\u", "user_", "._", "get", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "id_", "=_", "request", "\\u", "params_", "._", "get_", "(_", "\"", "user", "\\u", "id", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user", "\\u", "id_", "and_", "not_", "request_", "._", "couch", "\\u", "user_", "._", "is", "\\u", "web", "\\u", "user_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Ba", "d", "Request_", "(_", "\"", "Mus", "t", " ", "speci", "fy", " ", "user", "\\u", "id", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ids", "\\u", "only_", "=_", "string", "\\u", "to", "\\u", "boolean_", "(_", "request", "\\u", "params_", "._", "get_", "(_", "\"", "ids", "\\u", "only", "\"_", ",_", "\"", "fal", "se", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "id_", "=_", "request", "\\u", "params_", "._", "get_", "(_", "\"", "case", "\\u", "id", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "footprint", "_", "=_", "string", "\\u", "to", "\\u", "boolean_", "(_", "request", "\\u", "params_", "._", "get_", "(_", "\"", "footprint", "\"_", ",_", "\"", "fal", "se", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accessor_", "=_", "Case", "Accessor", "s_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "toggle", "s_", "._", "HS", "PH", "\\u", "HA", "CK_", "._", "enabled_", "(_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hsp", "h", "\\u", "case", "\\u", "id_", "=_", "request", "\\u", "params_", "._", "get_", "(_", "'", "hsp", "h", "\\u", "hack", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hsp", "h", "\\u", "case", "\\u", "id_", "!=_", "'", "Non", "e", "'_", "and_", "hsp", "h", "\\u", "case", "\\u", "id_", "and_", "user", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case_", "=_", "accessor_", "._", "get", "\\u", "case_", "(_", "hsp", "h", "\\u", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "case", "\\u", "id_", "=_", "Comm", "Care", "User_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "id_", "(_", "user", "\\u", "id_", ")_", "._", "get", "\\u", "user", "case", "\\u", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "case_", "=_", "accessor_", "._", "get", "\\u", "case_", "(_", "user", "case", "\\u", "id_", ")_", "if_", "user", "case", "\\u", "id_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "case_", ":_", "Case", "API", "Result_", "(_", "id_", "=_", "case_", "[_", "'\\u", "id", "'_", "]_", ",_", "couch", "\\u", "doc_", "=_", "case_", ",_", "id", "\\u", "only_", "=_", "ids", "\\u", "only_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filter_", "(_", "None_", ",_", "[_", "case_", ",_", "case_", "._", "parent_", ",_", "user", "case_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "case", "\\u", "id_", "and_", "not_", "footprint", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "short", " ", "circuit", " ", "every", "thing", " ", "else", " ", "and", " ", "just", " ", "return", " ", "the", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "this", " ", "allow", "s", " ", "any", " ", "user", " ", "in", " ", "the", " ", "domain", " ", "to", " ", "access", " ", "any", " ", "case", " ", "given_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "know", " ", "its", " ", "ID", ",", " ", "whi", "ch", " ", "is", " ", "slight", "ly", " ", "different", " ", "from", " ", "the", " ", "previous_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "behavior", " ", "(", "can", " ", "only", " ", "access", " ", "thing", "s", " ", "you", " ", "own", " ", "+", " ", "footprint", ").", " ", "If", " ", "we", " ", "want", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", " ", "this", " ", "contract", " ", "we", " ", "wou", "ld", " ", "need", " ", "to", " ", "update", " ", "this", " ", "to", " ", "check", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "owned", " ", "case", " ", "list", " ", "+", " ", "footprint", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case_", "=_", "accessor_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "case_", "._", "domain_", "==_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cases_", "=_", "[_", "Case", "API", "Result_", "(_", "id_", "=_", "case", "\\u", "id_", ",_", "couch", "\\u", "doc_", "=_", "case_", ",_", "id", "\\u", "only_", "=_", "ids", "\\u", "only_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filters_", "=_", "get", "\\u", "filter", "s", "\\u", "from", "\\u", "request", "\\u", "params_", "(_", "request", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "api", "\\u", "close", "d\\u", "to", "\\u", "status_", "(_", "request", "\\u", "params_", "._", "get_", "(_", "'", "close", "d", "'_", ",_", "'", "fal", "se", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "type_", "=_", "filters_", "._", "get_", "(_", "'", "proper", "ties", "/", "case", "\\u", "type", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cases_", "=_", "get", "\\u", "filter", "ed", "\\u", "cases_", "(_", "domain_", ",_", "status_", "=_", "status_", ",_", "case", "\\u", "type_", "=_", "case", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", "=_", "user", "\\u", "id_", ",_", "filters_", "=_", "filters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "footprint", "_", "=_", "footprint", "_", ",_", "ids", "\\u", "only_", "=_", "ids", "\\u", "only_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "strip", "\\u", "history_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "cases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "filter", "\\u", "cases_", "(_", "request_", ",_", "domain_", ",_", "app", "\\u", "id_", ",_", "module", "\\u", "id_", ",_", "parent", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "=_", "Application_", "._", "get_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "=_", "app_", "._", "get", "\\u", "module_", "(_", "module", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "\\u", "cookie_", "=_", "request_", "._", "COOKIE", "S_", "._", "get_", "(_", "'", "sessionid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "require", "s", "\\u", "parent", "\\u", "cases_", "=_", "string", "\\u", "to", "\\u", "boolean_", "(_", "request_", "._", "GET_", "._", "get_", "(_", "'", "require", "s", "\\u", "parent", "\\u", "case", "s", "'_", ",_", "'", "fal", "se", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xpath_", "=_", "Entr", "ies", "Helper_", "._", "get", "\\u", "filter", "\\u", "xpath_", "(_", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instances_", "=_", "get", "\\u", "instance", "s", "\\u", "for", "\\u", "module_", "(_", "app_", ",_", "module_", ",_", "addition", "al", "\\u", "xpa", "ths_", "=_", "[_", "xpath_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "instances_", "=_", "[_", "{_", "'", "id", "'_", ":_", "inst_", "._", "id_", ",_", "'", "src", "'_", ":_", "inst_", "._", "src_", "}_", "for_", "inst_", "in_", "instances_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "form", "player_", "=_", "toggle", "s_", "._", "USE", "\\u", "FORM", "PLAYER", "_", "._", "enabled_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "accessor_", "=_", "Case", "Accessor", "s_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "touch", "forms", " ", "doe", "sn", "'", "t", " ", "like", " ", "this", " ", "to", " ", "be", " ", "escaped", "_", "\\u\\u\\uNL\\u\\u\\u_", "xpath_", "=_", "HTM", "LP", "arser", "_", "._", "HTM", "LP", "arser", "_", "(_", ")_", "._", "unescape_", "(_", "xpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "type_", "=_", "module_", "._", "case", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "xpath_", "or_", "shou", "ld", "\\u", "use", "\\u", "sql", "\\u", "backend_", "(_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "need", " ", "to", " ", "do", " ", "a", " ", "custom", " ", "filter", ",", " ", "send", " ", "it", " ", "to", " ", "touch", "forms", " ", "for", " ", "processing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addition", "al", "\\u", "filters_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "proper", "ties", "/", "case", "\\u", "type", "\"_", ":_", "case", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "footprint", "\"_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "helper_", "=_", "Base", "Sess", "ion", "Data", "Helper_", "(_", "domain_", ",_", "request_", "._", "couch", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "helper_", "._", "filter", "\\u", "cases_", "(_", "xpath_", ",_", "addition", "al", "\\u", "filters_", ",_", "Dj", "ang", "o", "Auth_", "(_", "auth", "\\u", "cookie_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "instances_", "=_", "extra", "\\u", "instances_", ",_", "use", "\\u", "form", "player_", "=_", "use", "\\u", "form", "player_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "._", "get_", "(_", "'", "status", "'_", ",_", "None_", ")_", "==_", "'", "error", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "result_", "._", "get_", "(_", "'", "code", "'_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "result_", "._", "get_", "(_", "'", "message", "'_", ",_", "\\u_", "(_", "\"", "Some", "thing", " ", "wen", "t", " ", "wrong", " ", "filtering", " ", "your", " ", "case", "s", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "code_", "==_", "500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "notif", "y", "\\u", "exception_", "(_", "None_", ",_", "message_", "=_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "message_", ",_", "status", "\\u", "code_", "=_", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "case", "\\u", "ids_", "=_", "result_", "._", "get_", "(_", "\"", "case", "s", "\"_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "just", " ", "use", " ", "our", " ", "bui", "lt", " ", "in", " ", "api", " ", "with", " ", "the", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case", "\\u", "ids_", "=_", "[_", "res_", "._", "id_", "for_", "res_", "in_", "get", "\\u", "filter", "ed", "\\u", "cases_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "CASE", "\\u", "STATUS", "\\u", "OPEN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "case", "\\u", "type_", "=_", "case", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "id_", "=_", "request_", "._", "couch", "\\u", "user_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "footprint", "_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ids", "\\u", "only_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cases_", "=_", "accessor_", "._", "get", "\\u", "cases_", "(_", "case", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "parent", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cases_", "=_", "filter_", "(_", "lambda_", "c_", ":_", "c_", "._", "parent_", "and_", "c_", "._", "parent_", "._", "case", "\\u", "id_", "==_", "parent", "\\u", "id_", ",_", "cases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refi", "lter", " ", "these", " ", "bec", "aus", "e", " ", "we", " ", "mig", "ht", " ", "have", " ", "accident", "ally", " ", "include", "d", " ", "footprint", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "results", " ", "from", " ", "touch", "forms", ".", " ", "this", " ", "is", " ", "a", " ", "litt", "le", " ", "hack", "y", " ", "but", " ", "the", " ", "easi", "est_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "quick", ")", " ", "workar", "ound", ".", " ", "shou", "ld", " ", "be", " ", "revis", "ted", " ", "whe", "n", " ", "we", " ", "optimize", " ", "the", " ", "case", " ", "list", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cases_", "=_", "filter_", "(_", "lambda_", "c_", ":_", "c_", "._", "type_", "==_", "case", "\\u", "type_", ",_", "cases_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cases_", "=_", "[_", "c_", "._", "to", "\\u", "api", "\\u", "json_", "(_", "lite_", "=_", "True_", ")_", "for_", "c_", "in_", "cases_", "if_", "c_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "{_", "'", "case", "s", "'_", ":_", "cases_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "require", "s", "\\u", "parent", "\\u", "cases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Subtract", " ", "alr", "ead", "y", " ", "fetched", " ", "case", "s", " ", "from", " ", "parent", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "ids_", "=_", "set_", "(_", "map_", "(_", "lambda_", "c_", ":_", "c_", "[_", "'", "indice", "s", "'_", "]_", "[_", "'", "parent", "'_", "]_", "[_", "'", "case", "\\u", "id", "'_", "]_", ",_", "cases_", ")_", ")_", "-_", "set_", "(_", "map_", "(_", "lambda_", "c_", ":_", "c_", "[_", "'", "case", "\\u", "id", "'_", "]_", ",_", "cases_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "=_", "accessor_", "._", "get", "\\u", "cases_", "(_", "list_", "(_", "parent", "\\u", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parents_", "=_", "[_", "c_", "._", "to", "\\u", "api", "\\u", "json_", "(_", "lite_", "=_", "True_", ")_", "for_", "c_", "in_", "parents_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "update_", "(_", "{_", "'", "parents", "'_", ":_", "parents_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "apps", "\\u", "api_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json", "\\u", "response_", "(_", "get", "\\u", "cloud", "care", "\\u", "apps_", "(_", "domain_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "app", "\\u", "api_", "(_", "request_", ",_", "domain_", ",_", "app", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json", "\\u", "response_", "(_", "look", "\\u", "up", "\\u", "app", "\\u", "json_", "(_", "domain_", ",_", "app", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Remo", "te", "App", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "cache", "\\u", "page_", "(_", "60_", "*_", "30_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "fixtures_", "(_", "request_", ",_", "domain_", ",_", "user", "\\u", "id_", ",_", "fixture", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "Comm", "Care", "User_", "._", "get", "\\u", "by", "\\u", "user", "\\u", "id_", "(_", "user", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Cou", "ch", "User_", "._", "Account", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err_", "=_", "(_", "\"", "You", " ", "can", "'", "t", " ", "use", " ", "case", " ", "shar", "ing", " ", "or", " ", "fixture", "s", " ", "as", " ", "a", " ", "%", "s", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Logi", "n", " ", "as", " ", "a", " ", "mobile", " ", "worker", " ", "and", " ", "try", " ", "again", ".\"_", ")_", "%_", "settings_", "._", "WEB", "\\u", "USER", "\\u", "TERM", "_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "err_", ",_", "status_", "=_", "412", "_", ",_", "content", "\\u", "type_", "=_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "user_", "._", "is", "\\u", "member", "\\u", "of_", "(_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "xml", "\\u", "user_", "=_", "user_", "._", "to", "\\u", "case", "xml", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fixture", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "Element", "Tree_", "._", "Element_", "(_", "\"", "fixture", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "fixture_", "in_", "generator_", "._", "get", "\\u", "fixtures_", "(_", "case", "xml", "\\u", "user_", ",_", "version_", "=_", "V2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "._", "append_", "(_", "fixture_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Http", "Response_", "(_", "Element", "Tree_", "._", "tostring_", "(_", "ret_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "text", "/", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fixture_", "=_", "generator_", "._", "get", "\\u", "fixture", "\\u", "by", "\\u", "id_", "(_", "fixture", "\\u", "id_", ",_", "case", "xml", "\\u", "user_", ",_", "version_", "=_", "V2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fixture_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "fixture_", "._", "getch", "ildren_", "(_", ")_", ")_", "==_", "1_", ",_", "'", "fixture", " ", "{}", " ", "expected", " ", "1", " ", "child", " ", "but", " ", "found", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fixture", "\\u", "id_", ",_", "len_", "(_", "fixture_", "._", "getch", "ildren_", "(_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "Element", "Tree_", "._", "tostring_", "(_", "fixture_", "._", "getch", "ildren_", "(_", ")_", "[_", "0_", "]_", ")_", ",_", "content", "\\u", "type_", "=_", "\"", "text", "/", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "sessions_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "is", " ", "it", " ", "ok", " ", "to", " ", "pull", " ", "user", " ", "from", " ", "the", " ", "request", "?", " ", "other", " ", "api", " ", "calls", " ", "see", "m", " ", "to", " ", "have", " ", "an", " ", "explicit", " ", "'", "user", "'", " ", "param_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "skip_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "skip", "'_", ")_", "or_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "limit", "'_", ")_", "or_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "get", "\\u", "open", "\\u", "form", "\\u", "sessions_", "(_", "request_", "._", "user_", ",_", "skip_", "=_", "skip_", ",_", "limit_", "=_", "limit_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "session", "\\u", "context_", "(_", "request_", ",_", "domain_", ",_", "session", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "alth", "ou", "gh", " ", "this", " ", "view", " ", "doe", "s", " ", "not", " ", "appear", "ed", " ", "to", " ", "be", " ", "call", "ed", " ", "from", " ", "any", "where", " ", "it", " ", "is", ",", " ", "and", " ", "cann", "ot", " ", "be", " ", "delete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "javascript", " ", "routin", "g", " ", "in", " ", "cloud", "care", " ", "depend", "s", " ", "on", " ", "it", ",", " ", "tho", "ugh", " ", "construct", "s", " ", "it", " ", "manu", "ally", " ", "in", " ", "a", " ", "hard", "code", "d", " ", "way", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "get", "Sess", "ion", "Context", "Ur", "l", " ", "in", " ", "cloud", "care", "/", "util", ".", "js_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "'", "cloud", "care", "\\u", "get", "\\u", "session", "\\u", "context", "'", " ", "to", " ", "this", " ", "comment", " ", "so", " ", "tha", "t", " ", "the", " ", "url", " ", "name", " ", "pass", "es", " ", "a", " ", "grep", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "Entr", "y", "Session_", "._", "objects_", "._", "get_", "(_", "session", "\\u", "id_", "=_", "session", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Entr", "y", "Session_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "DELET", "E", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "{_", "'", "status", "'_", ":_", "'", "success", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "helper_", "=_", "Base", "Sess", "ion", "Data", "Helper_", "(_", "domain_", ",_", "request_", "._", "couch", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "helper_", "._", "get", "\\u", "full", "\\u", "context_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "id", "'_", ":_", "session", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "id", "'_", ":_", "session_", "._", "app", "\\u", "id_", "if_", "session_", "else_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "ledger", "s_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "ledger", "s", " ", "associate", "d", " ", "with", " ", "a", " ", "case", " ", "in", " ", "the", " ", "format", ":", "\\", "10", ";", " ", " ", " ", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "section", "\\u", "id", "\":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "product", "\\u", "id", "\":", " ", "amo", "unt", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "product", "\\u", "id", "\":", " ", "amo", "unt", ",", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "this", " ", "only", " ", "works", " ", "for", " ", "the", " ", "Cou", "ch", " ", "back", "end", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "params_", "=_", "request_", "._", "GET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "case", "\\u", "id_", "=_", "request", "\\u", "params_", "._", "get_", "(_", "'", "case", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "case", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "message", "'_", ":_", "'", "You", " ", "must", " ", "speci", "fy", " ", "a", " ", "case", " ", "id", " ", "to", " ", "make", " ", "this", " ", "query", ".'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "code_", "=_", "400_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "case_", "=_", "Case", "Accessor", "s_", "(_", "domain_", ")_", "._", "get", "\\u", "case_", "(_", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Case", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ledger", "\\u", "map_", "=_", "get", "\\u", "current", "\\u", "ledger", "\\u", "transactions_", "(_", "case_", "._", "case", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "custom", "\\u", "json", "\\u", "handler_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "obj_", ",_", "Stock", "Transaction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "obj_", "._", "stock", "\\u", "on", "\\u", "hand_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "handler_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entity", "\\u", "id", "'_", ":_", "case", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ledger", "'_", ":_", "ledger", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "custom", "\\u", "json", "\\u", "handler_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sync", "\\u", "db", "\\u", "api_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth", "\\u", "cookie_", "=_", "request_", "._", "COOKIE", "S_", "._", "get_", "(_", "'", "sessionid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sync", "\\u", "db_", "(_", "username_", ",_", "domain_", ",_", "Dj", "ang", "o", "Auth_", "(_", "auth", "\\u", "cookie_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "OK", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "e_", ",_", "status_", "=_", "500_", ",_", "content", "\\u", "type_", "=_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cloud", "care", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render", "\\u", "form_", "(_", "request_", ",_", "domain_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "session_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session", "\\u", "id_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "session", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Entr", "y", "Session_", ",_", "session", "\\u", "id_", "=_", "session", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "instance_", "=_", "get", "\\u", "raw", "\\u", "instance_", "(_", "session", "\\u", "id_", ",_", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "e_", ",_", "status_", "=_", "500_", ",_", "content", "\\u", "type_", "=_", "\"", "text", "/", "plain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xmlns_", "=_", "raw", "\\u", "instance_", "[_", "\"", "xml", "ns", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "data\\u", "xml_", "=_", "raw", "\\u", "instance_", "[_", "\"", "output", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", ",_", "form", "\\u", "data\\u", "json_", "=_", "xml", "2j", "son_", "(_", "form", "\\u", "data\\u", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty", "\\u", "questions_", "=_", "readable_", "._", "get", "\\u", "questions_", "(_", "domain_", ",_", "session_", "._", "app", "\\u", "id_", ",_", "xmlns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reada", "ble", "\\u", "form_", "=_", "readable_", "._", "get", "\\u", "reada", "ble", "\\u", "form", "\\u", "data_", "(_", "form", "\\u", "data\\u", "json_", ",_", "pretty", "\\u", "questions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "render", "ed", "\\u", "reada", "ble", "\\u", "form_", "=_", "render", "\\u", "to", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "report", "s", "/", "form", "/", "partial", "s", "/", "reada", "ble", "\\u", "form", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "question", "s", "'_", ":_", "reada", "ble", "\\u", "form_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "data", "'_", ":_", "render", "ed", "\\u", "reada", "ble", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "xml", "'_", ":_", "indent", "\\u", "xml_", "(_", "form", "\\u", "data\\u", "xml_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Http", "Respons", "e", "Conflict_", "(_", "Http", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "code_", "=_", "409_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Edit", "Cloud", "care", "User", "Permi", "ssion", "s", "View_", "(_", "Base", "User", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "name_", "=_", "'", "cloud", "care", "/", "config", ".", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url", "name_", "=_", "'", "cloud", "care", "\\u", "app", "\\u", "settings", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "title_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Cloud", "Care", " ", "Permi", "ssion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Cloud", "care", "User", "Permi", "ssion", "s", "View_", "(_", "Base", "User", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "domain", "\\u", "admin", "\\u", "required_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "method", "\\u", "decorator_", "(_", "require", "s", "\\u", "privilege", "\\u", "with", "\\u", "fallback_", "(_", "privilege", "s_", "._", "CLOUD", "CAR", "E_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "use", "\\u", "boots", "trap", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "dispatch_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "Edit", "Cloud", "care", "User", "Permi", "ssion", "s", "View_", ",_", "self_", ")_", "._", "dispatch_", "(_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Cloud", "care", "User", "Permi", "ssion", "s", "View_", "(_", "Base", "User", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "page", "\\u", "context_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "apps_", "=_", "get", "\\u", "cloud", "care", "\\u", "apps_", "(_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access_", "=_", "Applica", "tion", "Access_", "._", "get", "\\u", "template", "\\u", "json_", "(_", "self_", "._", "domain_", ",_", "apps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "groups_", "=_", "Group_", "._", "by", "\\u", "domain_", "(_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "apps", "'_", ":_", "apps_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "groups_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "access", "'_", ":_", "access_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Edit", "Cloud", "care", "User", "Permi", "ssion", "s", "View_", "(_", "Base", "User", "Sett", "ings", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "request_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "j_", "=_", "json_", "._", "loads_", "(_", "request_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "=_", "Applica", "tion", "Access_", "._", "get", "\\u", "by", "\\u", "domain_", "(_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new_", "=_", "Applica", "tion", "Access_", "._", "wrap_", "(_", "j_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "._", "restrict", "_", "=_", "new_", "._", "restrict", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old_", "._", "app", "\\u", "groups_", "=_", "new_", "._", "app", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "old_", "._", "\\u", "rev_", "!=_", "new_", "._", "\\u", "rev_", "or_", "old_", "._", "\\u", "id_", "!=_", "new_", "._", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Reso", "urc", "e", "Conflict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Reso", "urc", "e", "Conflict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Conflict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
maraoz/proofofexistence/cron.py
[ { "content": "import webapp2, jinja2, os, hashlib, logging, urllib\nimport json\nimport datetime\n\nfrom model import Document\nfrom google.appengine.api import mail\n\nfrom secrets import ADMIN_EMAIL\nfrom blockchain import auto_consolidate\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConsolidationCron(webapp2.RequestHandler):", "metadata": "root.ConsolidationCron", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def get(self):\n archiveable = Document.get_archiveable()\n processed = False\n for d in archiveable:\n res = d.archive()\n self.response.write(\"%s %s<br />\" % (d.digest, res))\n processed = True\n if processed:\n self.response.write(\"Running autoconsolidate<br />\")\n auto_consolidate()\n else:\n self.response.write(\"Finished without operation<br />\")", "metadata": "root.ConsolidationCron.get", "header": "['class', 'ConsolidationCron', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 11 }, { "content": "class ConfirmationCron(webapp2.RequestHandler):", "metadata": "root.ConfirmationCron", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def get(self):\n actionable = Document.get_actionable()\n for d in actionable:\n ret = d.blockchain_certify()\n sender_address = \"[email protected]\"\n subject = \"Document certified: %s %s\" % (ret['success'], d.digest)\n body = subject + \"\\n\\nmesage: %s\" % (ret['message'])\n mail.send_mail(sender_address, ADMIN_EMAIL, subject, body)", "metadata": "root.ConfirmationCron.get", "header": "['class', 'ConfirmationCron', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 25 }, { "content": "class PaymentCheckerCron(webapp2.RequestHandler):", "metadata": "root.PaymentCheckerCron", "header": "['module', '___EOS___']", "index": 34 }, { "content": " def get(self):\n digest = self.request.get('d')\n d = Document.get_doc(digest)\n if d and d.pending and d.has_balance():\n d.received_payment()\n self.response.write(\"%s %s<br />\" % (d.digest, d.payment_address))", "metadata": "root.PaymentCheckerCron.get", "header": "['class', 'PaymentCheckerCron', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "import webapp2, jinja2, os, hashlib, logging, urllib", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 52 }, { "span": "import json", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 11 }, { "span": "import datetime", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "webapp2_", ",_", "jinja2_", ",_", "os_", ",_", "hashlib_", ",_", "logging_", ",_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "model_", "import_", "Document_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "secrets_", "import_", "ADM", "IN", "\\u", "EMAIL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "blockchain", "_", "import_", "auto", "\\u", "consolidat", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Cons", "oli", "dati", "on", "Cro", "n_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cons", "oli", "dati", "on", "Cro", "n_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "archive", "able_", "=_", "Document_", "._", "get", "\\u", "archive", "able_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "archive", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "d_", "._", "archive_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "\"%", "s", " ", "%", "s", "<", "br", " ", "/>\"_", "%_", "(_", "d_", "._", "digest_", ",_", "res_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "processed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "write_", "(_", "\"", "Run", "ning", " ", "autocon", "solid", "ate", "<", "br", " ", "/>\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auto", "\\u", "consolidat", "e_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response_", "._", "write_", "(_", "\"", "Finish", "ed", " ", "with", "out", " ", "operati", "on", "<", "br", " ", "/>\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Confirmation", "Cro", "n_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Confirmation", "Cro", "n_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "able_", "=_", "Document_", "._", "get", "\\u", "action", "able_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "d_", "in_", "action", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "d_", "._", "blockchain", "\\u", "certi", "fy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sender", "\\u", "address_", "=_", "\"", "manu", "ela", "ra", "oz", "@", "gma", "il", ".", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subject_", "=_", "\"", "Document", " ", "certi", "fied", ":", " ", "%", "s", " ", "%", "s", "\"_", "%_", "(_", "ret_", "[_", "'", "success", "'_", "]_", ",_", "d_", "._", "digest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "subject_", "+_", "\"\\\\", "n", "\\\\", "nme", "sage", ":", " ", "%", "s", "\"_", "%_", "(_", "ret_", "[_", "'", "message", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mail_", "._", "send", "\\u", "mail_", "(_", "sender", "\\u", "address_", ",_", "ADM", "IN", "\\u", "EMAIL_", ",_", "subject_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Payment", "Check", "er", "Cro", "n_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Payment", "Check", "er", "Cro", "n_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "digest_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "Document_", "._", "get", "\\u", "doc_", "(_", "digest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "and_", "d_", "._", "pending_", "and_", "d_", "._", "has", "\\u", "balance_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "._", "receive", "d\\u", "payment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "\"%", "s", " ", "%", "s", "<", "br", " ", "/>\"_", "%_", "(_", "d_", "._", "digest_", ",_", "d_", "._", "pay", "ment", "\\u", "address_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ClusterHQ/flocker/flocker/volume/functional/test_service.py
[ { "content": " def test_handoff_roundtrip(self):\n \"\"\"\n Handoff of a volume from A to B and then B to A between two ZFS-based\n volume managers does not fail.\n \"\"\"\n service_pair = create_realistic_servicepair(self)\n\n d = service_pair.from_service.create(\n service_pair.from_service.get(\n VolumeName(namespace=u\"myns\", dataset_id=u\"myvolume\")\n )\n )\n\n def created(volume):\n return service_pair.from_service.handoff(\n volume, service_pair.remote)\n d.addCallback(created)\n\n def handed_off(_):\n return service_pair.to_service.handoff(\n service_pair.to_service.get(\n VolumeName(namespace=u\"myns\", dataset_id=u\"myvolume\")),\n service_pair.origin_remote)\n # If the Deferred errbacks the test will fail:\n return d", "metadata": "root.RealisticTests.test_handoff_roundtrip", "header": "['class', 'RealisticTests', '(', 'AsyncTestCase', ')', ':', '___EOS___']", "index": 37 } ]
[ { "span": "handed_off(", "start_line": 55, "start_column": 12, "end_line": 55, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Real", "istic", "Tests_", "(_", "Async", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hand", "off", "\\u", "roundtrip", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Hand", "off", " ", "of", " ", "a", " ", "volume", " ", "from", " ", "A", " ", "to", " ", "B", " ", "and", " ", "then", " ", "B", " ", "to", " ", "A", " ", "bet", "ween", " ", "two", " ", "ZF", "S", "-", "based", "\\", "10", ";", " ", " ", " ", " ", "volume", " ", "manage", "rs", " ", "doe", "s", " ", "not", " ", "fail", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service", "\\u", "pair_", "=_", "create", "\\u", "realis", "tic", "\\u", "service", "pair_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "service", "\\u", "pair_", "._", "from", "\\u", "service_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "pair_", "._", "from", "\\u", "service_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Volume", "Name_", "(_", "namespace_", "=_", "u", "\"", "myn", "s", "\"_", ",_", "dataset", "\\u", "id_", "=_", "u", "\"", "myv", "olume", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "created_", "(_", "volume_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "service", "\\u", "pair_", "._", "from", "\\u", "service_", "._", "hand", "off_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "volume_", ",_", "service", "\\u", "pair_", "._", "remote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "created_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "hande", "d\\u", "off_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "service", "\\u", "pair_", "._", "to", "\\u", "service_", "._", "hand", "off_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "pair_", "._", "to", "\\u", "service_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Volume", "Name_", "(_", "namespace_", "=_", "u", "\"", "myn", "s", "\"_", ",_", "dataset", "\\u", "id_", "=_", "u", "\"", "myv", "olume", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "service", "\\u", "pair_", "._", "orig", "in", "\\u", "remote_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "Defe", "rre", "d", " ", "errback", "s", " ", "the", " ", "test", " ", "will", " ", "fail", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "d_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/wsgilib.py
[ { "content": "# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)\n# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php\n\n\"\"\"\nA module of many disparate routines.\n\"\"\"\n\nfrom __future__ import print_function\n\n# functions which moved to paste.request and paste.response\n# Deprecated around 15 Dec 2005\nfrom paste.request import get_cookies, parse_querystring, parse_formvars\nfrom paste.request import construct_url, path_info_split, path_info_pop\nfrom paste.response import HeaderDict, has_header, header_value, remove_header\nfrom paste.response import error_body_response, error_response, error_response_app\n\nfrom traceback import print_exception\nimport six\nimport sys\nfrom six.moves import cStringIO as StringIO\nfrom six.moves.urllib.parse import unquote, urlsplit\nimport warnings\n\n__all__ = ['add_close', 'add_start_close', 'capture_output', 'catch_errors',\n 'catch_errors_app', 'chained_app_iters', 'construct_url',\n 'dump_environ', 'encode_unicode_app_iter', 'error_body_response',\n 'error_response', 'get_cookies', 'has_header', 'header_value',\n 'interactive', 'intercept_output', 'path_info_pop',\n 'path_info_split', 'raw_interactive', 'send_file']\n\n\n\n\n\n\n\n\n\n\n\ninteractive.proxy = 'raw_interactive'\n\n\n\n\n\n## Deprecation warning wrapper:\n\n\n\n# Put warnings wrapper in place for all public functions that\n# were imported from elsewhere:\n\nfor _name in __all__:\n _func = globals()[_name]\n if (hasattr(_func, 'func_globals')\n and _func.func_globals['__name__'] != __name__):\n globals()[_name] = _warn_deprecated(_func)\n\nif __name__ == '__main__':\n import doctest\n doctest.testmod()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class add_close(object):\n \"\"\"\n An an iterable that iterates over app_iter, then calls\n close_func.\n \"\"\"\n\n\n\n\n", "metadata": "root.add_close", "header": "['module', '___EOS___']", "index": 30 }, { "content": " def __init__(self, app_iterable, close_func):\n self.app_iterable = app_iterable\n self.app_iter = iter(app_iterable)\n self.close_func = close_func\n self._closed = False", "metadata": "root.add_close.__init__", "header": "['class', 'add_close', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def __iter__(self):\n return self", "metadata": "root.add_close.__iter__", "header": "['class', 'add_close', '(', 'object', ')', ':', '___EOS___']", "index": 42 }, { "content": " def next(self):\n return self.app_iter.next()", "metadata": "root.add_close.next", "header": "['class', 'add_close', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": " def close(self):\n self._closed = True\n if hasattr(self.app_iterable, 'close'):\n self.app_iterable.close()\n self.close_func()", "metadata": "root.add_close.close", "header": "['class', 'add_close', '(', 'object', ')', ':', '___EOS___']", "index": 48 }, { "content": " def __del__(self):\n if not self._closed:\n # We can't raise an error or anything at this stage\n print(\"Error: app_iter.close() was not called when finishing \"\n \"WSGI request. finalization function %s not called\"\n % self.close_func, file=sys.stderr)", "metadata": "root.add_close.__del__", "header": "['class', 'add_close', '(', 'object', ')', ':', '___EOS___']", "index": 54 }, { "content": "class add_start_close(object):\n \"\"\"\n An an iterable that iterates over app_iter, calls start_func\n before the first item is returned, then calls close_func at the\n end.\n \"\"\"\n\n\n\n __next__ = next\n\n", "metadata": "root.add_start_close", "header": "['module', '___EOS___']", "index": 61 }, { "content": " def __init__(self, app_iterable, start_func, close_func=None):\n self.app_iterable = app_iterable\n self.app_iter = iter(app_iterable)\n self.first = True\n self.start_func = start_func\n self.close_func = close_func\n self._closed = False", "metadata": "root.add_start_close.__init__", "header": "['class', 'add_start_close', '(', 'object', ')', ':', '___EOS___']", "index": 68 }, { "content": " def __iter__(self):\n return self", "metadata": "root.add_start_close.__iter__", "header": "['class', 'add_start_close', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": " def next(self):\n if self.first:\n self.start_func()\n self.first = False\n return next(self.app_iter)", "metadata": "root.add_start_close.next", "header": "['class', 'add_start_close', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " def close(self):\n self._closed = True\n if hasattr(self.app_iterable, 'close'):\n self.app_iterable.close()\n if self.close_func is not None:\n self.close_func()", "metadata": "root.add_start_close.close", "header": "['class', 'add_start_close', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": " def __del__(self):\n if not self._closed:\n # We can't raise an error or anything at this stage\n print(\"Error: app_iter.close() was not called when finishing \"\n \"WSGI request. finalization function %s not called\"\n % self.close_func, file=sys.stderr)", "metadata": "root.add_start_close.__del__", "header": "['class', 'add_start_close', '(', 'object', ')', ':', '___EOS___']", "index": 93 }, { "content": "class chained_app_iters(object):\n\n \"\"\"\n Chains several app_iters together, also delegating .close() to each\n of them.\n \"\"\"\n\n\n\n\n", "metadata": "root.chained_app_iters", "header": "['module', '___EOS___']", "index": 100 }, { "content": " def __init__(self, *chained):\n self.app_iters = chained\n self.chained = [iter(item) for item in chained]\n self._closed = False", "metadata": "root.chained_app_iters.__init__", "header": "['class', 'chained_app_iters', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def __iter__(self):\n return self", "metadata": "root.chained_app_iters.__iter__", "header": "['class', 'chained_app_iters', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def next(self):\n if len(self.chained) == 1:\n return self.chained[0].next()\n else:\n try:\n return self.chained[0].next()\n except StopIteration:\n self.chained.pop(0)\n return self.next()", "metadata": "root.chained_app_iters.next", "header": "['class', 'chained_app_iters', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def close(self):\n self._closed = True\n got_exc = None\n for app_iter in self.app_iters:\n try:\n if hasattr(app_iter, 'close'):\n app_iter.close()\n except:\n got_exc = sys.exc_info()\n if got_exc:\n six.reraise(got_exc[0], got_exc[1], got_exc[2])", "metadata": "root.chained_app_iters.close", "header": "['class', 'chained_app_iters', '(', 'object', ')', ':', '___EOS___']", "index": 125 }, { "content": " def __del__(self):\n if not self._closed:\n # We can't raise an error or anything at this stage\n print(\"Error: app_iter.close() was not called when finishing \"\n \"WSGI request. finalization function %s not called\"\n % self.close_func, file=sys.stderr)", "metadata": "root.chained_app_iters.__del__", "header": "['class', 'chained_app_iters', '(', 'object', ')', ':', '___EOS___']", "index": 137 }, { "content": "class encode_unicode_app_iter(object):\n \"\"\"\n Encodes an app_iterable's unicode responses as strings\n \"\"\"\n\n\n\n __next__ = next\n", "metadata": "root.encode_unicode_app_iter", "header": "['module', '___EOS___']", "index": 144 }, { "content": " def __init__(self, app_iterable, encoding=sys.getdefaultencoding(),\n errors='strict'):\n self.app_iterable = app_iterable\n self.app_iter = iter(app_iterable)\n self.encoding = encoding\n self.errors = errors", "metadata": "root.encode_unicode_app_iter.__init__", "header": "['class', 'encode_unicode_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 149 }, { "content": " def __iter__(self):\n return self", "metadata": "root.encode_unicode_app_iter.__iter__", "header": "['class', 'encode_unicode_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 156 }, { "content": " def next(self):\n content = next(self.app_iter)\n if isinstance(content, six.text_type):\n content = content.encode(self.encoding, self.errors)\n return content", "metadata": "root.encode_unicode_app_iter.next", "header": "['class', 'encode_unicode_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 159 }, { "content": " def close(self):\n if hasattr(self.app_iterable, 'close'):\n self.app_iterable.close()", "metadata": "root.encode_unicode_app_iter.close", "header": "['class', 'encode_unicode_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 166 }, { "content": "def catch_errors(application, environ, start_response, error_callback,\n ok_callback=None):\n \"\"\"\n Runs the application, and returns the application iterator (which should be\n passed upstream). If an error occurs then error_callback will be called with\n exc_info as its sole argument. If no errors occur and ok_callback is given,\n then it will be called with no arguments.\n \"\"\"\n try:\n app_iter = application(environ, start_response)\n except:\n error_callback(sys.exc_info())\n raise\n if type(app_iter) in (list, tuple):\n # These won't produce exceptions\n if ok_callback:\n ok_callback()\n return app_iter\n else:\n return _wrap_app_iter(app_iter, error_callback, ok_callback)", "metadata": "root.catch_errors", "header": "['module', '___EOS___']", "index": 170 }, { "content": "class _wrap_app_iter(object):\n\n\n", "metadata": "root._wrap_app_iter", "header": "['module', '___EOS___']", "index": 191 }, { "content": " def __init__(self, app_iterable, error_callback, ok_callback):\n self.app_iterable = app_iterable\n self.app_iter = iter(app_iterable)\n self.error_callback = error_callback\n self.ok_callback = ok_callback\n if hasattr(self.app_iterable, 'close'):\n self.close = self.app_iterable.close", "metadata": "root._wrap_app_iter.__init__", "header": "['class', '_wrap_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 193 }, { "content": " def __iter__(self):\n return self", "metadata": "root._wrap_app_iter.__iter__", "header": "['class', '_wrap_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 201 }, { "content": " def next(self):\n try:\n return self.app_iter.next()\n except StopIteration:\n if self.ok_callback:\n self.ok_callback()\n raise\n except:\n self.error_callback(sys.exc_info())\n raise", "metadata": "root._wrap_app_iter.next", "header": "['class', '_wrap_app_iter', '(', 'object', ')', ':', '___EOS___']", "index": 204 }, { "content": "def catch_errors_app(application, environ, start_response, error_callback_app,\n ok_callback=None, catch=Exception):\n \"\"\"\n Like ``catch_errors``, except error_callback_app should be a\n callable that will receive *three* arguments -- ``environ``,\n ``start_response``, and ``exc_info``. It should call\n ``start_response`` (*with* the exc_info argument!) and return an\n iterator.\n \"\"\"\n try:\n app_iter = application(environ, start_response)\n except catch:\n return error_callback_app(environ, start_response, sys.exc_info())\n if type(app_iter) in (list, tuple):\n # These won't produce exceptions\n if ok_callback is not None:\n ok_callback()\n return app_iter\n else:\n return _wrap_app_iter_app(\n environ, start_response, app_iter,\n error_callback_app, ok_callback, catch=catch)", "metadata": "root.catch_errors_app", "header": "['module', '___EOS___']", "index": 215 }, { "content": "class _wrap_app_iter_app(object):\n\n\n", "metadata": "root._wrap_app_iter_app", "header": "['module', '___EOS___']", "index": 238 }, { "content": " def __init__(self, environ, start_response, app_iterable,\n error_callback_app, ok_callback, catch=Exception):\n self.environ = environ\n self.start_response = start_response\n self.app_iterable = app_iterable\n self.app_iter = iter(app_iterable)\n self.error_callback_app = error_callback_app\n self.ok_callback = ok_callback\n self.catch = catch\n if hasattr(self.app_iterable, 'close'):\n self.close = self.app_iterable.close", "metadata": "root._wrap_app_iter_app.__init__", "header": "['class', '_wrap_app_iter_app', '(', 'object', ')', ':', '___EOS___']", "index": 240 }, { "content": " def __iter__(self):\n return self", "metadata": "root._wrap_app_iter_app.__iter__", "header": "['class', '_wrap_app_iter_app', '(', 'object', ')', ':', '___EOS___']", "index": 252 }, { "content": " def next(self):\n try:\n return self.app_iter.next()\n except StopIteration:\n if self.ok_callback:\n self.ok_callback()\n raise\n except self.catch:\n if hasattr(self.app_iterable, 'close'):\n try:\n self.app_iterable.close()\n except:\n # @@: Print to wsgi.errors?\n pass\n new_app_iterable = self.error_callback_app(\n self.environ, self.start_response, sys.exc_info())\n app_iter = iter(new_app_iterable)\n if hasattr(new_app_iterable, 'close'):\n self.close = new_app_iterable.close\n self.next = app_iter.next\n return self.next()", "metadata": "root._wrap_app_iter_app.next", "header": "['class', '_wrap_app_iter_app', '(', 'object', ')', ':', '___EOS___']", "index": 255 }, { "content": "def raw_interactive(application, path='', raise_on_wsgi_error=False,\n **environ):\n \"\"\"\n Runs the application in a fake environment.\n \"\"\"\n assert \"path_info\" not in environ, \"argument list changed\"\n if raise_on_wsgi_error:\n errors = ErrorRaiser()\n else:\n errors = six.BytesIO()\n basic_environ = {\n # mandatory CGI variables\n 'REQUEST_METHOD': 'GET', # always mandatory\n 'SCRIPT_NAME': '', # may be empty if app is at the root\n 'PATH_INFO': '', # may be empty if at root of app\n 'SERVER_NAME': 'localhost', # always mandatory\n 'SERVER_PORT': '80', # always mandatory\n 'SERVER_PROTOCOL': 'HTTP/1.0',\n # mandatory wsgi variables\n 'wsgi.version': (1, 0),\n 'wsgi.url_scheme': 'http',\n 'wsgi.input': six.BytesIO(),\n 'wsgi.errors': errors,\n 'wsgi.multithread': False,\n 'wsgi.multiprocess': False,\n 'wsgi.run_once': False,\n }\n if path:\n (_, _, path_info, query, fragment) = urlsplit(str(path))\n path_info = unquote(path_info)\n # urlsplit returns unicode so coerce it back to str\n path_info, query = str(path_info), str(query)\n basic_environ['PATH_INFO'] = path_info\n if query:\n basic_environ['QUERY_STRING'] = query\n for name, value in environ.items():\n name = name.replace('__', '.')\n basic_environ[name] = value\n if ('SERVER_NAME' in basic_environ\n and 'HTTP_HOST' not in basic_environ):\n basic_environ['HTTP_HOST'] = basic_environ['SERVER_NAME']\n istream = basic_environ['wsgi.input']\n if isinstance(istream, bytes):\n basic_environ['wsgi.input'] = six.BytesIO(istream)\n basic_environ['CONTENT_LENGTH'] = len(istream)\n data = {}\n output = []\n headers_set = []\n headers_sent = []\n def start_response(status, headers, exc_info=None):\n if exc_info:\n try:\n if headers_sent:\n # Re-raise original exception only if headers sent\n six.reraise(exc_info[0], exc_info[1], exc_info[2])\n finally:\n # avoid dangling circular reference\n exc_info = None\n elif headers_set:\n # You cannot set the headers more than once, unless the\n # exc_info is provided.\n raise AssertionError(\"Headers already set and no exc_info!\")\n headers_set.append(True)\n data['status'] = status\n data['headers'] = headers\n return output.append\n app_iter = application(basic_environ, start_response)\n try:\n try:\n for s in app_iter:\n if not isinstance(s, six.binary_type):\n raise ValueError(\n \"The app_iter response can only contain bytes (not \"\n \"unicode); got: %r\" % s)\n headers_sent.append(True)\n if not headers_set:\n raise AssertionError(\"Content sent w/o headers!\")\n output.append(s)\n except TypeError as e:\n # Typically \"iteration over non-sequence\", so we want\n # to give better debugging information...\n e.args = ((e.args[0] + ' iterable: %r' % app_iter),) + e.args[1:]\n raise\n finally:\n if hasattr(app_iter, 'close'):\n app_iter.close()\n return (data['status'], data['headers'], b''.join(output),\n errors.getvalue())", "metadata": "root.raw_interactive", "header": "['module', '___EOS___']", "index": 277 }, { "content": "class ErrorRaiser(object):\n\n\n\n", "metadata": "root.ErrorRaiser", "header": "['module', '___EOS___']", "index": 366 }, { "content": " def flush(self):\n pass", "metadata": "root.ErrorRaiser.flush", "header": "['class', 'ErrorRaiser', '(', 'object', ')', ':', '___EOS___']", "index": 368 }, { "content": " def write(self, value):\n if not value:\n return\n raise AssertionError(\n \"No errors should be written (got: %r)\" % value)", "metadata": "root.ErrorRaiser.write", "header": "['class', 'ErrorRaiser', '(', 'object', ')', ':', '___EOS___']", "index": 371 }, { "content": " def writelines(self, seq):\n raise AssertionError(\n \"No errors should be written (got lines: %s)\" % list(seq))", "metadata": "root.ErrorRaiser.writelines", "header": "['class', 'ErrorRaiser', '(', 'object', ')', ':', '___EOS___']", "index": 377 }, { "content": " def getvalue(self):\n return ''", "metadata": "root.ErrorRaiser.getvalue", "header": "['class', 'ErrorRaiser', '(', 'object', ')', ':', '___EOS___']", "index": 381 }, { "content": "def interactive(*args, **kw):\n \"\"\"\n Runs the application interatively, wrapping `raw_interactive` but\n returning the output in a formatted way.\n \"\"\"\n status, headers, content, errors = raw_interactive(*args, **kw)\n full = StringIO()\n if errors:\n full.write('Errors:\\n')\n full.write(errors.strip())\n full.write('\\n----------end errors\\n')\n full.write(status + '\\n')\n for name, value in headers:\n full.write('%s: %s\\n' % (name, value))\n full.write('\\n')\n full.write(content)\n return full.getvalue()", "metadata": "root.interactive", "header": "['module', '___EOS___']", "index": 384 }, { "content": "def dump_environ(environ, start_response):\n \"\"\"\n Application which simply dumps the current environment\n variables out as a plain text response.\n \"\"\"\n output = []\n keys = list(environ.keys())\n keys.sort()\n for k in keys:\n v = str(environ[k]).replace(\"\\n\",\"\\n \")\n output.append(\"%s: %s\\n\" % (k, v))\n output.append(\"\\n\")\n content_length = environ.get(\"CONTENT_LENGTH\", '')\n if content_length:\n output.append(environ['wsgi.input'].read(int(content_length)))\n output.append(\"\\n\")\n output = \"\".join(output)\n if six.PY3:\n output = output.encode('utf8')\n headers = [('Content-Type', 'text/plain'),\n ('Content-Length', str(len(output)))]\n start_response(\"200 OK\", headers)\n return [output]", "metadata": "root.dump_environ", "header": "['module', '___EOS___']", "index": 403 }, { "content": "def send_file(filename):\n warnings.warn(\n \"wsgilib.send_file has been moved to paste.fileapp.FileApp\",\n DeprecationWarning, 2)\n from paste import fileapp\n return fileapp.FileApp(filename)", "metadata": "root.send_file", "header": "['module', '___EOS___']", "index": 427 }, { "content": "def capture_output(environ, start_response, application):\n \"\"\"\n Runs application with environ and start_response, and captures\n status, headers, and body.\n\n Sends status and header, but *not* body. Returns (status,\n headers, body). Typically this is used like:\n\n .. code-block:: python\n\n def dehtmlifying_middleware(application):\n def replacement_app(environ, start_response):\n status, headers, body = capture_output(\n environ, start_response, application)\n content_type = header_value(headers, 'content-type')\n if (not content_type\n or not content_type.startswith('text/html')):\n return [body]\n body = re.sub(r'<.*?>', '', body)\n return [body]\n return replacement_app\n\n \"\"\"\n warnings.warn(\n 'wsgilib.capture_output has been deprecated in favor '\n 'of wsgilib.intercept_output',\n DeprecationWarning, 2)\n data = []\n output = StringIO()\n def replacement_start_response(status, headers, exc_info=None):\n if data:\n data[:] = []\n data.append(status)\n data.append(headers)\n start_response(status, headers, exc_info)\n return output.write\n app_iter = application(environ, replacement_start_response)\n try:\n for item in app_iter:\n output.write(item)\n finally:\n if hasattr(app_iter, 'close'):\n app_iter.close()\n if not data:\n data.append(None)\n if len(data) < 2:\n data.append(None)\n data.append(output.getvalue())\n return data", "metadata": "root.capture_output", "header": "['module', '___EOS___']", "index": 434 }, { "content": "def intercept_output(environ, application, conditional=None,\n start_response=None):\n \"\"\"\n Runs application with environ and captures status, headers, and\n body. None are sent on; you must send them on yourself (unlike\n ``capture_output``)\n\n Typically this is used like:\n\n .. code-block:: python\n\n def dehtmlifying_middleware(application):\n def replacement_app(environ, start_response):\n status, headers, body = intercept_output(\n environ, application)\n start_response(status, headers)\n content_type = header_value(headers, 'content-type')\n if (not content_type\n or not content_type.startswith('text/html')):\n return [body]\n body = re.sub(r'<.*?>', '', body)\n return [body]\n return replacement_app\n\n A third optional argument ``conditional`` should be a function\n that takes ``conditional(status, headers)`` and returns False if\n the request should not be intercepted. In that case\n ``start_response`` will be called and ``(None, None, app_iter)``\n will be returned. You must detect that in your code and return\n the app_iter, like:\n\n .. code-block:: python\n\n def dehtmlifying_middleware(application):\n def replacement_app(environ, start_response):\n status, headers, body = intercept_output(\n environ, application,\n lambda s, h: header_value(headers, 'content-type').startswith('text/html'),\n start_response)\n if status is None:\n return body\n start_response(status, headers)\n body = re.sub(r'<.*?>', '', body)\n return [body]\n return replacement_app\n \"\"\"\n if conditional is not None and start_response is None:\n raise TypeError(\n \"If you provide conditional you must also provide \"\n \"start_response\")\n data = []\n output = StringIO()\n def replacement_start_response(status, headers, exc_info=None):\n if conditional is not None and not conditional(status, headers):\n data.append(None)\n return start_response(status, headers, exc_info)\n if data:\n data[:] = []\n data.append(status)\n data.append(headers)\n return output.write\n app_iter = application(environ, replacement_start_response)\n if data[0] is None:\n return (None, None, app_iter)\n try:\n for item in app_iter:\n output.write(item)\n finally:\n if hasattr(app_iter, 'close'):\n app_iter.close()\n if not data:\n data.append(None)\n if len(data) < 2:\n data.append(None)\n data.append(output.getvalue())\n return data", "metadata": "root.intercept_output", "header": "['module', '___EOS___']", "index": 484 }, { "content": "class ResponseHeaderDict(HeaderDict):\n", "metadata": "root.ResponseHeaderDict", "header": "['module', '___EOS___']", "index": 563 }, { "content": " def __init__(self, *args, **kw):\n warnings.warn(\n \"The class wsgilib.ResponseHeaderDict has been moved \"\n \"to paste.response.HeaderDict\",\n DeprecationWarning, 2)\n HeaderDict.__init__(self, *args, **kw)", "metadata": "root.ResponseHeaderDict.__init__", "header": "['class', 'ResponseHeaderDict', '(', 'HeaderDict', ')', ':', '___EOS___']", "index": 565 }, { "content": "def _warn_deprecated(new_func):\n new_name = new_func.func_name\n new_path = new_func.func_globals['__name__'] + '.' + new_name\n def replacement(*args, **kw):\n warnings.warn(\n \"The function wsgilib.%s has been moved to %s\"\n % (new_name, new_path),\n DeprecationWarning, 2)\n return new_func(*args, **kw)\n try:\n replacement.func_name = new_func.func_name\n except:\n pass\n return replacement", "metadata": "root._warn_deprecated", "header": "['module', '___EOS___']", "index": 572 } ]
[ { "span": "from paste.request import get_cookies, parse_querystring, parse_formvars", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 72 }, { "span": "from paste.response import HeaderDict, has_header, header_value, remove_header", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 78 }, { "span": "from paste.response import error_body_response, error_response, error_response_app", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 82 }, { "span": "from traceback import print_exception", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "(", "c", ")", " ", "2005", " ", "Ia", "n", " ", "Bi", "ck", "ing", " ", "and", " ", "contributor", "s", ";", " ", "writt", "en", " ", "for", " ", "Past", "e", " ", "(", "http", "://", "python", "paste", ".", "org", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "MIT", " ", "license", ":", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "A", " ", "module", " ", "of", " ", "many", " ", "disp", "ara", "te", " ", "routin", "es", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", "s", " ", "whi", "ch", " ", "moved", " ", "to", " ", "paste", ".", "request", " ", "and", " ", "paste", ".", "response_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dep", "reca", "ted", " ", "aro", "und", " ", "15", " ", "De", "c", " ", "2005", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "paste_", "._", "request_", "import_", "get", "\\u", "cookies_", ",_", "parse", "\\u", "querystring", "_", ",_", "parse", "\\u", "form", "vars_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "paste_", "._", "request_", "import_", "construct", "\\u", "url_", ",_", "path", "\\u", "info", "\\u", "split_", ",_", "path", "\\u", "info", "\\u", "pop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "paste_", "._", "response_", "import_", "Head", "er", "Dict_", ",_", "has", "\\u", "header_", ",_", "header", "\\u", "value_", ",_", "remove", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "paste_", "._", "response_", "import_", "error", "\\u", "body", "\\u", "response_", ",_", "error", "\\u", "response_", ",_", "error", "\\u", "response", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "traceback_", "import_", "print", "\\u", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "c", "String", "IO_", "as_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "._", "urllib_", "._", "parse_", "import_", "unquote_", ",_", "urlsplit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "add", "\\u", "close", "'_", ",_", "'", "add", "\\u", "start", "\\u", "close", "'_", ",_", "'", "captur", "e\\u", "output", "'_", ",_", "'", "catch", "\\u", "error", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "catch", "\\u", "error", "s", "\\u", "app", "'_", ",_", "'", "chained", "\\u", "app", "\\u", "iters", "'_", ",_", "'", "construct", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dump", "\\u", "environ", "'_", ",_", "'", "encode", "\\u", "unicode", "\\u", "app", "\\u", "iter", "'_", ",_", "'", "error", "\\u", "body", "\\u", "response", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "\\u", "response", "'_", ",_", "'", "get", "\\u", "cookie", "s", "'_", ",_", "'", "has", "\\u", "header", "'_", ",_", "'", "header", "\\u", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interactive", "'_", ",_", "'", "intercept", "\\u", "output", "'_", ",_", "'", "path", "\\u", "info", "\\u", "pop", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "\\u", "info", "\\u", "split", "'_", ",_", "'", "raw", "\\u", "interactive", "'_", ",_", "'", "send", "\\u", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "interactive_", "._", "proxy_", "=_", "'", "raw", "\\u", "interactive", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Dep", "reca", "tion", " ", "warn", "ing", " ", "wrapp", "er", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Put", " ", "warn", "ings", " ", "wrapp", "er", " ", "in", " ", "place", " ", "for", " ", "all", " ", "public", " ", "function", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "wer", "e", " ", "import", "ed", " ", "from", " ", "else", "where", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u", "name_", "in_", "\\u\\u", "all\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "func_", "=_", "globals_", "(_", ")_", "[_", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "hasattr_", "(_", "\\u", "func_", ",_", "'", "func", "\\u", "globals", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "\\u", "func_", "._", "func", "\\u", "globals_", "[_", "'\\u", "\\u", "name", "\\u\\u'_", "]_", "!=_", "\\u\\u", "name\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "globals_", "(_", ")_", "[_", "\\u", "name_", "]_", "=_", "\\u", "warn", "\\u", "deprecated_", "(_", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doctest_", "._", "testmod_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "add", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "an", " ", "iterable", " ", "tha", "t", " ", "iterate", "s", " ", "over", " ", "app", "\\u", "iter", ",", " ", "then", " ", "calls", "\\", "10", ";", " ", " ", " ", " ", "close", "\\u", "func", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "iterable_", ",_", "close", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "=_", "app", "\\u", "iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "iter_", "=_", "iter_", "(_", "app", "\\u", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close", "\\u", "func_", "=_", "close", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "closed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "app", "\\u", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "closed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "close", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "raise", " ", "an", " ", "error", " ", "or", " ", "anyt", "hing", " ", "at", " ", "this", " ", "stage_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", ":", " ", "app", "\\u", "iter", ".", "close", "()", " ", "was", " ", "not", " ", "call", "ed", " ", "whe", "n", " ", "finish", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WS", "GI", " ", "request", ".", " ", "finali", "zatio", "n", " ", "function", " ", "%", "s", " ", "not", " ", "call", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "close", "\\u", "func_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "add", "\\u", "start", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "an", " ", "iterable", " ", "tha", "t", " ", "iterate", "s", " ", "over", " ", "app", "\\u", "iter", ",", " ", "calls", " ", "start", "\\u", "func", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "the", " ", "first", " ", "item", " ", "is", " ", "return", "ed", ",", " ", "then", " ", "calls", " ", "close", "\\u", "func", " ", "at", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "end", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "next\\u\\u_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "start", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "iterable_", ",_", "start", "\\u", "func_", ",_", "close", "\\u", "func_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "=_", "app", "\\u", "iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "iter_", "=_", "iter_", "(_", "app", "\\u", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "first_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "func_", "=_", "start", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "close", "\\u", "func_", "=_", "close", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "closed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "start", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "start", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "first_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "start", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "first_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "next_", "(_", "self_", "._", "app", "\\u", "iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "start", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "closed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "close", "\\u", "func_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close", "\\u", "func_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "add", "\\u", "start", "\\u", "close_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "raise", " ", "an", " ", "error", " ", "or", " ", "anyt", "hing", " ", "at", " ", "this", " ", "stage_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", ":", " ", "app", "\\u", "iter", ".", "close", "()", " ", "was", " ", "not", " ", "call", "ed", " ", "whe", "n", " ", "finish", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WS", "GI", " ", "request", ".", " ", "finali", "zatio", "n", " ", "function", " ", "%", "s", " ", "not", " ", "call", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "close", "\\u", "func_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "chained", "\\u", "app", "\\u", "iters_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Chain", "s", " ", "sever", "al", " ", "app", "\\u", "iters", " ", "tog", "ether", ",", " ", "als", "o", " ", "delegat", "ing", " ", ".", "close", "()", " ", "to", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "chained", "\\u", "app", "\\u", "iters_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "chained", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iters_", "=_", "chained", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chained", "_", "=_", "[_", "iter_", "(_", "item_", ")_", "for_", "item_", "in_", "chained", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "closed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "chained", "\\u", "app", "\\u", "iters_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "chained", "\\u", "app", "\\u", "iters_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "chained", "_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "chained", "_", "[_", "0_", "]_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "chained", "_", "[_", "0_", "]_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "chained", "_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "chained", "\\u", "app", "\\u", "iters_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "closed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "got", "\\u", "exc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app", "\\u", "iter_", "in_", "self_", "._", "app", "\\u", "iters_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "app", "\\u", "iter_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "app", "\\u", "iter_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "got", "\\u", "exc_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "got", "\\u", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "six_", "._", "reraise", "_", "(_", "got", "\\u", "exc_", "[_", "0_", "]_", ",_", "got", "\\u", "exc_", "[_", "1_", "]_", ",_", "got", "\\u", "exc_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "chained", "\\u", "app", "\\u", "iters_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "closed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "raise", " ", "an", " ", "error", " ", "or", " ", "anyt", "hing", " ", "at", " ", "this", " ", "stage_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "Error", ":", " ", "app", "\\u", "iter", ".", "close", "()", " ", "was", " ", "not", " ", "call", "ed", " ", "whe", "n", " ", "finish", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "WS", "GI", " ", "request", ".", " ", "finali", "zatio", "n", " ", "function", " ", "%", "s", " ", "not", " ", "call", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "self_", "._", "close", "\\u", "func_", ",_", "file_", "=_", "sys_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "encode", "\\u", "unicode", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Encode", "s", " ", "an", " ", "app", "\\u", "iterable", "'", "s", " ", "unicode", " ", "response", "s", " ", "as", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "next\\u\\u_", "=_", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "encode", "\\u", "unicode", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "iterable_", ",_", "encoding_", "=_", "sys_", "._", "getde", "fault", "encoding_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "=_", "'", "strict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "=_", "app", "\\u", "iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "iter_", "=_", "iter_", "(_", "app", "\\u", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "encoding_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "encode", "\\u", "unicode", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "encode", "\\u", "unicode", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "next_", "(_", "self_", "._", "app", "\\u", "iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "content_", ",_", "six_", "._", "text", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "content_", "._", "encode_", "(_", "self_", "._", "encoding_", ",_", "self_", "._", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "encode", "\\u", "unicode", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", "._", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "catch", "\\u", "errors_", "(_", "application_", ",_", "environ_", ",_", "start", "\\u", "response_", ",_", "error", "\\u", "callback_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ok", "\\u", "callback_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "applica", "tion", ",", " ", "and", " ", "return", "s", " ", "the", " ", "applica", "tion", " ", "iter", "ator", " ", "(", "whi", "ch", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "pass", "ed", " ", "ups", "tream", ").", " ", " ", "If", " ", "an", " ", "error", " ", "occur", "s", " ", "then", " ", "error", "\\u", "callback", " ", "will", " ", "be", " ", "call", "ed", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "exc", "\\u", "info", " ", "as", " ", "its", " ", "sole", " ", "argu", "ment", ".", " ", " ", "If", " ", "no", " ", "error", "s", " ", "occur", " ", "and", " ", "ok", "\\u", "callback", " ", "is", " ", "give", "n", ",", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "it", " ", "will", " ", "be", " ", "call", "ed", " ", "with", " ", "no", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "iter_", "=_", "application_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "callback_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "app", "\\u", "iter_", ")_", "in_", "(_", "list_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "won", "'", "t", " ", "produce", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ok", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ok", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "app", "\\u", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "wrap", "\\u", "app", "\\u", "iter_", "(_", "app", "\\u", "iter_", ",_", "error", "\\u", "callback_", ",_", "ok", "\\u", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app", "\\u", "iterable_", ",_", "error", "\\u", "callback_", ",_", "ok", "\\u", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "app", "\\u", "iterable_", "=_", "app", "\\u", "iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "iter_", "=_", "iter_", "(_", "app", "\\u", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "callback_", "=_", "error", "\\u", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ok", "\\u", "callback_", "=_", "ok", "\\u", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "=_", "self_", "._", "app", "\\u", "iterable_", "._", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "app", "\\u", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "ok", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ok", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "error", "\\u", "callback_", "(_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "catch", "\\u", "error", "s", "\\u", "app_", "(_", "application_", ",_", "environ_", ",_", "start", "\\u", "response_", ",_", "error", "\\u", "callback", "\\u", "app_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ok", "\\u", "callback_", "=_", "None_", ",_", "catch", "_", "=_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Lik", "e", " ", "``", "catch", "\\u", "error", "s", "``", ",", " ", "except", " ", "error", "\\u", "callback", "\\u", "app", " ", "shou", "ld", " ", "be", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "calla", "ble", " ", "tha", "t", " ", "will", " ", "receive", " ", "*", "three", "*", " ", "argu", "ment", "s", " ", "--", " ", "``", "environ", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "``", "start", "\\u", "response", "``", ",", " ", "and", " ", "``", "exc", "\\u", "info", "``.", " ", " ", "It", " ", "shou", "ld", " ", "call", "\\", "10", ";", " ", " ", " ", " ", "``", "start", "\\u", "response", "``", " ", "(*", "with", "*", " ", "the", " ", "exc", "\\u", "info", " ", "argu", "ment", "!)", " ", "and", " ", "return", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "iter", "ator", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "iter_", "=_", "application_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "catch", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "error", "\\u", "callback", "\\u", "app_", "(_", "environ_", ",_", "start", "\\u", "response_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "app", "\\u", "iter_", ")_", "in_", "(_", "list_", ",_", "tuple_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", "se", " ", "won", "'", "t", " ", "produce", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ok", "\\u", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ok", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "app", "\\u", "iter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "wrap", "\\u", "app", "\\u", "iter", "\\u", "app_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "environ_", ",_", "start", "\\u", "response_", ",_", "app", "\\u", "iter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "callback", "\\u", "app_", ",_", "ok", "\\u", "callback_", ",_", "catch", "_", "=_", "catch", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter", "\\u", "app_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter", "\\u", "app_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "environ_", ",_", "start", "\\u", "response_", ",_", "app", "\\u", "iterable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "callback", "\\u", "app_", ",_", "ok", "\\u", "callback_", ",_", "catch", "_", "=_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "environ_", "=_", "environ_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "response_", "=_", "start", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "iterable_", "=_", "app", "\\u", "iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "iter_", "=_", "iter_", "(_", "app", "\\u", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error", "\\u", "callback", "\\u", "app_", "=_", "error", "\\u", "callback", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ok", "\\u", "callback_", "=_", "ok", "\\u", "callback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "catch", "_", "=_", "catch", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", "._", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "=_", "self_", "._", "app", "\\u", "iterable_", "._", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter", "\\u", "app_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "wrap", "\\u", "app", "\\u", "iter", "\\u", "app_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "app", "\\u", "iter_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sto", "p", "Iteration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "ok", "\\u", "callback_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ok", "\\u", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "self_", "._", "catch", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "self_", "._", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "app", "\\u", "iterable_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@@", ":", " ", "Print", " ", "to", " ", "wsgi", ".", "error", "s", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "app", "\\u", "iterable_", "=_", "self_", "._", "error", "\\u", "callback", "\\u", "app_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "environ_", ",_", "self_", "._", "start", "\\u", "response_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app", "\\u", "iter_", "=_", "iter_", "(_", "new", "\\u", "app", "\\u", "iterable_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "new", "\\u", "app", "\\u", "iterable_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "=_", "new", "\\u", "app", "\\u", "iterable_", "._", "close_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "next_", "=_", "app", "\\u", "iter_", "._", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "raw", "\\u", "interactive_", "(_", "application_", ",_", "path_", "=_", "''_", ",_", "raise", "\\u", "on", "\\u", "wsgi", "\\u", "error_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "environ_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "applica", "tion", " ", "in", " ", "a", " ", "fake", " ", "environ", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "path", "\\u", "info", "\"_", "not_", "in_", "environ_", ",_", "\"", "argu", "ment", " ", "list", " ", "change", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "raise", "\\u", "on", "\\u", "wsgi", "\\u", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "Error", "Rai", "ser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "six_", "._", "Byte", "s", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "basic", "\\u", "environ_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mandat", "ory", " ", "CGI", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "'", "REQUEST", "\\u", "METH", "OD", "'_", ":_", "'", "GET", "'_", ",_", "#", " ", "alw", "ay", "s", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SCRIPT", "\\u", "NAME", "'_", ":_", "''_", ",_", "#", " ", "may", " ", "be", " ", "empty", " ", "if", " ", "app", " ", "is", " ", "at", " ", "the", " ", "root_", "\\u\\u\\uNL\\u\\u\\u_", "'", "PATH", "\\u", "INFO", "'_", ":_", "''_", ",_", "#", " ", "may", " ", "be", " ", "empty", " ", "if", " ", "at", " ", "root", " ", "of", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SERVER", "\\u", "NAME", "'_", ":_", "'", "local", "host", "'_", ",_", "#", " ", "alw", "ay", "s", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SERVER", "\\u", "PORT", "'_", ":_", "'", "80", "'_", ",_", "#", " ", "alw", "ay", "s", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SERVER", "\\u", "PROTOCOL", "'_", ":_", "'", "HTTP", "/", "1.0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mandat", "ory", " ", "wsgi", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "version", "'_", ":_", "(_", "1_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "url", "\\u", "sche", "me", "'_", ":_", "'", "http", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "input", "'_", ":_", "six_", "._", "Byte", "s", "IO_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "error", "s", "'_", ":_", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "multit", "hread", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "multipro", "cess", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", ".", "run", "\\u", "onc", "e", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "\\u_", ",_", "\\u_", ",_", "path", "\\u", "info_", ",_", "query_", ",_", "fragment_", ")_", "=_", "urlsplit_", "(_", "str_", "(_", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "info_", "=_", "unquote_", "(_", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "urls", "plit", " ", "return", "s", " ", "unicode", " ", "so", " ", "coerce", " ", "it", " ", "back", " ", "to", " ", "str_", "\\u\\u\\uNL\\u\\u\\u_", "path", "\\u", "info_", ",_", "query_", "=_", "str_", "(_", "path", "\\u", "info_", ")_", ",_", "str_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basic", "\\u", "environ_", "[_", "'", "PATH", "\\u", "INFO", "'_", "]_", "=_", "path", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic", "\\u", "environ_", "[_", "'", "QUE", "RY", "\\u", "STRING", "'_", "]_", "=_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "environ_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "name_", "._", "replace_", "(_", "'\\u\\u'_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basic", "\\u", "environ_", "[_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "'", "SERVER", "\\u", "NAME", "'_", "in_", "basic", "\\u", "environ_", "\\u\\u\\uNL\\u\\u\\u_", "and_", "'", "HTTP", "\\u", "HOST", "'_", "not_", "in_", "basic", "\\u", "environ_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic", "\\u", "environ_", "[_", "'", "HTTP", "\\u", "HOST", "'_", "]_", "=_", "basic", "\\u", "environ_", "[_", "'", "SERVER", "\\u", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "istr", "eam_", "=_", "basic", "\\u", "environ_", "[_", "'", "wsgi", ".", "input", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "istr", "eam_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basic", "\\u", "environ_", "[_", "'", "wsgi", ".", "input", "'_", "]_", "=_", "six_", "._", "Byte", "s", "IO_", "(_", "istr", "eam_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basic", "\\u", "environ_", "[_", "'", "CONTE", "NT", "\\u", "LENGTH", "'_", "]_", "=_", "len_", "(_", "istr", "eam_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "s", "\\u", "set_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "s", "\\u", "sent_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "start", "\\u", "response_", "(_", "status_", ",_", "headers_", ",_", "exc", "\\u", "info_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exc", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "header", "s", "\\u", "sent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Re", "-", "raise", " ", "original", " ", "exception", " ", "only", " ", "if", " ", "header", "s", " ", "sent_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "six_", "._", "reraise", "_", "(_", "exc", "\\u", "info_", "[_", "0_", "]_", ",_", "exc", "\\u", "info_", "[_", "1_", "]_", ",_", "exc", "\\u", "info_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "avoid", " ", "dan", "glin", "g", " ", "circular", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exc", "\\u", "info_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "header", "s", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "You", " ", "cann", "ot", " ", "set", " ", "the", " ", "header", "s", " ", "more", " ", "than", " ", "onc", "e", ",", " ", "unl", "ess", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exc", "\\u", "info", " ", "is", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Head", "ers", " ", "alr", "ead", "y", " ", "set", " ", "and", " ", "no", " ", "exc", "\\u", "info", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header", "s", "\\u", "set_", "._", "append_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "status", "'_", "]_", "=_", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "header", "s", "'_", "]_", "=_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "._", "append_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "iter_", "=_", "application_", "(_", "basic", "\\u", "environ_", ",_", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "s_", "in_", "app", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "s_", ",_", "six_", "._", "binar", "y", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "app", "\\u", "iter", " ", "response", " ", "can", " ", "only", " ", "contain", " ", "bytes", " ", "(", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unicode", ");", " ", "got", ":", " ", "%", "r", "\"_", "%_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "header", "s", "\\u", "sent_", "._", "append_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "header", "s", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Assert", "ion", "Error_", "(_", "\"", "Conten", "t", " ", "sent", " ", "w", "/", "o", " ", "header", "s", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "append_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Typical", "ly", " ", "\"", "iterati", "on", " ", "over", " ", "non", "-", "sequence", "\",", " ", "so", " ", "we", " ", "want_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "give", " ", "bett", "er", " ", "debugg", "ing", " ", "informati", "on", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "args_", "=_", "(_", "(_", "e_", "._", "args_", "[_", "0_", "]_", "+_", "'", " ", "iterable", ":", " ", "%", "r", "'_", "%_", "app", "\\u", "iter_", ")_", ",_", ")_", "+_", "e_", "._", "args_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "app", "\\u", "iter_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "iter_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "data_", "[_", "'", "status", "'_", "]_", ",_", "data_", "[_", "'", "header", "s", "'_", "]_", ",_", "b", "''_", "._", "join_", "(_", "output_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "errors_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Error", "Rai", "ser_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Error", "Rai", "ser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "flush_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Rai", "ser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Assert", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "error", "s", " ", "shou", "ld", " ", "be", " ", "writt", "en", " ", "(", "got", ":", " ", "%", "r", ")\"_", "%_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Rai", "ser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "writelines_", "(_", "self_", ",_", "seq_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Assert", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "error", "s", " ", "shou", "ld", " ", "be", " ", "writt", "en", " ", "(", "got", " ", "lines", ":", " ", "%", "s", ")\"_", "%_", "list_", "(_", "seq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Rai", "ser_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getvalue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "interactive_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "the", " ", "applica", "tion", " ", "inter", "ative", "ly", ",", " ", "wrapp", "ing", " ", "`", "raw", "\\u", "interactive", "`", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "return", "ing", " ", "the", " ", "output", " ", "in", " ", "a", " ", "format", "ted", " ", "way", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", ",_", "headers_", ",_", "content_", ",_", "errors_", "=_", "raw", "\\u", "interactive_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full_", "._", "write_", "(_", "'", "Error", "s", ":\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full_", "._", "write_", "(_", "errors_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full_", "._", "write_", "(_", "'\\\\", "n", "----------", "end", " ", "error", "s", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full_", "._", "write_", "(_", "status_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full_", "._", "write_", "(_", "'%", "s", ":", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "full_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "full_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "full_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "dump", "\\u", "environ_", "(_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Applica", "tion", " ", "whi", "ch", " ", "simp", "ly", " ", "dump", "s", " ", "the", " ", "current", " ", "environ", "ment", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", " ", "out", " ", "as", " ", "a", " ", "plain", " ", "text", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "list_", "(_", "environ_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "str_", "(_", "environ_", "[_", "k_", "]_", ")_", "._", "replace_", "(_", "\"\\\\", "n", "\"_", ",_", "\"\\\\", "n", " ", " ", " ", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "append_", "(_", "\"%", "s", ":", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "k_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "._", "append_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "length_", "=_", "environ_", "._", "get_", "(_", "\"", "CONTE", "NT", "\\u", "LENGTH", "\"_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "content", "\\u", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "append_", "(_", "environ_", "[_", "'", "wsgi", ".", "input", "'_", "]_", "._", "read_", "(_", "int_", "(_", "content", "\\u", "length_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "._", "append_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "\"\"_", "._", "join_", "(_", "output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "=_", "output_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "[_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "text", "/", "plain", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "str_", "(_", "len_", "(_", "output_", ")_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "response_", "(_", "\"", "200", " ", "OK", "\"_", ",_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "output_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "file_", "(_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "wsgi", "lib", ".", "send", "\\u", "file", " ", "has", " ", "bee", "n", " ", "moved", " ", "to", " ", "paste", ".", "file", "app", ".", "File", "App", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "paste_", "import_", "file", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "file", "app_", "._", "File", "App_", "(_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "captur", "e\\u", "output_", "(_", "environ_", ",_", "start", "\\u", "response_", ",_", "application_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "applica", "tion", " ", "with", " ", "environ", " ", "and", " ", "start", "\\u", "response", ",", " ", "and", " ", "captures", "\\", "10", ";", " ", " ", " ", " ", "status", ",", " ", "header", "s", ",", " ", "and", " ", "body", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sen", "ds", " ", "status", " ", "and", " ", "header", ",", " ", "but", " ", "*", "not", "*", " ", "body", ".", " ", " ", "Return", "s", " ", "(", "status", ",", "\\", "10", ";", " ", " ", " ", " ", "header", "s", ",", " ", "body", ").", " ", " ", "Typical", "ly", " ", "this", " ", "is", " ", "used", " ", "like", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "de", "html", "if", "ying", "\\u", "middle", "ware", "(", "applica", "tion", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "replace", "ment", "\\u", "app", "(", "environ", ",", " ", "start", "\\u", "response", "):", "\\", "10", ";", " ", " ", " ", " ", "status", ",", " ", "header", "s", ",", " ", "body", " ", "=", " ", "captur", "e\\u", "output", "(", "\\", "10", ";", " ", " ", "environ", ",", " ", "start", "\\u", "response", ",", " ", "applica", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "content", "\\u", "type", " ", "=", " ", "header", "\\u", "value", "(", "header", "s", ",", " ", "'", "content", "-", "type", "')", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "not", " ", "content", "\\u", "type", "\\", "10", ";", " ", " ", "or", " ", "not", " ", "content", "\\u", "type", ".", "startswith", "('", "text", "/", "html", "'))", ":", "\\", "10", ";", " ", " ", "return", " ", "[", "body", "]", "\\", "10", ";", " ", " ", " ", " ", "body", " ", "=", " ", "re", ".", "sub", "(", "r", "'<", ".*?", ">'", ",", " ", "''", ",", " ", "body", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "[", "body", "]", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "replace", "ment", "\\u", "app", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "wsgi", "lib", ".", "captur", "e\\u", "output", " ", "has", " ", "bee", "n", " ", "depre", "cated", " ", "in", " ", "fav", "or", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "of", " ", "wsgi", "lib", ".", "intercept", "\\u", "output", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "replace", "ment", "\\u", "start", "\\u", "response_", "(_", "status_", ",_", "headers_", ",_", "exc", "\\u", "info_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "._", "append_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "response_", "(_", "status_", ",_", "headers_", ",_", "exc", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "._", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "iter_", "=_", "application_", "(_", "environ_", ",_", "replace", "ment", "\\u", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "app", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "write_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "app", "\\u", "iter_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "iter_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "data_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "._", "append_", "(_", "output_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "intercept", "\\u", "output_", "(_", "environ_", ",_", "application_", ",_", "conditional", "_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "response_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "applica", "tion", " ", "with", " ", "environ", " ", "and", " ", "captures", " ", "status", ",", " ", "header", "s", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "body", ".", " ", " ", "Non", "e", " ", "are", " ", "sent", " ", "on", ";", " ", "you", " ", "must", " ", "send", " ", "them", " ", "on", " ", "your", "self", " ", "(", "unli", "ke", "\\", "10", ";", " ", " ", " ", " ", "``", "captur", "e\\u", "output", "``)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Typical", "ly", " ", "this", " ", "is", " ", "used", " ", "like", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "de", "html", "if", "ying", "\\u", "middle", "ware", "(", "applica", "tion", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "replace", "ment", "\\u", "app", "(", "environ", ",", " ", "start", "\\u", "response", "):", "\\", "10", ";", " ", " ", " ", " ", "status", ",", " ", "header", "s", ",", " ", "body", " ", "=", " ", "intercept", "\\u", "output", "(", "\\", "10", ";", " ", " ", "environ", ",", " ", "applica", "tion", ")", "\\", "10", ";", " ", " ", " ", " ", "start", "\\u", "response", "(", "status", ",", " ", "header", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "content", "\\u", "type", " ", "=", " ", "header", "\\u", "value", "(", "header", "s", ",", " ", "'", "content", "-", "type", "')", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "not", " ", "content", "\\u", "type", "\\", "10", ";", " ", " ", "or", " ", "not", " ", "content", "\\u", "type", ".", "startswith", "('", "text", "/", "html", "'))", ":", "\\", "10", ";", " ", " ", "return", " ", "[", "body", "]", "\\", "10", ";", " ", " ", " ", " ", "body", " ", "=", " ", "re", ".", "sub", "(", "r", "'<", ".*?", ">'", ",", " ", "''", ",", " ", "body", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "[", "body", "]", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "replace", "ment", "\\u", "app", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "third", " ", "option", "al", " ", "argu", "ment", " ", "``", "conditional", "``", " ", "shou", "ld", " ", "be", " ", "a", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "take", "s", " ", "``", "conditional", "(", "status", ",", " ", "header", "s", ")`", "`", " ", "and", " ", "return", "s", " ", "Fal", "se", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "request", " ", "shou", "ld", " ", "not", " ", "be", " ", "intercept", "ed", ".", " ", " ", "In", " ", "tha", "t", " ", "case", "\\", "10", ";", " ", " ", " ", " ", "``", "start", "\\u", "response", "``", " ", "will", " ", "be", " ", "call", "ed", " ", "and", " ", "``", "(", "Non", "e", ",", " ", "Non", "e", ",", " ", "app", "\\u", "iter", ")`", "`", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "return", "ed", ".", " ", " ", "You", " ", "must", " ", "detect", " ", "tha", "t", " ", "in", " ", "your", " ", "code", " ", "and", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "app", "\\u", "iter", ",", " ", "like", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "python", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "de", "html", "if", "ying", "\\u", "middle", "ware", "(", "applica", "tion", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "replace", "ment", "\\u", "app", "(", "environ", ",", " ", "start", "\\u", "response", "):", "\\", "10", ";", " ", " ", " ", " ", "status", ",", " ", "header", "s", ",", " ", "body", " ", "=", " ", "intercept", "\\u", "output", "(", "\\", "10", ";", " ", " ", "environ", ",", " ", "applica", "tion", ",", "\\", "10", ";", " ", " ", "lambda", " ", "s", ",", " ", "h", ":", " ", "header", "\\u", "value", "(", "header", "s", ",", " ", "'", "content", "-", "type", "')", ".", "startswith", "('", "text", "/", "html", "')", ",", "\\", "10", ";", " ", " ", "start", "\\u", "response", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "status", " ", "is", " ", "Non", "e", ":", "\\", "10", ";", " ", " ", "return", " ", "body", "\\", "10", ";", " ", " ", " ", " ", "start", "\\u", "response", "(", "status", ",", " ", "header", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "body", " ", "=", " ", "re", ".", "sub", "(", "r", "'<", ".*?", ">'", ",", " ", "''", ",", " ", "body", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "[", "body", "]", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "replace", "ment", "\\u", "app", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "conditional", "_", "is_", "not_", "None_", "and_", "start", "\\u", "response_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "If", " ", "you", " ", "provide", " ", "conditional", " ", "you", " ", "must", " ", "als", "o", " ", "provide", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "start", "\\u", "response", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "replace", "ment", "\\u", "start", "\\u", "response_", "(_", "status_", ",_", "headers_", ",_", "exc", "\\u", "info_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "conditional", "_", "is_", "not_", "None_", "and_", "not_", "conditional", "_", "(_", "status_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "start", "\\u", "response_", "(_", "status_", ",_", "headers_", ",_", "exc", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "._", "append_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "._", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "iter_", "=_", "application_", "(_", "environ_", ",_", "replace", "ment", "\\u", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "0_", "]_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "None_", ",_", "app", "\\u", "iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "app", "\\u", "iter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "output_", "._", "write_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "app", "\\u", "iter_", ",_", "'", "close", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "iter_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "data_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "._", "append_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "._", "append_", "(_", "output_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Respons", "e", "Head", "er", "Dict_", "(_", "Head", "er", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Respons", "e", "Head", "er", "Dict_", "(_", "Head", "er", "Dict_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "class", " ", "wsgi", "lib", ".", "Respons", "e", "Head", "er", "Dict", " ", "has", " ", "bee", "n", " ", "moved", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", " ", "paste", ".", "response", ".", "Head", "er", "Dict", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Head", "er", "Dict_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "warn", "\\u", "deprecated_", "(_", "new", "\\u", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "name_", "=_", "new", "\\u", "func_", "._", "func", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "path_", "=_", "new", "\\u", "func_", "._", "func", "\\u", "globals_", "[_", "'\\u", "\\u", "name", "\\u\\u'_", "]_", "+_", "'.'_", "+_", "new", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "replacement_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "function", " ", "wsgi", "lib", ".", "%", "s", " ", "has", " ", "bee", "n", " ", "moved", " ", "to", " ", "%", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "new", "\\u", "name_", ",_", "new", "\\u", "path_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Dep", "reca", "tion", "Warning_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "\\u", "func_", "(_", "*_", "args_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "replacement_", "._", "func", "\\u", "name_", "=_", "new", "\\u", "func_", "._", "func", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "replacement_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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_missing.py
[ { "content": "\"\"\"\nCopyright (c) 2013,\nFabian Gieseke, Justin P. Heinermann, Oliver Kramer, Jendrik Poloczek,\nNils A. Treiber\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n Neither the name of the Computational Intelligence Group of the University\n of Oldenburg nor the names of its contributors may be used to endorse or\n promote products derived from this software without specific prior written\n permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\"\"\"\n\nfrom windml.preprocessing.missing_data_finder import MissingDataFinder\nfrom numpy import zeros, int32, float32, nan\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OverrideMissing(object):", "metadata": "root.OverrideMissing", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def override(self, timeseries, timestep, override_val):\n\n val = override_val\n new_amount = timeseries.shape[0]\n misses = MissingDataFinder().find(timeseries, timestep)\n\n starts = {}\n for start, end, amount in misses:\n new_amount += amount\n starts[start] = [end, amount]\n\n # allocate new numpy array\n filled = zeros((new_amount,), dtype=[('date', int32),\\\n ('corrected_score', float32),\\\n ('speed', float32)])\n\n keys = starts.keys()\n current_index = 0\n\n for i in range(len(timeseries)):\n if(i in keys):\n # missing data starting\n cs = 'corrected_score'\n d = 'date'\n\n # add start measurement\n filled[current_index] = timeseries[i]\n current_index += 1\n\n end, n = starts[i]\n for j in range(1, n + 1):\n new_timestep = timeseries[i][d] + j * timestep\n filled[current_index] = (new_timestep, val, val)\n current_index += 1\n else:\n filled[current_index] = timeseries[i]\n current_index += 1\n\n return filled", "metadata": "root.OverrideMissing.override", "header": "['class', 'OverrideMissing', '(', 'object', ')', ':', '___EOS___']", "index": 37 } ]
[ { "span": "from numpy import zeros, int32, float32, nan", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2013", ",", "\\", "10", ";", "Fab", "ian", " ", "Gi", "ese", "ke", ",", " ", "Justi", "n", " ", "P", ".", " ", "Hei", "ner", "man", "n", ",", " ", "Oli", "ver", " ", "Kra", "mer", ",", " ", "Jen", "dri", "k", " ", "Pol", "oc", "ze", "k", ",", "\\", "10", ";", "Ni", "ls", " ", "A", ".", " ", "Tre", "ibe", "r", "\\", "10", ";", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out", "\\", "10", ";", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "\\", "10", ";", " ", " ", " ", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "Computation", "al", " ", "Intel", "lig", "ence", " ", "Group", " ", "of", " ", "the", " ", "Univers", "it", "y", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "Old", "enb", "urg", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", "\\", "10", ";", " ", " ", " ", " ", "permissi", "on", ".", "\\", "10", ";", "\\", "10", ";", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", "\\", "10", ";", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", "\\", "10", ";", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", "\\", "10", ";", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", "\\", "10", ";", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", "\\", "10", ";", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", "\\", "10", ";", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", "\\", "10", ";", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", "\\", "10", ";", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", "\\", "10", ";", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wind", "ml_", "._", "preprocessing_", "._", "missi", "ng", "\\u", "data\\u", "finder_", "import_", "Missing", "Data", "Finder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "zeros_", ",_", "int32_", ",_", "float32_", ",_", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Override", "Missing", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Override", "Missing", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "override_", "(_", "self_", ",_", "timeseries_", ",_", "timestep_", ",_", "override", "\\u", "val_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "override", "\\u", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "amount_", "=_", "timeseries_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "misses", "_", "=_", "Missing", "Data", "Finder_", "(_", ")_", "._", "find_", "(_", "timeseries_", ",_", "timestep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "starts_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "start_", ",_", "end_", ",_", "amount_", "in_", "misses", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "amount_", "+=_", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "starts_", "[_", "start_", "]_", "=_", "[_", "end_", ",_", "amount_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "allocate", " ", "new", " ", "nump", "y", " ", "array_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filled_", "=_", "zeros_", "(_", "(_", "new", "\\u", "amount_", ",_", ")_", ",_", "dtype_", "=_", "[_", "(_", "'", "date", "'_", ",_", "int32_", ")_", ",_", "(_", "'", "corrected", "\\u", "score", "'_", ",_", "float32_", ")_", ",_", "(_", "'", "speed", "'_", ",_", "float32_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "starts_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "timeseries_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "i_", "in_", "keys_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "missi", "ng", " ", "data", " ", "startin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cs_", "=_", "'", "corrected", "\\u", "score", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "'", "date", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "start", " ", "measurement_", "\\u\\u\\uNL\\u\\u\\u_", "filled_", "[_", "current", "\\u", "index_", "]_", "=_", "timeseries_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "end_", ",_", "n_", "=_", "starts_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", "in_", "range_", "(_", "1_", ",_", "n_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "timestep_", "=_", "timeseries_", "[_", "i_", "]_", "[_", "d_", "]_", "+_", "j_", "*_", "timestep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filled_", "[_", "current", "\\u", "index_", "]_", "=_", "(_", "new", "\\u", "timestep_", ",_", "val_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filled_", "[_", "current", "\\u", "index_", "]_", "=_", "timeseries_", "[_", "i_", "]_",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported with 'import' and 'import from'
pypa/pip/pip/req/req_file.py
[ { "content": "\"\"\"\nRequirements file parsing\n\"\"\"\n\nfrom __future__ import absolute_import\n\nimport os\nimport re\nimport shlex\nimport sys\nimport optparse\nimport warnings\n\nfrom pip._vendor.six.moves.urllib import parse as urllib_parse\nfrom pip._vendor.six.moves import filterfalse\n\nimport pip\nfrom pip.download import get_file_content\nfrom pip.req.req_install import InstallRequirement\nfrom pip.exceptions import (RequirementsFileParseError)\nfrom pip.utils.deprecation import RemovedInPip10Warning\nfrom pip import cmdoptions\n\n__all__ = ['parse_requirements']\n\nSCHEME_RE = re.compile(r'^(http|https|file):', re.I)\nCOMMENT_RE = re.compile(r'(^|\\s)+#.*$')\n\nSUPPORTED_OPTIONS = [\n cmdoptions.constraints,\n cmdoptions.editable,\n cmdoptions.requirements,\n cmdoptions.no_index,\n cmdoptions.index_url,\n cmdoptions.find_links,\n cmdoptions.extra_index_url,\n cmdoptions.allow_external,\n cmdoptions.allow_all_external,\n cmdoptions.no_allow_external,\n cmdoptions.allow_unsafe,\n cmdoptions.no_allow_unsafe,\n cmdoptions.use_wheel,\n cmdoptions.no_use_wheel,\n cmdoptions.always_unzip,\n cmdoptions.no_binary,\n cmdoptions.only_binary,\n cmdoptions.pre,\n cmdoptions.process_dependency_links,\n cmdoptions.trusted_host,\n cmdoptions.require_hashes,\n]\n\n# options to be passed to requirements\nSUPPORTED_OPTIONS_REQ = [\n cmdoptions.install_options,\n cmdoptions.global_options,\n cmdoptions.hash,\n]\n\n# the 'dest' string values\nSUPPORTED_OPTIONS_REQ_DEST = [o().dest for o in SUPPORTED_OPTIONS_REQ]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import pip", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Requirements", " ", "file", " ", "pars", "ing", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shlex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pip_", "._", "\\u", "vendor_", "._", "six_", "._", "moves_", "._", "urllib_", "import_", "parse_", "as_", "url", "lib", "\\u", "parse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pip_", "._", "\\u", "vendor_", "._", "six_", "._", "moves_", "import_", "filter", "false_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pip_", "._", "download_", "import_", "get", "\\u", "file", "\\u", "content_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pip_", "._", "req_", "._", "req", "\\u", "install_", "import_", "Install", "Requirement", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pip_", "._", "exceptions_", "import_", "(_", "Requirements", "File", "Pars", "e", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pip_", "._", "utils_", "._", "deprecation", "_", "import_", "Remove", "d", "In", "Pi", "p10", "Warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pip_", "import_", "cmd", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "parse", "\\u", "require", "ment", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SCHEME", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "r", "'", "^", "(", "http", "|", "https", "|", "file", "):'_", ",_", "re_", "._", "I_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMMENT", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "r", "'(", "^", "|\\\\", "s", ")+", "#.", "*$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SUPPORTED", "\\u", "OPTIONS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "constraints_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "editable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "requirements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "no", "\\u", "index_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "index", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "find", "\\u", "links_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "extra", "\\u", "index", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "allow", "\\u", "external_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "allow", "\\u", "all", "\\u", "external_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "no", "\\u", "allow", "\\u", "external_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "allow", "\\u", "unsafe", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "no", "\\u", "allow", "\\u", "unsafe", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "use", "\\u", "wheel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "no", "\\u", "use", "\\u", "wheel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "alw", "ay", "s", "\\u", "unzip", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "no", "\\u", "binary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "only", "\\u", "binary_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "pre_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "process", "\\u", "dependen", "cy", "\\u", "links_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "trusted", "\\u", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "require", "\\u", "hashes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "options", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "requirements_", "\\u\\u\\uNL\\u\\u\\u_", "SUPPORTED", "\\u", "OPTION", "S", "\\u", "REQ_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "install", "\\u", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "global", "\\u", "options_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "options_", "._", "hash_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "'", "dest", "'", " ", "string", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "SUPPORTED", "\\u", "OPTION", "S", "\\u", "REQ", "\\u", "DEST", "_", "=_", "[_", "o_", "(_", ")_", "._", "dest_", "for_", "o_", "in_", "SUPPORTED", "\\u", "OPTION", "S", "\\u", "REQ_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEW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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
erkyrath/tworld/lib/twest/test_funcs.py
[ { "content": " @tornado.testing.gen_test\n def test_type_methods_list(self):\n yield self.resetTables()\n \n task = two.task.Task(self.app, None, 1, 2, twcommon.misc.now())\n ctx = EvalPropContext(task, loctx=self.loctx, level=LEVEL_EXECUTE)\n\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls.append(4);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2,3,4])\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls.clear();_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [])\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls2=_ls.copy();_ls[0]=0;_ls2', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2,3])\n res = yield ctx.eval('[1,2,3,2].count(2)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 2)\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls.extend([4,5]);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2,3,4,5])\n res = yield ctx.eval('[5,4,3].index(4)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 1)\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls.insert(0,4);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [4,1,2,3])\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls.pop();_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2])\n res = yield ctx.eval('_ls=[1,2,3]\\n_ls.remove(2);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,3])\n res = yield ctx.eval('_ls=[3,2,1]\\n_ls.reverse();_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2,3])\n \n task.resetticks()\n\n res = yield ctx.eval('_ls=[3,1,2]\\n_ls.sort();_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2,3])\n res = yield ctx.eval('_ls=[3,1,2]\\nlist.sort(_ls);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [1,2,3])\n res = yield ctx.eval('_ls=[3,1,2]\\n_ls.sort(reverse=True);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [3,2,1])\n res = yield ctx.eval('_ls=[3,1,2]\\nlist.sort(_ls,reverse=True);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [3,2,1])\n res = yield ctx.eval('_ls=[-1,2,-3,4]\\n_ls.sort(key=str);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [-1,-3,2,4])\n res = yield ctx.eval('_ls=[-1,2,-3,4]\\nlist.sort(_ls,key=str);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [-1,-3,2,4])\n res = yield ctx.eval('_ls=[-1,2,-3,4]\\n_ls.sort(key=str,reverse=True);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [4,2,-3,-1])\n res = yield ctx.eval('_ls=[-1,2,-3,4]\\nlist.sort(_ls,key=str,reverse=True);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [4,2,-3,-1])\n res = yield ctx.eval('_ls=[-1,-3,2,4]\\n_func=code(\"x*x\",args=\"x\")\\n_ls.sort(key=_func);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [-1,2,-3,4])\n res = yield ctx.eval('_ls=[-1,-3,2,4]\\n_func=code(\"x*x\",args=\"x\")\\nlist.sort(_ls,key=_func);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [-1,2,-3,4])\n res = yield ctx.eval('_ls=[-1,-3,2,4]\\n_func=code(\"x*x\",args=\"x\")\\n_ls.sort(key=_func,reverse=True);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [4,-3,2,-1])\n res = yield ctx.eval('_ls=[-1,-3,2,4]\\n_func=code(\"x*x\",args=\"x\")\\nlist.sort(_ls,key=_func,reverse=True);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, [4,-3,2,-1])\n \n res = yield ctx.eval('_ls=[\"d\",\"C\",\"b\",\"A\"]\\n_ls.sort(key=str.upper);_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ['A','b','C','d'])\n res = yield ctx.eval('_ls=[\"d\",\"p\",\"q\",\"x\",\"y\"]\\n_ls.sort(key=functools.partial(str.index,\"xyzpdq\"));_ls', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ['x','y','p','d','q'])\n \n with self.assertRaises(TypeError):\n res = yield ctx.eval('_ls=[1]\\n_ls.sort(key=foo);_ls', locals={'foo':open}, evaltype=EVALTYPE_CODE)\n with self.assertRaises(TypeError):\n res = yield ctx.eval('_ls=[1]\\n_ls.sort(key=foo);_ls', locals={'foo':123}, evaltype=EVALTYPE_CODE)", "metadata": "root.TestEvalAsync.test_type_methods_list", "header": "['class', 'TestEvalAsync', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 169 }, { "content": " @tornado.testing.gen_test\n def test_type_methods_string(self):\n yield self.resetTables()\n \n task = two.task.Task(self.app, None, 1, 2, twcommon.misc.now())\n ctx = EvalPropContext(task, loctx=self.loctx, level=LEVEL_EXECUTE)\n \n res = yield ctx.eval('\"foo bar\".capitalize()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'Foo bar')\n res = yield ctx.eval('\"Foo BAR\".casefold()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'foo bar')\n res = yield ctx.eval('\"foo bar\".center(9)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ' foo bar ')\n res = yield ctx.eval('\"foo bar\".count(\"o\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 2)\n res = yield ctx.eval('\"foo bar\".endswith(\"ar\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"foo bar\".find(\"a\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 5)\n res = yield ctx.eval('\"foo bar\".index(\"a\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 5)\n res = yield ctx.eval('\"foo bar\".isalnum()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, False)\n res = yield ctx.eval('\"foobar\".isalpha()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"1235\".isdecimal()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"1235x\".isdigit()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, False)\n res = yield ctx.eval('\"Foo_bar\".isidentifier()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"foo bar\".islower()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"1235\".isnumeric()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"foo bar\".isprintable()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"foo bar\".isspace()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, False)\n res = yield ctx.eval('\"Foo Bar\".istitle()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\"Foo Bar\".isupper()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, False)\n res = yield ctx.eval('\",\".join([\"x\",\"y\",\"zz\"])', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'x,y,zz')\n res = yield ctx.eval('\"foo bar\".ljust(9)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'foo bar ')\n res = yield ctx.eval('\"Foo BAR\".lower()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'foo bar')\n res = yield ctx.eval('\" foo \".lstrip()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'foo ')\n res = yield ctx.eval('\"x,y,z\".partition(\",\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ('x', ',', 'y,z') )\n res = yield ctx.eval('\"foo bar\".replace(\"o\",\"z\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'fzz bar')\n res = yield ctx.eval('\"foo bar\".rfind(\"o\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 2)\n res = yield ctx.eval('\"foo bar\".rindex(\"o\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 2)\n res = yield ctx.eval('\"foo bar\".rjust(9)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ' foo bar')\n res = yield ctx.eval('\"x,y,z\".rpartition(\",\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ('x,y', ',', 'z') )\n res = yield ctx.eval('\"x,y,z\".rsplit(\",\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ['x', 'y', 'z'] )\n res = yield ctx.eval('\" foo \".rstrip()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ' foo')\n res = yield ctx.eval('\"x,y,z\".split(\",\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ['x', 'y', 'z'] )\n res = yield ctx.eval('\"x\\\\ny\\\\nz\".splitlines()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ['x', 'y', 'z'] )\n res = yield ctx.eval('\"foo bar\".startswith(\"fo\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, True)\n res = yield ctx.eval('\" foo \".strip()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'foo')\n res = yield ctx.eval('\"Foo BAR\".swapcase()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'fOO bar')\n res = yield ctx.eval('\"foo bar\".title()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'Foo Bar')\n res = yield ctx.eval('\"foo bar\".upper()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'FOO BAR')\n res = yield ctx.eval('\"foo bar\".zfill(9)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, '00foo bar')\n\n # Miscellaneous cases\n res = yield ctx.eval('str.upper(\"foo bar\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 'FOO BAR')\n \n with self.assertRaises(twcommon.excepts.ExecSandboxException):\n res = yield ctx.eval('\"x\".__class__', evaltype=EVALTYPE_CODE)\n with self.assertRaises(twcommon.excepts.ExecSandboxException):\n res = yield ctx.eval('str.__class__', evaltype=EVALTYPE_CODE)\n with self.assertRaises(twcommon.excepts.ExecSandboxException):\n res = yield ctx.eval('\"x\".nosuchattr', evaltype=EVALTYPE_CODE)\n with self.assertRaises(twcommon.excepts.ExecSandboxException):\n res = yield ctx.eval('str.nosuchattr', evaltype=EVALTYPE_CODE)\n with self.assertRaises(twcommon.excepts.ExecSandboxException):\n res = yield ctx.eval('\"x\".format', evaltype=EVALTYPE_CODE)\n with self.assertRaises(twcommon.excepts.ExecSandboxException):\n res = yield ctx.eval('str.format', evaltype=EVALTYPE_CODE)", "metadata": "root.TestEvalAsync.test_type_methods_string", "header": "['class', 'TestEvalAsync', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 266 }, { "content": " @tornado.testing.gen_test\n def test_partial(self):\n yield self.resetTables()\n \n task = two.task.Task(self.app, None, 1, 2, twcommon.misc.now())\n task.set_writable()\n ctx = EvalPropContext(task, loctx=self.loctx, level=LEVEL_EXECUTE)\n\n res = yield ctx.eval('functools.partial(int)()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 0)\n res = yield ctx.eval('functools.partial(int, \"10\")()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 10)\n res = yield ctx.eval('functools.partial(int)(\"11\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 11)\n res = yield ctx.eval('functools.partial(int, \"10\", 4)()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 4)\n res = yield ctx.eval('functools.partial(int)(\"11\", 4)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 5)\n res = yield ctx.eval('functools.partial(int, \"12\")(4)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 6)\n res = yield ctx.eval('functools.partial(int, \"10\", base=5)()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 5)\n res = yield ctx.eval('functools.partial(int)(\"11\", base=5)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 6)\n res = yield ctx.eval('functools.partial(int, \"12\")(base=5)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 7)\n \n res = yield ctx.eval('propint = code(\"int(x, base=base)\", args=\"x, base=None\")', evaltype=EVALTYPE_CODE)\n res = yield ctx.eval('functools.partial(propint, \"10\", base=6)()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 6)\n res = yield ctx.eval('functools.partial(propint)(\"11\", base=6)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 7)\n res = yield ctx.eval('functools.partial(propint, \"12\")(base=6)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, 8)\n\n res = yield ctx.eval('functools.partial(ObjectId, \"528d3862689e9d17a7a96473\")()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ObjectId('528d3862689e9d17a7a96473'))\n res = yield ctx.eval('functools.partial(ObjectId)(\"528d3862689e9d17a7a96474\")', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, ObjectId('528d3862689e9d17a7a96474'))\n \n res = yield ctx.eval('functools.partial(location)()', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, self.exlocid)\n res = yield ctx.eval('functools.partial(location)(None)', evaltype=EVALTYPE_CODE)\n self.assertEqual(res, self.exlocid)\n\n with self.assertRaises(TypeError):\n res = yield ctx.eval('functools.partial(foo)()', locals={'foo':open}, evaltype=EVALTYPE_CODE)", "metadata": "root.TestEvalAsync.test_partial", "header": "['class', 'TestEvalAsync', '(', 'twest', '.', 'mock', '.', 'MockAppTestCase', ')', ':', '___EOS___']", "index": 419 } ]
[ { "span": "res ", "start_line": 232, "start_column": 12, "end_line": 232, "end_column": 15 }, { "span": "res ", "start_line": 365, "start_column": 12, "end_line": 365, "end_column": 15 }, { "span": "res ", "start_line": 465, "start_column": 12, "end_line": 465, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Eval", "Async", "_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "type", "\\u", "method", "s", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "two_", "._", "task_", "._", "Task_", "(_", "self_", "._", "app_", ",_", "None_", ",_", "1_", ",_", "2_", ",_", "tw", "common_", "._", "misc_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "Eval", "Prop", "Context_", "(_", "task_", ",_", "loc", "tx_", "=_", "self_", "._", "loc", "tx_", ",_", "level_", "=_", "LE", "VEL", "\\u", "EXECUTE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", ".", "append", "(", "4", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", ".", "clear", "();", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", "2", "=", "\\u", "ls", ".", "copy", "();", "\\u", "ls", "[", "0", "]=", "0", ";", "\\u", "ls", "2", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'[", "1", ",", "2", ",", "3", ",", "2", "].", "count", "(", "2", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", ".", "extend", "([", "4", ",", "5", "])", ";", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'[", "5", ",", "4", ",", "3", "].", "index", "(", "4", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", ".", "insert", "(", "0", ",", "4", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "4_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", ".", "pop", "();", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", ",", "2", ",", "3", "]\\\\", "n", "\\u", "ls", ".", "remove", "(", "2", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "3", ",", "2", ",", "1", "]\\\\", "n", "\\u", "ls", ".", "reverse", "();", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "._", "reset", "ticks_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "3", ",", "1", ",", "2", "]\\\\", "n", "\\u", "ls", ".", "sort", "();", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "3", ",", "1", ",", "2", "]\\\\", "nli", "st", ".", "sort", "(\\u", "ls", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "3", ",", "1", ",", "2", "]\\\\", "n", "\\u", "ls", ".", "sort", "(", "reverse", "=", "Tru", "e", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "3_", ",_", "2_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "3", ",", "1", ",", "2", "]\\\\", "nli", "st", ".", "sort", "(\\u", "ls", ",", "reverse", "=", "Tru", "e", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "3_", ",_", "2_", ",_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",", "2", ",-", "3", ",", "4", "]\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "str", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "-_", "1_", ",_", "-_", "3_", ",_", "2_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",", "2", ",-", "3", ",", "4", "]\\\\", "nli", "st", ".", "sort", "(\\u", "ls", ",", "key", "=", "str", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "-_", "1_", ",_", "-_", "3_", ",_", "2_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",", "2", ",-", "3", ",", "4", "]\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "str", ",", "reverse", "=", "Tru", "e", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "4_", ",_", "2_", ",_", "-_", "3_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",", "2", ",-", "3", ",", "4", "]\\\\", "nli", "st", ".", "sort", "(\\u", "ls", ",", "key", "=", "str", ",", "reverse", "=", "Tru", "e", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "4_", ",_", "2_", ",_", "-_", "3_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",-", "3", ",", "2", ",", "4", "]\\\\", "n", "\\u", "func", "=", "code", "(\"", "x", "*", "x", "\",", "args", "=\"", "x", "\")\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "\\u", "func", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "-_", "1_", ",_", "2_", ",_", "-_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",-", "3", ",", "2", ",", "4", "]\\\\", "n", "\\u", "func", "=", "code", "(\"", "x", "*", "x", "\",", "args", "=\"", "x", "\")\\\\", "nli", "st", ".", "sort", "(\\u", "ls", ",", "key", "=", "\\u", "func", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "-_", "1_", ",_", "2_", ",_", "-_", "3_", ",_", "4_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",-", "3", ",", "2", ",", "4", "]\\\\", "n", "\\u", "func", "=", "code", "(\"", "x", "*", "x", "\",", "args", "=\"", "x", "\")\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "\\u", "func", ",", "reverse", "=", "Tru", "e", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "4_", ",_", "-_", "3_", ",_", "2_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "-1", ",-", "3", ",", "2", ",", "4", "]\\\\", "n", "\\u", "func", "=", "code", "(\"", "x", "*", "x", "\",", "args", "=\"", "x", "\")\\\\", "nli", "st", ".", "sort", "(\\u", "ls", ",", "key", "=", "\\u", "func", ",", "reverse", "=", "Tru", "e", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "4_", ",_", "-_", "3_", ",_", "2_", ",_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[\"", "d", "\",\"", "C", "\",\"", "b", "\",\"", "A", "\"]", "\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "str", ".", "upper", ");", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "'", "A", "'_", ",_", "'", "b", "'_", ",_", "'", "C", "'_", ",_", "'", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[\"", "d", "\",\"", "p", "\",\"", "q", "\",\"", "x", "\",\"", "y", "\"]", "\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "functo", "ols", ".", "partial", "(", "str", ".", "index", ",\"", "xyz", "pd", "q", "\"))", ";", "\\u", "ls", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "p", "'_", ",_", "'", "d", "'_", ",_", "'", "q", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", "]\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "foo", ");", "\\u", "ls", "'_", ",_", "locals_", "=_", "{_", "'", "foo", "'_", ":_", "open_", "}_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\\u", "ls", "=[", "1", "]\\\\", "n", "\\u", "ls", ".", "sort", "(", "key", "=", "foo", ");", "\\u", "ls", "'_", ",_", "locals_", "=_", "{_", "'", "foo", "'_", ":_", "123_", "}_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Eval", "Async", "_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "type", "\\u", "method", "s", "\\u", "string_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "two_", "._", "task_", "._", "Task_", "(_", "self_", "._", "app_", ",_", "None_", ",_", "1_", ",_", "2_", ",_", "tw", "common_", "._", "misc_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "Eval", "Prop", "Context_", "(_", "task_", ",_", "loc", "tx_", "=_", "self_", "._", "loc", "tx_", ",_", "level_", "=_", "LE", "VEL", "\\u", "EXECUTE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "capitaliz", "e", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "Foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "Foo", " ", "BAR", "\".", "case", "fold", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "center", "(", "9", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", " ", "foo", " ", "bar", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "count", "(\"", "o", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "ends", "with", "(\"", "ar", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "find", "(\"", "a", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "index", "(\"", "a", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "isal", "num", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "fooba", "r", "\".", "isal", "pha", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "123", "5", "\".", "isd", "eci", "mal", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "123", "5", "x", "\".", "isdi", "git", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "Foo", "\\u", "bar", "\".", "isi", "denti", "fier", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "isl", "ower", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "123", "5", "\".", "isn", "ume", "ric", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "isp", "rint", "able", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "isspace", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "Foo", " ", "Bar", "\".", "isti", "tle", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "Foo", " ", "Bar", "\".", "isupper", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\",", "\".", "join", "([", "\"", "x", "\",\"", "y", "\",\"", "zz", "\"]", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "x", ",", "y", ",", "zz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "lj", "ust", "(", "9", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "foo", " ", "bar", " ", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "Foo", " ", "BAR", "\".", "lower", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", " ", "foo", " ", "\".", "lst", "rip", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "foo", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", ",", "y", ",", "z", "\".", "partit", "ion", "(\"", ",\"", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "(_", "'", "x", "'_", ",_", "','_", ",_", "'", "y", ",", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "replace", "(\"", "o", "\",\"", "z", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "fz", "z", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "rfi", "nd", "(\"", "o", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "rindex", "(\"", "o", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "rj", "ust", "(", "9", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", " ", " ", "foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", ",", "y", ",", "z", "\".", "rpa", "rti", "tion", "(\"", ",\"", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "(_", "'", "x", ",", "y", "'_", ",_", "','_", ",_", "'", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", ",", "y", ",", "z", "\".", "rsp", "lit", "(\"", ",\"", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", " ", "foo", " ", "\".", "rstr", "ip", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", " ", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", ",", "y", ",", "z", "\".", "split", "(\"", ",\"", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", "\\\\\\\\", "ny", "\\\\\\\\", "nz", "\".", "split", "lines", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", ",_", "'", "z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "startswith", "(\"", "fo", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", " ", "foo", " ", "\".", "strip", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "Foo", " ", "BAR", "\".", "swap", "case", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "f", "OO", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "title", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "Foo", " ", "Bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "upper", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "FOO", " ", "BAR", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "foo", " ", "bar", "\".", "zfil", "l", "(", "9", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "00", "foo", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mis", "cell", "ane", "ous", " ", "cases_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "str", ".", "upper", "(\"", "foo", " ", "bar", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "'", "FOO", " ", "BAR", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tw", "common_", "._", "except", "s_", "._", "Exe", "c", "Sandbox", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", "\".\\", "u\\u", "class", "\\u\\u'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tw", "common_", "._", "except", "s_", "._", "Exe", "c", "Sandbox", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "str", ".\\u", "\\u", "class", "\\u\\u'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tw", "common_", "._", "except", "s_", "._", "Exe", "c", "Sandbox", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", "\".", "nos", "uch", "attr", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tw", "common_", "._", "except", "s_", "._", "Exe", "c", "Sandbox", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "str", ".", "nos", "uch", "attr", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tw", "common_", "._", "except", "s_", "._", "Exe", "c", "Sandbox", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'\"", "x", "\".", "format", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "tw", "common_", "._", "except", "s_", "._", "Exe", "c", "Sandbox", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "str", ".", "format", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Eval", "Async", "_", "(_", "twe", "st_", "._", "mock_", "._", "Moc", "k", "App", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "tornado_", "._", "testing_", "._", "gen", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "partial_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "reset", "Tables_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "task_", "=_", "two_", "._", "task_", "._", "Task_", "(_", "self_", "._", "app_", ",_", "None_", ",_", "1_", ",_", "2_", ",_", "tw", "common_", "._", "misc_", "._", "now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "task_", "._", "set\\u", "writable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "Eval", "Prop", "Context_", "(_", "task_", ",_", "loc", "tx_", "=_", "self_", "._", "loc", "tx_", ",_", "level_", "=_", "LE", "VEL", "\\u", "EXECUTE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ")()", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ",", " ", "\"", "10", "\")", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ")(", "\"", "11", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ",", " ", "\"", "10", "\",", " ", "4", ")()", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ")(", "\"", "11", "\",", " ", "4", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ",", " ", "\"", "1", "2", "\")", "(", "4", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ",", " ", "\"", "10", "\",", " ", "base", "=", "5", ")()", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ")(", "\"", "11", "\",", " ", "base", "=", "5", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "int", ",", " ", "\"", "1", "2", "\")", "(", "base", "=", "5", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "prop", "int", " ", "=", " ", "code", "(\"", "int", "(", "x", ",", " ", "base", "=", "base", ")\"", ",", " ", "args", "=\"", "x", ",", " ", "base", "=", "Non", "e", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "prop", "int", ",", " ", "\"", "10", "\",", " ", "base", "=", "6", ")()", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "prop", "int", ")(", "\"", "11", "\",", " ", "base", "=", "6", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "prop", "int", ",", " ", "\"", "1", "2", "\")", "(", "base", "=", "6", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "Object", "Id", ",", " ", "\"", "528", "d3", "862", "689", "e9", "d1", "7a", "7a", "964", "7", "3", "\")", "()'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Object", "Id_", "(_", "'", "528", "d3", "862", "689", "e9", "d1", "7a", "7a", "964", "7", "3", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "Object", "Id", ")(", "\"", "528", "d3", "862", "689", "e9", "d1", "7a", "7a", "964", "7", "4", "\")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "Object", "Id_", "(_", "'", "528", "d3", "862", "689", "e9", "d1", "7a", "7a", "964", "7", "4", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "location", ")()", "'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "self_", "._", "ex", "loci", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "location", ")(", "Non", "e", ")'_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "res_", ",_", "self_", "._", "ex", "loci", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "yield_", "ctx_", "._", "eval_", "(_", "'", "functo", "ols", ".", "partial", "(", "foo", ")()", "'_", ",_", "locals_", "=_", "{_", "'", "foo", "'_", ":_", "open_", "}_", ",_", "eval", "type_", "=_", "EVAL", "TYPE", "\\u", "CODE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
dronekit/dronekit-python/dronekit/__init__.py
[ { "content": " def __init__(self, raw_version, autopilot_type, vehicle_type):\n self.autopilot_type = autopilot_type\n self.vehicle_type = vehicle_type\n self.raw_version = raw_version\n if(raw_version == None):\n self.major = None\n self.minor = None\n self.patch = None\n self.release = None\n else:\n self.major = raw_version >> 24 & 0xFF\n self.minor = raw_version >> 16 & 0xFF\n self.patch = raw_version >> 8 & 0xFF\n self.release = raw_version & 0xFF", "metadata": "root.Version.__init__", "header": "['class', 'Version', '(', 'object', ')', ':', '___EOS___']", "index": 285 }, { "content": " def __init__(self, handler):\n super(Vehicle, self).__init__()\n\n self._handler = handler\n self._master = handler.master\n\n # Cache all updated attributes for wait_ready.\n # By default, we presume all \"commands\" are loaded.\n self._ready_attrs = set(['commands'])\n\n # Default parameters when calling wait_ready() or wait_ready(True).\n self._default_ready_attrs = ['parameters', 'gps_0', 'armed', 'mode', 'attitude']\n\n @self.on_attribute('*')\n def listener(_, name, value):\n self._ready_attrs.add(name)\n\n # Attaches message listeners.\n self._message_listeners = dict()\n\n @handler.forward_message\n def listener(_, msg):\n self.notify_message_listeners(msg.get_type(), msg)\n\n self._location = Locations(self)\n self._vx = None\n self._vy = None\n self._vz = None\n\n @self.on_message('GLOBAL_POSITION_INT')\n def listener(self, name, m):\n (self._vx, self._vy, self._vz) = (m.vx / 100.0, m.vy / 100.0, m.vz / 100.0)\n self.notify_attribute_listeners('velocity', self.velocity)\n\n self._pitch = None\n self._yaw = None\n self._roll = None\n self._pitchspeed = None\n self._yawspeed = None\n self._rollspeed = None\n\n @self.on_message('ATTITUDE')\n def listener(self, name, m):\n self._pitch = m.pitch\n self._yaw = m.yaw\n self._roll = m.roll\n self._pitchspeed = m.pitchspeed\n self._yawspeed = m.yawspeed\n self._rollspeed = m.rollspeed\n self.notify_attribute_listeners('attitude', self.attitude)\n\n self._heading = None\n self._airspeed = None\n self._groundspeed = None\n\n @self.on_message('VFR_HUD')\n def listener(self, name, m):\n self._heading = m.heading\n self.notify_attribute_listeners('heading', self.heading)\n self._airspeed = m.airspeed\n self.notify_attribute_listeners('airspeed', self.airspeed)\n self._groundspeed = m.groundspeed\n self.notify_attribute_listeners('groundspeed', self.groundspeed)\n\n self._rngfnd_distance = None\n self._rngfnd_voltage = None\n\n @self.on_message('RANGEFINDER')\n def listener(self, name, m):\n self._rngfnd_distance = m.distance\n self._rngfnd_voltage = m.voltage\n self.notify_attribute_listeners('rangefinder', self.rangefinder)\n\n self._mount_pitch = None\n self._mount_yaw = None\n self._mount_roll = None\n\n @self.on_message('MOUNT_STATUS')\n def listener(self, name, m):\n self._mount_pitch = m.pointing_a / 100.0\n self._mount_roll = m.pointing_b / 100.0\n self._mount_yaw = m.pointing_c / 100.0\n self.notify_attribute_listeners('mount', self.mount_status)\n\n self._capabilities = None\n self._raw_version =None\n self._autopilot_version_msg_count = 0\n\n @self.on_message('AUTOPILOT_VERSION')\n def listener(vehicle, name, m):\n self._capabilities = m.capabilities\n self._raw_version = m.flight_sw_version\n self._autopilot_version_msg_count += 1\n if self._capabilities != 0 or self._autopilot_version_msg_count > 5:\n # ArduPilot <3.4 fails to send capabilities correctly\n # straight after boot, and even older versions send\n # this back as always-0.\n vehicle.remove_message_listener('HEARTBEAT', self.send_capabilties_request)\n self.notify_attribute_listeners('autopilot_version', self._raw_version)\n\n # gimbal\n self._gimbal = Gimbal(self)\n\n # All keys are strings.\n self._channels = Channels(self, 8)\n\n @self.on_message('RC_CHANNELS_RAW')\n def listener(self, name, m):\n def set_rc(chnum, v):\n '''Private utility for handling rc channel messages'''\n # use port to allow ch nums greater than 8\n self._channels._update_channel(str(m.port * 8 + chnum), v)\n\n set_rc(1, m.chan1_raw)\n set_rc(2, m.chan2_raw)\n set_rc(3, m.chan3_raw)\n set_rc(4, m.chan4_raw)\n set_rc(5, m.chan5_raw)\n set_rc(6, m.chan6_raw)\n set_rc(7, m.chan7_raw)\n set_rc(8, m.chan8_raw)\n self.notify_attribute_listeners('channels', self.channels)\n\n self._voltage = None\n self._current = None\n self._level = None\n\n @self.on_message('SYS_STATUS')\n def listener(self, name, m):\n self._voltage = m.voltage_battery\n self._current = m.current_battery\n self._level = m.battery_remaining\n self.notify_attribute_listeners('battery', self.battery)\n\n self._eph = None\n self._epv = None\n self._satellites_visible = None\n self._fix_type = None # FIXME support multiple GPSs per vehicle - possibly by using componentId\n\n @self.on_message('GPS_RAW_INT')\n def listener(self, name, m):\n self._eph = m.eph\n self._epv = m.epv\n self._satellites_visible = m.satellites_visible\n self._fix_type = m.fix_type\n self.notify_attribute_listeners('gps_0', self.gps_0)\n\n self._current_waypoint = 0\n\n @self.on_message(['WAYPOINT_CURRENT', 'MISSION_CURRENT'])\n def listener(self, name, m):\n self._current_waypoint = m.seq\n\n self._ekf_poshorizabs = False\n self._ekf_constposmode = False\n self._ekf_predposhorizabs = False\n\n @self.on_message('EKF_STATUS_REPORT')\n def listener(self, name, m):\n # boolean: EKF's horizontal position (absolute) estimate is good\n self._ekf_poshorizabs = (m.flags & ardupilotmega.EKF_POS_HORIZ_ABS) > 0\n # boolean: EKF is in constant position mode and does not know it's absolute or relative position\n self._ekf_constposmode = (m.flags & ardupilotmega.EKF_CONST_POS_MODE) > 0\n # boolean: EKF's predicted horizontal position (absolute) estimate is good\n self._ekf_predposhorizabs = (m.flags & ardupilotmega.EKF_PRED_POS_HORIZ_ABS) > 0\n\n self.notify_attribute_listeners('ekf_ok', self.ekf_ok, cache=True)\n\n self._flightmode = 'AUTO'\n self._armed = False\n self._system_status = None\n self._autopilot_type = None#PX4, ArduPilot, etc.\n self._vehicle_type = None#quadcopter, plane, etc.\n\n @self.on_message('HEARTBEAT')\n def listener(self, name, m):\n self._armed = (m.base_mode & mavutil.mavlink.MAV_MODE_FLAG_SAFETY_ARMED) != 0\n self.notify_attribute_listeners('armed', self.armed, cache=True)\n self._autopilot_type = m.autopilot\n self._vehicle_type = m.type\n if self._is_mode_available(m.custom_mode) == False:\n raise APIException(\"mode %s not available on mavlink definition\" % m.custom_mode)\n self._flightmode = self._mode_mapping_bynumber[m.custom_mode]\n self.notify_attribute_listeners('mode', self.mode, cache=True)\n self._system_status = m.system_status\n self.notify_attribute_listeners('system_status', self.system_status, cache=True)\n\n # Waypoints.\n\n self._home_location = None\n self._wploader = mavwp.MAVWPLoader()\n self._wp_loaded = True\n self._wp_uploaded = None\n self._wpts_dirty = False\n self._commands = CommandSequence(self)\n\n @self.on_message(['WAYPOINT_COUNT', 'MISSION_COUNT'])\n def listener(self, name, msg):\n if not self._wp_loaded:\n self._wploader.clear()\n self._wploader.expected_count = msg.count\n self._master.waypoint_request_send(0)\n\n @self.on_message(['WAYPOINT', 'MISSION_ITEM'])\n def listener(self, name, msg):\n if not self._wp_loaded:\n if msg.seq == 0:\n if not (msg.x == 0 and msg.y == 0 and msg.z == 0):\n self._home_location = LocationGlobal(msg.x, msg.y, msg.z)\n\n if msg.seq > self._wploader.count():\n # Unexpected waypoint\n pass\n elif msg.seq < self._wploader.count():\n # Waypoint duplicate\n pass\n else:\n self._wploader.add(msg)\n\n if msg.seq + 1 < self._wploader.expected_count:\n self._master.waypoint_request_send(msg.seq + 1)\n else:\n self._wp_loaded = True\n self.notify_attribute_listeners('commands', self.commands)\n\n # Waypoint send to master\n @self.on_message(['WAYPOINT_REQUEST', 'MISSION_REQUEST'])\n def listener(self, name, msg):\n if self._wp_uploaded != None:\n wp = self._wploader.wp(msg.seq)\n handler.fix_targets(wp)\n self._master.mav.send(wp)\n self._wp_uploaded[msg.seq] = True\n\n # TODO: Waypoint loop listeners\n\n # Parameters.\n\n start_duration = 0.2\n repeat_duration = 1\n\n self._params_count = -1\n self._params_set = []\n self._params_loaded = False\n self._params_start = False\n self._params_map = {}\n self._params_last = monotonic.monotonic() # Last new param.\n self._params_duration = start_duration\n self._parameters = Parameters(self)\n\n @handler.forward_loop\n def listener(_):\n # Check the time duration for last \"new\" params exceeds watchdog.\n if not self._params_start:\n return\n\n if None not in self._params_set and not self._params_loaded:\n self._params_loaded = True\n self.notify_attribute_listeners('parameters', self.parameters)\n\n if not self._params_loaded and monotonic.monotonic() - self._params_last > self._params_duration:\n c = 0\n for i, v in enumerate(self._params_set):\n if v == None:\n self._master.mav.param_request_read_send(0, 0, '', i)\n c += 1\n if c > 50:\n break\n self._params_duration = repeat_duration\n self._params_last = monotonic.monotonic()\n\n @self.on_message(['PARAM_VALUE'])\n def listener(self, name, msg):\n # If we discover a new param count, assume we\n # are receiving a new param set.\n if self._params_count != msg.param_count:\n self._params_loaded = False\n self._params_start = True\n self._params_count = msg.param_count\n self._params_set = [None] * msg.param_count\n\n # Attempt to set the params. We throw an error\n # if the index is out of range of the count or\n # we lack a param_id.\n try:\n if msg.param_index < msg.param_count and msg:\n if self._params_set[msg.param_index] == None:\n self._params_last = monotonic.monotonic()\n self._params_duration = start_duration\n self._params_set[msg.param_index] = msg\n self._params_map[msg.param_id] = msg.param_value\n self._parameters.notify_attribute_listeners(msg.param_id, msg.param_value,\n cache=True)\n except:\n import traceback\n traceback.print_exc()\n\n # Heartbeats.\n\n self._heartbeat_started = False\n self._heartbeat_lastsent = 0\n self._heartbeat_lastreceived = 0\n self._heartbeat_timeout = False\n\n self._heartbeat_warning = 5\n self._heartbeat_error = 30\n self._heartbeat_system = None\n\n @handler.forward_loop\n def listener(_):\n # Send 1 heartbeat per second\n if monotonic.monotonic() - self._heartbeat_lastsent > 1:\n self._master.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS,\n mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)\n self._heartbeat_lastsent = monotonic.monotonic()\n\n # Timeouts.\n if self._heartbeat_started:\n if self._heartbeat_error and self._heartbeat_error > 0 and monotonic.monotonic(\n ) - self._heartbeat_lastreceived > self._heartbeat_error:\n raise APIException('No heartbeat in %s seconds, aborting.' %\n self._heartbeat_error)\n elif monotonic.monotonic() - self._heartbeat_lastreceived > self._heartbeat_warning:\n if self._heartbeat_timeout == False:\n errprinter('>>> Link timeout, no heartbeat in last %s seconds' %\n self._heartbeat_warning)\n self._heartbeat_timeout = True\n\n @self.on_message(['HEARTBEAT'])\n def listener(self, name, msg):\n self._heartbeat_system = msg.get_srcSystem()\n self._heartbeat_lastreceived = monotonic.monotonic()\n if self._heartbeat_timeout:\n errprinter('>>> ...link restored.')\n self._heartbeat_timeout = False\n\n self._last_heartbeat = None\n\n @handler.forward_loop\n def listener(_):\n if self._heartbeat_lastreceived:\n self._last_heartbeat = monotonic.monotonic() - self._heartbeat_lastreceived\n self.notify_attribute_listeners('last_heartbeat', self.last_heartbeat)", "metadata": "root.Vehicle.__init__", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 999 }, { "content": " @property\n def battery(self):\n \"\"\"\n Current system batter status (:py:class:`Battery`).\n \"\"\"\n if self._voltage == None or self._current == None or self._level == None:\n return None\n return Battery(self._voltage, self._current, self._level)", "metadata": "root.Vehicle.battery", "header": "['class', 'Vehicle', '(', 'HasObservers', ')', ':', '___EOS___']", "index": 1607 } ]
[ { "span": "raw_version == None)", "start_line": 289, "start_column": 11, "end_line": 289, "end_column": 30 }, { "span": "v == None:", "start_line": 1262, "start_column": 23, "end_line": 1262, "end_column": 32 }, { "span": "self._params_set[msg.param_index] == None:", "start_line": 1285, "start_column": 23, "end_line": 1285, "end_column": 64 }, { "span": "self._voltage == None ", "start_line": 1612, "start_column": 11, "end_line": 1612, "end_column": 32 }, { "span": "self._current == None ", "start_line": 1612, "start_column": 36, "end_line": 1612, "end_column": 57 }, { "span": "self._level == None:", "start_line": 1612, "start_column": 61, "end_line": 1612, "end_column": 80 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Version_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "raw", "\\u", "version_", ",_", "autop", "ilo", "t", "\\u", "type_", ",_", "vehic", "le", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "autop", "ilo", "t", "\\u", "type_", "=_", "autop", "ilo", "t", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "vehic", "le", "\\u", "type_", "=_", "vehic", "le", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raw", "\\u", "version_", "=_", "raw", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "raw", "\\u", "version_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "major_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "minor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "release_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "major_", "=_", "raw", "\\u", "version_", ">>_", "24_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "minor_", "=_", "raw", "\\u", "version_", ">>_", "16_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "patch_", "=_", "raw", "\\u", "version_", ">>_", "8_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "release_", "=_", "raw", "\\u", "version_", "&_", "0xFF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Vehicle", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "handler_", "=_", "handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "=_", "handler_", "._", "master_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cache", " ", "all", " ", "update", "d", " ", "attribute", "s", " ", "for", " ", "wait", "\\u", "read", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", " ", "default", ",", " ", "we", " ", "presu", "me", " ", "all", " ", "\"", "command", "s", "\"", " ", "are", " ", "load", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "read", "y", "\\u", "attrs_", "=_", "set_", "(_", "[_", "'", "command", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "parameter", "s", " ", "whe", "n", " ", "calling", " ", "wait", "\\u", "read", "y", "()", " ", "or", " ", "wait", "\\u", "read", "y", "(", "Tru", "e", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "default", "\\u", "read", "y", "\\u", "attrs_", "=_", "[_", "'", "parameter", "s", "'_", ",_", "'", "gps", "\\u", "0", "'_", ",_", "'", "arme", "d", "'_", ",_", "'", "mode", "'_", ",_", "'", "atti", "tude", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "attribute_", "(_", "'*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "read", "y", "\\u", "attrs_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attache", "s", " ", "message", " ", "listeners", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "message", "\\u", "listeners_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "notif", "y", "\\u", "message", "\\u", "listeners_", "(_", "msg_", "._", "get", "\\u", "type_", "(_", ")_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "location_", "=_", "Locations_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vx_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vz", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "GLOB", "AL", "\\u", "POSITION", "\\u", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "self_", "._", "\\u", "vx_", ",_", "self_", "._", "\\u", "vy_", ",_", "self_", "._", "\\u", "vz", "_", ")_", "=_", "(_", "m_", "._", "vx_", "/_", "100.0_", ",_", "m_", "._", "vy_", "/_", "100.0_", ",_", "m_", "._", "vz", "_", "/_", "100.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "velo", "city", "'_", ",_", "self_", "._", "velocity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "pitch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pitch", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "ATT", "ITU", "DE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pitch_", "=_", "m_", "._", "pitch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw_", "=_", "m_", "._", "yaw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll_", "=_", "m_", "._", "roll_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pitch", "speed_", "=_", "m_", "._", "pitch", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "yaw", "speed_", "=_", "m_", "._", "yaw", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "roll", "speed_", "=_", "m_", "._", "roll", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "atti", "tude", "'_", ",_", "self_", "._", "atti", "tude", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "heading_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "airs", "peed", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ground", "speed_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "VF", "R", "\\u", "HU", "D", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "heading_", "=_", "m_", "._", "heading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "heading", "'_", ",_", "self_", "._", "heading_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "airs", "peed", "_", "=_", "m_", "._", "airs", "peed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "airs", "peed", "'_", ",_", "self_", "._", "airs", "peed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ground", "speed_", "=_", "m_", "._", "ground", "speed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "ground", "speed", "'_", ",_", "self_", "._", "ground", "speed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "rng", "fn", "d\\u", "distance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rng", "fn", "d\\u", "voltage_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "RANGE", "FIND", "ER", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "rng", "fn", "d\\u", "distance_", "=_", "m_", "._", "distance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rng", "fn", "d\\u", "voltage_", "=_", "m_", "._", "voltage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "range", "finde", "r", "'_", ",_", "self_", "._", "range", "finder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "pitch_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "yaw_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "roll_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "MOUNT", "\\u", "STATUS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mount", "\\u", "pitch_", "=_", "m_", "._", "pointi", "ng", "\\u", "a_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "roll_", "=_", "m_", "._", "pointi", "ng", "\\u", "b_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mount", "\\u", "yaw_", "=_", "m_", "._", "pointi", "ng", "\\u", "c_", "/_", "100.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "mount", "'_", ",_", "self_", "._", "mount", "\\u", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "capabilities_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "raw", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "version", "\\u", "msg", "\\u", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "AUTO", "PI", "LOT", "\\u", "VERSI", "ON", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "vehicle_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "capabilities_", "=_", "m_", "._", "capabilities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "raw", "\\u", "version_", "=_", "m_", "._", "flight", "\\u", "sw", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "version", "\\u", "msg", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "capabilities_", "!=_", "0_", "or_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "version", "\\u", "msg", "\\u", "count_", ">_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ar", "du", "Pilo", "t", " ", "<", "3.4", " ", "fail", "s", " ", "to", " ", "send", " ", "capab", "ilities", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "straight", " ", "after", " ", "boot", ",", " ", "and", " ", "even", " ", "older", " ", "version", "s", " ", "send_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "back", " ", "as", " ", "alw", "ay", "s", "-0", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vehicle_", "._", "remove", "\\u", "message", "\\u", "listener_", "(_", "'", "HEA", "RT", "BEA", "T", "'_", ",_", "self_", "._", "send", "\\u", "capab", "ilt", "ies", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "autop", "ilo", "t", "\\u", "version", "'_", ",_", "self_", "._", "\\u", "raw", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gi", "mba", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "gi", "mba", "l_", "=_", "Gi", "mba", "l_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "keys", " ", "are", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "channels_", "=_", "Channels_", "(_", "self_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "RC", "\\u", "CHANNELS", "\\u", "RA", "W", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set\\u", "rc_", "(_", "chn", "um_", ",_", "v_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Priva", "te", " ", "utility", " ", "for", " ", "handling", " ", "rc", " ", "channel", " ", "message", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "use", " ", "port", " ", "to", " ", "allow", " ", "ch", " ", "nums", " ", "great", "er", " ", "than", " ", "8_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "channels_", "._", "\\u", "update", "\\u", "channel_", "(_", "str_", "(_", "m_", "._", "port_", "*_", "8_", "+_", "chn", "um_", ")_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "set\\u", "rc_", "(_", "1_", ",_", "m_", "._", "chan", "1", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "2_", ",_", "m_", "._", "chan", "2", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "3_", ",_", "m_", "._", "chan", "3", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "4_", ",_", "m_", "._", "chan", "4", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "5_", ",_", "m_", "._", "chan", "5", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "6_", ",_", "m_", "._", "chan", "6", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "7_", ",_", "m_", "._", "chan", "7", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "set\\u", "rc_", "(_", "8_", ",_", "m_", "._", "chan", "8", "\\u", "raw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "channel", "s", "'_", ",_", "self_", "._", "channels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "voltage_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "level_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "SYS", "\\u", "STATUS", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "voltage_", "=_", "m_", "._", "voltage", "\\u", "battery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current_", "=_", "m_", "._", "current", "\\u", "battery", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "level_", "=_", "m_", "._", "battery", "\\u", "remaining_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "battery", "'_", ",_", "self_", "._", "battery", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "eph", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ep", "v_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "satellite", "s", "\\u", "visible_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fix", "\\u", "type_", "=_", "None_", "#", " ", "FIX", "ME", " ", "support", " ", "multiple", " ", "GPS", "s", " ", "per", " ", "vehic", "le", " ", "-", " ", "possib", "ly", " ", "by", " ", "usi", "ng", " ", "component", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "GPS", "\\u", "RA", "W", "\\u", "INT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "eph", "_", "=_", "m_", "._", "eph", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ep", "v_", "=_", "m_", "._", "ep", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "satellite", "s", "\\u", "visible_", "=_", "m_", "._", "satellite", "s", "\\u", "visible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "fix", "\\u", "type_", "=_", "m_", "._", "fix", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "gps", "\\u", "0", "'_", ",_", "self_", "._", "gps", "\\u", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "current", "\\u", "waypoint", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "\\u", "CURREN", "T", "'_", ",_", "'", "MISSI", "ON", "\\u", "CURREN", "T", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "current", "\\u", "waypoint", "_", "=_", "m_", "._", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "pos", "horiz", "abs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "const", "pos", "mode_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "pred", "pos", "horiz", "abs_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "EK", "F", "\\u", "STATUS", "\\u", "REPORT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "boolean", ":", " ", "EK", "F", "'", "s", " ", "horizon", "tal", " ", "position", " ", "(", "abs", "olute", ")", " ", "estimate", " ", "is", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ek", "f", "\\u", "pos", "horiz", "abs_", "=_", "(_", "m_", "._", "flags_", "&_", "ard", "upi", "lot", "mega", "_", "._", "EK", "F", "\\u", "POS", "\\u", "HORI", "Z", "\\u", "ABS", "_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "boolean", ":", " ", "EK", "F", " ", "is", " ", "in", " ", "constant", " ", "position", " ", "mode", " ", "and", " ", "doe", "s", " ", "not", " ", "know", " ", "it", "'", "s", " ", "abs", "olute", " ", "or", " ", "relative", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "const", "pos", "mode_", "=_", "(_", "m_", "._", "flags_", "&_", "ard", "upi", "lot", "mega", "_", "._", "EK", "F", "\\u", "CONST", "\\u", "POS", "\\u", "MODE_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "boolean", ":", " ", "EK", "F", "'", "s", " ", "predi", "cte", "d", " ", "horizon", "tal", " ", "position", " ", "(", "abs", "olute", ")", " ", "estimate", " ", "is", " ", "good_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "ek", "f", "\\u", "pred", "pos", "horiz", "abs_", "=_", "(_", "m_", "._", "flags_", "&_", "ard", "upi", "lot", "mega", "_", "._", "EK", "F", "\\u", "PRE", "D", "\\u", "POS", "\\u", "HORI", "Z", "\\u", "ABS", "_", ")_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "ek", "f", "\\u", "ok", "'_", ",_", "self_", "._", "ek", "f", "\\u", "ok_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "flight", "mode_", "=_", "'", "AUTO", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "arme", "d_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system", "\\u", "status_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "type_", "=_", "None_", "#", "PX", "4", ",", " ", "Ar", "du", "Pilo", "t", ",", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehic", "le", "\\u", "type_", "=_", "None_", "#", "quad", "cop", "ter", ",", " ", "plane", ",", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "'", "HEA", "RT", "BEA", "T", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "m_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "arme", "d_", "=_", "(_", "m_", "._", "base", "\\u", "mode_", "&_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "MODE", "\\u", "FLAG", "\\u", "SAFE", "TY", "\\u", "ARM", "ED_", ")_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "arme", "d", "'_", ",_", "self_", "._", "arme", "d_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "autop", "ilo", "t", "\\u", "type_", "=_", "m_", "._", "autop", "ilo", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "vehic", "le", "\\u", "type_", "=_", "m_", "._", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "\\u", "mode", "\\u", "available_", "(_", "m_", "._", "custom", "\\u", "mode_", ")_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "API", "Exception_", "(_", "\"", "mode", " ", "%", "s", " ", "not", " ", "avail", "able", " ", "on", " ", "mavlink", " ", "definit", "ion", "\"_", "%_", "m_", "._", "custom", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "flight", "mode_", "=_", "self_", "._", "\\u", "mode", "\\u", "mapping", "\\u", "by", "number_", "[_", "m_", "._", "custom", "\\u", "mode_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "mode", "'_", ",_", "self_", "._", "mode_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "system", "\\u", "status_", "=_", "m_", "._", "system", "\\u", "status_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "system", "\\u", "status", "'_", ",_", "self_", "._", "system", "\\u", "status_", ",_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Way", "points", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "home", "\\u", "location_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "loader_", "=_", "mav", "wp_", "._", "MAV", "WP", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "\\u", "loaded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "\\u", "uploade", "d_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wpt", "s", "\\u", "dirty_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "commands_", "=_", "Command", "Sequence_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "\\u", "COUNT", "'_", ",_", "'", "MISSI", "ON", "\\u", "COUNT", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "wp", "\\u", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "wp", "loader_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "loader_", "._", "expected", "\\u", "count_", "=_", "msg_", "._", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "waypoint", "\\u", "request", "\\u", "send_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "'_", ",_", "'", "MISSI", "ON", "\\u", "ITEM", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "wp", "\\u", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "._", "seq_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "(_", "msg_", "._", "x_", "==_", "0_", "and_", "msg_", "._", "y_", "==_", "0_", "and_", "msg_", "._", "z_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "home", "\\u", "location_", "=_", "Locat", "ion", "Global_", "(_", "msg_", "._", "x_", ",_", "msg_", "._", "y_", ",_", "msg_", "._", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "msg_", "._", "seq_", ">_", "self_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Une", "xpe", "cte", "d", " ", "waypoint", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "msg_", "._", "seq_", "<_", "self_", "._", "\\u", "wp", "loader_", "._", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Way", "point", " ", "duplicate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "wp", "loader_", "._", "add_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "msg_", "._", "seq_", "+_", "1_", "<_", "self_", "._", "\\u", "wp", "loader_", "._", "expected", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "master_", "._", "waypoint", "\\u", "request", "\\u", "send_", "(_", "msg_", "._", "seq_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "wp", "\\u", "loaded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "command", "s", "'_", ",_", "self_", "._", "commands_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Way", "point", " ", "send", " ", "to", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "WAY", "POINT", "\\u", "REQUEST", "'_", ",_", "'", "MISSI", "ON", "\\u", "REQUEST", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "wp", "\\u", "uploade", "d_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wp_", "=_", "self_", "._", "\\u", "wp", "loader_", "._", "wp_", "(_", "msg_", "._", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "fix", "\\u", "targets_", "(_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "master_", "._", "mav_", "._", "send_", "(_", "wp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "wp", "\\u", "uploade", "d_", "[_", "msg_", "._", "seq_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Way", "point", " ", "loop", " ", "listeners_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Parameter", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "duration_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repeat", "\\u", "duration_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "count_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "set_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "loaded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "start_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "last_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "#", " ", "Las", "t", " ", "new", " ", "param", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "duration_", "=_", "start", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parameters_", "=_", "Parameters_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "time", " ", "duration", " ", "for", " ", "last", " ", "\"", "new", "\"", " ", "params", " ", "exceed", "s", " ", "watchdog", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "params", "\\u", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "None_", "not_", "in_", "self_", "._", "\\u", "params", "\\u", "set_", "and_", "not_", "self_", "._", "\\u", "params", "\\u", "loaded_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "params", "\\u", "loaded_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "parameter", "s", "'_", ",_", "self_", "._", "parameters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "params", "\\u", "loaded_", "and_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "params", "\\u", "last_", ">_", "self_", "._", "\\u", "params", "\\u", "duration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "params", "\\u", "set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "v_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "master_", "._", "mav_", "._", "param", "\\u", "request", "\\u", "read", "\\u", "send_", "(_", "0_", ",_", "0_", ",_", "''_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "c_", ">_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "duration_", "=_", "repeat", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "last_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "PARAM", "\\u", "VALU", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "discove", "r", " ", "a", " ", "new", " ", "param", " ", "count", ",", " ", "assume", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "receiv", "ing", " ", "a", " ", "new", " ", "param", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "params", "\\u", "count_", "!=_", "msg_", "._", "param", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "params", "\\u", "loaded_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "start_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "count_", "=_", "msg_", "._", "param", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "set_", "=_", "[_", "None_", "]_", "*_", "msg_", "._", "param", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Atte", "mpt", " ", "to", " ", "set", " ", "the", " ", "params", ".", " ", "We", " ", "throw", " ", "an", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "index", " ", "is", " ", "out", " ", "of", " ", "range", " ", "of", " ", "the", " ", "count", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "lack", " ", "a", " ", "param", "\\u", "id", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "msg_", "._", "param", "\\u", "index_", "<_", "msg_", "._", "param", "\\u", "count_", "and_", "msg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "params", "\\u", "set_", "[_", "msg_", "._", "param", "\\u", "index_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "params", "\\u", "last_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "duration_", "=_", "start", "\\u", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "set_", "[_", "msg_", "._", "param", "\\u", "index_", "]_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "params", "\\u", "map_", "[_", "msg_", "._", "param", "\\u", "id_", "]_", "=_", "msg_", "._", "param", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parameters_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "msg_", "._", "param", "\\u", "id_", ",_", "msg_", "._", "param", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traceback_", "._", "print", "\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Heart", "beats", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "started_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lasts", "ent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "warning_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "system_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sen", "d", " ", "1", " ", "heart", "beat", " ", "per", " ", "second_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lasts", "ent_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "master_", "._", "mav_", "._", "heart", "beat", "\\u", "send_", "(_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "TYPE", "\\u", "GC", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mav", "util_", "._", "mavlink", "_", "._", "MAV", "\\u", "AUTO", "PI", "LOT", "\\u", "INVALID", "_", ",_", "0_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lasts", "ent_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Time", "outs", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "started_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", "and_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", ">_", "0_", "and_", "monotonic", "_", "._", "monotonic", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", ">_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "API", "Exception_", "(_", "'", "No", " ", "heart", "beat", " ", "in", " ", "%", "s", " ", "second", "s", ",", " ", "abort", "ing", ".'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", ">_", "self_", "._", "\\u", "heart", "beat", "\\u", "warning_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "err", "printer_", "(_", "'>>", ">", " ", "Link", " ", "timeo", "ut", ",", " ", "no", " ", "heart", "beat", " ", "in", " ", "last", " ", "%", "s", " ", "second", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "on", "\\u", "message_", "(_", "[_", "'", "HEA", "RT", "BEA", "T", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "self_", ",_", "name_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "heart", "beat", "\\u", "system_", "=_", "msg_", "._", "get", "\\u", "src", "System_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "err", "printer_", "(_", "'>>", ">", " ", "...", "link", " ", "restore", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "heart", "beat", "\\u", "timeout_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "last", "\\u", "heartbeat_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "handler_", "._", "forward", "\\u", "loop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "listener_", "(_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "last", "\\u", "heartbeat_", "=_", "monotonic", "_", "._", "monotonic", "_", "(_", ")_", "-_", "self_", "._", "\\u", "heart", "beat", "\\u", "lastr", "ece", "ive", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "notif", "y", "\\u", "attribute", "\\u", "listeners_", "(_", "'", "last", "\\u", "heart", "beat", "'_", ",_", "self_", "._", "last", "\\u", "heartbeat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Vehicle", "_", "(_", "Has", "Observer", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "battery", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", " ", "system", " ", "batt", "er", " ", "status", " ", "(:", "py", ":", "class", ":`", "Batt", "ery", "`)", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "voltage_", "==_", "None_", "or_", "self_", "._", "\\u", "current_", "==_", "None_", "or_", "self_", "._", "\\u", "level_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Batt", "ery", "_", "(_", "self_", "._", "\\u", "voltage_", ",_", "self_", "._", "\\u", "current_", ",_", "self_", "._", "\\u", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
diefenbach/django-lfs/lfs/manage/property/views.py
[ { "content": "@permission_required(\"core.manage_shop\")\n@require_POST\ndef save_select_field(request, property_id):\n \"\"\"Saves the data of a property select field.\n \"\"\"\n property = get_object_or_404(Property, pk=property_id)\n\n form = SelectFieldForm(instance=property, data=request.POST)\n property = form.save()\n\n # invalidate global properties version number (all product property caches will be invalidated)\n invalidate_cache_group_id('global-properties-version')\n\n return HttpResponseRedirect(request.META.get(\"HTTP_REFERER\"))", "metadata": "root.save_select_field", "header": "['module', '___EOS___']", "index": 264 }, { "content": "@permission_required(\"core.manage_shop\")\n@require_POST\ndef save_number_field_validators(request, property_id):\n \"\"\"Saves the validators for the property with passed property_id.\n \"\"\"\n property = get_object_or_404(Property, pk=property_id)\n\n form = NumberFieldForm(instance=property, data=request.POST)\n property = form.save()\n\n # invalidate global properties version number (all product property caches will be invalidated)\n invalidate_cache_group_id('global-properties-version')\n\n response = HttpResponseRedirect(request.META.get(\"HTTP_REFERER\"))\n return lfs.core.utils.set_message_to(response, _(u\"Validators have been saved.\"))", "metadata": "root.save_number_field_validators", "header": "['module', '___EOS___']", "index": 292 }, { "content": "@permission_required(\"core.manage_shop\")\n@require_POST\ndef save_step_range(request, property_id):\n \"\"\"Save the steps of the property with given id.\n \"\"\"\n property = get_object_or_404(Property, pk=property_id)\n\n form = StepRangeForm(instance=property, data=request.POST)\n property = form.save()\n\n # invalidate global properties version number (all product property caches will be invalidated)\n invalidate_cache_group_id('global-properties-version')\n\n result = json.dumps({\n \"message\": _(u\"Step range has been saved.\"),\n }, cls=LazyEncoder)\n\n return HttpResponse(result, content_type='application/json')", "metadata": "root.save_step_range", "header": "['module', '___EOS___']", "index": 325 }, { "content": "@permission_required(\"core.manage_shop\")\n@require_POST\ndef save_step_type(request, property_id):\n \"\"\"Save the step type of the property with given id.\n \"\"\"\n property = get_object_or_404(Property, pk=property_id)\n\n form = StepTypeForm(instance=property, data=request.POST)\n property = form.save()\n\n # invalidate global properties version number (all product property caches will be invalidated)\n invalidate_cache_group_id('global-properties-version')\n\n html = [[\"#steps\", steps_inline(request, property_id)]]\n result = json.dumps({\n \"html\": html,\n \"message\": _(u\"Step type has been saved.\"),\n }, cls=LazyEncoder)\n return HttpResponse(result, content_type='application/json')", "metadata": "root.save_step_type", "header": "['module', '___EOS___']", "index": 345 }, { "content": "@permission_required(\"core.manage_shop\")\n@require_POST\ndef add_option(request, property_id):\n \"\"\"Adds option to property with passed property id.\n \"\"\"\n property = get_object_or_404(Property, pk=property_id)\n\n if request.POST.get(\"action\") == \"add\":\n name = request.POST.get(\"name\", \"\")\n price = request.POST.get(\"price\", \"\")\n try:\n price = float(price)\n except ValueError:\n price = 0.0\n\n if name != \"\":\n option = PropertyOption.objects.create(name=name, price=price, property_id=property_id)\n message = _(u\"Option has been added.\")\n else:\n message = _(u\"Option could not be added.\")\n else:\n\n for option_id in request.POST.getlist(\"option\"):\n\n try:\n option = PropertyOption.objects.get(pk=option_id)\n except PropertyOption.DoesNotExist:\n pass\n else:\n try:\n price = float(request.POST.get(\"price-%s\" % option_id, \"\"))\n except ValueError:\n price = 0.0\n\n try:\n position = int(request.POST.get(\"position-%s\" % option_id, 99))\n except ValueError:\n position = 99\n\n option.position = position\n option.name = request.POST.get(\"name-%s\" % option_id, \"\")\n option.price = price\n option.save()\n message = _(u\"Options have been updated.\")\n\n _update_positions(property)\n # invalidate global properties version number (all product property caches will be invalidated)\n invalidate_cache_group_id('global-properties-version')\n\n html = [[\"#options\", options_inline(request, property_id)]]\n result = json.dumps({\n \"html\": html,\n \"message\": message\n }, cls=LazyEncoder)\n return HttpResponse(result, content_type='application/json')", "metadata": "root.add_option", "header": "['module', '___EOS___']", "index": 474 } ]
[ { "span": "property ", "start_line": 272, "start_column": 4, "end_line": 272, "end_column": 12 }, { "span": "property ", "start_line": 300, "start_column": 4, "end_line": 300, "end_column": 12 }, { "span": "property ", "start_line": 333, "start_column": 4, "end_line": 333, "end_column": 12 }, { "span": "property ", "start_line": 353, "start_column": 4, "end_line": 353, "end_column": 12 }, { "span": "option ", "start_line": 490, "start_column": 12, "end_line": 490, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "\\u", "select", "\\u", "field_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", "s", " ", "the", " ", "data", " ", "of", " ", "a", " ", "property", " ", "select", " ", "field", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Property_", ",_", "pk_", "=_", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Select", "Field", "Form_", "(_", "instance_", "=_", "property_", ",_", "data_", "=_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invalidate", " ", "global", " ", "proper", "ties", " ", "version", " ", "number", " ", "(", "all", " ", "product", " ", "property", " ", "cache", "s", " ", "will", " ", "be", " ", "invalidate", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "invalidate", "\\u", "cache", "\\u", "group", "\\u", "id_", "(_", "'", "global", "-", "proper", "ties", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Respons", "e", "Redirect_", "(_", "request_", "._", "META_", "._", "get_", "(_", "\"", "HTTP", "\\u", "REFE", "RER", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "\\u", "number", "\\u", "field", "\\u", "validators_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", "s", " ", "the", " ", "validator", "s", " ", "for", " ", "the", " ", "property", " ", "with", " ", "pass", "ed", " ", "property", "\\u", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Property_", ",_", "pk_", "=_", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Number", "Field", "Form_", "(_", "instance_", "=_", "property_", ",_", "data_", "=_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invalidate", " ", "global", " ", "proper", "ties", " ", "version", " ", "number", " ", "(", "all", " ", "product", " ", "property", " ", "cache", "s", " ", "will", " ", "be", " ", "invalidate", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "invalidate", "\\u", "cache", "\\u", "group", "\\u", "id_", "(_", "'", "global", "-", "proper", "ties", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "Http", "Respons", "e", "Redirect_", "(_", "request_", "._", "META_", "._", "get_", "(_", "\"", "HTTP", "\\u", "REFE", "RER", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lf", "s_", "._", "core_", "._", "utils_", "._", "set\\u", "message", "\\u", "to_", "(_", "response_", ",_", "\\u_", "(_", "u", "\"", "Validat", "ors", " ", "have", " ", "bee", "n", " ", "saved", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "\\u", "step", "\\u", "range_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", " ", "the", " ", "step", "s", " ", "of", " ", "the", " ", "property", " ", "with", " ", "give", "n", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Property_", ",_", "pk_", "=_", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Step", "Range", "Form_", "(_", "instance_", "=_", "property_", ",_", "data_", "=_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invalidate", " ", "global", " ", "proper", "ties", " ", "version", " ", "number", " ", "(", "all", " ", "product", " ", "property", " ", "cache", "s", " ", "will", " ", "be", " ", "invalidate", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "invalidate", "\\u", "cache", "\\u", "group", "\\u", "id_", "(_", "'", "global", "-", "proper", "ties", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "\"_", ":_", "\\u_", "(_", "u", "\"", "Step", " ", "range", " ", "has", " ", "bee", "n", " ", "saved", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "cls_", "=_", "La", "zy", "Encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Http", "Response_", "(_", "result_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "\\u", "step", "\\u", "type_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Save", " ", "the", " ", "step", " ", "type", " ", "of", " ", "the", " ", "property", " ", "with", " ", "give", "n", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Property_", ",_", "pk_", "=_", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "=_", "Step", "Type", "Form_", "(_", "instance_", "=_", "property_", ",_", "data_", "=_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "invalidate", " ", "global", " ", "proper", "ties", " ", "version", " ", "number", " ", "(", "all", " ", "product", " ", "property", " ", "cache", "s", " ", "will", " ", "be", " ", "invalidate", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "invalidate", "\\u", "cache", "\\u", "group", "\\u", "id_", "(_", "'", "global", "-", "proper", "ties", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "[_", "[_", "\"#", "step", "s", "\"_", ",_", "step", "s", "\\u", "inline_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "html", "\"_", ":_", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "\"_", ":_", "\\u_", "(_", "u", "\"", "Step", " ", "type", " ", "has", " ", "bee", "n", " ", "saved", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "cls_", "=_", "La", "zy", "Encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "result_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "permissi", "on", "\\u", "required_", "(_", "\"", "core", ".", "manage", "\\u", "shop", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "option_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "s", " ", "option", " ", "to", " ", "property", " ", "with", " ", "pass", "ed", " ", "property", " ", "id", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Property_", ",_", "pk_", "=_", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "action", "\"_", ")_", "==_", "\"", "add", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "name", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "price_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "price", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "price_", "=_", "float_", "(_", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "price_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "name_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "Proper", "ty", "Option_", "._", "objects_", "._", "create_", "(_", "name_", "=_", "name_", ",_", "price_", "=_", "price_", ",_", "property", "\\u", "id_", "=_", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "\\u_", "(_", "u", "\"", "Optio", "n", " ", "has", " ", "bee", "n", " ", "adde", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\\u_", "(_", "u", "\"", "Optio", "n", " ", "coul", "d", " ", "not", " ", "be", " ", "adde", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "option", "\\u", "id_", "in_", "request_", "._", "POST_", "._", "getlist_", "(_", "\"", "option", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "Proper", "ty", "Option_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "option", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Proper", "ty", "Option_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "price_", "=_", "float_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "price", "-%", "s", "\"_", "%_", "option", "\\u", "id_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "price_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "position_", "=_", "int_", "(_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "position", "-%", "s", "\"_", "%_", "option", "\\u", "id_", ",_", "99_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "position_", "=_", "99_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "option_", "._", "position_", "=_", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "._", "name_", "=_", "request_", "._", "POST_", "._", "get_", "(_", "\"", "name", "-%", "s", "\"_", "%_", "option", "\\u", "id_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "._", "price_", "=_", "price_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "\\u_", "(_", "u", "\"", "Optio", "ns", " ", "have", " ", "bee", "n", " ", "update", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "update", "\\u", "positions_", "(_", "property_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "invalidate", " ", "global", " ", "proper", "ties", " ", "version", " ", "number", " ", "(", "all", " ", "product", " ", "property", " ", "cache", "s", " ", "will", " ", "be", " ", "invalidate", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "invalidate", "\\u", "cache", "\\u", "group", "\\u", "id_", "(_", "'", "global", "-", "proper", "ties", "-", "version", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "[_", "[_", "\"#", "options", "\"_", ",_", "options", "\\u", "inline_", "(_", "request_", ",_", "property", "\\u", "id_", ")_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "html", "\"_", ":_", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "\"_", ":_", "message_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "cls_", "=_", "La", "zy", "Encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "result_", ",_", "content", "\\u", "type_", "=_", "'", "applica", "tion", "/", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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.py
[ { "content": "import six\nimport platform\nimport multiprocessing\nfrom multiprocessing.queues import Queue as BaseQueue\n\n\n# The SharedCounter and Queue classes come from:\n# https://github.com/vterron/lemon/commit/9ca6b4b\n\n\n\n\n\nif platform.system() == 'Darwin':\n if hasattr(multiprocessing, 'get_context'): # for py34\n else:\nelse:\n from multiprocessing import Queue # flake8: noqa\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SharedCounter(object):\n \"\"\" A synchronized shared counter.\n The locking done by multiprocessing.Value ensures that only a single\n process or thread may read or write the in-memory ctypes object. However,\n in order to do n += 1, Python performs a read followed by a write, so a\n second process may read the old value before the new one is written by the\n first process. The solution is to use a multiprocessing.Lock to guarantee\n the atomicity of the modifications to Value.\n This class comes almost entirely from Eli Bendersky's blog:\n http://eli.thegreenplace.net/2012/01/04/shared-counter-with-pythons-multiprocessing/\n \"\"\"\n\n\n", "metadata": "root.SharedCounter", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self, n=0):\n self.count = multiprocessing.Value('i', n)", "metadata": "root.SharedCounter.__init__", "header": "['class', 'SharedCounter', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def increment(self, n=1):\n \"\"\" Increment the counter by n (default = 1) \"\"\"\n with self.count.get_lock():\n self.count.value += n", "metadata": "root.SharedCounter.increment", "header": "['class', 'SharedCounter', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": " @property\n def value(self):\n \"\"\" Return the value of the counter \"\"\"\n return self.count.value", "metadata": "root.SharedCounter.value", "header": "['class', 'SharedCounter', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": "class MultiProcessingQueue(BaseQueue):\n \"\"\" A portable implementation of multiprocessing.Queue.\n Because of multithreading / multiprocessing semantics, Queue.qsize() may\n raise the NotImplementedError exception on Unix platforms like Mac OS X\n where sem_getvalue() is not implemented. This subclass addresses this\n problem by using a synchronized shared counter (initialized to zero) and\n increasing / decreasing its value every time the put() and get() methods\n are called, respectively. This not only prevents NotImplementedError from\n being raised, but also allows us to implement a reliable version of both\n qsize() and empty().\n \"\"\"\n\n\n", "metadata": "root.MultiProcessingQueue", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def __init__(self, *args, **kwargs):\n super(MultiProcessingQueue, self).__init__(*args, **kwargs)\n self.size = SharedCounter(0)", "metadata": "root.MultiProcessingQueue.__init__", "header": "['class', 'MultiProcessingQueue', '(', 'BaseQueue', ')', ':', '___EOS___']", "index": 46 }, { "content": " def put(self, *args, **kwargs):\n self.size.increment(1)\n super(MultiProcessingQueue, self).put(*args, **kwargs)", "metadata": "root.MultiProcessingQueue.put", "header": "['class', 'MultiProcessingQueue', '(', 'BaseQueue', ')', ':', '___EOS___']", "index": 50 }, { "content": " def get(self, *args, **kwargs):\n v = super(MultiProcessingQueue, self).get(*args, **kwargs)\n self.size.increment(-1)\n return v", "metadata": "root.MultiProcessingQueue.get", "header": "['class', 'MultiProcessingQueue', '(', 'BaseQueue', ')', ':', '___EOS___']", "index": 54 }, { "content": " def qsize(self):\n \"\"\" Reliable implementation of multiprocessing.Queue.qsize() \"\"\"\n return self.size.value", "metadata": "root.MultiProcessingQueue.qsize", "header": "['class', 'MultiProcessingQueue', '(', 'BaseQueue', ')', ':', '___EOS___']", "index": 59 }, { "content": " def Queue(maxsize=0):\n return MultiProcessingQueue(maxsize, ctx=multiprocessing.get_context())", "metadata": "root.Queue", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def Queue(maxsize=0):\n return MultiProcessingQueue(maxsize)", "metadata": "root.Queue", "header": "['module', '___EOS___']", "index": 69 } ]
[ { "span": "import six", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "multiprocessing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "multiprocessing_", "._", "queues_", "import_", "Queue_", "as_", "Base", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "Share", "d", "Counter", " ", "and", " ", "Queue", " ", "classe", "s", " ", "come", " ", "from", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "git", "hub", ".", "com", "/", "vte", "rro", "n", "/", "lem", "on", "/", "commit", "/", "9c", "a6", "b4", "b_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "platform_", "._", "system_", "(_", ")_", "==_", "'", "Dar", "win", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "multiprocessing_", ",_", "'", "get", "\\u", "context", "'_", ")_", ":_", "#", " ", "for", " ", "py3", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "multiprocessing_", "import_", "Queue_", "#", " ", "flake", "8", ":", " ", "no", "qa_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Share", "d", "Counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "synchronized", " ", "shared", " ", "counter", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "locking", " ", "don", "e", " ", "by", " ", "multipro", "cess", "ing", ".", "Value", " ", "ensure", "s", " ", "tha", "t", " ", "only", " ", "a", " ", "single", "\\", "10", ";", " ", " ", " ", " ", "process", " ", "or", " ", "thread", " ", "may", " ", "read", " ", "or", " ", "write", " ", "the", " ", "in", "-", "memory", " ", "ctype", "s", " ", "object", ".", " ", "Ho", "we", "ver", ",", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "order", " ", "to", " ", "do", " ", "n", " ", "+=", " ", "1", ",", " ", "Pyth", "on", " ", "perform", "s", " ", "a", " ", "read", " ", "followe", "d", " ", "by", " ", "a", " ", "write", ",", " ", "so", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "second", " ", "process", " ", "may", " ", "read", " ", "the", " ", "old", " ", "value", " ", "bef", "ore", " ", "the", " ", "new", " ", "one", " ", "is", " ", "writt", "en", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "first", " ", "process", ".", " ", "The", " ", "solut", "ion", " ", "is", " ", "to", " ", "use", " ", "a", " ", "multipro", "cess", "ing", ".", "Lock", " ", "to", " ", "guaran", "tee", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "atomi", "city", " ", "of", " ", "the", " ", "modification", "s", " ", "to", " ", "Value", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "come", "s", " ", "alm", "ost", " ", "entire", "ly", " ", "from", " ", "Eli", " ", "Ben", "ders", "ky", "'", "s", " ", "blog", ":", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "eli", ".", "the", "green", "place", ".", "net", "/", "2012", "/", "01", "/", "04", "/", "shared", "-", "counter", "-", "with", "-", "python", "s", "-", "multipro", "cess", "ing", "/", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Share", "d", "Counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "n_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "count_", "=_", "multiprocessing_", "._", "Value_", "(_", "'", "i", "'_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d", "Counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "increment_", "(_", "self_", ",_", "n_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Increment", " ", "the", " ", "counter", " ", "by", " ", "n", " ", "(", "default", " ", "=", " ", "1", ")", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "count_", "._", "get", "\\u", "lock_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "count_", "._", "value_", "+=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d", "Counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "value", " ", "of", " ", "the", " ", "counter", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "count_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "Process", "ing", "Queue_", "(_", "Base", "Queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "portab", "le", " ", "implementation", " ", "of", " ", "multipro", "cess", "ing", ".", "Queue", ".", "\\", "10", ";", " ", " ", " ", " ", "Be", "caus", "e", " ", "of", " ", "multit", "hread", "ing", " ", "/", " ", "multipro", "cess", "ing", " ", "semantics", ",", " ", "Queue", ".", "qs", "ize", "()", " ", "may", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "the", " ", "Not", "Impl", "ement", "ed", "Error", " ", "exception", " ", "on", " ", "Uni", "x", " ", "platform", "s", " ", "like", " ", "Mac", " ", "OS", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "sem", "\\u", "getv", "alu", "e", "()", " ", "is", " ", "not", " ", "implemented", ".", " ", "Thi", "s", " ", "subclass", " ", "addresse", "s", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "problem", " ", "by", " ", "usi", "ng", " ", "a", " ", "synchronized", " ", "shared", " ", "counter", " ", "(", "initialize", "d", " ", "to", " ", "zero", ")", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "incr", "easi", "ng", " ", "/", " ", "decre", "asin", "g", " ", "its", " ", "value", " ", "every", " ", "time", " ", "the", " ", "put", "()", " ", "and", " ", "get", "()", " ", "method", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "call", "ed", ",", " ", "respec", "tiv", "el", "y", ".", " ", "Thi", "s", " ", "not", " ", "only", " ", "prevent", "s", " ", "Not", "Impl", "ement", "ed", "Error", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "bei", "ng", " ", "raise", "d", ",", " ", "but", " ", "als", "o", " ", "allow", "s", " ", "us", " ", "to", " ", "implement", " ", "a", " ", "reliab", "le", " ", "version", " ", "of", " ", "bot", "h", "\\", "10", ";", " ", " ", " ", " ", "qs", "ize", "()", " ", "and", " ", "empty", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Process", "ing", "Queue_", "(_", "Base", "Queue_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Multi", "Process", "ing", "Queue_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "Share", "d", "Counter_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Process", "ing", "Queue_", "(_", "Base", "Queue_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "size_", "._", "increment_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Multi", "Process", "ing", "Queue_", ",_", "self_", ")_", "._", "put_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Process", "ing", "Queue_", "(_", "Base", "Queue_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "super_", "(_", "Multi", "Process", "ing", "Queue_", ",_", "self_", ")_", "._", "get_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "._", "increment_", "(_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Process", "ing", "Queue_", "(_", "Base", "Queue_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "qsize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Reli", "able", " ", "implementation", " ", "of", " ", "multipro", "cess", "ing", ".", "Queue", ".", "qs", "ize", "()", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "size_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "Queue_", "(_", "maxsize_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Multi", "Process", "ing", "Queue_", "(_", "maxsize_", ",_", "ctx_", "=_", "multiprocessing_", "._", "get", "\\u", "context_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "Queue_", "(_", "maxsize_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Multi", "Process", "ing", "Queue_", "(_", "maxsize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Imprecise assert
bartdag/recodoc2/recodoc2/apps/codebase/tests.py
[ { "content": " @transaction.autocommit\n def testCodeWords(self):\n create_code_db('project1', 'core', '3.0')\n\n parse_code('project1', 'core', '3.0', 'java')\n\n code_words =\\\n get_project_code_words(Project.objects.get(dir_name='project1'))\n\n self.assertTrue('rootapplication' in code_words)\n self.assertTrue('tag2' in code_words)\n self.assertTrue('dog' not in code_words)\n self.assertEqual(12, len(code_words))", "metadata": "root.CodeParserTest.testCodeWords", "header": "['class', 'CodeParserTest', '(', 'TransactionTestCase', ')', ':', '___EOS___']", "index": 166 }, { "content": " @transaction.autocommit\n def testJavaCodeParser(self):\n create_code_db('project1', 'core', '3.0')\n\n codebase = parse_code('project1', 'core', '3.0', 'java')\n\n ### Test some Classes ###\n ce = CodeElement.objects.get(fqn='RootApplication')\n self.assertEqual('RootApplication', ce.simple_name)\n self.assertEqual('class', ce.kind.kind)\n\n ce2 = CodeElement.objects.get(fqn='p1.p2.Tag')\n self.assertTrue(ce2.abstract)\n\n # Test containees & containers\n self.assertEqual(1, ce.containees.count())\n self.assertEqual('package', ce.containers.all()[0].kind.kind)\n self.assertEqual('', ce.containers.all()[0].fqn)\n\n ce = CodeElement.objects.get(fqn='p1.Application')\n self.assertEqual('Application', ce.simple_name)\n self.assertEqual('class', ce.kind.kind)\n # Test containees & containers\n self.assertEqual(1, ce.containees.count())\n self.assertEqual('package', ce.containers.all()[0].kind.kind)\n self.assertEqual('p1', ce.containers.all()[0].fqn)\n\n self.assertEqual(2,\n CodeElement.objects.filter(simple_name='Application').count())\n\n # Test hierarchy\n ce = CodeElement.objects.get(fqn='p1.AnimalException')\n # Nothing because the parent is not in the codebase\n # (java.lang.Exception)\n self.assertEqual(0, ce.parents.count())\n\n ce = CodeElement.objects.get(fqn='p1.p2.Dog')\n fqns = [parent.fqn for parent in ce.parents.all()]\n self.assertTrue('p1.p2.Canidae' in fqns)\n self.assertTrue('p1.p2.Tag' in fqns)\n self.assertTrue('p1.p2.Tag2' in fqns)\n\n # Test internal classes\n ce = CodeElement.objects.get(fqn='p3.Special.InnerSpecial')\n self.assertEqual('InnerSpecial', ce.simple_name)\n self.assertEqual('p3.Special', ce.containers.all()[0].fqn)\n self.assertEqual('method1', ce.containees.all()[0].simple_name)\n self.assertEqual('p3.Special.InnerSpecial.method1',\n ce.containees.all()[0].fqn)\n\n ### Test some Methods and Parameters ###\n ce = CodeElement.objects.get(fqn='p1.BigCat.doSomething')\n method = ce.methodelement\n self.assertEqual(4, method.parameters_length)\n self.assertTrue(MethodElement.objects.filter(simple_name='doSomething')\n .filter(parameters_length=4).exists())\n self.assertEqual(4, ce.parameters().count())\n self.assertEqual('method', ce.kind.kind)\n # Test container\n self.assertEqual('p1.BigCat', ce.containers.all()[0].fqn)\n\n self.assertEqual('specials', ce.parameters().all()[3].simple_name)\n # Array info is stripped from type.\n self.assertEqual('byte', ce.parameters().all()[2].type_fqn)\n # Generic info is stripped from type\n self.assertEqual('java.util.List', ce.parameters().all()[3].type_fqn)\n self.assertEqual('method parameter',\n ce.parameters().all()[3].kind.kind)\n\n ce = CodeElement.objects.get(fqn='p1.Animal.getParents')\n self.assertEqual('java.util.Collection', ce.methodelement.return_fqn)\n self.assertEqual('method', ce.kind.kind)\n # Test container\n self.assertEqual('p1.Animal', ce.containers.all()[0].fqn)\n\n ce = CodeElement.objects.get(fqn='p1.Animal.run')\n self.assertEqual('void', ce.methodelement.return_fqn)\n self.assertEqual('method', ce.kind.kind)\n\n ### Test some Fields ###\n ce = CodeElement.objects.get(fqn='p1.Animal.MAX_AGE')\n self.assertEqual('MAX_AGE', ce.simple_name)\n self.assertEqual('int', ce.fieldelement.type_simple_name)\n self.assertEqual('int', ce.fieldelement.type_fqn)\n self.assertEqual('field', ce.kind.kind)\n # Test container\n self.assertEqual('p1.Animal', ce.containers.all()[0].fqn)\n\n ce = CodeElement.objects.get(fqn='p1.Cat.name')\n self.assertEqual('java.lang.String', ce.fieldelement.type_fqn)\n self.assertEqual('field', ce.kind.kind)\n # Test container\n self.assertEqual('p1.Cat', ce.containers.all()[0].fqn)\n\n ### Test some Enumerations ###\n ce = CodeElement.objects.get(fqn='p1.AnimalType')\n self.assertEqual('enumeration', ce.kind.kind)\n self.assertTrue(ce.kind.is_type)\n self.assertEqual('enumeration value',\n ce.containees.all()[0].kind.kind)\n self.assertEqual('p1.AnimalType',\n ce.containees.all()[0].fieldelement.type_fqn)\n simple_names = [v.simple_name for v in ce.containees.all()]\n self.assertTrue('NOT_SURE' in simple_names)\n self.assertEqual(3, len(simple_names))\n\n ce = CodeElement.objects.get(fqn='p1.SubAnimalType')\n self.assertEqual('enumeration', ce.kind.kind)\n self.assertTrue(ce.kind.is_type)\n simple_names = [v.simple_name for v in ce.containees.all()]\n self.assertTrue('SOFT' in simple_names)\n # Because it is private!\n self.assertTrue('SubAnimalType' not in simple_names)\n self.assertTrue('getOther' in simple_names)\n self.assertTrue('other' not in simple_names)\n self.assertEqual(3, len(simple_names))\n\n ### Test some Annotations ###\n ce = CodeElement.objects.get(fqn='p1.AnimalTag')\n self.assertEqual('annotation', ce.kind.kind)\n self.assertEqual('annotation field', ce.containees.all()[0].kind.kind)\n fooBar = ce.containees.filter(simple_name='fooBar').all()[0]\n self.assertEqual('java.lang.String', fooBar.fieldelement.type_fqn)\n self.assertEqual(6, ce.containees.count())\n\n self.assertEqual(109, codebase.code_elements.count())\n\n clear_code_elements('project1', 'core', '3.0', 'xml')\n self.assertEqual(109, codebase.code_elements.count())\n clear_code_elements('project1', 'core', '3.0')\n self.assertEqual(0, codebase.code_elements.count())", "metadata": "root.CodeParserTest.testJavaCodeParser", "header": "['class', 'CodeParserTest', '(', 'TransactionTestCase', ')', ':', '___EOS___']", "index": 269 } ]
[ { "span": "self.assertTrue('rootapplication' in code_words)", "start_line": 175, "start_column": 8, "end_line": 175, "end_column": 56 }, { "span": "self.assertTrue('tag2' in code_words)", "start_line": 176, "start_column": 8, "end_line": 176, "end_column": 45 }, { "span": "self.assertTrue('dog' not in code_words)", "start_line": 177, "start_column": 8, "end_line": 177, "end_column": 48 }, { "span": "self.assertTrue('p1.p2.Canidae' in fqns)", "start_line": 307, "start_column": 8, "end_line": 307, "end_column": 48 }, { "span": "self.assertTrue('p1.p2.Tag' in fqns)", "start_line": 308, "start_column": 8, "end_line": 308, "end_column": 44 }, { "span": "self.assertTrue('p1.p2.Tag2' in fqns)", "start_line": 309, "start_column": 8, "end_line": 309, "end_column": 45 }, { "span": "self.assertTrue('NOT_SURE' in simple_names)", "start_line": 372, "start_column": 8, "end_line": 372, "end_column": 51 }, { "span": "self.assertTrue('SOFT' in simple_names)", "start_line": 379, "start_column": 8, "end_line": 379, "end_column": 47 }, { "span": "self.assertTrue('SubAnimalType' not in simple_names)", "start_line": 381, "start_column": 8, "end_line": 381, "end_column": 60 }, { "span": "self.assertTrue('getOther' in simple_names)", "start_line": 382, "start_column": 8, "end_line": 382, "end_column": 51 }, { "span": "self.assertTrue('other' not in simple_names)", "start_line": 383, "start_column": 8, "end_line": 383, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Code", "Parser", "Test_", "(_", "Transa", "ction", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transaction_", "._", "autocommit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Code", "Words_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "code", "\\u", "db_", "(_", "'", "project", "1", "'_", ",_", "'", "core", "'_", ",_", "'", "3.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parse", "\\u", "code_", "(_", "'", "project", "1", "'_", ",_", "'", "core", "'_", ",_", "'", "3.0", "'_", ",_", "'", "java", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "words_", "=_", "get", "\\u", "project", "\\u", "code", "\\u", "words_", "(_", "Project_", "._", "objects_", "._", "get_", "(_", "dir\\u", "name_", "=_", "'", "project", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "root", "applica", "tion", "'_", "in_", "code", "\\u", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "tag", "2", "'_", "in_", "code", "\\u", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "dog", "'_", "not_", "in_", "code", "\\u", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "12_", ",_", "len_", "(_", "code", "\\u", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Code", "Parser", "Test_", "(_", "Transa", "ction", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "transaction_", "._", "autocommit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Ja", "va", "Code", "Parser_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "create", "\\u", "code", "\\u", "db_", "(_", "'", "project", "1", "'_", ",_", "'", "core", "'_", ",_", "'", "3.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "codeb", "ase_", "=_", "parse", "\\u", "code_", "(_", "'", "project", "1", "'_", ",_", "'", "core", "'_", ",_", "'", "3.0", "'_", ",_", "'", "java", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Test", " ", "some", " ", "Class", "es", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "Roo", "t", "Applica", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Roo", "t", "Applica", "tion", "'_", ",_", "ce_", "._", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "class", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce", "2_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "p2", ".", "Ta", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ce", "2_", "._", "abstract_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "contain", "ees", " ", "&", " ", "containers_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "ce_", "._", "contain", "ees", "_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "package", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "''_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Applica", "tion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "Applica", "tion", "'_", ",_", "ce_", "._", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "class", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "contain", "ees", " ", "&", " ", "containers_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "ce_", "._", "contain", "ees", "_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "package", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p1", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Code", "Element_", "._", "objects_", "._", "filter_", "(_", "simple", "\\u", "name_", "=_", "'", "Applica", "tion", "'_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "hierarchy_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Anima", "l", "Except", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", "hing", " ", "bec", "aus", "e", " ", "the", " ", "parent", " ", "is", " ", "not", " ", "in", " ", "the", " ", "codeb", "ase_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "java", ".", "lang", ".", "Except", "ion", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "ce_", "._", "parents_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "p2", ".", "Dog", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fqn", "s_", "=_", "[_", "parent_", "._", "fqn", "_", "for_", "parent_", "in_", "ce_", "._", "parents_", "._", "all_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "p1", ".", "p2", ".", "Can", "ida", "e", "'_", "in_", "fqn", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "p1", ".", "p2", ".", "Ta", "g", "'_", "in_", "fqn", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "p1", ".", "p2", ".", "Ta", "g2", "'_", "in_", "fqn", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "internal", " ", "classes_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p3", ".", "Special", ".", "In", "ner", "Special", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "In", "ner", "Special", "'_", ",_", "ce_", "._", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p3", ".", "Special", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "method", "1", "'_", ",_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p3", ".", "Special", ".", "In", "ner", "Special", ".", "method", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Test", " ", "some", " ", "Meth", "ods", " ", "and", " ", "Parameter", "s", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Big", "Cat", ".", "do", "Some", "thing", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "method_", "=_", "ce_", "._", "method", "element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "method_", "._", "parameter", "s", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "Meth", "od", "Element_", "._", "objects_", "._", "filter_", "(_", "simple", "\\u", "name_", "=_", "'", "do", "Some", "thing", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "._", "filter_", "(_", "parameter", "s", "\\u", "length_", "=_", "4_", ")_", "._", "exists_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "ce_", "._", "parameters_", "(_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "method", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p1", ".", "Big", "Cat", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "specials", "'_", ",_", "ce_", "._", "parameters_", "(_", ")_", "._", "all_", "(_", ")_", "[_", "3_", "]_", "._", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Array", " ", "info", " ", "is", " ", "strip", "ped", " ", "from", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "byte", "'_", ",_", "ce_", "._", "parameters_", "(_", ")_", "._", "all_", "(_", ")_", "[_", "2_", "]_", "._", "type", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Gene", "ric", " ", "info", " ", "is", " ", "strip", "ped", " ", "from", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "java", ".", "util", ".", "List", "'_", ",_", "ce_", "._", "parameters_", "(_", ")_", "._", "all_", "(_", ")_", "[_", "3_", "]_", "._", "type", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "method", " ", "parameter", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "._", "parameters_", "(_", ")_", "._", "all_", "(_", ")_", "[_", "3_", "]_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Anima", "l", ".", "get", "Parent", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "java", ".", "util", ".", "Collecti", "on", "'_", ",_", "ce_", "._", "method", "element_", "._", "return", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "method", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p1", ".", "Anima", "l", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Anima", "l", ".", "run", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "voi", "d", "'_", ",_", "ce_", "._", "method", "element_", "._", "return", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "method", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Test", " ", "some", " ", "Field", "s", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Anima", "l", ".", "MAX", "\\u", "AGE", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "MAX", "\\u", "AGE", "'_", ",_", "ce_", "._", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "int", "'_", ",_", "ce_", "._", "field", "element_", "._", "type", "\\u", "simple", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "int", "'_", ",_", "ce_", "._", "field", "element_", "._", "type", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "field", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p1", ".", "Anima", "l", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Cat", ".", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "java", ".", "lang", ".", "String", "'_", ",_", "ce_", "._", "field", "element_", "._", "type", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "field", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "container_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p1", ".", "Cat", "'_", ",_", "ce_", "._", "containers_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Test", " ", "some", " ", "Enum", "eratio", "ns", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Anima", "l", "Type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "enumerati", "on", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ce_", "._", "kind_", "._", "is", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "enumerati", "on", " ", "value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "p1", ".", "Anima", "l", "Type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "field", "element_", "._", "type", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simple", "\\u", "names_", "=_", "[_", "v_", "._", "simple", "\\u", "name_", "for_", "v_", "in_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "NOT", "\\u", "SUR", "E", "'_", "in_", "simple", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "simple", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Sub", "Anima", "l", "Type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "enumerati", "on", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "ce_", "._", "kind_", "._", "is", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "simple", "\\u", "names_", "=_", "[_", "v_", "._", "simple", "\\u", "name_", "for_", "v_", "in_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "SOFT", "'_", "in_", "simple", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Be", "caus", "e", " ", "it", " ", "is", " ", "private", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Sub", "Anima", "l", "Type", "'_", "not_", "in_", "simple", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "get", "Ot", "her", "'_", "in_", "simple", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "other", "'_", "not_", "in_", "simple", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "3_", ",_", "len_", "(_", "simple", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Test", " ", "some", " ", "Annotations", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "ce_", "=_", "Code", "Element_", "._", "objects_", "._", "get_", "(_", "fqn", "_", "=_", "'", "p1", ".", "Anima", "l", "Ta", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "annot", "ation", "'_", ",_", "ce_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "annot", "ation", " ", "field", "'_", ",_", "ce_", "._", "contain", "ees", "_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "._", "kind_", "._", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "foo", "Bar_", "=_", "ce_", "._", "contain", "ees", "_", "._", "filter_", "(_", "simple", "\\u", "name_", "=_", "'", "foo", "Bar", "'_", ")_", "._", "all_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "java", ".", "lang", ".", "String", "'_", ",_", "foo", "Bar_", "._", "field", "element_", "._", "type", "\\u", "fqn", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "6_", ",_", "ce_", "._", "contain", "ees", "_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "109_", ",_", "codeb", "ase_", "._", "code", "\\u", "elements_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "clear", "\\u", "code", "\\u", "elements_", "(_", "'", "project", "1", "'_", ",_", "'", "core", "'_", ",_", "'", "3.0", "'_", ",_", "'", "xml", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "109_", ",_", "codeb", "ase_", "._", "code", "\\u", "elements_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clear", "\\u", "code", "\\u", "elements_", "(_", "'", "project", "1", "'_", ",_", "'", "core", "'_", ",_", "'", "3.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "codeb", "ase_", "._", "code", "\\u", "elements_", "._", "count_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
Southpaw-TACTIC/TACTIC/3rd_party/site-packages/pytz/tzinfo.py
[ { "content": "'''Base classes and helpers for building zone specific tzinfo classes'''\n\nfrom datetime import datetime, timedelta, tzinfo\nfrom bisect import bisect_right\ntry:\n set\nexcept NameError:\n from sets import Set as set\n\nimport pytz\nfrom pytz.exceptions import AmbiguousTimeError, NonExistentTimeError\n\n__all__ = []\n\n_timedelta_cache = {}\n\n_epoch = datetime.utcfromtimestamp(0)\n_datetime_cache = {0: _epoch}\n\n_ttinfo_cache = {}\n\n_notime = memorized_timedelta(0)\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "sets ", "start_line": 7, "start_column": 9, "end_line": 7, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "Base", " ", "classe", "s", " ", "and", " ", "help", "ers", " ", "for", " ", "buildi", "ng", " ", "zone", " ", "specific", " ", "tzi", "nfo", " ", "classe", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", ",_", "tzinfo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bisect_", "import_", "bisect", "\\u", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sets_", "import_", "Set_", "as_", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "pytz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pytz_", "._", "exceptions_", "import_", "Ambi", "guous", "Time", "Error_", ",_", "Non", "Exist", "ent", "Time", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "timedelta", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "epoch_", "=_", "datetime_", "._", "utc", "fromtimestamp_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "datetime", "\\u", "cache_", "=_", "{_", "0_", ":_", "\\u", "epoch_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "tti", "nfo", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Microsoft/ivy/ivy/concept_alpha.py
[ { "content": "#\n# Copyright (c) Microsoft Corporation. All Rights Reserved.\n#\n\"\"\"\n\"\"\"\n\nfrom z3_utils import z3_implies\nfrom logic import Or\n\n\n\nif __name__ == '__main__':\n from collections import OrderedDict\n from logic import (Var, Const, Apply, Eq, Not, And, Or, Implies,\n ForAll, Exists)\n from logic import UninterpretedSort, FunctionSort, first_order_sort, Boolean\n from logic_util import free_variables, substitute, substitute_apply\n from concept import Concept, ConceptCombiner, ConceptDomain\n\n\n S = UninterpretedSort('S')\n UnaryRelation = FunctionSort(S, Boolean)\n BinaryRelation = FunctionSort(S, S, Boolean)\n\n X, Y, Z = (Var(n, S) for n in ['X', 'Y', 'Z'])\n U = Var('U', UnaryRelation)\n U1 = Var('U1', UnaryRelation)\n U2 = Var('U2', UnaryRelation)\n B = Var('B', BinaryRelation)\n B1 = Var('B1', BinaryRelation)\n B2 = Var('B2', BinaryRelation)\n\n nstar = Const('nstar', BinaryRelation)\n x = Const('x', S)\n y = Const('y', S)\n\n c11 = Concept([X], And(Eq(x,X), Eq(y,X)))\n c10 = Concept([X], And(Eq(x,X), Not(Eq(y,X))))\n c01 = Concept([X], And(Not(Eq(x,X)), Eq(y,X)))\n c00 = Concept([X], And(Not(Eq(x,X)), Not(Eq(y,X))))\n\n cnstar = Concept([X, Y], nstar(X,Y))\n cnplus = Concept([X, Y], And(nstar(X,Y), Not(Eq(X,Y))))\n\n notexists = ConceptCombiner([U], Not(Exists([X], U(X))))\n exists = ConceptCombiner([U], Exists([X], U(X)))\n singleton = ConceptCombiner([U], ForAll([X,Y], Implies(And(U(X), U(Y)), Eq(X,Y))))\n all_to_all = ConceptCombiner(\n [U1, U2, B],\n ForAll([X,Y], Implies(And(U1(X), U2(Y)), B(X,Y)))\n )\n\n cd = ConceptDomain(\n OrderedDict([\n ('xy', c11),\n ('other', c00),\n ('x', c10),\n ('y', c01),\n ('nstar', cnstar),\n ('nplus', cnplus),\n ]),\n OrderedDict([\n ('notexists', notexists),\n ('exists', exists),\n ('singleton', singleton),\n ('all_to_all', all_to_all),\n ]),\n OrderedDict([\n ('node_info', (\n ['notexists', 'exists', 'singleton'],\n ['xy', 'other', 'x', 'y'],\n )),\n ('binary_info', (\n ['all_to_all'],\n ['xy', 'other', 'x', 'y'],\n ['xy', 'other', 'x', 'y'],\n ['nstar', 'nplus'],\n ))\n ]),\n )\n\n facts = cd.get_facts()\n print \"facts = [\"\n for tag, formula in facts:\n print ' ', tag, formula, ','\n print \"]\\n\"\n\n state = And(\n ForAll([X,Y,Z], And(\n nstar(X,X),\n Implies(And(nstar(X,Y), nstar(Y,X)), Eq(X,Y)),\n Implies(And(nstar(X,Y), nstar(Y,Z)), nstar(X,Z)),\n Implies(And(nstar(X,Y), nstar(X,Z)), Or(nstar(Y,Z), nstar(Z,Y))),\n )),\n\n nstar(x,y),\n Not(Eq(x,y)),\n ForAll([Z], Implies(And(nstar(x,Z), Not(Eq(x,Z))), nstar(y,Z))),\n )\n\n abstract_value = alpha(cd, state)\n print \"abstract_value = [\"\n for tag, value in abstract_value:\n print ' ', tag, value, ','\n print \"]\\n\"\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def alpha(concept_domain, state, cache=None):\n \"\"\"\n Right now, state is just a plain formula\n\n This is a *very* unoptimized implementation\n \"\"\"\n if z3_implies(state, Or()):\n return [(tag, True) for tag, formula in concept_domain.get_facts()]\n\n if cache is None:\n cache = dict()\n facts = concept_domain.get_facts()\n result = []\n for tag, formula in facts:\n if tag in cache:\n value = cache[tag]\n else:\n # assert len(cache) == 0, tag\n value = z3_implies(state, formula)\n result.append((tag, value))\n return result", "metadata": "root.alpha", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def test(st):\n print st, \"=\", eval(st)", "metadata": "root.test", "header": "['module', '___EOS___']", "index": 40 } ]
[ { "span": "from logic import (Var, Const, Apply, Eq, Not, And, Or, Implies,\n ForAll, Exists)", "start_line": 34, "start_column": 4, "end_line": 35, "end_column": 38 }, { "span": "from logic import UninterpretedSort, FunctionSort, first_order_sort, Boolean", "start_line": 36, "start_column": 4, "end_line": 36, "end_column": 80 }, { "span": "from logic_util import free_variables, substitute, substitute_apply", "start_line": 37, "start_column": 4, "end_line": 37, "end_column": 71 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Micro", "soft", " ", "Cor", "porat", "ion", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "z3", "\\u", "utils_", "import_", "z3", "\\u", "implies", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logic_", "import_", "Or_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logic_", "import_", "(_", "Var_", ",_", "Const_", ",_", "Apply", "_", ",_", "Eq_", ",_", "Not_", ",_", "And_", ",_", "Or_", ",_", "Impl", "ies_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "All_", ",_", "Exists_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logic_", "import_", "Unin", "terp", "ret", "ed", "Sort_", ",_", "Function", "Sort_", ",_", "first", "\\u", "order", "\\u", "sort_", ",_", "Boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "logic", "\\u", "util_", "import_", "free", "\\u", "variables_", ",_", "substitute_", ",_", "substitute", "\\u", "apply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "concept_", "import_", "Concept", "_", ",_", "Concept", "Combine", "r_", ",_", "Concept", "Domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "S_", "=_", "Unin", "terp", "ret", "ed", "Sort_", "(_", "'", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Una", "ry", "Relation_", "=_", "Function", "Sort_", "(_", "S_", ",_", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Bin", "ary", "Relation_", "=_", "Function", "Sort_", "(_", "S_", ",_", "S_", ",_", "Boolean_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", ",_", "Y_", ",_", "Z_", "=_", "(_", "Var_", "(_", "n_", ",_", "S_", ")_", "for_", "n_", "in_", "[_", "'", "X", "'_", ",_", "'", "Y", "'_", ",_", "'", "Z", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "U_", "=_", "Var_", "(_", "'", "U", "'_", ",_", "Una", "ry", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "U1", "_", "=_", "Var_", "(_", "'", "U1", "'_", ",_", "Una", "ry", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "U2", "_", "=_", "Var_", "(_", "'", "U2", "'_", ",_", "Una", "ry", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B_", "=_", "Var_", "(_", "'", "B", "'_", ",_", "Bin", "ary", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B1_", "=_", "Var_", "(_", "'", "B1", "'_", ",_", "Bin", "ary", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "B2_", "=_", "Var_", "(_", "'", "B2", "'_", ",_", "Bin", "ary", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nsta", "r_", "=_", "Const_", "(_", "'", "nsta", "r", "'_", ",_", "Bin", "ary", "Relation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "Const_", "(_", "'", "x", "'_", ",_", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "Const_", "(_", "'", "y", "'_", ",_", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c1", "1_", "=_", "Concept", "_", "(_", "[_", "X_", "]_", ",_", "And_", "(_", "Eq_", "(_", "x_", ",_", "X_", ")_", ",_", "Eq_", "(_", "y_", ",_", "X_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c1", "0_", "=_", "Concept", "_", "(_", "[_", "X_", "]_", ",_", "And_", "(_", "Eq_", "(_", "x_", ",_", "X_", ")_", ",_", "Not_", "(_", "Eq_", "(_", "y_", ",_", "X_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0", "1_", "=_", "Concept", "_", "(_", "[_", "X_", "]_", ",_", "And_", "(_", "Not_", "(_", "Eq_", "(_", "x_", ",_", "X_", ")_", ")_", ",_", "Eq_", "(_", "y_", ",_", "X_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c0", "0_", "=_", "Concept", "_", "(_", "[_", "X_", "]_", ",_", "And_", "(_", "Not_", "(_", "Eq_", "(_", "x_", ",_", "X_", ")_", ")_", ",_", "Not_", "(_", "Eq_", "(_", "y_", ",_", "X_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cns", "tar_", "=_", "Concept", "_", "(_", "[_", "X_", ",_", "Y_", "]_", ",_", "nsta", "r_", "(_", "X_", ",_", "Y_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cn", "plus_", "=_", "Concept", "_", "(_", "[_", "X_", ",_", "Y_", "]_", ",_", "And_", "(_", "nsta", "r_", "(_", "X_", ",_", "Y_", ")_", ",_", "Not_", "(_", "Eq_", "(_", "X_", ",_", "Y_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "note", "xist", "s_", "=_", "Concept", "Combine", "r_", "(_", "[_", "U_", "]_", ",_", "Not_", "(_", "Exists_", "(_", "[_", "X_", "]_", ",_", "U_", "(_", "X_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exists_", "=_", "Concept", "Combine", "r_", "(_", "[_", "U_", "]_", ",_", "Exists_", "(_", "[_", "X_", "]_", ",_", "U_", "(_", "X_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "singleton_", "=_", "Concept", "Combine", "r_", "(_", "[_", "U_", "]_", ",_", "For", "All_", "(_", "[_", "X_", ",_", "Y_", "]_", ",_", "Impl", "ies_", "(_", "And_", "(_", "U_", "(_", "X_", ")_", ",_", "U_", "(_", "Y_", ")_", ")_", ",_", "Eq_", "(_", "X_", ",_", "Y_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "to", "\\u", "all_", "=_", "Concept", "Combine", "r_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "U1", "_", ",_", "U2", "_", ",_", "B_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "All_", "(_", "[_", "X_", ",_", "Y_", "]_", ",_", "Impl", "ies_", "(_", "And_", "(_", "U1", "_", "(_", "X_", ")_", ",_", "U2", "_", "(_", "Y_", ")_", ")_", ",_", "B_", "(_", "X_", ",_", "Y_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cd_", "=_", "Concept", "Domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "xy", "'_", ",_", "c1", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "other", "'_", ",_", "c0", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "x", "'_", ",_", "c1", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "y", "'_", ",_", "c0", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "nsta", "r", "'_", ",_", "cns", "tar_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "npl", "us", "'_", ",_", "cn", "plus_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "note", "xist", "s", "'_", ",_", "note", "xist", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "exist", "s", "'_", ",_", "exists_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "singleton", "'_", ",_", "singleton_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "all", "\\u", "to", "\\u", "all", "'_", ",_", "all", "\\u", "to", "\\u", "all_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "node", "\\u", "info", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "note", "xist", "s", "'_", ",_", "'", "exist", "s", "'_", ",_", "'", "singleton", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "xy", "'_", ",_", "'", "other", "'_", ",_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "binar", "y", "\\u", "info", "'_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "all", "\\u", "to", "\\u", "all", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "xy", "'_", ",_", "'", "other", "'_", ",_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "xy", "'_", ",_", "'", "other", "'_", ",_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "nsta", "r", "'_", ",_", "'", "npl", "us", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "facts_", "=_", "cd_", "._", "get", "\\u", "facts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "fact", "s", " ", "=", " ", "[\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", ",_", "formula_", "in_", "facts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", "'_", ",_", "tag_", ",_", "formula_", ",_", "','_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"]", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "And_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "For", "All_", "(_", "[_", "X_", ",_", "Y_", ",_", "Z_", "]_", ",_", "And_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nsta", "r_", "(_", "X_", ",_", "X_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Impl", "ies_", "(_", "And_", "(_", "nsta", "r_", "(_", "X_", ",_", "Y_", ")_", ",_", "nsta", "r_", "(_", "Y_", ",_", "X_", ")_", ")_", ",_", "Eq_", "(_", "X_", ",_", "Y_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Impl", "ies_", "(_", "And_", "(_", "nsta", "r_", "(_", "X_", ",_", "Y_", ")_", ",_", "nsta", "r_", "(_", "Y_", ",_", "Z_", ")_", ")_", ",_", "nsta", "r_", "(_", "X_", ",_", "Z_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Impl", "ies_", "(_", "And_", "(_", "nsta", "r_", "(_", "X_", ",_", "Y_", ")_", ",_", "nsta", "r_", "(_", "X_", ",_", "Z_", ")_", ")_", ",_", "Or_", "(_", "nsta", "r_", "(_", "Y_", ",_", "Z_", ")_", ",_", "nsta", "r_", "(_", "Z_", ",_", "Y_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nsta", "r_", "(_", "x_", ",_", "y_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Not_", "(_", "Eq_", "(_", "x_", ",_", "y_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "For", "All_", "(_", "[_", "Z_", "]_", ",_", "Impl", "ies_", "(_", "And_", "(_", "nsta", "r_", "(_", "x_", ",_", "Z_", ")_", ",_", "Not_", "(_", "Eq_", "(_", "x_", ",_", "Z_", ")_", ")_", ")_", ",_", "nsta", "r_", "(_", "y_", ",_", "Z_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "abstract", "\\u", "value_", "=_", "alpha_", "(_", "cd_", ",_", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "abstract", "\\u", "value", " ", "=", " ", "[\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", ",_", "value_", "in_", "abstract", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", " ", " ", " ", "'_", ",_", "tag_", ",_", "value_", ",_", "','_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"]", "\\\\", "n", "\"_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "alpha_", "(_", "concept", "\\u", "domain_", ",_", "state_", ",_", "cache_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rig", "ht", " ", "now", ",", " ", "state", " ", "is", " ", "just", " ", "a", " ", "plain", " ", "formula", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "*", "very", "*", " ", "uno", "pti", "mi", "zed", " ", "implementation", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "z3", "\\u", "implies", "_", "(_", "state_", ",_", "Or_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "tag_", ",_", "True_", ")_", "for_", "tag_", ",_", "formula_", "in_", "concept", "\\u", "domain_", "._", "get", "\\u", "facts_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cache_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "facts_", "=_", "concept", "\\u", "domain_", "._", "get", "\\u", "facts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "tag_", ",_", "formula_", "in_", "facts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tag_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "cache_", "[_", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "len", "(", "cache", ")", " ", "==", " ", "0", ",", " ", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "z3", "\\u", "implies", "_", "(_", "state_", ",_", "formula_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "(_", "tag_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test_", "(_", "st_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "st_", ",_", "\"=\"_", ",_", "eval_", "(_", "st_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
viewfinderco/viewfinder/backend/base/test/handler_test.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2012 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Viewfinder web request handler tests.\n\n HandlerTestCase: sets up an HTTP server-based test case with\n ViewfinderHandler-derived handlers using asynchronous decorators.\n\"\"\"\n\n__author__ = '[email protected] (Spencer Kimball)'\n\nimport logging\nimport random\nimport struct\nimport sys\nimport unittest\n\nfrom functools import partial\nfrom tornado import httpclient, options, web, testing\nfrom tornado.stack_context import StackContext\n\n\nfrom viewfinder.backend.base import handler, util\nfrom viewfinder.backend.base.testing import async_test, BaseTestCase\nfrom viewfinder.backend.db.local_client import LocalClient\nfrom viewfinder.backend.db.db_client import DBClient, DBKey, DBKeySchema\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class _DatastoreHandler(web.RequestHandler):\n \"\"\"Handler for datastore database set/retrieval.\"\"\"\n", "metadata": "root._DatastoreHandler", "header": "['module', '___EOS___']", "index": 29 }, { "content": " @handler.asynchronous(datastore=True)\n def get(self):\n def _OnGet(result):\n self.write('%s' % result.attributes['v'])\n self.finish()\n\n self._client.GetItem(table='test',\n key=DBKey(hash_key=self.get_argument('k'), range_key=None),\n attributes=['v'], callback=_OnGet)", "metadata": "root._DatastoreHandler.get", "header": "['class', '_DatastoreHandler', '(', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 31 }, { "content": " @handler.asynchronous(datastore=True)\n def post(self):\n def _OnPut(result):\n self.write('ok')\n self.finish()\n\n self._client.PutItem(table='test',\n key=DBKey(hash_key=self.get_argument('k'), range_key=None),\n attributes={'v': self.get_argument('v')}, callback=_OnPut)", "metadata": "root._DatastoreHandler.post", "header": "['class', '_DatastoreHandler', '(', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 41 }, { "content": "class HandlerTestCase(BaseTestCase, testing.AsyncHTTPTestCase):\n \"\"\"Sets up a web server which handles various backend asynchronous\n services, such as datastore db operations.\n \"\"\"\n\n\n\n\n", "metadata": "root.HandlerTestCase", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def setUp(self):\n super(HandlerTestCase, self).setUp()\n\n # Redefine http client to increase the maximum number of outstanding clients.\n self.http_client = httpclient.AsyncHTTPClient(\n io_loop=self.io_loop, max_clients=100, force_instance=True)\n # Setup a test table in a test datastore client instance.\n options.options.localdb_dir = ''\n\n DBClient.SetInstance(LocalClient(None))\n DBClient.Instance().CreateTable(\n table='test', hash_key_schema=DBKeySchema(name='k', value_type='S'),\n range_key_schema=None, read_units=10, write_units=5, callback=None)", "metadata": "root.HandlerTestCase.setUp", "header": "['class', 'HandlerTestCase', '(', 'BaseTestCase', ',', 'testing', '.', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def get_app(self):\n \"\"\"Creates a web server which handles:\n\n - GET /datastore?k=<key> - retrieve value for <key>; shard is hash of key\n - POST /datastore?k=<key>&v=<value> - set datastore <key>:<value>; shard is hash of key\n \"\"\"\n return web.Application([(r\"/datastore\", _DatastoreHandler)])", "metadata": "root.HandlerTestCase.get_app", "header": "['class', 'HandlerTestCase', '(', 'BaseTestCase', ',', 'testing', '.', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " @async_test\n def testDatastore(self):\n \"\"\"Test the webserver handles datastore key/value store and retrieval\n by inserting a collection of random values and verifying their\n retrieval, in parallel.\n \"\"\"\n values = self._CreateRandomValues(num_values=100)\n\n def _InsertDone():\n self._RetrieveValues(values, self.stop)\n\n self._InsertValues(values, _InsertDone)", "metadata": "root.HandlerTestCase.testDatastore", "header": "['class', 'HandlerTestCase', '(', 'BaseTestCase', ',', 'testing', '.', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def _CreateRandomValues(self, num_values=100):\n \"\"\"Creates num_values random integers between [0, 1<<20)\n \"\"\"\n return [int(random.uniform(0, 1 << 20)) for i in xrange(num_values)]", "metadata": "root.HandlerTestCase._CreateRandomValues", "header": "['class', 'HandlerTestCase', '(', 'BaseTestCase', ',', 'testing', '.', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 91 }, { "content": " def _InsertValues(self, values, callback):\n \"\"\"Inserts values into datastore via the tornado web server and\n invokes callback with the sequence of values when complete. The\n values are randomly distributed over the available shards.\n\n - The key of each value is computed as: 'k%d' % value\n \"\"\"\n def _VerifyResponse(cb, resp):\n self.assertEqual(resp.body, 'ok')\n cb()\n\n with util.Barrier(callback) as b:\n for val in values:\n self.http_client.fetch(\n httpclient.HTTPRequest(self.get_url('/datastore'), method='POST',\n body='k=k%d&v=%d' % (val, val)),\n callback=partial(_VerifyResponse, b.Callback()))", "metadata": "root.HandlerTestCase._InsertValues", "header": "['class', 'HandlerTestCase', '(', 'BaseTestCase', ',', 'testing', '.', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 96 }, { "content": " def _RetrieveValues(self, values, callback):\n \"\"\"Retrieves and verifies the specified values from Datastore database\n via the tornado web server.\n \"\"\"\n def _VerifyResponse(val, cb, resp):\n self.assertEqual(resp.body, repr(val))\n cb()\n\n with util.Barrier(callback) as b:\n for val in values:\n self.http_client.fetch(\n httpclient.HTTPRequest(self.get_url('/datastore?k=k%d' % val), method='GET'),\n callback=partial(_VerifyResponse, val, b.Callback()))", "metadata": "root.HandlerTestCase._RetrieveValues", "header": "['class', 'HandlerTestCase', '(', 'BaseTestCase', ',', 'testing', '.', 'AsyncHTTPTestCase', ')', ':', '___EOS___']", "index": 114 } ]
[ { "span": "import logging", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 14 }, { "span": "import struct", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 13 }, { "span": "import sys", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 10 }, { "span": "import unittest", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 15 }, { "span": "from tornado.stack_context import StackContext", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "View", "finde", "r", " ", "web", " ", "request", " ", "handler", " ", "tests", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Handle", "r", "Test", "Case", ":", " ", "sets", " ", "up", " ", "an", " ", "HTTP", " ", "server", "-", "based", " ", "test", " ", "case", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "View", "finde", "r", "Handle", "r", "-", "derive", "d", " ", "handler", "s", " ", "usi", "ng", " ", "async", "hronous", " ", "decorat", "ors", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "spe", "nce", "r", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Spe", "nce", "r", " ", "Ki", "mba", "ll", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "httpc", "lient_", ",_", "options_", ",_", "web_", ",_", "testing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "._", "stack", "\\u", "context_", "import_", "Stack", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "handler_", ",_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "testing_", "import_", "async", "\\u", "test_", ",_", "Base", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "local", "\\u", "client_", "import_", "Local", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "db", "\\u", "client_", "import_", "DB", "Client_", ",_", "DB", "Key_", ",_", "DB", "Key", "Schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "\\u", "Datas", "tore", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "r", " ", "for", " ", "datast", "ore", " ", "databa", "se", " ", "set", "/", "retrie", "val", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Datas", "tore", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "handler_", "._", "async", "hronous", "_", "(_", "datastore_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "On", "Get_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "'%", "s", "'_", "%_", "result_", "._", "attributes_", "[_", "'", "v", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "client_", "._", "Get", "Item_", "(_", "table_", "=_", "'", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "DB", "Key_", "(_", "hash", "\\u", "key_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "k", "'_", ")_", ",_", "range", "\\u", "key_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "[_", "'", "v", "'_", "]_", ",_", "callback_", "=_", "\\u", "On", "Get_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Datas", "tore", "Handler_", "(_", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "handler_", "._", "async", "hronous", "_", "(_", "datastore_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "On", "Put", "_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write_", "(_", "'", "ok", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "client_", "._", "Put", "Item_", "(_", "table_", "=_", "'", "test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "DB", "Key_", "(_", "hash", "\\u", "key_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "k", "'_", ")_", ",_", "range", "\\u", "key_", "=_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "{_", "'", "v", "'_", ":_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "v", "'_", ")_", "}_", ",_", "callback_", "=_", "\\u", "On", "Put", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "up", " ", "a", " ", "web", " ", "server", " ", "whi", "ch", " ", "handle", "s", " ", "vari", "ous", " ", "back", "end", " ", "async", "hronous", "\\", "10", ";", " ", " ", "service", "s", ",", " ", "suc", "h", " ", "as", " ", "datast", "ore", " ", "db", " ", "operati", "ons", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Handle", "r", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Red", "efin", "e", " ", "http", " ", "client", " ", "to", " ", "increase", " ", "the", " ", "maxim", "um", " ", "number", " ", "of", " ", "outstanding", " ", "clients", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "http", "\\u", "client_", "=_", "httpc", "lient_", "._", "Async", "HTTP", "Client_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "io", "\\u", "loop_", "=_", "self_", "._", "io", "\\u", "loop_", ",_", "max", "\\u", "clients_", "=_", "100_", ",_", "force", "\\u", "instance_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "a", " ", "test", " ", "table", " ", "in", " ", "a", " ", "test", " ", "datast", "ore", " ", "client", " ", "instance", "._", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "options_", "._", "locald", "b", "\\u", "dir_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DB", "Client_", "._", "Set", "Instance_", "(_", "Local", "Client_", "(_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DB", "Client_", "._", "Instance_", "(_", ")_", "._", "Creat", "e", "Table_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "table_", "=_", "'", "test", "'_", ",_", "hash", "\\u", "key", "\\u", "schema_", "=_", "DB", "Key", "Schema_", "(_", "name_", "=_", "'", "k", "'_", ",_", "value", "\\u", "type_", "=_", "'", "S", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "key", "\\u", "schema_", "=_", "None_", ",_", "read", "\\u", "units_", "=_", "10_", ",_", "write", "\\u", "units_", "=_", "5_", ",_", "callback_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "app_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "web", " ", "server", " ", "whi", "ch", " ", "handle", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", "-", " ", "GET", " ", " ", "/", "datast", "ore", "?", "k", "=", "<", "key", ">", " ", "-", " ", "retrieve", " ", "value", " ", "for", " ", "<", "key", ">", ";", " ", "shard", " ", "is", " ", "hash", " ", "of", " ", "key", "\\", "10", ";", " ", "-", " ", "POST", " ", "/", "datast", "ore", "?", "k", "=", "<", "key", ">", "&", "v", "=", "<", "value", ">", " ", "-", " ", "set", " ", "datast", "ore", " ", "<", "key", ">:", "<", "value", ">", ";", " ", "shard", " ", "is", " ", "hash", " ", "of", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "web_", "._", "Application_", "(_", "[_", "(_", "r", "\"/", "datast", "ore", "\"_", ",_", "\\u", "Datas", "tore", "Handler_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "async", "\\u", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test", "Datas", "tore_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "the", " ", "webse", "rver", " ", "handle", "s", " ", "datast", "ore", " ", "key", "/", "value", " ", "store", " ", "and", " ", "retrie", "val", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "insert", "ing", " ", "a", " ", "collection", " ", "of", " ", "random", " ", "values", " ", "and", " ", "verify", "ing", " ", "thei", "r", "\\", "10", ";", " ", " ", " ", " ", "retrie", "val", ",", " ", "in", " ", "parall", "el", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "self_", "._", "\\u", "Creat", "e", "Random", "Values_", "(_", "num", "\\u", "values_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Insert", "Done_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Retrieve", "Values_", "(_", "values_", ",_", "self_", "._", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "Insert", "Values_", "(_", "values_", ",_", "\\u", "Insert", "Done_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Creat", "e", "Random", "Values_", "(_", "self_", ",_", "num", "\\u", "values_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "num", "\\u", "values", " ", "random", " ", "integ", "ers", " ", "bet", "ween", " ", "[", "0", ",", " ", "1", "<<", "20", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "int_", "(_", "random_", "._", "uniform_", "(_", "0_", ",_", "1_", "<<_", "20_", ")_", ")_", "for_", "i_", "in_", "xrange_", "(_", "num", "\\u", "values_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Insert", "Values_", "(_", "self_", ",_", "values_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Insert", "s", " ", "values", " ", "int", "o", " ", "datast", "ore", " ", "via", " ", "the", " ", "torn", "ado", " ", "web", " ", "server", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "invoke", "s", " ", "callback", " ", "with", " ", "the", " ", "sequence", " ", "of", " ", "values", " ", "whe", "n", " ", "complete", ".", " ", "The", "\\", "10", ";", " ", " ", " ", " ", "values", " ", "are", " ", "random", "ly", " ", "distributed", " ", "over", " ", "the", " ", "avail", "able", " ", "shard", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "key", " ", "of", " ", "each", " ", "value", " ", "is", " ", "compute", "d", " ", "as", ":", " ", "'", "k", "%", "d", "'", " ", "%", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Verify", "Response_", "(_", "cb_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "body_", ",_", "'", "ok", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "util_", "._", "Barri", "er_", "(_", "callback_", ")_", "as_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "val_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "http", "\\u", "client_", "._", "fetch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "self_", "._", "get", "\\u", "url_", "(_", "'/", "datast", "ore", "'_", ")_", ",_", "method_", "=_", "'", "POST", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "'", "k", "=", "k", "%", "d", "&", "v", "=", "%", "d", "'_", "%_", "(_", "val_", ",_", "val_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "partial_", "(_", "\\u", "Verify", "Response_", ",_", "b_", "._", "Callback_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Handle", "r", "Test", "Case_", "(_", "Base", "Test", "Case_", ",_", "testing_", "._", "Async", "HTTP", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Retrieve", "Values_", "(_", "self_", ",_", "values_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", "s", " ", "and", " ", "verifie", "s", " ", "the", " ", "specified", " ", "values", " ", "from", " ", "Datas", "tore", " ", "databa", "se", "\\", "10", ";", " ", " ", " ", " ", "via", " ", "the", " ", "torn", "ado", " ", "web", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Verify", "Response_", "(_", "val_", ",_", "cb_", ",_", "resp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "body_", ",_", "repr_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "util_", "._", "Barri", "er_", "(_", "callback_", ")_", "as_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "val_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "http", "\\u", "client_", "._", "fetch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "self_", "._", "get", "\\u", "url_", "(_", "'/", "datast", "ore", "?", "k", "=", "k", "%", "d", "'_", "%_", "val_", ")_", ",_", "method_", "=_", "'", "GET", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "=_", "partial_", "(_", "\\u", "Verify", "Response_", ",_", "val_", ",_", "b_", "._", "Callback_", "(_", ")_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Incomplete URL substring sanitization
crypt3lx2k/Tripcode-Dictionary-Tools/tdt/core/classify.py
[ { "content": "def classify (url):\n \"\"\"\n Classifies an URL and returns the corresponding WebEntity derivative.\n \"\"\"\n original = url\n\n if isinstance (url, WebEntity):\n return url\n\n if not isinstance (url, str):\n raise TypeError ('%s not valid type for 4chan URL' % type(url))\n\n if url.startswith('/'):\n url = url.lstrip('/')\n\n if url.endswith('/'):\n url = url.rstrip('/')\n\n if not '4chan.org' in url:\n url = '{}://{}/{}'.format(Links.scheme, Links.netloc, url)\n\n if not (\n url.startswith ('http://') or\n url.startswith ('https://')\n ):\n url = '{}://{}'.format(Links.scheme, url)\n\n path = urlparse.urlparse(url).path\n\n match = Links.thread_pattern.match(path)\n if match:\n return Thread(*match.groups())\n\n match = Links.page_pattern.match(path)\n if match:\n return Page(*match.groups())\n\n match = Links.board_pattern.match(path)\n if match:\n return Board(*match.groups())\n\n raise ValueError ('invalid 4chan URL: %s' % repr(original))", "metadata": "root.classify", "header": "['module', '___EOS___']", "index": 8 } ]
[ { "span": "'4chan.org' in url:", "start_line": 26, "start_column": 11, "end_line": 26, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Incomp", "lete", "_", "URL_", "substring", "_", "sani", "ti", "zation_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "classify_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Classif", "ies", " ", "an", " ", "URL", " ", "and", " ", "return", "s", " ", "the", " ", "correspond", "ing", " ", "Web", "Entit", "y", " ", "deriv", "ative", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "url_", ",_", "Web", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "url_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'%", "s", " ", "not", " ", "valid", " ", "type", " ", "for", " ", "4c", "han", " ", "URL", "'_", "%_", "type_", "(_", "url_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "url_", "._", "startswith_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "url_", "._", "lstrip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "url_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "url_", "._", "rstrip_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "'", "4c", "han", ".", "org", "'_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'{}", "://{}", "/{}'_", "._", "format_", "(_", "Links_", "._", "scheme_", ",_", "Links_", "._", "netloc_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "._", "startswith_", "(_", "'", "http", "://'_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "._", "startswith_", "(_", "'", "https", "://'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'{}", "://{}", "'_", "._", "format_", "(_", "Links_", "._", "scheme_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "urlparse_", "._", "urlparse_", "(_", "url_", ")_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "match_", "=_", "Links_", "._", "thread", "\\u", "pattern_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Thread_", "(_", "*_", "match_", "._", "groups_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "Links_", "._", "page", "\\u", "pattern_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Page_", "(_", "*_", "match_", "._", "groups_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match_", "=_", "Links_", "._", "board", "\\u", "pattern_", "._", "match_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Board_", "(_", "*_", "match_", "._", "groups_", "(_", ")_", ")_", "\\u\\u\\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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Signature mismatch in overriding method
openstack/taskflow/taskflow/retry.py
[ { "content": "@six.add_metaclass(abc.ABCMeta)\nclass Retry(atom.Atom):\n \"\"\"A class that can decide how to resolve execution failures.\n\n This abstract base class is used to inherit from and provide different\n strategies that will be activated upon execution failures. Since a retry\n object is an atom it may also provide :meth:`~taskflow.retry.Retry.execute`\n and :meth:`~taskflow.retry.Retry.revert` methods to alter the inputs of\n connected atoms (depending on the desired strategy to be used this can be\n quite useful).\n\n NOTE(harlowja): the :meth:`~taskflow.retry.Retry.execute` and\n :meth:`~taskflow.retry.Retry.revert` and\n :meth:`~taskflow.retry.Retry.on_failure` will automatically be given\n a ``history`` parameter, which contains information about the past\n decisions and outcomes that have occurred (if available).\n \"\"\"\n\n\n\n\n\n", "metadata": "root.Retry", "header": "['module', '___EOS___']", "index": 138 }, { "content": " def __init__(self, name=None, provides=None, requires=None,\n auto_extract=True, rebind=None):\n super(Retry, self).__init__(name=name, provides=provides,\n requires=requires, rebind=rebind,\n auto_extract=auto_extract,\n ignore_list=[EXECUTE_REVERT_HISTORY])", "metadata": "root.Retry.__init__", "header": "['class', 'Retry', '(', 'atom', '.', 'Atom', ')', ':', '___EOS___']", "index": 156 }, { "content": " @property\n def name(self):\n return self._name", "metadata": "root.Retry.name", "header": "['class', 'Retry', '(', 'atom', '.', 'Atom', ')', ':', '___EOS___']", "index": 163 }, { "content": " @name.setter\n def name(self, name):\n self._name = name", "metadata": "root.Retry.name", "header": "['class', 'Retry', '(', 'atom', '.', 'Atom', ')', ':', '___EOS___']", "index": 167 }, { "content": " @abc.abstractmethod\n def execute(self, history, *args, **kwargs):\n \"\"\"Executes the given retry.\n\n This execution activates a given retry which will typically produce\n data required to start or restart a connected component using\n previously provided values and a ``history`` of prior failures from\n previous runs. The historical data can be analyzed to alter the\n resolution strategy that this retry controller will use.\n\n For example, a retry can provide the same values multiple times (after\n each run), the latest value or some other variation. Old values will be\n saved to the history of the retry atom automatically, that is a list of\n tuples (result, failures) are persisted where failures is a dictionary\n of failures indexed by task names and the result is the execution\n result returned by this retry during that failure resolution\n attempt.\n\n :param args: positional arguments that retry requires to execute.\n :param kwargs: any keyword arguments that retry requires to execute.\n \"\"\"", "metadata": "root.Retry.execute", "header": "['class', 'Retry', '(', 'atom', '.', 'Atom', ')', ':', '___EOS___']", "index": 171 }, { "content": " def revert(self, history, *args, **kwargs):\n \"\"\"Reverts this retry.\n\n On revert call all results that had been provided by previous tries\n and all errors caused during reversion are provided. This method\n will be called *only* if a subflow must be reverted without the\n retry (that is to say that the controller has ran out of resolution\n options and has either given up resolution or has failed to handle\n a execution failure).\n\n :param args: positional arguments that the retry required to execute.\n :param kwargs: any keyword arguments that the retry required to\n execute.\n \"\"\"", "metadata": "root.Retry.revert", "header": "['class', 'Retry', '(', 'atom', '.', 'Atom', ')', ':', '___EOS___']", "index": 193 }, { "content": " @abc.abstractmethod\n def on_failure(self, history, *args, **kwargs):\n \"\"\"Makes a decision about the future.\n\n This method will typically use information about prior failures (if\n this historical failure information is not available or was not\n persisted the provided history will be empty).\n\n Returns a retry constant (one of):\n\n * ``RETRY``: when the controlling flow must be reverted and restarted\n again (for example with new parameters).\n * ``REVERT``: when this controlling flow must be completely reverted\n and the parent flow (if any) should make a decision about further\n flow execution.\n * ``REVERT_ALL``: when this controlling flow and the parent\n flow (if any) must be reverted and marked as a ``FAILURE``.\n \"\"\"", "metadata": "root.Retry.on_failure", "header": "['class', 'Retry', '(', 'atom', '.', 'Atom', ')', ':', '___EOS___']", "index": 208 }, { "content": "class AlwaysRevertAll(Retry):\n \"\"\"Retry that always reverts a whole flow.\"\"\"\n\n", "metadata": "root.AlwaysRevertAll", "header": "['module', '___EOS___']", "index": 238 }, { "content": " def on_failure(self, **kwargs):\n return REVERT_ALL", "metadata": "root.AlwaysRevertAll.on_failure", "header": "['class', 'AlwaysRevertAll', '(', 'Retry', ')', ':', '___EOS___']", "index": 241 }, { "content": " def execute(self, **kwargs):\n pass", "metadata": "root.AlwaysRevertAll.execute", "header": "['class', 'AlwaysRevertAll', '(', 'Retry', ')', ':', '___EOS___']", "index": 244 } ]
[ { "span": "def on_failure(self, **kwargs):", "start_line": 241, "start_column": 4, "end_line": 241, "end_column": 35 }, { "span": "def execute(self, **kwargs):", "start_line": 244, "start_column": 4, "end_line": 244, "end_column": 32 } ]
[ { "span": "def execute(self, history, *args, **kwargs):", "start_line": 172, "start_column": 4, "end_line": 172, "end_column": 48 }, { "span": "def on_failure(self, history, *args, **kwargs):", "start_line": 209, "start_column": 4, "end_line": 209, "end_column": 51 } ]
1
false
[ "[CLS]_", "Signature_", "mismatch_", "in_", "overrid", "ing_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "abc_", "._", "ABC", "Meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "class", " ", "tha", "t", " ", "can", " ", "decide", " ", "how", " ", "to", " ", "resolve", " ", "executi", "on", " ", "fail", "ure", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "abstract", " ", "base", " ", "class", " ", "is", " ", "used", " ", "to", " ", "inherit", " ", "from", " ", "and", " ", "provide", " ", "different", "\\", "10", ";", " ", " ", " ", " ", "strategi", "es", " ", "tha", "t", " ", "will", " ", "be", " ", "activat", "ed", " ", "upo", "n", " ", "executi", "on", " ", "fail", "ure", "s", ".", " ", "Sin", "ce", " ", "a", " ", "retr", "y", "\\", "10", ";", " ", " ", " ", " ", "object", " ", "is", " ", "an", " ", "atom", " ", "it", " ", "may", " ", "als", "o", " ", "provide", " ", ":", "meth", ":`", "~", "task", "flow", ".", "retr", "y", ".", "Retr", "y", ".", "execute", "`", "\\", "10", ";", " ", " ", " ", " ", "and", " ", ":", "meth", ":`", "~", "task", "flow", ".", "retr", "y", ".", "Retr", "y", ".", "revert", "`", " ", "method", "s", " ", "to", " ", "alter", " ", "the", " ", "inputs", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "connect", "ed", " ", "atom", "s", " ", "(", "depend", "ing", " ", "on", " ", "the", " ", "desi", "red", " ", "strat", "eg", "y", " ", "to", " ", "be", " ", "used", " ", "this", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "quite", " ", "usef", "ul", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "NOTE", "(", "har", "low", "ja", "):", " ", "the", " ", ":", "meth", ":`", "~", "task", "flow", ".", "retr", "y", ".", "Retr", "y", ".", "execute", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "task", "flow", ".", "retr", "y", ".", "Retr", "y", ".", "revert", "`", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "meth", ":`", "~", "task", "flow", ".", "retr", "y", ".", "Retr", "y", ".", "on", "\\u", "fail", "ure", "`", " ", "will", " ", "automati", "call", "y", " ", "be", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "``", "histo", "ry", "``", " ", "parameter", ",", " ", "whi", "ch", " ", "contain", "s", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "past", "\\", "10", ";", " ", " ", " ", " ", "decision", "s", " ", "and", " ", "outcomes", " ", "tha", "t", " ", "have", " ", "occur", "red", " ", "(", "if", " ", "avail", "able", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "provides_", "=_", "None_", ",_", "requires_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "extract_", "=_", "True_", ",_", "rebin", "d_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Retry_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", "=_", "name_", ",_", "provides_", "=_", "provides_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "requires_", "=_", "requires_", ",_", "rebin", "d_", "=_", "rebin", "d_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auto", "\\u", "extract_", "=_", "auto", "\\u", "extract_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ignore", "\\u", "list_", "=_", "[_", "EXECUTE", "\\u", "REV", "ERT", "\\u", "HISTORY", "_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "name_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "name_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "history_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "es", " ", "the", " ", "give", "n", " ", "retr", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "executi", "on", " ", "activat", "es", " ", "a", " ", "give", "n", " ", "retr", "y", " ", "whi", "ch", " ", "will", " ", "typical", "ly", " ", "produce", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "require", "d", " ", "to", " ", "start", " ", "or", " ", "restart", " ", "a", " ", "connect", "ed", " ", "component", " ", "usi", "ng", "\\", "10", ";", " ", " ", " ", " ", "previ", "ously", " ", "provided", " ", "values", " ", "and", " ", "a", " ", "``", "histo", "ry", "``", " ", "of", " ", "prior", " ", "fail", "ure", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "previ", "ous", " ", "runs", ".", " ", "The", " ", "historical", " ", "data", " ", "can", " ", "be", " ", "analyze", "d", " ", "to", " ", "alter", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "resolu", "tion", " ", "strat", "eg", "y", " ", "tha", "t", " ", "this", " ", "retr", "y", " ", "controlle", "r", " ", "will", " ", "use", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "a", " ", "retr", "y", " ", "can", " ", "provide", " ", "the", " ", "same", " ", "values", " ", "multiple", " ", "times", " ", "(", "after", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "run", "),", " ", "the", " ", "late", "st", " ", "value", " ", "or", " ", "some", " ", "other", " ", "variatio", "n", ".", " ", "Old", " ", "values", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "saved", " ", "to", " ", "the", " ", "histo", "ry", " ", "of", " ", "the", " ", "retr", "y", " ", "atom", " ", "automati", "call", "y", ",", " ", "tha", "t", " ", "is", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "tuple", "s", " ", "(", "result", ",", " ", "fail", "ure", "s", ")", " ", "are", " ", "persiste", "d", " ", "where", " ", "fail", "ure", "s", " ", "is", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "fail", "ure", "s", " ", "indexe", "d", " ", "by", " ", "task", " ", "names", " ", "and", " ", "the", " ", "result", " ", "is", " ", "the", " ", "executi", "on", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "return", "ed", " ", "by", " ", "this", " ", "retr", "y", " ", "dur", "ing", " ", "tha", "t", " ", "fail", "ure", " ", "resolu", "tion", "\\", "10", ";", " ", " ", " ", " ", "atte", "mpt", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "positional", " ", "argu", "ment", "s", " ", "tha", "t", " ", "retr", "y", " ", "require", "s", " ", "to", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "kwarg", "s", ":", " ", "any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "tha", "t", " ", "retr", "y", " ", "require", "s", " ", "to", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "revert", "_", "(_", "self_", ",_", "history_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Rever", "ts", " ", "this", " ", "retr", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", " ", "revert", " ", "call", " ", "all", " ", "results", " ", "tha", "t", " ", "had", " ", "bee", "n", " ", "provided", " ", "by", " ", "previ", "ous", " ", "trie", "s", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "all", " ", "error", "s", " ", "caus", "ed", " ", "dur", "ing", " ", "reversi", "on", " ", "are", " ", "provided", ".", " ", "Thi", "s", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "call", "ed", " ", "*", "only", "*", " ", "if", " ", "a", " ", "subf", "low", " ", "must", " ", "be", " ", "revert", "ed", " ", "with", "out", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "retr", "y", " ", "(", "tha", "t", " ", "is", " ", "to", " ", "say", " ", "tha", "t", " ", "the", " ", "controlle", "r", " ", "has", " ", "ran", " ", "out", " ", "of", " ", "resolu", "tion", "\\", "10", ";", " ", " ", " ", " ", "options", " ", "and", " ", "has", " ", "eit", "her", " ", "give", "n", " ", "up", " ", "resolu", "tion", " ", "or", " ", "has", " ", "fail", "ed", " ", "to", " ", "handle", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "executi", "on", " ", "fail", "ure", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "args", ":", " ", "positional", " ", "argu", "ment", "s", " ", "tha", "t", " ", "the", " ", "retr", "y", " ", "require", "d", " ", "to", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "kwarg", "s", ":", " ", "any", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "tha", "t", " ", "the", " ", "retr", "y", " ", "require", "d", " ", "to", "\\", "10", ";", " ", " ", " ", " ", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Retry_", "(_", "atom_", "._", "Atom_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "on", "\\u", "failure_", "(_", "self_", ",_", "history_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "a", " ", "decision", " ", "abo", "ut", " ", "the", " ", "future", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "will", " ", "typical", "ly", " ", "use", " ", "informati", "on", " ", "abo", "ut", " ", "prior", " ", "fail", "ure", "s", " ", "(", "if", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "historical", " ", "fail", "ure", " ", "informati", "on", " ", "is", " ", "not", " ", "avail", "able", " ", "or", " ", "was", " ", "not", "\\", "10", ";", " ", " ", " ", " ", "persiste", "d", " ", "the", " ", "provided", " ", "histo", "ry", " ", "will", " ", "be", " ", "empty", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "retr", "y", " ", "constant", " ", "(", "one", " ", "of", "):", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "RETRY", "``", ":", " ", "whe", "n", " ", "the", " ", "controll", "ing", " ", "flow", " ", "must", " ", "be", " ", "revert", "ed", " ", "and", " ", "restart", "ed", "\\", "10", ";", " ", " ", "again", " ", "(", "for", " ", "example", " ", "with", " ", "new", " ", "parameter", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "REV", "ERT", "``", ":", " ", "whe", "n", " ", "this", " ", "controll", "ing", " ", "flow", " ", "must", " ", "be", " ", "complete", "ly", " ", "revert", "ed", "\\", "10", ";", " ", " ", "and", " ", "the", " ", "parent", " ", "flow", " ", "(", "if", " ", "any", ")", " ", "shou", "ld", " ", "make", " ", "a", " ", "decision", " ", "abo", "ut", " ", "fur", "ther", "\\", "10", ";", " ", " ", "flow", " ", "executi", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "``", "REV", "ERT", "\\u", "ALL", "``", ":", " ", "whe", "n", " ", "this", " ", "controll", "ing", " ", "flow", " ", "and", " ", "the", " ", "parent", "\\", "10", ";", " ", " ", "flow", " ", "(", "if", " ", "any", ")", " ", "must", " ", "be", " ", "revert", "ed", " ", "and", " ", "marked", " ", "as", " ", "a", " ", "``", "FAIL", "URE", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Al", "way", "s", "Rever", "t", "All_", "(_", "Retry_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retr", "y", " ", "tha", "t", " ", "alw", "ay", "s", " ", "revert", "s", " ", "a", " ", "whole", " ", "flow", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Al", "way", "s", "Rever", "t", "All_", "(_", "Retry_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "on", "\\u", "failure_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "REV", "ERT", "\\u", "ALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Al", "way", "s", "Rever", "t", "All_", "(_", "Retry_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2 ]
Unused import
redapple/sql2graph/example-export.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright 2013 Paul Tremberth, Newlynn Labs\n# See LICENSE for details.\n\nimport optparse\nimport ConfigParser\nimport os\nimport sys\nimport traceback\nimport csv\nimport sql2graph.export\nfrom sql2graph.schema import Field, IntField, Relation, Reference, Column, Entity, Property\n\n# ----------------------------------------------------------------------\n\nSCHEMA = (\n Entity('car',\n fields = [\n IntField('pk', Column('id'), primary_key=True, index='cars'),\n Field('name', Column('name'), index='cars'),\n Field('begin', Column('begin'), index='cars'),\n Field('end', Column('end'), index='cars'),\n ],\n relations = [\n Relation(Reference('car', 'id'),\n Reference('manufacturer', 'manufacturer'),\n [Property('rel_type', 'makes/made')])\n ]\n ),\n Entity('manufacturer',\n fields = [\n IntField('pk', Column('id'), primary_key=True, index='manufacturers'),\n Field('name', Column('name'), index='manufacturers'),\n ],\n )\n)\n\nDEFAULT_NODES_FILE = 'nodes.csv'\nDEFAULT_RELATIONS_FILE = 'relations.csv'\n\n\n\nif __name__ == '__main__':\n main()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n\n option_parser = optparse.OptionParser()\n option_parser.add_option(\"-c\", \"--config\", dest=\"configfile\", help=\"configuration file\", default=None)\n option_parser.add_option(\"-p\", \"--pretend\", action=\"store_true\", dest=\"pretend\", help=\"just pretend; do not write anthing\", default=False)\n option_parser.add_option(\"-N\", \"--nodes\", dest=\"nodes_file\", help=\"Nodes file\", default=None)\n option_parser.add_option(\"-R\", \"--relations\", dest=\"relations_file\", help=\"Relations file\", default=None)\n (options, args) = option_parser.parse_args()\n\n config_parser = ConfigParser.RawConfigParser()\n if options.configfile:\n config_parser.read(options.configfile)\n else:\n print \"you must provide a config file\"\n sys.exit(0)\n\n if config_parser.has_section('TABLE_DUMPS'):\n dump_tables = dict((\n (entity, dump_file)\n for entity, dump_file in config_parser.items('TABLE_DUMPS')\n ))\n else:\n print \"no TABLE_DUMPS section\"\n raise SystemExit\n\n\n if config_parser.has_option('IMPORT_ORDER', 'order'):\n entity_order = [entity.strip()\n for entity in config_parser.get('IMPORT_ORDER', 'order').split(',')]\n else:\n print \"no IMPORT_ORDER/order\"\n raise SystemExit\n\n if config_parser.has_section('INDEX_FILES'):\n index_files = dict((\n (index_name, index_file)\n for index_name, index_file in config_parser.items('INDEX_FILES')\n ))\n else:\n print \"no INDEX_FILES section\"\n index_files = None\n\n\n # check if all dump files exist\n for entity in entity_order:\n if dump_tables.get(entity):\n if not os.path.isfile(dump_tables.get(entity)):\n print \"file %s does not exist\" % dump_tables.get(entity)\n raise RuntimeError\n\n # For TAB-delimited CSV files, use dialect=csv.excel_tab\n # In this cars example, the CSV files use commas\n exporter = sql2graph.export.GraphExporter(\n schema=SCHEMA, format='neo4j', dialect=csv.excel)\n\n exporter.set_output_nodes_file(\n entity=sql2graph.export.MERGED,\n filename=options.nodes_file or DEFAULT_NODES_FILE)\n\n exporter.set_output_relations_file(\n entity=sql2graph.export.MERGED,\n filename=options.relations_file or DEFAULT_RELATIONS_FILE)\n\n for index_name, index_file in index_files.iteritems():\n exporter.set_output_indexes_file(entity=index_name, filename=index_file)\n\n for entity_name in entity_order:\n if dump_tables.get(entity):\n exporter.feed_dumpfile(entity=entity_name, filename=dump_tables.get(entity_name))\n\n exporter.run()", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 41 } ]
[ { "span": "import traceback", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", "Paul", " ", "Tre", "mber", "th", ",", " ", "New", "ly", "nn", " ", "Lab", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Config", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sql", "2g", "raph_", "._", "export_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sql", "2g", "raph_", "._", "schema_", "import_", "Field_", ",_", "Int", "Field_", ",_", "Relation_", ",_", "Reference_", ",_", "Column_", ",_", "Entity_", ",_", "Property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SCHEMA_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Entity_", "(_", "'", "car", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Int", "Field_", "(_", "'", "pk", "'_", ",_", "Column_", "(_", "'", "id", "'_", ")_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "index_", "=_", "'", "cars", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "name", "'_", ",_", "Column_", "(_", "'", "name", "'_", ")_", ",_", "index_", "=_", "'", "cars", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "begin", "'_", ",_", "Column_", "(_", "'", "begin", "'_", ")_", ",_", "index_", "=_", "'", "cars", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "end", "'_", ",_", "Column_", "(_", "'", "end", "'_", ")_", ",_", "index_", "=_", "'", "cars", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Relation_", "(_", "Reference_", "(_", "'", "car", "'_", ",_", "'", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Reference_", "(_", "'", "manufactur", "er", "'_", ",_", "'", "manufactur", "er", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "Property_", "(_", "'", "rel", "\\u", "type", "'_", ",_", "'", "make", "s", "/", "made", "'_", ")_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Entity_", "(_", "'", "manufactur", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Int", "Field_", "(_", "'", "pk", "'_", ",_", "Column_", "(_", "'", "id", "'_", ")_", ",_", "primary", "\\u", "key_", "=_", "True_", ",_", "index_", "=_", "'", "manufactur", "ers", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field_", "(_", "'", "name", "'_", ",_", "Column_", "(_", "'", "name", "'_", ")_", ",_", "index_", "=_", "'", "manufactur", "ers", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "NODES", "\\u", "FILE_", "=_", "'", "nodes", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "RELATION", "S", "\\u", "FILE_", "=_", "'", "relation", "s", ".", "csv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option", "\\u", "parser_", "=_", "optparse_", "._", "Optio", "n", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "c", "\"_", ",_", "\"--", "config", "\"_", ",_", "dest_", "=_", "\"", "configf", "ile", "\"_", ",_", "help_", "=_", "\"", "configura", "tion", " ", "file", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "p", "\"_", ",_", "\"--", "prete", "nd", "\"_", ",_", "action_", "=_", "\"", "store", "\\u", "true", "\"_", ",_", "dest_", "=_", "\"", "prete", "nd", "\"_", ",_", "help_", "=_", "\"", "just", " ", "prete", "nd", ";", " ", "do", " ", "not", " ", "write", " ", "ant", "hing", "\"_", ",_", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "N", "\"_", ",_", "\"--", "nodes", "\"_", ",_", "dest_", "=_", "\"", "nodes", "\\u", "file", "\"_", ",_", "help_", "=_", "\"", "Node", "s", " ", "file", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "parser_", "._", "add", "\\u", "option_", "(_", "\"-", "R", "\"_", ",_", "\"--", "relation", "s", "\"_", ",_", "dest_", "=_", "\"", "relation", "s", "\\u", "file", "\"_", ",_", "help_", "=_", "\"", "Relation", "s", " ", "file", "\"_", ",_", "default_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "options_", ",_", "args_", ")_", "=_", "option", "\\u", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "parser_", "=_", "Config", "Parser_", "._", "Ra", "w", "Config", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "options_", "._", "configfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "parser_", "._", "read_", "(_", "options_", "._", "configfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "you", " ", "must", " ", "provide", " ", "a", " ", "config", " ", "file", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config", "\\u", "parser_", "._", "has", "\\u", "section_", "(_", "'", "TAB", "LE", "\\u", "DUMP", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dump", "\\u", "tables_", "=_", "dict_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "entity_", ",_", "dump", "\\u", "file_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "entity_", ",_", "dump", "\\u", "file_", "in_", "config", "\\u", "parser_", "._", "items_", "(_", "'", "TAB", "LE", "\\u", "DUMP", "S", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "no", " ", "TAB", "LE", "\\u", "DUMP", "S", " ", "section", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "System", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config", "\\u", "parser_", "._", "has", "\\u", "option_", "(_", "'", "IMPORT", "\\u", "ORDE", "R", "'_", ",_", "'", "order", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity", "\\u", "order_", "=_", "[_", "entity_", "._", "strip_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "entity_", "in_", "config", "\\u", "parser_", "._", "get_", "(_", "'", "IMPORT", "\\u", "ORDE", "R", "'_", ",_", "'", "order", "'_", ")_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "no", " ", "IMPORT", "\\u", "ORDE", "R", "/", "order", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "System", "Exit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config", "\\u", "parser_", "._", "has", "\\u", "section_", "(_", "'", "INDE", "X", "\\u", "FILE", "S", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "files_", "=_", "dict_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "index", "\\u", "name_", ",_", "index", "\\u", "file_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index", "\\u", "name_", ",_", "index", "\\u", "file_", "in_", "config", "\\u", "parser_", "._", "items_", "(_", "'", "INDE", "X", "\\u", "FILE", "S", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "no", " ", "INDE", "X", "\\u", "FILE", "S", " ", "section", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index", "\\u", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "all", " ", "dump", " ", "files", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "entity_", "in_", "entity", "\\u", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dump", "\\u", "tables_", "._", "get_", "(_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "dump", "\\u", "tables_", "._", "get_", "(_", "entity_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "file", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "exist", "\"_", "%_", "dump", "\\u", "tables_", "._", "get_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "TAB", "-", "delim", "ited", " ", "CSV", " ", "files", ",", " ", "use", " ", "dialect", "=", "csv", ".", "exce", "l\\u", "tab_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "this", " ", "cars", " ", "example", ",", " ", "the", " ", "CSV", " ", "files", " ", "use", " ", "commas", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exporter_", "=_", "sql", "2g", "raph_", "._", "export_", "._", "Graph", "Exporter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "schema_", "=_", "SCHEMA_", ",_", "format_", "=_", "'", "neo", "4j", "'_", ",_", "dialect_", "=_", "csv_", "._", "excel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exporter_", "._", "set\\u", "output", "\\u", "nodes", "\\u", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "sql", "2g", "raph_", "._", "export_", "._", "MERGE", "D_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "options_", "._", "nodes", "\\u", "file_", "or_", "DEF", "AUL", "T", "\\u", "NODES", "\\u", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exporter_", "._", "set\\u", "output", "\\u", "relation", "s", "\\u", "file_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "entity_", "=_", "sql", "2g", "raph_", "._", "export_", "._", "MERGE", "D_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "options_", "._", "relation", "s", "\\u", "file_", "or_", "DEF", "AUL", "T", "\\u", "RELATION", "S", "\\u", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index", "\\u", "name_", ",_", "index", "\\u", "file_", "in_", "index", "\\u", "files_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "._", "set\\u", "output", "\\u", "indexe", "s", "\\u", "file_", "(_", "entity_", "=_", "index", "\\u", "name_", ",_", "filename_", "=_", "index", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "entity", "\\u", "name_", "in_", "entity", "\\u", "order_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dump", "\\u", "tables_", "._", "get_", "(_", "entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exporter_", "._", "feed", "\\u", "dump", "file_", "(_", "entity_", "=_", "entity", "\\u", "name_", ",_", "filename_", "=_", "dump", "\\u", "tables_", "._", "get_", "(_", "entity", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exporter_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
impactlab/eemeter/tests/test_meter_library.py
[ { "content": "from eemeter.config.yaml_parser import load\nfrom eemeter.meter import DataCollection\n\nfrom eemeter.consumption import ConsumptionData\nfrom eemeter.evaluation import Period\nfrom eemeter.location import Location\nfrom eemeter.project import Project\n\nfrom eemeter.meter import TimeSpanMeter\nfrom eemeter.meter import TotalHDDMeter\nfrom eemeter.meter import TotalCDDMeter\nfrom eemeter.meter import NormalAnnualHDD\nfrom eemeter.meter import NormalAnnualCDD\nfrom eemeter.meter import NPeriodsMeetingHDDPerDayThreshold\nfrom eemeter.meter import NPeriodsMeetingCDDPerDayThreshold\nfrom eemeter.meter import RecentReadingMeter\nfrom eemeter.meter import GrossSavingsMeter\nfrom eemeter.meter import AnnualizedGrossSavingsMeter\nfrom eemeter.meter import AverageDailyUsage\nfrom eemeter.meter import EstimatedAverageDailyUsage\nfrom eemeter.meter import ConsumptionDataAttributes\nfrom eemeter.meter import ProjectAttributes\nfrom eemeter.meter import ProjectConsumptionDataBaselineReporting\nfrom eemeter.meter import ProjectFuelTypes\n\nfrom eemeter.models import AverageDailyTemperatureSensitivityModel\n\nfrom fixtures.weather import gsod_722880_2012_2014_weather_source\nfrom fixtures.weather import tmy3_722880_weather_source\n\nfrom fixtures.consumption import consumption_generator_1\nfrom fixtures.consumption import consumption_generator_2\nfrom fixtures.consumption import generated_consumption_data_1\nfrom fixtures.consumption import generated_consumption_data_2\nfrom fixtures.consumption import generated_consumption_data_pre_post_1\nfrom fixtures.consumption import generated_consumption_data_with_annualized_usage_1\nfrom fixtures.consumption import generated_consumption_data_pre_post_with_gross_savings_1\nfrom fixtures.consumption import generated_consumption_data_pre_post_with_annualized_gross_savings_1\nfrom fixtures.consumption import consumption_data_1\nfrom fixtures.consumption import time_span_1\nfrom fixtures.consumption import generated_consumption_data_with_hdd_1\nfrom fixtures.consumption import generated_consumption_data_with_cdd_1\nfrom fixtures.consumption import generated_consumption_data_with_n_periods_hdd_1\nfrom fixtures.consumption import generated_consumption_data_with_n_periods_cdd_1\n\nfrom datetime import datetime\nfrom datetime import timedelta\nimport pytz\n\nfrom numpy.testing import assert_allclose\nimport numpy as np\n\nRTOL = 1e-2\nATOL = 1e-2\n\nimport pytest\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@pytest.mark.slow\ndef test_temperature_sensitivity_parameter_optimization(\n generated_consumption_data_1, gsod_722880_2012_2014_weather_source):\n\n meter_yaml = \"\"\"\n !obj:eemeter.meter.TemperatureSensitivityParameterOptimizationMeter {\n temperature_unit_str: \"degF\",\n model: !obj:eemeter.models.AverageDailyTemperatureSensitivityModel {\n cooling: True,\n heating: True,\n initial_params: {\n base_daily_consumption: 0,\n heating_slope: 0,\n cooling_slope: 0,\n heating_balance_temperature: 60,\n cooling_balance_temperature: 70,\n },\n param_bounds: {\n base_daily_consumption: [0,2000],\n heating_slope: [0,200],\n cooling_slope: [0,200],\n heating_balance_temperature: [55,65],\n cooling_balance_temperature: [65,75],\n },\n },\n input_mapping: {\n \"consumption_data\": {},\n \"weather_source\": {},\n \"energy_unit_str\": {},\n },\n output_mapping: {\n \"temp_sensitivity_params\": {},\n \"n_days\": {},\n \"average_daily_usages\": {},\n \"estimated_average_daily_usages\": {},\n },\n }\n \"\"\"\n meter = load(meter_yaml)\n\n cd, params = generated_consumption_data_1\n\n data_collection = DataCollection(\n consumption_data=cd,\n weather_source=gsod_722880_2012_2014_weather_source,\n energy_unit_str=\"kWh\")\n\n result = meter.evaluate(data_collection)\n\n assert_allclose(result.get_data('temp_sensitivity_params').value.to_list(), params.to_list(),\n rtol=RTOL, atol=ATOL)\n assert result.get_data('n_days') is not None\n assert result.get_data('average_daily_usages') is not None\n assert result.get_data('estimated_average_daily_usages') is not None", "metadata": "root.test_temperature_sensitivity_parameter_optimization", "header": "['module', '___EOS___']", "index": 57 }, { "content": "@pytest.mark.slow\ndef test_annualized_usage_meter(\n generated_consumption_data_with_annualized_usage_1,\n gsod_722880_2012_2014_weather_source, tmy3_722880_weather_source):\n\n meter_yaml = \"\"\"\n !obj:eemeter.meter.Sequence {\n sequence: [\n !obj:eemeter.meter.TemperatureSensitivityParameterOptimizationMeter {\n temperature_unit_str: \"degF\",\n model: !obj:eemeter.models.AverageDailyTemperatureSensitivityModel &model {\n cooling: True,\n heating: True,\n initial_params: {\n base_daily_consumption: 0,\n heating_slope: 0,\n cooling_slope: 0,\n heating_balance_temperature: 60,\n cooling_balance_temperature: 70,\n },\n param_bounds: {\n base_daily_consumption: [0,2000],\n heating_slope: [0,200],\n cooling_slope: [0,200],\n heating_balance_temperature: [55,65],\n cooling_balance_temperature: [65,75],\n },\n },\n input_mapping: {\n consumption_data: {},\n weather_source: {},\n energy_unit_str: {},\n },\n output_mapping: {\n temp_sensitivity_params: {name: model_params},\n },\n },\n !obj:eemeter.meter.AnnualizedUsageMeter {\n temperature_unit_str: \"degF\",\n model: *model,\n input_mapping: {\n model_params: {},\n weather_normal_source: {},\n },\n output_mapping: {\n annualized_usage: {},\n },\n }\n ]\n }\n \"\"\"\n meter = load(meter_yaml)\n\n cd, params, annualized_usage = \\\n generated_consumption_data_with_annualized_usage_1\n\n data_collection = DataCollection(\n consumption_data=cd,\n weather_source=gsod_722880_2012_2014_weather_source,\n weather_normal_source=tmy3_722880_weather_source,\n energy_unit_str=\"kWh\")\n result = meter.evaluate(data_collection)\n\n assert_allclose(result.get_data('model_params').value.to_list(), params.to_list(),\n rtol=RTOL, atol=ATOL)\n assert_allclose(result.get_data('annualized_usage').value,\n annualized_usage, rtol=RTOL, atol=ATOL)", "metadata": "root.test_annualized_usage_meter", "header": "['module', '___EOS___']", "index": 113 }, { "content": "@pytest.mark.slow\ndef test_gross_savings_metric(generated_consumption_data_pre_post_with_gross_savings_1,\n gsod_722880_2012_2014_weather_source):\n\n model = AverageDailyTemperatureSensitivityModel(heating=True, cooling=True)\n meter = GrossSavingsMeter(temperature_unit_str=\"degF\", model=model)\n\n cd, params_pre, params_post, retrofit_date, savings = \\\n generated_consumption_data_pre_post_with_gross_savings_1\n\n reporting_period = Period(retrofit_date, datetime(2015,1,1))\n\n\n result = meter.evaluate_raw(\n consumption_data_reporting=cd.filter_by_period(reporting_period),\n model_params_baseline=params_pre,\n weather_source=gsod_722880_2012_2014_weather_source,\n energy_unit_str=\"kWh\")\n\n assert_allclose(result[\"gross_savings\"], savings,\n rtol=RTOL, atol=ATOL)", "metadata": "root.test_gross_savings_metric", "header": "['module', '___EOS___']", "index": 181 }, { "content": "@pytest.mark.slow\ndef test_annualized_gross_savings_metric(\n generated_consumption_data_pre_post_with_annualized_gross_savings_1,\n gsod_722880_2012_2014_weather_source, tmy3_722880_weather_source):\n\n model = AverageDailyTemperatureSensitivityModel(heating=True, cooling=True)\n meter = AnnualizedGrossSavingsMeter(temperature_unit_str=\"degF\", model=model)\n\n cd, params_pre, params_post, retrofit_date, savings = \\\n generated_consumption_data_pre_post_with_annualized_gross_savings_1\n\n reporting_period = Period(retrofit_date, datetime(2015,1,1))\n\n result = meter.evaluate_raw(\n model_params_baseline=params_pre,\n model_params_reporting=params_post,\n consumption_data_reporting=cd.filter_by_period(reporting_period),\n weather_normal_source=tmy3_722880_weather_source,\n energy_unit_str=\"kWh\")\n\n assert_allclose(result[\"annualized_gross_savings\"], savings,\n rtol=RTOL, atol=ATOL)", "metadata": "root.test_annualized_gross_savings_metric", "header": "['module', '___EOS___']", "index": 203 }, { "content": "def test_time_span_meter(time_span_1):\n cd, n_days = time_span_1\n meter = TimeSpanMeter()\n assert n_days == meter.evaluate_raw(consumption_data=cd)[\"time_span\"]", "metadata": "root.test_time_span_meter", "header": "['module', '___EOS___']", "index": 226 }, { "content": "def test_total_hdd_meter(generated_consumption_data_with_hdd_1,gsod_722880_2012_2014_weather_source):\n cd, hdd, base, temp_unit = generated_consumption_data_with_hdd_1\n meter = TotalHDDMeter(base=base,temperature_unit_str=temp_unit)\n result = meter.evaluate_raw(consumption_data=cd,\n weather_source=gsod_722880_2012_2014_weather_source)\n assert_allclose(hdd,result[\"total_hdd\"],rtol=RTOL,atol=ATOL)", "metadata": "root.test_total_hdd_meter", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def test_total_cdd_meter(generated_consumption_data_with_cdd_1,gsod_722880_2012_2014_weather_source):\n cd, cdd, base, temp_unit = generated_consumption_data_with_cdd_1\n meter = TotalCDDMeter(base=base,temperature_unit_str=temp_unit)\n result = meter.evaluate_raw(consumption_data=cd,\n weather_source=gsod_722880_2012_2014_weather_source)\n assert_allclose(cdd,result[\"total_cdd\"],rtol=RTOL,atol=ATOL)", "metadata": "root.test_total_cdd_meter", "header": "['module', '___EOS___']", "index": 238 }, { "content": "def test_normal_annual_hdd(tmy3_722880_weather_source):\n meter = NormalAnnualHDD(base=65,temperature_unit_str=\"degF\")\n result = meter.evaluate_raw(weather_normal_source=tmy3_722880_weather_source)\n assert_allclose(result[\"normal_annual_hdd\"],1578.588175669573,rtol=RTOL,atol=ATOL)", "metadata": "root.test_normal_annual_hdd", "header": "['module', '___EOS___']", "index": 245 }, { "content": "def test_normal_annual_cdd(tmy3_722880_weather_source):\n meter = NormalAnnualCDD(base=65,temperature_unit_str=\"degF\")\n result = meter.evaluate_raw(weather_normal_source=tmy3_722880_weather_source)\n assert_allclose(result[\"normal_annual_cdd\"],1248.4575607999941,rtol=RTOL,atol=ATOL)", "metadata": "root.test_normal_annual_cdd", "header": "['module', '___EOS___']", "index": 250 }, { "content": "def test_n_periods_meeting_hdd_per_day_threshold(generated_consumption_data_with_n_periods_hdd_1,gsod_722880_2012_2014_weather_source):\n cd, n_periods_lt, n_periods_gt, hdd = generated_consumption_data_with_n_periods_hdd_1\n meter_lt = NPeriodsMeetingHDDPerDayThreshold(base=65,temperature_unit_str=\"degF\",operation=\"<\")\n meter_gt = NPeriodsMeetingHDDPerDayThreshold(base=65,temperature_unit_str=\"degF\",operation=\">\")\n result_lt = meter_lt.evaluate_raw(consumption_data=cd,\n hdd=hdd,\n weather_source=gsod_722880_2012_2014_weather_source)\n result_gt = meter_gt.evaluate_raw(consumption_data=cd,\n hdd=hdd,\n weather_source=gsod_722880_2012_2014_weather_source)\n assert n_periods_lt == result_lt[\"n_periods\"]\n assert n_periods_gt == result_gt[\"n_periods\"]", "metadata": "root.test_n_periods_meeting_hdd_per_day_threshold", "header": "['module', '___EOS___']", "index": 255 }, { "content": "def test_n_periods_meeting_cdd_per_day_threshold(generated_consumption_data_with_n_periods_cdd_1,gsod_722880_2012_2014_weather_source):\n cd, n_periods_lt, n_periods_gt, cdd = generated_consumption_data_with_n_periods_cdd_1\n meter_lt = NPeriodsMeetingCDDPerDayThreshold(base=65,temperature_unit_str=\"degF\",operation=\"<\")\n meter_gt = NPeriodsMeetingCDDPerDayThreshold(base=65,temperature_unit_str=\"degF\",operation=\">\")\n result_lt = meter_lt.evaluate_raw(consumption_data=cd,\n cdd=cdd,\n weather_source=gsod_722880_2012_2014_weather_source)\n result_gt = meter_gt.evaluate_raw(consumption_data=cd,\n cdd=cdd,\n weather_source=gsod_722880_2012_2014_weather_source)\n assert n_periods_lt == result_lt[\"n_periods\"]\n assert n_periods_gt == result_gt[\"n_periods\"]", "metadata": "root.test_n_periods_meeting_cdd_per_day_threshold", "header": "['module', '___EOS___']", "index": 268 }, { "content": "def test_recent_reading_meter():\n recent_record = {\"start\": datetime.now(pytz.utc) - timedelta(days=390),\n \"end\": datetime.now(pytz.utc) - timedelta(days=360), \"value\": 0}\n old_record = {\"start\": datetime(2012,1,1,tzinfo=pytz.utc),\n \"end\": datetime(2012,2,1,tzinfo=pytz.utc), \"value\": 0}\n\n no_cd = ConsumptionData([],\n \"electricity\", \"kWh\", record_type=\"arbitrary\")\n old_cd = ConsumptionData([old_record],\n \"electricity\", \"kWh\", record_type=\"arbitrary\")\n recent_cd = ConsumptionData([recent_record],\n \"electricity\", \"kWh\", record_type=\"arbitrary\")\n mixed_cd = ConsumptionData([recent_record,old_record],\n \"electricity\", \"kWh\", record_type=\"arbitrary\")\n\n meter = RecentReadingMeter()\n assert meter.evaluate_raw(consumption_data=no_cd)[\"n_days\"] == np.inf\n assert meter.evaluate_raw(consumption_data=old_cd)[\"n_days\"] == 31\n assert meter.evaluate_raw(consumption_data=recent_cd)[\"n_days\"] == 30\n assert meter.evaluate_raw(consumption_data=mixed_cd)[\"n_days\"] == 30", "metadata": "root.test_recent_reading_meter", "header": "['module', '___EOS___']", "index": 281 }, { "content": "def test_average_daily_usage(generated_consumption_data_1):\n cd,params = generated_consumption_data_1\n meter = AverageDailyUsage()\n result = meter.evaluate_raw(consumption_data=cd,\n energy_unit_str=\"kWh\")\n assert result[\"average_daily_usages\"] is not None", "metadata": "root.test_average_daily_usage", "header": "['module', '___EOS___']", "index": 302 }, { "content": "def test_estimated_average_daily_usage(generated_consumption_data_1,gsod_722880_2012_2014_weather_source):\n meter_yaml = \"\"\"\n !obj:eemeter.meter.EstimatedAverageDailyUsage {\n temperature_unit_str: \"degF\",\n model: !obj:eemeter.models.AverageDailyTemperatureSensitivityModel {\n cooling: True,\n heating: True,\n },\n }\n \"\"\"\n meter = load(meter_yaml)\n\n cd,params = generated_consumption_data_1\n\n result = meter.evaluate_raw(\n consumption_data=cd,\n weather_source=gsod_722880_2012_2014_weather_source,\n temp_sensitivity_params=params,\n energy_unit_str=\"kWh\")\n assert result[\"estimated_average_daily_usages\"] is not None\n assert result[\"n_days\"] is not None", "metadata": "root.test_estimated_average_daily_usage", "header": "['module', '___EOS___']", "index": 309 }, { "content": "def test_consumption_data_attributes(generated_consumption_data_1):\n cd,params = generated_consumption_data_1\n meter = ConsumptionDataAttributes()\n result = meter.evaluate_raw(consumption_data=cd)\n assert result[\"fuel_type\"] == \"electricity\"\n assert result[\"unit_name\"] == \"kWh\"\n assert result[\"freq\"] == None\n assert result[\"freq_timedelta\"] == None\n assert result[\"pulse_value\"] == None\n assert result[\"name\"] == None", "metadata": "root.test_consumption_data_attributes", "header": "['module', '___EOS___']", "index": 331 }, { "content": "def test_project_attributes(generated_consumption_data_1):\n cd,params = generated_consumption_data_1\n baseline_period = Period(datetime(2014,1,1),datetime(2014,1,1))\n location = Location(zipcode=\"91104\")\n project = Project(location,[cd],baseline_period,None)\n meter = ProjectAttributes(project)\n result = meter.evaluate_raw(project=project)\n assert result[\"location\"].zipcode == location.zipcode\n assert result[\"consumption\"][0] is not None\n assert result[\"baseline_period\"] is not None\n assert result[\"reporting_period\"] is None\n assert result[\"other_periods\"] == []\n assert result[\"weather_source\"].station_id == \"722880\"\n assert result[\"weather_normal_source\"].station_id == \"722880\"", "metadata": "root.test_project_attributes", "header": "['module', '___EOS___']", "index": 342 }, { "content": "def test_project_consumption_baseline_reporting(generated_consumption_data_1):\n cd, _ = generated_consumption_data_1\n baseline_period = Period(datetime(2011,1,1),datetime(2013,6,1))\n reporting_period = Period(datetime(2013,6,1),datetime(2016,1,1))\n location = Location(zipcode=\"91104\")\n project = Project(location,[cd],baseline_period,reporting_period)\n meter = ProjectConsumptionDataBaselineReporting()\n result = meter.evaluate_raw(project=project)\n assert result[\"consumption\"][0][\"value\"].data.index[0] == datetime(2012,1,1)\n assert result[\"consumption\"][0][\"value\"].data.index[17] == datetime(2013,5,25)\n assert result[\"consumption\"][0][\"tags\"][0] == \"electricity\"\n assert result[\"consumption\"][0][\"tags\"][1] == \"baseline\"\n assert result[\"consumption\"][1][\"value\"].data.index[0] == datetime(2013,6,24)\n assert result[\"consumption\"][1][\"value\"].data.index[18] == datetime(2014,12,16)\n assert result[\"consumption\"][1][\"tags\"][0] == \"electricity\"\n assert result[\"consumption\"][1][\"tags\"][1] == \"reporting\"", "metadata": "root.test_project_consumption_baseline_reporting", "header": "['module', '___EOS___']", "index": 357 }, { "content": "def test_project_attributes(generated_consumption_data_1):\n cd,params = generated_consumption_data_1\n baseline_period = Period(datetime(2014,1,1),datetime(2014,1,1))\n location = Location(zipcode=\"91104\")\n project = Project(location,[cd,cd],baseline_period,None)\n meter = ProjectFuelTypes(project)\n result = meter.evaluate_raw(project=project)\n assert len(result[\"fuel_types\"]) == 2\n assert result[\"fuel_types\"][0][\"value\"] == \"electricity\"\n assert result[\"fuel_types\"][0][\"tags\"] == [\"electricity\"]\n assert result[\"fuel_types\"][1][\"value\"] == \"electricity\"\n assert result[\"fuel_types\"][1][\"tags\"] == [\"electricity\"]", "metadata": "root.test_project_attributes", "header": "['module', '___EOS___']", "index": 374 } ]
[ { "span": "from eemeter.meter import EstimatedAverageDailyUsage", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 52 }, { "span": "from fixtures.weather import gsod_722880_2012_2014_weather_source", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 65 }, { "span": "from fixtures.weather import tmy3_722880_weather_source", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 55 }, { "span": "from fixtures.consumption import consumption_generator_1", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 56 }, { "span": "from fixtures.consumption import consumption_generator_2", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 56 }, { "span": "from fixtures.consumption import generated_consumption_data_1", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 61 }, { "span": "from fixtures.consumption import generated_consumption_data_2", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 61 }, { "span": "from fixtures.consumption import generated_consumption_data_pre_post_1", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 70 }, { "span": "from fixtures.consumption import generated_consumption_data_with_annualized_usage_1", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 83 }, { "span": "from fixtures.consumption import generated_consumption_data_pre_post_with_gross_savings_1", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 89 }, { "span": "from fixtures.consumption import generated_consumption_data_pre_post_with_annualized_gross_savings_1", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 100 }, { "span": "from fixtures.consumption import consumption_data_1", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 51 }, { "span": "from fixtures.consumption import time_span_1", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 44 }, { "span": "from fixtures.consumption import generated_consumption_data_with_hdd_1", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 70 }, { "span": "from fixtures.consumption import generated_consumption_data_with_cdd_1", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 70 }, { "span": "from fixtures.consumption import generated_consumption_data_with_n_periods_hdd_1", "start_line": 42, "start_column": 0, "end_line": 42, "end_column": 80 }, { "span": "from fixtures.consumption import generated_consumption_data_with_n_periods_cdd_1", "start_line": 43, "start_column": 0, "end_line": 43, "end_column": 80 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "config_", "._", "yaml", "\\u", "parser_", "import_", "load_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Data", "Collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "consum", "ption_", "import_", "Consu", "mption", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "evaluation_", "import_", "Period_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "location_", "import_", "Location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "project_", "import_", "Project_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Time", "Span", "Meter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Total", "HD", "DM", "eter", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Total", "CD", "DM", "eter", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Normal", "Ann", "ual", "HD", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Normal", "Ann", "ual", "CD", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "NP", "eriod", "s", "Meet", "ing", "HD", "DP", "er", "Day", "Threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "NP", "eriod", "s", "Meet", "ing", "CD", "DP", "er", "Day", "Threshold_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Rece", "nt", "Reading", "Meter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Gro", "ss", "Sav", "ings", "Meter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Ann", "uali", "zed", "Gro", "ss", "Sav", "ings", "Meter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Average", "Da", "il", "y", "Usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Estimated", "Average", "Da", "il", "y", "Usage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Consu", "mption", "Data", "Attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Project", "Attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Project", "Consu", "mption", "Data", "Base", "line", "Report", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "meter_", "import_", "Project", "Fu", "el", "Types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "eem", "eter", "_", "._", "models_", "import_", "Average", "Da", "il", "y", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fixtures_", "._", "weather_", "import_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "weather_", "import_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "consum", "ption", "\\u", "generat", "or", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "consum", "ption", "\\u", "generat", "or", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "annual", "ize", "d\\u", "usage", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "with", "\\u", "gross", "\\u", "saving", "s", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "with", "\\u", "annual", "ize", "d\\u", "gross", "\\u", "saving", "s", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "time", "\\u", "span", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "hdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "cdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "n", "\\u", "period", "s", "\\u", "hdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fixtures_", "._", "consum", "ption_", "import_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "n", "\\u", "period", "s", "\\u", "cdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytz_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "._", "testing_", "import_", "assert", "\\u", "allclose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RT", "OL", "_", "=_", "1e-2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AT", "OL", "_", "=_", "1e-2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "slow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "tempe", "ratur", "e\\u", "sensitivity", "\\u", "parameter", "\\u", "optimization", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ",_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mete", "r", "\\u", "yaml_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "!", "obj", ":", "eem", "eter", ".", "mete", "r", ".", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Parameter", "Optim", "izatio", "n", "Meter", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "tempe", "ratur", "e\\u", "unit", "\\u", "str", ":", " ", "\"", "deg", "F", "\",", "\\", "10", ";", " ", " ", " ", " ", "model", ":", " ", "!", "obj", ":", "eem", "eter", ".", "model", "s", ".", "Average", "Da", "il", "y", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Model", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "cooling", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "heating", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "initial", "\\u", "params", ":", " ", "{", "\\", "10", ";", " ", " ", "base", "\\u", "daily", "\\u", "consum", "ption", ":", " ", "0", ",", "\\", "10", ";", " ", " ", "heating", "\\u", "slope", ":", " ", "0", ",", "\\", "10", ";", " ", " ", "cooling", "\\u", "slope", ":", " ", "0", ",", "\\", "10", ";", " ", " ", "heating", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "60", ",", "\\", "10", ";", " ", " ", "cooling", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "7", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "param", "\\u", "bound", "s", ":", " ", "{", "\\", "10", ";", " ", " ", "base", "\\u", "daily", "\\u", "consum", "ption", ":", " ", "[", "0", ",", "2000", "],", "\\", "10", ";", " ", " ", "heating", "\\u", "slope", ":", " ", "[", "0", ",", "200", "],", "\\", "10", ";", " ", " ", "cooling", "\\u", "slope", ":", " ", "[", "0", ",", "200", "],", "\\", "10", ";", " ", " ", "heating", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "[", "5", "5", ",", "6", "5", "],", "\\", "10", ";", " ", " ", "cooling", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "[", "6", "5", ",", "7", "5", "],", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "input", "\\u", "mapping", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "consum", "ption", "\\u", "data", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "wea", "ther", "\\u", "source", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "energ", "y", "\\u", "unit", "\\u", "str", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "output", "\\u", "mapping", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "temp", "\\u", "sensitivity", "\\u", "params", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "n", "\\u", "day", "s", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "averag", "e\\u", "daily", "\\u", "usage", "s", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "estimate", "d\\u", "averag", "e\\u", "daily", "\\u", "usage", "s", "\":", " ", "{}", ",", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "load_", "(_", "mete", "r", "\\u", "yaml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cd_", ",_", "params_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "collection_", "=_", "Data", "Collection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "energ", "y", "\\u", "unit", "\\u", "str_", "=_", "\"", "k", "Wh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate_", "(_", "data\\u", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "._", "get", "\\u", "data_", "(_", "'", "temp", "\\u", "sensitivity", "\\u", "params", "'_", ")_", "._", "value_", "._", "to", "\\u", "list_", "(_", ")_", ",_", "params_", "._", "to", "\\u", "list_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "._", "get", "\\u", "data_", "(_", "'", "n", "\\u", "day", "s", "'_", ")_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "._", "get", "\\u", "data_", "(_", "'", "averag", "e\\u", "daily", "\\u", "usage", "s", "'_", ")_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "._", "get", "\\u", "data_", "(_", "'", "estimate", "d\\u", "averag", "e\\u", "daily", "\\u", "usage", "s", "'_", ")_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "slow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "annual", "ize", "d\\u", "usage", "\\u", "meter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "annual", "ize", "d\\u", "usage", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ",_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mete", "r", "\\u", "yaml_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "!", "obj", ":", "eem", "eter", ".", "mete", "r", ".", "Sequ", "ence", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "sequence", ":", " ", "[", "\\", "10", ";", " ", " ", " ", " ", "!", "obj", ":", "eem", "eter", ".", "mete", "r", ".", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Parameter", "Optim", "izatio", "n", "Meter", " ", "{", "\\", "10", ";", " ", " ", "tempe", "ratur", "e\\u", "unit", "\\u", "str", ":", " ", "\"", "deg", "F", "\",", "\\", "10", ";", " ", " ", "model", ":", " ", "!", "obj", ":", "eem", "eter", ".", "model", "s", ".", "Average", "Da", "il", "y", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Model", " ", "&", "model", " ", "{", "\\", "10", ";", " ", " ", "cooling", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", "heating", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", "initial", "\\u", "params", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "base", "\\u", "daily", "\\u", "consum", "ption", ":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "heating", "\\u", "slope", ":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cooling", "\\u", "slope", ":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "heating", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "60", ",", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cooling", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "7", "0", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "param", "\\u", "bound", "s", ":", " ", "{", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "base", "\\u", "daily", "\\u", "consum", "ption", ":", " ", "[", "0", ",", "2000", "],", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "heating", "\\u", "slope", ":", " ", "[", "0", ",", "200", "],", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cooling", "\\u", "slope", ":", " ", "[", "0", ",", "200", "],", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "heating", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "[", "5", "5", ",", "6", "5", "],", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "cooling", "\\u", "balance", "\\u", "tempe", "ratur", "e", ":", " ", "[", "6", "5", ",", "7", "5", "],", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "input", "\\u", "mapping", ":", " ", "{", "\\", "10", ";", " ", " ", "consum", "ption", "\\u", "data", ":", " ", "{}", ",", "\\", "10", ";", " ", " ", "wea", "ther", "\\u", "source", ":", " ", "{}", ",", "\\", "10", ";", " ", " ", "energ", "y", "\\u", "unit", "\\u", "str", ":", " ", "{}", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "output", "\\u", "mapping", ":", " ", "{", "\\", "10", ";", " ", " ", "temp", "\\u", "sensitivity", "\\u", "params", ":", " ", "{", "name", ":", " ", "model", "\\u", "params", "},", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "!", "obj", ":", "eem", "eter", ".", "mete", "r", ".", "Ann", "uali", "zed", "Us", "age", "Meter", " ", "{", "\\", "10", ";", " ", " ", "tempe", "ratur", "e\\u", "unit", "\\u", "str", ":", " ", "\"", "deg", "F", "\",", "\\", "10", ";", " ", " ", "model", ":", " ", "*", "model", ",", "\\", "10", ";", " ", " ", "input", "\\u", "mapping", ":", " ", "{", "\\", "10", ";", " ", " ", "model", "\\u", "params", ":", " ", "{}", ",", "\\", "10", ";", " ", " ", "wea", "ther", "\\u", "normal", "\\u", "source", ":", " ", "{}", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", "output", "\\u", "mapping", ":", " ", "{", "\\", "10", ";", " ", " ", "annual", "ize", "d\\u", "usage", ":", " ", "{}", ",", "\\", "10", ";", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "load_", "(_", "mete", "r", "\\u", "yaml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cd_", ",_", "params_", ",_", "annual", "ize", "d\\u", "usage_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "annual", "ize", "d\\u", "usage", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "collection_", "=_", "Data", "Collection_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "normal", "\\u", "source_", "=_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "energ", "y", "\\u", "unit", "\\u", "str_", "=_", "\"", "k", "Wh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate_", "(_", "data\\u", "collection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "._", "get", "\\u", "data_", "(_", "'", "model", "\\u", "params", "'_", ")_", "._", "value_", "._", "to", "\\u", "list_", "(_", ")_", ",_", "params_", "._", "to", "\\u", "list_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "._", "get", "\\u", "data_", "(_", "'", "annual", "ize", "d\\u", "usage", "'_", ")_", "._", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "annual", "ize", "d\\u", "usage_", ",_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "slow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "gross", "\\u", "saving", "s", "\\u", "metric_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "with", "\\u", "gross", "\\u", "saving", "s", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Average", "Da", "il", "y", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Model_", "(_", "heating", "_", "=_", "True_", ",_", "cooling", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Gro", "ss", "Sav", "ings", "Meter_", "(_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ",_", "model_", "=_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cd_", ",_", "params", "\\u", "pre_", ",_", "params", "\\u", "post_", ",_", "retro", "fit", "\\u", "date_", ",_", "saving", "s_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "with", "\\u", "gross", "\\u", "saving", "s", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reporting", "\\u", "period_", "=_", "Period_", "(_", "retro", "fit", "\\u", "date_", ",_", "datetime_", "(_", "2015_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "consum", "ption", "\\u", "data\\u", "reporting", "_", "=_", "cd_", "._", "filter", "\\u", "by", "\\u", "period_", "(_", "reporting", "\\u", "period_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "params", "\\u", "baseline_", "=_", "params", "\\u", "pre_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "energ", "y", "\\u", "unit", "\\u", "str_", "=_", "\"", "k", "Wh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "[_", "\"", "gross", "\\u", "saving", "s", "\"_", "]_", ",_", "saving", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "pytest_", "._", "mark_", "._", "slow_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "annual", "ize", "d\\u", "gross", "\\u", "saving", "s", "\\u", "metric_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "with", "\\u", "annual", "ize", "d\\u", "gross", "\\u", "saving", "s", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ",_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "model_", "=_", "Average", "Da", "il", "y", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Model_", "(_", "heating", "_", "=_", "True_", ",_", "cooling", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Ann", "uali", "zed", "Gro", "ss", "Sav", "ings", "Meter_", "(_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ",_", "model_", "=_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cd_", ",_", "params", "\\u", "pre_", ",_", "params", "\\u", "post_", ",_", "retro", "fit", "\\u", "date_", ",_", "saving", "s_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "pre", "\\u", "post", "\\u", "with", "\\u", "annual", "ize", "d\\u", "gross", "\\u", "saving", "s", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reporting", "\\u", "period_", "=_", "Period_", "(_", "retro", "fit", "\\u", "date_", ",_", "datetime_", "(_", "2015_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "params", "\\u", "baseline_", "=_", "params", "\\u", "pre_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "params", "\\u", "reporting", "_", "=_", "params", "\\u", "post_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consum", "ption", "\\u", "data\\u", "reporting", "_", "=_", "cd_", "._", "filter", "\\u", "by", "\\u", "period_", "(_", "reporting", "\\u", "period_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "normal", "\\u", "source_", "=_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "energ", "y", "\\u", "unit", "\\u", "str_", "=_", "\"", "k", "Wh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "[_", "\"", "annual", "ize", "d\\u", "gross", "\\u", "saving", "s", "\"_", "]_", ",_", "saving", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "time", "\\u", "span", "\\u", "meter_", "(_", "time", "\\u", "span", "\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "n", "\\u", "days_", "=_", "time", "\\u", "span", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Time", "Span", "Meter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "\\u", "days_", "==_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ")_", "[_", "\"", "time", "\\u", "span", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "total", "\\u", "hdd", "\\u", "meter_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "hdd", "\\u", "1_", ",_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "hdd", "_", ",_", "base_", ",_", "temp", "\\u", "unit_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "hdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Total", "HD", "DM", "eter", "_", "(_", "base_", "=_", "base_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "temp", "\\u", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "hdd", "_", ",_", "result_", "[_", "\"", "total", "\\u", "hdd", "\"_", "]_", ",_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "total", "\\u", "cdd", "\\u", "meter_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "cdd", "\\u", "1_", ",_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "cdd", "_", ",_", "base_", ",_", "temp", "\\u", "unit_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "cdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Total", "CD", "DM", "eter", "_", "(_", "base_", "=_", "base_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "temp", "\\u", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "cdd", "_", ",_", "result_", "[_", "\"", "total", "\\u", "cdd", "\"_", "]_", ",_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "normal", "\\u", "annual", "\\u", "hdd", "_", "(_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meter_", "=_", "Normal", "Ann", "ual", "HD", "D_", "(_", "base_", "=_", "65_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "wea", "ther", "\\u", "normal", "\\u", "source_", "=_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "[_", "\"", "normal", "\\u", "annual", "\\u", "hdd", "\"_", "]_", ",_", "157", "8.5", "881", "756", "695", "73_", ",_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "normal", "\\u", "annual", "\\u", "cdd", "_", "(_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meter_", "=_", "Normal", "Ann", "ual", "CD", "D_", "(_", "base_", "=_", "65_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "wea", "ther", "\\u", "normal", "\\u", "source_", "=_", "tm", "y", "3", "\\u", "722", "880", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "allclose_", "(_", "result_", "[_", "\"", "normal", "\\u", "annual", "\\u", "cdd", "\"_", "]_", ",_", "124", "8.4", "575", "607", "9999", "41_", ",_", "rtol_", "=_", "RT", "OL", "_", ",_", "atol_", "=_", "AT", "OL", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "n", "\\u", "period", "s", "\\u", "meeting", "\\u", "hdd", "\\u", "per", "\\u", "day", "\\u", "threshold_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "n", "\\u", "period", "s", "\\u", "hdd", "\\u", "1_", ",_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "n", "\\u", "period", "s", "\\u", "lt_", ",_", "n", "\\u", "period", "s", "\\u", "gt_", ",_", "hdd", "_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "n", "\\u", "period", "s", "\\u", "hdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mete", "r", "\\u", "lt_", "=_", "NP", "eriod", "s", "Meet", "ing", "HD", "DP", "er", "Day", "Threshold_", "(_", "base_", "=_", "65_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ",_", "operation_", "=_", "\"<\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mete", "r", "\\u", "gt_", "=_", "NP", "eriod", "s", "Meet", "ing", "HD", "DP", "er", "Day", "Threshold_", "(_", "base_", "=_", "65_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ",_", "operation_", "=_", "\">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "lt_", "=_", "mete", "r", "\\u", "lt_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hdd", "_", "=_", "hdd", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "gt_", "=_", "mete", "r", "\\u", "gt_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hdd", "_", "=_", "hdd", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "\\u", "period", "s", "\\u", "lt_", "==_", "result", "\\u", "lt_", "[_", "\"", "n", "\\u", "period", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "\\u", "period", "s", "\\u", "gt_", "==_", "result", "\\u", "gt_", "[_", "\"", "n", "\\u", "period", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "n", "\\u", "period", "s", "\\u", "meeting", "\\u", "cdd", "\\u", "per", "\\u", "day", "\\u", "threshold_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "n", "\\u", "period", "s", "\\u", "cdd", "\\u", "1_", ",_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "n", "\\u", "period", "s", "\\u", "lt_", ",_", "n", "\\u", "period", "s", "\\u", "gt_", ",_", "cdd", "_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "with", "\\u", "n", "\\u", "period", "s", "\\u", "cdd", "\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mete", "r", "\\u", "lt_", "=_", "NP", "eriod", "s", "Meet", "ing", "CD", "DP", "er", "Day", "Threshold_", "(_", "base_", "=_", "65_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ",_", "operation_", "=_", "\"<\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mete", "r", "\\u", "gt_", "=_", "NP", "eriod", "s", "Meet", "ing", "CD", "DP", "er", "Day", "Threshold_", "(_", "base_", "=_", "65_", ",_", "tempe", "ratur", "e\\u", "unit", "\\u", "str_", "=_", "\"", "deg", "F", "\"_", ",_", "operation_", "=_", "\">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "lt_", "=_", "mete", "r", "\\u", "lt_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cdd", "_", "=_", "cdd", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "gt_", "=_", "mete", "r", "\\u", "gt_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cdd", "_", "=_", "cdd", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "\\u", "period", "s", "\\u", "lt_", "==_", "result", "\\u", "lt_", "[_", "\"", "n", "\\u", "period", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "n", "\\u", "period", "s", "\\u", "gt_", "==_", "result", "\\u", "gt_", "[_", "\"", "n", "\\u", "period", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "recent", "\\u", "readi", "ng", "\\u", "meter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recent", "\\u", "record_", "=_", "{_", "\"", "start", "\"_", ":_", "datetime_", "._", "now_", "(_", "pytz_", "._", "utc_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "390", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "end", "\"_", ":_", "datetime_", "._", "now_", "(_", "pytz_", "._", "utc_", ")_", "-_", "timedelta_", "(_", "days_", "=_", "360_", ")_", ",_", "\"", "value", "\"_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "record_", "=_", "{_", "\"", "start", "\"_", ":_", "datetime_", "(_", "2012_", ",_", "1_", ",_", "1_", ",_", "tzinfo_", "=_", "pytz_", "._", "utc_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "end", "\"_", ":_", "datetime_", "(_", "2012_", ",_", "2_", ",_", "1_", ",_", "tzinfo_", "=_", "pytz_", "._", "utc_", ")_", ",_", "\"", "value", "\"_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "no", "\\u", "cd_", "=_", "Consu", "mption", "Data_", "(_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "electric", "it", "y", "\"_", ",_", "\"", "k", "Wh", "\"_", ",_", "record", "\\u", "type_", "=_", "\"", "arbitra", "ry", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "cd_", "=_", "Consu", "mption", "Data_", "(_", "[_", "old", "\\u", "record_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "electric", "it", "y", "\"_", ",_", "\"", "k", "Wh", "\"_", ",_", "record", "\\u", "type_", "=_", "\"", "arbitra", "ry", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recent", "\\u", "cd_", "=_", "Consu", "mption", "Data_", "(_", "[_", "recent", "\\u", "record_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "electric", "it", "y", "\"_", ",_", "\"", "k", "Wh", "\"_", ",_", "record", "\\u", "type_", "=_", "\"", "arbitra", "ry", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mixed", "\\u", "cd_", "=_", "Consu", "mption", "Data_", "(_", "[_", "recent", "\\u", "record_", ",_", "old", "\\u", "record_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "electric", "it", "y", "\"_", ",_", "\"", "k", "Wh", "\"_", ",_", "record", "\\u", "type_", "=_", "\"", "arbitra", "ry", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "meter_", "=_", "Rece", "nt", "Reading", "Meter_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "no", "\\u", "cd_", ")_", "[_", "\"", "n", "\\u", "day", "s", "\"_", "]_", "==_", "np_", "._", "inf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "old", "\\u", "cd_", ")_", "[_", "\"", "n", "\\u", "day", "s", "\"_", "]_", "==_", "31_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "recent", "\\u", "cd_", ")_", "[_", "\"", "n", "\\u", "day", "s", "\"_", "]_", "==_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "mixed", "\\u", "cd_", ")_", "[_", "\"", "n", "\\u", "day", "s", "\"_", "]_", "==_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "averag", "e\\u", "daily", "\\u", "usage_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "params_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Average", "Da", "il", "y", "Usage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "energ", "y", "\\u", "unit", "\\u", "str_", "=_", "\"", "k", "Wh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "averag", "e\\u", "daily", "\\u", "usage", "s", "\"_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "estimate", "d\\u", "averag", "e\\u", "daily", "\\u", "usage_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ",_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mete", "r", "\\u", "yaml_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "!", "obj", ":", "eem", "eter", ".", "mete", "r", ".", "Estimated", "Average", "Da", "il", "y", "Us", "age", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "tempe", "ratur", "e\\u", "unit", "\\u", "str", ":", " ", "\"", "deg", "F", "\",", "\\", "10", ";", " ", " ", " ", " ", "model", ":", " ", "!", "obj", ":", "eem", "eter", ".", "model", "s", ".", "Average", "Da", "il", "y", "Tempe", "ratur", "e", "Sensitiv", "it", "y", "Model", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "cooling", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "heating", ":", " ", "Tru", "e", ",", "\\", "10", ";", " ", " ", " ", " ", "},", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "load_", "(_", "mete", "r", "\\u", "yaml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cd_", ",_", "params_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "consum", "ption", "\\u", "data_", "=_", "cd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wea", "ther", "\\u", "source_", "=_", "gso", "d\\u", "722", "880", "\\u", "2012", "\\u", "2014", "\\u", "wea", "ther", "\\u", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "temp", "\\u", "sensitivity", "\\u", "params_", "=_", "params_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "energ", "y", "\\u", "unit", "\\u", "str_", "=_", "\"", "k", "Wh", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "estimate", "d\\u", "averag", "e\\u", "daily", "\\u", "usage", "s", "\"_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "n", "\\u", "day", "s", "\"_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "consum", "ption", "\\u", "data\\u", "attributes_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "params_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Consu", "mption", "Data", "Attributes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "consum", "ption", "\\u", "data_", "=_", "cd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "fuel", "\\u", "type", "\"_", "]_", "==_", "\"", "electric", "it", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "unit", "\\u", "name", "\"_", "]_", "==_", "\"", "k", "Wh", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "freq", "\"_", "]_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "freq", "\\u", "timedelta", "\"_", "]_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "pulse", "\\u", "value", "\"_", "]_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "name", "\"_", "]_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "project", "\\u", "attributes_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "params_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline", "\\u", "period_", "=_", "Period_", "(_", "datetime_", "(_", "2014_", ",_", "1_", ",_", "1_", ")_", ",_", "datetime_", "(_", "2014_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Location_", "(_", "zipcode", "_", "=_", "\"", "911", "04", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "Project_", "(_", "location_", ",_", "[_", "cd_", "]_", ",_", "baseline", "\\u", "period_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Project", "Attributes_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "project_", "=_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "location", "\"_", "]_", "._", "zipcode", "_", "==_", "location_", "._", "zipcode", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "0_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "baseline", "\\u", "period", "\"_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "reporting", "\\u", "period", "\"_", "]_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "other", "\\u", "period", "s", "\"_", "]_", "==_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "wea", "ther", "\\u", "source", "\"_", "]_", "._", "station", "\\u", "id_", "==_", "\"", "722", "880", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "wea", "ther", "\\u", "normal", "\\u", "source", "\"_", "]_", "._", "station", "\\u", "id_", "==_", "\"", "722", "880", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "project", "\\u", "consum", "ption", "\\u", "baseline", "\\u", "reporting", "_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "\\u_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline", "\\u", "period_", "=_", "Period_", "(_", "datetime_", "(_", "2011_", ",_", "1_", ",_", "1_", ")_", ",_", "datetime_", "(_", "2013_", ",_", "6_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reporting", "\\u", "period_", "=_", "Period_", "(_", "datetime_", "(_", "2013_", ",_", "6_", ",_", "1_", ")_", ",_", "datetime_", "(_", "2016_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Location_", "(_", "zipcode", "_", "=_", "\"", "911", "04", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "Project_", "(_", "location_", ",_", "[_", "cd_", "]_", ",_", "baseline", "\\u", "period_", ",_", "reporting", "\\u", "period_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Project", "Consu", "mption", "Data", "Base", "line", "Report", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "project_", "=_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "value", "\"_", "]_", "._", "data_", "._", "index_", "[_", "0_", "]_", "==_", "datetime_", "(_", "2012_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "value", "\"_", "]_", "._", "data_", "._", "index_", "[_", "17_", "]_", "==_", "datetime_", "(_", "2013_", ",_", "5_", ",_", "25_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "tags", "\"_", "]_", "[_", "0_", "]_", "==_", "\"", "electric", "it", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "tags", "\"_", "]_", "[_", "1_", "]_", "==_", "\"", "baseline", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "1_", "]_", "[_", "\"", "value", "\"_", "]_", "._", "data_", "._", "index_", "[_", "0_", "]_", "==_", "datetime_", "(_", "2013_", ",_", "6_", ",_", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "1_", "]_", "[_", "\"", "value", "\"_", "]_", "._", "data_", "._", "index_", "[_", "18_", "]_", "==_", "datetime_", "(_", "2014_", ",_", "12_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "1_", "]_", "[_", "\"", "tags", "\"_", "]_", "[_", "0_", "]_", "==_", "\"", "electric", "it", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "consum", "ption", "\"_", "]_", "[_", "1_", "]_", "[_", "\"", "tags", "\"_", "]_", "[_", "1_", "]_", "==_", "\"", "reporting", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "project", "\\u", "attributes_", "(_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cd_", ",_", "params_", "=_", "generat", "ed", "\\u", "consum", "ption", "\\u", "data\\u", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "baseline", "\\u", "period_", "=_", "Period_", "(_", "datetime_", "(_", "2014_", ",_", "1_", ",_", "1_", ")_", ",_", "datetime_", "(_", "2014_", ",_", "1_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "=_", "Location_", "(_", "zipcode", "_", "=_", "\"", "911", "04", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "Project_", "(_", "location_", ",_", "[_", "cd_", ",_", "cd_", "]_", ",_", "baseline", "\\u", "period_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meter_", "=_", "Project", "Fu", "el", "Types_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "meter_", "._", "evaluate", "\\u", "raw_", "(_", "project_", "=_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "result_", "[_", "\"", "fuel", "\\u", "types", "\"_", "]_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "fuel", "\\u", "types", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "value", "\"_", "]_", "==_", "\"", "electric", "it", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "fuel", "\\u", "types", "\"_", "]_", "[_", "0_", "]_", "[_", "\"", "tags", "\"_", "]_", "==_", "[_", "\"", "electric", "it", "y", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "fuel", "\\u", "types", "\"_", "]_", "[_", "1_", "]_", "[_", "\"", "value", "\"_", "]_", "==_", "\"", "electric", "it", "y", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "[_", "\"", "fuel", "\\u", "types", "\"_", "]_", "[_", "1_", "]_", "[_", "\"", "tags", "\"_", "]_", "==_", "[_", "\"", "electric", "it", "y", "\"_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
haikuginger/beekeeper/beekeeper/__init__.py
[ { "content": "\"\"\"\nImporting certain classes into the global namespace.\n\"\"\"\n\nfrom beekeeper.api import API\nfrom beekeeper.hive import Hive\nfrom beekeeper.data_handlers import DataHandler\nfrom beekeeper.variable_handlers import VariableHandler, set_content_type\nfrom beekeeper.variable_handlers import render as render_variables\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from beekeeper.api import API", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 29 }, { "span": "from beekeeper.hive import Hive", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 31 }, { "span": "from beekeeper.data_handlers import DataHandler", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 47 }, { "span": "from beekeeper.variable_handlers import VariableHandler, set_content_type", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 73 }, { "span": "from beekeeper.variable_handlers import render as render_variables", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 66 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Import", "ing", " ", "cert", "ain", " ", "classe", "s", " ", "int", "o", " ", "the", " ", "global", " ", "namespace", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bee", "keeper", "_", "._", "api_", "import_", "API_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bee", "keeper", "_", "._", "hive", "_", "import_", "Hi", "ve_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bee", "keeper", "_", "._", "data\\u", "handlers_", "import_", "Data", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bee", "keeper", "_", "._", "variab", "le", "\\u", "handlers_", "import_", "Varia", "ble", "Handler_", ",_", "set\\u", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bee", "keeper", "_", "._", "variab", "le", "\\u", "handlers_", "import_", "render_", "as_", "render", "\\u", "variables_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
gkno/gkno_launcher/src/gkno/dataConsistency.py
[ { "content": "#!/bin/bash/python\n\nfrom __future__ import print_function\nfrom copy import deepcopy\n\nimport dataConsistencyErrors as er\nimport superpipeline\n\nimport json\nimport os\nimport sys\n\n# Loop over all of the nodes in a graph and check that the values associated with it\n# are of the correct type and have extensions consistent with all of the arguments\n# attached to the node.\n\n# Check the values for a node.\n\n# Check a values data type.\n\n# Check that the file extension is valid.\n\n# Loop over all tasks in the pipeline and check that all required values (excepting output files\n# which can be constructed) have been defined.\n\n# Purge the graph of nodes with no values.\n\n# Set the aboslute paths of all the files used in the pipeline.\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def checkValues(graph, superpipeline):\n\n # First, loop over all of the option nodes and check that the data types for all values\n # are valid.\n for nodeId in graph.getNodes(['option', 'file']):\n values = graph.getGraphNodeAttribute(nodeId, 'values')\n nodeType = graph.getGraphNodeAttribute(nodeId, 'nodeType')\n\n # Determine if the node values are commands to evaluate at run time. If so, do not perform these checks.\n if not graph.getGraphNodeAttribute(nodeId, 'isCommandToEvaluate'):\n\n # Get all of the arguments that use this node and check the data types. Start with all predecessors to this node.\n expectedDataType = None\n for predecessorNodeId in graph.getPredecessors(nodeId):\n expectedDataType = checkNode(graph, superpipeline, predecessorNodeId, nodeId, nodeType, expectedDataType, values, isInput = False)\n\n expectedDataType = None\n for successorNodeId in graph.getSuccessors(nodeId):\n expectedDataType = checkNode(graph, superpipeline, nodeId, successorNodeId, nodeType, expectedDataType, values, isInput = True)", "metadata": "root.checkValues", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def checkNode(graph, superpipeline, source, target, nodeType, expectedDataType, values, isInput):\n \n # Define error handling,\n errors = er.consistencyErrors()\n\n # Get pipeline configuration data.\n data = superpipeline.pipelineConfigurationData[superpipeline.pipeline]\n\n # Get the required attributes.\n longFormArgument = graph.CM_getArgumentAttribute(graph.graph, source, target, 'longFormArgument')\n dataType = graph.CM_getArgumentAttribute(graph.graph, source, target, 'dataType')\n\n # Check if this edge hgas been marked as a link only. This occurs when a nodes values are constructed using values from\n # another node. An edge is included to ensure that the workflow and dependencies are correct, but there will be no\n # argument associated with the edge and the following checks are not required.\n isLinkOnly = graph.CM_getArgumentAttribute(graph.graph, source, target, 'isLinkOnly')\n if not isLinkOnly:\n\n # If this is the first argument parsed, populate the expectedDataType variable with the data type for this argument.\n if not expectedDataType: expectedDataType = dataType\n \n # If expectedDataType is populated and this data type is different to the expectedDataType, this implies that different\n # arguments using the same values expect different data types. This is clearly impossible, so terminate.\n #TODO ERROR\n elif expectedDataType != dataType: print('dataConsistency.checkNode - 1', dataType, expectedDataType); exit(0)\n \n # Loop over each of the values for this node.\n for value in values:\n \n # Check that the data type is correct.\n #TODO ERROR\n if not isCorrectDataType(value, expectedDataType): print('dataConsistency.checkNode - 2', longFormArgument, value, dataType, type(value)); exit(0)\n \n # If this is a file, check that the extension is valid. Do not perform this check for stubs.\n if nodeType == 'file':\n if not graph.CM_getArgumentAttribute(graph.graph, source, target, 'isStub'):\n extensions = graph.CM_getArgumentAttribute(graph.graph, source, target, 'extensions')\n \n # Not all files have specified extensions. If no extensions are supplied, this check should not be performed.\n if extensions:\n task = target if isInput else source\n fileNodeId = source if isInput else target\n \n # Fail if there was an error.\n if not checkExtensions(value, extensions):\n \n # Check if a top level pipeline argument exists.\n if longFormArgument in data.longFormArguments.keys():\n shortFormArgument = data.longFormArguments[longFormArgument].shortFormArgument\n errors.invalidExtensionPipeline(longFormArgument, shortFormArgument, value, extensions)\n \n # If no pipeline argument exists for this argument, list the task and argument.\n else:\n shortFormArgument = graph.CM_getArgumentAttribute(graph.graph, source, target, 'shortFormArgument')\n errors.invalidExtension(task, longFormArgument, shortFormArgument, value, extensions)\n\n # Return the expected data type\n return expectedDataType", "metadata": "root.checkNode", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def isCorrectDataType(value, dataType):\n\n # The value can only be none, if this is a flag.\n if not value and value != 0 and dataType != 'flag': return False\n elif not value: return True\n\n # If the expected data type is an integer.\n if dataType == 'integer':\n try: value = int(value)\n except: return False\n return True\n\n # If the expected data type is a float.\n elif dataType == 'float':\n try: value = float(value)\n except: return False\n return True\n\n # If the expected data type is a string.\n elif dataType == 'string':\n try: value = str(value)\n except: return False\n return True\n\n # If the expected data type is a Boolean.\n elif dataType == 'bool':\n if value == 'true' or value == 'True' or value == 'false' or value == 'False': return True\n return False\n\n # If the expected data type is a flag.\n elif dataType == 'flag':\n if value == 'set' or value == 'unset': return True\n return False\n\n # If none of the above conditions were met, the data type is incorrect.\n return False", "metadata": "root.isCorrectDataType", "header": "['module', '___EOS___']", "index": 96 }, { "content": "def checkExtensions(value, extensions):\n\n # If the extensions are not known (e.g. are listed as 'no extension') do not perform this check.\n if len(extensions) == 1 and extensions[0] == 'no extension': return True\n\n # If the value ends with any of the extensions, return True.\n for extension in extensions:\n if value.endswith(extension): return True\n\n # Otherwise, return False,\n return False", "metadata": "root.checkExtensions", "header": "['module', '___EOS___']", "index": 134 }, { "content": "def checkRequiredArguments(graph, superpipeline, args, isTerminate):\n\n # Define error handling,\n errors = er.consistencyErrors()\n isSuccess = True\n\n # Keep track of nodes that can have their values constructed.\n constructableNodes = []\n\n # Loop over the defined pipeline arguments and check that all arguments listed as required have\n # been set.\n for argument in args.arguments:\n\n # If the pipeline specifies if this argument is required or not, update the properties of the nodes.\n # If not specified (i.e. isRequired == None), it is left to the tool configuration to determine if\n # the argument is required. This allows the pipeline configuration file to not only specify that an\n # argument is required even if the underlying tool doesn't require the value, the pipeline can also\n # override the tools claim that the argument is required.\n if args.arguments[argument].isRequired == False:\n for nodeId in args.arguments[argument].graphNodeIds: graph.setGraphNodeAttribute(nodeId, 'isRequired', False)\n if args.arguments[argument].isRequired:\n\n # Loop over the associated graph nodes and see if the values are set.\n for nodeId in args.arguments[argument].graphNodeIds:\n graph.setGraphNodeAttribute(nodeId, 'isRequired', False)\n\n # Check if this argument was imported from a task in the pipeline. If so, determine if there are\n # any instructions for constructing the filename (if not an option). Only terminate if the argument\n # is for an option, or there are no instructions.\n hasInstructions = False\n if args.arguments[argument].isImported:\n task = args.arguments[argument].importedFromTask\n tool = graph.getGraphNodeAttribute(task, 'tool')\n toolData = superpipeline.getToolData(tool)\n hasInstructions = True if toolData.getArgumentAttribute(argument, 'constructionInstructions') else False\n\n # If the values haven't been set, terminate. This is a pipeline argument listed as required\n # and so must be set by the user (and not constructed).\n if not graph.getGraphNodeAttribute(nodeId, 'values') and not hasInstructions:\n isSuccess = False\n shortFormArgument = args.arguments[argument].shortFormArgument\n description = args.arguments[argument].description\n if isTerminate: errors.unsetRequiredArgument(argument, shortFormArgument, description)\n\n # Loop over all tasks in the workflow\n for task in graph.workflow:\n\n # Get the tool for the task.\n tool = superpipeline.tasks[task]\n toolData = superpipeline.getToolData(tool)\n\n # Loop over all of the arguments for the tool and check that all required arguments have a node\n # and that the node has values.\n for argument in toolData.arguments:\n\n # Check if the argument is required.\n if toolData.getArgumentAttribute(argument, 'isRequired'):\n\n # Record if a node for this node is seen.\n foundNode = False\n\n # Determine if the argument is for an input file, output file or an option.\n isInput = toolData.getArgumentAttribute(argument, 'isInput')\n isOutput = toolData.getArgumentAttribute(argument, 'isOutput')\n\n # If this is an output file with construction instructions, the filenames will be constructed\n # later, so this does not need to be checked. Keep track of the nodes which will be constructed\n # as these could be inputs to other tasks and so the check for existence is also not required\n # for these input files.\n\n # Start with input files and options.\n if not isOutput:\n\n # Loop over all input nodes looking for edges that use this argument.\n for nodeId in graph.CM_getInputNodes(graph.graph, task):\n edgeArgument = graph.getArgumentAttribute(nodeId, task, 'longFormArgument')\n\n # If this node uses the required argument.\n if edgeArgument == argument:\n foundNode = True\n\n # If this node has already been marked as not required (i.e. the tools requirement has been superceded\n # by instructions in the pipeline configuration file).\n if graph.getGraphNodeAttribute(nodeId, 'isRequired'):\n hasInstructions = False if graph.getArgumentAttribute(nodeId, task, 'constructionInstructions') == None else True\n hasValues = True if len(graph.getGraphNodeAttribute(nodeId, 'values')) != 0 else False\n if not hasValues and not hasInstructions and nodeId not in constructableNodes:\n isSuccess = False\n \n # Check to see if this node can have it's values set with a top level pipeline argument (e.g. can\n # be set without defining the task on the command line).\n longFormArgument = graph.getGraphNodeAttribute(nodeId, 'longFormArgument')\n if longFormArgument and '.' not in longFormArgument:\n \n # Get the short form of the pipeline argument and the argument description.\n #shortFormArgument = args.arguments[longFormArgument].shortFormArgument\n shortFormArgument = graph.getGraphNodeAttribute(nodeId, 'shortFormArgument')\n description = graph.getGraphNodeAttribute(nodeId, 'description')\n if isTerminate: errors.unsetRequiredArgument(longFormArgument, shortFormArgument, description)\n \n # If this is not a top level argument, provide a different error.\n # TODO CHECK THIS\n else: \n \n # Get the short form version of the argument as well as the argument description. This is as defined\n # for the tool, so if this argument can be set using a pipeline argument, these values are incorrect.\n shortFormArgument = graph.getArgumentAttribute(nodeId, task, 'shortFormArgument')\n description = graph.getArgumentAttribute(nodeId, task, 'description')\n if isTerminate: errors.unsetRequiredNestedArgument(task, argument, shortFormArgument, description, superpipeline.pipeline)\n\n # If there is no node for this argument, this means that the pipeline configuration file does not contain\n # a unique or shared node for this argument. In addition, the value has not been provided on the command\n # line. This means that no values will get assigned to this argument, so terminate.\n if not foundNode:\n instructions = toolData.getArgumentAttribute(argument, 'constructionInstructions')\n if not instructions: \n isSuccess = False\n\n # Check if arguments were imported for this task. If so, check to see if this argument is therefore\n # available on the command line.\n if task == superpipeline.pipelineConfigurationData[superpipeline.pipeline].importArgumentsFromTool:\n if isTerminate: \n errors.unsetRequiredArgument(argument, args.arguments[argument].shortFormArgument, args.arguments[argument].description)\n else:\n if isTerminate: errors.noInputNode(task, tool, argument)\n \n # If there are instructions, but no node, construct the node.\n else:\n if instructions['method'] == 'from tool argument':\n argumentToUse = instructions['use argument']\n\n # Find all nodes for this task using this argument.\n for predecessorNodeId in graph.graph.predecessors(task):\n if graph.getArgumentAttribute(predecessorNodeId, task, 'longFormArgument') == argumentToUse:\n nodeAddress = str(predecessorNodeId + '.' + argument)\n\n # Add the node and edge.\n argumentAttributes = toolData.getArgumentData(argument)\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(nodeAddress, task, argumentAttributes)\n\n # Attach the name of the node from which this filename is constructed to the node.\n graph.setGraphNodeAttribute(nodeAddress, 'constructUsingNode', predecessorNodeId)\n\n # If there are instructions, but the construction method does not use another argument, create a node.\n else:\n nodeAddress = str(task + '.' + argument)\n\n # Add the node and edge.\n argumentAttributes = toolData.getArgumentData(argument)\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(nodeAddress, task, argumentAttributes)\n\n # Now consider output files.\n else:\n instructions = toolData.getArgumentAttribute(argument, 'constructionInstructions')\n\n # Loop over all output nodes looking for edges that use this argument.\n for nodeId in graph.CM_getOutputNodes(graph.graph, task):\n edgeArgument = graph.getArgumentAttribute(task, nodeId, 'longFormArgument')\n\n # If this node uses the required argument.\n if edgeArgument == argument:\n foundNode = True\n\n # If construction instructions are provided.\n if instructions:\n\n # If the construction is to proceed by using an argument from this task, ensure that that\n # argument is either set, or is itelf a successor to another task and so has the chance\n # of being set.\n if instructions['method'] == 'from tool argument':\n longFormArgument = toolData.getLongFormArgument(instructions['use argument'])\n foundNode = False\n for predecessorNodeId in graph.graph.predecessors(task):\n edgeArgument = graph.getArgumentAttribute(predecessorNodeId, task, 'longFormArgument')\n if edgeArgument == longFormArgument:\n foundNode = True\n constructionNodeId = predecessorNodeId\n\n # If the node being used to construct the file does not exist, then it cannot be used to \n # construct the filename and so some data must be missing.\n if not foundNode:\n isSuccess = False\n if isTerminate: errors.noNodeForConstruction(task, tool, argument, longFormArgument)\n\n # If the node used to construct this filename exists, but it has no values or predecessors,\n # it also will not be able to be used to construct the argument.\n #elif not graph.getGraphNodeAttribute(constructionNodeId, 'values'):\n #if not graph.graph.predecessors(constructionNodeId):\n # TODO ERROR\n #print('dataConsistency - checkRequiredArguments - cannot construct output', task, argument); exit(1)\n\n # Add the node to the list of nodes that have the potential to be constructed.\n if nodeId not in constructableNodes: constructableNodes.append(nodeId)\n\n # If no instructions are provided check that there are values supplied.\n if not instructions and not graph.getGraphNodeAttribute(nodeId, 'values'):\n isSuccess = False\n if isTerminate: errors.noConstructionMethod(task, tool, argument)\n\n # If no node exists for this argument, determine the course of action.\n if not foundNode:\n\n # If there are no instructions for constructing the filename, terminate.\n if not instructions: print('dataConsistency.checkRequiredArguments - no output node', task, argument); exit(1)\n\n # If there are instructions, but no node, construct the node.\n nodeAddress = str(task + '.' + argument)\n argumentAttributes = toolData.getArgumentData(argument)\n\n # Determine if this node is a stub. If so, this is an output that is not shared with any other tasks, so\n # construct as many nodes as required.\n if argumentAttributes.isStub: #graph.constructOutputStubs()\n for i, stubExtension in enumerate(argumentAttributes.stubExtensions):\n modifiedNodeAddress = str(nodeAddress + '.' + stubExtension)\n stubAttributes = deepcopy(argumentAttributes)\n stubAttributes.stubExtension = stubExtension\n stubAttributes.isPrimaryStubNode = True if i == 0 else False\n graph.addFileNode(modifiedNodeAddress, modifiedNodeAddress)\n graph.addEdge(task, modifiedNodeAddress, stubAttributes)\n\n # If this is not a stub, add the node and edge.\n else:\n graph.addFileNode(nodeAddress, nodeAddress)\n graph.addEdge(task, nodeAddress, argumentAttributes)\n\n # Return if the operation was a success.\n return isSuccess", "metadata": "root.checkRequiredArguments", "header": "['module', '___EOS___']", "index": 148 }, { "content": "def purgeEmptyNodes(graph):\n\n # Loop over all the option nodes in the graph.\n for nodeId in graph.getNodes('option'):\n\n # Remove empty nodes.\n if not graph.getGraphNodeAttribute(nodeId, 'values'):\n if graph.getGraphNodeAttribute(nodeId, 'isRequired'): print('ERROR - dataConsistency - purgeEmpythNodes'); exit(1)\n graph.graph.remove_node(nodeId)\n\n # Remove isolated nodes.\n elif not graph.graph.predecessors(nodeId) and not graph.graph.successors(nodeId): graph.graph.remove_node(nodeId)\n\n # Then loop over all file nodes, removing valueless nodes.\n for nodeId in graph.getNodes('file'):\n if not graph.getGraphNodeAttribute(nodeId, 'values'):\n if graph.getGraphNodeAttribute(nodeId, 'isRequired'): print('ERROR - dataConsistency - purgeEmpythNodes'); exit(1)\n graph.graph.remove_node(nodeId)\n\n # Remove isolated nodes.\n elif not graph.graph.predecessors(nodeId) and not graph.graph.successors(nodeId): graph.graph.remove_node(nodeId)", "metadata": "root.purgeEmptyNodes", "header": "['module', '___EOS___']", "index": 379 }, { "content": "def setFilePaths(graph, gknoArguments, gkno):\n inputFiles = []\n\n # Get the input and output paths as defined by the user.\n definedInputPath = gkno.getGknoArgument('GKNO-INPUT-PATH', gknoArguments)\n definedOutputPath = gkno.getGknoArgument('GKNO-OUTPUT-PATH', gknoArguments)\n\n # Get the path of the input and the output directories.\n inputPath = definedInputPath if definedInputPath else str('$(PWD)')\n outputPath = definedOutputPath if definedOutputPath else str('$(PWD)')\n\n # If the path is '.', set to $(PWD).\n if inputPath == '.': inputPath = '$(PWD)'\n if outputPath == '.': outputPath = '$(PWD)'\n\n # Ensure that the input and output paths end with /.\n if not inputPath.endswith('/'): inputPath += '/'\n if not outputPath.endswith('/'): outputPath += '/'\n\n # Parse all of the file nodes.\n for nodeId in graph.getNodes('file'):\n\n # Determine if the file is an input or output file. Since the node could be feeding\n # into or from multiple tasks, a file is an input, if and only if, the file nodes\n # associated with the option node have no predecessors.\n isInput = False if graph.graph.predecessors(nodeId) else True\n if isInput:\n source = nodeId\n target = graph.graph.successors(nodeId)[0]\n else:\n source = graph.graph.predecessors(nodeId)[0]\n target = nodeId\n\n # Determine if this is a stub,\n isStub = graph.getArgumentAttribute(source, target, 'isStub')\n if isStub: stubExtension = graph.getArgumentAttribute(source, target, 'stubExtension')\n\n # Determine if a file location is set for the argument. If so, add this location to the node.\n fileLocation = graph.getArgumentAttribute(source, target, 'fileLocation')\n \n # Get the values associated with the node.\n updatedValues = []\n for value in graph.getGraphNodeAttribute(nodeId, 'values'):\n\n # Update the value to include the extension, if this is a stub (if necessary).\n if isStub and not value.endswith(stubExtension):\n modifiedValue = str(value + stubExtension) if '.' in stubExtension else str(value + '.' + stubExtension)\n else: modifiedValue = value\n\n # Check if the value already has a path. If not, add the input or output path. If the path\n # was defined by the user on the command line, override any path that is already present\n # with that supplied. In addition, store all of the input files. Since these are specifically\n # defined as files that are not created by any task in the pipeline, these files need to exist\n # in order for the pipeline to run.\n if isInput:\n\n # If a file location is specified with the argument, the value should not have the path altered, but\n # the file location should be stored. This will be used to define where the file should exist in the\n # makefile, but will not appear in the value on the command line.\n if fileLocation:\n graph.setGraphNodeAttribute(nodeId, 'fileLocation', fileLocation)\n updatedValue = str(value)\n\n # Override the path if necessary.\n elif definedInputPath: updatedValue = str(inputPath + modifiedValue.split('/')[-1])\n else: updatedValue = str(modifiedValue) if '/' in modifiedValue else str(inputPath + modifiedValue)\n updatedValues.append(updatedValue)\n\n # Add the input files to the list of input files required by the pipeline. These will be checked to ensure\n # that they exist prior to pipeline execution.\n if fileLocation: inputFiles.append(str(fileLocation + updatedValue))\n else: inputFiles.append(updatedValue)\n else:\n if definedOutputPath: updatedValues.append(str(outputPath + modifiedValue.split('/')[-1]))\n else: updatedValues.append(str(modifiedValue) if '/' in modifiedValue else str(outputPath + modifiedValue))\n\n # Replace the values stored in the node with the values including the absolute path.\n graph.setGraphNodeAttribute(nodeId, 'values', updatedValues)\n\n # Return the list of all required input files.\n return inputFiles", "metadata": "root.setFilePaths", "header": "['module', '___EOS___']", "index": 402 } ]
[ { "span": "import superpipeline", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 20 }, { "span": "import json", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 11 }, { "span": "import os", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 9 }, { "span": "import sys", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "bin", "/", "bash", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "deepcopy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "data", "Cons", "iste", "nc", "y", "Errors_", "as_", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "super", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "of", " ", "the", " ", "nodes", " ", "in", " ", "a", " ", "graph", " ", "and", " ", "check", " ", "tha", "t", " ", "the", " ", "values", " ", "associate", "d", " ", "with", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "of", " ", "the", " ", "correct", " ", "type", " ", "and", " ", "have", " ", "extensi", "ons", " ", "consistent", " ", "with", " ", "all", " ", "of", " ", "the", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "attache", "d", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "values", " ", "for", " ", "a", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "a", " ", "values", " ", "data", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "file", " ", "extensi", "on", " ", "is", " ", "valid", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "task", "s", " ", "in", " ", "the", " ", "pipeline", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "require", "d", " ", "values", " ", "(", "except", "ing", " ", "output", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "can", " ", "be", " ", "construct", "ed", ")", " ", "have", " ", "bee", "n", " ", "defin", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Purg", "e", " ", "the", " ", "graph", " ", "of", " ", "nodes", " ", "with", " ", "no", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "abo", "sl", "ute", " ", "path", "s", " ", "of", " ", "all", " ", "the", " ", "files", " ", "used", " ", "in", " ", "the", " ", "pipeline", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "Values_", "(_", "graph_", ",_", "super", "pipeline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", ",", " ", "loop", " ", "over", " ", "all", " ", "of", " ", "the", " ", "option", " ", "nodes", " ", "and", " ", "check", " ", "tha", "t", " ", "the", " ", "data", " ", "types", " ", "for", " ", "all", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "valid", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "graph_", "._", "get", "Nodes_", "(_", "[_", "'", "option", "'_", ",_", "'", "file", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "Type_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "node", "Type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "node", " ", "values", " ", "are", " ", "command", "s", " ", "to", " ", "evaluate", " ", "at", " ", "run", " ", "time", ".", " ", "If", " ", "so", ",", " ", "do", " ", "not", " ", "perform", " ", "these", " ", "checks", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Command", "To", "Evaluate", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "all", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "node", " ", "and", " ", "check", " ", "the", " ", "data", " ", "types", ".", " ", "Start", " ", "with", " ", "all", " ", "predecessor", "s", " ", "to", " ", "this", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Data", "Type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "get", "Pred", "ece", "ssor", "s_", "(_", "node", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Data", "Type_", "=_", "check", "Node_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "predecessor", "Node", "Id_", ",_", "node", "Id_", ",_", "node", "Type_", ",_", "expected", "Data", "Type_", ",_", "values_", ",_", "is", "Input_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "expected", "Data", "Type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "successor", "Node", "Id_", "in_", "graph_", "._", "get", "Success", "ors_", "(_", "node", "Id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "Data", "Type_", "=_", "check", "Node_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "node", "Id_", ",_", "successor", "Node", "Id_", ",_", "node", "Type_", ",_", "expected", "Data", "Type_", ",_", "values_", ",_", "is", "Input_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Node_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "source_", ",_", "target_", ",_", "node", "Type_", ",_", "expected", "Data", "Type_", ",_", "values_", ",_", "is", "Input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "error", " ", "handling", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "er_", "._", "consiste", "nc", "y", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "pipeline", " ", "configura", "tion", " ", "data", "._", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "super", "pipeline_", "._", "pipeline", "Configura", "tion", "Data_", "[_", "super", "pipeline_", "._", "pipeline_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "require", "d", " ", "attribute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "long", "Form", "Argument_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data", "Type_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "data", "Type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "edge", " ", "hg", "as", " ", "bee", "n", " ", "marked", " ", "as", " ", "a", " ", "link", " ", "only", ".", " ", "Thi", "s", " ", "occur", "s", " ", "whe", "n", " ", "a", " ", "nodes", " ", "values", " ", "are", " ", "construct", "ed", " ", "usi", "ng", " ", "values", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anot", "her", " ", "node", ".", " ", "An", " ", "edge", " ", "is", " ", "include", "d", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "workf", "low", " ", "and", " ", "dependen", "cies", " ", "are", " ", "correct", ",", " ", "but", " ", "there", " ", "will", " ", "be", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "associate", "d", " ", "with", " ", "the", " ", "edge", " ", "and", " ", "the", " ", "follow", "ing", " ", "checks", " ", "are", " ", "not", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "is", "Link", "Only_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "is", "Link", "On", "ly", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "Link", "Only_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "the", " ", "first", " ", "argu", "ment", " ", "parsed", ",", " ", "populate", " ", "the", " ", "expected", "Data", "Type", " ", "variab", "le", " ", "with", " ", "the", " ", "data", " ", "type", " ", "for", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "expected", "Data", "Type_", ":_", "expected", "Data", "Type_", "=_", "data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "expected", "Data", "Type", " ", "is", " ", "populate", "d", " ", "and", " ", "this", " ", "data", " ", "type", " ", "is", " ", "different", " ", "to", " ", "the", " ", "expected", "Data", "Type", ",", " ", "this", " ", "implies", " ", "tha", "t", " ", "different", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", "s", " ", "usi", "ng", " ", "the", " ", "same", " ", "values", " ", "expect", " ", "different", " ", "data", " ", "types", ".", " ", "Thi", "s", " ", "is", " ", "clear", "ly", " ", "impossible", ",", " ", "so", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "elif_", "expected", "Data", "Type_", "!=_", "data", "Type_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Node", " ", "-", " ", "1", "'_", ",_", "data", "Type_", ",_", "expected", "Data", "Type_", ")_", ";_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "each", " ", "of", " ", "the", " ", "values", " ", "for", " ", "this", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "the", " ", "data", " ", "type", " ", "is", " ", "correct", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "is", "Correct", "Data", "Type_", "(_", "value_", ",_", "expected", "Data", "Type_", ")_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Node", " ", "-", " ", "2", "'_", ",_", "long", "Form", "Argument_", ",_", "value_", ",_", "data", "Type_", ",_", "type_", "(_", "value_", ")_", ")_", ";_", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "a", " ", "file", ",", " ", "check", " ", "tha", "t", " ", "the", " ", "extensi", "on", " ", "is", " ", "valid", ".", " ", "Do", " ", "not", " ", "perform", " ", "this", " ", "check", " ", "for", " ", "stub", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "node", "Type_", "==_", "'", "file", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "is", "Stu", "b", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "extensions_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "extensi", "ons", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "all", " ", "files", " ", "have", " ", "specified", " ", "extensi", "ons", ".", " ", "If", " ", "no", " ", "extensi", "ons", " ", "are", " ", "supplie", "d", ",", " ", "this", " ", "check", " ", "shou", "ld", " ", "not", " ", "be", " ", "perform", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "extensions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "target_", "if_", "is", "Input_", "else_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Node", "Id_", "=_", "source_", "if_", "is", "Input_", "else_", "target_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fail", " ", "if", " ", "there", " ", "was", " ", "an", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check", "Extensions_", "(_", "value_", ",_", "extensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "a", " ", "top", " ", "level", " ", "pipeline", " ", "argu", "ment", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "long", "Form", "Argument_", "in_", "data_", "._", "long", "Form", "Arguments_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "short", "Form", "Argument_", "=_", "data_", "._", "long", "Form", "Arguments_", "[_", "long", "Form", "Argument_", "]_", "._", "short", "Form", "Argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "._", "invalid", "Ext", "ensi", "on", "Pipeline_", "(_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "value_", ",_", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "pipeline", " ", "argu", "ment", " ", "exist", "s", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "list", " ", "the", " ", "task", " ", "and", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "short", "Form", "Argument_", "=_", "graph_", "._", "CM", "\\u", "get", "Arg", "ument", "Attribute_", "(_", "graph_", "._", "graph_", ",_", "source_", ",_", "target_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "._", "invalid", "Extension_", "(_", "task_", ",_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "value_", ",_", "extensions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "the", " ", "expected", " ", "data", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "expected", "Data", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "Correct", "Data", "Type_", "(_", "value_", ",_", "data", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "value", " ", "can", " ", "only", " ", "be", " ", "none", ",", " ", "if", " ", "this", " ", "is", " ", "a", " ", "flag", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "and_", "value_", "!=_", "0_", "and_", "data", "Type_", "!=_", "'", "flag", "'_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "not_", "value_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "an", " ", "integ", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data", "Type_", "==_", "'", "integ", "er", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "float", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "float", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "value_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "string", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "string", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "Boo", "lean", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "bool", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "'", "true", "'_", "or_", "value_", "==_", "'", "Tru", "e", "'_", "or_", "value_", "==_", "'", "fal", "se", "'_", "or_", "value_", "==_", "'", "Fal", "se", "'_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "expected", " ", "data", " ", "type", " ", "is", " ", "a", " ", "flag", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data", "Type_", "==_", "'", "flag", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "'", "set", "'_", "or_", "value_", "==_", "'", "unse", "t", "'_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "none", " ", "of", " ", "the", " ", "above", " ", "condition", "s", " ", "wer", "e", " ", "met", ",", " ", "the", " ", "data", " ", "type", " ", "is", " ", "incorrect", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Extensions_", "(_", "value_", ",_", "extensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "extensi", "ons", " ", "are", " ", "not", " ", "know", "n", " ", "(", "e", ".", "g", ".", " ", "are", " ", "liste", "d", " ", "as", " ", "'", "no", " ", "extensi", "on", "')", " ", "do", " ", "not", " ", "perform", " ", "this", " ", "check", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "extensions_", ")_", "==_", "1_", "and_", "extensions_", "[_", "0_", "]_", "==_", "'", "no", " ", "extensi", "on", "'_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "value", " ", "ends", " ", "with", " ", "any", " ", "of", " ", "the", " ", "extensi", "ons", ",", " ", "return", " ", "Tru", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "extension_", "in_", "extensions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "endswith_", "(_", "extension_", ")_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "return", " ", "Fal", "se", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Requ", "ired", "Arguments_", "(_", "graph_", ",_", "super", "pipeline_", ",_", "args_", ",_", "is", "Terminate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "error", " ", "handling", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "er_", "._", "consiste", "nc", "y", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Success_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Keep", " ", "track", " ", "of", " ", "nodes", " ", "tha", "t", " ", "can", " ", "have", " ", "thei", "r", " ", "values", " ", "construct", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "construct", "able", "Nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "defin", "ed", " ", "pipeline", " ", "argu", "ment", "s", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "argu", "ment", "s", " ", "liste", "d", " ", "as", " ", "require", "d", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bee", "n", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "argument_", "in_", "args_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "pipeline", " ", "speci", "fie", "s", " ", "if", " ", "this", " ", "argu", "ment", " ", "is", " ", "require", "d", " ", "or", " ", "not", ",", " ", "update", " ", "the", " ", "proper", "ties", " ", "of", " ", "the", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "specified", " ", "(", "i", ".", "e", ".", " ", "is", "Requ", "ired", " ", "==", " ", "Non", "e", "),", " ", "it", " ", "is", " ", "left", " ", "to", " ", "the", " ", "tool", " ", "configura", "tion", " ", "to", " ", "dete", "rmin", "e", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", ".", " ", "Thi", "s", " ", "allow", "s", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", " ", "to", " ", "not", " ", "only", " ", "speci", "fy", " ", "tha", "t", " ", "an_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "is", " ", "require", "d", " ", "even", " ", "if", " ", "the", " ", "underl", "ying", " ", "tool", " ", "doe", "sn", "'", "t", " ", "require", " ", "the", " ", "value", ",", " ", "the", " ", "pipeline", " ", "can", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "override", " ", "the", " ", "tool", "s", " ", "claim", " ", "tha", "t", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Required_", "==_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "graph", "Node", "Ids_", ":_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "the", " ", "associate", "d", " ", "graph", " ", "nodes", " ", "and", " ", "see", " ", "if", " ", "the", " ", "values", " ", "are", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "graph", "Node", "Ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "this", " ", "argu", "ment", " ", "was", " ", "import", "ed", " ", "from", " ", "a", " ", "task", " ", "in", " ", "the", " ", "pipeline", ".", " ", "If", " ", "so", ",", " ", "dete", "rmin", "e", " ", "if", " ", "there", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "instruct", "ion", "s", " ", "for", " ", "constructi", "ng", " ", "the", " ", "filename", " ", "(", "if", " ", "not", " ", "an", " ", "option", ").", " ", "On", "ly", " ", "terminate", " ", "if", " ", "the", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "for", " ", "an", " ", "option", ",", " ", "or", " ", "there", " ", "are", " ", "no", " ", "instruct", "ion", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "has", "Instructions", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "is", "Imported", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "import", "ed", "Fro", "m", "Task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "task_", ",_", "'", "tool", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "Data_", "=_", "super", "pipeline_", "._", "get", "Tool", "Data_", "(_", "tool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Instructions", "_", "=_", "True_", "if_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "values", " ", "have", "n", "'", "t", " ", "bee", "n", " ", "set", ",", " ", "terminate", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "pipeline", " ", "argu", "ment", " ", "liste", "d", " ", "as", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "so", " ", "must", " ", "be", " ", "set", " ", "by", " ", "the", " ", "user", " ", "(", "and", " ", "not", " ", "construct", "ed", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", "and_", "not_", "has", "Instructions", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "Form", "Argument_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "short", "Form", "Argument_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "description_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "task", "s", " ", "in", " ", "the", " ", "workflow_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "task_", "in_", "graph_", "._", "workflow_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "tool", " ", "for", " ", "the", " ", "task", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tool_", "=_", "super", "pipeline_", "._", "tasks_", "[_", "task_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tool", "Data_", "=_", "super", "pipeline_", "._", "get", "Tool", "Data_", "(_", "tool_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "for", " ", "the", " ", "tool", " ", "and", " ", "check", " ", "tha", "t", " ", "all", " ", "require", "d", " ", "argu", "ment", "s", " ", "have", " ", "a", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "tha", "t", " ", "the", " ", "node", " ", "has", " ", "values", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "argument_", "in_", "tool", "Data_", "._", "arguments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "argu", "ment", " ", "is", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Record", " ", "if", " ", "a", " ", "node", " ", "for", " ", "this", " ", "node", " ", "is", " ", "see", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "argu", "ment", " ", "is", " ", "for", " ", "an", " ", "input", " ", "file", ",", " ", "output", " ", "file", " ", "or", " ", "an", " ", "option", "._", "\\u\\u\\uNL\\u\\u\\u_", "is", "Input_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Inp", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "Output_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "is", "Output", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "an", " ", "output", " ", "file", " ", "with", " ", "constructi", "on", " ", "instruct", "ion", "s", ",", " ", "the", " ", "filename", "s", " ", "will", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "late", "r", ",", " ", "so", " ", "this", " ", "doe", "s", " ", "not", " ", "need", " ", "to", " ", "be", " ", "checke", "d", ".", " ", "Keep", " ", "track", " ", "of", " ", "the", " ", "nodes", " ", "whi", "ch", " ", "will", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "these", " ", "coul", "d", " ", "be", " ", "inputs", " ", "to", " ", "other", " ", "task", "s", " ", "and", " ", "so", " ", "the", " ", "check", " ", "for", " ", "existence", " ", "is", " ", "als", "o", " ", "not", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "these", " ", "input", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "with", " ", "input", " ", "files", " ", "and", " ", "options", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "Output_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "input", " ", "nodes", " ", "look", "ing", " ", "for", " ", "edge", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "graph_", "._", "CM", "\\u", "get", "Inp", "ut", "Nodes_", "(_", "graph_", "._", "graph_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "use", "s", " ", "the", " ", "require", "d", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "marked", " ", "as", " ", "not", " ", "require", "d", " ", "(", "i", ".", "e", ".", " ", "the", " ", "tool", "s", " ", "require", "ment", " ", "has", " ", "bee", "n", " ", "superc", "eded", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "instruct", "ion", "s", " ", "in", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "Instructions", "_", "=_", "False_", "if_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "==_", "None_", "else_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "Values_", "=_", "True_", "if_", "len_", "(_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ")_", "!=_", "0_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "has", "Values_", "and_", "not_", "has", "Instructions", "_", "and_", "node", "Id_", "not_", "in_", "construct", "able", "Nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "node", " ", "can", " ", "have", " ", "it", "'", "s", " ", "values", " ", "set", " ", "with", " ", "a", " ", "top", " ", "level", " ", "pipeline", " ", "argu", "ment", " ", "(", "e", ".", "g", ".", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "set", " ", "with", "out", " ", "defini", "ng", " ", "the", " ", "task", " ", "on", " ", "the", " ", "command", " ", "line", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "long", "Form", "Argument_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "long", "Form", "Argument_", "and_", "'.'_", "not_", "in_", "long", "Form", "Argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "short", " ", "form", " ", "of", " ", "the", " ", "pipeline", " ", "argu", "ment", " ", "and", " ", "the", " ", "argu", "ment", " ", "description", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "short", "Form", "Arg", "ument", " ", "=", " ", "args", ".", "argu", "ment", "s", "[", "long", "Form", "Arg", "ument", "].", "short", "Form", "Argument_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "short", "Form", "Argument_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "long", "Form", "Argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "not", " ", "a", " ", "top", " ", "level", " ", "argu", "ment", ",", " ", "provide", " ", "a", " ", "different", " ", "error", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "CHECK", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "short", " ", "form", " ", "version", " ", "of", " ", "the", " ", "argu", "ment", " ", "as", " ", "well", " ", "as", " ", "the", " ", "argu", "ment", " ", "description", ".", " ", "Thi", "s", " ", "is", " ", "as", " ", "defined_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "the", " ", "tool", ",", " ", "so", " ", "if", " ", "this", " ", "argu", "ment", " ", "can", " ", "be", " ", "set", " ", "usi", "ng", " ", "a", " ", "pipeline", " ", "argu", "ment", ",", " ", "these", " ", "values", " ", "are", " ", "incorrect", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "short", "Form", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "short", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "node", "Id_", ",_", "task_", ",_", "'", "description", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "unse", "t", "Requ", "ired", "Nest", "ed", "Argument_", "(_", "task_", ",_", "argument_", ",_", "short", "Form", "Argument_", ",_", "description_", ",_", "super", "pipeline_", "._", "pipeline_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "is", " ", "no", " ", "node", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "this", " ", "means", " ", "tha", "t", " ", "the", " ", "pipeline", " ", "configura", "tion", " ", "file", " ", "doe", "s", " ", "not", " ", "contain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "unique", " ", "or", " ", "shared", " ", "node", " ", "for", " ", "this", " ", "argu", "ment", ".", " ", "In", " ", "addition", ",", " ", "the", " ", "value", " ", "has", " ", "not", " ", "bee", "n", " ", "provided", " ", "on", " ", "the", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "line", ".", " ", "Thi", "s", " ", "means", " ", "tha", "t", " ", "no", " ", "values", " ", "will", " ", "get", " ", "assign", "ed", " ", "to", " ", "this", " ", "argu", "ment", ",", " ", "so", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "instructions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "argu", "ment", "s", " ", "wer", "e", " ", "import", "ed", " ", "for", " ", "this", " ", "task", ".", " ", "If", " ", "so", ",", " ", "check", " ", "to", " ", "see", " ", "if", " ", "this", " ", "argu", "ment", " ", "is", " ", "there", "fore", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avail", "able", " ", "on", " ", "the", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "task_", "==_", "super", "pipeline_", "._", "pipeline", "Configura", "tion", "Data_", "[_", "super", "pipeline_", "._", "pipeline_", "]_", "._", "import", "Arg", "ument", "s", "Fro", "m", "Tool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Terminate", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "unse", "t", "Requ", "ired", "Argument_", "(_", "argument_", ",_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "short", "Form", "Argument_", ",_", "args_", "._", "arguments_", "[_", "argument_", "]_", "._", "description_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Inp", "ut", "Node_", "(_", "task_", ",_", "tool_", ",_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "no", " ", "node", ",", " ", "construct", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instructions_", "[_", "'", "method", "'_", "]_", "==_", "'", "from", " ", "tool", " ", "argu", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "argu", "ment", "To", "Use_", "=_", "instructions_", "[_", "'", "use", " ", "argu", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "all", " ", "nodes", " ", "for", " ", "this", " ", "task", " ", "usi", "ng", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "predecessor", "Node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "==_", "argu", "ment", "To", "Use_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "node", "Address_", "=_", "str_", "(_", "predecessor", "Node", "Id_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "node", "Address_", ",_", "task_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attach", " ", "the", " ", "name", " ", "of", " ", "the", " ", "node", " ", "from", " ", "whi", "ch", " ", "this", " ", "filename", " ", "is", " ", "construct", "ed", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Address_", ",_", "'", "construct", "Us", "ing", "Node", "'_", ",_", "predecessor", "Node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "the", " ", "constructi", "on", " ", "method", " ", "doe", "s", " ", "not", " ", "use", " ", "anot", "her", " ", "argu", "ment", ",", " ", "create", " ", "a", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node", "Address_", "=_", "str_", "(_", "task_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "node", "Address_", ",_", "task_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "consider", " ", "output", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Attribute_", "(_", "argument_", ",_", "'", "constructi", "on", "Instructions", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "output", " ", "nodes", " ", "look", "ing", " ", "for", " ", "edge", "s", " ", "tha", "t", " ", "use", " ", "this", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node", "Id_", "in_", "graph_", "._", "CM", "\\u", "get", "Output", "Nodes_", "(_", "graph_", "._", "graph_", ",_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "task_", ",_", "node", "Id_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "node", " ", "use", "s", " ", "the", " ", "require", "d", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "constructi", "on", " ", "instruct", "ion", "s", " ", "are", " ", "provided", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instructions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "constructi", "on", " ", "is", " ", "to", " ", "proceed", " ", "by", " ", "usi", "ng", " ", "an", " ", "argu", "ment", " ", "from", " ", "this", " ", "task", ",", " ", "ensure", " ", "tha", "t", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "is", " ", "eit", "her", " ", "set", ",", " ", "or", " ", "is", " ", "ite", "lf", " ", "a", " ", "successor", " ", "to", " ", "anot", "her", " ", "task", " ", "and", " ", "so", " ", "has", " ", "the", " ", "chance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "bei", "ng", " ", "set", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instructions_", "[_", "'", "method", "'_", "]_", "==_", "'", "from", " ", "tool", " ", "argu", "ment", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "Form", "Argument_", "=_", "tool", "Data_", "._", "get", "Long", "Form", "Argument_", "(_", "instructions_", "[_", "'", "use", " ", "argu", "ment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "found", "Node_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "predecessor", "Node", "Id_", "in_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "task_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "edge", "Argument_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "predecessor", "Node", "Id_", ",_", "task_", ",_", "'", "long", "Form", "Arg", "ument", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "edge", "Argument_", "==_", "long", "Form", "Argument_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "found", "Node_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "constructi", "on", "Node", "Id_", "=_", "predecessor", "Node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "node", " ", "bei", "ng", " ", "used", " ", "to", " ", "construct", " ", "the", " ", "file", " ", "doe", "s", " ", "not", " ", "exist", ",", " ", "then", " ", "it", " ", "cann", "ot", " ", "be", " ", "used", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "the", " ", "filename", " ", "and", " ", "so", " ", "some", " ", "data", " ", "must", " ", "be", " ", "missi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Node", "For", "Construct", "ion_", "(_", "task_", ",_", "tool_", ",_", "argument_", ",_", "long", "Form", "Argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "node", " ", "used", " ", "to", " ", "construct", " ", "this", " ", "filename", " ", "exist", "s", ",", " ", "but", " ", "it", " ", "has", " ", "no", " ", "values", " ", "or", " ", "predecessor", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "als", "o", " ", "will", " ", "not", " ", "be", " ", "able", " ", "to", " ", "be", " ", "used", " ", "to", " ", "construct", " ", "the", " ", "argu", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "eli", "f", " ", "not", " ", "graph", ".", "get", "Graph", "Node", "Attribute", "(", "constructi", "on", "Node", "Id", ",", " ", "'", "values", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "graph", ".", "graph", ".", "predecessor", "s", "(", "constructi", "on", "Node", "Id", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "ERROR_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "('", "data", "Cons", "iste", "nc", "y", " ", "-", " ", "check", "Requ", "ired", "Arg", "ument", "s", " ", "-", " ", "cann", "ot", " ", "construct", " ", "output", "',", " ", "task", ",", " ", "argu", "ment", ");", " ", "exit", "(", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "node", " ", "to", " ", "the", " ", "list", " ", "of", " ", "nodes", " ", "tha", "t", " ", "have", " ", "the", " ", "potenti", "al", " ", "to", " ", "be", " ", "construct", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "node", "Id_", "not_", "in_", "construct", "able", "Nodes_", ":_", "construct", "able", "Nodes_", "._", "append_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "instruct", "ion", "s", " ", "are", " ", "provided", " ", "check", " ", "tha", "t", " ", "there", " ", "are", " ", "values", " ", "supplie", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instructions_", "and_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Success_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Terminate", "_", ":_", "errors_", "._", "no", "Construct", "ion", "Method_", "(_", "task_", ",_", "tool_", ",_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "node", " ", "exist", "s", " ", "for", " ", "this", " ", "argu", "ment", ",", " ", "dete", "rmin", "e", " ", "the", " ", "course", " ", "of", " ", "action", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found", "Node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "no", " ", "instruct", "ion", "s", " ", "for", " ", "constructi", "ng", " ", "the", " ", "filename", ",", " ", "terminate", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "instructions_", ":_", "print_", "(_", "'", "data", "Cons", "iste", "nc", "y", ".", "check", "Requ", "ired", "Arg", "ument", "s", " ", "-", " ", "no", " ", "output", " ", "node", "'_", ",_", "task_", ",_", "argument_", ")_", ";_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", " ", "are", " ", "instruct", "ion", "s", ",", " ", "but", " ", "no", " ", "node", ",", " ", "construct", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "node", "Address_", "=_", "str_", "(_", "task_", "+_", "'.'_", "+_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "argu", "ment", "Attributes_", "=_", "tool", "Data_", "._", "get", "Arg", "ument", "Data_", "(_", "argument_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "this", " ", "node", " ", "is", " ", "a", " ", "stub", ".", " ", "If", " ", "so", ",", " ", "this", " ", "is", " ", "an", " ", "output", " ", "tha", "t", " ", "is", " ", "not", " ", "shared", " ", "with", " ", "any", " ", "other", " ", "task", "s", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "construct", " ", "as", " ", "many", " ", "nodes", " ", "as", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "argu", "ment", "Attributes_", "._", "is", "Stub_", ":_", "#", "graph", ".", "construct", "Output", "Stu", "bs", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "stub", "Extension_", "in_", "enumerate_", "(_", "argu", "ment", "Attributes_", "._", "stub", "Extensions_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifi", "ed", "Node", "Address_", "=_", "str_", "(_", "node", "Address_", "+_", "'.'_", "+_", "stub", "Extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "=_", "deepcopy_", "(_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "._", "stub", "Extension_", "=_", "stub", "Extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stub", "Attributes_", "._", "is", "Prim", "ary", "Stu", "b", "Node_", "=_", "True_", "if_", "i_", "==_", "0_", "else_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "File", "Node_", "(_", "modifi", "ed", "Node", "Address_", ",_", "modifi", "ed", "Node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "task_", ",_", "modifi", "ed", "Node", "Address_", ",_", "stub", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "not", " ", "a", " ", "stub", ",", " ", "add", " ", "the", " ", "node", " ", "and", " ", "edge", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "add", "File", "Node_", "(_", "node", "Address_", ",_", "node", "Address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "add", "Edge_", "(_", "task_", ",_", "node", "Address_", ",_", "argu", "ment", "Attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Return", " ", "if", " ", "the", " ", "operati", "on", " ", "was", " ", "a", " ", "success", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "is", "Success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pur", "ge", "Emp", "ty", "Nodes_", "(_", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Loop", " ", "over", " ", "all", " ", "the", " ", "option", " ", "nodes", " ", "in", " ", "the", " ", "graph", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node", "Id_", "in_", "graph_", "._", "get", "Nodes_", "(_", "'", "option", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "empty", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "print_", "(_", "'", "ERROR", " ", "-", " ", "data", "Cons", "iste", "nc", "y", " ", "-", " ", "pur", "ge", "Emp", "yth", "Node", "s", "'_", ")_", ";_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "graph_", "._", "remove", "\\u", "node_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "isolated", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "node", "Id_", ")_", "and_", "not_", "graph_", "._", "graph_", "._", "successors_", "(_", "node", "Id_", ")_", ":_", "graph_", "._", "graph_", "._", "remove", "\\u", "node_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "n", " ", "loop", " ", "over", " ", "all", " ", "file", " ", "nodes", ",", " ", "remo", "ving", " ", "value", "less", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node", "Id_", "in_", "graph_", "._", "get", "Nodes_", "(_", "'", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "is", "Requ", "ired", "'_", ")_", ":_", "print_", "(_", "'", "ERROR", " ", "-", " ", "data", "Cons", "iste", "nc", "y", " ", "-", " ", "pur", "ge", "Emp", "yth", "Node", "s", "'_", ")_", ";_", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "._", "graph_", "._", "remove", "\\u", "node_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "isolated", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "node", "Id_", ")_", "and_", "not_", "graph_", "._", "graph_", "._", "successors_", "(_", "node", "Id_", ")_", ":_", "graph_", "._", "graph_", "._", "remove", "\\u", "node_", "(_", "node", "Id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "File", "Paths_", "(_", "graph_", ",_", "gk", "no", "Arguments_", ",_", "gk", "no_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "input", "Files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "input", " ", "and", " ", "output", " ", "path", "s", " ", "as", " ", "defin", "ed", " ", "by", " ", "the", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "defin", "ed", "Inp", "ut", "Path_", "=_", "gk", "no_", "._", "get", "G", "kno", "Argument_", "(_", "'", "GK", "NO", "-", "INPUT", "-", "PATH", "'_", ",_", "gk", "no", "Arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defin", "ed", "Output", "Path_", "=_", "gk", "no_", "._", "get", "G", "kno", "Argument_", "(_", "'", "GK", "NO", "-", "OUTPU", "T", "-", "PATH", "'_", ",_", "gk", "no", "Arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "path", " ", "of", " ", "the", " ", "input", " ", "and", " ", "the", " ", "output", " ", "director", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "input", "Path_", "=_", "defin", "ed", "Inp", "ut", "Path_", "if_", "defin", "ed", "Inp", "ut", "Path_", "else_", "str_", "(_", "'$", "(", "PWD", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "Path_", "=_", "defin", "ed", "Output", "Path_", "if_", "defin", "ed", "Output", "Path_", "else_", "str_", "(_", "'$", "(", "PWD", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "path", " ", "is", " ", "'.'", ",", " ", "set", " ", "to", " ", "$(", "PWD", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "input", "Path_", "==_", "'.'_", ":_", "input", "Path_", "=_", "'$", "(", "PWD", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "output", "Path_", "==_", "'.'_", ":_", "output", "Path_", "=_", "'$", "(", "PWD", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "input", " ", "and", " ", "output", " ", "path", "s", " ", "end", " ", "with", " ", "/.", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "input", "Path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "input", "Path_", "+=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "output", "Path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "output", "Path_", "+=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pars", "e", " ", "all", " ", "of", " ", "the", " ", "file", " ", "nodes", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node", "Id_", "in_", "graph_", "._", "get", "Nodes_", "(_", "'", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "the", " ", "file", " ", "is", " ", "an", " ", "input", " ", "or", " ", "output", " ", "file", ".", " ", "Sin", "ce", " ", "the", " ", "node", " ", "coul", "d", " ", "be", " ", "feed", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "or", " ", "from", " ", "multiple", " ", "task", "s", ",", " ", "a", " ", "file", " ", "is", " ", "an", " ", "input", ",", " ", "if", " ", "and", " ", "only", " ", "if", ",", " ", "the", " ", "file", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "associate", "d", " ", "with", " ", "the", " ", "option", " ", "node", " ", "have", " ", "no", " ", "predecessor", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Input_", "=_", "False_", "if_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "node", "Id_", ")_", "else_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "graph_", "._", "graph_", "._", "successors_", "(_", "node", "Id_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "graph_", "._", "graph_", "._", "predecessor", "s_", "(_", "node", "Id_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "node", "Id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "this", " ", "is", " ", "a", " ", "stub", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "Stub_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "source_", ",_", "target_", ",_", "'", "is", "Stu", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "Stub_", ":_", "stub", "Extension_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "source_", ",_", "target_", ",_", "'", "stub", "Ext", "ensi", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "if", " ", "a", " ", "file", " ", "location", " ", "is", " ", "set", " ", "for", " ", "the", " ", "argu", "ment", ".", " ", "If", " ", "so", ",", " ", "add", " ", "this", " ", "location", " ", "to", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "file", "Location_", "=_", "graph_", "._", "get", "Arg", "ument", "Attribute_", "(_", "source_", ",_", "target_", ",_", "'", "file", "Locat", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "values", " ", "associate", "d", " ", "with", " ", "the", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "update", "d", "Values_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", "in_", "graph_", "._", "get", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "value", " ", "to", " ", "include", " ", "the", " ", "extensi", "on", ",", " ", "if", " ", "this", " ", "is", " ", "a", " ", "stub", " ", "(", "if", " ", "necessar", "y", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "Stub_", "and_", "not_", "value_", "._", "endswith_", "(_", "stub", "Extension_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifi", "ed", "Value_", "=_", "str_", "(_", "value_", "+_", "stub", "Extension_", ")_", "if_", "'.'_", "in_", "stub", "Extension_", "else_", "str_", "(_", "value_", "+_", "'.'_", "+_", "stub", "Extension_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "modifi", "ed", "Value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "value", " ", "alr", "ead", "y", " ", "has", " ", "a", " ", "path", ".", " ", "If", " ", "not", ",", " ", "add", " ", "the", " ", "input", " ", "or", " ", "output", " ", "path", ".", " ", "If", " ", "the", " ", "path_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "was", " ", "defin", "ed", " ", "by", " ", "the", " ", "user", " ", "on", " ", "the", " ", "command", " ", "line", ",", " ", "override", " ", "any", " ", "path", " ", "tha", "t", " ", "is", " ", "alr", "ead", "y", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "tha", "t", " ", "supplie", "d", ".", " ", "In", " ", "addition", ",", " ", "store", " ", "all", " ", "of", " ", "the", " ", "input", " ", "files", ".", " ", "Sin", "ce", " ", "these", " ", "are", " ", "specifica", "ll", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", " ", "as", " ", "files", " ", "tha", "t", " ", "are", " ", "not", " ", "created", " ", "by", " ", "any", " ", "task", " ", "in", " ", "the", " ", "pipeline", ",", " ", "these", " ", "files", " ", "need", " ", "to", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "order", " ", "for", " ", "the", " ", "pipeline", " ", "to", " ", "run", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "Input_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "a", " ", "file", " ", "location", " ", "is", " ", "specified", " ", "with", " ", "the", " ", "argu", "ment", ",", " ", "the", " ", "value", " ", "shou", "ld", " ", "not", " ", "have", " ", "the", " ", "path", " ", "alter", "ed", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "file", " ", "location", " ", "shou", "ld", " ", "be", " ", "store", "d", ".", " ", "Thi", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "defin", "e", " ", "where", " ", "the", " ", "file", " ", "shou", "ld", " ", "exist", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "makefile", ",", " ", "but", " ", "will", " ", "not", " ", "appear", " ", "in", " ", "the", " ", "value", " ", "on", " ", "the", " ", "command", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "file", "Location_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "file", "Locat", "ion", "'_", ",_", "file", "Location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d", "Value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "the", " ", "path", " ", "if", " ", "necessar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "defin", "ed", "Inp", "ut", "Path_", ":_", "update", "d", "Value_", "=_", "str_", "(_", "input", "Path_", "+_", "modifi", "ed", "Value_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "update", "d", "Value_", "=_", "str_", "(_", "modifi", "ed", "Value_", ")_", "if_", "'/'_", "in_", "modifi", "ed", "Value_", "else_", "str_", "(_", "input", "Path_", "+_", "modifi", "ed", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "d", "Values_", "._", "append_", "(_", "update", "d", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "input", " ", "files", " ", "to", " ", "the", " ", "list", " ", "of", " ", "input", " ", "files", " ", "require", "d", " ", "by", " ", "the", " ", "pipeline", ".", " ", "The", "se", " ", "will", " ", "be", " ", "checke", "d", " ", "to", " ", "ensure", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "the", "y", " ", "exist", " ", "prior", " ", "to", " ", "pipeline", " ", "executi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "file", "Location_", ":_", "input", "Files_", "._", "append_", "(_", "str_", "(_", "file", "Location_", "+_", "update", "d", "Value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "input", "Files_", "._", "append_", "(_", "update", "d", "Value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "defin", "ed", "Output", "Path_", ":_", "update", "d", "Values_", "._", "append_", "(_", "str_", "(_", "output", "Path_", "+_", "modifi", "ed", "Value_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "update", "d", "Values_", "._", "append_", "(_", "str_", "(_", "modifi", "ed", "Value_", ")_", "if_", "'/'_", "in_", "modifi", "ed", "Value_", "else_", "str_", "(_", "output", "Path_", "+_", "modifi", "ed", "Value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Replace", " ", "the", " ", "values", " ", "store", "d", " ", "in", " ", "the", " ", "node", " ", "with", " ", "the", " ", "values", " ", "inclu", "ding", " ", "the", " ", "abs", "olute", " ", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "graph_", "._", "set", "Graph", "Node", "Attribute_", "(_", "node", "Id_", ",_", "'", "values", "'_", ",_", "update", "d", "Values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
yadutaf/ctop/cgroup_top.py
[ { "content": "def run(user, cmd, interactive=False):\n '''\n Run ``cmd`` as ``user``. If ``interactive`` is True, save any curses status\n and synchronously run the command in foreground. Otherwise, run the command\n in background, discarding any output.\n\n special user -2 means: current user\n '''\n prefix = []\n cur_uid = os.getuid()\n try:\n cur_user = pwd.getpwuid(cur_uid).pw_name\n except:\n cur_user = cur_uid\n\n if user != cur_user and user != -2:\n if cur_uid == 0:\n prefix = ['su', user]\n if user == 'root':\n prefix = ['sudo']\n else:\n prefix = ['sudo', '-u', user]\n\n if interactive:\n # Prepare screen for interactive command\n curses.savetty()\n curses.nocbreak()\n curses.echo()\n curses.endwin()\n\n # Run command\n pty.spawn(prefix+cmd)\n\n # Restore screen\n init_screen()\n curses.resetty()\n else:\n with open('/dev/null', 'w') as dev_null:\n subprocess.Popen(\n prefix+cmd,\n stdout=dev_null,\n stderr=dev_null,\n close_fds=True,\n )", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 198 }, { "content": " @property\n def owner(self):\n path = os.path.join(self.base_path, self.path, 'tasks')\n uid = os.stat(path).st_uid\n try:\n return pwd.getpwuid(uid).pw_name\n except:\n return uid", "metadata": "root.Cgroup.owner", "header": "['class', 'Cgroup', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def _coerce(self, value):\n try:\n return int(value)\n except:\n pass\n\n try:\n return float(value)\n except:\n pass\n\n return value", "metadata": "root.Cgroup._coerce", "header": "['class', 'Cgroup', '(', 'object', ')', ':', '___EOS___']", "index": 293 }, { "content": "def display(scr, results, conf):\n # Sort and render\n results = sorted(results, key=lambda line: line.get(conf['sort_by'], 0), reverse=not conf['sort_asc'])\n results = prepare_tree(results)\n\n CONFIGURATION['cgroups'] = [cgroup['cgroup'] for cgroup in results]\n\n # Ensure selected line name synced with num\n if CONFIGURATION['follow']:\n while True:\n try:\n i = CONFIGURATION['cgroups'].index(CONFIGURATION['selected_line_name'])\n CONFIGURATION['selected_line_num'] = i\n break\n except:\n CONFIGURATION['selected_line_name'] = os.path.dirname(CONFIGURATION['selected_line_name'])\n else:\n CONFIGURATION['selected_line_num'] = min(len(results)-1, CONFIGURATION['selected_line_num'])\n CONFIGURATION['selected_line_name'] = CONFIGURATION['cgroups'][CONFIGURATION['selected_line_num']]\n CONFIGURATION['selected_line'] = results[CONFIGURATION['selected_line_num']]\n\n # Get display informations\n height, width = scr.getmaxyx()\n list_height = height - 2 # title + status lines\n\n # Update offset\n max_offset = max(0, len(results) - list_height)\n # selected line above screen limit\n if CONFIGURATION['selected_line_num'] < CONFIGURATION['offset']:\n CONFIGURATION['offset'] = CONFIGURATION['selected_line_num']\n # selected line below screen limit\n elif CONFIGURATION['selected_line_num'] - CONFIGURATION['offset'] > list_height - 1:\n CONFIGURATION['offset'] = CONFIGURATION['selected_line_num'] - list_height + 1\n # offset non consistent\n elif CONFIGURATION['offset'] > max_offset:\n CONFIGURATION['offset'] = max_offset\n\n # Display statistics\n scr.clear()\n\n # Title line && templates\n x = 0\n line_tpl = []\n scr.addstr(0, 0, ' '*width, curses.color_pair(1))\n\n for col in COLUMNS:\n # Build templates\n title_fmt = '{0:%s%ss}' % (col.align, col.width)\n line_tpl.append(col.col_fmt % (col.width))\n\n # Build title line\n color = 2 if col.col_sort == conf['sort_by'] else 1\n try:\n scr.addstr(0, x, title_fmt.format(col.title)+' ', curses.color_pair(color))\n except:\n # Handle narrow screens\n break\n if col.width:\n x += col.width + 1\n\n # Content\n lineno = 1\n for line in results[CONFIGURATION['offset']:]:\n y = 0\n if lineno-1 == CONFIGURATION['selected_line_num']-CONFIGURATION['offset']:\n col_reg, col_tree = curses.color_pair(2), curses.color_pair(2)\n else:\n col_reg, col_tree = colors = curses.color_pair(0), curses.color_pair(4)\n\n # Draw line background\n try:\n scr.addstr(lineno, 0, ' '*width, col_reg)\n except _curses.error:\n # Handle small screens\n break\n\n # Draw line content\n try:\n for col in COLUMNS:\n cell_tpl = col.col_fmt % (col.width if col.width else 1)\n data_point = line.get(col.col_data, '')\n\n if col.title == 'CGROUP' and CONFIGURATION['tree']:\n data_point = os.path.basename(data_point) or '[root]'\n\n for c in line.get('_tree', []):\n scr.addch(c, col_tree)\n y+=1\n\n scr.addstr(lineno, y, cell_tpl.format(data_point)+' ', col_reg)\n if col.width:\n y += col.width + 1\n except _curses.error:\n # Handle narrow screens\n pass\n lineno += 1\n else:\n # Make sure last line did not wrap, clear it if needed\n try: scr.addstr(lineno, 0, ' '*width)\n except _curses.error: pass\n\n # status line\n try:\n color = curses.color_pair(2)\n try:\n scr.addstr(height-1, 0, ' '*(width), color)\n except:\n # Last char wraps, on purpose: draw full line\n pass\n\n selected = results[CONFIGURATION['selected_line_num']]\n\n scr.addstr(height-1, 0, \" CTOP \", color)\n scr.addch(curses.ACS_VLINE, color)\n scr.addstr(\" [P]ause: \"+('On ' if CONFIGURATION['pause_refresh'] else 'Off '), color)\n scr.addch(curses.ACS_VLINE, color)\n scr.addstr(\" [F]ollow: \"+('On ' if CONFIGURATION['follow'] else 'Off ') , color)\n scr.addch(curses.ACS_VLINE, color)\n scr.addstr(\" [F5] Toggle %s view \"%('list' if CONFIGURATION['tree'] else 'tree'), color)\n scr.addch(curses.ACS_VLINE, color)\n\n # Fold control\n if CONFIGURATION['tree']:\n scr.addstr(\" [+/-] %s \"%('unfold' if selected['cgroup'] in CONFIGURATION['fold'] else 'fold'), color)\n scr.addch(curses.ACS_VLINE, color)\n\n # Do we have any actions available for *selected* line ?\n selected_type = selected['type']\n if selected_type == 'docker' and HAS_DOCKER or \\\n selected_type in ['lxc', 'lxc-user'] and HAS_LXC or \\\n selected_type == 'openvz' and HAS_OPENVZ:\n if selected_type == 'openvz':\n scr.addstr(\" [A]ttach, [E]nter, [S]top, [C]hkpnt, [K]ill \", color)\n else:\n scr.addstr(\" [A]ttach, [E]nter, [S]top, [K]ill \", color)\n scr.addch(curses.ACS_VLINE, color)\n\n scr.addstr(\" [Q]uit\", color)\n except _curses.error:\n # Handle narrow screens\n pass\n\n scr.refresh()", "metadata": "root.display", "header": "['module', '___EOS___']", "index": 600 }, { "content": "def init_screen():\n curses.start_color() # load colors\n curses.use_default_colors()\n curses.noecho() # do not echo text\n curses.cbreak() # do not wait for \"enter\"\n curses.mousemask(curses.ALL_MOUSE_EVENTS)\n\n # Hide cursor, if terminal AND curse supports it\n if hasattr(curses, 'curs_set'):\n try:\n curses.curs_set(0)\n except:\n pass", "metadata": "root.init_screen", "header": "['module', '___EOS___']", "index": 929 } ]
[ { "span": "except:", "start_line": 210, "start_column": 4, "end_line": 210, "end_column": 11 }, { "span": "except:", "start_line": 268, "start_column": 8, "end_line": 268, "end_column": 15 }, { "span": "except:", "start_line": 296, "start_column": 8, "end_line": 296, "end_column": 15 }, { "span": "except:", "start_line": 301, "start_column": 8, "end_line": 301, "end_column": 15 }, { "span": "except:", "start_line": 614, "start_column": 12, "end_line": 614, "end_column": 19 }, { "span": "except:", "start_line": 654, "start_column": 8, "end_line": 654, "end_column": 15 }, { "span": "except:", "start_line": 706, "start_column": 8, "end_line": 706, "end_column": 15 }, { "span": "except:", "start_line": 940, "start_column": 8, "end_line": 940, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "user_", ",_", "cmd_", ",_", "interactive_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "``", "cmd", "``", " ", "as", " ", "``", "user", "``.", " ", "If", " ", "``", "interactive", "``", " ", "is", " ", "Tru", "e", ",", " ", "save", " ", "any", " ", "curse", "s", " ", "status", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "synchron", "ously", " ", "run", " ", "the", " ", "command", " ", "in", " ", "fore", "ground", ".", " ", "Ot", "her", "wis", "e", ",", " ", "run", " ", "the", " ", "command", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "background", ",", " ", "discard", "ing", " ", "any", " ", "output", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "special", " ", "user", " ", "-", "2", " ", "means", ":", " ", "current", " ", "user", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "uid_", "=_", "os_", "._", "getu", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "user_", "=_", "pwd_", "._", "getpw", "uid_", "(_", "cur", "\\u", "uid_", ")_", "._", "pw", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "user_", "=_", "cur", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user_", "!=_", "cur", "\\u", "user_", "and_", "user_", "!=_", "-_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cur", "\\u", "uid_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "[_", "'", "su", "'_", ",_", "user_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user_", "==_", "'", "root", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "[_", "'", "sudo", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "[_", "'", "sudo", "'_", ",_", "'-", "u", "'_", ",_", "user_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Prepare", " ", "screen", " ", "for", " ", "interactive", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curses_", "._", "save", "tty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "noc", "break_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "echo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "end", "win_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "pty", "_", "._", "spawn_", "(_", "prefix_", "+_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "screen_", "\\u\\u\\uNL\\u\\u\\u_", "init", "\\u", "screen_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "reset", "ty_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'/", "dev", "/", "null", "'_", ",_", "'", "w", "'_", ")_", "as_", "dev", "\\u", "null_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "+_", "cmd_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "dev", "\\u", "null_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "dev", "\\u", "null_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "close", "\\u", "fds_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cg", "roup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "owner_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "base", "\\u", "path_", ",_", "self_", "._", "path_", ",_", "'", "task", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "os_", "._", "stat_", "(_", "path_", ")_", "._", "st", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "pwd_", "._", "getpw", "uid_", "(_", "uid_", ")_", "._", "pw", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cg", "roup_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "coerce", "_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "display_", "(_", "scr_", ",_", "results_", ",_", "conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sort", " ", "and", " ", "render_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "sorted_", "(_", "results_", ",_", "key_", "=_", "lambda_", "line_", ":_", "line_", "._", "get_", "(_", "conf_", "[_", "'", "sort", "\\u", "by", "'_", "]_", ",_", "0_", ")_", ",_", "reverse_", "=_", "not_", "conf_", "[_", "'", "sort", "\\u", "asc", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "prepar", "e\\u", "tree_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONFIGURATION", "_", "[_", "'", "cgroup", "s", "'_", "]_", "=_", "[_", "cgroup", "_", "[_", "'", "cgroup", "'_", "]_", "for_", "cgroup", "_", "in_", "results_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "selecte", "d", " ", "line", " ", "name", " ", "synced", " ", "with", " ", "num_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "CONFIGURATION", "_", "[_", "'", "follow", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "CONFIGURATION", "_", "[_", "'", "cgroup", "s", "'_", "]_", "._", "index_", "(_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "name", "'_", "]_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "=_", "min_", "(_", "len_", "(_", "results_", ")_", "-_", "1_", ",_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "name", "'_", "]_", "=_", "CONFIGURATION", "_", "[_", "'", "cgroup", "s", "'_", "]_", "[_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "'_", "]_", "=_", "results_", "[_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "display", " ", "informations", "_", "\\u\\u\\uNL\\u\\u\\u_", "height_", ",_", "width_", "=_", "scr_", "._", "getma", "xy", "x_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "height_", "=_", "height_", "-_", "2_", "#", " ", "title", " ", "+", " ", "status", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "offset_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "offset_", "=_", "max_", "(_", "0_", ",_", "len_", "(_", "results_", ")_", "-_", "list", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "selecte", "d", " ", "line", " ", "above", " ", "screen", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "<_", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", "=_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "selecte", "d", " ", "line", " ", "belo", "w", " ", "screen", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "-_", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", ">_", "list", "\\u", "height_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", "=_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "-_", "list", "\\u", "height_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "offset", " ", "non", " ", "consistent", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", ">_", "max", "\\u", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", "=_", "max", "\\u", "offset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Display", " ", "statistics_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scr_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tit", "le", " ", "line", " ", "&&", " ", "templates_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "tpl_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "0_", ",_", "0_", ",_", "'", " ", "'_", "*_", "width_", ",_", "curses_", "._", "color", "\\u", "pair_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "col_", "in_", "COLUMNS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Build", " ", "templates_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title", "\\u", "fmt_", "=_", "'{", "0", ":", "%", "s", "%", "ss", "}'_", "%_", "(_", "col_", "._", "align_", ",_", "col_", "._", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "tpl_", "._", "append_", "(_", "col_", "._", "col", "\\u", "fmt_", "%_", "(_", "col_", "._", "width_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "title", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "2_", "if_", "col_", "._", "col", "\\u", "sort_", "==_", "conf_", "[_", "'", "sort", "\\u", "by", "'_", "]_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "._", "addstr_", "(_", "0_", ",_", "x_", ",_", "title", "\\u", "fmt_", "._", "format_", "(_", "col_", "._", "title_", ")_", "+_", "'", " ", "'_", ",_", "curses_", "._", "color", "\\u", "pair_", "(_", "color_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "narrow", " ", "screens", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "._", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "+=_", "col_", "._", "width_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Content_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lineno_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "results_", "[_", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lineno_", "-_", "1_", "==_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "-_", "CONFIGURATION", "_", "[_", "'", "offset", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "reg_", ",_", "col", "\\u", "tree_", "=_", "curses_", "._", "color", "\\u", "pair_", "(_", "2_", ")_", ",_", "curses_", "._", "color", "\\u", "pair_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "reg_", ",_", "col", "\\u", "tree_", "=_", "colors_", "=_", "curses_", "._", "color", "\\u", "pair_", "(_", "0_", ")_", ",_", "curses_", "._", "color", "\\u", "pair_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "line", " ", "background_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "._", "addstr_", "(_", "lineno_", ",_", "0_", ",_", "'", " ", "'_", "*_", "width_", ",_", "col", "\\u", "reg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "\\u", "curses_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "small", " ", "screens", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "line", " ", "content_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "col_", "in_", "COLUMNS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "tpl_", "=_", "col_", "._", "col", "\\u", "fmt_", "%_", "(_", "col_", "._", "width_", "if_", "col_", "._", "width_", "else_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "point_", "=_", "line_", "._", "get_", "(_", "col_", "._", "col", "\\u", "data_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "col_", "._", "title_", "==_", "'", "CG", "RO", "UP", "'_", "and_", "CONFIGURATION", "_", "[_", "'", "tree", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "data\\u", "point_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "data\\u", "point_", ")_", "or_", "'[", "root", "]'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "c_", "in_", "line_", "._", "get_", "(_", "'\\u", "tree", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "scr_", "._", "addc", "h_", "(_", "c_", ",_", "col", "\\u", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "lineno_", ",_", "y_", ",_", "cell", "\\u", "tpl_", "._", "format_", "(_", "data\\u", "point_", ")_", "+_", "'", " ", "'_", ",_", "col", "\\u", "reg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "col_", "._", "width_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "y_", "+=_", "col_", "._", "width_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "\\u", "curses_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "narrow", " ", "screens", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lineno_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "last", " ", "line", " ", "did", " ", "not", " ", "wrap", ",", " ", "clear", " ", "it", " ", "if", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "scr_", "._", "addstr_", "(_", "lineno_", ",_", "0_", ",_", "'", " ", "'_", "*_", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", "\\u", "curses_", "._", "error_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "status", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "color_", "=_", "curses_", "._", "color", "\\u", "pair_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "._", "addstr_", "(_", "height_", "-_", "1_", ",_", "0_", ",_", "'", " ", "'_", "*_", "(_", "width_", ")_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Las", "t", " ", "char", " ", "wrap", "s", ",", " ", "on", " ", "purpose", ":", " ", "draw", " ", "full", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "selected_", "=_", "results_", "[_", "CONFIGURATION", "_", "[_", "'", "selecte", "d\\u", "line", "\\u", "num", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "height_", "-_", "1_", ",_", "0_", ",_", "\"", " ", "CT", "OP", " ", "\"_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addc", "h_", "(_", "curses_", "._", "ACS", "\\u", "VL", "INE", "_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "\"", " ", "[", "P", "]", "aus", "e", ":", " ", "\"_", "+_", "(_", "'", "On", " ", "'_", "if_", "CONFIGURATION", "_", "[_", "'", "paus", "e\\u", "refre", "sh", "'_", "]_", "else_", "'", "Off", " ", "'_", ")_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addc", "h_", "(_", "curses_", "._", "ACS", "\\u", "VL", "INE", "_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "\"", " ", "[", "F", "]", "oll", "ow", ":", " ", "\"_", "+_", "(_", "'", "On", " ", "'_", "if_", "CONFIGURATION", "_", "[_", "'", "follow", "'_", "]_", "else_", "'", "Off", " ", "'_", ")_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addc", "h_", "(_", "curses_", "._", "ACS", "\\u", "VL", "INE", "_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "\"", " ", "[", "F5", "]", " ", "Toggle", " ", "%", "s", " ", "view", " ", "\"_", "%_", "(_", "'", "list", "'_", "if_", "CONFIGURATION", "_", "[_", "'", "tree", "'_", "]_", "else_", "'", "tree", "'_", ")_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addc", "h_", "(_", "curses_", "._", "ACS", "\\u", "VL", "INE", "_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fold", " ", "control_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "CONFIGURATION", "_", "[_", "'", "tree", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "._", "addstr_", "(_", "\"", " ", "[+", "/-", "]", " ", "%", "s", " ", "\"_", "%_", "(_", "'", "unfol", "d", "'_", "if_", "selected_", "[_", "'", "cgroup", "'_", "]_", "in_", "CONFIGURATION", "_", "[_", "'", "fold", "'_", "]_", "else_", "'", "fold", "'_", ")_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scr_", "._", "addc", "h_", "(_", "curses_", "._", "ACS", "\\u", "VL", "INE", "_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "we", " ", "have", " ", "any", " ", "action", "s", " ", "avail", "able", " ", "for", " ", "*", "selecte", "d", "*", " ", "line", " ", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "selecte", "d\\u", "type_", "=_", "selected_", "[_", "'", "type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selecte", "d\\u", "type_", "==_", "'", "docker", "'_", "and_", "HAS", "\\u", "DOCKER", "_", "or_", "selecte", "d\\u", "type_", "in_", "[_", "'", "lxc", "'_", ",_", "'", "lxc", "-", "user", "'_", "]_", "and_", "HAS", "\\u", "LX", "C_", "or_", "selecte", "d\\u", "type_", "==_", "'", "openv", "z", "'_", "and_", "HAS", "\\u", "OPEN", "VZ", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "selecte", "d\\u", "type_", "==_", "'", "openv", "z", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "._", "addstr_", "(_", "\"", " ", "[", "A", "]", "tta", "ch", ",", " ", "[", "E", "]", "nter", ",", " ", "[", "S", "]", "top", ",", " ", "[", "C", "]", "hk", "pnt", ",", " ", "[", "K", "]", "ill", " ", "\"_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scr_", "._", "addstr_", "(_", "\"", " ", "[", "A", "]", "tta", "ch", ",", " ", "[", "E", "]", "nter", ",", " ", "[", "S", "]", "top", ",", " ", "[", "K", "]", "ill", " ", "\"_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scr_", "._", "addc", "h_", "(_", "curses_", "._", "ACS", "\\u", "VL", "INE", "_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scr_", "._", "addstr_", "(_", "\"", " ", "[", "Q", "]", "uit", "\"_", ",_", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "\\u", "curses_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Handle", " ", "narrow", " ", "screens", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scr_", "._", "refresh_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "screen_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curses_", "._", "start", "\\u", "color_", "(_", ")_", "#", " ", "load", " ", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "use", "\\u", "default", "\\u", "colors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "noe", "cho", "_", "(_", ")_", "#", " ", "do", " ", "not", " ", "echo", " ", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "cb", "reak", "_", "(_", ")_", "#", " ", "do", " ", "not", " ", "wait", " ", "for", " ", "\"", "enter", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "curses_", "._", "mouse", "mask_", "(_", "curses_", "._", "ALL", "\\u", "MOUSE", "\\u", "EVENTS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hi", "de", " ", "cursor", ",", " ", "if", " ", "termina", "l", " ", "AND", " ", "curse", " ", "support", "s", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "curses_", ",_", "'", "curs", "\\u", "set", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curses_", "._", "curs", "\\u", "set_", "(_", "0_", ")_", "\\u\\u\\u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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2 ]
Unused local variable
babble/babble/include/jython/Lib/test/test_select.py
[ { "content": " def testBadSelectSetTypes(self):\n # Test some known error conditions\n for bad_select_set in [None, 1,]:\n for pos in range(2): # OOB not supported on Java\n args = [[], [], []]\n args[pos] = bad_select_set\n try:\n timeout = 0 # Can't wait forever\n rfd, wfd, xfd = select.select(args[0], args[1], args[2], timeout)\n except (select.error, TypeError):\n pass\n except Exception, x:\n self.fail(\"Selecting on '%s' raised wrong exception %s\" % (str(bad_select_set), str(x)))\n else:\n self.fail(\"Selecting on '%s' should have raised TypeError\" % str(bad_select_set))", "metadata": "root.TestSelectInvalidParameters.testBadSelectSetTypes", "header": "['class', 'TestSelectInvalidParameters', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 55 }, { "content": " def testBadSelectableTypes(self):\n class Nope: pass\n\n class Almost1:\n def fileno(self):\n return 'fileno'\n\n class Almost2:\n def fileno(self):\n return 'fileno'\n\n # Test some known error conditions\n for bad_selectable in [None, 1, object(), Nope(), Almost1(), Almost2()]:\n try:\n timeout = 0 # Can't wait forever\n rfd, wfd, xfd = select.select([bad_selectable], [], [], timeout)\n except (TypeError, select.error), x:\n pass\n else:\n self.fail(\"Selecting on '%s' should have raised TypeError or select.error\" % str(bad_selectable))", "metadata": "root.TestSelectInvalidParameters.testBadSelectableTypes", "header": "['class', 'TestSelectInvalidParameters', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 71 }, { "content": " def testInvalidTimeoutTypes(self):\n for invalid_timeout in ['not a number']:\n try:\n rfd, wfd, xfd = select.select([], [], [], invalid_timeout)\n except TypeError:\n pass\n else:\n self.fail(\"Invalid timeout value '%s' should have raised TypeError\" % invalid_timeout)", "metadata": "root.TestSelectInvalidParameters.testInvalidTimeoutTypes", "header": "['class', 'TestSelectInvalidParameters', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 92 }, { "content": " def testInvalidTimeoutValues(self):\n for invalid_timeout in [-1]:\n try:\n rfd, wfd, xfd = select.select([], [], [], invalid_timeout)\n except (ValueError, select.error):\n pass\n else:\n self.fail(\"Invalid timeout value '%s' should have raised ValueError or select.error\" % invalid_timeout)", "metadata": "root.TestSelectInvalidParameters.testInvalidTimeoutValues", "header": "['class', 'TestSelectInvalidParameters', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 101 }, { "content": " def _testSocketMustBeNonBlocking(self):\n self.cli.setblocking(1)\n self.cli.connect( (test_socket.HOST, test_socket.PORT) )\n timeout = 1000 # milliseconds\n poll_object = select.poll()\n try:\n poll_object.register(self.cli)\n except select.error, se:\n self.failUnlessEqual(se[0], errno.ESOCKISBLOCKING)\n except Exception, x:\n self.fail(\"Registering blocking socket should have raised select.error, not %s\" % str(x))\n else:\n self.fail(\"Registering blocking socket should have raised select.error\")", "metadata": "root.ThreadedPollClientSocket._testSocketMustBeNonBlocking", "header": "['class', 'ThreadedPollClientSocket', '(', 'test_socket', '.', 'ThreadedTCPSocketTest', ')', ':', '___EOS___']", "index": 169 } ]
[ { "span": "rfd,", "start_line": 63, "start_column": 20, "end_line": 63, "end_column": 23 }, { "span": "wfd,", "start_line": 63, "start_column": 25, "end_line": 63, "end_column": 28 }, { "span": "xfd ", "start_line": 63, "start_column": 30, "end_line": 63, "end_column": 33 }, { "span": "rfd,", "start_line": 86, "start_column": 16, "end_line": 86, "end_column": 19 }, { "span": "wfd,", "start_line": 86, "start_column": 21, "end_line": 86, "end_column": 24 }, { "span": "xfd ", "start_line": 86, "start_column": 26, "end_line": 86, "end_column": 29 }, { "span": "rfd,", "start_line": 95, "start_column": 16, "end_line": 95, "end_column": 19 }, { "span": "wfd,", "start_line": 95, "start_column": 21, "end_line": 95, "end_column": 24 }, { "span": "xfd ", "start_line": 95, "start_column": 26, "end_line": 95, "end_column": 29 }, { "span": "rfd,", "start_line": 104, "start_column": 16, "end_line": 104, "end_column": 19 }, { "span": "wfd,", "start_line": 104, "start_column": 21, "end_line": 104, "end_column": 24 }, { "span": "xfd ", "start_line": 104, "start_column": 26, "end_line": 104, "end_column": 29 }, { "span": "timeout ", "start_line": 172, "start_column": 8, "end_line": 172, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Select", "Inva", "lid", "Parameters_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Ba", "d", "Select", "Set", "Types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "some", " ", "know", "n", " ", "error", " ", "conditions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "bad", "\\u", "select", "\\u", "set_", "in_", "[_", "None_", ",_", "1_", ",_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "pos_", "in_", "range_", "(_", "2_", ")_", ":_", "#", " ", "OO", "B", " ", "not", " ", "support", "ed", " ", "on", " ", "Ja", "va_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "[_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "pos_", "]_", "=_", "bad", "\\u", "select", "\\u", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "timeout_", "=_", "0_", "#", " ", "Can", "'", "t", " ", "wait", " ", "forever_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "d_", ",_", "wf", "d_", ",_", "xf", "d_", "=_", "select_", "._", "select_", "(_", "args_", "[_", "0_", "]_", ",_", "args_", "[_", "1_", "]_", ",_", "args_", "[_", "2_", "]_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "select_", "._", "error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fail_", "(_", "\"", "Selecti", "ng", " ", "on", " ", "'%", "s", "'", " ", "raise", "d", " ", "wrong", " ", "exception", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "bad", "\\u", "select", "\\u", "set_", ")_", ",_", "str_", "(_", "x_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "fail_", "(_", "\"", "Selecti", "ng", " ", "on", " ", "'%", "s", "'", " ", "shou", "ld", " ", "have", " ", "raise", "d", " ", "Type", "Error", "\"_", "%_", "str_", "(_", "bad", "\\u", "select", "\\u", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Inva", "lid", "Parameters_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Ba", "d", "Select", "able", "Types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "No", "pe_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Al", "most", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fileno_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "filen", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Al", "most", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fileno_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "filen", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "some", " ", "know", "n", " ", "error", " ", "conditions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "bad", "\\u", "selectable", "_", "in_", "[_", "None_", ",_", "1_", ",_", "object_", "(_", ")_", ",_", "No", "pe_", "(_", ")_", ",_", "Al", "most", "1_", "(_", ")_", ",_", "Al", "most", "2_", "(_", ")_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timeout_", "=_", "0_", "#", " ", "Can", "'", "t", " ", "wait", " ", "forever_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rf", "d_", ",_", "wf", "d_", ",_", "xf", "d_", "=_", "select_", "._", "select_", "(_", "[_", "bad", "\\u", "selectable", "_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "select_", "._", "error_", ")_", ",_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Selecti", "ng", " ", "on", " ", "'%", "s", "'", " ", "shou", "ld", " ", "have", " ", "raise", "d", " ", "Type", "Error", " ", "or", " ", "select", ".", "error", "\"_", "%_", "str_", "(_", "bad", "\\u", "selectable", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Inva", "lid", "Parameters_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Inva", "lid", "Time", "out", "Types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "invalid", "\\u", "timeout_", "in_", "[_", "'", "not", " ", "a", " ", "number", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rf", "d_", ",_", "wf", "d_", ",_", "xf", "d_", "=_", "select_", "._", "select_", "(_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "invalid", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Inva", "lid", " ", "timeo", "ut", " ", "value", " ", "'%", "s", "'", " ", "shou", "ld", " ", "have", " ", "raise", "d", " ", "Type", "Error", "\"_", "%_", "invalid", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Select", "Inva", "lid", "Parameters_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Inva", "lid", "Time", "out", "Values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "invalid", "\\u", "timeout_", "in_", "[_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rf", "d_", ",_", "wf", "d_", ",_", "xf", "d_", "=_", "select_", "._", "select_", "(_", "[_", "]_", ",_", "[_", "]_", ",_", "[_", "]_", ",_", "invalid", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "select_", "._", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Inva", "lid", " ", "timeo", "ut", " ", "value", " ", "'%", "s", "'", " ", "shou", "ld", " ", "have", " ", "raise", "d", " ", "Value", "Error", " ", "or", " ", "select", ".", "error", "\"_", "%_", "invalid", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Thread", "ed", "Poll", "Client", "Socket_", "(_", "test\\u", "socket_", "._", "Thread", "ed", "TC", "PS", "ocket", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test", "Sock", "et", "Mus", "t", "Be", "Non", "Block", "ing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cli_", "._", "setb", "locking_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cli_", "._", "connect_", "(_", "(_", "test\\u", "socket_", "._", "HOST_", ",_", "test\\u", "socket_", "._", "PORT_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeout_", "=_", "1000_", "#", " ", "milliseconds", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "poll", "\\u", "object_", "=_", "select_", "._", "poll_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "poll", "\\u", "object_", "._", "register_", "(_", "self_", "._", "cli_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "select_", "._", "error_", ",_", "se_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail", "Un", "less", "Equal_", "(_", "se_", "[_", "0_", "]_", ",_", "errno_", "._", "ES", "OCK", "ISB", "LOCK", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "x_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Register", "ing", " ", "blockin", "g", " ", "socket", " ", "shou", "ld", " ", "have", " ", "raise", "d", " ", "select", ".", "error", ",", " ", "not", " ", "%", "s", "\"_", "%_", "str_", "(_", "x_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Register", "ing", " ", "blockin", "g", " ", "socket", " ", "shou", "ld", " ", "have", " ", "raise", "d", " ", "select", ".", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
apache/libcloud/docs/examples/compute/vmware_vcloud_1.5.py
[ { "content": "from libcloud.compute.types import Provider\nfrom libcloud.compute.providers import get_driver\n\nimport libcloud.security\n\n# Skip this step if you are launching nodes on an official vCloud\n# provider. It is intended only for self signed SSL certs in\n# vanilla vCloud Director v1.5 test deployments.\n# Note: Code like this poses a security risk (MITM attack) and\n# that's the reason why you should never use it for anything else\n# besides testing. You have been warned.\nlibcloud.security.VERIFY_SSL_CERT = False\n\nvcloud = get_driver(Provider.VCLOUD)\n\ndriver = vcloud('you username@organisation', 'your password',\n host='vcloud.local', api_version='1.5')\n\n# List all instantiated vApps\nnodes = driver.list_nodes()\n# List all VMs within the first vApp instance\nprint nodes[0].extra['vms']\n\n# List all available vApp Templates\nimages = driver.list_images()\nimage = [i for i in images if i.name == 'natty-server-cloudimg-amd64'][0]\n\n# Create node with minimum set of parameters\nnode = driver.create_node(name='test node 1', image=image)\n# Destroy the node\ndriver.destroy_node(node)\n\n# Create node without deploying and powering it on\nnode = driver.create_node(name='test node 2', image=image, ex_deploy=False)\n\n# Create node with custom CPU & Memory values\nnode = driver.create_node(name='test node 3', image=image, ex_vm_cpu=3,\n ex_vm_memory=1024)\n\n# Create node with customised networking parameters (eg. for OVF\n# imported images)\nnode = driver.create_node(name='test node 4', image=image,\n ex_vm_network='your vm net name',\n ex_network='your org net name',\n ex_vm_fence='bridged', ex_vm_ipmode='DHCP')\n\n# Create node in a custom virtual data center\nnode = driver.create_node(name='test node 4', image=image,\n ex_vdc='your vdc name')\n\n# Create node with guest OS customisation script to be run at first boot\nnode = driver.create_node(name='test node 5', image=image,\n ex_vm_script='filesystem path to your script')\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "node ", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 4 }, { "span": "node ", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 4 }, { "span": "node ", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 4 }, { "span": "node ", "start_line": 47, "start_column": 0, "end_line": 47, "end_column": 4 } ]
[ { "span": "node ", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 4 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "compute_", "._", "types_", "import_", "Provider_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "libc", "loud", "_", "._", "compute_", "._", "providers_", "import_", "get", "\\u", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "libc", "loud", "_", "._", "security_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ski", "p", " ", "this", " ", "step", " ", "if", " ", "you", " ", "are", " ", "launch", "ing", " ", "nodes", " ", "on", " ", "an", " ", "official", " ", "v", "Cloud_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "provide", "r", ".", " ", "It", " ", "is", " ", "inten", "ded", " ", "only", " ", "for", " ", "self", " ", "sign", "ed", " ", "SS", "L", " ", "cert", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vanilla", " ", "v", "Cloud", " ", "Director", " ", "v1", ".5", " ", "test", " ", "deployments", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "Code", " ", "like", " ", "this", " ", "poses", " ", "a", " ", "security", " ", "risk", " ", "(", "MIT", "M", " ", "attac", "k", ")", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", "'", "s", " ", "the", " ", "reason", " ", "wh", "y", " ", "you", " ", "shou", "ld", " ", "neve", "r", " ", "use", " ", "it", " ", "for", " ", "anyt", "hing", " ", "else_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bes", "ides", " ", "testi", "ng", ".", " ", "You", " ", "have", " ", "bee", "n", " ", "warn", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "libc", "loud", "_", "._", "security_", "._", "VERIFY", "\\u", "SS", "L", "\\u", "CERT", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vclo", "ud_", "=_", "get", "\\u", "driver_", "(_", "Provider_", "._", "VC", "LO", "UD", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "=_", "vclo", "ud_", "(_", "'", "you", " ", "user", "name", "@", "organisation", "'_", ",_", "'", "your", " ", "password", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "'", "vclo", "ud", ".", "local", "'_", ",_", "api", "\\u", "version_", "=_", "'", "1.5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "all", " ", "instantiate", "d", " ", "v", "App", "s_", "\\u\\u\\uNL\\u\\u\\u_", "nodes_", "=_", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "List", " ", "all", " ", "VM", "s", " ", "within", " ", "the", " ", "first", " ", "v", "App", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "nodes_", "[_", "0_", "]_", "._", "extra_", "[_", "'", "vms", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "all", " ", "avail", "able", " ", "v", "App", " ", "Templates_", "\\u\\u\\uNL\\u\\u\\u_", "images_", "=_", "driver_", "._", "list", "\\u", "images_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image_", "=_", "[_", "i_", "for_", "i_", "in_", "images_", "if_", "i_", "._", "name_", "==_", "'", "nat", "ty", "-", "server", "-", "cloud", "img", "-", "am", "d6", "4", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "node", " ", "with", " ", "minim", "um", " ", "set", " ", "of", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "driver_", "._", "create", "\\u", "node_", "(_", "name_", "=_", "'", "test", " ", "node", " ", "1", "'_", ",_", "image_", "=_", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Destr", "oy", " ", "the", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "._", "destroy", "\\u", "node_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "node", " ", "with", "out", " ", "deploy", "ing", " ", "and", " ", "power", "ing", " ", "it", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "driver_", "._", "create", "\\u", "node_", "(_", "name_", "=_", "'", "test", " ", "node", " ", "2", "'_", ",_", "image_", "=_", "image_", ",_", "ex", "\\u", "deploy_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "node", " ", "with", " ", "custom", " ", "CPU", " ", "&", " ", "Memo", "ry", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "driver_", "._", "create", "\\u", "node_", "(_", "name_", "=_", "'", "test", " ", "node", " ", "3", "'_", ",_", "image_", "=_", "image_", ",_", "ex", "\\u", "vm", "\\u", "cpu_", "=_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "vm", "\\u", "memory_", "=_", "1024_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "node", " ", "with", " ", "customi", "sed", " ", "networking", " ", "parameter", "s", " ", "(", "eg", ".", " ", "for", " ", "OV", "F_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "import", "ed", " ", "images", ")_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "driver_", "._", "create", "\\u", "node_", "(_", "name_", "=_", "'", "test", " ", "node", " ", "4", "'_", ",_", "image_", "=_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "vm", "\\u", "network_", "=_", "'", "your", " ", "vm", " ", "net", " ", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "network_", "=_", "'", "your", " ", "org", " ", "net", " ", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "vm", "\\u", "fence", "_", "=_", "'", "bridge", "d", "'_", ",_", "ex", "\\u", "vm", "\\u", "ip", "mode_", "=_", "'", "DHC", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "node", " ", "in", " ", "a", " ", "custom", " ", "virtual", " ", "data", " ", "center_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "driver_", "._", "create", "\\u", "node_", "(_", "name_", "=_", "'", "test", " ", "node", " ", "4", "'_", ",_", "image_", "=_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "vdc", "_", "=_", "'", "your", " ", "vdc", " ", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "node", " ", "with", " ", "guest", " ", "OS", " ", "customi", "sation", " ", "script", " ", "to", " ", "be", " ", "run", " ", "at", " ", "first", " ", "boot_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "driver_", "._", "create", "\\u", "node_", "(_", "name_", "=_", "'", "test", " ", "node", " ", "5", "'_", ",_", "image_", "=_", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex", "\\u", "vm", "\\u", "script_", "=_", "'", "filesystem", " ", "path", " ", "to", " ", "your", " ", "script", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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views.py
[ { "content": "def other_services(request, template_name=\"account/other_services.html\"):\n from zwitschern.utils import twitter_verify_credentials\n from zwitschern.pownce_utils import pownce_verify_credentials\n twitter_form = TwitterForm(request.user)\n pownce_form = PownceForm(request.user)\n twitter_authorized = False\n pownce_authorized = False\n if request.method == \"POST\":\n twitter_form = TwitterForm(request.user, request.POST)\n\n if request.POST['actionType'] == 'saveTwitter':\n if twitter_form.is_valid():\n from zwitschern.utils import twitter_account_raw\n twitter_account = twitter_account_raw(request.POST['username'], request.POST['password'])\n twitter_authorized = twitter_verify_credentials(twitter_account)\n if not twitter_authorized:\n request.user.message_set.create(message=\"Twitter authentication failed\")\n else:\n twitter_form.save()\n \n if request.POST['actionType'] == 'savePownce':\n pownce_form = PownceForm(request.user, request.POST) \n if pownce_form.is_valid():\n from zwitschern.pownce_utils import pownce_account_raw\n pownce_account = pownce_account_raw(request.POST['usernamep'], request.POST['passwordp'])\n pownce_authorized = pownce_verify_credentials(pownce_account)\n if not pownce_authorized:\n request.user.message_set.create(message=\"Pownce authentication failed\")\n else:\n pownce_form.save()\n else:\n from zwitschern.utils import twitter_account_for_user\n from zwitschern.pownce_utils import pownce_account_for_user\n twitter_account = twitter_account_for_user(request.user)\n pownce_account = pownce_account_for_user(request.user)\n twitter_authorized = twitter_verify_credentials(twitter_account)\n pownce_authorized = pownce_verify_credentials(pownce_account)\n twitter_form = TwitterForm(request.user)\n pownce_form = PownceForm(request.user)\n return render_to_response(template_name, {\n \"twitter_form\": twitter_form,\n \"twitter_authorized\": twitter_authorized,\n \"pownce_form\": pownce_form,\n \"pownce_authorized\":pownce_authorized,\n }, context_instance=RequestContext(request))", "metadata": "root.other_services", "header": "['module', '___EOS___']", "index": 139 } ]
[ { "span": "twitter_form ", "start_line": 142, "start_column": 4, "end_line": 142, "end_column": 16 } ]
[ { "span": "twitter_form ", "start_line": 147, "start_column": 8, "end_line": 147, "end_column": 20 }, { "span": "twitter_form ", "start_line": 176, "start_column": 8, "end_line": 176, "end_column": 20 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "other", "\\u", "services_", "(_", "request_", ",_", "template", "\\u", "name_", "=_", "\"", "account", "/", "other", "\\u", "service", "s", ".", "html", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "zw", "its", "cher", "n_", "._", "utils_", "import_", "twit", "ter", "\\u", "verify", "\\u", "credentials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zw", "its", "cher", "n_", "._", "pow", "nce", "\\u", "utils_", "import_", "pow", "nce", "\\u", "verify", "\\u", "credentials_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "form_", "=_", "Twit", "ter", "Form_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "form_", "=_", "Pow", "nce", "Form_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "authorized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "authorized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "\"", "POST", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "twit", "ter", "\\u", "form_", "=_", "Twit", "ter", "Form_", "(_", "request_", "._", "user_", ",_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "POST_", "[_", "'", "action", "Type", "'_", "]_", "==_", "'", "save", "Twit", "ter", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "twit", "ter", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "zw", "its", "cher", "n_", "._", "utils_", "import_", "twit", "ter", "\\u", "account", "\\u", "raw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "account_", "=_", "twit", "ter", "\\u", "account", "\\u", "raw_", "(_", "request_", "._", "POST_", "[_", "'", "user", "name", "'_", "]_", ",_", "request_", "._", "POST_", "[_", "'", "password", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "authorized_", "=_", "twit", "ter", "\\u", "verify", "\\u", "credentials_", "(_", "twit", "ter", "\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "twit", "ter", "\\u", "authorized_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "request_", "._", "user_", "._", "message", "\\u", "set_", "._", "create_", "(_", "message_", "=_", "\"", "Twit", "ter", " ", "authenticat", "ion", " ", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "twit", "ter", "\\u", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "POST_", "[_", "'", "action", "Type", "'_", "]_", "==_", "'", "save", "Pow", "nce", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pow", "nce", "\\u", "form_", "=_", "Pow", "nce", "Form_", "(_", "request_", "._", "user_", ",_", "request_", "._", "POST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pow", "nce", "\\u", "form_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "zw", "its", "cher", "n_", "._", "pow", "nce", "\\u", "utils_", "import_", "pow", "nce", "\\u", "account", "\\u", "raw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "account_", "=_", "pow", "nce", "\\u", "account", "\\u", "raw_", "(_", "request_", "._", "POST_", "[_", "'", "user", "name", "p", "'_", "]_", ",_", "request_", "._", "POST_", "[_", "'", "password", "p", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "authorized_", "=_", "pow", "nce", "\\u", "verify", "\\u", "credentials_", "(_", "pow", "nce", "\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "pow", "nce", "\\u", "authorized_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "request_", "._", "user_", "._", "message", "\\u", "set_", "._", "create_", "(_", "message_", "=_", "\"", "Pow", "nce", " ", "authenticat", "ion", " ", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pow", "nce", "\\u", "form_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "zw", "its", "cher", "n_", "._", "utils_", "import_", "twit", "ter", "\\u", "account", "\\u", "for", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zw", "its", "cher", "n_", "._", "pow", "nce", "\\u", "utils_", "import_", "pow", "nce", "\\u", "account", "\\u", "for", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "account_", "=_", "twit", "ter", "\\u", "account", "\\u", "for", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "account_", "=_", "pow", "nce", "\\u", "account", "\\u", "for", "\\u", "user_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "authorized_", "=_", "twit", "ter", "\\u", "verify", "\\u", "credentials_", "(_", "twit", "ter", "\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "authorized_", "=_", "pow", "nce", "\\u", "verify", "\\u", "credentials_", "(_", "pow", "nce", "\\u", "account_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "twit", "ter", "\\u", "form_", "=_", "Twit", "ter", "Form_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pow", "nce", "\\u", "form_", "=_", "Pow", "nce", "Form_", "(_", "request_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "template", "\\u", "name_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twit", "ter", "\\u", "form", "\"_", ":_", "twit", "ter", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "twit", "ter", "\\u", "authoriz", "ed", "\"_", ":_", "twit", "ter", "\\u", "authorized_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pow", "nce", "\\u", "form", "\"_", ":_", "pow", "nce", "\\u", "form_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pow", "nce", "\\u", "authoriz", "ed", "\"_", ":_", "pow", "nce", "\\u", "authorized_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 3, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
danrobinson/tracestack/tracestack/__init__.py
[ { "content": "# import shortcuts\nfrom tracestack.debugger import on, off, pm\nfrom tracestack.decorators import trace", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from tracestack.debugger import on, off, pm", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 43 }, { "span": "from tracestack.decorators import trace", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 39 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "import", " ", "shortcuts_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "trace", "stack_", "._", "debugger_", "import_", "on_", ",_", "off_", ",_", "pm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "trace", "stack_", "._", "decorators_", "import_", "trace_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1 ]
Unused import
ardekantur/pyglet/pyglet/window/xlib/__init__.py
[ { "content": "# ----------------------------------------------------------------------------\n# pyglet\n# Copyright (c) 2006-2008 Alex Holkner\n# All rights reserved.\n# \n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions \n# are met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright \n# notice, this list of conditions and the following disclaimer in\n# the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of pyglet nor the names of its\n# contributors may be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n# ----------------------------------------------------------------------------\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id$'\n\nfrom ctypes import *\nimport unicodedata\nimport warnings\n\nimport pyglet\nfrom pyglet.window import WindowException, NoSuchDisplayException, \\\n MouseCursorException, MouseCursor, \\\n DefaultMouseCursor, ImageMouseCursor, BaseWindow, _PlatformEventHandler, \\\n _ViewEventHandler\nfrom pyglet.window import key\nfrom pyglet.window import mouse\nfrom pyglet.event import EventDispatcher\n\nfrom pyglet.canvas.xlib import XlibCanvas\n\nfrom pyglet.libs.x11 import xlib\nfrom pyglet.libs.x11 import cursorfont\n\nfrom pyglet.compat import asbytes\n\ntry:\n from pyglet.libs.x11 import xsync\n _have_xsync = True\nexcept:\n _have_xsync = False\n\n\nXA_CARDINAL = 6 # Xatom.h:14\n\n# Do we have the November 2000 UTF8 extension?\n_have_utf8 = hasattr(xlib._lib, 'Xutf8TextListToTextProperty')\n\n# symbol,ctrl -> motion mapping\n_motion_map = {\n (key.UP, False): key.MOTION_UP,\n (key.RIGHT, False): key.MOTION_RIGHT,\n (key.DOWN, False): key.MOTION_DOWN,\n (key.LEFT, False): key.MOTION_LEFT,\n (key.RIGHT, True): key.MOTION_NEXT_WORD,\n (key.LEFT, True): key.MOTION_PREVIOUS_WORD,\n (key.HOME, False): key.MOTION_BEGINNING_OF_LINE,\n (key.END, False): key.MOTION_END_OF_LINE,\n (key.PAGEUP, False): key.MOTION_PREVIOUS_PAGE,\n (key.PAGEDOWN, False): key.MOTION_NEXT_PAGE,\n (key.HOME, True): key.MOTION_BEGINNING_OF_FILE,\n (key.END, True): key.MOTION_END_OF_FILE,\n (key.BACKSPACE, False): key.MOTION_BACKSPACE,\n (key.DELETE, False): key.MOTION_DELETE,\n}\n\n\n\n# Platform event data is single item, so use platform event handler directly.\nXlibEventHandler = _PlatformEventHandler\nViewEventHandler = _ViewEventHandler\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class mwmhints_t(Structure):\n _fields_ = [\n ('flags', c_uint32),\n ('functions', c_uint32),\n ('decorations', c_uint32),\n ('input_mode', c_int32),\n ('status', c_uint32)\n ]", "metadata": "root.mwmhints_t", "header": "['module', '___EOS___']", "index": 63 }, { "content": "class XlibException(WindowException):\n '''An X11-specific exception. This exception is probably a programming\n error in pyglet.'''\n pass", "metadata": "root.XlibException", "header": "['module', '___EOS___']", "index": 95 }, { "content": "class XlibMouseCursor(MouseCursor):\n drawable = False\n", "metadata": "root.XlibMouseCursor", "header": "['module', '___EOS___']", "index": 100 }, { "content": " def __init__(self, cursor):\n self.cursor = cursor", "metadata": "root.XlibMouseCursor.__init__", "header": "['class', 'XlibMouseCursor', '(', 'MouseCursor', ')', ':', '___EOS___']", "index": 103 }, { "content": "class XlibWindow(BaseWindow):\n _x_display = None # X display connection\n _x_screen_id = None # X screen index\n _x_ic = None # X input context\n _window = None # Xlib window handle\n _minimum_size = None\n _maximum_size = None\n _override_redirect = False\n\n _x = 0\n _y = 0 # Last known window position\n _width = 0\n _height = 0 # Last known window size\n _mouse_exclusive_client = None # x,y of \"real\" mouse during exclusive\n _mouse_buttons = [False] * 6 # State of each xlib button\n _keyboard_exclusive = False\n _active = True\n _applied_mouse_exclusive = False\n _applied_keyboard_exclusive = False\n _mapped = False\n _lost_context = False\n _lost_context_state = False\n\n _enable_xsync = False\n _current_sync_value = None\n _current_sync_valid = False\n\n _needs_resize = False # True when resize event has been received but not\n # dispatched\n\n _default_event_mask = (0x1ffffff \n & ~xlib.PointerMotionHintMask\n & ~xlib.ResizeRedirectMask\n & ~xlib.SubstructureNotifyMask)\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n # Private utility\n\n\n\n\n\n # Event handling\n\n\n\n\n\n\n # Event handlers\n '''\n def _event_symbol(self, event):\n # pyglet.self.key keysymbols are identical to X11 keysymbols, no\n # need to map the keysymbol.\n symbol = xlib.XKeycodeToKeysym(self._x_display, event.xkey.keycode, 0)\n if symbol == 0:\n # XIM event\n return None\n elif symbol not in key._key_names.keys():\n symbol = key.user_key(event.xkey.keycode)\n return symbol\n '''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.XlibWindow", "header": "['module', '___EOS___']", "index": 110 }, { "content": " def __init__(self, *args, **kwargs):\n # Bind event handlers\n self._event_handlers = {}\n self._view_event_handlers = {}\n for name in self._platform_event_names:\n if not hasattr(self, name):\n continue\n func = getattr(self, name)\n for message in func._platform_event_data:\n if hasattr(func, '_view'):\n self._view_event_handlers[message] = func \n else:\n self._event_handlers[message] = func \n\n super(XlibWindow, self).__init__(*args, **kwargs)", "metadata": "root.XlibWindow.__init__", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 145 }, { "content": " def _recreate(self, changes):\n # If flipping to/from fullscreen, need to recreate the window. (This\n # is the case with both override_redirect method and\n # _NET_WM_STATE_FULLSCREEN).\n #\n # A possible improvement could be to just hide the top window,\n # destroy the GLX window, and reshow it again when leaving fullscreen.\n # This would prevent the floating window from being moved by the\n # WM.\n if ('fullscreen' in changes or 'resizable' in changes):\n # clear out the GLX context\n self.context.detach()\n xlib.XDestroyWindow(self._x_display, self._window)\n del self.display._window_map[self._window]\n del self.display._window_map[self._view]\n self._window = None \n self._mapped = False\n\n # TODO: detect state loss only by examining context share.\n if 'context' in changes:\n self._lost_context = True\n self._lost_context_state = True\n\n self._create()", "metadata": "root.XlibWindow._recreate", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 161 }, { "content": " def _create(self):\n # Unmap existing window if necessary while we fiddle with it.\n if self._window and self._mapped:\n self._unmap()\n\n self._x_display = self.display._display\n self._x_screen_id = self.display.x_screen\n\n\n # Create X window if not already existing.\n if not self._window:\n root = xlib.XRootWindow(self._x_display, self._x_screen_id)\n\n visual_info = self.config.get_visual_info()\n\n visual = visual_info.visual\n visual_id = xlib.XVisualIDFromVisual(visual)\n default_visual = xlib.XDefaultVisual(\n self._x_display, self._x_screen_id)\n default_visual_id = xlib.XVisualIDFromVisual(default_visual)\n window_attributes = xlib.XSetWindowAttributes()\n if visual_id != default_visual_id:\n window_attributes.colormap = xlib.XCreateColormap(\n self._x_display, root, visual, xlib.AllocNone)\n else:\n window_attributes.colormap = xlib.XDefaultColormap(\n self._x_display, self._x_screen_id)\n window_attributes.bit_gravity = xlib.StaticGravity\n\n # Issue 287: Compiz on Intel/Mesa doesn't draw window decoration\n # unless CWBackPixel is given in mask. Should have\n # no effect on other systems, so it's set\n # unconditionally.\n mask = xlib.CWColormap | xlib.CWBitGravity | xlib.CWBackPixel\n\n if self._fullscreen:\n width, height = self.screen.width, self.screen.height\n self._view_x = (width - self._width) // 2\n self._view_y = (height - self._height) // 2\n else:\n width, height = self._width, self._height\n self._view_x = self._view_y = 0\n\n self._window = xlib.XCreateWindow(self._x_display, root,\n 0, 0, width, height, 0, visual_info.depth,\n xlib.InputOutput, visual, mask,\n byref(window_attributes))\n self._view = xlib.XCreateWindow(self._x_display, \n self._window, self._view_x, self._view_y, \n self._width, self._height, 0, visual_info.depth, \n xlib.InputOutput, visual, mask, \n byref(window_attributes));\n xlib.XMapWindow(self._x_display, self._view)\n xlib.XSelectInput(\n self._x_display, self._view, self._default_event_mask)\n\n self.display._window_map[self._window] = \\\n self.dispatch_platform_event\n self.display._window_map[self._view] = \\\n self.dispatch_platform_event_view\n\n self.canvas = XlibCanvas(self.display, self._view)\n\n self.context.attach(self.canvas)\n self.context.set_vsync(self._vsync) # XXX ?\n\n # Setting null background pixmap disables drawing the background,\n # preventing flicker while resizing (in theory).\n #\n # Issue 287: Compiz on Intel/Mesa doesn't draw window decoration if\n # this is called. As it doesn't seem to have any\n # effect anyway, it's just commented out.\n #xlib.XSetWindowBackgroundPixmap(self._x_display, self._window, 0)\n\n self._enable_xsync = (pyglet.options['xsync'] and\n self.display._enable_xsync and\n self.config.double_buffer)\n\n # Set supported protocols\n protocols = []\n protocols.append(xlib.XInternAtom(self._x_display,\n asbytes('WM_DELETE_WINDOW'), False))\n if self._enable_xsync:\n protocols.append(xlib.XInternAtom(self._x_display,\n asbytes('_NET_WM_SYNC_REQUEST'),\n False))\n protocols = (c_ulong * len(protocols))(*protocols)\n xlib.XSetWMProtocols(self._x_display, self._window,\n protocols, len(protocols))\n\n # Create window resize sync counter\n if self._enable_xsync:\n value = xsync.XSyncValue()\n self._sync_counter = xlib.XID(\n xsync.XSyncCreateCounter(self._x_display, value))\n atom = xlib.XInternAtom(self._x_display,\n asbytes('_NET_WM_SYNC_REQUEST_COUNTER'), False)\n ptr = pointer(self._sync_counter)\n\n xlib.XChangeProperty(self._x_display, self._window,\n atom, XA_CARDINAL, 32,\n xlib.PropModeReplace,\n cast(ptr, POINTER(c_ubyte)), 1)\n # Set window attributes\n attributes = xlib.XSetWindowAttributes()\n attributes_mask = 0\n\n self._override_redirect = False\n if self._fullscreen:\n if pyglet.options['xlib_fullscreen_override_redirect']:\n # Try not to use this any more, it causes problems; disabled\n # by default in favour of _NET_WM_STATE_FULLSCREEN.\n attributes.override_redirect = self._fullscreen\n attributes_mask |= xlib.CWOverrideRedirect\n self._override_redirect = True\n else:\n self._set_wm_state('_NET_WM_STATE_FULLSCREEN')\n\n if self._fullscreen:\n xlib.XMoveResizeWindow(self._x_display, self._window, \n self.screen.x, self.screen.y, \n self.screen.width, self.screen.height)\n else:\n xlib.XResizeWindow(self._x_display, self._window, \n self._width, self._height)\n\n xlib.XChangeWindowAttributes(self._x_display, self._window, \n attributes_mask, byref(attributes))\n\n # Set style\n styles = {\n self.WINDOW_STYLE_DEFAULT: '_NET_WM_WINDOW_TYPE_NORMAL',\n self.WINDOW_STYLE_DIALOG: '_NET_WM_WINDOW_TYPE_DIALOG',\n self.WINDOW_STYLE_TOOL: '_NET_WM_WINDOW_TYPE_UTILITY',\n }\n if self._style in styles:\n self._set_atoms_property('_NET_WM_WINDOW_TYPE', \n (styles[self._style],))\n elif self._style == self.WINDOW_STYLE_BORDERLESS:\n MWM_HINTS_DECORATIONS = 1 << 1\n PROP_MWM_HINTS_ELEMENTS = 5\n mwmhints = mwmhints_t()\n mwmhints.flags = MWM_HINTS_DECORATIONS\n mwmhints.decorations = 0\n name = xlib.XInternAtom(self._x_display, '_MOTIF_WM_HINTS', False)\n xlib.XChangeProperty(self._x_display, self._window,\n name, name, 32, xlib.PropModeReplace, \n cast(pointer(mwmhints), POINTER(c_ubyte)),\n PROP_MWM_HINTS_ELEMENTS)\n\n # Set resizeable\n if not self._resizable and not self._fullscreen:\n self.set_minimum_size(self._width, self._height)\n self.set_maximum_size(self._width, self._height)\n\n # Set caption\n self.set_caption(self._caption)\n\n # Create input context. A good but very outdated reference for this\n # is http://www.sbin.org/doc/Xlib/chapt_11.html\n if _have_utf8 and not self._x_ic:\n if not self.display._x_im:\n xlib.XSetLocaleModifiers(asbytes('@im=none'))\n self.display._x_im = \\\n xlib.XOpenIM(self._x_display, None, None, None)\n\n xlib.XFlush(self._x_display);\n\n # Need to set argtypes on this function because it's vararg,\n # and ctypes guesses wrong.\n xlib.XCreateIC.argtypes = [xlib.XIM, \n c_char_p, c_int,\n c_char_p, xlib.Window,\n c_char_p, xlib.Window,\n c_void_p]\n self._x_ic = xlib.XCreateIC(self.display._x_im, \n asbytes('inputStyle'), xlib.XIMPreeditNothing|xlib.XIMStatusNothing,\n asbytes('clientWindow'), self._window,\n asbytes('focusWindow'), self._window,\n None)\n\n filter_events = c_ulong()\n xlib.XGetICValues(self._x_ic,\n 'filterEvents', byref(filter_events),\n None)\n self._default_event_mask |= filter_events.value\n xlib.XSetICFocus(self._x_ic)\n\n self.switch_to()\n if self._visible:\n self.set_visible(True)\n\n self.set_mouse_platform_visible()\n self._applied_mouse_exclusive = None\n self._update_exclusivity()", "metadata": "root.XlibWindow._create", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 186 }, { "content": " def _map(self):\n if self._mapped:\n return\n\n # Map the window, wait for map event before continuing.\n xlib.XSelectInput(\n self._x_display, self._window, xlib.StructureNotifyMask)\n xlib.XMapRaised(self._x_display, self._window)\n e = xlib.XEvent()\n while True:\n xlib.XNextEvent(self._x_display, e)\n if e.type == xlib.MapNotify:\n break\n xlib.XSelectInput(\n self._x_display, self._window, self._default_event_mask)\n self._mapped = True\n\n if self._override_redirect:\n # Possibly an override_redirect issue.\n self.activate()\n\n self.dispatch_event('on_resize', self._width, self._height)\n self.dispatch_event('on_show')\n self.dispatch_event('on_expose')", "metadata": "root.XlibWindow._map", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 382 }, { "content": " def _unmap(self):\n if not self._mapped:\n return\n\n xlib.XSelectInput(\n self._x_display, self._window, xlib.StructureNotifyMask)\n xlib.XUnmapWindow(self._x_display, self._window)\n e = xlib.XEvent()\n while True:\n xlib.XNextEvent(self._x_display, e)\n if e.type == xlib.UnmapNotify:\n break\n\n xlib.XSelectInput(\n self._x_display, self._window, self._default_event_mask)\n self._mapped = False", "metadata": "root.XlibWindow._unmap", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 407 }, { "content": " def _get_root(self):\n attributes = xlib.XWindowAttributes()\n xlib.XGetWindowAttributes(self._x_display, self._window,\n byref(attributes))\n return attributes.root", "metadata": "root.XlibWindow._get_root", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 424 }, { "content": " def close(self):\n if not self._window:\n return\n\n self.context.destroy()\n self._unmap()\n if self._window:\n xlib.XDestroyWindow(self._x_display, self._window)\n\n del self.display._window_map[self._window]\n self._window = None\n\n if _have_utf8:\n xlib.XDestroyIC(self._x_ic)\n self._x_ic = None\n\n super(XlibWindow, self).close()", "metadata": "root.XlibWindow.close", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 430 }, { "content": " def switch_to(self):\n if self.context:\n self.context.set_current()", "metadata": "root.XlibWindow.switch_to", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 448 }, { "content": " def flip(self):\n self.draw_mouse_cursor()\n\n # TODO canvas.flip?\n if self.context:\n self.context.flip()\n\n self._sync_resize()", "metadata": "root.XlibWindow.flip", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 452 }, { "content": " def set_vsync(self, vsync):\n if pyglet.options['vsync'] is not None:\n vsync = pyglet.options['vsync']\n self._vsync = vsync\n self.context.set_vsync(vsync)", "metadata": "root.XlibWindow.set_vsync", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 461 }, { "content": " def set_caption(self, caption):\n if caption is None:\n caption = ''\n self._caption = caption\n self._set_text_property('WM_NAME', caption, allow_utf8=False)\n self._set_text_property('WM_ICON_NAME', caption, allow_utf8=False)\n self._set_text_property('_NET_WM_NAME', caption)\n self._set_text_property('_NET_WM_ICON_NAME', caption)", "metadata": "root.XlibWindow.set_caption", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 467 }, { "content": " def get_caption(self):\n return self._caption", "metadata": "root.XlibWindow.get_caption", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 476 }, { "content": " def set_size(self, width, height):\n if self._fullscreen:\n raise WindowException('Cannot set size of fullscreen window.')\n self._width = width\n self._height = height\n if not self._resizable:\n self.set_minimum_size(width, height)\n self.set_maximum_size(width, height)\n xlib.XResizeWindow(self._x_display, self._window, width, height)\n self._update_view_size()\n self.dispatch_event('on_resize', width, height)", "metadata": "root.XlibWindow.set_size", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 479 }, { "content": " def _update_view_size(self):\n xlib.XResizeWindow(self._x_display, self._view, \n self._width, self._height)", "metadata": "root.XlibWindow._update_view_size", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 491 }, { "content": " def get_size(self):\n # XGetGeometry and XWindowAttributes seem to always return the\n # original size of the window, which is wrong after the user\n # has resized it.\n # XXX this is probably fixed now, with fix of resize.\n return self._width, self._height", "metadata": "root.XlibWindow.get_size", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 495 }, { "content": " def set_location(self, x, y):\n # Assume the window manager has reparented our top-level window\n # only once, in which case attributes.x/y give the offset from\n # the frame to the content window. Better solution would be\n # to use _NET_FRAME_EXTENTS, where supported.\n attributes = xlib.XWindowAttributes()\n xlib.XGetWindowAttributes(self._x_display, self._window,\n byref(attributes))\n # XXX at least under KDE's WM these attrs are both 0\n x -= attributes.x\n y -= attributes.y\n xlib.XMoveWindow(self._x_display, self._window, x, y)", "metadata": "root.XlibWindow.set_location", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 502 }, { "content": " def get_location(self):\n child = xlib.Window()\n x = c_int()\n y = c_int()\n xlib.XTranslateCoordinates(self._x_display,\n self._window,\n self._get_root(),\n 0, 0,\n byref(x),\n byref(y),\n byref(child))\n return x.value, y.value", "metadata": "root.XlibWindow.get_location", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 515 }, { "content": " def activate(self):\n xlib.XSetInputFocus(self._x_display, self._window,\n xlib.RevertToParent, xlib.CurrentTime)", "metadata": "root.XlibWindow.activate", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 528 }, { "content": " def set_visible(self, visible=True):\n if visible:\n self._map()\n else:\n self._unmap()\n self._visible = visible", "metadata": "root.XlibWindow.set_visible", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 532 }, { "content": " def set_minimum_size(self, width, height):\n self._minimum_size = width, height\n self._set_wm_normal_hints()", "metadata": "root.XlibWindow.set_minimum_size", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 539 }, { "content": " def set_maximum_size(self, width, height):\n self._maximum_size = width, height\n self._set_wm_normal_hints()", "metadata": "root.XlibWindow.set_maximum_size", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 543 }, { "content": " def minimize(self):\n xlib.XIconifyWindow(self._x_display, self._window, self._x_screen_id)", "metadata": "root.XlibWindow.minimize", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 547 }, { "content": " def maximize(self):\n self._set_wm_state('_NET_WM_STATE_MAXIMIZED_HORZ',\n '_NET_WM_STATE_MAXIMIZED_VERT')", "metadata": "root.XlibWindow.maximize", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 550 }, { "content": " def set_mouse_platform_visible(self, platform_visible=None):\n if platform_visible is None:\n platform_visible = self._mouse_visible and \\\n not self._mouse_cursor.drawable\n\n if not platform_visible:\n # Hide pointer by creating an empty cursor\n black = xlib.XBlackPixel(self._x_display, self._x_screen_id)\n black = xlib.XColor()\n bmp = xlib.XCreateBitmapFromData(self._x_display, self._window,\n c_buffer(8), 8, 8)\n cursor = xlib.XCreatePixmapCursor(self._x_display, bmp, bmp,\n black, black, 0, 0)\n xlib.XDefineCursor(self._x_display, self._window, cursor)\n xlib.XFreeCursor(self._x_display, cursor)\n xlib.XFreePixmap(self._x_display, bmp)\n else:\n # Restore cursor\n if isinstance(self._mouse_cursor, XlibMouseCursor):\n xlib.XDefineCursor(self._x_display, self._window, \n self._mouse_cursor.cursor)\n else:\n xlib.XUndefineCursor(self._x_display, self._window)", "metadata": "root.XlibWindow.set_mouse_platform_visible", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 554 }, { "content": " def set_mouse_position(self, x, y):\n xlib.XWarpPointer(self._x_display,\n 0, # src window\n self._window, # dst window\n 0, 0, # src x, y\n 0, 0, # src w, h\n x, self._height - y,\n )", "metadata": "root.XlibWindow.set_mouse_position", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 578 }, { "content": " def _update_exclusivity(self):\n mouse_exclusive = self._active and self._mouse_exclusive\n keyboard_exclusive = self._active and self._keyboard_exclusive\n\n if mouse_exclusive != self._applied_mouse_exclusive:\n if mouse_exclusive:\n self.set_mouse_platform_visible(False)\n\n # Restrict to client area\n xlib.XGrabPointer(self._x_display, self._window,\n True,\n 0,\n xlib.GrabModeAsync,\n xlib.GrabModeAsync,\n self._window,\n 0,\n xlib.CurrentTime)\n\n # Move pointer to center of window\n x = self._width / 2\n y = self._height / 2\n self._mouse_exclusive_client = x, y\n self.set_mouse_position(x, y)\n elif self._fullscreen and not self.screen._xinerama:\n # Restrict to fullscreen area (prevent viewport scrolling)\n self.set_mouse_position(0, 0)\n r = xlib.XGrabPointer(self._x_display, self._view,\n True, 0,\n xlib.GrabModeAsync,\n xlib.GrabModeAsync,\n self._view,\n 0,\n xlib.CurrentTime)\n if r:\n # Failed to grab, try again later\n self._applied_mouse_exclusive = None\n return\n self.set_mouse_platform_visible()\n else:\n # Unclip\n xlib.XUngrabPointer(self._x_display, xlib.CurrentTime)\n self.set_mouse_platform_visible()\n\n self._applied_mouse_exclusive = mouse_exclusive\n\n if keyboard_exclusive != self._applied_keyboard_exclusive:\n if keyboard_exclusive:\n xlib.XGrabKeyboard(self._x_display,\n self._window,\n False,\n xlib.GrabModeAsync,\n xlib.GrabModeAsync,\n xlib.CurrentTime)\n else:\n xlib.XUngrabKeyboard(self._x_display, xlib.CurrentTime)\n self._applied_keyboard_exclusive = keyboard_exclusive", "metadata": "root.XlibWindow._update_exclusivity", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 587 }, { "content": " def set_exclusive_mouse(self, exclusive=True):\n if exclusive == self._mouse_exclusive:\n return\n\n self._mouse_exclusive = exclusive\n self._update_exclusivity()", "metadata": "root.XlibWindow.set_exclusive_mouse", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 644 }, { "content": " def set_exclusive_keyboard(self, exclusive=True):\n if exclusive == self._keyboard_exclusive:\n return\n \n self._keyboard_exclusive = exclusive\n self._update_exclusivity()", "metadata": "root.XlibWindow.set_exclusive_keyboard", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 651 }, { "content": " def get_system_mouse_cursor(self, name):\n if name == self.CURSOR_DEFAULT:\n return DefaultMouseCursor()\n\n # NQR means default shape is not pretty... surely there is another\n # cursor font?\n cursor_shapes = {\n self.CURSOR_CROSSHAIR: cursorfont.XC_crosshair,\n self.CURSOR_HAND: cursorfont.XC_hand2,\n self.CURSOR_HELP: cursorfont.XC_question_arrow, # NQR\n self.CURSOR_NO: cursorfont.XC_pirate, # NQR\n self.CURSOR_SIZE: cursorfont.XC_fleur,\n self.CURSOR_SIZE_UP: cursorfont.XC_top_side,\n self.CURSOR_SIZE_UP_RIGHT: cursorfont.XC_top_right_corner,\n self.CURSOR_SIZE_RIGHT: cursorfont.XC_right_side,\n self.CURSOR_SIZE_DOWN_RIGHT: cursorfont.XC_bottom_right_corner,\n self.CURSOR_SIZE_DOWN: cursorfont.XC_bottom_side,\n self.CURSOR_SIZE_DOWN_LEFT: cursorfont.XC_bottom_left_corner,\n self.CURSOR_SIZE_LEFT: cursorfont.XC_left_side,\n self.CURSOR_SIZE_UP_LEFT: cursorfont.XC_top_left_corner,\n self.CURSOR_SIZE_UP_DOWN: cursorfont.XC_sb_v_double_arrow,\n self.CURSOR_SIZE_LEFT_RIGHT: cursorfont.XC_sb_h_double_arrow,\n self.CURSOR_TEXT: cursorfont.XC_xterm,\n self.CURSOR_WAIT: cursorfont.XC_watch,\n self.CURSOR_WAIT_ARROW: cursorfont.XC_watch, # NQR\n }\n if name not in cursor_shapes:\n raise MouseCursorException('Unknown cursor name \"%s\"' % name)\n cursor = xlib.XCreateFontCursor(self._x_display, cursor_shapes[name])\n return XlibMouseCursor(cursor)", "metadata": "root.XlibWindow.get_system_mouse_cursor", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 658 }, { "content": " def set_icon(self, *images):\n # Careful! XChangeProperty takes an array of long when data type\n # is 32-bit (but long can be 64 bit!), so pad high bytes of format if\n # necessary.\n\n import sys\n format = {\n ('little', 4): 'BGRA',\n ('little', 8): 'BGRAAAAA',\n ('big', 4): 'ARGB',\n ('big', 8): 'AAAAARGB'\n }[(sys.byteorder, sizeof(c_ulong))]\n\n data = ''\n for image in images:\n image = image.get_image_data()\n pitch = -(image.width * len(format))\n s = c_buffer(sizeof(c_ulong) * 2)\n memmove(s, cast((c_ulong * 2)(image.width, image.height), \n POINTER(c_ubyte)), len(s))\n data += s.raw + image.get_data(format, pitch)\n buffer = (c_ubyte * len(data))()\n memmove(buffer, data, len(data))\n atom = xlib.XInternAtom(self._x_display, '_NET_WM_ICON', False)\n xlib.XChangeProperty(self._x_display, self._window, atom, XA_CARDINAL,\n 32, xlib.PropModeReplace, buffer, len(data)/sizeof(c_ulong))", "metadata": "root.XlibWindow.set_icon", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 689 }, { "content": " def _set_wm_normal_hints(self):\n hints = xlib.XAllocSizeHints().contents\n if self._minimum_size:\n hints.flags |= xlib.PMinSize\n hints.min_width, hints.min_height = self._minimum_size\n if self._maximum_size:\n hints.flags |= xlib.PMaxSize\n hints.max_width, hints.max_height = self._maximum_size\n xlib.XSetWMNormalHints(self._x_display, self._window, byref(hints))", "metadata": "root.XlibWindow._set_wm_normal_hints", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 718 }, { "content": " def _set_text_property(self, name, value, allow_utf8=True):\n atom = xlib.XInternAtom(self._x_display, asbytes(name), False)\n if not atom:\n raise XlibException('Undefined atom \"%s\"' % name)\n assert type(value) in (str, unicode)\n property = xlib.XTextProperty()\n if _have_utf8 and allow_utf8:\n buf = create_string_buffer(value.encode('utf8'))\n result = xlib.Xutf8TextListToTextProperty(self._x_display,\n cast(pointer(buf), c_char_p), 1, xlib.XUTF8StringStyle, \n byref(property))\n if result < 0:\n raise XlibException('Could not create UTF8 text property')\n else:\n buf = create_string_buffer(value.encode('ascii', 'ignore'))\n result = xlib.XStringListToTextProperty(\n cast(pointer(buf), c_char_p), 1, byref(property))\n if result < 0:\n raise XlibException('Could not create text property')\n xlib.XSetTextProperty(self._x_display,\n self._window, byref(property), atom)\n # XXX <rj> Xlib doesn't like us freeing this\n #xlib.XFree(property.value)", "metadata": "root.XlibWindow._set_text_property", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 728 }, { "content": " def _set_atoms_property(self, name, values, mode=xlib.PropModeReplace):\n name_atom = xlib.XInternAtom(self._x_display, asbytes(name), False)\n atoms = []\n for value in values:\n atoms.append(xlib.XInternAtom(self._x_display, asbytes(value), False))\n atom_type = xlib.XInternAtom(self._x_display, asbytes('ATOM'), False)\n if len(atoms):\n atoms_ar = (xlib.Atom * len(atoms))(*atoms)\n xlib.XChangeProperty(self._x_display, self._window,\n name_atom, atom_type, 32, mode,\n cast(pointer(atoms_ar), POINTER(c_ubyte)), len(atoms))\n else:\n xlib.XDeleteProperty(self._x_display, self._window, net_wm_state)", "metadata": "root.XlibWindow._set_atoms_property", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 752 }, { "content": " def _set_wm_state(self, *states):\n # Set property\n net_wm_state = xlib.XInternAtom(self._x_display, '_NET_WM_STATE', False)\n atoms = []\n for state in states:\n atoms.append(xlib.XInternAtom(self._x_display, state, False))\n atom_type = xlib.XInternAtom(self._x_display, 'ATOM', False)\n if len(atoms):\n atoms_ar = (xlib.Atom * len(atoms))(*atoms)\n xlib.XChangeProperty(self._x_display, self._window,\n net_wm_state, atom_type, 32, xlib.PropModePrepend,\n cast(pointer(atoms_ar), POINTER(c_ubyte)), len(atoms))\n else:\n xlib.XDeleteProperty(self._x_display, self._window, net_wm_state)\n\n # Nudge the WM\n e = xlib.XEvent()\n e.xclient.type = xlib.ClientMessage\n e.xclient.message_type = net_wm_state\n e.xclient.display = cast(self._x_display, POINTER(xlib.Display))\n e.xclient.window = self._window\n e.xclient.format = 32\n e.xclient.data.l[0] = xlib.PropModePrepend\n for i, atom in enumerate(atoms):\n e.xclient.data.l[i + 1] = atom\n xlib.XSendEvent(self._x_display, self._get_root(),\n False, xlib.SubstructureRedirectMask, byref(e))", "metadata": "root.XlibWindow._set_wm_state", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 766 }, { "content": " def dispatch_events(self):\n self.dispatch_pending_events()\n\n self._allow_dispatch_event = True\n\n e = xlib.XEvent()\n\n # Cache these in case window is closed from an event handler\n _x_display = self._x_display\n _window = self._window\n _view = self._view\n\n # Check for the events specific to this window\n while xlib.XCheckWindowEvent(_x_display, _window,\n 0x1ffffff, byref(e)):\n # Key events are filtered by the xlib window event\n # handler so they get a shot at the prefiltered event.\n if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):\n if xlib.XFilterEvent(e, 0):\n continue\n self.dispatch_platform_event(e)\n\n # Check for the events specific to this view\n while xlib.XCheckWindowEvent(_x_display, _view,\n 0x1ffffff, byref(e)):\n # Key events are filtered by the xlib window event\n # handler so they get a shot at the prefiltered event.\n if e.xany.type not in (xlib.KeyPress, xlib.KeyRelease):\n if xlib.XFilterEvent(e, 0):\n continue\n self.dispatch_platform_event_view(e)\n\n # Generic events for this window (the window close event).\n while xlib.XCheckTypedWindowEvent(_x_display, _window, \n xlib.ClientMessage, byref(e)):\n self.dispatch_platform_event(e) \n \n if self._needs_resize:\n self.dispatch_event('on_resize', self._width, self._height)\n self.dispatch_event('on_expose')\n self._needs_resize = False\n\n self._allow_dispatch_event = False", "metadata": "root.XlibWindow.dispatch_events", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 796 }, { "content": " def dispatch_pending_events(self):\n while self._event_queue:\n EventDispatcher.dispatch_event(self, *self._event_queue.pop(0))\n\n # Dispatch any context-related events\n if self._lost_context:\n self._lost_context = False\n EventDispatcher.dispatch_event(self, 'on_context_lost')\n if self._lost_context_state:\n self._lost_context_state = False\n EventDispatcher.dispatch_event(self, 'on_context_state_lost')", "metadata": "root.XlibWindow.dispatch_pending_events", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 840 }, { "content": " def dispatch_platform_event(self, e):\n if self._applied_mouse_exclusive is None:\n self._update_exclusivity()\n event_handler = self._event_handlers.get(e.type)\n if event_handler:\n event_handler(e)", "metadata": "root.XlibWindow.dispatch_platform_event", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 852 }, { "content": " def dispatch_platform_event_view(self, e):\n event_handler = self._view_event_handlers.get(e.type)\n if event_handler:\n event_handler(e)", "metadata": "root.XlibWindow.dispatch_platform_event_view", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 859 }, { "content": " @staticmethod\n def _translate_modifiers(state):\n modifiers = 0\n if state & xlib.ShiftMask:\n modifiers |= key.MOD_SHIFT\n if state & xlib.ControlMask:\n modifiers |= key.MOD_CTRL\n if state & xlib.LockMask:\n modifiers |= key.MOD_CAPSLOCK\n if state & xlib.Mod1Mask:\n modifiers |= key.MOD_ALT\n if state & xlib.Mod2Mask:\n modifiers |= key.MOD_NUMLOCK\n if state & xlib.Mod4Mask:\n modifiers |= key.MOD_WINDOWS\n if state & xlib.Mod5Mask:\n modifiers |= key.MOD_SCROLLLOCK\n return modifiers", "metadata": "root.XlibWindow._translate_modifiers", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 864 }, { "content": " def _event_text_symbol(self, ev):\n text = None\n symbol = xlib.KeySym()\n buffer = create_string_buffer(128)\n\n # Look up raw keysym before XIM filters it (default for keypress and\n # keyrelease)\n count = xlib.XLookupString(ev.xkey,\n buffer, len(buffer) - 1,\n byref(symbol), None)\n\n # Give XIM a shot\n filtered = xlib.XFilterEvent(ev, ev.xany.window)\n\n if ev.type == xlib.KeyPress and not filtered:\n status = c_int()\n if _have_utf8:\n encoding = 'utf8'\n count = xlib.Xutf8LookupString(self._x_ic,\n ev.xkey,\n buffer, len(buffer) - 1,\n byref(symbol), byref(status))\n if status.value == xlib.XBufferOverflow:\n raise NotImplementedError('TODO: XIM buffer resize')\n\n else:\n encoding = 'ascii'\n count = xlib.XLookupString(ev.xkey,\n buffer, len(buffer) - 1,\n byref(symbol), None)\n if count:\n status.value = xlib.XLookupBoth\n\n if status.value & (xlib.XLookupChars | xlib.XLookupBoth):\n text = buffer.value[:count].decode(encoding)\n\n # Don't treat Unicode command codepoints as text, except Return.\n if text and unicodedata.category(text) == 'Cc' and text != '\\r':\n text = None\n\n symbol = symbol.value\n\n # If the event is a XIM filtered event, the keysym will be virtual\n # (e.g., aacute instead of A after a dead key). Drop it, we don't\n # want these kind of key events.\n if ev.xkey.keycode == 0 and not filtered:\n symbol = None\n\n # pyglet.self.key keysymbols are identical to X11 keysymbols, no\n # need to map the keysymbol. For keysyms outside the pyglet set, map\n # raw key code to a user key.\n if symbol and symbol not in key._key_names and ev.xkey.keycode:\n # Issue 353: Symbol is uppercase when shift key held down.\n symbol = ord(unichr(symbol).lower())\n\n # If still not recognised, use the keycode\n if symbol not in key._key_names:\n symbol = key.user_key(ev.xkey.keycode)\n\n if filtered:\n # The event was filtered, text must be ignored, but the symbol is\n # still good.\n return None, symbol\n\n return text, symbol", "metadata": "root.XlibWindow._event_text_symbol", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 897 }, { "content": " def _event_text_motion(self, symbol, modifiers):\n if modifiers & key.MOD_ALT:\n return None\n ctrl = modifiers & key.MOD_CTRL != 0\n return _motion_map.get((symbol, ctrl), None)", "metadata": "root.XlibWindow._event_text_motion", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 963 }, { "content": " @ViewEventHandler\n @XlibEventHandler(xlib.KeyPress)\n @XlibEventHandler(xlib.KeyRelease)\n def _event_key_view(self, ev):\n if ev.type == xlib.KeyRelease:\n # Look in the queue for a matching KeyPress with same timestamp,\n # indicating an auto-repeat rather than actual key event.\n saved = []\n while True:\n auto_event = xlib.XEvent()\n result = xlib.XCheckWindowEvent(self._x_display,\n self._window, xlib.KeyPress|xlib.KeyRelease, \n byref(auto_event))\n if not result:\n break\n saved.append(auto_event)\n if auto_event.type == xlib.KeyRelease:\n # just save this off for restoration back to the queue\n continue\n if ev.xkey.keycode == auto_event.xkey.keycode:\n # Found a key repeat: dispatch EVENT_TEXT* event\n text, symbol = self._event_text_symbol(auto_event)\n modifiers = self._translate_modifiers(ev.xkey.state)\n modifiers_ctrl = modifiers & (key.MOD_CTRL | key.MOD_ALT)\n motion = self._event_text_motion(symbol, modifiers)\n if motion:\n if modifiers & key.MOD_SHIFT:\n self.dispatch_event(\n 'on_text_motion_select', motion)\n else:\n self.dispatch_event('on_text_motion', motion)\n elif text and not modifiers_ctrl:\n self.dispatch_event('on_text', text)\n\n ditched = saved.pop()\n for auto_event in reversed(saved):\n xlib.XPutBackEvent(self._x_display, byref(auto_event))\n return\n else:\n # Key code of press did not match, therefore no repeating\n # is going on, stop searching.\n break\n # Whoops, put the events back, it's for real.\n for auto_event in reversed(saved):\n xlib.XPutBackEvent(self._x_display, byref(auto_event))\n\n text, symbol = self._event_text_symbol(ev)\n modifiers = self._translate_modifiers(ev.xkey.state)\n modifiers_ctrl = modifiers & (key.MOD_CTRL | key.MOD_ALT)\n motion = self._event_text_motion(symbol, modifiers)\n\n if ev.type == xlib.KeyPress:\n if symbol:\n self.dispatch_event('on_key_press', symbol, modifiers)\n if motion:\n if modifiers & key.MOD_SHIFT:\n self.dispatch_event('on_text_motion_select', motion)\n else:\n self.dispatch_event('on_text_motion', motion)\n elif text and not modifiers_ctrl:\n self.dispatch_event('on_text', text)\n elif ev.type == xlib.KeyRelease:\n if symbol:\n self.dispatch_event('on_key_release', symbol, modifiers)", "metadata": "root.XlibWindow._event_key_view", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 969 }, { "content": " @XlibEventHandler(xlib.KeyPress)\n @XlibEventHandler(xlib.KeyRelease)\n def _event_key(self, ev):\n return self._event_key_view(ev)", "metadata": "root.XlibWindow._event_key", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1034 }, { "content": " @ViewEventHandler\n @XlibEventHandler(xlib.MotionNotify)\n def _event_motionnotify_view(self, ev):\n x = ev.xmotion.x\n y = self.height - ev.xmotion.y\n\n if self._mouse_in_window:\n dx = x - self._mouse_x\n dy = y - self._mouse_y\n else:\n dx = dy = 0\n\n if self._applied_mouse_exclusive and \\\n (ev.xmotion.x, ev.xmotion.y) == self._mouse_exclusive_client:\n # Ignore events caused by XWarpPointer\n self._mouse_x = x\n self._mouse_y = y\n return\n\n if self._applied_mouse_exclusive:\n # Reset pointer position\n ex, ey = self._mouse_exclusive_client\n xlib.XWarpPointer(self._x_display,\n 0,\n self._window,\n 0, 0,\n 0, 0,\n ex, ey)\n\n self._mouse_x = x\n self._mouse_y = y\n self._mouse_in_window = True\n\n buttons = 0\n if ev.xmotion.state & xlib.Button1MotionMask:\n buttons |= mouse.LEFT\n if ev.xmotion.state & xlib.Button2MotionMask:\n buttons |= mouse.MIDDLE\n if ev.xmotion.state & xlib.Button3MotionMask:\n buttons |= mouse.RIGHT\n\n if buttons:\n # Drag event\n modifiers = self._translate_modifiers(ev.xmotion.state)\n self.dispatch_event('on_mouse_drag',\n x, y, dx, dy, buttons, modifiers)\n else:\n # Motion event\n self.dispatch_event('on_mouse_motion', x, y, dx, dy)", "metadata": "root.XlibWindow._event_motionnotify_view", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1039 }, { "content": " @XlibEventHandler(xlib.MotionNotify)\n def _event_motionnotify(self, ev):\n # Window motion looks for drags that are outside the view but within\n # the window.\n buttons = 0\n if ev.xmotion.state & xlib.Button1MotionMask:\n buttons |= mouse.LEFT\n if ev.xmotion.state & xlib.Button2MotionMask:\n buttons |= mouse.MIDDLE\n if ev.xmotion.state & xlib.Button3MotionMask:\n buttons |= mouse.RIGHT\n\n if buttons:\n # Drag event\n x = ev.xmotion.x - self._view_x\n y = self._height - (ev.xmotion.y - self._view_y)\n\n if self._mouse_in_window:\n dx = x - self._mouse_x\n dy = y - self._mouse_y\n else:\n dx = dy = 0\n self._mouse_x = x\n self._mouse_y = y\n\n modifiers = self._translate_modifiers(ev.xmotion.state)\n self.dispatch_event('on_mouse_drag',\n x, y, dx, dy, buttons, modifiers)", "metadata": "root.XlibWindow._event_motionnotify", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1089 }, { "content": " @XlibEventHandler(xlib.ClientMessage)\n def _event_clientmessage(self, ev):\n atom = ev.xclient.data.l[0]\n if atom == xlib.XInternAtom(ev.xclient.display,\n asbytes('WM_DELETE_WINDOW'), False):\n self.dispatch_event('on_close')\n elif (self._enable_xsync and \n atom == xlib.XInternAtom(ev.xclient.display, \n asbytes('_NET_WM_SYNC_REQUEST'), False)):\n lo = ev.xclient.data.l[2]\n hi = ev.xclient.data.l[3]\n self._current_sync_value = xsync.XSyncValue(hi, lo)", "metadata": "root.XlibWindow._event_clientmessage", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1118 }, { "content": " def _sync_resize(self):\n if self._enable_xsync and self._current_sync_valid:\n if xsync.XSyncValueIsZero(self._current_sync_value):\n self._current_sync_valid = False\n return\n xsync.XSyncSetCounter(self._x_display, \n self._sync_counter,\n self._current_sync_value)\n self._current_sync_value = None\n self._current_sync_valid = False", "metadata": "root.XlibWindow._sync_resize", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1131 }, { "content": " @ViewEventHandler\n @XlibEventHandler(xlib.ButtonPress)\n @XlibEventHandler(xlib.ButtonRelease)\n def _event_button(self, ev):\n x = ev.xbutton.x\n y = self.height - ev.xbutton.y\n button = 1 << (ev.xbutton.button - 1) # 1, 2, 3 -> 1, 2, 4\n modifiers = self._translate_modifiers(ev.xbutton.state)\n if ev.type == xlib.ButtonPress:\n # override_redirect issue: manually activate this window if\n # fullscreen.\n if self._override_redirect and not self._active:\n self.activate()\n\n if ev.xbutton.button == 4:\n self.dispatch_event('on_mouse_scroll', x, y, 0, 1)\n elif ev.xbutton.button == 5:\n self.dispatch_event('on_mouse_scroll', x, y, 0, -1)\n elif ev.xbutton.button < len(self._mouse_buttons):\n self._mouse_buttons[ev.xbutton.button] = True\n self.dispatch_event('on_mouse_press', \n x, y, button, modifiers)\n else:\n if ev.xbutton.button < 4:\n self._mouse_buttons[ev.xbutton.button] = False\n self.dispatch_event('on_mouse_release', \n x, y, button, modifiers)", "metadata": "root.XlibWindow._event_button", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1142 }, { "content": " @ViewEventHandler\n @XlibEventHandler(xlib.Expose)\n def _event_expose(self, ev):\n # Ignore all expose events except the last one. We could be told\n # about exposure rects - but I don't see the point since we're\n # working with OpenGL and we'll just redraw the whole scene.\n if ev.xexpose.count > 0: return\n self.dispatch_event('on_expose')", "metadata": "root.XlibWindow._event_expose", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1170 }, { "content": " @ViewEventHandler\n @XlibEventHandler(xlib.EnterNotify)\n def _event_enternotify(self, ev):\n # figure active mouse buttons\n # XXX ignore modifier state?\n state = ev.xcrossing.state\n self._mouse_buttons[1] = state & xlib.Button1Mask\n self._mouse_buttons[2] = state & xlib.Button2Mask\n self._mouse_buttons[3] = state & xlib.Button3Mask\n self._mouse_buttons[4] = state & xlib.Button4Mask\n self._mouse_buttons[5] = state & xlib.Button5Mask\n\n # mouse position\n x = self._mouse_x = ev.xcrossing.x\n y = self._mouse_y = self.height - ev.xcrossing.y\n self._mouse_in_window = True\n\n # XXX there may be more we could do here\n self.dispatch_event('on_mouse_enter', x, y)", "metadata": "root.XlibWindow._event_enternotify", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1179 }, { "content": " @ViewEventHandler\n @XlibEventHandler(xlib.LeaveNotify)\n def _event_leavenotify(self, ev):\n x = self._mouse_x = ev.xcrossing.x\n y = self._mouse_y = self.height - ev.xcrossing.y\n self._mouse_in_window = False\n self.dispatch_event('on_mouse_leave', x, y)", "metadata": "root.XlibWindow._event_leavenotify", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1199 }, { "content": " @XlibEventHandler(xlib.ConfigureNotify)\n def _event_configurenotify(self, ev):\n if self._enable_xsync and self._current_sync_value:\n self._current_sync_valid = True\n\n if self._fullscreen:\n return\n\n self.switch_to()\n\n w, h = ev.xconfigure.width, ev.xconfigure.height\n x, y = ev.xconfigure.x, ev.xconfigure.y\n if self._width != w or self._height != h:\n self._update_view_size()\n self._width = w\n self._height = h\n self._needs_resize = True\n if self._x != x or self._y != y:\n self.dispatch_event('on_move', x, y)\n self._x = x\n self._y = y", "metadata": "root.XlibWindow._event_configurenotify", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1207 }, { "content": " @XlibEventHandler(xlib.FocusIn)\n def _event_focusin(self, ev):\n self._active = True\n self._update_exclusivity()\n self.dispatch_event('on_activate')\n xlib.XSetICFocus(self._x_ic)", "metadata": "root.XlibWindow._event_focusin", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1229 }, { "content": " @XlibEventHandler(xlib.FocusOut)\n def _event_focusout(self, ev):\n self._active = False\n self._update_exclusivity()\n self.dispatch_event('on_deactivate')\n xlib.XUnsetICFocus(self._x_ic)", "metadata": "root.XlibWindow._event_focusout", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1236 }, { "content": " @XlibEventHandler(xlib.MapNotify)\n def _event_mapnotify(self, ev):\n self._mapped = True\n self.dispatch_event('on_show')\n self._update_exclusivity()", "metadata": "root.XlibWindow._event_mapnotify", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1243 }, { "content": " @XlibEventHandler(xlib.UnmapNotify)\n def _event_unmapnotify(self, ev):\n self._mapped = False\n self.dispatch_event('on_hide')", "metadata": "root.XlibWindow._event_unmapnotify", "header": "['class', 'XlibWindow', '(', 'BaseWindow', ')', ':', '___EOS___']", "index": 1249 } ]
[ { "span": "import warnings", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 15 }, { "span": "from pyglet.window import WindowException, NoSuchDisplayException, \\\n MouseCursorException, MouseCursor, \\\n DefaultMouseCursor, ImageMouseCursor, BaseWindow, _PlatformEventHandler, \\\n _ViewEventHandler", "start_line": 42, "start_column": 0, "end_line": 45, "end_column": 21 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyglet_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2006", "-", "2008", " ", "Alex", " ", "Hol", "kne", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "pyg", "let", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "written_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Id", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unicodedata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyglet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "Window", "Exception_", ",_", "No", "Suc", "h", "Display", "Exception_", ",_", "Mouse", "Curs", "or", "Exception_", ",_", "Mouse", "Cursor_", ",_", "Default", "Mouse", "Cursor_", ",_", "Image", "Mouse", "Cursor_", ",_", "Base", "Window_", ",_", "\\u", "Plat", "form", "Event", "Handler_", ",_", "\\u", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "mouse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "event_", "import_", "Event", "Dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "canvas_", "._", "xli", "b_", "import_", "Xl", "ib", "Canvas_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "xli", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "cursor", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "._", "compat_", "import_", "as", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pyglet_", "._", "libs_", "._", "x1", "1_", "import_", "xs", "ync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "have", "\\u", "xs", "ync_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "have", "\\u", "xs", "ync_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "XA", "\\u", "CARD", "INAL", "_", "=_", "6_", "#", " ", "Xa", "tom", ".", "h", ":", "14_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Do", " ", "we", " ", "have", " ", "the", " ", "Nove", "mber", " ", "2000", " ", "UT", "F8", " ", "extensi", "on", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "have", "\\u", "utf8_", "=_", "hasattr_", "(_", "xli", "b_", "._", "\\u", "lib_", ",_", "'", "Xu", "tf", "8", "Text", "List", "To", "Text", "Proper", "ty", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "symbol", ",", "ctrl", " ", "->", " ", "moti", "on", " ", "mapping_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "moti", "on", "\\u", "map_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "UP_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "UP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "RIGHT_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "RIGHT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "DOWN_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "DOWN_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "LEFT_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "LEFT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "RIGHT_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "NEXT", "\\u", "WORD_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "LEFT_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "PREVI", "OUS", "\\u", "WORD_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "HOME_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "BEGIN", "NING", "\\u", "OF", "\\u", "LINE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "END_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "END", "\\u", "OF", "\\u", "LINE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "PAGE", "UP_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "PREVI", "OUS", "\\u", "PAGE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "PAGE", "DOWN_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "NEXT", "\\u", "PAGE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "HOME_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "BEGIN", "NING", "\\u", "OF", "\\u", "FILE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "END_", ",_", "True_", ")_", ":_", "key_", "._", "MOTION", "\\u", "END", "\\u", "OF", "\\u", "FILE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "BACK", "SPACE_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "BACK", "SPACE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "key_", "._", "DELETE_", ",_", "False_", ")_", ":_", "key_", "._", "MOTION", "\\u", "DELETE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plat", "form", " ", "event", " ", "data", " ", "is", " ", "single", " ", "item", ",", " ", "so", " ", "use", " ", "platform", " ", "event", " ", "handler", " ", "direct", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Xl", "ib", "Event", "Handler_", "=_", "\\u", "Plat", "form", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "View", "Event", "Handler_", "=_", "\\u", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "mw", "mh", "ints", "\\u", "t_", "(_", "Structure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fields\\u_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "flags", "'_", ",_", "c\\u", "uint32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "function", "s", "'_", ",_", "c\\u", "uint32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "decorat", "ion", "s", "'_", ",_", "c\\u", "uint32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "input", "\\u", "mode", "'_", ",_", "c\\u", "int32_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "status", "'_", ",_", "c\\u", "uint32_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Xl", "ib", "Exception_", "(_", "Window", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "An", " ", "X1", "1", "-", "specific", " ", "exception", ".", " ", " ", "Thi", "s", " ", "exception", " ", "is", " ", "probab", "ly", " ", "a", " ", "program", "ming", "\\", "10", ";", " ", " ", " ", " ", "error", " ", "in", " ", "pyg", "let", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Xl", "ib", "Mouse", "Cursor_", "(_", "Mouse", "Cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "drawa", "ble_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Mouse", "Cursor_", "(_", "Mouse", "Cursor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cursor_", "=_", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "x", "\\u", "display_", "=_", "None_", "#", " ", "X", " ", "display", " ", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "x", "\\u", "screen", "\\u", "id_", "=_", "None_", "#", " ", "X", " ", "screen", " ", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "x", "\\u", "ic_", "=_", "None_", "#", " ", "X", " ", "input", " ", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "window_", "=_", "None_", "#", " ", "Xl", "ib", " ", "window", " ", "handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "minim", "um", "\\u", "size_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "maxim", "um", "\\u", "size_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "override", "\\u", "redirect_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "x_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "y_", "=_", "0_", "#", " ", "Las", "t", " ", "know", "n", " ", "window", " ", "position_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "width_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "height_", "=_", "0_", "#", " ", "Las", "t", " ", "know", "n", " ", "window", " ", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "mouse", "\\u", "exclu", "sive", "\\u", "client_", "=_", "None_", "#", " ", "x", ",", "y", " ", "of", " ", "\"", "real", "\"", " ", "mouse", " ", "dur", "ing", " ", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "mouse", "\\u", "buttons_", "=_", "[_", "False_", "]_", "*_", "6_", "#", " ", "State", " ", "of", " ", "each", " ", "xli", "b", " ", "button_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "keyb", "oard", "\\u", "exclusive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "applied", "\\u", "keyb", "oard", "\\u", "exclusive_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "mapped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "lost", "\\u", "context_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "lost", "\\u", "context", "\\u", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "enable", "\\u", "xs", "ync_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "current", "\\u", "sync", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "current", "\\u", "sync", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "need", "s", "\\u", "resize_", "=_", "False_", "#", " ", "Tru", "e", " ", "whe", "n", " ", "resiz", "e", " ", "event", " ", "has", " ", "bee", "n", " ", "receive", "d", " ", "but", " ", "not_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dispatch", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "default", "\\u", "event", "\\u", "mask_", "=_", "(_", "0x1f", "fffff", "_", "\\u\\u\\uNL\\u\\u\\u_", "&_", "~_", "xli", "b_", "._", "Point", "er", "Motion", "Hint", "Mask_", "\\u\\u\\uNL\\u\\u\\u_", "&_", "~_", "xli", "b_", "._", "Resize", "Redirect", "Mask_", "\\u\\u\\uNL\\u\\u\\u_", "&_", "~_", "xli", "b_", "._", "Substr", "ucture", "Noti", "fy", "Mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uN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WLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Priva", "te", " ", "utility_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Event", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Event", " ", "handlers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "'''", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "\\u", "event", "\\u", "symbol", "(", "self", ",", " ", "event", "):", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "pyg", "let", ".", "self", ".", "key", " ", "keysym", "bol", "s", " ", "are", " ", "identi", "cal", " ", "to", " ", "X1", "1", " ", "keysym", "bol", "s", ",", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "need", " ", "to", " ", "map", " ", "the", " ", "keysym", "bol", ".", "\\", "10", ";", " ", " ", " ", " ", "symbol", " ", "=", " ", "xli", "b", ".", "XK", "ey", "code", "To", "Keys", "ym", "(", "self", ".\\u", "x", "\\u", "display", ",", " ", "event", ".", "xk", "ey", ".", "keyc", "ode", ",", " ", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "symbol", " ", "==", " ", "0", ":", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "XI", "M", " ", "event", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "eli", "f", " ", "symbol", " ", "not", " ", "in", " ", "key", ".\\u", "key", "\\u", "names", ".", "keys", "():", "\\", "10", ";", " ", " ", " ", " ", "symbol", " ", "=", " ", "key", ".", "user", "\\u", "key", "(", "event", ".", "xk", "ey", ".", "keyc", "ode", ")", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "symbol", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bind", " ", "event", " ", "handlers_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "event", "\\u", "handlers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "view", "\\u", "event", "\\u", "handlers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "self_", "._", "\\u", "platform", "\\u", "event", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "func_", "=_", "getattr_", "(_", "self_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "message_", "in_", "func_", "._", "\\u", "platform", "\\u", "event", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "func_", ",_", "'\\u", "view", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "view", "\\u", "event", "\\u", "handlers_", "[_", "message_", "]_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "event", "\\u", "handlers_", "[_", "message_", "]_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Xl", "ib", "Window_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "recreate", "_", "(_", "self_", ",_", "changes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "flip", "ping", " ", "to", "/", "from", " ", "fullscreen", ",", " ", "need", " ", "to", " ", "recreate", " ", "the", " ", "window", ".", " ", " ", "(", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "case", " ", "with", " ", "bot", "h", " ", "override", "\\u", "redirec", "t", " ", "method", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "NET", "\\u", "WM", "\\u", "STATE", "\\u", "FULL", "SCREEN", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "possib", "le", " ", "improvement", " ", "coul", "d", " ", "be", " ", "to", " ", "just", " ", "hide", " ", "the", " ", "top", " ", "window", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "destroy", " ", "the", " ", "GLX", " ", "window", ",", " ", "and", " ", "resh", "ow", " ", "it", " ", "again", " ", "whe", "n", " ", "leaving", " ", "fullscreen", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "wou", "ld", " ", "prevent", " ", "the", " ", "float", "ing", " ", "window", " ", "from", " ", "bei", "ng", " ", "moved", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WM", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "'", "fullscreen", "'_", "in_", "changes_", "or_", "'", "resizable", "'_", "in_", "changes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "clear", " ", "out", " ", "the", " ", "GLX", " ", "context_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "._", "detach_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XD", "estr", "oy", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "display_", "._", "\\u", "window", "\\u", "map_", "[_", "self_", "._", "\\u", "window_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "display_", "._", "\\u", "window", "\\u", "map_", "[_", "self_", "._", "\\u", "view_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "window_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mapped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "detect", " ", "state", " ", "loss", " ", "only", " ", "by", " ", "exam", "inin", "g", " ", "context", " ", "share", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "context", "'_", "in_", "changes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lost", "\\u", "context_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "lost", "\\u", "context", "\\u", "state_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "create_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "create_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unma", "p", " ", "exist", "ing", " ", "window", " ", "if", " ", "necessar", "y", " ", "whi", "le", " ", "we", " ", "fid", "dle", " ", "with", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "window_", "and_", "self_", "._", "\\u", "mapped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "unma", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", "=_", "self_", "._", "display_", "._", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "screen", "\\u", "id_", "=_", "self_", "._", "display_", "._", "x", "\\u", "screen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "X", " ", "window", " ", "if", " ", "not", " ", "alr", "ead", "y", " ", "exist", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "xli", "b_", "._", "XR", "oot", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "x", "\\u", "screen", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "visu", "al", "\\u", "info_", "=_", "self_", "._", "config_", "._", "get", "\\u", "visu", "al", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "visual_", "=_", "visu", "al", "\\u", "info_", "._", "visual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "visu", "al", "\\u", "id_", "=_", "xli", "b_", "._", "XV", "isu", "al", "IDF", "rom", "Vis", "ual_", "(_", "visual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "visual_", "=_", "xli", "b_", "._", "XD", "efa", "ult", "Vis", "ual_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "x", "\\u", "screen", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "visu", "al", "\\u", "id_", "=_", "xli", "b_", "._", "XV", "isu", "al", "IDF", "rom", "Vis", "ual_", "(_", "default", "\\u", "visual_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "window", "\\u", "attributes_", "=_", "xli", "b_", "._", "XS", "et", "Window", "Attributes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "visu", "al", "\\u", "id_", "!=_", "default", "\\u", "visu", "al", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window", "\\u", "attributes_", "._", "colormap_", "=_", "xli", "b_", "._", "XC", "reate", "Color", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "root_", ",_", "visual_", ",_", "xli", "b_", "._", "Alloc", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "window", "\\u", "attributes_", "._", "colormap_", "=_", "xli", "b_", "._", "XD", "efa", "ult", "Color", "map_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "x", "\\u", "screen", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "window", "\\u", "attributes_", "._", "bit", "\\u", "gravity", "_", "=_", "xli", "b_", "._", "Static", "Grav", "ity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "287", ":", " ", "Comp", "iz", " ", "on", " ", "Intel", "/", "Mes", "a", " ", "doe", "sn", "'", "t", " ", "draw", " ", "window", " ", "decorat", "ion_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "unl", "ess", " ", "CW", "Back", "Pix", "el", " ", "is", " ", "give", "n", " ", "in", " ", "mask", ".", " ", " ", "Sho", "ul", "d", " ", "have_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "no", " ", "effect", " ", "on", " ", "other", " ", "system", "s", ",", " ", "so", " ", "it", "'", "s", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "uncon", "dition", "ally", "._", "\\u\\u\\uNL\\u\\u\\u_", "mask_", "=_", "xli", "b_", "._", "CW", "Color", "map_", "|_", "xli", "b_", "._", "CW", "Bit", "Grav", "ity_", "|_", "xli", "b_", "._", "CW", "Back", "Pixel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "fullscreen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", ",_", "height_", "=_", "self_", "._", "screen_", "._", "width_", ",_", "self_", "._", "screen_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "view", "\\u", "x_", "=_", "(_", "width_", "-_", "self_", "._", "\\u", "width_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "view", "\\u", "y_", "=_", "(_", "height_", "-_", "self_", "._", "\\u", "height_", ")_", "//_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", ",_", "height_", "=_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "view", "\\u", "x_", "=_", "self_", "._", "\\u", "view", "\\u", "y_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "window_", "=_", "xli", "b_", "._", "XC", "reate", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "root_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "width_", ",_", "height_", ",_", "0_", ",_", "visu", "al", "\\u", "info_", "._", "depth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Inp", "ut", "Output_", ",_", "visual_", ",_", "mask_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "window", "\\u", "attributes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "view_", "=_", "xli", "b_", "._", "XC", "reate", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "self_", "._", "\\u", "view", "\\u", "x_", ",_", "self_", "._", "\\u", "view", "\\u", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ",_", "0_", ",_", "visu", "al", "\\u", "info_", "._", "depth_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Inp", "ut", "Output_", ",_", "visual_", ",_", "mask_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "window", "\\u", "attributes_", ")_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XM", "ap", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XS", "elect", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "view_", ",_", "self_", "._", "\\u", "default", "\\u", "event", "\\u", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "display_", "._", "\\u", "window", "\\u", "map_", "[_", "self_", "._", "\\u", "window_", "]_", "=_", "self_", "._", "dispatch", "\\u", "platform", "\\u", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "display_", "._", "\\u", "window", "\\u", "map_", "[_", "self_", "._", "\\u", "view_", "]_", "=_", "self_", "._", "dispatch", "\\u", "platform", "\\u", "event", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "canvas_", "=_", "Xl", "ib", "Canvas_", "(_", "self_", "._", "display_", ",_", "self_", "._", "\\u", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "context_", "._", "attach_", "(_", "self_", "._", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "._", "set\\u", "vs", "ync_", "(_", "self_", "._", "\\u", "vs", "ync_", ")_", "#", " ", "XX", "X", " ", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sett", "ing", " ", "null", " ", "background", " ", "pixmap", " ", "disable", "s", " ", "drawing", " ", "the", " ", "background", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "prevent", "ing", " ", "fli", "cker", " ", "whi", "le", " ", "resiz", "ing", " ", "(", "in", " ", "theory", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Issue", " ", "287", ":", " ", "Comp", "iz", " ", "on", " ", "Intel", "/", "Mes", "a", " ", "doe", "sn", "'", "t", " ", "draw", " ", "window", " ", "decorat", "ion", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "is", " ", "call", "ed", ".", " ", " ", "As", " ", "it", " ", "doe", "sn", "'", "t", " ", "see", "m", " ", "to", " ", "have", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "effect", " ", "anyway", ",", " ", "it", "'", "s", " ", "just", " ", "commente", "d", " ", "out", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "xli", "b", ".", "XS", "et", "Window", "Back", "ground", "Pix", "map", "(", "self", ".\\u", "x", "\\u", "display", ",", " ", "self", ".\\u", "window", ",", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "enable", "\\u", "xs", "ync_", "=_", "(_", "pyglet_", "._", "options_", "[_", "'", "xs", "ync", "'_", "]_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "display_", "._", "\\u", "enable", "\\u", "xs", "ync_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "config_", "._", "double", "\\u", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "support", "ed", " ", "protocols_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocols_", "._", "append_", "(_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'", "WM", "\\u", "DELET", "E", "\\u", "WIND", "OW", "'_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "enable", "\\u", "xs", "ync_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "protocols_", "._", "append_", "(_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "SYNC", "\\u", "REQUEST", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "protocols_", "=_", "(_", "c\\u", "ulong_", "*_", "len_", "(_", "protocols_", ")_", ")_", "(_", "*_", "protocols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XS", "et", "WM", "Protocols", "_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", ",_", "len_", "(_", "protocols_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "window", " ", "resiz", "e", " ", "sync", " ", "counter_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "enable", "\\u", "xs", "ync_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "xs", "ync_", "._", "XS", "ync", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "sync", "\\u", "counter_", "=_", "xli", "b_", "._", "XI", "D_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "xs", "ync_", "._", "XS", "ync", "Creat", "e", "Counter_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "SYNC", "\\u", "REQUEST", "\\u", "COUNTER", "'_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ptr_", "=_", "pointer_", "(_", "self_", "._", "\\u", "sync", "\\u", "counter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "XC", "hange", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "atom_", ",_", "XA", "\\u", "CARD", "INAL", "_", ",_", "32_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Prop", "Mode", "Replace", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cast_", "(_", "ptr_", ",_", "POINTER_", "(_", "c\\u", "ubyte_", ")_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "window", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attributes_", "=_", "xli", "b_", "._", "XS", "et", "Window", "Attributes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attribute", "s", "\\u", "mask_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "override", "\\u", "redirect_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "fullscreen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pyglet_", "._", "options_", "[_", "'", "xli", "b", "\\u", "fullscreen", "\\u", "override", "\\u", "redirec", "t", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "y", " ", "not", " ", "to", " ", "use", " ", "this", " ", "any", " ", "more", ",", " ", "it", " ", "caus", "es", " ", "problem", "s", ";", " ", "disabled_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "default", " ", "in", " ", "fav", "our", " ", "of", " ", "\\u", "NET", "\\u", "WM", "\\u", "STATE", "\\u", "FULL", "SCREEN", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attributes_", "._", "override", "\\u", "redirect_", "=_", "self_", "._", "\\u", "fullscreen", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attribute", "s", "\\u", "mask_", "|=_", "xli", "b_", "._", "CW", "Override", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "override", "\\u", "redirect_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "set\\u", "wm", "\\u", "state_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "STATE", "\\u", "FULL", "SCREEN", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "fullscreen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XM", "ove", "Resize", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "screen_", "._", "x_", ",_", "self_", "._", "screen_", "._", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "screen_", "._", "width_", ",_", "self_", "._", "screen_", "._", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XR", "esi", "ze", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XC", "hange", "Window", "Attributes_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attribute", "s", "\\u", "mask_", ",_", "byref_", "(_", "attributes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "style_", "\\u\\u\\uNL\\u\\u\\u_", "styles_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "WIND", "OW", "\\u", "STYLE", "\\u", "DEFAULT_", ":_", "'\\u", "NET", "\\u", "WM", "\\u", "WIND", "OW", "\\u", "TYPE", "\\u", "NORMA", "L", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "WIND", "OW", "\\u", "STYLE", "\\u", "DIAL", "OG", "_", ":_", "'\\u", "NET", "\\u", "WM", "\\u", "WIND", "OW", "\\u", "TYPE", "\\u", "DIAL", "OG", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "WIND", "OW", "\\u", "STYLE", "\\u", "TOOL", "_", ":_", "'\\u", "NET", "\\u", "WM", "\\u", "WIND", "OW", "\\u", "TYPE", "\\u", "UTIL", "IT", "Y", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "style_", "in_", "styles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "set\\u", "atom", "s", "\\u", "property_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "WIND", "OW", "\\u", "TYPE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "styles_", "[_", "self_", "._", "\\u", "style_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "style_", "==_", "self_", "._", "WIND", "OW", "\\u", "STYLE", "\\u", "BORDER", "LESS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "MW", "M", "\\u", "HINT", "S", "\\u", "DECO", "RATION", "S_", "=_", "1_", "<<_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PROP", "\\u", "MW", "M", "\\u", "HINT", "S", "\\u", "ELEMENT", "S_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mw", "mh", "ints_", "=_", "mw", "mh", "ints", "\\u", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mw", "mh", "ints_", "._", "flags_", "=_", "MW", "M", "\\u", "HINT", "S", "\\u", "DECO", "RATION", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mw", "mh", "ints_", "._", "decorat", "ions_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "'\\u", "MOT", "IF", "\\u", "WM", "\\u", "HINT", "S", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XC", "hange", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "name_", ",_", "32_", ",_", "xli", "b_", "._", "Prop", "Mode", "Replace", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cast_", "(_", "pointer_", "(_", "mw", "mh", "ints_", ")_", ",_", "POINTER_", "(_", "c\\u", "ubyte_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PROP", "\\u", "MW", "M", "\\u", "HINT", "S", "\\u", "ELEMENT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "resiz", "eab", "le_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "resizable", "_", "and_", "not_", "self_", "._", "\\u", "fullscreen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "minim", "um", "\\u", "size_", "(_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "maxim", "um", "\\u", "size_", "(_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "caption_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "caption_", "(_", "self_", "._", "\\u", "caption_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "input", " ", "context", ".", " ", " ", "A", " ", "good", " ", "but", " ", "very", " ", "outdate", "d", " ", "reference", " ", "for", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "http", "://", "www", ".", "sb", "in", ".", "org", "/", "doc", "/", "Xl", "ib", "/", "chap", "t", "\\u", "11.", "html_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "have", "\\u", "utf8_", "and_", "not_", "self_", "._", "\\u", "x", "\\u", "ic_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "display_", "._", "\\u", "x", "\\u", "im_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XS", "et", "Local", "e", "Modifie", "rs_", "(_", "as", "bytes_", "(_", "'@", "im", "=", "none", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "display_", "._", "\\u", "x", "\\u", "im_", "=_", "xli", "b_", "._", "XO", "pen", "IM", "_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XF", "lus", "h_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "ed", " ", "to", " ", "set", " ", "arg", "types", " ", "on", " ", "this", " ", "function", " ", "bec", "aus", "e", " ", "it", "'", "s", " ", "vara", "rg", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "ctype", "s", " ", "guesses", " ", "wrong", "._", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "XC", "reate", "IC_", "._", "argtypes_", "=_", "[_", "xli", "b_", "._", "XI", "M_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "char", "\\u", "p_", ",_", "c\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "char", "\\u", "p_", ",_", "xli", "b_", "._", "Window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "char", "\\u", "p_", ",_", "xli", "b_", "._", "Window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "voi", "d\\u", "p_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "ic_", "=_", "xli", "b_", "._", "XC", "reate", "IC_", "(_", "self_", "._", "display_", "._", "\\u", "x", "\\u", "im_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'", "input", "Style", "'_", ")_", ",_", "xli", "b_", "._", "XI", "MP", "ree", "dit", "Not", "hing_", "|_", "xli", "b_", "._", "XI", "MS", "tat", "us", "Not", "hing_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'", "client", "Window", "'_", ")_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'", "foc", "us", "Window", "'_", ")_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "events_", "=_", "c\\u", "ulong_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XG", "et", "IC", "Values_", "(_", "self_", "._", "\\u", "x", "\\u", "ic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "filter", "Event", "s", "'_", ",_", "byref_", "(_", "filter", "\\u", "events_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "default", "\\u", "event", "\\u", "mask_", "|=_", "filter", "\\u", "events_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XS", "et", "IC", "Focus_", "(_", "self_", "._", "\\u", "x", "\\u", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "switch", "\\u", "to_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "visible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "visible_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "mouse", "\\u", "platform", "\\u", "visible_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "mapped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Map", " ", "the", " ", "window", ",", " ", "wait", " ", "for", " ", "map", " ", "event", " ", "bef", "ore", " ", "continui", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "elect", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "xli", "b_", "._", "Structur", "e", "Noti", "fy", "Mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XM", "ap", "Rai", "sed_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "xli", "b_", "._", "XE", "vent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XN", "ext", "Event_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "type_", "==_", "xli", "b_", "._", "Map", "Notify_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "elect", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "self_", "._", "\\u", "default", "\\u", "event", "\\u", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mapped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "override", "\\u", "redirect_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Poss", "ibl", "y", " ", "an", " ", "override", "\\u", "redirec", "t", " ", "issue", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "resiz", "e", "'_", ",_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "show", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "expos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "unma", "p_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "mapped_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "elect", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "xli", "b_", "._", "Structur", "e", "Noti", "fy", "Mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XU", "nmap", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "xli", "b_", "._", "XE", "vent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XN", "ext", "Event_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "type_", "==_", "xli", "b_", "._", "Unma", "p", "Notify_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "elect", "Input_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "self_", "._", "\\u", "default", "\\u", "event", "\\u", "mask_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mapped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "root_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attributes_", "=_", "xli", "b_", "._", "XW", "indo", "w", "Attributes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XG", "et", "Window", "Attributes_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "attributes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "attributes_", "._", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "context_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "unma", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XD", "estr", "oy", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del_", "self_", "._", "display_", "._", "\\u", "window", "\\u", "map_", "[_", "self_", "._", "\\u", "window_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "window_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\\u", "have", "\\u", "utf8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XD", "estr", "oy", "IC_", "(_", "self_", "._", "\\u", "x", "\\u", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "x", "\\u", "ic_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "Xl", "ib", "Window_", ",_", "self_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "switch", "\\u", "to_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "._", "set\\u", "current_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "flip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "draw", "\\u", "mouse", "\\u", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "canv", "as", ".", "flip", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "context_", "._", "flip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "sync", "\\u", "resize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "vs", "ync_", "(_", "self_", ",_", "vs", "ync_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "pyglet_", "._", "options_", "[_", "'", "vs", "ync", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vs", "ync_", "=_", "pyglet_", "._", "options_", "[_", "'", "vs", "ync", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "vs", "ync_", "=_", "vs", "ync_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "context_", "._", "set\\u", "vs", "ync_", "(_", "vs", "ync_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "caption_", "(_", "self_", ",_", "caption_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "caption_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caption_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "caption_", "=_", "caption_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "text", "\\u", "property_", "(_", "'", "WM", "\\u", "NAME", "'_", ",_", "caption_", ",_", "allow", "\\u", "utf8_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "text", "\\u", "property_", "(_", "'", "WM", "\\u", "ICON", "\\u", "NAME", "'_", ",_", "caption_", ",_", "allow", "\\u", "utf8_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "text", "\\u", "property_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "NAME", "'_", ",_", "caption_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "text", "\\u", "property_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "ICON", "\\u", "NAME", "'_", ",_", "caption_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "caption_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "caption_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "size_", "(_", "self_", ",_", "width_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "fullscreen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Window", "Exception_", "(_", "'", "Cann", "ot", " ", "set", " ", "size", " ", "of", " ", "fullscreen", " ", "window", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "width_", "=_", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "height_", "=_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "resizable", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "minim", "um", "\\u", "size_", "(_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "maxim", "um", "\\u", "size_", "(_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XR", "esi", "ze", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "view", "\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "resiz", "e", "'_", ",_", "width_", ",_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "view", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XR", "esi", "ze", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XG", "et", "Geometr", "y", " ", "and", " ", "XW", "indo", "w", "Attribute", "s", " ", "see", "m", " ", "to", " ", "alw", "ay", "s", " ", "return", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "original", " ", "size", " ", "of", " ", "the", " ", "window", ",", " ", "whi", "ch", " ", "is", " ", "wrong", " ", "after", " ", "the", " ", "user_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", " ", "resized", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "this", " ", "is", " ", "probab", "ly", " ", "fixed", " ", "now", ",", " ", "with", " ", "fix", " ", "of", " ", "resiz", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "location_", "(_", "self_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "the", " ", "window", " ", "manage", "r", " ", "has", " ", "repar", "ente", "d", " ", "our", " ", "top", "-", "level", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "onc", "e", ",", " ", "in", " ", "whi", "ch", " ", "case", " ", "attribute", "s", ".", "x", "/", "y", " ", "give", " ", "the", " ", "offset", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "frame", " ", "to", " ", "the", " ", "content", " ", "window", ".", " ", " ", "Bet", "ter", " ", "solut", "ion", " ", "wou", "ld", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "use", " ", "\\u", "NET", "\\u", "FRAME", "\\u", "EXT", "ENT", "S", ",", " ", "where", " ", "support", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attributes_", "=_", "xli", "b_", "._", "XW", "indo", "w", "Attributes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XG", "et", "Window", "Attributes_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "attributes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "at", " ", "leas", "t", " ", "under", " ", "KD", "E", "'", "s", " ", "WM", " ", "these", " ", "attr", "s", " ", "are", " ", "bot", "h", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "-=_", "attributes_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "-=_", "attributes_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XM", "ove", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "xli", "b_", "._", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "c\\u", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "c\\u", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XT", "rans", "late", "Coordinates_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "root_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "x_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "y_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "child_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "x_", "._", "value_", ",_", "y_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "activate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XS", "et", "Inp", "ut", "Focus_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Rever", "t", "To", "Parent_", ",_", "xli", "b_", "._", "Curr", "ent", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "visible_", "(_", "self_", ",_", "visible_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "visible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "unma", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "visible_", "=_", "visible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "minim", "um", "\\u", "size_", "(_", "self_", ",_", "width_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "minim", "um", "\\u", "size_", "=_", "width_", ",_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "wm", "\\u", "normal", "\\u", "hints_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "maxim", "um", "\\u", "size_", "(_", "self_", ",_", "width_", ",_", "height_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "maxim", "um", "\\u", "size_", "=_", "width_", ",_", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "set\\u", "wm", "\\u", "normal", "\\u", "hints_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "minimize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XI", "con", "if", "y", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "self_", "._", "\\u", "x", "\\u", "screen", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "maximize", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "set\\u", "wm", "\\u", "state_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "STATE", "\\u", "MAXI", "MI", "ZED", "\\u", "HOR", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\u", "NET", "\\u", "WM", "\\u", "STATE", "\\u", "MAXI", "MI", "ZED", "\\u", "VERT", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "mouse", "\\u", "platform", "\\u", "visible_", "(_", "self_", ",_", "platform", "\\u", "visible_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "platform", "\\u", "visible_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "platform", "\\u", "visible_", "=_", "self_", "._", "\\u", "mouse", "\\u", "visible_", "and_", "not_", "self_", "._", "\\u", "mouse", "\\u", "cursor_", "._", "drawa", "ble_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "platform", "\\u", "visible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hi", "de", " ", "point", "er", " ", "by", " ", "creati", "ng", " ", "an", " ", "empty", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "black_", "=_", "xli", "b_", "._", "XB", "lack", "Pixel_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "x", "\\u", "screen", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "black_", "=_", "xli", "b_", "._", "XC", "olor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bmp_", "=_", "xli", "b_", "._", "XC", "reate", "Bit", "map", "Fro", "m", "Data_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c\\u", "buffer_", "(_", "8_", ")_", ",_", "8_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cursor_", "=_", "xli", "b_", "._", "XC", "reate", "Pix", "map", "Cursor_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "bmp_", ",_", "bmp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "black_", ",_", "black_", ",_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XD", "efin", "e", "Cursor_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XF", "ree", "Cursor_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XF", "ree", "Pixmap_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "bmp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Restor", "e", " ", "cursor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", "._", "\\u", "mouse", "\\u", "cursor_", ",_", "Xl", "ib", "Mouse", "Cursor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XD", "efin", "e", "Cursor_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "cursor_", "._", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XU", "ndef", "ine", "Cursor_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "mouse", "\\u", "position_", "(_", "self_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XW", "arp", "Pointer_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "#", " ", "src", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "#", " ", "dst", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "#", " ", "src", " ", "x", ",", " ", "y_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "#", " ", "src", " ", "w", ",", " ", "h_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "self_", "._", "\\u", "height_", "-_", "y_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mouse", "\\u", "exclusive_", "=_", "self_", "._", "\\u", "active_", "and_", "self_", "._", "\\u", "mouse", "\\u", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyb", "oard", "\\u", "exclusive_", "=_", "self_", "._", "\\u", "active_", "and_", "self_", "._", "\\u", "keyb", "oard", "\\u", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mouse", "\\u", "exclusive_", "!=_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mouse", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "mouse", "\\u", "platform", "\\u", "visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restrict", " ", "to", " ", "client", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "XG", "rab", "Pointer_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Grab", "Mode", "Async", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Grab", "Mode", "Async", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Curr", "ent", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", " ", "point", "er", " ", "to", " ", "center", " ", "of", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "self_", "._", "\\u", "width_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "\\u", "height_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "exclu", "sive", "\\u", "client_", "=_", "x_", ",_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "mouse", "\\u", "position_", "(_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u", "fullscreen", "_", "and_", "not_", "self_", "._", "screen_", "._", "\\u", "xin", "era", "ma_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Restrict", " ", "to", " ", "fullscreen", " ", "area", " ", "(", "prevent", " ", "viewport", " ", "scrolling", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "mouse", "\\u", "position_", "(_", "0_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "xli", "b_", "._", "XG", "rab", "Pointer_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "True_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Grab", "Mode", "Async", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Grab", "Mode", "Async", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Curr", "ent", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fail", "ed", " ", "to", " ", "gra", "b", ",", " ", "try", " ", "again", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "mouse", "\\u", "platform", "\\u", "visible_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unc", "lip", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XU", "ngr", "ab", "Pointer_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "xli", "b_", "._", "Curr", "ent", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "mouse", "\\u", "platform", "\\u", "visible_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", "=_", "mouse", "\\u", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "keyb", "oard", "\\u", "exclusive_", "!=_", "self_", "._", "\\u", "applied", "\\u", "keyb", "oard", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyb", "oard", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XG", "rab", "Keyboard_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Grab", "Mode", "Async", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Grab", "Mode", "Async", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Curr", "ent", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XU", "ngr", "ab", "Keyboard_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "xli", "b_", "._", "Curr", "ent", "Time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "applied", "\\u", "keyb", "oard", "\\u", "exclusive_", "=_", "keyb", "oard", "\\u", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "exclu", "sive", "\\u", "mouse_", "(_", "self_", ",_", "exclusive_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exclusive_", "==_", "self_", "._", "\\u", "mouse", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "exclusive_", "=_", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "exclu", "sive", "\\u", "keyboard_", "(_", "self_", ",_", "exclusive_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "exclusive_", "==_", "self_", "._", "\\u", "keyb", "oard", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "keyb", "oard", "\\u", "exclusive_", "=_", "exclusive_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "system", "\\u", "mouse", "\\u", "cursor_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "==_", "self_", "._", "CURSOR", "\\u", "DEFAULT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Default", "Mouse", "Cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NQ", "R", " ", "means", " ", "default", " ", "shape", " ", "is", " ", "not", " ", "pretty", "...", " ", "sure", "ly", " ", "there", " ", "is", " ", "anot", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cursor", " ", "font", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor", "\\u", "shapes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "CROSS", "HA", "IR_", ":_", "cursor", "font_", "._", "XC", "\\u", "cross", "hair", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "HAND", "_", ":_", "cursor", "font_", "._", "XC", "\\u", "hand", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "HELP_", ":_", "cursor", "font_", "._", "XC", "\\u", "question", "\\u", "arrow_", ",_", "#", " ", "NQ", "R_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "NO_", ":_", "cursor", "font_", "._", "XC", "\\u", "pirat", "e_", ",_", "#", " ", "NQ", "R_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE_", ":_", "cursor", "font_", "._", "XC", "\\u", "fle", "ur_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "UP_", ":_", "cursor", "font_", "._", "XC", "\\u", "top", "\\u", "side_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "UP", "\\u", "RIGHT_", ":_", "cursor", "font_", "._", "XC", "\\u", "top", "\\u", "right", "\\u", "corner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "RIGHT_", ":_", "cursor", "font_", "._", "XC", "\\u", "right", "\\u", "side_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "DOWN", "\\u", "RIGHT_", ":_", "cursor", "font_", "._", "XC", "\\u", "bottom", "\\u", "right", "\\u", "corner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "DOWN_", ":_", "cursor", "font_", "._", "XC", "\\u", "bottom", "\\u", "side_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "DOWN", "\\u", "LEFT_", ":_", "cursor", "font_", "._", "XC", "\\u", "bottom", "\\u", "left", "\\u", "corner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "LEFT_", ":_", "cursor", "font_", "._", "XC", "\\u", "left", "\\u", "side_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "UP", "\\u", "LEFT_", ":_", "cursor", "font_", "._", "XC", "\\u", "top", "\\u", "left", "\\u", "corner_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "UP", "\\u", "DOWN_", ":_", "cursor", "font_", "._", "XC", "\\u", "sb", "\\u", "v", "\\u", "double", "\\u", "arrow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "SIZE", "\\u", "LEF", "T", "\\u", "RIGHT_", ":_", "cursor", "font_", "._", "XC", "\\u", "sb", "\\u", "h", "\\u", "double", "\\u", "arrow_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "TEXT_", ":_", "cursor", "font_", "._", "XC", "\\u", "xter", "m_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "WAIT", "_", ":_", "cursor", "font_", "._", "XC", "\\u", "watch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "CURSOR", "\\u", "WAIT", "\\u", "ARROW", "_", ":_", "cursor", "font_", "._", "XC", "\\u", "watch_", ",_", "#", " ", "NQ", "R_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "not_", "in_", "cursor", "\\u", "shapes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Mouse", "Curs", "or", "Exception_", "(_", "'", "Un", "know", "n", " ", "cursor", " ", "name", " ", "\"%", "s", "\"'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor_", "=_", "xli", "b_", "._", "XC", "reate", "Font", "Cursor_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "cursor", "\\u", "shapes_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Xl", "ib", "Mouse", "Cursor_", "(_", "cursor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "icon_", "(_", "self_", ",_", "*_", "images_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Care", "ful", "!", " ", " ", "XC", "hange", "Proper", "ty", " ", "take", "s", " ", "an", " ", "array", " ", "of", " ", "long", " ", "whe", "n", " ", "data", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "32", "-", "bit", " ", "(", "but", " ", "long", " ", "can", " ", "be", " ", "64", " ", "bit", "!)", ",", " ", "so", " ", "pad", " ", "high", " ", "bytes", " ", "of", " ", "format", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "necessar", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "litt", "le", "'_", ",_", "4_", ")_", ":_", "'", "BG", "RA", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "litt", "le", "'_", ",_", "8_", ")_", ":_", "'", "BG", "RA", "AAAA", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "big", "'_", ",_", "4_", ")_", ":_", "'", "ARG", "B", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "big", "'_", ",_", "8_", ")_", ":_", "'", "AAAAA", "RGB", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[_", "(_", "sys_", "._", "byteorder_", ",_", "sizeof_", "(_", "c\\u", "ulong_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "image_", "in_", "images_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "image_", "._", "get", "\\u", "image", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pitch_", "=_", "-_", "(_", "image_", "._", "width_", "*_", "len_", "(_", "format_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "c\\u", "buffer_", "(_", "sizeof_", "(_", "c\\u", "ulong_", ")_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem", "move_", "(_", "s_", ",_", "cast_", "(_", "(_", "c\\u", "ulong_", "*_", "2_", ")_", "(_", "image_", "._", "width_", ",_", "image_", "._", "height_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "POINTER_", "(_", "c\\u", "ubyte_", ")_", ")_", ",_", "len_", "(_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "+=_", "s_", "._", "raw_", "+_", "image_", "._", "get", "\\u", "data_", "(_", "format_", ",_", "pitch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buffer_", "=_", "(_", "c\\u", "ubyte_", "*_", "len_", "(_", "data_", ")_", ")_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mem", "move_", "(_", "buffer_", ",_", "data_", ",_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atom_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "'\\u", "NET", "\\u", "WM", "\\u", "ICON", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XC", "hange", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "atom_", ",_", "XA", "\\u", "CARD", "INAL", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "32_", ",_", "xli", "b_", "._", "Prop", "Mode", "Replace", "_", ",_", "buffer_", ",_", "len_", "(_", "data_", ")_", "/_", "sizeof_", "(_", "c\\u", "ulong_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "wm", "\\u", "normal", "\\u", "hints_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hints_", "=_", "xli", "b_", "._", "XA", "lloc", "Size", "Hint", "s_", "(_", ")_", "._", "contents_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "minim", "um", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hints_", "._", "flags_", "|=_", "xli", "b_", "._", "PM", "in", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hints_", "._", "min", "\\u", "width_", ",_", "hints_", "._", "min", "\\u", "height_", "=_", "self_", "._", "\\u", "minim", "um", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "maxim", "um", "\\u", "size_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hints_", "._", "flags_", "|=_", "xli", "b_", "._", "PM", "ax", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hints_", "._", "max", "\\u", "width_", ",_", "hints_", "._", "max", "\\u", "height_", "=_", "self_", "._", "\\u", "maxim", "um", "\\u", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "et", "WM", "Normal", "Hint", "s_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "byref_", "(_", "hints_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "text", "\\u", "property_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "allow", "\\u", "utf8_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atom_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "as", "bytes_", "(_", "name_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "atom_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Xl", "ib", "Exception_", "(_", "'", "Unde", "fined", " ", "atom", " ", "\"%", "s", "\"'_", "%_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "type_", "(_", "value_", ")_", "in_", "(_", "str_", ",_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "property_", "=_", "xli", "b_", "._", "XT", "ext", "Property_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "have", "\\u", "utf8_", "and_", "allow", "\\u", "utf8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "create", "\\u", "string", "\\u", "buffer_", "(_", "value_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "xli", "b_", "._", "Xu", "tf", "8", "Text", "List", "To", "Text", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cast_", "(_", "pointer_", "(_", "buf_", ")_", ",_", "c\\u", "char", "\\u", "p_", ")_", ",_", "1_", ",_", "xli", "b_", "._", "XU", "TF", "8", "String", "Style_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "property_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Xl", "ib", "Exception_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "UT", "F8", " ", "text", " ", "property", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "create", "\\u", "string", "\\u", "buffer_", "(_", "value_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "ignore", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "xli", "b_", "._", "XS", "tring", "List", "To", "Text", "Property_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cast_", "(_", "pointer_", "(_", "buf_", ")_", ",_", "c\\u", "char", "\\u", "p_", ")_", ",_", "1_", ",_", "byref_", "(_", "property_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Xl", "ib", "Exception_", "(_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "text", " ", "property", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "et", "Text", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "byref_", "(_", "property_", ")_", ",_", "atom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "XX", "X", " ", "<", "rj", ">", " ", "Xl", "ib", " ", "doe", "sn", "'", "t", " ", "like", " ", "us", " ", "free", "ing", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", "xli", "b", ".", "XF", "ree", "(", "property", ".", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "atom", "s", "\\u", "property_", "(_", "self_", ",_", "name_", ",_", "values_", ",_", "mode_", "=_", "xli", "b_", "._", "Prop", "Mode", "Replace", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name", "\\u", "atom_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "as", "bytes_", "(_", "name_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atoms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", "in_", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atoms_", "._", "append_", "(_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "as", "bytes_", "(_", "value_", ")_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "atom", "\\u", "type_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "as", "bytes_", "(_", "'", "ATOM", "'_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "atoms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atom", "s", "\\u", "ar_", "=_", "(_", "xli", "b_", "._", "Atom_", "*_", "len_", "(_", "atoms_", ")_", ")_", "(_", "*_", "atoms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XC", "hange", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name", "\\u", "atom_", ",_", "atom", "\\u", "type_", ",_", "32_", ",_", "mode_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cast_", "(_", "pointer_", "(_", "atom", "s", "\\u", "ar_", ")_", ",_", "POINTER_", "(_", "c\\u", "ubyte_", ")_", ")_", ",_", "len_", "(_", "atoms_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XD", "ele", "te", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "net", "\\u", "wm", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "wm", "\\u", "state_", "(_", "self_", ",_", "*_", "states_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "property_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "net", "\\u", "wm", "\\u", "state_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "'\\u", "NET", "\\u", "WM", "\\u", "STATE", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "atoms_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "state_", "in_", "states_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atoms_", "._", "append_", "(_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "state_", ",_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "atom", "\\u", "type_", "=_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "'", "ATOM", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "atoms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atom", "s", "\\u", "ar_", "=_", "(_", "xli", "b_", "._", "Atom_", "*_", "len_", "(_", "atoms_", ")_", ")_", "(_", "*_", "atoms_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XC", "hange", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "net", "\\u", "wm", "\\u", "state_", ",_", "atom", "\\u", "type_", ",_", "32_", ",_", "xli", "b_", "._", "Prop", "Mode", "Prep", "end_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cast_", "(_", "pointer_", "(_", "atom", "s", "\\u", "ar_", ")_", ",_", "POINTER_", "(_", "c\\u", "ubyte_", ")_", ")_", ",_", "len_", "(_", "atoms_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XD", "ele", "te", "Property_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "window_", ",_", "net", "\\u", "wm", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nu", "dge", " ", "the", " ", "WM", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "e_", "=_", "xli", "b_", "._", "XE", "vent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xc", "lient_", "._", "type_", "=_", "xli", "b_", "._", "Client", "Message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xc", "lient_", "._", "message", "\\u", "type_", "=_", "net", "\\u", "wm", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xc", "lient_", "._", "display_", "=_", "cast_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "POINTER_", "(_", "xli", "b_", "._", "Display_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xc", "lient_", "._", "window_", "=_", "self_", "._", "\\u", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xc", "lient_", "._", "format_", "=_", "32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "xc", "lient_", "._", "data_", "._", "l_", "[_", "0_", "]_", "=_", "xli", "b_", "._", "Prop", "Mode", "Prep", "end_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "atom_", "in_", "enumerate_", "(_", "atoms_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "._", "xc", "lient_", "._", "data_", "._", "l_", "[_", "i_", "+_", "1_", "]_", "=_", "atom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xli", "b_", "._", "XS", "end", "Event_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "self_", "._", "\\u", "get", "\\u", "root_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "False_", ",_", "xli", "b_", "._", "Substr", "ucture", "Redirect", "Mask_", ",_", "byref_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "events_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "pend", "ing", "\\u", "events_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "allow", "\\u", "dispatch", "\\u", "event_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "e_", "=_", "xli", "b_", "._", "XE", "vent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cache", " ", "these", " ", "in", " ", "case", " ", "window", " ", "is", " ", "close", "d", " ", "from", " ", "an", " ", "event", " ", "handler_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "x", "\\u", "display_", "=_", "self_", "._", "\\u", "x", "\\u", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "window_", "=_", "self_", "._", "\\u", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "view_", "=_", "self_", "._", "\\u", "view_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "the", " ", "events", " ", "specific", " ", "to", " ", "this", " ", "window_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "xli", "b_", "._", "XC", "heck", "Window", "Event_", "(_", "\\u", "x", "\\u", "display_", ",_", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0x1f", "fffff", "_", ",_", "byref_", "(_", "e_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Key", " ", "events", " ", "are", " ", "filter", "ed", " ", "by", " ", "the", " ", "xli", "b", " ", "window", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handler", " ", "so", " ", "the", "y", " ", "get", " ", "a", " ", "sho", "t", " ", "at", " ", "the", " ", "prefi", "lter", "ed", " ", "event", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "xa", "ny_", "._", "type_", "not_", "in_", "(_", "xli", "b_", "._", "Key", "Press_", ",_", "xli", "b_", "._", "Key", "Release_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xli", "b_", "._", "XF", "ilter", "Event_", "(_", "e_", ",_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "platform", "\\u", "event_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "for", " ", "the", " ", "events", " ", "specific", " ", "to", " ", "this", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "xli", "b_", "._", "XC", "heck", "Window", "Event_", "(_", "\\u", "x", "\\u", "display_", ",_", "\\u", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0x1f", "fffff", "_", ",_", "byref_", "(_", "e_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Key", " ", "events", " ", "are", " ", "filter", "ed", " ", "by", " ", "the", " ", "xli", "b", " ", "window", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "handler", " ", "so", " ", "the", "y", " ", "get", " ", "a", " ", "sho", "t", " ", "at", " ", "the", " ", "prefi", "lter", "ed", " ", "event", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "xa", "ny_", "._", "type_", "not_", "in_", "(_", "xli", "b_", "._", "Key", "Press_", ",_", "xli", "b_", "._", "Key", "Release_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xli", "b_", "._", "XF", "ilter", "Event_", "(_", "e_", ",_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "platform", "\\u", "event", "\\u", "view_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Gene", "ric", " ", "events", " ", "for", " ", "this", " ", "window", " ", "(", "the", " ", "window", " ", "close", " ", "event", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "xli", "b_", "._", "XC", "heck", "Type", "d", "Window", "Event_", "(_", "\\u", "x", "\\u", "display_", ",_", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xli", "b_", "._", "Client", "Message_", ",_", "byref_", "(_", "e_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "platform", "\\u", "event_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "need", "s", "\\u", "resize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "resiz", "e", "'_", ",_", "self_", "._", "\\u", "width_", ",_", "self_", "._", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "expos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "need", "s", "\\u", "resize_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "allow", "\\u", "dispatch", "\\u", "event_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "pend", "ing", "\\u", "events_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "self_", "._", "\\u", "event", "\\u", "queue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Event", "Dispatcher_", "._", "dispatch", "\\u", "event_", "(_", "self_", ",_", "*_", "self_", "._", "\\u", "event", "\\u", "queue_", "._", "pop_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dispa", "tch", " ", "any", " ", "context", "-", "relate", "d", " ", "events_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "lost", "\\u", "context_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lost", "\\u", "context_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Event", "Dispatcher_", "._", "dispatch", "\\u", "event_", "(_", "self_", ",_", "'", "on", "\\u", "context", "\\u", "lost", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "lost", "\\u", "context", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "lost", "\\u", "context", "\\u", "state_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Event", "Dispatcher_", "._", "dispatch", "\\u", "event_", "(_", "self_", ",_", "'", "on", "\\u", "context", "\\u", "state", "\\u", "lost", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "platform", "\\u", "event_", "(_", "self_", ",_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "handler_", "=_", "self_", "._", "\\u", "event", "\\u", "handlers_", "._", "get_", "(_", "e_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "handler_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dispatch", "\\u", "platform", "\\u", "event", "\\u", "view_", "(_", "self_", ",_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "handler_", "=_", "self_", "._", "\\u", "view", "\\u", "event", "\\u", "handlers_", "._", "get_", "(_", "e_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event", "\\u", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "event", "\\u", "handler_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "translat", "e\\u", "modifiers_", "(_", "state_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Shi", "ft", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "SHIFT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Control", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "CTR", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Lock", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "CAPS", "LOCK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Mod", "1", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "ALT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Mod", "2", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "NUM", "LOCK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Mod", "4", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "WINDOWS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "&_", "xli", "b_", "._", "Mod", "5", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "|=_", "key_", "._", "MOD", "\\u", "SCROLL", "LOCK_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "modifiers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "event", "\\u", "text", "\\u", "symbol_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "symbol_", "=_", "xli", "b_", "._", "Key", "Sym", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buffer_", "=_", "create", "\\u", "string", "\\u", "buffer_", "(_", "128_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Look", " ", "up", " ", "raw", " ", "keysym", " ", "bef", "ore", " ", "XI", "M", " ", "filter", "s", " ", "it", " ", "(", "default", " ", "for", " ", "keypress", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "key", "release", ")_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "xli", "b_", "._", "XL", "ook", "up", "String_", "(_", "ev_", "._", "xk", "ey_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", ",_", "len_", "(_", "buffer_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "symbol_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Give", " ", "XI", "M", " ", "a", " ", "shot_", "\\u\\u\\uNL\\u\\u\\u_", "filtered_", "=_", "xli", "b_", "._", "XF", "ilter", "Event_", "(_", "ev_", ",_", "ev_", "._", "xa", "ny_", "._", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ev_", "._", "type_", "==_", "xli", "b_", "._", "Key", "Press_", "and_", "not_", "filtered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "c\\u", "int_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "have", "\\u", "utf8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "'", "utf", "8", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "xli", "b_", "._", "Xu", "tf", "8", "Look", "up", "String_", "(_", "self_", "._", "\\u", "x", "\\u", "ic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ev_", "._", "xk", "ey_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", ",_", "len_", "(_", "buffer_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "symbol_", ")_", ",_", "byref_", "(_", "status_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "._", "value_", "==_", "xli", "b_", "._", "XB", "uffe", "r", "Over", "flow_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "TOD", "O", ":", " ", "XI", "M", " ", "buffer", " ", "resiz", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "encoding_", "=_", "'", "ascii", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count_", "=_", "xli", "b_", "._", "XL", "ook", "up", "String_", "(_", "ev_", "._", "xk", "ey_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "buffer_", ",_", "len_", "(_", "buffer_", ")_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "symbol_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "status_", "._", "value_", "=_", "xli", "b_", "._", "XL", "ook", "up", "Bot", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status_", "._", "value_", "&_", "(_", "xli", "b_", "._", "XL", "ook", "up", "Chars_", "|_", "xli", "b_", "._", "XL", "ook", "up", "Bot", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "buffer_", "._", "value_", "[_", ":_", "count_", "]_", "._", "decode_", "(_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "treat", " ", "Unic", "ode", " ", "command", " ", "codepoint", "s", " ", "as", " ", "text", ",", " ", "except", " ", "Return", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "text_", "and_", "unicodedata_", "._", "category_", "(_", "text_", ")_", "==_", "'", "Cc", "'_", "and_", "text_", "!=_", "'\\\\", "r", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "symbol_", "=_", "symbol_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "event", " ", "is", " ", "a", " ", "XI", "M", " ", "filter", "ed", " ", "event", ",", " ", "the", " ", "keysym", " ", "will", " ", "be", " ", "virtual_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "e", ".", "g", ".,", " ", "aac", "ute", " ", "inst", "ead", " ", "of", " ", "A", " ", "after", " ", "a", " ", "dead", " ", "key", ").", " ", " ", "Drop", " ", "it", ",", " ", "we", " ", "don", "'", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "want", " ", "these", " ", "kind", " ", "of", " ", "key", " ", "events", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ev_", "._", "xk", "ey_", "._", "keycode_", "==_", "0_", "and_", "not_", "filtered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbol_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyg", "let", ".", "self", ".", "key", " ", "keysym", "bol", "s", " ", "are", " ", "identi", "cal", " ", "to", " ", "X1", "1", " ", "keysym", "bol", "s", ",", " ", "no_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "map", " ", "the", " ", "keysym", "bol", ".", " ", " ", "For", " ", "keysym", "s", " ", "outsi", "de", " ", "the", " ", "pyg", "let", " ", "set", ",", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "raw", " ", "key", " ", "code", " ", "to", " ", "a", " ", "user", " ", "key", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "symbol_", "and_", "symbol_", "not_", "in_", "key_", "._", "\\u", "key", "\\u", "names_", "and_", "ev_", "._", "xk", "ey_", "._", "keycode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Issue", " ", "353", ":", " ", "Sym", "bol", " ", "is", " ", "upper", "case", " ", "whe", "n", " ", "shift", " ", "key", " ", "hel", "d", " ", "down", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbol_", "=_", "ord_", "(_", "unichr_", "(_", "symbol_", ")_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "still", " ", "not", " ", "recog", "nis", "ed", ",", " ", "use", " ", "the", " ", "keycode_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "symbol_", "not_", "in_", "key_", "._", "\\u", "key", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "symbol_", "=_", "key_", "._", "user", "\\u", "key_", "(_", "ev_", "._", "xk", "ey_", "._", "keycode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filtered_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "event", " ", "was", " ", "filter", "ed", ",", " ", "text", " ", "must", " ", "be", " ", "ignore", "d", ",", " ", "but", " ", "the", " ", "symbol", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "still", " ", "good", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", ",_", "symbol_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "event", "\\u", "text", "\\u", "motion_", "(_", "self_", ",_", "symbol_", ",_", "modifiers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "modifiers_", "&_", "key_", "._", "MOD", "\\u", "ALT", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctrl_", "=_", "modifiers_", "&_", "key_", "._", "MOD", "\\u", "CTR", "L_", "!=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "moti", "on", "\\u", "map_", "._", "get_", "(_", "(_", "symbol_", ",_", "ctrl_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Key", "Press_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Key", "Release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "key", "\\u", "view_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ev_", "._", "type_", "==_", "xli", "b_", "._", "Key", "Release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Look", " ", "in", " ", "the", " ", "queue", " ", "for", " ", "a", " ", "matchi", "ng", " ", "Key", "Press", " ", "with", " ", "same", " ", "timestamp", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "indicati", "ng", " ", "an", " ", "auto", "-", "repeat", " ", "rat", "her", " ", "than", " ", "actual", " ", "key", " ", "event", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auto", "\\u", "event_", "=_", "xli", "b_", "._", "XE", "vent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "xli", "b_", "._", "XC", "heck", "Window", "Event_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "xli", "b_", "._", "Key", "Press_", "|_", "xli", "b_", "._", "Key", "Release_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "byref_", "(_", "auto", "\\u", "event_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved_", "._", "append_", "(_", "auto", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "auto", "\\u", "event_", "._", "type_", "==_", "xli", "b_", "._", "Key", "Release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "just", " ", "save", " ", "this", " ", "off", " ", "for", " ", "resto", "ration", " ", "back", " ", "to", " ", "the", " ", "queue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ev_", "._", "xk", "ey_", "._", "keycode_", "==_", "auto", "\\u", "event_", "._", "xk", "ey_", "._", "keycode_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Foun", "d", " ", "a", " ", "key", " ", "repeat", ":", " ", "dispatch", " ", "EVENT", "\\u", "TEXT", "*", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", ",_", "symbol_", "=_", "self_", "._", "\\u", "event", "\\u", "text", "\\u", "symbol_", "(_", "auto", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifiers_", "=_", "self_", "._", "\\u", "translat", "e\\u", "modifiers_", "(_", "ev_", "._", "xk", "ey_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifiers", "\\u", "ctrl_", "=_", "modifiers_", "&_", "(_", "key_", "._", "MOD", "\\u", "CTR", "L_", "|_", "key_", "._", "MOD", "\\u", "ALT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "motion_", "=_", "self_", "._", "\\u", "event", "\\u", "text", "\\u", "motion_", "(_", "symbol_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "motion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "modifiers_", "&_", "key_", "._", "MOD", "\\u", "SHIFT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "on", "\\u", "text", "\\u", "moti", "on", "\\u", "select", "'_", ",_", "motion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "text", "\\u", "moti", "on", "'_", ",_", "motion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "text_", "and_", "not_", "modifiers", "\\u", "ctrl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "text", "'_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dit", "ched", "_", "=_", "saved_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "auto", "\\u", "event_", "in_", "reversed_", "(_", "saved_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "xli", "b_", "._", "XP", "ut", "Back", "Event_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "byref_", "(_", "auto", "\\u", "event_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Key", " ", "code", " ", "of", " ", "press", " ", "did", " ", "not", " ", "match", ",", " ", "there", "fore", " ", "no", " ", "repeatin", "g_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "goi", "ng", " ", "on", ",", " ", "stop", " ", "search", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Who", "ops", ",", " ", "put", " ", "the", " ", "events", " ", "back", ",", " ", "it", "'", "s", " ", "for", " ", "real", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "auto", "\\u", "event_", "in_", "reversed_", "(_", "saved_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xli", "b_", "._", "XP", "ut", "Back", "Event_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "byref_", "(_", "auto", "\\u", "event_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", ",_", "symbol_", "=_", "self_", "._", "\\u", "event", "\\u", "text", "\\u", "symbol_", "(_", "ev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifiers_", "=_", "self_", "._", "\\u", "translat", "e\\u", "modifiers_", "(_", "ev_", "._", "xk", "ey_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifiers", "\\u", "ctrl_", "=_", "modifiers_", "&_", "(_", "key_", "._", "MOD", "\\u", "CTR", "L_", "|_", "key_", "._", "MOD", "\\u", "ALT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "motion_", "=_", "self_", "._", "\\u", "event", "\\u", "text", "\\u", "motion_", "(_", "symbol_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "ev_", "._", "type_", "==_", "xli", "b_", "._", "Key", "Press_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "symbol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "key", "\\u", "press", "'_", ",_", "symbol_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "motion_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "modifiers_", "&_", "key_", "._", "MOD", "\\u", "SHIFT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "text", "\\u", "moti", "on", "\\u", "select", "'_", ",_", "motion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "text", "\\u", "moti", "on", "'_", ",_", "motion_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "text_", "and_", "not_", "modifiers", "\\u", "ctrl_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "text", "'_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ev_", "._", "type_", "==_", "xli", "b_", "._", "Key", "Release_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "symbol_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "key", "\\u", "release", "'_", ",_", "symbol_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Key", "Press_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Key", "Release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "key_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "event", "\\u", "key", "\\u", "view_", "(_", "ev_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Motion", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "moti", "onn", "oti", "fy", "\\u", "view_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "ev_", "._", "xm", "oti", "on_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "height_", "-_", "ev_", "._", "xm", "oti", "on_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "mouse", "\\u", "in", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "x_", "-_", "self_", "._", "\\u", "mouse", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "y_", "-_", "self_", "._", "\\u", "mouse", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "dy_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", "and_", "(_", "ev_", "._", "xm", "oti", "on_", "._", "x_", ",_", "ev_", "._", "xm", "oti", "on_", "._", "y_", ")_", "==_", "self_", "._", "\\u", "mouse", "\\u", "exclu", "sive", "\\u", "client_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "events", " ", "caus", "ed", " ", "by", " ", "XW", "arp", "Pointer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "\\u", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "applied", "\\u", "mouse", "\\u", "exclusive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reset", " ", "point", "er", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", ",_", "ey_", "=_", "self_", "._", "\\u", "mouse", "\\u", "exclu", "sive", "\\u", "client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XW", "arp", "Pointer_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "window_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "0_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ex_", ",_", "ey_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "in", "\\u", "window_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buttons_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ev_", "._", "xm", "oti", "on_", "._", "state_", "&_", "xli", "b_", "._", "Butt", "on1", "Motion", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "|=_", "mouse_", "._", "LEFT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ev_", "._", "xm", "oti", "on_", "._", "state_", "&_", "xli", "b_", "._", "Butt", "on2", "Motion", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "|=_", "mouse_", "._", "MIDDLE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ev_", "._", "xm", "oti", "on_", "._", "state_", "&_", "xli", "b_", "._", "Butt", "on", "3", "Motion", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "|=_", "mouse_", "._", "RIGHT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "buttons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Drag", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modifiers_", "=_", "self_", "._", "\\u", "translat", "e\\u", "modifiers_", "(_", "ev_", "._", "xm", "oti", "on_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "drag", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", ",_", "dx_", ",_", "dy_", ",_", "buttons_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Motion", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "moti", "on", "'_", ",_", "x_", ",_", "y_", ",_", "dx_", ",_", "dy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Motion", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "moti", "onn", "oti", "fy_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Window", " ", "moti", "on", " ", "look", "s", " ", "for", " ", "drag", "s", " ", "tha", "t", " ", "are", " ", "outsi", "de", " ", "the", " ", "view", " ", "but", " ", "within", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "window", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ev_", "._", "xm", "oti", "on_", "._", "state_", "&_", "xli", "b_", "._", "Butt", "on1", "Motion", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "|=_", "mouse_", "._", "LEFT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ev_", "._", "xm", "oti", "on_", "._", "state_", "&_", "xli", "b_", "._", "Butt", "on2", "Motion", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "|=_", "mouse_", "._", "MIDDLE", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ev_", "._", "xm", "oti", "on_", "._", "state_", "&_", "xli", "b_", "._", "Butt", "on", "3", "Motion", "Mask_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buttons_", "|=_", "mouse_", "._", "RIGHT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "buttons_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Drag", " ", "event_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "ev_", "._", "xm", "oti", "on_", "._", "x_", "-_", "self_", "._", "\\u", "view", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "\\u", "height_", "-_", "(_", "ev_", "._", "xm", "oti", "on_", "._", "y_", "-_", "self_", "._", "\\u", "view", "\\u", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "mouse", "\\u", "in", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "x_", "-_", "self_", "._", "\\u", "mouse", "\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dy_", "=_", "y_", "-_", "self_", "._", "\\u", "mouse", "\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dx_", "=_", "dy_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "modifiers_", "=_", "self_", "._", "\\u", "translat", "e\\u", "modifiers_", "(_", "ev_", "._", "xm", "oti", "on_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "drag", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", ",_", "dx_", ",_", "dy_", ",_", "buttons_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Client", "Message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "client", "message_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "atom_", "=_", "ev_", "._", "xc", "lient_", "._", "data_", "._", "l_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "atom_", "==_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "ev_", "._", "xc", "lient_", "._", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'", "WM", "\\u", "DELET", "E", "\\u", "WIND", "OW", "'_", ")_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "close", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "self_", "._", "\\u", "enable", "\\u", "xs", "ync_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "atom_", "==_", "xli", "b_", "._", "XI", "nter", "n", "Atom_", "(_", "ev_", "._", "xc", "lient_", "._", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "as", "bytes_", "(_", "'\\u", "NET", "\\u", "WM", "\\u", "SYNC", "\\u", "REQUEST", "'_", ")_", ",_", "False_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lo_", "=_", "ev_", "._", "xc", "lient_", "._", "data_", "._", "l_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hi_", "=_", "ev_", "._", "xc", "lient_", "._", "data_", "._", "l_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "value_", "=_", "xs", "ync_", "._", "XS", "ync", "Value_", "(_", "hi_", ",_", "lo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "sync", "\\u", "resize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "enable", "\\u", "xs", "ync_", "and_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "xs", "ync_", "._", "XS", "ync", "Value", "Is", "Zero_", "(_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xs", "ync_", "._", "XS", "ync", "Set", "Counter_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "sync", "\\u", "counter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Butt", "on", "Press_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Butt", "on", "Release_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "button_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "ev_", "._", "xb", "utton_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "height_", "-_", "ev_", "._", "xb", "utton_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "button_", "=_", "1_", "<<_", "(_", "ev_", "._", "xb", "utton_", "._", "button_", "-_", "1_", ")_", "#", " ", "1", ",", " ", "2", ",", " ", "3", " ", "->", " ", "1", ",", " ", "2", ",", " ", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modifiers_", "=_", "self_", "._", "\\u", "translat", "e\\u", "modifiers_", "(_", "ev_", "._", "xb", "utton_", "._", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ev_", "._", "type_", "==_", "xli", "b_", "._", "Butt", "on", "Press_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", "\\u", "redirec", "t", " ", "issue", ":", " ", "manu", "ally", " ", "activat", "e", " ", "this", " ", "window", " ", "if_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fullscreen", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "override", "\\u", "redirect_", "and_", "not_", "self_", "._", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "activate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ev_", "._", "xb", "utton_", "._", "button_", "==_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "scroll", "'_", ",_", "x_", ",_", "y_", ",_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ev_", "._", "xb", "utton_", "._", "button_", "==_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "scroll", "'_", ",_", "x_", ",_", "y_", ",_", "0_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ev_", "._", "xb", "utton_", "._", "button_", "<_", "len_", "(_", "self_", "._", "\\u", "mouse", "\\u", "buttons_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "ev_", "._", "xb", "utton_", "._", "button_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "press", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", ",_", "button_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ev_", "._", "xb", "utton_", "._", "button_", "<_", "4_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "ev_", "._", "xb", "utton_", "._", "button_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "release", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", ",_", "button_", ",_", "modifiers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Expos", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "expose_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ignor", "e", " ", "all", " ", "expos", "e", " ", "events", " ", "except", " ", "the", " ", "last", " ", "one", ".", " ", "We", " ", "coul", "d", " ", "be", " ", "tol", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abo", "ut", " ", "exposure", " ", "rect", "s", " ", "-", " ", "but", " ", "I", " ", "don", "'", "t", " ", "see", " ", "the", " ", "point", " ", "sinc", "e", " ", "we", "'", "re_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "working", " ", "with", " ", "Open", "GL", " ", "and", " ", "we", "'", "ll", " ", "just", " ", "redraw", " ", "the", " ", "whole", " ", "scen", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ev_", "._", "xe", "xpo", "se_", "._", "count_", ">_", "0_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "expos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Enter", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "enter", "notify_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "figure", " ", "active", " ", "mouse", " ", "buttons_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "ignore", " ", "modifier", " ", "state", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "ev_", "._", "xc", "ross", "ing_", "._", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "1_", "]_", "=_", "state_", "&_", "xli", "b_", "._", "Butt", "on1", "Mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "2_", "]_", "=_", "state_", "&_", "xli", "b_", "._", "Butt", "on2", "Mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "3_", "]_", "=_", "state_", "&_", "xli", "b_", "._", "Butt", "on", "3", "Mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "4_", "]_", "=_", "state_", "&_", "xli", "b_", "._", "Butt", "on", "4", "Mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "buttons_", "[_", "5_", "]_", "=_", "state_", "&_", "xli", "b_", "._", "Butt", "on", "5", "Mask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "mouse", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "self_", "._", "\\u", "mouse", "\\u", "x_", "=_", "ev_", "._", "xc", "ross", "ing_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "\\u", "mouse", "\\u", "y_", "=_", "self_", "._", "height_", "-_", "ev_", "._", "xc", "ross", "ing_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "in", "\\u", "window_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", " ", "there", " ", "may", " ", "be", " ", "more", " ", "we", " ", "coul", "d", " ", "do", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "enter", "'_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "View", "Event", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Leav", "e", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "lea", "ven", "oti", "fy_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "self_", "._", "\\u", "mouse", "\\u", "x_", "=_", "ev_", "._", "xc", "ross", "ing_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "self_", "._", "\\u", "mouse", "\\u", "y_", "=_", "self_", "._", "height_", "-_", "ev_", "._", "xc", "ross", "ing_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "\\u", "in", "\\u", "window_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "mouse", "\\u", "lea", "ve", "'_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Configure", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "configur", "eno", "tify", "_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "enable", "\\u", "xs", "ync_", "and_", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "current", "\\u", "sync", "\\u", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "fullscreen", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "switch", "\\u", "to_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "w_", ",_", "h_", "=_", "ev_", "._", "xco", "nfigure", "_", "._", "width_", ",_", "ev_", "._", "xco", "nfigure", "_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "ev_", "._", "xco", "nfigure", "_", "._", "x_", ",_", "ev_", "._", "xco", "nfigure", "_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "width_", "!=_", "w_", "or_", "self_", "._", "\\u", "height_", "!=_", "h_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "update", "\\u", "view", "\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "width_", "=_", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "height_", "=_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "need", "s", "\\u", "resize_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "x_", "!=_", "x_", "or_", "self_", "._", "\\u", "y_", "!=_", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "move", "'_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Foc", "us", "In_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "foc", "usi", "n_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "active_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "activat", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XS", "et", "IC", "Focus_", "(_", "self_", "._", "\\u", "x", "\\u", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Foc", "us", "Out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "foc", "uso", "ut_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "active_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "deactivate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xli", "b_", "._", "XU", "nse", "t", "IC", "Focus_", "(_", "self_", "._", "\\u", "x", "\\u", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Map", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "map", "notify_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mapped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "show", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "update", "\\u", "exclu", "si", "vity", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Xl", "ib", "Window_", "(_", "Base", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "Xl", "ib", "Event", "Handler_", "(_", "xli", "b_", "._", "Unma", "p", "Notify_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "event", "\\u", "unma", "pno", "tify", "_", "(_", "self_", ",_", "ev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mapped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "\\u", "event_", "(_", "'", "on", "\\u", "hide", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
richrd/suplemon/suplemon/modules/battery.py
[ { "content": " def battery_status_read(self):\n \"\"\"Get the battery status via proc/acpi.\"\"\"\n try:\n path_info = self.readf(\"/proc/acpi/battery/BAT0/info\")\n path_state = self.readf(\"/proc/acpi/battery/BAT0/state\")\n except:\n return None\n try:\n max_cap = float(helpers.get_string_between(\"last full capacity:\", \"mWh\", path_info))\n cur_cap = float(helpers.get_string_between(\"remaining capacity:\", \"mWh\", path_state))\n return int(cur_cap / max_cap * 100)\n except:\n return None", "metadata": "root.Battery.battery_status_read", "header": "['class', 'Battery', '(', 'Module', ')', ':', '___EOS___']", "index": 57 }, { "content": " def battery_status_acpi(self):\n \"\"\"Get the battery status via acpi.\"\"\"\n try:\n fnull = open(os.devnull, \"w\")\n raw_str = subprocess.check_output([\"acpi\"], stderr=fnull)\n fnull.close()\n except:\n return None\n raw_str = raw_str.decode(\"utf-8\")\n part = helpers.get_string_between(\",\", \"%\", raw_str)\n if part:\n try:\n return int(part)\n except:\n return None\n return None", "metadata": "root.Battery.battery_status_acpi", "header": "['class', 'Battery', '(', 'Module', ')', ':', '___EOS___']", "index": 71 }, { "content": " def battery_status_upower(self):\n \"\"\"Get the battery status via upower.\"\"\"\n path = \"/org/freedesktop/UPower/devices/battery_BAT0\"\n try:\n raw_str = subprocess.check_output([\"upower\", \"-i\", path])\n except:\n return None\n raw_str = raw_str.decode(\"utf-8\")\n raw_str = raw_str.splitlines()[0]\n part = helpers.get_string_between(\"percentage:\", \"%\", raw_str)\n if part:\n try:\n return int(part)\n except:\n return None\n return None", "metadata": "root.Battery.battery_status_upower", "header": "['class', 'Battery', '(', 'Module', ')', ':', '___EOS___']", "index": 88 } ]
[ { "span": "except:", "start_line": 62, "start_column": 8, "end_line": 62, "end_column": 15 }, { "span": "except:", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 15 }, { "span": "except:", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 15 }, { "span": "except:", "start_line": 84, "start_column": 12, "end_line": 84, "end_column": 19 }, { "span": "except:", "start_line": 93, "start_column": 8, "end_line": 93, "end_column": 15 }, { "span": "except:", "start_line": 101, "start_column": 12, "end_line": 101, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Batt", "ery", "_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "battery", "\\u", "status", "\\u", "read_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "battery", " ", "status", " ", "via", " ", "proc", "/", "ac", "pi", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "info_", "=_", "self_", "._", "readf", "_", "(_", "\"/", "proc", "/", "ac", "pi", "/", "battery", "/", "BAT", "0", "/", "info", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path", "\\u", "state_", "=_", "self_", "._", "readf", "_", "(_", "\"/", "proc", "/", "ac", "pi", "/", "battery", "/", "BAT", "0", "/", "state", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "max", "\\u", "cap_", "=_", "float_", "(_", "helpers_", "._", "get", "\\u", "string", "\\u", "between_", "(_", "\"", "last", " ", "full", " ", "capacit", "y", ":\"_", ",_", "\"", "m", "Wh", "\"_", ",_", "path", "\\u", "info_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "cap_", "=_", "float_", "(_", "helpers_", "._", "get", "\\u", "string", "\\u", "between_", "(_", "\"", "rema", "inin", "g", " ", "capacit", "y", ":\"_", ",_", "\"", "m", "Wh", "\"_", ",_", "path", "\\u", "state_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "int_", "(_", "cur", "\\u", "cap_", "/_", "max", "\\u", "cap_", "*_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Batt", "ery", "_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "battery", "\\u", "status", "\\u", "ac", "pi_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "battery", " ", "status", " ", "via", " ", "ac", "pi", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fnu", "ll_", "=_", "open_", "(_", "os_", "._", "devnull_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "str_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "\"", "ac", "pi", "\"_", "]_", ",_", "stderr_", "=_", "fnu", "ll_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fnu", "ll_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raw", "\\u", "str_", "=_", "raw", "\\u", "str_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part_", "=_", "helpers_", "._", "get", "\\u", "string", "\\u", "between_", "(_", "\",\"_", ",_", "\"%\"_", ",_", "raw", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "part_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Batt", "ery", "_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "battery", "\\u", "status", "\\u", "upo", "wer", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "battery", " ", "status", " ", "via", " ", "upo", "wer", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "\"/", "org", "/", "freed", "es", "kto", "p", "/", "UP", "ower", "/", "device", "s", "/", "battery", "\\u", "BAT", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "str_", "=_", "subprocess_", "._", "check", "\\u", "output_", "(_", "[_", "\"", "upo", "wer", "\"_", ",_", "\"-", "i", "\"_", ",_", "path_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raw", "\\u", "str_", "=_", "raw", "\\u", "str_", "._", "decode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "\\u", "str_", "=_", "raw", "\\u", "str_", "._", "splitlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part_", "=_", "helpers_", "._", "get", "\\u", "string", "\\u", "between_", "(_", "\"", "percentage", ":\"_", ",_", "\"%\"_", ",_", "raw", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "part_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
'import *' may pollute namespace
enthought/comtypes/comtypes/util.py
[ { "content": "\"\"\"This module defines the funtions byref_at(cobj, offset)\nand cast_field(struct, fieldname, fieldtype).\n\"\"\"\nfrom ctypes import *\n\n\n################################################################\n#\n# byref_at\n#\n\n\n################################################################\n#\n# cast_field\n#\n\n__all__ = [\"byref_at\", \"cast_field\"]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from ctypes import *", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "'", "import", " ", "*'_", "may", "_", "poll", "ute", "_", "namespace_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "module", " ", "defin", "es", " ", "the", " ", "fun", "tion", "s", " ", "by", "ref", "\\u", "at", "(", "cobj", ",", " ", "offset", ")", "\\", "10", ";", "and", " ", "cast", "\\u", "field", "(", "struct", ",", " ", "field", "name", ",", " ", "field", "type", ").", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", "ref", "\\u", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "cast", "\\u", "field_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "by", "ref", "\\u", "at", "\"_", ",_", "\"", "cast", "\\u", "field", "\"_", "]_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
eBay/bayesian-belief-networks/bayesian/factor_graph.py
[ { "content": "from __future__ import division\n'''Implements Sum-Product Algorithm and Sampling over Factor Graphs'''\nimport os\nimport csv\nimport sys\nimport copy\nimport inspect\nimport random\n\nfrom collections import defaultdict\nfrom itertools import product as iter_product\nfrom Queue import Queue\n\nimport sqlite3\nfrom prettytable import PrettyTable\n\nfrom bayesian.persistance import SampleDB, ensure_data_dir_exists\nfrom bayesian.exceptions import *\nfrom bayesian.utils import get_args\n\nDEBUG = False\nGREEN = '\\033[92m'\nNORMAL = '\\033[0m'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Node(object):\n\n\n\n\n\n", "metadata": "root.Node", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def is_leaf(self):\n if len(self.neighbours) == 1:\n return True\n return False", "metadata": "root.Node.is_leaf", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 26 }, { "content": " def send(self, message):\n recipient = message.destination\n if DEBUG:\n print '%s ---> %s' % (\n self.name, recipient.name), message\n recipient.received_messages[\n self.name] = message", "metadata": "root.Node.send", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 31 }, { "content": " def get_sent_messages(self):\n sent_messages = {}\n for neighbour in self.neighbours:\n if neighbour.received_messages.get(self.name):\n sent_messages[neighbour.name] = \\\n neighbour.received_messages.get(self.name)\n return sent_messages", "metadata": "root.Node.get_sent_messages", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " def message_report(self):\n '''\n List out all messages Node\n currently has received.\n '''\n print '------------------------------'\n print 'Messages at Node %s' % self.name\n print '------------------------------'\n for k, v in self.received_messages.iteritems():\n print '%s <-- Argspec:%s' % (v.source.name, v.argspec)\n v.list_factors()\n print '--'", "metadata": "root.Node.message_report", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 47 }, { "content": " def get_target(self):\n '''\n A node can only send to a neighbour if\n it has not already sent to that neighbour\n and it has received messages from all other\n neighbours.\n '''\n neighbours = self.neighbours\n #if len(neighbours) - len(self.received_messages) > 1:\n # return None\n needed_to_send = defaultdict(int)\n for target in neighbours:\n needed_to_send[target] = len(neighbours) - 1\n for _, message in self.received_messages.items():\n for target in neighbours:\n if message.source != target:\n needed_to_send[target] -= 1\n for k, v in needed_to_send.items():\n if v == 0 and not self.name in k.received_messages:\n return k", "metadata": "root.Node.get_target", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 60 }, { "content": " def get_neighbour_by_name(self, name):\n for node in self.neighbours:\n if node.name == name:\n return node", "metadata": "root.Node.get_neighbour_by_name", "header": "['class', 'Node', '(', 'object', ')', ':', '___EOS___']", "index": 81 }, { "content": "class VariableNode(Node):\n\n\n\n\n\n", "metadata": "root.VariableNode", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def __init__(self, name, domain=[True, False]):\n self.name = name\n self.domain = domain\n self.neighbours = []\n self.received_messages = {}\n self.value = None", "metadata": "root.VariableNode.__init__", "header": "['class', 'VariableNode', '(', 'Node', ')', ':', '___EOS___']", "index": 89 }, { "content": " def construct_message(self):\n target = self.get_target()\n message = make_variable_node_message(self, target)\n return message", "metadata": "root.VariableNode.construct_message", "header": "['class', 'VariableNode', '(', 'Node', ')', ':', '___EOS___']", "index": 96 }, { "content": " def __repr__(self):\n return '<VariableNode: %s:%s>' % (self.name, self.value)", "metadata": "root.VariableNode.__repr__", "header": "['class', 'VariableNode', '(', 'Node', ')', ':', '___EOS___']", "index": 101 }, { "content": " def marginal(self, val, normalizer=1.0):\n '''\n The marginal function in a Variable\n Node is the product of all incoming\n messages. These should all be functions\n of this nodes variable.\n When any of the variables in the\n network are constrained we need to\n normalize.\n '''\n product = 1\n for _, message in self.received_messages.iteritems():\n product *= message(val)\n return product / normalizer", "metadata": "root.VariableNode.marginal", "header": "['class', 'VariableNode', '(', 'Node', ')', ':', '___EOS___']", "index": 104 }, { "content": " def reset(self):\n self.received_messages = {}\n self.value = None", "metadata": "root.VariableNode.reset", "header": "['class', 'VariableNode', '(', 'Node', ')', ':', '___EOS___']", "index": 119 }, { "content": " def verify_neighbour_types(self):\n '''\n Check that all neighbours are of VariableNode type.\n '''\n for node in self.neighbours:\n if not isinstance(node, FactorNode):\n return False\n return True", "metadata": "root.VariableNode.verify_neighbour_types", "header": "['class', 'VariableNode', '(', 'Node', ')', ':', '___EOS___']", "index": 123 }, { "content": "class FactorNode(Node):\n\n\n\n\n\n\n", "metadata": "root.FactorNode", "header": "['module', '___EOS___']", "index": 133 }, { "content": " def __init__(self, name, func, neighbours=[]):\n self.name = name\n self.func = func\n self.neighbours = neighbours[:]\n self.received_messages = {}\n self.func.value = None\n self.cached_functions = []", "metadata": "root.FactorNode.__init__", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 135 }, { "content": " def construct_message(self):\n target = self.get_target()\n message = make_factor_node_message(self, target)\n return message", "metadata": "root.FactorNode.construct_message", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 143 }, { "content": " def verify_neighbour_types(self):\n '''\n Check that all neighbours are of VariableNode type.\n '''\n for node in self.neighbours:\n if not isinstance(node, VariableNode):\n return False\n return True", "metadata": "root.FactorNode.verify_neighbour_types", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 148 }, { "content": " def __repr__(self):\n return '<FactorNode %s %s(%s)>' % \\\n (self.name,\n self.func.__name__,\n get_args(self.func))", "metadata": "root.FactorNode.__repr__", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 157 }, { "content": " def marginal(self, val_dict):\n # The Joint marginal of the\n # neighbour variables of a factor\n # node is given by the product\n # of the incoming messages and the factor\n product = 1\n neighbours = self.neighbours\n for neighbour in neighbours:\n message = self.received_messages[neighbour.name]\n call_args = []\n for arg in get_args(message):\n call_args.append(val_dict[arg])\n if not call_args:\n call_args.append('dummy')\n product *= message(*call_args)\n # Finally we also need to multiply\n # by the factor itself\n call_args = []\n for arg in get_args(self.func):\n call_args.append(val_dict[arg])\n if not call_args:\n call_args.append('dummy')\n product *= self.func(*call_args)\n return product", "metadata": "root.FactorNode.marginal", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 163 }, { "content": " def add_evidence(self, node, value):\n '''\n Here we modify the factor function\n to return 0 whenever it is called\n with the observed variable having\n a value other than the observed value.\n '''\n args = get_args(self.func)\n pos = args.index(node.name)\n # Save the old func so that we\n # can remove the evidence later\n old_func = self.func\n self.cached_functions.insert(0, old_func)\n\n def evidence_func(*args):\n if args[pos] != value:\n return 0\n return old_func(*args)\n\n evidence_func.argspec = args\n evidence_func.domains = old_func.domains\n self.func = evidence_func", "metadata": "root.FactorNode.add_evidence", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 188 }, { "content": " def reset(self):\n self.received_messages = {}\n if self.cached_functions:\n self.func = self.cached_functions[-1]\n self.cached_functions = []", "metadata": "root.FactorNode.reset", "header": "['class', 'FactorNode', '(', 'Node', ')', ':', '___EOS___']", "index": 211 }, { "content": "class Message(object):\n\n", "metadata": "root.Message", "header": "['module', '___EOS___']", "index": 218 }, { "content": " def list_factors(self):\n print '---------------------------'\n print 'Factors in message %s -> %s' % \\\n (self.source.name, self.destination.name)\n print '---------------------------'\n for factor in self.factors:\n print factor", "metadata": "root.Message.list_factors", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 220 }, { "content": " def __call__(self, var):\n '''\n Evaluate the message as a function\n '''\n if getattr(self.func, '__name__', None) == 'unity':\n return 1\n assert not isinstance(var, VariableNode)\n # Now check that the name of the\n # variable matches the argspec...\n #assert var.name == self.argspec[0]\n return self.func(var)", "metadata": "root.Message.__call__", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 228 }, { "content": "class VariableMessage(Message):\n\n", "metadata": "root.VariableMessage", "header": "['module', '___EOS___']", "index": 241 }, { "content": " def __init__(self, source, destination, factors, func):\n self.source = source\n self.destination = destination\n self.factors = factors\n self.argspec = get_args(func)\n self.func = func", "metadata": "root.VariableMessage.__init__", "header": "['class', 'VariableMessage', '(', 'Message', ')', ':', '___EOS___']", "index": 243 }, { "content": " def __repr__(self):\n return '<V-Message from %s -> %s: %s factors (%s)>' % \\\n (self.source.name, self.destination.name,\n len(self.factors), self.argspec)", "metadata": "root.VariableMessage.__repr__", "header": "['class', 'VariableMessage', '(', 'Message', ')', ':', '___EOS___']", "index": 250 }, { "content": "class FactorMessage(Message):\n\n", "metadata": "root.FactorMessage", "header": "['module', '___EOS___']", "index": 256 }, { "content": " def __init__(self, source, destination, factors, func):\n self.source = source\n self.destination = destination\n self.factors = factors\n self.func = func\n self.argspec = get_args(func)\n self.domains = func.domains", "metadata": "root.FactorMessage.__init__", "header": "['class', 'FactorMessage', '(', 'Message', ')', ':', '___EOS___']", "index": 258 }, { "content": " def __repr__(self):\n return '<F-Message %s -> %s: ~(%s) %s factors.>' % \\\n (self.source.name, self.destination.name,\n self.argspec,\n len(self.factors))", "metadata": "root.FactorMessage.__repr__", "header": "['class', 'FactorMessage', '(', 'Message', ')', ':', '___EOS___']", "index": 266 }, { "content": "def connect(a, b):\n '''\n Make an edge between two nodes\n or between a source and several\n neighbours.\n '''\n if not isinstance(b, list):\n b = [b]\n for b_ in b:\n a.neighbours.append(b_)\n b_.neighbours.append(a)", "metadata": "root.connect", "header": "['module', '___EOS___']", "index": 273 }, { "content": "def eliminate_var(f, var):\n '''\n Given a function f return a new\n function which sums over the variable\n we want to eliminate\n\n This may be where we have the opportunity\n to remove the use of .value....\n\n '''\n arg_spec = get_args(f)\n pos = arg_spec.index(var)\n new_spec = arg_spec[:]\n new_spec.remove(var)\n # Lets say the orginal argspec is\n # ('a', 'b', 'c', 'd') and they\n # are all Booleans\n # Now lets say we want to eliminate c\n # This means we want to sum over\n # f(a, b, True, d) and f(a, b, False, d)\n # Seems like all we have to do is know\n # the positionn of c and thats it???\n # Ok so its not as simple as that...\n # this is because when the *call* is made\n # to the eliminated function, as opposed\n # to when its built then its only\n # called with ('a', 'b', 'd')\n eliminated_pos = arg_spec.index(var)\n\n def eliminated(*args):\n template = arg_spec[:]\n total = 0\n call_args = template[:]\n i = 0\n for arg in args:\n # To be able to remove .value we\n # first need to also be able to\n # remove .name in fact .value is\n # just a side effect of having to\n # rely on .name. This means we\n # probably need to construct a\n # a list containing the names\n # of the args based on the position\n # they are being called.\n if i == eliminated_pos:\n # We need to increment i\n # once more to skip over\n # the variable being marginalized\n call_args[i] = 'marginalize me!'\n i += 1\n call_args[i] = arg\n i += 1\n\n for val in f.domains[var]:\n #v = VariableNode(name=var)\n #v.value = val\n #call_args[pos] = v\n call_args[pos] = val\n total += f(*call_args)\n return total\n\n eliminated.argspec = new_spec\n eliminated.domains = f.domains\n #eliminated.__name__ = f.__name__\n return eliminated", "metadata": "root.eliminate_var", "header": "['module', '___EOS___']", "index": 287 }, { "content": "def memoize(f):\n '''\n The goal of message passing\n is to re-use results. This\n memoise is slightly modified from\n usual examples in that it caches\n the values of variables rather than\n the variables themselves.\n '''\n cache = {}\n\n def memoized(*args):\n #arg_vals = tuple([arg.value for arg in args])\n arg_vals = tuple(args)\n if not arg_vals in cache:\n cache[arg_vals] = f(*args)\n return cache[arg_vals]\n\n if hasattr(f, 'domains'):\n memoized.domains = f.domains\n if hasattr(f, 'argspec'):\n memoized.argspec = f.argspec\n return memoized", "metadata": "root.memoize", "header": "['module', '___EOS___']", "index": 354 }, { "content": "def make_not_sum_func(product_func, keep_var):\n '''\n Given a function with some set of\n arguments, and a single argument to keep,\n construct a new function only of the\n keep_var, summarized over all the other\n variables.\n\n For this branch we are trying to\n get rid of the requirement to have\n to use .value on arguments....\n Looks like its actually in the\n eliminate var...\n '''\n args = get_args(product_func)\n new_func = copy.deepcopy(product_func)\n for arg in args:\n if arg != keep_var:\n new_func = eliminate_var(new_func, arg)\n new_func = memoize(new_func)\n return new_func", "metadata": "root.make_not_sum_func", "header": "['module', '___EOS___']", "index": 379 }, { "content": "def make_factor_node_message(node, target_node):\n '''\n The rules for a factor node are:\n take the product of all the incoming\n messages (except for the destination\n node) and then take the sum over\n all the variables except for the\n destination variable.\n >>> def f(x1, x2, x3): pass\n >>> node = object()\n >>> node.func = f\n >>> target_node = object()\n >>> target_node.name = 'x2'\n >>> make_factor_node_message(node, target_node)\n '''\n\n if node.is_leaf():\n not_sum_func = make_not_sum_func(node.func, target_node.name)\n message = FactorMessage(node, target_node, [node.func], not_sum_func)\n return message\n\n args = set(get_args(node.func))\n\n # Compile list of factors for message\n factors = [node.func]\n\n # Now add the message that came from each\n # of the non-destination neighbours...\n neighbours = node.neighbours\n for neighbour in neighbours:\n if neighbour == target_node:\n continue\n # When we pass on a message, we unwrap\n # the original payload and wrap it\n # in new headers, this is purely\n # to verify the procedure is correct\n # according to usual nomenclature\n in_message = node.received_messages[neighbour.name]\n if in_message.destination != node:\n out_message = VariableMessage(\n neighbour, node, in_message.factors,\n in_message.func)\n out_message.argspec = in_message.argspec\n else:\n out_message = in_message\n factors.append(out_message)\n\n product_func = make_product_func(factors)\n not_sum_func = make_not_sum_func(product_func, target_node.name)\n message = FactorMessage(node, target_node, factors, not_sum_func)\n return message", "metadata": "root.make_factor_node_message", "header": "['module', '___EOS___']", "index": 402 }, { "content": "def make_variable_node_message(node, target_node):\n '''\n To construct the message from\n a variable node to a factor\n node we take the product of\n all messages received from\n neighbours except for any\n message received from the target.\n If the source node is a leaf node\n then send the unity function.\n '''\n if node.is_leaf():\n message = VariableMessage(\n node, target_node, [1], unity)\n return message\n factors = []\n neighbours = node.neighbours\n for neighbour in neighbours:\n if neighbour == target_node:\n continue\n factors.append(\n node.received_messages[neighbour.name])\n\n product_func = make_product_func(factors)\n message = VariableMessage(\n node, target_node, factors, product_func)\n return message", "metadata": "root.make_variable_node_message", "header": "['module', '___EOS___']", "index": 455 }, { "content": "def make_product_func(factors):\n '''\n Return a single callable from\n a list of factors which correctly\n applies the arguments to each\n individual factor.\n\n The challenge here is to return a function\n whose argument list we know and ensure that\n when this function is called, its always\n called with the correct arguments.\n Since the correct argspec is attached\n to the built function it seems that\n it should be up to the caller to\n get the argument list correct.\n So we need to determine when and where its called...\n\n '''\n args_map = {}\n all_args = []\n domains = {}\n for factor in factors:\n #if factor == 1:\n # continue\n args_map[factor] = get_args(factor)\n all_args += args_map[factor]\n if hasattr(factor, 'domains'):\n domains.update(factor.domains)\n args = list(set(all_args))\n # Perhaps if we sort the\n\n\n def product_func(*product_func_args):\n #import pytest; pytest.set_trace()\n #arg_dict = dict([(a.name, a) for a in product_func_args])\n arg_dict = dict(zip(args, product_func_args))\n #import pytest; pytest.set_trace()\n result = 1\n for factor in factors:\n #domains.update(factor.domains)\n # We need to build the correct argument\n # list to call this factor with.\n factor_args = []\n for arg in get_args(factor):\n if arg in arg_dict:\n factor_args.append(arg_dict[arg])\n if not factor_args:\n # Since we always require\n # at least one argument we\n # insert a dummy argument\n # so that the unity function works.\n factor_args.append('dummy')\n result *= factor(*factor_args)\n\n return result\n\n product_func.argspec = args\n product_func.factors = factors\n product_func.domains = domains\n return memoize(product_func)", "metadata": "root.make_product_func", "header": "['module', '___EOS___']", "index": 484 }, { "content": "def make_unity(argspec):\n def unity(x):\n return 1\n unity.argspec = argspec\n unity.__name__ = '1'\n return unity", "metadata": "root.make_unity", "header": "['module', '___EOS___']", "index": 546 }, { "content": "def unity():\n return 1", "metadata": "root.unity", "header": "['module', '___EOS___']", "index": 554 }, { "content": "def expand_args(args):\n if not args:\n return []\n return", "metadata": "root.expand_args", "header": "['module', '___EOS___']", "index": 558 }, { "content": "def dict_to_tuples(d):\n '''\n Convert a dict whose values\n are lists to a list of\n tuples of the key with\n each of the values\n '''\n retval = []\n for k, vals in d.iteritems():\n retval.append([(k, v) for v in vals])\n return retval", "metadata": "root.dict_to_tuples", "header": "['module', '___EOS___']", "index": 564 }, { "content": "def expand_parameters(arg_vals):\n '''\n Given a list of args and values\n return a list of tuples\n containing all possible sequences\n of length n.\n '''\n arg_tuples = dict_to_tuples(arg_vals)\n return [dict(args) for args in iter_product(*arg_tuples)]", "metadata": "root.expand_parameters", "header": "['module', '___EOS___']", "index": 577 }, { "content": "def add_evidence(node, value):\n '''\n Set a variable node to an observed value.\n Note that for now this is achieved\n by modifying the factor functions\n which this node is connected to.\n After updating the factor nodes\n we need to re-run the sum-product\n algorithm. We also need to normalize\n all marginal outcomes.\n '''\n node.value = value\n neighbours = node.neighbours\n for factor_node in neighbours:\n if node.name in get_args(factor_node.func):\n factor_node.add_evidence(node, value)", "metadata": "root.add_evidence", "header": "['module', '___EOS___']", "index": 588 }, { "content": "def discover_sample_ordering(graph):\n '''\n Try to get the order of variable nodes\n for sampling. This would be easier in\n the underlying BBN but lets try on\n the factor graph.\n '''\n iterations = 0\n ordering = []\n pmf_ordering = []\n accounted_for = set()\n variable_nodes = [n for n in graph.nodes if isinstance(n, VariableNode)]\n factor_nodes = [n for n in graph.nodes if isinstance(n, FactorNode)]\n required = len([n for n in graph.nodes if isinstance(n, VariableNode)])\n # Firstly any leaf factor nodes will\n # by definition only have one variable\n # node connection, therefore these\n # variables can be set first.\n for node in graph.get_leaves():\n if isinstance(node, FactorNode):\n ordering.append(node.neighbours[0])\n accounted_for.add(node.neighbours[0].name)\n pmf_ordering.append(node.func)\n\n # Now for each factor node whose variables\n # all but one are already in the ordering,\n # we can add that one variable. This is\n # actuall\n while len(ordering) < required:\n for node in factor_nodes:\n args = set(get_args(node.func))\n new_args = args.difference(accounted_for)\n if len(new_args) == 1:\n arg_name = list(new_args)[0]\n var_node = node.get_neighbour_by_name(arg_name)\n ordering.append(var_node)\n accounted_for.add(var_node.name)\n pmf_ordering.append(node.func)\n return zip(ordering, pmf_ordering)", "metadata": "root.discover_sample_ordering", "header": "['module', '___EOS___']", "index": 606 }, { "content": "def get_sample(ordering, evidence={}):\n '''\n Given a valid ordering, sample the network.\n '''\n sample = []\n sample_dict = dict()\n for var, func in ordering:\n r = random.random()\n total = 0\n for val in var.domain:\n test_var = VariableNode(var.name)\n test_var.value = val\n # Now we need to build the\n # argument list out of any\n # variables already in the sample\n # and this new test value in\n # the order required by the function.\n args = []\n for arg in get_args(func):\n if arg == var.name:\n #args.append(test_var)\n args.append(val)\n else:\n args.append(sample_dict[arg].value)\n\n total += func(*args)\n if total > r:\n # We only want to use this sample\n # if it corresponds to the evidence value...\n if var.name in evidence:\n if test_var.value == evidence[var.name]:\n sample.append(test_var)\n sample_dict[var.name] = test_var\n else:\n sample.append(test_var)\n sample_dict[var.name] = test_var\n break\n if not var.name in sample_dict:\n print 'Iterated through all values for %s and %s but no go...' \\\n % (var.name, func.__name__)\n # This seems to mean that we have never seen this combination\n # of variables before, we can either discard it as irrelevant or\n # use some type of +1 smoothing???\n # What if we just randomly select some value for var????\n # lets try that as it seems the easiest....\n raise InvalidSampleException\n return sample", "metadata": "root.get_sample", "header": "['module', '___EOS___']", "index": 647 }, { "content": "class FactorGraph(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.FactorGraph", "header": "['module', '___EOS___']", "index": 696 }, { "content": " def __init__(self, nodes, name=None, n_samples=100):\n self.nodes = nodes\n self._inference_method = 'sumproduct'\n # We need to divine the domains for Factor nodes here...\n # First compile a mapping of factors to variables\n # from the arg spec...\n function_args = dict()\n arg_domains = dict()\n for node in self.nodes:\n if isinstance(node, VariableNode):\n #if not hasattr(node, 'domain'):\n # node.domain = [True, False]\n arg_domains[node.name] = node.domain\n elif isinstance(node, FactorNode):\n function_args[node.func.__name__] = get_args(node.func)\n # Now if the domains for the\n # factor functions have not been explicitely\n # set we create them based on the variable\n # values it can take.\n for node in self.nodes:\n if isinstance(node, FactorNode):\n if hasattr(node.func, 'domains'):\n continue\n domains = dict()\n for arg in get_args(node.func):\n if not arg in arg_domains:\n print 'WARNING: missing variable for arg:%s' % arg\n else:\n domains.update({arg: arg_domains[arg]})\n node.func.domains = domains\n self.name = name\n self.n_samples = n_samples\n # Now try to set the mode of inference..\n try:\n if self.has_cycles():\n # Currently only sampling\n # is supported for cyclic graphs\n self.inference_method = 'sample'\n else:\n # The sumproduct method will\n # give exact likelihoods but\n # only of the graph contains\n # no cycles.\n self.inference_method = 'sumproduct'\n except:\n print 'Failed to determine if graph has cycles, '\n 'setting inference to sample.'\n self.inference_method = 'sample'\n self.enforce_minimum_samples = False", "metadata": "root.FactorGraph.__init__", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 698 }, { "content": " @property\n def inference_method(self):\n return self._inference_method", "metadata": "root.FactorGraph.inference_method", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 748 }, { "content": " @inference_method.setter\n def inference_method(self, value):\n # If the value is being set to 'sample_db'\n # we need to make sure that the sqlite file\n # exists.\n if value == 'sample_db':\n ensure_data_dir_exists(self.sample_db_filename)\n sample_ordering = self.discover_sample_ordering()\n domains = dict([(var, var.domain) for var, _ in sample_ordering])\n if not os.path.isfile(self.sample_db_filename):\n # This is a new file so we need to\n # initialize the db...\n self.sample_db = SampleDB(\n self.sample_db_filename,\n domains,\n initialize=True)\n else:\n self.sample_db = SampleDB(\n self.sample_db_filename,\n domains,\n initialize=False)\n self._inference_method = value", "metadata": "root.FactorGraph.inference_method", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 752 }, { "content": " @property\n def sample_db_filename(self):\n '''\n Get the name of the sqlite sample\n database for external sample\n generation and querying.\n The default location for now\n will be in the users home\n directory under ~/.pypgm/data/[name].sqlite\n where [name] is the name of the\n model. If the model has\n not been given an explict name\n it will be \"default\".\n\n '''\n home = os.path.expanduser('~')\n return os.path.join(\n home, '.pypgm',\n 'data',\n '%s.sqlite' % (self.name or 'default'))", "metadata": "root.FactorGraph.sample_db_filename", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 775 }, { "content": " def reset(self):\n '''\n Reset all nodes back to their initial state.\n We should do this before or after adding\n or removing evidence.\n '''\n for node in self.nodes:\n node.reset()", "metadata": "root.FactorGraph.reset", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 796 }, { "content": " def has_cycles(self):\n '''\n Check if the graph has cycles or not.\n We will do this by traversing starting\n from any leaf node and recording\n both the edges traversed and the nodes\n discovered. From stackoverflow, if\n an unexplored edge leads to a\n previously found node then it has\n cycles.\n '''\n discovered_nodes = set()\n traversed_edges = set()\n q = Queue()\n for node in self.nodes:\n if node.is_leaf():\n start_node = node\n break\n q.put(start_node)\n while not q.empty():\n current_node = q.get()\n if DEBUG:\n print \"Current Node: \", current_node\n print \"Discovered Nodes before adding Current Node: \", \\\n discovered_nodes\n if current_node.name in discovered_nodes:\n # We have a cycle!\n if DEBUG:\n print 'Dequeued node already processed: %s', current_node\n return True\n discovered_nodes.add(current_node.name)\n if DEBUG:\n print \"Discovered Nodes after adding Current Node: \", \\\n discovered_nodes\n for neighbour in current_node.neighbours:\n edge = [current_node.name, neighbour.name]\n # Since this is undirected and we want\n # to record the edges we have traversed\n # we will sort the edge alphabetically\n edge.sort()\n edge = tuple(edge)\n if edge not in traversed_edges:\n # This is a new edge...\n if neighbour.name in discovered_nodes:\n return True\n # Now place all neighbour nodes on the q\n # and record this edge as traversed\n if neighbour.name not in discovered_nodes:\n if DEBUG:\n print 'Enqueuing: %s' % neighbour\n q.put(neighbour)\n traversed_edges.add(edge)\n return False", "metadata": "root.FactorGraph.has_cycles", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 805 }, { "content": " def verify(self):\n '''\n Check several properties of the Factor Graph\n that should hold.\n '''\n # Check that all nodes are either\n # instances of classes derived from\n # VariableNode or FactorNode.\n # It is a very common error to instantiate\n # the graph with the factor function\n # instead of the corresponding factor\n # node.\n for node in self.nodes:\n if not isinstance(node, VariableNode) and \\\n not isinstance(node, FactorNode):\n bases = node.__class__.__bases__\n if not VariableNode in bases and not FactorNode in bases:\n print ('Factor Graph does not '\n 'support nodes of type: %s' % node.__class__)\n raise InvalidGraphException\n # First check that for each node\n # only connects to nodes of the\n # other type.\n print 'Checking neighbour node types...'\n for node in self.nodes:\n if not node.verify_neighbour_types():\n print '%s has invalid neighbour type.' % node\n return False\n print 'Checking that all factor functions have domains...'\n for node in self.nodes:\n if isinstance(node, FactorNode):\n if not hasattr(node.func, 'domains'):\n print '%s has no domains.' % node\n raise InvalidGraphException\n elif not node.func.domains:\n # Also check for an empty domain dict!\n print '%s has empty domains.' % node\n raise InvalidGraphException\n print 'Checking that all variables are accounted for' + \\\n ' by at least one function...'\n variables = set([vn.name for vn in self.nodes\n if isinstance(vn, VariableNode)])\n\n largs = [get_args(fn.func) for fn in\n self.nodes if isinstance(fn, FactorNode)]\n\n args = set(reduce(lambda x, y: x + y, largs))\n\n if not variables.issubset(args):\n print 'These variables are not used in any factors nodes: '\n print variables.difference(args)\n return False\n print 'Checking that all arguments have matching variable nodes...'\n if not args.issubset(variables):\n print 'These arguments have missing variables:'\n print args.difference(variables)\n return False\n print 'Checking that graph has at least one leaf node...'\n leaf_nodes = filter(\n lambda x: x.is_leaf(),\n self.nodes)\n if not leaf_nodes:\n print 'Graph has no leaf nodes.'\n raise InvalidGraphException\n return True", "metadata": "root.FactorGraph.verify", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 859 }, { "content": " def get_leaves(self):\n return [node for node in self.nodes if node.is_leaf()]", "metadata": "root.FactorGraph.get_leaves", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 925 }, { "content": " def get_eligible_senders(self):\n '''\n Return a list of nodes that are\n eligible to send messages at this\n round. Only nodes that have received\n messages from all but one neighbour\n may send at any round.\n '''\n eligible = []\n for node in self.nodes:\n if node.get_target():\n eligible.append(node)\n return eligible", "metadata": "root.FactorGraph.get_eligible_senders", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 928 }, { "content": " def propagate(self):\n '''\n This is the heart of the sum-product\n Message Passing Algorithm.\n '''\n step = 1\n while True:\n eligible_senders = self.get_eligible_senders()\n #print 'Step: %s %s nodes can send.' \\\n # % (step, len(eligible_senders))\n #print [x.name for x in eligible_senders]\n if not eligible_senders:\n break\n for node in eligible_senders:\n message = node.construct_message()\n node.send(message)\n step += 1", "metadata": "root.FactorGraph.propagate", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 942 }, { "content": " def variable_nodes(self):\n return [n for n in self.nodes if isinstance(n, VariableNode)]", "metadata": "root.FactorGraph.variable_nodes", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 960 }, { "content": " def factor_nodes(self):\n return [n for n in self.nodes if isinstance(n, FactorNode)]", "metadata": "root.FactorGraph.factor_nodes", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 963 }, { "content": " def get_normalizer(self):\n for node in self.variable_nodes():\n if node.value is not None:\n normalizer = node.marginal(node.value)\n return normalizer\n return 1", "metadata": "root.FactorGraph.get_normalizer", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 966 }, { "content": " def status(self, omit=[False, 0]):\n normalizer = self.get_normalizer()\n retval = dict()\n for node in self.variable_nodes():\n for value in node.domain:\n m = node.marginal(value, normalizer)\n retval[(node.name, value)] = m\n return retval", "metadata": "root.FactorGraph.status", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 973 }, { "content": " def query_by_propagation(self, **kwds):\n self.reset()\n for k, v in kwds.items():\n for node in self.variable_nodes():\n if node.name == k:\n add_evidence(node, v)\n self.propagate()\n return self.status()", "metadata": "root.FactorGraph.query_by_propagation", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 982 }, { "content": " def query(self, **kwds):\n if self.inference_method == 'sample_db':\n return self.query_by_external_samples(**kwds)\n elif self.inference_method == 'sample':\n return self.query_by_sampling(**kwds)\n elif self.inference_method == 'sumproduct':\n return self.query_by_propagation(**kwds)\n raise InvalidInferenceMethod", "metadata": "root.FactorGraph.query", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 991 }, { "content": " def q(self, **kwds):\n '''Wrapper around query\n\n This method formats the query\n result in a nice human readable format\n for interactive use.\n '''\n result = self.query(**kwds)\n tab = PrettyTable(['Node', 'Value', 'Marginal'], sortby='Node')\n tab.align = 'l'\n tab.align['Marginal'] = 'r'\n tab.float_format = '%8.6f'\n for (node, value), prob in result.items():\n if kwds.get(node, '') == value:\n tab.add_row(['%s*' % node,\n '%s%s*%s' % (GREEN, value, NORMAL),\n '%8.6f' % prob])\n else:\n tab.add_row([node, value, '%8.6f' % prob])\n print tab", "metadata": "root.FactorGraph.q", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1000 }, { "content": " def discover_sample_ordering(self):\n return discover_sample_ordering(self)", "metadata": "root.FactorGraph.discover_sample_ordering", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1021 }, { "content": " def get_sample(self, evidence={}):\n '''\n We need to allow for setting\n certain observed variables and\n discarding mismatching\n samples as we generate them.\n '''\n if not hasattr(self, 'sample_ordering'):\n self.sample_ordering = self.discover_sample_ordering()\n return get_sample(self.sample_ordering, evidence)", "metadata": "root.FactorGraph.get_sample", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1024 }, { "content": " def query_by_sampling(self, **kwds):\n counts = defaultdict(int)\n valid_samples = 0\n while valid_samples < self.n_samples:\n print \"%s of %s\" % (valid_samples, self.n_samples)\n try:\n sample = self.get_sample(kwds)\n valid_samples += 1\n except:\n print 'Failed to get a valid sample...'\n print 'continuing...'\n continue\n for var in sample:\n key = (var.name, var.value)\n counts[key] += 1\n # Now normalize\n normalized = dict(\n [(k, v / valid_samples) for k, v in counts.items()])\n return normalized", "metadata": "root.FactorGraph.query_by_sampling", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1035 }, { "content": " def generate_samples(self, n):\n '''\n Generate and save samples to\n the SQLite sample db for this\n model.\n '''\n if self.inference_method != 'sample_db':\n raise IncorrectInferenceMethodError(\n 'generate_samples() not support for inference method: %s' % \\\n self.inference_method)\n valid_samples = 0\n if not hasattr(self, 'sample_ordering'):\n self.sample_ordering = self.discover_sample_ordering()\n fn = [x[0].name for x in self.sample_ordering]\n sdb = self.sample_db\n while valid_samples < n:\n try:\n sample = self.get_sample()\n except InvalidSampleException:\n # TODO: Need to figure\n # out why we get invalid\n # samples.\n continue\n sdb.save_sample([(v.name, v.value) for v in sample])\n valid_samples += 1\n sdb.commit()\n print '%s samples stored in %s' % (n, self.sample_db_filename)", "metadata": "root.FactorGraph.generate_samples", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1055 }, { "content": " def query_by_external_samples(self, **kwds):\n counts = defaultdict(int)\n samples = self.sample_db.get_samples(self.n_samples, **kwds)\n if len(samples) == 0:\n raise NoSamplesInDB(\n 'There are no samples in the database. '\n 'Generate some with graph.generate_samples(N).')\n if len(samples) < self.n_samples and self.enforce_minimum_samples:\n raise InsufficientSamplesException(\n 'There are less samples in the sampling '\n 'database than are required by this graph. '\n 'Either generate more samples '\n '(graph.generate_samples(N) or '\n 'decrease the number of samples '\n 'required for querying (graph.n_samples). ')\n for sample in samples:\n for name, val in sample.items():\n key = (name, val)\n counts[key] += 1\n normalized = dict(\n [(k, v / len(samples)) for k, v in counts.items()])\n return normalized", "metadata": "root.FactorGraph.query_by_external_samples", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1083 }, { "content": " def export(self, filename=None, format='graphviz'):\n '''Export the graph in GraphViz dot language.'''\n if filename:\n fh = open(filename, 'w')\n else:\n fh = sys.stdout\n if format != 'graphviz':\n raise 'Unsupported Export Format.'\n fh.write('graph G {\\n')\n fh.write(' graph [ dpi = 300 bgcolor=\"transparent\" rankdir=\"LR\"];\\n')\n edges = set()\n for node in self.nodes:\n if isinstance(node, FactorNode):\n fh.write(' %s [ shape=\"rectangle\" color=\"red\"];\\n' % node.name)\n else:\n fh.write(' %s [ shape=\"ellipse\" color=\"blue\"];\\n' % node.name)\n for node in self.nodes:\n for neighbour in node.neighbours:\n edge = [node.name, neighbour.name]\n edge = tuple(sorted(edge))\n edges.add(edge)\n for source, target in edges:\n fh.write(' %s -- %s;\\n' % (source, target))\n fh.write('}\\n')", "metadata": "root.FactorGraph.export", "header": "['class', 'FactorGraph', '(', 'object', ')', ':', '___EOS___']", "index": 1107 }, { "content": "def build_graph(*args, **kwds):\n '''\n Automatically create all the\n variable and factor nodes\n using only function definitions.\n Since its cumbersome to supply\n the domains for variable nodes\n via the factor domains perhaps\n we should allow a domains dict?\n '''\n # Lets start off identifying all the\n # variables by introspecting the\n # functions.\n variables = set()\n domains = kwds.get('domains', {})\n name = kwds.get('name')\n variable_nodes = dict()\n factor_nodes = []\n if isinstance(args[0], list):\n # Assume the functions were all\n # passed in a list in the first\n # argument. This makes it possible\n # to build very large graphs with\n # more than 255 functions.\n args = args[0]\n for factor in args:\n factor_args = get_args(factor)\n variables.update(factor_args)\n factor_node = FactorNode(factor.__name__, factor)\n #factor_node.func.domains = domains\n # Bit of a hack for now we should actually exclude variables that\n # are not parameters of this function\n factor_nodes.append(factor_node)\n for variable in variables:\n node = VariableNode(\n variable,\n domain=domains.get(variable, [True, False]))\n variable_nodes[variable] = node\n # Now we have to connect each factor node\n # to its variable nodes\n for factor_node in factor_nodes:\n factor_args = get_args(factor_node.func)\n connect(factor_node, [variable_nodes[x] for x in factor_args])\n graph = FactorGraph(variable_nodes.values() + factor_nodes, name=name)\n #print domains\n return graph", "metadata": "root.build_graph", "header": "['module', '___EOS___']", "index": 1133 } ]
[ { "span": "import csv", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 }, { "span": "import inspect", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 14 }, { "span": "import sqlite3", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'''", "Impl", "ement", "s", " ", "Sum", "-", "Product", " ", "Algorit", "hm", " ", "and", " ", "Sampl", "ing", " ", "over", " ", "Factor", " ", "Graph", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "inspect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "product_", "as_", "iter", "\\u", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Queue_", "import_", "Queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sqlite3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pretty", "table_", "import_", "Pret", "ty", "Table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "bayes", "ian_", "._", "persist", "ance_", "import_", "Sampl", "e", "DB_", ",_", "ensure", "\\u", "data\\u", "dir\\u", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bayes", "ian_", "._", "exceptions_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bayes", "ian_", "._", "utils_", "import_", "get", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GREEN_", "=_", "'\\\\", "033", "[", "9", "2m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "NORMAL_", "=_", "'\\\\", "033", "[", "0", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "is", "\\u", "leaf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "neighbours_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send_", "(_", "self_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recipient_", "=_", "message_", "._", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'%", "s", " ", "---", ">", " ", "%", "s", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "name_", ",_", "recipient_", "._", "name_", ")_", ",_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recipient_", "._", "receive", "d\\u", "messages_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "name_", "]_", "=_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sent", "\\u", "messages_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sent", "\\u", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neighbour", "_", "in_", "self_", "._", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "neighbour", "_", "._", "receive", "d\\u", "messages_", "._", "get_", "(_", "self_", "._", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sent", "\\u", "messages_", "[_", "neighbour", "_", "._", "name_", "]_", "=_", "neighbour", "_", "._", "receive", "d\\u", "messages_", "._", "get_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sent", "\\u", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "message", "\\u", "report_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "out", " ", "all", " ", "message", "s", " ", "Node", "\\", "10", ";", " ", " ", " ", " ", "currentl", "y", " ", "has", " ", "receive", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-------", "--------------", "---------", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Messag", "es", " ", "at", " ", "Node", " ", "%", "s", "'_", "%_", "self_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-------", "--------------", "---------", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "self_", "._", "receive", "d\\u", "messages_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'%", "s", " ", "<-", "-", " ", "Arg", "spec", ":", "%", "s", "'_", "%_", "(_", "v_", "._", "source_", "._", "name_", ",_", "v_", "._", "argspec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "._", "list", "\\u", "factors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'--'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "target_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "node", " ", "can", " ", "only", " ", "send", " ", "to", " ", "a", " ", "neighbour", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "has", " ", "not", " ", "alr", "ead", "y", " ", "sent", " ", "to", " ", "tha", "t", " ", "neighbour", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "it", " ", "has", " ", "receive", "d", " ", "message", "s", " ", "from", " ", "all", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "neighbour", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbours_", "=_", "self_", "._", "neighbours_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "len", "(", "neighbour", "s", ")", " ", "-", " ", "len", "(", "self", ".", "receive", "d\\u", "message", "s", ")", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "need", "ed", "\\u", "to", "\\u", "send_", "=_", "defaultdict_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "target_", "in_", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "need", "ed", "\\u", "to", "\\u", "send_", "[_", "target_", "]_", "=_", "len_", "(_", "neighbours_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "\\u_", ",_", "message_", "in_", "self_", "._", "receive", "d\\u", "messages_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "target_", "in_", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "message_", "._", "source_", "!=_", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "need", "ed", "\\u", "to", "\\u", "send_", "[_", "target_", "]_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "need", "ed", "\\u", "to", "\\u", "send_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "v_", "==_", "0_", "and_", "not_", "self_", "._", "name_", "in_", "k_", "._", "receive", "d\\u", "messages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Node_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "neighbour", "\\u", "by", "\\u", "name_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "self_", "._", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "name_", "==_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "domain_", "=_", "[_", "True_", ",_", "False_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "domain_", "=_", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "neighbours_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "receive", "d\\u", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "construct", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "self_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "make", "\\u", "variab", "le", "\\u", "node", "\\u", "message_", "(_", "self_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "Varia", "ble", "Node", ":", " ", "%", "s", ":", "%", "s", ">'_", "%_", "(_", "self_", "._", "name_", ",_", "self_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "marginal", "_", "(_", "self_", ",_", "val_", ",_", "normalizer", "_", "=_", "1.0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "marginal", " ", "function", " ", "in", " ", "a", " ", "Varia", "ble", "\\", "10", ";", " ", " ", " ", " ", "Node", " ", "is", " ", "the", " ", "product", " ", "of", " ", "all", " ", "inco", "ming", "\\", "10", ";", " ", " ", " ", " ", "message", "s", ".", " ", "The", "se", " ", "shou", "ld", " ", "all", " ", "be", " ", "function", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "this", " ", "nodes", " ", "variab", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "any", " ", "of", " ", "the", " ", "variab", "les", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "network", " ", "are", " ", "constrained", " ", "we", " ", "need", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "normali", "ze", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", ",_", "message_", "in_", "self_", "._", "receive", "d\\u", "messages_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "*=_", "message_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "product_", "/_", "normalizer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "receive", "d\\u", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "\\u", "neighbour", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "tha", "t", " ", "all", " ", "neighbour", "s", " ", "are", " ", "of", " ", "Varia", "ble", "Node", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "func_", ",_", "neighbours_", "=_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "neighbours_", "=_", "neighbours_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "receive", "d\\u", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "._", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "d\\u", "functions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "construct", "\\u", "message_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "self_", "._", "get", "\\u", "target_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "make", "\\u", "factor", "\\u", "node", "\\u", "message_", "(_", "self_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "\\u", "neighbour", "\\u", "types_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "tha", "t", " ", "all", " ", "neighbour", "s", " ", "are", " ", "of", " ", "Varia", "ble", "Node", " ", "type", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "node_", ",_", "Varia", "ble", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "Factor", "Node", " ", "%", "s", " ", "%", "s", "(%", "s", ")>", "'_", "%_", "(_", "self_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "func_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "args_", "(_", "self_", "._", "func_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "marginal", "_", "(_", "self_", ",_", "val", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Joint", " ", "marginal", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "neighbour", " ", "variab", "les", " ", "of", " ", "a", " ", "factor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "node", " ", "is", " ", "give", "n", " ", "by", " ", "the", " ", "product_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "inco", "ming", " ", "message", "s", " ", "and", " ", "the", " ", "factor_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "product_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbours_", "=_", "self_", "._", "neighbours_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neighbour", "_", "in_", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "self_", "._", "receive", "d\\u", "messages_", "[_", "neighbour", "_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "get", "\\u", "args_", "(_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "._", "append_", "(_", "val", "\\u", "dict_", "[_", "arg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "call", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "._", "append_", "(_", "'", "dummy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product_", "*=_", "message_", "(_", "*_", "call", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Final", "ly", " ", "we", " ", "als", "o", " ", "need", " ", "to", " ", "multiply_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "the", " ", "factor", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "get", "\\u", "args_", "(_", "self_", "._", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "._", "append_", "(_", "val", "\\u", "dict_", "[_", "arg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "call", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "._", "append_", "(_", "'", "dummy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product_", "*=_", "self_", "._", "func_", "(_", "*_", "call", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "evidence_", "(_", "self_", ",_", "node_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Her", "e", " ", "we", " ", "modif", "y", " ", "the", " ", "factor", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "return", " ", "0", " ", "whe", "neve", "r", " ", "it", " ", "is", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "the", " ", "observe", "d", " ", "variab", "le", " ", "hav", "ing", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "value", " ", "other", " ", "than", " ", "the", " ", "observe", "d", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "get", "\\u", "args_", "(_", "self_", "._", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "args_", "._", "index_", "(_", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "the", " ", "old", " ", "func", " ", "so", " ", "tha", "t", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "can", " ", "remove", " ", "the", " ", "eviden", "ce", " ", "later_", "\\u\\u\\uNL\\u\\u\\u_", "old", "\\u", "func_", "=_", "self_", "._", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "d\\u", "functions_", "._", "insert_", "(_", "0_", ",_", "old", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "eviden", "ce", "\\u", "func_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "[_", "pos_", "]_", "!=_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "old", "\\u", "func_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eviden", "ce", "\\u", "func_", "._", "argspec_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eviden", "ce", "\\u", "func_", "._", "domains_", "=_", "old", "\\u", "func_", "._", "domains_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "eviden", "ce", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "receive", "d\\u", "messages_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "cache", "d\\u", "functions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "func_", "=_", "self_", "._", "cache", "d\\u", "functions_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache", "d\\u", "functions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "list", "\\u", "factors_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'-------", "--------------", "------", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Factor", "s", " ", "in", " ", "message", " ", "%", "s", " ", "->", " ", "%", "s", "'_", "%_", "(_", "self_", "._", "source_", "._", "name_", ",_", "self_", "._", "destination_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'-------", "--------------", "------", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "factor_", "in_", "self_", "._", "factors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Evaluate", " ", "the", " ", "message", " ", "as", " ", "a", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "getattr_", "(_", "self_", "._", "func_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "None_", ")_", "==_", "'", "unity", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "not_", "isinstance_", "(_", "var_", ",_", "Varia", "ble", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "check", " ", "tha", "t", " ", "the", " ", "name", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "le", " ", "matche", "s", " ", "the", " ", "args", "pec", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "var", ".", "name", " ", "==", " ", "self", ".", "args", "pec", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "func_", "(_", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Varia", "ble", "Message_", "(_", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Message_", "(_", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "source_", ",_", "destination_", ",_", "factors_", ",_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "destination_", "=_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factors_", "=_", "factors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "argspec_", "=_", "get", "\\u", "args_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Varia", "ble", "Message_", "(_", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "V", "-", "Messag", "e", " ", "from", " ", "%", "s", " ", "->", " ", "%", "s", ":", " ", "%", "s", " ", "factor", "s", " ", "(%", "s", ")>", "'_", "%_", "(_", "self_", "._", "source_", "._", "name_", ",_", "self_", "._", "destination_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "self_", "._", "factors_", ")_", ",_", "self_", "._", "argspec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Factor", "Message_", "(_", "Message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Message_", "(_", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "source_", ",_", "destination_", ",_", "factors_", ",_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "source_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "destination_", "=_", "destination_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factors_", "=_", "factors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "func_", "=_", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "argspec_", "=_", "get", "\\u", "args_", "(_", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "domains_", "=_", "func_", "._", "domains_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Message_", "(_", "Message_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "repr\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "F", "-", "Messag", "e", " ", "%", "s", " ", "->", " ", "%", "s", ":", " ", "~", "(%", "s", ")", " ", "%", "s", " ", "factor", "s", ".", ">'_", "%_", "(_", "self_", "._", "source_", "._", "name_", ",_", "self_", "._", "destination_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "argspec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "self_", "._", "factors_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Make", " ", "an", " ", "edge", " ", "bet", "ween", " ", "two", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "bet", "ween", " ", "a", " ", "source", " ", "and", " ", "sever", "al", "\\", "10", ";", " ", " ", " ", " ", "neighbour", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "b_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "[_", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "b", "\\u_", "in_", "b_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "._", "neighbours_", "._", "append_", "(_", "b", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b", "\\u_", "._", "neighbours_", "._", "append_", "(_", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "eliminat", "e\\u", "var_", "(_", "f_", ",_", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "function", " ", "f", " ", "return", " ", "a", " ", "new", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "whi", "ch", " ", "sums", " ", "over", " ", "the", " ", "variab", "le", "\\", "10", ";", " ", " ", " ", " ", "we", " ", "want", " ", "to", " ", "eliminat", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "may", " ", "be", " ", "where", " ", "we", " ", "have", " ", "the", " ", "opportunit", "y", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "remove", " ", "the", " ", "use", " ", "of", " ", ".", "value", "....", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "\\u", "spec_", "=_", "get", "\\u", "args_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "arg", "\\u", "spec_", "._", "index_", "(_", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "spec_", "=_", "arg", "\\u", "spec_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "spec_", "._", "remove_", "(_", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Let", "s", " ", "say", " ", "the", " ", "org", "inal", " ", "args", "pec", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "('", "a", "',", " ", "'", "b", "',", " ", "'", "c", "',", " ", "'", "d", "')", " ", "and", " ", "the", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "all", " ", "Boo", "lean", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "lets", " ", "say", " ", "we", " ", "want", " ", "to", " ", "eliminat", "e", " ", "c_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "means", " ", "we", " ", "want", " ", "to", " ", "sum", " ", "over_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "f", "(", "a", ",", " ", "b", ",", " ", "Tru", "e", ",", " ", "d", ")", " ", "and", " ", "f", "(", "a", ",", " ", "b", ",", " ", "Fal", "se", ",", " ", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", "ms", " ", "like", " ", "all", " ", "we", " ", "have", " ", "to", " ", "do", " ", "is", " ", "know", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "position", "n", " ", "of", " ", "c", " ", "and", " ", "tha", "ts", " ", "it", "???", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ok", " ", "so", " ", "its", " ", "not", " ", "as", " ", "simple", " ", "as", " ", "tha", "t", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "bec", "aus", "e", " ", "whe", "n", " ", "the", " ", "*", "call", "*", " ", "is", " ", "made", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "eliminat", "ed", " ", "function", ",", " ", "as", " ", "oppo", "sed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "whe", "n", " ", "its", " ", "bui", "lt", " ", "then", " ", "its", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", "ed", " ", "with", " ", "('", "a", "',", " ", "'", "b", "',", " ", "'", "d", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "eliminat", "ed", "\\u", "pos_", "=_", "arg", "\\u", "spec_", "._", "index_", "(_", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "eliminat", "ed_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "arg", "\\u", "spec_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "call", "\\u", "args_", "=_", "template_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "To", " ", "be", " ", "able", " ", "to", " ", "remove", " ", ".", "value", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "need", " ", "to", " ", "als", "o", " ", "be", " ", "able", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", ".", "name", " ", "in", " ", "fact", " ", ".", "value", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "a", " ", "side", " ", "effect", " ", "of", " ", "hav", "ing", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "rely", " ", "on", " ", ".", "name", ".", " ", "Thi", "s", " ", "means", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "probab", "ly", " ", "need", " ", "to", " ", "construct", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "list", " ", "contain", "ing", " ", "the", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "args", " ", "based", " ", "on", " ", "the", " ", "position_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "are", " ", "bei", "ng", " ", "call", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "eliminat", "ed", "\\u", "pos_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "increment", " ", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "onc", "e", " ", "more", " ", "to", " ", "skip", " ", "over_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "variab", "le", " ", "bei", "ng", " ", "marginal", "ized_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "[_", "i_", "]_", "=_", "'", "marginal", "ize", " ", "me", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "call", "\\u", "args_", "[_", "i_", "]_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "val_", "in_", "f_", "._", "domains_", "[_", "var_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "v", " ", "=", " ", "Varia", "ble", "Node", "(", "name", "=", "var", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "v", ".", "value", " ", "=", " ", "val_", "\\u\\u\\uNL\\u\\u\\u_", "#", "call", "\\u", "args", "[", "pos", "]", " ", "=", " ", "v_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "call", "\\u", "args_", "[_", "pos_", "]_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "+=_", "f_", "(_", "*_", "call", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "eliminat", "ed_", "._", "argspec_", "=_", "new", "\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eliminat", "ed_", "._", "domains_", "=_", "f_", "._", "domains_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "eliminat", "ed", ".\\u", "\\u", "name", "\\u\\u", " ", "=", " ", "f", ".\\u", "\\u", "name\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "eliminat", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "memoize_", "(_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "goal", " ", "of", " ", "message", " ", "passi", "ng", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "to", " ", "re", "-", "use", " ", "results", ".", " ", "Thi", "s", "\\", "10", ";", " ", " ", " ", " ", "memo", "ise", " ", "is", " ", "slight", "ly", " ", "modifi", "ed", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "usual", " ", "example", "s", " ", "in", " ", "tha", "t", " ", "it", " ", "cache", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "values", " ", "of", " ", "variab", "les", " ", "rat", "her", " ", "than", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "variab", "les", " ", "them", "sel", "ves", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "memoized", "_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "arg", "\\u", "vals", " ", "=", " ", "tuple", "([", "arg", ".", "value", " ", "for", " ", "arg", " ", "in", " ", "args", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "vals_", "=_", "tuple_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "arg", "\\u", "vals_", "in_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "arg", "\\u", "vals_", "]_", "=_", "f_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cache_", "[_", "arg", "\\u", "vals_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", ",_", "'", "domains", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "memoized", "_", "._", "domains_", "=_", "f_", "._", "domains_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "f_", ",_", "'", "args", "pec", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "memoized", "_", "._", "argspec_", "=_", "f_", "._", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "memoized", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "not", "\\u", "sum", "\\u", "func_", "(_", "product", "\\u", "func_", ",_", "keep", "\\u", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "function", " ", "with", " ", "some", " ", "set", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", ",", " ", "and", " ", "a", " ", "single", " ", "argu", "ment", " ", "to", " ", "keep", ",", "\\", "10", ";", " ", " ", " ", " ", "construct", " ", "a", " ", "new", " ", "function", " ", "only", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "keep", "\\u", "var", ",", " ", "summarize", "d", " ", "over", " ", "all", " ", "the", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "variab", "les", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "this", " ", "branch", " ", "we", " ", "are", " ", "try", "ing", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "rid", " ", "of", " ", "the", " ", "require", "ment", " ", "to", " ", "have", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "use", " ", ".", "value", " ", "on", " ", "argu", "ment", "s", "....", "\\", "10", ";", " ", " ", " ", " ", "Look", "s", " ", "like", " ", "its", " ", "actual", "ly", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "eliminat", "e", " ", "var", "...", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "get", "\\u", "args_", "(_", "product", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "func_", "=_", "copy_", "._", "deepcopy_", "(_", "product", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "!=_", "keep", "\\u", "var_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "func_", "=_", "eliminat", "e\\u", "var_", "(_", "new", "\\u", "func_", ",_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "func_", "=_", "memoize_", "(_", "new", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "new", "\\u", "func_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "factor", "\\u", "node", "\\u", "message_", "(_", "node_", ",_", "target", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "rule", "s", " ", "for", " ", "a", " ", "factor", " ", "node", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "take", " ", "the", " ", "product", " ", "of", " ", "all", " ", "the", " ", "inco", "ming", "\\", "10", ";", " ", " ", " ", " ", "message", "s", " ", "(", "except", " ", "for", " ", "the", " ", "destinat", "ion", "\\", "10", ";", " ", " ", " ", " ", "node", ")", " ", "and", " ", "then", " ", "take", " ", "the", " ", "sum", " ", "over", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "the", " ", "variab", "les", " ", "except", " ", "for", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "destinat", "ion", " ", "variab", "le", ".", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "def", " ", "f", "(", "x1", ",", " ", "x2", ",", " ", "x3", "):", " ", "pass", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "node", " ", "=", " ", "object", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "node", ".", "func", " ", "=", " ", "f", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "target", "\\u", "node", " ", "=", " ", "object", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "target", "\\u", "node", ".", "name", " ", "=", " ", "'", "x2", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "make", "\\u", "factor", "\\u", "node", "\\u", "message", "(", "node", ",", " ", "target", "\\u", "node", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "node_", "._", "is", "\\u", "leaf_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "not", "\\u", "sum", "\\u", "func_", "=_", "make", "\\u", "not", "\\u", "sum", "\\u", "func_", "(_", "node_", "._", "func_", ",_", "target", "\\u", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "Factor", "Message_", "(_", "node_", ",_", "target", "\\u", "node_", ",_", "[_", "node_", "._", "func_", "]_", ",_", "not", "\\u", "sum", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "set_", "(_", "get", "\\u", "args_", "(_", "node_", "._", "func_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compil", "e", " ", "list", " ", "of", " ", "factor", "s", " ", "for", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "factors_", "=_", "[_", "node_", "._", "func_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "add", " ", "the", " ", "message", " ", "tha", "t", " ", "came", " ", "from", " ", "each_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "non", "-", "destinat", "ion", " ", "neighbour", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "neighbours_", "=_", "node_", "._", "neighbours_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neighbour", "_", "in_", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "neighbour", "_", "==_", "target", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Whe", "n", " ", "we", " ", "pass", " ", "on", " ", "a", " ", "message", ",", " ", "we", " ", "unwrap", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "original", " ", "payload", " ", "and", " ", "wrap", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "new", " ", "header", "s", ",", " ", "this", " ", "is", " ", "pure", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "verify", " ", "the", " ", "procedure", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "according", " ", "to", " ", "usual", " ", "nome", "ncla", "ture_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "message_", "=_", "node_", "._", "receive", "d\\u", "messages_", "[_", "neighbour", "_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "\\u", "message_", "._", "destination_", "!=_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "message_", "=_", "Varia", "ble", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "neighbour", "_", ",_", "node_", ",_", "in", "\\u", "message_", "._", "factors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "message_", "._", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "\\u", "message_", "._", "argspec_", "=_", "in", "\\u", "message_", "._", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "\\u", "message_", "=_", "in", "\\u", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factors_", "._", "append_", "(_", "out", "\\u", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product", "\\u", "func_", "=_", "make", "\\u", "product", "\\u", "func_", "(_", "factors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "not", "\\u", "sum", "\\u", "func_", "=_", "make", "\\u", "not", "\\u", "sum", "\\u", "func_", "(_", "product", "\\u", "func_", ",_", "target", "\\u", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "Factor", "Message_", "(_", "node_", ",_", "target", "\\u", "node_", ",_", "factors_", ",_", "not", "\\u", "sum", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "variab", "le", "\\u", "node", "\\u", "message_", "(_", "node_", ",_", "target", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "construct", " ", "the", " ", "message", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "variab", "le", " ", "node", " ", "to", " ", "a", " ", "factor", "\\", "10", ";", " ", " ", " ", " ", "node", " ", "we", " ", "take", " ", "the", " ", "product", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "message", "s", " ", "receive", "d", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "neighbour", "s", " ", "except", " ", "for", " ", "any", "\\", "10", ";", " ", " ", " ", " ", "message", " ", "receive", "d", " ", "from", " ", "the", " ", "target", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "source", " ", "node", " ", "is", " ", "a", " ", "leaf", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "send", " ", "the", " ", "unity", " ", "function", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "._", "is", "\\u", "leaf_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "Varia", "ble", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "node_", ",_", "target", "\\u", "node_", ",_", "[_", "1_", "]_", ",_", "unity", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbours_", "=_", "node_", "._", "neighbours_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "neighbour", "_", "in_", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "neighbour", "_", "==_", "target", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "factors_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "receive", "d\\u", "messages_", "[_", "neighbour", "_", "._", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product", "\\u", "func_", "=_", "make", "\\u", "product", "\\u", "func_", "(_", "factors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "Varia", "ble", "Message_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "node_", ",_", "target", "\\u", "node_", ",_", "factors_", ",_", "product", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "product", "\\u", "func_", "(_", "factors_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "single", " ", "calla", "ble", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "list", " ", "of", " ", "factor", "s", " ", "whi", "ch", " ", "correct", "ly", "\\", "10", ";", " ", " ", " ", " ", "appli", "es", " ", "the", " ", "argu", "ment", "s", " ", "to", " ", "each", "\\", "10", ";", " ", " ", " ", " ", "individual", " ", "factor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "chall", "enge", " ", "here", " ", "is", " ", "to", " ", "return", " ", "a", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "who", "se", " ", "argu", "ment", " ", "list", " ", "we", " ", "know", " ", "and", " ", "ensure", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "whe", "n", " ", "this", " ", "function", " ", "is", " ", "call", "ed", ",", " ", "its", " ", "alw", "ay", "s", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "with", " ", "the", " ", "correct", " ", "argu", "ment", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Sin", "ce", " ", "the", " ", "correct", " ", "args", "pec", " ", "is", " ", "attache", "d", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "bui", "lt", " ", "function", " ", "it", " ", "see", "ms", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "shou", "ld", " ", "be", " ", "up", " ", "to", " ", "the", " ", "caller", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "get", " ", "the", " ", "argu", "ment", " ", "list", " ", "correct", ".", "\\", "10", ";", " ", " ", " ", " ", "So", " ", "we", " ", "need", " ", "to", " ", "dete", "rmin", "e", " ", "whe", "n", " ", "and", " ", "where", " ", "its", " ", "call", "ed", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "map_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domains_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "factor_", "in_", "factors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "factor", " ", "==", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "map_", "[_", "factor_", "]_", "=_", "get", "\\u", "args_", "(_", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "args_", "+=_", "args", "\\u", "map_", "[_", "factor_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "factor_", ",_", "'", "domains", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domains_", "._", "update_", "(_", "factor_", "._", "domains_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "list_", "(_", "set_", "(_", "all", "\\u", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Per", "hap", "s", " ", "if", " ", "we", " ", "sort", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "product", "\\u", "func_", "(_", "*_", "product", "\\u", "func", "\\u", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "import", " ", "pytest", ";", " ", "pytest", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "arg", "\\u", "dict", " ", "=", " ", "dict", "([(", "a", ".", "name", ",", " ", "a", ")", " ", "for", " ", "a", " ", "in", " ", "product", "\\u", "func", "\\u", "args", "])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "dict_", "=_", "dict_", "(_", "zip_", "(_", "args_", ",_", "product", "\\u", "func", "\\u", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "import", " ", "pytest", ";", " ", "pytest", ".", "set\\u", "trace", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "factor_", "in_", "factors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "domains", ".", "update", "(", "factor", ".", "domains", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "build", " ", "the", " ", "correct", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "list", " ", "to", " ", "call", " ", "this", " ", "factor", " ", "with", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factor", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "get", "\\u", "args_", "(_", "factor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "in_", "arg", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "factor", "\\u", "args_", "._", "append_", "(_", "arg", "\\u", "dict_", "[_", "arg_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "factor", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "we", " ", "alw", "ay", "s", " ", "require_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "leas", "t", " ", "one", " ", "argu", "ment", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "a", " ", "dummy", " ", "argument_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "tha", "t", " ", "the", " ", "unity", " ", "function", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factor", "\\u", "args_", "._", "append_", "(_", "'", "dummy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "*=_", "factor_", "(_", "*_", "factor", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "product", "\\u", "func_", "._", "argspec_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "func_", "._", "factors_", "=_", "factors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "func_", "._", "domains_", "=_", "domains_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "memoize_", "(_", "product", "\\u", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "unity", "_", "(_", "argspec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "unity", "_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unity", "_", "._", "argspec_", "=_", "argspec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unity", "_", "._", "\\u\\u", "name\\u\\u_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "unity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unity", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "\\u", "args_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dict", "\\u", "to", "\\u", "tuples_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "a", " ", "dict", " ", "who", "se", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "lists", " ", "to", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "tuple", "s", " ", "of", " ", "the", " ", "key", " ", "with", "\\", "10", ";", " ", " ", " ", " ", "each", " ", "of", " ", "the", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "vals_", "in_", "d_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "retval_", "._", "append_", "(_", "[_", "(_", "k_", ",_", "v_", ")_", "for_", "v_", "in_", "vals_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "expand", "\\u", "parameters_", "(_", "arg", "\\u", "vals_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "list", " ", "of", " ", "args", " ", "and", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "a", " ", "list", " ", "of", " ", "tuple", "s", "\\", "10", ";", " ", " ", " ", " ", "contain", "ing", " ", "all", " ", "possib", "le", " ", "sequence", "s", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "length", " ", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "\\u", "tuples_", "=_", "dict", "\\u", "to", "\\u", "tuples_", "(_", "arg", "\\u", "vals_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "dict_", "(_", "args_", ")_", "for_", "args_", "in_", "iter", "\\u", "product_", "(_", "*_", "arg", "\\u", "tuples_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "evidence_", "(_", "node_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Set", " ", "a", " ", "variab", "le", " ", "node", " ", "to", " ", "an", " ", "observe", "d", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "for", " ", "now", " ", "this", " ", "is", " ", "achieve", "d", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "modif", "ying", " ", "the", " ", "factor", " ", "function", "s", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "this", " ", "node", " ", "is", " ", "connect", "ed", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "updat", "ing", " ", "the", " ", "factor", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "we", " ", "need", " ", "to", " ", "re", "-", "run", " ", "the", " ", "sum", "-", "product", "\\", "10", ";", " ", " ", " ", " ", "algo", "rit", "hm", ".", " ", "We", " ", "als", "o", " ", "need", " ", "to", " ", "normali", "ze", "\\", "10", ";", " ", " ", " ", " ", "all", " ", "marginal", " ", "outcomes", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "neighbours_", "=_", "node_", "._", "neighbours_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "factor", "\\u", "node_", "in_", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "name_", "in_", "get", "\\u", "args_", "(_", "factor", "\\u", "node_", "._", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factor", "\\u", "node_", "._", "add", "\\u", "evidence_", "(_", "node_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "discove", "r", "\\u", "sample", "\\u", "ordering_", "(_", "graph_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Tr", "y", " ", "to", " ", "get", " ", "the", " ", "order", " ", "of", " ", "variab", "le", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "samp", "ling", ".", " ", "Thi", "s", " ", "wou", "ld", " ", "be", " ", "easi", "er", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "underl", "ying", " ", "BB", "N", " ", "but", " ", "lets", " ", "try", " ", "on", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "factor", " ", "graph", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iterations_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pmf", "\\u", "ordering_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account", "ed", "\\u", "for_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "nodes_", "=_", "[_", "n_", "for_", "n_", "in_", "graph_", "._", "nodes_", "if_", "isinstance_", "(_", "n_", ",_", "Varia", "ble", "Node_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factor", "\\u", "nodes_", "=_", "[_", "n_", "for_", "n_", "in_", "graph_", "._", "nodes_", "if_", "isinstance_", "(_", "n_", ",_", "Factor", "Node_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "required_", "=_", "len_", "(_", "[_", "n_", "for_", "n_", "in_", "graph_", "._", "nodes_", "if_", "isinstance_", "(_", "n_", ",_", "Varia", "ble", "Node_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", "ly", " ", "any", " ", "leaf", " ", "factor", " ", "nodes", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "definit", "ion", " ", "only", " ", "have", " ", "one", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "node", " ", "connecti", "on", ",", " ", "there", "fore", " ", "these", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "les", " ", "can", " ", "be", " ", "set", " ", "first", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "graph_", "._", "get", "\\u", "leaves_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ordering_", "._", "append_", "(_", "node_", "._", "neighbours_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account", "ed", "\\u", "for_", "._", "add_", "(_", "node_", "._", "neighbours_", "[_", "0_", "]_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pmf", "\\u", "ordering_", "._", "append_", "(_", "node_", "._", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "for", " ", "each", " ", "factor", " ", "node", " ", "who", "se", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "but", " ", "one", " ", "are", " ", "alr", "ead", "y", " ", "in", " ", "the", " ", "orderi", "ng", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "can", " ", "add", " ", "tha", "t", " ", "one", " ", "variab", "le", ".", " ", "Thi", "s", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "actual", "l_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "len_", "(_", "ordering_", ")_", "<_", "required_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "factor", "\\u", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "set_", "(_", "get", "\\u", "args_", "(_", "node_", "._", "func_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "args_", "=_", "args_", "._", "difference_", "(_", "account", "ed", "\\u", "for_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "new", "\\u", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "name_", "=_", "list_", "(_", "new", "\\u", "args_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "var", "\\u", "node_", "=_", "node_", "._", "get", "\\u", "neighbour", "\\u", "by", "\\u", "name_", "(_", "arg", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "._", "append_", "(_", "var", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "account", "ed", "\\u", "for_", "._", "add_", "(_", "var", "\\u", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pmf", "\\u", "ordering_", "._", "append_", "(_", "node_", "._", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "zip_", "(_", "ordering_", ",_", "pmf", "\\u", "ordering_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sample_", "(_", "ordering_", ",_", "evidence_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "valid", " ", "orderi", "ng", ",", " ", "sample", " ", "the", " ", "network", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "dict_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "var_", ",_", "func_", "in_", "ordering_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "random_", "._", "random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "val_", "in_", "var_", "._", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "var_", "=_", "Varia", "ble", "Node_", "(_", "var_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "var_", "._", "value_", "=_", "val_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "need", " ", "to", " ", "build", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", " ", "list", " ", "out", " ", "of", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "les", " ", "alr", "ead", "y", " ", "in", " ", "the", " ", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "this", " ", "new", " ", "test", " ", "value", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "order", " ", "require", "d", " ", "by", " ", "the", " ", "function", "._", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "get", "\\u", "args_", "(_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "==_", "var_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "args", ".", "append", "(", "test\\u", "var", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "._", "append_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "args_", "._", "append_", "(_", "sample", "\\u", "dict_", "[_", "arg_", "]_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total_", "+=_", "func_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "total_", ">_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "only", " ", "want", " ", "to", " ", "use", " ", "this", " ", "sample_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "it", " ", "correspond", "s", " ", "to", " ", "the", " ", "eviden", "ce", " ", "value", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "var_", "._", "name_", "in_", "evidence_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "test\\u", "var_", "._", "value_", "==_", "evidence_", "[_", "var_", "._", "name_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sample_", "._", "append_", "(_", "test\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "dict_", "[_", "var_", "._", "name_", "]_", "=_", "test\\u", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "sample_", "._", "append_", "(_", "test\\u", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "dict_", "[_", "var_", "._", "name_", "]_", "=_", "test\\u", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "var_", "._", "name_", "in_", "sample", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Iterat", "ed", " ", "through", " ", "all", " ", "values", " ", "for", " ", "%", "s", " ", "and", " ", "%", "s", " ", "but", " ", "no", " ", "go", "...'_", "%_", "(_", "var_", "._", "name_", ",_", "func_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "see", "ms", " ", "to", " ", "mean", " ", "tha", "t", " ", "we", " ", "have", " ", "neve", "r", " ", "see", "n", " ", "this", " ", "combination_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "variab", "les", " ", "bef", "ore", ",", " ", "we", " ", "can", " ", "eit", "her", " ", "discard", " ", "it", " ", "as", " ", "irre", "lev", "ant", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "some", " ", "type", " ", "of", " ", "+", "1", " ", "smoothing", "???", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "What", " ", "if", " ", "we", " ", "just", " ", "random", "ly", " ", "select", " ", "some", " ", "value", " ", "for", " ", "var", "???", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "lets", " ", "try", " ", "tha", "t", " ", "as", " ", "it", " ", "see", "ms", " ", "the", " ", "easi", "est", "....", "_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "Inva", "lid", "Sampl", "e", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sample_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "nodes_", ",_", "name_", "=_", "None_", ",_", "n", "\\u", "samples_", "=_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "nodes_", "=_", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "infer", "ence", "\\u", "method_", "=_", "'", "sum", "product", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "divi", "ne", " ", "the", " ", "domains", " ", "for", " ", "Factor", " ", "nodes", " ", "here", "..._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "compile", " ", "a", " ", "mapping", " ", "of", " ", "factor", "s", " ", "to", " ", "variables_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "arg", " ", "spec", "..._", "\\u\\u\\uNL\\u\\u\\u_", "function", "\\u", "args_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arg", "\\u", "domains_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", ",_", "Varia", "ble", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "not", " ", "has", "attr", "(", "node", ",", " ", "'", "domain", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "node", ".", "domain", " ", "=", " ", "[", "Tru", "e", ",", " ", "Fal", "se", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arg", "\\u", "domains_", "[_", "node_", "._", "name_", "]_", "=_", "node_", "._", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function", "\\u", "args_", "[_", "node_", "._", "func_", "._", "\\u\\u", "name\\u\\u_", "]_", "=_", "get", "\\u", "args_", "(_", "node_", "._", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "if", " ", "the", " ", "domains", " ", "for", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "factor", " ", "function", "s", " ", "have", " ", "not", " ", "bee", "n", " ", "explicit", "el", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "we", " ", "create", " ", "them", " ", "based", " ", "on", " ", "the", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "values", " ", "it", " ", "can", " ", "take", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "node_", "._", "func_", ",_", "'", "domains", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "domains_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "get", "\\u", "args_", "(_", "node_", "._", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "arg_", "in_", "arg", "\\u", "domains_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "WARN", "ING", ":", " ", "missi", "ng", " ", "variab", "le", " ", "for", " ", "arg", ":", "%", "s", "'_", "%_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "domains_", "._", "update_", "(_", "{_", "arg_", ":_", "arg", "\\u", "domains_", "[_", "arg_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "._", "func_", "._", "domains_", "=_", "domains_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "n", "\\u", "samples_", "=_", "n", "\\u", "samples_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "try", " ", "to", " ", "set", " ", "the", " ", "mode", " ", "of", " ", "infer", "ence", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "cycles_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Curr", "ent", "ly", " ", "only", " ", "sampling_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "support", "ed", " ", "for", " ", "cyclic", " ", "graphs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "infer", "ence", "\\u", "method_", "=_", "'", "sample", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "sum", "product", " ", "method", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", " ", "exact", " ", "likelihood", "s", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "of", " ", "the", " ", "graph", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "no", " ", "cycle", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "infer", "ence", "\\u", "method_", "=_", "'", "sum", "product", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Fail", "ed", " ", "to", " ", "dete", "rmin", "e", " ", "if", " ", "graph", " ", "has", " ", "cycle", "s", ",", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "'", "setti", "ng", " ", "infer", "ence", " ", "to", " ", "sample", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "infer", "ence", "\\u", "method_", "=_", "'", "sample", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "enforce", "\\u", "minim", "um", "\\u", "samples_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "infer", "ence", "\\u", "method_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "infer", "ence", "\\u", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "infer", "ence", "\\u", "method_", "._", "setter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "infer", "ence", "\\u", "method_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "value", " ", "is", " ", "bei", "ng", " ", "set", " ", "to", " ", "'", "sample", "\\u", "db", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "need", " ", "to", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "sql", "ite", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exist", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "==_", "'", "sample", "\\u", "db", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ensure", "\\u", "data\\u", "dir\\u", "exists_", "(_", "self_", "._", "sample", "\\u", "db", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "ordering_", "=_", "self_", "._", "discove", "r", "\\u", "sample", "\\u", "ordering_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domains_", "=_", "dict_", "(_", "[_", "(_", "var_", ",_", "var_", "._", "domain_", ")_", "for_", "var_", ",_", "\\u_", "in_", "sample", "\\u", "ordering_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "self_", "._", "sample", "\\u", "db", "\\u", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "new", " ", "file", " ", "so", " ", "we", " ", "need", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "initialize", " ", "the", " ", "db", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sample", "\\u", "db_", "=_", "Sampl", "e", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sample", "\\u", "db", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domains_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initialize_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sample", "\\u", "db_", "=_", "Sampl", "e", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sample", "\\u", "db", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domains_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "initialize_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "infer", "ence", "\\u", "method_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sample", "\\u", "db", "\\u", "filename_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "name", " ", "of", " ", "the", " ", "sql", "ite", " ", "sample", "\\", "10", ";", " ", " ", " ", " ", "databa", "se", " ", "for", " ", "external", " ", "sample", "\\", "10", ";", " ", " ", " ", " ", "generat", "ion", " ", "and", " ", "query", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "location", " ", "for", " ", "now", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "be", " ", "in", " ", "the", " ", "users", " ", "home", "\\", "10", ";", " ", " ", " ", " ", "director", "y", " ", "under", " ", "~", "/.", "pyp", "gm", "/", "data", "/", "[", "name", "].", "sql", "ite", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "[", "name", "]", " ", "is", " ", "the", " ", "name", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "model", ".", " ", "If", " ", "the", " ", "model", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "not", " ", "bee", "n", " ", "give", "n", " ", "an", " ", "expl", "ict", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "will", " ", "be", " ", "\"", "default", "\".\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'~'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "home_", ",_", "'.", "pyp", "gm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", ".", "sql", "ite", "'_", "%_", "(_", "self_", "._", "name_", "or_", "'", "default", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Reset", " ", "all", " ", "nodes", " ", "back", " ", "to", " ", "thei", "r", " ", "initial", " ", "state", ".", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "shou", "ld", " ", "do", " ", "this", " ", "bef", "ore", " ", "or", " ", "after", " ", "addin", "g", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "remo", "ving", " ", "eviden", "ce", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "cycles_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "if", " ", "the", " ", "graph", " ", "has", " ", "cycle", "s", " ", "or", " ", "not", ".", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "will", " ", "do", " ", "this", " ", "by", " ", "trav", "ersi", "ng", " ", "startin", "g", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "any", " ", "leaf", " ", "node", " ", "and", " ", "record", "ing", "\\", "10", ";", " ", " ", " ", " ", "bot", "h", " ", "the", " ", "edge", "s", " ", "traverse", "d", " ", "and", " ", "the", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "discovere", "d", ".", " ", "Fro", "m", " ", "stack", "overflow", ",", " ", "if", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "une", "xpl", "ored", " ", "edge", " ", "leads", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "previ", "ously", " ", "found", " ", "node", " ", "then", " ", "it", " ", "has", "\\", "10", ";", " ", " ", " ", " ", "cycle", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "discovere", "d\\u", "nodes_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traverse", "d\\u", "edges_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "is", "\\u", "leaf_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "node_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", "._", "put_", "(_", "start", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "q_", "._", "empty_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "node_", "=_", "q_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Curr", "ent", " ", "Node", ":", " ", "\"_", ",_", "current", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Discover", "ed", " ", "Node", "s", " ", "bef", "ore", " ", "addin", "g", " ", "Curr", "ent", " ", "Node", ":", " ", "\"_", ",_", "discovere", "d\\u", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "current", "\\u", "node_", "._", "name_", "in_", "discovere", "d\\u", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "a", " ", "cycle", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'", "Deq", "ueue", "d", " ", "node", " ", "alr", "ead", "y", " ", "process", "ed", ":", " ", "%", "s", "'_", ",_", "current", "\\u", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "discovere", "d\\u", "nodes_", "._", "add_", "(_", "current", "\\u", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Discover", "ed", " ", "Node", "s", " ", "after", " ", "addin", "g", " ", "Curr", "ent", " ", "Node", ":", " ", "\"_", ",_", "discovere", "d\\u", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "neighbour", "_", "in_", "current", "\\u", "node_", "._", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge_", "=_", "[_", "current", "\\u", "node_", "._", "name_", ",_", "neighbour", "_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "this", " ", "is", " ", "undi", "rect", "ed", " ", "and", " ", "we", " ", "want_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "record", " ", "the", " ", "edge", "s", " ", "we", " ", "have", " ", "traverse", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "will", " ", "sort", " ", "the", " ", "edge", " ", "alphabetic", "ally", "_", "\\u\\u\\uNL\\u\\u\\u_", "edge_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge_", "=_", "tuple_", "(_", "edge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "edge_", "not_", "in_", "traverse", "d\\u", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "new", " ", "edge", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "neighbour", "_", "._", "name_", "in_", "discovere", "d\\u", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "place", " ", "all", " ", "neighbour", " ", "nodes", " ", "on", " ", "the", " ", "q_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "record", " ", "this", " ", "edge", " ", "as", " ", "traverse", "d_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "neighbour", "_", "._", "name_", "not_", "in_", "discovere", "d\\u", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "Enque", "uin", "g", ":", " ", "%", "s", "'_", "%_", "neighbour", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", "._", "put_", "(_", "neighbour", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "traverse", "d\\u", "edges_", "._", "add_", "(_", "edge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", " ", "sever", "al", " ", "proper", "ties", " ", "of", " ", "the", " ", "Factor", " ", "Graph", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "shou", "ld", " ", "hold", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "all", " ", "nodes", " ", "are", " ", "eit", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", "s", " ", "of", " ", "classe", "s", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Varia", "ble", "Node", " ", "or", " ", "Factor", "Node", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "is", " ", "a", " ", "very", " ", "common", " ", "error", " ", "to", " ", "instantiate", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "graph", " ", "with", " ", "the", " ", "factor", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inst", "ead", " ", "of", " ", "the", " ", "correspond", "ing", " ", "factor_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "node", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "node_", ",_", "Varia", "ble", "Node_", ")_", "and_", "not_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bases_", "=_", "node_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "bases\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "Varia", "ble", "Node_", "in_", "bases_", "and_", "not_", "Factor", "Node_", "in_", "bases_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "'", "Factor", " ", "Graph", " ", "doe", "s", " ", "not", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "support", " ", "nodes", " ", "of", " ", "type", ":", " ", "%", "s", "'_", "%_", "node_", "._", "\\u\\u", "class\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Graph", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "check", " ", "tha", "t", " ", "for", " ", "each", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "connects", " ", "to", " ", "nodes", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Check", "ing", " ", "neighbour", " ", "node", " ", "types", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "node_", "._", "verify", "\\u", "neighbour", "\\u", "types_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'%", "s", " ", "has", " ", "invalid", " ", "neighbour", " ", "type", ".'_", "%_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Check", "ing", " ", "tha", "t", " ", "all", " ", "factor", " ", "function", "s", " ", "have", " ", "domains", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "node_", "._", "func_", ",_", "'", "domains", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'%", "s", " ", "has", " ", "no", " ", "domains", ".'_", "%_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Graph", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "node_", "._", "func_", "._", "domains_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Al", "so", " ", "check", " ", "for", " ", "an", " ", "empty", " ", "domain", " ", "dict", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "'%", "s", " ", "has", " ", "empty", " ", "domains", ".'_", "%_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Graph", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Check", "ing", " ", "tha", "t", " ", "all", " ", "variab", "les", " ", "are", " ", "account", "ed", " ", "for", "'_", "+_", "'", " ", "by", " ", "at", " ", "leas", "t", " ", "one", " ", "function", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variables_", "=_", "set_", "(_", "[_", "vn_", "._", "name_", "for_", "vn_", "in_", "self_", "._", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "vn_", ",_", "Varia", "ble", "Node_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lar", "gs_", "=_", "[_", "get", "\\u", "args_", "(_", "fn_", "._", "func_", ")_", "for_", "fn_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "nodes_", "if_", "isinstance_", "(_", "fn_", ",_", "Factor", "Node_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "set_", "(_", "reduce_", "(_", "lambda_", "x_", ",_", "y_", ":_", "x_", "+_", "y_", ",_", "lar", "gs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "variables_", "._", "issubset_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "The", "se", " ", "variab", "les", " ", "are", " ", "not", " ", "used", " ", "in", " ", "any", " ", "factor", "s", " ", "nodes", ":", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "variables_", "._", "difference_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Check", "ing", " ", "tha", "t", " ", "all", " ", "argu", "ment", "s", " ", "have", " ", "matchi", "ng", " ", "variab", "le", " ", "nodes", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "args_", "._", "issubset_", "(_", "variables_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "The", "se", " ", "argu", "ment", "s", " ", "have", " ", "missi", "ng", " ", "variab", "les", ":'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "args_", "._", "difference_", "(_", "variables_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "Check", "ing", " ", "tha", "t", " ", "graph", " ", "has", " ", "at", " ", "leas", "t", " ", "one", " ", "leaf", " ", "node", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "\\u", "nodes_", "=_", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "lambda_", "x_", ":_", "x_", "._", "is", "\\u", "leaf_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "leaf", "\\u", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Graph", " ", "has", " ", "no", " ", "leaf", " ", "nodes", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Graph", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "leaves_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "node_", "for_", "node_", "in_", "self_", "._", "nodes_", "if_", "node_", "._", "is", "\\u", "leaf_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "eligible", "\\u", "sender", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "nodes", " ", "tha", "t", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "eligible", " ", "to", " ", "send", " ", "message", "s", " ", "at", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "round", ".", " ", "On", "ly", " ", "nodes", " ", "tha", "t", " ", "have", " ", "receive", "d", "\\", "10", ";", " ", " ", " ", " ", "message", "s", " ", "from", " ", "all", " ", "but", " ", "one", " ", "neighbour", "\\", "10", ";", " ", " ", " ", " ", "may", " ", "send", " ", "at", " ", "any", " ", "round", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eligible", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "get", "\\u", "target_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eligible", "_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "eligible", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "propagate_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "the", " ", "heart", " ", "of", " ", "the", " ", "sum", "-", "product", "\\", "10", ";", " ", " ", " ", " ", "Messag", "e", " ", "Passi", "ng", " ", "Algorit", "hm", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eligible", "\\u", "sender", "s_", "=_", "self_", "._", "get", "\\u", "eligible", "\\u", "sender", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "Step", ":", " ", "%", "s", " ", "%", "s", " ", "nodes", " ", "can", " ", "send", ".'", " ", "\\\\_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "%", " ", "(", "step", ",", " ", "len", "(", "eligible", "\\u", "sender", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "[", "x", ".", "name", " ", "for", " ", "x", " ", "in", " ", "eligible", "\\u", "sender", "s", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "eligible", "\\u", "sender", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "eligible", "\\u", "sender", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "node_", "._", "construct", "\\u", "message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "send_", "(_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "step_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "variab", "le", "\\u", "nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "n_", "for_", "n_", "in_", "self_", "._", "nodes_", "if_", "isinstance_", "(_", "n_", ",_", "Varia", "ble", "Node_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "factor", "\\u", "nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "n_", "for_", "n_", "in_", "self_", "._", "nodes_", "if_", "isinstance_", "(_", "n_", ",_", "Factor", "Node_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "normalizer", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "self_", "._", "variab", "le", "\\u", "nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normalizer", "_", "=_", "node_", "._", "marginal", "_", "(_", "node_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "normalizer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "status_", "(_", "self_", ",_", "omit", "_", "=_", "[_", "False_", ",_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normalizer", "_", "=_", "self_", "._", "get", "\\u", "normalizer", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "variab", "le", "\\u", "nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "value_", "in_", "node_", "._", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "node_", "._", "marginal", "_", "(_", "value_", ",_", "normalizer", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "[_", "(_", "node_", "._", "name_", ",_", "value_", ")_", "]_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "retval_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "query", "\\u", "by", "\\u", "propagat", "ion_", "(_", "self_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "kwds_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "node_", "in_", "self_", "._", "variab", "le", "\\u", "nodes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "name_", "==_", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "add", "\\u", "evidence_", "(_", "node_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "propagate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "query_", "(_", "self_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "infer", "ence", "\\u", "method_", "==_", "'", "sample", "\\u", "db", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "query", "\\u", "by", "\\u", "external", "\\u", "samples_", "(_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "infer", "ence", "\\u", "method_", "==_", "'", "sample", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "query", "\\u", "by", "\\u", "sampling_", "(_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "infer", "ence", "\\u", "method_", "==_", "'", "sum", "product", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "query", "\\u", "by", "\\u", "propagat", "ion_", "(_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Inva", "lid", "Infer", "ence", "Method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "q_", "(_", "self_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Wrapper", " ", "aro", "und", " ", "query", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "formats", " ", "the", " ", "query", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "in", " ", "a", " ", "nice", " ", "human", " ", "reada", "ble", " ", "format", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "interactive", " ", "use", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "query_", "(_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab_", "=_", "Pret", "ty", "Table_", "(_", "[_", "'", "Node", "'_", ",_", "'", "Value", "'_", ",_", "'", "Marg", "inal", "'_", "]_", ",_", "sortby", "_", "=_", "'", "Node", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab_", "._", "align_", "=_", "'", "l", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab_", "._", "align_", "[_", "'", "Marg", "inal", "'_", "]_", "=_", "'", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tab_", "._", "float", "\\u", "format_", "=_", "'%", "8.6", "f", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "node_", ",_", "value_", ")_", ",_", "prob_", "in_", "result_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kwds_", "._", "get_", "(_", "node_", ",_", "''_", ")_", "==_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab_", "._", "add", "\\u", "row_", "(_", "[_", "'%", "s", "*'_", "%_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "%", "s", "*", "%", "s", "'_", "%_", "(_", "GREEN_", ",_", "value_", ",_", "NORMAL_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "8.6", "f", "'_", "%_", "prob_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tab_", "._", "add", "\\u", "row_", "(_", "[_", "node_", ",_", "value_", ",_", "'%", "8.6", "f", "'_", "%_", "prob_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "tab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "discove", "r", "\\u", "sample", "\\u", "ordering_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "discove", "r", "\\u", "sample", "\\u", "ordering_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "sample_", "(_", "self_", ",_", "evidence_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "need", " ", "to", " ", "allow", " ", "for", " ", "setti", "ng", "\\", "10", ";", " ", " ", " ", " ", "cert", "ain", " ", "observe", "d", " ", "variab", "les", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "discard", "ing", " ", "mism", "atch", "ing", "\\", "10", ";", " ", " ", " ", " ", "samples", " ", "as", " ", "we", " ", "generat", "e", " ", "them", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'", "sample", "\\u", "orderi", "ng", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sample", "\\u", "ordering_", "=_", "self_", "._", "discove", "r", "\\u", "sample", "\\u", "ordering_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "get", "\\u", "sample_", "(_", "self_", "._", "sample", "\\u", "ordering_", ",_", "evidence_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "query", "\\u", "by", "\\u", "sampling_", "(_", "self_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counts_", "=_", "defaultdict_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "samples_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "valid", "\\u", "samples_", "<_", "self_", "._", "n", "\\u", "samples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", " ", "of", " ", "%", "s", "\"_", "%_", "(_", "valid", "\\u", "samples_", ",_", "self_", "._", "n", "\\u", "samples_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample_", "=_", "self_", "._", "get", "\\u", "sample_", "(_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "samples_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Fail", "ed", " ", "to", " ", "get", " ", "a", " ", "valid", " ", "sample", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "continui", "ng", "...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "var_", "in_", "sample_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "(_", "var_", "._", "name_", ",_", "var_", "._", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counts_", "[_", "key_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "normalize_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normalized_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "k_", ",_", "v_", "/_", "valid", "\\u", "samples_", ")_", "for_", "k_", ",_", "v_", "in_", "counts_", "._", "items_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "normalized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "samples_", "(_", "self_", ",_", "n_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Generate", " ", "and", " ", "save", " ", "samples", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "SQL", "ite", " ", "sample", " ", "db", " ", "for", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "infer", "ence", "\\u", "method_", "!=_", "'", "sample", "\\u", "db", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Inco", "rrect", "Infer", "ence", "Meth", "od", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "generat", "e\\u", "samples", "()", " ", "not", " ", "support", " ", "for", " ", "infer", "ence", " ", "method", ":", " ", "%", "s", "'_", "%_", "self_", "._", "infer", "ence", "\\u", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "valid", "\\u", "samples_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'", "sample", "\\u", "orderi", "ng", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sample", "\\u", "ordering_", "=_", "self_", "._", "discove", "r", "\\u", "sample", "\\u", "ordering_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fn_", "=_", "[_", "x_", "[_", "0_", "]_", "._", "name_", "for_", "x_", "in_", "self_", "._", "sample", "\\u", "ordering_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sdb", "_", "=_", "self_", "._", "sample", "\\u", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "valid", "\\u", "samples_", "<_", "n_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample_", "=_", "self_", "._", "get", "\\u", "sample_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Inva", "lid", "Sampl", "e", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Ne", "ed", " ", "to", " ", "figure_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "out", " ", "wh", "y", " ", "we", " ", "get", " ", "invalid_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "samples", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sdb", "_", "._", "save", "\\u", "sample_", "(_", "[_", "(_", "v_", "._", "name_", ",_", "v_", "._", "value_", ")_", "for_", "v_", "in_", "sample_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid", "\\u", "samples_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sdb", "_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'%", "s", " ", "samples", " ", "store", "d", " ", "in", " ", "%", "s", "'_", "%_", "(_", "n_", ",_", "self_", "._", "sample", "\\u", "db", "\\u", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "query", "\\u", "by", "\\u", "external", "\\u", "samples_", "(_", "self_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "counts_", "=_", "defaultdict_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "samples_", "=_", "self_", "._", "sample", "\\u", "db_", "._", "get", "\\u", "samples_", "(_", "self_", "._", "n", "\\u", "samples_", ",_", "**_", "kwds_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "samples_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "No", "Sampl", "es", "In", "DB_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "There", " ", "are", " ", "no", " ", "samples", " ", "in", " ", "the", " ", "databa", "se", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Generate", " ", "some", " ", "with", " ", "graph", ".", "generat", "e\\u", "samples", "(", "N", ").'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "samples_", ")_", "<_", "self_", "._", "n", "\\u", "samples_", "and_", "self_", "._", "enforce", "\\u", "minim", "um", "\\u", "samples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Ins", "uff", "icient", "Sampl", "es", "Exception_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "There", " ", "are", " ", "less", " ", "samples", " ", "in", " ", "the", " ", "samp", "ling", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", " ", "than", " ", "are", " ", "require", "d", " ", "by", " ", "this", " ", "graph", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ei", "ther", " ", "generat", "e", " ", "more", " ", "samples", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "graph", ".", "generat", "e\\u", "samples", "(", "N", ")", " ", "or", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "decrease", " ", "the", " ", "number", " ", "of", " ", "samples", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "require", "d", " ", "for", " ", "query", "ing", " ", "(", "graph", ".", "n", "\\u", "samples", ").", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "sample_", "in_", "samples_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "name_", ",_", "val_", "in_", "sample_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "(_", "name_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "counts_", "[_", "key_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normalized_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "k_", ",_", "v_", "/_", "len_", "(_", "samples_", ")_", ")_", "for_", "k_", ",_", "v_", "in_", "counts_", "._", "items_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "normalized_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Factor", "Graph_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export_", "(_", "self_", ",_", "filename_", "=_", "None_", ",_", "format_", "=_", "'", "graphviz", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Export", " ", "the", " ", "graph", " ", "in", " ", "Graph", "Viz", " ", "dot", " ", "language", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "open_", "(_", "filename_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "format_", "!=_", "'", "graphviz", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Unsu", "ppo", "rted", " ", "Export", " ", "Format", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fh_", "._", "write_", "(_", "'", "graph", " ", "G", " ", "{\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "write_", "(_", "'", " ", " ", "graph", " ", "[", " ", "dp", "i", " ", "=", " ", "300", " ", "bg", "color", "=\"", "transp", "arent", "\"", " ", "rank", "dir", "=\"", "LR", "\"]", ";\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", ",_", "Factor", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "write_", "(_", "'", " ", " ", "%", "s", " ", "[", " ", "shape", "=\"", "rectangle", "\"", " ", "color", "=\"", "red", "\"]", ";\\\\", "n", "'_", "%_", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "write_", "(_", "'", " ", " ", "%", "s", " ", "[", " ", "shape", "=\"", "ellips", "e", "\"", " ", "color", "=\"", "blue", "\"]", ";\\\\", "n", "'_", "%_", "node_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "neighbour", "_", "in_", "node_", "._", "neighbours_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edge_", "=_", "[_", "node_", "._", "name_", ",_", "neighbour", "_", "._", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edge_", "=_", "tuple_", "(_", "sorted_", "(_", "edge_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edges_", "._", "add_", "(_", "edge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "source_", ",_", "target_", "in_", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "write_", "(_", "'", " ", " ", "%", "s", " ", "--", " ", "%", "s", ";\\\\", "n", "'_", "%_", "(_", "source_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fh_", "._", "write_", "(_", "'}", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "\\u", "graph_", "(_", "*_", "args_", ",_", "**_", "kwds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Automat", "ical", "ly", " ", "create", " ", "all", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "variab", "le", " ", "and", " ", "factor", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "usi", "ng", " ", "only", " ", "function", " ", "definit", "ion", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Sin", "ce", " ", "its", " ", "cum", "bers", "ome", " ", "to", " ", "supply", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "domains", " ", "for", " ", "variab", "le", " ", "nodes", "\\", "10", ";", " ", " ", " ", " ", "via", " ", "the", " ", "factor", " ", "domains", " ", "per", "hap", "s", "\\", "10", ";", " ", " ", " ", " ", "we", " ", "shou", "ld", " ", "allow", " ", "a", " ", "domains", " ", "dict", "?", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Let", "s", " ", "start", " ", "off", " ", "identify", "ing", " ", "all", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "les", " ", "by", " ", "introspect", "ing", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "variables_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domains_", "=_", "kwds_", "._", "get_", "(_", "'", "domains", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "kwds_", "._", "get_", "(_", "'", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "nodes_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factor", "\\u", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "args_", "[_", "0_", "]_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Assume", " ", "the", " ", "function", "s", " ", "wer", "e", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pass", "ed", " ", "in", " ", "a", " ", "list", " ", "in", " ", "the", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "argu", "ment", ".", " ", "Thi", "s", " ", "make", "s", " ", "it", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "build", " ", "very", " ", "large", " ", "graph", "s", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "more", " ", "than", " ", "255", " ", "function", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "factor_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factor", "\\u", "args_", "=_", "get", "\\u", "args_", "(_", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variables_", "._", "update_", "(_", "factor", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factor", "\\u", "node_", "=_", "Factor", "Node_", "(_", "factor_", "._", "\\u\\u", "name\\u\\u_", ",_", "factor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "factor", "\\u", "node", ".", "func", ".", "domains", " ", "=", " ", "domains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bit", " ", "of", " ", "a", " ", "hack", " ", "for", " ", "now", " ", "we", " ", "shou", "ld", " ", "actual", "ly", " ", "exclu", "de", " ", "variab", "les", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "not", " ", "parameter", "s", " ", "of", " ", "this", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "factor", "\\u", "nodes_", "._", "append_", "(_", "factor", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "variable_", "in_", "variables_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "Varia", "ble", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "variable_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "domains_", "._", "get_", "(_", "variable_", ",_", "[_", "True_", ",_", "False_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "variab", "le", "\\u", "nodes_", "[_", "variable_", "]_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "have", " ", "to", " ", "connect", " ", "each", " ", "factor", " ", "node_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "its", " ", "variab", "le", " ", "nodes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "factor", "\\u", "node_", "in_", "factor", "\\u", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "factor", "\\u", "args_", "=_", "get", "\\u", "args_", "(_", "factor", "\\u", "node_", "._", "func_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connect_", "(_", "factor", "\\u", "node_", ",_", "[_", "variab", "le", "\\u", "nodes_", "[_", "x_", "]_", "for_", "x_", "in_", "factor", "\\u", "args_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "graph_", "=_", "Factor", "Graph_", "(_", "variab", "le", "\\u", "nodes_", "._", "values_", "(_", ")_", "+_", "factor", "\\u", "nodes_", ",_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "domains_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "graph_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
sahana/eden/modules/s3/s3xml.py
[ { "content": "## -*- coding: utf-8 -*-\n\n\"\"\" S3XML Toolkit\n\n @see: U{B{I{S3XRC}} <http://eden.sahanafoundation.org/wiki/S3XRC>}\n\n @requires: U{B{I{gluon}} <http://web2py.com>}\n @requires: U{B{I{lxml}} <http://codespeak.net/lxml>}\n\n @copyright: 2009-2016 (c) Sahana Software Foundation\n @license: MIT\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\n\nimport datetime\nimport os\nimport re\nimport sys\nimport urllib2\n\ntry:\n import json # try stdlib (Python 2.6)\nexcept ImportError:\n try:\n import simplejson as json # try external module\n except:\n import gluon.contrib.simplejson as json # fallback to pure-Python module\n\ntry:\n from lxml import etree\nexcept ImportError:\n print >> sys.stderr, \"ERROR: lxml module needed for XML handling\"\n raise\n\nfrom gluon import *\nfrom gluon.storage import Storage\n\nfrom s3codec import S3Codec\nfrom s3datetime import s3_decode_iso_datetime, s3_encode_iso_datetime, s3_utc\nfrom s3fields import S3RepresentLazy\nfrom s3utils import s3_get_foreign_key, s3_unicode, s3_strip_markup, s3_validate, s3_represent_value\n\nogetattr = object.__getattribute__\n\n# Compact JSON encoding\nSEPARATORS = (\",\", \":\")\n\n# =============================================================================\n\n# =============================================================================\n\n# End =========================================================================\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def parse(self, source):\n \"\"\"\n Parse an XML source into an element tree\n\n @param source: the XML source -\n can be a file-like object, a filename or a HTTP/HTTPS/FTP URL\n \"\"\"\n\n self.error = None\n if isinstance(source, basestring) and source[:5] == \"https\":\n try:\n source = urllib2.urlopen(source)\n except:\n pass\n try:\n parser = etree.XMLParser(no_network = False,\n remove_blank_text = True,\n )\n result = etree.parse(source, parser)\n return result\n except:\n e = sys.exc_info()[1]\n self.error = e\n return None", "metadata": "root.S3XML.parse", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 223 }, { "content": " def transform(self, tree, stylesheet_path, **args):\n \"\"\"\n Transform an element tree with XSLT\n\n @param tree: the element tree\n @param stylesheet_path: pathname of the XSLT stylesheet\n @param args: dict of arguments to pass to the stylesheet\n \"\"\"\n\n self.error = None\n\n if args:\n _args = dict((k, \"'%s'\" % args[k]) for k in args)\n else:\n _args = None\n\n if isinstance(stylesheet_path, (etree._ElementTree, etree._Element)):\n # Pre-parsed stylesheet\n stylesheet = stylesheet_path\n else:\n stylesheet = self.parse(stylesheet_path)\n\n if stylesheet is not None:\n try:\n ac = etree.XSLTAccessControl(read_file=True, read_network=True)\n transformer = etree.XSLT(stylesheet, access_control=ac)\n if _args:\n result = transformer(tree, **_args)\n else:\n result = transformer(tree)\n return result\n except:\n e = sys.exc_info()[1]\n self.error = e\n current.log.error(e)\n #output = self.tostring(tree, pretty_print=True)\n #outputFile = open(\"failed_transform.xml\", \"w\")\n #outputFile.write(output)\n #outputFile.close()\n return None\n else:\n # Error parsing the XSL stylesheet\n return None", "metadata": "root.S3XML.transform", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 249 }, { "content": " def rmap(self, table, record, fields):\n \"\"\"\n Generates a reference map for a record\n\n @param table: the database table\n @param record: the record\n @param fields: list of reference field names in this table\n \"\"\"\n\n reference_map = []\n\n DELETED = self.DELETED\n REPLACEDBY = self.REPLACEDBY\n\n if DELETED in record and record[DELETED] and \\\n REPLACEDBY in record and record[REPLACEDBY]:\n fields = [REPLACEDBY]\n #replace = True\n else:\n fields = [f for f in fields if f in record and record[f]]\n #replace = False\n\n if not fields:\n return reference_map\n\n db = current.db\n\n UID = self.UID\n MCI = self.MCI\n\n export_uid = self.export_uid\n represent = self.represent\n filter_mci = self.filter_mci\n tablename = table._tablename\n gtablename = current.auth.settings.table_group_name\n load_table = current.s3db.table\n\n for f in fields:\n\n if f == REPLACEDBY:\n val = ogetattr(record, f)\n if not val:\n continue\n row = db(table._id == val).select(table[UID],\n limitby=(0, 1)).first()\n if not row:\n continue\n else:\n uids = [export_uid(row[UID])]\n entry = {\"field\": f,\n \"table\": tablename,\n \"multiple\": False,\n \"id\": [val],\n \"uid\": uids,\n \"text\": None,\n \"lazy\": False,\n \"value\": None}\n reference_map.append(Storage(entry))\n continue\n\n try:\n dbfield = ogetattr(table, f)\n except:\n continue\n\n ktablename, pkey, multiple = s3_get_foreign_key(dbfield)\n if not ktablename:\n # Not a foreign key\n continue\n\n val = ids = ogetattr(record, f)\n\n ktable = load_table(ktablename)\n if not ktable:\n # Referenced table doesn't exist\n continue\n\n ktable_fields = ktable.fields\n k_id = ktable._id\n\n uid = None\n uids = None\n\n if pkey is None:\n pkey = k_id.name\n if pkey != \"id\" and \"instance_type\" in ktable_fields:\n\n # Super-link\n if multiple:\n # @todo: Can't currently resolve multi-references to\n # super-entities\n continue\n else:\n query = (k_id == ids)\n\n # Get the super-record\n srecord = db(query).select(ogetattr(ktable, UID),\n ktable.instance_type,\n limitby=(0, 1)).first()\n if not srecord:\n continue\n\n ktablename = srecord.instance_type\n uid = ogetattr(srecord, UID)\n\n if ktablename == tablename and \\\n UID in record and ogetattr(record, UID) == uid and \\\n not self.show_ids:\n # Super key in the main instance record, never export\n continue\n\n ktable = load_table(ktablename)\n if not ktable:\n continue\n\n # Make sure the referenced record is accessible:\n query = current.auth.s3_accessible_query(\"read\", ktable) & \\\n (ktable[UID] == uid)\n krecord = db(query).select(ktable._id, limitby=(0, 1)).first()\n\n if not krecord:\n continue\n\n ids = [krecord[ktable._id]]\n uids = [export_uid(uid)]\n\n else:\n\n # Make sure the referenced records are accessible:\n query = current.auth.s3_accessible_query(\"read\", ktable)\n if multiple:\n query &= (k_id.belongs(ids))\n limitby = None\n else:\n query &= (k_id == ids)\n limitby = (0, 1)\n\n if DELETED in ktable_fields:\n query = (ktable.deleted != True) & query\n if filter_mci and MCI in ktable_fields:\n query = (ktable.mci >= 0) & query\n\n if UID in ktable_fields:\n\n krecords = db(query).select(ogetattr(ktable, UID),\n limitby=limitby)\n if krecords:\n uids = [r[UID] for r in krecords if r[UID]]\n if ktablename != gtablename:\n uids = map(export_uid, uids)\n else:\n continue\n else:\n\n krecord = db(query).select(k_id, limitby=(0, 1)).first()\n if not krecord:\n continue\n\n value = s3_unicode(dbfield.formatter(val))\n\n # Get the representation\n lazy = None\n renderer = dbfield.represent\n if renderer is not None:\n if hasattr(renderer, \"bulk\"):\n text = None\n lazy = S3RepresentLazy(val, renderer)\n else:\n text = represent(table, f, val)\n else:\n text = value\n\n # Add the entry to the reference map\n entry = {\"field\":f,\n \"table\":ktablename,\n \"multiple\":multiple,\n \"id\":ids if type(ids) is list else [ids],\n \"uid\":uids,\n \"text\":text,\n \"lazy\":lazy,\n \"value\":value}\n reference_map.append(Storage(entry))\n\n return reference_map", "metadata": "root.S3XML.rmap", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 508 }, { "content": " @staticmethod\n def _dtparse(dtstr, field_type=\"datetime\"):\n \"\"\"\n Helper function to parse a string into a date,\n time or datetime value (always returns UTC datetimes).\n\n @param dtstr: the string\n @param field_type: the field type\n \"\"\"\n\n error = None\n value = None\n\n try:\n dt = s3_decode_iso_datetime(str(dtstr))\n value = s3_utc(dt)\n except:\n error = sys.exc_info()[1]\n if error is None:\n if field_type == \"date\":\n value = value.date()\n elif field_type == \"time\":\n value = value.time()\n return (value, error)", "metadata": "root.S3XML._dtparse", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 1356 }, { "content": " @classmethod\n def record(cls, table, element,\n original=None,\n files=[],\n skip=[],\n postprocess=None):\n \"\"\"\n Creates a record (Storage) from a <resource> element and validates\n it\n\n @param table: the database table\n\n @param element: the element\n @param original: the original record\n @param files: list of attached upload files\n @param postprocess: post-process hook (xml_post_parse)\n @param skip: fields to skip\n \"\"\"\n\n valid = True\n record = Storage()\n\n db = current.db\n auth = current.auth\n utable = auth.settings.table_user\n gtable = auth.settings.table_group\n\n # Extract the UUID\n UID = cls.UID\n uid = None\n if UID in table.fields and UID not in skip:\n uid = current.xml.import_uid(element.get(UID, None))\n if uid:\n record[UID] = uid\n\n # Attribute names\n ATTRIBUTE = cls.ATTRIBUTE\n FIELD = ATTRIBUTE[\"field\"]\n VALUE = ATTRIBUTE[\"value\"]\n ERROR = ATTRIBUTE[\"error\"]\n\n DELETED = cls.DELETED\n APPROVED = cls.APPROVED\n IGNORE_FIELDS = cls.IGNORE_FIELDS\n OGROUP = cls.OGROUP\n USER_FIELDS = (cls.CUSER, cls.MUSER, cls.OUSER)\n\n # Attributes\n deleted = False\n for f in cls.ATTRIBUTES_TO_FIELDS:\n\n if f == DELETED:\n if f in table and \\\n element.get(f, \"false\").lower() == \"true\":\n record[f] = deleted = True\n replaced_by = element.get(ATTRIBUTE[\"replaced_by\"], None)\n if replaced_by:\n record[cls.REPLACEDBY] = replaced_by\n break\n else:\n continue\n\n if f == APPROVED:\n # Override default-approver:\n if \"approved_by\" in table:\n approved = element.get(f)\n if approved:\n if approved.lower() == \"false\":\n record[\"approved_by\"] = None\n else:\n if table[\"approved_by\"].default is None:\n auth.permission.set_default_approver(table, force=True)\n else:\n if table[\"approved_by\"].default is None:\n auth.permission.set_default_approver(table)\n continue\n\n if f in IGNORE_FIELDS or f in skip:\n continue\n\n elif f in USER_FIELDS:\n v = element.get(f, None)\n if v and utable and \"email\" in utable:\n query = (utable.email == v)\n user = db(query).select(utable.id, limitby=(0, 1)).first()\n if user:\n record[f] = user.id\n continue\n\n elif f == OGROUP:\n v = element.get(f, None)\n if v and gtable and \"role\" in gtable:\n query = (gtable.role == v)\n role = db(query).select(gtable.id, limitby=(0, 1)).first()\n if role:\n record[f] = role.id\n continue\n\n if hasattr(table, f): # f in table.fields:\n v = value = element.get(f, None)\n if value is not None:\n field_type = str(table[f].type)\n if field_type in (\"datetime\", \"date\", \"time\"):\n (value, error) = cls._dtparse(v,\n field_type=field_type)\n else:\n try:\n (value, error) = s3_validate(table, f, v, original)\n except AttributeError:\n # No such field\n continue\n if error:\n element.set(ERROR, \"%s: %s\" % (f, error))\n valid = False\n continue\n record[f] = value\n\n if deleted and uid:\n # UUID is enough to identify the record,\n # so can skip parsing field data\n return record\n\n # Fields\n xml_decode = cls.xml_decode\n for child in element.findall(\"data\"):\n error = None\n f = child.get(FIELD, None)\n if not f or not hasattr(table, f): # f not in table.fields:\n continue\n if f in IGNORE_FIELDS or f in skip:\n continue\n field_type = str(table[f].type)\n if field_type in (\"id\", \"blob\"):\n continue\n elif field_type == \"upload\":\n download_url = child.get(ATTRIBUTE[\"url\"])\n filename = child.get(ATTRIBUTE[\"filename\"])\n upload = None\n if filename and filename in files:\n # We already have the file cached\n upload = files[filename]\n elif download_url == \"local\":\n # File is already in-place\n value = filename\n # Read from the filesystem\n # uploadfolder = table[f].uploadfolder\n # if not uploadfolder:\n # uploadfolder = os.path.join(current.request.folder,\n # \"uploads\")\n # filepath = os.path.join(uploadfolder, filename)\n # try:\n # upload = open(filepath, r)\n # except IOError:\n # continue\n elif download_url:\n # Download file from Internet\n if not isinstance(download_url, str):\n try:\n download_url = download_url.encode(\"utf-8\")\n except UnicodeEncodeError:\n continue\n if not filename:\n filename = download_url.split(\"?\")[0] or \"upload.bin\"\n try:\n upload = urllib2.urlopen(download_url)\n except IOError:\n continue\n if upload:\n if not isinstance(filename, str):\n try:\n filename = filename.encode(\"utf-8\")\n except UnicodeEncodeError:\n continue\n field = table[f]\n value = field.store(upload, filename)\n elif download_url != \"local\":\n continue\n else:\n value = child.get(VALUE, None)\n\n skip_validation = False\n is_text = field_type in (\"string\", \"text\")\n\n if value is None:\n decode_value = not is_text\n if field_type == \"password\":\n value = child.text\n # Do not re-encrypt the password if it already\n # comes encrypted:\n skip_validation = True\n else:\n value = xml_decode(child.text)\n else:\n decode_value = True\n\n if value is None and is_text:\n value = \"\"\n elif value == \"\" and not is_text:\n value = None\n\n if value is not None:\n if field_type in (\"datetime\", \"date\", \"time\"):\n (value, error) = cls._dtparse(value,\n field_type=field_type)\n skip_validation = True\n v = value\n elif field_type == \"upload\":\n pass\n elif isinstance(value, basestring) \\\n and len(value) \\\n and decode_value:\n try:\n _value = json.loads(value)\n if _value != float(\"inf\"):\n # e.g. an HTML_COLOUR of 98E600\n value = _value\n except:\n error = sys.exc_info()[1]\n\n if not skip_validation:\n if not isinstance(value, (basestring, list, tuple, bool)):\n v = str(value)\n elif isinstance(value, basestring):\n v = value.encode(\"utf-8\")\n else:\n v = value\n filename = None\n try:\n if field_type == \"upload\" and \\\n download_url != \"local\" and \\\n table[f].requires:\n filename, stream = field.retrieve(value)\n v = filename\n if isinstance(stream, basestring):\n # Regular file in file system => try open\n stream = open(stream, \"rb\")\n if not error:\n dummy = Storage({\"filename\": filename,\n \"file\": stream})\n (dummy, error) = s3_validate(table, f, dummy, original)\n elif field_type == \"password\":\n v = str(value) # CRYPT barfs on integers\n (value, error) = s3_validate(table, f, v)\n else:\n (value, error) = s3_validate(table, f, v, original)\n except AttributeError:\n # No such field\n continue\n except IOError:\n if filename:\n error = \"Cannot read uploaded file: %s\" % filename\n else:\n error = sys.exc_info()[1]\n except:\n error = sys.exc_info()[1]\n\n child.set(VALUE, s3_unicode(v))\n if error:\n child.set(ERROR, s3_unicode(\"%s: %s\" % (f, error)))\n valid = False\n continue\n\n record[f] = value\n\n if valid:\n if postprocess:\n postprocess(element, record)\n return record\n else:\n return None", "metadata": "root.S3XML.record", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 1382 }, { "content": " @classmethod\n def __element2json(cls, element, native=False):\n \"\"\"\n Converts an element into JSON\n\n @param element: the element\n @param native: use native mode for attributes\n \"\"\"\n\n TAG = cls.TAG\n ATTRIBUTE = cls.ATTRIBUTE\n PREFIX = cls.PREFIX\n\n element2json = cls.__element2json\n\n if element.tag == TAG.list:\n obj = []\n append = obj.append\n for child in element:\n tag = child.tag\n if not isinstance(tag, basestring):\n continue # skip comment nodes\n if tag[0] == \"{\":\n tag = tag.rsplit(\"}\", 1)[1]\n child_obj = element2json(child, native=native)\n if child_obj:\n append(child_obj)\n return obj\n else:\n obj = {}\n iterchildren = element.iterchildren\n xpath = element.xpath\n is_single = lambda t, a, v: len(xpath(\"%s[@%s='%s']\" % (t, a, v))) == 1\n for child in iterchildren(tag=etree.Element):\n tag = child.tag\n if tag[0] == \"{\":\n tag = tag.rsplit(\"}\", 1)[1]\n collapse = True\n single = False\n attributes = child.attrib\n if native:\n if tag == TAG.resource:\n resource = attributes.get(ATTRIBUTE.name)\n tag = \"%s_%s\" % (PREFIX.resource, resource)\n collapse = False\n elif tag == TAG.options:\n r = attributes.get(ATTRIBUTE.resource)\n tag = \"%s_%s\" % (PREFIX.options, r)\n single = is_single(TAG.options, ATTRIBUTE.resource, r)\n elif tag == TAG.reference:\n f = attributes.get(ATTRIBUTE.field)\n tag = \"%s_%s\" % (PREFIX.reference, f)\n single = is_single(TAG.reference, ATTRIBUTE.field, f)\n elif tag == TAG.data:\n tag = attributes.get(ATTRIBUTE.field)\n single = is_single(TAG.data, ATTRIBUTE.field, tag)\n else:\n for s in iterchildren(tag=tag):\n if single is True:\n single = False\n break\n else:\n single = True\n child_obj = element2json(child, native=native)\n if child_obj is not None and child_obj != \"\":\n if tag not in obj:\n if single and collapse:\n obj[tag] = child_obj\n else:\n obj[tag] = [child_obj]\n else:\n if type(obj[tag]) is not list:\n obj[tag] = [obj[tag]]\n obj[tag].append(child_obj)\n\n attributes = element.attrib\n skip_text = False\n tag = element.tag\n numeric = False\n for a in attributes:\n v = attributes[a]\n if native:\n if a == ATTRIBUTE.name and tag == TAG.resource:\n continue\n if a == ATTRIBUTE.resource and tag == TAG.options:\n continue\n if a == ATTRIBUTE.field and tag in (TAG.data, TAG.reference):\n continue\n if a == ATTRIBUTE.value:\n try:\n v = json.loads(v)\n except:\n pass\n else:\n if a == ATTRIBUTE.value:\n try:\n obj[TAG.item] = json.loads(v)\n except:\n pass\n else:\n skip_text = True\n continue\n elif a == ATTRIBUTE.type and v == \"numeric\":\n numeric = True\n continue\n obj[PREFIX.attribute + a] = v\n\n if element.text and not skip_text:\n represent = cls.xml_decode(element.text)\n if numeric:\n # Value should be a number not string\n try:\n float_represent = float(represent.replace(\",\", \"\"))\n int_represent = int(float_represent)\n if int_represent == float_represent:\n represent = int_represent\n else:\n represent = float_represent\n except:\n # @ToDo: Don't assume this i18n formatting...\n pass\n obj[PREFIX.text] = represent\n\n if len(obj) == 1 and obj.keys()[0] in \\\n (PREFIX.text, TAG.item, TAG.list):\n obj = obj[obj.keys()[0]]\n\n return obj", "metadata": "root.S3XML.__element2json", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 2094 }, { "content": " @classmethod\n def csv2tree(cls, source,\n resourcename=None,\n extra_data=None,\n hashtags=None,\n delimiter=\",\",\n quotechar='\"'):\n \"\"\"\n Convert a table-form CSV source into an element tree, consisting of\n <table name=\"format\">, <row> and <col field=\"fieldname\"> elements.\n\n @param source: the source (file-like object)\n @param resourcename: the resource name\n @param extra_data: dict of extra cols {key:value} to add to each row\n @param hashtags: dict of hashtags for extra cols {key:hashtag}\n @param delimiter: delimiter for values\n @param quotechar: quotation character\n\n @todo: add a character encoding parameter to skip the guessing\n \"\"\"\n\n import csv\n\n # Increase field size to be able to import WKTs\n csv.field_size_limit(2**20 * 100) # 100 megs\n\n # Shortcuts\n ATTRIBUTE = cls.ATTRIBUTE\n FIELD = ATTRIBUTE.field\n HASHTAG = ATTRIBUTE.hashtag\n TAG = cls.TAG\n COL = TAG.col\n SubElement = etree.SubElement\n\n root = etree.Element(TAG.table)\n if resourcename is not None:\n root.set(ATTRIBUTE.name, resourcename)\n\n def add_col(row, key, value, hashtags=None):\n col = SubElement(row, COL)\n col.set(FIELD, s3_unicode(key))\n if hashtags:\n hashtag = hashtags.get(key)\n if hashtag and hashtag[1:]:\n col.set(HASHTAG, hashtag)\n if value:\n text = s3_unicode(value).strip()\n if text[:6].lower() not in (\"null\", \"<null>\"):\n try:\n col.text = text\n except MemoryError:\n current.log.error(\"S3XML: Unable to set value for key %s: MemoryError\" % key)\n else:\n col.text = \"\"\n\n def utf_8_encode(source):\n \"\"\"\n UTF-8-recode the source line by line, guessing the character\n encoding of the source.\n \"\"\"\n # Make this a list of all encodings you need to support (as long as\n # they are supported by Python codecs), always starting with the most\n # likely.\n encodings = (\"utf-8-sig\", \"iso-8859-1\")\n e = encodings[0]\n for line in source:\n if e:\n try:\n yield unicode(line, e, \"strict\").encode(\"utf-8\")\n except:\n pass\n else:\n continue\n for encoding in encodings:\n try:\n yield unicode(line, encoding, \"strict\").encode(\"utf-8\")\n except:\n continue\n else:\n e = encoding\n break\n\n hashtags = dict(hashtags) if hashtags else {}\n\n try:\n import StringIO\n if not isinstance(source, StringIO.StringIO):\n source = utf_8_encode(source)\n reader = csv.DictReader(source,\n delimiter=delimiter,\n quotechar=quotechar)\n ROW = TAG.row\n for i, r in enumerate(reader):\n # Skip empty rows\n if not any(r.values()):\n continue\n if i == 0:\n # Auto-detect hashtags\n items = dict((k, s3_unicode(v.strip()))\n for k, v in r.items() if k and v and v.strip())\n if all(v[0] == \"#\" for v in items.values()):\n hashtags.update(items)\n continue\n row = SubElement(root, ROW)\n for k in r:\n if k:\n add_col(row, k, r[k], hashtags=hashtags)\n if extra_data:\n for key in extra_data:\n if key not in r:\n add_col(row, key, extra_data[key], hashtags=hashtags)\n except csv.Error:\n e = sys.exc_info()[1]\n raise HTTP(400, body=cls.json_message(False, 400, e))\n\n # Use this to debug the source tree if needed:\n #print >>sys.stderr, cls.tostring(root, pretty_print=True)\n\n return etree.ElementTree(root)", "metadata": "root.S3XML.csv2tree", "header": "['class', 'S3XML', '(', 'S3Codec', ')', ':', '___EOS___']", "index": 2546 } ]
[ { "span": "except:", "start_line": 45, "start_column": 4, "end_line": 45, "end_column": 11 }, { "span": "except:", "start_line": 235, "start_column": 12, "end_line": 235, "end_column": 19 }, { "span": "except:", "start_line": 243, "start_column": 8, "end_line": 243, "end_column": 15 }, { "span": "except:", "start_line": 280, "start_column": 12, "end_line": 280, "end_column": 19 }, { "span": "except:", "start_line": 570, "start_column": 12, "end_line": 570, "end_column": 19 }, { "span": "except:", "start_line": 1372, "start_column": 8, "end_line": 1372, "end_column": 15 }, { "span": "except:", "start_line": 1598, "start_column": 20, "end_line": 1598, "end_column": 27 }, { "span": "except:", "start_line": 1635, "start_column": 20, "end_line": 1635, "end_column": 27 }, { "span": "except:", "start_line": 2185, "start_column": 24, "end_line": 2185, "end_column": 31 }, { "span": "except:", "start_line": 2191, "start_column": 24, "end_line": 2191, "end_column": 31 }, { "span": "except:", "start_line": 2212, "start_column": 20, "end_line": 2212, "end_column": 27 }, { "span": "except:", "start_line": 2615, "start_column": 20, "end_line": 2615, "end_column": 27 }, { "span": "except:", "start_line": 2622, "start_column": 20, "end_line": 2622, "end_column": 27 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "S", "3", "XML", " ", "Tool", "kit", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "see", ":", " ", "U", "{", "B", "{", "I", "{", "S", "3", "XR", "C", "}}", " ", "<", "http", "://", "eden", ".", "sa", "han", "af", "ound", "ation", ".", "org", "/", "wiki", "/", "S", "3", "XR", "C", ">}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "require", "s", ":", " ", "U", "{", "B", "{", "I", "{", "glu", "on", "}}", " ", "<", "http", "://", "web", "2py", ".", "com", ">}", "\\", "10", ";", " ", " ", " ", " ", "@", "require", "s", ":", " ", "U", "{", "B", "{", "I", "{", "lx", "ml", "}}", " ", "<", "http", "://", "codes", "peak", ".", "net", "/", "lx", "ml", ">}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "copyr", "ight", ":", " ", "200", "9", "-", "2016", " ", "(", "c", ")", " ", "Sa", "han", "a", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", "\\", "10", ";", " ", " ", " ", " ", "@", "license", ":", " ", "MIT", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Permi", "ssion", " ", "is", " ", "here", "by", " ", "grant", "ed", ",", " ", "free", " ", "of", " ", "charge", ",", " ", "to", " ", "any", " ", "person", "\\", "10", ";", " ", " ", " ", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", "\\", "10", ";", " ", " ", " ", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", "\\", "10", ";", " ", " ", " ", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", "\\", "10", ";", " ", " ", " ", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", "\\", "10", ";", " ", " ", " ", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", "\\", "10", ";", " ", " ", " ", " ", "condition", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "include", "d", " ", "in", " ", "all", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", "\\", "10", ";", " ", " ", " ", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", "\\", "10", ";", " ", " ", " ", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", "\\", "10", ";", " ", " ", " ", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", "\\", "10", ";", " ", " ", " ", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", "\\", "10", ";", " ", " ", " ", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", "\\", "10", ";", " ", " ", " ", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", "\\", "10", ";", " ", " ", " ", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", " ", "SOFT", "WARE", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "json_", "#", " ", "try", " ", "stdlib", " ", "(", "Pyth", "on", " ", "2.6", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "simplejson_", "as_", "json_", "#", " ", "try", " ", "external", " ", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "gluon_", "._", "contrib_", "._", "simplejson_", "as_", "json_", "#", " ", "fall", "back", " ", "to", " ", "pure", "-", "Pyth", "on", " ", "module_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lxml_", "import_", "etree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "sys_", "._", "stderr_", ",_", "\"", "ERROR", ":", " ", "lx", "ml", " ", "module", " ", "need", "ed", " ", "for", " ", "XML", " ", "handling", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "gluon_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "storage_", "import_", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "s3", "codec_", "import_", "S", "3", "Codec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "datetime_", "import_", "s3", "\\u", "decode", "\\u", "iso", "\\u", "datetime_", ",_", "s3", "\\u", "encode", "\\u", "iso", "\\u", "datetime_", ",_", "s3", "\\u", "utc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "fields_", "import_", "S", "3", "Represent", "La", "zy", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "utils_", "import_", "s3", "\\u", "get", "\\u", "foreign", "\\u", "key_", ",_", "s3", "\\u", "unicode_", ",_", "s3", "\\u", "strip", "\\u", "markup_", ",_", "s3", "\\u", "validate_", ",_", "s3", "\\u", "represent", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "oge", "tat", "tr_", "=_", "object_", "._", "\\u\\u", "getattribute\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compact", " ", "JSO", "N", " ", "encoding_", "\\u\\u\\uNL\\u\\u\\u_", "SEPA", "RAT", "ORS", "_", "=_", "(_", "\",\"_", ",_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "End", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Pars", "e", " ", "an", " ", "XML", " ", "source", " ", "int", "o", " ", "an", " ", "element", " ", "tree", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "source", ":", " ", "the", " ", "XML", " ", "source", " ", "-", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "be", " ", "a", " ", "file", "-", "like", " ", "object", ",", " ", "a", " ", "filename", " ", "or", " ", "a", " ", "HTTP", "/", "HTTP", "S", "/", "FTP", " ", "URL", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "source_", ",_", "basestring_", ")_", "and_", "source_", "[_", ":_", "5_", "]_", "==_", "\"", "https", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "urllib2_", "._", "urlopen_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "etree_", "._", "XML", "Parser_", "(_", "no", "\\u", "network_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remove", "\\u", "blank", "\\u", "text_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "etree_", "._", "parse_", "(_", "source_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "transform_", "(_", "self_", ",_", "tree_", ",_", "stylesheet", "\\u", "path_", ",_", "**_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Transform", " ", "an", " ", "element", " ", "tree", " ", "with", " ", "XS", "LT", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "tree", ":", " ", "the", " ", "element", " ", "tree", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "stylesheet", "\\u", "path", ":", " ", "path", "name", " ", "of", " ", "the", " ", "XS", "LT", " ", "stylesheet", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "args", ":", " ", "dict", " ", "of", " ", "argu", "ment", "s", " ", "to", " ", "pass", " ", "to", " ", "the", " ", "stylesheet", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "args_", "=_", "dict_", "(_", "(_", "k_", ",_", "\"'", "%", "s", "'\"_", "%_", "args_", "[_", "k_", "]_", ")_", "for_", "k_", "in_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "args_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "stylesheet", "\\u", "path_", ",_", "(_", "etree_", "._", "\\u", "Element", "Tree_", ",_", "etree_", "._", "\\u", "Element_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pre", "-", "parsed", " ", "stylesheet", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stylesheet", "_", "=_", "stylesheet", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stylesheet", "_", "=_", "self_", "._", "parse_", "(_", "stylesheet", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stylesheet", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ac_", "=_", "etree_", "._", "XS", "LT", "Access", "Control_", "(_", "read", "\\u", "file_", "=_", "True_", ",_", "read", "\\u", "network_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transformer_", "=_", "etree_", "._", "XS", "LT_", "(_", "stylesheet", "_", ",_", "access", "\\u", "control_", "=_", "ac_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "transformer_", "(_", "tree_", ",_", "**_", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "result_", "=_", "transformer_", "(_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "=_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current_", "._", "log_", "._", "error_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "output", " ", "=", " ", "self", ".", "tost", "ring", "(", "tree", ",", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "output", "File", " ", "=", " ", "open", "(\"", "fail", "ed", "\\u", "transform", ".", "xml", "\",", " ", "\"", "w", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "output", "File", ".", "write", "(", "output", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "output", "File", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Error", " ", "pars", "ing", " ", "the", " ", "XS", "L", " ", "stylesheet", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rma", "p_", "(_", "self_", ",_", "table_", ",_", "record_", ",_", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Generate", "s", " ", "a", " ", "reference", " ", "map", " ", "for", " ", "a", " ", "record", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "table", ":", " ", "the", " ", "databa", "se", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "record", ":", " ", "the", " ", "record", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "fields", ":", " ", "list", " ", "of", " ", "reference", " ", "field", " ", "names", " ", "in", " ", "this", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reference", "\\u", "map_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DELETED", "_", "=_", "self_", "._", "DELETED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "REPLACE", "DB", "Y_", "=_", "self_", "._", "REPLACE", "DB", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DELETED", "_", "in_", "record_", "and_", "record_", "[_", "DELETED", "_", "]_", "and_", "REPLACE", "DB", "Y_", "in_", "record_", "and_", "record_", "[_", "REPLACE", "DB", "Y_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "REPLACE", "DB", "Y_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "replace", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "f_", "for_", "f_", "in_", "fields_", "if_", "f_", "in_", "record_", "and_", "record_", "[_", "f_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "replace", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reference", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "UID_", "=_", "self_", "._", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MC", "I_", "=_", "self_", "._", "MC", "I_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "export", "\\u", "uid_", "=_", "self_", "._", "export", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "represent_", "=_", "self_", "._", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "mc", "i_", "=_", "self_", "._", "filter", "\\u", "mc", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tablename_", "=_", "table_", "._", "\\u", "tablename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gta", "ble", "name_", "=_", "current_", "._", "auth_", "._", "settings_", "._", "table", "\\u", "group", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "load", "\\u", "table_", "=_", "current_", "._", "s3db_", "._", "table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "f_", "in_", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "==_", "REPLACE", "DB", "Y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "oge", "tat", "tr_", "(_", "record_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "val_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "=_", "db_", "(_", "table_", "._", "\\u", "id_", "==_", "val_", ")_", "._", "select_", "(_", "table_", "[_", "UID_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "row_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "uids_", "=_", "[_", "export", "\\u", "uid_", "(_", "row_", "[_", "UID_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry_", "=_", "{_", "\"", "field", "\"_", ":_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "table", "\"_", ":_", "tablename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "multiple", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "[_", "val_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uid", "\"_", ":_", "uids_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lazy", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "\\u", "map_", "._", "append_", "(_", "Storage_", "(_", "entry_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbf", "ield_", "=_", "oge", "tat", "tr_", "(_", "table_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kt", "able", "name_", ",_", "pkey_", ",_", "multiple_", "=_", "s3", "\\u", "get", "\\u", "foreign", "\\u", "key_", "(_", "dbf", "ield_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kt", "able", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "a", " ", "foreign", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "val_", "=_", "ids_", "=_", "oge", "tat", "tr_", "(_", "record_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kt", "able_", "=_", "load", "\\u", "table_", "(_", "kt", "able", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kt", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reference", "d", " ", "table", " ", "doe", "sn", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kt", "able", "\\u", "fields_", "=_", "kt", "able_", "._", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "k", "\\u", "id_", "=_", "kt", "able_", "._", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "uid_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uids_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pkey_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pkey_", "=_", "k", "\\u", "id_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pkey_", "!=_", "\"", "id", "\"_", "and_", "\"", "instance", "\\u", "type", "\"_", "in_", "kt", "able", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Super", "-", "link_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "todo", ":", " ", "Can", "'", "t", " ", "currentl", "y", " ", "resolve", " ", "multi", "-", "reference", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "super", "-", "entities_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "(_", "k", "\\u", "id_", "==_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "super", "-", "record_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sre", "cord", "_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "oge", "tat", "tr_", "(_", "kt", "able_", ",_", "UID_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kt", "able_", "._", "instance", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sre", "cord", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kt", "able", "name_", "=_", "sre", "cord", "_", "._", "instance", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "oge", "tat", "tr_", "(_", "sre", "cord", "_", ",_", "UID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "kt", "able", "name_", "==_", "tablename_", "and_", "UID_", "in_", "record_", "and_", "oge", "tat", "tr_", "(_", "record_", ",_", "UID_", ")_", "==_", "uid_", "and_", "not_", "self_", "._", "show", "\\u", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Super", " ", "key", " ", "in", " ", "the", " ", "main", " ", "instance", " ", "record", ",", " ", "neve", "r", " ", "export_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kt", "able_", "=_", "load", "\\u", "table_", "(_", "kt", "able", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kt", "able_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "referenced", " ", "record", " ", "is", " ", "accessible", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "current_", "._", "auth_", "._", "s3", "\\u", "accessible", "\\u", "query_", "(_", "\"", "read", "\"_", ",_", "kt", "able_", ")_", "&_", "(_", "kt", "able_", "[_", "UID_", "]_", "==_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kre", "cord", "_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "kt", "able_", "._", "\\u", "id_", ",_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "kre", "cord", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ids_", "=_", "[_", "kre", "cord", "_", "[_", "kt", "able_", "._", "\\u", "id_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uids_", "=_", "[_", "export", "\\u", "uid_", "(_", "uid_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "referenced", " ", "record", "s", " ", "are", " ", "accessible", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "current_", "._", "auth_", "._", "s3", "\\u", "accessible", "\\u", "query_", "(_", "\"", "read", "\"_", ",_", "kt", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "multiple_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "&=_", "(_", "k", "\\u", "id_", "._", "belo", "ngs_", "(_", "ids_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit", "by_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "&=_", "(_", "k", "\\u", "id_", "==_", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DELETED", "_", "in_", "kt", "able", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "(_", "kt", "able_", "._", "deleted_", "!=_", "True_", ")_", "&_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filter", "\\u", "mc", "i_", "and_", "MC", "I_", "in_", "kt", "able", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "(_", "kt", "able_", "._", "mc", "i_", ">=_", "0_", ")_", "&_", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "UID_", "in_", "kt", "able", "\\u", "fields_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kre", "cord", "s_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "oge", "tat", "tr_", "(_", "kt", "able_", ",_", "UID_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "by_", "=_", "limit", "by_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kre", "cord", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uids_", "=_", "[_", "r_", "[_", "UID_", "]_", "for_", "r_", "in_", "kre", "cord", "s_", "if_", "r_", "[_", "UID_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "kt", "able", "name_", "!=_", "gta", "ble", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "uids_", "=_", "map_", "(_", "export", "\\u", "uid_", ",_", "uids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kre", "cord", "_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "k", "\\u", "id_", ",_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kre", "cord", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "s3", "\\u", "unicode_", "(_", "dbf", "ield_", "._", "formatter_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "representation_", "\\u\\u\\uNL\\u\\u\\u_", "lazy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "renderer_", "=_", "dbf", "ield_", "._", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "renderer_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "renderer_", ",_", "\"", "bul", "k", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lazy_", "=_", "S", "3", "Represent", "La", "zy", "_", "(_", "val_", ",_", "renderer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "text_", "=_", "represent_", "(_", "table_", ",_", "f_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "the", " ", "entry", " ", "to", " ", "the", " ", "reference", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry_", "=_", "{_", "\"", "field", "\"_", ":_", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "table", "\"_", ":_", "kt", "able", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "multiple", "\"_", ":_", "multiple_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ":_", "ids_", "if_", "type_", "(_", "ids_", ")_", "is_", "list_", "else_", "[_", "ids_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uid", "\"_", ":_", "uids_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "text", "\"_", ":_", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "lazy", "\"_", ":_", "lazy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "value_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference", "\\u", "map_", "._", "append_", "(_", "Storage_", "(_", "entry_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "reference", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "dt", "parse_", "(_", "dtst", "r_", ",_", "field", "\\u", "type_", "=_", "\"", "datetime", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Help", "er", " ", "function", " ", "to", " ", "parse", " ", "a", " ", "string", " ", "int", "o", " ", "a", " ", "date", ",", "\\", "10", ";", " ", " ", " ", " ", "time", " ", "or", " ", "datetime", " ", "value", " ", "(", "alw", "ay", "s", " ", "return", "s", " ", "UT", "C", " ", "datetimes", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "dtst", "r", ":", " ", "the", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "field", "\\u", "type", ":", " ", "the", " ", "field", " ", "type", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "s3", "\\u", "decode", "\\u", "iso", "\\u", "datetime_", "(_", "str_", "(_", "dtst", "r_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "s3", "\\u", "utc_", "(_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field", "\\u", "type_", "==_", "\"", "date", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "date_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "type_", "==_", "\"", "time", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "value_", ",_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "record_", "(_", "cls_", ",_", "table_", ",_", "element_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "original_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "skip_", "=_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "postprocess", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "record", " ", "(", "Stor", "age", ")", " ", "from", " ", "a", " ", "<", "resource", ">", " ", "element", " ", "and", " ", "validates", "\\", "10", ";", " ", " ", " ", " ", "it", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "table", ":", " ", "the", " ", "databa", "se", " ", "table", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "element", ":", " ", "the", " ", "element", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "original", ":", " ", "the", " ", "original", " ", "record", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "files", ":", " ", "list", " ", "of", " ", "attache", "d", " ", "upload", " ", "files", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "postprocess", ":", " ", "post", "-", "process", " ", "hook", " ", "(", "xml", "\\u", "post", "\\u", "parse", ")", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "skip", ":", " ", "fields", " ", "to", " ", "skip", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record_", "=_", "Storage_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "current_", "._", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth_", "=_", "current_", "._", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uta", "ble_", "=_", "auth_", "._", "settings_", "._", "table", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gta", "ble_", "=_", "auth_", "._", "settings_", "._", "table", "\\u", "group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Extract", " ", "the", " ", "UUID_", "\\u\\u\\uNL\\u\\u\\u_", "UID_", "=_", "cls_", "._", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "UID_", "in_", "table_", "._", "fields_", "and_", "UID_", "not_", "in_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uid_", "=_", "current_", "._", "xml_", "._", "import", "\\u", "uid_", "(_", "element_", "._", "get_", "(_", "UID_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "uid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record_", "[_", "UID_", "]_", "=_", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attribute", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ATTRIBUTE_", "=_", "cls_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FIELD_", "=_", "ATTRIBUTE_", "[_", "\"", "field", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VALUE_", "=_", "ATTRIBUTE_", "[_", "\"", "value", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR_", "=_", "ATTRIBUTE_", "[_", "\"", "error", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DELETED", "_", "=_", "cls_", "._", "DELETED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "APPRO", "VED", "_", "=_", "cls_", "._", "APPRO", "VED", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "IGNORE", "\\u", "FIELDS_", "=_", "cls_", "._", "IGNORE", "\\u", "FIELDS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OGR", "OU", "P_", "=_", "cls_", "._", "OGR", "OU", "P_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "USER", "\\u", "FIELDS_", "=_", "(_", "cls_", "._", "CU", "SER", "_", ",_", "cls_", "._", "MUS", "ER_", ",_", "cls_", "._", "OUS", "ER_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Attributes_", "\\u\\u\\uNL\\u\\u\\u_", "deleted_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "f_", "in_", "cls_", "._", "ATTRIBUTE", "S", "\\u", "TO", "\\u", "FIELDS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "==_", "DELETED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "f_", "in_", "table_", "and_", "element_", "._", "get_", "(_", "f_", ",_", "\"", "fal", "se", "\"_", ")_", "._", "lower_", "(_", ")_", "==_", "\"", "true", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "record_", "[_", "f_", "]_", "=_", "deleted_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "replaced", "\\u", "by_", "=_", "element_", "._", "get_", "(_", "ATTRIBUTE_", "[_", "\"", "replaced", "\\u", "by", "\"_", "]_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "replaced", "\\u", "by_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record_", "[_", "cls_", "._", "REPLACE", "DB", "Y_", "]_", "=_", "replaced", "\\u", "by_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "==_", "APPRO", "VED", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Override", " ", "default", "-", "approve", "r", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "approved", "\\u", "by", "\"_", "in_", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "approved", "_", "=_", "element_", "._", "get_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "approved", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "approved", "_", "._", "lower_", "(_", ")_", "==_", "\"", "fal", "se", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record_", "[_", "\"", "approved", "\\u", "by", "\"_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "table_", "[_", "\"", "approved", "\\u", "by", "\"_", "]_", "._", "default_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "auth_", "._", "permission_", "._", "set\\u", "default", "\\u", "approve", "r_", "(_", "table_", ",_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "table_", "[_", "\"", "approved", "\\u", "by", "\"_", "]_", "._", "default_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "auth_", "._", "permission_", "._", "set\\u", "default", "\\u", "approve", "r_", "(_", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "in_", "IGNORE", "\\u", "FIELDS_", "or_", "f_", "in_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "f_", "in_", "USER", "\\u", "FIELDS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "element_", "._", "get_", "(_", "f_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "and_", "uta", "ble_", "and_", "\"", "email", "\"_", "in_", "uta", "ble_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "(_", "uta", "ble_", "._", "email_", "==_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "uta", "ble_", "._", "id_", ",_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record_", "[_", "f_", "]_", "=_", "user_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "f_", "==_", "OGR", "OU", "P_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "element_", "._", "get_", "(_", "f_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "v_", "and_", "gta", "ble_", "and_", "\"", "role", "\"_", "in_", "gta", "ble_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "(_", "gta", "ble_", "._", "role_", "==_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "role_", "=_", "db_", "(_", "query_", ")_", "._", "select_", "(_", "gta", "ble_", "._", "id_", ",_", "limit", "by_", "=_", "(_", "0_", ",_", "1_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "role_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "record_", "[_", "f_", "]_", "=_", "role_", "._", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "table_", ",_", "f_", ")_", ":_", "#", " ", "f", " ", "in", " ", "table", ".", "fields", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "value_", "=_", "element_", "._", "get_", "(_", "f_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "field", "\\u", "type_", "=_", "str_", "(_", "table_", "[_", "f_", "]_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "type_", "in_", "(_", "\"", "datetime", "\"_", ",_", "\"", "date", "\"_", ",_", "\"", "time", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "(_", "value_", ",_", "error_", ")_", "=_", "cls_", "._", "\\u", "dt", "parse_", "(_", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "type_", "=_", "field", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "(_", "value_", ",_", "error_", ")_", "=_", "s3", "\\u", "validate_", "(_", "table_", ",_", "f_", ",_", "v_", ",_", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "suc", "h", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "element_", "._", "set_", "(_", "ERROR_", ",_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record_", "[_", "f_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "deleted_", "and_", "uid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "UU", "ID", " ", "is", " ", "eno", "ugh", " ", "to", " ", "identify", " ", "the", " ", "record", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "can", " ", "skip", " ", "pars", "ing", " ", "field", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fields_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xml", "\\u", "decode_", "=_", "cls_", "._", "xml", "\\u", "decode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "element_", "._", "findall_", "(_", "\"", "data", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "child_", "._", "get_", "(_", "FIELD_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "f_", "or_", "not_", "hasattr_", "(_", "table_", ",_", "f_", ")_", ":_", "#", " ", "f", " ", "not", " ", "in", " ", "table", ".", "fields", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "f_", "in_", "IGNORE", "\\u", "FIELDS_", "or_", "f_", "in_", "skip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field", "\\u", "type_", "=_", "str_", "(_", "table_", "[_", "f_", "]_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "type_", "in_", "(_", "\"", "id", "\"_", ",_", "\"", "blob", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "type_", "==_", "\"", "upload", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "download", "\\u", "url_", "=_", "child_", "._", "get_", "(_", "ATTRIBUTE_", "[_", "\"", "url", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "child_", "._", "get_", "(_", "ATTRIBUTE_", "[_", "\"", "filename", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upload_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename_", "and_", "filename_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "alr", "ead", "y", " ", "have", " ", "the", " ", "file", " ", "cached_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "upload_", "=_", "files_", "[_", "filename_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "download", "\\u", "url_", "==_", "\"", "local", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "File", " ", "is", " ", "alr", "ead", "y", " ", "in", "-", "place_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Read", " ", "from", " ", "the", " ", "filesystem_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", "folder", " ", "=", " ", "table", "[", "f", "].", "upload", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "upload", "folder", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", "folder", " ", "=", " ", "os", ".", "path", ".", "join", "(", "current", ".", "request", ".", "folder", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "uploads", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "filepath", " ", "=", " ", "os", ".", "path", ".", "join", "(", "upload", "folder", ",", " ", "filename", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "upload", " ", "=", " ", "open", "(", "filepath", ",", " ", "r", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "IO", "Error", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "download", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Down", "load", " ", "file", " ", "from", " ", "Intern", "et_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "isinstance_", "(_", "download", "\\u", "url_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "download", "\\u", "url_", "=_", "download", "\\u", "url_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Encode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "filename_", "=_", "download", "\\u", "url_", "._", "split_", "(_", "\"?\"_", ")_", "[_", "0_", "]_", "or_", "\"", "upload", ".", "bin", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "upload_", "=_", "urllib2_", "._", "urlopen_", "(_", "download", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upload_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "isinstance_", "(_", "filename_", ",_", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "filename_", "=_", "filename_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Encode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "table_", "[_", "f_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "field_", "._", "store_", "(_", "upload_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "download", "\\u", "url_", "!=_", "\"", "local", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "child_", "._", "get_", "(_", "VALUE_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "skip", "\\u", "validation_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "text_", "=_", "field", "\\u", "type_", "in_", "(_", "\"", "string", "\"_", ",_", "\"", "text", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decode", "\\u", "value_", "=_", "not_", "is", "\\u", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "type_", "==_", "\"", "password", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "child_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "not", " ", "re", "-", "encrypt", " ", "the", " ", "password", " ", "if", " ", "it", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "come", "s", " ", "encrypt", "ed", ":_", "\\u\\u\\uNL\\u\\u\\u_", "skip", "\\u", "validation_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "=_", "xml", "\\u", "decode_", "(_", "child_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "decode", "\\u", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "None_", "and_", "is", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "==_", "\"\"_", "and_", "not_", "is", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "field", "\\u", "type_", "in_", "(_", "\"", "datetime", "\"_", ",_", "\"", "date", "\"_", ",_", "\"", "time", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "(_", "value_", ",_", "error_", ")_", "=_", "cls_", "._", "\\u", "dt", "parse_", "(_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "type_", "=_", "field", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "\\u", "validation_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "type_", "==_", "\"", "upload", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", "and_", "len_", "(_", "value_", ")_", "and_", "decode", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "value_", "=_", "json_", "._", "loads_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "value_", "!=_", "float_", "(_", "\"", "inf", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "e", ".", "g", ".", " ", "an", " ", "HTM", "L", "\\u", "COLOUR", " ", "of", " ", "98", "E6", "00_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "value_", "=_", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "error_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "skip", "\\u", "validation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "isinstance_", "(_", "value_", ",_", "(_", "basestring_", ",_", "list_", ",_", "tuple_", ",_", "bool_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "value_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "field", "\\u", "type_", "==_", "\"", "upload", "\"_", "and_", "download", "\\u", "url_", "!=_", "\"", "local", "\"_", "and_", "table_", "[_", "f_", "]_", "._", "requires_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "filename_", ",_", "stream_", "=_", "field_", "._", "retrieve_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "stream_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Regula", "r", " ", "file", " ", "in", " ", "file", " ", "system", " ", "=>", " ", "try", " ", "open_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "stream_", "=_", "open_", "(_", "stream_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "dummy_", "=_", "Storage_", "(_", "{_", "\"", "filename", "\"_", ":_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "file", "\"_", ":_", "stream_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "dummy_", ",_", "error_", ")_", "=_", "s3", "\\u", "validate_", "(_", "table_", ",_", "f_", ",_", "dummy_", ",_", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "field", "\\u", "type_", "==_", "\"", "password", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "str_", "(_", "value_", ")_", "#", " ", "CRYPT", " ", "bar", "fs", " ", "on", " ", "integers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "value_", ",_", "error_", ")_", "=_", "s3", "\\u", "validate_", "(_", "table_", ",_", "f_", ",_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "(_", "value_", ",_", "error_", ")_", "=_", "s3", "\\u", "validate_", "(_", "table_", ",_", "f_", ",_", "v_", ",_", "original_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "suc", "h", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "error_", "=_", "\"", "Cann", "ot", " ", "read", " ", "uploade", "d", " ", "file", ":", " ", "%", "s", "\"_", "%_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "error_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "error_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child_", "._", "set_", "(_", "VALUE_", ",_", "s3", "\\u", "unicode_", "(_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "child_", "._", "set_", "(_", "ERROR_", ",_", "s3", "\\u", "unicode_", "(_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "f_", ",_", "error_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "record_", "[_", "f_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "postprocess", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "postprocess", "_", "(_", "element_", ",_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "record_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "element", "2j", "son_", "(_", "cls_", ",_", "element_", ",_", "native_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", "s", " ", "an", " ", "element", " ", "int", "o", " ", "JSO", "N", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "element", ":", " ", "the", " ", "element", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "nativ", "e", ":", " ", "use", " ", "nativ", "e", " ", "mode", " ", "for", " ", "attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TAG_", "=_", "cls_", "._", "TAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ATTRIBUTE_", "=_", "cls_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PREFIX_", "=_", "cls_", "._", "PREFIX_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "element", "2j", "son_", "=_", "cls_", "._", "\\u\\u", "element", "2j", "son_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "element_", "._", "tag_", "==_", "TAG_", "._", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "=_", "obj_", "._", "append_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "element_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "child_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "tag_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "#", " ", "skip", " ", "comment", " ", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tag_", "[_", "0_", "]_", "==_", "\"{\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "tag_", "._", "rsplit_", "(_", "\"}\"_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child", "\\u", "obj_", "=_", "element", "2j", "son_", "(_", "child_", ",_", "native_", "=_", "native_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child", "\\u", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "append_", "(_", "child", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iter", "children_", "=_", "element_", "._", "iter", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xpath_", "=_", "element_", "._", "xpath_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "single_", "=_", "lambda_", "t_", ",_", "a_", ",_", "v_", ":_", "len_", "(_", "xpath_", "(_", "\"%", "s", "[", "@", "%", "s", "='", "%", "s", "']\"_", "%_", "(_", "t_", ",_", "a_", ",_", "v_", ")_", ")_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "iter", "children_", "(_", "tag_", "=_", "etree_", "._", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "child_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "[_", "0_", "]_", "==_", "\"{\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "tag_", "._", "rsplit_", "(_", "\"}\"_", ",_", "1_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "collapse", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attributes_", "=_", "child_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "tag_", "==_", "TAG_", "._", "resource_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "resource_", "=_", "attributes_", "._", "get_", "(_", "ATTRIBUTE_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "PREFIX_", "._", "resource_", ",_", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collapse", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "TAG_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "r_", "=_", "attributes_", "._", "get_", "(_", "ATTRIBUTE_", "._", "resource_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "PREFIX_", "._", "options_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single_", "=_", "is", "\\u", "single_", "(_", "TAG_", "._", "options_", ",_", "ATTRIBUTE_", "._", "resource_", ",_", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "TAG_", "._", "reference_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "f_", "=_", "attributes_", "._", "get_", "(_", "ATTRIBUTE_", "._", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "\"%", "s", "\\u", "%", "s", "\"_", "%_", "(_", "PREFIX_", "._", "reference_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single_", "=_", "is", "\\u", "single_", "(_", "TAG_", "._", "reference_", ",_", "ATTRIBUTE_", "._", "field_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "tag_", "==_", "TAG_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "tag_", "=_", "attributes_", "._", "get_", "(_", "ATTRIBUTE_", "._", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "single_", "=_", "is", "\\u", "single_", "(_", "TAG_", "._", "data_", ",_", "ATTRIBUTE_", "._", "field_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "s_", "in_", "iter", "children_", "(_", "tag_", "=_", "tag_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "single_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "single_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "single_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "child", "\\u", "obj_", "=_", "element", "2j", "son_", "(_", "child_", ",_", "native_", "=_", "native_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child", "\\u", "obj_", "is_", "not_", "None_", "and_", "child", "\\u", "obj_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "tag_", "not_", "in_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "single_", "and_", "collapse", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "obj_", "[_", "tag_", "]_", "=_", "child", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "obj_", "[_", "tag_", "]_", "=_", "[_", "child", "\\u", "obj_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "type_", "(_", "obj_", "[_", "tag_", "]_", ")_", "is_", "not_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "obj_", "[_", "tag_", "]_", "=_", "[_", "obj_", "[_", "tag_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "[_", "tag_", "]_", "._", "append_", "(_", "child", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attributes_", "=_", "element_", "._", "attrib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "\\u", "text_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "element_", "._", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "numeric_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "a_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "attributes_", "[_", "a_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "native_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "a_", "==_", "ATTRIBUTE_", "._", "name_", "and_", "tag_", "==_", "TAG_", "._", "resource_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "a_", "==_", "ATTRIBUTE_", "._", "resource_", "and_", "tag_", "==_", "TAG_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "a_", "==_", "ATTRIBUTE_", "._", "field_", "and_", "tag_", "in_", "(_", "TAG_", "._", "data_", ",_", "TAG_", "._", "reference_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "a_", "==_", "ATTRIBUTE_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "v_", "=_", "json_", "._", "loads_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "a_", "==_", "ATTRIBUTE_", "._", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "obj_", "[_", "TAG_", "._", "item_", "]_", "=_", "json_", "._", "loads_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "skip", "\\u", "text_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "a_", "==_", "ATTRIBUTE_", "._", "type_", "and_", "v_", "==_", "\"", "numeri", "c", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "numeric_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "[_", "PREFIX_", "._", "attribute_", "+_", "a_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "element_", "._", "text_", "and_", "not_", "skip", "\\u", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "represent_", "=_", "cls_", "._", "xml", "\\u", "decode_", "(_", "element_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "numeric_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Value", " ", "shou", "ld", " ", "be", " ", "a", " ", "number", " ", "not", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "float", "\\u", "represent_", "=_", "float_", "(_", "represent_", "._", "replace_", "(_", "\",\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "int\\u", "represent_", "=_", "int_", "(_", "float", "\\u", "represent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int\\u", "represent_", "==_", "float", "\\u", "represent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "represent_", "=_", "int\\u", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "represent_", "=_", "float", "\\u", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "@", "To", "Do", ":", " ", "Don", "'", "t", " ", "assume", " ", "this", " ", "i18n", " ", "format", "ting", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "[_", "PREFIX_", "._", "text_", "]_", "=_", "represent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "obj_", ")_", "==_", "1_", "and_", "obj_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", "in_", "(_", "PREFIX_", "._", "text_", ",_", "TAG_", "._", "item_", ",_", "TAG_", "._", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "obj_", "[_", "obj_", "._", "keys_", "(_", ")_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "XML_", "(_", "S", "3", "Codec_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "csv", "2t", "ree_", "(_", "cls_", ",_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resource", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "data_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hashtag", "s_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delimiter_", "=_", "\",\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quotechar", "_", "=_", "'\"'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "a", " ", "table", "-", "form", " ", "CSV", " ", "source", " ", "int", "o", " ", "an", " ", "element", " ", "tree", ",", " ", "consi", "stin", "g", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "<", "table", " ", "name", "=\"", "format", "\">", ",", " ", "<", "row", ">", " ", "and", " ", "<", "col", " ", "field", "=\"", "field", "name", "\">", " ", "element", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "source", ":", " ", "the", " ", "source", " ", "(", "file", "-", "like", " ", "object", ")", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "resource", "name", ":", " ", "the", " ", "resource", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "extra", "\\u", "data", ":", " ", "dict", " ", "of", " ", "extra", " ", "cols", " ", "{", "key", ":", "value", "}", " ", "to", " ", "add", " ", "to", " ", "each", " ", "row", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "hashtag", "s", ":", " ", "dict", " ", "of", " ", "hashtag", "s", " ", "for", " ", "extra", " ", "cols", " ", "{", "key", ":", "hashtag", "}", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "delimiter", ":", " ", "delimiter", " ", "for", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "quotechar", ":", " ", "quotation", " ", "character", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "todo", ":", " ", "add", " ", "a", " ", "character", " ", "encoding", " ", "parameter", " ", "to", " ", "skip", " ", "the", " ", "guess", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increase", " ", "field", " ", "size", " ", "to", " ", "be", " ", "able", " ", "to", " ", "import", " ", "WK", "Ts_", "\\u\\u\\uNL\\u\\u\\u_", "csv_", "._", "field", "\\u", "size", "\\u", "limit_", "(_", "2_", "**_", "20_", "*_", "100_", ")_", "#", " ", "100", " ", "me", "gs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Short", "cuts_", "\\u\\u\\uNL\\u\\u\\u_", "ATTRIBUTE_", "=_", "cls_", "._", "ATTRIBUTE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FIELD_", "=_", "ATTRIBUTE_", "._", "field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "HT", "AG", "_", "=_", "ATTRIBUTE_", "._", "hashtag", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG_", "=_", "cls_", "._", "TAG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COL_", "=_", "TAG_", "._", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Sub", "Element_", "=_", "etree_", "._", "Sub", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "=_", "etree_", "._", "Element_", "(_", "TAG_", "._", "table_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resource", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "._", "set_", "(_", "ATTRIBUTE_", "._", "name_", ",_", "resource", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "col_", "(_", "row_", ",_", "key_", ",_", "value_", ",_", "hashtag", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "=_", "Sub", "Element_", "(_", "row_", ",_", "COL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "._", "set_", "(_", "FIELD_", ",_", "s3", "\\u", "unicode_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hashtag", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hashtag", "_", "=_", "hashtag", "s_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hashtag", "_", "and_", "hashtag", "_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "col_", "._", "set_", "(_", "HAS", "HT", "AG", "_", ",_", "hashtag", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "s3", "\\u", "unicode_", "(_", "value_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text_", "[_", ":_", "6_", "]_", "._", "lower_", "(_", ")_", "not_", "in_", "(_", "\"", "null", "\"_", ",_", "\"<", "null", ">\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "col_", "._", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Memo", "ry", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "current_", "._", "log_", "._", "error_", "(_", "\"", "S", "3", "XML", ":", " ", "Una", "ble", " ", "to", " ", "set", " ", "value", " ", "for", " ", "key", " ", "%", "s", ":", " ", "Memo", "ry", "Error", "\"_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col_", "._", "text_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "utf", "\\u", "8", "\\u", "encode_", "(_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "UT", "F", "-", "8", "-", "reco", "de", " ", "the", " ", "source", " ", "line", " ", "by", " ", "line", ",", " ", "guess", "ing", " ", "the", " ", "character", "\\", "10", ";", " ", " ", " ", " ", "encoding", " ", "of", " ", "the", " ", "source", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "this", " ", "a", " ", "list", " ", "of", " ", "all", " ", "encoding", "s", " ", "you", " ", "need", " ", "to", " ", "support", " ", "(", "as", " ", "long", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "are", " ", "support", "ed", " ", "by", " ", "Pyth", "on", " ", "codec", "s", "),", " ", "alw", "ay", "s", " ", "startin", "g", " ", "with", " ", "the", " ", "most", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "like", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "encodings_", "=_", "(_", "\"", "utf", "-", "8", "-", "sig", "\"_", ",_", "\"", "iso", "-", "8859", "-1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "encodings_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "source_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "unicode_", "(_", "line_", ",_", "e_", ",_", "\"", "strict", "\"_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "encoding_", "in_", "encodings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "unicode_", "(_", "line_", ",_", "encoding_", ",_", "\"", "strict", "\"_", ")_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "e_", "=_", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "hashtag", "s_", "=_", "dict_", "(_", "hashtag", "s_", ")_", "if_", "hashtag", "s_", "else_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "source_", ",_", "String", "IO_", "._", "String", "IO_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "utf", "\\u", "8", "\\u", "encode_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reader_", "=_", "csv_", "._", "Dict", "Reader_", "(_", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delimiter_", "=_", "delimiter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quotechar", "_", "=_", "quotechar", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ROW", "_", "=_", "TAG_", "._", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "r_", "in_", "enumerate_", "(_", "reader_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ski", "p", " ", "empty", " ", "rows_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "any_", "(_", "r_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Auto", "-", "detect", " ", "hashtag", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "items_", "=_", "dict_", "(_", "(_", "k_", ",_", "s3", "\\u", "unicode_", "(_", "v_", "._", "strip_", "(_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "r_", "._", "items_", "(_", ")_", "if_", "k_", "and_", "v_", "and_", "v_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "all_", "(_", "v_", "[_", "0_", "]_", "==_", "\"#\"_", "for_", "v_", "in_", "items_", "._", "values_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "hashtag", "s_", "._", "update_", "(_", "items_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "=_", "Sub", "Element_", "(_", "root_", ",_", "ROW", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "\\u", "col_", "(_", "row_", ",_", "k_", ",_", "r_", "[_", "k_", "]_", ",_", "hashtag", "s_", "=_", "hashtag", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "key_", "in_", "extra", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "key_", "not_", "in_", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "add", "\\u", "col_", "(_", "row_", ",_", "key_", ",_", "extra", "\\u", "data_", "[_", "key_", "]_", ",_", "hashtag", "s_", "=_", "hashtag", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "csv_", "._", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "HTTP_", "(_", "400_", ",_", "body_", "=_", "cls_", "._", "json", "\\u", "message_", "(_", "False_", ",_", "400_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "this", " ", "to", " ", "debug", " ", "the", " ", "source", " ", "tree", " ", "if", " ", "need", "ed", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", ">>", "sys", ".", "std", "err", ",", " ", "cls", ".", "tost", "ring", "(", "root", ",", " ", "pretty", "\\u", "print", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "etree_", "._", "Element", "Tree_", "(_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
japerk/nltk-trainer/analyze_chunked_corpus.py
[ { "content": "#!/usr/bin/env python\nimport argparse, collections\nimport nltk.corpus\nfrom nltk.tree import Tree\nfrom nltk.corpus.util import LazyCorpusLoader\nfrom nltk_trainer import load_corpus_reader, simplify_wsj_tag\nfrom nltk_trainer.chunking.transforms import node_label\n\n########################################\n## command options & argument parsing ##\n########################################\n\nparser = argparse.ArgumentParser(description='Analyze a chunked corpus',\n\tformatter_class=argparse.RawTextHelpFormatter)\n\nparser.add_argument('corpus',\n\thelp='''The name of a chunked corpus included with NLTK, such as\ntreebank_chunk or conll2002, or the root path to a corpus directory,\nwhich can be either an absolute path or relative to a nltk_data directory.''')\nparser.add_argument('--trace', default=1, type=int,\n\thelp='How much trace output you want, defaults to %(default)d. 0 is no trace output.')\n\ncorpus_group = parser.add_argument_group('Corpus Reader Options')\ncorpus_group.add_argument('--reader', default=None,\n\thelp='''Full module path to a corpus reader class, such as\nnltk.corpus.reader.chunked.ChunkedCorpusReader''')\ncorpus_group.add_argument('--fileids', default=None,\n\thelp='Specify fileids to load from corpus')\n\nif simplify_wsj_tag:\n\tcorpus_group.add_argument('--simplify_tags', action='store_true', default=False,\n\t\thelp='Use simplified tags')\n\nsort_group = parser.add_argument_group('Tag Count Sorting Options')\nsort_group.add_argument('--sort', default='tag', choices=['tag', 'count'],\n\thelp='Sort key, defaults to %(default)s')\nsort_group.add_argument('--reverse', action='store_true', default=False,\n\thelp='Sort in revere order')\n\nargs = parser.parse_args()\n\n###################\n## corpus reader ##\n###################\n\nchunked_corpus = load_corpus_reader(args.corpus, reader=args.reader, fileids=args.fileids)\n\nif not chunked_corpus:\n\traise ValueError('%s is an unknown corpus')\n\nif args.trace:\n\tprint('loading %s' % args.corpus)\n\n##############\n## counting ##\n##############\n\nwc = 0\ntag_counts = collections.defaultdict(int)\niob_counts = collections.defaultdict(int)\ntag_iob_counts = collections.defaultdict(lambda: collections.defaultdict(int))\nword_set = set()\n\nfor obj in chunked_corpus.chunked_words():\n\tif isinstance(obj, Tree):\n\t\tlabel = node_label(obj)\n\t\tiob_counts[label] += 1\n\t\t\n\t\tfor word, tag in obj.leaves():\n\t\t\twc += 1\n\t\t\tword_set.add(word)\n\t\t\ttag_counts[tag] += 1\n\t\t\ttag_iob_counts[tag][label] += 1\n\telse:\n\t\tword, tag = obj\n\t\twc += 1\n\t\tword_set.add(word)\n\t\ttag_counts[tag] += 1\n\n############\n## output ##\n############\n\nprint('%d total words' % wc)\nprint('%d unique words' % len(word_set))\nprint('%d tags' % len(tag_counts))\nprint('%d IOBs\\n' % len(iob_counts))\n\nif args.sort == 'tag':\n\tsort_key = lambda tc: tc[0]\nelif args.sort == 'count':\n\tsort_key = lambda tc: tc[1]\nelse:\n\traise ValueError('%s is not a valid sort option' % args.sort)\n\nline1 = ' Tag Count '\nline2 = '======= ========='\n\niobs = sorted(iob_counts.keys())\n\nfor iob in iobs:\n\tline1 += ' %s ' % iob\n\tline2 += ' ==%s==' % ('=' * len(iob))\n\nprint(line1)\nprint(line2)\n\nfor tag, count in sorted(tag_counts.items(), key=sort_key, reverse=args.reverse):\n\tiob_counts = [str(tag_iob_counts[tag][iob]).rjust(4+len(iob)) for iob in iobs]\n\tprint(' '.join([tag.ljust(7), str(count).rjust(9)] + iob_counts))\n\nprint(line2)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import nltk.corpus", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 18 }, { "span": "from nltk.corpus.util import LazyCorpusLoader", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", ",_", "collections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nltk_", "._", "corpus_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "tree_", "import_", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nltk_", "._", "corpus_", "._", "util_", "import_", "La", "zy", "Cor", "pus", "Loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nlt", "k", "\\u", "trainer_", "import_", "load", "\\u", "corp", "us", "\\u", "reader_", ",_", "simplify", "\\u", "ws", "j", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nlt", "k", "\\u", "trainer_", "._", "chunk", "ing_", "._", "transforms_", "import_", "node", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "command", " ", "options", " ", "&", " ", "argu", "ment", " ", "pars", "ing", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "######", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Analy", "ze", " ", "a", " ", "chunked", " ", "corp", "us", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "formatter", "\\u", "class_", "=_", "argparse_", "._", "Ra", "w", "Text", "Help", "Formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "corp", "us", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "The", " ", "name", " ", "of", " ", "a", " ", "chunked", " ", "corp", "us", " ", "include", "d", " ", "with", " ", "NL", "TK", ",", " ", "suc", "h", " ", "as", "\\", "10", ";", "tree", "bank", "\\u", "chunk", " ", "or", " ", "conl", "l2", "002", ",", " ", "or", " ", "the", " ", "root", " ", "path", " ", "to", " ", "a", " ", "corp", "us", " ", "director", "y", ",", "\\", "10", ";", "whi", "ch", " ", "can", " ", "be", " ", "eit", "her", " ", "an", " ", "abs", "olute", " ", "path", " ", "or", " ", "relative", " ", "to", " ", "a", " ", "nlt", "k", "\\u", "data", " ", "director", "y", ".'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "trace", "'_", ",_", "default_", "=_", "1_", ",_", "type_", "=_", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Ho", "w", " ", "muc", "h", " ", "trace", " ", "output", " ", "you", " ", "want", ",", " ", "default", "s", " ", "to", " ", "%", "(", "default", ")", "d", ".", " ", "0", " ", "is", " ", "no", " ", "trace", " ", "output", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "corp", "us", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "argu", "ment", "\\u", "group_", "(_", "'", "Cor", "pus", " ", "Read", "er", " ", "Optio", "ns", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corp", "us", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'--", "reader", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'''", "Full", " ", "module", " ", "path", " ", "to", " ", "a", " ", "corp", "us", " ", "reader", " ", "class", ",", " ", "suc", "h", " ", "as", "\\", "10", ";", "nlt", "k", ".", "corp", "us", ".", "reader", ".", "chunked", ".", "Chunk", "ed", "Cor", "pus", "Read", "er", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "corp", "us", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'--", "fileid", "s", "'_", ",_", "default_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Speci", "fy", " ", "fileid", "s", " ", "to", " ", "load", " ", "from", " ", "corp", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "simplify", "\\u", "ws", "j", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "corp", "us", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'--", "simplify", "\\u", "tags", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Us", "e", " ", "simplified", " ", "tags", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sort", "\\u", "group_", "=_", "parser_", "._", "add", "\\u", "argu", "ment", "\\u", "group_", "(_", "'", "Ta", "g", " ", "Count", " ", "Sort", "ing", " ", "Optio", "ns", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'--", "sort", "'_", ",_", "default_", "=_", "'", "tag", "'_", ",_", "choices_", "=_", "[_", "'", "tag", "'_", ",_", "'", "count", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Sort", " ", "key", ",", " ", "default", "s", " ", "to", " ", "%", "(", "default", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sort", "\\u", "group_", "._", "add", "\\u", "argument_", "(_", "'--", "reverse", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "default_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "'", "Sort", " ", "in", " ", "rever", "e", " ", "order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "corp", "us", " ", "reader", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chunked", "\\u", "corpus_", "=_", "load", "\\u", "corp", "us", "\\u", "reader_", "(_", "args_", "._", "corpus_", ",_", "reader_", "=_", "args_", "._", "reader_", ",_", "fileid", "s_", "=_", "args_", "._", "fileid", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "chunked", "\\u", "corpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "raise_", "Value", "Error_", "(_", "'%", "s", " ", "is", " ", "an", " ", "unknown", " ", "corp", "us", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "args_", "._", "trace_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "print_", "(_", "'", "load", "ing", " ", "%", "s", "'_", "%_", "args_", "._", "corpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "counti", "ng", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "wc_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "counts_", "=_", "collections_", "._", "defaultdict_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iob", "\\u", "counts_", "=_", "collections_", "._", "defaultdict_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "iob", "\\u", "counts_", "=_", "collections_", "._", "defaultdict_", "(_", "lambda_", ":_", "collections_", "._", "defaultdict_", "(_", "int_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "\\u", "set_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "chunked", "\\u", "corpus_", "._", "chunked", "\\u", "words_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "isinstance_", "(_", "obj_", ",_", "Tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "label_", "=_", "node", "\\u", "label_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iob", "\\u", "counts_", "[_", "label_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "word_", ",_", "tag_", "in_", "obj_", "._", "leaves_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "wc_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "\\u", "set_", "._", "add_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "counts_", "[_", "tag_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "iob", "\\u", "counts_", "[_", "tag_", "]_", "[_", "label_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "word_", ",_", "tag_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wc_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "word", "\\u", "set_", "._", "add_", "(_", "word_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag", "\\u", "counts_", "[_", "tag_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "output", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'%", "d", " ", "total", " ", "words", "'_", "%_", "wc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'%", "d", " ", "unique", " ", "words", "'_", "%_", "len_", "(_", "word", "\\u", "set_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'%", "d", " ", "tags", "'_", "%_", "len_", "(_", "tag", "\\u", "counts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'%", "d", " ", "IO", "Bs", "\\\\", "n", "'_", "%_", "len_", "(_", "iob", "\\u", "counts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "args_", "._", "sort_", "==_", "'", "tag", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "sort", "\\u", "key_", "=_", "lambda_", "tc_", ":_", "tc_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "args_", "._", "sort_", "==_", "'", "count", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "sort", "\\u", "key_", "=_", "lambda_", "tc_", ":_", "tc_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "raise_", "Value", "Error_", "(_", "'%", "s", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "sort", " ", "option", "'_", "%_", "args_", "._", "sort_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line1_", "=_", "'", " ", " ", "Ta", "g", " ", " ", "Count", " ", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line2_", "=_", "'===", "====", " ", " ", "=========", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "iob", "s_", "=_", "sorted_", "(_", "iob", "\\u", "counts_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "iob", "_", "in_", "iob", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "line1_", "+=_", "'", " ", " ", " ", " ", "%", "s", " ", " ", "'_", "%_", "iob", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line2_", "+=_", "'", " ", " ", "==", "%", "s", "=='", "_", "%_", "(_", "'='_", "*_", "len_", "(_", "iob", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "line1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "line2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tag_", ",_", "count_", "in_", "sorted_", "(_", "tag", "\\u", "counts_", "._", "items_", "(_", ")_", ",_", "key_", "=_", "sort", "\\u", "key_", ",_", "reverse_", "=_", "args_", "._", "reverse_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "iob", "\\u", "counts_", "=_", "[_", "str_", "(_", "tag", "\\u", "iob", "\\u", "counts_", "[_", "tag_", "]_", "[_", "iob", "_", "]_", ")_", "._", "rjust_", "(_", "4_", "+_", "len_", "(_", "iob", "_", ")_", ")_", "for_", "iob", "_", "in_", "iob", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", " ", "'_", "._", "join_", "(_", "[_", "tag_", "._", "ljust_", "(_", "7_", ")_", ",_", "str_", "(_", "count_", ")_", "._", "rjust_", "(_", "9_", ")_", "]_", "+_", "iob", "\\u", "counts_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "line2_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
pydata/numexpr/setup.py
[ { "content": "def setup_package():\n metadata = dict(\n description='Fast numerical expression evaluator for NumPy',\n author='David M. Cooke, Francesc Alted and others',\n author_email='[email protected], [email protected]',\n url='https://github.com/pydata/numexpr',\n license='MIT',\n packages=['numexpr'],\n install_requires=requirements,\n setup_requires=requirements\n )\n if (len(sys.argv) >= 2 and\n ('--help' in sys.argv[1:] or\n (sys.argv[1] in (\n '--help-commands', 'egg_info', '--version', 'clean', '--name')))):\n\n # For these actions, NumPy is not required.\n #\n # They are required to succeed without Numpy for example when\n # pip is used to install Numexpr when Numpy is not yet present in\n # the system.\n # (via https://github.com/abhirk/scikit-learn/blob/master/setup.py)\n try:\n from setuptools import setup\n except ImportError:\n from distutils.core import setup\n\n metadata['name'] = 'numexpr'\n metadata['version'] = version\n else:\n from numpy.distutils.core import setup\n from numpy.distutils.command.build_ext import build_ext as numpy_build_ext\n\n try: # Python 3\n # Code taken form numpy/distutils/command/build_py.py\n # XXX: update LICENSES\n from distutils.command.build_py import build_py_2to3 as old_build_py\n from numpy.distutils.misc_util import is_string\n\n class build_py(old_build_py):\n\n def run(self):\n build_src = self.get_finalized_command('build_src')\n if build_src.py_modules_dict and self.packages is None:\n self.packages = list(build_src.py_modules_dict.keys())\n old_build_py.run(self)\n\n def find_package_modules(self, package, package_dir):\n modules = old_build_py.find_package_modules(\n self, package, package_dir)\n\n # Find build_src generated *.py files.\n build_src = self.get_finalized_command('build_src')\n modules += build_src.py_modules_dict.get(package, [])\n\n return modules\n\n def find_modules(self):\n old_py_modules = self.py_modules[:]\n new_py_modules = list(filter(is_string, self.py_modules))\n self.py_modules[:] = new_py_modules\n modules = old_build_py.find_modules(self)\n self.py_modules[:] = old_py_modules\n\n return modules\n\n except ImportError: # Python 2\n from numpy.distutils.command.build_py import build_py\n\n DEBUG = False\n\n def localpath(*args):\n return op.abspath(op.join(*((op.dirname(__file__),) + args)))\n\n def debug(instring):\n if DEBUG:\n print(\" DEBUG: \" + instring)\n\n\n def configuration():\n from numpy.distutils.misc_util import Configuration, dict_append\n from numpy.distutils.system_info import system_info\n\n config = Configuration('numexpr')\n\n #try to find configuration for MKL, either from environment or site.cfg\n if op.exists('site.cfg'):\n mkl_config_data = config.get_info('mkl')\n # Some version of MKL needs to be linked with libgfortran.\n # For this, use entries of DEFAULT section in site.cfg.\n default_config = system_info()\n dict_append(mkl_config_data,\n libraries=default_config.get_libraries(),\n library_dirs=default_config.get_lib_dirs())\n else:\n mkl_config_data = {}\n\n # setup information for C extension\n if os.name == 'nt':\n pthread_win = ['numexpr/win32/pthread.c']\n else:\n pthread_win = []\n extension_config_data = {\n 'sources': ['numexpr/interpreter.cpp',\n 'numexpr/module.cpp',\n 'numexpr/numexpr_object.cpp'] + pthread_win,\n 'depends': ['numexpr/interp_body.cpp',\n 'numexpr/complex_functions.hpp',\n 'numexpr/interpreter.hpp',\n 'numexpr/module.hpp',\n 'numexpr/msvc_function_stubs.hpp',\n 'numexpr/numexpr_config.hpp',\n 'numexpr/numexpr_object.hpp'],\n 'libraries': ['m'],\n 'extra_compile_args': ['-funroll-all-loops', ],\n }\n dict_append(extension_config_data, **mkl_config_data)\n if 'library_dirs' in mkl_config_data:\n library_dirs = ':'.join(mkl_config_data['library_dirs'])\n config.add_extension('interpreter', **extension_config_data)\n\n config.make_config_py()\n config.add_subpackage('tests', 'numexpr/tests')\n\n #version handling\n config.get_version('numexpr/version.py')\n return config\n\n\n class cleaner(clean):\n\n def run(self):\n # Recursive deletion of build/ directory\n path = localpath(\"build\")\n try:\n shutil.rmtree(path)\n except Exception:\n debug(\"Failed to remove directory %s\" % path)\n else:\n debug(\"Cleaned up %s\" % path)\n\n # Now, the extension and other files\n try:\n import imp\n except ImportError:\n if os.name == 'posix':\n paths = [localpath(\"numexpr/interpreter.so\")]\n else:\n paths = [localpath(\"numexpr/interpreter.pyd\")]\n else:\n paths = []\n for suffix, _, _ in imp.get_suffixes():\n if suffix == '.py':\n continue\n paths.append(localpath(\"numexpr\", \"interpreter\" + suffix))\n paths.append(localpath(\"numexpr/__config__.py\"))\n paths.append(localpath(\"numexpr/__config__.pyc\"))\n for path in paths:\n try:\n os.remove(path)\n except Exception:\n debug(\"Failed to clean up file %s\" % path)\n else:\n debug(\"Cleaning up %s\" % path)\n\n clean.run(self)\n\n class build_ext(numpy_build_ext):\n def build_extension(self, ext):\n # at this point we know what the C compiler is.\n if self.compiler.compiler_type == 'msvc' or self.compiler.compiler_type == 'intelemw':\n ext.extra_compile_args = []\n # also remove extra linker arguments msvc doesn't understand\n ext.extra_link_args = []\n # also remove gcc math library\n ext.libraries.remove('m')\n numpy_build_ext.build_extension(self, ext)\n\n if setuptools:\n metadata['zip_safe'] = False\n\n metadata['cmdclass'] = {\n 'build_ext': build_ext,\n 'clean': cleaner,\n 'build_py': build_py,\n }\n metadata['configuration'] = configuration\n\n setup(**metadata)", "metadata": "root.setup_package", "header": "['module', '___EOS___']", "index": 33 } ]
[ { "span": "library_dirs ", "start_line": 151, "start_column": 16, "end_line": 151, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "package_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Fast", " ", "numerical", " ", "express", "ion", " ", "evaluat", "or", " ", "for", " ", "Num", "Py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Dav", "id", " ", "M", ".", " ", "Coo", "ke", ",", " ", "France", "sc", " ", "Alt", "ed", " ", "and", " ", "other", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "davi", "d", ".", "m", ".", "cook", "e", "@", "gma", "il", ".", "com", ",", " ", "fal", "tet", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "pyda", "ta", "/", "nume", "xpr", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "nume", "xpr", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "requirements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "setup", "\\u", "requires_", "=_", "requirements_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "sys_", "._", "argv_", ")_", ">=_", "2_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'--", "help", "'_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", "in_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "help", "-", "command", "s", "'_", ",_", "'", "egg", "\\u", "info", "'_", ",_", "'--", "version", "'_", ",_", "'", "clean", "'_", ",_", "'--", "name", "'_", ")_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "these", " ", "action", "s", ",", " ", "Num", "Py", " ", "is", " ", "not", " ", "require", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "y", " ", "are", " ", "require", "d", " ", "to", " ", "succe", "ed", " ", "with", "out", " ", "Num", "py", " ", "for", " ", "example", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pip", " ", "is", " ", "used", " ", "to", " ", "install", " ", "Num", "expr", " ", "whe", "n", " ", "Num", "py", " ", "is", " ", "not", " ", "ye", "t", " ", "presen", "t", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "via", " ", "https", "://", "git", "hub", ".", "com", "/", "ab", "hir", "k", "/", "scikit", "-", "learn", "/", "blob", "/", "master", "/", "setup", ".", "py", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata_", "[_", "'", "name", "'_", "]_", "=_", "'", "nume", "xpr", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "[_", "'", "version", "'_", "]_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "numpy_", "._", "distutils_", "._", "core_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "distutils_", "._", "command_", "._", "build", "\\u", "ext_", "import_", "build", "\\u", "ext_", "as_", "nump", "y", "\\u", "build", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "#", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Code", " ", "take", "n", " ", "form", " ", "nump", "y", "/", "distutils", "/", "command", "/", "build", "\\u", "py", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "XX", "X", ":", " ", "update", " ", "LICENSE", "S_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "distutils_", "._", "command_", "._", "build", "\\u", "py_", "import_", "build", "\\u", "py", "\\u", "2t", "o3", "_", "as_", "old", "\\u", "build", "\\u", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "distutils_", "._", "misc", "\\u", "util_", "import_", "is", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "build", "\\u", "py_", "(_", "old", "\\u", "build", "\\u", "py_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "build", "\\u", "src_", "=_", "self_", "._", "get", "\\u", "finalize", "d\\u", "command_", "(_", "'", "build", "\\u", "src", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "build", "\\u", "src_", "._", "py", "\\u", "module", "s", "\\u", "dict_", "and_", "self_", "._", "packages_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "packages_", "=_", "list_", "(_", "build", "\\u", "src_", "._", "py", "\\u", "module", "s", "\\u", "dict_", "._", "keys_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "build", "\\u", "py_", "._", "run_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "package", "\\u", "modules_", "(_", "self_", ",_", "package_", ",_", "package", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "modules_", "=_", "old", "\\u", "build", "\\u", "py_", "._", "find", "\\u", "package", "\\u", "modules_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "package_", ",_", "package", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fin", "d", " ", "build", "\\u", "src", " ", "generat", "ed", " ", "*.", "py", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "build", "\\u", "src_", "=_", "self_", "._", "get", "\\u", "finalize", "d\\u", "command_", "(_", "'", "build", "\\u", "src", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "+=_", "build", "\\u", "src_", "._", "py", "\\u", "module", "s", "\\u", "dict_", "._", "get_", "(_", "package_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "modules_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "old", "\\u", "py", "\\u", "modules_", "=_", "self_", "._", "py", "\\u", "modules_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "py", "\\u", "modules_", "=_", "list_", "(_", "filter_", "(_", "is", "\\u", "string_", ",_", "self_", "._", "py", "\\u", "modules_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "py", "\\u", "modules_", "[_", ":_", "]_", "=_", "new", "\\u", "py", "\\u", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "=_", "old", "\\u", "build", "\\u", "py_", "._", "find", "\\u", "modules_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "py", "\\u", "modules_", "[_", ":_", "]_", "=_", "old", "\\u", "py", "\\u", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "#", " ", "Pyth", "on", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "numpy_", "._", "distutils_", "._", "command_", "._", "build", "\\u", "py_", "import_", "build", "\\u", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "localpa", "th_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "op_", "._", "abspath_", "(_", "op_", "._", "join_", "(_", "*_", "(_", "(_", "op_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", ")_", "+_", "args_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "debug_", "(_", "instr", "ing_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", " ", "DEBU", "G", ":", " ", "\"_", "+_", "instr", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "configuration_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "numpy_", "._", "distutils_", "._", "misc", "\\u", "util_", "import_", "Configuration_", ",_", "dict", "\\u", "append_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "distutils_", "._", "system", "\\u", "info_", "import_", "system", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "Configuration_", "(_", "'", "nume", "xpr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "try", " ", "to", " ", "find", " ", "configura", "tion", " ", "for", " ", "MK", "L", ",", " ", "eit", "her", " ", "from", " ", "environ", "ment", " ", "or", " ", "site", ".", "cfg_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "op_", "._", "exists_", "(_", "'", "site", ".", "cfg", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mk", "l\\u", "config", "\\u", "data_", "=_", "config_", "._", "get", "\\u", "info_", "(_", "'", "mk", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "version", " ", "of", " ", "MK", "L", " ", "need", "s", " ", "to", " ", "be", " ", "linked", " ", "with", " ", "libg", "fortran", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "this", ",", " ", "use", " ", "entri", "es", " ", "of", " ", "DEF", "AUL", "T", " ", "section", " ", "in", " ", "site", ".", "cfg", "._", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "config_", "=_", "system", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "\\u", "append_", "(_", "mk", "l\\u", "config", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "libraries_", "=_", "default", "\\u", "config_", "._", "get", "\\u", "libraries_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "librar", "y", "\\u", "dirs_", "=_", "default", "\\u", "config_", "._", "get", "\\u", "lib", "\\u", "dirs_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mk", "l\\u", "config", "\\u", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setup", " ", "informati", "on", " ", "for", " ", "C", " ", "extension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "name_", "==_", "'", "nt", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pthread", "\\u", "win_", "=_", "[_", "'", "nume", "xpr", "/", "win32", "/", "pthread", ".", "c", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pthread", "\\u", "win_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "extensi", "on", "\\u", "config", "\\u", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "s", "'_", ":_", "[_", "'", "nume", "xpr", "/", "interprete", "r", ".", "cpp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "module", ".", "cpp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "nume", "xpr", "\\u", "object", ".", "cpp", "'_", "]_", "+_", "pthread", "\\u", "win_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "depend", "s", "'_", ":_", "[_", "'", "nume", "xpr", "/", "interp", "\\u", "body", ".", "cpp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "complex", "\\u", "function", "s", ".", "hp", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "interprete", "r", ".", "hp", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "module", ".", "hp", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "msvc", "\\u", "function", "\\u", "stub", "s", ".", "hp", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "nume", "xpr", "\\u", "config", ".", "hp", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nume", "xpr", "/", "nume", "xpr", "\\u", "object", ".", "hp", "p", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "librar", "ies", "'_", ":_", "[_", "'", "m", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "compile", "\\u", "args", "'_", ":_", "[_", "'-", "fun", "roll", "-", "all", "-", "loop", "s", "'_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dict", "\\u", "append_", "(_", "extensi", "on", "\\u", "config", "\\u", "data_", ",_", "**_", "mk", "l\\u", "config", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "librar", "y", "\\u", "dirs", "'_", "in_", "mk", "l\\u", "config", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "librar", "y", "\\u", "dirs_", "=_", "':'_", "._", "join_", "(_", "mk", "l\\u", "config", "\\u", "data_", "[_", "'", "librar", "y", "\\u", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "._", "add", "\\u", "extension_", "(_", "'", "interprete", "r", "'_", ",_", "**_", "extensi", "on", "\\u", "config", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "make", "\\u", "config", "\\u", "py_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "add", "\\u", "subpa", "ckage", "_", "(_", "'", "tests", "'_", ",_", "'", "nume", "xpr", "/", "tests", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "version", " ", "handling", "_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "._", "get", "\\u", "version_", "(_", "'", "nume", "xpr", "/", "version", ".", "py", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "cleaner", "_", "(_", "clean_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Recursive", " ", "deletion", " ", "of", " ", "build", "/", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "localpa", "th_", "(_", "\"", "build", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "shutil_", "._", "rmtree_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "debug_", "(_", "\"", "Fail", "ed", " ", "to", " ", "remove", " ", "director", "y", " ", "%", "s", "\"_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "debug_", "(_", "\"", "Cleane", "d", " ", "up", " ", "%", "s", "\"_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", ",", " ", "the", " ", "extensi", "on", " ", "and", " ", "other", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "os_", "._", "name_", "==_", "'", "posix", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "paths_", "=_", "[_", "localpa", "th_", "(_", "\"", "nume", "xpr", "/", "interprete", "r", ".", "so", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "paths_", "=_", "[_", "localpa", "th_", "(_", "\"", "nume", "xpr", "/", "interprete", "r", ".", "pyd", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "paths_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "suffix_", ",_", "\\u_", ",_", "\\u_", "in_", "imp_", "._", "get", "\\u", "suffixes_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "suffix_", "==_", "'.", "py", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "paths_", "._", "append_", "(_", "localpa", "th_", "(_", "\"", "nume", "xpr", "\"_", ",_", "\"", "interprete", "r", "\"_", "+_", "suffix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "paths_", "._", "append_", "(_", "localpa", "th_", "(_", "\"", "nume", "xpr", "/\\u", "\\u", "config", "\\u\\u", ".", "py", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "paths_", "._", "append_", "(_", "localpa", "th_", "(_", "\"", "nume", "xpr", "/\\u", "\\u", "config", "\\u\\u", ".", "pyc", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "path_", "in_", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "os_", "._", "remove_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "debug_", "(_", "\"", "Fail", "ed", " ", "to", " ", "clean", " ", "up", " ", "file", " ", "%", "s", "\"_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "debug_", "(_", "\"", "Clean", "ing", " ", "up", " ", "%", "s", "\"_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean_", "._", "run_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "build", "\\u", "ext_", "(_", "nump", "y", "\\u", "build", "\\u", "ext_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "build", "\\u", "extension_", "(_", "self_", ",_", "ext_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "at", " ", "this", " ", "point", " ", "we", " ", "know", " ", "what", " ", "the", " ", "C", " ", "compiler", " ", "is", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "compiler_", "._", "compiler", "\\u", "type_", "==_", "'", "msvc", "'_", "or_", "self_", "._", "compiler_", "._", "compiler", "\\u", "type_", "==_", "'", "intel", "em", "w", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "ext_", "._", "extra", "\\u", "compile", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "als", "o", " ", "remove", " ", "extra", " ", "linker", " ", "argu", "ment", "s", " ", "msvc", " ", "doe", "sn", "'", "t", " ", "underst", "and_", "\\u\\u\\uNL\\u\\u\\u_", "ext_", "._", "extra", "\\u", "link", "\\u", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "als", "o", " ", "remove", " ", "gcc", " ", "math", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "ext_", "._", "libraries_", "._", "remove_", "(_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nump", "y", "\\u", "build", "\\u", "ext_", "._", "build", "\\u", "extension_", "(_", "self_", ",_", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "setuptools_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "[_", "'", "zip", "\\u", "safe", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata_", "[_", "'", "cmd", "class", "'_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "build", "\\u", "ext", "'_", ":_", "build", "\\u", "ext_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "clean", "'_", ":_", "cleaner", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "build", "\\u", "py", "'_", ":_", "build", "\\u", "py_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "metadata_", "[_", "'", "configura", "tion", "'_", "]_", "=_", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "**_", "metadata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
androguard/androguard/elsim/elsim/similarity/similarity.py
[ { "content": "# This file is part of Elsim\n#\n# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>\n# All rights reserved.\n#\n# Elsim is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# Elsim is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public License\n# along with Elsim. If not, see <http://www.gnu.org/licenses/>.\n\n\nimport zlib, bz2\nimport math, json, re\n\n\n\ntry:\n from ctypes import cdll, c_float, c_double, c_int, c_uint, c_void_p, Structure, addressof, cast, c_size_t\n\n #struct libsimilarity {\n # void *orig;\n # unsigned int size_orig;\n # void *cmp;\n # unsigned size_cmp;\n\n # unsigned int *corig;\n # unsigned int *ccmp;\n #\n # float res;\n #};\n\n\n\n NATIVE_LIB = True\nexcept:\n NATIVE_LIB = False\n\n\nZLIB_COMPRESS = 0\nBZ2_COMPRESS = 1\nSMAZ_COMPRESS = 2\nLZMA_COMPRESS = 3\nXZ_COMPRESS = 4\nSNAPPY_COMPRESS = 5\nVCBLOCKSORT_COMPRESS = 6\n\nH_COMPRESSOR = { \"BZ2\" : BZ2_COMPRESS,\n \"ZLIB\" : ZLIB_COMPRESS,\n \"LZMA\" : LZMA_COMPRESS,\n \"XZ\" : XZ_COMPRESS,\n \"SNAPPY\" : SNAPPY_COMPRESS,\n }\n\nHR_COMPRESSOR = {\n BZ2_COMPRESS : \"BZ2\",\n ZLIB_COMPRESS : \"ZLIB\",\n LZMA_COMPRESS : \"LZMA\",\n XZ_COMPRESS : \"XZ\",\n SNAPPY_COMPRESS : \"SNAPPY\",\n }\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def __init__(self, path=\"./libsimilarity/libsimilarity.so\", native_lib=True):\n if native_lib == True and NATIVE_LIB == True:\n try:\n self.s = SIMILARITYNative( path )\n except:\n self.s = SIMILARITYPython()\n else:\n self.s = SIMILARITYPython()", "metadata": "root.SIMILARITY.__init__", "header": "['class', 'SIMILARITY', '(', 'object', ')', ':', '___EOS___']", "index": 371 } ]
[ { "span": "except:", "start_line": 69, "start_column": 0, "end_line": 69, "end_column": 7 }, { "span": "except:", "start_line": 375, "start_column": 12, "end_line": 375, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "El", "sim_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", ",", " ", "Ant", "hon", "y", " ", "Des", "nos", " ", "<", "des", "nos", " ", "at", " ", "t0", "t0", ".", "fr", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "El", "sim", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modify_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "Less", "er", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "El", "sim", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GN", "U", " ", "Less", "er", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "Less", "er", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "along", " ", "with", " ", "El", "sim", ".", " ", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "zlib_", ",_", "bz2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", ",_", "json_", ",_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "ctypes_", "import_", "cdl", "l_", ",_", "c\\u", "float_", ",_", "c\\u", "double_", ",_", "c\\u", "int_", ",_", "c\\u", "uint_", ",_", "c\\u", "voi", "d\\u", "p_", ",_", "Structure_", ",_", "address", "of_", ",_", "cast_", ",_", "c\\u", "size", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "struct", " ", "libs", "imi", "lar", "it", "y", " ", "{_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "voi", "d", " ", "*", "orig", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "unsigned", " ", "int", " ", "size", "\\u", "orig", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "voi", "d", " ", "*", "cmp", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "unsigned", " ", "size", "\\u", "cmp", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "unsigned", " ", "int", " ", "*", "cor", "ig", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "unsigned", " ", "int", " ", "*", "cc", "mp", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "float", " ", "res", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#}", ";_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NATI", "VE", "\\u", "LIB_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "NATI", "VE", "\\u", "LIB_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ZL", "IB", "\\u", "COMPRESS", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BZ", "2", "\\u", "COMPRESS", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SMA", "Z", "\\u", "COMPRESS", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LZ", "MA", "\\u", "COMPRESS", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "XZ", "\\u", "COMPRESS", "_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SNAP", "PY", "\\u", "COMPRESS", "_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VC", "BLOCKS", "ORT", "\\u", "COMPRESS", "_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "H", "\\u", "COMPRESS", "OR_", "=_", "{_", "\"", "BZ", "2", "\"_", ":_", "BZ", "2", "\\u", "COMPRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ZL", "IB", "\"_", ":_", "ZL", "IB", "\\u", "COMPRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "LZ", "MA", "\"_", ":_", "LZ", "MA", "\\u", "COMPRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "XZ", "\"_", ":_", "XZ", "\\u", "COMPRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "SNAP", "PY", "\"_", ":_", "SNAP", "PY", "\\u", "COMPRESS", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "HR", "\\u", "COMPRESS", "OR_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "BZ", "2", "\\u", "COMPRESS", "_", ":_", "\"", "BZ", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ZL", "IB", "\\u", "COMPRESS", "_", ":_", "\"", "ZL", "IB", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LZ", "MA", "\\u", "COMPRESS", "_", ":_", "\"", "LZ", "MA", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "XZ", "\\u", "COMPRESS", "_", ":_", "\"", "XZ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SNAP", "PY", "\\u", "COMPRESS", "_", ":_", "\"", "SNAP", "PY", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "SIM", "ILA", "RIT", "Y_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "path_", "=_", "\"./", "libs", "imi", "lar", "it", "y", "/", "libs", "imi", "lar", "it", "y", ".", "so", "\"_", ",_", "nativ", "e\\u", "lib_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "nativ", "e\\u", "lib_", "==_", "True_", "and_", "NATI", "VE", "\\u", "LIB_", "==_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "s_", "=_", "SIM", "ILA", "RIT", "YN", "ative_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "s_", "=_", "SIM", "ILA", "RIT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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
Lasagne/Lasagne/lasagne/tests/test_regularization.py
[ { "content": " def test_regularize_layer_params_single_layer(self, layers):\n from lasagne.regularization import regularize_layer_params\n l_1, l_2, l_3 = layers\n\n penalty = Mock(return_value=0)\n loss = regularize_layer_params(l_2, penalty)\n\n assert penalty.call_count == 1\n penalty.assert_any_call(l_2.W)", "metadata": "root.TestRegularizationHelpers.test_regularize_layer_params_single_layer", "header": "['class', 'TestRegularizationHelpers', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def test_regularize_layer_params_multiple_layers(self, layers):\n from lasagne.regularization import regularize_layer_params\n l_1, l_2, l_3 = layers\n\n penalty = Mock(return_value=0)\n loss = regularize_layer_params([l_1, l_2, l_3], penalty)\n\n assert penalty.call_count == 2\n penalty.assert_any_call(l_2.W)\n penalty.assert_any_call(l_3.W)", "metadata": "root.TestRegularizationHelpers.test_regularize_layer_params_multiple_layers", "header": "['class', 'TestRegularizationHelpers', '(', 'object', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_regularize_network_params(self, layers):\n from lasagne.regularization import regularize_network_params\n l_1, l_2, l_3 = layers\n\n penalty = Mock(return_value=0)\n loss = regularize_network_params(l_3, penalty)\n\n assert penalty.call_count == 2\n penalty.assert_any_call(l_2.W)\n penalty.assert_any_call(l_3.W)", "metadata": "root.TestRegularizationHelpers.test_regularize_network_params", "header": "['class', 'TestRegularizationHelpers', '(', 'object', ')', ':', '___EOS___']", "index": 74 } ]
[ { "span": "loss ", "start_line": 58, "start_column": 8, "end_line": 58, "end_column": 12 }, { "span": "loss ", "start_line": 68, "start_column": 8, "end_line": 68, "end_column": 12 }, { "span": "loss ", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Regula", "riz", "ation", "Helpers_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "regulari", "ze", "\\u", "layer", "\\u", "params", "\\u", "single", "\\u", "layer_", "(_", "self_", ",_", "layers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lasagne_", "._", "regularization", "_", "import_", "regulari", "ze", "\\u", "layer", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "1_", ",_", "l\\u", "2_", ",_", "l\\u", "3_", "=_", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "penalty_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loss_", "=_", "regulari", "ze", "\\u", "layer", "\\u", "params_", "(_", "l\\u", "2_", ",_", "penalty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "penalty_", "._", "call", "\\u", "count_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "penalty_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "l\\u", "2_", "._", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regula", "riz", "ation", "Helpers_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "regulari", "ze", "\\u", "layer", "\\u", "params", "\\u", "multiple", "\\u", "layers_", "(_", "self_", ",_", "layers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lasagne_", "._", "regularization", "_", "import_", "regulari", "ze", "\\u", "layer", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "1_", ",_", "l\\u", "2_", ",_", "l\\u", "3_", "=_", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "penalty_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loss_", "=_", "regulari", "ze", "\\u", "layer", "\\u", "params_", "(_", "[_", "l\\u", "1_", ",_", "l\\u", "2_", ",_", "l\\u", "3_", "]_", ",_", "penalty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "penalty_", "._", "call", "\\u", "count_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "penalty_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "l\\u", "2_", "._", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "penalty_", "._", "assert", "\\u", "any", "\\u", "call_", "(_", "l\\u", "3_", "._", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regula", "riz", "ation", "Helpers_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "regulari", "ze", "\\u", "network", "\\u", "params_", "(_", "self_", ",_", "layers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "lasagne_", "._", "regularization", "_", "import_", "regulari", "ze", "\\u", "network", "\\u", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "1_", ",_", "l\\u", "2_", ",_", "l\\u", "3_", "=_", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "penalty_", "=_", "Mock_", "(_", "return", "\\u", "value_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loss_", "=_", "regulari", "ze", "\\u", "network", "\\u", "params_", "(_", "l\\u", "3_", ",_", "penalty_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "penalty_", "._", "call", "\\u", "count_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "penalty_", "._", "ass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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
SmokinCaterpillar/pypet/pypet/tests/integration/git_check.py
[ { "content": "import sys\nimport os\nimport getopt\n\ntry:\n import pypet\nexcept ImportError:\n # Check if pypet is installed otherwise append /pypet folder\n # this is important for travis-ci\n path = os.path.abspath('../../../')\n print('Adding pypet path:`%s`' % path)\n sys.path.append(path)\n\n\nfrom pypet import Environment\nfrom pypet import cartesian_product, GitDiffError\nimport pypet.compat as compat\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n opt_dict = get_opt()\n test_fail = opt_dict.get('fail', False)\n if test_fail:\n fail_on_diff()\n test_no_fail = opt_dict.get('no_fail', False)\n main(test_no_fail)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def multiply(traj):\n z=traj.x*traj.y\n traj.f_add_result('z',z, comment='Im the product of two reals!')", "metadata": "root.multiply", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def get_opt():\n opt_list, _ = getopt.getopt(sys.argv[1:],'fn')\n opt_dict = {}\n for opt, arg in opt_list:\n if opt == '-f':\n opt_dict['fail'] = True\n print('I will try to fail on diffs.')\n if opt == '-n':\n opt_dict['no_fail'] = True\n print('I will try to fail on diffs, but there should not be any.')\n\n return opt_dict", "metadata": "root.get_opt", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def fail_on_diff():\n try:\n Environment(trajectory='fail',\n filename=os.path.join('fail',\n 'HDF5',),\n file_title='failing',\n git_repository='.', git_message='Im a message!',\n git_fail=True)\n raise RuntimeError('You should not be here!')\n except GitDiffError as exc:\n print('I expected the GitDiffError: `%s`' % repr(exc))", "metadata": "root.fail_on_diff", "header": "['module', '___EOS___']", "index": 38 }, { "content": "def main(fail=False):\n try:\n if compat.python_major == 3:\n print('Running Python 3, will not use Sumatra.')\n sumatra_project = None\n else:\n sumatra_project = '.'\n\n if fail:\n print('There better be not any diffs.')\n\n # Create an environment that handles running\n with Environment(trajectory='Example1_Quick_And_Not_So_Dirty',\n filename=os.path.join('experiments',\n 'HDF5',),\n file_title='Example1_Quick_And_Not_So_Dirty',\n comment='The first example!',\n complib='blosc',\n small_overview_tables=False,\n git_repository='.', git_message='Im a message!',\n git_fail=fail,\n sumatra_project=sumatra_project, sumatra_reason='Testing!') as env:\n\n # Get the trajectory from the environment\n traj = env.v_trajectory\n\n # Add both parameters\n traj.f_add_parameter('x', 1, comment='Im the first dimension!')\n traj.f_add_parameter('y', 1, comment='Im the second dimension!')\n\n # Explore the parameters with a cartesian product:\n traj.f_explore(cartesian_product({'x':[1,2,3], 'y':[6,7,8]}))\n\n # Run the simulation\n env.f_run(multiply)\n\n # Check that git information was added to the trajectory\n assert 'config.git.hexsha' in traj\n assert 'config.git.committed_date' in traj\n assert 'config.git.message' in traj\n assert 'config.git.name_rev' in traj\n\n print(\"Python git test successful\")\n\n # traj.f_expand({'x':[3,3],'y':[42,43]})\n #\n # env.f_run(multiply)\n except Exception as exc:\n print(repr(exc))\n sys.exit(1)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 51 } ]
[ { "span": "import pypet", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "getopt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pype", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "pype", "t", " ", "is", " ", "install", "ed", " ", "other", "wis", "e", " ", "append", " ", "/", "pype", "t", " ", "folder_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "importa", "nt", " ", "for", " ", "travis", "-", "ci_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "'../../", "..", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Add", "ing", " ", "pype", "t", " ", "path", ":`", "%", "s", "`'_", "%_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "pype", "t_", "import_", "Environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pype", "t_", "import_", "cartesian", "\\u", "product_", ",_", "Git", "Diff", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pype", "t_", "._", "compat_", "as_", "compat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "\\u", "dict_", "=_", "get", "\\u", "opt_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "fail_", "=_", "opt", "\\u", "dict_", "._", "get_", "(_", "'", "fail", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "test\\u", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fail", "\\u", "on", "\\u", "diff_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "no", "\\u", "fail_", "=_", "opt", "\\u", "dict_", "._", "get_", "(_", "'", "no", "\\u", "fail", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main_", "(_", "test\\u", "no", "\\u", "fail_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "multiply_", "(_", "traj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "z_", "=_", "traj_", "._", "x_", "*_", "traj_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traj_", "._", "f", "\\u", "add", "\\u", "result_", "(_", "'", "z", "'_", ",_", "z_", ",_", "comment_", "=_", "'", "Im", " ", "the", " ", "product", " ", "of", " ", "two", " ", "real", "s", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "opt_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "\\u", "list_", ",_", "\\u_", "=_", "getopt_", "._", "getopt_", "(_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ",_", "'", "fn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opt", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "opt_", ",_", "arg_", "in_", "opt", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "opt_", "==_", "'-", "f", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "\\u", "dict_", "[_", "'", "fail", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "I", " ", "will", " ", "try", " ", "to", " ", "fail", " ", "on", " ", "diffs", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "opt_", "==_", "'-", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "opt", "\\u", "dict_", "[_", "'", "no", "\\u", "fail", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "I", " ", "will", " ", "try", " ", "to", " ", "fail", " ", "on", " ", "diffs", ",", " ", "but", " ", "there", " ", "shou", "ld", " ", "not", " ", "be", " ", "any", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "opt", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fail", "\\u", "on", "\\u", "diff_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Environment_", "(_", "trajectory_", "=_", "'", "fail", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'", "fail", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HDF", "5", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "title_", "=_", "'", "faili", "ng", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "repository_", "=_", "'.'_", ",_", "git", "\\u", "message_", "=_", "'", "Im", " ", "a", " ", "message", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "'", "You", " ", "shou", "ld", " ", "not", " ", "be", " ", "here", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Git", "Diff", "Error_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "I", " ", "expected", " ", "the", " ", "Git", "Diff", "Error", ":", " ", "`", "%", "s", "`'_", "%_", "repr_", "(_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", "fail_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "compat_", "._", "python", "\\u", "major_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Run", "ning", " ", "Pyth", "on", " ", "3", ",", " ", "will", " ", "not", " ", "use", " ", "Sum", "atr", "a", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suma", "tra", "\\u", "project_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suma", "tra", "\\u", "project_", "=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "There", " ", "bett", "er", " ", "be", " ", "not", " ", "any", " ", "diffs", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "environ", "ment", " ", "tha", "t", " ", "handle", "s", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "Environment_", "(_", "trajectory_", "=_", "'", "Exam", "ple", "1", "\\u", "Qui", "ck", "\\u", "And", "\\u", "Not", "\\u", "So", "\\u", "Dirty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "os_", "._", "path_", "._", "join_", "(_", "'", "experiment", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "HDF", "5", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "title_", "=_", "'", "Exam", "ple", "1", "\\u", "Qui", "ck", "\\u", "And", "\\u", "Not", "\\u", "So", "\\u", "Dirty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "comment_", "=_", "'", "The", " ", "first", " ", "example", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compli", "b_", "=_", "'", "blo", "sc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "small", "\\u", "over", "view", "\\u", "tables_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "repository_", "=_", "'.'_", ",_", "git", "\\u", "message_", "=_", "'", "Im", " ", "a", " ", "message", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "fail_", "=_", "fail_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suma", "tra", "\\u", "project_", "=_", "suma", "tra", "\\u", "project_", ",_", "suma", "tra", "\\u", "reason_", "=_", "'", "Test", "ing", "!'_", ")_", "as_", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "trajecto", "ry", " ", "from", " ", "the", " ", "environment_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "traj_", "=_", "env_", "._", "v", "\\u", "trajectory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "bot", "h", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "traj_", "._", "f", "\\u", "add", "\\u", "parameter_", "(_", "'", "x", "'_", ",_", "1_", ",_", "comment_", "=_", "'", "Im", " ", "the", " ", "first", " ", "dimension", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "traj_", "._", "f", "\\u", "add", "\\u", "parameter_", "(_", "'", "y", "'_", ",_", "1_", ",_", "comment_", "=_", "'", "Im", " ", "the", " ", "second", " ", "dimension", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Explo", "re", " ", "the", " ", "parameter", "s", " ", "with", " ", "a", " ", "cartesian", " ", "product", ":_", "\\u\\u\\uNL\\u\\u\\u_", "traj_", "._", "f", "\\u", "explore", "_", "(_", "cartesian", "\\u", "product_", "(_", "{_", "'", "x", "'_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "'", "y", "'_", ":_", "[_", "6_", ",_", "7_", ",_", "8_", "]_", "}_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Run", " ", "the", " ", "simulation_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "f", "\\u", "run_", "(_", "multiply_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "git", " ", "informati", "on", " ", "was", " ", "adde", "d", " ", "to", " ", "the", " ", "trajectory_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "'", "config", ".", "git", ".", "hexs", "ha", "'_", "in_", "traj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "config", ".", "git", ".", "committ", "ed", "\\u", "date", "'_", "in_", "traj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "config", ".", "git", ".", "message", "'_", "in_", "traj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "config", ".", "git", ".", "name", "\\u", "rev", "'_", "in_", "traj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "\"", "Pyth", "on", " ", "git", " ", "test", " ", "success", "ful", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "traj", ".", "f", "\\u", "expand", "({", "'", "x", "':", "[", "3", ",", "3", "],", "'", "y", "':", "[", "4", "2", ",", "4", "3", "]}", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "env", ".", "f", "\\u", "run", "(", "multipl", "y", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "repr_", "(_", "exc_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
sightmachine/SimpleCV/SimpleCV/examples/detection/FeatureDetection.py
[ { "content": "#!/usr/bin/python\n'''\nThis program is used to find keypoint features in an image.\n\nYou need to click the upper left hand corner of what you want to train,\nthen click the right lower corner of what you want to train.\n\nThis will give you a template. For instance if you wanted to train\na face to recognize in the image you would click on the upper left corner\nof the face, then click in the lower right corner of the face. If you\nwant to retrain then just right click to reset.\n\n'''\n\nprint __doc__\n\nimport time\nfrom SimpleCV import Color, Image, np, Camera\nfrom SimpleCV.Display import Display\ncam = Camera()\ndisplay = Display((640,480)) # create our display\n\nquality = 400.00\nminDist = 0.35\nminMatch = 0.2\ntemplate_img = None\nmode = \"untrained\"\nstartX = None\nstartY = None\nendY = None\nendX = None\n\nwhile( display.isNotDone() ):\n img = cam.getImage().resize(640,480)\n\n #Display this if a template has not been trained yet\n if mode == \"untrained\":\n if startX == None or startY == None:\n img.dl().text(\"Click the upper left corner to train\", (10,10))\n if display.mouseLeft:\n startX = display.mouseRawX\n startY = display.mouseRawY\n time.sleep(0.2)\n elif endX == None or endY == None:\n img.dl().text(\"now click the lower right corner to train\", (10,10))\n if display.mouseLeft:\n endX = display.mouseX\n endY = display.mouseY\n template_img = img.crop(startX,startY,endX - startX, endY - startY)\n mode = \"trained\"\n time.sleep(0.2)\n else:\n pass\n\n if mode == \"trained\":\n keypoints = img.findKeypointMatch(template_img,quality,minDist,minMatch)\n if keypoints:\n #keypoints.draw()\n img = img.applyLayers()\n img = img.drawKeypointMatches(template_img) # draw the keypoint layers\n\n #Reset\n if display.mouseRight:\n template_img = None\n mode = \"untrained\"\n startX = None\n startY = None\n endY = None\n endX = None\n\n img = img.applyLayers() # apply the layers before resize\n img = img.resize(640,480)\n img.save(display)\n time.sleep(0.05)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from SimpleCV import Color, Image, np, Camera", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Thi", "s", " ", "program", " ", "is", " ", "used", " ", "to", " ", "find", " ", "keypoint", " ", "features", " ", "in", " ", "an", " ", "image", ".", "\\", "10", ";", "\\", "10", ";", "You", " ", "need", " ", "to", " ", "click", " ", "the", " ", "upper", " ", "left", " ", "hand", " ", "corn", "er", " ", "of", " ", "what", " ", "you", " ", "want", " ", "to", " ", "train", ",", "\\", "10", ";", "then", " ", "click", " ", "the", " ", "right", " ", "lower", " ", "corn", "er", " ", "of", " ", "what", " ", "you", " ", "want", " ", "to", " ", "train", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "will", " ", "give", " ", "you", " ", "a", " ", "template", ".", " ", " ", "For", " ", "instance", " ", "if", " ", "you", " ", "want", "ed", " ", "to", " ", "train", "\\", "10", ";", "a", " ", "face", " ", "to", " ", "recognize", " ", "in", " ", "the", " ", "image", " ", "you", " ", "wou", "ld", " ", "click", " ", "on", " ", "the", " ", "upper", " ", "left", " ", "corn", "er", "\\", "10", ";", "of", " ", "the", " ", "face", ",", " ", "then", " ", "click", " ", "in", " ", "the", " ", "lower", " ", "right", " ", "corn", "er", " ", "of", " ", "the", " ", "face", ".", " ", " ", "If", " ", "you", "\\", "10", ";", "want", " ", "to", " ", "retra", "in", " ", "then", " ", "just", " ", "right", " ", "click", " ", "to", " ", "reset", ".", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Simple", "CV_", "import_", "Color_", ",_", "Image_", ",_", "np_", ",_", "Camera_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Simple", "CV_", "._", "Display_", "import_", "Display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cam_", "=_", "Camera_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "display_", "=_", "Display_", "(_", "(_", "640_", ",_", "480_", ")_", ")_", "#", " ", "create", " ", "our", " ", "display_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "quality_", "=_", "400", ".00", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Dist_", "=_", "0.35_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "Match_", "=_", "0.2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "untr", "aine", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "(_", "display_", "._", "is", "Not", "Done_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "cam_", "._", "get", "Image_", "(_", ")_", "._", "resize_", "(_", "640_", ",_", "480_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Display", " ", "this", " ", "if", " ", "a", " ", "template", " ", "has", " ", "not", " ", "bee", "n", " ", "trained", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mode_", "==_", "\"", "untr", "aine", "d", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "start", "X_", "==_", "None_", "or_", "start", "Y_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "._", "dl_", "(_", ")_", "._", "text_", "(_", "\"", "Click", " ", "the", " ", "upper", " ", "left", " ", "corn", "er", " ", "to", " ", "train", "\"_", ",_", "(_", "10_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "display_", "._", "mouse", "Left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "X_", "=_", "display_", "._", "mouse", "Ra", "w", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Y_", "=_", "display_", "._", "mouse", "Ra", "w", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "end", "X_", "==_", "None_", "or_", "end", "Y_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "._", "dl_", "(_", ")_", "._", "text_", "(_", "\"", "now", " ", "click", " ", "the", " ", "lower", " ", "right", " ", "corn", "er", " ", "to", " ", "train", "\"_", ",_", "(_", "10_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "display_", "._", "mouse", "Left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "X_", "=_", "display_", "._", "mouse", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Y_", "=_", "display_", "._", "mouse", "Y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template", "\\u", "img_", "=_", "img_", "._", "crop_", "(_", "start", "X_", ",_", "start", "Y_", ",_", "end", "X_", "-_", "start", "X_", ",_", "end", "Y_", "-_", "start", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "trained", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode_", "==_", "\"", "trained", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keypoints_", "=_", "img_", "._", "find", "Keyp", "oint", "Match_", "(_", "template", "\\u", "img_", ",_", "quality_", ",_", "min", "Dist_", ",_", "min", "Match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "keypoints_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "keypoint", "s", ".", "draw", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "img_", "=_", "img_", "._", "appl", "y", "Layers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "img_", "=_", "img_", "._", "draw", "Keyp", "oint", "Matches_", "(_", "template", "\\u", "img_", ")_", "#", " ", "draw", " ", "the", " ", "keypoint", " ", "layers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Reset_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "display_", "._", "mouse", "Right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "img_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mode_", "=_", "\"", "untr", "aine", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "Y_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "X_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "img_", "=_", "img_", "._", "appl", "y", "Layers_", "(_", ")_", "#", " ", "appl", "y", " ", "the", " ", "layer", "s", " ", "bef", "ore", " ", "resize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "img_", "._", "resize_", "(_", "640_", ",_", "480_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "._", "save_", "(_", "display_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Incomplete URL substring sanitization
Impactstory/total-impact-webapp/totalimpactwebapp/aliases.py
[ { "content": " @cached_property\n def resolved_url(self):\n try:\n for url in self.url:\n if \"doi.org\" in url:\n continue\n elif \"ncbi.nlm.nih.gov/\" in url:\n continue\n elif \"europepmc.org\" in url:\n continue\n elif \"mendeley.com\" in url:\n continue\n elif \"scopus.com\" in url:\n continue\n else:\n return url\n\n # only had those, so return one of those\n return self.url[0]\n except AttributeError:\n return None", "metadata": "root.Aliases.resolved_url", "header": "['class', 'Aliases', '(', 'object', ')', ':', '___EOS___']", "index": 247 }, { "content": " def _guess_genre_and_host_from_aliases(self):\n \"\"\"Uses available aliases to decide the item's genre\"\"\"\n\n # logger.debug(u\"in decide_genre with {alias_dict}\".format(\n # alias_dict=alias_dict))\n\n genre = \"unknown\"\n host = \"unknown\"\n\n if hasattr(self, \"doi\"):\n joined_doi_string = \"\".join(self.doi).lower()\n if \"10.5061/dryad.\" in joined_doi_string:\n genre = \"dataset\"\n host = \"dryad\"\n elif \".figshare.\" in joined_doi_string:\n # if was already set to something, wouldn't be here\n host = \"figshare\"\n genre = \"dataset\"\n else:\n genre = \"article\"\n\n elif hasattr(self, \"pmid\"):\n genre = \"article\"\n\n elif hasattr(self, \"arxiv\"):\n genre = \"article\"\n host = \"arxiv\"\n\n elif hasattr(self, \"blog\"):\n genre = \"blog\"\n host = \"wordpresscom\"\n\n elif hasattr(self, \"blog_post\"):\n genre = \"blog\"\n host = \"blog_post\"\n\n elif hasattr(self, \"url\"):\n joined_url_string = \"\".join(self.url).lower()\n if \"slideshare.net\" in joined_url_string:\n genre = \"slides\"\n host = \"slideshare\"\n elif \"github.com\" in joined_url_string:\n genre = \"software\"\n host = \"github\"\n elif (\"youtube.com\" in joined_url_string) or (\"youtu.be\" in joined_url_string):\n genre = \"video\"\n host = \"youtube\"\n elif \"vimeo.com\" in joined_url_string:\n genre = \"video\"\n host = \"vimeo\"\n else:\n genre = \"webpage\"\n\n return genre, host", "metadata": "root.Aliases._guess_genre_and_host_from_aliases", "header": "['class', 'Aliases', '(', 'object', ')', ':', '___EOS___']", "index": 278 } ]
[ { "span": "\"doi.org\" in url:", "start_line": 251, "start_column": 19, "end_line": 251, "end_column": 35 }, { "span": "\"ncbi.nlm.nih.gov/\" in url:", "start_line": 253, "start_column": 21, "end_line": 253, "end_column": 47 }, { "span": "\"europepmc.org\" in url:", "start_line": 255, "start_column": 21, "end_line": 255, "end_column": 43 }, { "span": "\"mendeley.com\" in url:", "start_line": 257, "start_column": 21, "end_line": 257, "end_column": 42 }, { "span": "\"scopus.com\" in url:", "start_line": 259, "start_column": 21, "end_line": 259, "end_column": 40 }, { "span": "\"slideshare.net\" in joined_url_string:", "start_line": 316, "start_column": 15, "end_line": 316, "end_column": 52 }, { "span": "\"github.com\" in joined_url_string:", "start_line": 319, "start_column": 17, "end_line": 319, "end_column": 50 }, { "span": "\"youtube.com\" in joined_url_string)", "start_line": 322, "start_column": 18, "end_line": 322, "end_column": 52 }, { "span": "\"vimeo.com\" in joined_url_string:", "start_line": 325, "start_column": 17, "end_line": 325, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Incomp", "lete", "_", "URL_", "substring", "_", "sani", "ti", "zation_", "[SEP]_", "class_", "Aliase", "s_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "cache", "d\\u", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "resolve", "d\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "url_", "in_", "self_", "._", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "doi", ".", "org", "\"_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "ncbi", ".", "nlm", ".", "ni", "h", ".", "gov", "/\"_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "europ", "ep", "mc", ".", "org", "\"_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "mend", "ele", "y", ".", "com", "\"_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "scop", "us", ".", "com", "\"_", "in_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "had", " ", "tho", "se", ",", " ", "so", " ", "return", " ", "one", " ", "of", " ", "tho", "se_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "url_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Aliase", "s_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "guess", "\\u", "genre\\u", "and", "\\u", "host", "\\u", "from", "\\u", "aliases_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Us", "es", " ", "avail", "able", " ", "alias", "es", " ", "to", " ", "decide", " ", "the", " ", "item", "'", "s", " ", "genr", "e", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "logg", "er", ".", "debug", "(", "u", "\"", "in", " ", "decide", "\\u", "genr", "e", " ", "with", " ", "{", "alias", "\\u", "dict", "}\"", ".", "format", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alias", "\\u", "dict", "=", "alias", "\\u", "dict", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "genre_", "=_", "\"", "unknown", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "unknown", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "doi", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "joine", "d\\u", "doi", "\\u", "string_", "=_", "\"\"_", "._", "join_", "(_", "self_", "._", "doi_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "10.5", "061", "/", "dry", "ad", ".\"_", "in_", "joine", "d\\u", "doi", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "dataset", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "dry", "ad", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\".", "figs", "hare", ".\"_", "in_", "joine", "d\\u", "doi", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "was", " ", "alr", "ead", "y", " ", "set", " ", "to", " ", "somet", "hing", ",", " ", "wou", "ld", "n", "'", "t", " ", "be", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host_", "=_", "\"", "figs", "hare", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "genre_", "=_", "\"", "dataset", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "article", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "self_", ",_", "\"", "pmid", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "article", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "self_", ",_", "\"", "arx", "iv", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "article", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "arx", "iv", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "self_", ",_", "\"", "blog", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "blog", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "wordpress", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "self_", ",_", "\"", "blog", "\\u", "post", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "blog", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "blog", "\\u", "post", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "hasattr_", "(_", "self_", ",_", "\"", "url", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "joine", "d\\u", "url", "\\u", "string_", "=_", "\"\"_", "._", "join_", "(_", "self_", "._", "url_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "slides", "hare", ".", "net", "\"_", "in_", "joine", "d\\u", "url", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "slides", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "slides", "hare", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "git", "hub", ".", "com", "\"_", "in_", "joine", "d\\u", "url", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "software", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "git", "hub", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "(_", "\"", "youtu", "be", ".", "com", "\"_", "in_", "joine", "d\\u", "url", "\\u", "string_", ")_", "or_", "(_", "\"", "youtu", ".", "be", "\"_", "in_", "joine", "d\\u", "url", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "video", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "youtu", "be", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "vimeo", ".", "com", "\"_", "in_", "joine", "d\\u", "url", "\\u", "string_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "video", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "\"", "vimeo", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "genre_", "=_", "\"", "webpage", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "genre_", ",_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
hovel/pybbm/pybb/management/commands/pybb_delete_invalid_topics.py
[ { "content": "from __future__ import unicode_literals\nfrom django.utils.timezone import now, timedelta\nfrom django.core.management.base import BaseCommand, CommandError\nfrom django.db.models import Count\n\nfrom pybb.models import Topic\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Command(BaseCommand):\n help = 'Resave all posts.'\n", "metadata": "root.Command", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def handle(self, *args, **kwargs):\n check_time = now() - timedelta(seconds=10)\n topics = Topic.objects.filter(created__lt=check_time)\\\n .annotate(counter=Count('posts'))\\\n .filter(counter=0)\n\n count = topics.count()\n print('Found %d invalid topics' % count)\n if count:\n answer = raw_input('Are you sure you want delete them? [y/n]:')\n if answer.lower() == 'y':\n print('Deleting topics')\n topics.delete()\n print('Deletion completed')\n else:\n print('Aborting')", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'BaseCommand', ')', ':', '___EOS___']", "index": 10 } ]
[ { "span": "from django.core.management.base import BaseCommand, CommandError", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "timezone_", "import_", "now_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "management_", "._", "base_", "import_", "Base", "Command_", ",_", "Command", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyb", "b_", "._", "models_", "import_", "Topic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "help_", "=_", "'", "Res", "ave", " ", "all", " ", "posts", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Command_", "(_", "Base", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check", "\\u", "time_", "=_", "now_", "(_", ")_", "-_", "timedelta_", "(_", "seconds_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topics_", "=_", "Topic_", "._", "objects_", "._", "filter_", "(_", "created", "\\u\\u", "lt_", "=_", "check", "\\u", "time_", ")_", "._", "annotate_", "(_", "counter_", "=_", "Count_", "(_", "'", "posts", "'_", ")_", ")_", "._", "filter_", "(_", "counter_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "topics_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Foun", "d", " ", "%", "d", " ", "invalid", " ", "topic", "s", "'_", "%_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "answer_", "=_", "raw", "\\u", "input_", "(_", "'", "Are", " ", "you", " ", "sure", " ", "you", " ", "want", " ", "delete", " ", "them", "?", " ", "[", "y", "/", "n", "]:", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "answer_", "._", "lower_", "(_", ")_", "==_", "'", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Del", "eti", "ng", " ", "topic", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topics_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Deletion", " ", "complete", "d", "'_", ")_", "\\u\\u\\uNEWL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/ArrayPlot.py
[ { "content": "import core.modules\nimport core.modules.module_registry\nfrom core.modules.vistrails_module import Module, ModuleError\nfrom core.modules.basic_modules import PythonSource\nfrom Array import *\nfrom Matrix import *\n\nimport pylab\nimport matplotlib\nimport urllib\nimport random\n\n\n \n \n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ArrayPlot(object):\n namespace = 'numpy|array|plotting'\n \n\n \n", "metadata": "root.ArrayPlot", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def get_label(self, ar, i):\n lab = ar.get_name(i)\n if lab == None:\n return 'Array ' + str(i)\n else:\n return lab", "metadata": "root.ArrayPlot.get_label", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 14 }, { "content": " def is_cacheable(self):\n return False", "metadata": "root.ArrayPlot.is_cacheable", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def get_color(self, colors, i, randomcolor):\n if randomcolor:\n return (random.random(), random.random(), random.random())\n\n if self.color_dict == None:\n self.color_dict = {}\n for (k,r,g,b) in colors:\n self.color_dict[k] = (r,g,b)\n\n if self.color_dict.has_key(i):\n return self.color_dict[i]\n else:\n return None", "metadata": "root.ArrayPlot.get_color", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 24 }, { "content": " def get_marker(self, markers, i):\n if markers == None:\n return None\n\n if self.marker_dict == None:\n self.marker_dict = {}\n for (k,m) in markers:\n self.marker_dict[k] = m\n\n if self.marker_dict.has_key(i):\n return self.marker_dict[i]\n else:\n return None", "metadata": "root.ArrayPlot.get_marker", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def get_alpha(self, alphas, i):\n return None", "metadata": "root.ArrayPlot.get_alpha", "header": "['class', 'ArrayPlot', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": "class ArrayImage(ArrayPlot, Module):\n '''\n Display the 2D input Data Array as a color-mapped image.\n Independent control of the aspect ratio, colormap, presence of the\n colorbar and presented axis values are provided through the\n appropriate input ports: Aspect Ratio, Colormap, Colorbar,\n Extents. To change the colormap being used, it must be one of the\n pre-made maps provided by matplotlib.cm. Only 1 2D array can be\n viewed at a time.\n '''\n\n", "metadata": "root.ArrayImage", "header": "['module', '___EOS___']", "index": 55 }, { "content": " def compute(self):\n data = self.get_input(\"Data Array\")\n da_ar = data.get_array().squeeze()\n if da_ar.ndim != 2:\n raise ModuleError(\"Input Data Array must have dimension = 2\")\n\n aspect_ratio = self.force_get_input(\"Aspect Ratio\")\n colormap = self.force_get_input(\"Colormap\")\n colorbar = self.force_get_input(\"Colorbar\")\n extents = self.force_get_input(\"Extents\")\n\n # Quickly check the assigned colormap to make sure it's valid\n if colormap == None:\n colormap = \"jet\"\n if not hasattr(pylab, colormap):\n colormap = \"jet\"\n \n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n \n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n s += 'imshow(da_ar, interpolation=\\'bicubic\\''\n if aspect_ratio != None:\n s += ', aspect=' + str(aspect_ratio)\n\n if extents != None:\n s += ', extent=['+str(extents[0])+','+str(extents[1])+','+str(extents[2])+','+str(extents[3])+']'\n s += ')\\n'\n\n s += colormap + '()\\n'\n\n if colorbar:\n s += 'colorbar()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data.get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output('source', s)", "metadata": "root.ArrayImage.compute", "header": "['class', 'ArrayImage', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 65 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.namespace)", "metadata": "root.ArrayImage.register", "header": "['class', 'ArrayImage', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 133 }, { "content": " @classmethod\n def register_ports(cls, reg, basic):\n reg.add_input_port(cls, \"source\", (basic.String, 'source'), True)\n reg.add_input_port(cls, \"Data Array\", (NDArray, 'Array to Plot'))\n reg.add_input_port(cls, \"Aspect Ratio\", (basic.Float, 'Aspect Ratio'))\n reg.add_input_port(cls, \"Colormap\", (basic.String, 'Colormap'))\n reg.add_input_port(cls, \"Colorbar\", (basic.Boolean, 'Show Colorbar'), True)\n reg.add_input_port(cls, \"Extents\", [basic.Float, basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Background\", [basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Use X Title\", (basic.Boolean, 'Apply X-axis Label'))\n reg.add_input_port(cls, \"Use Y Title\", (basic.Boolean, 'Apply Y-axis Label'))\n reg.add_input_port(cls, \"Title\", (basic.String, 'Figure Title'))\n reg.add_input_port(cls, \"X Title\", (basic.String, 'X-axis label'), True)\n reg.add_input_port(cls, \"Y Title\", (basic.String, 'Y-axis label'), True)\n reg.add_output_port(cls, \"source\", (basic.String, 'source'))", "metadata": "root.ArrayImage.register_ports", "header": "['class', 'ArrayImage', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 137 }, { "content": "class Histogram(ArrayPlot, Module):\n '''\n Plot a histogram of the data values. Multiple datasets can be\n presented by providing multiple connections to the Data Array\n port. These data are then differentiated by assigned colors and\n labels. By default, 10 bins are used to histogram the data.\n Additionally, recapturing the PDF of the data is possible by\n enabling the Normalize option.\n '''\n\n", "metadata": "root.Histogram", "header": "['module', '___EOS___']", "index": 153 }, { "content": " def compute(self):\n data = self.get_input_list(\"Data Array\")\n self.label_dict = None\n self.color_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n nbins = self.force_get_input(\"Bins\")\n if nbins == None:\n nbins = 10\n normed = self.force_get_input(\"Normalize\")\n if normed == None:\n normed = False\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n data_list = []\n for i in data:\n data_list.append(i.get_array().squeeze())\n\n da_ar = None\n try:\n da_ar = numpy.array(data_list)\n except:\n raise ModuleException(\"Not all Data Array inputs are the same size!\")\n\n for i in range(da_ar.shape[0]):\n lab = self.get_label(data[i], i)\n col = self.get_color(colors, i, randomcolors)\n\n s += 'hist(da_ar['+str(i)+',:], bins=' + str(nbins)\n \n if lab != None:\n s += ', label=\\'' + lab + '\\''\n if col != None:\n s += ', facecolor=' + str(col)\n\n s += ', normed='+str(normed)\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data[0].get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'Histogram Value\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output(\"source\", s) ", "metadata": "root.Histogram.compute", "header": "['class', 'Histogram', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 162 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.namespace)", "metadata": "root.Histogram.register", "header": "['class', 'Histogram', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 237 }, { "content": " @classmethod\n def register_ports(cls, reg, basic):\n reg.add_input_port(cls, \"source\", (basic.String, 'source'), True)\n reg.add_input_port(cls, \"Data Array\", (NDArray, 'Data Array to Plot'))\n reg.add_input_port(cls, \"Legend\", (basic.Boolean, 'Use Legend'), True)\n reg.add_input_port(cls, \"Random Colors\", (basic.Boolean, 'Assign Random Colors'), True)\n reg.add_input_port(cls, \"Colors\", [basic.Integer, basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Background\", [basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Use X Title\", (basic.Boolean, 'Apply X-axis Label'))\n reg.add_input_port(cls, \"Use Y Title\", (basic.Boolean, 'Apply Y-axis Label'))\n reg.add_input_port(cls, \"Title\", (basic.String, 'Figure Title'))\n reg.add_input_port(cls, \"X Title\", (basic.String, 'X-axis label'), True)\n reg.add_input_port(cls, \"Bins\", (basic.Integer, 'Number of Bins'))\n reg.add_input_port(cls, \"Normalize\", (basic.Boolean, 'Normalize to PDF'), True)\n reg.add_output_port(cls, \"source\", (basic.String, 'source'))", "metadata": "root.Histogram.register_ports", "header": "['class', 'Histogram', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 241 }, { "content": "class BarChart(ArrayPlot, Module):\n '''\n Create a bar chart of the input data. Different datasets can be\n used simultaneously by connecting to the Data input port multiple\n times. Each successive data connection will be rendered on top of\n the previous dataset. This creates a stacked bar chart. Error\n bars are drawn with the errors for each of the datasets connected\n to the Error Bars input port.\n '''\n \n\n", "metadata": "root.BarChart", "header": "['module', '___EOS___']", "index": 257 }, { "content": " def get_ticks(self, num):\n a = []\n for i in range(num):\n a.append('')\n\n for i in self.tick_dict.keys():\n a[i] = self.tick_dict[i]\n\n return a", "metadata": "root.BarChart.get_ticks", "header": "['class', 'BarChart', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 266 }, { "content": " def compute(self):\n data = self.get_input_list(\"Data\")\n errs = self.force_get_input_list(\"Error Bars\")\n if len(errs) == 0:\n errs = None\n\n self.label_dict = None\n self.color_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n bg_color = self.force_get_input(\"Background\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n ticks = self.force_get_input_list(\"Bar Labels\")\n self.tick_dict = {}\n for (k,v) in ticks:\n self.tick_dict[k] = v\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n\n width = self.force_get_input(\"Bar Width\")\n if width == None:\n width = 0.5\n\n if errs != None:\n if len(data) != len(errs):\n raise ModuleError(\"Number of data does not match number of error bar data\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n numpts = None\n ind = None\n prev = None\n ind = numpy.arange(data[0].get_array().flatten().shape[0])\n t = self.get_ticks(data[0].get_array().flatten().shape[0])\n ag_ar = numpy.zeros((len(data), data[0].get_array().flatten().shape[0]))\n for i in range(len(data)):\n da_ar = data[i].get_array().flatten()\n ag_ar[i,:] = da_ar\n\n er_ar = numpy.zeros((len(data), data[0].get_array().flatten().shape[0]))\n if errs != None:\n for i in range(len(data)):\n er_ar[i,:] = errs[i].get_array().flatten()\n \n for i in range(ag_ar.shape[0]):\n s += 'bar(ind, ag_ar[' + str(i) + ',:], width'\n lab = self.get_label(data[i], i)\n col = self.get_color(colors, i, randomcolors)\n if lab != None:\n s += ', label=\\'' + lab + '\\''\n if col != None:\n s += ', color=' + str(col)\n\n if errs != None:\n s += ', yerr=er_ar[' + str(i) + ',:]'\n\n if prev != None:\n s += ', bottom=ag_ar[' + str(i-1) + ',:]'\n\n s += ')\\n'\n prev = ag_ar[i]\n \n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data[0].get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data[0].get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n s += 'xticks(ind + width/2., t)\\n'\n exec s\n self.set_output(\"source\", s)", "metadata": "root.BarChart.compute", "header": "['class', 'BarChart', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 276 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.namespace)", "metadata": "root.BarChart.register", "header": "['class', 'BarChart', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 374 }, { "content": " @classmethod\n def register_ports(cls, reg, basic):\n reg.add_input_port(cls, \"source\", (basic.String, 'source'), True)\n reg.add_input_port(cls, \"Data\", (NDArray, 'Data Array to Plot'))\n reg.add_input_port(cls, \"Error Bars\", (NDArray, 'Error Array to Plot'))\n reg.add_input_port(cls, \"Legend\", (basic.Boolean, 'Use Legend'), True)\n reg.add_input_port(cls, \"Random Colors\", (basic.Boolean, 'Assign Random Colors'), True)\n reg.add_input_port(cls, \"Colors\", [basic.Integer, basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Background\", [basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Bar Labels\", [basic.Integer, basic.String], True)\n reg.add_input_port(cls, \"Use X Title\", (basic.Boolean, 'Apply X-axis Label'))\n reg.add_input_port(cls, \"Use Y Title\", (basic.Boolean, 'Apply Y-axis Label'))\n reg.add_input_port(cls, \"X Title\", (basic.String, 'X-axis label'), True)\n reg.add_input_port(cls, \"Y Title\", (basic.String, 'Y-axis label'), True)\n reg.add_input_port(cls, \"Title\", (basic.String, 'Figure Title'))\n reg.add_input_port(cls, \"Bar Width\", (basic.Float, 'Bar Width'), True)\n reg.add_output_port(cls, \"source\", (basic.String, 'source'))", "metadata": "root.BarChart.register_ports", "header": "['class', 'BarChart', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 378 }, { "content": "class ScatterPlot(ArrayPlot, Module):\n '''\n Create a scatter plot from X and Y positions defined by the X\n Array and Y Array ports, respectively. Datasets can be added by\n connecting multiple arrays to the appropriate input ports.\n Symbols representing each dataset can be defined by using the\n Markers input assigning a valid pylab symbol to a dataset.\n '''\n\n", "metadata": "root.ScatterPlot", "header": "['module', '___EOS___']", "index": 396 }, { "content": " def compute(self):\n xdata = self.get_input_list(\"X Array\")\n ydata = self.get_input_list(\"Y Array\")\n self.label_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n self.color_dict = None\n bg_color = self.force_get_input(\"Background\")\n markers = self.force_get_input_list(\"Markers\")\n self.marker_dict = None\n ps = self.force_get_input(\"Point Size\")\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n p_title = self.force_get_input(\"Title\")\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n\n if len(xdata) != len(ydata):\n raise ModuleError(\"Cannot create scatter plot for different number of X and Y datasets.\")\n\n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n\n xdata_ar = numpy.zeros((len(xdata), xdata[0].get_array().flatten().shape[0]))\n ydata_ar = numpy.zeros((len(xdata), xdata[0].get_array().flatten().shape[0]))\n\n for i in range(len(xdata)):\n xd = xdata[i]\n yd = ydata[i]\n xdata_ar[i,:] = xd.get_array().flatten()\n ydata_ar[i,:] = yd.get_array().flatten()\n \n for i in range(len(xdata)):\n xar = xdata[i]\n yar = ydata[i]\n\n lab = self.get_label(xar, i)\n col = self.get_color(colors, i, randomcolors)\n mar = self.get_marker(markers, i)\n\n s += 'scatter(xdata_ar[' + str(i) +',:], ydata_ar[' + str(i) + ',:]'\n \n if lab != None:\n s += ', label=\\'' + lab +'\\''\n if col != None:\n s += ', color=' + str(col)\n if mar != None:\n s += ', marker=\\'' + mar + '\\''\n if ps != None:\n s += ', size=' + str(ps)\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + xar.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + yar.get_domain_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n print s\n exec s\n self.set_output(\"source\", s)", "metadata": "root.ScatterPlot.compute", "header": "['class', 'ScatterPlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 404 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.namespace)", "metadata": "root.ScatterPlot.register", "header": "['class', 'ScatterPlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 490 }, { "content": " @classmethod\n def register_ports(cls, reg, basic):\n reg.add_input_port(cls, \"source\", (basic.String, 'source'), True)\n reg.add_input_port(cls, \"X Array\", (NDArray, 'X Array to Plot'))\n reg.add_input_port(cls, \"Y Array\", (NDArray, 'Y Array to Plot'))\n reg.add_input_port(cls, \"Legend\", (basic.Boolean, 'Use Legend'), True)\n reg.add_input_port(cls, \"Random Colors\", (basic.Boolean, 'Assign Random Colors'), True)\n reg.add_input_port(cls, \"Colors\", [basic.Integer, basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Background\", [basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Markers\", [basic.Integer, basic.String], True)\n reg.add_input_port(cls, \"Use X Title\", (basic.Boolean, 'Apply X-axis Label'))\n reg.add_input_port(cls, \"Use Y Title\", (basic.Boolean, 'Apply Y-axis Label'))\n reg.add_input_port(cls, \"X Title\", (basic.String, 'X-axis label'), True)\n reg.add_input_port(cls, \"Y Title\", (basic.String, 'Y-axis label'), True)\n reg.add_input_port(cls, \"Title\", (basic.String, 'Figure Title'))\n reg.add_input_port(cls, \"Point Size\", (basic.Float, 'Point Size'), True)\n reg.add_output_port(cls, \"source\", (basic.String, 'source'))", "metadata": "root.ScatterPlot.register_ports", "header": "['class', 'ScatterPlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 494 }, { "content": "class LinePlot(ArrayPlot, Module):\n '''\n Create a standard line plot from a 1 or 2-dimensional Input Array.\n If the Input Array is 2-dimensional, each row will be plotted as a\n new line.\n ''' \n\n", "metadata": "root.LinePlot", "header": "['module', '___EOS___']", "index": 512 }, { "content": " def compute(self):\n data = self.get_input(\"Input Array\")\n indexes = self.force_get_input(\"Indexes\")\n self.label_dict = None\n use_legend = self.force_get_input(\"Legend\")\n randomcolors = self.force_get_input(\"Random Colors\")\n colors = self.force_get_input_list(\"Colors\")\n self.color_dict = None\n markers = self.force_get_input_list(\"Markers\")\n self.marker_dict = None\n x_label = self.force_get_input(\"X Title\")\n y_label = self.force_get_input(\"Y Title\")\n p_title = self.force_get_input(\"Title\")\n bg_color = self.force_get_input(\"Background\")\n\n array_x_t = self.force_get_input(\"Use X Title\")\n array_y_t = self.force_get_input(\"Use Y Title\")\n\n s = urllib.unquote(str(self.force_get_input(\"source\", '')))\n self.source = ''\n da_ar = data.get_array()\n\n if da_ar.ndim > 2:\n raise ModuleError(\"Cannot plot data with dimensions > 2\")\n \n s = 'from pylab import *\\n' +\\\n 'from numpy import *\\n' +\\\n 'import numpy\\n'\n \n if bg_color == None:\n bg_color = 'w'\n\n if type(bg_color) == type(''):\n s += 'figure(facecolor=\\'' + bg_color + '\\')\\n'\n else:\n s += 'figure(facecolor=' + str(bg_color) + ')\\n'\n \n if da_ar.ndim == 1:\n da_ar.shape = (1, da_ar.shape[0])\n\n xar = self.force_get_input(\"X Values\")\n sf = self.force_get_input(\"Scaling Factor\")\n if sf == None:\n sf = 1.\n\n if xar == None:\n start_i = None\n end_i = None\n if indexes == None:\n start_i = 0\n end_i = da_ar.shape[1]\n else:\n start_i = indexes[0]\n end_i = indexes[1]\n\n xar = numpy.arange(start_i, end_i)\n xar = xar * sf\n else:\n xar = xar.get_array()\n \n print da_ar.shape\n print xar.shape\n for i in range(da_ar.shape[0]):\n lab = self.get_label(data, i)\n col = self.get_color(colors, i, randomcolors)\n mar = self.get_marker(markers, i)\n if indexes == None:\n s += 'plot(xar, da_ar[' + str(i) + ',:]'\n else:\n s += 'plot(xar, da_ar[' + str(i) + ',' + str(indexes[0]) + ':' + str(indexes[1]) + ']'\n \n if lab != None:\n s += ', label=\\'' + lab +'\\''\n if col != None:\n s += ', color=' + str(col)\n if mar != None:\n s += ', marker=\\'' + mar + '\\''\n s += ')\\n'\n\n if use_legend:\n s += 'legend()\\n'\n\n if array_x_t:\n s += 'xlabel(\\'' + data.get_domain_name() + '\\')\\n'\n elif x_label:\n s += 'xlabel(\\'' + x_label + '\\')\\n'\n\n if array_y_t:\n s += 'ylabel(\\'' + data.get_range_name() + '\\')\\n'\n elif y_label:\n s += 'ylabel(\\'' + y_label + '\\')\\n'\n\n if p_title:\n s += 'title(\\'' + p_title + '\\')\\n'\n\n exec s\n self.set_output(\"source\", s)", "metadata": "root.LinePlot.compute", "header": "['class', 'LinePlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 518 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, namespace=cls.namespace)", "metadata": "root.LinePlot.register", "header": "['class', 'LinePlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 616 }, { "content": " @classmethod\n def register_ports(cls, reg, basic):\n reg.add_input_port(cls, \"source\", (basic.String, 'source'), True)\n reg.add_input_port(cls, \"Input Array\", (NDArray, 'Array to Plot'))\n reg.add_input_port(cls, \"X Values\", (NDArray, 'Domain Values'))\n reg.add_input_port(cls, \"Legend\", (basic.Boolean, 'Use Legend'), True)\n reg.add_input_port(cls, \"Random Colors\", (basic.Boolean, 'Assign Random Colors'), True)\n reg.add_input_port(cls, \"Colors\", [basic.Integer, basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Markers\", [basic.Integer, basic.String], True)\n reg.add_input_port(cls, \"Use X Title\", (basic.Boolean, 'Apply X-axis Label'))\n reg.add_input_port(cls, \"Use Y Title\", (basic.Boolean, 'Apply Y-axis Label'))\n reg.add_input_port(cls, \"X Title\", (basic.String, 'X-axis label'), True)\n reg.add_input_port(cls, \"Y Title\", (basic.String, 'Y-axis label'), True)\n reg.add_input_port(cls, \"Title\", (basic.String, 'Figure Title'))\n reg.add_input_port(cls, \"Background\", [basic.Float, basic.Float, basic.Float], True)\n reg.add_input_port(cls, \"Indexes\", [basic.Integer, basic.Integer], True)\n reg.add_input_port(cls, \"Scaling Factor\", (basic.Float, 'Scaling Factor'), True)\n reg.add_output_port(cls, \"source\", (basic.String, 'source'))", "metadata": "root.LinePlot.register_ports", "header": "['class', 'LinePlot', '(', 'ArrayPlot', ',', 'Module', ')', ':', '___EOS___']", "index": 620 } ]
[ { "span": "import core.modules", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 19 }, { "span": "import core.modules.module_registry", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 35 }, { "span": "from core.modules.basic_modules import PythonSource", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 51 }, { "span": "import matplotlib", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 17 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "._", "module", "\\u", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "Pyth", "on", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Array_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Matrix_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pylab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "namespace_", "=_", "'", "nump", "y", "|", "array", "|", "plott", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "label_", "(_", "self_", ",_", "ar_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "ar_", "._", "get", "\\u", "name_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lab_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Array", " ", "'_", "+_", "str_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "cache", "able_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "color_", "(_", "self_", ",_", "colors_", ",_", "i_", ",_", "random", "color_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "random", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "random_", "._", "random_", "(_", ")_", ",_", "random_", "._", "random_", "(_", ")_", ",_", "random_", "._", "random_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "color", "\\u", "dict_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "color", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "r_", ",_", "g_", ",_", "b_", ")_", "in_", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "color", "\\u", "dict_", "[_", "k_", "]_", "=_", "(_", "r_", ",_", "g_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "color", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "color", "\\u", "dict_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "marker_", "(_", "self_", ",_", "markers_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "markers_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "marker", "\\u", "dict_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "marker", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "m_", ")_", "in_", "markers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "marker", "\\u", "dict_", "[_", "k_", "]_", "=_", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "marker", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "marker", "\\u", "dict_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Plot_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "alpha_", "(_", "self_", ",_", "alphas_", ",_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Array", "Image_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Display", " ", "the", " ", "2", "D", " ", "input", " ", "Data", " ", "Array", " ", "as", " ", "a", " ", "color", "-", "mapp", "ed", " ", "image", ".", "\\", "10", ";", " ", " ", " ", " ", "Inde", "pend", "ent", " ", "control", " ", "of", " ", "the", " ", "aspect", " ", "ratio", ",", " ", "colormap", ",", " ", "presen", "ce", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "colorbar", " ", "and", " ", "presente", "d", " ", "axis", " ", "values", " ", "are", " ", "provided", " ", "through", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "appropr", "iate", " ", "input", " ", "port", "s", ":", " ", "Asp", "ect", " ", "Rati", "o", ",", " ", "Color", "map", ",", " ", "Color", "bar", ",", "\\", "10", ";", " ", " ", " ", " ", "Extent", "s", ".", " ", " ", "To", " ", "change", " ", "the", " ", "colormap", " ", "bei", "ng", " ", "used", ",", " ", "it", " ", "must", " ", "be", " ", "one", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "pre", "-", "made", " ", "maps", " ", "provided", " ", "by", " ", "mat", "plotlib", ".", "cm", ".", " ", " ", "On", "ly", " ", "1", " ", "2", "D", " ", "array", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "viewed", " ", "at", " ", "a", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Array", "Image_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Data", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "\\u", "ar_", "=_", "data_", "._", "get", "\\u", "array_", "(_", ")_", "._", "squeeze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", "!=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Inp", "ut", " ", "Data", " ", "Array", " ", "must", " ", "have", " ", "dimension", " ", "=", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "aspect", "\\u", "ratio_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Asp", "ect", " ", "Rati", "o", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colormap_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Color", "map", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colorbar_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Color", "bar", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extents_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Extent", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Qui", "ckl", "y", " ", "check", " ", "the", " ", "assign", "ed", " ", "colormap", " ", "to", " ", "make", " ", "sure", " ", "it", "'", "s", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "colormap_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colormap_", "=_", "\"", "jet", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "pylab_", ",_", "colormap_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colormap_", "=_", "\"", "jet", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'", "ims", "how", "(", "da", "\\u", "ar", ",", " ", "interpolati", "on", "=\\\\", "'", "bic", "ubi", "c", "\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aspect", "\\u", "ratio_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "aspect", "='_", "+_", "str_", "(_", "aspect", "\\u", "ratio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extents_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "extent", "=[", "'_", "+_", "str_", "(_", "extents_", "[_", "0_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "1_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "2_", "]_", ")_", "+_", "','_", "+_", "str_", "(_", "extents_", "[_", "3_", "]_", ")_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "colormap_", "+_", "'(", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "colorbar_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "colorbar", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "source", "'_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Image_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Array", "Image_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "ports_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Data", " ", "Array", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Asp", "ect", " ", "Rati", "o", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Asp", "ect", " ", "Rati", "o", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Color", "map", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Color", "map", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Color", "bar", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Show", " ", "Color", "bar", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Extent", "s", "\"_", ",_", "[_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Back", "ground", "\"_", ",_", "[_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "X", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "Y", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Fig", "ure", " ", "Tit", "le", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "X", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Y", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Histogram", "_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Plot", " ", "a", " ", "histo", "gram", " ", "of", " ", "the", " ", "data", " ", "values", ".", " ", " ", "Multipl", "e", " ", "dataset", "s", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "presente", "d", " ", "by", " ", "provi", "ding", " ", "multiple", " ", "connections", " ", "to", " ", "the", " ", "Data", " ", "Array", "\\", "10", ";", " ", " ", " ", " ", "port", ".", " ", " ", "The", "se", " ", "data", " ", "are", " ", "then", " ", "different", "iate", "d", " ", "by", " ", "assign", "ed", " ", "colors", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "labels", ".", " ", " ", "By", " ", "default", ",", " ", "10", " ", "bins", " ", "are", " ", "used", " ", "to", " ", "histo", "gram", " ", "the", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "Addition", "ally", ",", " ", "recap", "tur", "ing", " ", "the", " ", "PD", "F", " ", "of", " ", "the", " ", "data", " ", "is", " ", "possib", "le", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "ena", "blin", "g", " ", "the", " ", "Normalize", " ", "option", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Data", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nbins_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Bin", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nbins_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nbins_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "normed_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Normalize", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "normed_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "normed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "list_", "._", "append_", "(_", "i_", "._", "get", "\\u", "array_", "(_", ")_", "._", "squeeze_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "da", "\\u", "ar_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "=_", "numpy_", "._", "array_", "(_", "data\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Exception_", "(_", "\"", "Not", " ", "all", " ", "Data", " ", "Array", " ", "inputs", " ", "are", " ", "the", " ", "same", " ", "size", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", "[_", "i_", "]_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "'", "hist", "(", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "bins", "='_", "+_", "str_", "(_", "nbins_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "face", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "',", " ", "norm", "ed", "='_", "+_", "str_", "(_", "normed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "Histogram", " ", "Value", "\\\\')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Histogram", "_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "ports_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Data", " ", "Array", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Data", " ", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Legend", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Us", "e", " ", "Legend", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Random", " ", "Color", "s", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Assign", " ", "Random", " ", "Color", "s", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Color", "s", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Back", "ground", "\"_", ",_", "[_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "X", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "Y", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Fig", "ure", " ", "Tit", "le", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "X", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Bin", "s", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Number", " ", "of", " ", "Bin", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Normalize", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Normalize", " ", "to", " ", "PD", "F", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bar", "Chart_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "bar", " ", "chart", " ", "of", " ", "the", " ", "input", " ", "data", ".", " ", " ", "Different", " ", "dataset", "s", " ", "can", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "simultaneous", "ly", " ", "by", " ", "connecti", "ng", " ", "to", " ", "the", " ", "Data", " ", "input", " ", "port", " ", "multiple", "\\", "10", ";", " ", " ", " ", " ", "times", ".", " ", " ", "Ea", "ch", " ", "success", "ive", " ", "data", " ", "connecti", "on", " ", "will", " ", "be", " ", "render", "ed", " ", "on", " ", "top", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "previ", "ous", " ", "dataset", ".", " ", " ", "Thi", "s", " ", "create", "s", " ", "a", " ", "stacked", " ", "bar", " ", "chart", ".", " ", " ", "Error", "\\", "10", ";", " ", " ", " ", " ", "bar", "s", " ", "are", " ", "draw", "n", " ", "with", " ", "the", " ", "error", "s", " ", "for", " ", "each", " ", "of", " ", "the", " ", "dataset", "s", " ", "connect", "ed", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "Error", " ", "Bar", "s", " ", "input", " ", "port", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Chart_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "ticks_", "(_", "self_", ",_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "._", "append_", "(_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "self_", "._", "tick", "\\u", "dict_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "a_", "[_", "i_", "]_", "=_", "self_", "._", "tick", "\\u", "dict_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "a_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Chart_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errs_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Error", " ", "Bar", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "errs_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errs_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ticks_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Bar", " ", "Label", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tick", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "ticks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tick", "\\u", "dict_", "[_", "k_", "]_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "width_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Bar", " ", "Wid", "th", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "width_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errs_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "data_", ")_", "!=_", "len_", "(_", "errs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Number", " ", "of", " ", "data", " ", "doe", "s", " ", "not", " ", "match", " ", "number", " ", "of", " ", "error", " ", "bar", " ", "data", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nump", "ts_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ind_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ind_", "=_", "numpy_", "._", "arange_", "(_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "self_", "._", "get", "\\u", "ticks_", "(_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ag", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "data_", ")_", ",_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "=_", "data_", "[_", "i_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ag", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "da", "\\u", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "er", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "data_", ")_", ",_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errs_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "data_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "er", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "errs_", "[_", "i_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "ag", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "bar", "(", "ind", ",", " ", "ag", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "widt", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", "[_", "i_", "]_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "errs_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "yer", "r", "=", "er", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "prev_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "bottom", "=", "ag", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", "-_", "1_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev_", "=_", "ag", "\\u", "ar_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "[_", "0_", "]_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "'", "xtick", "s", "(", "ind", " ", "+", " ", "widt", "h", "/", "2", ".,", " ", "t", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Chart_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bar", "Chart_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "ports_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Data", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Data", " ", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Error", " ", "Bar", "s", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Error", " ", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Legend", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Us", "e", " ", "Legend", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Random", " ", "Color", "s", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Assign", " ", "Random", " ", "Color", "s", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Color", "s", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Back", "ground", "\"_", ",_", "[_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Bar", " ", "Label", "s", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "String_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "X", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "Y", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "X", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Y", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Fig", "ure", " ", "Tit", "le", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Bar", " ", "Wid", "th", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Bar", " ", "Wid", "th", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Scatter", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "scatter", " ", "plot", " ", "from", " ", "X", " ", "and", " ", "Y", " ", "position", "s", " ", "defin", "ed", " ", "by", " ", "the", " ", "X", "\\", "10", ";", " ", " ", " ", " ", "Array", " ", "and", " ", "Y", " ", "Array", " ", "port", "s", ",", " ", "respec", "tiv", "el", "y", ".", " ", " ", "Datasets", " ", "can", " ", "be", " ", "adde", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "connecti", "ng", " ", "multiple", " ", "arrays", " ", "to", " ", "the", " ", "appropr", "iate", " ", "input", " ", "port", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Sym", "bol", "s", " ", "represent", "ing", " ", "each", " ", "dataset", " ", "can", " ", "be", " ", "defin", "ed", " ", "by", " ", "usi", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "Markers", " ", "input", " ", "assign", "ing", " ", "a", " ", "valid", " ", "pyla", "b", " ", "symbol", " ", "to", " ", "a", " ", "dataset", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Scatter", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xdata_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "X", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ydata_", "=_", "self_", "._", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Y", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Markers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "marker", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ps_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Point", " ", "Size", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "xdata_", ")_", "!=_", "len_", "(_", "ydata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Cann", "ot", " ", "create", " ", "scatter", " ", "plot", " ", "for", " ", "different", " ", "number", " ", "of", " ", "X", " ", "and", " ", "Y", " ", "dataset", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xdat", "a", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "xdata_", ")_", ",_", "xdata_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "ta", "\\u", "ar_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "len_", "(_", "xdata_", ")_", ",_", "xdata_", "[_", "0_", "]_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "._", "shape_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "xdata_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xd", "_", "=_", "xdata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yd", "_", "=_", "ydata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xdat", "a", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "xd", "_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yda", "ta", "\\u", "ar_", "[_", "i_", ",_", ":_", "]_", "=_", "yd", "_", "._", "get", "\\u", "array_", "(_", ")_", "._", "flatten_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "len_", "(_", "xdata_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xar", "_", "=_", "xdata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yar", "_", "=_", "ydata_", "[_", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "xar", "_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mar", "_", "=_", "self_", "._", "get", "\\u", "marker_", "(_", "markers_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "+=_", "'", "scatter", "(", "xdat", "a", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", ",", " ", "yda", "ta", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mar", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "marker", "=\\\\", "''_", "+_", "mar", "_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ps_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "size", "='_", "+_", "str_", "(_", "ps_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "xar", "_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "yar", "_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scatter", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Scatter", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "ports_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Array", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "X", " ", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Y", " ", "Array", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Y", " ", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Legend", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Us", "e", " ", "Legend", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Random", " ", "Color", "s", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Assign", " ", "Random", " ", "Color", "s", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Color", "s", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Back", "ground", "\"_", ",_", "[_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Markers", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "String_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "X", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "Y", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "X", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Y", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Fig", "ure", " ", "Tit", "le", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Point", " ", "Size", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Point", " ", "Size", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Line", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "standard", " ", "line", " ", "plot", " ", "from", " ", "a", " ", "1", " ", "or", " ", "2", "-", "dimension", "al", " ", "Inp", "ut", " ", "Array", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "Inp", "ut", " ", "Array", " ", "is", " ", "2", "-", "dimension", "al", ",", " ", "each", " ", "row", " ", "will", " ", "be", " ", "plott", "ed", " ", "as", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "new", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Line", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Array", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indexes_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Indexe", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "label", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "legend_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Legend", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Random", " ", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "colors_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Color", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input", "\\u", "list_", "(_", "\"", "Markers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "marker", "\\u", "dict_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "label_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "title_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bg", "\\u", "color_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Back", "ground", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "array", "\\u", "x", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "array", "\\u", "y", "\\u", "t_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "urllib_", "._", "unquote_", "(_", "str_", "(_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "source", "\"_", ",_", "''_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "da", "\\u", "ar_", "=_", "data_", "._", "get", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "\"", "Cann", "ot", " ", "plot", " ", "data", " ", "with", " ", "dimension", "s", " ", ">", " ", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "=_", "'", "from", " ", "pyla", "b", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "from", " ", "nump", "y", " ", "import", " ", "*\\\\", "n", "'_", "+_", "'", "import", " ", "nump", "y", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bg", "\\u", "color_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bg", "\\u", "color_", "=_", "'", "w", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "bg", "\\u", "color_", ")_", "==_", "type_", "(_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "=\\\\", "''_", "+_", "bg", "\\u", "color_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "figure", "(", "face", "color", "='_", "+_", "str_", "(_", "bg", "\\u", "color_", ")_", "+_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "da", "\\u", "ar_", "._", "ndim_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "da", "\\u", "ar_", "._", "shape_", "=_", "(_", "1_", ",_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xar", "_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "X", " ", "Value", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sf_", "=_", "self_", "._", "force", "\\u", "get", "\\u", "input_", "(_", "\"", "Sca", "ling", " ", "Factor", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sf_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sf_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "xar", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indexes_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "da", "\\u", "ar_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "i_", "=_", "indexes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "i_", "=_", "indexes_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "xar", "_", "=_", "numpy_", "._", "arange_", "(_", "start", "\\u", "i_", ",_", "end", "\\u", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xar", "_", "=_", "xar", "_", "*_", "sf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xar", "_", "=_", "xar", "_", "._", "get", "\\u", "array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "da", "\\u", "ar_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "xar", "_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "da", "\\u", "ar_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lab_", "=_", "self_", "._", "get", "\\u", "label_", "(_", "data_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "self_", "._", "get", "\\u", "color_", "(_", "colors_", ",_", "i_", ",_", "random", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mar", "_", "=_", "self_", "._", "get", "\\u", "marker_", "(_", "markers_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "indexes_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "plot", "(", "xar", ",", " ", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "',", ":]", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "plot", "(", "xar", ",", " ", "da", "\\u", "ar", "['_", "+_", "str_", "(_", "i_", ")_", "+_", "','_", "+_", "str_", "(_", "indexes_", "[_", "0_", "]_", ")_", "+_", "':'_", "+_", "str_", "(_", "indexes_", "[_", "1_", "]_", ")_", "+_", "']'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lab_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "label", "=\\\\", "''_", "+_", "lab_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "col_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "color", "='_", "+_", "str_", "(_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mar", "_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "',", " ", "marker", "=\\\\", "''_", "+_", "mar", "_", "+_", "'\\\\''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", "+=_", "')", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "use", "\\u", "legend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "legend", "()", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "x", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "domain", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "x", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "xlabel", "(\\\\'", "'_", "+_", "x", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "array", "\\u", "y", "\\u", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "data_", "._", "get", "\\u", "range", "\\u", "name_", "(_", ")_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "y", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "ylabel", "(\\\\'", "'_", "+_", "y", "\\u", "label_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p", "\\u", "title_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "+=_", "'", "title", "(\\\\'", "'_", "+_", "p", "\\u", "title_", "+_", "'\\\\'", ")\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "source", "\"_", ",_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "namespace_", "=_", "cls_", "._", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Plot_", "(_", "Array", "Plot_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "ports_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Array", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Array", " ", "to", " ", "Plot", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Value", "s", "\"_", ",_", "(_", "ND", "Array_", ",_", "'", "Doma", "in", " ", "Value", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Legend", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Us", "e", " ", "Legend", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Random", " ", "Color", "s", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Assign", " ", "Random", " ", "Color", "s", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Color", "s", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Markers", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "String_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "X", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Us", "e", " ", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "Boolean_", ",_", "'", "Apply", " ", "Y", "-", "axis", " ", "Label", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "X", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "X", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Y", " ", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Y", "-", "axis", " ", "label", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Tit", "le", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "Fig", "ure", " ", "Tit", "le", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Back", "ground", "\"_", ",_", "[_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", ",_", "basic_", "._", "Float_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Indexe", "s", "\"_", ",_", "[_", "basic_", "._", "Integer_", ",_", "basic_", "._", "Integer_", "]_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Sca", "ling", " ", "Factor", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Sca", "ling", " ", "Factor", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "source", "\"_", ",_", "(_", "basic_", "._", "String_", ",_", "'", "source", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
anandology/pyjamas/pyjd/modcompile.py
[ { "content": "#!/usr/bin/env python\n# Copyright 2006 James Tauber and contributors\n# Copyright (C) 2009, Luke Kenneth Casson Leighton <[email protected]>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nimport sys\nimport compiler\nfrom compiler import ast, syntax\nfrom compiler import misc # good grief, this doesn't look good\nimport os\nimport copy\nimport imp\n\nfrom compiler.pycodegen import ModuleCodeGenerator\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PlatformParser:\n\n\n\n", "metadata": "root.PlatformParser", "header": "['module', '___EOS___']", "index": 27 }, { "content": " def __init__(self, platform_dir = \"\", verbose=False, chain_plat=None):\n self.platform_dir = platform_dir\n self.parse_cache = {}\n self.platform = \"\"\n self.verbose = verbose\n self.chain_plat = chain_plat", "metadata": "root.PlatformParser.__init__", "header": "['class', 'PlatformParser', ':', '___EOS___']", "index": 28 }, { "content": " def setPlatform(self, platform):\n self.platform = platform", "metadata": "root.PlatformParser.setPlatform", "header": "['class', 'PlatformParser', ':', '___EOS___']", "index": 35 }, { "content": " def checkOverridePlatformFile(self, file_name):\n\n if self.chain_plat:\n return self.chain_plat.checkOverridePlatformFile(file_name)\n if not self.platform:\n return None\n platform_file_name = self.generatePlatformFilename(file_name)\n if os.path.isfile(platform_file_name):\n return platform_file_name\n return None", "metadata": "root.PlatformParser.checkOverridePlatformFile", "header": "['class', 'PlatformParser', ':', '___EOS___']", "index": 38 }, { "content": " def parseModule(self, module_name, file_name):\n\n importing = False\n if not self.parse_cache.has_key(file_name):\n importing = True\n if self.chain_plat:\n mod, _ov = self.chain_plat.parseModule(module_name, file_name)\n else:\n mod = compiler.parseFile(file_name)\n self.parse_cache[file_name] = mod\n else:\n mod = self.parse_cache[file_name]\n\n override = False\n platform_file_name = self.generatePlatformFilename(file_name)\n if self.verbose:\n print \"platform\", platform_file_name\n if self.platform and os.path.isfile(platform_file_name):\n mod = copy.deepcopy(mod)\n mod_override = compiler.parseFile(platform_file_name)\n if self.verbose:\n print \"Merging\", module_name, self.platform\n merge(module_name, mod, mod_override)\n override = True\n\n if self.verbose:\n if override:\n print \"Importing %s (Platform %s)\" % (module_name, self.platform)\n elif importing:\n print \"Importing %s\" % (module_name)\n\n if override:\n return mod, platform_file_name\n return mod, file_name", "metadata": "root.PlatformParser.parseModule", "header": "['class', 'PlatformParser', ':', '___EOS___']", "index": 49 }, { "content": " def generatePlatformFilename(self, file_name):\n (module_name, extension) = os.path.splitext(os.path.basename(file_name))\n platform_file_name = module_name + self.platform + extension\n\n return os.path.join(os.path.dirname(file_name), self.platform_dir, platform_file_name)", "metadata": "root.PlatformParser.generatePlatformFilename", "header": "['class', 'PlatformParser', ':', '___EOS___']", "index": 84 }, { "content": "class TranslationError(Exception):\n", "metadata": "root.TranslationError", "header": "['module', '___EOS___']", "index": 90 }, { "content": " def __init__(self, msg, node, module_name=''):\n if node:\n lineno = node.lineno\n else:\n lineno = \"Unknown\"\n self.msg = msg\n self.node = node\n self.module_name = module_name\n self.lineno = lineno\n self.message = \"%s line %s:\\n%s\\n%s\" % (module_name, lineno, msg, node)", "metadata": "root.TranslationError.__init__", "header": "['class', 'TranslationError', '(', 'Exception', ')', ':', '___EOS___']", "index": 91 }, { "content": " def __str__(self):\n return self.message", "metadata": "root.TranslationError.__str__", "header": "['class', 'TranslationError', '(', 'Exception', ')', ':', '___EOS___']", "index": 102 }, { "content": "def merge(module_name, tree1, tree2):\n for child in tree2.node:\n if isinstance(child, ast.Function):\n replaceFunction(tree1, child.name, child)\n elif isinstance(child, ast.Class):\n replaceClassMethods(tree1, child.name, child)\n else:\n raise TranslationError(\n \"Do not know how to merge %s\" % child, child, module_name)\n return tree1", "metadata": "root.merge", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def replaceFunction(tree, function_name, function_node):\n # find function to replace\n for child in tree.node:\n if isinstance(child, ast.Function) and child.name == function_name:\n copyFunction(child, function_node)\n return\n raise TranslationError(\n \"function not found: \" + function_name, function_node, None)", "metadata": "root.replaceFunction", "header": "['module', '___EOS___']", "index": 116 }, { "content": "def copyFunction(target, source):\n target.code = source.code\n target.argnames = source.argnames\n target.defaults = source.defaults\n target.doc = source.doc # @@@ not sure we need to do this any more", "metadata": "root.copyFunction", "header": "['module', '___EOS___']", "index": 125 }, { "content": "def addCode(target, source):\n target.nodes.append(source)", "metadata": "root.addCode", "header": "['module', '___EOS___']", "index": 131 }, { "content": "def copyAssign(target, source):\n target.nodes = source.nodes\n target.expr = source.expr\n target.lineno = source.lineno", "metadata": "root.copyAssign", "header": "['module', '___EOS___']", "index": 134 }, { "content": "def eqNodes(nodes1, nodes2):\n return str(nodes1) == str(nodes2)", "metadata": "root.eqNodes", "header": "['module', '___EOS___']", "index": 139 }, { "content": "def replaceClassMethods(tree, class_name, class_node):\n # find class to replace\n old_class_node = None\n for child in tree.node:\n if isinstance(child, ast.Class) and child.name == class_name:\n old_class_node = child\n break\n\n if not old_class_node:\n raise TranslationError(\n \"class not found: \" + class_name, class_node, self.module_name)\n\n # replace methods\n for node in class_node.code:\n if isinstance(node, ast.Function):\n found = False\n for child in old_class_node.code:\n if isinstance(child, ast.Function) and child.name == node.name:\n found = True\n copyFunction(child, node)\n break\n\n if not found:\n raise TranslationError(\n \"class method not found: \" + class_name + \".\" + node.name,\n node, self.module_name)\n elif isinstance(node, ast.Assign) and \\\n isinstance(node.nodes[0], ast.AssName):\n found = False\n for child in old_class_node.code:\n if isinstance(child, ast.Assign) and \\\n eqNodes(child.nodes, node.nodes):\n found = True\n copyAssign(child, node)\n if not found:\n addCode(old_class_node.code, node)\n elif isinstance(node, ast.Pass):\n pass\n else:\n raise TranslationError(\n \"Do not know how to merge %s\" % node, node, self.module_name)", "metadata": "root.replaceClassMethods", "header": "['module', '___EOS___']", "index": 142 }, { "content": "class Module:\n\n mode = \"exec\"\n\n\n\n\n\n\n\n MAGIC = imp.get_magic()\n", "metadata": "root.Module", "header": "['module', '___EOS___']", "index": 184 }, { "content": " def __init__(self, tree, filename):\n self.tree = tree\n self.filename = filename\n self.code = None", "metadata": "root.Module.__init__", "header": "['class', 'Module', ':', '___EOS___']", "index": 188 }, { "content": " def _get_tree(self):\n misc.set_filename(self.filename, self.tree)\n syntax.check(self.tree)\n return self.tree", "metadata": "root.Module._get_tree", "header": "['class', 'Module', ':', '___EOS___']", "index": 193 }, { "content": " def compile(self):\n pass # implemented by subclass", "metadata": "root.Module.compile", "header": "['class', 'Module', ':', '___EOS___']", "index": 198 }, { "content": " def getCode(self):\n return self.code", "metadata": "root.Module.getCode", "header": "['class', 'Module', ':', '___EOS___']", "index": 201 }, { "content": " def compile(self, display=0):\n tree = self._get_tree()\n gen = ModuleCodeGenerator(tree)\n if display:\n import pprint\n print pprint.pprint(tree)\n self.code = gen.getCode()", "metadata": "root.Module.compile", "header": "['class', 'Module', ':', '___EOS___']", "index": 204 }, { "content": " def dump(self, f):\n f.write(self.getPycHeader())\n marshal.dump(self.code, f)", "metadata": "root.Module.dump", "header": "['class', 'Module', ':', '___EOS___']", "index": 212 }, { "content": " def getPycHeader(self):\n # compile.c uses marshal to write a long directly, with\n # calling the interface that would also generate a 1-byte code\n # to indicate the type of the value. simplest way to get the\n # same effect is to call marshal and then skip the code.\n mtime = os.path.getmtime(self.filename)\n mtime = struct.pack('<i', mtime)\n return self.MAGIC + mtime", "metadata": "root.Module.getPycHeader", "header": "['class', 'Module', ':', '___EOS___']", "index": 218 } ]
[ { "span": "import sys", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2006", " ", "Jam", "es", " ", "Tau", "ber", " ", "and", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", ",", " ", "Lu", "ke", " ", "Ken", "net", "h", " ", "Cass", "on", " ", "Lei", "ght", "on", " ", "<", "lk", "cl", "@", "lk", "cl", ".", "net", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "compiler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "compiler_", "import_", "ast_", ",_", "syntax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "compiler_", "import_", "misc_", "#", " ", "good", " ", "gri", "ef", ",", " ", "this", " ", "doe", "sn", "'", "t", " ", "look", " ", "good_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "imp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "compiler_", "._", "pyco", "deg", "en_", "import_", "Modul", "e", "Code", "Generator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Plat", "form", "Parser_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "platform", "\\u", "dir_", "=_", "\"\"_", ",_", "verbose_", "=_", "False_", ",_", "chain", "\\u", "plat", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "platform", "\\u", "dir_", "=_", "platform", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parse", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "platform_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "verbose_", "=_", "verbose_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "chain", "\\u", "plat", "_", "=_", "chain", "\\u", "plat", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Platform_", "(_", "self_", ",_", "platform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "platform_", "=_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "Override", "Plat", "form", "File_", "(_", "self_", ",_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "chain", "\\u", "plat", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "chain", "\\u", "plat", "_", "._", "check", "Override", "Plat", "form", "File_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "platform_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "platform", "\\u", "file", "\\u", "name_", "=_", "self_", "._", "generat", "e", "Plat", "form", "Filename_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "platform", "\\u", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "platform", "\\u", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Module_", "(_", "self_", ",_", "module", "\\u", "name_", ",_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "parse", "\\u", "cache_", "._", "has", "\\u", "key_", "(_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import", "ing_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "chain", "\\u", "plat", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", ",_", "\\u", "ov_", "=_", "self_", "._", "chain", "\\u", "plat", "_", "._", "parse", "Module_", "(_", "module", "\\u", "name_", ",_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "compiler_", "._", "parse", "File_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parse", "\\u", "cache_", "[_", "file", "\\u", "name_", "]_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "self_", "._", "parse", "\\u", "cache_", "[_", "file", "\\u", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "override_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform", "\\u", "file", "\\u", "name_", "=_", "self_", "._", "generat", "e", "Plat", "form", "Filename_", "(_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "platform", "\"_", ",_", "platform", "\\u", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "platform_", "and_", "os_", "._", "path_", "._", "isfile_", "(_", "platform", "\\u", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "copy_", "._", "deepcopy_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "\\u", "override_", "=_", "compiler_", "._", "parse", "File_", "(_", "platform", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Mer", "ging", "\"_", ",_", "module", "\\u", "name_", ",_", "self_", "._", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merge_", "(_", "module", "\\u", "name_", ",_", "mod_", ",_", "mod", "\\u", "override_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "override_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "verbose_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "override_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Import", "ing", " ", "%", "s", " ", "(", "Plat", "form", " ", "%", "s", ")\"_", "%_", "(_", "module", "\\u", "name_", ",_", "self_", "._", "platform_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "import", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Import", "ing", " ", "%", "s", "\"_", "%_", "(_", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "override_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mod_", ",_", "platform", "\\u", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "mod_", ",_", "file", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Plat", "form", "Parser_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e", "Plat", "form", "Filename_", "(_", "self_", ",_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "module", "\\u", "name_", ",_", "extension_", ")_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "file", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "platform", "\\u", "file", "\\u", "name_", "=_", "module", "\\u", "name_", "+_", "self_", "._", "platform_", "+_", "extension_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "file", "\\u", "name_", ")_", ",_", "self_", "._", "platform", "\\u", "dir_", ",_", "platform", "\\u", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Translat", "ion", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Translat", "ion", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "msg_", ",_", "node_", ",_", "module", "\\u", "name_", "=_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lineno_", "=_", "node_", "._", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lineno_", "=_", "\"", "Un", "know", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "msg_", "=_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "node_", "=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "module", "\\u", "name_", "=_", "module", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lineno_", "=_", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "message_", "=_", "\"%", "s", " ", "line", " ", "%", "s", ":\\\\", "n", "%", "s", "\\\\", "n", "%", "s", "\"_", "%_", "(_", "module", "\\u", "name_", ",_", "lineno_", ",_", "msg_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Translat", "ion", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "merge_", "(_", "module", "\\u", "name_", ",_", "tree", "1_", ",_", "tree", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "tree", "2_", "._", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "child_", ",_", "ast_", "._", "Function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "replace", "Function_", "(_", "tree", "1_", ",_", "child_", "._", "name_", ",_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "child_", ",_", "ast_", "._", "Class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "replace", "Class", "Methods_", "(_", "tree", "1_", ",_", "child_", "._", "name_", ",_", "child_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Translat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Do", " ", "not", " ", "know", " ", "how", " ", "to", " ", "merge", " ", "%", "s", "\"_", "%_", "child_", ",_", "child_", ",_", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tree", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "Function_", "(_", "tree_", ",_", "function", "\\u", "name_", ",_", "function", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "function", " ", "to", " ", "replace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "child_", "in_", "tree_", "._", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "child_", ",_", "ast_", "._", "Function_", ")_", "and_", "child_", "._", "name_", "==_", "function", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "copy", "Function_", "(_", "child_", ",_", "function", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Translat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "function", " ", "not", " ", "found", ":", " ", "\"_", "+_", "function", "\\u", "name_", ",_", "function", "\\u", "node_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "Function_", "(_", "target_", ",_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "._", "code_", "=_", "source_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "._", "argname", "s_", "=_", "source_", "._", "argname", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "._", "defaults_", "=_", "source_", "._", "defaults_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "._", "doc_", "=_", "source_", "._", "doc_", "#", " ", "@@", "@", " ", "not", " ", "sure", " ", "we", " ", "need", " ", "to", " ", "do", " ", "this", " ", "any", " ", "more_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Code_", "(_", "target_", ",_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "._", "nodes_", "._", "append_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "copy", "Assign_", "(_", "target_", ",_", "source_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "._", "nodes_", "=_", "source_", "._", "nodes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "._", "expr_", "=_", "source_", "._", "expr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "._", "lineno_", "=_", "source_", "._", "lineno_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "eq", "Nodes_", "(_", "nodes", "1_", ",_", "nodes", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "nodes", "1_", ")_", "==_", "str_", "(_", "nodes", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "Class", "Methods_", "(_", "tree_", ",_", "class", "\\u", "name_", ",_", "class", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "class", " ", "to", " ", "replace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "class", "\\u", "node_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "tree_", "._", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "child_", ",_", "ast_", "._", "Class_", ")_", "and_", "child_", "._", "name_", "==_", "class", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "class", "\\u", "node_", "=_", "child_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "old", "\\u", "class", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Translat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "class", " ", "not", " ", "found", ":", " ", "\"_", "+_", "class", "\\u", "name_", ",_", "class", "\\u", "node_", ",_", "self_", "._", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", " ", "methods_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "class", "\\u", "node_", "._", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "node_", ",_", "ast_", "._", "Function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "old", "\\u", "class", "\\u", "node_", "._", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "child_", ",_", "ast_", "._", "Function_", ")_", "and_", "child_", "._", "name_", "==_", "node_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "Function_", "(_", "child_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Translat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "class", " ", "method", " ", "not", " ", "found", ":", " ", "\"_", "+_", "class", "\\u", "name_", "+_", "\".\"_", "+_", "node_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node_", ",_", "self_", "._", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "node_", ",_", "ast_", "._", "Assign_", ")_", "and_", "isinstance_", "(_", "node_", "._", "nodes_", "[_", "0_", "]_", ",_", "ast_", "._", "Ass", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "found_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child_", "in_", "old", "\\u", "class", "\\u", "node_", "._", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "child_", ",_", "ast_", "._", "Assign_", ")_", "and_", "eq", "Nodes_", "(_", "child_", "._", "nodes_", ",_", "node_", "._", "nodes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "found_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copy", "Assign_", "(_", "child_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "add", "Code_", "(_", "old", "\\u", "class", "\\u", "node_", "._", "code_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "node_", ",_", "ast_", "._", "Pass_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Translat", "ion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Do", " ", "not", " ", "know", " ", "how", " ", "to", " ", "merge", " ", "%", "s", "\"_", "%_", "node_", ",_", "node_", ",_", "self_", "._", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mode_", "=_", "\"", "exec", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "MAGIC", "_", "=_", "imp_", "._", "get", "\\u", "magic_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "tree_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tree_", "=_", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filename_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "tree_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "misc_", "._", "set\\u", "filename_", "(_", "self_", "._", "filename_", ",_", "self_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "syntax_", "._", "check_", "(_", "self_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "implemented", " ", "by", " ", "subclass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Code_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile_", "(_", "self_", ",_", "display_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "=_", "self_", "._", "\\u", "get", "\\u", "tree_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen_", "=_", "Modul", "e", "Code", "Generator_", "(_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "display_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "pprint_", "._", "pprint_", "(_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "code_", "=_", "gen_", "._", "get", "Code_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "dump_", "(_", "self_", ",_", "f_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "self_", "._", "get", "Py", "c", "Header_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "marshal_", "._", "dump_", "(_", "self_", "._", "code_", ",_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Module_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Py", "c", "Header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "compile", ".", "c", " ", "use", "s", " ", "marshal", " ", "to", " ", "write", " ", "a", " ", "long", " ", "direct", "ly", ",", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "calling", " ", "the", " ", "interface", " ", "tha", "t", " ", "wou", "ld", " ", "als", "o", " ", "generat", "e", " ", "a", " ", "1", "-", "byte", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "indicat", "e", " ", "the", " ", "type", " ", "of", " ", "the", " ", "value", ".", " ", " ", "simple", "st", " ", "way", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "same", " ", "effect", " ", "is", " ", "to", " ", "call", " ", "marshal", " ", "and", " ", "then", " ", "skip", " ", "the", " ", "code", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mtime_", "=_", "os_", "._", "path_", "._", "getmtime_", "(_", "self_", "._", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mtime_", "=_", "struct_", "._", "pack_", "(_", "'<", "i", "'_", ",_", "mtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "MAGIC", "_", "+_", "mtime_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
grantjenks/python-diskcache/tests/test_fanout.py
[ { "content": "@setup_cache\ndef test_set_get_delete(cache):\n for value in range(100):\n cache.set(value, value)\n\n cache.check()\n\n for value in range(100):\n assert cache.get(value) == value\n\n cache.check()\n\n for value in range(100):\n assert value in cache\n\n cache.check()\n\n for value in range(100):\n assert cache.delete(value)\n assert cache.delete(100) == False\n\n cache.check()\n\n for value in range(100):\n cache[value] = value\n\n cache.check()\n\n for value in range(100):\n assert cache[value] == value\n\n cache.check()\n\n cache.clear()\n assert len(cache) == 0\n\n cache.check()", "metadata": "root.test_set_get_delete", "header": "['module', '___EOS___']", "index": 52 } ]
[ { "span": "assert cache.delete(value)", "start_line": 70, "start_column": 8, "end_line": 70, "end_column": 34 }, { "span": "assert cache.delete(100) == False", "start_line": 71, "start_column": 4, "end_line": 71, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "setup", "\\u", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "set\\u", "get", "\\u", "delete_", "(_", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "set_", "(_", "value_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "._", "get_", "(_", "value_", ")_", "==_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "value_", "in_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "._", "delete_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "cache_", "._", "delete_", "(_", "100_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "[_", "value_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "value_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "cache_", "[_", "value_", "]_", "==_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "cache_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "._", "check_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
hasgeek/coaster/tests/alembic/versions/132231d12fcd_test.py
[ { "content": "\"\"\"Test Migration\n\nRevision ID: 132231d12fcd\nRevises: None\nCreate Date: 2013-04-27 11:09:23.896698\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = u'132231d12fcd'\ndown_revision = None\n\nfrom alembic import op\nimport sqlalchemy as sa\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def upgrade():\n pass", "metadata": "root.upgrade", "header": "['module', '___EOS___']", "index": 16 }, { "content": "def downgrade():\n pass", "metadata": "root.downgrade", "header": "['module', '___EOS___']", "index": 20 } ]
[ { "span": "from alembic import op", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 22 }, { "span": "import sqlalchemy as sa", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Test", " ", "Migrat", "ion", "\\", "10", ";", "\\", "10", ";", "Revi", "sion", " ", "ID", ":", " ", "132", "231", "d1", "2f", "cd", "\\", "10", ";", "Revi", "ses", ":", " ", "Non", "e", "\\", "10", ";", "Creat", "e", " ", "Date", ":", " ", "2013", "-0", "4", "-", "2", "7", " ", "11", ":", "09", ":", "23.", "896", "698", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "revis", "ion", " ", "identifi", "ers", ",", " ", "used", " ", "by", " ", "Ale", "mbic", "._", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "=_", "u", "'", "132", "231", "d1", "2f", "cd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "down", "\\u", "revision_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "alembic_", "import_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlalchemy_", "as_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "upgrade_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "downgrade_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rapp-project/rapp-platform/rapp_testing_tools/scripts/default_tests/ontology_superclasses_of_test_1.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n#Copyright 2015 RAPP\n\n#Licensed under the Apache License, Version 2.0 (the \"License\");\n#you may not use this file except in compliance with the License.\n#You may obtain a copy of the License at\n\n #http://www.apache.org/licenses/LICENSE-2.0\n\n#Unless required by applicable law or agreed to in writing, software\n#distributed under the License is distributed on an \"AS IS\" BASIS,\n#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n#See the License for the specific language governing permissions and\n#limitations under the License.\n\n# Authors: Konstantinos Panayiotou, Manos Tsardoulias\n# contact: [email protected], [email protected]\n\n\nimport sys\nimport os\nimport timeit\nimport argparse\n\n__path__ = os.path.dirname(os.path.realpath(__file__))\n\n## ------ Access the RappCloud python module ------- ##\nfrom RappCloud import RappCloud\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RappInterfaceTest:\n\n\n", "metadata": "root.RappInterfaceTest", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __init__(self):\n self.rappCloud = RappCloud()\n self.ontology_class = \"Oven\"\n # Set the valid results\n self.valid_results = [ 'http://knowrob.org/kb/knowrob.owl#Box-Container',\\\n 'http://knowrob.org/kb/knowrob.owl#FurniturePiece', \\\n 'http://knowrob.org/kb/knowrob.owl#HeatingDevice', \\\n 'http://knowrob.org/kb/knowrob.owl#HouseholdAppliance']", "metadata": "root.RappInterfaceTest.__init__", "header": "['class', 'RappInterfaceTest', ':', '___EOS___']", "index": 33 }, { "content": " def execute(self):\n\n start_time = timeit.default_timer()\n # Call the Python RappCloud service\n response = self.rappCloud.ontology_superclasses_of(self.ontology_class)\n end_time = timeit.default_timer()\n self.elapsed_time = end_time - start_time\n return self.validate(response)", "metadata": "root.RappInterfaceTest.execute", "header": "['class', 'RappInterfaceTest', ':', '___EOS___']", "index": 42 }, { "content": " def validate(self, response):\n error = response['error']\n if error != \"\":\n return [error, self.elapsed_time]\n\n # Get the returned data\n return_data = response['results']\n # Check if the returned data are equal to the expected\n if self.valid_results == return_data:\n return [True, self.elapsed_time]\n else:\n return [\"Unexpected result : \" + str(return_data), self.elapsed_time]", "metadata": "root.RappInterfaceTest.validate", "header": "['class', 'RappInterfaceTest', ':', '___EOS___']", "index": 51 } ]
[ { "span": "import sys", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 10 }, { "span": "import argparse", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Copy", "right", " ", "201", "5", " ", "RA", "PP", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Kon", "stan", "tin", "os", " ", "Pan", "ay", "iot", "ou", ",", " ", "Man", "os", " ", "Ts", "ard", "oul", "ias", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contact", ":", " ", "kl", "pan", "agi", "@", "gma", "il", ".", "com", ",", " ", "ets", "ard", "ou", "@", "iti", ".", "gr_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "timeit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "path\\u\\u_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "realpath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "------", " ", "Access", " ", "the", " ", "Ra", "pp", "Cloud", " ", "python", " ", "module", " ", "-------", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "Ra", "pp", "Cloud_", "import_", "Ra", "pp", "Cloud_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ra", "pp", "Interface", "Test_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ra", "pp", "Interface", "Test_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rapp", "Cloud_", "=_", "Ra", "pp", "Cloud_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ontology", "\\u", "class_", "=_", "\"", "Ov", "en", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "valid", " ", "results_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "valid", "\\u", "results_", "=_", "[_", "'", "http", "://", "know", "rob", ".", "org", "/", "kb", "/", "know", "rob", ".", "ow", "l", "#", "Box", "-", "Containe", "r", "'_", ",_", "'", "http", "://", "know", "rob", ".", "org", "/", "kb", "/", "know", "rob", ".", "ow", "l", "#", "Fur", "nit", "ure", "Piece", "'_", ",_", "'", "http", "://", "know", "rob", ".", "org", "/", "kb", "/", "know", "rob", ".", "ow", "l", "#", "Heat", "ing", "Dev", "ice", "'_", ",_", "'", "http", "://", "know", "rob", ".", "org", "/", "kb", "/", "know", "rob", ".", "ow", "l", "#", "House", "hold", "Appliance", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ra", "pp", "Interface", "Test_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "time_", "=_", "timeit_", "._", "default", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Call", " ", "the", " ", "Pyth", "on", " ", "Ra", "pp", "Cloud", " ", "service_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "rapp", "Cloud_", "._", "ontology", "\\u", "superclass", "es", "\\u", "of_", "(_", "self_", "._", "ontology", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "timeit_", "._", "default", "\\u", "timer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ela", "pse", "d\\u", "time_", "=_", "end", "\\u", "time_", "-_", "start", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "validate_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ra", "pp", "Interface", "Test_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "validate_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "response_", "[_", "'", "error", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "error_", ",_", "self_", "._", "ela", "pse", "d\\u", "time_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "return", "ed", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return", "\\u", "data_", "=_", "response_", "[_", "'", "results", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "return", "ed", " ", "data", " ", "are", " ", "equal", " ", "to", " ", "the", " ", "expected_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "valid", "\\u", "results_", "==_", "return", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "True_", ",_", "self_", "._", "ela", "pse", "d\\u", "time_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\"", "Une", "xpe", "cte", "d", " ", "result", " ", ":", " ", "\"_", "+_", "str_", "(_", "return", "\\u", "data_", ")_", ",_", "self_", "._", "ela", "pse", "d\\u", "time_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary delete statement in function
VisTrails/VisTrails/contrib/sahm/pySAHM/MaxentRunner.py
[ { "content": " def run_cmd_line_jar(self, jar_name, args):\n #arg_items = list(itertools.chain(*args.items()))\n #arg_items = ['='.join((str(k),str(v))) for k,v in args.iteritems()]\n \n cmd = ' '.join(['java', '-mx512m', '-jar', jar_name] + args)\n \n self.writetolog(' running: ' + cmd, True, False)\n #res = execute_cmdline(['java', '-jar', jar_name] + args, output)\n p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n self.writetolog(' Finished running: ', True, False)\n \n \n ret = p.communicate()\n self.writetolog(' Maxent strOut: ' + str(ret[0]))\n if ret[1] is not None:\n msg = \"An error was encountered running the Maxent jar file. The error message is below - \\n\"\n msg += ret[1]\n writetolog(msg)\n raise RuntimeError , msg\n del ret", "metadata": "root.MAXENTRunner.run_cmd_line_jar", "header": "['class', 'MAXENTRunner', '(', 'object', ')', ':', '___EOS___']", "index": 93 } ]
[ { "span": "del ret", "start_line": 112, "start_column": 8, "end_line": 112, "end_column": 15 } ]
[ { "span": "def run_cmd_line_jar(self, jar_name, args):", "start_line": 93, "start_column": 4, "end_line": 93, "end_column": 47 } ]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "delete_", "statement_", "in_", "function_", "[SEP]_", "class_", "MAX", "ENTR", "unne", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "cmd", "\\u", "line", "\\u", "jar_", "(_", "self_", ",_", "jar", "\\u", "name_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "arg", "\\u", "items", " ", "=", " ", "list", "(", "iter", "tool", "s", ".", "chain", "(*", "args", ".", "items", "())", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "arg", "\\u", "items", " ", "=", " ", "['", "='", ".", "join", "((", "str", "(", "k", "),", "str", "(", "v", ")))", " ", "for", " ", "k", ",", "v", " ", "in", " ", "args", ".", "iter", "items", "()]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "'", " ", "'_", "._", "join_", "(_", "[_", "'", "java", "'_", ",_", "'-", "mx", "512", "m", "'_", ",_", "'-", "jar", "'_", ",_", "jar", "\\u", "name_", "]_", "+_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "writet", "olog", "_", "(_", "'", " ", " ", " ", " ", "runn", "ing", ":", " ", " ", "'_", "+_", "cmd_", ",_", "True_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "res", " ", "=", " ", "execute", "\\u", "cmdli", "ne", "([", "'", "java", "',", " ", "'-", "jar", "',", " ", "jar", "\\u", "name", "]", " ", "+", " ", "args", ",", " ", "output", ")_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "shell_", "=_", "True_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "STDOUT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "writet", "olog", "_", "(_", "'", " ", " ", " ", " ", "Finish", "ed", " ", "runn", "ing", ":", " ", " ", "'_", ",_", "True_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ret_", "=_", "p_", "._", "communicate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "writet", "olog", "_", "(_", "'", " ", " ", " ", " ", "Max", "ent", " ", "str", "Out", ":", " ", " ", "'_", "+_", "str_", "(_", "ret_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ret_", "[_", "1_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"", "An", " ", "error", " ", "was", " ", "encounter", "ed", " ", "runn", "ing", " ", "the", " ", "Max", "ent", " ", "jar", " ", "file", ".", " ", " ", "The", " ", "error", " ", "message", " ", "is", " ", "belo", "w", " ", "-", " ", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "+=_", "ret_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writet", "olog", "_", "(_", "msg_", ")_", "\\u\\u\\uN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