Skip to content
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

Import Final from typing or typing_extensions depending on the Python version #4692

Merged
merged 1 commit into from
May 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/streamlit/elements/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,29 @@
# limitations under the License.

import io
from streamlit.scriptrunner import ScriptRunContext, get_script_run_ctx

from streamlit.type_util import Key, to_key
import sys
from typing import cast, Optional, Union, BinaryIO, TextIO
from typing_extensions import Final
from textwrap import dedent

if sys.version_info >= (3, 8):
from typing import Final
else:
from typing_extensions import Final

import streamlit
from streamlit.errors import StreamlitAPIException
from streamlit.proto.Button_pb2 import Button as ButtonProto
from streamlit.in_memory_file_manager import in_memory_file_manager
from streamlit.proto.DownloadButton_pb2 import DownloadButton as DownloadButtonProto
from streamlit.scriptrunner import ScriptRunContext, get_script_run_ctx
from streamlit.state import (
register_widget,
WidgetArgs,
WidgetCallback,
WidgetKwargs,
)
from streamlit.type_util import Key, to_key

from .form import current_form_id, is_in_form
from .utils import check_callback_rules, check_session_state_rules

Expand Down