Input:
CODE <module>()
  DOC 'bases'
  RESUME 0
  LOAD_CONST 'bases'
  LOAD_NAME List
  LOAD_NAME type
  BINARY_SUBSCR
  LOAD_CONST 'namespace'
  LOAD_NAME MutableMapping
  LOAD_NAME str
  LOAD_NAME Any
  BUILD_TUPLE 2
  BINARY_SUBSCR
  LOAD_CONST 'key'
  LOAD_NAME str
  LOAD_CONST 'return'
  LOAD_CONST None
  BUILD_TUPLE 8
  LOAD_CONST <code _decorate_namespace_function>
  MAKE_FUNCTION annotations
  STORE_NAME _decorate_namespace_function
  RETURN_CONST None
END
CODE _decorate_namespace_function(bases, namespace, key)
  DOC 'pass'
  RESUME 0
  LOAD_FAST namespace
  LOAD_FAST key
  BINARY_SUBSCR
  STORE_FAST value
  LOAD_GLOBAL inspect
  LOAD_ATTR NULL|self + isfunction
  LOAD_FAST value
  CALL 1
  POP_JUMP_IF_TRUE L1
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST value
  LOAD_GLOBAL staticmethod
  LOAD_GLOBAL classmethod
  BUILD_TUPLE 2
  CALL 2
  POP_JUMP_IF_TRUE L1
  LOAD_ASSERTION_ERROR
  RAISE_VARARGS 1
L1:
  LOAD_GLOBAL inspect
  LOAD_ATTR NULL|self + isfunction
  LOAD_FAST value
  CALL 1
  POP_JUMP_IF_FALSE L2
  LOAD_FAST value
  STORE_FAST func
  JUMP_FORWARD L4
L2:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST value
  LOAD_GLOBAL staticmethod
  LOAD_GLOBAL classmethod
  BUILD_TUPLE 2
  CALL 2
  POP_JUMP_IF_FALSE L3
  LOAD_FAST value
  LOAD_ATTR __func__
  STORE_FAST func
  JUMP_FORWARD L4
L3:
  LOAD_GLOBAL NULL + NotImplementedError
  LOAD_CONST 'Unexpected value for a function: {}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST value
  CALL 1
  CALL 1
  RAISE_VARARGS 1
L4:
  BUILD_LIST 0
  STORE_FAST preconditions
  BUILD_LIST 0
  STORE_FAST snapshots
  BUILD_LIST 0
  STORE_FAST postconditions
  LOAD_GLOBAL icontract
  LOAD_ATTR _checkers
  LOAD_ATTR NULL|self + find_checker
  LOAD_FAST func
  KW_NAMES ('func',)
  CALL 1
  STORE_FAST contract_checker
  LOAD_FAST contract_checker
  POP_JUMP_IF_NONE L5
  LOAD_FAST contract_checker
  LOAD_ATTR __preconditions__
  STORE_FAST preconditions
  LOAD_FAST contract_checker
  LOAD_ATTR __postcondition_snapshots__
  STORE_FAST snapshots
  LOAD_FAST contract_checker
  LOAD_ATTR __postconditions__
  STORE_FAST postconditions
L5:
  LOAD_FAST key
  LOAD_CONST ('__init__',)
  CONTAINS_OP 1
  POP_JUMP_IF_FALSE L10
  BUILD_LIST 0
  STORE_FAST base_preconditions
  BUILD_LIST 0
  STORE_FAST base_snapshots
  BUILD_LIST 0
  STORE_FAST base_postconditions
  LOAD_CONST False
  STORE_FAST bases_have_func
  LOAD_FAST bases
  GET_ITER
L6:
  FOR_ITER L9
  STORE_FAST base
  LOAD_GLOBAL NULL + hasattr
  LOAD_FAST base
  LOAD_FAST key
  CALL 2
  POP_JUMP_IF_TRUE L7
  JUMP_BACKWARD L6
L7:
  LOAD_CONST True
  STORE_FAST bases_have_func
  LOAD_GLOBAL NULL + getattr
  LOAD_FAST base
  LOAD_FAST key
  CALL 2
  STORE_FAST base_func
  LOAD_GLOBAL icontract
  LOAD_ATTR _checkers
  LOAD_ATTR NULL|self + find_checker
  LOAD_FAST base_func
  KW_NAMES ('func',)
  CALL 1
  STORE_FAST base_contract_checker
  LOAD_FAST base_contract_checker
  POP_JUMP_IF_NOT_NONE L8
  JUMP_BACKWARD L6
L8:
  LOAD_FAST base_preconditions
  LOAD_ATTR NULL|self + extend
  LOAD_FAST base_contract_checker
  LOAD_ATTR __preconditions__
  CALL 1
  POP_TOP
  LOAD_FAST base_snapshots
  LOAD_ATTR NULL|self + extend
  LOAD_FAST base_contract_checker
  LOAD_ATTR __postcondition_snapshots__
  CALL 1
  POP_TOP
  LOAD_FAST base_postconditions
  LOAD_ATTR NULL|self + extend
  LOAD_FAST base_contract_checker
  LOAD_ATTR __postconditions__
  CALL 1
  POP_TOP
  JUMP_BACKWARD L6
L9:
  END_FOR
  LOAD_GLOBAL NULL + _collapse_preconditions
  LOAD_FAST base_preconditions
  LOAD_FAST bases_have_func
  LOAD_FAST preconditions
  LOAD_FAST func
  KW_NAMES ('base_preconditions', 'bases_have_func', 'preconditions', 'func')
  CALL 4
  STORE_FAST preconditions
  LOAD_GLOBAL NULL + _collapse_snapshots
  LOAD_FAST base_snapshots
  LOAD_FAST snapshots
  KW_NAMES ('base_snapshots', 'snapshots')
  CALL 2
  STORE_FAST snapshots
  LOAD_GLOBAL NULL + _collapse_postconditions
  LOAD_FAST base_postconditions
  LOAD_FAST postconditions
  KW_NAMES ('base_postconditions', 'postconditions')
  CALL 2
  STORE_FAST postconditions
L10:
  LOAD_FAST preconditions
  POP_JUMP_IF_TRUE L11
  LOAD_FAST postconditions
  POP_JUMP_IF_FALSE L16
L11:
  LOAD_FAST contract_checker
  POP_JUMP_IF_NOT_NONE L15
  LOAD_GLOBAL icontract
  LOAD_ATTR _checkers
  LOAD_ATTR NULL|self + decorate_with_checker
  LOAD_FAST func
  KW_NAMES ('func',)
  CALL 1
  STORE_FAST contract_checker
  LOAD_GLOBAL inspect
  LOAD_ATTR NULL|self + isfunction
  LOAD_FAST value
  CALL 1
  POP_JUMP_IF_FALSE L12
  LOAD_FAST contract_checker
  LOAD_FAST namespace
  LOAD_FAST key
  STORE_SUBSCR
  JUMP_FORWARD L15
L12:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST value
  LOAD_GLOBAL staticmethod
  CALL 2
  POP_JUMP_IF_FALSE L13
  LOAD_GLOBAL NULL + staticmethod
  LOAD_FAST contract_checker
  CALL 1
  LOAD_FAST namespace
  LOAD_FAST key
  STORE_SUBSCR
  JUMP_FORWARD L15
L13:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST value
  LOAD_GLOBAL classmethod
  CALL 2
  POP_JUMP_IF_FALSE L14
  LOAD_GLOBAL NULL + classmethod
  LOAD_FAST contract_checker
  CALL 1
  LOAD_FAST namespace
  LOAD_FAST key
  STORE_SUBSCR
  JUMP_FORWARD L15
L14:
  LOAD_GLOBAL NULL + NotImplementedError
  LOAD_CONST 'Unexpected value for a function: {}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST value
  CALL 1
  CALL 1
  RAISE_VARARGS 1
L15:
  LOAD_FAST preconditions
  LOAD_FAST contract_checker
  STORE_ATTR __preconditions__
  LOAD_FAST snapshots
  LOAD_FAST contract_checker
  STORE_ATTR __postcondition_snapshots__
  LOAD_FAST postconditions
  LOAD_FAST contract_checker
  STORE_ATTR __postconditions__
  RETURN_CONST None
L16:
  RETURN_CONST None
END

def _decorate_namespace_function(bases: List[type], namespace: MutableMapping[str, Any], key: str) -> None:
    """pass"""
    value = namespace[key]
    assert inspect.isfunction(value) or isinstance(value, (staticmethod, classmethod))
    if inspect.isfunction(value):
        func = value
    elif isinstance(value, (staticmethod, classmethod)):
        func = value.__func__
    else:
        raise NotImplementedError('Unexpected value for a function: {}'.format(value))
    preconditions = []
    snapshots = []
    postconditions = []
    contract_checker = icontract._checkers.find_checker(func=func)
    if contract_checker is not None:
        preconditions = contract_checker.__preconditions__
        snapshots = contract_checker.__postcondition_snapshots__
        postconditions = contract_checker.__postconditions__
    if key not in ['__init__']:
        base_preconditions = []
        base_snapshots = []
        base_postconditions = []
        bases_have_func = False
        for base in bases:
            if hasattr(base, key):
                bases_have_func = True
                base_func = getattr(base, key)
                base_contract_checker = icontract._checkers.find_checker(func=base_func)
                if base_contract_checker is not None:
                    base_preconditions.extend(base_contract_checker.__preconditions__)
                    base_snapshots.extend(base_contract_checker.__postcondition_snapshots__)
                    base_postconditions.extend(base_contract_checker.__postconditions__)
        preconditions = _collapse_preconditions(base_preconditions=base_preconditions, bases_have_func=bases_have_func, preconditions=preconditions, func=func)
        snapshots = _collapse_snapshots(base_snapshots=base_snapshots, snapshots=snapshots)
        postconditions = _collapse_postconditions(base_postconditions=base_postconditions, postconditions=postconditions)
    if preconditions or postconditions:
        if contract_checker is None:
            contract_checker = icontract._checkers.decorate_with_checker(func=func)
            if inspect.isfunction(value):
                namespace[key] = contract_checker
            elif isinstance(value, staticmethod):
                namespace[key] = staticmethod(contract_checker)
            elif isinstance(value, classmethod):
                namespace[key] = classmethod(contract_checker)
            else:
                raise NotImplementedError('Unexpected value for a function: {}'.format(value))
        contract_checker.__preconditions__ = preconditions
        contract_checker.__postcondition_snapshots__ = snapshots
        contract_checker.__postconditions__ = postconditions


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code tokenize_sents>
  MAKE_FUNCTION 0
  STORE_NAME tokenize_sents
  RETURN_CONST None
END
CODE tokenize_sents(string)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL six
  LOAD_ATTR NULL|self + text_type
  LOAD_FAST string
  CALL 1
  STORE_FAST string
  BUILD_LIST 0
  STORE_FAST spans
  LOAD_GLOBAL re
  LOAD_ATTR NULL|self + finditer
  LOAD_CONST '[^\\s]+'
  LOAD_FAST string
  CALL 2
  GET_ITER
L1:
  FOR_ITER L2
  STORE_FAST match
  LOAD_FAST spans
  LOAD_ATTR NULL|self + append
  LOAD_FAST match
  CALL 1
  POP_TOP
  JUMP_BACKWARD L1
L2:
  END_FOR
  LOAD_GLOBAL NULL + len
  LOAD_FAST spans
  CALL 1
  STORE_FAST spans_count
  BUILD_LIST 0
  STORE_FAST rez
  LOAD_CONST 0
  STORE_FAST off
  LOAD_GLOBAL NULL + range
  LOAD_FAST spans_count
  CALL 1
  GET_ITER
L3:
  EXTENDED_ARG 1
  FOR_ITER L11
  STORE_FAST i
  LOAD_FAST string
  LOAD_FAST spans
  LOAD_FAST i
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + start
  CALL 0
  LOAD_FAST spans
  LOAD_FAST i
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + end
  CALL 0
  BINARY_SLICE
  STORE_FAST tok
  LOAD_FAST i
  LOAD_FAST spans_count
  LOAD_CONST 1
  BINARY_OP -
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L4
  LOAD_FAST rez
  LOAD_ATTR NULL|self + append
  LOAD_FAST string
  LOAD_FAST off
  LOAD_FAST spans
  LOAD_FAST i
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + end
  CALL 0
  BINARY_SLICE
  CALL 1
  POP_TOP
  JUMP_BACKWARD L3
L4:
  LOAD_FAST tok
  LOAD_CONST -1
  BINARY_SUBSCR
  LOAD_CONST ('.', '!', '?', '…', '»')
  CONTAINS_OP 0
  POP_JUMP_IF_TRUE L5
  JUMP_BACKWARD L3
L5:
  LOAD_FAST tok
  LOAD_GLOBAL re
  LOAD_ATTR NULL|self + search
  LOAD_CONST '[.!?…»]'
  LOAD_FAST tok
  CALL 2
  LOAD_ATTR NULL|self + start
  CALL 0
  LOAD_CONST 1
  BINARY_OP -
  BINARY_SUBSCR
  STORE_FAST tok1
  LOAD_FAST string
  LOAD_FAST spans
  LOAD_FAST i
  LOAD_CONST 1
  BINARY_OP +
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + start
  CALL 0
  LOAD_FAST spans
  LOAD_FAST i
  LOAD_CONST 1
  BINARY_OP +
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + end
  CALL 0
  BINARY_SLICE
  STORE_FAST next_tok
  LOAD_FAST next_tok
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + isupper
  CALL 0
  POP_JUMP_IF_TRUE L6
  JUMP_BACKWARD L3
L6:
  LOAD_FAST tok1
  LOAD_ATTR NULL|self + isupper
  CALL 0
  POP_JUMP_IF_FALSE L7
  JUMP_BACKWARD L3
L7:
  LOAD_FAST tok
  LOAD_CONST -1
  BINARY_SUBSCR
  LOAD_CONST '.'
  COMPARE_OP !=
  POP_JUMP_IF_FALSE L8
  JUMP_BACKWARD L3
L8:
  LOAD_FAST tok1
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_CONST '('
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L9
  JUMP_BACKWARD L3
L9:
  LOAD_FAST tok
  LOAD_GLOBAL ABBRS
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L10
  JUMP_BACKWARD L3
L10:
  LOAD_FAST rez
  LOAD_ATTR NULL|self + append
  LOAD_FAST string
  LOAD_FAST off
  LOAD_FAST spans
  LOAD_FAST i
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + end
  CALL 0
  BINARY_SLICE
  CALL 1
  POP_TOP
  LOAD_FAST spans
  LOAD_FAST i
  LOAD_CONST 1
  BINARY_OP +
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + start
  CALL 0
  STORE_FAST off
  EXTENDED_ARG 1
  JUMP_BACKWARD L3
L11:
  END_FOR
  LOAD_FAST rez
  RETURN_VALUE
END

def tokenize_sents(string):
    """pass"""
    string = six.text_type(string)
    spans = []
    for match in re.finditer('[^\\s]+', string):
        spans.append(match)
    spans_count = len(spans)
    rez = []
    off = 0
    for i in range(spans_count):
        tok = string[spans[i].start():spans[i].end()]
        if i == spans_count - 1:
            rez.append(string[off:spans[i].end()])
        elif tok[-1] in ['.', '!', '?', '…', '»']:
            tok1 = tok[re.search('[.!?…»]', tok).start() - 1]
            next_tok = string[spans[i + 1].start():spans[i + 1].end()]
            if next_tok[0].isupper() and (not tok1.isupper()) and (not (tok[-1] != '.' or tok1[0] == '(' or tok in ABBRS)):
                rez.append(string[off:spans[i].end()])
                off = spans[i + 1].start()
    return rez

code-search-net/code_search_net (python, train split)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code tokenize_text>
  MAKE_FUNCTION 0
  STORE_NAME tokenize_text
  RETURN_CONST None
END
CODE tokenize_text(string)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL six
  LOAD_ATTR NULL|self + text_type
  LOAD_FAST string
  CALL 1
  STORE_FAST string
  BUILD_LIST 0
  STORE_FAST rez
  LOAD_FAST string
  LOAD_ATTR NULL|self + split
  LOAD_CONST '\n'
  CALL 1
  GET_ITER
L1:
  FOR_ITER L5
  STORE_FAST part
  BUILD_LIST 0
  STORE_FAST par
  LOAD_GLOBAL NULL + tokenize_sents
  LOAD_FAST part
  CALL 1
  GET_ITER
L2:
  FOR_ITER L3
  STORE_FAST sent
  LOAD_FAST par
  LOAD_ATTR NULL|self + append
  LOAD_GLOBAL NULL + tokenize_words
  LOAD_FAST sent
  CALL 1
  CALL 1
  POP_TOP
  JUMP_BACKWARD L2
L3:
  END_FOR
  LOAD_FAST par
  POP_JUMP_IF_TRUE L4
  JUMP_BACKWARD L1
L4:
  LOAD_FAST rez
  LOAD_ATTR NULL|self + append
  LOAD_FAST par
  CALL 1
  POP_TOP
  JUMP_BACKWARD L1
L5:
  END_FOR
  LOAD_FAST rez
  RETURN_VALUE
END

def tokenize_text(string):
    """pass"""
    string = six.text_type(string)
    rez = []
    for part in string.split('\n'):
        par = []
        for sent in tokenize_sents(part):
            par.append(tokenize_words(sent))
        if par:
            rez.append(par)
    return rez


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code override_djconfig>
  MAKE_FUNCTION 0
  STORE_NAME override_djconfig
  RETURN_CONST None
END
CODE override_djconfig(**new_cache_values)
  DOC 'pass'
  MAKE_CELL new_cache_values
  RESUME 0
  LOAD_CLOSURE new_cache_values
  BUILD_TUPLE 1
  LOAD_CONST <code override_djconfig.<locals>.decorator>
  MAKE_FUNCTION closure
  STORE_FAST decorator
  LOAD_FAST decorator
  RETURN_VALUE
END
CODE override_djconfig.<locals>.decorator(func)
  COPY_FREE_VARS 1
  MAKE_CELL func
  RESUME 0
  LOAD_GLOBAL NULL + wraps
  LOAD_DEREF func
  CALL 1
  LOAD_CLOSURE func
  LOAD_CLOSURE new_cache_values
  BUILD_TUPLE 2
  LOAD_CONST <code override_djconfig.<locals>.decorator.<locals>.func_wrapper>
  MAKE_FUNCTION closure
  CALL 0
  STORE_FAST func_wrapper
  LOAD_FAST func_wrapper
  RETURN_VALUE
END
CODE override_djconfig.<locals>.decorator.<locals>.func_wrapper(*args, **kw)
  COPY_FREE_VARS 2
  RESUME 0
  LOAD_DEREF new_cache_values
  GET_ITER
  LOAD_FAST_AND_CLEAR key
  SWAP 2
L1:
  BUILD_MAP 0
  SWAP 2
L2:
  FOR_ITER L3
  STORE_FAST key
  LOAD_FAST key
  LOAD_GLOBAL NULL + getattr
  LOAD_GLOBAL conf
  LOAD_ATTR config
  LOAD_FAST key
  CALL 2
  MAP_ADD 2
  JUMP_BACKWARD L2
L3:
  END_FOR
L4:
  STORE_FAST old_cache_values
  STORE_FAST key
  LOAD_GLOBAL conf
  LOAD_ATTR config
  LOAD_ATTR NULL|self + _set_many
  LOAD_DEREF new_cache_values
  CALL 1
  POP_TOP
  NOP
L5:
  PUSH_NULL
  LOAD_DEREF func
  LOAD_FAST args
  BUILD_MAP 0
  LOAD_FAST kw
  DICT_MERGE 1
  CALL_FUNCTION_EX 1
L6:
  LOAD_GLOBAL conf
  LOAD_ATTR config
  LOAD_ATTR NULL|self + _set_many
  LOAD_FAST old_cache_values
  CALL 1
  POP_TOP
  RETURN_VALUE
L7:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST key
  RERAISE 0
L8:
  PUSH_EXC_INFO
  LOAD_GLOBAL conf
  LOAD_ATTR config
  LOAD_ATTR NULL|self + _set_many
  LOAD_FAST old_cache_values
  CALL 1
  POP_TOP
  RERAISE 0
L9:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L4 -> handler=L7 depth=2 lasti=False
  EXC try=L5..L6 -> handler=L8 depth=0 lasti=False
  EXC try=L8..L9 -> handler=L9 depth=1 lasti=True
END

def override_djconfig(**new_cache_values):
    """pass"""

    def decorator(func):

        @wraps(func)
        def func_wrapper(*args, **kw):
            old_cache_values = {key: getattr(conf.config, key) for key in new_cache_values}
            conf.config._set_many(new_cache_values)
            try:
                return func(*args, **kw)
            finally:
                conf.config._set_many(old_cache_values)
        return func_wrapper
    return decorator


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code serialize>
  MAKE_FUNCTION 0
  STORE_NAME serialize
  RETURN_CONST None
END
CODE serialize(value, field)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST field
  LOAD_GLOBAL forms
  LOAD_ATTR Field
  CALL 2
  POP_JUMP_IF_TRUE L1
  LOAD_ASSERTION_ERROR
  RAISE_VARARGS 1
L1:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST field
  LOAD_GLOBAL forms
  LOAD_ATTR ModelMultipleChoiceField
  CALL 2
  POP_JUMP_IF_FALSE L6
  LOAD_GLOBAL json
  LOAD_ATTR NULL|self + dumps
  LOAD_FAST value
  GET_ITER
  LOAD_FAST_AND_CLEAR v
  SWAP 2
L2:
  BUILD_LIST 0
  SWAP 2
L3:
  FOR_ITER L4
  STORE_FAST v
  LOAD_FAST v
  LOAD_ATTR pk
  LIST_APPEND 2
  JUMP_BACKWARD L3
L4:
  END_FOR
L5:
  SWAP 2
  STORE_FAST v
  CALL 1
  RETURN_VALUE
L6:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST value
  LOAD_GLOBAL models
  LOAD_ATTR Model
  CALL 2
  POP_JUMP_IF_FALSE L7
  LOAD_FAST value
  LOAD_ATTR pk
  RETURN_VALUE
L7:
  LOAD_FAST value
  RETURN_VALUE
L8:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST v
  RERAISE 0
  EXC try=L2..L5 -> handler=L8 depth=4 lasti=False
END

def serialize(value, field):
    """pass"""
    assert isinstance(field, forms.Field)
    if isinstance(field, forms.ModelMultipleChoiceField):
        return json.dumps([v.pk for v in value])
    if isinstance(value, models.Model):
        return value.pk
    return value


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code get_version>
  MAKE_FUNCTION 0
  STORE_NAME get_version
  RETURN_CONST None
END
CODE get_version(package)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL io
  LOAD_ATTR NULL|self + open
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_GLOBAL BASE_DIR
  LOAD_FAST package
  LOAD_CONST '__init__.py'
  CALL 3
  LOAD_CONST 'utf-8'
  KW_NAMES ('encoding',)
  CALL 2
  BEFORE_WITH
L1:
  STORE_FAST fh
  LOAD_FAST fh
  LOAD_ATTR NULL|self + readlines
  CALL 0
  GET_ITER
  LOAD_FAST_AND_CLEAR l
  SWAP 2
L2:
  BUILD_LIST 0
  SWAP 2
L3:
  FOR_ITER L6
  STORE_FAST l
  LOAD_CONST '__version__'
  LOAD_FAST l
  CONTAINS_OP 0
  POP_JUMP_IF_TRUE L5
L4:
  JUMP_BACKWARD L3
L5:
  LOAD_FAST l
  LOAD_ATTR NULL|self + split
  LOAD_CONST '='
  LOAD_CONST 1
  CALL 2
  LOAD_CONST 1
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + strip
  CALL 0
  LOAD_ATTR NULL|self + strip
  LOAD_CONST "'"
  CALL 1
  LOAD_ATTR NULL|self + strip
  LOAD_CONST '"'
  CALL 1
  LIST_APPEND 2
  JUMP_BACKWARD L3
L6:
  END_FOR
L7:
  SWAP 2
  STORE_FAST l
  LOAD_CONST 0
  BINARY_SUBSCR
L8:
  SWAP 2
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  RETURN_VALUE
L9:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST l
  RERAISE 0
L10:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L11
  RERAISE 2
L11:
  POP_TOP
L12:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  RETURN_CONST None
L13:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L2 -> handler=L10 depth=1 lasti=True
  EXC try=L2..L4 -> handler=L9 depth=3 lasti=False
  EXC try=L5..L7 -> handler=L9 depth=3 lasti=False
  EXC try=L7..L8 -> handler=L10 depth=1 lasti=True
  EXC try=L9..L10 -> handler=L10 depth=1 lasti=True
  EXC try=L10..L12 -> handler=L13 depth=3 lasti=True
END

def get_version(package):
    """pass"""
    with io.open(os.path.join(BASE_DIR, package, '__init__.py'), encoding='utf-8') as fh:
        return [l.split('=', 1)[1].strip().strip("'").strip('"') for l in fh.readlines() if '__version__' in l][0]


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _check_backend>
  MAKE_FUNCTION 0
  STORE_NAME _check_backend
  RETURN_CONST None
END
CODE _check_backend()
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + set
  LOAD_GLOBAL NULL + getattr
  LOAD_GLOBAL settings
  LOAD_CONST 'MIDDLEWARE'
  LOAD_CONST None
  CALL 3
  COPY 1
  POP_JUMP_IF_TRUE L1
  POP_TOP
  LOAD_GLOBAL NULL + getattr
  LOAD_GLOBAL settings
  LOAD_CONST 'MIDDLEWARE_CLASSES'
  LOAD_CONST None
  CALL 3
  COPY 1
  POP_JUMP_IF_TRUE L1
  POP_TOP
  BUILD_LIST 0
L1:
  CALL 1
  STORE_FAST middleware
  LOAD_CONST 'djconfig.middleware.DjConfigLocMemMiddleware'
  LOAD_FAST middleware
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L2
  RETURN_CONST None
L2:
  LOAD_CONST 'djconfig.middleware.DjConfigMiddleware'
  LOAD_FAST middleware
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L3
  RETURN_CONST None
L3:
  LOAD_GLOBAL NULL + ValueError
  LOAD_CONST 'djconfig.middleware.DjConfigMiddleware is required but it was not found in MIDDLEWARE_CLASSES nor in MIDDLEWARE'
  CALL 1
  RAISE_VARARGS 1
END

def _check_backend():
    """pass"""
    middleware = set(getattr(settings, 'MIDDLEWARE', None) or getattr(settings, 'MIDDLEWARE_CLASSES', None) or [])
    if 'djconfig.middleware.DjConfigLocMemMiddleware' in middleware:
        return
    if 'djconfig.middleware.DjConfigMiddleware' in middleware:
        return
    raise ValueError('djconfig.middleware.DjConfigMiddleware is required but it was not found in MIDDLEWARE_CLASSES nor in MIDDLEWARE')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (True,)
  LOAD_CONST <code _register>
  MAKE_FUNCTION defaults
  STORE_NAME _register
  RETURN_CONST None
END
CODE _register(self, form_class, check_middleware)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + issubclass
  LOAD_FAST form_class
  LOAD_GLOBAL _ConfigFormBase
  CALL 2
  POP_JUMP_IF_TRUE L1
  LOAD_GLOBAL NULL + ValueError
  LOAD_CONST 'The form does not inherit from `forms.ConfigForm`'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_FAST self
  LOAD_ATTR _registry
  LOAD_ATTR NULL|self + add
  LOAD_FAST form_class
  CALL 1
  POP_TOP
  LOAD_FAST check_middleware
  POP_JUMP_IF_FALSE L2
  LOAD_GLOBAL NULL + _check_backend
  CALL 0
  POP_TOP
  RETURN_CONST None
L2:
  RETURN_CONST None
END

def _register(self, form_class, check_middleware=True):
    """pass"""
    if not issubclass(form_class, _ConfigFormBase):
        raise ValueError('The form does not inherit from `forms.ConfigForm`')
    self._registry.add(form_class)
    if check_middleware:
        _check_backend()


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _reload>
  MAKE_FUNCTION 0
  STORE_NAME _reload
  RETURN_CONST None
END
CODE _reload(self)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL apps
  LOAD_ATTR NULL|self + get_model
  LOAD_CONST 'djconfig.Config'
  CALL 1
  STORE_FAST ConfigModel
  BUILD_MAP 0
  STORE_FAST cache
  LOAD_GLOBAL NULL + dict
  LOAD_FAST ConfigModel
  LOAD_ATTR objects
  LOAD_ATTR NULL|self + all
  CALL 0
  LOAD_ATTR NULL|self + values_list
  LOAD_CONST 'key'
  LOAD_CONST 'value'
  CALL 2
  CALL 1
  STORE_FAST data
  LOAD_FAST self
  LOAD_ATTR _registry
  GET_ITER
L1:
  EXTENDED_ARG 1
  FOR_ITER L28
  STORE_FAST form_class
  PUSH_NULL
  LOAD_FAST form_class
  CALL 0
  STORE_FAST empty_form
  LOAD_FAST cache
  LOAD_ATTR NULL|self + update
  LOAD_FAST empty_form
  LOAD_ATTR fields
  LOAD_ATTR NULL|self + items
  CALL 0
  GET_ITER
  LOAD_FAST_AND_CLEAR name
  LOAD_FAST_AND_CLEAR field
  SWAP 3
L2:
  BUILD_MAP 0
  SWAP 2
L3:
  FOR_ITER L4
  UNPACK_SEQUENCE 2
  STORE_FAST name
  STORE_FAST field
  LOAD_FAST name
  LOAD_FAST field
  LOAD_ATTR initial
  MAP_ADD 2
  JUMP_BACKWARD L3
L4:
  END_FOR
L5:
  SWAP 3
  STORE_FAST field
  STORE_FAST name
  CALL 1
  POP_TOP
  PUSH_NULL
  LOAD_FAST form_class
  LOAD_FAST empty_form
  LOAD_ATTR fields
  LOAD_ATTR NULL|self + items
  CALL 0
  GET_ITER
  LOAD_FAST_AND_CLEAR name
  LOAD_FAST_AND_CLEAR field
  SWAP 3
L6:
  BUILD_MAP 0
  SWAP 2
L7:
  FOR_ITER L12
  UNPACK_SEQUENCE 2
  STORE_FAST name
  STORE_FAST field
  LOAD_FAST name
  LOAD_FAST data
  CONTAINS_OP 0
  POP_JUMP_IF_TRUE L9
L8:
  JUMP_BACKWARD L7
L9:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST field
  LOAD_GLOBAL forms
  LOAD_ATTR FileField
  CALL 2
  POP_JUMP_IF_FALSE L11
L10:
  JUMP_BACKWARD L7
L11:
  LOAD_FAST name
  LOAD_GLOBAL NULL + _deserialize
  LOAD_FAST data
  LOAD_FAST name
  BINARY_SUBSCR
  LOAD_FAST field
  CALL 2
  MAP_ADD 2
  JUMP_BACKWARD L7
L12:
  END_FOR
L13:
  SWAP 3
  STORE_FAST field
  STORE_FAST name
  KW_NAMES ('data',)
  CALL 1
  STORE_FAST form
  LOAD_FAST form
  LOAD_ATTR NULL|self + is_valid
  CALL 0
  POP_TOP
  LOAD_FAST cache
  LOAD_ATTR NULL|self + update
  LOAD_FAST form
  LOAD_ATTR cleaned_data
  LOAD_ATTR NULL|self + items
  CALL 0
  GET_ITER
  LOAD_FAST_AND_CLEAR name
  LOAD_FAST_AND_CLEAR value
  SWAP 3
L14:
  BUILD_MAP 0
  SWAP 2
L15:
  FOR_ITER L18
  UNPACK_SEQUENCE 2
  STORE_FAST name
  STORE_FAST value
  LOAD_FAST name
  LOAD_FAST data
  CONTAINS_OP 0
  POP_JUMP_IF_TRUE L17
L16:
  JUMP_BACKWARD L15
L17:
  LOAD_FAST name
  LOAD_GLOBAL NULL + _unlazify
  LOAD_FAST value
  CALL 1
  MAP_ADD 2
  JUMP_BACKWARD L15
L18:
  END_FOR
L19:
  SWAP 3
  STORE_FAST value
  STORE_FAST name
  CALL 1
  POP_TOP
  LOAD_FAST cache
  LOAD_ATTR NULL|self + update
  LOAD_FAST empty_form
  LOAD_ATTR fields
  LOAD_ATTR NULL|self + items
  CALL 0
  GET_ITER
  LOAD_FAST_AND_CLEAR name
  LOAD_FAST_AND_CLEAR field
  SWAP 3
L20:
  BUILD_MAP 0
  SWAP 2
L21:
  FOR_ITER L26
  UNPACK_SEQUENCE 2
  STORE_FAST name
  STORE_FAST field
  LOAD_FAST name
  LOAD_FAST data
  CONTAINS_OP 0
  POP_JUMP_IF_TRUE L23
L22:
  JUMP_BACKWARD L21
L23:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST field
  LOAD_GLOBAL forms
  LOAD_ATTR FileField
  CALL 2
  POP_JUMP_IF_TRUE L25
L24:
  JUMP_BACKWARD L21
L25:
  LOAD_FAST name
  LOAD_FAST data
  LOAD_FAST name
  BINARY_SUBSCR
  MAP_ADD 2
  JUMP_BACKWARD L21
L26:
  END_FOR
L27:
  SWAP 3
  STORE_FAST field
  STORE_FAST name
  CALL 1
  POP_TOP
  EXTENDED_ARG 1
  JUMP_BACKWARD L1
L28:
  END_FOR
  LOAD_FAST data
  LOAD_ATTR NULL|self + get
  LOAD_CONST '_updated_at'
  CALL 1
  LOAD_FAST cache
  LOAD_CONST '_updated_at'
  STORE_SUBSCR
  LOAD_FAST cache
  LOAD_FAST self
  STORE_ATTR _cache
  RETURN_CONST None
L29:
  SWAP 2
  POP_TOP
  SWAP 3
  STORE_FAST field
  STORE_FAST name
  RERAISE 0
L30:
  SWAP 2
  POP_TOP
  SWAP 3
  STORE_FAST field
  STORE_FAST name
  RERAISE 0
L31:
  SWAP 2
  POP_TOP
  SWAP 3
  STORE_FAST value
  STORE_FAST name
  RERAISE 0
L32:
  SWAP 2
  POP_TOP
  SWAP 3
  STORE_FAST field
  STORE_FAST name
  RERAISE 0
  EXC try=L2..L5 -> handler=L29 depth=6 lasti=False
  EXC try=L6..L8 -> handler=L30 depth=6 lasti=False
  EXC try=L9..L10 -> handler=L30 depth=6 lasti=False
  EXC try=L11..L13 -> handler=L30 depth=6 lasti=False
  EXC try=L14..L16 -> handler=L31 depth=6 lasti=False
  EXC try=L17..L19 -> handler=L31 depth=6 lasti=False
  EXC try=L20..L22 -> handler=L32 depth=6 lasti=False
  EXC try=L23..L24 -> handler=L32 depth=6 lasti=False
  EXC try=L25..L27 -> handler=L32 depth=6 lasti=False
END

def _reload(self):
    """pass"""
    ConfigModel = apps.get_model('djconfig.Config')
    cache = {}
    data = dict(ConfigModel.objects.all().values_list('key', 'value'))
    for form_class in self._registry:
        empty_form = form_class()
        cache.update({name: field.initial for name, field in empty_form.fields.items()})
        form = form_class(data={name: _deserialize(data[name], field) for name, field in empty_form.fields.items() if name in data and (not isinstance(field, forms.FileField))})
        form.is_valid()
        cache.update({name: _unlazify(value) for name, value in form.cleaned_data.items() if name in data})
        cache.update({name: data[name] for name, field in empty_form.fields.items() if name in data and isinstance(field, forms.FileField)})
    cache['_updated_at'] = data.get('_updated_at')
    self._cache = cache


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code Mixed>
  MAKE_FUNCTION 0
  STORE_NAME Mixed
  RETURN_CONST None
END
CODE Mixed(*types)
  DOC 'pass'
  MAKE_CELL types
  MAKE_CELL MixedType
  RESUME 0
  LOAD_GLOBAL NULL + len
  LOAD_DEREF types
  CALL 1
  LOAD_CONST 2
  COMPARE_OP <
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + ValueError
  LOAD_CONST 'Mixed type requires at least 2 specific types'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_GLOBAL NULL + set
  LOAD_DEREF types
  CALL 1
  STORE_DEREF types
  PUSH_NULL
  LOAD_BUILD_CLASS
  LOAD_CLOSURE types
  BUILD_TUPLE 1
  LOAD_CONST <code Mixed.<locals>.MixedType>
  MAKE_FUNCTION closure
  LOAD_CONST 'MixedType'
  LOAD_GLOBAL type
  CALL 3
  STORE_DEREF MixedType
  PUSH_NULL
  LOAD_BUILD_CLASS
  LOAD_CLOSURE MixedType
  BUILD_TUPLE 1
  LOAD_CONST <code Mixed.<locals>.Mixed>
  MAKE_FUNCTION closure
  LOAD_CONST 'Mixed'
  LOAD_GLOBAL object
  CALL 3
  STORE_FAST Mixed
  LOAD_FAST Mixed
  RETURN_VALUE
END
CODE Mixed.<locals>.MixedType()
  DOC 'Mixed.<locals>.MixedType'
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_NAME __name__
  STORE_NAME __module__
  LOAD_CONST 'Mixed.<locals>.MixedType'
  STORE_NAME __qualname__
  LOAD_CLOSURE types
  BUILD_TUPLE 1
  LOAD_CONST <code Mixed.<locals>.MixedType.__instancecheck__>
  MAKE_FUNCTION closure
  STORE_NAME __instancecheck__
  RETURN_CONST None
END
CODE Mixed.<locals>.MixedType.__instancecheck__(cls, instance)
  DOC 'pass'
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_DEREF types
  GET_ITER
L1:
  FOR_ITER L3
  STORE_FAST mtype
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST instance
  LOAD_FAST mtype
  CALL 2
  POP_JUMP_IF_TRUE L2
  JUMP_BACKWARD L1
L2:
  POP_TOP
  RETURN_CONST True
L3:
  END_FOR
  RETURN_CONST False
END
CODE Mixed.<locals>.Mixed()
  DOC 'Mixed.<locals>.Mixed'
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_NAME __name__
  STORE_NAME __module__
  LOAD_CONST 'Mixed.<locals>.Mixed'
  STORE_NAME __qualname__
  LOAD_LOCALS
  LOAD_FROM_DICT_OR_DEREF MixedType
  STORE_NAME __metaclass__
  RETURN_CONST None
END

def Mixed(*types):
    """pass"""
    if len(types) < 2:
        raise ValueError('Mixed type requires at least 2 specific types')
    types = set(types)

    class MixedType(type):

        def __instancecheck__(cls, instance):
            """pass"""
            for mtype in types:
                if isinstance(instance, mtype):
                    return True
            return False

    class Mixed(object):
        __metaclass__ = MixedType
    return Mixed


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code one_of>
  MAKE_FUNCTION 0
  STORE_NAME one_of
  RETURN_CONST None
END
CODE one_of(*args)
  DOC 'pass'
  MAKE_CELL items
  RESUME 0
  LOAD_GLOBAL NULL + len
  LOAD_FAST args
  CALL 1
  LOAD_CONST 1
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST args
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_GLOBAL list
  CALL 2
  POP_JUMP_IF_FALSE L1
  LOAD_FAST args
  LOAD_CONST 0
  BINARY_SUBSCR
  STORE_DEREF items
  JUMP_FORWARD L2
L1:
  LOAD_GLOBAL NULL + list
  LOAD_FAST args
  CALL 1
  STORE_DEREF items
L2:
  LOAD_CLOSURE items
  BUILD_TUPLE 1
  LOAD_CONST <code one_of.<locals>.validate>
  MAKE_FUNCTION closure
  STORE_FAST validate
  LOAD_FAST validate
  RETURN_VALUE
END
CODE one_of.<locals>.validate(value)
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_FAST value
  LOAD_DEREF items
  CONTAINS_OP 1
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + e
  LOAD_CONST '{} is not in the list {}'
  LOAD_FAST value
  LOAD_DEREF items
  CALL 3
  RETURN_VALUE
L1:
  RETURN_CONST None
END

def one_of(*args):
    """pass"""
    if len(args) == 1 and isinstance(args[0], list):
        items = args[0]
    else:
        items = list(args)

    def validate(value):
        if not value in items:
            return e('{} is not in the list {}', value, items)
    return validate


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code gte>
  MAKE_FUNCTION 0
  STORE_NAME gte
  RETURN_CONST None
END
CODE gte(min_value)
  DOC 'pass'
  MAKE_CELL min_value
  RESUME 0
  LOAD_CLOSURE min_value
  BUILD_TUPLE 1
  LOAD_CONST <code gte.<locals>.validate>
  MAKE_FUNCTION closure
  STORE_FAST validate
  LOAD_FAST validate
  RETURN_VALUE
END
CODE gte.<locals>.validate(value)
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_FAST value
  LOAD_DEREF min_value
  COMPARE_OP <
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + e
  LOAD_CONST '{} is not greater than or equal to {}'
  LOAD_FAST value
  LOAD_DEREF min_value
  CALL 3
  RETURN_VALUE
L1:
  RETURN_CONST None
END

def gte(min_value):
    """pass"""

    def validate(value):
        if value < min_value:
            return e('{} is not greater than or equal to {}', value, min_value)
    return validate


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code lte>
  MAKE_FUNCTION 0
  STORE_NAME lte
  RETURN_CONST None
END
CODE lte(max_value)
  DOC 'pass'
  MAKE_CELL max_value
  RESUME 0
  LOAD_CLOSURE max_value
  BUILD_TUPLE 1
  LOAD_CONST <code lte.<locals>.validate>
  MAKE_FUNCTION closure
  STORE_FAST validate
  LOAD_FAST validate
  RETURN_VALUE
END
CODE lte.<locals>.validate(value)
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_FAST value
  LOAD_DEREF max_value
  COMPARE_OP >
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + e
  LOAD_CONST '{} is not less than or equal to {}'
  LOAD_FAST value
  LOAD_DEREF max_value
  CALL 3
  RETURN_VALUE
L1:
  RETURN_CONST None
END

def lte(max_value):
    """pass"""

    def validate(value):
        if value > max_value:
            return e('{} is not less than or equal to {}', value, max_value)
    return validate


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code gt>
  MAKE_FUNCTION 0
  STORE_NAME gt
  RETURN_CONST None
END
CODE gt(gt_value)
  DOC 'pass'
  MAKE_CELL gt_value
  RESUME 0
  LOAD_CLOSURE gt_value
  BUILD_TUPLE 1
  LOAD_CONST <code gt.<locals>.validate>
  MAKE_FUNCTION closure
  STORE_FAST validate
  LOAD_FAST validate
  RETURN_VALUE
END
CODE gt.<locals>.validate(value)
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_FAST value
  LOAD_DEREF gt_value
  COMPARE_OP <=
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + e
  LOAD_CONST '{} is not greater than {}'
  LOAD_FAST value
  LOAD_DEREF gt_value
  CALL 3
  RETURN_VALUE
L1:
  RETURN_CONST None
END

def gt(gt_value):
    """pass"""

    def validate(value):
        if value <= gt_value:
            return e('{} is not greater than {}', value, gt_value)
    return validate


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code lt>
  MAKE_FUNCTION 0
  STORE_NAME lt
  RETURN_CONST None
END
CODE lt(lt_value)
  DOC 'pass'
  MAKE_CELL lt_value
  RESUME 0
  LOAD_CLOSURE lt_value
  BUILD_TUPLE 1
  LOAD_CONST <code lt.<locals>.validate>
  MAKE_FUNCTION closure
  STORE_FAST validate
  LOAD_FAST validate
  RETURN_VALUE
END
CODE lt.<locals>.validate(value)
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_FAST value
  LOAD_DEREF lt_value
  COMPARE_OP >=
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + e
  LOAD_CONST '{} is not less than {}'
  LOAD_FAST value
  LOAD_DEREF lt_value
  CALL 3
  RETURN_VALUE
L1:
  RETURN_CONST None
END

def lt(lt_value):
    """pass"""

    def validate(value):
        if value >= lt_value:
            return e('{} is not less than {}', value, lt_value)
    return validate


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, None)
  LOAD_CONST <code load_config>
  MAKE_FUNCTION defaults
  STORE_NAME load_config
  RETURN_CONST None
END
CODE load_config(path, defaults)
  DOC 'pass'
  RESUME 0
  LOAD_FAST defaults
  POP_JUMP_IF_NOT_NONE L1
  LOAD_GLOBAL DEFAULT_FILES
  STORE_FAST defaults
L1:
  LOAD_GLOBAL NULL + ConfigParser
  LOAD_CONST True
  KW_NAMES ('allow_no_value',)
  CALL 1
  STORE_FAST config
  LOAD_FAST defaults
  POP_JUMP_IF_FALSE L2
  LOAD_FAST config
  LOAD_ATTR NULL|self + read
  LOAD_FAST defaults
  CALL 1
  POP_TOP
L2:
  LOAD_FAST path
  POP_JUMP_IF_FALSE L5
  LOAD_GLOBAL NULL + open
  LOAD_FAST path
  CALL 1
  BEFORE_WITH
L3:
  STORE_FAST fh
  LOAD_FAST config
  LOAD_ATTR NULL|self + read_file
  LOAD_FAST fh
  CALL 1
  POP_TOP
L4:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  LOAD_FAST config
  RETURN_VALUE
L5:
  LOAD_FAST config
  RETURN_VALUE
L6:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L7
  RERAISE 2
L7:
  POP_TOP
L8:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  LOAD_FAST config
  RETURN_VALUE
L9:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L3..L4 -> handler=L6 depth=1 lasti=True
  EXC try=L6..L8 -> handler=L9 depth=3 lasti=True
END

def load_config(path=None, defaults=None):
    """pass"""
    if defaults is None:
        defaults = DEFAULT_FILES
    config = ConfigParser(allow_no_value=True)
    if defaults:
        config.read(defaults)
    if path:
        with open(path) as fh:
            config.read_file(fh)
    return config


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code as_dict>
  MAKE_FUNCTION 0
  STORE_NAME as_dict
  RETURN_CONST None
END
CODE as_dict(config)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + defaultdict
  LOAD_CONST <code as_dict.<locals>.<lambda>>
  MAKE_FUNCTION 0
  CALL 1
  STORE_FAST settings
  LOAD_FAST config
  LOAD_ATTR NULL|self + sections
  CALL 0
  GET_ITER
L1:
  FOR_ITER L4
  STORE_FAST section
  LOAD_FAST config
  LOAD_ATTR NULL|self + items
  LOAD_FAST section
  CALL 1
  GET_ITER
L2:
  FOR_ITER L3
  UNPACK_SEQUENCE 2
  STORE_FAST key
  STORE_FAST val
  LOAD_FAST val
  LOAD_FAST settings
  LOAD_FAST section
  BINARY_SUBSCR
  LOAD_FAST key
  STORE_SUBSCR
  JUMP_BACKWARD L2
L3:
  END_FOR
  JUMP_BACKWARD L1
L4:
  END_FOR
  LOAD_FAST settings
  RETURN_VALUE
END
CODE as_dict.<locals>.<lambda>()
  RESUME 0
  BUILD_MAP 0
  RETURN_VALUE
END

def as_dict(config):
    """pass"""
    settings = defaultdict(lambda: {})
    for section in config.sections():
        for key, val in config.items(section):
            settings[section][key] = val
    return settings


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code initialize>
  MAKE_FUNCTION 0
  STORE_NAME initialize
  RETURN_CONST None
END
CODE initialize(self, timeouts)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR bind
  LOAD_CONST True
  IS_OP 0
  POP_JUMP_IF_FALSE L1
  LOAD_FAST self
  LOAD_ATTR socket
  LOAD_ATTR NULL|self + bind
  LOAD_FAST self
  LOAD_ATTR address
  CALL 1
  POP_TOP
  JUMP_FORWARD L2
L1:
  LOAD_FAST self
  LOAD_ATTR socket
  LOAD_ATTR NULL|self + connect
  LOAD_FAST self
  LOAD_ATTR address
  CALL 1
  POP_TOP
L2:
  LOAD_FAST self
  LOAD_ATTR NULL|self + _set_timeouts
  LOAD_FAST timeouts
  CALL 1
  POP_TOP
  RETURN_CONST None
END

def initialize(self, timeouts):
    """pass"""
    if self.bind is True:
        self.socket.bind(self.address)
    else:
        self.socket.connect(self.address)
    self._set_timeouts(timeouts)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _set_timeouts>
  MAKE_FUNCTION 0
  STORE_NAME _set_timeouts
  RETURN_CONST None
END
CODE _set_timeouts(self, timeouts)
  DOC 'pass'
  RESUME 0
  LOAD_CONST (None, None)
  UNPACK_SEQUENCE 2
  STORE_FAST send_timeout
  STORE_FAST recv_timeout
  NOP
L1:
  LOAD_FAST timeouts
  UNPACK_SEQUENCE 2
  STORE_FAST send_timeout
  STORE_FAST recv_timeout
L2:
  LOAD_FAST send_timeout
  POP_JUMP_IF_NONE L3
  LOAD_FAST self
  LOAD_ATTR socket
  LOAD_ATTR NULL|self + set_int_option
  LOAD_GLOBAL nanomsg
  LOAD_ATTR SOL_SOCKET
  LOAD_GLOBAL nanomsg
  LOAD_ATTR SNDTIMEO
  LOAD_FAST send_timeout
  CALL 3
  POP_TOP
L3:
  LOAD_FAST recv_timeout
  POP_JUMP_IF_NONE L4
  LOAD_FAST self
  LOAD_ATTR socket
  LOAD_ATTR NULL|self + set_int_option
  LOAD_GLOBAL nanomsg
  LOAD_ATTR SOL_SOCKET
  LOAD_GLOBAL nanomsg
  LOAD_ATTR RCVTIMEO
  LOAD_FAST recv_timeout
  CALL 3
  POP_TOP
  RETURN_CONST None
L4:
  RETURN_CONST None
L5:
  PUSH_EXC_INFO
  LOAD_GLOBAL TypeError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L6
  POP_TOP
  LOAD_GLOBAL NULL + EndpointError
  LOAD_CONST '`timeouts` must be a pair of numbers (2, 3) which represent the timeout values for send and receive respectively'
  CALL 1
  RAISE_VARARGS 1
L6:
  RERAISE 0
L7:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L2 -> handler=L5 depth=0 lasti=False
  EXC try=L5..L7 -> handler=L7 depth=1 lasti=True
END

def _set_timeouts(self, timeouts):
    """pass"""
    send_timeout, recv_timeout = (None, None)
    try:
        send_timeout, recv_timeout = timeouts
    except TypeError:
        raise EndpointError('`timeouts` must be a pair of numbers (2, 3) which represent the timeout values for send and receive respectively')
    if send_timeout is not None:
        self.socket.set_int_option(nanomsg.SOL_SOCKET, nanomsg.SNDTIMEO, send_timeout)
    if recv_timeout is not None:
        self.socket.set_int_option(nanomsg.SOL_SOCKET, nanomsg.RCVTIMEO, recv_timeout)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code send>
  MAKE_FUNCTION 0
  STORE_NAME send
  RETURN_CONST None
END
CODE send(self, payload)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR NULL|self + encode
  LOAD_FAST payload
  CALL 1
  STORE_FAST payload
  LOAD_FAST self
  LOAD_ATTR NULL|self + sign
  LOAD_FAST payload
  CALL 1
  STORE_FAST payload
  LOAD_FAST self
  LOAD_ATTR socket
  LOAD_ATTR NULL|self + send
  LOAD_FAST payload
  CALL 1
  POP_TOP
  RETURN_CONST None
END

def send(self, payload):
    """pass"""
    payload = self.encode(payload)
    payload = self.sign(payload)
    self.socket.send(payload)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (True,)
  LOAD_CONST <code receive>
  MAKE_FUNCTION defaults
  STORE_NAME receive
  RETURN_CONST None
END
CODE receive(self, decode)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR socket
  LOAD_ATTR NULL|self + recv
  CALL 0
  STORE_FAST payload
  LOAD_FAST self
  LOAD_ATTR NULL|self + verify
  LOAD_FAST payload
  CALL 1
  STORE_FAST payload
  LOAD_FAST decode
  POP_JUMP_IF_FALSE L1
  LOAD_FAST self
  LOAD_ATTR NULL|self + decode
  LOAD_FAST payload
  CALL 1
  STORE_FAST payload
L1:
  LOAD_FAST payload
  RETURN_VALUE
END

def receive(self, decode=True):
    """pass"""
    payload = self.socket.recv()
    payload = self.verify(payload)
    if decode:
        payload = self.decode(payload)
    return payload


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code sign>
  MAKE_FUNCTION 0
  STORE_NAME sign
  RETURN_CONST None
END
CODE sign(self, payload)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR authenticator
  POP_JUMP_IF_FALSE L1
  LOAD_FAST self
  LOAD_ATTR authenticator
  LOAD_ATTR NULL|self + signed
  LOAD_FAST payload
  CALL 1
  RETURN_VALUE
L1:
  LOAD_FAST payload
  RETURN_VALUE
END

def sign(self, payload):
    """pass"""
    if self.authenticator:
        return self.authenticator.signed(payload)
    return payload


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code verify>
  MAKE_FUNCTION 0
  STORE_NAME verify
  RETURN_CONST None
END
CODE verify(self, payload)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR authenticator
  POP_JUMP_IF_TRUE L1
  LOAD_FAST payload
  RETURN_VALUE
L1:
  NOP
L2:
  LOAD_FAST self
  LOAD_ATTR authenticator
  LOAD_ATTR NULL|self + auth
  LOAD_FAST payload
  CALL 1
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR authenticator
  LOAD_ATTR NULL|self + unsigned
  LOAD_FAST payload
  CALL 1
L3:
  RETURN_VALUE
L4:
  PUSH_EXC_INFO
  LOAD_GLOBAL AuthenticatorInvalidSignature
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L5
  POP_TOP
  RAISE_VARARGS 0
L5:
  LOAD_GLOBAL Exception
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L8
  STORE_FAST exception
L6:
  LOAD_GLOBAL NULL + AuthenticateError
  LOAD_GLOBAL NULL + str
  LOAD_FAST exception
  CALL 1
  CALL 1
  RAISE_VARARGS 1
L7:
  LOAD_CONST None
  STORE_FAST exception
  DELETE_FAST exception
  RERAISE 1
L8:
  RERAISE 0
L9:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L2..L3 -> handler=L4 depth=0 lasti=False
  EXC try=L4..L6 -> handler=L9 depth=1 lasti=True
  EXC try=L6..L7 -> handler=L7 depth=1 lasti=True
  EXC try=L7..L9 -> handler=L9 depth=1 lasti=True
END

def verify(self, payload):
    """pass"""
    if not self.authenticator:
        return payload
    try:
        self.authenticator.auth(payload)
        return self.authenticator.unsigned(payload)
    except AuthenticatorInvalidSignature:
        raise
    except Exception as exception:
        raise AuthenticateError(str(exception))


Input:
CODE <module>()
  RESUME 0
  BUILD_LIST 0
  BUILD_TUPLE 1
  LOAD_CONST <code get_summary>
  MAKE_FUNCTION defaults
  STORE_NAME get_summary
  RETURN_CONST None
END
CODE get_summary(list_all, **kwargs)
  DOC 'pass'
  RESUME 0
  BUILD_LIST 0
  STORE_FAST all_summary
  LOAD_FAST list_all
  GET_ITER
L1:
  EXTENDED_ARG 1
  FOR_ITER L10
  STORE_FAST module
  LOAD_FAST module
  LOAD_CONST 'Name'
  BINARY_SUBSCR
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'show_all'
  LOAD_CONST True
  CALL 2
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'proj_name'
  LOAD_CONST 'TestProject'
  CALL 2
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'home_page'
  LOAD_GLOBAL __about__
  LOAD_ATTR HOME_PAGE
  CALL 2
  LOAD_CONST ''
  LOAD_CONST ''
  LOAD_CONST ''
  LOAD_GLOBAL NULL + len
  LOAD_FAST module
  LOAD_CONST 'TestCases'
  BINARY_SUBSCR
  CALL 1
  LOAD_CONST 0
  LOAD_CONST 0
  BUILD_LIST 0
  LOAD_CONST ('module_name', 'show_all', 'project_name', 'home_page', 'start_time', 'end_time', 'duration_seconds', 'total_case_num', 'pass_cases_num', 'fail_cases_num', 'details')
  BUILD_CONST_KEY_MAP 11
  STORE_FAST summary
  LOAD_FAST module
  LOAD_CONST 'TestCases'
  BINARY_SUBSCR
  GET_ITER
L2:
  FOR_ITER L5
  STORE_FAST case
  BUILD_MAP 0
  STORE_FAST case_detail
  LOAD_CONST './caselogs/'
  LOAD_FAST case
  LOAD_CONST 'case_name'
  BINARY_SUBSCR
  FORMAT_VALUE str
  LOAD_CONST '_'
  LOAD_FAST case
  LOAD_CONST 'exec_date'
  BINARY_SUBSCR
  FORMAT_VALUE str
  LOAD_CONST '.log'
  BUILD_STRING 5
  LOAD_FAST case_detail
  LOAD_CONST 'linkurl'
  STORE_SUBSCR
  LOAD_FAST case
  LOAD_CONST 'status'
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + lower
  CALL 0
  LOAD_CONST 'pass'
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L3
  LOAD_FAST summary
  LOAD_CONST 'pass_cases_num'
  COPY 2
  COPY 2
  BINARY_SUBSCR
  LOAD_CONST 1
  BINARY_OP +=
  SWAP 3
  SWAP 2
  STORE_SUBSCR
  LOAD_CONST 'tr_pass'
  LOAD_FAST case_detail
  LOAD_CONST 'c_style'
  STORE_SUBSCR
  JUMP_FORWARD L4
L3:
  LOAD_FAST summary
  LOAD_CONST 'fail_cases_num'
  COPY 2
  COPY 2
  BINARY_SUBSCR
  LOAD_CONST 1
  BINARY_OP +=
  SWAP 3
  SWAP 2
  STORE_SUBSCR
  LOAD_CONST 'tr_fail'
  LOAD_FAST case_detail
  LOAD_CONST 'c_style'
  STORE_SUBSCR
L4:
  LOAD_FAST case_detail
  LOAD_ATTR NULL|self + update
  LOAD_FAST case
  CALL 1
  POP_TOP
  LOAD_FAST summary
  LOAD_CONST 'details'
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + append
  LOAD_FAST case_detail
  CALL 1
  POP_TOP
  JUMP_BACKWARD L2
L5:
  END_FOR
  NOP
L6:
  LOAD_FAST module
  LOAD_CONST 'TestCases'
  BINARY_SUBSCR
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'start_at'
  CALL 1
  STORE_FAST st
  LOAD_FAST module
  LOAD_CONST 'TestCases'
  BINARY_SUBSCR
  LOAD_CONST -1
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'end_at'
  CALL 1
  STORE_FAST et
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + strftime
  LOAD_CONST '%Y-%m-%d %H:%M:%S'
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + localtime
  LOAD_FAST st
  CALL 1
  CALL 2
  LOAD_FAST summary
  LOAD_CONST 'start_time'
  STORE_SUBSCR
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + strftime
  LOAD_CONST '%Y-%m-%d %H:%M:%S'
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + localtime
  LOAD_FAST et
  CALL 1
  CALL 2
  LOAD_FAST summary
  LOAD_CONST 'end_time'
  STORE_SUBSCR
  LOAD_GLOBAL NULL + float
  LOAD_CONST '%.2f'
  LOAD_FAST et
  LOAD_FAST st
  BINARY_OP -
  BINARY_OP %
  CALL 1
  LOAD_FAST summary
  LOAD_CONST 'duration_seconds'
  STORE_SUBSCR
L7:
  LOAD_FAST summary
  LOAD_CONST 'fail_cases_num'
  BINARY_SUBSCR
  LOAD_CONST 0
  COMPARE_OP >
  POP_JUMP_IF_FALSE L8
  LOAD_CONST 0
  LOAD_CONST 'failure'
  LOAD_FAST summary
  LOAD_CONST 'pass_cases_num'
  BINARY_SUBSCR
  LOAD_FAST summary
  LOAD_CONST 'fail_cases_num'
  BINARY_SUBSCR
  LOAD_CONST ('result', 'message', 'pass', 'fail')
  BUILD_CONST_KEY_MAP 4
  LOAD_FAST summary
  LOAD_CONST 'dict_report'
  STORE_SUBSCR
  JUMP_FORWARD L9
L8:
  LOAD_CONST 1
  LOAD_CONST 'success'
  LOAD_FAST summary
  LOAD_CONST 'pass_cases_num'
  BINARY_SUBSCR
  LOAD_FAST summary
  LOAD_CONST 'fail_cases_num'
  BINARY_SUBSCR
  LOAD_CONST ('result', 'message', 'pass', 'fail')
  BUILD_CONST_KEY_MAP 4
  LOAD_FAST summary
  LOAD_CONST 'dict_report'
  STORE_SUBSCR
L9:
  LOAD_FAST all_summary
  LOAD_ATTR NULL|self + append
  LOAD_FAST summary
  CALL 1
  POP_TOP
  EXTENDED_ARG 1
  JUMP_BACKWARD L1
L10:
  END_FOR
  LOAD_FAST all_summary
  RETURN_VALUE
L11:
  PUSH_EXC_INFO
  LOAD_GLOBAL Exception
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L15
  STORE_FAST _
L12:
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + log_warning
  LOAD_CONST "Will set 'start_at' and 'end_at' to 'None'"
  CALL 1
  POP_TOP
  LOAD_CONST (None, None, None)
  UNPACK_SEQUENCE 3
  LOAD_FAST summary
  LOAD_CONST 'start_time'
  STORE_SUBSCR
  LOAD_FAST summary
  LOAD_CONST 'end_time'
  STORE_SUBSCR
  LOAD_FAST summary
  LOAD_CONST 'duration_seconds'
  STORE_SUBSCR
L13:
  POP_EXCEPT
  LOAD_CONST None
  STORE_FAST _
  DELETE_FAST _
  JUMP_BACKWARD L7
L14:
  LOAD_CONST None
  STORE_FAST _
  DELETE_FAST _
  RERAISE 1
L15:
  RERAISE 0
L16:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L6..L7 -> handler=L11 depth=1 lasti=False
  EXC try=L11..L12 -> handler=L16 depth=2 lasti=True
  EXC try=L12..L13 -> handler=L14 depth=2 lasti=True
  EXC try=L14..L16 -> handler=L16 depth=2 lasti=True
END

def get_summary(list_all=[], **kwargs):
    """pass"""
    all_summary = []
    for module in list_all:
        summary = {'module_name': module['Name'], 'show_all': kwargs.get('show_all', True), 'project_name': kwargs.get('proj_name', 'TestProject'), 'home_page': kwargs.get('home_page', __about__.HOME_PAGE), 'start_time': '', 'end_time': '', 'duration_seconds': '', 'total_case_num': len(module['TestCases']), 'pass_cases_num': 0, 'fail_cases_num': 0, 'details': []}
        for case in module['TestCases']:
            case_detail = {}
            case_detail['linkurl'] = './caselogs/%s_%s.log' % (case['case_name'], case['exec_date'])
            if case['status'].lower() == 'pass':
                summary['pass_cases_num'] += 1
                case_detail['c_style'] = 'tr_pass'
            else:
                summary['fail_cases_num'] += 1
                case_detail['c_style'] = 'tr_fail'
            case_detail.update(case)
            summary['details'].append(case_detail)
        try:
            st = module['TestCases'][0].get('start_at')
            et = module['TestCases'][-1].get('end_at')
            summary['start_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(st))
            summary['end_time'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(et))
            summary['duration_seconds'] = float('%.2f' % (et - st))
        except Exception as _:
            logger.log_warning("Will set 'start_at' and 'end_at' to 'None'")
            summary['start_time'], summary['end_time'], summary['duration_seconds'] = (None, None, None)
        if summary['fail_cases_num'] > 0:
            summary['dict_report'] = {'result': 0, 'message': 'failure', 'pass': summary['pass_cases_num'], 'fail': summary['fail_cases_num']}
        else:
            summary['dict_report'] = {'result': 1, 'message': 'success', 'pass': summary['pass_cases_num'], 'fail': summary['fail_cases_num']}
        all_summary.append(summary)
    return all_summary


Input:
CODE <module>()
  DOC 'TestModule'
  RESUME 0
  BUILD_LIST 0
  LOAD_CONST 'TestModule'
  BUILD_TUPLE 2
  LOAD_CONST <code add_report_data>
  MAKE_FUNCTION defaults
  STORE_NAME add_report_data
  RETURN_CONST None
END
CODE add_report_data(list_all, module_name, **kwargs)
  DOC 'pass'
  RESUME 0
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'start_at'
  CALL 1
  STORE_FAST start_at
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'case_name'
  LOAD_CONST 'TestCase'
  CALL 2
  STORE_FAST case_name
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'raw_case_name'
  LOAD_CONST 'TestCase'
  CALL 2
  STORE_FAST raw_case_name
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + localtime
  LOAD_FAST start_at
  CALL 1
  STORE_FAST exec_date_time
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + strftime
  LOAD_CONST '%Y-%m-%d'
  LOAD_FAST exec_date_time
  CALL 2
  STORE_FAST execdate
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + strftime
  LOAD_CONST '%H:%M:%S'
  LOAD_FAST exec_date_time
  CALL 2
  STORE_FAST exectime
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'resp_tester'
  LOAD_CONST 'administrator'
  CALL 2
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'tester'
  LOAD_CONST 'administrator'
  CALL 2
  LOAD_FAST case_name
  LOAD_FAST raw_case_name
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'status'
  LOAD_CONST 'Pass'
  CALL 2
  LOAD_FAST execdate
  LOAD_FAST exectime
  LOAD_FAST start_at
  LOAD_FAST kwargs
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'end_at'
  CALL 1
  LOAD_CONST ('resp_tester', 'tester', 'case_name', 'raw_case_name', 'status', 'exec_date', 'exec_time', 'start_at', 'end_at')
  BUILD_CONST_KEY_MAP 9
  STORE_FAST _case_report
  LOAD_FAST list_all
  GET_ITER
L1:
  FOR_ITER L6
  STORE_FAST module
  LOAD_FAST module_name
  LOAD_FAST module
  LOAD_CONST 'Name'
  BINARY_SUBSCR
  COMPARE_OP !=
  POP_JUMP_IF_FALSE L2
  JUMP_BACKWARD L1
L2:
  LOAD_FAST module
  LOAD_CONST 'TestCases'
  BINARY_SUBSCR
  GET_ITER
L3:
  FOR_ITER L5
  STORE_FAST case
  LOAD_FAST raw_case_name
  LOAD_FAST case
  LOAD_CONST 'raw_case_name'
  BINARY_SUBSCR
  COMPARE_OP ==
  POP_JUMP_IF_TRUE L4
  JUMP_BACKWARD L3
L4:
  LOAD_FAST case
  LOAD_ATTR NULL|self + update
  LOAD_FAST _case_report
  CALL 1
  POP_TOP
  LOAD_FAST list_all
  SWAP 2
  POP_TOP
  SWAP 2
  POP_TOP
  RETURN_VALUE
L5:
  END_FOR
  LOAD_FAST module
  LOAD_CONST 'TestCases'
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + append
  LOAD_FAST _case_report
  CALL 1
  POP_TOP
  LOAD_FAST list_all
  SWAP 2
  POP_TOP
  RETURN_VALUE
L6:
  END_FOR
  LOAD_FAST list_all
  LOAD_ATTR NULL|self + append
  LOAD_FAST module_name
  LOAD_FAST _case_report
  BUILD_LIST 1
  LOAD_CONST ('Name', 'TestCases')
  BUILD_CONST_KEY_MAP 2
  CALL 1
  POP_TOP
  LOAD_FAST list_all
  RETURN_VALUE
END

def add_report_data(list_all=[], module_name='TestModule', **kwargs):
    """pass"""
    start_at = kwargs.get('start_at')
    case_name = kwargs.get('case_name', 'TestCase')
    raw_case_name = kwargs.get('raw_case_name', 'TestCase')
    exec_date_time = time.localtime(start_at)
    execdate = time.strftime('%Y-%m-%d', exec_date_time)
    exectime = time.strftime('%H:%M:%S', exec_date_time)
    _case_report = {'resp_tester': kwargs.get('resp_tester', 'administrator'), 'tester': kwargs.get('tester', 'administrator'), 'case_name': case_name, 'raw_case_name': raw_case_name, 'status': kwargs.get('status', 'Pass'), 'exec_date': execdate, 'exec_time': exectime, 'start_at': start_at, 'end_at': kwargs.get('end_at')}
    for module in list_all:
        if module_name != module['Name']:
            continue
        for case in module['TestCases']:
            if raw_case_name == case['raw_case_name']:
                case.update(_case_report)
                return list_all
        module['TestCases'].append(_case_report)
        return list_all
    list_all.append({'Name': module_name, 'TestCases': [_case_report]})
    return list_all


Input:
CODE <module>()
  DOC 'DEFAULT'
  RESUME 0
  LOAD_CONST ('DEFAULT',)
  LOAD_CONST <code get_webpack>
  MAKE_FUNCTION defaults
  STORE_NAME get_webpack
  RETURN_CONST None
END
CODE get_webpack(request, name)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + hasattr
  LOAD_FAST request
  LOAD_CONST '_webpack_map'
  CALL 2
  POP_JUMP_IF_TRUE L1
  BUILD_MAP 0
  LOAD_FAST request
  STORE_ATTR _webpack_map
L1:
  LOAD_FAST request
  LOAD_ATTR _webpack_map
  LOAD_ATTR NULL|self + get
  LOAD_FAST name
  CALL 1
  STORE_FAST wp
  LOAD_FAST wp
  POP_JUMP_IF_NOT_NONE L2
  LOAD_GLOBAL NULL + Webpack
  LOAD_FAST request
  LOAD_FAST name
  CALL 2
  COPY 1
  STORE_FAST wp
  LOAD_FAST request
  LOAD_ATTR _webpack_map
  LOAD_FAST name
  STORE_SUBSCR
L2:
  LOAD_FAST wp
  RETURN_VALUE
END

def get_webpack(request, name='DEFAULT'):
    """pass"""
    if not hasattr(request, '_webpack_map'):
        request._webpack_map = {}
    wp = request._webpack_map.get(name)
    if wp is None:
        wp = request._webpack_map[name] = Webpack(request, name)
    return wp


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code includeme>
  MAKE_FUNCTION 0
  STORE_NAME includeme
  RETURN_CONST None
END
CODE includeme(config)
  DOC 'pass'
  RESUME 0
  LOAD_FAST config
  LOAD_ATTR registry
  LOAD_ATTR settings
  STORE_FAST settings
  LOAD_FAST config
  LOAD_ATTR root_package
  LOAD_ATTR __name__
  STORE_FAST root_package_name
  LOAD_CONST 'DEFAULT'
  LOAD_GLOBAL NULL + WebpackState
  LOAD_FAST settings
  LOAD_FAST root_package_name
  CALL 2
  BUILD_MAP 1
  LOAD_FAST config
  LOAD_ATTR registry
  STORE_ATTR webpack
  LOAD_GLOBAL NULL + aslist
  LOAD_FAST settings
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'webpack.configs'
  BUILD_LIST 0
  CALL 2
  CALL 1
  GET_ITER
L1:
  FOR_ITER L2
  STORE_FAST extra_config
  LOAD_GLOBAL NULL + WebpackState
  LOAD_FAST settings
  LOAD_FAST root_package_name
  LOAD_FAST extra_config
  KW_NAMES ('name',)
  CALL 3
  STORE_FAST state
  LOAD_FAST state
  LOAD_FAST config
  LOAD_ATTR registry
  LOAD_ATTR webpack
  LOAD_FAST extra_config
  STORE_SUBSCR
  JUMP_BACKWARD L1
L2:
  END_FOR
  LOAD_GLOBAL six
  LOAD_ATTR NULL|self + itervalues
  LOAD_FAST config
  LOAD_ATTR registry
  LOAD_ATTR webpack
  CALL 1
  GET_ITER
L3:
  FOR_ITER L5
  STORE_FAST state
  LOAD_FAST state
  LOAD_ATTR static_view
  POP_JUMP_IF_TRUE L4
  JUMP_BACKWARD L3
L4:
  LOAD_FAST config
  LOAD_ATTR NULL|self + add_static_view
  LOAD_FAST state
  LOAD_ATTR static_view_name
  LOAD_FAST state
  LOAD_ATTR static_view_path
  LOAD_FAST state
  LOAD_ATTR cache_max_age
  KW_NAMES ('name', 'path', 'cache_max_age')
  CALL 3
  POP_TOP
  JUMP_BACKWARD L3
L5:
  END_FOR
  LOAD_FAST config
  LOAD_ATTR NULL|self + add_request_method
  LOAD_GLOBAL get_webpack
  LOAD_CONST 'webpack'
  CALL 2
  POP_TOP
  RETURN_CONST None
END

def includeme(config):
    """pass"""
    settings = config.registry.settings
    root_package_name = config.root_package.__name__
    config.registry.webpack = {'DEFAULT': WebpackState(settings, root_package_name)}
    for extra_config in aslist(settings.get('webpack.configs', [])):
        state = WebpackState(settings, root_package_name, name=extra_config)
        config.registry.webpack[extra_config] = state
    for state in six.itervalues(config.registry.webpack):
        if state.static_view:
            config.add_static_view(name=state.static_view_name, path=state.static_view_path, cache_max_age=state.cache_max_age)
    config.add_request_method(get_webpack, 'webpack')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, None, True)
  LOAD_CONST <code _get_setting>
  MAKE_FUNCTION defaults
  STORE_NAME _get_setting
  RETURN_CONST None
END
CODE _get_setting(self, setting, default, name, inherit)
  DOC 'pass'
  RESUME 0
  LOAD_FAST name
  POP_JUMP_IF_NOT_NONE L1
  LOAD_FAST self
  LOAD_ATTR name
  STORE_FAST name
L1:
  LOAD_FAST name
  LOAD_CONST 'DEFAULT'
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L2
  LOAD_FAST self
  LOAD_ATTR _settings
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'webpack.{0}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST setting
  CALL 1
  LOAD_FAST default
  CALL 2
  RETURN_VALUE
L2:
  LOAD_FAST self
  LOAD_ATTR _settings
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'webpack.{0}.{1}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST name
  LOAD_FAST setting
  CALL 2
  LOAD_GLOBAL SENTINEL
  CALL 2
  STORE_FAST val
  LOAD_FAST val
  LOAD_GLOBAL SENTINEL
  IS_OP 0
  POP_JUMP_IF_FALSE L4
  LOAD_FAST inherit
  POP_JUMP_IF_FALSE L3
  LOAD_FAST self
  LOAD_ATTR NULL|self + _get_setting
  LOAD_FAST setting
  LOAD_FAST default
  LOAD_CONST 'DEFAULT'
  CALL 3
  RETURN_VALUE
L3:
  LOAD_FAST default
  RETURN_VALUE
L4:
  LOAD_FAST val
  RETURN_VALUE
END

def _get_setting(self, setting, default=None, name=None, inherit=True):
    """pass"""
    if name is None:
        name = self.name
    if name == 'DEFAULT':
        return self._settings.get('webpack.{0}'.format(setting), default)
    else:
        val = self._settings.get('webpack.{0}.{1}'.format(name, setting), SENTINEL)
        if val is SENTINEL:
            if inherit:
                return self._get_setting(setting, default, 'DEFAULT')
            else:
                return default
        else:
            return val


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, None)
  LOAD_CONST <code load_stats>
  MAKE_FUNCTION defaults
  STORE_NAME load_stats
  RETURN_CONST None
END
CODE load_stats(self, cache, wait)
  DOC 'pass'
  RESUME 0
  LOAD_FAST cache
  POP_JUMP_IF_NOT_NONE L1
  LOAD_FAST self
  LOAD_ATTR debug
  UNARY_NOT
  STORE_FAST cache
L1:
  LOAD_FAST wait
  POP_JUMP_IF_NOT_NONE L2
  LOAD_FAST self
  LOAD_ATTR debug
  STORE_FAST wait
L2:
  LOAD_FAST cache
  POP_JUMP_IF_FALSE L3
  LOAD_FAST self
  LOAD_ATTR _stats
  POP_JUMP_IF_NOT_NONE L6
L3:
  LOAD_FAST self
  LOAD_ATTR NULL|self + _load_stats
  CALL 0
  LOAD_FAST self
  STORE_ATTR _stats
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + time
  CALL 0
  STORE_FAST start
  LOAD_FAST wait
  POP_JUMP_IF_FALSE L6
  LOAD_FAST self
  LOAD_ATTR _stats
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'status'
  CALL 1
  LOAD_CONST 'compiling'
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L6
L4:
  LOAD_FAST self
  LOAD_ATTR timeout
  POP_JUMP_IF_FALSE L5
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + time
  CALL 0
  LOAD_FAST start
  BINARY_OP -
  LOAD_FAST self
  LOAD_ATTR timeout
  COMPARE_OP >
  POP_JUMP_IF_FALSE L5
  LOAD_GLOBAL NULL + RuntimeError
  LOAD_CONST 'Webpack {0!r} timed out while compiling'
  LOAD_ATTR NULL|self + format
  LOAD_FAST self
  LOAD_ATTR stats_file
  LOAD_ATTR path
  CALL 1
  CALL 1
  RAISE_VARARGS 1
L5:
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + sleep
  LOAD_CONST 0.1
  CALL 1
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR NULL|self + _load_stats
  CALL 0
  LOAD_FAST self
  STORE_ATTR _stats
  LOAD_FAST wait
  POP_JUMP_IF_FALSE L6
  LOAD_FAST self
  LOAD_ATTR _stats
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'status'
  CALL 1
  LOAD_CONST 'compiling'
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L6
  JUMP_BACKWARD L4
L6:
  LOAD_FAST self
  LOAD_ATTR _stats
  RETURN_VALUE
END

def load_stats(self, cache=None, wait=None):
    """pass"""
    if cache is None:
        cache = not self.debug
    if wait is None:
        wait = self.debug
    if not cache or self._stats is None:
        self._stats = self._load_stats()
        start = time.time()
        while wait and self._stats.get('status') == 'compiling':
            if self.timeout and time.time() - start > self.timeout:
                raise RuntimeError('Webpack {0!r} timed out while compiling'.format(self.stats_file.path))
            time.sleep(0.1)
            self._stats = self._load_stats()
    return self._stats


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _load_stats>
  MAKE_FUNCTION 0
  STORE_NAME _load_stats
  RETURN_CONST None
END
CODE _load_stats(self)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + range
  LOAD_CONST 0
  LOAD_CONST 3
  CALL 2
  GET_ITER
L1:
  FOR_ITER L6
  STORE_FAST attempt
  NOP
L2:
  LOAD_FAST self
  LOAD_ATTR stats_file
  LOAD_ATTR NULL|self + open
  CALL 0
  BEFORE_WITH
L3:
  STORE_FAST f
  LOAD_GLOBAL json
  LOAD_ATTR NULL|self + load
  LOAD_FAST f
  CALL 1
L4:
  SWAP 2
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
L5:
  SWAP 2
  POP_TOP
  RETURN_VALUE
L6:
  END_FOR
  RETURN_CONST None
L7:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L8
  RERAISE 2
L8:
  POP_TOP
L9:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  JUMP_FORWARD L11
L10:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L11:
  JUMP_BACKWARD L1
L12:
  PUSH_EXC_INFO
  LOAD_GLOBAL ValueError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L15
  POP_TOP
  LOAD_FAST attempt
  LOAD_CONST 2
  COMPARE_OP <
  POP_JUMP_IF_FALSE L13
  LOAD_GLOBAL time
  LOAD_ATTR NULL|self + sleep
  LOAD_FAST attempt
  LOAD_CONST 0.2
  BINARY_OP *
  CALL 1
  POP_TOP
  JUMP_FORWARD L14
L13:
  RAISE_VARARGS 0
L14:
  POP_EXCEPT
  JUMP_BACKWARD L1
L15:
  LOAD_GLOBAL IOError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L16
  POP_TOP
  LOAD_GLOBAL NULL + IOError
  LOAD_CONST 'Could not read stats file {0}. Make sure you are using the webpack-bundle-tracker plugin'
  LOAD_ATTR NULL|self + format
  LOAD_FAST self
  LOAD_ATTR stats_file
  CALL 1
  CALL 1
  RAISE_VARARGS 1
L16:
  RERAISE 0
L17:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L2..L3 -> handler=L12 depth=1 lasti=False
  EXC try=L3..L4 -> handler=L7 depth=2 lasti=True
  EXC try=L4..L5 -> handler=L12 depth=1 lasti=False
  EXC try=L7..L9 -> handler=L10 depth=4 lasti=True
  EXC try=L9..L11 -> handler=L12 depth=1 lasti=False
  EXC try=L12..L14 -> handler=L17 depth=2 lasti=True
  EXC try=L15..L17 -> handler=L17 depth=2 lasti=True
END

def _load_stats(self):
    """pass"""
    for attempt in range(0, 3):
        try:
            with self.stats_file.open() as f:
                return json.load(f)
        except ValueError:
            if attempt < 2:
                time.sleep(attempt * 0.2)
            else:
                raise
        except IOError:
            raise IOError('Could not read stats file {0}. Make sure you are using the webpack-bundle-tracker plugin'.format(self.stats_file))


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _chunk_filter>
  MAKE_FUNCTION 0
  STORE_NAME _chunk_filter
  RETURN_CONST None
END
CODE _chunk_filter(self, extensions)
  DOC 'pass'
  MAKE_CELL self
  MAKE_CELL extensions
  RESUME 0
  LOAD_GLOBAL NULL + isinstance
  LOAD_DEREF extensions
  LOAD_GLOBAL six
  LOAD_ATTR string_types
  CALL 2
  POP_JUMP_IF_FALSE L1
  LOAD_DEREF extensions
  LOAD_ATTR NULL|self + split
  CALL 0
  STORE_DEREF extensions
L1:
  LOAD_CLOSURE extensions
  LOAD_CLOSURE self
  BUILD_TUPLE 2
  LOAD_CONST <code _chunk_filter.<locals>._filter>
  MAKE_FUNCTION closure
  STORE_FAST _filter
  LOAD_FAST _filter
  RETURN_VALUE
END
CODE _chunk_filter.<locals>._filter(chunk)
  DOC 'pass'
  COPY_FREE_VARS 2
  MAKE_CELL name
  RESUME 0
  LOAD_FAST chunk
  LOAD_CONST 'name'
  BINARY_SUBSCR
  STORE_DEREF name
  LOAD_DEREF extensions
  POP_JUMP_IF_NONE L1
  LOAD_GLOBAL NULL + any
  LOAD_CLOSURE name
  BUILD_TUPLE 1
  LOAD_CONST <code _chunk_filter.<locals>._filter.<locals>.<genexpr>>
  MAKE_FUNCTION closure
  LOAD_DEREF extensions
  GET_ITER
  CALL 0
  CALL 1
  POP_JUMP_IF_TRUE L1
  RETURN_CONST False
L1:
  LOAD_DEREF self
  LOAD_ATTR state
  LOAD_ATTR ignore_re
  GET_ITER
L2:
  FOR_ITER L4
  STORE_FAST pattern
  LOAD_FAST pattern
  LOAD_ATTR NULL|self + match
  LOAD_DEREF name
  CALL 1
  POP_JUMP_IF_TRUE L3
  JUMP_BACKWARD L2
L3:
  POP_TOP
  RETURN_CONST False
L4:
  END_FOR
  LOAD_DEREF self
  LOAD_ATTR state
  LOAD_ATTR ignore
  GET_ITER
L5:
  FOR_ITER L7
  STORE_FAST pattern
  LOAD_GLOBAL fnmatch
  LOAD_ATTR NULL|self + fnmatchcase
  LOAD_DEREF name
  LOAD_FAST pattern
  CALL 2
  POP_JUMP_IF_TRUE L6
  JUMP_BACKWARD L5
L6:
  POP_TOP
  RETURN_CONST False
L7:
  END_FOR
  RETURN_CONST True
END
CODE _chunk_filter.<locals>._filter.<locals>.<genexpr>(.0)
  COPY_FREE_VARS 1
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_FAST .0
L2:
  FOR_ITER L3
  STORE_FAST e
  LOAD_DEREF name
  LOAD_ATTR NULL|self + endswith
  LOAD_FAST e
  CALL 1
  YIELD_VALUE 1
  RESUME 1
  POP_TOP
  JUMP_BACKWARD L2
L3:
  END_FOR
  RETURN_CONST None
L4:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L4 -> handler=L4 depth=0 lasti=True
END

def _chunk_filter(self, extensions):
    """pass"""
    if isinstance(extensions, six.string_types):
        extensions = extensions.split()

    def _filter(chunk):
        """pass"""
        name = chunk['name']
        if extensions is not None:
            if not any((name.endswith(e) for e in extensions)):
                return False
        for pattern in self.state.ignore_re:
            if pattern.match(name):
                return False
        for pattern in self.state.ignore:
            if fnmatch.fnmatchcase(name, pattern):
                return False
        return True
    return _filter


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _unique_names>
  MAKE_FUNCTION 0
  STORE_NAME _unique_names
  RETURN_CONST None
END
CODE _unique_names()
  DOC 'pass'
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_CONST 'abcdefghijklmnopqrstuvwxyz0123456789'
  STORE_FAST characters
  LOAD_GLOBAL NULL + irange
  LOAD_GLOBAL NULL + len
  LOAD_FAST characters
  CALL 1
  CALL 1
  GET_ITER
  LOAD_FAST_AND_CLEAR i
  SWAP 2
L2:
  BUILD_LIST 0
  SWAP 2
L3:
  FOR_ITER L4
  STORE_FAST i
  LOAD_FAST characters
  LOAD_FAST i
  LOAD_FAST i
  LOAD_CONST 1
  BINARY_OP +
  BINARY_SLICE
  LIST_APPEND 2
  JUMP_BACKWARD L3
L4:
  END_FOR
L5:
  STORE_FAST characters
  STORE_FAST i
  LOAD_GLOBAL random
  LOAD_ATTR NULL|self + Random
  CALL 0
  STORE_FAST rng
  NOP
L6:
  LOAD_GLOBAL NULL + irange
  LOAD_CONST 10
  CALL 1
  GET_ITER
  LOAD_FAST_AND_CLEAR i
  SWAP 2
L7:
  BUILD_LIST 0
  SWAP 2
L8:
  FOR_ITER L9
  STORE_FAST i
  LOAD_FAST rng
  LOAD_ATTR NULL|self + choice
  LOAD_FAST characters
  CALL 1
  LIST_APPEND 2
  JUMP_BACKWARD L8
L9:
  END_FOR
L10:
  STORE_FAST letters
  STORE_FAST i
  LOAD_CONST ''
  LOAD_ATTR NULL|self + join
  LOAD_FAST letters
  CALL 1
  YIELD_VALUE 1
  RESUME 1
  POP_TOP
  JUMP_BACKWARD L6
L11:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST i
  RERAISE 0
L12:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST i
  RERAISE 0
L13:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L2 -> handler=L13 depth=0 lasti=True
  EXC try=L2..L5 -> handler=L11 depth=2 lasti=False
  EXC try=L5..L7 -> handler=L13 depth=0 lasti=True
  EXC try=L7..L10 -> handler=L12 depth=2 lasti=False
  EXC try=L10..L13 -> handler=L13 depth=0 lasti=True
END

def _unique_names():
    """pass"""
    characters = 'abcdefghijklmnopqrstuvwxyz0123456789'
    characters = [characters[i:i + 1] for i in irange(len(characters))]
    rng = random.Random()
    while True:
        letters = [rng.choice(characters) for i in irange(10)]
        yield ''.join(letters)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code escape_queue>
  MAKE_FUNCTION 0
  STORE_NAME escape_queue
  RETURN_CONST None
END
CODE escape_queue(s)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST s
  LOAD_GLOBAL PosixPath
  CALL 2
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + unicode_
  LOAD_FAST s
  CALL 1
  STORE_FAST s
  JUMP_FORWARD L2
L1:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST s
  LOAD_GLOBAL bytes
  CALL 2
  POP_JUMP_IF_FALSE L2
  LOAD_FAST s
  LOAD_ATTR NULL|self + decode
  LOAD_CONST 'utf-8'
  CALL 1
  STORE_FAST s
L2:
  LOAD_FAST s
  LOAD_ATTR NULL|self + startswith
  LOAD_CONST '~/'
  CALL 1
  POP_JUMP_IF_FALSE L3
  LOAD_CONST '~/'
  LOAD_GLOBAL NULL + shell_escape
  LOAD_FAST s
  LOAD_CONST 2
  LOAD_CONST None
  BINARY_SLICE
  CALL 1
  BINARY_OP +
  RETURN_VALUE
L3:
  LOAD_GLOBAL NULL + shell_escape
  LOAD_FAST s
  CALL 1
  RETURN_VALUE
END

def escape_queue(s):
    """pass"""
    if isinstance(s, PosixPath):
        s = unicode_(s)
    elif isinstance(s, bytes):
        s = s.decode('utf-8')
    if s.startswith('~/'):
        return '~/' + shell_escape(s[2:])
    else:
        return shell_escape(s)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code parse_ssh_destination>
  MAKE_FUNCTION 0
  STORE_NAME parse_ssh_destination
  RETURN_CONST None
END
CODE parse_ssh_destination(destination)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL _re_ssh
  LOAD_ATTR NULL|self + match
  LOAD_FAST destination
  CALL 1
  STORE_FAST match
  LOAD_FAST match
  POP_JUMP_IF_TRUE L1
  LOAD_GLOBAL NULL + InvalidDestination
  LOAD_CONST 'Invalid destination: %s'
  LOAD_FAST destination
  BINARY_OP %
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_FAST match
  LOAD_ATTR NULL|self + groups
  CALL 0
  UNPACK_SEQUENCE 4
  STORE_FAST user
  STORE_FAST password
  STORE_FAST host
  STORE_FAST port
  BUILD_MAP 0
  STORE_FAST info
  LOAD_FAST user
  POP_JUMP_IF_FALSE L2
  LOAD_FAST user
  LOAD_FAST info
  LOAD_CONST 'username'
  STORE_SUBSCR
  JUMP_FORWARD L3
L2:
  LOAD_GLOBAL getpass
  LOAD_ATTR NULL|self + getuser
  CALL 0
  LOAD_FAST info
  LOAD_CONST 'username'
  STORE_SUBSCR
L3:
  LOAD_FAST password
  POP_JUMP_IF_FALSE L4
  LOAD_FAST password
  LOAD_FAST info
  LOAD_CONST 'password'
  STORE_SUBSCR
L4:
  LOAD_FAST port
  POP_JUMP_IF_FALSE L5
  LOAD_GLOBAL NULL + int
  LOAD_FAST port
  CALL 1
  LOAD_FAST info
  LOAD_CONST 'port'
  STORE_SUBSCR
L5:
  LOAD_FAST host
  LOAD_FAST info
  LOAD_CONST 'hostname'
  STORE_SUBSCR
  LOAD_FAST info
  RETURN_VALUE
END

def parse_ssh_destination(destination):
    """pass"""
    match = _re_ssh.match(destination)
    if not match:
        raise InvalidDestination('Invalid destination: %s' % destination)
    user, password, host, port = match.groups()
    info = {}
    if user:
        info['username'] = user
    else:
        info['username'] = getpass.getuser()
    if password:
        info['password'] = password
    if port:
        info['port'] = int(port)
    info['hostname'] = host
    return info


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _ssh_client>
  MAKE_FUNCTION 0
  STORE_NAME _ssh_client
  RETURN_CONST None
END
CODE _ssh_client(self)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL paramiko
  LOAD_ATTR NULL|self + SSHClient
  CALL 0
  STORE_FAST ssh
  LOAD_FAST ssh
  LOAD_ATTR NULL|self + load_system_host_keys
  CALL 0
  POP_TOP
  LOAD_FAST ssh
  LOAD_ATTR NULL|self + set_missing_host_key_policy
  LOAD_GLOBAL paramiko
  LOAD_ATTR NULL|self + RejectPolicy
  CALL 0
  CALL 1
  POP_TOP
  LOAD_FAST ssh
  RETURN_VALUE
END

def _ssh_client(self):
    """pass"""
    ssh = paramiko.SSHClient()
    ssh.load_system_host_keys()
    ssh.set_missing_host_key_policy(paramiko.RejectPolicy())
    return ssh


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _connect>
  MAKE_FUNCTION 0
  STORE_NAME _connect
  RETURN_CONST None
END
CODE _connect(self)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR NULL|self + _ssh_client
  CALL 0
  STORE_FAST ssh
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + debug
  LOAD_CONST 'Connecting with %s'
  LOAD_CONST ', '
  LOAD_ATTR NULL|self + join
  LOAD_CONST <code _connect.<locals>.<genexpr>>
  MAKE_FUNCTION 0
  LOAD_GLOBAL NULL + iteritems
  LOAD_FAST self
  LOAD_ATTR destination
  CALL 1
  GET_ITER
  CALL 0
  CALL 1
  CALL 2
  POP_TOP
  PUSH_NULL
  LOAD_FAST ssh
  LOAD_ATTR connect
  LOAD_CONST ()
  BUILD_MAP 0
  LOAD_FAST self
  LOAD_ATTR destination
  DICT_MERGE 1
  CALL_FUNCTION_EX 1
  POP_TOP
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + debug
  LOAD_CONST 'Connected to %s'
  LOAD_FAST self
  LOAD_ATTR destination
  LOAD_CONST 'hostname'
  BINARY_SUBSCR
  CALL 2
  POP_TOP
  LOAD_FAST ssh
  LOAD_FAST self
  STORE_ATTR _ssh
  RETURN_CONST None
END
CODE _connect.<locals>.<genexpr>(.0)
  DOC '='
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_FAST .0
L2:
  FOR_ITER L5
  UNPACK_SEQUENCE 2
  STORE_FAST k
  STORE_FAST v
  LOAD_FAST k
  FORMAT_VALUE str
  LOAD_CONST '='
  LOAD_FAST k
  LOAD_CONST 'password'
  COMPARE_OP !=
  POP_JUMP_IF_FALSE L3
  LOAD_FAST v
  JUMP_FORWARD L4
L3:
  LOAD_CONST '***'
L4:
  FORMAT_VALUE repr
  BUILD_STRING 3
  YIELD_VALUE 1
  RESUME 1
  POP_TOP
  JUMP_BACKWARD L2
L5:
  END_FOR
  RETURN_CONST None
L6:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L6 -> handler=L6 depth=0 lasti=True
END

def _connect(self):
    """pass"""
    ssh = self._ssh_client()
    logger.debug('Connecting with %s', ', '.join(('%s=%r' % (k, v if k != 'password' else '***') for k, v in iteritems(self.destination))))
    ssh.connect(**self.destination)
    logger.debug('Connected to %s', self.destination['hostname'])
    self._ssh = ssh


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code get_client>
  MAKE_FUNCTION 0
  STORE_NAME get_client
  RETURN_CONST None
END
CODE get_client(self)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR _ssh
  POP_JUMP_IF_NOT_NONE L1
  LOAD_FAST self
  LOAD_ATTR NULL|self + _connect
  CALL 0
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR _ssh
  RETURN_VALUE
L1:
  NOP
L2:
  LOAD_FAST self
  LOAD_ATTR _ssh
  LOAD_ATTR NULL|self + get_transport
  CALL 0
  LOAD_ATTR NULL|self + open_session
  CALL 0
  STORE_FAST chan
L3:
  LOAD_FAST chan
  LOAD_ATTR NULL|self + close
  CALL 0
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR _ssh
  RETURN_VALUE
L4:
  PUSH_EXC_INFO
  LOAD_GLOBAL socket
  LOAD_ATTR error
  LOAD_GLOBAL paramiko
  LOAD_ATTR SSHException
  BUILD_TUPLE 2
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L6
  POP_TOP
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + warning
  LOAD_CONST 'Lost connection, reconnecting...'
  CALL 1
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR _ssh
  LOAD_ATTR NULL|self + close
  CALL 0
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR NULL|self + _connect
  CALL 0
  POP_TOP
L5:
  POP_EXCEPT
  LOAD_FAST self
  LOAD_ATTR _ssh
  RETURN_VALUE
L6:
  RERAISE 0
L7:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L2..L3 -> handler=L4 depth=0 lasti=False
  EXC try=L4..L5 -> handler=L7 depth=1 lasti=True
  EXC try=L6..L7 -> handler=L7 depth=1 lasti=True
END

def get_client(self):
    """pass"""
    if self._ssh is None:
        self._connect()
        return self._ssh
    else:
        try:
            chan = self._ssh.get_transport().open_session()
        except (socket.error, paramiko.SSHException):
            logger.warning('Lost connection, reconnecting...')
            self._ssh.close()
            self._connect()
        else:
            chan.close()
        return self._ssh


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code activate>
  MAKE_FUNCTION 0
  STORE_NAME activate
  RETURN_CONST None
END
CODE activate(lancet, method, project)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + taskstatus
  LOAD_CONST 'Looking up project'
  CALL 1
  BEFORE_WITH
L1:
  STORE_FAST ts
  LOAD_FAST method
  LOAD_CONST 'key'
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L2
  LOAD_GLOBAL get_project_keys
  STORE_FAST func
  JUMP_FORWARD L3
L2:
  LOAD_FAST method
  LOAD_CONST 'dir'
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L3
  LOAD_GLOBAL get_project_keys
  STORE_FAST func
L3:
  PUSH_NULL
  LOAD_FAST_CHECK func
  LOAD_FAST lancet
  CALL 1
  GET_ITER
L4:
  FOR_ITER L7
  UNPACK_SEQUENCE 2
  STORE_FAST key
  STORE_FAST project_path
  LOAD_FAST key
  LOAD_ATTR NULL|self + lower
  CALL 0
  LOAD_FAST project
  LOAD_ATTR NULL|self + lower
  CALL 0
  COMPARE_OP ==
  POP_JUMP_IF_TRUE L6
L5:
  JUMP_BACKWARD L4
L6:
  POP_TOP
  JUMP_FORWARD L8
L7:
  END_FOR
  LOAD_FAST ts
  LOAD_ATTR NULL|self + abort
  LOAD_CONST 'Project "{}" not found (using {}-based lookup)'
  LOAD_FAST project
  LOAD_FAST method
  CALL 3
  POP_TOP
L8:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
L9:
  LOAD_GLOBAL NULL + load_config
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST_CHECK project_path
  LOAD_GLOBAL LOCAL_CONFIG
  CALL 2
  CALL 1
  STORE_FAST config
  LOAD_FAST lancet
  LOAD_ATTR NULL|self + defer_to_shell
  LOAD_CONST 'cd'
  LOAD_FAST project_path
  CALL 2
  POP_TOP
  LOAD_FAST config
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'lancet'
  LOAD_CONST 'virtualenv'
  LOAD_CONST None
  KW_NAMES ('fallback',)
  CALL 3
  STORE_FAST venv
  LOAD_FAST venv
  POP_JUMP_IF_FALSE L10
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST project_path
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + expanduser
  LOAD_FAST venv
  CALL 1
  CALL 2
  STORE_FAST venv_path
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST venv_path
  LOAD_CONST 'bin'
  LOAD_CONST 'activate'
  CALL 3
  STORE_FAST activate_script
  LOAD_FAST lancet
  LOAD_ATTR NULL|self + defer_to_shell
  LOAD_CONST 'source'
  LOAD_FAST activate_script
  CALL 2
  POP_TOP
  RETURN_CONST None
L10:
  LOAD_CONST 'VIRTUAL_ENV'
  LOAD_GLOBAL os
  LOAD_ATTR environ
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L11
  LOAD_FAST lancet
  LOAD_ATTR NULL|self + defer_to_shell
  LOAD_CONST 'deactivate'
  CALL 1
  POP_TOP
  RETURN_CONST None
L11:
  RETURN_CONST None
L12:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L13
  RERAISE 2
L13:
  POP_TOP
L14:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  JUMP_BACKWARD L9
L15:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L5 -> handler=L12 depth=1 lasti=True
  EXC try=L6..L8 -> handler=L12 depth=1 lasti=True
  EXC try=L12..L14 -> handler=L15 depth=3 lasti=True
END

def activate(lancet, method, project):
    """pass"""
    with taskstatus('Looking up project') as ts:
        if method == 'key':
            func = get_project_keys
        elif method == 'dir':
            func = get_project_keys
        for key, project_path in func(lancet):
            if key.lower() == project.lower():
                break
        else:
            ts.abort('Project "{}" not found (using {}-based lookup)', project, method)
    config = load_config(os.path.join(project_path, LOCAL_CONFIG))
    lancet.defer_to_shell('cd', project_path)
    venv = config.get('lancet', 'virtualenv', fallback=None)
    if venv:
        venv_path = os.path.join(project_path, os.path.expanduser(venv))
        activate_script = os.path.join(venv_path, 'bin', 'activate')
        lancet.defer_to_shell('source', activate_script)
    elif 'VIRTUAL_ENV' in os.environ:
        lancet.defer_to_shell('deactivate')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code workon>
  MAKE_FUNCTION 0
  STORE_NAME workon
  RETURN_CONST None
END
CODE workon(ctx, issue_id, new, base_branch)
  DOC 'pass'
  RESUME 0
  LOAD_FAST ctx
  LOAD_ATTR obj
  STORE_FAST lancet
  LOAD_FAST issue_id
  POP_JUMP_IF_TRUE L1
  LOAD_FAST new
  POP_JUMP_IF_TRUE L1
  LOAD_GLOBAL click
  LOAD_ATTR NULL|self + UsageError
  LOAD_CONST 'Provide either an issue ID or the --new flag.'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_FAST issue_id
  POP_JUMP_IF_FALSE L2
  LOAD_FAST new
  POP_JUMP_IF_FALSE L2
  LOAD_GLOBAL click
  LOAD_ATTR NULL|self + UsageError
  LOAD_CONST 'Provide either an issue ID or the --new flag, but not both.'
  CALL 1
  RAISE_VARARGS 1
L2:
  LOAD_FAST new
  POP_JUMP_IF_FALSE L3
  LOAD_GLOBAL click
  LOAD_ATTR NULL|self + prompt
  LOAD_CONST 'Issue summary'
  CALL 1
  STORE_FAST summary
  LOAD_GLOBAL NULL + create_issue
  LOAD_FAST lancet
  LOAD_FAST summary
  LOAD_CONST True
  KW_NAMES ('summary', 'add_to_active_sprint')
  CALL 3
  STORE_FAST issue
  JUMP_FORWARD L4
L3:
  LOAD_GLOBAL NULL + get_issue
  LOAD_FAST lancet
  LOAD_FAST issue_id
  CALL 2
  STORE_FAST issue
L4:
  LOAD_FAST lancet
  LOAD_ATTR tracker
  LOAD_ATTR NULL|self + whoami
  CALL 0
  STORE_FAST username
  LOAD_FAST lancet
  LOAD_ATTR config
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'tracker'
  LOAD_CONST 'active_status'
  CALL 2
  STORE_FAST active_status
  LOAD_FAST base_branch
  POP_JUMP_IF_TRUE L5
  LOAD_FAST lancet
  LOAD_ATTR config
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'repository'
  LOAD_CONST 'base_branch'
  CALL 2
  STORE_FAST base_branch
L5:
  LOAD_GLOBAL NULL + get_branch
  LOAD_FAST lancet
  LOAD_FAST issue
  LOAD_FAST base_branch
  CALL 3
  STORE_FAST branch
  LOAD_GLOBAL NULL + get_transition
  LOAD_FAST ctx
  LOAD_FAST lancet
  LOAD_FAST issue
  LOAD_FAST active_status
  CALL 4
  STORE_FAST transition
  LOAD_GLOBAL NULL + assign_issue
  LOAD_FAST lancet
  LOAD_FAST issue
  LOAD_FAST username
  LOAD_FAST active_status
  CALL 4
  POP_TOP
  LOAD_GLOBAL NULL + set_issue_status
  LOAD_FAST lancet
  LOAD_FAST issue
  LOAD_FAST active_status
  LOAD_FAST transition
  CALL 4
  POP_TOP
  LOAD_GLOBAL NULL + taskstatus
  LOAD_CONST 'Checking out working branch'
  CALL 1
  BEFORE_WITH
L6:
  STORE_FAST ts
  LOAD_FAST lancet
  LOAD_ATTR repo
  LOAD_ATTR NULL|self + checkout
  LOAD_FAST branch
  LOAD_ATTR name
  CALL 1
  POP_TOP
  LOAD_FAST ts
  LOAD_ATTR NULL|self + ok
  LOAD_CONST 'Checked out working branch based on "{}"'
  LOAD_ATTR NULL|self + format
  LOAD_FAST base_branch
  CALL 1
  CALL 1
  POP_TOP
L7:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
L8:
  LOAD_GLOBAL NULL + taskstatus
  LOAD_CONST 'Starting harvest timer'
  CALL 1
  BEFORE_WITH
L9:
  STORE_FAST ts
  LOAD_FAST lancet
  LOAD_ATTR timer
  LOAD_ATTR NULL|self + start
  LOAD_FAST issue
  CALL 1
  POP_TOP
  LOAD_FAST ts
  LOAD_ATTR NULL|self + ok
  LOAD_CONST 'Started harvest timer'
  CALL 1
  POP_TOP
L10:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  RETURN_CONST None
L11:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L12
  RERAISE 2
L12:
  POP_TOP
L13:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  JUMP_BACKWARD L8
L14:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L15:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L16
  RERAISE 2
L16:
  POP_TOP
L17:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  RETURN_CONST None
L18:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L6..L7 -> handler=L11 depth=1 lasti=True
  EXC try=L9..L10 -> handler=L15 depth=1 lasti=True
  EXC try=L11..L13 -> handler=L14 depth=3 lasti=True
  EXC try=L15..L17 -> handler=L18 depth=3 lasti=True
END

def workon(ctx, issue_id, new, base_branch):
    """pass"""
    lancet = ctx.obj
    if not issue_id and (not new):
        raise click.UsageError('Provide either an issue ID or the --new flag.')
    elif issue_id and new:
        raise click.UsageError('Provide either an issue ID or the --new flag, but not both.')
    if new:
        summary = click.prompt('Issue summary')
        issue = create_issue(lancet, summary=summary, add_to_active_sprint=True)
    else:
        issue = get_issue(lancet, issue_id)
    username = lancet.tracker.whoami()
    active_status = lancet.config.get('tracker', 'active_status')
    if not base_branch:
        base_branch = lancet.config.get('repository', 'base_branch')
    branch = get_branch(lancet, issue, base_branch)
    transition = get_transition(ctx, lancet, issue, active_status)
    assign_issue(lancet, issue, username, active_status)
    set_issue_status(lancet, issue, active_status, transition)
    with taskstatus('Checking out working branch') as ts:
        lancet.repo.checkout(branch.name)
        ts.ok('Checked out working branch based on "{}"'.format(base_branch))
    with taskstatus('Starting harvest timer') as ts:
        lancet.timer.start(issue)
        ts.ok('Started harvest timer')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code time>
  MAKE_FUNCTION 0
  STORE_NAME time
  RETURN_CONST None
END
CODE time(lancet, issue)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + get_issue
  LOAD_FAST lancet
  LOAD_FAST issue
  CALL 2
  STORE_FAST issue
  LOAD_GLOBAL NULL + taskstatus
  LOAD_CONST 'Starting harvest timer'
  CALL 1
  BEFORE_WITH
L1:
  STORE_FAST ts
  LOAD_FAST lancet
  LOAD_ATTR timer
  LOAD_ATTR NULL|self + start
  LOAD_FAST issue
  CALL 1
  POP_TOP
  LOAD_FAST ts
  LOAD_ATTR NULL|self + ok
  LOAD_CONST 'Started harvest timer'
  CALL 1
  POP_TOP
L2:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  RETURN_CONST None
L3:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L4
  RERAISE 2
L4:
  POP_TOP
L5:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  RETURN_CONST None
L6:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L2 -> handler=L3 depth=1 lasti=True
  EXC try=L3..L5 -> handler=L6 depth=3 lasti=True
END

def time(lancet, issue):
    """pass"""
    issue = get_issue(lancet, issue)
    with taskstatus('Starting harvest timer') as ts:
        lancet.timer.start(issue)
        ts.ok('Started harvest timer')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code pause>
  MAKE_FUNCTION 0
  STORE_NAME pause
  RETURN_CONST None
END
CODE pause(ctx)
  DOC 'pass'
  RESUME 0
  LOAD_FAST ctx
  LOAD_ATTR obj
  STORE_FAST lancet
  LOAD_FAST lancet
  LOAD_ATTR config
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'tracker'
  LOAD_CONST 'paused_status'
  CALL 2
  STORE_FAST paused_status
  LOAD_GLOBAL NULL + get_issue
  LOAD_FAST lancet
  CALL 1
  STORE_FAST issue
  LOAD_GLOBAL NULL + get_transition
  LOAD_FAST ctx
  LOAD_FAST lancet
  LOAD_FAST issue
  LOAD_FAST paused_status
  CALL 4
  STORE_FAST transition
  LOAD_GLOBAL NULL + set_issue_status
  LOAD_FAST lancet
  LOAD_FAST issue
  LOAD_FAST paused_status
  LOAD_FAST transition
  CALL 4
  POP_TOP
  LOAD_GLOBAL NULL + taskstatus
  LOAD_CONST 'Pausing harvest timer'
  CALL 1
  BEFORE_WITH
L1:
  STORE_FAST ts
  LOAD_FAST lancet
  LOAD_ATTR timer
  LOAD_ATTR NULL|self + pause
  CALL 0
  POP_TOP
  LOAD_FAST ts
  LOAD_ATTR NULL|self + ok
  LOAD_CONST 'Harvest timer paused'
  CALL 1
  POP_TOP
L2:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  RETURN_CONST None
L3:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L4
  RERAISE 2
L4:
  POP_TOP
L5:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  RETURN_CONST None
L6:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L2 -> handler=L3 depth=1 lasti=True
  EXC try=L3..L5 -> handler=L6 depth=3 lasti=True
END

def pause(ctx):
    """pass"""
    lancet = ctx.obj
    paused_status = lancet.config.get('tracker', 'paused_status')
    issue = get_issue(lancet)
    transition = get_transition(ctx, lancet, issue, paused_status)
    set_issue_status(lancet, issue, paused_status, transition)
    with taskstatus('Pausing harvest timer') as ts:
        lancet.timer.pause()
        ts.ok('Harvest timer paused')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code raisefrom>
  MAKE_FUNCTION 0
  STORE_NAME raisefrom
  RETURN_CONST None
END
CODE raisefrom(exc_type, message, exc)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL sys
  LOAD_ATTR version_info
  LOAD_CONST None
  LOAD_CONST 2
  BINARY_SLICE
  LOAD_CONST (3, 2)
  COMPARE_OP >=
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL six
  LOAD_ATTR NULL|self + raise_from
  PUSH_NULL
  LOAD_FAST exc_type
  LOAD_FAST message
  CALL 1
  LOAD_FAST exc
  CALL 2
  POP_TOP
  RETURN_CONST None
L1:
  LOAD_GLOBAL six
  LOAD_ATTR NULL|self + reraise
  LOAD_FAST exc_type
  LOAD_FAST message
  FORMAT_VALUE str
  LOAD_CONST ' - '
  LOAD_FAST exc
  FORMAT_VALUE str
  BUILD_STRING 3
  LOAD_GLOBAL sys
  LOAD_ATTR NULL|self + exc_info
  CALL 0
  LOAD_CONST 2
  BINARY_SUBSCR
  CALL 3
  POP_TOP
  RETURN_CONST None
END

def raisefrom(exc_type, message, exc):
    """pass"""
    if sys.version_info[:2] >= (3, 2):
        six.raise_from(exc_type(message), exc)
    else:
        six.reraise(exc_type, '%s - %s' % (message, exc), sys.exc_info()[2])


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code init_runner>
  MAKE_FUNCTION 0
  STORE_NAME init_runner
  RETURN_CONST None
END
CODE init_runner(self, parser, tracers, projinfo)
  DOC 'pass'
  RESUME 0
  LOAD_FAST parser
  LOAD_FAST self
  STORE_ATTR parser
  LOAD_FAST tracers
  LOAD_FAST self
  STORE_ATTR tracers
  LOAD_FAST projinfo
  LOAD_FAST self
  STORE_ATTR proj_info
  RETURN_CONST None
END

def init_runner(self, parser, tracers, projinfo):
    """pass"""
    self.parser = parser
    self.tracers = tracers
    self.proj_info = projinfo


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _run_grid_multiprocess>
  MAKE_FUNCTION 0
  STORE_NAME _run_grid_multiprocess
  RETURN_CONST None
END
CODE _run_grid_multiprocess(self, func, iterables)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL multiprocessing
  LOAD_ATTR NULL|self + freeze_support
  CALL 0
  POP_TOP
  LOAD_GLOBAL multiprocessing
  LOAD_ATTR NULL|self + Pool
  CALL 0
  STORE_FAST pool
  LOAD_FAST pool
  LOAD_ATTR NULL|self + map
  LOAD_FAST func
  LOAD_FAST iterables
  CALL 2
  STORE_FAST pool_tracers
  LOAD_FAST pool
  LOAD_ATTR NULL|self + close
  CALL 0
  POP_TOP
  LOAD_FAST pool
  LOAD_ATTR NULL|self + join
  CALL 0
  POP_TOP
  LOAD_GLOBAL NULL + dict
  LOAD_GLOBAL NULL + zip
  LOAD_FAST self
  LOAD_ATTR _default_devices
  LOAD_FAST pool_tracers
  CALL 2
  CALL 1
  LOAD_FAST self
  STORE_ATTR tracers
  RETURN_CONST None
END

def _run_grid_multiprocess(self, func, iterables):
    """pass"""
    multiprocessing.freeze_support()
    pool = multiprocessing.Pool()
    pool_tracers = pool.map(func, iterables)
    pool.close()
    pool.join()
    self.tracers = dict(zip(self._default_devices, pool_tracers))


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _run_grid_multithread>
  MAKE_FUNCTION 0
  STORE_NAME _run_grid_multithread
  RETURN_CONST None
END
CODE _run_grid_multithread(self, func, iterables)
  DOC 'pass'
  MAKE_CELL func
  RESUME 0
  LOAD_CLOSURE func
  BUILD_TUPLE 1
  LOAD_CONST <code _run_grid_multithread.<locals>.<lambda>>
  MAKE_FUNCTION closure
  STORE_FAST f
  LOAD_GLOBAL NULL + map
  LOAD_FAST f
  LOAD_FAST iterables
  CALL 2
  STORE_FAST threads
  LOAD_FAST threads
  GET_ITER
L1:
  FOR_ITER L2
  STORE_FAST thread
  LOAD_FAST thread
  LOAD_ATTR NULL|self + setDaemon
  LOAD_CONST True
  CALL 1
  POP_TOP
  LOAD_FAST thread
  LOAD_ATTR NULL|self + start
  CALL 0
  POP_TOP
  LOAD_FAST thread
  LOAD_ATTR NULL|self + join
  CALL 0
  POP_TOP
  JUMP_BACKWARD L1
L2:
  END_FOR
  RETURN_CONST None
END
CODE _run_grid_multithread.<locals>.<lambda>(x)
  COPY_FREE_VARS 1
  RESUME 0
  LOAD_GLOBAL threading
  LOAD_ATTR NULL|self + Thread
  LOAD_DEREF func
  LOAD_FAST x
  BUILD_TUPLE 1
  KW_NAMES ('target', 'args')
  CALL 2
  RETURN_VALUE
END

def _run_grid_multithread(self, func, iterables):
    """pass"""
    f = lambda x: threading.Thread(target=func, args=(x,))
    threads = map(f, iterables)
    for thread in threads:
        thread.setDaemon(True)
        thread.start()
        thread.join()


Input:
CODE <module>()
  DOC 'Automation'
  RESUME 0
  LOAD_CONST ('Automation', None, 'utf-8', False)
  LOAD_CONST <code init_project_env>
  MAKE_FUNCTION defaults
  STORE_NAME init_project_env
  RETURN_CONST None
END
CODE init_project_env(subject, proj_path, sysencoding, debug)
  DOC 'pass'
  RESUME 0
  LOAD_FAST proj_path
  POP_JUMP_IF_TRUE L3
  NOP
L1:
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + dirname
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + abspath
  LOAD_GLOBAL inspect
  LOAD_ATTR NULL|self + stack
  CALL 0
  LOAD_CONST -1
  BINARY_SUBSCR
  LOAD_CONST 1
  BINARY_SUBSCR
  CALL 1
  CALL 1
  STORE_FAST executable_file_path
L2:
  LOAD_FAST executable_file_path
  STORE_FAST proj_path
L3:
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST proj_path
  LOAD_FAST subject
  CALL 2
  STORE_FAST p
  LOAD_FAST sysencoding
  LOAD_FAST debug
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + splitext
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + basename
  LOAD_FAST subject
  CALL 1
  CALL 1
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'config.ini'
  CALL 2
  LOAD_FAST p
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'testcase'
  CALL 2
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'data'
  CALL 2
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'buffer'
  CALL 2
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'resource'
  CALL 2
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'tools'
  CALL 2
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'result'
  CALL 2
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'result'
  LOAD_CONST 'testcase'
  CALL 3
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST p
  LOAD_CONST 'result'
  LOAD_CONST 'screenshots'
  CALL 3
  LOAD_CONST ('root', 'case', 'data', 'buffer', 'resource', 'tools', 'rst', 'rst_log', 'rst_shot')
  BUILD_CONST_KEY_MAP 9
  LOAD_CONST ('sys_coding', 'debug', 'module_name', 'cfg_file', 'path')
  BUILD_CONST_KEY_MAP 5
  STORE_FAST proj_conf
  LOAD_FAST proj_conf
  LOAD_CONST 'path'
  BINARY_SUBSCR
  LOAD_ATTR NULL|self + values
  CALL 0
  GET_ITER
  LOAD_FAST_AND_CLEAR v
  SWAP 2
L4:
  BUILD_LIST 0
  SWAP 2
L5:
  FOR_ITER L6
  STORE_FAST v
  LOAD_GLOBAL FileSystemUtils
  LOAD_ATTR NULL|self + mkdirs
  LOAD_FAST v
  CALL 1
  LIST_APPEND 2
  JUMP_BACKWARD L5
L6:
  END_FOR
L7:
  SWAP 2
  STORE_FAST v
  POP_TOP
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + isdir
  LOAD_FAST p
  CALL 1
  POP_JUMP_IF_FALSE L8
  LOAD_GLOBAL sys
  LOAD_ATTR path
  LOAD_ATTR NULL|self + append
  LOAD_FAST p
  CALL 1
  POP_TOP
  LOAD_FAST proj_conf
  RETURN_VALUE
L8:
  LOAD_CONST ''
  POP_TOP
  LOAD_FAST proj_conf
  RETURN_VALUE
L9:
  PUSH_EXC_INFO
  POP_TOP
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + dirname
  LOAD_GLOBAL sys
  LOAD_ATTR path
  LOAD_CONST 0
  BINARY_SUBSCR
  CALL 1
  STORE_FAST executable_file_path
L10:
  POP_EXCEPT
  EXTENDED_ARG 2
  JUMP_BACKWARD L2
L11:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L12:
  PUSH_EXC_INFO
  LOAD_FAST_CHECK executable_file_path
  STORE_FAST proj_path
  RERAISE 0
L13:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L14:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST v
  RERAISE 0
  EXC try=L1..L2 -> handler=L9 depth=0 lasti=False
  EXC try=L4..L7 -> handler=L14 depth=2 lasti=False
  EXC try=L9..L10 -> handler=L11 depth=1 lasti=True
  EXC try=L10..L12 -> handler=L12 depth=0 lasti=False
  EXC try=L12..L13 -> handler=L13 depth=1 lasti=True
END

def init_project_env(subject='Automation', proj_path=None, sysencoding='utf-8', debug=False):
    """pass"""
    if not proj_path:
        try:
            executable_file_path = os.path.dirname(os.path.abspath(inspect.stack()[-1][1]))
        except:
            executable_file_path = os.path.dirname(sys.path[0])
        finally:
            proj_path = executable_file_path
    p = os.path.join(proj_path, subject)
    proj_conf = {'sys_coding': sysencoding, 'debug': debug, 'module_name': os.path.splitext(os.path.basename(subject))[0], 'cfg_file': os.path.join(p, 'config.ini'), 'path': {'root': p, 'case': os.path.join(p, 'testcase'), 'data': os.path.join(p, 'data'), 'buffer': os.path.join(p, 'buffer'), 'resource': os.path.join(p, 'resource'), 'tools': os.path.join(p, 'tools'), 'rst': os.path.join(p, 'result'), 'rst_log': os.path.join(p, 'result', 'testcase'), 'rst_shot': os.path.join(p, 'result', 'screenshots')}}
    [FileSystemUtils.mkdirs(v) for v in proj_conf['path'].values()]
    sys.path.append(p) if os.path.isdir(p) else ''
    return proj_conf


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code get_long_description>
  MAKE_FUNCTION 0
  STORE_NAME get_long_description
  RETURN_CONST None
END
CODE get_long_description()
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + abspath
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + dirname
  LOAD_GLOBAL __file__
  CALL 1
  CALL 1
  STORE_FAST here
  LOAD_GLOBAL NULL + copen
  LOAD_GLOBAL os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + join
  LOAD_FAST here
  LOAD_CONST 'DESCRIPTION.rst'
  CALL 2
  LOAD_CONST 'utf-8'
  KW_NAMES ('encoding',)
  CALL 2
  BEFORE_WITH
L1:
  STORE_FAST description
  LOAD_FAST description
  LOAD_ATTR NULL|self + read
  CALL 0
L2:
  SWAP 2
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  RETURN_VALUE
L3:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L4
  RERAISE 2
L4:
  POP_TOP
L5:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  RETURN_CONST None
L6:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L2 -> handler=L3 depth=1 lasti=True
  EXC try=L3..L5 -> handler=L6 depth=3 lasti=True
END

def get_long_description():
    """pass"""
    here = os.path.abspath(os.path.dirname(__file__))
    with copen(os.path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as description:
        return description.read()