Skip to content

Refactor: separete the generic framework code from stub geration #86

Description

@oseasandrepro

Inside srpc_sutb_util.py should have only operations for reflection to handle the files .py _interface.py

I am thinking of using the factory pattern to generate stubs for each language.

Look at an example below from How to Use the Factory Pattern in Python - A Practical Guide

class EmailNotifier:
    def send(self, message):
        return f"Sending email: {message}"

class SMSNotifier:
    def send(self, message):
        return f"Sending SMS: {message}"

class PushNotifier:
    def send(self, message):
        return f"Sending push notification: {message}"

class NotificationFactory:
    @staticmethod
    def create_notifier(notifier_type):
        if notifier_type == "email":
            return EmailNotifier()
        elif notifier_type == "sms":
            return SMSNotifier()
        elif notifier_type == "push":
            return PushNotifier()
        else:
            raise ValueError(f"Unknown notifier type: {notifier_type}")

Use enums, look at enum documentation enum in Python

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions