py2docfx 0.1.16.dev2052678__py3-none-any.whl → 0.1.16.dev2064350__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.
Files changed (281) hide show
  1. py2docfx/convert_prepare/environment.py +3 -1
  2. py2docfx/convert_prepare/get_source.py +6 -1
  3. py2docfx/convert_prepare/package_info.py +1 -1
  4. py2docfx/venv/basevenv/Lib/site-packages/babel/py.typed +1 -0
  5. py2docfx/venv/basevenv/Lib/site-packages/markupsafe/_speedups.pyi +1 -0
  6. py2docfx/venv/basevenv/Lib/site-packages/markupsafe/py.typed +0 -0
  7. py2docfx/venv/basevenv/Lib/site-packages/packaging/py.typed +0 -0
  8. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
  9. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
  10. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/chardet/py.typed +0 -0
  11. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
  12. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
  13. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
  14. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
  15. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/pyparsing/py.typed +0 -0
  16. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
  17. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
  18. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/tenacity/py.typed +0 -0
  19. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/tomli/py.typed +1 -0
  20. py2docfx/venv/basevenv/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
  21. py2docfx/venv/basevenv/Lib/site-packages/pip/py.typed +4 -0
  22. py2docfx/venv/basevenv/Lib/site-packages/pkg_resources/py.typed +0 -0
  23. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/importlib_metadata/py.typed +0 -0
  24. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/inflect/py.typed +0 -0
  25. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/jaraco/collections/py.typed +0 -0
  26. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi +125 -0
  27. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/jaraco/functools/py.typed +0 -0
  28. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/more_itertools/__init__.pyi +2 -0
  29. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/more_itertools/more.pyi +709 -0
  30. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/more_itertools/py.typed +0 -0
  31. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/more_itertools/recipes.pyi +136 -0
  32. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/packaging/py.typed +0 -0
  33. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/platformdirs/py.typed +0 -0
  34. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/tomli/py.typed +1 -0
  35. py2docfx/venv/basevenv/Lib/site-packages/setuptools/_vendor/typeguard/py.typed +0 -0
  36. py2docfx/venv/basevenv/Lib/site-packages/sphinx/py.typed +0 -0
  37. py2docfx/venv/basevenv/Lib/site-packages/sphinxcontrib/applehelp/py.typed +0 -0
  38. py2docfx/venv/basevenv/Lib/site-packages/sphinxcontrib/htmlhelp/py.typed +0 -0
  39. py2docfx/venv/basevenv/Lib/site-packages/sphinxcontrib/qthelp/py.typed +0 -0
  40. py2docfx/venv/basevenv/Lib/site-packages/sphinxcontrib/serializinghtml/py.typed +0 -0
  41. py2docfx/venv/basevenv/Lib/site-packages/urllib3/_version.py +9 -4
  42. py2docfx/venv/basevenv/Lib/site-packages/urllib3/contrib/emscripten/response.py +8 -16
  43. py2docfx/venv/basevenv/Lib/site-packages/urllib3/contrib/pyopenssl.py +10 -0
  44. py2docfx/venv/basevenv/Lib/site-packages/urllib3/exceptions.py +12 -4
  45. py2docfx/venv/basevenv/Lib/site-packages/urllib3/http2/connection.py +1 -1
  46. py2docfx/venv/basevenv/Lib/site-packages/urllib3/py.typed +2 -0
  47. py2docfx/venv/basevenv/Lib/site-packages/urllib3/util/ssl_.py +21 -1
  48. py2docfx/venv/basevenv/Lib/site-packages/urllib3/util/ssl_match_hostname.py +1 -1
  49. py2docfx/venv/basevenv/Lib/site-packages/wheel/__init__.py +1 -1
  50. py2docfx/venv/basevenv/Lib/site-packages/wheel/__main__.py +7 -5
  51. py2docfx/venv/basevenv/Lib/site-packages/wheel/{cli → _commands}/__init__.py +3 -5
  52. py2docfx/venv/basevenv/Lib/site-packages/wheel/{cli → _commands}/convert.py +14 -9
  53. py2docfx/venv/basevenv/Lib/site-packages/wheel/{cli → _commands}/pack.py +1 -2
  54. py2docfx/venv/basevenv/Lib/site-packages/wheel/{cli → _commands}/tags.py +4 -3
  55. py2docfx/venv/basevenv/Lib/site-packages/wheel/_metadata.py +184 -0
  56. py2docfx/venv/basevenv/Lib/site-packages/wheel/bdist_wheel.py +12 -23
  57. py2docfx/venv/basevenv/Lib/site-packages/wheel/macosx_libfile.py +4 -0
  58. py2docfx/venv/basevenv/Lib/site-packages/wheel/metadata.py +17 -183
  59. py2docfx/venv/basevenv/Lib/site-packages/wheel/wheelfile.py +30 -16
  60. py2docfx/venv/venv1/Lib/site-packages/azure/core/_version.py +1 -1
  61. py2docfx/venv/venv1/Lib/site-packages/azure/core/credentials.py +5 -4
  62. py2docfx/venv/venv1/Lib/site-packages/azure/core/instrumentation.py +67 -0
  63. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/_base.py +3 -1
  64. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/_tools.py +1 -1
  65. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication.py +4 -4
  66. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication_async.py +1 -2
  67. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_distributed_tracing.py +152 -29
  68. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_redirect.py +3 -2
  69. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_redirect_async.py +2 -2
  70. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_retry.py +3 -10
  71. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_retry_async.py +3 -8
  72. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_universal.py +2 -0
  73. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/transport/_aiohttp.py +0 -1
  74. py2docfx/venv/venv1/Lib/site-packages/azure/core/polling/base_polling.py +3 -3
  75. py2docfx/venv/venv1/Lib/site-packages/azure/core/py.typed +0 -0
  76. py2docfx/venv/venv1/Lib/site-packages/azure/core/rest/_http_response_impl_async.py +3 -0
  77. py2docfx/venv/venv1/Lib/site-packages/azure/core/rest/_rest_py3.py +2 -2
  78. py2docfx/venv/venv1/Lib/site-packages/azure/core/settings.py +27 -21
  79. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/__init__.py +3 -7
  80. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/_abstract_span.py +2 -35
  81. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/_models.py +71 -0
  82. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/common.py +12 -4
  83. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/decorator.py +66 -13
  84. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/decorator_async.py +62 -23
  85. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/ext/opencensus_span/py.typed +0 -0
  86. py2docfx/venv/venv1/Lib/site-packages/azure/core/tracing/opentelemetry.py +244 -0
  87. py2docfx/venv/venv1/Lib/site-packages/azure/core/utils/_connection_string_parser.py +1 -2
  88. py2docfx/venv/venv1/Lib/site-packages/azure/core/utils/_messaging_shared.py +1 -1
  89. py2docfx/venv/venv1/Lib/site-packages/azure/core/utils/_pipeline_transport_rest_shared.py +1 -1
  90. py2docfx/venv/venv1/Lib/site-packages/azure/core/utils/_utils.py +1 -1
  91. py2docfx/venv/venv1/Lib/site-packages/azure/identity/py.typed +0 -0
  92. py2docfx/venv/venv1/Lib/site-packages/certifi/py.typed +0 -0
  93. py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/py.typed +0 -0
  94. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi +28 -0
  95. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi +8 -0
  96. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi +7 -0
  97. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi +17 -0
  98. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi +117 -0
  99. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi +72 -0
  100. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/aead.pyi +103 -0
  101. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/ciphers.pyi +38 -0
  102. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/cmac.pyi +18 -0
  103. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi +51 -0
  104. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi +41 -0
  105. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/ec.pyi +52 -0
  106. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi +12 -0
  107. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi +12 -0
  108. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi +19 -0
  109. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi +21 -0
  110. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi +43 -0
  111. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/keys.pyi +33 -0
  112. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi +13 -0
  113. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/rsa.pyi +55 -0
  114. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi +12 -0
  115. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/x448.pyi +12 -0
  116. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/pkcs12.pyi +46 -0
  117. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi +49 -0
  118. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/test_support.pyi +22 -0
  119. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi +246 -0
  120. py2docfx/venv/venv1/Lib/site-packages/cryptography/py.typed +0 -0
  121. py2docfx/venv/venv1/Lib/site-packages/google/api/annotations_pb2.pyi +24 -0
  122. py2docfx/venv/venv1/Lib/site-packages/google/api/auth_pb2.pyi +120 -0
  123. py2docfx/venv/venv1/Lib/site-packages/google/api/backend_pb2.pyi +102 -0
  124. py2docfx/venv/venv1/Lib/site-packages/google/api/billing_pb2.pyi +50 -0
  125. py2docfx/venv/venv1/Lib/site-packages/google/api/client_pb2.pyi +405 -0
  126. py2docfx/venv/venv1/Lib/site-packages/google/api/config_change_pb2.pyi +65 -0
  127. py2docfx/venv/venv1/Lib/site-packages/google/api/consumer_pb2.pyi +62 -0
  128. py2docfx/venv/venv1/Lib/site-packages/google/api/context_pb2.pyi +60 -0
  129. py2docfx/venv/venv1/Lib/site-packages/google/api/control_pb2.pyi +43 -0
  130. py2docfx/venv/venv1/Lib/site-packages/google/api/distribution_pb2.pyi +144 -0
  131. py2docfx/venv/venv1/Lib/site-packages/google/api/documentation_pb2.pyi +86 -0
  132. py2docfx/venv/venv1/Lib/site-packages/google/api/endpoint_pb2.pyi +41 -0
  133. py2docfx/venv/venv1/Lib/site-packages/google/api/error_reason_pb2.pyi +90 -0
  134. py2docfx/venv/venv1/Lib/site-packages/google/api/field_behavior_pb2.pyi +45 -0
  135. py2docfx/venv/venv1/Lib/site-packages/google/api/field_info_pb2.pyi +60 -0
  136. py2docfx/venv/venv1/Lib/site-packages/google/api/http_pb2.pyi +94 -0
  137. py2docfx/venv/venv1/Lib/site-packages/google/api/httpbody_pb2.pyi +41 -0
  138. py2docfx/venv/venv1/Lib/site-packages/google/api/label_pb2.pyi +47 -0
  139. py2docfx/venv/venv1/Lib/site-packages/google/api/launch_stage_pb2.pyi +40 -0
  140. py2docfx/venv/venv1/Lib/site-packages/google/api/log_pb2.pyi +47 -0
  141. py2docfx/venv/venv1/Lib/site-packages/google/api/logging_pb2.pyi +57 -0
  142. py2docfx/venv/venv1/Lib/site-packages/google/api/metric_pb2.pyi +186 -0
  143. py2docfx/venv/venv1/Lib/site-packages/google/api/monitored_resource_pb2.pyi +104 -0
  144. py2docfx/venv/venv1/Lib/site-packages/google/api/monitoring_pb2.pyi +57 -0
  145. py2docfx/venv/venv1/Lib/site-packages/google/api/policy_pb2.pyi +57 -0
  146. py2docfx/venv/venv1/Lib/site-packages/google/api/quota_pb2.pyi +116 -0
  147. py2docfx/venv/venv1/Lib/site-packages/google/api/resource_pb2.pyi +93 -0
  148. py2docfx/venv/venv1/Lib/site-packages/google/api/routing_pb2.pyi +49 -0
  149. py2docfx/venv/venv1/Lib/site-packages/google/api/service_pb2.pyi +170 -0
  150. py2docfx/venv/venv1/Lib/site-packages/google/api/source_info_pb2.pyi +34 -0
  151. py2docfx/venv/venv1/Lib/site-packages/google/api/system_parameter_pb2.pyi +60 -0
  152. py2docfx/venv/venv1/Lib/site-packages/google/api/usage_pb2.pyi +55 -0
  153. py2docfx/venv/venv1/Lib/site-packages/google/api/visibility_pb2.pyi +56 -0
  154. py2docfx/venv/venv1/Lib/site-packages/google/api_core/py.typed +2 -0
  155. py2docfx/venv/venv1/Lib/site-packages/google/auth/py.typed +2 -0
  156. py2docfx/venv/venv1/Lib/site-packages/google/cloud/extended_operations_pb2.pyi +45 -0
  157. py2docfx/venv/venv1/Lib/site-packages/google/cloud/location/locations_pb2.pyi +96 -0
  158. py2docfx/venv/venv1/Lib/site-packages/google/gapic/metadata/gapic_metadata_pb2.pyi +118 -0
  159. py2docfx/venv/venv1/Lib/site-packages/google/logging/type/http_request_pb2.pyi +91 -0
  160. py2docfx/venv/venv1/Lib/site-packages/google/logging/type/log_severity_pb2.pyi +42 -0
  161. py2docfx/venv/venv1/Lib/site-packages/google/longrunning/operations_proto_pb2.pyi +126 -0
  162. py2docfx/venv/venv1/Lib/site-packages/google/oauth2/py.typed +2 -0
  163. py2docfx/venv/venv1/Lib/site-packages/google/rpc/code_pb2.pyi +58 -0
  164. py2docfx/venv/venv1/Lib/site-packages/google/rpc/context/attribute_context_pb2.pyi +309 -0
  165. py2docfx/venv/venv1/Lib/site-packages/google/rpc/context/audit_context_pb2.pyi +51 -0
  166. py2docfx/venv/venv1/Lib/site-packages/google/rpc/error_details_pb2.pyi +207 -0
  167. py2docfx/venv/venv1/Lib/site-packages/google/rpc/http_pb2.pyi +71 -0
  168. py2docfx/venv/venv1/Lib/site-packages/google/rpc/status_pb2.pyi +41 -0
  169. py2docfx/venv/venv1/Lib/site-packages/google/type/calendar_period_pb2.pyi +40 -0
  170. py2docfx/venv/venv1/Lib/site-packages/google/type/color_pb2.pyi +42 -0
  171. py2docfx/venv/venv1/Lib/site-packages/google/type/date_pb2.pyi +36 -0
  172. py2docfx/venv/venv1/Lib/site-packages/google/type/datetime_pb2.pyi +77 -0
  173. py2docfx/venv/venv1/Lib/site-packages/google/type/dayofweek_pb2.pyi +40 -0
  174. py2docfx/venv/venv1/Lib/site-packages/google/type/decimal_pb2.pyi +27 -0
  175. py2docfx/venv/venv1/Lib/site-packages/google/type/expr_pb2.pyi +39 -0
  176. py2docfx/venv/venv1/Lib/site-packages/google/type/fraction_pb2.pyi +31 -0
  177. py2docfx/venv/venv1/Lib/site-packages/google/type/interval_pb2.pyi +36 -0
  178. py2docfx/venv/venv1/Lib/site-packages/google/type/latlng_pb2.pyi +31 -0
  179. py2docfx/venv/venv1/Lib/site-packages/google/type/localized_text_pb2.pyi +31 -0
  180. py2docfx/venv/venv1/Lib/site-packages/google/type/money_pb2.pyi +36 -0
  181. py2docfx/venv/venv1/Lib/site-packages/google/type/month_pb2.pyi +50 -0
  182. py2docfx/venv/venv1/Lib/site-packages/google/type/phone_number_pb2.pyi +48 -0
  183. py2docfx/venv/venv1/Lib/site-packages/google/type/postal_address_pb2.pyi +74 -0
  184. py2docfx/venv/venv1/Lib/site-packages/google/type/quaternion_pb2.pyi +39 -0
  185. py2docfx/venv/venv1/Lib/site-packages/google/type/timeofday_pb2.pyi +39 -0
  186. py2docfx/venv/venv1/Lib/site-packages/idna/py.typed +0 -0
  187. py2docfx/venv/venv1/Lib/site-packages/jwt/py.typed +0 -0
  188. py2docfx/venv/venv1/Lib/site-packages/packaging/__init__.py +15 -0
  189. py2docfx/venv/venv1/Lib/site-packages/{wheel/vendored/packaging → packaging}/_elffile.py +9 -7
  190. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/_manylinux.py +12 -9
  191. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/_musllinux.py +5 -3
  192. py2docfx/venv/venv1/Lib/site-packages/{wheel/vendored/packaging → packaging}/_parser.py +11 -13
  193. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/_tokenizer.py +10 -8
  194. py2docfx/venv/venv1/Lib/site-packages/packaging/licenses/__init__.py +145 -0
  195. py2docfx/venv/venv1/Lib/site-packages/packaging/licenses/_spdx.py +759 -0
  196. py2docfx/venv/venv1/Lib/site-packages/{wheel/vendored/packaging → packaging}/markers.py +103 -25
  197. py2docfx/venv/venv1/Lib/site-packages/packaging/metadata.py +863 -0
  198. py2docfx/venv/venv1/Lib/site-packages/packaging/py.typed +0 -0
  199. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/requirements.py +5 -4
  200. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/specifiers.py +40 -31
  201. py2docfx/venv/venv1/Lib/site-packages/{wheel/vendored/packaging → packaging}/tags.py +96 -50
  202. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/utils.py +39 -48
  203. py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/version.py +53 -32
  204. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/cachecontrol/py.typed +0 -0
  205. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/certifi/py.typed +0 -0
  206. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/chardet/py.typed +0 -0
  207. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/distro/py.typed +0 -0
  208. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/idna/py.typed +0 -0
  209. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/packaging/py.typed +0 -0
  210. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/platformdirs/py.typed +0 -0
  211. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/pyparsing/py.typed +0 -0
  212. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/resolvelib/py.typed +0 -0
  213. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/rich/py.typed +0 -0
  214. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/tenacity/py.typed +0 -0
  215. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/tomli/py.typed +1 -0
  216. py2docfx/venv/venv1/Lib/site-packages/pip/_vendor/truststore/py.typed +0 -0
  217. py2docfx/venv/venv1/Lib/site-packages/pip/py.typed +4 -0
  218. py2docfx/venv/venv1/Lib/site-packages/pkg_resources/py.typed +0 -0
  219. py2docfx/venv/venv1/Lib/site-packages/rsa/py.typed +1 -0
  220. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/importlib_metadata/py.typed +0 -0
  221. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/inflect/py.typed +0 -0
  222. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/jaraco/collections/py.typed +0 -0
  223. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi +125 -0
  224. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/jaraco/functools/py.typed +0 -0
  225. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/more_itertools/__init__.pyi +2 -0
  226. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/more_itertools/more.pyi +709 -0
  227. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/more_itertools/py.typed +0 -0
  228. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/more_itertools/recipes.pyi +136 -0
  229. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/packaging/py.typed +0 -0
  230. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/platformdirs/py.typed +0 -0
  231. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/tomli/py.typed +1 -0
  232. py2docfx/venv/venv1/Lib/site-packages/setuptools/_vendor/typeguard/py.typed +0 -0
  233. py2docfx/venv/venv1/Lib/site-packages/typing_extensions.py +30 -12
  234. py2docfx/venv/venv1/Lib/site-packages/urllib3/_version.py +9 -4
  235. py2docfx/venv/venv1/Lib/site-packages/urllib3/contrib/emscripten/response.py +8 -16
  236. py2docfx/venv/venv1/Lib/site-packages/urllib3/contrib/pyopenssl.py +10 -0
  237. py2docfx/venv/venv1/Lib/site-packages/urllib3/exceptions.py +12 -4
  238. py2docfx/venv/venv1/Lib/site-packages/urllib3/http2/connection.py +1 -1
  239. py2docfx/venv/venv1/Lib/site-packages/urllib3/py.typed +2 -0
  240. py2docfx/venv/venv1/Lib/site-packages/urllib3/util/ssl_.py +21 -1
  241. py2docfx/venv/venv1/Lib/site-packages/urllib3/util/ssl_match_hostname.py +1 -1
  242. py2docfx/venv/venv1/Lib/site-packages/wheel/__init__.py +1 -1
  243. py2docfx/venv/venv1/Lib/site-packages/wheel/__main__.py +7 -5
  244. py2docfx/venv/venv1/Lib/site-packages/wheel/{cli → _commands}/__init__.py +3 -5
  245. py2docfx/venv/venv1/Lib/site-packages/wheel/{cli → _commands}/convert.py +14 -9
  246. py2docfx/venv/venv1/Lib/site-packages/wheel/{cli → _commands}/pack.py +1 -2
  247. py2docfx/venv/venv1/Lib/site-packages/wheel/{cli → _commands}/tags.py +4 -3
  248. py2docfx/venv/venv1/Lib/site-packages/wheel/_metadata.py +184 -0
  249. py2docfx/venv/venv1/Lib/site-packages/wheel/bdist_wheel.py +12 -23
  250. py2docfx/venv/venv1/Lib/site-packages/wheel/macosx_libfile.py +4 -0
  251. py2docfx/venv/venv1/Lib/site-packages/wheel/metadata.py +17 -183
  252. py2docfx/venv/venv1/Lib/site-packages/wheel/wheelfile.py +30 -16
  253. {py2docfx-0.1.16.dev2052678.dist-info → py2docfx-0.1.16.dev2064350.dist-info}/METADATA +2 -3
  254. {py2docfx-0.1.16.dev2052678.dist-info → py2docfx-0.1.16.dev2064350.dist-info}/RECORD +263 -104
  255. {py2docfx-0.1.16.dev2052678.dist-info → py2docfx-0.1.16.dev2064350.dist-info}/WHEEL +1 -1
  256. py2docfx/venv/basevenv/Lib/site-packages/wheel/_bdist_wheel.py +0 -613
  257. py2docfx/venv/basevenv/Lib/site-packages/wheel/_setuptools_logging.py +0 -26
  258. py2docfx/venv/basevenv/Lib/site-packages/wheel/util.py +0 -17
  259. py2docfx/venv/basevenv/Lib/site-packages/wheel/vendored/packaging/_elffile.py +0 -108
  260. py2docfx/venv/basevenv/Lib/site-packages/wheel/vendored/packaging/_parser.py +0 -356
  261. py2docfx/venv/basevenv/Lib/site-packages/wheel/vendored/packaging/markers.py +0 -253
  262. py2docfx/venv/basevenv/Lib/site-packages/wheel/vendored/packaging/tags.py +0 -571
  263. py2docfx/venv/venv1/Lib/site-packages/wheel/_bdist_wheel.py +0 -613
  264. py2docfx/venv/venv1/Lib/site-packages/wheel/_setuptools_logging.py +0 -26
  265. py2docfx/venv/venv1/Lib/site-packages/wheel/util.py +0 -17
  266. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/_manylinux.py +0 -260
  267. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/_musllinux.py +0 -83
  268. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/_structures.py +0 -61
  269. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/_tokenizer.py +0 -192
  270. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/requirements.py +0 -90
  271. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/specifiers.py +0 -1011
  272. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/utils.py +0 -172
  273. py2docfx/venv/venv1/Lib/site-packages/wheel/vendored/packaging/version.py +0 -561
  274. /py2docfx/venv/basevenv/Lib/site-packages/{wheel/vendored/__init__.py → certifi/py.typed} +0 -0
  275. /py2docfx/venv/basevenv/Lib/site-packages/{wheel/vendored/packaging/__init__.py → charset_normalizer/py.typed} +0 -0
  276. /py2docfx/venv/{venv1/Lib/site-packages/wheel/vendored/__init__.py → basevenv/Lib/site-packages/idna/py.typed} +0 -0
  277. /py2docfx/venv/{venv1/Lib/site-packages/wheel/vendored/packaging/__init__.py → basevenv/Lib/site-packages/jinja2/py.typed} +0 -0
  278. /py2docfx/venv/basevenv/Lib/site-packages/wheel/{cli → _commands}/unpack.py +0 -0
  279. /py2docfx/venv/{basevenv/Lib/site-packages/wheel/vendored → venv1/Lib/site-packages}/packaging/_structures.py +0 -0
  280. /py2docfx/venv/venv1/Lib/site-packages/wheel/{cli → _commands}/unpack.py +0 -0
  281. {py2docfx-0.1.16.dev2052678.dist-info → py2docfx-0.1.16.dev2064350.dist-info}/top_level.txt +0 -0
@@ -4,12 +4,10 @@
4
4
  # ------------------------------------
5
5
  """Protocol that defines what functions wrappers of tracing libraries should implement."""
6
6
  from __future__ import annotations
7
- from enum import Enum
8
7
  from urllib.parse import urlparse
9
8
 
10
9
  from typing import (
11
10
  Any,
12
- Sequence,
13
11
  Optional,
14
12
  Union,
15
13
  Callable,
@@ -26,33 +24,16 @@ from azure.core.rest import (
26
24
  AsyncHttpResponse as AsyncRestHttpResponse,
27
25
  HttpRequest as RestHttpRequest,
28
26
  )
27
+ from ._models import AttributeValue, SpanKind
28
+
29
29
 
30
30
  HttpResponseType = Union[HttpResponse, AsyncHttpResponse, RestHttpResponse, AsyncRestHttpResponse]
31
31
  HttpRequestType = Union[HttpRequest, RestHttpRequest]
32
32
 
33
- AttributeValue = Union[
34
- str,
35
- bool,
36
- int,
37
- float,
38
- Sequence[str],
39
- Sequence[bool],
40
- Sequence[int],
41
- Sequence[float],
42
- ]
43
33
  Attributes = Dict[str, AttributeValue]
44
34
  SpanType = TypeVar("SpanType")
45
35
 
46
36
 
47
- class SpanKind(Enum):
48
- UNSPECIFIED = 1
49
- SERVER = 2
50
- CLIENT = 3
51
- PRODUCER = 4
52
- CONSUMER = 5
53
- INTERNAL = 6
54
-
55
-
56
37
  @runtime_checkable
57
38
  class AbstractSpan(Protocol, Generic[SpanType]):
58
39
  """Wraps a span from a distributed tracing implementation.
@@ -305,17 +286,3 @@ class HttpSpanMixin:
305
286
  else:
306
287
  self.add_attribute(HttpSpanMixin._HTTP_STATUS_CODE, 504)
307
288
  self.add_attribute(HttpSpanMixin._ERROR_TYPE, "504")
308
-
309
-
310
- class Link:
311
- """
312
- This is a wrapper class to link the context to the current tracer.
313
- :param headers: A dictionary of the request header as key value pairs.
314
- :type headers: dict
315
- :param attributes: Any additional attributes that should be added to link
316
- :type attributes: dict
317
- """
318
-
319
- def __init__(self, headers: Dict[str, str], attributes: Optional[Attributes] = None) -> None:
320
- self.headers = headers
321
- self.attributes = attributes
@@ -0,0 +1,71 @@
1
+ # ------------------------------------
2
+ # Copyright (c) Microsoft Corporation.
3
+ # Licensed under the MIT License.
4
+ # ------------------------------------
5
+ from enum import Enum
6
+ from typing import Dict, Mapping, Optional, Union, Sequence, TypedDict
7
+
8
+ from .._enum_meta import CaseInsensitiveEnumMeta
9
+
10
+
11
+ AttributeValue = Union[
12
+ str,
13
+ bool,
14
+ int,
15
+ float,
16
+ Sequence[str],
17
+ Sequence[bool],
18
+ Sequence[int],
19
+ Sequence[float],
20
+ ]
21
+ Attributes = Mapping[str, AttributeValue]
22
+
23
+
24
+ class SpanKind(Enum, metaclass=CaseInsensitiveEnumMeta):
25
+ """Describes the role or kind of a span within a distributed trace.
26
+
27
+ This helps to categorize spans based on their relationship to other spans and the type
28
+ of operation they represent.
29
+ """
30
+
31
+ UNSPECIFIED = 1
32
+ """Unspecified span kind."""
33
+
34
+ SERVER = 2
35
+ """Indicates that the span describes an operation that handles a remote request."""
36
+
37
+ CLIENT = 3
38
+ """Indicates that the span describes a request to some remote service."""
39
+
40
+ PRODUCER = 4
41
+ """Indicates that the span describes the initiation or scheduling of a local or remote operation."""
42
+
43
+ CONSUMER = 5
44
+ """Indicates that the span represents the processing of an operation initiated by a producer."""
45
+
46
+ INTERNAL = 6
47
+ """Indicates that the span is used internally in the application."""
48
+
49
+
50
+ class Link:
51
+ """Represents a reference from one span to another span.
52
+
53
+ :param headers: A dictionary of the request header as key value pairs.
54
+ :type headers: dict
55
+ :param attributes: Any additional attributes that should be added to link
56
+ :type attributes: dict
57
+ """
58
+
59
+ def __init__(self, headers: Dict[str, str], attributes: Optional[Attributes] = None) -> None:
60
+ self.headers = headers
61
+ self.attributes = attributes
62
+
63
+
64
+ class TracingOptions(TypedDict, total=False):
65
+ """Options to configure tracing behavior for operations."""
66
+
67
+ enabled: bool
68
+ """Whether tracing is enabled for the operation. By default, if the global setting is enabled, tracing is
69
+ enabled for all operations. This option can be used to override the global setting for a specific operation."""
70
+ attributes: Attributes
71
+ """Attributes to include in the spans emitted for the operation."""
@@ -29,6 +29,7 @@ from typing import Any, Optional, Callable, Type, Generator
29
29
  import warnings
30
30
 
31
31
  from ._abstract_span import AbstractSpan
32
+ from ..instrumentation import get_tracer
32
33
  from ..settings import settings
33
34
 
34
35
 
@@ -72,10 +73,11 @@ def change_context(span: Optional[AbstractSpan]) -> Generator:
72
73
  :rtype: contextmanager
73
74
  :return: A context manager that will run the given span in the new context
74
75
  """
75
- span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
76
+ span_impl_type = settings.tracing_implementation()
76
77
  if span_impl_type is None or span is None:
77
78
  yield
78
79
  else:
80
+
79
81
  try:
80
82
  with span_impl_type.change_context(span):
81
83
  yield
@@ -101,8 +103,14 @@ def with_current_context(func: Callable) -> Any:
101
103
  :return: The func wrapped with correct context
102
104
  :rtype: callable
103
105
  """
104
- span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
105
- if span_impl_type is None:
106
+ if not settings.tracing_enabled():
106
107
  return func
107
108
 
108
- return span_impl_type.with_current_context(func)
109
+ span_impl_type: Optional[Type[AbstractSpan]] = settings.tracing_implementation()
110
+ if span_impl_type:
111
+ return span_impl_type.with_current_context(func)
112
+
113
+ tracer = get_tracer()
114
+ if not tracer:
115
+ return func
116
+ return tracer.with_current_context(func)
@@ -24,22 +24,28 @@
24
24
  #
25
25
  # --------------------------------------------------------------------------
26
26
  """The decorator to apply if you want the given function traced."""
27
-
27
+ from contextvars import ContextVar
28
28
  import functools
29
29
 
30
30
  from typing import Callable, Any, TypeVar, overload, Optional, Mapping, TYPE_CHECKING
31
31
  from typing_extensions import ParamSpec
32
- from .common import change_context, get_function_and_class_name
33
- from . import SpanKind as _SpanKind
32
+ from .common import change_context
34
33
  from ..settings import settings
34
+ from ..instrumentation import get_tracer as _get_tracer
35
+ from ._models import SpanKind as _SpanKind
35
36
 
36
37
  if TYPE_CHECKING:
37
- from azure.core.tracing import SpanKind
38
+ from azure.core.tracing import TracingOptions, SpanKind
39
+
38
40
 
39
41
  P = ParamSpec("P")
40
42
  T = TypeVar("T")
41
43
 
42
44
 
45
+ # This context variable is used to determine if we are already in the span context of a decorated function.
46
+ _in_span_context = ContextVar("in_span_context", default=False)
47
+
48
+
43
49
  @overload
44
50
  def distributed_trace(__func: Callable[P, T]) -> Callable[P, T]:
45
51
  pass
@@ -97,24 +103,71 @@ def distributed_trace(
97
103
  merge_span = kwargs.pop("merge_span", False)
98
104
  passed_in_parent = kwargs.pop("parent_span", None)
99
105
 
100
- # Assume this will be popped in DistributedTracingPolicy.
101
- func_tracing_attributes = kwargs.pop("tracing_attributes", tracing_attributes)
106
+ # If we are already in the span context of a decorated function, don't trace.
107
+ if _in_span_context.get():
108
+ return func(*args, **kwargs)
102
109
 
103
- span_impl_type = settings.tracing_implementation()
104
- if span_impl_type is None:
110
+ # This will be popped in the pipeline or transport runner.
111
+ tracing_options: TracingOptions = kwargs.get("tracing_options", {})
112
+ tracing_enabled = settings.tracing_enabled()
113
+
114
+ # User can explicitly disable tracing for this request.
115
+ user_enabled = tracing_options.get("enabled")
116
+
117
+ # If tracing is disabled globally and user didn't explicitly enable it, don't trace.
118
+ if user_enabled is False or (not tracing_enabled and user_enabled is None):
105
119
  return func(*args, **kwargs)
106
120
 
107
121
  # Merge span is parameter is set, but only if no explicit parent are passed
108
122
  if merge_span and not passed_in_parent:
109
123
  return func(*args, **kwargs)
110
124
 
111
- with change_context(passed_in_parent):
112
- name = name_of_span or get_function_and_class_name(func, *args)
113
- with span_impl_type(name=name, kind=kind) as span:
114
- for key, value in func_tracing_attributes.items():
115
- span.add_attribute(key, value)
125
+ # Assume this will be popped in DistributedTracingPolicy.
126
+ func_tracing_attributes = kwargs.get("tracing_attributes", tracing_attributes)
127
+ span_attributes = {**func_tracing_attributes, **tracing_options.get("attributes", {})}
128
+
129
+ span_impl_type = settings.tracing_implementation()
130
+
131
+ name = name_of_span or func.__qualname__
132
+ if span_impl_type:
133
+ # Plugin path
134
+ with change_context(passed_in_parent):
135
+ with span_impl_type(name=name, kind=kind) as span:
136
+ for key, value in span_attributes.items():
137
+ span.add_attribute(key, value) # type: ignore
138
+ return func(*args, **kwargs)
139
+ else:
140
+ # Native path
141
+ config = {}
142
+ if args and hasattr(args[0], "_instrumentation_config"):
143
+ config = args[0]._instrumentation_config # pylint: disable=protected-access
144
+ method_tracer = _get_tracer(
145
+ library_name=config.get("library_name"),
146
+ library_version=config.get("library_version"),
147
+ schema_url=config.get("schema_url"),
148
+ attributes=config.get("attributes"),
149
+ )
150
+ if not method_tracer:
116
151
  return func(*args, **kwargs)
117
152
 
153
+ span_suppression_token = _in_span_context.set(True)
154
+ try:
155
+ with method_tracer.start_as_current_span(
156
+ name=name,
157
+ kind=kind,
158
+ attributes=span_attributes,
159
+ ) as span:
160
+ try:
161
+ return func(*args, **kwargs)
162
+ except Exception as err: # pylint: disable=broad-except
163
+ ex_type = type(err)
164
+ module = ex_type.__module__ if ex_type.__module__ != "builtins" else ""
165
+ error_type = f"{module}.{ex_type.__qualname__}" if module else ex_type.__qualname__
166
+ span.set_attribute("error.type", error_type)
167
+ raise
168
+ finally:
169
+ _in_span_context.reset(span_suppression_token)
170
+
118
171
  return wrapper_use_tracer
119
172
 
120
173
  return decorator if __func is None else decorator(__func)
@@ -24,31 +24,28 @@
24
24
  #
25
25
  # --------------------------------------------------------------------------
26
26
  """The decorator to apply if you want the given function traced."""
27
-
27
+ from contextvars import ContextVar
28
28
  import functools
29
29
 
30
- from typing import (
31
- Awaitable,
32
- Callable,
33
- Any,
34
- TypeVar,
35
- overload,
36
- Optional,
37
- Mapping,
38
- TYPE_CHECKING,
39
- )
30
+ from typing import Awaitable, Callable, Any, TypeVar, overload, Optional, Mapping, TYPE_CHECKING
40
31
  from typing_extensions import ParamSpec
41
- from .common import change_context, get_function_and_class_name
42
- from . import SpanKind as _SpanKind
32
+ from .common import change_context
33
+ from ._models import SpanKind as _SpanKind
34
+ from ..instrumentation import get_tracer as _get_tracer
43
35
  from ..settings import settings
44
36
 
45
37
  if TYPE_CHECKING:
46
- from azure.core.tracing import SpanKind
38
+ from azure.core.tracing import TracingOptions, SpanKind
39
+
47
40
 
48
41
  P = ParamSpec("P")
49
42
  T = TypeVar("T")
50
43
 
51
44
 
45
+ # This context variable is used to determine if we are already in the span context of a decorated function.
46
+ _in_span_context = ContextVar("in_span_context", default=False)
47
+
48
+
52
49
  @overload
53
50
  def distributed_trace_async(__func: Callable[P, Awaitable[T]]) -> Callable[P, Awaitable[T]]:
54
51
  pass
@@ -106,24 +103,66 @@ def distributed_trace_async( # pylint: disable=unused-argument
106
103
  merge_span = kwargs.pop("merge_span", False)
107
104
  passed_in_parent = kwargs.pop("parent_span", None)
108
105
 
109
- # Assume this will be popped in DistributedTracingPolicy.
110
- func_tracing_attributes = kwargs.get("tracing_attributes", tracing_attributes)
106
+ # If we are already in the span context of a decorated function, don't trace.
107
+ if _in_span_context.get():
108
+ return await func(*args, **kwargs)
111
109
 
112
- span_impl_type = settings.tracing_implementation()
113
- if span_impl_type is None:
110
+ # This will be popped in the pipeline or transport runner.
111
+ tracing_options: TracingOptions = kwargs.get("tracing_options", {})
112
+ tracing_enabled = settings.tracing_enabled()
113
+
114
+ # User can explicitly disable tracing for this request.
115
+ user_enabled = tracing_options.get("enabled")
116
+
117
+ # If tracing is disabled globally and user didn't explicitly enable it, don't trace.
118
+ if user_enabled is False or (not tracing_enabled and user_enabled is None):
114
119
  return await func(*args, **kwargs)
115
120
 
116
121
  # Merge span is parameter is set, but only if no explicit parent are passed
117
122
  if merge_span and not passed_in_parent:
118
123
  return await func(*args, **kwargs)
119
124
 
120
- with change_context(passed_in_parent):
121
- name = name_of_span or get_function_and_class_name(func, *args)
122
- with span_impl_type(name=name, kind=kind) as span:
123
- for key, value in func_tracing_attributes.items():
124
- span.add_attribute(key, value)
125
+ # Assume this will be popped in DistributedTracingPolicy.
126
+ func_tracing_attributes = kwargs.get("tracing_attributes", tracing_attributes)
127
+ span_attributes = {**func_tracing_attributes, **tracing_options.get("attributes", {})}
128
+
129
+ span_impl_type = settings.tracing_implementation()
130
+
131
+ name = name_of_span or func.__qualname__
132
+ if span_impl_type:
133
+ # Plugin path
134
+ with change_context(passed_in_parent):
135
+ with span_impl_type(name=name, kind=kind) as span:
136
+ for key, value in span_attributes.items():
137
+ span.add_attribute(key, value) # type: ignore
138
+ return await func(*args, **kwargs)
139
+ else:
140
+ # Native path
141
+ config = {}
142
+ if args and hasattr(args[0], "_instrumentation_config"):
143
+ config = args[0]._instrumentation_config # pylint: disable=protected-access
144
+ method_tracer = _get_tracer(**config)
145
+ if not method_tracer:
125
146
  return await func(*args, **kwargs)
126
147
 
148
+ span_suppression_token = _in_span_context.set(True)
149
+ try:
150
+ with method_tracer.start_as_current_span(
151
+ name=name,
152
+ kind=kind,
153
+ attributes=span_attributes,
154
+ ) as span:
155
+ try:
156
+ return await func(*args, **kwargs)
157
+ except Exception as err: # pylint: disable=broad-except
158
+ ex_type = type(err)
159
+ module = ex_type.__module__ if ex_type.__module__ != "builtins" else ""
160
+ error_type = f"{module}.{ex_type.__qualname__}" if module else ex_type.__qualname__
161
+ span.set_attribute("error.type", error_type)
162
+ raise
163
+ finally:
164
+ _in_span_context.reset(span_suppression_token)
165
+
127
166
  return wrapper_use_tracer
128
167
 
129
168
  return decorator if __func is None else decorator(__func)
@@ -0,0 +1,244 @@
1
+ # ------------------------------------
2
+ # Copyright (c) Microsoft Corporation.
3
+ # Licensed under the MIT License.
4
+ # ------------------------------------
5
+ from __future__ import annotations
6
+ from contextlib import contextmanager
7
+ from contextvars import Token
8
+ from typing import Optional, Dict, Sequence, cast, Callable, Iterator, TYPE_CHECKING
9
+
10
+ from opentelemetry import context as otel_context_module, trace
11
+ from opentelemetry.trace import (
12
+ Span,
13
+ SpanKind as OpenTelemetrySpanKind,
14
+ Link as OpenTelemetryLink,
15
+ )
16
+ from opentelemetry.trace.propagation import get_current_span as get_current_span_otel
17
+ from opentelemetry.propagate import extract, inject
18
+
19
+ try:
20
+ from opentelemetry.context import _SUPPRESS_HTTP_INSTRUMENTATION_KEY # type: ignore[attr-defined]
21
+ except ImportError:
22
+ _SUPPRESS_HTTP_INSTRUMENTATION_KEY = "suppress_http_instrumentation"
23
+
24
+ from .._version import VERSION
25
+ from ._models import (
26
+ Attributes,
27
+ SpanKind as _SpanKind,
28
+ )
29
+
30
+ if TYPE_CHECKING:
31
+ from azure.core.tracing import Link, SpanKind
32
+
33
+
34
+ _DEFAULT_SCHEMA_URL = "https://opentelemetry.io/schemas/1.23.1"
35
+ _DEFAULT_MODULE_NAME = "azure-core"
36
+
37
+ _KIND_MAPPINGS = {
38
+ _SpanKind.CLIENT: OpenTelemetrySpanKind.CLIENT,
39
+ _SpanKind.CONSUMER: OpenTelemetrySpanKind.CONSUMER,
40
+ _SpanKind.PRODUCER: OpenTelemetrySpanKind.PRODUCER,
41
+ _SpanKind.SERVER: OpenTelemetrySpanKind.SERVER,
42
+ _SpanKind.INTERNAL: OpenTelemetrySpanKind.INTERNAL,
43
+ _SpanKind.UNSPECIFIED: OpenTelemetrySpanKind.INTERNAL,
44
+ }
45
+
46
+
47
+ class OpenTelemetryTracer:
48
+ """A tracer that uses OpenTelemetry to trace operations.
49
+
50
+ :keyword library_name: The name of the library to use in the tracer.
51
+ :paramtype library_name: str
52
+ :keyword library_version: The version of the library to use in the tracer.
53
+ :paramtype library_version: str
54
+ :keyword schema_url: Specifies the Schema URL of the emitted spans. Defaults to
55
+ "https://opentelemetry.io/schemas/1.23.1".
56
+ :paramtype schema_url: str
57
+ :keyword attributes: Attributes to add to the emitted spans.
58
+ :paramtype attributes: Mapping[str, AttributeValue]
59
+ """
60
+
61
+ def __init__(
62
+ self,
63
+ *,
64
+ library_name: Optional[str] = None,
65
+ library_version: Optional[str] = None,
66
+ schema_url: Optional[str] = None,
67
+ attributes: Optional[Attributes] = None,
68
+ ) -> None:
69
+ self._tracer = trace.get_tracer(
70
+ instrumenting_module_name=library_name or _DEFAULT_MODULE_NAME,
71
+ instrumenting_library_version=library_version or VERSION,
72
+ schema_url=schema_url or _DEFAULT_SCHEMA_URL,
73
+ attributes=attributes,
74
+ )
75
+
76
+ def start_span(
77
+ self,
78
+ name: str,
79
+ *,
80
+ kind: SpanKind = _SpanKind.INTERNAL,
81
+ attributes: Optional[Attributes] = None,
82
+ links: Optional[Sequence[Link]] = None,
83
+ ) -> Span:
84
+ """Starts a span without setting it as the current span in the context.
85
+
86
+ :param name: The name of the span
87
+ :type name: str
88
+ :keyword kind: The kind of the span. INTERNAL by default.
89
+ :paramtype kind: ~azure.core.tracing.SpanKind
90
+ :keyword attributes: Attributes to add to the span.
91
+ :paramtype attributes: Mapping[str, AttributeValue]
92
+ :keyword links: Links to add to the span.
93
+ :paramtype links: list[~azure.core.tracing.Link]
94
+ :return: The span that was started
95
+ :rtype: ~azure.core.tracing.Span
96
+ """
97
+ otel_kind = _KIND_MAPPINGS.get(kind, OpenTelemetrySpanKind.INTERNAL)
98
+ otel_links = self._parse_links(links)
99
+
100
+ otel_span = self._tracer.start_span(
101
+ name,
102
+ kind=otel_kind,
103
+ attributes=attributes,
104
+ links=otel_links,
105
+ record_exception=False,
106
+ )
107
+
108
+ return otel_span
109
+
110
+ @contextmanager
111
+ def start_as_current_span(
112
+ self,
113
+ name: str,
114
+ *,
115
+ kind: SpanKind = _SpanKind.INTERNAL,
116
+ attributes: Optional[Attributes] = None,
117
+ links: Optional[Sequence[Link]] = None,
118
+ end_on_exit: bool = True,
119
+ ) -> Iterator[Span]:
120
+ """Context manager that starts a span and sets it as the current span in the context.
121
+
122
+ .. code:: python
123
+
124
+ with tracer.start_as_current_span("span_name") as span:
125
+ # Do something with the span
126
+ span.set_attribute("key", "value")
127
+
128
+ :param name: The name of the span
129
+ :type name: str
130
+ :keyword kind: The kind of the span. INTERNAL by default.
131
+ :paramtype kind: ~azure.core.tracing.SpanKind
132
+ :keyword attributes: Attributes to add to the span.
133
+ :paramtype attributes: Optional[Attributes]
134
+ :keyword links: Links to add to the span.
135
+ :paramtype links: Optional[Sequence[Link]]
136
+ :keyword end_on_exit: Whether to end the span when exiting the context manager. Defaults to True.
137
+ :paramtype end_on_exit: bool
138
+ :return: The span that was started
139
+ :rtype: Iterator[~opentelemetry.trace.Span]
140
+ """
141
+ span = self.start_span(name, kind=kind, attributes=attributes, links=links)
142
+ with trace.use_span( # pylint: disable=not-context-manager
143
+ span, record_exception=False, end_on_exit=end_on_exit
144
+ ) as span:
145
+ yield span
146
+
147
+ @classmethod
148
+ @contextmanager
149
+ def use_span(cls, span: Span, *, end_on_exit: bool = True) -> Iterator[Span]:
150
+ """Context manager that takes a non-active span and activates it in the current context.
151
+
152
+ :param span: The span to set as the current span
153
+ :type span: ~opentelemetry.trace.Span
154
+ :keyword end_on_exit: Whether to end the span when exiting the context manager. Defaults to True.
155
+ :paramtype end_on_exit: bool
156
+ :return: The span that was activated.
157
+ :rtype: Iterator[~opentelemetry.trace.Span]
158
+ """
159
+ with trace.use_span( # pylint: disable=not-context-manager
160
+ span, record_exception=False, end_on_exit=end_on_exit
161
+ ) as active_span:
162
+ yield active_span
163
+
164
+ def _parse_links(self, links: Optional[Sequence[Link]]) -> Optional[Sequence[OpenTelemetryLink]]:
165
+ if not links:
166
+ return None
167
+
168
+ try:
169
+ otel_links = []
170
+ for link in links:
171
+ ctx = extract(link.headers)
172
+ span_ctx = get_current_span_otel(ctx).get_span_context()
173
+ otel_links.append(OpenTelemetryLink(span_ctx, link.attributes))
174
+ return otel_links
175
+ except AttributeError:
176
+ # We will just send the links as is if it's not ~azure.core.tracing.Link without
177
+ # any validation assuming the user knows what they are doing.
178
+ return cast(Sequence[OpenTelemetryLink], links)
179
+
180
+ @classmethod
181
+ def get_current_span(cls) -> Span:
182
+ """Returns the current span in the context.
183
+
184
+ :return: The current span
185
+ :rtype: ~opentelemetry.trace.Span
186
+ """
187
+ return get_current_span_otel()
188
+
189
+ @classmethod
190
+ def with_current_context(cls, func: Callable) -> Callable:
191
+ """Passes the current spans to the new context the function will be run in.
192
+
193
+ :param func: The function that will be run in the new context
194
+ :type func: callable
195
+ :return: The wrapped function
196
+ :rtype: callable
197
+ """
198
+ current_context = otel_context_module.get_current()
199
+
200
+ def call_with_current_context(*args, **kwargs):
201
+ token = None
202
+ try:
203
+ token = otel_context_module.attach(current_context)
204
+ return func(*args, **kwargs)
205
+ finally:
206
+ if token is not None:
207
+ otel_context_module.detach(token)
208
+
209
+ return call_with_current_context
210
+
211
+ @classmethod
212
+ def get_trace_context(cls) -> Dict[str, str]:
213
+ """Returns the Trace Context header values associated with the current span.
214
+
215
+ These are generally the W3C Trace Context headers (i.e. "traceparent" and "tracestate").
216
+
217
+ :return: A key value pair dictionary
218
+ :rtype: dict[str, str]
219
+ """
220
+ trace_context: Dict[str, str] = {}
221
+ inject(trace_context)
222
+ return trace_context
223
+
224
+ @classmethod
225
+ def _suppress_auto_http_instrumentation(cls) -> Token:
226
+ """Enabled automatic HTTP instrumentation suppression.
227
+
228
+ Since azure-core already instruments HTTP calls, we need to suppress any automatic HTTP
229
+ instrumentation provided by other libraries to prevent duplicate spans. This has no effect if no
230
+ automatic HTTP instrumentation libraries are being used.
231
+
232
+ :return: A token that can be used to detach the suppression key from the context
233
+ :rtype: ~contextvars.Token
234
+ """
235
+ return otel_context_module.attach(otel_context_module.set_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY, True))
236
+
237
+ @classmethod
238
+ def _detach_from_context(cls, token: Token) -> None:
239
+ """Detach a token from the context.
240
+
241
+ :param token: The token to detach
242
+ :type token: ~contextvars.Token
243
+ """
244
+ otel_context_module.detach(token)
@@ -17,8 +17,7 @@ def parse_connection_string(conn_str: str, case_sensitive_keys: bool = False) ->
17
17
  default), all keys will be lower-cased. If set to `True`, the original casing of the keys will be preserved.
18
18
  :rtype: Mapping
19
19
  :returns: Dict of connection string key/value pairs.
20
- :raises:
21
- ValueError: if each key in conn_str does not have a corresponding value and
20
+ :raises ValueError: if each key in conn_str does not have a corresponding value and
22
21
  for other bad formatting of connection strings - including duplicate
23
22
  args, bad syntax, etc.
24
23
  """
@@ -22,7 +22,7 @@ def _get_json_content(obj):
22
22
  :type obj: any
23
23
  :return: The JSON content of the object.
24
24
  :rtype: dict
25
- :raises ValueError if JSON content cannot be loaded from the object
25
+ :raises ValueError: if JSON content cannot be loaded from the object.
26
26
  """
27
27
  msg = "Failed to load JSON content from the object."
28
28
  try: