/usr/lib/python3/dist-packages/pyutilib/workflow/connector.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # _________________________________________________________________________
#
# PyUtilib: A Python utility library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the BSD License.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
# _________________________________________________________________________
__all__ = ['Connector', 'DirectConnector']
class Connector(object):
def __init__(self, from_port=None, to_port=None):
"""Constructor."""
from pyutilib.workflow import task
if from_port is None:
self.from_port = task.NoTask #pragma:nocover
else:
self.from_port = from_port
if to_port is None:
self.to_port = task.NoTask #pragma:nocover
else:
self.to_port = to_port
def get_value(self):
raise ValueError("There is no value to get in an abstract Connector object!") #pragma:nocover
def ready(self):
return self.from_port.ready()
def __repr__(self):
"""Return a string representation for this connection."""
return str(self)
def __str__(self):
"""Return a string representation for this connection."""
return "%s: from=(%s) to=(%s) %s" % (str(self.__class__.__name__), str(self.from_port.task().id), str(self.to_port.task().id), self.ready())
#class UnknownConnector(Connector):
# def __init__(self, from_port=None, to_port=None):
# Connector.__init__(self, from_port=from_port, to_port=to_port)
class DirectConnector(Connector):
def __init__(self, from_port=None, to_port=None):
Connector.__init__(self, from_port=from_port, to_port=to_port)
def get_value(self):
if self.ready():
return self.from_port.get_value()
return None
|