def test_rfc_datetime_field_deserialization(self, fmt, value, expected, aware):
        field = fields.DateTime(format=fmt)
        assert field.deserialize(value) == expected
        field = fields.NaiveDateTime(format=fmt)
        if aware:
            with pytest.raises(ValidationError, match="Not a valid naive datetime."):
                field.deserialize(value)
        else:
            assert field.deserialize(value) == expected
        field = fields.AwareDateTime(format=fmt)
        if not aware:
            with pytest.raises(ValidationError, match="Not a valid aware datetime."):
                field.deserialize(value)
        else:
            assert field.deserialize(value) == expected
test_rfc_datetime_field_deserialization(self=<tests.test_deserialization.TestFieldDeserialization object at 0x7f27f99854f0>, fmt='rfc', value='Sun, 10 Nov 2013 01:23:45 -0000', expected=datetime.datetime(2013, 11, 10, 1, 23, 45), aware=False)

<fields.DateTime(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid {obj_type}.', 'invalid_awareness': 'Not a valid {awareness} {obj_type}.', 'format': '"{input}" cannot be formatted as a {obj_type}.'})>

<fields.NaiveDateTime(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid {obj_type}.', 'invalid_awareness': 'Not a valid {awareness} {obj_type}.', 'format': '"{input}" cannot be formatted as a {obj_type}.'})>

<fields.AwareDateTime(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid {obj_type}.', 'invalid_awareness': 'Not a valid {awareness} {obj_type}.', 'format': '"{input}" cannot be formatted as a {obj_type}.'})>


assert field.deserialize(value) == expected


<fields.NaiveDateTime(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid {obj_type}.', 'invalid_awareness': 'Not a valid {awareness} {obj_type}.', 'format': '"{input}" cannot be formatted as a {obj_type}.'})>


<fields.AwareDateTime(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid {obj_type}.', 'invalid_awareness': 'Not a valid {awareness} {obj_type}.', 'format': '"{input}" cannot be formatted as a {obj_type}.'})>


def test_iso_datetime_field_deserialization(self, fmt, value, expected, aware):
        field = fields.DateTime(format=fmt)
        assert field.deserialize(value) == expected
        field = fields.NaiveDateTime(format=fmt)
        if aware:
            with pytest.raises(ValidationError, match="Not a valid naive datetime."):
                field.deserialize(value)
        else:
            assert field.deserialize(value) == expected
        field = fields.AwareDateTime(format=fmt)
        if not aware:
            with pytest.raises(ValidationError, match="Not a valid aware datetime."):
                field.deserialize(value)
        else:
            assert field.deserialize(value) == expected
test_iso_datetime_field_deserialization(self=<tests.test_deserialization.TestFieldDeserialization object at 0x7f27f99c1b80>, fmt='iso', value='2013-11-10T01:23:45', expected=datetime.datetime(2013, 11, 10, 1, 23, 45), aware=False)


def test_timestamp_field_deserialization(self, fmt, value, expected):
        field = fields.DateTime(format=fmt)
        assert field.deserialize(value) == expected
        field = fields.NaiveDateTime(format=fmt)
        assert field.deserialize(value) == expected
        field = fields.AwareDateTime(format=fmt)
        with pytest.raises(ValidationError, match="Not a valid aware datetime."):
            field.deserialize(value)
        field = fields.AwareDateTime(format=fmt, default_timezone=central)
        expected_aware = expected.replace(tzinfo=central)
        assert field.deserialize(value) == expected_aware
test_timestamp_field_deserialization(self=<tests.test_deserialization.TestFieldDeserialization object at 0x7f27f99915b0>, fmt='timestamp', value=1384043025, expected=datetime.datetime(2013, 11, 10, 0, 23, 45))

datetime.datetime(2013, 11, 10, 0, 23, 45, tzinfo=<DstTzInfo 'America/Chicago' LMT-1 day, 18:09:00 STD>)


def test_invalid_ip_deserialization(self, in_value):
        field = fields.IP()
        with pytest.raises(ValidationError) as excinfo:
            field.deserialize(in_value)
        assert excinfo.value.args[0] == "Not a valid IP address."
test_invalid_ip_deserialization(self=<tests.test_deserialization.TestFieldDeserialization object at 0x7f27f9018a90>, in_value='malformed')

<fields.IP(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid_ip': 'Not a valid IP address.'})>

<ExceptionInfo for raises contextmanager>

<ExceptionInfo ValidationError('Not a valid IP address.') tblen=3>


assert excinfo.value.args[0] == "Not a valid IP address."


def test_partial_deserialization(self, partial_schema):
        class MySchema(Schema):
            foo = fields.Field(required=True)
            bar = fields.Field(required=True)
        schema_args = {}
        load_args = {}
        if partial_schema:
            schema_args["partial"] = True
        else:
            load_args["partial"] = True
        data = MySchema(**schema_args).load({"foo": 3}, **load_args)
        assert data["foo"] == 3
        assert "bar" not in data
test_partial_deserialization(self=<tests.test_deserialization.TestSchemaDeserialization object at 0x7f27f9affb80>, partial_schema=True)


def test_required_field_failure(FieldClass):
    class RequireSchema(Schema):
        age = FieldClass(required=True)
    user_data = {"name": "Phil"}
    with pytest.raises(ValidationError) as excinfo:
        RequireSchema().load(user_data)
    errors = excinfo.value.messages
    assert "Missing data for required field." in errors["age"]
test_required_field_failure(FieldClass=<class 'marshmallow.fields.String'>)

<ExceptionInfo for raises contextmanager>

<ExceptionInfo ValidationError({'age': ['Missing data for required field.'], 'name': ['Unknown field.']}) tblen=3>


assert "Missing data for required field." in errors["age"]


def test_extra_metadata_may_be_added_to_field(self, FieldClass):
        with pytest.warns(DeprecationWarning):
            field = FieldClass(description="Just a normal field.")
        assert field.metadata["description"] == "Just a normal field."
        field = FieldClass(
            required=True,
            dump_default=None,
            validate=lambda v: True,
            metadata={"description": "foo", "widget": "select"},
        )
        assert field.metadata == {"description": "foo", "widget": "select"}
test_extra_metadata_may_be_added_to_field(self=<tests.test_fields.TestMetadata object at 0x7f27f8eff2e0>, FieldClass=<class 'marshmallow.fields.String'>)

<fields.String(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>

<fields.String(dump_default=None, attribute=None, validate=<function TestMetadata.test_extra_metadata_may_be_added_to_field.<locals>.<lambda> at 0x7f27f8da89d0>, required=True, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>


assert field.metadata["description"] == "Just a normal field."


assert field.metadata == {"description": "foo", "widget": "select"}


def test_field_metadata_added_in_deprecated_style_warns(self, FieldClass):
        with pytest.warns(DeprecationWarning):
            field = FieldClass(description="Just a normal field.")
            assert field.metadata["description"] == "Just a normal field."
        with pytest.warns(DeprecationWarning):
            field = FieldClass(
                required=True,
                dump_default=None,
                validate=lambda v: True,
                description="foo",
                metadata={"widget": "select"},
            )
        assert field.metadata == {"description": "foo", "widget": "select"}
test_field_metadata_added_in_deprecated_style_warns(self=<tests.test_fields.TestMetadata object at 0x7f27f94782b0>, FieldClass=<class 'marshmallow.fields.String'>)

<fields.String(dump_default=None, attribute=None, validate=<function TestMetadata.test_field_metadata_added_in_deprecated_style_warns.<locals>.<lambda> at 0x7f27f8da8f70>, required=True, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>


def test_load_default_in_deprecated_style_warns(self, FieldClass):
        with pytest.warns(
            DeprecationWarning,
            match="The 'missing' argument to fields is deprecated. "
            "Use 'load_default' instead.",
        ):
            FieldClass(missing=None)
        myfield = FieldClass(load_default=1)
        with pytest.warns(
            DeprecationWarning,
            match="The 'missing' attribute of fields is deprecated. "
            "Use 'load_default' instead.",
        ):
            assert myfield.missing == 1
        with pytest.warns(
            DeprecationWarning,
            match="The 'missing' attribute of fields is deprecated. "
            "Use 'load_default' instead.",
        ):
            myfield.missing = 0
        assert myfield.load_default == 0
test_load_default_in_deprecated_style_warns(self=<tests.test_fields.TestDeprecatedDefaultAndMissing object at 0x7f27f9467bb0>, FieldClass=<class 'marshmallow.fields.String'>)

<fields.String(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=1, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>

<fields.String(dump_default=<marshmallow.missing>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=0, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>


def test_dump_default_in_deprecated_style_warns(self, FieldClass):
        with pytest.warns(
            DeprecationWarning,
            match="The 'default' argument to fields is deprecated. "
            "Use 'dump_default' instead.",
        ):
            FieldClass(default=None)
        myfield = FieldClass(dump_default=1)
        with pytest.warns(
            DeprecationWarning,
            match="The 'default' attribute of fields is deprecated. "
            "Use 'dump_default' instead.",
        ):
            assert myfield.default == 1
        with pytest.warns(
            DeprecationWarning,
            match="The 'default' attribute of fields is deprecated. "
            "Use 'dump_default' instead.",
        ):
            myfield.default = 0
        assert myfield.dump_default == 0
test_dump_default_in_deprecated_style_warns(self=<tests.test_fields.TestDeprecatedDefaultAndMissing object at 0x7f27f92eae50>, FieldClass=<class 'marshmallow.fields.String'>)

<fields.String(dump_default=1, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>

<fields.String(dump_default=0, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.', 'invalid': 'Not a valid string.', 'invalid_utf8': 'Not a valid utf-8 string.'})>


def _pntcoord(sol, i, n, m, distances, prec):
    tmppnt = []
    state = 1
    pntscount = len(sol)
    if distances[i, n] < -0.5 or distances[i, m] < -0.5:
        return tmppnt, state
    if distances[i, n] + distances[i, m] < _dist(sol[n], sol[m]):
        state = 2
        return tmppnt, state
    g = _affinef(*_invtranmat(*_tranmat(sol[n], sol[m])))
    x = _xvalue(distances[i, n], distances[i, m], _dist(sol[n], sol[m]))
    y1, y2 = _yvalue(distances[i, n], distances[i, m], _dist(sol[n], sol[m]))
    pos1 = g(np.array([x, y1]))
    pos2 = g(np.array([x, y2]))
    valid1 = True
    valid2 = True
    for k in range(pntscount):
        if np.ndim(sol[k]) != 0 and distances[i, k] > -0.5:
            valid1 &= abs(_dist(sol[k], pos1) - distances[i, k]) < prec
            valid2 &= abs(_dist(sol[k], pos2) - distances[i, k]) < prec
    if valid1 or valid2:
        state = 0
        same = abs(y1 - y2) < prec / 4.0
        if valid1:
            tmppnt.append(dcopy(pos1))
        if valid2 and not same:
            tmppnt.append(dcopy(pos2))
    else:
        state = 2
    return tmppnt, state
_pntcoord(sol=[array([0., 0.]), array([3., 0.]), 0, 0], i=2, n=0, m=1, distances=array([[ 0.,  3.,  4.,  1.],       [ 3.,  0.,  2.,  3.],       [ 4.,  2.,  0., -1.],       [ 1.,  3., -1.,  0.]]), prec=0.1)

<function _affinef.<locals>.func at 0x7f9d2f5dc9d0>


def _solequal(sol1, sol2, prec):
    res = True
    for sol_1, sol_2 in zip(sol1, sol2):
        if np.ndim(sol_1) != 0 and np.ndim(sol_2) != 0:
            res &= _dist(sol_1, sol_2) < prec
        elif np.ndim(sol_1) != 0 and np.ndim(sol_2) == 0:
            return False
        elif np.ndim(sol_1) == 0 and np.ndim(sol_2) != 0:
            return False
    return res
_solequal(sol1=[array([0., 0.]), array([3., 0.]), array([3.5       , 1.93649167]), array([ 0.16666667, -0.9860133 ])], sol2=[array([0., 0.]), array([3., 0.]), array([3.5       , 1.93649167]), array([0.16666667, 0.9860133 ])], prec=0.1)


def startElement(self, full_name, attrs):
        name = self._build_name(full_name)
        attrs = self._attrs_to_dict(attrs)
        if attrs and self.namespace_declarations:
            attrs['xmlns'] = self.namespace_declarations
            self.namespace_declarations = self.dict_constructor()
        self.path.append((name, attrs or None))
        if len(self.path) >= self.item_depth:
            self.stack.append((self.item, self.data))
            if self.xml_attribs:
                attr_entries = []
                for key, value in attrs.items():
                    key = self.attr_prefix+self._build_name(key)
                    if self.postprocessor:
                        entry = self.postprocessor(self.path, key, value)
                    else:
                        entry = (key, value)
                    if entry:
                        attr_entries.append(entry)
                attrs = self.dict_constructor(attr_entries)
            else:
                attrs = None
            self.item = attrs or None
            self.data = []
startElement(self=<xmltodict._DictSAXHandler object at 0x7f2c78685910>, full_name='root', attrs=['a', '1', 'b', '2', 'c', '3'], self.attr_prefix='@', self.cdata_key='

<function _DictSAXHandler.<lambda> at 0x7f2c786d40d0>


def _build_name(self, full_name):
        if self.namespaces is None:
            return full_name
        i = full_name.rfind(self.namespace_separator)
        if i == -1:
            return full_name
        namespace, name = full_name[:i], full_name[i+1:]
        try:
            short_namespace = self.namespaces[namespace]
        except KeyError:
            short_namespace = namespace
        if not short_namespace:
            return name
        else:
            return self.namespace_separator.join((short_namespace, name))
_build_name(self=<xmltodict._DictSAXHandler object at 0x7f2c78683040>, full_name='http://defaultns.com/:root', self.attr_prefix='@', self.cdata_key='

{'': 'http://defaultns.com/', 'a': 'http://a.com/', 'b': 'http://b.com/'}

{'http://defaultns.com/': '', 'http://a.com/': 'ns_a'}


namespace, name = full_name[:i], full_name[i+1:]


def endElement(self, full_name):
        name = self._build_name(full_name)
        if len(self.path) == self.item_depth:
            item = self.item
            if item is None:
                item = (None if not self.data
                        else self.cdata_separator.join(self.data))
            should_continue = self.item_callback(self.path, item)
            if not should_continue:
                raise ParsingInterrupted()
        if self.stack:
            data = (None if not self.data
                    else self.cdata_separator.join(self.data))
            item = self.item
            self.item, self.data = self.stack.pop()
            if self.strip_whitespace and data and item:
                data = data.strip() or None
            if data and self.force_cdata and item is None:
                item = self.dict_constructor()
            if item is not None:
                if data:
                    self.push_data(item, self.cdata_key, data)
                self.item = self.push_data(self.item, name, item)
            else:
                self.item = self.push_data(self.item, name, data)
        else:
            self.item = None
            self.data = []
        self.path.pop()
endElement(self=<xmltodict._DictSAXHandler object at 0x7f2c78685910>, full_name='root', self.attr_prefix='@', self.cdata_key='


def push_data(self, item, key, data):
        if self.postprocessor is not None:
            result = self.postprocessor(self.path, key, data)
            if result is None:
                return item
            key, data = result
        if item is None:
            item = self.dict_constructor()
        try:
            value = item[key]
            if isinstance(value, list):
                value.append(data)
            else:
                item[key] = [value, data]
        except KeyError:
            if self._should_force_list(key, data):
                item[key] = [data]
            else:
                item[key] = data
        return item
push_data(self=<xmltodict._DictSAXHandler object at 0x7f2c78685910>, item=None, key='root', data={'@a': '1', '@b': '2', '@c': '3'}, self.attr_prefix='@', self.cdata_key='


def _process_namespace(name, namespaces, ns_sep=':', attr_prefix='@'):
    if not namespaces:
        return name
    try:
        ns, name = name.rsplit(ns_sep, 1)
    except ValueError:
        pass
    else:
        ns_res = namespaces.get(ns.strip(attr_prefix))
        name = '{}{}{}{}'.format(
            attr_prefix if ns.startswith(attr_prefix) else '',
            ns_res, ns_sep, name) if ns_res else name
    return name
_process_namespace(name='http://defaultns.com/:root', namespaces={'http://defaultns.com/': '', 'http://a.com/': 'a', 'http://b.com/': 'b'}, ns_sep=':', attr_prefix='@')


def characters(self, data):
        if not self.data:
            self.data = [data]
        else:
            self.data.append(data)
characters(self=<xmltodict._DictSAXHandler object at 0x7f2c786859a0>, data='y', self.attr_prefix='@', self.cdata_key='


def comments(self, data):
        if self.strip_whitespace:
            data = data.strip()
        self.item = self.push_data(self.item, self.comment_key, data)
comments(self=<xmltodict._DictSAXHandler object at 0x7f2c78888c10>, data=' b comment ', self.attr_prefix='@', self.cdata_key='


self.item = self.push_data(self.item, self.comment_key, data)


def response_error(code_status, message=None):
    payload = {'error': HTTP_STATUS_CODES.get(code_status, "something went wrong")}
    if message:
        payload['message'] = message
    response = jsonify(payload)
    response.status_code = code_status
    return response
response_error(code_status=400, message='Invalid input')

'Invalid input'

'Invalid input'

{'error': 'Bad Request', 'message': 'Invalid input'}

Response: <Response 50 bytes [200 OK]>

Response: <Response 50 bytes [400 BAD REQUEST]>


'Invalid input'

{'error': 'Bad Request', 'message': 'Invalid input'}

'Invalid input'

Response: <Response 50 bytes [200 OK]>

Response: <Response 50 bytes [400 BAD REQUEST]>


'Invalid input'

'Invalid input'

Response: <Response 50 bytes [200 OK]>

Response: <Response 50 bytes [400 BAD REQUEST]>


'Invalid input'

'Invalid input'

Response: <Response 50 bytes [200 OK]>

Response: <Response 50 bytes [400 BAD REQUEST]>


def get_base_urls(self, urls):
        base_urls = []
        for i in urls:
            parsed_url = urlparse(i)
            base_url = parsed_url.scheme + "://" + parsed_url.netloc
            if base_url not in base_urls:
                base_urls.append(base_url)
        return base_urls
get_base_urls(self=<application.parser.file.openapi3_parser.OpenAPI3Parser object at 0x7fea8cf55d30>, urls=['http://petstore.swagger.io/v1', 'https://api.example.com/v1/resource', 'https://api.example.com/v1/another/resource', 'https://api.example.com/v1/some/endpoint'], self._parser_config=None)

ParseResult(scheme='http', netloc='petstore.swagger.io', path='/v1', params='', query='', fragment='')

ParseResult(scheme='https', netloc='api.example.com', path='/v1/resource', params='', query='', fragment='')

ParseResult(scheme='https', netloc='api.example.com', path='/v1/another/resource', params='', query='', fragment='')

ParseResult(scheme='https', netloc='api.example.com', path='/v1/some/endpoint', params='', query='', fragment='')


def get_info_from_paths(self, path):
        info = ""
        if path.operations:
            for operation in path.operations:
                info += (
                    f"\n{operation.method.value}="
                    f"{operation.responses[0].description}"
                )
        return info
get_info_from_paths(self=<application.parser.file.openapi3_parser.OpenAPI3Parser object at 0x7fea8c9ce700>, path=Path(url='/pets/{petId}', summary=None, description=None, operations=[Operation(method=<OperationMethod.GET: 'get'>, responses=[Response(is_default=False, description='Expected response to a valid request', code=200, content=[Content(type=<ContentType.JSON: 'application/json'>, schema=Object(type=<DataType.OBJECT: 'object'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, max_properties=None, min_properties=None, required=['id', 'name'], properties=[Property(name='id', schema=Integer(type=<DataType.INTEGER: 'integer'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, multiple_of=None, maximum=None, exclusive_maximum=None, minimum=None, exclusive_minimum=None, format=<IntegerFormat.INT64: 'int64'>)), Property(name='name', schema=String(type=<DataType.STRING: 'string'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, max_length=None, min_length=None, pattern=None, format=None)), Property(name='tag', schema=String(type=<DataType.STRING: 'string'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, max_length=None, min_length=None, pattern=None, format=None))]))], headers=[]), Response(is_default=True, description='unexpected error', code=None, content=[Content(type=<ContentType.JSON: 'application/json'>, schema=Object(type=<DataType.OBJECT: 'object'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, max_properties=None, min_properties=None, required=['code', 'message'], properties=[Property(name='code', schema=Integer(type=<DataType.INTEGER: 'integer'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, multiple_of=None, maximum=None, exclusive_maximum=None, minimum=None, exclusive_minimum=None, format=<IntegerFormat.INT32: 'int32'>)), Property(name='message', schema=String(type=<DataType.STRING: 'string'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, max_length=None, min_length=None, pattern=None, format=None))]))], headers=[])], summary='Info for a specific pet', description=None, operation_id='showPetById', external_docs=None, request_body=None, deprecated=False, parameters=[Parameter(name='petId', location=<ParameterLocation.PATH: 'path'>, schema=String(type=<DataType.STRING: 'string'>, title=None, enum=[], example=None, description=None, default=None, nullable=False, read_only=False, write_only=False, deprecated=False, extensions={}, max_length=None, min_length=None, pattern=None, format=None), required=True, description='The id of the pet to retrieve', deprecated=False, style=<PathParameterStyle.SIMPLE: 'simple'>, explode=False)], tags=['pets'], security=[])], parameters=[]), self._parser_config=None)

'\nget=Expected response to a valid request'


'\nget=Expected response to a valid request'


def __next__(self):
        while True:
            self.buffer.seek(self.read_pos)
            line = self.buffer.readline()
            if line and line[-1] == ord('\n'):
                self.read_pos += len(line)
                return line[:-1]
            try:
                chunk = next(self.byte_iterator)
            except StopIteration:
                if self.read_pos < self.buffer.getbuffer().nbytes:
                    continue
                raise
            if 'PayloadPart' not in chunk:
                print('Unknown event type:' + chunk)
                continue
            self.buffer.seek(0, io.SEEK_END)
            self.buffer.write(chunk['PayloadPart']['Bytes'])
__next__(self=<application.llm.sagemaker.LineIterator object at 0x7fea87997070>, self.buffer=<_io.BytesIO object at 0x7fea879a1d10>, self.byte_iterator=<list_iterator object at 0x7fea879a5040>, self.read_pos=0)


def check_data(a, b):
    if not isinstance(a, np.ndarray):
        a = np.array(a)
    if not isinstance(b, np.ndarray):
        b = np.array(b)
    if type(a) != type(b):
        raise ValueError("Type mismatch: %s and %s" % (type(a), type(b)))
    if a.size != b.size:
        raise ValueError("Arrays must be equal in length.")
    return a, b
check_data(a=[], b=1)


def wrapper(a, b):
        a, b = check_data(a, b)
        return function(a, b)
wrapper(a=[1, 2, 3, 4], b=[1, 2, 3, 4], function=<function unhot.<locals>.wrapper at 0x7f4414e29790>)


def logloss(actual, predicted):
    predicted = np.clip(predicted, EPS, 1 - EPS)
    loss = -np.sum(actual * np.log(predicted))
    return loss / float(actual.shape[0])
logloss(actual=array([1]), predicted=array([1]))


loss = -np.sum(actual * np.log(predicted))


def clasifier(optimizer):
    X, y = make_classification(
        n_samples=1000, n_features=100, n_informative=75, random_state=1111, n_classes=2, class_sep=2.5
    )
    y = one_hot(y)
    X -= np.mean(X, axis=0)
    X /= np.std(X, axis=0)
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.15, random_state=1111)
    model = NeuralNet(
        layers=[
            Dense(128, Parameters(init="uniform")),
            Activation("relu"),
            Dropout(0.5),
            Dense(64, Parameters(init="normal")),
            Activation("relu"),
            Dense(2),
            Activation("softmax"),
        ],
        loss="categorical_crossentropy",
        optimizer=optimizer,
        metric="accuracy",
        batch_size=64,
        max_epochs=10,
    )
    model.fit(X_train, y_train)
    predictions = model.predict(X_test)
    return roc_auc_score(y_test[:, 0], predictions[:, 0])
clasifier(optimizer={rho=0.95, eps=1e-08, lr=1.0})

{verbose=True, shuffle=False, optimizer=<mla.neuralnet.optimizers.Adadelta object at 0x7f43904a38e0>, layers=[<mla.neuralnet.layers.basic.Dense object at 0x7f43904a3610>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a33d0>, <mla.neuralnet.layers.basic.Dropout object at 0x7f43904a32b0>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3c70>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3550>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3820>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3730>], batch_size=64, max_epochs=10, _n_layers=0, log_metric=True, metric_name='accuracy', bprop_entry=-1, training=False, _initialized=False}


X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.15, random_state=1111)


def fit(self, X, y=None):
        if not self._initialized:
            self._setup_layers(X.shape)
        if y.ndim == 1:
            y = y[:, np.newaxis]
        self._setup_input(X, y)
        self.is_training = True
        self.optimizer.optimize(self)
        self.is_training = False
fit(self=<mla.neuralnet.nnet.NeuralNet object at 0x7f43904a3700>, X=array([[ 0.52035826, -1.70073552, -0.50697874, ..., -0.74790479,         0.16039734,  1.0323546 ],       [ 0.96925333, -0.29561268,  0.86400006, ...,  1.4457464 ,        -1.32196293, -0.0653791 ],       [ 0.24562753,  0.62176281,  0.95963704, ..., -0.16747796,        -0.60033504,  1.64606491],       ...,       [ 1.14501028,  1.07221843,  1.2764346 , ..., -0.83624018,        -1.87719572,  0.57666069],       [ 1.98506244, -0.27254282,  1.58679531, ..., -0.73272139,         2.03923433, -1.41719355],       [-0.82634613,  1.99698567,  0.0889722 , ...,  0.83719252,        -0.88980401,  0.81743782]]), y=array([[1., 0.],       [1., 0.],       [1., 0.],       ...,       [0., 1.],       [1., 0.],       [1., 0.]]), self._initialized=False, self._n_layers=0, self.batch_size=64, self.bprop_entry=-1, self.layers=[<mla.neuralnet.layers.basic.Dense object at 0x7f43904a3610>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a33d0>, <mla.neuralnet.layers.basic.Dropout object at 0x7f43904a32b0>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3c70>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3550>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3820>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3730>], self.log_metric=True, self.loss=<function logloss at 0x7f4414e29e50>, self.loss_grad=<function NeuralNet.__init__.<locals>.<lambda> at 0x7f439043c790>, self.max_epochs=10, self.metric=<function unhot.<locals>.wrapper at 0x7f4414e29820>, self.metric_name='accuracy', self.optimizer=<mla.neuralnet.optimizers.Adadelta object at 0x7f43904a38e0>, self.shuffle=False, self.training=False, self.verbose=True)


def _setup_layers(self, x_shape):
        x_shape = list(x_shape)
        x_shape[0] = self.batch_size
        for layer in self.layers:
            layer.setup(x_shape)
            x_shape = layer.shape(x_shape)
        self._n_layers = len(self.layers)
        self.optimizer.setup(self)
        self._initialized = True
        logging.info("Total parameters: %s" % self.n_params)
_setup_layers(self=<mla.neuralnet.nnet.NeuralNet object at 0x7f43904a3700>, x_shape=(850, 100), self._initialized=False, self._n_layers=0, self.batch_size=64, self.bprop_entry=-1, self.layers=[<mla.neuralnet.layers.basic.Dense object at 0x7f43904a3610>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a33d0>, <mla.neuralnet.layers.basic.Dropout object at 0x7f43904a32b0>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3c70>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3550>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3820>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3730>], self.log_metric=True, self.loss=<function logloss at 0x7f4414e29e50>, self.loss_grad=<function NeuralNet.__init__.<locals>.<lambda> at 0x7f439043c790>, self.max_epochs=10, self.metric=<function unhot.<locals>.wrapper at 0x7f4414e29820>, self.metric_name='accuracy', self.optimizer=<mla.neuralnet.optimizers.Adadelta object at 0x7f43904a38e0>, self.shuffle=False, self.training=False, self.verbose=True)

{_params=<mla.neuralnet.parameters.Parameters object at 0x7f43904a3580>, output_dim=128, last_input=None}

{_params=<mla.neuralnet.parameters.Parameters object at 0x7f43904a3df0>, output_dim=64, last_input=None}

{_params=<mla.neuralnet.parameters.Parameters object at 0x7f43904a3430>, output_dim=2, last_input=None}


def setup_weights(self, W_shape, b_shape=None):
        if "W" not in self._params:
            self._params["W"] = self.init(shape=W_shape, scale=self.scale)
            if b_shape is None:
                self._params["b"] = np.full(W_shape[1], self.initial_bias)
            else:
                self._params["b"] = np.full(b_shape, self.initial_bias)
        self.init_grad()
setup_weights(self=<mla.neuralnet.parameters.Parameters object at 0x7f43904a3580>, W_shape=(100, 128), b_shape=None, self._grads={}, self._params={}, self.constraints={}, self.init=<function uniform at 0x7f4414d97e50>, self.initial_bias=1.0, self.regularizers={}, self.scale=0.5)


self._params["b"] = np.full(W_shape[1], self.initial_bias)


def error(self, X=None, y=None):
        training_phase = self.is_training
        if training_phase:
            self.is_training = False
        if X is None and y is None:
            y_pred = self._predict(self.X)
            score = self.metric(self.y, y_pred)
        else:
            y_pred = self._predict(X)
            score = self.metric(y, y_pred)
        if training_phase:
            self.is_training = True
        return score
error(self=<mla.neuralnet.nnet.NeuralNet object at 0x7f43904a3700>, X=None, y=None, self.X=array([[ 0.52035826, -1.70073552, -0.50697874, ..., -0.74790479,         0.16039734,  1.0323546 ],       [ 0.96925333, -0.29561268,  0.86400006, ...,  1.4457464 ,        -1.32196293, -0.0653791 ],       [ 0.24562753,  0.62176281,  0.95963704, ..., -0.16747796,        -0.60033504,  1.64606491],       ...,       [ 1.14501028,  1.07221843,  1.2764346 , ..., -0.83624018,        -1.87719572,  0.57666069],       [ 1.98506244, -0.27254282,  1.58679531, ..., -0.73272139,         2.03923433, -1.41719355],       [-0.82634613,  1.99698567,  0.0889722 , ...,  0.83719252,        -0.88980401,  0.81743782]]), self._initialized=True, self._n_layers=7, self.batch_size=64, self.bprop_entry=-1, self.layers=[<mla.neuralnet.layers.basic.Dense object at 0x7f43904a3610>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a33d0>, <mla.neuralnet.layers.basic.Dropout object at 0x7f43904a32b0>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3c70>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3550>, <mla.neuralnet.layers.basic.Dense object at 0x7f43904a3820>, <mla.neuralnet.layers.basic.Activation object at 0x7f43904a3730>], self.log_metric=True, self.loss=<function logloss at 0x7f4414e29e50>, self.loss_grad=<function NeuralNet.__init__.<locals>.<lambda> at 0x7f439043c790>, self.max_epochs=10, self.metric=<function unhot.<locals>.wrapper at 0x7f4414e29820>, self.metric_name='accuracy', self.n_features=100, self.n_samples=850, self.optimizer=<mla.neuralnet.optimizers.Adadelta object at 0x7f43904a38e0>, self.shuffle=False, self.training=True, self.verbose=True, self.y=array([[1., 0.],       [1., 0.],       [1., 0.],       ...,       [0., 1.],       [1., 0.],       [1., 0.]]))


def read_env() -> Dict[str, Any]:
    __env_dict: Dict[str, Optional[str]] = {}
    for env_file in get_reading_order():
        if env_file.exists():
            __env_dict.update(**dotenv_values(env_file))
    __env_dict_filtered = {
        k[len("OPENBBB_") - 1 :]: v
        for k, v in __env_dict.items()
        if k.startswith("OPENBB_")
    }
    return __env_dict_filtered
read_env()


def add_additional_handlers(cls, values):
        if (
            not any([values["TEST_MODE"], values["LOGGING_SUPPRESS"]])
            and values["LOG_COLLECT"]
            and "posthog" not in values["LOGGING_HANDLERS"]
        ):
            values["LOGGING_HANDLERS"].append("posthog")
        return values
add_additional_handlers(cls=<class 'openbb_terminal.core.models.system_model.SystemModel'>, values={'OS': 'Linux', 'PYTHON_VERSION': '3.9.19', 'PLATFORM': 'Linux-5.15.0-94-generic-x86_64-with-glibc2.35', 'VERSION': '3.2.4', 'LOGGING_APP_ID': 'REPLACE_ME', 'LOGGING_APP_NAME': 'gst', 'LOGGING_AWS_ACCESS_KEY_ID': 'REPLACE_ME', 'LOGGING_AWS_SECRET_ACCESS_KEY': 'REPLACE_ME', 'LOGGING_COMMIT_HASH': 'REPLACE_ME', 'LOGGING_BRANCH': 'REPLACE_ME', 'LOGGING_FREQUENCY': 'H', 'LOGGING_HANDLERS': ['file'], 'LOGGING_ROLLING_CLOCK': False, 'LOGGING_VERBOSITY': 20, 'LOGGING_SUB_APP': 'terminal', 'LOGGING_SUPPRESS': False, 'LOGGING_SEND_TO_S3': True, 'LOG_COLLECT': True, 'DISABLE_STREAMLIT_WARNING': False, 'DISABLE_FORECASTING_WARNING': False, 'DISABLE_OPTIMIZATION_WARNING': False, 'TEST_MODE': False, 'DEBUG_MODE': False, 'DEV_BACKEND': False, 'ENABLE_AUTHENTICATION': True, 'HEADLESS': False})

{'OS': 'Linux', 'PYTHON_VERSION': '3.9.19', 'PLATFORM': 'Linux-5.15.0-94-generic-x86_64-with-glibc2.35', 'VERSION': '3.2.4', 'LOGGING_APP_ID': 'REPLACE_ME', 'LOGGING_APP_NAME': 'gst', 'LOGGING_AWS_ACCESS_KEY_ID': 'REPLACE_ME', 'LOGGING_AWS_SECRET_ACCESS_KEY': 'REPLACE_ME', 'LOGGING_COMMIT_HASH': 'REPLACE_ME', 'LOGGING_BRANCH': 'REPLACE_ME', 'LOGGING_FREQUENCY': 'H', 'LOGGING_HANDLERS': ['file', 'posthog'], 'LOGGING_ROLLING_CLOCK': False, 'LOGGING_VERBOSITY': 20, 'LOGGING_SUB_APP': 'terminal', 'LOGGING_SUPPRESS': False, 'LOGGING_SEND_TO_S3': True, 'LOG_COLLECT': True, 'DISABLE_STREAMLIT_WARNING': False, 'DISABLE_FORECASTING_WARNING': False, 'DISABLE_OPTIMIZATION_WARNING': False, 'TEST_MODE': False, 'DEBUG_MODE': False, 'DEV_BACKEND': False, 'ENABLE_AUTHENTICATION': True, 'HEADLESS': False}


def validate_send_to_s3(cls, values):
        if "posthog" in values["LOGGING_HANDLERS"] or values["LOG_COLLECT"] is False:
            values["LOGGING_SEND_TO_S3"] = False
        return values
validate_send_to_s3(cls=<class 'openbb_terminal.core.models.system_model.SystemModel'>, values={'OS': 'Linux', 'PYTHON_VERSION': '3.9.19', 'PLATFORM': 'Linux-5.15.0-94-generic-x86_64-with-glibc2.35', 'VERSION': '3.2.4', 'LOGGING_APP_ID': 'REPLACE_ME', 'LOGGING_APP_NAME': 'gst', 'LOGGING_AWS_ACCESS_KEY_ID': 'REPLACE_ME', 'LOGGING_AWS_SECRET_ACCESS_KEY': 'REPLACE_ME', 'LOGGING_COMMIT_HASH': 'REPLACE_ME', 'LOGGING_BRANCH': 'REPLACE_ME', 'LOGGING_FREQUENCY': 'H', 'LOGGING_HANDLERS': ['file', 'posthog'], 'LOGGING_ROLLING_CLOCK': False, 'LOGGING_VERBOSITY': 20, 'LOGGING_SUB_APP': 'terminal', 'LOGGING_SUPPRESS': False, 'LOGGING_SEND_TO_S3': True, 'LOG_COLLECT': True, 'DISABLE_STREAMLIT_WARNING': False, 'DISABLE_FORECASTING_WARNING': False, 'DISABLE_OPTIMIZATION_WARNING': False, 'TEST_MODE': False, 'DEBUG_MODE': False, 'DEV_BACKEND': False, 'ENABLE_AUTHENTICATION': True, 'HEADLESS': False})

{'OS': 'Linux', 'PYTHON_VERSION': '3.9.19', 'PLATFORM': 'Linux-5.15.0-94-generic-x86_64-with-glibc2.35', 'VERSION': '3.2.4', 'LOGGING_APP_ID': 'REPLACE_ME', 'LOGGING_APP_NAME': 'gst', 'LOGGING_AWS_ACCESS_KEY_ID': 'REPLACE_ME', 'LOGGING_AWS_SECRET_ACCESS_KEY': 'REPLACE_ME', 'LOGGING_COMMIT_HASH': 'REPLACE_ME', 'LOGGING_BRANCH': 'REPLACE_ME', 'LOGGING_FREQUENCY': 'H', 'LOGGING_HANDLERS': ['file', 'posthog'], 'LOGGING_ROLLING_CLOCK': False, 'LOGGING_VERBOSITY': 20, 'LOGGING_SUB_APP': 'terminal', 'LOGGING_SUPPRESS': False, 'LOGGING_SEND_TO_S3': False, 'LOG_COLLECT': True, 'DISABLE_STREAMLIT_WARNING': False, 'DISABLE_FORECASTING_WARNING': False, 'DISABLE_OPTIMIZATION_WARNING': False, 'TEST_MODE': False, 'DEBUG_MODE': False, 'DEV_BACKEND': False, 'ENABLE_AUTHENTICATION': True, 'HEADLESS': False}


def __new__(mcs: Type["PluginMeta"], *args: Any, **kwargs: Any) -> "PluginMeta":
        name, bases, attrs = args
        indicators: Dict[str, Indicator] = {}
        cls_attrs: Dict[str, list] = {
            "__ma_mode__": [],
            "__inchart__": [],
            "__subplots__": [],
        }
        new_cls = super().__new__(mcs, name, bases, attrs, **kwargs)
        for base in reversed(new_cls.__mro__):
            for elem, value in base.__dict__.items():
                if elem in indicators:
                    del indicators[elem]
                is_static_method = isinstance(value, staticmethod)
                if is_static_method:
                    value = value.__func__
                if isinstance(value, Indicator):
                    if is_static_method:
                        raise TypeError(
                            f"Indicator {value.name} can't be a static method"
                        )
                    indicators[value.name] = value
                elif is_static_method and elem not in new_cls.__static_methods__:
                    new_cls.__static_methods__.append(elem)
                if elem in ["__ma_mode__", "__inchart__", "__subplots__"]:
                    cls_attrs[elem].extend(value)
        new_cls.__indicators__ = list(indicators.values())
        new_cls.__static_methods__ = list(set(new_cls.__static_methods__))
        new_cls.__ma_mode__ = list(set(cls_attrs["__ma_mode__"]))
        new_cls.__inchart__ = list(set(cls_attrs["__inchart__"]))
        new_cls.__subplots__ = list(set(cls_attrs["__subplots__"]))
        return new_cls
__new__(mcs=<class 'openbb_terminal.core.plots.plotly_ta.base.PluginMeta'>, args=('PltTA', (), {'__module__': 'openbb_terminal.core.plots.plotly_ta.base', '__qualname__': 'PltTA', '__annotations__': {'indicators': <class 'openbb_terminal.core.plots.plotly_ta.data_classes.ChartIndicators'>, 'intraday': <class 'bool'>, 'df_stock': <class 'pandas.core.frame.DataFrame'>, 'df_ta': <class 'pandas.core.frame.DataFrame'>, 'df_fib': <class 'pandas.core.frame.DataFrame'>, 'close_column': typing.Optional[str], 'params': typing.Dict[str, openbb_terminal.core.plots.plotly_ta.data_classes.TAIndicator], 'inchart_colors': typing.List[str], 'show_volume': <class 'bool'>, '__static_methods__': <class 'list'>, '__indicators__': typing.List[openbb_terminal.core.plots.plotly_ta.base.Indicator], '__ma_mode__': typing.List[str], '__inchart__': typing.List[str], '__subplots__': typing.List[str]}, '__doc__': 'The base class that all Plotly plugins must inherit from.', 'intraday': False, 'close_column': 'Close', 'params': {}, 'inchart_colors': [], 'show_volume': True, '__static_methods__': [], '__indicators__': [], '__ma_mode__': [], '__inchart__': [], '__subplots__': [], '__new__': <function PltTA.__new__ at 0x7fd9130d98b0>, 'ma_mode': <property object at 0x7fd915b6fe00>, 'add_plugins': <function PltTA.add_plugins at 0x7fd9130d9a60>, 'remove_plugins': <function PltTA.remove_plugins at 0x7fd9130d9af0>, '__iter__': <function PltTA.__iter__ at 0x7fd9130d9b80>, 'get_float_precision': <function PltTA.get_float_precision at 0x7fd9130d9c10>, '__classcell__': <cell at 0x7fd9132b88b0: empty>}), kwargs={}, __class__=<class 'openbb_terminal.core.plots.plotly_ta.base.PluginMeta'>)

('PltTA', (), {'__module__': 'openbb_terminal.core.plots.plotly_ta.base', '__qualname__': 'PltTA', '__annotations__': {'indicators': <class 'openbb_terminal.core.plots.plotly_ta.data_classes.ChartIndicators'>, 'intraday': <class 'bool'>, 'df_stock': <class 'pandas.core.frame.DataFrame'>, 'df_ta': <class 'pandas.core.frame.DataFrame'>, 'df_fib': <class 'pandas.core.frame.DataFrame'>, 'close_column': typing.Optional[str], 'params': typing.Dict[str, openbb_terminal.core.plots.plotly_ta.data_classes.TAIndicator], 'inchart_colors': typing.List[str], 'show_volume': <class 'bool'>, '__static_methods__': <class 'list'>, '__indicators__': typing.List[openbb_terminal.core.plots.plotly_ta.base.Indicator], '__ma_mode__': typing.List[str], '__inchart__': typing.List[str], '__subplots__': typing.List[str]}, '__doc__': 'The base class that all Plotly plugins must inherit from.', 'intraday': False, 'close_column': 'Close', 'params': {}, 'inchart_colors': [], 'show_volume': True, '__static_methods__': [], '__indicators__': [], '__ma_mode__': [], '__inchart__': [], '__subplots__': [], '__new__': <function PltTA.__new__ at 0x7fd9130d98b0>, 'ma_mode': <property object at 0x7fd915b6fe00>, 'add_plugins': <function PltTA.add_plugins at 0x7fd9130d9a60>, 'remove_plugins': <function PltTA.remove_plugins at 0x7fd9130d9af0>, '__iter__': <function PltTA.__iter__ at 0x7fd9130d9b80>, 'get_float_precision': <function PltTA.get_float_precision at 0x7fd9130d9c10>, '__classcell__': <cell at 0x7fd9132b88b0: PluginMeta object at 0x556accf571c0>})

('PltTA', (), {'__module__': 'openbb_terminal.core.plots.plotly_ta.base', '__qualname__': 'PltTA', '__annotations__': {'indicators': <class 'openbb_terminal.core.plots.plotly_ta.data_classes.ChartIndicators'>, 'intraday': <class 'bool'>, 'df_stock': <class 'pandas.core.frame.DataFrame'>, 'df_ta': <class 'pandas.core.frame.DataFrame'>, 'df_fib': <class 'pandas.core.frame.DataFrame'>, 'close_column': typing.Optional[str], 'params': typing.Dict[str, openbb_terminal.core.plots.plotly_ta.data_classes.TAIndicator], 'inchart_colors': typing.List[str], 'show_volume': <class 'bool'>, '__static_methods__': <class 'list'>, '__indicators__': typing.List[openbb_terminal.core.plots.plotly_ta.base.Indicator], '__ma_mode__': typing.List[str], '__inchart__': typing.List[str], '__subplots__': typing.List[str]}, '__doc__': 'The base class that all Plotly plugins must inherit from.', 'intraday': False, 'close_column': 'Close', 'params': {}, 'inchart_colors': [], 'show_volume': True, '__static_methods__': ['__new__'], '__indicators__': [], '__ma_mode__': [], '__inchart__': [], '__subplots__': [], '__new__': <function PltTA.__new__ at 0x7fd9130d98b0>, 'ma_mode': <property object at 0x7fd915b6fe00>, 'add_plugins': <function PltTA.add_plugins at 0x7fd9130d9a60>, 'remove_plugins': <function PltTA.remove_plugins at 0x7fd9130d9af0>, '__iter__': <function PltTA.__iter__ at 0x7fd9130d9b80>, 'get_float_precision': <function PltTA.get_float_precision at 0x7fd9130d9c10>, '__classcell__': <cell at 0x7fd9132b88b0: PluginMeta object at 0x556accf571c0>})

<slot wrapper '__repr__' of 'object' objects>

<slot wrapper '__hash__' of 'object' objects>

<slot wrapper '__str__' of 'object' objects>

<slot wrapper '__getattribute__' of 'object' objects>

<slot wrapper '__setattr__' of 'object' objects>

<slot wrapper '__delattr__' of 'object' objects>

<slot wrapper '__lt__' of 'object' objects>

<slot wrapper '__le__' of 'object' objects>

<slot wrapper '__eq__' of 'object' objects>

<slot wrapper '__ne__' of 'object' objects>

<slot wrapper '__gt__' of 'object' objects>

<slot wrapper '__ge__' of 'object' objects>

<slot wrapper '__init__' of 'object' objects>

<built-in method __new__ of type object at 0x556ac9f08d60>

<method '__reduce_ex__' of 'object' objects>

<method '__reduce__' of 'object' objects>

<method '__subclasshook__' of 'object' objects>

<method '__init_subclass__' of 'object' objects>

<method '__format__' of 'object' objects>

<method '__sizeof__' of 'object' objects>

<attribute '__class__' of 'object' objects>

'The base class of the class hierarchy.\n\nWhen called, it accepts no arguments and returns a new featureless\ninstance that has no instance attributes and cannot be given any.\n'

<attribute '__dict__' of 'PltTA' objects>

<attribute '__weakref__' of 'PltTA' objects>


<slot wrapper '__repr__' of 'object' objects>

<slot wrapper '__hash__' of 'object' objects>

<slot wrapper '__str__' of 'object' objects>

<slot wrapper '__getattribute__' of 'object' objects>

<slot wrapper '__setattr__' of 'object' objects>

<slot wrapper '__delattr__' of 'object' objects>

<slot wrapper '__lt__' of 'object' objects>

<slot wrapper '__le__' of 'object' objects>

<slot wrapper '__eq__' of 'object' objects>

<slot wrapper '__ne__' of 'object' objects>

<slot wrapper '__gt__' of 'object' objects>

<slot wrapper '__ge__' of 'object' objects>

<slot wrapper '__init__' of 'object' objects>

<built-in method __new__ of type object at 0x556ac9f08d60>

<method '__reduce_ex__' of 'object' objects>

<method '__reduce__' of 'object' objects>

<method '__subclasshook__' of 'object' objects>

<method '__init_subclass__' of 'object' objects>

<method '__format__' of 'object' objects>

<method '__sizeof__' of 'object' objects>

<attribute '__class__' of 'object' objects>

'The base class of the class hierarchy.\n\nWhen called, it accepts no arguments and returns a new featureless\ninstance that has no instance attributes and cannot be given any.\n'

{'indicators': <class 'openbb_terminal.core.plots.plotly_ta.data_classes.ChartIndicators'>, 'intraday': <class 'bool'>, 'df_stock': <class 'pandas.core.frame.DataFrame'>, 'df_ta': <class 'pandas.core.frame.DataFrame'>, 'df_fib': <class 'pandas.core.frame.DataFrame'>, 'close_column': typing.Optional[str], 'params': typing.Dict[str, openbb_terminal.core.plots.plotly_ta.data_classes.TAIndicator], 'inchart_colors': typing.List[str], 'show_volume': <class 'bool'>, '__static_methods__': <class 'list'>, '__indicators__': typing.List[openbb_terminal.core.plots.plotly_ta.base.Indicator], '__ma_mode__': typing.List[str], '__inchart__': typing.List[str], '__subplots__': typing.List[str]}

'The base class that all Plotly plugins must inherit from.'

<function PltTA.__new__ at 0x7fd9130d98b0>

<function PltTA.add_plugins at 0x7fd9130d9a60>

<function PltTA.remove_plugins at 0x7fd9130d9af0>

<function PltTA.__iter__ at 0x7fd9130d9b80>

<function PltTA.get_float_precision at 0x7fd9130d9c10>

<attribute '__dict__' of 'PltTA' objects>

<attribute '__weakref__' of 'PltTA' objects>


def getLogger(name, stdout=None):
    logger = logging.getLogger(name)
    logger.handlers = []
    if (stdout is None):
        logger.addHandler(logging.NullHandler())
    if stdout is not None:
        handler = logging.StreamHandler()
        handler.setLevel(stdout['level'])
        handler.setFormatter(CumulusFormatter())
        logger.addHandler(handler)
    logger.setLevel(1)
    return logger
getLogger(name='cumulus.aws', stdout=None)


def get_first_duplicate(items):
    seen = set()
    for item in items:
        if item not in seen:
            seen.add(item)
        else:
            return item
    return None
get_first_duplicate(items=[])


def _define(self, f, o_len, pure):
        name = f.__name__
        entry = SymbolTableEntry(self, name, o_len, pure)
        setattr(self, name, entry)
        self._impls[name] = f
        return f
_define(self=<hyperopt.pyll.base.SymbolTable object at 0x7f2e26fd4b50>, f=<function call at 0x7f2e26e03a60>, o_len=None, pure=False, self._impls={'list': <class 'list'>, 'dict': <class 'dict'>, 'range': <class 'range'>, 'len': <built-in function len>, 'int': <class 'int'>, 'float': <class 'float'>, 'map': <class 'map'>, 'max': <built-in function max>, 'min': <built-in function min>, 'getattr': <built-in function getattr>})

{'list': <class 'list'>, 'dict': <class 'dict'>, 'range': <class 'range'>, 'len': <built-in function len>, 'int': <class 'int'>, 'float': <class 'float'>, 'map': <class 'map'>, 'max': <built-in function max>, 'min': <built-in function min>, 'getattr': <built-in function getattr>, 'call': <function call at 0x7f2e26e03a60>}

{symbol_table=<hyperopt.pyll.base.SymbolTable object at 0x7f2e26fd4b50>, apply_name='call', o_len=None, pure=False}

<hyperopt.pyll.base.SymbolTableEntry object at 0x7f2e26e52e80>


def _get_logger(name):
    logger = logging.getLogger(name)
    logger.setLevel(logging.INFO)
    if not logger.handlers and not logging.getLogger().handlers:
        handler = logging.StreamHandler(sys.stderr)
        logger.addHandler(handler)
    return logger
_get_logger(name='hyperopt.utils')


def vectorize_stochastic(orig):
    if orig.name == "idxs_map" and orig.pos_args[1]._obj in stoch:
        idxs = orig.pos_args[0]
        dist = orig.pos_args[1]._obj
        def foo(arg):
            assert arg.name == "pos_args"
            assert len(arg.pos_args) == 2
            arg_vals = arg.pos_args[1]
            if arg_vals.name == "idxs_take":
                if arg_vals.arg["vals"].name == "asarray":
                    if arg_vals.arg["vals"].inputs()[0].name == "repeat":
                        repeated_thing = arg_vals.arg["vals"].inputs()[0].inputs()[1]
                        return repeated_thing
            if arg.pos_args[0] is idxs:
                return arg_vals
            else:
                raise NotImplementedError()
        new_pos_args = [foo(arg) for arg in orig.pos_args[2:]]
        new_named_args = [[aname, foo(arg)] for aname, arg in orig.named_args]
        vnode = Apply(dist, new_pos_args, new_named_args, o_len=None)
        n_times = scope.len(idxs)
        if "size" in dict(vnode.named_args):
            raise NotImplementedError("random node already has size")
        vnode.named_args.append(["size", n_times])
        return vnode
    else:
        return orig
vectorize_stochastic(orig={name='idxs_map', pos_args=[<hyperopt.pyll.base.Apply object at 0x7f2ec4b084f0>, <hyperopt.pyll.base.Literal object at 0x7f2ec4b083a0>, <hyperopt.pyll.base.Apply object at 0x7f2ec4b082b0>], named_args=[], o_len=None, pure=True, define_params=None})

{name='array_union', pos_args=[<hyperopt.pyll.base.Apply object at 0x7f2ec4b085b0>], named_args=[], o_len=None, pure=True, define_params=None}

<function vectorize_stochastic.<locals>.foo at 0x7f2ec4a6da60>

{name='randint', pos_args=[<hyperopt.pyll.base.Literal object at 0x7f2ec50fac40>], named_args=[], o_len=None, pure=False, define_params=None}

{name='randint', pos_args=[<hyperopt.pyll.base.Literal object at 0x7f2ec50fac40>], named_args=[['size', <hyperopt.pyll.base.Apply object at 0x7f2ec4b08a60>]], o_len=None, pure=False, define_params=None}

{name='len', pos_args=[<hyperopt.pyll.base.Apply object at 0x7f2ec4b084f0>], named_args=[], o_len=None, pure=True, define_params=None}


def delete(self, *, ip_parameter, cascade):
        as_address = clean_address(ip_parameter)
        as_network = clean_network(ip_parameter)
        if as_address in self.__description:
            return self.__remove_ip_object(as_address)
        elif as_network in self.__description:
            return self.__remove_ip_object(as_network)
        raise IPObjectNotInSpaceError("cannot delete undescribed IP object")
delete(self=AddressSpace(_AddressSpace__strict=False, _AddressSpace__description={IPv4Address('203.0.113.128'): 'an IPv4 test net address'}, _AddressSpace__networks={}, _AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, _AddressSpace__parent_supernet={IPv4Address('203.0.113.128'): None}, _AddressSpace__children_ip_object={None: {IPv4Address('203.0.113.128')}}), ip_parameter='203.0.113.128', cascade=True, self._AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, self._AddressSpace__children_ip_object={None: {IPv4Address('203.0.113.128')}}, self._AddressSpace__description={IPv4Address('203.0.113.128'): 'an IPv4 test net address'}, self._AddressSpace__networks={}, self._AddressSpace__parent_supernet={IPv4Address('203.0.113.128'): None}, self._AddressSpace__strict=False)

AddressSpace(_AddressSpace__strict=False, _AddressSpace__description={}, _AddressSpace__networks={}, _AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, _AddressSpace__parent_supernet={}, _AddressSpace__children_ip_object={None: set()})


AddressSpace(_AddressSpace__strict=False, _AddressSpace__description={}, _AddressSpace__networks={}, _AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, _AddressSpace__parent_supernet={}, _AddressSpace__children_ip_object={None: set()})


def __remove_ip_object(self, ip_object):
        if ip_object not in self.__description:
            raise IPObjectNotInSpaceError(
                "cannot remove undescribed IP object"
            )
        if isinstance(ip_object, IPAddressTuple):
            supernet = self.__parent_supernet[ip_object]
            self.__children_ip_object[supernet].remove(ip_object)
            del self.__parent_supernet[ip_object]
            del self.__description[ip_object]
        elif isinstance(ip_object, IPNetworkTuple):
            supernet = self.__parent_supernet[ip_object]
            children_of_supernet = (
                self.__children_ip_object.setdefault(supernet, set())
            )
            for child in self.__children_ip_object[ip_object]:
                self.__parent_supernet[child] = supernet
                children_of_supernet.add(child)
            del self.__children_ip_object[ip_object]
            del self.__parent_supernet[ip_object]
            del self.__description[ip_object]
        else:
            raise TypeError("ip_parameter must be a valid IP object")
        return True
__remove_ip_object(self=AddressSpace(_AddressSpace__strict=False, _AddressSpace__description={IPv4Address('203.0.113.128'): 'an IPv4 test net address'}, _AddressSpace__networks={}, _AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, _AddressSpace__parent_supernet={IPv4Address('203.0.113.128'): None}, _AddressSpace__children_ip_object={None: {IPv4Address('203.0.113.128')}}), ip_object=IPv4Address('203.0.113.128'), self._AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, self._AddressSpace__children_ip_object={None: {IPv4Address('203.0.113.128')}}, self._AddressSpace__description={IPv4Address('203.0.113.128'): 'an IPv4 test net address'}, self._AddressSpace__networks={}, self._AddressSpace__parent_supernet={IPv4Address('203.0.113.128'): None}, self._AddressSpace__strict=False)

AddressSpace(_AddressSpace__strict=False, _AddressSpace__description={IPv4Address('203.0.113.128'): 'an IPv4 test net address'}, _AddressSpace__networks={}, _AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, _AddressSpace__parent_supernet={IPv4Address('203.0.113.128'): None}, _AddressSpace__children_ip_object={None: set()})

AddressSpace(_AddressSpace__strict=False, _AddressSpace__description={IPv4Address('203.0.113.128'): 'an IPv4 test net address'}, _AddressSpace__networks={}, _AddressSpace__addresses={4: {IPv4Address('203.0.113.128')}}, _AddressSpace__parent_supernet={}, _AddressSpace__children_ip_object={None: set()})


def _test_grad_nd(n, ndim):
    coords = [np.arange(n)] * ndim
    xc = np.meshgrid(*coords, indexing="ij")
    u = reduce(lambda x,y: x+y**2, xc, 0.0)
    ucopy = np.copy(u)
    slices = tuple([slice(1,-1,None)] * ndim)
    for i in range(ndim):
        assert grad(u, axis=i) == pytest.approx(2*xc[i][slices])
    assert np.all(u == ucopy)
_test_grad_nd(n=92, ndim=1)


xc = np.meshgrid(*coords, indexing="ij")


slices = tuple([slice(1,-1,None)] * ndim)


def get_idx(ndim, axis=None, axis_idx=None):
    s = [midx] * ndim
    if axis is not None:
        if hasattr(axis, "__iter__"):
            for ax, axidx in zip(axis, axis_idx):
                s[ax] = axidx
        else:
            s[axis] = axis_idx
    return tuple(s)
get_idx(ndim=1, axis=0, axis_idx=slice(None, -2, None))


def _test_grad2_nd(n, ndim):
    coords = [np.arange(n)] * ndim
    xc = np.meshgrid(*coords, indexing="ij")
    u = reduce(lambda x,y: x+y**2, xc, 0.0)
    ucopy = np.copy(u)
    gu = np.zeros(tuple([n-2]*ndim))
    gu2 = gu + 2.0
    for i in range(ndim):
        for j in range(ndim):
            if i == j:
                assert grad2(u, axes=(i,j)) == pytest.approx(gu2)
            else:
                assert grad2(u, axes=(i,j)) == pytest.approx(gu)
    assert np.all(u == ucopy)
_test_grad2_nd(n=32, ndim=1)


def _get_default_expanded_coordinate(shape, ndim):
    x_coords = []
    for i in range(ndim):
        idx = [None] * ndim
        idx[i] = slice(None, None, None)
        x_coords.append(np.arange(shape[i])[tuple(idx)])
    return x_coords
_get_default_expanded_coordinate(shape=array([102]), ndim=1)


idx_pad0_l = _get_idx(ndim, dim, slice(pw[0], pw[0]+1, None))


idx_pad0_r = _get_idx(ndim, dim, slice(pw[0]+1, pw[0]+2, None))


idx_pad0 = _get_idx(ndim, dim, slice(pw[0], pw[0]+1, None))


idx_pad0_fill = _get_idx(ndim, dim, slice(None, pw[0], None))


def _get_idx(ndim, dim, s, defidx=None):
    defidx = slice(None, None, None) if defidx is None else defidx
    idx = [defidx] * ndim
    idx[dim] = s
    return tuple(idx)
_get_idx(ndim=1, dim=0, s=slice(1, 2, None), defidx=None)


def _test_forward_nd_slanted_pot(n, ndim, abs=None):
    x = np.arange(n) - n / 2.0
    xs = np.meshgrid(*([x]*ndim), indexing="ij")
    xs_sq = reduce(lambda x,y:x+y*y, xs, 0.0)
    A = n / 6.0
    sigma = (n/30.)
    source = np.exp(-xs_sq / (2*sigma**2))
    source_copy = np.copy(source)
    phi = xs[0] * A
    target = sb.forward(source, phi)
    xs2 = np.copy(xs)
    xs2[0] -= A
    xs2_sq = reduce(lambda x,y:x+y*y, xs2, 0.0)
    target_calc = np.exp(-xs2_sq / (2*sigma**2))
    abs = 2.5/n if abs is None else abs
    assert target == pytest.approx(target_calc, abs=abs)
    assert np.ndim(target) == ndim
    assert np.all(source == source_copy)
_test_forward_nd_slanted_pot(n=100, ndim=1, abs=None)


xs = np.meshgrid(*([x]*ndim), indexing="ij")


xs_sq = reduce(lambda x,y:x+y*y, xs, 0.0)


def _test_forward_nd_quad_pot(n, ndim, abs=None):
    x = np.arange(n) - n / 2.0
    xs = np.meshgrid(*([x]*ndim), indexing="ij")
    xs_sq = reduce(lambda x,y:x+y*y, xs, 0.0)
    B = 1.0
    scale = 1 + B
    sigma = (n/30.)
    source = np.exp(-xs_sq / (2*sigma**2))
    source_copy = np.copy(source)
    phi = 0.5*B*xs_sq
    target = sb.forward(source, phi)
    target_calc = (scale**-ndim)*np.exp(-xs_sq / (2*(sigma*scale)**2))
    abs = 2.5/n if abs is None else abs
    assert target == pytest.approx(target_calc, abs=abs)
    assert np.ndim(target) == ndim
    assert np.all(source == source_copy)
_test_forward_nd_quad_pot(n=100, ndim=1, abs=None)


def _write_sectionindex(self):
        all_keys = []
        all_start = []
        all_stop = []
        prev_divider = False
        for idx, ln in enumerate(self.description):
            if prev_divider is True and any([h == ln.rstrip() for h in self._section_headings]):
                key = ln[1:].rstrip().lstrip()
                if len(all_start) > 0:
                    all_stop.append(idx - 1)
                all_keys.append(key)
                all_start.append(idx)
                prev_divider = False
            if DIVIDER in ln:
                prev_divider = True
        all_stop.append(self.data_beginline)
        section_map = collections.defaultdict(list)
        for (k, start, stop) in zip(all_keys, all_start, all_stop):
            section_map[k].append((start, stop))
        section_map.default_factory = None
        self.sectionindex = section_map
_write_sectionindex(self=<proxysiphon.proxychimp.Guts object at 0x7f9f0263ae20>, self._section_headings=['

['# Contribution_Date', '# Title', '# Investigators', '# NOTE: Please cite original publication, online resource and date accessed when using this data.', '# Description and Notes', '# Publication', '# Funding_Agency', '# Site Information', '# Data_Collection', '# Species', '# Chronology_Information', '# Variables', '# Data']

'#------------------------\n# Contribution_Date\n#\n#------------------------\n# Title\n#\n#------------------------\n# Chronology_Information\n#\n# Labcode\tdepth_top\tdepth_bottom\tmat_dated\t14C_date\t14C_1s_err\tdelta_R\tdelta_R_1s_err\tother_date\tother_1s_err\tother_type\t\n# 152757\t5\t6\tG. ruber or mixed planktonic\t475\t30\t188\t73\t-999\t-999\t-999\t\n#\n#------------------------\n# Data\n# Data lines follow (have no #)\n# Missing Value: -999\ndepth\tage\tbacon\n1\t2\t3\n4\t5\t6'

defaultdict(None, {'Contribution_Date': [(1, 3)], 'Title': [(4, 6)], 'Chronology_Information': [(7, 12)], 'Data': [(13, 16)]})

['Contribution_Date', 'Title', 'Chronology_Information', 'Data']

defaultdict(<class 'list'>, {'Contribution_Date': [(1, 3)]})

defaultdict(<class 'list'>, {'Contribution_Date': [(1, 3)], 'Title': [(4, 6)]})

defaultdict(<class 'list'>, {'Contribution_Date': [(1, 3)], 'Title': [(4, 6)], 'Chronology_Information': [(7, 12)]})

defaultdict(<class 'list'>, {'Contribution_Date': [(1, 3)], 'Title': [(4, 6)], 'Chronology_Information': [(7, 12)], 'Data': [(13, 16)]})


def guess_missingvalues(self):
        section = self.pull_section('Data')[0]
        out = None
        for ln in section:
            if MISSINGVALUE_LABEL in ln:
                out = ln.split(MISSINGVALUE_LABEL)[1]
        log.debug('Guessed missing value(s): {}'.format(out))
        return out
guess_missingvalues(self=<proxysiphon.proxychimp.Guts object at 0x7f9f025d1f10>, self._section_headings=['

['#------------------------', '# NOTE: Please cite original publication, online resource and date accessed when using this data.', '# If there is no publication information, please cite Investigator,', '#', '# Description/Documentation lines begin with #', '# Data lines have no #', '#', '# Online_Resource: http://www.ncdc.noaa.gov/paleo/study/', '# Online_Resource: http://www1.ncdc.noaa.gov/pub/data/paleo/', '#', '# Original_Source_URL: https://www.ncdc.noaa.gov/paleo-search/study/2622', '#------------------------', '# Contribution_Date', '#', '#------------------------', '# Title', '#', '#------------------------', '# Data_Collection', '#   Collection_Name: P178-15P', '#   First_Year: 39485', '#   Last_Year: -18', '#   Time_Unit: cal yr BP', '#   Core_Length: ', '#   Notes: mg_red', '#   Collection_Year: 1923', '#------------------------', '# Site Information', '# Site_Name: P178-15P', '# Location: Arabian Sea', '# Country: ', '# Northernmost_Latitude: 11.955', '# Southernmost_Latitude: 11.955', '# Easternmost_Longitude: 44.3', '# Westernmost_Longitude: 44.3', '# Elevation: -869', '#------------------------', '# Description and Notes', '#        Description: d18O sacc from 2003 paper, mg/ca sacc from 2002 paper, alkeno', '#------------------------', '# Publication', '# Authors: Tierney, Jessica E.; Pausata, Francesco S. R.; deMenocal, Peter B.', '# Published_Date_or_Year: 2016', '# Published_Title: Deglacial Indian monsoon failure and North Atlantic stadials linked by Indian Ocean surface cooling', '# Journal_Name: Nature Geoscience', '# Volume: 9', '# Edition: ', '# Issue: ', '# Pages: 46-50', '# Report Number: ', '# DOI: 10.1038/ngeo2603', '# Online_Resource: ', '# Full_Citation: ', '# Abstract:', '#------------------------', '# Chronology_Information', '#', '# Labcode\tdepth_top\tdepth_bottom\tmat_dated\t14C_date\t14C_1s_err\tdelta_R\tdelta_R_1s_err\tother_date\tother_1s_err\tother_type\t', '#', '#---------------------------------------', '# Variables', '# Data variables follow that are preceded by "##" in columns one and two.', '# Variables list, one per line, shortname-tab-longname components (9 components: what, material, error, units, seasonality, archive, detail, method, C or N for Character or Numeric data)', '## depth\t,,,cm,,,,,', '## age\t,,,cal yr BP,,,,,', '## bacon\t,,,index,,,,,', '#------------------------', '# Data', '# Data lines follow (have no #)', '# Missing Value: -999']

{'encoding': 'ascii', 'confidence': 1.0, 'language': ''}

'#------------------------\n# NOTE: Please cite original publication, online resource and date accessed when using this data.\n# If there is no publication information, please cite Investigator,\n#\n# Description/Documentation lines begin with #\n# Data lines have no #\n#\n# Online_Resource: http://www.ncdc.noaa.gov/paleo/study/\n# Online_Resource: http://www1.ncdc.noaa.gov/pub/data/paleo/\n#\n# Original_Source_URL: https://www.ncdc.noaa.gov/paleo-search/study/2622\n#------------------------\n# Contribution_Date\n#\n#------------------------\n# Title\n#\n#------------------------\n# Data_Collection\n#   Collection_Name: P178-15P\n#   First_Year: 39485\n#   Last_Year: -18\n#   Time_Unit: cal yr BP\n#   Core_Length: \n#   Notes: mg_red\n#   Collection_Year: 1923\n#------------------------\n# Site Information\n# Site_Name: P178-15P\n# Location: Arabian Sea\n# Country: \n# Northernmost_Latitude: 11.955\n# Southernmost_Latitude: 11.955\n# Easternmost_Longitude: 44.3\n# Westernmost_Longitude: 44.3\n# Elevation: -869\n#------------------------\n# Description and Notes\n#        Description: d18O sacc from 2003 paper, mg/ca sacc from 2002 paper, alkeno\n#------------------------\n# Publication\n# Authors: Tierney, Jessica E.; Pausata, Francesco S. R.; deMenocal, Peter B.\n# Published_Date_or_Year: 2016\n# Published_Title: Deglacial Indian monsoon failure and North Atlantic stadials linked by Indian Ocean surface cooling\n# Journal_Name: Nature Geoscience\n# Volume: 9\n# Edition: \n# Issue: \n# Pages: 46-50\n# Report Number: \n# DOI: 10.1038/ngeo2603\n# Online_Resource: \n# Full_Citation: \n# Abstract:\n#------------------------\n# Chronology_Information\n#\n# Labcode\tdepth_top\tdepth_bottom\tmat_dated\t14C_date\t14C_1s_err\tdelta_R\tdelta_R_1s_err\tother_date\tother_1s_err\tother_type\t\n#\n#---------------------------------------\n# Variables\n# Data variables follow that are preceded by "##" in columns one and two.\n# Variables list, one per line, shortname-tab-longname components (9 components: what, material, error, units, seasonality, archive, detail, method, C or N for Character or Numeric data)\n## depth\t,,,cm,,,,,\n## age\t,,,cal yr BP,,,,,\n## bacon\t,,,index,,,,,\n#------------------------\n# Data\n# Data lines follow (have no #)\n# Missing Value: -999\ndepth\tage\tbacon\n1\t2\t3\n4\t5\t6'

defaultdict(None, {'NOTE: Please cite original publication, online resource and date accessed when using this data.': [(1, 11)], 'Contribution_Date': [(12, 14)], 'Title': [(15, 17)], 'Data_Collection': [(18, 26)], 'Site Information': [(27, 36)], 'Description and Notes': [(37, 39)], 'Publication': [(40, 54)], 'Chronology_Information': [(55, 59)], 'Variables': [(60, 66)], 'Data': [(67, 70)]})

['# Data', '# Data lines follow (have no #)', '# Missing Value: -999']


def yank_chron_df(self, section_name='Chronology_Information', missingvalues=None):
        if missingvalues is None:
            missingvalues = [-999, 'NaN']
        section = self.pull_section(section_name)[0]
        start_idx = section.index(CHRON_HEADER)
        g_chrond = section[start_idx:]
        g_chrond_cleaned = [x[2:].rstrip() for x in g_chrond]
        data_bytes = '\n'.join(g_chrond_cleaned).encode('utf-8')
        df = pd.read_csv(BytesIO(data_bytes), sep='\t', na_values=missingvalues)
        return df
yank_chron_df(self=<proxysiphon.proxychimp.Guts object at 0x7f9f025d1f10>, section_name='Chronology_Information', missingvalues=None, self._section_headings=['

['# Chronology_Information', '#', '# Labcode\tdepth_top\tdepth_bottom\tmat_dated\t14C_date\t14C_1s_err\tdelta_R\tdelta_R_1s_err\tother_date\tother_1s_err\tother_type\t', '#']

Empty DataFrameColumns: [Labcode, depth_top, depth_bottom, mat_dated, 14C_date, 14C_1s_err, delta_R, delta_R_1s_err, other_date, other_1s_err, other_type]Index: []


['# Chronology_Information', '#', '# Labcode\tdepth_top\tdepth_bottom\tmat_dated\t14C_date\t14C_1s_err\tdelta_R\tdelta_R_1s_err\tother_date\tother_1s_err\tother_type\t', '#']


g_chrond_cleaned = [x[2:].rstrip() for x in g_chrond]  # Removes the '# ' and ending white space.


df = pd.read_csv(BytesIO(data_bytes), sep='\t', na_values=missingvalues)

Empty DataFrameColumns: [Labcode, depth_top, depth_bottom, mat_dated, 14C_date, 14C_1s_err, delta_R, delta_R_1s_err, other_date, other_1s_err, other_type]Index: []


def _reset_state(self):
        self._inside_file_metadata = False
        self._inside_output = False
        self._default_stream_found = False
        self._current_input_file = {"streams": []}
        self._current_stream = None
        self._current_chapter = None
        self.result = {
            "video_found": False,
            "audio_found": False,
            "metadata": {},
            "inputs": [],
        }
        self._last_metadata_field_added = None
_reset_state(self=<moviepy.video.io.ffmpeg_reader.FFmpegInfosParser object at 0x7f8c0a6795e0>, self.check_duration=True, self.duration_tag_separator='Duration: ', self.filename='media/bitmap.mp4', self.fps_source='fps', self.infos="Input

"Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'media/bitmap.mp4':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    encoder         : Lavf58.20.100\n  Duration: 00:00:05.00, start: 0.000000, bitrate: 2 kb/s\n    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1x1, 1 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc (default)\n    Metadata:\n      handler_name    : VideoHandler\nAt least one output file must be specified\n"

{'video_found': False, 'audio_found': False, 'metadata': {}, 'inputs': []}


def parse(self):
        input_chapters = []
        for line in self.infos.splitlines()[1:]:
            if (
                self.duration_tag_separator == "time="
                and self.check_duration
                and "time=" in line
            ):
                self.result["duration"] = self.parse_duration(line)
            elif self._inside_output or line[0] != " ":
                if self.duration_tag_separator == "time=" and not self._inside_output:
                    self._inside_output = True
            elif not self._inside_file_metadata and line.startswith("  Metadata:"):
                self._inside_file_metadata = True
            elif line.startswith("  Duration:"):
                self._inside_file_metadata = False
                if self.check_duration and self.duration_tag_separator == "Duration: ":
                    self.result["duration"] = self.parse_duration(line)
                bitrate_match = re.search(r"bitrate: (\d+) kb/s", line)
                self.result["bitrate"] = (
                    int(bitrate_match.group(1)) if bitrate_match else None
                )
                start_match = re.search(r"start: (\d+\.?\d+)", line)
                self.result["start"] = (
                    float(start_match.group(1)) if start_match else None
                )
            elif self._inside_file_metadata:
                field, value = self.parse_metadata_field_value(line)
                if field == "":
                    field = self._last_metadata_field_added
                    value = self.result["metadata"][field] + "\n" + value
                else:
                    self._last_metadata_field_added = field
                self.result["metadata"][field] = value
            elif line.lstrip().startswith("Stream "):
                if self._current_stream:
                    self._current_input_file["streams"].append(self._current_stream)
                main_info_match = re.search(
                    r"^Stream\s
                    line.lstrip(),
                )
                (
                    input_number,
                    stream_number,
                    language,
                    stream_type,
                ) = main_info_match.groups()
                input_number = int(input_number)
                stream_number = int(stream_number)
                stream_type_lower = stream_type.lower()
                if language == "und":
                    language = None
                self._current_stream = {
                    "input_number": input_number,
                    "stream_number": stream_number,
                    "stream_type": stream_type_lower,
                    "language": language,
                    "default": not self._default_stream_found
                    or line.endswith("(default)"),
                }
                self._default_stream_found = True
                if self._current_stream["default"]:
                    self.result[
                        f"default_{stream_type_lower}_input_number"
                    ] = input_number
                    self.result[
                        f"default_{stream_type_lower}_stream_number"
                    ] = stream_number
                if self._current_chapter:
                    input_chapters[input_number].append(self._current_chapter)
                    self._current_chapter = None
                if "input_number" not in self._current_input_file:
                    self._current_input_file["input_number"] = input_number
                elif self._current_input_file["input_number"] != input_number:
                    if len(input_chapters) >= input_number + 1:
                        self._current_input_file["chapters"] = input_chapters[
                            input_number
                        ]
                    self.result["inputs"].append(self._current_input_file)
                    self._current_input_file = {"input_number": input_number}
                try:
                    global_data, stream_data = self.parse_data_by_stream_type(
                        stream_type, line
                    )
                except NotImplementedError as exc:
                    warnings.warn(
                        f"{str(exc)}\nffmpeg output:\n\n{self.infos}", UserWarning
                    )
                else:
                    self.result.update(global_data)
                    self._current_stream.update(stream_data)
            elif line.startswith("    Metadata:"):
                continue
            elif self._current_stream:
                if "metadata" not in self._current_stream:
                    self._current_stream["metadata"] = {}
                field, value = self.parse_metadata_field_value(line)
                if self._current_stream["stream_type"] == "video":
                    field, value = self.video_metadata_type_casting(field, value)
                    if field == "rotate":
                        self.result["video_rotation"] = value
                if field == "":
                    field = self._last_metadata_field_added
                    value = self._current_stream["metadata"][field] + "\n" + value
                else:
                    self._last_metadata_field_added = field
                self._current_stream["metadata"][field] = value
            elif line.startswith("    Chapter"):
                if self._current_chapter:
                    if len(input_chapters) < self._current_chapter["input_number"] + 1:
                        input_chapters.append([])
                    input_chapters[self._current_chapter["input_number"]].append(
                        self._current_chapter
                    )
                chapter_data_match = re.search(
                    r"^    Chapter
                    line,
                )
                input_number, chapter_number, start, end = chapter_data_match.groups()
                self._current_chapter = {
                    "input_number": int(input_number),
                    "chapter_number": int(chapter_number),
                    "start": float(start),
                    "end": float(end),
                }
            elif self._current_chapter:
                if "metadata" not in self._current_chapter:
                    self._current_chapter["metadata"] = {}
                field, value = self.parse_metadata_field_value(line)
                if field == "":
                    field = self._last_metadata_field_added
                    value = self._current_chapter["metadata"][field] + "\n" + value
                else:
                    self._last_metadata_field_added = field
                self._current_chapter["metadata"][field] = value
        if self._current_input_file:
            self._current_input_file["streams"].append(self._current_stream)
            if len(input_chapters) == self._current_input_file["input_number"] + 1:
                self._current_input_file["chapters"] = input_chapters[
                    self._current_input_file["input_number"]
                ]
            self.result["inputs"].append(self._current_input_file)
        if self.result["video_found"] and self.check_duration:
            self.result["video_n_frames"] = int(
                self.result["duration"] * self.result["video_fps"]
            )
            self.result["video_duration"] = self.result["duration"]
        else:
            self.result["video_n_frames"] = 1
            self.result["video_duration"] = None
        if self.result["audio_found"] and not self.result.get("audio_bitrate"):
            self.result["audio_bitrate"] = None
            for streams_input in self.result["inputs"]:
                for stream in streams_input["streams"]:
                    if stream["stream_type"] == "audio" and stream.get("bitrate"):
                        self.result["audio_bitrate"] = stream["bitrate"]
                        break
                if self.result["audio_bitrate"] is not None:
                    break
        result = self.result
        self._reset_state()
        return result
parse(self=<moviepy.video.io.ffmpeg_reader.FFmpegInfosParser object at 0x7f8c0a6795e0>, self._current_chapter=None, self._current_input_file={'streams': []}, self._current_stream=None, self._default_stream_found=False, self._inside_file_metadata=False, self._inside_output=False, self._last_metadata_field_added=None, self.check_duration=True, self.duration_tag_separator='Duration: ', self.filename='media/bitmap.mp4', self.fps_source='fps', self.infos="Input

{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True}

{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [1, 1], 'bitrate': 1, 'fps': 1.0}

{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [1, 1], 'bitrate': 1, 'fps': 1.0, 'metadata': {}}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom'}, 'inputs': []}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512'}, 'inputs': []}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41'}, 'inputs': []}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': []}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [], 'duration': 5.0}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [], 'duration': 5.0, 'bitrate': 2}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [], 'duration': 5.0, 'bitrate': 2, 'start': 0.0}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0}

{'video_found': False, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0}

{'video_found': True, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [1, 1], 'video_bitrate': 1, 'video_fps': 1.0}

{'video_found': True, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [{'streams': [{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [1, 1], 'bitrate': 1, 'fps': 1.0, 'metadata': {'handler_name': 'VideoHandler'}}], 'input_number': 0}], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [1, 1], 'video_bitrate': 1, 'video_fps': 1.0}

{'video_found': True, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [{'streams': [{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [1, 1], 'bitrate': 1, 'fps': 1.0, 'metadata': {'handler_name': 'VideoHandler'}}], 'input_number': 0}], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [1, 1], 'video_bitrate': 1, 'video_fps': 1.0, 'video_n_frames': 5}

{'video_found': True, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [{'streams': [{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [1, 1], 'bitrate': 1, 'fps': 1.0, 'metadata': {'handler_name': 'VideoHandler'}}], 'input_number': 0}], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [1, 1], 'video_bitrate': 1, 'video_fps': 1.0, 'video_n_frames': 5, 'video_duration': 5.0}

'    compatible_brands: isomiso2avc1mp41'

'    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1x1, 1 kb/s, 1 fps, 1 tbr, 16384 tbn, 2 tbc (default)'

'At least one output file must be specified'

<re.Match object; span=(42, 57), match='bitrate: 2 kb/s'>

<re.Match object; span=(25, 40), match='start: 0.000000'>

<re.Match object; span=(0, 24), match='Stream #0:0(und): Video:'>

{'video_found': True, 'video_size': [1, 1], 'video_bitrate': 1, 'video_fps': 1.0}


def parse_video_stream_data(self, line):
        global_data, stream_data = ({"video_found": True}, {})
        try:
            match_video_size = re.search(r" (\d+)x(\d+)[,\s]", line)
            if match_video_size:
                stream_data["size"] = [int(num) for num in match_video_size.groups()]
        except Exception:
            raise IOError(
                (
                    "MoviePy error: failed to read video dimensions in"
                    " file '%s'.\nHere are the file infos returned by"
                    "ffmpeg:\n\n%s"
                )
                % (self.filename, self.infos)
            )
        match_bitrate = re.search(r"(\d+) kb/s", line)
        stream_data["bitrate"] = int(match_bitrate.group(1)) if match_bitrate else None
        if self.fps_source == "fps":
            try:
                fps = self.parse_fps(line)
            except (AttributeError, ValueError):
                fps = self.parse_tbr(line)
        elif self.fps_source == "tbr":
            try:
                fps = self.parse_tbr(line)
            except (AttributeError, ValueError):
                fps = self.parse_fps(line)
        else:
            raise ValueError(
                ("fps source '%s' not supported parsing the video '%s'")
                % (self.fps_source, self.filename)
            )
        coef = 1000.0 / 1001.0
        for x in [23, 24, 25, 30, 50]:
            if (fps != x) and abs(fps - x * coef) < 0.01:
                fps = x * coef
        stream_data["fps"] = fps
        if self._current_stream["default"] or "video_size" not in self.result:
            global_data["video_size"] = stream_data.get("size", None)
        if self._current_stream["default"] or "video_bitrate" not in self.result:
            global_data["video_bitrate"] = stream_data.get("bitrate", None)
        if self._current_stream["default"] or "video_fps" not in self.result:
            global_data["video_fps"] = stream_data["fps"]
        return (global_data, stream_data)
parse_video_stream_data(self=<moviepy.video.io.ffmpeg_reader.FFmpegInfosParser object at 0x7f8c0a6795e0>, line='    Stream

{'video_found': True, 'video_size': [1, 1]}

{'video_found': True, 'video_size': [1, 1], 'video_bitrate': 1}

<re.Match object; span=(87, 92), match=' 1x1,'>

<re.Match object; span=(93, 99), match='1 kb/s'>


def read_frame(self):
        w, h = self.size
        nbytes = self.depth * w * h
        s = self.proc.stdout.read(nbytes)
        if len(s) != nbytes:
            warnings.warn(
                (
                    "In file %s, %d bytes wanted but %d bytes read at frame index"
                    " %d (out of a total %d frames), at time %.02f/%.02f sec."
                    " Using the last valid frame instead."
                )
                % (
                    self.filename,
                    nbytes,
                    len(s),
                    self.pos,
                    self.n_frames,
                    1.0 * self.pos / self.fps,
                    self.duration,
                ),
                UserWarning,
            )
            if not hasattr(self, "last_read"):
                raise IOError(
                    (
                        "MoviePy error: failed to read the first frame of "
                        f"video file {self.filename}. That might mean that the file is "
                        "corrupted. That may also mean that you are using "
                        "a deprecated version of FFMPEG. On Ubuntu/Debian "
                        "for instance the version in the repos is deprecated. "
                        "Please update to a recent version from the website."
                    )
                )
            result = self.last_read
        else:
            if hasattr(np, "frombuffer"):
                result = np.frombuffer(s, dtype="uint8")
            else:
                result = np.fromstring(s, dtype="uint8")
            result.shape = (h, w, len(s) // (w * h))
            self.last_read = result
        self.pos += 1
        return result
read_frame(self=<moviepy.video.io.ffmpeg_reader.FFMPEG_VideoReader object at 0x7f8c0a679fd0>, self.bitrate=1, self.bufsize=103, self.depth=3, self.duration=5.0, self.ffmpeg_duration=5.0, self.filename='media/bitmap.mp4', self.fps=1.0, self.infos={'video_found': True, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf58.20.100'}, 'inputs': [{'streams': [{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [1, 1], 'bitrate': 1, 'fps': 1.0, 'metadata': {'handler_name': 'VideoHandler'}}], 'input_number': 0}], 'duration': 5.0, 'bitrate': 2, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [1, 1], 'video_bitrate': 1, 'video_fps': 1.0, 'video_n_frames': 5, 'video_duration': 5.0}, self.n_frames=5, self.pixel_format='rgb24', self.pos=0, self.proc=<Popen: returncode: None args: ['/local/rcs/XXX/miniforge3/envs/Zulko+mov...>, self.resize_algo='bicubic', self.rotation=0, self.size=[1, 1])


def parse_audio_stream_data(self, line):
        global_data, stream_data = ({"audio_found": True}, {})
        try:
            stream_data["fps"] = int(re.search(r" (\d+) Hz", line).group(1))
        except (AttributeError, ValueError):
            stream_data["fps"] = "unknown"
        match_audio_bitrate = re.search(r"(\d+) kb/s", line)
        stream_data["bitrate"] = (
            int(match_audio_bitrate.group(1)) if match_audio_bitrate else None
        )
        if self._current_stream["default"]:
            global_data["audio_fps"] = stream_data["fps"]
            global_data["audio_bitrate"] = stream_data["bitrate"]
        return (global_data, stream_data)
parse_audio_stream_data(self=<moviepy.video.io.ffmpeg_reader.FFmpegInfosParser object at 0x7f8c0a679f10>, line='    Stream

'    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)'

{'streams': [{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [640, 360], 'bitrate': 495, 'fps': 25.0, 'metadata': {'handler_name': 'VideoHandler'}}], 'input_number': 0}

{'input_number': 0, 'stream_number': 1, 'stream_type': 'audio', 'language': None, 'default': True}

"Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'media/chaplin.mp4':\n  Metadata:\n    major_brand     : isom\n    minor_version   : 512\n    compatible_brands: isomiso2avc1mp41\n    encoder         : Lavf57.25.100\n  Duration: 00:00:09.64, start: 0.000000, bitrate: 631 kb/s\n    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 495 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)\n    Metadata:\n      handler_name    : VideoHandler\n    Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)\n    Metadata:\n      handler_name    : SoundHandler\nAt least one output file must be specified\n"

{'video_found': True, 'audio_found': False, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf57.25.100'}, 'inputs': [], 'duration': 9.64, 'bitrate': 631, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [640, 360], 'video_bitrate': 495, 'video_fps': 25.0, 'default_audio_input_number': 0, 'default_audio_stream_number': 1}

<re.Match object; span=(78, 86), match='127 kb/s'>

{'audio_found': True, 'audio_fps': 44100}

{'audio_found': True, 'audio_fps': 44100, 'audio_bitrate': 127}


def buffer_around(self, frame_number):
        new_bufferstart = max(0, frame_number - self.buffersize // 2)
        if self.buffer is not None:
            current_f_end = self.buffer_startframe + self.buffersize
            if new_bufferstart < current_f_end < new_bufferstart + self.buffersize:
                conserved = current_f_end - new_bufferstart
                chunksize = self.buffersize - conserved
                array = self.read_chunk(chunksize)
                self.buffer = np.vstack([self.buffer[-conserved:], array])
            else:
                self.seek(new_bufferstart)
                self.buffer = self.read_chunk(self.buffersize)
        else:
            self.seek(new_bufferstart)
            self.buffer = self.read_chunk(self.buffersize)
        self.buffer_startframe = new_bufferstart
buffer_around(self=<moviepy.audio.io.readers.FFMPEG_AudioReader object at 0x7f8c0a2042e0>, frame_number=1, self.bitrate=127, self.buffer=None, self.buffer_startframe=1, self.buffersize=200000, self.codec='pcm_s16le', self.duration=9.64, self.filename='media/chaplin.mp4', self.format='s16le', self.fps=44100, self.infos={'video_found': True, 'audio_found': True, 'metadata': {'major_brand': 'isom', 'minor_version': '512', 'compatible_brands': 'isomiso2avc1mp41', 'encoder': 'Lavf57.25.100'}, 'inputs': [{'streams': [{'input_number': 0, 'stream_number': 0, 'stream_type': 'video', 'language': None, 'default': True, 'size': [640, 360], 'bitrate': 495, 'fps': 25.0, 'metadata': {'handler_name': 'VideoHandler'}}, {'input_number': 0, 'stream_number': 1, 'stream_type': 'audio', 'language': None, 'default': True, 'fps': 44100, 'bitrate': 127, 'metadata': {'handler_name': 'SoundHandler'}}], 'input_number': 0}], 'duration': 9.64, 'bitrate': 631, 'start': 0.0, 'default_video_input_number': 0, 'default_video_stream_number': 0, 'video_size': [640, 360], 'video_bitrate': 495, 'video_fps': 25.0, 'default_audio_input_number': 0, 'default_audio_stream_number': 1, 'audio_fps': 44100, 'audio_bitrate': 127, 'video_n_frames': 241, 'video_duration': 9.64}, self.n_frames=425124, self.nbytes=2, self.nchannels=2, self.pos=0, self.proc=<Popen: returncode: None args: ['/local/rcs/XXX/miniforge3/envs/Zulko+mov...>)