diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-08-24 18:36:05 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-08-24 19:08:00 +0200 |
commit | d14e74ccf60fcb6b6e854b84d5dcefbe6b27ec0f (patch) | |
tree | 8fb7cf4f16f7fdb4f9fc4d24a0adc92d2bfd5fc5 /src/plugins/python | |
parent | 3a59f2f65e1fc4d604e93378ee63a01208296dc6 (diff) | |
download | weechat-d14e74ccf60fcb6b6e854b84d5dcefbe6b27ec0f.zip |
Add compatibility with Python < 3.10 in weechat.pyi
The | syntax for unions is only supported in Python 3.10 and later.
Since Python 3.8 and 3.9 are still supported upstream for a while and we
had a user reporting on IRC that they couldn't use the stub file since
they are using 3.8, change to the old syntax for unions to support this.
There aren't really any drawbacks of this. It's just a bit more verbose,
and a typing import is necessary, but neither of those really matters in
a generated stub file.
Diffstat (limited to 'src/plugins/python')
-rw-r--r-- | src/plugins/python/weechat.pyi | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/python/weechat.pyi b/src/plugins/python/weechat.pyi index 6d743e4c2..49191fa60 100644 --- a/src/plugins/python/weechat.pyi +++ b/src/plugins/python/weechat.pyi @@ -3,7 +3,7 @@ # DO NOT EDIT BY HAND! # -from typing import Dict +from typing import Dict, Union WEECHAT_RC_OK: int = 0 WEECHAT_RC_OK_EAT: int = 1 @@ -539,7 +539,7 @@ def config_new_section(config_file: str, name: str, :: # example - def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: + def my_section_read_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -558,7 +558,7 @@ def config_new_section(config_file: str, name: str, # return weechat.WEECHAT_CONFIG_WRITE_ERROR # return weechat.WEECHAT_CONFIG_WRITE_MEMORY_ERROR - def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: str | None) -> int: + def my_section_create_option_cb(data: str, config_file: str, section: str, option_name: str, value: Union[str, None]) -> int: # ... return weechat.WEECHAT_CONFIG_OPTION_SET_OK_CHANGED # return weechat.WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -594,7 +594,7 @@ def config_search_section(config_file: str, section_name: str) -> str: def config_new_option(config_file: str, section: str, name: str, type: str, description: str, string_values: str, min: int, max: int, - default_value: str | None, value: str | None, null_value_allowed: int, + default_value: Union[str, None], value: Union[str, None], null_value_allowed: int, callback_check_value: str, callback_check_value_data: str, callback_change: str, callback_change_data: str, callback_delete: str, callback_delete_data: str) -> str: |