py2docfx 0.1.20.dev2196778__py3-none-any.whl → 0.1.20.dev2243675__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/api.py +3 -2
- py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/legacy.py +17 -1
- py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/version.py +1 -1
- py2docfx/venv/basevenv/Lib/site-packages/requests/__version__.py +2 -2
- py2docfx/venv/basevenv/Lib/site-packages/requests/adapters.py +17 -40
- py2docfx/venv/basevenv/Lib/site-packages/requests/sessions.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/core/_version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication.py +21 -9
- py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication_async.py +21 -9
- py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_retry.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_bearer_token_provider.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/authorization_code.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azd_cli.py +82 -17
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_cli.py +28 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_powershell.py +28 -4
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/broker.py +79 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/chained.py +9 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/default.py +153 -53
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/imds.py +25 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/shared_cache.py +12 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/vscode.py +163 -144
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/workload_identity.py +23 -12
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/__init__.py +4 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/interactive.py +14 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/pipeline.py +4 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/utils.py +96 -0
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_bearer_token_provider.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/authorization_code.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azd_cli.py +32 -13
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_cli.py +26 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_powershell.py +13 -2
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/chained.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/default.py +120 -55
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/imds.py +27 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/on_behalf_of.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/shared_cache.py +12 -5
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/vscode.py +15 -67
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/workload_identity.py +17 -13
- py2docfx/venv/venv1/Lib/site-packages/cffi/__init__.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/cffi/cparser.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cffi/recompiler.py +5 -5
- py2docfx/venv/venv1/Lib/site-packages/cffi/setuptools_ext.py +13 -0
- py2docfx/venv/venv1/Lib/site-packages/cffi/vengine_cpy.py +3 -0
- py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/api.py +3 -2
- py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/legacy.py +17 -1
- py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/version.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/cryptography/__about__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/__init__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/any_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/api_pb2.py +12 -8
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/compiler/plugin_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor.py +398 -246
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor_pb2.py +74 -72
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor_pool.py +5 -4
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/duration_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/empty_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/field_mask_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/api_implementation.py +0 -6
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/extension_dict.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/field_mask.py +3 -3
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/python_edition_defaults.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/python_message.py +10 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/type_checkers.py +47 -5
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/json_format.py +55 -32
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/runtime_version.py +6 -26
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/source_context_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/struct_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/text_format.py +30 -19
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/timestamp_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/type_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/google/protobuf/wrappers_pb2.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/pycparser/__init__.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pycparser/c_generator.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pycparser/c_lexer.py +14 -0
- py2docfx/venv/venv1/Lib/site-packages/pycparser/c_parser.py +30 -7
- py2docfx/venv/venv1/Lib/site-packages/pycparser/lextab.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/pycparser/yacctab.py +132 -127
- py2docfx/venv/venv1/Lib/site-packages/requests/__version__.py +2 -2
- py2docfx/venv/venv1/Lib/site-packages/requests/adapters.py +17 -40
- py2docfx/venv/venv1/Lib/site-packages/requests/sessions.py +1 -1
- py2docfx/venv/venv1/Lib/site-packages/typing_extensions.py +91 -18
- {py2docfx-0.1.20.dev2196778.dist-info → py2docfx-0.1.20.dev2243675.dist-info}/METADATA +1 -1
- {py2docfx-0.1.20.dev2196778.dist-info → py2docfx-0.1.20.dev2243675.dist-info}/RECORD +86 -88
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/linux_vscode_adapter.py +0 -100
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/macos_vscode_adapter.py +0 -34
- py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/win_vscode_adapter.py +0 -77
- {py2docfx-0.1.20.dev2196778.dist-info → py2docfx-0.1.20.dev2243675.dist-info}/WHEEL +0 -0
- {py2docfx-0.1.20.dev2196778.dist-info → py2docfx-0.1.20.dev2243675.dist-info}/top_level.txt +0 -0
|
@@ -2,49 +2,37 @@
|
|
|
2
2
|
# Copyright (c) Microsoft Corporation.
|
|
3
3
|
# Licensed under the MIT License.
|
|
4
4
|
# ------------------------------------
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Optional, Any
|
|
6
6
|
|
|
7
7
|
from azure.core.credentials import AccessToken, AccessTokenInfo, TokenRequestOptions
|
|
8
|
-
from azure.core.exceptions import ClientAuthenticationError
|
|
9
|
-
from ..._exceptions import CredentialUnavailableError
|
|
10
8
|
from .._internal import AsyncContextManager
|
|
11
|
-
from .._internal.aad_client import AadClient
|
|
12
|
-
from .._internal.get_token_mixin import GetTokenMixin
|
|
13
9
|
from .._internal.decorators import log_get_token_async
|
|
14
|
-
from ..._credentials.vscode import
|
|
15
|
-
from ..._internal import within_dac
|
|
10
|
+
from ..._credentials.vscode import VisualStudioCodeCredential as SyncVSCodeCredential
|
|
16
11
|
|
|
17
12
|
|
|
18
|
-
class VisualStudioCodeCredential(
|
|
19
|
-
"""Authenticates as the Azure user signed in to Visual Studio Code via the 'Azure
|
|
13
|
+
class VisualStudioCodeCredential(AsyncContextManager):
|
|
14
|
+
"""Authenticates as the Azure user signed in to Visual Studio Code via the 'Azure Resources' extension.
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
https://github.com/microsoft/vscode-azure-account/issues/964. Consider using other developer credentials such as
|
|
24
|
-
AzureCliCredential, AzureDeveloperCliCredential, or AzurePowerShellCredential.
|
|
16
|
+
This currently only works in Windows/WSL environments and requires the 'azure-identity-broker'
|
|
17
|
+
package to be installed.
|
|
25
18
|
|
|
26
|
-
:keyword str
|
|
27
|
-
|
|
28
|
-
matching the "Azure: Cloud" setting in VS Code's user settings or, when that setting has no value, the
|
|
29
|
-
authority for Azure Public Cloud.
|
|
30
|
-
:keyword str tenant_id: ID of the tenant the credential should authenticate in. Defaults to the "Azure: Tenant"
|
|
31
|
-
setting in VS Code's user settings or, when that setting has no value, the "organizations" tenant, which
|
|
32
|
-
supports only Microsoft Entra work or school accounts.
|
|
19
|
+
:keyword str tenant_id: A Microsoft Entra tenant ID. Defaults to the tenant specified in the authentication
|
|
20
|
+
record file used by the Azure Resources extension.
|
|
33
21
|
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
|
|
34
22
|
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
|
|
35
23
|
acquire tokens for any tenant the application can access.
|
|
36
24
|
"""
|
|
37
25
|
|
|
26
|
+
def __init__(self, **kwargs: Any) -> None:
|
|
27
|
+
self._sync_credential = SyncVSCodeCredential(**kwargs)
|
|
28
|
+
|
|
38
29
|
async def __aenter__(self) -> "VisualStudioCodeCredential":
|
|
39
|
-
|
|
40
|
-
await self._client.__aenter__()
|
|
30
|
+
self._sync_credential.__enter__()
|
|
41
31
|
return self
|
|
42
32
|
|
|
43
33
|
async def close(self) -> None:
|
|
44
34
|
"""Close the credential's transport session."""
|
|
45
|
-
|
|
46
|
-
if self._client:
|
|
47
|
-
await self._client.__aexit__()
|
|
35
|
+
self._sync_credential.close()
|
|
48
36
|
|
|
49
37
|
@log_get_token_async
|
|
50
38
|
async def get_token(
|
|
@@ -66,22 +54,7 @@ class VisualStudioCodeCredential(_VSCodeCredentialBase, AsyncContextManager, Get
|
|
|
66
54
|
:raises ~azure.identity.CredentialUnavailableError: the credential cannot retrieve user details from Visual
|
|
67
55
|
Studio Code
|
|
68
56
|
"""
|
|
69
|
-
|
|
70
|
-
error_message = (
|
|
71
|
-
self._unavailable_reason + "\n"
|
|
72
|
-
"Visit https://aka.ms/azsdk/python/identity/vscodecredential/troubleshoot"
|
|
73
|
-
" to troubleshoot this issue."
|
|
74
|
-
)
|
|
75
|
-
raise CredentialUnavailableError(message=error_message)
|
|
76
|
-
if not self._client:
|
|
77
|
-
raise CredentialUnavailableError("Initialization failed")
|
|
78
|
-
if within_dac.get():
|
|
79
|
-
try:
|
|
80
|
-
token = await super().get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
|
|
81
|
-
return token
|
|
82
|
-
except ClientAuthenticationError as ex:
|
|
83
|
-
raise CredentialUnavailableError(message=ex.message) from ex
|
|
84
|
-
return await super().get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
|
|
57
|
+
return self._sync_credential.get_token(*scopes, claims=claims, tenant_id=tenant_id, **kwargs)
|
|
85
58
|
|
|
86
59
|
async def get_token_info(self, *scopes: str, options: Optional[TokenRequestOptions] = None) -> AccessTokenInfo:
|
|
87
60
|
"""Request an access token for `scopes` as the user currently signed in to Visual Studio Code.
|
|
@@ -99,29 +72,4 @@ class VisualStudioCodeCredential(_VSCodeCredentialBase, AsyncContextManager, Get
|
|
|
99
72
|
:raises ~azure.identity.CredentialUnavailableError: the credential cannot retrieve user details from Visual
|
|
100
73
|
Studio Code.
|
|
101
74
|
"""
|
|
102
|
-
|
|
103
|
-
error_message = (
|
|
104
|
-
self._unavailable_reason + "\n"
|
|
105
|
-
"Visit https://aka.ms/azsdk/python/identity/vscodecredential/troubleshoot"
|
|
106
|
-
" to troubleshoot this issue."
|
|
107
|
-
)
|
|
108
|
-
raise CredentialUnavailableError(message=error_message)
|
|
109
|
-
if within_dac.get():
|
|
110
|
-
try:
|
|
111
|
-
token = await super().get_token_info(*scopes, options=options)
|
|
112
|
-
return token
|
|
113
|
-
except ClientAuthenticationError as ex:
|
|
114
|
-
raise CredentialUnavailableError(message=ex.message) from ex
|
|
115
|
-
return await super().get_token_info(*scopes, options=options)
|
|
116
|
-
|
|
117
|
-
async def _acquire_token_silently(self, *scopes: str, **kwargs: Any) -> Optional[AccessTokenInfo]:
|
|
118
|
-
self._client = cast(AadClient, self._client)
|
|
119
|
-
return self._client.get_cached_access_token(scopes, **kwargs)
|
|
120
|
-
|
|
121
|
-
async def _request_token(self, *scopes: str, **kwargs: Any) -> AccessTokenInfo:
|
|
122
|
-
refresh_token = self._get_refresh_token()
|
|
123
|
-
self._client = cast(AadClient, self._client)
|
|
124
|
-
return await self._client.obtain_token_by_refresh_token(scopes, refresh_token, **kwargs)
|
|
125
|
-
|
|
126
|
-
def _get_client(self, **kwargs: Any) -> AadClient:
|
|
127
|
-
return AadClient(**kwargs)
|
|
75
|
+
return self._sync_credential.get_token_info(*scopes, options=options)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import os
|
|
6
6
|
from typing import Any, Optional
|
|
7
7
|
from .client_assertion import ClientAssertionCredential
|
|
8
|
-
from ..._credentials.workload_identity import TokenFileMixin
|
|
8
|
+
from ..._credentials.workload_identity import TokenFileMixin, WORKLOAD_CONFIG_ERROR
|
|
9
9
|
from ..._constants import EnvironmentVariables
|
|
10
10
|
|
|
11
11
|
|
|
@@ -52,21 +52,25 @@ class WorkloadIdentityCredential(ClientAssertionCredential, TokenFileMixin):
|
|
|
52
52
|
tenant_id = tenant_id or os.environ.get(EnvironmentVariables.AZURE_TENANT_ID)
|
|
53
53
|
client_id = client_id or os.environ.get(EnvironmentVariables.AZURE_CLIENT_ID)
|
|
54
54
|
token_file_path = token_file_path or os.environ.get(EnvironmentVariables.AZURE_FEDERATED_TOKEN_FILE)
|
|
55
|
+
|
|
56
|
+
missing_args = []
|
|
55
57
|
if not tenant_id:
|
|
56
|
-
|
|
57
|
-
"'tenant_id' is required. Please pass it in or set the "
|
|
58
|
-
f"{EnvironmentVariables.AZURE_TENANT_ID} environment variable"
|
|
59
|
-
)
|
|
58
|
+
missing_args.append("'tenant_id'")
|
|
60
59
|
if not client_id:
|
|
61
|
-
|
|
62
|
-
"'client_id' is required. Please pass it in or set the "
|
|
63
|
-
f"{EnvironmentVariables.AZURE_CLIENT_ID} environment variable"
|
|
64
|
-
)
|
|
60
|
+
missing_args.append("'client_id'")
|
|
65
61
|
if not token_file_path:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
)
|
|
62
|
+
missing_args.append("'token_file_path'")
|
|
63
|
+
|
|
64
|
+
if missing_args:
|
|
65
|
+
missing_args_str = ", ".join(missing_args)
|
|
66
|
+
error_message = f"{WORKLOAD_CONFIG_ERROR}. Missing required arguments: {missing_args_str}."
|
|
67
|
+
raise ValueError(error_message)
|
|
68
|
+
|
|
69
|
+
# Type assertions since we've validated these are not None
|
|
70
|
+
assert tenant_id is not None
|
|
71
|
+
assert client_id is not None
|
|
72
|
+
assert token_file_path is not None
|
|
73
|
+
|
|
70
74
|
self._token_file_path = token_file_path
|
|
71
75
|
super().__init__(
|
|
72
76
|
tenant_id=tenant_id,
|
|
@@ -5,8 +5,8 @@ from .api import FFI
|
|
|
5
5
|
from .error import CDefError, FFIError, VerificationError, VerificationMissing
|
|
6
6
|
from .error import PkgConfigError
|
|
7
7
|
|
|
8
|
-
__version__ = "
|
|
9
|
-
__version_info__ = (
|
|
8
|
+
__version__ = "2.0.0"
|
|
9
|
+
__version_info__ = (2, 0, 0)
|
|
10
10
|
|
|
11
11
|
# The verifier module file names are based on the CRC32 of a string that
|
|
12
12
|
# contains the following version number. It may be older than __version__
|
|
@@ -59,7 +59,7 @@ def _workaround_for_old_pycparser(csource):
|
|
|
59
59
|
# for "char***(*const)". This means we can't tell the difference
|
|
60
60
|
# afterwards. But "char(*const(***))" gives us the right syntax
|
|
61
61
|
# tree. The issue only occurs if there are several stars in
|
|
62
|
-
# sequence with no parenthesis
|
|
62
|
+
# sequence with no parenthesis in between, just possibly qualifiers.
|
|
63
63
|
# Attempt to fix it by adding some parentheses in the source: each
|
|
64
64
|
# time we see "* const" or "* const *", we add an opening
|
|
65
65
|
# parenthesis before each star---the hard part is figuring out where
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import os, sys,
|
|
1
|
+
import io, os, sys, sysconfig
|
|
2
2
|
from . import ffiplatform, model
|
|
3
3
|
from .error import VerificationError
|
|
4
4
|
from .cffi_opcode import *
|
|
@@ -7,9 +7,9 @@ VERSION_BASE = 0x2601
|
|
|
7
7
|
VERSION_EMBEDDED = 0x2701
|
|
8
8
|
VERSION_CHAR16CHAR32 = 0x2801
|
|
9
9
|
|
|
10
|
-
USE_LIMITED_API = (sys.platform != 'win32' or sys.version_info < (3, 0) or
|
|
11
|
-
sys.version_info >= (3, 5))
|
|
12
|
-
|
|
10
|
+
USE_LIMITED_API = ((sys.platform != 'win32' or sys.version_info < (3, 0) or
|
|
11
|
+
sys.version_info >= (3, 5)) and
|
|
12
|
+
not sysconfig.get_config_var("Py_GIL_DISABLED")) # free-threaded doesn't yet support limited API
|
|
13
13
|
|
|
14
14
|
class GlobalExpr:
|
|
15
15
|
def __init__(self, name, address, type_op, size=0, check_value=0):
|
|
@@ -953,7 +953,7 @@ class Recompiler:
|
|
|
953
953
|
if cname is None or fbitsize >= 0:
|
|
954
954
|
offset = '(size_t)-1'
|
|
955
955
|
elif named_ptr is not None:
|
|
956
|
-
offset = '((char *)&((%s)4096)->%s) - (char *)4096' % (
|
|
956
|
+
offset = '(size_t)(((char *)&((%s)4096)->%s) - (char *)4096)' % (
|
|
957
957
|
named_ptr.name, fldname)
|
|
958
958
|
else:
|
|
959
959
|
offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import sys
|
|
3
|
+
import sysconfig
|
|
3
4
|
|
|
4
5
|
try:
|
|
5
6
|
basestring
|
|
@@ -87,6 +88,7 @@ def _set_py_limited_api(Extension, kwds):
|
|
|
87
88
|
Recently (2020) we started shipping only >= 3.5 wheels, though. So
|
|
88
89
|
we'll give it another try and set py_limited_api on Windows >= 3.5.
|
|
89
90
|
"""
|
|
91
|
+
from cffi._shimmed_dist_utils import log
|
|
90
92
|
from cffi import recompiler
|
|
91
93
|
|
|
92
94
|
if ('py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount')
|
|
@@ -101,6 +103,17 @@ def _set_py_limited_api(Extension, kwds):
|
|
|
101
103
|
# try to set 'py_limited_api' anyway. At worst, we get a
|
|
102
104
|
# warning.
|
|
103
105
|
kwds['py_limited_api'] = True
|
|
106
|
+
|
|
107
|
+
if sysconfig.get_config_var("Py_GIL_DISABLED"):
|
|
108
|
+
if kwds.get('py_limited_api'):
|
|
109
|
+
log.info("Ignoring py_limited_api=True for free-threaded build.")
|
|
110
|
+
|
|
111
|
+
kwds['py_limited_api'] = False
|
|
112
|
+
|
|
113
|
+
if kwds.get('py_limited_api') is False:
|
|
114
|
+
# avoid setting Py_LIMITED_API if py_limited_api=False
|
|
115
|
+
# which _cffi_include.h does unless _CFFI_NO_LIMITED_API is defined
|
|
116
|
+
kwds.setdefault("define_macros", []).append(("_CFFI_NO_LIMITED_API", None))
|
|
104
117
|
return kwds
|
|
105
118
|
|
|
106
119
|
def _add_c_module(dist, ffi, module_name, source, source_extension, kwds):
|
|
@@ -124,6 +124,9 @@ class VCPythonEngine(object):
|
|
|
124
124
|
prnt(' Py_DECREF(lib);')
|
|
125
125
|
prnt(' return NULL;')
|
|
126
126
|
prnt(' }')
|
|
127
|
+
prnt('#if Py_GIL_DISABLED')
|
|
128
|
+
prnt(' PyUnstable_Module_SetGIL(lib, Py_MOD_GIL_NOT_USED);')
|
|
129
|
+
prnt('#endif')
|
|
127
130
|
prnt(' return lib;')
|
|
128
131
|
prnt('}')
|
|
129
132
|
prnt()
|
|
@@ -369,14 +369,15 @@ def from_bytes(
|
|
|
369
369
|
# Preparing those fallbacks in case we got nothing.
|
|
370
370
|
if (
|
|
371
371
|
enable_fallback
|
|
372
|
-
and encoding_iana
|
|
372
|
+
and encoding_iana
|
|
373
|
+
in ["ascii", "utf_8", specified_encoding, "utf_16", "utf_32"]
|
|
373
374
|
and not lazy_str_hard_failure
|
|
374
375
|
):
|
|
375
376
|
fallback_entry = CharsetMatch(
|
|
376
377
|
sequences,
|
|
377
378
|
encoding_iana,
|
|
378
379
|
threshold,
|
|
379
|
-
|
|
380
|
+
bom_or_sig_available,
|
|
380
381
|
[],
|
|
381
382
|
decoded_payload,
|
|
382
383
|
preemptive_declaration=specified_encoding,
|
|
@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Any
|
|
|
4
4
|
from warnings import warn
|
|
5
5
|
|
|
6
6
|
from .api import from_bytes
|
|
7
|
-
from .constant import CHARDET_CORRESPONDENCE
|
|
7
|
+
from .constant import CHARDET_CORRESPONDENCE, TOO_SMALL_SEQUENCE
|
|
8
8
|
|
|
9
9
|
# TODO: remove this check when dropping Python 3.7 support
|
|
10
10
|
if TYPE_CHECKING:
|
|
@@ -49,6 +49,22 @@ def detect(
|
|
|
49
49
|
language = r.language if r is not None and r.language != "Unknown" else ""
|
|
50
50
|
confidence = 1.0 - r.chaos if r is not None else None
|
|
51
51
|
|
|
52
|
+
# automatically lower confidence
|
|
53
|
+
# on small bytes samples.
|
|
54
|
+
# https://github.com/jawah/charset_normalizer/issues/391
|
|
55
|
+
if (
|
|
56
|
+
confidence is not None
|
|
57
|
+
and confidence >= 0.9
|
|
58
|
+
and encoding
|
|
59
|
+
not in {
|
|
60
|
+
"utf_8",
|
|
61
|
+
"ascii",
|
|
62
|
+
}
|
|
63
|
+
and r.bom is False # type: ignore[union-attr]
|
|
64
|
+
and len(byte_str) < TOO_SMALL_SEQUENCE
|
|
65
|
+
):
|
|
66
|
+
confidence -= 0.2
|
|
67
|
+
|
|
52
68
|
# Note: CharsetNormalizer does not return 'UTF-8-SIG' as the sig get stripped in the detection/normalization process
|
|
53
69
|
# but chardet does return 'utf-8-sig' and it is a valid codec name.
|
|
54
70
|
if r is not None and encoding == "utf_8" and r.bom:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
4
|
# source: google/protobuf/any.proto
|
|
5
|
-
# Protobuf Python Version: 6.
|
|
5
|
+
# Protobuf Python Version: 6.32.1
|
|
6
6
|
"""Generated protocol buffer code."""
|
|
7
7
|
from google.protobuf import descriptor as _descriptor
|
|
8
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder
|
|
|
12
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
13
|
_runtime_version.Domain.PUBLIC,
|
|
14
14
|
6,
|
|
15
|
-
|
|
15
|
+
32,
|
|
16
16
|
1,
|
|
17
17
|
'',
|
|
18
18
|
'google/protobuf/any.proto'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
4
|
# source: google/protobuf/api.proto
|
|
5
|
-
# Protobuf Python Version: 6.
|
|
5
|
+
# Protobuf Python Version: 6.32.1
|
|
6
6
|
"""Generated protocol buffer code."""
|
|
7
7
|
from google.protobuf import descriptor as _descriptor
|
|
8
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder
|
|
|
12
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
13
|
_runtime_version.Domain.PUBLIC,
|
|
14
14
|
6,
|
|
15
|
-
|
|
15
|
+
32,
|
|
16
16
|
1,
|
|
17
17
|
'',
|
|
18
18
|
'google/protobuf/api.proto'
|
|
@@ -26,7 +26,7 @@ from google.protobuf import source_context_pb2 as google_dot_protobuf_dot_source
|
|
|
26
26
|
from google.protobuf import type_pb2 as google_dot_protobuf_dot_type__pb2
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobuf/api.proto\x12\x0fgoogle.protobuf\x1a$google/protobuf/source_context.proto\x1a\x1agoogle/protobuf/type.proto\"\
|
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobuf/api.proto\x12\x0fgoogle.protobuf\x1a$google/protobuf/source_context.proto\x1a\x1agoogle/protobuf/type.proto\"\xdb\x02\n\x03\x41pi\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x31\n\x07methods\x18\x02 \x03(\x0b\x32\x17.google.protobuf.MethodR\x07methods\x12\x31\n\x07options\x18\x03 \x03(\x0b\x32\x17.google.protobuf.OptionR\x07options\x12\x18\n\x07version\x18\x04 \x01(\tR\x07version\x12\x45\n\x0esource_context\x18\x05 \x01(\x0b\x32\x1e.google.protobuf.SourceContextR\rsourceContext\x12.\n\x06mixins\x18\x06 \x03(\x0b\x32\x16.google.protobuf.MixinR\x06mixins\x12/\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.SyntaxR\x06syntax\x12\x18\n\x07\x65\x64ition\x18\x08 \x01(\tR\x07\x65\x64ition\"\xd4\x02\n\x06Method\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x10request_type_url\x18\x02 \x01(\tR\x0erequestTypeUrl\x12+\n\x11request_streaming\x18\x03 \x01(\x08R\x10requestStreaming\x12*\n\x11response_type_url\x18\x04 \x01(\tR\x0fresponseTypeUrl\x12-\n\x12response_streaming\x18\x05 \x01(\x08R\x11responseStreaming\x12\x31\n\x07options\x18\x06 \x03(\x0b\x32\x17.google.protobuf.OptionR\x07options\x12\x33\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.SyntaxB\x02\x18\x01R\x06syntax\x12\x1c\n\x07\x65\x64ition\x18\x08 \x01(\tB\x02\x18\x01R\x07\x65\x64ition\"/\n\x05Mixin\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n\x04root\x18\x02 \x01(\tR\x04rootBv\n\x13\x63om.google.protobufB\x08\x41piProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3')
|
|
30
30
|
|
|
31
31
|
_globals = globals()
|
|
32
32
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -34,10 +34,14 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.api_pb2', _
|
|
|
34
34
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
35
35
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
36
36
|
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\010ApiProtoP\001Z,google.golang.org/protobuf/types/known/apipb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
|
|
37
|
+
_globals['_METHOD'].fields_by_name['syntax']._loaded_options = None
|
|
38
|
+
_globals['_METHOD'].fields_by_name['syntax']._serialized_options = b'\030\001'
|
|
39
|
+
_globals['_METHOD'].fields_by_name['edition']._loaded_options = None
|
|
40
|
+
_globals['_METHOD'].fields_by_name['edition']._serialized_options = b'\030\001'
|
|
37
41
|
_globals['_API']._serialized_start=113
|
|
38
|
-
_globals['_API']._serialized_end=
|
|
39
|
-
_globals['_METHOD']._serialized_start=
|
|
40
|
-
_globals['_METHOD']._serialized_end=
|
|
41
|
-
_globals['_MIXIN']._serialized_start=
|
|
42
|
-
_globals['_MIXIN']._serialized_end=
|
|
42
|
+
_globals['_API']._serialized_end=460
|
|
43
|
+
_globals['_METHOD']._serialized_start=463
|
|
44
|
+
_globals['_METHOD']._serialized_end=803
|
|
45
|
+
_globals['_MIXIN']._serialized_start=805
|
|
46
|
+
_globals['_MIXIN']._serialized_end=852
|
|
43
47
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
4
|
# source: google/protobuf/compiler/plugin.proto
|
|
5
|
-
# Protobuf Python Version: 6.
|
|
5
|
+
# Protobuf Python Version: 6.32.1
|
|
6
6
|
"""Generated protocol buffer code."""
|
|
7
7
|
from google.protobuf import descriptor as _descriptor
|
|
8
8
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
@@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder
|
|
|
12
12
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
13
|
_runtime_version.Domain.PUBLIC,
|
|
14
14
|
6,
|
|
15
|
-
|
|
15
|
+
32,
|
|
16
16
|
1,
|
|
17
17
|
'',
|
|
18
18
|
'google/protobuf/compiler/plugin.proto'
|