Skip to content

Commit

Permalink
Simplify comment wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mahaloz committed Sep 16, 2024
1 parent ac91c5d commit 2996a2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion libbs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.22.0"
__version__ = "1.22.1"


import logging
Expand Down
19 changes: 3 additions & 16 deletions libbs/artifacts/comment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import textwrap
from typing import Optional

from .artifact import Artifact
Expand Down Expand Up @@ -31,22 +32,8 @@ def __str__(self):

@staticmethod
def linewrap_comment(comment: str, width=80):
lines = comment.splitlines()
final_comment = ""

for line in lines:
if len(line) < width:
final_comment += line + "\n"
continue

for i, c in enumerate(line):
if i % width == 0 and i != 0:
final_comment += "\n"
final_comment += c

final_comment += "\n"

return final_comment
wrapped_text = textwrap.fill(comment, width=width)
return wrapped_text

def nonconflict_merge(self, obj2: "Comment", **kwargs) -> "Comment":
obj1: "Comment" = self.copy()
Expand Down

0 comments on commit 2996a2c

Please sign in to comment.