Skip to content

Commit

Permalink
Autofunction: Prevent method signatures with nested parentheses from …
Browse files Browse the repository at this point in the history
…truncating (#888)

* Correct method signatures with nested parentheses

* Revert temporary fix
  • Loading branch information
sfc-gh-dmatthews authored Nov 29, 2023
1 parent 09255b2 commit f927b01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/blocks/autofunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const Autofunction = ({
.replace("streamlit", "st")
.replace(/[.,\/#!$%\^&\*;:{}=\-`~()]/g, "");
const type_name = method.signature
? method.signature.match(/\(([^)]*)\)/)[1]
? method.signature.match(/\((.*)\)/)[1]
: "";
const isDeprecated =
method.deprecated && method.deprecated.deprecated === true;
Expand Down
8 changes: 4 additions & 4 deletions python/streamlit.json
Original file line number Diff line number Diff line change
Expand Up @@ -69938,7 +69938,7 @@
},
{
"name": "query",
"signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
"signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
"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",
"description": "<p>Run a read-only query.</p>",
"args": [
Expand Down Expand Up @@ -70060,7 +70060,7 @@
},
{
"name": "query",
"signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...&rpar;`.\", params=None, **kwargs)",
"signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)",
"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",
"description": "<p>Run a read-only SQL query.</p>",
"args": [
Expand Down Expand Up @@ -70248,7 +70248,7 @@
},
"streamlit.connections.SQLConnection.query": {
"name": "query",
"signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...&rpar;`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
"signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)",
"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",
"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",
"args": [
Expand Down Expand Up @@ -70398,7 +70398,7 @@
},
"streamlit.connections.SnowflakeConnection.query": {
"name": "query",
"signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...&rpar;`.\", params=None, **kwargs)",
"signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)",
"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",
"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",
"args": [
Expand Down

0 comments on commit f927b01

Please sign in to comment.