Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jopel committed Nov 19, 2024
1 parent 4b465c3 commit b67548b
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 85 deletions.
5 changes: 2 additions & 3 deletions scripts/templates/template.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
from __future__ import annotations

import struct
from io import BytesIO
from snowflake.telemetry._internal.serialize import (
Enum,
MessageMarshaler,
Varint,
)
from typing import List, Optional
from typing import List

{% for import in file_template.imports %}
from {{ import }} import *
Expand Down Expand Up @@ -56,7 +55,7 @@ class {{ message.name }}(MessageMarshaler):
{%- endfor %}
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
{%- for field in message.fields %}
{{ field.serialize_field_inline | indent(8) }}
{%- endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from __future__ import annotations

import struct
from io import BytesIO
from typing import (
List,
Optional,
)
from typing import List

from snowflake.telemetry._internal.opentelemetry.proto.logs.v1.logs_marshaler import *
from snowflake.telemetry._internal.serialize import (
Expand Down Expand Up @@ -43,7 +39,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._resource_logs:
for v in self._resource_logs:
out += b"\n"
Expand Down Expand Up @@ -75,7 +71,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._partial_success is not None:
out += b"\n"
Varint.write_varint_u32(out, self._partial_success._get_size())
Expand Down Expand Up @@ -104,7 +100,7 @@ def calculate_size(self) -> int:
size += len(b"\x12") + Varint.size_varint_u32(len(v)) + len(v)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.rejected_log_records:
out += b"\x08"
Varint.write_varint_i64(out, self.rejected_log_records)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from __future__ import annotations

import struct
from io import BytesIO
from typing import (
List,
Optional,
)
from typing import List

from snowflake.telemetry._internal.opentelemetry.proto.metrics.v1.metrics_marshaler import *
from snowflake.telemetry._internal.serialize import (
Expand Down Expand Up @@ -43,7 +39,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._resource_metrics:
for v in self._resource_metrics:
out += b"\n"
Expand Down Expand Up @@ -75,7 +71,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._partial_success is not None:
out += b"\n"
Varint.write_varint_u32(out, self._partial_success._get_size())
Expand Down Expand Up @@ -104,7 +100,7 @@ def calculate_size(self) -> int:
size += len(b"\x12") + Varint.size_varint_u32(len(v)) + len(v)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.rejected_data_points:
out += b"\x08"
Varint.write_varint_i64(out, self.rejected_data_points)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from __future__ import annotations

import struct
from io import BytesIO
from typing import (
List,
Optional,
)
from typing import List

from snowflake.telemetry._internal.opentelemetry.proto.trace.v1.trace_marshaler import *
from snowflake.telemetry._internal.serialize import (
Expand Down Expand Up @@ -43,7 +39,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._resource_spans:
for v in self._resource_spans:
out += b"\n"
Expand Down Expand Up @@ -75,7 +71,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._partial_success is not None:
out += b"\n"
Varint.write_varint_u32(out, self._partial_success._get_size())
Expand Down Expand Up @@ -104,7 +100,7 @@ def calculate_size(self) -> int:
size += len(b"\x12") + Varint.size_varint_u32(len(v)) + len(v)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.rejected_spans:
out += b"\x08"
Varint.write_varint_i64(out, self.rejected_spans)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from __future__ import annotations

import struct
from io import BytesIO
from typing import (
List,
Optional,
)
from typing import List

from snowflake.telemetry._internal.serialize import (
Enum,
Expand Down Expand Up @@ -87,7 +83,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.string_value is not None:
v = self.string_value.encode("utf-8")
out += b"\n"
Expand Down Expand Up @@ -141,7 +137,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._values:
for v in self._values:
out += b"\n"
Expand Down Expand Up @@ -174,7 +170,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._values:
for v in self._values:
out += b"\n"
Expand Down Expand Up @@ -213,7 +209,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.key:
v = self.key.encode("utf-8")
out += b"\n"
Expand Down Expand Up @@ -269,7 +265,7 @@ def calculate_size(self) -> int:
size += len(b" ") + Varint.size_varint_u32(self.dropped_attributes_count)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.name:
v = self.name.encode("utf-8")
out += b"\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from __future__ import annotations

import struct
from io import BytesIO
from typing import (
List,
Optional,
)
from typing import List

from snowflake.telemetry._internal.opentelemetry.proto.common.v1.common_marshaler import *
from snowflake.telemetry._internal.opentelemetry.proto.resource.v1.resource_marshaler import *
Expand Down Expand Up @@ -77,7 +73,7 @@ def calculate_size(self) -> int:
)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._resource_logs:
for v in self._resource_logs:
out += b"\n"
Expand Down Expand Up @@ -131,7 +127,7 @@ def calculate_size(self) -> int:
size += len(b"\x1a") + Varint.size_varint_u32(len(v)) + len(v)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._resource is not None:
out += b"\n"
Varint.write_varint_u32(out, self._resource._get_size())
Expand Down Expand Up @@ -194,7 +190,7 @@ def calculate_size(self) -> int:
size += len(b"\x1a") + Varint.size_varint_u32(len(v)) + len(v)
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self._scope is not None:
out += b"\n"
Varint.write_varint_u32(out, self._scope._get_size())
Expand Down Expand Up @@ -304,7 +300,7 @@ def calculate_size(self) -> int:
size += len(b"Y") + 8
return size

def write_to(self, out: BytesIO) -> None:
def write_to(self, out: bytearray) -> None:
if self.time_unix_nano:
out += b"\t"
out += struct.pack("<Q", self.time_unix_nano)
Expand Down
Loading

0 comments on commit b67548b

Please sign in to comment.