Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
A
attic
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
hydrargyrum
attic
Commits
ea2649a3
Commit
ea2649a3
authored
Nov 09, 2020
by
hydrargyrum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log-ts-diff: format adjustments
parent
90ed5f5b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
log-ts-diff/log-ts-diff.py
log-ts-diff/log-ts-diff.py
+3
-3
log-ts-diff/test.py
log-ts-diff/test.py
+5
-3
No files found.
log-ts-diff/log-ts-diff.py
View file @
ea2649a3
...
...
@@ -38,13 +38,13 @@ def duration_to_str(duration):
for
attr
in
attrs
:
factor
=
getattr
(
duration
,
attr
)
if
factor
:
parts
.
append
(
f
'
{
factor
:
+
2
d
}
{
attr
}
'
)
parts
.
append
(
f
'
{
factor
:
=+
2
d
}{
attrs
[
attr
]
}
'
)
if
duration
.
microseconds
:
secs
=
duration
.
seconds
+
duration
.
microseconds
/
1_000_000
parts
.
append
(
f
'
{
secs
:
+
6
.3
f
}
s'
)
parts
.
append
(
f
'
{
secs
:
=+
7
.3
f
}
s'
)
elif
duration
.
seconds
:
parts
.
append
(
f
'
{
duration
.
seconds
:
+
3
d
}
'
)
parts
.
append
(
f
'
{
duration
.
seconds
:
=+
3
d
}
s
'
)
if
not
parts
:
parts
.
append
(
'+0'
)
...
...
log-ts-diff/test.py
View file @
ea2649a3
...
...
@@ -5,20 +5,22 @@ import subprocess
output
=
subprocess
.
check_output
(
[
pathlib
.
Path
(
__file__
).
with_name
(
'ts-diff.py'
)],
[
pathlib
.
Path
(
__file__
).
with_name
(
'
log-
ts-diff.py'
)],
encoding
=
'utf-8'
,
input
=
'''
2020-11-09 19:24:08,582:FOO
EXTRA
2020-11-09 19:24:08,628:BAR
2020-11-09 19:24:08,351:BAZ
2020-11-09 19:24:09,351:QUX
LINE
'''
.
strip
()
)
assert
output
==
'''
2020-11-09 19:24:08,582:FOO
EXTRA
+0.046s :BAR
-0.277s :BAZ
+ 0.046s :BAR
- 0.277s :BAZ
+ 1s :QUX
LINE
'''
.
lstrip
()
Write
Preview
Markdown
is supported
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