Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.backend.python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.backend.python
Commits
4156bbf4
Commit
4156bbf4
authored
7 years ago
by
Samuel GAIST
Browse files
Options
Downloads
Patches
Plain Diff
[data] Added missing doc and fixed doc related warnings
Also fixed import warnings
parent
3f24f857
No related branches found
No related tags found
2 merge requests
!17
Merge development branch 1.5.x
,
!13
Improve documentation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/backend/python/data.py
+39
-31
39 additions, 31 deletions
beat/backend/python/data.py
with
39 additions
and
31 deletions
beat/backend/python/data.py
+
39
−
31
View file @
4156bbf4
...
@@ -26,33 +26,38 @@
...
@@ -26,33 +26,38 @@
###############################################################################
###############################################################################
"""
Data I/O classes and functions
"""
"""
====
data
====
Data I/O classes and functions
"""
import
os
import
os
import
re
import
re
import
glob
import
glob
import
simplejson
as
json
import
simplejson
as
json
import
select
import
time
import
time
import
tempfile
import
abc
import
abc
import
zmq
import
zmq
import
logging
import
six
from
functools
import
reduce
from
functools
import
reduce
from
collections
import
namedtuple
from
collections
import
namedtuple
import
logging
logger
=
logging
.
getLogger
(
__name__
)
import
six
from
.hash
import
hashFileContents
from
.hash
import
hashFileContents
from
.dataformat
import
DataFormat
from
.dataformat
import
DataFormat
from
.algorithm
import
Algorithm
from
.algorithm
import
Algorithm
logger
=
logging
.
getLogger
(
__name__
)
# ----------------------------------------------------------
# ----------------------------------------------------------
class
RemoteException
(
Exception
):
class
RemoteException
(
Exception
):
"""
Exception happening on a remote location
"""
def
__init__
(
self
,
kind
,
message
):
def
__init__
(
self
,
kind
,
message
):
super
(
RemoteException
,
self
).
__init__
()
super
(
RemoteException
,
self
).
__init__
()
...
@@ -150,8 +155,8 @@ def getAllFilenames(filename, start_index=None, end_index=None):
...
@@ -150,8 +155,8 @@ def getAllFilenames(filename, start_index=None, end_index=None):
Returns:
Returns:
(data_filenames, indices_filenames,
data_checksum_filenames, indices_checksum_filenames)
(data_filenames, indices_filenames,
data_checksum_filenames, indices_checksum_filenames)
"""
"""
index_re
=
re
.
compile
(
r
'
^.*\.(\d+)\.(\d+)\.(data|index)(.checksum)?$
'
)
index_re
=
re
.
compile
(
r
'
^.*\.(\d+)\.(\d+)\.(data|index)(.checksum)?$
'
)
...
@@ -360,8 +365,8 @@ class CachedDataSource(DataSource):
...
@@ -360,8 +365,8 @@ class CachedDataSource(DataSource):
3. Contiguous indices if they are present
3. Contiguous indices if they are present
"""
"""
# Make sure that we have a perfect match between data files and
checksum
# Make sure that we have a perfect match between data files and
# files
#
checksum
files
checksum_filenames_noext
=
[
os
.
path
.
splitext
(
f
)[
0
]
for
f
in
checksum_filenames
]
checksum_filenames_noext
=
[
os
.
path
.
splitext
(
f
)[
0
]
for
f
in
checksum_filenames
]
if
data_filenames
!=
checksum_filenames_noext
:
if
data_filenames
!=
checksum_filenames_noext
:
...
@@ -777,10 +782,13 @@ class DataSink(object):
...
@@ -777,10 +782,13 @@ class DataSink(object):
@abc.abstractmethod
@abc.abstractmethod
def
isConnected
(
self
):
def
isConnected
(
self
):
pass
"""
Returns whether the data sink is connected
"""
pass
def
close
(
self
):
def
close
(
self
):
"""
Closes the data sink
"""
pass
pass
...
@@ -867,12 +875,12 @@ class CachedDataSink(DataSink):
...
@@ -867,12 +875,12 @@ class CachedDataSink(DataSink):
filename (str): Name of the file to generate
filename (str): Name of the file to generate
dataformat (dataformat.DataFormat): The dataformat to be used
dataformat (dataformat.DataFormat): The dataformat to be used
inside this file. All objects stored inside this file will respect
that
inside this file. All objects stored inside this file will respect
format.
that
format.
encoding (str): String defining the encoding to be used for encoding
the
encoding (str): String defining the encoding to be used for encoding
data. Only a few options are supported: ``binary``
(the default) or
the
data. Only a few options are supported: ``binary``
``json`` (debugging purposes).
(the default) or
``json`` (debugging purposes).
"""
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment