Skip to content

Commit f927b01

Browse files
Autofunction: Prevent method signatures with nested parentheses from truncating (#888)
* Correct method signatures with nested parentheses * Revert temporary fix
1 parent 09255b2 commit f927b01

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/blocks/autofunction.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ const Autofunction = ({
339339
.replace("streamlit", "st")
340340
.replace(/[.,\/#!$%\^&\*;:{}=\-`~()]/g, "");
341341
const type_name = method.signature
342-
? method.signature.match(/\(([^)]*)\)/)[1]
342+
? method.signature.match(/\((.*)\)/)[1]
343343
: "";
344344
const isDeprecated =
345345
method.deprecated && method.deprecated.deprecated === true;

python/streamlit.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -69938,7 +69938,7 @@
6993869938
},
6993969939
{
6994069940
"name": "query",
69941-
"signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
69941+
"signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
6994269942
"example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection(&quot;sql&quot;)\ndf = conn.query(&quot;select * from pet_owners where owner = :owner&quot;, ttl=3600, params={&quot;owner&quot;:&quot;barbara&quot;})\nst.dataframe(df)\n</pre>\n</blockquote>\n",
6994369943
"description": "<p>Run a read-only query.</p>",
6994469944
"args": [
@@ -70060,7 +70060,7 @@
7006070060
},
7006170061
{
7006270062
"name": "query",
70063-
"signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...&rpar;`.\", params=None, **kwargs)",
70063+
"signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)",
7006470064
"example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection(&quot;snowflake&quot;)\ndf = conn.query(&quot;select * from pet_owners&quot;)\nst.dataframe(df)\n</pre>\n</blockquote>\n",
7006570065
"description": "<p>Run a read-only SQL query.</p>",
7006670066
"args": [
@@ -70248,7 +70248,7 @@
7024870248
},
7024970249
"streamlit.connections.SQLConnection.query": {
7025070250
"name": "query",
70251-
"signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...&rpar;`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
70251+
"signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
7025270252
"example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection(&quot;sql&quot;)\ndf = conn.query(&quot;select * from pet_owners where owner = :owner&quot;, ttl=3600, params={&quot;owner&quot;:&quot;barbara&quot;})\nst.dataframe(df)\n</pre>\n</blockquote>\n",
7025370253
"description": "<p>Run a read-only query.</p>\n<p>This method implements both query result caching (with caching behavior\nidentical to that of using &#64;st.cache_data) as well as simple error handling/retries.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Queries that are run without a specified ttl are cached indefinitely.</p>\n</div>\n<p>Aside from the <tt class=\"docutils literal\">ttl</tt> kwarg, all kwargs passed to this function are passed down\nto <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.read_sql.html\">pd.read_sql</a>\nand have the behavior described in the pandas documentation.</p>\n",
7025470254
"args": [
@@ -70398,7 +70398,7 @@
7039870398
},
7039970399
"streamlit.connections.SnowflakeConnection.query": {
7040070400
"name": "query",
70401-
"signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...&rpar;`.\", params=None, **kwargs)",
70401+
"signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)",
7040270402
"example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection(&quot;snowflake&quot;)\ndf = conn.query(&quot;select * from pet_owners&quot;)\nst.dataframe(df)\n</pre>\n</blockquote>\n",
7040370403
"description": "<p>Run a read-only SQL query.</p>\n<p>This method implements both query result caching (with caching behavior\nidentical to that of using <tt class=\"docutils literal\">&#64;st.cache_data</tt>) as well as simple error handling/retries.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Queries that are run without a specified ttl are cached indefinitely.</p>\n</div>\n",
7040470404
"args": [

0 commit comments

Comments
 (0)