Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
1e905c5f
Commit
1e905c5f
authored
Jun 30, 2023
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no file update
parent
3b16ace6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
app.py
app.py
+20
-12
No files found.
app.py
View file @
1e905c5f
...
@@ -7,7 +7,7 @@ import signal
...
@@ -7,7 +7,7 @@ import signal
import
sys
import
sys
from
asyncio
import
AbstractEventLoop
from
asyncio
import
AbstractEventLoop
from
concurrent.futures
import
ThreadPoolExecutor
from
concurrent.futures
import
ThreadPoolExecutor
from
typing
import
Any
from
typing
import
Any
,
Optional
from
absl
import
app
,
flags
from
absl
import
app
,
flags
from
marshmallow
import
EXCLUDE
from
marshmallow
import
EXCLUDE
...
@@ -44,16 +44,20 @@ class CSVLogger(PacketLogger):
...
@@ -44,16 +44,20 @@ class CSVLogger(PacketLogger):
BREAK_LINE
=
"
\r\n
"
BREAK_LINE
=
"
\r\n
"
def
__init__
(
self
,
file_path
:
str
):
def
__init__
(
self
,
file_path
:
Optional
[
str
]
=
None
):
self
.
file_path
=
file_path
self
.
file_path
=
file_path
is_file_exists
=
os
.
path
.
exists
(
self
.
file_path
)
self
.
file
=
None
self
.
file
=
open
(
self
.
file_path
,
"a+"
)
if
not
is_file_exists
:
if
file_path
is
not
None
:
self
.
write
(
"; "
.
join
([
"Station ID"
,
"Timestamp"
,
"Frequency"
,
self
.
file_path
=
file_path
"DoA"
,
"Confidence"
,
"Power"
,
"Serial"
,
is_file_exists
=
os
.
path
.
exists
(
self
.
file_path
)
"Radio Bearing"
,
self
.
file
=
open
(
self
.
file_path
,
"a+"
)
"Compass Offset"
])
+
self
.
BREAK_LINE
)
if
not
is_file_exists
:
self
.
save
()
self
.
write
(
"; "
.
join
([
"Station ID"
,
"Timestamp"
,
"Frequency"
,
"DoA"
,
"Confidence"
,
"Power"
,
"Serial"
,
"Radio Bearing"
,
"Compass Offset"
])
+
self
.
BREAK_LINE
)
self
.
save
()
@staticmethod
@staticmethod
def
serialize_data
(
data
:
Any
)
->
str
:
def
serialize_data
(
data
:
Any
)
->
str
:
...
@@ -65,6 +69,9 @@ class CSVLogger(PacketLogger):
...
@@ -65,6 +69,9 @@ class CSVLogger(PacketLogger):
# noinspection PyBroadException
# noinspection PyBroadException
def
write
(
self
,
data
:
str
)
->
None
:
def
write
(
self
,
data
:
str
)
->
None
:
""" Try write """
""" Try write """
if
self
.
file
is
None
:
return
while
True
:
while
True
:
try
:
try
:
self
.
file
.
write
(
data
)
self
.
file
.
write
(
data
)
...
@@ -88,8 +95,9 @@ class CSVLogger(PacketLogger):
...
@@ -88,8 +95,9 @@ class CSVLogger(PacketLogger):
def
save
(
self
)
->
None
:
def
save
(
self
)
->
None
:
""" Save data """
""" Save data """
self
.
file
.
flush
()
if
self
.
file
is
not
None
:
self
.
file
.
close
()
self
.
file
.
flush
()
self
.
file
.
close
()
def
init_logging
(
filename
:
str
=
None
,
level
:
int
=
None
)
->
None
:
def
init_logging
(
filename
:
str
=
None
,
level
:
int
=
None
)
->
None
:
...
...
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