Skip to content

Commit

Permalink
release: qase-python-commons 3.1.1
Browse files Browse the repository at this point in the history
Remove unused code in the `attachment` model.
  • Loading branch information
gibiw committed Sep 3, 2024
1 parent 6541457 commit 49369ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion qase-python-commons/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]"}]
Expand Down
16 changes: 3 additions & 13 deletions qase-python-commons/src/qase/commons/models/attachment.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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

Expand All @@ -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

0 comments on commit 49369ad

Please sign in to comment.