Добавил модули

This commit is contained in:
2023-12-05 00:10:42 +03:00
parent 249a9e8a63
commit 1d36512756
18 changed files with 507 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
class PipeManager:
def __init__(self):
self.pipes = {}
def add(self, pipe):
name = pipe.name
if self.contains(name):
raise Exception("Pipe with name '" + name + "' already exists")
self.pipes[name] = pipe
def get(self, name):
if not self.contains(name):
raise Exception("There is no pipe with name '" + name + "'")
return self.pipes[name]
def contains(self, name):
return name in self.pipes