diff --git a/py_src/sphn/__init__.pyi b/py_src/sphn/__init__.pyi index 0fd3c71..63ee64a 100644 --- a/py_src/sphn/__init__.pyi +++ b/py_src/sphn/__init__.pyi @@ -70,7 +70,7 @@ def write_wav(filename, data, sample_rate): pass class FileReader: - def __init__(path): + def __init__(self, path): pass @property @@ -121,7 +121,7 @@ class FileReader: pass class OpusStreamReader: - def __init__(sample_rate): + def __init__(self, sample_rate): pass def append_bytes(self, data): @@ -145,7 +145,7 @@ class OpusStreamReader: pass class OpusStreamWriter: - def __init__(sample_rate): + def __init__(self, sample_rate): pass def append_pcm(self, pcm): diff --git a/stub.py b/stub.py index d7b906c..18bfdf4 100644 --- a/stub.py +++ b/stub.py @@ -108,7 +108,10 @@ def pyi_file(obj, indent=""): # Init if obj.__text_signature__: - body += f"{indent}def __init__{obj.__text_signature__}:\n" + ts = obj.__text_signature__ + if len(ts) > 1 and ts.startswith("(") and not ts.startswith("(self"): + ts = "(self, " + ts[1:] + body += f"{indent}def __init__{ts}:\n" body += f"{indent+INDENT}pass\n" body += "\n"