Skip to content

Commit

Permalink
Added pop method to Handler class
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekakhrone committed Mar 18, 2021
1 parent 23b0ed3 commit 0350857
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


libname = "TPS"
version = "1.1.0"
version = "1.1.1"

setup(
name=libname,
Expand Down
13 changes: 13 additions & 0 deletions tps/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,19 @@ def _validate_modules(self):
# assert phonetizer_type == md.EnPhonetizer


def pop(self, item):
if isinstance(item, int):
idx = item
elif isinstance(item, str):
for idx, module in enumerate(self.modules):
if module.name == item:
break
else:
raise TypeError

return self.modules.pop(idx)


def _clear_state(self):
del self._out_data
self._out_data = {}
Expand Down

0 comments on commit 0350857

Please sign in to comment.