Skip to content

Commit

Permalink
Merge branch 'master' into enhance-harmonicity
Browse files Browse the repository at this point in the history
  • Loading branch information
hokiedsp committed Feb 21, 2021
2 parents f8de86f + 45aa6db commit 205397e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
8 changes: 0 additions & 8 deletions src/parselmouth/Thing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@ namespace parselmouth {
CLASS_BINDING(Thing, structThing, detail::PraatHolder<structThing>)
BINDING_CONSTRUCTOR(Thing, "Thing")
BINDING_INIT(Thing) {
#if PY_MAJOR_VERSION >= 3
def("__str__",
[](Thing self) { MelderInfoInterceptor info; Thing_info(self); return info.get(); });
#else
def("__unicode__",
[](Thing self) { MelderInfoInterceptor info; Thing_info(self); return info.get(); });

def("__str__",
[](Thing self) { MelderInfoInterceptor info; Thing_info(self); return info.get(); });
#endif

def_property("name", &Thing_getName, [](Thing self, char32 *name) { if (name) praat_cleanUpName(name); Thing_setName(self, name); });

Expand Down
18 changes: 3 additions & 15 deletions src/parselmouth/Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,9 @@ namespace parselmouth
[](Vector self, double factor) { auto result = Data_copy(self); Vector_multiplyByScalar(result.get(), 1 / factor); return result; },
"factor"_a, py::is_operator());

#if PY_MAJOR_VERSION < 3
def(
"__idiv__",
[](Vector self, double factor) { Vector_multiplyByScalar(self, 1 / factor); return self; },
"factor"_a, py::is_operator());

def(
"__div__",
[](Vector self, double factor) { auto result = Data_copy(self); Vector_multiplyByScalar(result.get(), 1 / factor); return result; },
"factor"_a, py::is_operator());
#endif

def("scale",
args_cast<_, Positive<_>>(Vector_scale),
"scale"_a);
def("scale",
args_cast<_, Positive<_>>(Vector_scale),
"scale"_a);

def("scale_peak",
args_cast<_, Positive<_>>(Vector_scale),
Expand Down
2 changes: 1 addition & 1 deletion src/parselmouth/praat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void PraatEnvironment::toPraatArg(structStackel &stackel, const py::handle &arg)
return fillStackel(stackel, py::cast<double>(arg));
else if (py::isinstance<py::bool_>(arg))
return fillStackel(stackel, py::cast<bool>(arg));
else if (py::isinstance<py::str>(arg) && (PY_MAJOR_VERSION < 3 || !py::isinstance<py::bytes>(arg)))
else if (py::isinstance<py::str>(arg) && !py::isinstance<py::bytes>(arg))
return fillStackel(stackel, py::cast<std::u32string>(arg));

try {
Expand Down

0 comments on commit 205397e

Please sign in to comment.