Skip to content

[Discussion] Typing, tests, formatting, pre-commit #105

@msiwik-epruf

Description

@msiwik-epruf

Hey guys,

(memphis-py==0.2.7)
I just finished deploying docker-compose demo, played with schema, produced and consumed messages.

I would like to contribute and learn project more. Are there any priorities or goals?

First thing i saw when I played with hello example was lacking of types. I see that sometimes bytearray is allowed something Union[bytearray, bytes] and etc, but

async def validate_msg(self, message):
        if self.connection.schema_updates_data[self.internal_station_name] != {}:
            schema_type = self.connection.schema_updates_data[self.internal_station_name]['type']
            if schema_type == "protobuf":
                message = self.validate_protobuf(message) # bytearray | Unknown
                return message
            elif schema_type == "json":
                message = self.validate_json_schema(message) # bytearray 
                return message
            elif schema_type == "graphql":
                message = self.validate_graphql(message) # bytearray | bytes
                return message
        elif not isinstance(message, bytearray):
            raise MemphisSchemaError("Unsupported message type")
        else:
            return message

Also there is on line 802, but on line 29 we import from google.protobuf.message import Message (name conflict)

class Message:
    def __init__(self, message, connection, cg_name):
        self.message = message
        self.connection = connection
        self.cg_name = cg_name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions