Добавил модули
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user