From 49369ad3ed41c73b8c85b675e4381b2fa720e4fb Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Tue, 3 Sep 2024 10:31:19 +0200 Subject: [PATCH] release: qase-python-commons 3.1.1 Remove unused code in the `attachment` model. --- qase-python-commons/pyproject.toml | 2 +- .../src/qase/commons/models/attachment.py | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/qase-python-commons/pyproject.toml b/qase-python-commons/pyproject.toml index 098461a2..22f279e6 100644 --- a/qase-python-commons/pyproject.toml +++ b/qase-python-commons/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "qase-python-commons" -version = "3.1.0" +version = "3.1.1" description = "A library for Qase TestOps and Qase Report" readme = "README.md" authors = [{name = "Qase Team", email = "support@qase.io"}] diff --git a/qase-python-commons/src/qase/commons/models/attachment.py b/qase-python-commons/src/qase/commons/models/attachment.py index 2711d3f0..d6c7587b 100644 --- a/qase-python-commons/src/qase/commons/models/attachment.py +++ b/qase-python-commons/src/qase/commons/models/attachment.py @@ -1,10 +1,8 @@ -import os import uuid import json -import pathlib -from typing import Optional, Union -from io import BytesIO, StringIO +from typing import Optional +from io import BytesIO from .basemodel import BaseModel @@ -26,17 +24,8 @@ def __init__(self, if (not isinstance(content, str)) and (not isinstance(content, bytes)): self.content = json.dumps(self.content, default=lambda o: o.__dict__, sort_keys=False, indent=4) - self.size = self._get_size(content) self.id = str(uuid.uuid4()) - def _get_size(self, content): - if self.file_path: - return os.path.getsize(self.file_path) - elif content: - return len(content) - else: - return 0 - def get_id(self) -> str: return self.id @@ -51,4 +40,5 @@ def get_for_upload(self) -> BytesIO: content = BytesIO(self.content) content.name = self.file_name content.mime = self.mime_type + return content