This is an automated email from the ASF dual-hosted git repository. bertty pushed a commit to branch python-platform in repository https://gitbox.apache.org/repos/asf/incubator-wayang.git
commit f68dfa8fb6065028375605dc098d8137809beccb Author: Bertty Contreras-Rojas <[email protected]> AuthorDate: Wed Apr 6 19:24:31 2022 +0200 [WAYANG-#8] WyOperator change name to PywyWayang Signed-off-by: bertty <[email protected]> --- python/src/pywy/dataquanta.py | 6 ++--- python/src/pywy/graph/graphtypes.py | 30 +++++++++++----------- python/src/pywy/platforms/basic/mapping.py | 6 ++--- .../python/operators/PythonExecutionOperator.py | 4 +-- python/src/pywy/wayangplan/__init__.py | 4 +-- python/src/pywy/wayangplan/base.py | 8 +++--- python/src/pywy/wayangplan/sink.py | 4 +-- python/src/pywy/wayangplan/source.py | 4 +-- python/src/pywy/wayangplan/unary.py | 4 +-- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/python/src/pywy/dataquanta.py b/python/src/pywy/dataquanta.py index 2854b6b0..b38ac15c 100644 --- a/python/src/pywy/dataquanta.py +++ b/python/src/pywy/dataquanta.py @@ -42,10 +42,10 @@ class DataQuanta(GenericTco): """ Represents an intermediate result/data flow edge in a [[WayangPlan]]. """ - previous : WyOperator = None + previous : PywyOperator = None context: WayangContext - def __init__(self, context:WayangContext, operator: WyOperator): + def __init__(self, context:WayangContext, operator: PywyOperator): self.operator = operator self.context = context @@ -66,7 +66,7 @@ class DataQuanta(GenericTco): trs.translate() # TODO add the logic to execute the plan - def __connect(self, op:WyOperator, port_op: int = 0) -> WyOperator: + def __connect(self, op:PywyOperator, port_op: int = 0) -> PywyOperator: self.operator.connect(0, op, port_op) return op diff --git a/python/src/pywy/graph/graphtypes.py b/python/src/pywy/graph/graphtypes.py index fdd12809..26664edd 100644 --- a/python/src/pywy/graph/graphtypes.py +++ b/python/src/pywy/graph/graphtypes.py @@ -1,43 +1,43 @@ from typing import ( Iterable, List ) from pywy.graph.graph import ( GraphNode, WayangGraph ) -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator -class NodeOperator(GraphNode[WyOperator]): +class NodeOperator(GraphNode[PywyOperator]): - def __init__(self, op: WyOperator): + def __init__(self, op: PywyOperator): super(NodeOperator, self).__init__(op) - def getadjacents(self) -> Iterable[WyOperator]: - operator: WyOperator = self.current + def getadjacents(self) -> Iterable[PywyOperator]: + operator: PywyOperator = self.current if operator is None or operator.inputs == 0: return [] return operator.inputOperator - def build_node(self, t:WyOperator) -> 'NodeOperator': + def build_node(self, t:PywyOperator) -> 'NodeOperator': return NodeOperator(t) class WGraphOfOperator(WayangGraph[NodeOperator]): - def __init__(self, nodes: List[WyOperator]): + def __init__(self, nodes: List[PywyOperator]): super(WGraphOfOperator, self).__init__(nodes) - def build_node(self, t:WyOperator) -> NodeOperator: + def build_node(self, t:PywyOperator) -> NodeOperator: return NodeOperator(t) -class NodeVec(GraphNode[List[WyOperator]]): +class NodeVec(GraphNode[List[PywyOperator]]): - def __init__(self, op: WyOperator): + def __init__(self, op: PywyOperator): super(NodeVec, self).__init__([op, None]) - def getadjacents(self) -> Iterable[List[WyOperator]]: - operator: WyOperator = self.current[0] + def getadjacents(self) -> Iterable[List[PywyOperator]]: + operator: PywyOperator = self.current[0] if operator is None or operator.inputs == 0: return [] return operator.inputOperator - def build_node(self, t:WyOperator) -> 'NodeVec': + def build_node(self, t:PywyOperator) -> 'NodeVec': return NodeVec(t) def __str__(self): @@ -48,8 +48,8 @@ class NodeVec(GraphNode[List[WyOperator]]): class WGraphOfVec(WayangGraph[NodeVec]): - def __init__(self, nodes: List[WyOperator]): + def __init__(self, nodes: List[PywyOperator]): super(WGraphOfVec, self).__init__(nodes) - def build_node(self, t:WyOperator) -> NodeVec: + def build_node(self, t:PywyOperator) -> NodeVec: return NodeVec(t) \ No newline at end of file diff --git a/python/src/pywy/platforms/basic/mapping.py b/python/src/pywy/platforms/basic/mapping.py index e8f14a20..9749ebdd 100644 --- a/python/src/pywy/platforms/basic/mapping.py +++ b/python/src/pywy/platforms/basic/mapping.py @@ -1,5 +1,5 @@ from typing import Dict -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator class Mapping: mappings: Dict[str, type] @@ -7,10 +7,10 @@ class Mapping: def __init__(self): self.mappings = {} - def add_mapping(self, operator: WyOperator): + def add_mapping(self, operator: PywyOperator): self.mappings[operator.name_basic()] = type(operator) - def get_instanceof(self, operator: WyOperator): + def get_instanceof(self, operator: PywyOperator): template = self.mappings[operator.name_basic()] if template is None: raise Exception( diff --git a/python/src/pywy/platforms/python/operators/PythonExecutionOperator.py b/python/src/pywy/platforms/python/operators/PythonExecutionOperator.py index 52a82944..2db44f03 100644 --- a/python/src/pywy/platforms/python/operators/PythonExecutionOperator.py +++ b/python/src/pywy/platforms/python/operators/PythonExecutionOperator.py @@ -1,7 +1,7 @@ -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator from pywy.platforms.python.channels import Channel -class PythonExecutionOperator(WyOperator): +class PythonExecutionOperator(PywyOperator): def prefix(self) -> str: return 'Py' diff --git a/python/src/pywy/wayangplan/__init__.py b/python/src/pywy/wayangplan/__init__.py index 265e2d21..b0c87a10 100644 --- a/python/src/pywy/wayangplan/__init__.py +++ b/python/src/pywy/wayangplan/__init__.py @@ -1,10 +1,10 @@ -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator from pywy.wayangplan.sink import TextFileSink from pywy.wayangplan.source import TextFileSource from pywy.wayangplan.unary import FilterOperator, MapOperator, FlatmapOperator # __ALL__= [ - WyOperator, + PywyOperator, TextFileSink, TextFileSource, FilterOperator, diff --git a/python/src/pywy/wayangplan/base.py b/python/src/pywy/wayangplan/base.py index 1eedf1b8..1a81052a 100644 --- a/python/src/pywy/wayangplan/base.py +++ b/python/src/pywy/wayangplan/base.py @@ -1,15 +1,15 @@ from typing import ( TypeVar, Optional, List, Set ) from pywy.platforms.basic.channel import ChannelDescriptor -class WyOperator: +class PywyOperator: inputSlot : List[TypeVar] inputChannel : ChannelDescriptor - inputOperator: List['WyOperator'] + inputOperator: List['PywyOperator'] inputs : int outputSlot : List[TypeVar] outputChannel: ChannelDescriptor - outputOperator: List['WyOperator'] + outputOperator: List['PywyOperator'] outputs: int def __init__(self, @@ -47,7 +47,7 @@ class WyOperator: self.validate_inputs(input) self.validate_outputs(output) - def connect(self, port:int, that: 'WyOperator', port_that:int): + def connect(self, port:int, that: 'PywyOperator', port_that:int): self.outputOperator[port] = that that.inputOperator[port_that] = self diff --git a/python/src/pywy/wayangplan/sink.py b/python/src/pywy/wayangplan/sink.py index 2d832099..3cd26adc 100644 --- a/python/src/pywy/wayangplan/sink.py +++ b/python/src/pywy/wayangplan/sink.py @@ -1,9 +1,9 @@ from typing import Any from pywy.types import GenericTco -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator -class SinkOperator(WyOperator): +class SinkOperator(PywyOperator): def postfix(self) -> str: return 'Sink' diff --git a/python/src/pywy/wayangplan/source.py b/python/src/pywy/wayangplan/source.py index 202a4655..1439c108 100644 --- a/python/src/pywy/wayangplan/source.py +++ b/python/src/pywy/wayangplan/source.py @@ -1,6 +1,6 @@ -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator -class SourceUnaryOperator(WyOperator): +class SourceUnaryOperator(PywyOperator): def __init__(self, name:str): super(SourceUnaryOperator, self).__init__( diff --git a/python/src/pywy/wayangplan/unary.py b/python/src/pywy/wayangplan/unary.py index aa1d9573..725159e3 100644 --- a/python/src/pywy/wayangplan/unary.py +++ b/python/src/pywy/wayangplan/unary.py @@ -1,5 +1,5 @@ from itertools import chain -from pywy.wayangplan.base import WyOperator +from pywy.wayangplan.base import PywyOperator from pywy.types import ( GenericTco, GenericUco, @@ -13,7 +13,7 @@ from pywy.types import ( -class UnaryToUnaryOperator(WyOperator): +class UnaryToUnaryOperator(PywyOperator): def __init__(self, name:str, input:GenericTco, output:GenericUco): super().__init__(name, input, output, 1, 1)
