Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code filter_validate_schemas>
  MAKE_FUNCTION 0
  STORE_NAME filter_validate_schemas
  RETURN_CONST None
END
CODE filter_validate_schemas(get_response, params)
  DOC 'pass'
  MAKE_CELL get_response
  MAKE_CELL _convert_params
  MAKE_CELL request_schema
  RESUME 0
  LOAD_FAST params
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'request_schema'
  CALL 1
  STORE_DEREF request_schema
  LOAD_DEREF request_schema
  POP_JUMP_IF_NOT_NONE L1
  LOAD_DEREF get_response
  RETURN_VALUE
L1:
  LOAD_CONST <code filter_validate_schemas.<locals>._convert_params>
  MAKE_FUNCTION 0
  STORE_DEREF _convert_params
  LOAD_CLOSURE _convert_params
  LOAD_CLOSURE get_response
  LOAD_CLOSURE request_schema
  BUILD_TUPLE 3
  LOAD_CONST <code filter_validate_schemas.<locals>.decorated_filter>
  MAKE_FUNCTION closure
  STORE_FAST decorated_filter
  LOAD_FAST decorated_filter
  RETURN_VALUE
END
CODE filter_validate_schemas.<locals>._convert_params(schema, data)
  RESUME 0
  LOAD_FAST schema
  LOAD_ATTR fields
  LOAD_ATTR NULL|self + values
  CALL 0
  GET_ITER
L1:
  FOR_ITER L5
  STORE_FAST sc
  LOAD_FAST sc
  LOAD_ATTR serialized_name
  COPY 1
  POP_JUMP_IF_TRUE L2
  POP_TOP
  LOAD_FAST sc
  LOAD_ATTR name
L2:
  STORE_FAST name
  LOAD_FAST data
  LOAD_ATTR NULL|self + getlist
  LOAD_FAST name
  CALL 1
  STORE_FAST val
  LOAD_FAST val
  POP_JUMP_IF_NOT_NONE L3
  JUMP_BACKWARD L1
L3:
  LOAD_GLOBAL NULL + len
  LOAD_FAST val
  CALL 1
  LOAD_CONST 1
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L4
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST sc
  LOAD_GLOBAL ListType
  CALL 2
  POP_JUMP_IF_TRUE L4
  LOAD_FAST val
  LOAD_CONST 0
  BINARY_SUBSCR
  STORE_FAST val
L4:
  LOAD_FAST val
  LOAD_FAST data
  LOAD_FAST name
  STORE_SUBSCR
  JUMP_BACKWARD L1
L5:
  END_FOR
  RETURN_CONST None
END
CODE filter_validate_schemas.<locals>.decorated_filter(request, *args, **kwargs)
  COPY_FREE_VARS 3
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_GLOBAL NULL + CIDict
  LOAD_FAST request
  LOAD_ATTR headers
  CALL 1
  LOAD_FAST request
  LOAD_ATTR app
  LOAD_ATTR router
  LOAD_ATTR NULL|self + get
  LOAD_FAST request
  CALL 1
  LOAD_CONST 2
  BINARY_SUBSCR
  LOAD_GLOBAL NULL + RequestParameters
  LOAD_FAST request
  LOAD_ATTR args
  CALL 1
  BUILD_MAP 0
  LOAD_CONST ('headers', 'path', 'params', 'body')
  BUILD_CONST_KEY_MAP 4
  STORE_FAST data
  LOAD_FAST request
  LOAD_ATTR body
  POP_JUMP_IF_FALSE L3
  LOAD_FAST request
  LOAD_ATTR form
  POP_JUMP_IF_FALSE L2
  LOAD_GLOBAL NULL + RequestParameters
  LOAD_FAST request
  LOAD_ATTR form
  CALL 1
  LOAD_FAST data
  LOAD_CONST 'body'
  STORE_SUBSCR
  JUMP_FORWARD L3
L2:
  LOAD_GLOBAL NULL + deepcopy
  LOAD_FAST request
  LOAD_ATTR json
  CALL 1
  LOAD_FAST data
  LOAD_CONST 'body'
  STORE_SUBSCR
L3:
  LOAD_GLOBAL NULL + hasattr
  LOAD_DEREF request_schema
  LOAD_CONST 'body'
  CALL 2
  POP_JUMP_IF_FALSE L4
  LOAD_FAST request
  LOAD_ATTR form
  POP_JUMP_IF_FALSE L4
  PUSH_NULL
  LOAD_DEREF _convert_params
  LOAD_DEREF request_schema
  LOAD_ATTR body
  LOAD_FAST data
  LOAD_CONST 'body'
  BINARY_SUBSCR
  CALL 2
  POP_TOP
L4:
  LOAD_GLOBAL NULL + hasattr
  LOAD_DEREF request_schema
  LOAD_CONST 'params'
  CALL 2
  POP_JUMP_IF_FALSE L5
  LOAD_FAST data
  LOAD_CONST 'params'
  BINARY_SUBSCR
  POP_JUMP_IF_FALSE L5
  PUSH_NULL
  LOAD_DEREF _convert_params
  LOAD_DEREF request_schema
  LOAD_ATTR params
  LOAD_FAST data
  LOAD_CONST 'params'
  BINARY_SUBSCR
  CALL 2
  POP_TOP
L5:
  NOP
L6:
  PUSH_NULL
  LOAD_DEREF request_schema
  LOAD_FAST data
  LOAD_CONST False
  LOAD_CONST False
  KW_NAMES ('strict', 'validate')
  CALL 3
  STORE_FAST model
  LOAD_FAST model
  LOAD_ATTR NULL|self + validate
  CALL 0
  POP_TOP
  LOAD_FAST model
  LOAD_ATTR NULL|self + to_native
  CALL 0
  LOAD_FAST request
  STORE_ATTR validated
L7:
  PUSH_NULL
  LOAD_DEREF get_response
  LOAD_FAST request
  BUILD_LIST 1
  LOAD_FAST args
  LIST_EXTEND 1
  CALL_INTRINSIC_1 INTRINSIC_LIST_TO_TUPLE
  BUILD_MAP 0
  LOAD_FAST kwargs
  DICT_MERGE 1
  CALL_FUNCTION_EX 1
  GET_AWAITABLE 0
  LOAD_CONST None
L8:
  SEND L11
L9:
  YIELD_VALUE 2
L10:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L8
L11:
  END_SEND
  RETURN_VALUE
L12:
  PUSH_EXC_INFO
  LOAD_GLOBAL BaseError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L15
  STORE_FAST e
L13:
  LOAD_GLOBAL NULL + ValidationErrors
  LOAD_FAST e
  LOAD_ATTR NULL|self + to_primitive
  CALL 0
  CALL 1
  RAISE_VARARGS 1
L14:
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  RERAISE 1
L15:
  RERAISE 0
L16:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L17:
  CLEANUP_THROW
L18:
  JUMP_BACKWARD L11
L19:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L5 -> handler=L19 depth=0 lasti=True
  EXC try=L6..L7 -> handler=L12 depth=0 lasti=False
  EXC try=L7..L9 -> handler=L19 depth=0 lasti=True
  EXC try=L9..L10 -> handler=L17 depth=2 lasti=False
  EXC try=L10..L12 -> handler=L19 depth=0 lasti=True
  EXC try=L12..L13 -> handler=L16 depth=1 lasti=True
  EXC try=L13..L14 -> handler=L14 depth=1 lasti=True
  EXC try=L14..L16 -> handler=L16 depth=1 lasti=True
  EXC try=L16..L18 -> handler=L19 depth=0 lasti=True
END

def filter_validate_schemas(get_response, params):
    """pass"""
    request_schema = params.get('request_schema')
    if request_schema is None:
        return get_response

    def _convert_params(schema, data):
        for sc in schema.fields.values():
            name = sc.serialized_name or sc.name
            val = data.getlist(name)
            if val is None:
                continue
            if len(val) == 1 and (not isinstance(sc, ListType)):
                val = val[0]
            data[name] = val

    async def decorated_filter(request, *args, **kwargs):
        data = {'headers': CIDict(request.headers), 'path': request.app.router.get(request)[2], 'params': RequestParameters(request.args), 'body': {}}
        if request.body:
            if request.form:
                data['body'] = RequestParameters(request.form)
            else:
                data['body'] = deepcopy(request.json)
        if hasattr(request_schema, 'body') and request.form:
            _convert_params(request_schema.body, data['body'])
        if hasattr(request_schema, 'params') and data['params']:
            _convert_params(request_schema.params, data['params'])
        try:
            model = request_schema(data, strict=False, validate=False)
            model.validate()
            request.validated = model.to_native()
        except BaseError as e:
            raise ValidationErrors(e.to_primitive())
        return await get_response(request, *args, **kwargs)
    return decorated_filter


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code filter_validate_response>
  MAKE_FUNCTION 0
  STORE_NAME filter_validate_response
  RETURN_CONST None
END
CODE filter_validate_response(get_response, params)
  DOC 'pass'
  MAKE_CELL get_response
  MAKE_CELL schema
  RESUME 0
  LOAD_FAST params
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'response_schema'
  CALL 1
  STORE_DEREF schema
  LOAD_CLOSURE get_response
  LOAD_CLOSURE schema
  BUILD_TUPLE 2
  LOAD_CONST <code filter_validate_response.<locals>.decorated_filter>
  MAKE_FUNCTION closure
  STORE_FAST decorated_filter
  LOAD_FAST decorated_filter
  RETURN_VALUE
END
CODE filter_validate_response.<locals>.decorated_filter(request, *args, **kwargs)
  COPY_FREE_VARS 2
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  PUSH_NULL
  LOAD_DEREF get_response
  LOAD_FAST request
  BUILD_LIST 1
  LOAD_FAST args
  LIST_EXTEND 1
  CALL_INTRINSIC_1 INTRINSIC_LIST_TO_TUPLE
  BUILD_MAP 0
  LOAD_FAST kwargs
  DICT_MERGE 1
  CALL_FUNCTION_EX 1
  GET_AWAITABLE 0
  LOAD_CONST None
L2:
  SEND L5
L3:
  YIELD_VALUE 2
L4:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L2
L5:
  END_SEND
  STORE_FAST response
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL HTTPResponse
  CALL 2
  POP_JUMP_IF_FALSE L6
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL Response
  CALL 2
  POP_JUMP_IF_TRUE L6
  LOAD_FAST response
  RETURN_VALUE
L6:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL Response
  CALL 2
  POP_JUMP_IF_TRUE L7
  LOAD_GLOBAL NULL + TypeError
  LOAD_CONST 'response is not an instance of rafter.http.Response.'
  CALL 1
  RAISE_VARARGS 1
L7:
  LOAD_DEREF schema
  POP_JUMP_IF_FALSE L11
  LOAD_FAST response
  LOAD_ATTR data
  LOAD_FAST response
  LOAD_ATTR headers
  LOAD_CONST ('body', 'headers')
  BUILD_CONST_KEY_MAP 2
  STORE_FAST data
L8:
  NOP
L9:
  PUSH_NULL
  LOAD_DEREF schema
  LOAD_FAST data
  LOAD_CONST False
  LOAD_CONST False
  KW_NAMES ('strict', 'validate')
  CALL 3
  STORE_FAST model
  LOAD_FAST model
  LOAD_ATTR NULL|self + validate
  CALL 0
  POP_TOP
  LOAD_FAST model
  LOAD_ATTR NULL|self + to_primitive
  CALL 0
  STORE_FAST result
  LOAD_FAST result
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'body'
  LOAD_CONST None
  CALL 2
  LOAD_FAST response
  STORE_ATTR body
  LOAD_FAST response
  LOAD_ATTR headers
  LOAD_ATTR NULL|self + update
  LOAD_FAST result
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'headers'
  BUILD_MAP 0
  CALL 2
  CALL 1
  POP_TOP
L10:
  LOAD_FAST response
  RETURN_VALUE
L11:
  LOAD_FAST response
  RETURN_VALUE
L12:
  CLEANUP_THROW
L13:
  JUMP_BACKWARD L5
L14:
  PUSH_EXC_INFO
  LOAD_GLOBAL BaseError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L18
  STORE_FAST e
L15:
  LOAD_GLOBAL log
  LOAD_ATTR NULL|self + exception
  LOAD_FAST e
  CALL 1
  POP_TOP
  LOAD_GLOBAL NULL + abort
  LOAD_CONST 500
  LOAD_CONST 'Wrong data output'
  CALL 2
  POP_TOP
L16:
  POP_EXCEPT
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  LOAD_FAST response
  RETURN_VALUE
L17:
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  RERAISE 1
L18:
  RERAISE 0
L19:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L20:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L3 -> handler=L20 depth=0 lasti=True
  EXC try=L3..L4 -> handler=L12 depth=2 lasti=False
  EXC try=L4..L8 -> handler=L20 depth=0 lasti=True
  EXC try=L9..L10 -> handler=L14 depth=0 lasti=False
  EXC try=L10..L13 -> handler=L20 depth=0 lasti=True
  EXC try=L14..L15 -> handler=L19 depth=1 lasti=True
  EXC try=L15..L16 -> handler=L17 depth=1 lasti=True
  EXC try=L16..L17 -> handler=L20 depth=0 lasti=True
  EXC try=L17..L19 -> handler=L19 depth=1 lasti=True
  EXC try=L19..L20 -> handler=L20 depth=0 lasti=True
END

def filter_validate_response(get_response, params):
    """pass"""
    schema = params.get('response_schema')

    async def decorated_filter(request, *args, **kwargs):
        response = await get_response(request, *args, **kwargs)
        if isinstance(response, HTTPResponse) and (not isinstance(response, Response)):
            return response
        if not isinstance(response, Response):
            raise TypeError('response is not an instance of rafter.http.Response.')
        if schema:
            data = {'body': response.data, 'headers': response.headers}
            try:
                model = schema(data, strict=False, validate=False)
                model.validate()
                result = model.to_primitive()
                response.body = result.get('body', None)
                response.headers.update(result.get('headers', {}))
            except BaseError as e:
                log.exception(e)
                abort(500, 'Wrong data output')
        return response
    return decorated_filter

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


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (True,)
  LOAD_CONST <code _write_int>
  MAKE_FUNCTION defaults
  STORE_NAME _write_int
  RETURN_CONST None
END
CODE _write_int(fname, data, append)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL pexdoc
  LOAD_ATTR exh
  LOAD_ATTR NULL|self + addex
  LOAD_GLOBAL ValueError
  LOAD_CONST 'There is no data to save to file'
  CALL 2
  STORE_FAST data_ex
  LOAD_GLOBAL pexdoc
  LOAD_ATTR exh
  LOAD_ATTR NULL|self + addex
  LOAD_GLOBAL OSError
  LOAD_CONST 'File *[fname]* could not be created: *[reason]*'
  CALL 2
  STORE_FAST fos_ex
  PUSH_NULL
  LOAD_FAST data_ex
  LOAD_GLOBAL NULL + len
  LOAD_FAST data
  CALL 1
  LOAD_CONST 0
  COMPARE_OP ==
  COPY 1
  POP_JUMP_IF_TRUE L1
  POP_TOP
  LOAD_GLOBAL NULL + len
  LOAD_FAST data
  CALL 1
  LOAD_CONST 1
  COMPARE_OP ==
  COPY 1
  POP_JUMP_IF_FALSE L1
  POP_TOP
  LOAD_GLOBAL NULL + len
  LOAD_FAST data
  LOAD_CONST 0
  BINARY_SUBSCR
  CALL 1
  LOAD_CONST 0
  COMPARE_OP ==
L1:
  CALL 1
  POP_TOP
  NOP
L2:
  LOAD_GLOBAL pmisc
  LOAD_ATTR NULL|self + make_dir
  LOAD_FAST fname
  CALL 1
  POP_TOP
  LOAD_FAST append
  LOAD_CONST False
  IS_OP 0
  POP_JUMP_IF_FALSE L3
  LOAD_CONST 'w'
  JUMP_FORWARD L4
L3:
  LOAD_CONST 'a'
L4:
  STORE_FAST mode
  LOAD_GLOBAL sys
  LOAD_ATTR hexversion
  LOAD_CONST 50331648
  COMPARE_OP <
  POP_JUMP_IF_FALSE L8
  LOAD_GLOBAL NULL + open
  LOAD_FAST fname
  LOAD_FAST mode
  CALL 2
  BEFORE_WITH
L5:
  STORE_FAST file_handle
  LOAD_GLOBAL csv
  LOAD_ATTR NULL|self + writer
  LOAD_FAST file_handle
  LOAD_CONST ','
  KW_NAMES ('delimiter',)
  CALL 2
  LOAD_ATTR NULL|self + writerows
  LOAD_FAST data
  CALL 1
  POP_TOP
L6:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
L7:
  RETURN_CONST None
L8:
  LOAD_GLOBAL NULL + open
  LOAD_FAST fname
  LOAD_FAST mode
  LOAD_CONST ''
  KW_NAMES ('newline',)
  CALL 3
  BEFORE_WITH
L9:
  STORE_FAST file_handle
  LOAD_GLOBAL csv
  LOAD_ATTR NULL|self + writer
  LOAD_FAST file_handle
  LOAD_CONST ','
  KW_NAMES ('delimiter',)
  CALL 2
  LOAD_ATTR NULL|self + writerows
  LOAD_FAST data
  CALL 1
  POP_TOP
L10:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
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
L15:
  RETURN_CONST None
L16:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L17:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  POP_JUMP_IF_TRUE L18
  RERAISE 2
L18:
  POP_TOP
L19:
  POP_EXCEPT
  POP_TOP
  POP_TOP
L20:
  RETURN_CONST None
L21:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L22:
  PUSH_EXC_INFO
  LOAD_GLOBAL IOError
  LOAD_GLOBAL OSError
  BUILD_TUPLE 2
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L26
  STORE_FAST eobj
L23:
  PUSH_NULL
  LOAD_FAST fos_ex
  LOAD_CONST True
  LOAD_GLOBAL NULL + _MF
  LOAD_CONST 'fname'
  LOAD_FAST fname
  LOAD_CONST 'reason'
  LOAD_FAST eobj
  LOAD_ATTR strerror
  CALL 4
  CALL 2
  POP_TOP
L24:
  POP_EXCEPT
  LOAD_CONST None
  STORE_FAST eobj
  DELETE_FAST eobj
  RETURN_CONST None
L25:
  LOAD_CONST None
  STORE_FAST eobj
  DELETE_FAST eobj
  RERAISE 1
L26:
  RERAISE 0
L27:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L2..L5 -> handler=L22 depth=0 lasti=False
  EXC try=L5..L6 -> handler=L12 depth=1 lasti=True
  EXC try=L6..L7 -> handler=L22 depth=0 lasti=False
  EXC try=L8..L9 -> handler=L22 depth=0 lasti=False
  EXC try=L9..L10 -> handler=L17 depth=1 lasti=True
  EXC try=L10..L11 -> handler=L22 depth=0 lasti=False
  EXC try=L12..L14 -> handler=L16 depth=3 lasti=True
  EXC try=L14..L15 -> handler=L22 depth=0 lasti=False
  EXC try=L16..L17 -> handler=L22 depth=0 lasti=False
  EXC try=L17..L19 -> handler=L21 depth=3 lasti=True
  EXC try=L19..L20 -> handler=L22 depth=0 lasti=False
  EXC try=L21..L22 -> handler=L22 depth=0 lasti=False
  EXC try=L22..L23 -> handler=L27 depth=1 lasti=True
  EXC try=L23..L24 -> handler=L25 depth=1 lasti=True
  EXC try=L25..L27 -> handler=L27 depth=1 lasti=True
END

def _write_int(fname, data, append=True):
    """pass"""
    data_ex = pexdoc.exh.addex(ValueError, 'There is no data to save to file')
    fos_ex = pexdoc.exh.addex(OSError, 'File *[fname]* could not be created: *[reason]*')
    data_ex(len(data) == 0 or (len(data) == 1 and len(data[0]) == 0))
    try:
        pmisc.make_dir(fname)
        mode = 'w' if append is False else 'a'
        if sys.hexversion < 50331648:
            with open(fname, mode) as file_handle:
                csv.writer(file_handle, delimiter=',').writerows(data)
        else:
            with open(fname, mode, newline='') as file_handle:
                csv.writer(file_handle, delimiter=',').writerows(data)
    except (IOError, OSError) as eobj:
        fos_ex(True, _MF('fname', fname, 'reason', eobj.strerror))


Input:
CODE <module>()
  RESUME 0
  LOAD_NAME defaults
  LOAD_ATTR RADIUS
  LOAD_CONST False
  LOAD_CONST False
  LOAD_CONST False
  BUILD_TUPLE 4
  LOAD_CONST <code revdocs2reverts>
  MAKE_FUNCTION defaults
  STORE_NAME revdocs2reverts
  RETURN_CONST None
END
CODE revdocs2reverts(rev_docs, radius, use_sha1, resort, verbose)
  DOC 'pass'
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_GLOBAL NULL + groupby
  LOAD_FAST rev_docs
  LOAD_CONST <code revdocs2reverts.<locals>.<lambda>>
  MAKE_FUNCTION 0
  CALL 2
  STORE_FAST page_rev_docs
  LOAD_FAST page_rev_docs
  GET_ITER
L2:
  EXTENDED_ARG 2
  FOR_ITER L19
  UNPACK_SEQUENCE 2
  STORE_FAST page_doc
  STORE_FAST rev_docs
  LOAD_FAST verbose
  POP_JUMP_IF_FALSE L3
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + write
  LOAD_FAST page_doc
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'title'
  CALL 1
  LOAD_CONST ': '
  BINARY_OP +
  CALL 1
  POP_TOP
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + flush
  CALL 0
  POP_TOP
L3:
  LOAD_FAST resort
  POP_JUMP_IF_FALSE L5
  LOAD_FAST verbose
  POP_JUMP_IF_FALSE L4
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + write
  LOAD_CONST '(sorting) '
  CALL 1
  POP_TOP
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + flush
  CALL 0
  POP_TOP
L4:
  LOAD_GLOBAL NULL + sorted
  LOAD_FAST rev_docs
  LOAD_CONST <code revdocs2reverts.<locals>.<lambda>>
  MAKE_FUNCTION 0
  KW_NAMES ('key',)
  CALL 2
  STORE_FAST rev_docs
L5:
  LOAD_GLOBAL NULL + Detector
  LOAD_FAST radius
  KW_NAMES ('radius',)
  CALL 1
  STORE_FAST detector
  LOAD_FAST rev_docs
  GET_ITER
L6:
  EXTENDED_ARG 1
  FOR_ITER L16
  STORE_FAST rev_doc
  LOAD_FAST use_sha1
  POP_JUMP_IF_TRUE L7
  LOAD_CONST 'text'
  LOAD_FAST rev_doc
  CONTAINS_OP 1
  POP_JUMP_IF_FALSE L7
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + warn
  LOAD_CONST "Skipping {0}: 'text' field not found in {0}"
  LOAD_ATTR NULL|self + format
  LOAD_FAST rev_doc
  LOAD_CONST 'id'
  BINARY_SUBSCR
  LOAD_FAST rev_doc
  CALL 2
  CALL 1
  POP_TOP
  JUMP_BACKWARD L6
L7:
  LOAD_FAST use_sha1
  POP_JUMP_IF_FALSE L9
  LOAD_FAST rev_doc
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'sha1'
  CALL 1
  COPY 1
  POP_JUMP_IF_TRUE L8
  POP_TOP
  LOAD_GLOBAL NULL + DummyChecksum
  CALL 0
L8:
  STORE_FAST checksum
  JUMP_FORWARD L10
L9:
  LOAD_CONST 'text'
  LOAD_FAST rev_doc
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L10
  LOAD_GLOBAL NULL + bytes
  LOAD_FAST rev_doc
  LOAD_CONST 'text'
  BINARY_SUBSCR
  LOAD_CONST 'utf8'
  LOAD_CONST 'replace'
  CALL 3
  STORE_FAST text_bytes
  LOAD_GLOBAL hashlib
  LOAD_ATTR NULL|self + sha1
  LOAD_FAST text_bytes
  CALL 1
  LOAD_ATTR NULL|self + digest
  CALL 0
  STORE_FAST checksum
L10:
  LOAD_FAST detector
  LOAD_ATTR NULL|self + process
  LOAD_FAST_CHECK checksum
  LOAD_FAST rev_doc
  CALL 2
  STORE_FAST revert
  LOAD_FAST revert
  POP_JUMP_IF_FALSE L13
  LOAD_FAST revert
  LOAD_ATTR NULL|self + to_json
  CALL 0
  YIELD_VALUE 1
  RESUME 1
  POP_TOP
  LOAD_FAST verbose
  POP_JUMP_IF_TRUE L12
L11:
  JUMP_BACKWARD L6
L12:
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + write
  LOAD_CONST 'r'
  CALL 1
  POP_TOP
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + flush
  CALL 0
  POP_TOP
  JUMP_BACKWARD L6
L13:
  LOAD_FAST verbose
  POP_JUMP_IF_TRUE L15
L14:
  JUMP_BACKWARD L6
L15:
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + write
  LOAD_CONST '.'
  CALL 1
  POP_TOP
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + flush
  CALL 0
  POP_TOP
  EXTENDED_ARG 1
  JUMP_BACKWARD L6
L16:
  END_FOR
  LOAD_FAST verbose
  POP_JUMP_IF_TRUE L18
L17:
  EXTENDED_ARG 1
  JUMP_BACKWARD L2
L18:
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + write
  LOAD_CONST '\n'
  CALL 1
  POP_TOP
  LOAD_GLOBAL sys
  LOAD_ATTR stderr
  LOAD_ATTR NULL|self + flush
  CALL 0
  POP_TOP
  EXTENDED_ARG 2
  JUMP_BACKWARD L2
L19:
  END_FOR
  RETURN_CONST None
L20:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L11 -> handler=L20 depth=0 lasti=True
  EXC try=L12..L14 -> handler=L20 depth=0 lasti=True
  EXC try=L15..L17 -> handler=L20 depth=0 lasti=True
  EXC try=L18..L20 -> handler=L20 depth=0 lasti=True
END
CODE revdocs2reverts.<locals>.<lambda>(rd)
  RESUME 0
  LOAD_FAST rd
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'page'
  CALL 1
  RETURN_VALUE
END
CODE revdocs2reverts.<locals>.<lambda>(r)
  RESUME 0
  LOAD_FAST r
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'timestamp'
  CALL 1
  LOAD_FAST r
  LOAD_ATTR NULL|self + get
  LOAD_CONST 'id'
  CALL 1
  BUILD_TUPLE 2
  RETURN_VALUE
END

def revdocs2reverts(rev_docs, radius=defaults.RADIUS, use_sha1=False, resort=False, verbose=False):
    """pass"""
    page_rev_docs = groupby(rev_docs, lambda rd: rd.get('page'))
    for page_doc, rev_docs in page_rev_docs:
        if verbose:
            sys.stderr.write(page_doc.get('title') + ': ')
            sys.stderr.flush()
        if resort:
            if verbose:
                sys.stderr.write('(sorting) ')
                sys.stderr.flush()
            rev_docs = sorted(rev_docs, key=lambda r: (r.get('timestamp'), r.get('id')))
        detector = Detector(radius=radius)
        for rev_doc in rev_docs:
            if not use_sha1 and 'text' not in rev_doc:
                logger.warn("Skipping {0}: 'text' field not found in {0}".format(rev_doc['id'], rev_doc))
                continue
            if use_sha1:
                checksum = rev_doc.get('sha1') or DummyChecksum()
            elif 'text' in rev_doc:
                text_bytes = bytes(rev_doc['text'], 'utf8', 'replace')
                checksum = hashlib.sha1(text_bytes).digest()
            revert = detector.process(checksum, rev_doc)
            if revert:
                yield revert.to_json()
                if verbose:
                    sys.stderr.write('r')
                    sys.stderr.flush()
            elif verbose:
                sys.stderr.write('.')
                sys.stderr.flush()
        if verbose:
            sys.stderr.write('\n')
            sys.stderr.flush()


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (True, 0, None)
  LOAD_CONST <code dsort>
  MAKE_FUNCTION defaults
  STORE_NAME dsort
  RETURN_CONST None
END
CODE dsort(fname, order, has_header, frow, ofname)
  DOC 'pass'
  RESUME 0
  LOAD_FAST ofname
  POP_JUMP_IF_NOT_NONE L1
  LOAD_FAST fname
  JUMP_FORWARD L2
L1:
  LOAD_FAST ofname
L2:
  STORE_FAST ofname
  LOAD_GLOBAL NULL + CsvFile
  LOAD_FAST fname
  LOAD_FAST has_header
  LOAD_FAST frow
  KW_NAMES ('fname', 'has_header', 'frow')
  CALL 3
  STORE_FAST obj
  LOAD_FAST obj
  LOAD_ATTR NULL|self + dsort
  LOAD_FAST order
  CALL 1
  POP_TOP
  LOAD_FAST obj
  LOAD_ATTR NULL|self + write
  LOAD_FAST ofname
  LOAD_FAST has_header
  LOAD_CONST False
  KW_NAMES ('fname', 'header', 'append')
  CALL 3
  POP_TOP
  RETURN_CONST None
END

def dsort(fname, order, has_header=True, frow=0, ofname=None):
    """pass"""
    ofname = fname if ofname is None else ofname
    obj = CsvFile(fname=fname, has_header=has_header, frow=frow)
    obj.dsort(order)
    obj.write(fname=ofname, header=has_header, append=False)


Input:
CODE <module>()
  DOC 'return'
  RESUME 0
  LOAD_CONST ('return', None)
  LOAD_CONST <code main>
  MAKE_FUNCTION annotations
  STORE_NAME main
  RETURN_CONST None
END
CODE main()
  DOC 'pass'
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_GLOBAL logging
  LOAD_ATTR NULL|self + basicConfig
  LOAD_GLOBAL logging
  LOAD_ATTR INFO
  KW_NAMES ('level',)
  CALL 1
  POP_TOP
  LOAD_GLOBAL NULL + ClientSession
  CALL 0
  BEFORE_ASYNC_WITH
  GET_AWAITABLE 1
  LOAD_CONST None
L2:
  SEND L5
L3:
  YIELD_VALUE 2
L4:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L2
L5:
  END_SEND
L6:
  STORE_FAST websession
L7:
  NOP
L8:
  LOAD_GLOBAL NULL + Client
  LOAD_FAST websession
  CALL 1
  STORE_FAST client
  LOAD_FAST client
  LOAD_ATTR user_reports
  LOAD_ATTR NULL|self + status_by_coordinates
  LOAD_GLOBAL LATITUDE
  LOAD_GLOBAL LONGITUDE
  CALL 2
  GET_AWAITABLE 0
  LOAD_CONST None
L9:
  SEND L12
L10:
  YIELD_VALUE 4
L11:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L9
L12:
  END_SEND
  STORE_FAST user_coord_resp
  LOAD_GLOBAL _LOGGER
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'User data by latitude/longitude (%s, %s): %s'
  LOAD_GLOBAL LATITUDE
  LOAD_GLOBAL LONGITUDE
  LOAD_FAST user_coord_resp
  CALL 4
  POP_TOP
  LOAD_FAST client
  LOAD_ATTR user_reports
  LOAD_ATTR NULL|self + status_by_zip
  LOAD_GLOBAL ZIP_CODE
  CALL 1
  GET_AWAITABLE 0
  LOAD_CONST None
L13:
  SEND L16
L14:
  YIELD_VALUE 4
L15:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L13
L16:
  END_SEND
  STORE_FAST user_zip_resp
  LOAD_GLOBAL _LOGGER
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'User data by ZIP code (%s): %s'
  LOAD_GLOBAL ZIP_CODE
  LOAD_FAST user_zip_resp
  CALL 3
  POP_TOP
  LOAD_FAST client
  LOAD_ATTR cdc_reports
  LOAD_ATTR NULL|self + status_by_coordinates
  LOAD_GLOBAL LATITUDE
  LOAD_GLOBAL LONGITUDE
  CALL 2
  GET_AWAITABLE 0
  LOAD_CONST None
L17:
  SEND L20
L18:
  YIELD_VALUE 4
L19:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L17
L20:
  END_SEND
  STORE_FAST cdc_coord_resp
  LOAD_GLOBAL _LOGGER
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'CDC data by latitude/longitude (%s, %s): %s'
  LOAD_GLOBAL LATITUDE
  LOAD_GLOBAL LONGITUDE
  LOAD_FAST cdc_coord_resp
  CALL 4
  POP_TOP
  LOAD_FAST client
  LOAD_ATTR cdc_reports
  LOAD_ATTR NULL|self + status_by_state
  LOAD_GLOBAL STATE
  CALL 1
  GET_AWAITABLE 0
  LOAD_CONST None
L21:
  SEND L24
L22:
  YIELD_VALUE 4
L23:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L21
L24:
  END_SEND
  STORE_FAST cdc_state_resp
  LOAD_GLOBAL _LOGGER
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'CDC data by state name (%s): %s'
  LOAD_GLOBAL STATE
  LOAD_FAST cdc_state_resp
  CALL 3
  POP_TOP
L25:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  GET_AWAITABLE 2
  LOAD_CONST None
L26:
  SEND L29
L27:
  YIELD_VALUE 2
L28:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L26
L29:
  END_SEND
  POP_TOP
  RETURN_CONST None
L30:
  CLEANUP_THROW
L31:
  EXTENDED_ARG 1
  JUMP_BACKWARD L5
L32:
  CLEANUP_THROW
L33:
  EXTENDED_ARG 1
  JUMP_BACKWARD L12
L34:
  CLEANUP_THROW
L35:
  JUMP_BACKWARD L16
L36:
  CLEANUP_THROW
L37:
  JUMP_BACKWARD L20
L38:
  CLEANUP_THROW
L39:
  JUMP_BACKWARD L24
L40:
  PUSH_EXC_INFO
  LOAD_GLOBAL FluNearYouError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L44
  STORE_FAST err
L41:
  LOAD_GLOBAL NULL + print
  LOAD_FAST err
  CALL 1
  POP_TOP
L42:
  POP_EXCEPT
  LOAD_CONST None
  STORE_FAST err
  DELETE_FAST err
  JUMP_BACKWARD L25
L43:
  LOAD_CONST None
  STORE_FAST err
  DELETE_FAST err
  RERAISE 1
L44:
  RERAISE 0
L45:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L46:
  CLEANUP_THROW
L47:
  JUMP_BACKWARD L29
L48:
  PUSH_EXC_INFO
  WITH_EXCEPT_START
  GET_AWAITABLE 2
  LOAD_CONST None
L49:
  SEND L53
L50:
  YIELD_VALUE 3
L51:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L49
L52:
  CLEANUP_THROW
L53:
  END_SEND
  POP_JUMP_IF_TRUE L54
  RERAISE 2
L54:
  POP_TOP
L55:
  POP_EXCEPT
  POP_TOP
  POP_TOP
  RETURN_CONST None
L56:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L57:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L3 -> handler=L57 depth=0 lasti=True
  EXC try=L3..L4 -> handler=L30 depth=3 lasti=False
  EXC try=L4..L6 -> handler=L57 depth=0 lasti=True
  EXC try=L6..L7 -> handler=L48 depth=1 lasti=True
  EXC try=L8..L10 -> handler=L40 depth=1 lasti=False
  EXC try=L10..L11 -> handler=L32 depth=3 lasti=False
  EXC try=L11..L14 -> handler=L40 depth=1 lasti=False
  EXC try=L14..L15 -> handler=L34 depth=3 lasti=False
  EXC try=L15..L18 -> handler=L40 depth=1 lasti=False
  EXC try=L18..L19 -> handler=L36 depth=3 lasti=False
  EXC try=L19..L22 -> handler=L40 depth=1 lasti=False
  EXC try=L22..L23 -> handler=L38 depth=3 lasti=False
  EXC try=L23..L25 -> handler=L40 depth=1 lasti=False
  EXC try=L25..L27 -> handler=L57 depth=0 lasti=True
  EXC try=L27..L28 -> handler=L46 depth=2 lasti=False
  EXC try=L28..L31 -> handler=L57 depth=0 lasti=True
  EXC try=L32..L33 -> handler=L40 depth=1 lasti=False
  EXC try=L34..L35 -> handler=L40 depth=1 lasti=False
  EXC try=L36..L37 -> handler=L40 depth=1 lasti=False
  EXC try=L38..L39 -> handler=L40 depth=1 lasti=False
  EXC try=L40..L41 -> handler=L45 depth=2 lasti=True
  EXC try=L41..L42 -> handler=L43 depth=2 lasti=True
  EXC try=L42..L43 -> handler=L48 depth=1 lasti=True
  EXC try=L43..L45 -> handler=L45 depth=2 lasti=True
  EXC try=L45..L46 -> handler=L48 depth=1 lasti=True
  EXC try=L46..L47 -> handler=L57 depth=0 lasti=True
  EXC try=L48..L50 -> handler=L56 depth=3 lasti=True
  EXC try=L50..L51 -> handler=L52 depth=6 lasti=False
  EXC try=L51..L55 -> handler=L56 depth=3 lasti=True
  EXC try=L55..L57 -> handler=L57 depth=0 lasti=True
END

async def main() -> None:
    """pass"""
    logging.basicConfig(level=logging.INFO)
    async with ClientSession() as websession:
        try:
            client = Client(websession)
            user_coord_resp = await client.user_reports.status_by_coordinates(LATITUDE, LONGITUDE)
            _LOGGER.info('User data by latitude/longitude (%s, %s): %s', LATITUDE, LONGITUDE, user_coord_resp)
            user_zip_resp = await client.user_reports.status_by_zip(ZIP_CODE)
            _LOGGER.info('User data by ZIP code (%s): %s', ZIP_CODE, user_zip_resp)
            cdc_coord_resp = await client.cdc_reports.status_by_coordinates(LATITUDE, LONGITUDE)
            _LOGGER.info('CDC data by latitude/longitude (%s, %s): %s', LATITUDE, LONGITUDE, cdc_coord_resp)
            cdc_state_resp = await client.cdc_reports.status_by_state(STATE)
            _LOGGER.info('CDC data by state name (%s): %s', STATE, cdc_state_resp)
        except FluNearYouError as err:
            print(err)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, 600)
  LOAD_CONST <code call>
  MAKE_FUNCTION defaults
  STORE_NAME call
  RETURN_CONST None
END
CODE call(cls, method, params, timeout)
  DOC 'pass'
  RESUME 0
  LOAD_FAST params
  POP_JUMP_IF_NOT_NONE L1
  BUILD_LIST 0
  JUMP_FORWARD L2
L1:
  LOAD_FAST params
L2:
  STORE_FAST params
  LOAD_FAST cls
  LOAD_ATTR NULL|self + make_request
  LOAD_GLOBAL SERVER_ADDRESS
  LOAD_FAST method
  LOAD_FAST params
  LOAD_FAST timeout
  KW_NAMES ('timeout',)
  CALL 4
  RETURN_VALUE
END

def call(cls, method, params=None, timeout=600):
    """pass"""
    params = [] if params is None else params
    return cls.make_request(SERVER_ADDRESS, method, params, timeout=timeout)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, None, True, True, 0, 0, None, None)
  LOAD_CONST <code concatenate>
  MAKE_FUNCTION defaults
  STORE_NAME concatenate
  RETURN_CONST None
END
CODE concatenate(fname1, fname2, dfilter1, dfilter2, has_header1, has_header2, frow1, frow2, ofname, ocols)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL pexdoc
  LOAD_ATTR exh
  LOAD_ATTR NULL|self + addex
  LOAD_GLOBAL RuntimeError
  LOAD_CONST 'Files have different number of columns'
  CALL 2
  STORE_FAST iro
  LOAD_GLOBAL pexdoc
  LOAD_ATTR exh
  LOAD_ATTR NULL|self + addex
  LOAD_GLOBAL RuntimeError
  LOAD_CONST 'Number of columns in data files and output columns are different'
  CALL 2
  STORE_FAST iom
  LOAD_GLOBAL NULL + CsvFile
  LOAD_FAST fname1
  LOAD_FAST dfilter1
  LOAD_FAST has_header1
  LOAD_FAST frow1
  KW_NAMES ('fname', 'dfilter', 'has_header', 'frow')
  CALL 4
  STORE_FAST obj1
  LOAD_GLOBAL NULL + CsvFile
  LOAD_FAST fname2
  LOAD_FAST dfilter2
  LOAD_FAST has_header2
  LOAD_FAST frow2
  KW_NAMES ('fname', 'dfilter', 'has_header', 'frow')
  CALL 4
  STORE_FAST obj2
  LOAD_FAST ofname
  POP_JUMP_IF_NOT_NONE L1
  LOAD_FAST fname1
  JUMP_FORWARD L2
L1:
  LOAD_FAST ofname
L2:
  STORE_FAST ofname
  LOAD_FAST ocols
  POP_JUMP_IF_NOT_NONE L5
  LOAD_FAST has_header1
  POP_JUMP_IF_FALSE L5
  LOAD_FAST obj1
  LOAD_ATTR cfilter
  POP_JUMP_IF_NOT_NONE L3
  LOAD_FAST obj1
  LOAD_ATTR NULL|self + header
  CALL 0
  BUILD_LIST 1
  JUMP_FORWARD L4
L3:
  LOAD_FAST obj1
  LOAD_ATTR cfilter
  BUILD_LIST 1
L4:
  STORE_FAST ocols
  JUMP_FORWARD L11
L5:
  LOAD_FAST ocols
  POP_JUMP_IF_NOT_NONE L8
  LOAD_FAST has_header2
  POP_JUMP_IF_FALSE L8
  LOAD_FAST obj2
  LOAD_ATTR cfilter
  POP_JUMP_IF_NOT_NONE L6
  LOAD_FAST obj2
  LOAD_ATTR NULL|self + header
  CALL 0
  BUILD_LIST 1
  JUMP_FORWARD L7
L6:
  LOAD_FAST obj2
  LOAD_ATTR cfilter
  BUILD_LIST 1
L7:
  STORE_FAST ocols
  JUMP_FORWARD L11
L8:
  LOAD_FAST ocols
  POP_JUMP_IF_NOT_NONE L9
  BUILD_LIST 0
  STORE_FAST ocols
  JUMP_FORWARD L11
L9:
  PUSH_NULL
  LOAD_FAST iom
  LOAD_FAST obj1
  LOAD_ATTR cfilter
  LOAD_CONST None
  IS_OP 1
  COPY 1
  POP_JUMP_IF_FALSE L10
  POP_TOP
  LOAD_GLOBAL NULL + len
  LOAD_FAST obj1
  LOAD_ATTR cfilter
  CALL 1
  LOAD_GLOBAL NULL + len
  LOAD_FAST ocols
  CALL 1
  COMPARE_OP !=
L10:
  CALL 1
  POP_TOP
  LOAD_FAST ocols
  BUILD_LIST 1
  STORE_FAST ocols
L11:
  PUSH_NULL
  LOAD_FAST iro
  LOAD_GLOBAL NULL + _C
  LOAD_FAST obj1
  LOAD_ATTR cfilter
  LOAD_FAST obj2
  LOAD_ATTR cfilter
  CALL 2
  COPY 1
  POP_JUMP_IF_FALSE L12
  POP_TOP
  LOAD_GLOBAL NULL + len
  LOAD_FAST obj1
  LOAD_ATTR cfilter
  CALL 1
  LOAD_GLOBAL NULL + len
  LOAD_FAST obj2
  LOAD_ATTR cfilter
  CALL 1
  COMPARE_OP !=
L12:
  CALL 1
  POP_TOP
  LOAD_FAST ocols
  LOAD_FAST obj1
  LOAD_ATTR NULL|self + data
  LOAD_CONST True
  KW_NAMES ('filtered',)
  CALL 1
  BINARY_OP +
  LOAD_FAST obj2
  LOAD_ATTR NULL|self + data
  LOAD_CONST True
  KW_NAMES ('filtered',)
  CALL 1
  BINARY_OP +
  STORE_FAST data
  LOAD_GLOBAL NULL + write
  LOAD_FAST ofname
  LOAD_FAST data
  LOAD_CONST False
  KW_NAMES ('fname', 'data', 'append')
  CALL 3
  POP_TOP
  RETURN_CONST None
END

def concatenate(fname1, fname2, dfilter1=None, dfilter2=None, has_header1=True, has_header2=True, frow1=0, frow2=0, ofname=None, ocols=None):
    """pass"""
    iro = pexdoc.exh.addex(RuntimeError, 'Files have different number of columns')
    iom = pexdoc.exh.addex(RuntimeError, 'Number of columns in data files and output columns are different')
    obj1 = CsvFile(fname=fname1, dfilter=dfilter1, has_header=has_header1, frow=frow1)
    obj2 = CsvFile(fname=fname2, dfilter=dfilter2, has_header=has_header2, frow=frow2)
    ofname = fname1 if ofname is None else ofname
    if ocols is None and has_header1:
        ocols = [obj1.header()] if obj1.cfilter is None else [obj1.cfilter]
    elif ocols is None and has_header2:
        ocols = [obj2.header()] if obj2.cfilter is None else [obj2.cfilter]
    elif ocols is None:
        ocols = []
    else:
        iom(obj1.cfilter is not None and len(obj1.cfilter) != len(ocols))
        ocols = [ocols]
    iro(_C(obj1.cfilter, obj2.cfilter) and len(obj1.cfilter) != len(obj2.cfilter))
    data = ocols + obj1.data(filtered=True) + obj2.data(filtered=True)
    write(fname=ofname, data=data, append=False)


Input:
CODE <module>()
  DOC 'GET'
  RESUME 0
  PUSH_NULL
  LOAD_NAME frozenset
  LOAD_CONST 'GET'
  BUILD_SET 1
  CALL 1
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST False
  LOAD_CONST None
  LOAD_CONST None
  BUILD_TUPLE 6
  LOAD_CONST <code resource>
  MAKE_FUNCTION defaults
  STORE_NAME resource
  RETURN_CONST None
END
CODE resource(self, uri, methods, host, strict_slashes, stream, version, name, **kwargs)
  DOC 'pass'
  MAKE_CELL self
  MAKE_CELL uri
  MAKE_CELL methods
  MAKE_CELL host
  MAKE_CELL strict_slashes
  MAKE_CELL stream
  MAKE_CELL version
  MAKE_CELL name
  MAKE_CELL kwargs
  RESUME 0
  LOAD_DEREF strict_slashes
  POP_JUMP_IF_NOT_NONE L1
  LOAD_DEREF self
  LOAD_ATTR strict_slashes
  STORE_DEREF strict_slashes
L1:
  LOAD_CLOSURE host
  LOAD_CLOSURE kwargs
  LOAD_CLOSURE methods
  LOAD_CLOSURE name
  LOAD_CLOSURE self
  LOAD_CLOSURE stream
  LOAD_CLOSURE strict_slashes
  LOAD_CLOSURE uri
  LOAD_CLOSURE version
  BUILD_TUPLE 9
  LOAD_CONST <code resource.<locals>.decorator>
  MAKE_FUNCTION closure
  STORE_FAST decorator
  LOAD_FAST decorator
  RETURN_VALUE
END
CODE resource.<locals>.decorator(handler)
  COPY_FREE_VARS 9
  RESUME 0
  LOAD_DEREF self
  LOAD_ATTR resources
  LOAD_ATTR NULL|self + append
  LOAD_GLOBAL NULL + FutureRoute
  LOAD_FAST handler
  LOAD_DEREF uri
  LOAD_DEREF methods
  LOAD_DEREF host
  LOAD_DEREF strict_slashes
  LOAD_DEREF stream
  LOAD_DEREF version
  LOAD_DEREF name
  CALL 8
  LOAD_DEREF kwargs
  BUILD_TUPLE 2
  CALL 1
  POP_TOP
  LOAD_FAST handler
  RETURN_VALUE
END

def resource(self, uri, methods=frozenset({'GET'}), host=None, strict_slashes=None, stream=False, version=None, name=None, **kwargs):
    """pass"""
    if strict_slashes is None:
        strict_slashes = self.strict_slashes

    def decorator(handler):
        self.resources.append((FutureRoute(handler, uri, methods, host, strict_slashes, stream, version, name), kwargs))
        return handler
    return decorator


Input:
CODE <module>()
  DOC 'GET'
  RESUME 0
  PUSH_NULL
  LOAD_NAME frozenset
  LOAD_CONST 'GET'
  BUILD_SET 1
  CALL 1
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  BUILD_TUPLE 5
  LOAD_CONST <code add_resource>
  MAKE_FUNCTION defaults
  STORE_NAME add_resource
  RETURN_CONST None
END
CODE add_resource(self, handler, uri, methods, host, strict_slashes, version, name, **kwargs)
  DOC 'pass'
  RESUME 0
  PUSH_NULL
  PUSH_NULL
  LOAD_FAST self
  LOAD_ATTR resource
  LOAD_CONST ()
  LOAD_FAST uri
  LOAD_FAST methods
  LOAD_FAST host
  LOAD_FAST strict_slashes
  LOAD_FAST version
  LOAD_FAST name
  LOAD_CONST ('uri', 'methods', 'host', 'strict_slashes', 'version', 'name')
  BUILD_CONST_KEY_MAP 6
  LOAD_FAST kwargs
  DICT_MERGE 1
  CALL_FUNCTION_EX 1
  LOAD_FAST handler
  CALL 1
  POP_TOP
  RETURN_CONST None
END

def add_resource(self, handler, uri, methods=frozenset({'GET'}), host=None, strict_slashes=None, version=None, name=None, **kwargs):
    """pass"""
    self.resource(uri=uri, methods=methods, host=host, strict_slashes=strict_slashes, version=version, name=name, **kwargs)(handler)


Input:
CODE <module>()
  DOC 'fn'
  RESUME 0
  LOAD_CONST 'fn'
  LOAD_NAME str
  LOAD_CONST 'return'
  LOAD_NAME Iterator
  LOAD_NAME InsertionPoint
  BINARY_SUBSCR
  BUILD_TUPLE 4
  LOAD_CONST <code in_file>
  MAKE_FUNCTION annotations
  STORE_NAME in_file
  RETURN_CONST None
END
CODE in_file(self, fn)
  DOC 'pass'
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + debug
  LOAD_CONST 'finding insertion points in file: %s'
  LOAD_FAST fn
  CALL 2
  POP_TOP
  LOAD_FAST self
  LOAD_ATTR __file_insertions
  LOAD_ATTR NULL|self + get
  LOAD_FAST fn
  BUILD_LIST 0
  CALL 2
  GET_YIELD_FROM_ITER
  LOAD_CONST None
L2:
  SEND L5
L3:
  YIELD_VALUE 2
L4:
  RESUME 2
  JUMP_BACKWARD_NO_INTERRUPT L2
L5:
  END_SEND
  POP_TOP
  RETURN_CONST None
L6:
  CLEANUP_THROW
L7:
  JUMP_BACKWARD L5
L8:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L3 -> handler=L8 depth=0 lasti=True
  EXC try=L3..L4 -> handler=L6 depth=2 lasti=False
  EXC try=L4..L7 -> handler=L8 depth=0 lasti=True
END

def in_file(self, fn: str) -> Iterator[InsertionPoint]:
    """pass"""
    logger.debug('finding insertion points in file: %s', fn)
    yield from self.__file_insertions.get(fn, [])


Input:
CODE <module>()
  DOC 'line'
  RESUME 0
  LOAD_CONST 'line'
  LOAD_NAME FileLine
  LOAD_CONST 'return'
  LOAD_NAME Iterator
  LOAD_NAME InsertionPoint
  BINARY_SUBSCR
  BUILD_TUPLE 4
  LOAD_CONST <code at_line>
  MAKE_FUNCTION annotations
  STORE_NAME at_line
  RETURN_CONST None
END
CODE at_line(self, line)
  DOC 'pass'
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + debug
  LOAD_CONST 'finding insertion points at line: %s'
  LOAD_GLOBAL NULL + str
  LOAD_FAST line
  CALL 1
  CALL 2
  POP_TOP
  LOAD_FAST line
  LOAD_ATTR filename
  STORE_FAST filename
  LOAD_FAST line
  LOAD_ATTR num
  STORE_FAST line_num
  LOAD_FAST self
  LOAD_ATTR NULL|self + in_file
  LOAD_FAST filename
  CALL 1
  GET_ITER
L2:
  FOR_ITER L5
  STORE_FAST ins
  LOAD_FAST line_num
  LOAD_FAST ins
  LOAD_ATTR location
  LOAD_ATTR line
  COMPARE_OP ==
  POP_JUMP_IF_TRUE L4
L3:
  JUMP_BACKWARD L2
L4:
  LOAD_GLOBAL logger
  LOAD_ATTR NULL|self + debug
  LOAD_CONST 'found insertion point at line [%s]: %s'
  LOAD_GLOBAL NULL + str
  LOAD_FAST line
  CALL 1
  LOAD_FAST ins
  CALL 3
  POP_TOP
  LOAD_FAST ins
  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..L3 -> handler=L6 depth=0 lasti=True
  EXC try=L4..L6 -> handler=L6 depth=0 lasti=True
END

def at_line(self, line: FileLine) -> Iterator[InsertionPoint]:
    """pass"""
    logger.debug('finding insertion points at line: %s', str(line))
    filename = line.filename
    line_num = line.num
    for ins in self.in_file(filename):
        if line_num == ins.location.line:
            logger.debug('found insertion point at line [%s]: %s', str(line), ins)
            yield ins


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _doAtomicFileCreation>
  MAKE_FUNCTION 0
  STORE_NAME _doAtomicFileCreation
  RETURN_CONST None
END
CODE _doAtomicFileCreation(filePath)
  DOC 'pass'
  RESUME 0
  NOP
L1:
  LOAD_GLOBAL _os
  LOAD_ATTR NULL|self + close
  LOAD_GLOBAL _os
  LOAD_ATTR NULL|self + open
  LOAD_FAST filePath
  LOAD_GLOBAL _os
  LOAD_ATTR O_CREAT
  LOAD_GLOBAL _os
  LOAD_ATTR O_EXCL
  BINARY_OP |
  CALL 2
  CALL 1
  POP_TOP
L2:
  RETURN_CONST True
L3:
  PUSH_EXC_INFO
  LOAD_GLOBAL OSError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L8
  STORE_FAST e
L4:
  LOAD_FAST e
  LOAD_ATTR errno
  LOAD_GLOBAL _errno
  LOAD_ATTR EEXIST
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L6
L5:
  POP_EXCEPT
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  RETURN_CONST False
L6:
  LOAD_FAST e
  RAISE_VARARGS 1
L7:
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  RERAISE 1
L8:
  RERAISE 0
L9:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L1..L2 -> handler=L3 depth=0 lasti=False
  EXC try=L3..L4 -> handler=L9 depth=1 lasti=True
  EXC try=L4..L5 -> handler=L7 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 _doAtomicFileCreation(filePath):
    """pass"""
    try:
        _os.close(_os.open(filePath, _os.O_CREAT | _os.O_EXCL))
        return True
    except OSError as e:
        if e.errno == _errno.EEXIST:
            return False
        else:
            raise e


Input:
CODE <module>()
  DOC '.'
  RESUME 0
  LOAD_CONST ('.', None, None, None, 0, 10)
  LOAD_CONST <code findNextFile>
  MAKE_FUNCTION defaults
  STORE_NAME findNextFile
  RETURN_CONST None
END
CODE findNextFile(folder, prefix, suffix, fnameGen, base, maxattempts)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL _os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + expanduser
  LOAD_GLOBAL _os
  LOAD_ATTR path
  LOAD_ATTR NULL|self + expandvars
  LOAD_FAST folder
  CALL 1
  CALL 1
  STORE_FAST expFolder
  LOAD_GLOBAL NULL + _findNextFile
  LOAD_FAST expFolder
  LOAD_FAST prefix
  LOAD_FAST suffix
  LOAD_FAST fnameGen
  LOAD_FAST base
  LOAD_FAST maxattempts
  LOAD_CONST 0
  CALL 7
  RETURN_VALUE
END

def findNextFile(folder='.', prefix=None, suffix=None, fnameGen=None, base=0, maxattempts=10):
    """pass"""
    expFolder = _os.path.expanduser(_os.path.expandvars(folder))
    return _findNextFile(expFolder, prefix, suffix, fnameGen, base, maxattempts, 0)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, None, None, None)
  LOAD_CONST <code _run>
  MAKE_FUNCTION defaults
  STORE_NAME _run
  RETURN_CONST None
END
CODE _run(passedArgs, stderr, stdout, exitFn)
  DOC 'pass'
  RESUME 0
  LOAD_CONST 'Finds the next available file-name in a sequence.\n\n    This program will create a file of zero size and will output the path to it\n    on STDOUT. No files which exist will be altered in this operation and\n    concurrent invocations of this program will return separate files. In case\n    of conflict, this program will attempt to generate a new file name up to\n    \'maxattempts\' number of times before failing. (See --max-attempts)\n\n    The sequence will start from the base argument (See --base, default: 0).\n\n    This program will look for the next file in the sequence ignoring any gaps.\n    Hence, if the files "a.0.txt" and "a.3.txt" exist, then the next file\n    returned will be "a.4.txt" when called with prefix="a." and suffix=".txt".\n\n    Returns:\n        Path of the file which follows the provided pattern and can be opened\n        for writing.\n\n        Otherwise, it prints an error (wrong path, drive full, illegal\n        character in filename, etc.) to stderr and exits with a non-zero error\n        code.\n    '
  STORE_FAST description
  LOAD_GLOBAL _argparse
  LOAD_ATTR NULL|self + ArgumentParser
  LOAD_FAST description
  LOAD_GLOBAL _argparse
  LOAD_ATTR RawTextHelpFormatter
  KW_NAMES ('description', 'formatter_class')
  CALL 2
  STORE_FAST argParser
  LOAD_FAST argParser
  LOAD_ATTR NULL|self + add_argument
  LOAD_CONST 'prefix'
  LOAD_CONST 'Prefix for the sequence of files.'
  KW_NAMES ('help',)
  CALL 2
  POP_TOP
  LOAD_FAST argParser
  LOAD_ATTR NULL|self + add_argument
  LOAD_CONST 'suffix'
  LOAD_CONST 'Suffix for the sequence of files.'
  LOAD_CONST '?'
  LOAD_CONST ''
  KW_NAMES ('help', 'nargs', 'default')
  CALL 4
  POP_TOP
  LOAD_FAST argParser
  LOAD_ATTR NULL|self + add_argument
  LOAD_CONST 'folder'
  LOAD_CONST 'The folder where the file will be created.'
  LOAD_CONST '?'
  LOAD_GLOBAL _os
  LOAD_ATTR NULL|self + getcwd
  CALL 0
  KW_NAMES ('help', 'nargs', 'default')
  CALL 4
  POP_TOP
  LOAD_FAST argParser
  LOAD_ATTR NULL|self + add_argument
  LOAD_CONST '-m'
  LOAD_CONST '--max-attempts'
  LOAD_CONST 'Number of attempts to make before giving up.'
  LOAD_CONST 10
  KW_NAMES ('help', 'default')
  CALL 4
  POP_TOP
  LOAD_FAST argParser
  LOAD_ATTR NULL|self + add_argument
  LOAD_CONST '-b'
  LOAD_CONST '--base'
  LOAD_CONST 'From where to start counting (default: 0).'
  LOAD_CONST 0
  KW_NAMES ('help', 'default')
  CALL 4
  POP_TOP
  LOAD_FAST passedArgs
  POP_JUMP_IF_NONE L1
  LOAD_FAST passedArgs
  JUMP_FORWARD L2
L1:
  LOAD_GLOBAL _sys
  LOAD_ATTR argv
  LOAD_CONST 1
  LOAD_CONST None
  BINARY_SLICE
L2:
  STORE_FAST passedArgs
  LOAD_FAST argParser
  LOAD_ATTR NULL|self + parse_args
  LOAD_FAST passedArgs
  CALL 1
  STORE_FAST args
  LOAD_FAST stdout
  POP_JUMP_IF_NOT_NONE L3
  LOAD_GLOBAL _sys
  LOAD_ATTR stdout
  JUMP_FORWARD L4
L3:
  LOAD_FAST stdout
L4:
  STORE_FAST stdout
  LOAD_FAST stderr
  POP_JUMP_IF_NOT_NONE L5
  LOAD_GLOBAL _sys
  LOAD_ATTR stderr
  JUMP_FORWARD L6
L5:
  LOAD_FAST stderr
L6:
  STORE_FAST stderr
  NOP
L7:
  LOAD_GLOBAL NULL + findNextFile
  LOAD_FAST args
  LOAD_ATTR folder
  LOAD_FAST args
  LOAD_ATTR prefix
  LOAD_FAST args
  LOAD_ATTR suffix
  LOAD_FAST args
  LOAD_ATTR max_attempts
  LOAD_FAST args
  LOAD_ATTR base
  KW_NAMES ('prefix', 'suffix', 'maxattempts', 'base')
  CALL 5
  STORE_FAST nextFile
  LOAD_FAST stdout
  LOAD_ATTR NULL|self + write
  LOAD_FAST nextFile
  LOAD_CONST '\n'
  BINARY_OP +
  CALL 1
  POP_TOP
L8:
  RETURN_CONST None
L9:
  PUSH_EXC_INFO
  LOAD_GLOBAL OSError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L13
  STORE_FAST e
L10:
  LOAD_FAST stderr
  LOAD_ATTR NULL|self + write
  LOAD_GLOBAL _os
  LOAD_ATTR NULL|self + strerror
  LOAD_FAST e
  LOAD_ATTR errno
  CALL 1
  LOAD_CONST '\n'
  BINARY_OP +
  CALL 1
  POP_TOP
  LOAD_GLOBAL _sys
  LOAD_ATTR NULL|self + exit
  LOAD_FAST e
  LOAD_ATTR errno
  CALL 1
  POP_TOP
L11:
  POP_EXCEPT
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  RETURN_CONST None
L12:
  LOAD_CONST None
  STORE_FAST e
  DELETE_FAST e
  RERAISE 1
L13:
  RERAISE 0
L14:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L7..L8 -> handler=L9 depth=0 lasti=False
  EXC try=L9..L10 -> handler=L14 depth=1 lasti=True
  EXC try=L10..L11 -> handler=L12 depth=1 lasti=True
  EXC try=L12..L14 -> handler=L14 depth=1 lasti=True
END

def _run(passedArgs=None, stderr=None, stdout=None, exitFn=None):
    """pass"""
    description = 'Finds the next available file-name in a sequence.\n\n    This program will create a file of zero size and will output the path to it\n    on STDOUT. No files which exist will be altered in this operation and\n    concurrent invocations of this program will return separate files. In case\n    of conflict, this program will attempt to generate a new file name up to\n    \'maxattempts\' number of times before failing. (See --max-attempts)\n\n    The sequence will start from the base argument (See --base, default: 0).\n\n    This program will look for the next file in the sequence ignoring any gaps.\n    Hence, if the files "a.0.txt" and "a.3.txt" exist, then the next file\n    returned will be "a.4.txt" when called with prefix="a." and suffix=".txt".\n\n    Returns:\n        Path of the file which follows the provided pattern and can be opened\n        for writing.\n\n        Otherwise, it prints an error (wrong path, drive full, illegal\n        character in filename, etc.) to stderr and exits with a non-zero error\n        code.\n    '
    argParser = _argparse.ArgumentParser(description=description, formatter_class=_argparse.RawTextHelpFormatter)
    argParser.add_argument('prefix', help='Prefix for the sequence of files.')
    argParser.add_argument('suffix', help='Suffix for the sequence of files.', nargs='?', default='')
    argParser.add_argument('folder', help='The folder where the file will be created.', nargs='?', default=_os.getcwd())
    argParser.add_argument('-m', '--max-attempts', help='Number of attempts to make before giving up.', default=10)
    argParser.add_argument('-b', '--base', help='From where to start counting (default: 0).', default=0)
    passedArgs = passedArgs if passedArgs is not None else _sys.argv[1:]
    args = argParser.parse_args(passedArgs)
    stdout = _sys.stdout if stdout is None else stdout
    stderr = _sys.stderr if stderr is None else stderr
    try:
        nextFile = findNextFile(args.folder, prefix=args.prefix, suffix=args.suffix, maxattempts=args.max_attempts, base=args.base)
        stdout.write(nextFile + u'\n')
    except OSError as e:
        stderr.write(_os.strerror(e.errno) + u'\n')
        _sys.exit(e.errno)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _errstr>
  MAKE_FUNCTION 0
  STORE_NAME _errstr
  RETURN_CONST None
END
CODE _errstr(value)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + str
  LOAD_FAST value
  CALL 1
  STORE_FAST value
  LOAD_GLOBAL NULL + len
  LOAD_FAST value
  CALL 1
  LOAD_GLOBAL MAX_ERROR_STR_LEN
  COMPARE_OP >
  POP_JUMP_IF_FALSE L1
  LOAD_FAST value
  LOAD_CONST None
  LOAD_GLOBAL MAX_ERROR_STR_LEN
  BINARY_SLICE
  LOAD_CONST '...'
  BINARY_OP +
  RETURN_VALUE
L1:
  LOAD_FAST value
  RETURN_VALUE
END

def _errstr(value):
    """pass"""
    value = str(value)
    if len(value) > MAX_ERROR_STR_LEN:
        return value[:MAX_ERROR_STR_LEN] + '...'
    else:
        return value


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _getStrippedValue>
  MAKE_FUNCTION 0
  STORE_NAME _getStrippedValue
  RETURN_CONST None
END
CODE _getStrippedValue(value, strip)
  DOC 'pass'
  RESUME 0
  LOAD_FAST strip
  POP_JUMP_IF_NOT_NONE L1
  LOAD_FAST value
  LOAD_ATTR NULL|self + strip
  CALL 0
  STORE_FAST value
  LOAD_FAST value
  RETURN_VALUE
L1:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST strip
  LOAD_GLOBAL str
  CALL 2
  POP_JUMP_IF_FALSE L2
  LOAD_FAST value
  LOAD_ATTR NULL|self + strip
  LOAD_FAST strip
  CALL 1
  STORE_FAST value
  LOAD_FAST value
  RETURN_VALUE
L2:
  LOAD_FAST strip
  LOAD_CONST False
  IS_OP 0
  POP_JUMP_IF_FALSE L3
  NOP
L3:
  LOAD_FAST value
  RETURN_VALUE
END

def _getStrippedValue(value, strip):
    """pass"""
    if strip is None:
        value = value.strip()
    elif isinstance(strip, str):
        value = value.strip(strip)
    elif strip is False:
        pass
    return value


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None,)
  LOAD_CONST <code _raiseValidationException>
  MAKE_FUNCTION defaults
  STORE_NAME _raiseValidationException
  RETURN_CONST None
END
CODE _raiseValidationException(standardExcMsg, customExcMsg)
  DOC 'pass'
  RESUME 0
  LOAD_FAST customExcMsg
  POP_JUMP_IF_NOT_NONE L1
  LOAD_GLOBAL NULL + ValidationException
  LOAD_GLOBAL NULL + str
  LOAD_FAST standardExcMsg
  CALL 1
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_GLOBAL NULL + ValidationException
  LOAD_GLOBAL NULL + str
  LOAD_FAST customExcMsg
  CALL 1
  CALL 1
  RAISE_VARARGS 1
END

def _raiseValidationException(standardExcMsg, customExcMsg=None):
    """pass"""
    if customExcMsg is None:
        raise ValidationException(str(standardExcMsg))
    else:
        raise ValidationException(str(customExcMsg))


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None,)
  LOAD_CONST <code _prevalidationCheck>
  MAKE_FUNCTION defaults
  STORE_NAME _prevalidationCheck
  RETURN_CONST None
END
CODE _prevalidationCheck(value, blank, strip, allowlistRegexes, blocklistRegexes, excMsg)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + str
  LOAD_FAST value
  CALL 1
  STORE_FAST value
  LOAD_GLOBAL NULL + _getStrippedValue
  LOAD_FAST value
  LOAD_FAST strip
  CALL 2
  STORE_FAST value
  LOAD_FAST blank
  POP_JUMP_IF_TRUE L1
  LOAD_FAST value
  LOAD_CONST ''
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + _raiseValidationException
  LOAD_GLOBAL NULL + _
  LOAD_CONST 'Blank values are not allowed.'
  CALL 1
  LOAD_FAST excMsg
  CALL 2
  POP_TOP
  JUMP_FORWARD L2
L1:
  LOAD_FAST blank
  POP_JUMP_IF_FALSE L2
  LOAD_FAST value
  LOAD_CONST ''
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L2
  LOAD_CONST True
  LOAD_FAST value
  BUILD_TUPLE 2
  RETURN_VALUE
L2:
  LOAD_FAST allowlistRegexes
  POP_JUMP_IF_NONE L8
  LOAD_FAST allowlistRegexes
  GET_ITER
L3:
  FOR_ITER L7
  STORE_FAST regex
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST regex
  LOAD_GLOBAL re
  LOAD_ATTR Pattern
  CALL 2
  POP_JUMP_IF_FALSE L5
  LOAD_FAST regex
  LOAD_ATTR NULL|self + search
  LOAD_FAST value
  LOAD_GLOBAL re
  LOAD_ATTR IGNORECASE
  CALL 2
  POP_JUMP_IF_NOT_NONE L4
  JUMP_BACKWARD L3
L4:
  LOAD_CONST True
  LOAD_FAST value
  BUILD_TUPLE 2
  SWAP 2
  POP_TOP
  RETURN_VALUE
L5:
  LOAD_GLOBAL re
  LOAD_ATTR NULL|self + search
  LOAD_FAST regex
  LOAD_FAST value
  LOAD_GLOBAL re
  LOAD_ATTR IGNORECASE
  CALL 3
  POP_JUMP_IF_NOT_NONE L6
  JUMP_BACKWARD L3
L6:
  LOAD_CONST True
  LOAD_FAST value
  BUILD_TUPLE 2
  SWAP 2
  POP_TOP
  RETURN_VALUE
L7:
  END_FOR
L8:
  LOAD_FAST blocklistRegexes
  POP_JUMP_IF_NONE L15
  LOAD_FAST blocklistRegexes
  GET_ITER
L9:
  FOR_ITER L14
  STORE_FAST blocklistRegexItem
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST blocklistRegexItem
  LOAD_GLOBAL str
  CALL 2
  POP_JUMP_IF_FALSE L10
  LOAD_FAST blocklistRegexItem
  LOAD_GLOBAL DEFAULT_BLOCKLIST_RESPONSE
  STORE_FAST response
  STORE_FAST regex
  JUMP_FORWARD L11
L10:
  LOAD_FAST blocklistRegexItem
  UNPACK_SEQUENCE 2
  STORE_FAST regex
  STORE_FAST response
L11:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST regex
  LOAD_GLOBAL re
  LOAD_ATTR Pattern
  CALL 2
  POP_JUMP_IF_FALSE L12
  LOAD_FAST regex
  LOAD_ATTR NULL|self + search
  LOAD_FAST value
  LOAD_GLOBAL re
  LOAD_ATTR IGNORECASE
  CALL 2
  POP_JUMP_IF_NONE L12
  LOAD_GLOBAL NULL + _raiseValidationException
  LOAD_FAST response
  LOAD_FAST excMsg
  CALL 2
  POP_TOP
  JUMP_BACKWARD L9
L12:
  LOAD_GLOBAL re
  LOAD_ATTR NULL|self + search
  LOAD_FAST regex
  LOAD_FAST value
  LOAD_GLOBAL re
  LOAD_ATTR IGNORECASE
  CALL 3
  POP_JUMP_IF_NOT_NONE L13
  JUMP_BACKWARD L9
L13:
  LOAD_GLOBAL NULL + _raiseValidationException
  LOAD_FAST response
  LOAD_FAST excMsg
  CALL 2
  POP_TOP
  JUMP_BACKWARD L9
L14:
  END_FOR
L15:
  LOAD_CONST False
  LOAD_FAST value
  BUILD_TUPLE 2
  RETURN_VALUE
END

def _prevalidationCheck(value, blank, strip, allowlistRegexes, blocklistRegexes, excMsg=None):
    """pass"""
    value = str(value)
    value = _getStrippedValue(value, strip)
    if not blank and value == '':
        _raiseValidationException(_('Blank values are not allowed.'), excMsg)
    elif blank and value == '':
        return (True, value)
    if allowlistRegexes is not None:
        for regex in allowlistRegexes:
            if isinstance(regex, re.Pattern):
                if regex.search(value, re.IGNORECASE) is not None:
                    return (True, value)
            elif re.search(regex, value, re.IGNORECASE) is not None:
                return (True, value)
    if blocklistRegexes is not None:
        for blocklistRegexItem in blocklistRegexes:
            if isinstance(blocklistRegexItem, str):
                regex, response = (blocklistRegexItem, DEFAULT_BLOCKLIST_RESPONSE)
            else:
                regex, response = blocklistRegexItem
            if isinstance(regex, re.Pattern) and regex.search(value, re.IGNORECASE) is not None:
                _raiseValidationException(response, excMsg)
            elif re.search(regex, value, re.IGNORECASE) is not None:
                _raiseValidationException(response, excMsg)
    return (False, value)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _validateGenericParameters>
  MAKE_FUNCTION 0
  STORE_NAME _validateGenericParameters
  RETURN_CONST None
END
CODE _validateGenericParameters(blank, strip, allowlistRegexes, blocklistRegexes)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST blank
  LOAD_GLOBAL bool
  CALL 2
  POP_JUMP_IF_TRUE L1
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'blank argument must be a bool'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST strip
  LOAD_GLOBAL bool
  LOAD_GLOBAL str
  LOAD_GLOBAL NULL + type
  LOAD_CONST None
  CALL 1
  BUILD_TUPLE 3
  CALL 2
  POP_JUMP_IF_TRUE L2
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'strip argument must be a bool, None, or str'
  CALL 1
  RAISE_VARARGS 1
L2:
  LOAD_FAST allowlistRegexes
  POP_JUMP_IF_NOT_NONE L3
  BUILD_LIST 0
  STORE_FAST allowlistRegexes
L3:
  NOP
L4:
  LOAD_GLOBAL NULL + len
  LOAD_FAST allowlistRegexes
  CALL 1
  POP_TOP
L5:
  LOAD_FAST allowlistRegexes
  GET_ITER
L6:
  FOR_ITER L8
  STORE_FAST response
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_GLOBAL str
  CALL 2
  POP_JUMP_IF_FALSE L7
  JUMP_BACKWARD L6
L7:
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'allowlistRegexes must be a sequence of regex_strs'
  CALL 1
  RAISE_VARARGS 1
L8:
  END_FOR
  LOAD_FAST blocklistRegexes
  POP_JUMP_IF_NOT_NONE L9
  BUILD_LIST 0
  STORE_FAST blocklistRegexes
L9:
  NOP
L10:
  LOAD_GLOBAL NULL + len
  LOAD_FAST blocklistRegexes
  CALL 1
  POP_TOP
L11:
  LOAD_FAST blocklistRegexes
  GET_ITER
L12:
  FOR_ITER L16
  STORE_FAST response
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL str
  CALL 2
  POP_JUMP_IF_FALSE L13
  JUMP_BACKWARD L12
L13:
  LOAD_GLOBAL NULL + len
  LOAD_FAST response
  CALL 1
  LOAD_CONST 2
  COMPARE_OP !=
  POP_JUMP_IF_FALSE L14
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs'
  CALL 1
  RAISE_VARARGS 1
L14:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_GLOBAL str
  CALL 2
  POP_JUMP_IF_FALSE L15
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_CONST 1
  BINARY_SUBSCR
  LOAD_GLOBAL str
  CALL 2
  POP_JUMP_IF_FALSE L15
  JUMP_BACKWARD L12
L15:
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs'
  CALL 1
  RAISE_VARARGS 1
L16:
  END_FOR
  RETURN_CONST None
L17:
  PUSH_EXC_INFO
  POP_TOP
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'allowlistRegexes must be a sequence of regex_strs'
  CALL 1
  RAISE_VARARGS 1
L18:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L19:
  PUSH_EXC_INFO
  POP_TOP
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs'
  CALL 1
  RAISE_VARARGS 1
L20:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L4..L5 -> handler=L17 depth=0 lasti=False
  EXC try=L10..L11 -> handler=L19 depth=0 lasti=False
  EXC try=L17..L18 -> handler=L18 depth=1 lasti=True
  EXC try=L19..L20 -> handler=L20 depth=1 lasti=True
END

def _validateGenericParameters(blank, strip, allowlistRegexes, blocklistRegexes):
    """pass"""
    if not isinstance(blank, bool):
        raise PySimpleValidateException('blank argument must be a bool')
    if not isinstance(strip, (bool, str, type(None))):
        raise PySimpleValidateException('strip argument must be a bool, None, or str')
    if allowlistRegexes is None:
        allowlistRegexes = []
    try:
        len(allowlistRegexes)
    except:
        raise PySimpleValidateException('allowlistRegexes must be a sequence of regex_strs')
    for response in allowlistRegexes:
        if not isinstance(response[0], str):
            raise PySimpleValidateException('allowlistRegexes must be a sequence of regex_strs')
    if blocklistRegexes is None:
        blocklistRegexes = []
    try:
        len(blocklistRegexes)
    except:
        raise PySimpleValidateException('blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs')
    for response in blocklistRegexes:
        if isinstance(response, str):
            continue
        if len(response) != 2:
            raise PySimpleValidateException('blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs')
        if not isinstance(response[0], str) or not isinstance(response[1], str):
            raise PySimpleValidateException('blocklistRegexes must be a sequence of (regex_str, str) tuples or regex_strs')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None, None, None, None)
  LOAD_CONST <code _validateParamsFor_validateNum>
  MAKE_FUNCTION defaults
  STORE_NAME _validateParamsFor_validateNum
  RETURN_CONST None
END
CODE _validateParamsFor_validateNum(min, max, lessThan, greaterThan)
  DOC 'pass'
  RESUME 0
  LOAD_FAST min
  POP_JUMP_IF_NONE L1
  LOAD_FAST greaterThan
  POP_JUMP_IF_NONE L1
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'only one argument for min or greaterThan can be passed, not both'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_FAST max
  POP_JUMP_IF_NONE L2
  LOAD_FAST lessThan
  POP_JUMP_IF_NONE L2
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'only one argument for max or lessThan can be passed, not both'
  CALL 1
  RAISE_VARARGS 1
L2:
  LOAD_FAST min
  POP_JUMP_IF_NONE L3
  LOAD_FAST max
  POP_JUMP_IF_NONE L3
  LOAD_FAST min
  LOAD_FAST max
  COMPARE_OP >
  POP_JUMP_IF_FALSE L3
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'the min argument must be less than or equal to the max argument'
  CALL 1
  RAISE_VARARGS 1
L3:
  LOAD_FAST min
  POP_JUMP_IF_NONE L4
  LOAD_FAST lessThan
  POP_JUMP_IF_NONE L4
  LOAD_FAST min
  LOAD_FAST lessThan
  COMPARE_OP >=
  POP_JUMP_IF_FALSE L4
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'the min argument must be less than the lessThan argument'
  CALL 1
  RAISE_VARARGS 1
L4:
  LOAD_FAST max
  POP_JUMP_IF_NONE L5
  LOAD_FAST greaterThan
  POP_JUMP_IF_NONE L5
  LOAD_FAST max
  LOAD_FAST greaterThan
  COMPARE_OP <=
  POP_JUMP_IF_FALSE L5
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_CONST 'the max argument must be greater than the greaterThan argument'
  CALL 1
  RAISE_VARARGS 1
L5:
  LOAD_CONST 'min'
  LOAD_FAST min
  BUILD_TUPLE 2
  LOAD_CONST 'max'
  LOAD_FAST max
  BUILD_TUPLE 2
  LOAD_CONST 'lessThan'
  LOAD_FAST lessThan
  BUILD_TUPLE 2
  LOAD_CONST 'greaterThan'
  LOAD_FAST greaterThan
  BUILD_TUPLE 2
  BUILD_TUPLE 4
  GET_ITER
L6:
  FOR_ITER L8
  UNPACK_SEQUENCE 2
  STORE_FAST name
  STORE_FAST val
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST val
  LOAD_GLOBAL int
  LOAD_GLOBAL float
  LOAD_GLOBAL NULL + type
  LOAD_CONST None
  CALL 1
  BUILD_TUPLE 3
  CALL 2
  POP_JUMP_IF_FALSE L7
  JUMP_BACKWARD L6
L7:
  LOAD_GLOBAL NULL + PySimpleValidateException
  LOAD_FAST name
  LOAD_CONST ' argument must be int, float, or NoneType'
  BINARY_OP +
  CALL 1
  RAISE_VARARGS 1
L8:
  END_FOR
  RETURN_CONST None
END

def _validateParamsFor_validateNum(min=None, max=None, lessThan=None, greaterThan=None):
    """pass"""
    if min is not None and greaterThan is not None:
        raise PySimpleValidateException('only one argument for min or greaterThan can be passed, not both')
    if max is not None and lessThan is not None:
        raise PySimpleValidateException('only one argument for max or lessThan can be passed, not both')
    if min is not None and max is not None and (min > max):
        raise PySimpleValidateException('the min argument must be less than or equal to the max argument')
    if min is not None and lessThan is not None and (min >= lessThan):
        raise PySimpleValidateException('the min argument must be less than the lessThan argument')
    if max is not None and greaterThan is not None and (max <= greaterThan):
        raise PySimpleValidateException('the max argument must be greater than the greaterThan argument')
    for name, val in (('min', min), ('max', max), ('lessThan', lessThan), ('greaterThan', greaterThan)):
        if not isinstance(val, (int, float, type(None))):
            raise PySimpleValidateException(name + ' argument must be int, float, or NoneType')


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code filter_transform_response>
  MAKE_FUNCTION 0
  STORE_NAME filter_transform_response
  RETURN_CONST None
END
CODE filter_transform_response(get_response, params)
  DOC 'pass'
  MAKE_CELL get_response
  RESUME 0
  LOAD_CLOSURE get_response
  BUILD_TUPLE 1
  LOAD_CONST <code filter_transform_response.<locals>.decorated_filter>
  MAKE_FUNCTION closure
  STORE_FAST decorated_filter
  LOAD_FAST decorated_filter
  RETURN_VALUE
END
CODE filter_transform_response.<locals>.decorated_filter(request, *args, **kwargs)
  COPY_FREE_VARS 1
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  PUSH_NULL
  LOAD_DEREF get_response
  LOAD_FAST request
  BUILD_LIST 1
  LOAD_FAST args
  LIST_EXTEND 1
  CALL_INTRINSIC_1 INTRINSIC_LIST_TO_TUPLE
  BUILD_MAP 0
  LOAD_FAST kwargs
  DICT_MERGE 1
  CALL_FUNCTION_EX 1
  GET_AWAITABLE 0
  LOAD_CONST None
L2:
  SEND L5
L3:
  YIELD_VALUE 2
L4:
  RESUME 3
  JUMP_BACKWARD_NO_INTERRUPT L2
L5:
  END_SEND
  STORE_FAST response
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL HTTPResponse
  CALL 2
  POP_JUMP_IF_FALSE L6
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL Response
  CALL 2
  POP_JUMP_IF_TRUE L6
  LOAD_FAST response
  RETURN_VALUE
L6:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST response
  LOAD_GLOBAL Response
  CALL 2
  POP_JUMP_IF_TRUE L7
  LOAD_GLOBAL NULL + Response
  LOAD_FAST response
  CALL 1
  STORE_FAST response
L7:
  LOAD_FAST response
  RETURN_VALUE
L8:
  CLEANUP_THROW
L9:
  JUMP_BACKWARD L5
L10:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L3 -> handler=L10 depth=0 lasti=True
  EXC try=L3..L4 -> handler=L8 depth=2 lasti=False
  EXC try=L4..L9 -> handler=L10 depth=0 lasti=True
END

def filter_transform_response(get_response, params):
    """pass"""

    async def decorated_filter(request, *args, **kwargs):
        response = await get_response(request, *args, **kwargs)
        if isinstance(response, HTTPResponse) and (not isinstance(response, Response)):
            return response
        if not isinstance(response, Response):
            response = Response(response)
        return response
    return decorated_filter


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (None,)
  LOAD_CONST <code initialize>
  MAKE_FUNCTION defaults
  STORE_NAME initialize
  RETURN_CONST None
END
CODE initialize(self, maxsize, history)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + super
  CALL 0
  LOAD_ATTR NULL|self + __init__
  CALL 0
  POP_TOP
  LOAD_GLOBAL NULL + int
  LOAD_FAST maxsize
  CALL 1
  LOAD_FAST self
  STORE_ATTR maxsize
  LOAD_GLOBAL NULL + deque
  LOAD_FAST self
  LOAD_ATTR maxsize
  KW_NAMES ('maxlen',)
  CALL 1
  LOAD_FAST self
  STORE_ATTR history
  LOAD_FAST history
  POP_JUMP_IF_NONE L3
  LOAD_FAST history
  GET_ITER
L1:
  FOR_ITER L2
  UNPACK_SEQUENCE 2
  STORE_FAST key
  STORE_FAST value
  LOAD_FAST self
  LOAD_ATTR NULL|self + insert
  LOAD_FAST key
  LOAD_FAST value
  CALL 2
  POP_TOP
  JUMP_BACKWARD L1
L2:
  END_FOR
  RETURN_CONST None
L3:
  RETURN_CONST None
END

def initialize(self, maxsize, history=None):
    """pass"""
    super().__init__()
    self.maxsize = int(maxsize)
    self.history = deque(maxlen=self.maxsize)
    if history is not None:
        for key, value in history:
            self.insert(key, value)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code insert>
  MAKE_FUNCTION 0
  STORE_NAME insert
  RETURN_CONST None
END
CODE insert(self, key, value)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + len
  LOAD_FAST self
  LOAD_ATTR history
  CALL 1
  LOAD_FAST self
  LOAD_ATTR maxsize
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L1
  LOAD_FAST self
  LOAD_ATTR history
  LOAD_CONST 0
  BINARY_SUBSCR
  STORE_FAST expectorate
  JUMP_FORWARD L2
L1:
  LOAD_CONST None
  STORE_FAST expectorate
L2:
  LOAD_FAST self
  LOAD_ATTR history
  LOAD_ATTR NULL|self + append
  LOAD_FAST key
  LOAD_FAST value
  BUILD_TUPLE 2
  CALL 1
  POP_TOP
  LOAD_FAST key
  LOAD_FAST self
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L3
  LOAD_GLOBAL NULL + super
  CALL 0
  LOAD_ATTR NULL|self + __getitem__
  LOAD_FAST key
  CALL 1
  LOAD_ATTR NULL|self + append
  LOAD_FAST value
  CALL 1
  POP_TOP
  JUMP_FORWARD L4
L3:
  LOAD_GLOBAL NULL + super
  CALL 0
  LOAD_ATTR NULL|self + __setitem__
  LOAD_FAST key
  LOAD_FAST value
  BUILD_LIST 1
  CALL 2
  POP_TOP
L4:
  LOAD_FAST expectorate
  POP_JUMP_IF_NONE L6
  LOAD_FAST expectorate
  UNPACK_SEQUENCE 2
  STORE_FAST old_key
  STORE_FAST old_value
  LOAD_GLOBAL NULL + super
  CALL 0
  LOAD_ATTR NULL|self + __getitem__
  LOAD_FAST old_key
  CALL 1
  LOAD_ATTR NULL|self + pop
  LOAD_CONST 0
  CALL 1
  POP_TOP
  LOAD_GLOBAL NULL + len
  LOAD_GLOBAL NULL + super
  CALL 0
  LOAD_ATTR NULL|self + __getitem__
  LOAD_FAST old_key
  CALL 1
  CALL 1
  LOAD_CONST 0
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L5
  LOAD_GLOBAL NULL + super
  CALL 0
  LOAD_ATTR NULL|self + __delitem__
  LOAD_FAST old_key
  CALL 1
  POP_TOP
L5:
  LOAD_FAST old_key
  LOAD_FAST old_value
  BUILD_TUPLE 2
  RETURN_VALUE
L6:
  RETURN_CONST None
END

def insert(self, key, value):
    """pass"""
    if len(self.history) == self.maxsize:
        expectorate = self.history[0]
    else:
        expectorate = None
    self.history.append((key, value))
    if key in self:
        super().__getitem__(key).append(value)
    else:
        super().__setitem__(key, [value])
    if expectorate is not None:
        old_key, old_value = expectorate
        super().__getitem__(old_key).pop(0)
        if len(super().__getitem__(old_key)) == 0:
            super().__delitem__(old_key)
        return (old_key, old_value)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code up_to>
  MAKE_FUNCTION 0
  STORE_NAME up_to
  RETURN_CONST None
END
CODE up_to(self, key)
  DOC 'pass'
  RETURN_GENERATOR
  POP_TOP
L1:
  RESUME 0
  LOAD_GLOBAL NULL + reversed
  LOAD_FAST self
  LOAD_ATTR history
  CALL 1
  GET_ITER
L2:
  FOR_ITER L4
  UNPACK_SEQUENCE 2
  STORE_FAST okey
  STORE_FAST ovalue
  LOAD_FAST okey
  LOAD_FAST key
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L3
  POP_TOP
  RETURN_CONST None
L3:
  LOAD_FAST ovalue
  YIELD_VALUE 1
  RESUME 1
  POP_TOP
  JUMP_BACKWARD L2
L4:
  END_FOR
  RETURN_CONST None
L5:
  CALL_INTRINSIC_1 INTRINSIC_STOPITERATION_ERROR
  RERAISE 1
  EXC try=L1..L5 -> handler=L5 depth=0 lasti=True
END

def up_to(self, key):
    """pass"""
    for okey, ovalue in reversed(self.history):
        if okey == key:
            break
        else:
            yield ovalue


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST None
  LOAD_NAME defaults
  LOAD_ATTR RADIUS
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  BUILD_TUPLE 5
  LOAD_CONST <code check>
  MAKE_FUNCTION defaults
  STORE_NAME check
  RETURN_CONST None
END
CODE check(session, rev_id, page_id, radius, before, window, rvprop)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + int
  LOAD_FAST rev_id
  CALL 1
  STORE_FAST rev_id
  LOAD_GLOBAL NULL + int
  LOAD_FAST radius
  CALL 1
  STORE_FAST radius
  LOAD_FAST radius
  LOAD_CONST 1
  COMPARE_OP <
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + TypeError
  LOAD_CONST 'invalid radius.  Expected a positive integer.'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_FAST page_id
  POP_JUMP_IF_NONE L2
  LOAD_GLOBAL NULL + int
  LOAD_FAST page_id
  CALL 1
  JUMP_FORWARD L3
L2:
  LOAD_CONST None
L3:
  STORE_FAST page_id
  LOAD_FAST before
  POP_JUMP_IF_NONE L4
  LOAD_GLOBAL NULL + Timestamp
  LOAD_FAST before
  CALL 1
  JUMP_FORWARD L5
L4:
  LOAD_CONST None
L5:
  STORE_FAST before
  LOAD_FAST rvprop
  POP_JUMP_IF_NONE L6
  LOAD_GLOBAL NULL + set
  LOAD_FAST rvprop
  CALL 1
  JUMP_FORWARD L7
L6:
  LOAD_GLOBAL NULL + set
  CALL 0
L7:
  STORE_FAST rvprop
  LOAD_FAST page_id
  POP_JUMP_IF_NOT_NONE L8
  LOAD_GLOBAL NULL + get_page_id
  LOAD_FAST session
  LOAD_FAST rev_id
  CALL 2
  STORE_FAST page_id
L8:
  LOAD_GLOBAL NULL + list
  LOAD_GLOBAL NULL + n_edits_before
  LOAD_FAST session
  LOAD_FAST rev_id
  LOAD_FAST page_id
  LOAD_FAST radius
  LOAD_CONST 1
  BINARY_OP +
  BUILD_SET 0
  LOAD_CONST frozenset({'sha1', 'timestamp', 'ids'})
  SET_UPDATE 1
  LOAD_FAST rvprop
  BINARY_OP |
  KW_NAMES ('n', 'rvprop')
  CALL 5
  CALL 1
  STORE_FAST current_and_past_revs
  LOAD_GLOBAL NULL + len
  LOAD_FAST current_and_past_revs
  CALL 1
  LOAD_CONST 1
  COMPARE_OP <
  POP_JUMP_IF_FALSE L9
  LOAD_GLOBAL NULL + KeyError
  LOAD_CONST 'Revision {0} not found in page {1}.'
  LOAD_ATTR NULL|self + format
  LOAD_FAST rev_id
  LOAD_FAST page_id
  CALL 2
  CALL 1
  RAISE_VARARGS 1
L9:
  LOAD_FAST current_and_past_revs
  LOAD_CONST -1
  BINARY_SUBSCR
  LOAD_FAST current_and_past_revs
  LOAD_CONST None
  LOAD_CONST -1
  BINARY_SLICE
  STORE_FAST past_revs
  STORE_FAST current_rev
  LOAD_FAST window
  POP_JUMP_IF_NONE L10
  LOAD_FAST before
  POP_JUMP_IF_NOT_NONE L10
  LOAD_GLOBAL NULL + Timestamp
  LOAD_FAST current_rev
  LOAD_CONST 'timestamp'
  BINARY_SUBSCR
  CALL 1
  LOAD_FAST window
  BINARY_OP +
  STORE_FAST before
L10:
  LOAD_GLOBAL NULL + list
  LOAD_GLOBAL NULL + n_edits_after
  LOAD_FAST session
  LOAD_FAST rev_id
  LOAD_CONST 1
  BINARY_OP +
  LOAD_FAST page_id
  LOAD_FAST radius
  LOAD_FAST before
  BUILD_SET 0
  LOAD_CONST frozenset({'sha1', 'timestamp', 'ids'})
  SET_UPDATE 1
  LOAD_FAST rvprop
  BINARY_OP |
  KW_NAMES ('n', 'timestamp', 'rvprop')
  CALL 6
  CALL 1
  STORE_FAST future_revs
  LOAD_GLOBAL NULL + build_revert_tuple
  LOAD_FAST rev_id
  LOAD_FAST past_revs
  LOAD_FAST current_rev
  LOAD_FAST future_revs
  LOAD_FAST radius
  CALL 5
  RETURN_VALUE
END

def check(session, rev_id, page_id=None, radius=defaults.RADIUS, before=None, window=None, rvprop=None):
    """pass"""
    rev_id = int(rev_id)
    radius = int(radius)
    if radius < 1:
        raise TypeError('invalid radius.  Expected a positive integer.')
    page_id = int(page_id) if page_id is not None else None
    before = Timestamp(before) if before is not None else None
    rvprop = set(rvprop) if rvprop is not None else set()
    if page_id is None:
        page_id = get_page_id(session, rev_id)
    current_and_past_revs = list(n_edits_before(session, rev_id, page_id, n=radius + 1, rvprop={'ids', 'timestamp', 'sha1'} | rvprop))
    if len(current_and_past_revs) < 1:
        raise KeyError('Revision {0} not found in page {1}.'.format(rev_id, page_id))
    current_rev, past_revs = (current_and_past_revs[-1], current_and_past_revs[:-1])
    if window is not None and before is None:
        before = Timestamp(current_rev['timestamp']) + window
    future_revs = list(n_edits_after(session, rev_id + 1, page_id, n=radius, timestamp=before, rvprop={'ids', 'timestamp', 'sha1'} | rvprop))
    return build_revert_tuple(rev_id, past_revs, current_rev, future_revs, radius)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST None
  LOAD_CONST None
  LOAD_NAME defaults
  LOAD_ATTR RADIUS
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  BUILD_TUPLE 6
  LOAD_CONST <code check_deleted>
  MAKE_FUNCTION defaults
  STORE_NAME check_deleted
  RETURN_CONST None
END
CODE check_deleted(session, rev_id, title, timestamp, radius, before, window, rvprop)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + int
  LOAD_FAST rev_id
  CALL 1
  STORE_FAST rev_id
  LOAD_GLOBAL NULL + int
  LOAD_FAST radius
  CALL 1
  STORE_FAST radius
  LOAD_FAST radius
  LOAD_CONST 1
  COMPARE_OP <
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + TypeError
  LOAD_CONST 'invalid radius.  Expected a positive integer.'
  CALL 1
  RAISE_VARARGS 1
L1:
  LOAD_FAST title
  POP_JUMP_IF_NONE L2
  LOAD_GLOBAL NULL + str
  LOAD_FAST title
  CALL 1
  JUMP_FORWARD L3
L2:
  LOAD_CONST None
L3:
  STORE_FAST title
  LOAD_FAST before
  POP_JUMP_IF_NONE L4
  LOAD_GLOBAL NULL + Timestamp
  LOAD_FAST before
  CALL 1
  JUMP_FORWARD L5
L4:
  LOAD_CONST None
L5:
  STORE_FAST before
  LOAD_FAST rvprop
  POP_JUMP_IF_NONE L6
  LOAD_GLOBAL NULL + set
  LOAD_FAST rvprop
  CALL 1
  JUMP_FORWARD L7
L6:
  LOAD_GLOBAL NULL + set
  CALL 0
L7:
  STORE_FAST rvprop
  LOAD_FAST title
  POP_JUMP_IF_NONE L8
  LOAD_FAST timestamp
  POP_JUMP_IF_NOT_NONE L9
L8:
  LOAD_GLOBAL NULL + get_deleted_title_and_timestamp
  LOAD_FAST session
  LOAD_FAST rev_id
  CALL 2
  UNPACK_SEQUENCE 2
  STORE_FAST title
  STORE_FAST timestamp
L9:
  LOAD_GLOBAL NULL + list
  LOAD_GLOBAL NULL + n_deleted_edits_before
  LOAD_FAST session
  LOAD_FAST rev_id
  LOAD_FAST title
  LOAD_FAST timestamp
  LOAD_FAST radius
  LOAD_CONST 1
  BINARY_OP +
  BUILD_SET 0
  LOAD_CONST frozenset({'sha1', 'timestamp', 'ids'})
  SET_UPDATE 1
  LOAD_FAST rvprop
  BINARY_OP |
  KW_NAMES ('n', 'rvprop')
  CALL 6
  CALL 1
  STORE_FAST current_and_past_revs
  LOAD_GLOBAL NULL + len
  LOAD_FAST current_and_past_revs
  CALL 1
  LOAD_CONST 1
  COMPARE_OP <
  POP_JUMP_IF_FALSE L10
  LOAD_GLOBAL NULL + KeyError
  LOAD_CONST 'Revision {0} not found in page {1}.'
  LOAD_ATTR NULL|self + format
  LOAD_FAST rev_id
  LOAD_FAST title
  CALL 2
  CALL 1
  RAISE_VARARGS 1
L10:
  LOAD_FAST current_and_past_revs
  LOAD_CONST -1
  BINARY_SUBSCR
  LOAD_FAST current_and_past_revs
  LOAD_CONST None
  LOAD_CONST -1
  BINARY_SLICE
  STORE_FAST past_revs
  STORE_FAST current_rev
  LOAD_FAST window
  POP_JUMP_IF_NONE L11
  LOAD_FAST before
  POP_JUMP_IF_NOT_NONE L11
  LOAD_GLOBAL NULL + Timestamp
  LOAD_FAST current_rev
  LOAD_CONST 'timestamp'
  BINARY_SUBSCR
  CALL 1
  LOAD_FAST window
  BINARY_OP +
  STORE_FAST before
L11:
  LOAD_GLOBAL NULL + list
  LOAD_GLOBAL NULL + n_deleted_edits_after
  LOAD_FAST session
  LOAD_FAST rev_id
  LOAD_CONST 1
  BINARY_OP +
  LOAD_FAST title
  LOAD_FAST timestamp
  LOAD_FAST radius
  LOAD_FAST before
  BUILD_SET 0
  LOAD_CONST frozenset({'sha1', 'timestamp', 'ids'})
  SET_UPDATE 1
  LOAD_FAST rvprop
  BINARY_OP |
  KW_NAMES ('n', 'before', 'rvprop')
  CALL 7
  CALL 1
  STORE_FAST future_revs
  LOAD_GLOBAL NULL + build_revert_tuple
  LOAD_FAST rev_id
  LOAD_FAST past_revs
  LOAD_FAST current_rev
  LOAD_FAST future_revs
  LOAD_FAST radius
  CALL 5
  RETURN_VALUE
END

def check_deleted(session, rev_id, title=None, timestamp=None, radius=defaults.RADIUS, before=None, window=None, rvprop=None):
    """pass"""
    rev_id = int(rev_id)
    radius = int(radius)
    if radius < 1:
        raise TypeError('invalid radius.  Expected a positive integer.')
    title = str(title) if title is not None else None
    before = Timestamp(before) if before is not None else None
    rvprop = set(rvprop) if rvprop is not None else set()
    if title is None or timestamp is None:
        title, timestamp = get_deleted_title_and_timestamp(session, rev_id)
    current_and_past_revs = list(n_deleted_edits_before(session, rev_id, title, timestamp, n=radius + 1, rvprop={'ids', 'timestamp', 'sha1'} | rvprop))
    if len(current_and_past_revs) < 1:
        raise KeyError('Revision {0} not found in page {1}.'.format(rev_id, title))
    current_rev, past_revs = (current_and_past_revs[-1], current_and_past_revs[:-1])
    if window is not None and before is None:
        before = Timestamp(current_rev['timestamp']) + window
    future_revs = list(n_deleted_edits_after(session, rev_id + 1, title, timestamp, n=radius, before=before, rvprop={'ids', 'timestamp', 'sha1'} | rvprop))
    return build_revert_tuple(rev_id, past_revs, current_rev, future_revs, radius)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST (True,)
  LOAD_CONST <code get_commits>
  MAKE_FUNCTION defaults
  STORE_NAME get_commits
  RETURN_CONST None
END
CODE get_commits(repo_dir, old_commit, new_commit, hide_merges)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + Repo
  LOAD_FAST repo_dir
  CALL 1
  STORE_FAST repo
  LOAD_FAST repo
  LOAD_ATTR NULL|self + iter_commits
  LOAD_CONST '{0}..{1}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST old_commit
  LOAD_FAST new_commit
  CALL 2
  KW_NAMES ('rev',)
  CALL 1
  STORE_FAST commits
  LOAD_FAST hide_merges
  POP_JUMP_IF_FALSE L7
  LOAD_FAST commits
  GET_ITER
  LOAD_FAST_AND_CLEAR x
  SWAP 2
L1:
  BUILD_LIST 0
  SWAP 2
L2:
  FOR_ITER L5
  STORE_FAST x
  LOAD_FAST x
  LOAD_ATTR summary
  LOAD_ATTR NULL|self + startswith
  LOAD_CONST 'Merge '
  CALL 1
  POP_JUMP_IF_FALSE L4
L3:
  JUMP_BACKWARD L2
L4:
  LOAD_FAST x
  LIST_APPEND 2
  JUMP_BACKWARD L2
L5:
  END_FOR
L6:
  SWAP 2
  STORE_FAST x
  RETURN_VALUE
L7:
  LOAD_GLOBAL NULL + list
  LOAD_FAST commits
  CALL 1
  RETURN_VALUE
L8:
  SWAP 2
  POP_TOP
  SWAP 2
  STORE_FAST x
  RERAISE 0
  EXC try=L1..L3 -> handler=L8 depth=2 lasti=False
  EXC try=L4..L6 -> handler=L8 depth=2 lasti=False
END

def get_commits(repo_dir, old_commit, new_commit, hide_merges=True):
    """pass"""
    repo = Repo(repo_dir)
    commits = repo.iter_commits(rev='{0}..{1}'.format(old_commit, new_commit))
    if hide_merges:
        return [x for x in commits if not x.summary.startswith('Merge ')]
    else:
        return list(commits)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code get_commit_url>
  MAKE_FUNCTION 0
  STORE_NAME get_commit_url
  RETURN_CONST None
END
CODE get_commit_url(repo_url)
  DOC 'pass'
  RESUME 0
  LOAD_CONST 'github.com'
  LOAD_FAST repo_url
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L2
  LOAD_FAST repo_url
  LOAD_ATTR NULL|self + endswith
  LOAD_CONST '.git'
  CALL 1
  POP_JUMP_IF_FALSE L1
  LOAD_FAST repo_url
  LOAD_CONST None
  LOAD_CONST -4
  BINARY_SLICE
  RETURN_VALUE
L1:
  LOAD_FAST repo_url
  RETURN_VALUE
L2:
  LOAD_CONST 'git.openstack.org'
  LOAD_FAST repo_url
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L3
  LOAD_CONST '/'
  LOAD_ATTR NULL|self + join
  LOAD_FAST repo_url
  LOAD_ATTR NULL|self + split
  LOAD_CONST '/'
  CALL 1
  LOAD_CONST -2
  LOAD_CONST None
  BINARY_SLICE
  CALL 1
  STORE_FAST uri
  LOAD_CONST 'https://github.com/{0}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST uri
  CALL 1
  RETURN_VALUE
L3:
  LOAD_FAST repo_url
  RETURN_VALUE
END

def get_commit_url(repo_url):
    """pass"""
    if 'github.com' in repo_url:
        return repo_url[:-4] if repo_url.endswith('.git') else repo_url
    if 'git.openstack.org' in repo_url:
        uri = '/'.join(repo_url.split('/')[-2:])
        return 'https://github.com/{0}'.format(uri)
    return repo_url


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code get_projects>
  MAKE_FUNCTION 0
  STORE_NAME get_projects
  RETURN_CONST None
END
CODE get_projects(osa_repo_dir, commit)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + Repo
  LOAD_FAST osa_repo_dir
  CALL 1
  STORE_FAST repo
  LOAD_GLOBAL NULL + checkout
  LOAD_FAST repo
  LOAD_FAST commit
  CALL 2
  POP_TOP
  LOAD_GLOBAL glob
  LOAD_ATTR NULL|self + glob
  LOAD_CONST '{0}/playbooks/defaults/repo_packages/*.yml'
  LOAD_ATTR NULL|self + format
  LOAD_FAST osa_repo_dir
  CALL 1
  CALL 1
  STORE_FAST yaml_files
  BUILD_LIST 0
  STORE_FAST yaml_parsed
  LOAD_FAST yaml_files
  GET_ITER
L1:
  FOR_ITER L4
  STORE_FAST yaml_file
  LOAD_GLOBAL NULL + open
  LOAD_FAST yaml_file
  LOAD_CONST 'r'
  CALL 2
  BEFORE_WITH
L2:
  STORE_FAST f
  LOAD_FAST yaml_parsed
  LOAD_ATTR NULL|self + append
  LOAD_GLOBAL yaml
  LOAD_ATTR NULL|self + load
  LOAD_FAST f
  CALL 1
  CALL 1
  POP_TOP
L3:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  JUMP_BACKWARD L1
L4:
  END_FOR
  LOAD_FAST yaml_parsed
  GET_ITER
  LOAD_FAST_AND_CLEAR d
  LOAD_FAST_AND_CLEAR k
  LOAD_FAST_AND_CLEAR v
  SWAP 4
L5:
  BUILD_MAP 0
  SWAP 2
L6:
  FOR_ITER L9
  STORE_FAST d
  LOAD_FAST d
  LOAD_ATTR NULL|self + items
  CALL 0
  GET_ITER
L7:
  FOR_ITER L8
  UNPACK_SEQUENCE 2
  STORE_FAST k
  STORE_FAST v
  LOAD_FAST k
  LOAD_FAST v
  MAP_ADD 3
  JUMP_BACKWARD L7
L8:
  END_FOR
  JUMP_BACKWARD L6
L9:
  END_FOR
L10:
  STORE_FAST merged_dicts
  STORE_FAST k
  STORE_FAST d
  STORE_FAST v
  LOAD_GLOBAL NULL + normalize_yaml
  LOAD_FAST merged_dicts
  CALL 1
  RETURN_VALUE
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 L1
L14:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L15:
  SWAP 2
  POP_TOP
  SWAP 4
  STORE_FAST v
  STORE_FAST k
  STORE_FAST d
  RERAISE 0
  EXC try=L2..L3 -> handler=L11 depth=2 lasti=True
  EXC try=L5..L10 -> handler=L15 depth=4 lasti=False
  EXC try=L11..L13 -> handler=L14 depth=4 lasti=True
END

def get_projects(osa_repo_dir, commit):
    """pass"""
    repo = Repo(osa_repo_dir)
    checkout(repo, commit)
    yaml_files = glob.glob('{0}/playbooks/defaults/repo_packages/*.yml'.format(osa_repo_dir))
    yaml_parsed = []
    for yaml_file in yaml_files:
        with open(yaml_file, 'r') as f:
            yaml_parsed.append(yaml.load(f))
    merged_dicts = {k: v for d in yaml_parsed for k, v in d.items()}
    return normalize_yaml(merged_dicts)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code checkout>
  MAKE_FUNCTION 0
  STORE_NAME checkout
  RETURN_CONST None
END
CODE checkout(repo, ref)
  DOC 'pass'
  RESUME 0
  LOAD_FAST ref
  LOAD_FAST repo
  LOAD_ATTR branches
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL log
  LOAD_ATTR NULL|self + warn
  LOAD_CONST 'Removing local branch {b} for repo {r}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST ref
  LOAD_FAST repo
  KW_NAMES ('b', 'r')
  CALL 2
  CALL 1
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR head
  LOAD_ATTR NULL|self + reset
  LOAD_CONST True
  LOAD_CONST True
  KW_NAMES ('index', 'working_tree')
  CALL 2
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR git
  LOAD_ATTR NULL|self + checkout
  LOAD_FAST repo
  LOAD_ATTR head
  LOAD_ATTR commit
  LOAD_ATTR hexsha
  CALL 1
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR NULL|self + delete_head
  LOAD_FAST ref
  LOAD_CONST '--force'
  CALL 2
  POP_TOP
L1:
  LOAD_GLOBAL log
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'Checkout out repo {repo} to ref {ref}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST repo
  LOAD_FAST ref
  KW_NAMES ('repo', 'ref')
  CALL 2
  CALL 1
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR head
  LOAD_ATTR NULL|self + reset
  LOAD_CONST True
  LOAD_CONST True
  KW_NAMES ('index', 'working_tree')
  CALL 2
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR git
  LOAD_ATTR NULL|self + checkout
  LOAD_FAST ref
  CALL 1
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR head
  LOAD_ATTR NULL|self + reset
  LOAD_CONST True
  LOAD_CONST True
  KW_NAMES ('index', 'working_tree')
  CALL 2
  POP_TOP
  LOAD_FAST repo
  LOAD_ATTR head
  LOAD_ATTR commit
  LOAD_ATTR hexsha
  STORE_FAST sha
  LOAD_GLOBAL log
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'Current SHA for repo {repo} is {sha}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST repo
  LOAD_FAST sha
  KW_NAMES ('repo', 'sha')
  CALL 2
  CALL 1
  POP_TOP
  RETURN_CONST None
END

def checkout(repo, ref):
    """pass"""
    if ref in repo.branches:
        log.warn('Removing local branch {b} for repo {r}'.format(b=ref, r=repo))
        repo.head.reset(index=True, working_tree=True)
        repo.git.checkout(repo.head.commit.hexsha)
        repo.delete_head(ref, '--force')
    log.info('Checkout out repo {repo} to ref {ref}'.format(repo=repo, ref=ref))
    repo.head.reset(index=True, working_tree=True)
    repo.git.checkout(ref)
    repo.head.reset(index=True, working_tree=True)
    sha = repo.head.commit.hexsha
    log.info('Current SHA for repo {repo} is {sha}'.format(repo=repo, sha=sha))


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code get_roles>
  MAKE_FUNCTION 0
  STORE_NAME get_roles
  RETURN_CONST None
END
CODE get_roles(osa_repo_dir, commit, role_requirements)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + Repo
  LOAD_FAST osa_repo_dir
  CALL 1
  STORE_FAST repo
  LOAD_GLOBAL NULL + checkout
  LOAD_FAST repo
  LOAD_FAST commit
  CALL 2
  POP_TOP
  LOAD_GLOBAL log
  LOAD_ATTR NULL|self + info
  LOAD_CONST 'Looking for file {f} in repo {r}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST osa_repo_dir
  LOAD_FAST role_requirements
  KW_NAMES ('r', 'f')
  CALL 2
  CALL 1
  POP_TOP
  LOAD_CONST '{0}/{1}'
  LOAD_ATTR NULL|self + format
  LOAD_FAST osa_repo_dir
  LOAD_FAST role_requirements
  CALL 2
  STORE_FAST filename
  LOAD_GLOBAL NULL + open
  LOAD_FAST filename
  LOAD_CONST 'r'
  CALL 2
  BEFORE_WITH
L1:
  STORE_FAST f
  LOAD_GLOBAL yaml
  LOAD_ATTR NULL|self + load
  LOAD_FAST f
  CALL 1
  STORE_FAST roles_yaml
L2:
  LOAD_CONST None
  LOAD_CONST None
  LOAD_CONST None
  CALL 2
  POP_TOP
  LOAD_GLOBAL NULL + normalize_yaml
  LOAD_FAST roles_yaml
  CALL 1
  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
  LOAD_GLOBAL NULL + normalize_yaml
  LOAD_FAST_CHECK roles_yaml
  CALL 1
  RETURN_VALUE
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_roles(osa_repo_dir, commit, role_requirements):
    """pass"""
    repo = Repo(osa_repo_dir)
    checkout(repo, commit)
    log.info('Looking for file {f} in repo {r}'.format(r=osa_repo_dir, f=role_requirements))
    filename = '{0}/{1}'.format(osa_repo_dir, role_requirements)
    with open(filename, 'r') as f:
        roles_yaml = yaml.load(f)
    return normalize_yaml(roles_yaml)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code make_osa_report>
  MAKE_FUNCTION 0
  STORE_NAME make_osa_report
  RETURN_CONST None
END
CODE make_osa_report(repo_dir, old_commit, new_commit, args)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + update_repo
  LOAD_FAST repo_dir
  LOAD_FAST args
  LOAD_ATTR osa_repo_url
  LOAD_FAST args
  LOAD_ATTR update
  CALL 3
  POP_TOP
  LOAD_GLOBAL NULL + validate_commits
  LOAD_FAST repo_dir
  LOAD_FAST old_commit
  LOAD_FAST new_commit
  BUILD_LIST 2
  CALL 2
  POP_TOP
  LOAD_GLOBAL NULL + validate_commit_range
  LOAD_FAST repo_dir
  LOAD_FAST old_commit
  LOAD_FAST new_commit
  CALL 3
  POP_TOP
  LOAD_GLOBAL NULL + get_commits
  LOAD_FAST repo_dir
  LOAD_FAST old_commit
  LOAD_FAST new_commit
  CALL 3
  STORE_FAST commits
  LOAD_FAST args
  LOAD_CONST 'openstack-ansible'
  LOAD_FAST commits
  LOAD_GLOBAL NULL + get_commit_url
  LOAD_FAST args
  LOAD_ATTR osa_repo_url
  CALL 1
  LOAD_FAST old_commit
  LOAD_FAST new_commit
  LOAD_CONST ('args', 'repo', 'commits', 'commit_base_url', 'old_sha', 'new_sha')
  BUILD_CONST_KEY_MAP 6
  STORE_FAST template_vars
  LOAD_GLOBAL NULL + render_template
  LOAD_CONST 'offline-header.j2'
  LOAD_FAST template_vars
  CALL 2
  RETURN_VALUE
END

def make_osa_report(repo_dir, old_commit, new_commit, args):
    """pass"""
    update_repo(repo_dir, args.osa_repo_url, args.update)
    validate_commits(repo_dir, [old_commit, new_commit])
    validate_commit_range(repo_dir, old_commit, new_commit)
    commits = get_commits(repo_dir, old_commit, new_commit)
    template_vars = {'args': args, 'repo': 'openstack-ansible', 'commits': commits, 'commit_base_url': get_commit_url(args.osa_repo_url), 'old_sha': old_commit, 'new_sha': new_commit}
    return render_template('offline-header.j2', template_vars)


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _homogenize_data_filter>
  MAKE_FUNCTION 0
  STORE_NAME _homogenize_data_filter
  RETURN_CONST None
END
CODE _homogenize_data_filter(dfilter)
  DOC 'pass'
  RESUME 0
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_GLOBAL tuple
  CALL 2
  POP_JUMP_IF_FALSE L1
  LOAD_GLOBAL NULL + len
  LOAD_FAST dfilter
  CALL 1
  LOAD_CONST 1
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L1
  LOAD_FAST dfilter
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_CONST None
  BUILD_TUPLE 2
  STORE_FAST dfilter
L1:
  LOAD_FAST dfilter
  POP_JUMP_IF_NONE L2
  LOAD_FAST dfilter
  LOAD_CONST (None, None)
  COMPARE_OP ==
  POP_JUMP_IF_TRUE L2
  LOAD_FAST dfilter
  LOAD_CONST (None,)
  COMPARE_OP ==
  POP_JUMP_IF_FALSE L3
L2:
  LOAD_CONST (None, None)
  STORE_FAST dfilter
  LOAD_FAST dfilter
  RETURN_VALUE
L3:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_GLOBAL dict
  CALL 2
  POP_JUMP_IF_FALSE L4
  LOAD_FAST dfilter
  LOAD_CONST None
  BUILD_TUPLE 2
  STORE_FAST dfilter
  LOAD_FAST dfilter
  RETURN_VALUE
L4:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_GLOBAL list
  LOAD_GLOBAL str
  BUILD_TUPLE 2
  CALL 2
  POP_JUMP_IF_TRUE L5
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_GLOBAL int
  CALL 2
  POP_JUMP_IF_FALSE L7
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_GLOBAL bool
  CALL 2
  POP_JUMP_IF_TRUE L7
L5:
  LOAD_CONST None
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_GLOBAL list
  CALL 2
  POP_JUMP_IF_FALSE L6
  LOAD_FAST dfilter
  BUILD_TUPLE 2
  STORE_FAST dfilter
  LOAD_FAST dfilter
  RETURN_VALUE
L6:
  LOAD_FAST dfilter
  BUILD_LIST 1
  BUILD_TUPLE 2
  STORE_FAST dfilter
  LOAD_FAST dfilter
  RETURN_VALUE
L7:
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_CONST 0
  BINARY_SUBSCR
  LOAD_GLOBAL dict
  CALL 2
  POP_JUMP_IF_TRUE L8
  LOAD_FAST dfilter
  LOAD_CONST 0
  BINARY_SUBSCR
  POP_JUMP_IF_NOT_NONE L9
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST dfilter
  LOAD_CONST 1
  BINARY_SUBSCR
  LOAD_GLOBAL dict
  CALL 2
  POP_JUMP_IF_TRUE L9
L8:
  NOP
  LOAD_FAST dfilter
  RETURN_VALUE
L9:
  LOAD_FAST dfilter
  LOAD_CONST 1
  BINARY_SUBSCR
  LOAD_FAST dfilter
  LOAD_CONST 0
  BINARY_SUBSCR
  BUILD_TUPLE 2
  STORE_FAST dfilter
  LOAD_FAST dfilter
  RETURN_VALUE
END

def _homogenize_data_filter(dfilter):
    """pass"""
    if isinstance(dfilter, tuple) and len(dfilter) == 1:
        dfilter = (dfilter[0], None)
    if dfilter is None or dfilter == (None, None) or dfilter == (None,):
        dfilter = (None, None)
    elif isinstance(dfilter, dict):
        dfilter = (dfilter, None)
    elif isinstance(dfilter, (list, str)) or (isinstance(dfilter, int) and (not isinstance(dfilter, bool))):
        dfilter = (None, dfilter if isinstance(dfilter, list) else [dfilter])
    elif isinstance(dfilter[0], dict) or (dfilter[0] is None and (not isinstance(dfilter[1], dict))):
        pass
    else:
        dfilter = (dfilter[1], dfilter[0])
    return dfilter


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _tofloat>
  MAKE_FUNCTION 0
  STORE_NAME _tofloat
  RETURN_CONST None
END
CODE _tofloat(obj)
  DOC 'pass'
  RESUME 0
  LOAD_CONST 'inf'
  LOAD_FAST obj
  LOAD_ATTR NULL|self + lower
  CALL 0
  LOAD_ATTR NULL|self + strip
  CALL 0
  CONTAINS_OP 0
  POP_JUMP_IF_FALSE L1
  LOAD_FAST obj
  RETURN_VALUE
L1:
  NOP
L2:
  LOAD_GLOBAL NULL + int
  LOAD_FAST obj
  CALL 1
L3:
  RETURN_VALUE
L4:
  PUSH_EXC_INFO
  LOAD_GLOBAL ValueError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L14
  POP_TOP
L5:
  NOP
L6:
  LOAD_GLOBAL NULL + float
  LOAD_FAST obj
  CALL 1
L7:
  SWAP 2
L8:
  POP_EXCEPT
  RETURN_VALUE
L9:
  PUSH_EXC_INFO
  LOAD_GLOBAL ValueError
  CHECK_EXC_MATCH
  POP_JUMP_IF_FALSE L12
  POP_TOP
  LOAD_FAST obj
  SWAP 2
L10:
  POP_EXCEPT
  SWAP 2
L11:
  POP_EXCEPT
  RETURN_VALUE
L12:
  RERAISE 0
L13:
  COPY 3
  POP_EXCEPT
  RERAISE 1
L14:
  RERAISE 0
L15:
  COPY 3
  POP_EXCEPT
  RERAISE 1
  EXC try=L2..L3 -> handler=L4 depth=0 lasti=False
  EXC try=L4..L5 -> handler=L15 depth=1 lasti=True
  EXC try=L6..L7 -> handler=L9 depth=1 lasti=False
  EXC try=L7..L8 -> handler=L15 depth=1 lasti=True
  EXC try=L9..L10 -> handler=L13 depth=2 lasti=True
  EXC try=L10..L11 -> handler=L15 depth=1 lasti=True
  EXC try=L12..L13 -> handler=L13 depth=2 lasti=True
  EXC try=L13..L15 -> handler=L15 depth=1 lasti=True
END

def _tofloat(obj):
    """pass"""
    if 'inf' in obj.lower().strip():
        return obj
    try:
        return int(obj)
    except ValueError:
        try:
            return float(obj)
        except ValueError:
            return obj


Input:
CODE <module>()
  RESUME 0
  LOAD_CONST <code _in_header>
  MAKE_FUNCTION 0
  STORE_NAME _in_header
  RETURN_CONST None
END
CODE _in_header(self, col)
  DOC 'pass'
  RESUME 0
  LOAD_FAST self
  LOAD_ATTR _has_header
  POP_JUMP_IF_TRUE L1
  LOAD_GLOBAL pexdoc
  LOAD_ATTR exh
  LOAD_ATTR NULL|self + addex
  LOAD_GLOBAL RuntimeError
  LOAD_CONST 'Invalid column specification'
  CALL 2
  STORE_FAST icol_ex
L1:
  LOAD_GLOBAL pexdoc
  LOAD_ATTR exh
  LOAD_ATTR NULL|self + addex
  LOAD_GLOBAL ValueError
  LOAD_CONST 'Column *[column_identifier]* not found'
  CALL 2
  STORE_FAST hnf_ex
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST col
  LOAD_GLOBAL str
  LOAD_GLOBAL int
  BUILD_TUPLE 2
  CALL 2
  POP_JUMP_IF_FALSE L2
  LOAD_FAST col
  BUILD_LIST 1
  JUMP_FORWARD L3
L2:
  LOAD_FAST col
L3:
  STORE_FAST col_list
  LOAD_FAST col_list
  GET_ITER
L4:
  FOR_ITER L9
  STORE_FAST col
  LOAD_CONST 'column_identifier'
  LOAD_FAST col
  LOAD_CONST ('field', 'value')
  BUILD_CONST_KEY_MAP 2
  STORE_FAST edata
  LOAD_FAST self
  LOAD_ATTR _has_header
  POP_JUMP_IF_TRUE L6
  PUSH_NULL
  LOAD_FAST_CHECK icol_ex
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST col
  LOAD_GLOBAL int
  CALL 2
  UNARY_NOT
  CALL 1
  POP_TOP
  PUSH_NULL
  LOAD_FAST hnf_ex
  LOAD_FAST col
  LOAD_CONST 0
  COMPARE_OP <
  COPY 1
  POP_JUMP_IF_TRUE L5
  POP_TOP
  LOAD_FAST col
  LOAD_GLOBAL NULL + len
  LOAD_FAST self
  LOAD_ATTR _header
  CALL 1
  LOAD_CONST 1
  BINARY_OP -
  COMPARE_OP >
L5:
  LOAD_FAST edata
  CALL 2
  POP_TOP
  JUMP_BACKWARD L4
L6:
  PUSH_NULL
  LOAD_FAST hnf_ex
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST col
  LOAD_GLOBAL int
  CALL 2
  COPY 1
  POP_JUMP_IF_FALSE L7
  POP_TOP
  LOAD_FAST col
  LOAD_CONST 0
  COMPARE_OP <
  COPY 1
  POP_JUMP_IF_TRUE L7
  POP_TOP
  LOAD_FAST col
  LOAD_FAST self
  LOAD_ATTR _data_cols
  COMPARE_OP >
L7:
  COPY 1
  POP_JUMP_IF_TRUE L8
  POP_TOP
  LOAD_GLOBAL NULL + isinstance
  LOAD_FAST col
  LOAD_GLOBAL str
  CALL 2
  COPY 1
  POP_JUMP_IF_FALSE L8
  POP_TOP
  LOAD_FAST col
  LOAD_ATTR NULL|self + upper
  CALL 0
  LOAD_FAST self
  LOAD_ATTR _header_upper
  CONTAINS_OP 1
L8:
  LOAD_FAST edata
  CALL 2
  POP_TOP
  JUMP_BACKWARD L4
L9:
  END_FOR
  LOAD_FAST col_list
  RETURN_VALUE
END

def _in_header(self, col):
    """pass"""
    if not self._has_header:
        icol_ex = pexdoc.exh.addex(RuntimeError, 'Invalid column specification')
    hnf_ex = pexdoc.exh.addex(ValueError, 'Column *[column_identifier]* not found')
    col_list = [col] if isinstance(col, (str, int)) else col
    for col in col_list:
        edata = {'field': 'column_identifier', 'value': col}
        if not self._has_header:
            icol_ex(not isinstance(col, int))
            hnf_ex(col < 0 or col > len(self._header) - 1, edata)
        else:
            hnf_ex(isinstance(col, int) and (col < 0 or col > self._data_cols) or (isinstance(col, str) and col.upper() not in self._header_upper), edata)
    return col_list