Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1402)

Unified Diff: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py

Issue 2793903006: Style fix and docstring for the APM QA Python tool (Closed)
Patch Set: _ prefix for internal use functions Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
index aeee74746c330b4426991fdf47173c32942828cc..50ef5d11f0939cbcaec286b414055a7fa13555da 100644
--- a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/data_access.py
@@ -13,8 +13,8 @@ import json
import os
-def make_directory(path):
- """Recursively make a directory without rising exceptions if already existing.
+def MakeDirectory(path):
+ """Makes a directory recursively without rising exceptions if existing.
Args:
path: path to the directory to be created.
@@ -34,13 +34,14 @@ class Metadata(object):
_AUDIO_IN_REF_FILENAME = 'audio_in_ref.txt'
@classmethod
- def load_audio_in_ref_paths(cls, metadata_path):
- """Metadata loader for input and reference audio track paths.
+ def LoadAudioInRefPaths(cls, metadata_path):
+ """Loads the input and the reference audio track paths.
Args:
metadata_path: path to the directory containing the metadata file.
- Returns: pair of metadata file paths for the input and output audio tracks.
+ Returns:
+ Pair of metadata file paths for the input and output audio tracks.
"""
metadata_filepath = os.path.join(metadata_path, cls._AUDIO_IN_REF_FILENAME)
with open(metadata_filepath) as f:
@@ -49,9 +50,14 @@ class Metadata(object):
return audio_in_filepath, audio_ref_filepath
@classmethod
- def save_audio_in_ref_paths(cls, output_path, audio_in_filepath,
+ def SaveAudioInRefPaths(cls, output_path, audio_in_filepath,
audio_ref_filepath):
- """Metadata saver for input and reference audio track paths.
+ """Saves the input and the reference audio track paths.
+
+ Args:
+ output_path: path to the directory containing the metadata file.
+ audio_in_filepath: path to the input audio track file.
+ audio_ref_filepath: path to the reference audio track file.
"""
output_filepath = os.path.join(output_path, cls._AUDIO_IN_REF_FILENAME)
with open(output_filepath, 'w') as f:
@@ -68,12 +74,26 @@ class AudioProcConfigFile(object):
pass
@classmethod
- def load(cls, filepath):
+ def Load(cls, filepath):
+ """Loads a configuration file for audioproc_f.
+
+ Args:
+ filepath: path to the configuration file.
+
+ Returns:
+ A dict containing the configuration.
+ """
with open(filepath) as f:
return json.load(f)
@classmethod
- def save(cls, filepath, config):
+ def Save(cls, filepath, config):
+ """Saves a configuration file for audioproc_f.
+
+ Args:
+ filepath: path to the configuration file.
+ config: a dict containing the configuration.
+ """
with open(filepath, 'w') as f:
json.dump(config, f)
@@ -86,11 +106,25 @@ class ScoreFile(object):
pass
@classmethod
- def load(cls, filepath):
+ def Load(cls, filepath):
+ """Loads a score from file.
+
+ Args:
+ filepath: path to the score file.
+
+ Returns:
+ A float encoding the score.
+ """
with open(filepath) as f:
return float(f.readline().strip())
@classmethod
- def save(cls, filepath, score):
+ def Save(cls, filepath, score):
+ """Saves a score into a file.
+
+ Args:
+ filepath: path to the score file.
+ score: float encoding the score.
+ """
with open(filepath, 'w') as f:
f.write('{0:f}\n'.format(score))

Powered by Google App Engine
This is Rietveld 408576698