Skip to content

Commit

Permalink
adding dev-v0.16.2 tag to this commit to ensure building
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar committed Sep 21, 2023
1 parent 2a5df36 commit 364896d
Show file tree
Hide file tree
Showing 6 changed files with 283 additions and 167 deletions.
61 changes: 47 additions & 14 deletions html/supertokens_python/async_to_sync_wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,34 @@ <h1 class="title">Module <code>supertokens_python.async_to_sync_wrapper</code></

import asyncio
from typing import Any, Coroutine, TypeVar
from os import getenv

_T = TypeVar(&#34;_T&#34;)


def check_event_loop():
def nest_asyncio_enabled():
return getenv(&#34;SUPERTOKENS_NEST_ASYNCIO&#34;, &#34;&#34;) == &#34;1&#34;


def create_or_get_event_loop() -&gt; asyncio.AbstractEventLoop:
try:
asyncio.get_event_loop()
except RuntimeError as ex:
return asyncio.get_event_loop()
except Exception as ex:
if &#34;There is no current event loop in thread&#34; in str(ex):
loop = asyncio.new_event_loop()

if nest_asyncio_enabled():
import nest_asyncio # type: ignore

nest_asyncio.apply(loop) # type: ignore

asyncio.set_event_loop(loop)
return loop
raise ex


def sync(co: Coroutine[Any, Any, _T]) -&gt; _T:
check_event_loop()
loop = asyncio.get_event_loop()
loop = create_or_get_event_loop()
return loop.run_until_complete(co)</code></pre>
</details>
</section>
Expand All @@ -68,22 +80,43 @@ <h1 class="title">Module <code>supertokens_python.async_to_sync_wrapper</code></
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="supertokens_python.async_to_sync_wrapper.check_event_loop"><code class="name flex">
<span>def <span class="ident">check_event_loop</span></span>(<span>)</span>
<dt id="supertokens_python.async_to_sync_wrapper.create_or_get_event_loop"><code class="name flex">
<span>def <span class="ident">create_or_get_event_loop</span></span>(<span>)> asyncio.events.AbstractEventLoop</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def check_event_loop():
<pre><code class="python">def create_or_get_event_loop() -&gt; asyncio.AbstractEventLoop:
try:
asyncio.get_event_loop()
except RuntimeError as ex:
return asyncio.get_event_loop()
except Exception as ex:
if &#34;There is no current event loop in thread&#34; in str(ex):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)</code></pre>

if nest_asyncio_enabled():
import nest_asyncio # type: ignore

nest_asyncio.apply(loop) # type: ignore

asyncio.set_event_loop(loop)
return loop
raise ex</code></pre>
</details>
</dd>
<dt id="supertokens_python.async_to_sync_wrapper.nest_asyncio_enabled"><code class="name flex">
<span>def <span class="ident">nest_asyncio_enabled</span></span>(<span>)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def nest_asyncio_enabled():
return getenv(&#34;SUPERTOKENS_NEST_ASYNCIO&#34;, &#34;&#34;) == &#34;1&#34;</code></pre>
</details>
</dd>
<dt id="supertokens_python.async_to_sync_wrapper.sync"><code class="name flex">
Expand All @@ -96,8 +129,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">def sync(co: Coroutine[Any, Any, _T]) -&gt; _T:
check_event_loop()
loop = asyncio.get_event_loop()
loop = create_or_get_event_loop()
return loop.run_until_complete(co)</code></pre>
</details>
</dd>
Expand All @@ -119,7 +151,8 @@ <h2>Index</h2>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="supertokens_python.async_to_sync_wrapper.check_event_loop" href="#supertokens_python.async_to_sync_wrapper.check_event_loop">check_event_loop</a></code></li>
<li><code><a title="supertokens_python.async_to_sync_wrapper.create_or_get_event_loop" href="#supertokens_python.async_to_sync_wrapper.create_or_get_event_loop">create_or_get_event_loop</a></code></li>
<li><code><a title="supertokens_python.async_to_sync_wrapper.nest_asyncio_enabled" href="#supertokens_python.async_to_sync_wrapper.nest_asyncio_enabled">nest_asyncio_enabled</a></code></li>
<li><code><a title="supertokens_python.async_to_sync_wrapper.sync" href="#supertokens_python.async_to_sync_wrapper.sync">sync</a></code></li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion html/supertokens_python/constants.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
from __future__ import annotations

SUPPORTED_CDI_VERSIONS = [&#34;3.0&#34;]
VERSION = &#34;0.16.1&#34;
VERSION = &#34;0.16.2&#34;
TELEMETRY = &#34;/telemetry&#34;
USER_COUNT = &#34;/users/count&#34;
USER_DELETE = &#34;/user/remove&#34;
Expand Down
24 changes: 17 additions & 7 deletions html/supertokens_python/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h1 class="title">Package <code>supertokens_python</code></h1>
# License for the specific language governing permissions and limitations
# under the License.

from typing import Any, Callable, Dict, List, Optional, Union
from typing import Any, Callable, Dict, List, Optional

from typing_extensions import Literal

Expand All @@ -60,11 +60,16 @@ <h1 class="title">Package <code>supertokens_python</code></h1>
framework: Literal[&#34;fastapi&#34;, &#34;flask&#34;, &#34;django&#34;],
supertokens_config: SupertokensConfig,
recipe_list: List[Callable[[supertokens.AppInfo], RecipeModule]],
mode: Union[Literal[&#34;asgi&#34;, &#34;wsgi&#34;], None] = None,
telemetry: Union[bool, None] = None,
mode: Optional[Literal[&#34;asgi&#34;, &#34;wsgi&#34;]] = None,
telemetry: Optional[bool] = None,
):
return Supertokens.init(
app_info, framework, supertokens_config, recipe_list, mode, telemetry
app_info,
framework,
supertokens_config,
recipe_list,
mode,
telemetry,
)


Expand Down Expand Up @@ -206,11 +211,16 @@ <h2 class="section-title" id="header-functions">Functions</h2>
framework: Literal[&#34;fastapi&#34;, &#34;flask&#34;, &#34;django&#34;],
supertokens_config: SupertokensConfig,
recipe_list: List[Callable[[supertokens.AppInfo], RecipeModule]],
mode: Union[Literal[&#34;asgi&#34;, &#34;wsgi&#34;], None] = None,
telemetry: Union[bool, None] = None,
mode: Optional[Literal[&#34;asgi&#34;, &#34;wsgi&#34;]] = None,
telemetry: Optional[bool] = None,
):
return Supertokens.init(
app_info, framework, supertokens_config, recipe_list, mode, telemetry
app_info,
framework,
supertokens_config,
recipe_list,
mode,
telemetry,
)</code></pre>
</details>
</dd>
Expand Down
Loading

0 comments on commit 364896d

Please sign in to comment.