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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.backend.python
Commits
52470e1d
Commit
52470e1d
authored
7 years ago
by
Philip ABBET
Browse files
Options
Downloads
Patches
Plain Diff
Reformatting
parent
548211ce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/backend/python/utils.py
+13
-1
13 additions, 1 deletion
beat/backend/python/utils.py
with
13 additions
and
1 deletion
beat/backend/python/utils.py
100644 → 100755
+
13
−
1
View file @
52470e1d
...
...
@@ -6,7 +6,7 @@
# Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.
core
module of the BEAT platform.
#
# This file is part of the beat.
backend.python
module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
...
...
@@ -51,6 +51,8 @@ def hashed_or_simple(prefix, what, path, suffix='.json'):
return
os
.
path
.
join
(
prefix
,
what
,
path
)
#----------------------------------------------------------
def
safe_rmfile
(
f
):
"""
Safely removes a file from the disk
"""
...
...
@@ -58,6 +60,8 @@ def safe_rmfile(f):
if
os
.
path
.
exists
(
f
):
os
.
unlink
(
f
)
#----------------------------------------------------------
def
safe_rmdir
(
f
):
"""
Safely removes the directory containg a given file from the disk
"""
...
...
@@ -67,6 +71,8 @@ def safe_rmdir(f):
if
not
os
.
listdir
(
d
):
os
.
rmdir
(
d
)
#----------------------------------------------------------
def
extension_for_language
(
language
):
"""
Returns the preferred extension for a given programming language
...
...
@@ -99,6 +105,8 @@ def extension_for_language(language):
)[
language
]
#----------------------------------------------------------
class
File
(
object
):
"""
User helper to read and write file objects
"""
...
...
@@ -154,6 +162,8 @@ class File(object):
safe_rmdir
(
self
.
path
)
#remove containing directory
#----------------------------------------------------------
class
Storage
(
object
):
"""
Resolves paths for objects that provide only a description
...
...
@@ -199,6 +209,8 @@ class Storage(object):
self
.
doc
.
remove
()
#----------------------------------------------------------
class
CodeStorage
(
object
):
"""
Resolves paths for objects that provide a description and code
...
...
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