Skip to content

Remove the duplicate logic in connection classes #355

@ItsDrike

Description

@ItsDrike

There is a couple of methods with duplicated logic. Maybe we should do it in one method with dict or possibly with an enum class?

from enum import Enum

class ValueType(Enum):
    FULL_NAME = "Q"
    ...

def write_value_with_type(self, value: int, type: ValueType) -> None:
    self.write(self._pack(type.value, value))

write_value_with_type(123, ValueType.FULL_NAME)

https://docs.python.org/3/library/enum.html

Originally posted by @PerchunPak in #273 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: protocolRelated to underlying networking protocolt: enhancementImprovement to an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions