OpenPecha / Toolkit

🛠 Tools to create, edit and export texts and annotations
https://toolkit.openpecha.org
Apache License 2.0
7 stars 4 forks source link

`create_opf`should provide which type of `OpenPecha` object should be created #225

Open 10zinten opened 1 year ago

10zinten commented 1 year ago

since, we have separated git logic from OpenPechaFS into OpenPechaGitRepo with https://github.com/OpenPecha/Toolkit/pull/224 the create_opf should be flexible enough to return any type of OpenPecha variant.

Suggestions

  1. Class dependency injection

Cons:

def create_opf(self, ..., pecha_class: OpenPecha):
    pecha = pecha_class(metadata=metadata)
    ...
    return pecha
  1. Object dependency injection

    Cons:

    • no code completion with modern code editor
def create_opf(self, ..., pecha: OpenPecha):
    ...
    return pecha
eroux commented 1 year ago

I like the object dependency injection better