internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: streamlit/streamlit

Issue:
PyDeck warning Mapbox API key not set
# Summary

Migrated a deck_gl chart to PyDeck API.  When page is run get a UserWarning that the Mapbox API key is not set.  Old deck_gl_chart() function does not display the warning. 

# Steps to reproduce

1:  Get a personal mapbox token,  Verify it is set using streamlit config show

[mapbox]

```
# Configure Streamlit to use a custom Mapbox token for elements like st.deck_gl_chart and st.map. If you don't do this you'll be using Streamlit's own token, which has limitations and is not guaranteed to always work. To get a token for yourself, create an account at https://mapbox.com. It's free! (for moderate usage levels)
# Default: "pk.eyJ1IjoidGhpYWdvdCIsImEiOiJjamh3bm85NnkwMng4M3dydnNveWwzeWNzIn0.vCBDzNsEF2uFSFk2AM0WZQ"
# The value below was set in C:\Users\...path...\.streamlit\config.toml
token = "pk.eyJ1Ijoia25......................."
```

2. Run a PyDeck chart, any demo should do
3. Inspect the output from streamlit run app.py in the shell

## Expected behavior:

map displays, no message in shell

## Actual behavior:

Map displays, shell displays a UserWarning

```
You can now view your Streamlit app in your browser.

  URL: http://localhost:8501

c:\apps\anaconda3\envs\ccadash\lib\site-packages\pydeck\bindings\deck.py:82: UserWarning: Mapbox API key is not set. This may impact available features of pydeck.
  UserWarning,
```

## Is this a regression?

That is, did this use to work the way you expected in the past?
yes

# Debug info

- Streamlit version:0.53.0
- Python version: 3.7.3
- Using Conda? PipEnv? PyEnv? Pex?   Conda
- OS version:   Windows 10
- Browser version:  Chrome  Version 79.0.3945.117 (Official Build) (64-bit)

# Additional information

If needed, add any other context about the problem here. For exmaple, did this bug come from https://discuss.streamlit.io or another site? Link the original source here!



Discussion:

Resolving patch:
diff --git a/lib/streamlit/bootstrap.py b/lib/streamlit/bootstrap.py
--- a/lib/streamlit/bootstrap.py
+++ b/lib/streamlit/bootstrap.py
@@ -159,6 +159,12 @@ def maybe_open_browser():
     ioloop.call_later(BROWSER_WAIT_TIMEOUT_SEC, maybe_open_browser)
 
 
+def _fix_pydeck_mapbox_api_warning():
+    """Sets MAPBOX_API_KEY environment variable needed for PyDeck otherwise it will throw an exception"""
+
+    os.environ["MAPBOX_API_KEY"] = config.get_option("mapbox.token")
+
+
 def _print_url():
     title_message = "You can now view your Streamlit app in your browser."
     named_urls = []
@@ -206,6 +212,7 @@ def run(script_path, command_line, args):
     _fix_matplotlib_crash()
     _fix_tornado_crash()
     _fix_sys_argv(script_path, args)
+    _fix_pydeck_mapbox_api_warning()
 
     # Install a signal handler that will shut down the ioloop
     # and close all our threads


Test patch:
Repository: streamlit/streamlit

Issue:
H3HexagonLayer in pydeck doesn't display
I previously posted this as a feature request but realized it's a bug.
Data loaded in an H3HexagonLayer in pydeck doesn't display. The data I'm hoping to visualize has lat long and hex features. Loading the lat longs into a HexagonLayer works, loading the hex feature into an H3HexagonLayer does not. There's no error message - the map displays with no data overlay. I ran the same code in a notebook without streamlit and it works as expected, so this isn't a pydeck bug.

Here's the relevant code:
```
st.write(
  pdk.Deck(
    mapbox_key='my_key',
    map_style="mapbox://styles/mapbox/light-v9",
    tooltip={"text": "Trips: {count}"},
    initial_view_state=pdk.ViewState(
      latitude=40.763781,
      longitude=-111.894560,
      zoom=10,
      bearing=0,
      pitch=50
    ),
    layers=[
      pdk.Layer(
        "H3HexagonLayer",
        df,
        pickable=True,
        stroked=True,
        filled=True,
        extruded=True,
        get_hexagon="hex",
        get_fill_color=f"[255, (1 - count / {max_count}) * 255, 0]",
        get_elevation='count * 20',
        get_line_color=[255, 255, 255],
        line_width_min_pixels=2,
      ),
    ],
  )
)
```
Here's df.head():

  hex | start_hour | count
-- | -- | --
8926960292fffff | 0 | 1
8926960440bffff | 0 | 1
8926960444bffff | 0 | 1
89269604457ffff | 0 | 1
892696044cfffff | 0 | 1




Discussion:
Anybody?
Dear @mysterefrank,
I believe I've found a solution. Will send a PR today.
Awesome thanks!

Resolving patch:
diff --git a/e2e/scripts/st_pydeck_geo_layers.py b/e2e/scripts/st_pydeck_geo_layers.py
new file mode 100644
--- /dev/null
+++ b/e2e/scripts/st_pydeck_geo_layers.py
@@ -0,0 +1,34 @@
+import streamlit as st
+import pandas as pd
+import pydeck as pdk
+
+H3_HEX_DATA = [
+    {"hex": "88283082b9fffff", "count": 10},
+    {"hex": "88283082d7fffff", "count": 50},
+    {"hex": "88283082a9fffff", "count": 100},
+]
+df = pd.DataFrame(H3_HEX_DATA)
+
+st.pydeck_chart(
+    pdk.Deck(
+        map_style="mapbox://styles/mapbox/light-v9",
+        tooltip={"text": "Count: {count}"},
+        initial_view_state=pdk.ViewState(
+            latitude=37.7749295, longitude=-122.4194155, zoom=12, bearing=0, pitch=30
+        ),
+        layers=[
+            pdk.Layer(
+                "H3HexagonLayer",
+                df,
+                pickable=True,
+                stroked=True,
+                filled=True,
+                extruded=False,
+                get_hexagon="hex",
+                get_fill_color="[0, 255, 0]",
+                get_line_color=[255, 255, 255],
+                line_width_min_pixels=2,
+            ),
+        ],
+    )
+)


Test patch:
Repository: streamlit/streamlit

Issue:
Context: streamlit.graphviz_chart Typo: should be graphviz.Digraph NOT graphviz.DiGraph
**Link to doc page in question (if any):** https://docs.streamlit.io/api.html#streamlit.graphviz_chart

**Name of the Streamlit feature whose docs need improvement:**

**What you think the docs should say:**

graph = graphviz.Digraph()   # there is a DiGraph in nx package



Discussion:

Resolving patch:
diff --git a/lib/streamlit/DeltaGenerator.py b/lib/streamlit/DeltaGenerator.py
--- a/lib/streamlit/DeltaGenerator.py
+++ b/lib/streamlit/DeltaGenerator.py
@@ -1141,7 +1141,7 @@ def graphviz_chart(
         >>> import graphviz as graphviz
         >>>
         >>> # Create a graphlib graph object
-        >>> graph = graphviz.DiGraph()
+        >>> graph = graphviz.Digraph()
         >>> graph.edge('run', 'intr')
         >>> graph.edge('intr', 'runbl')
         >>> graph.edge('runbl', 'run')


Test patch:
Repository: streamlit/streamlit

Issue:
Spelling mistake while running streamlit hello , DataFrame Demo
# Summary

I noticed a spelling mistake in dataframe demo while runing streamlit hello , It displays UN Data Exlorer instead of UN Data Explorer

# Steps to reproduce

1. Go to terminal
2. Run `streamlit hello`
3. Open browser at localhost:8501 and choose dataframe demo

## Expected behavior:

It should display correct spelling as `(Data courtesy of the UN Data Exlporer.)`

## Actual behavior:

It's displaying `(Data courtesy of the UN Data Exlorer.)`
![image](https://user-images.githubusercontent.com/54715558/82215467-169e2200-9935-11ea-9c8d-f43d5f9ae454.png)


## Is this a regression?
 no

# Debug info

- Streamlit version: 0.57.3
- Python version: 3.8.2
- Using Conda? PipEnv? PyEnv? Pex? Conda
- OS version: Windows 10
- Browser version: Chrome v81.0

# Additional information

If needed, add any other context about the problem here. For example, did this bug come from https://discuss.streamlit.io or another site? Link the original source here!



Discussion:

Resolving patch:
diff --git a/lib/streamlit/hello/hello.py b/lib/streamlit/hello/hello.py
--- a/lib/streamlit/hello/hello.py
+++ b/lib/streamlit/hello/hello.py
@@ -67,7 +67,7 @@
                 """
 This demo shows how to use `st.write` to visualize Pandas DataFrames.
 
-(Data courtesy of the [UN Data Exlorer](http://data.un.org/Explorer.aspx).)
+(Data courtesy of the [UN Data Explorer](http://data.un.org/Explorer.aspx).)
 """,
             ),
         ),


Test patch:
Repository: streamlit/streamlit

Issue:
streamlit.video() ,parameter start_time is mentioned twice
**Link to doc page in question (if any):**
https://docs.streamlit.io/api.html#streamlit.video

**Name of the Streamlit feature whose docs need improvement:**
streamlit.video()

**What you think the docs should say:**
parameter start_time is mentioned twice , just remove the extra start_time parameter mentioned without any description
![image](https://user-images.githubusercontent.com/54715558/82224458-7d293d00-9941-11ea-9623-610f9899a011.png)



Discussion:

Resolving patch:
diff --git a/lib/streamlit/DeltaGenerator.py b/lib/streamlit/DeltaGenerator.py
--- a/lib/streamlit/DeltaGenerator.py
+++ b/lib/streamlit/DeltaGenerator.py
@@ -1576,7 +1576,6 @@ def video(self, element, data, format="video/mp4", start_time=0):
             Includes support for YouTube URLs.
             Numpy arrays and raw data formats must include all necessary file
             headers to match specified file format.
-        start_time: int
         format : str
             The mime type for the video file. Defaults to 'video/mp4'.
             See https://tools.ietf.org/html/rfc4281 for more info.
@@ -2214,7 +2213,9 @@ def beta_color_picker(self, element, label, value=None, key=None):
         return str(current_value)
 
     @_with_element
-    def text_input(self, element, label, value="", max_chars=None, key=None, type="default"):
+    def text_input(
+        self, element, label, value="", max_chars=None, key=None, type="default"
+    ):
         """Display a single-line text input widget.
 
         Parameters
@@ -2268,7 +2269,9 @@ def text_input(self, element, label, value="", max_chars=None, key=None, type="d
         return str(current_value)
 
     @_with_element
-    def text_area(self, element, label, value="", height=None, max_chars=None, key=None):
+    def text_area(
+        self, element, label, value="", height=None, max_chars=None, key=None
+    ):
         """Display a multi-line text input widget.
 
         Parameters
@@ -2373,7 +2376,15 @@ def time_input(self, element, label, value=None, key=None):
         return current_value
 
     @_with_element
-    def date_input(self, element, label, value=None, min_value=datetime.min, max_value=None, key=None):
+    def date_input(
+        self,
+        element,
+        label,
+        value=None,
+        min_value=datetime.min,
+        max_value=None,
+        key=None,
+    ):
         """Display a date input widget.
 
         Parameters
@@ -2430,7 +2441,7 @@ def date_input(self, element, label, value=None, min_value=datetime.min, max_val
 
         if max_value is None:
             today = date.today()
-            max_value = date(today.year+10, today.month, today.day)
+            max_value = date(today.year + 10, today.month, today.day)
 
         if isinstance(max_value, datetime):
             max_value = max_value.date()


Test patch:
Repository: streamlit/streamlit

Issue:
Progress bar parameter values
Currently the docs state that progress accepts an int from 0 - 100, however the actual implementation accepts floats as well, with values from 0-1.

**Link to doc page in question (if any):**

https://docs.streamlit.io/en/latest/api.html#streamlit.progress

**Name of the Streamlit feature whose docs need improvement:**

Progress

**What you think the docs should say:**

```
Parameters:	
        value (int) – The percentage complete: 0 <= value <= 100
        or
        value (float) – The percentage complete: 0 <= value <= 1
```


Discussion:

Resolving patch:
diff --git a/lib/streamlit/DeltaGenerator.py b/lib/streamlit/DeltaGenerator.py
--- a/lib/streamlit/DeltaGenerator.py
+++ b/lib/streamlit/DeltaGenerator.py
@@ -2664,8 +2664,10 @@ def progress(self, element, value):
 
         Parameters
         ----------
-        value : int
-            The percentage complete: 0 <= value <= 100
+        value : int or float
+            0 <= value <= 100 for int
+
+            0.0 <= value <= 1.0 for float
 
         Example
         -------


Test patch:
Repository: streamlit/streamlit

Issue:
Remove remaining python 2 references
<img width="673" alt="Screen Shot 2020-05-15 at 11 37 36 AM" src="https://user-images.githubusercontent.com/699897/82374191-12393e00-99f5-11ea-918f-b23e1a52667e.png">
<img width="636" alt="Screen Shot 2020-05-15 at 11 37 17 AM" src="https://user-images.githubusercontent.com/699897/82374196-136a6b00-99f5-11ea-84fd-66d8a3442346.png">



Discussion:

Resolving patch:
diff --git a/lib/streamlit/ScriptRunner.py b/lib/streamlit/ScriptRunner.py
--- a/lib/streamlit/ScriptRunner.py
+++ b/lib/streamlit/ScriptRunner.py
@@ -269,8 +269,8 @@ def _run_script(self, rerun_data):
                 # Don't inherit any flags or "future" statements.
                 flags=0,
                 dont_inherit=1,
-                # Parameter not supported in Python2:
-                # optimize=-1,
+                # Use the default optimization options.
+                optimize=-1,
             )
 
         except BaseException as e:
diff --git a/lib/streamlit/elements/doc_string.py b/lib/streamlit/elements/doc_string.py
--- a/lib/streamlit/elements/doc_string.py
+++ b/lib/streamlit/elements/doc_string.py
@@ -107,21 +107,8 @@ def _get_signature(f):
 
 
 def _unwrap_decorated_func(f):
-    if hasattr(f, "func_closure"):
-        try:
-            # Python 2 way.
-            while getattr(f, "func_closure"):
-                contents = f.func_closure[0].cell_contents
-                if not callable(contents):
-                    break
-                f = contents
-            return f
-        except AttributeError:
-            pass
-
     if hasattr(f, "__wrapped__"):
         try:
-            # Python 3 way.
             while getattr(f, "__wrapped__"):
                 contents = f.__wrapped__
                 if not callable(contents):
@@ -131,6 +118,6 @@ def _unwrap_decorated_func(f):
         except AttributeError:
             pass
 
-    # Fall back to original function, though it's unlikely we'll reach 
+    # Fall back to original function, though it's unlikely we'll reach
     # this part of the code.
     return f


Test patch:
diff --git a/lib/tests/streamlit/bootstrap_test.py b/lib/tests/streamlit/bootstrap_test.py
--- a/lib/tests/streamlit/bootstrap_test.py
+++ b/lib/tests/streamlit/bootstrap_test.py
@@ -14,17 +14,11 @@
 
 import sys
 import unittest
+from io import StringIO
 
 import matplotlib
 from mock import patch
 
-try:
-    # Python 2
-    from StringIO import StringIO
-except ImportError:
-    # Python 3
-    from io import StringIO
-
 from streamlit import bootstrap
 from streamlit import config
 from streamlit.Report import Report
Repository: streamlit/streamlit

Issue:
Replace Exception in st.foo() with StreamlitAPIException
Main places we do this today:
graphviz_chart.py
map.py


Discussion:

Resolving patch:
diff --git a/lib/streamlit/elements/graphviz_chart.py b/lib/streamlit/elements/graphviz_chart.py
--- a/lib/streamlit/elements/graphviz_chart.py
+++ b/lib/streamlit/elements/graphviz_chart.py
@@ -17,6 +17,7 @@
 from streamlit import type_util
 from streamlit.logger import get_logger
 from streamlit.proto.GraphVizChart_pb2 import GraphVizChart as GraphVizChartProto
+from streamlit.errors import StreamlitAPIException
 
 LOGGER = get_logger(__name__)
 
@@ -129,7 +130,9 @@ def marshall(proto, figure_or_dot, use_container_width):
     elif isinstance(figure_or_dot, str):
         dot = figure_or_dot
     else:
-        raise Exception("Unhandled type for graphviz chart: %s" % type(figure_or_dot))
+        raise StreamlitAPIException(
+            "Unhandled type for graphviz chart: %s" % type(figure_or_dot)
+        )
 
     proto.spec = dot
     proto.use_container_width = use_container_width
diff --git a/lib/streamlit/elements/map.py b/lib/streamlit/elements/map.py
--- a/lib/streamlit/elements/map.py
+++ b/lib/streamlit/elements/map.py
@@ -22,6 +22,7 @@
 
 from streamlit.proto.DeckGlJsonChart_pb2 import DeckGlJsonChart as DeckGlJsonChartProto
 import streamlit.elements.deck_gl_json_chart as deck_gl_json_chart
+from streamlit.errors import StreamlitAPIException
 
 
 class MapMixin:
@@ -134,17 +135,21 @@ def to_deckgl_json(data, zoom):
     elif "latitude" in data:
         lat = "latitude"
     else:
-        raise Exception('Map data must contain a column named "latitude" or "lat".')
+        raise StreamlitAPIException(
+            'Map data must contain a column named "latitude" or "lat".'
+        )
 
     if "lon" in data:
         lon = "lon"
     elif "longitude" in data:
         lon = "longitude"
     else:
-        raise Exception('Map data must contain a column called "longitude" or "lon".')
+        raise StreamlitAPIException(
+            'Map data must contain a column called "longitude" or "lon".'
+        )
 
     if data[lon].isnull().values.any() or data[lat].isnull().values.any():
-        raise Exception("Latitude and longitude data must be numeric.")
+        raise StreamlitAPIException("Latitude and longitude data must be numeric.")
 
     data = pd.DataFrame(data)
 


Test patch:
Repository: streamlit/streamlit

Issue:
Add screenshot test for syntax highlighting



Discussion:

Resolving patch:
diff --git a/e2e/scripts/st_code.py b/e2e/scripts/st_code.py
--- a/e2e/scripts/st_code.py
+++ b/e2e/scripts/st_code.py
@@ -17,3 +17,9 @@
 st.code("# This code is awesome!")
 
 st.code("")
+
+code = """
+def hello():
+    print("Hello, Streamlit!")
+"""
+st.code(code, language="python")


Test patch:
Repository: streamlit/streamlit

Issue:
Crazy error message shown when two widgets have the same key
# Steps to reproduce

1. Run this code
   ```
   import streamlit as st

   st.button("OK")
   st.button("OK")
   ```
2. Observe!

## Expected behavior:

You should get one button plus an error message explaining you can't have to `st.button` calls with the same key.

## Actual behavior:

The error message complains about `st.-3952690150221448179` :scream_cat: 

See screenshot:
![image](https://user-images.githubusercontent.com/690814/91766363-4f35d480-eb8f-11ea-8648-ce832caf4da3.png)

## Is this a regression?

yes

# Debug info

- Streamlit version: 0.65.0



Discussion:

Resolving patch:
diff --git a/lib/streamlit/elements/utils.py b/lib/streamlit/elements/utils.py
--- a/lib/streamlit/elements/utils.py
+++ b/lib/streamlit/elements/utils.py
@@ -90,7 +90,7 @@ def _set_widget_id(
         added = ctx.widget_ids_this_run.add(widget_id)
         if not added:
             raise DuplicateWidgetID(
-                _build_duplicate_widget_message(widget_id, user_key)
+                _build_duplicate_widget_message(widget_func_name, user_key)
             )
     element_proto.id = widget_id
 


Test patch:
diff --git a/lib/tests/streamlit/delta_generator_test.py b/lib/tests/streamlit/delta_generator_test.py
--- a/lib/tests/streamlit/delta_generator_test.py
+++ b/lib/tests/streamlit/delta_generator_test.py
@@ -205,23 +205,23 @@ def test_duplicate_widget_id_error(self):
             create_widget()
             with self.assertRaises(DuplicateWidgetID) as ctx:
                 create_widget()
-                self.assertIn(
-                    _build_duplicate_widget_message(
-                        widget_func_name=widget_type, user_key=None
-                    ),
-                    ctx.exception,
-                )
+            self.assertEqual(
+                _build_duplicate_widget_message(
+                    widget_func_name=widget_type, user_key=None
+                ),
+                str(ctx.exception),
+            )
 
             # Test duplicate user-specified widget key
             create_widget("key")
             with self.assertRaises(DuplicateWidgetID) as ctx:
                 create_widget("key")
-                self.assertIn(
-                    _build_duplicate_widget_message(
-                        widget_func_name=widget_type, user_key="key"
-                    ),
-                    ctx.exception,
-                )
+            self.assertEqual(
+                _build_duplicate_widget_message(
+                    widget_func_name=widget_type, user_key="key"
+                ),
+                str(ctx.exception),
+            )
 
 
 class DeltaGeneratorClassTest(testutil.DeltaGeneratorTestCase):
Repository: streamlit/streamlit

Issue:
Remove st.deck_gl_chart
### Problem

Remove st.deck_gl_chart now that the deprecation date is past



Discussion:

Resolving patch:
diff --git a/lib/streamlit/elements/deck_gl.py b/lib/streamlit/elements/deck_gl.py
--- a/lib/streamlit/elements/deck_gl.py
+++ b/lib/streamlit/elements/deck_gl.py
@@ -30,7 +30,11 @@
 
 class DeckGlMixin:
     def deck_gl_chart(dg, spec=None, use_container_width=False, **kwargs):
-        """Draw a map chart using the Deck.GL library.
+        """
+        .. deprecated:: 0.53.0
+            Use :func:`streamlit.pydeck_chart` instead.
+
+        Draw a map chart using the Deck.GL library.
 
         This API closely follows Deck.GL's JavaScript API
         (https://deck.gl/#/documentation), with a few small adaptations and


Test patch:
Repository: streamlit/streamlit

Issue:
Video on main API page is broken
See: https://docs.streamlit.io/en/stable/api.html#streamlit.video

![](https://i.imgur.com/6eI7Bv3.png)


Discussion:

Resolving patch:
diff --git a/docs/api-examples-source/charts.video.py b/docs/api-examples-source/charts.video.py
--- a/docs/api-examples-source/charts.video.py
+++ b/docs/api-examples-source/charts.video.py
@@ -1,6 +1,6 @@
 import streamlit as st
 
-VIDEO_URL = "https://vod-progressive.akamaized.net/exp=1595241944~acl=%2A%2F664785003.mp4%2A~hmac=2a26d355839498b80bbb2c43e6808bd12bc0d2e7920616a8226a1e017c270217/vimeo-prod-skyfire-std-us/01/4526/7/197634410/664785003.mp4?filename=Star+-+6962.mp4"
+VIDEO_URL = "https://static.streamlit.io/examples/star.mp4"
 
 st.video(VIDEO_URL)
 
diff --git a/lib/streamlit/elements/media_proto.py b/lib/streamlit/elements/media_proto.py
--- a/lib/streamlit/elements/media_proto.py
+++ b/lib/streamlit/elements/media_proto.py
@@ -84,7 +84,7 @@ def video(dg, data, format="video/mp4", start_time=0):
         >>> st.video(video_bytes)
 
         .. output::
-           https://static.streamlit.io/0.61.0-yRE1/index.html?id=LZLtVFFTf1s41yfPExzRu8
+           https://static.streamlit.io/0.66.0-2BLtg/index.html?id=DzAouvizGRAyuLjkPpR894
            height: 600px
 
         .. note::


Test patch: