Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
arthur-zzz
noc
Commits
cf164eb6
Commit
cf164eb6
authored
Nov 24, 2021
by
arthur-zzz
Browse files
just use str
parent
3da2c9ef
Pipeline
#34278
passed with stages
in 27 minutes and 17 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
core/text.py
View file @
cf164eb6
...
@@ -12,9 +12,6 @@ from itertools import zip_longest
...
@@ -12,9 +12,6 @@ from itertools import zip_longest
# Third-party modules
# Third-party modules
from
typing
import
List
,
Union
,
Iterable
from
typing
import
List
,
Union
,
Iterable
# NOC modules
from
noc.core.comp
import
smart_text
rx_header_start
=
re
.
compile
(
r
"^\s*[-=]+[\s\+]+[-=]+"
)
rx_header_start
=
re
.
compile
(
r
"^\s*[-=]+[\s\+]+[-=]+"
)
rx_col
=
re
.
compile
(
r
"^([\s\+]*)([\-]+|[=]+)"
)
rx_col
=
re
.
compile
(
r
"^([\s\+]*)([\-]+|[=]+)"
)
...
@@ -533,7 +530,7 @@ def format_table(widths, data, sep=" ", hsep=" "):
...
@@ -533,7 +530,7 @@ def format_table(widths, data, sep=" ", hsep=" "):
# Calculate column widths
# Calculate column widths
widths
=
list
(
widths
)
widths
=
list
(
widths
)
for
row
in
data
:
for
row
in
data
:
widths
=
[
max
(
x
,
len
(
s
mart_text
(
y
,
errors
=
"replace"
)))
for
x
,
y
in
zip
(
widths
,
row
)]
widths
=
[
max
(
x
,
len
(
s
tr
(
y
)))
for
x
,
y
in
zip
(
widths
,
row
)]
# Build print mask
# Build print mask
mask
=
sep
.
join
(
"%%-%ds"
%
w
for
w
in
widths
)
mask
=
sep
.
join
(
"%%-%ds"
%
w
for
w
in
widths
)
out
=
[
out
=
[
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment