mirror of
https://github.com/ioistired/pleroma-ebooks.git
synced 2024-11-20 02:14:52 +01:00
c22a493dff
relicense to AGPLv3 comply with the MPL's file copyleft some other changes in the direction of supporting GPT-2 which were hard to untangle from the rest of the changes (sorry)
13 lines
274 B
Python
13 lines
274 B
Python
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import anyio
|
|
import functools
|
|
from bs4 import BeautifulSoup
|
|
|
|
def shield(f):
|
|
@functools.wraps(f)
|
|
async def shielded(*args, **kwargs):
|
|
with anyio.CancelScope(shield=True) as cs:
|
|
return await f(*args, **kwargs)
|
|
return shielded
|