From 9f12157d4ae372c8af12cdf5104c7b40792605be Mon Sep 17 00:00:00 2001 From: wan Date: Thu, 2 Jan 2025 15:28:49 -0500 Subject: [PATCH] Fix formatting. --- ddtrace/profiling/exporter/http.py | 20 ++++++++++++++----- .../iast_packages/packages/pkg_pyjwt.py | 6 +++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ddtrace/profiling/exporter/http.py b/ddtrace/profiling/exporter/http.py index 1c0f9fd11c..32dbd35bfc 100644 --- a/ddtrace/profiling/exporter/http.py +++ b/ddtrace/profiling/exporter/http.py @@ -66,9 +66,9 @@ def __init__( self.version: typing.Optional[str] = version self.tags: typing.Dict[str, str] = tags if tags is not None else {} self.max_retry_delay: typing.Optional[float] = max_retry_delay - self.endpoint_call_counter_span_processor: typing.Optional[ - EndpointCallCounterProcessor - ] = endpoint_call_counter_span_processor + self.endpoint_call_counter_span_processor: typing.Optional[EndpointCallCounterProcessor] = ( + endpoint_call_counter_span_processor + ) self.__post_init__() @@ -220,8 +220,18 @@ def export( "family": "python", "attachments": [item["filename"].decode("utf-8") for item in data], "tags_profiler": self._get_tags(service), - "start": (datetime.datetime.fromtimestamp(start_time_ns / 1e9, tz=datetime.timezone.utc).replace(microsecond=0).isoformat() + "Z"), - "end": (datetime.datetime.fromtimestamp(end_time_ns / 1e9, tz=datetime.timezone.utc).replace(microsecond=0).isoformat() + "Z"), + "start": ( + datetime.datetime.fromtimestamp(start_time_ns / 1e9, tz=datetime.timezone.utc) + .replace(microsecond=0) + .isoformat() + + "Z" + ), + "end": ( + datetime.datetime.fromtimestamp(end_time_ns / 1e9, tz=datetime.timezone.utc) + .replace(microsecond=0) + .isoformat() + + "Z" + ), } # type: Dict[str, Any] if self.endpoint_call_counter_span_processor is not None: diff --git a/tests/appsec/iast_packages/packages/pkg_pyjwt.py b/tests/appsec/iast_packages/packages/pkg_pyjwt.py index 773d868c4a..ec43d8a17d 100644 --- a/tests/appsec/iast_packages/packages/pkg_pyjwt.py +++ b/tests/appsec/iast_packages/packages/pkg_pyjwt.py @@ -3,6 +3,7 @@ https://pypi.org/project/PyJWT/ """ + import datetime from flask import Blueprint @@ -25,7 +26,10 @@ def pkg_pyjwt_view(): secret_key = "your-256-bit-secret" user_payload = request.args.get("package_param", "default-user") - payload = {"user": user_payload, "exp": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=30)} + payload = { + "user": user_payload, + "exp": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(seconds=30), + } try: # Encode the payload to create a JWT