primeira versão transcreve audio

This commit is contained in:
Impacte AI
2024-11-29 13:51:10 -03:00
commit 449d6cffe4
1549 changed files with 427969 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Version managed by git-versioner
version = "v4.0"
version_short = "v4.0"
git_hash = "1544d35"
on_tag = "v4.0"
dirty = False
SUPPORT_PATCH = False

View File

@@ -0,0 +1,71 @@
import sys
import site
_registered = False
def _register_bootstrap_functions():
# This should in practice only ever be called once, but protect
# outselves just in case it is somehow called a second time.
global _registered
if _registered:
return
try:
_registered = True
# Now discover and register post import hook
#
# It should be safe to import wrapt at this point as this code
# will be executed after all module search path has been setup.
# This will register the patches
from . import wrapt_requests
except Exception as ex:
print("pip_system_certs: ERROR: could not register module:", ex)
def _execsitecustomize_wrapper(wrapped):
def _execsitecustomize(*args, **kwargs):
try:
return wrapped(*args, **kwargs)
finally:
# Check whether 'usercustomize' support is actually disabled.
# In that case we do our work after 'sitecustomize' is loaded.
if not site.ENABLE_USER_SITE:
_register_bootstrap_functions()
return _execsitecustomize
def _execusercustomize_wrapper(wrapped):
def _execusercustomize(*args, **kwargs):
try:
return wrapped(*args, **kwargs)
finally:
_register_bootstrap_functions()
return _execusercustomize
def bootstrap():
# We want to do our real work as the very last thing in the 'site'
# module when it is being imported so that the module search path is
# initialised properly. What is the last thing executed depends on
# whether 'usercustomize' module support is enabled. Such support
# will not be enabled in Python virtual enviromments. We therefore
# wrap the functions for the loading of both the 'sitecustomize' and
# 'usercustomize' modules but detect when 'usercustomize' support is
# disabled and in that case do what we need to after 'sitecustomize'
# is loaded.
#
# In wrapping these functions though, we can't actually use wrapt
# to do so. This is because depending on how wrapt was installed it
# may technically be dependent on '.pth' evaluation for Python to
# know where to import it from. The addition of the directory which
# contains wrapt may not yet have been done. We thus use a simple
# function wrapper instead.
site.execsitecustomize = _execsitecustomize_wrapper(site.execsitecustomize)
site.execusercustomize = _execusercustomize_wrapper(site.execusercustomize)

View File

@@ -0,0 +1,81 @@
from __future__ import absolute_import
import warnings
import wrapt
## Enable the import to enable type hinting / code navigation below
# import pip._vendor.requests.adapters
# pip master has most commands moved into _internal folder
@wrapt.when_imported('requests')
@wrapt.when_imported('pip._vendor.requests')
# Support for pipenv v2022.8.5
@wrapt.when_imported('pipenv.patched.pip._vendor.requests')
# Support for pipenv older than v2022.8.5
@wrapt.when_imported('pipenv.patched.notpip._vendor.requests')
def apply_patches(requests):
override_ssl_handler(requests.adapters.HTTPAdapter)
def override_ssl_handler(adapter):
# type: (pip._vendor.requests.adapters.HTTPAdapter) -> None
def init_poolmanager(wrapped, _instance, args, kwargs):
# type: (pip._vendor.requests.adapters.HTTPAdapter.init_poolmanager, None, list, dict) -> None
import ssl
ssl_context = ssl.create_default_context()
ssl_context.load_default_certs()
kwargs['ssl_context'] = ssl_context
wrapped(*args, **kwargs)
def cert_verify(wrapped, _instance, args, kwargs):
# type: (pip._vendor.requests.adapters.HTTPAdapter.cert_verify, None, list, dict) -> None
wrapped(*args, **kwargs)
# By default Python requests uses the ca_certs from the certifi module
# But we want to use the certificate store instead.
# By clearing the ca_certs variable we force it to fall back on that behaviour (handled in urllib3)
if "conn" in kwargs:
conn = kwargs["conn"]
else:
conn = args[0]
# our default ssl_context we created from init_poolmanager() has these attributes set:
# - check_hostname == True
# - verify_mode == VerifyMode.CERT_REQUIRED
# this ssl_context gets passed all the way down to the HTTPSConnection object from urllib3
# and urllib3 wants to set ssl_context.verify_mode depending on the verify parameter
# (verify is either a bool where False becomes CERT_NONE; or a string pointing to ca bundle)
# However, the SSLContext class doesnt allow this while check_hostname is True
# Therefore, we reset check_hostname in case cert_verify() got called with verify == False
if "verify" in kwargs:
verify = kwargs["verify"]
elif len(args) > 2:
verify = args[2]
else:
# this is not reachable because there is no default for this parameter
# but it prepares us in case urllib3 might add a default one day
verify = True
warnings.warn(
"Mandatory verify parameter not given, falling back to True.\n"
"This may or may not be intended behavior and is probably related to an unsupported version of urllib3\n"
"Please report an issue at https://gitlab.com/alelec/pip-system-certs with your\n"
"python version included in the description\n"
)
if not verify:
try:
conn.conn_kw["ssl_context"].check_hostname = False
except (AttributeError, TypeError, KeyError):
warnings.warn(
"Failed to patch SSL settings for unverified requests (unsupported version of urllib3?)\n"
"This may lead to errors when urllib3 tries to modify verify_mode.\n"
"Please report an issue at https://gitlab.com/alelec/pip-system-certs with your\n"
"python version included in the description\n"
)
conn.ca_certs = None
wrapt.wrap_function_wrapper(adapter, 'init_poolmanager', init_poolmanager)
wrapt.wrap_function_wrapper(adapter, 'cert_verify', cert_verify)