-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add AIFC module stubs #3075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add AIFC module stubs #3075
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a5b4664
Add AIFC module type stubs
CraftSpider 4f794f2
Fix NamedTuple, use syntax valid in all versions
CraftSpider 14915fa
Remove whitespace inside classes and between functions
CraftSpider 55b8946
More descriptive type names
CraftSpider bac3400
Convert open and openfp to use literal overloads
CraftSpider 98776fd
Add overload for non-literal case
CraftSpider f5bb231
Change `read_frames` return type
CraftSpider File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
from typing import Union, IO, Optional, Type, NamedTuple, List, Tuple, Any, Text, overload | ||
from typing_extensions import Literal | ||
from types import TracebackType | ||
import sys | ||
|
||
class Error(Exception): ... | ||
|
||
_aifc_params = NamedTuple('_aifc_params', [('nchannels', int), ('sampwidth', int), ('framerate', int), | ||
('nframes', int), ('comptype', bytes), ('compname', bytes)]) | ||
|
||
_File = Union[Text, IO[bytes]] | ||
_Marker = Tuple[int, int, bytes] | ||
|
||
class Aifc_read: | ||
def __init__(self, f: _File) -> None: ... | ||
if sys.version_info >= (3, 4): | ||
def __enter__(self) -> Aifc_read: ... | ||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], | ||
exc_tb: Optional[TracebackType]) -> None: ... | ||
def initfp(self, file: IO[bytes]) -> None: ... | ||
def getfp(self) -> IO[bytes]: ... | ||
def rewind(self) -> None: ... | ||
def close(self) -> None: ... | ||
def tell(self) -> int: ... | ||
def getnchannels(self) -> int: ... | ||
def getnframes(self) -> int: ... | ||
def getsampwidth(self) -> int: ... | ||
def getframerate(self) -> int: ... | ||
def getcomptype(self) -> bytes: ... | ||
def getcompname(self) -> bytes: ... | ||
def getparams(self) -> _aifc_params: ... | ||
def getmarkers(self) -> Optional[List[_Marker]]: ... | ||
def getmark(self, id: int) -> _Marker: ... | ||
def setpos(self, pos: int) -> None: ... | ||
def readframes(self, nframes: int) -> str: ... | ||
|
||
class Aifc_write: | ||
def __init__(self, f: _File) -> None: ... | ||
def __del__(self) -> None: ... | ||
if sys.version_info >= (3, 4): | ||
def __enter__(self) -> Aifc_write: ... | ||
def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], | ||
exc_tb: Optional[TracebackType]) -> None: ... | ||
def initfp(self, file: IO[bytes]) -> None: ... | ||
def aiff(self) -> None: ... | ||
def aifc(self) -> None: ... | ||
def setnchannels(self, nchannels: int) -> None: ... | ||
def getnchannels(self) -> int: ... | ||
def setsampwidth(self, sampwidth: int) -> None: ... | ||
def getsampwidth(self) -> int: ... | ||
def setframerate(self, framerate: int) -> None: ... | ||
def getframerate(self) -> int: ... | ||
def setnframes(self, nframes: int) -> None: ... | ||
def getnframes(self) -> int: ... | ||
def setcomptype(self, comptype: bytes, compname: bytes) -> None: ... | ||
def getcomptype(self) -> bytes: ... | ||
def getcompname(self) -> bytes: ... | ||
def setparams(self, params: Tuple[int, int, int, int, bytes, bytes]) -> None: ... | ||
def getparams(self) -> _aifc_params: ... | ||
def setmark(self, id: int, pos: int, name: bytes) -> None: ... | ||
def getmark(self, id: int) -> _Marker: ... | ||
def getmarkers(self) -> Optional[List[_Marker]]: ... | ||
def tell(self) -> int: ... | ||
def writeframesraw(self, data: Any) -> None: ... # Actual type for data is Buffer Protocol | ||
def writeframes(self, data: Any) -> None: ... | ||
def close(self) -> None: ... | ||
|
||
@overload | ||
def open(f: _File, mode: Literal["r", "rb"] = ...) -> Aifc_read: ... | ||
@overload | ||
def open(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ... | ||
CraftSpider marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@overload | ||
def open(f: _File, mode: str) -> Any: ... | ||
|
||
@overload | ||
def openfp(f: _File, mode: Literal["r", "rb"] = ...) -> Aifc_read: ... | ||
@overload | ||
def openfp(f: _File, mode: Literal["w", "wb"]) -> Aifc_write: ... | ||
@overload | ||
def openfp(f: _File, mode: str) -> Any: ... |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.