diff options
| author | Nadir Chowdhury <[email protected]> | 2021-02-25 02:26:51 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-24 21:26:51 -0500 |
| commit | 63ec23bac24ab62633bdb8fd19b93ecd3fddba7c (patch) | |
| tree | 14ad9433dddf4c056c292a07e2c0e74b79942cdd /discord/opus.py | |
| parent | Fix NameError with invoked_parents (diff) | |
| download | discord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.tar.xz discord.py-63ec23bac24ab62633bdb8fd19b93ecd3fddba7c.zip | |
Code optimisations and refactoring via Sourcery
Diffstat (limited to 'discord/opus.py')
| -rw-r--r-- | discord/opus.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/discord/opus.py b/discord/opus.py index 28b37ae0..94adf338 100644 --- a/discord/opus.py +++ b/discord/opus.py @@ -276,17 +276,14 @@ class _OpusStruct: @staticmethod def get_opus_version() -> str: - if not is_loaded(): - if not _load_default(): - raise OpusNotLoaded() + if not is_loaded() and not _load_default(): + raise OpusNotLoaded() return _lib.opus_get_version_string().decode('utf-8') class Encoder(_OpusStruct): def __init__(self, application=APPLICATION_AUDIO): - if not is_loaded(): - if not _load_default(): - raise OpusNotLoaded() + _OpusStruct.get_opus_version() self.application = application self._state = self._create_state() @@ -342,9 +339,7 @@ class Encoder(_OpusStruct): class Decoder(_OpusStruct): def __init__(self): - if not is_loaded(): - if not _load_default(): - raise OpusNotLoaded() + _OpusStruct.get_opus_version() self._state = self._create_state() |