Skip to content

Commit 710e570

Browse files
committed
Add tests for utils.py, ComponentPayload.py
1 parent a188d69 commit 710e570

22 files changed

+279
-21
lines changed

pipeline.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ preprocessing:
3232
output_dir: 'pyannote_vad_preprocessed'
3333
add_segment_metadata: true
3434
performance_measurement: true
35+
keep_only_first_segment: true
3536
onset: 0.85 # onset activation threshold
3637
offset: 0.8 # offset activation threshold
3738
min_duration_on: 0.1 # remove speech regions shorter than that many seconds

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=42.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
11
[flake8]
22
max-line-length=120
3+
4+
[metadata]
5+
name = vanpy
6+
description = Voice ANalysis framework
7+
author = Gregory Koushnir
8+
license = Apache License v2.0
9+
license_file = LICENSE
10+
platforms = unix, linux, osx, cygwin, win32
11+
classifiers =
12+
Programming Language :: Python :: 3
13+
Programming Language :: Python :: 3 :: Only
14+
Programming Language :: Python :: 3.6
15+
Programming Language :: Python :: 3.7
16+
Programming Language :: Python :: 3.8
17+
Programming Language :: Python :: 3.9
18+
19+
[options]
20+
packages =
21+
vanpy
22+
python_requires = >=3.6
23+
package_dir =
24+
=src
25+
zip_safe = no
26+
27+
[options.extras_require]
28+
testing =
29+
pytest>=6.0
30+
pytest-cov>=2.0
31+
mypy>=0.910
32+
flake8>=3.9
33+
tox>=3.24
34+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
description='Voice ANalysis framework',
1111
author='Gregory Koushnir',
1212
author_email='[email protected]',
13-
packages=find_packages(include=['vanpy.core', 'vanpy.core.*', 'vanpy.utils', 'vanpy.utils.*']),
13+
# packages=find_packages(include=['vanpy.core', 'vanpy.core.*', 'vanpy.utils', 'vanpy.utils.*']),
1414
install_requires=[
1515
'gdown>=4.4.0',
1616
'huggingface-hub>=0.5.1',

src/vanpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.71.31'
1+
__version__ = '0.71.33'

src/vanpy/core/BasePipline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from yaml import YAMLObject
77

88
from src.vanpy.core.ComponentPayload import ComponentPayload
9-
from src.vanpy.core.PiplineComponent import PipelineComponent
9+
from src.vanpy.core.PipelineComponent import PipelineComponent
1010

1111

1212
@dataclass

src/vanpy/core/CombinedPipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import List
66

77
from src.vanpy.core.BasePipline import BasePipeline
8-
from src.vanpy.core.PiplineComponent import ComponentPayload
8+
from src.vanpy.core.PipelineComponent import ComponentPayload
99
from yaml import YAMLObject
1010

1111

src/vanpy/core/ComponentPayload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def get_columns(self, all_paths_columns=False, meta_columns=False):
6969
columns.extend(self.metadata['meta_columns'])
7070
return columns
7171

72-
def get_declared_columns(self, ext_columns: List[str], all_paths_columns=False, meta_columns=False):
72+
def get_declared_columns(self, ext_columns: List[str], all_paths_columns=False, meta_columns=False) -> pd.DataFrame:
7373
"""
7474
Returns a payload's dataframe containing the specified columns.
7575
@@ -85,7 +85,7 @@ def get_declared_columns(self, ext_columns: List[str], all_paths_columns=False,
8585
columns = self.get_columns(all_paths_columns, meta_columns)
8686
for cols in ext_columns:
8787
columns.extend(self.metadata[cols])
88-
columns = list(set(columns) & set(self.df.columns))
88+
# columns = list(set(columns) & set(self.df.columns))
8989
return self.df[columns]
9090

9191
def get_features_df(self, all_paths_columns=False, meta_columns=False):

src/vanpy/core/PiplineComponent.py renamed to src/vanpy/core/PipelineComponent.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,13 @@ def save_component_payload(self, input_payload: ComponentPayload, intermediate=F
126126
self.get_logger().info(f'Saved payload in {self.config["intermediate_payload_path"]}')
127127

128128
def save_intermediate_payload(self, i: int, input_payload: ComponentPayload):
129+
"""
130+
Save intermediate payload based on the save_payload_periodicity configuration.
131+
132+
:param i: current iteration count
133+
:type i: int
134+
:param input_payload: the payload to be saved
135+
:type input_payload: ComponentPayload
136+
"""
129137
if 'save_payload_periodicity' in self.config and i % self.config['save_payload_periodicity'] == 0 and i > 0:
130138
self.save_component_payload(input_payload, intermediate=True)

src/vanpy/core/feature_extraction_components/LibrosaFeaturesExtractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import pandas as pd
88

99
from src.vanpy.core.ComponentPayload import ComponentPayload
10-
from src.vanpy.core.PiplineComponent import PipelineComponent
10+
from src.vanpy.core.PipelineComponent import PipelineComponent
1111
from typing import List
1212

1313

0 commit comments

Comments
 (0)