Skip to content

Commit 0e0d3b7

Browse files
committed
har_trees: Use temporary directory
1 parent 3cfdd72 commit 0e0d3b7

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

examples/har_trees/har_train.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ def assign_window_label(labels, majority=0.66):
108108
return None
109109

110110

111-
from contextlib import contextmanager
112-
@contextmanager
113-
def NotTemporaryDirectory():
114-
115-
path = 'temp-test'
116-
if not os.path.exists(path):
117-
os.makedirs(path)
118-
yield path
119-
120-
121111
def timebased_features(windows : list[pandas.DataFrame],
122112
columns : list[str],
123113
micropython_bin='micropython') -> pandas.DataFrame:
@@ -136,7 +126,7 @@ def timebased_features(windows : list[pandas.DataFrame],
136126
# lower=numpy.quantile(data, 0.01),
137127
#)
138128

139-
with NotTemporaryDirectory() as tempdir:
129+
with tempfile.TemporaryDirectory() as tempdir:
140130
data_path = os.path.join(tempdir, 'data.npy')
141131
features_path = os.path.join(tempdir, 'features.npy')
142132

0 commit comments

Comments
 (0)