File tree Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Expand file tree Collapse file tree 2 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 1
1
build==1.2.1
2
- build-tool @ https://github.com/GamuNetwork/devtools/releases/download/1.5 .8/build_tool-1.5 .8-py3-none-any.whl
2
+ build-tool @ https://github.com/GamuNetwork/devtools/releases/download/1.6 .8/build_tool-1.6 .8-py3-none-any.whl
3
3
exceptiongroup==1.2.1
4
4
iniconfig==2.0.0
5
5
packaging==24.0
Original file line number Diff line number Diff line change @@ -123,22 +123,29 @@ def wrapper(*args, **kwargs):
123
123
return func (* args , ** kwargs )
124
124
return wrapper
125
125
126
+ def countLinesLength (string : str ) -> list [int ]:
127
+ lines = string .split ('\n ' )
128
+ return [len (line ) for line in lines ]
129
+
126
130
def splitLongString (string : str , length : int = 100 ) -> str :
127
131
"""Split a long string into multiple lines, on spaces"""
128
132
result = []
129
133
if len (string ) <= length :
130
134
return string
131
135
132
- tokens = string .split (' ' )
133
- line = ""
134
- for token in tokens :
135
- if len (token ) > length :
136
- raise ValueError (f"Word '{ token } ' is too long (limit is { length } characters)" )
137
- if len (line ) + len (token ) > length :
138
- result .append (line .strip ())
139
- line = ""
140
- line += token + ' '
141
- result .append (line .strip ())
136
+ lines = [line .split (' ' ) for line in string .split ('\n ' )]
137
+
138
+ for line in lines :
139
+ current_line = []
140
+ for word in line :
141
+ if len (word ) > length :
142
+ raise ValueError ("A word is longer than the maximum length" )
143
+ if len (' ' .join (current_line )) + len (word ) > length :
144
+ result .append (' ' .join (current_line ))
145
+ current_line = [word ]
146
+ else :
147
+ current_line .append (word )
148
+ result .append (' ' .join (current_line ))
142
149
return '\n ' .join (result )
143
150
144
151
class CustomJSONEncoder (JSONEncoder ):
You can’t perform that action at this time.
0 commit comments