From b1a35941ebeeb14378e5dc00acf145048d00a3a4 Mon Sep 17 00:00:00 2001 From: Karl Higley Date: Thu, 24 Feb 2022 17:06:12 -0500 Subject: [PATCH] Rename `merlin.graph` to `merlin.dag` (#22) --- merlin/{graph => dag}/__init__.py | 0 merlin/{graph => dag}/base_operator.py | 4 ++-- merlin/{graph => dag}/graph.py | 2 +- merlin/{graph => dag}/node.py | 6 +++--- merlin/{graph => dag}/ops/__init__.py | 0 merlin/{graph => dag}/ops/concat_columns.py | 4 ++-- merlin/{graph => dag}/ops/identity.py | 4 ++-- merlin/{graph => dag}/ops/selection.py | 4 ++-- merlin/{graph => dag}/ops/subset_columns.py | 4 ++-- merlin/{graph => dag}/ops/subtraction.py | 4 ++-- merlin/{graph => dag}/selector.py | 8 ++++---- tests/unit/{graph => dag}/ops/test_selection.py | 4 ++-- tests/unit/{graph => dag}/test_base_operator.py | 6 +++--- tests/unit/{graph => dag}/test_column_schemas.py | 2 +- tests/unit/{graph => dag}/test_column_selector.py | 8 ++++---- tests/unit/{graph => dag}/test_tags.py | 0 16 files changed, 30 insertions(+), 30 deletions(-) rename merlin/{graph => dag}/__init__.py (100%) rename merlin/{graph => dag}/base_operator.py (99%) rename merlin/{graph => dag}/graph.py (99%) rename merlin/{graph => dag}/node.py (98%) rename merlin/{graph => dag}/ops/__init__.py (100%) rename merlin/{graph => dag}/ops/concat_columns.py (95%) rename merlin/{graph => dag}/ops/identity.py (93%) rename merlin/{graph => dag}/ops/selection.py (94%) rename merlin/{graph => dag}/ops/subset_columns.py (94%) rename merlin/{graph => dag}/ops/subtraction.py (94%) rename merlin/{graph => dag}/selector.py (96%) rename tests/unit/{graph => dag}/ops/test_selection.py (94%) rename tests/unit/{graph => dag}/test_base_operator.py (94%) rename tests/unit/{graph => dag}/test_column_schemas.py (99%) rename tests/unit/{graph => dag}/test_column_selector.py (97%) rename tests/unit/{graph => dag}/test_tags.py (100%) diff --git a/merlin/graph/__init__.py b/merlin/dag/__init__.py similarity index 100% rename from merlin/graph/__init__.py rename to merlin/dag/__init__.py diff --git a/merlin/graph/base_operator.py b/merlin/dag/base_operator.py similarity index 99% rename from merlin/graph/base_operator.py rename to merlin/dag/base_operator.py index 9fa1c96fc..57f68d052 100644 --- a/merlin/graph/base_operator.py +++ b/merlin/dag/base_operator.py @@ -19,7 +19,7 @@ from typing import Any, List, Union import merlin -from merlin.graph.selector import ColumnSelector +from merlin.dag.selector import ColumnSelector from merlin.schema import ColumnSchema, Schema @@ -248,7 +248,7 @@ def label(self) -> str: return self.__class__.__name__ def create_node(self, selector): - return merlin.graph.Node(selector) + return merlin.dag.Node(selector) @property def supports(self) -> Supports: diff --git a/merlin/graph/graph.py b/merlin/dag/graph.py similarity index 99% rename from merlin/graph/graph.py rename to merlin/dag/graph.py index 600b66056..9fc302483 100644 --- a/merlin/graph/graph.py +++ b/merlin/dag/graph.py @@ -17,7 +17,7 @@ import logging from collections import deque -from merlin.graph.node import ( +from merlin.dag.node import ( Node, _combine_schemas, iter_nodes, diff --git a/merlin/graph/node.py b/merlin/dag/node.py similarity index 98% rename from merlin/graph/node.py rename to merlin/dag/node.py index 879cf51c6..9ea731bc1 100644 --- a/merlin/graph/node.py +++ b/merlin/dag/node.py @@ -15,9 +15,9 @@ # import collections.abc -from merlin.graph.base_operator import BaseOperator -from merlin.graph.ops import ConcatColumns, SelectionOp, SubsetColumns, SubtractionOp -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator +from merlin.dag.ops import ConcatColumns, SelectionOp, SubsetColumns, SubtractionOp +from merlin.dag.selector import ColumnSelector from merlin.schema import Schema diff --git a/merlin/graph/ops/__init__.py b/merlin/dag/ops/__init__.py similarity index 100% rename from merlin/graph/ops/__init__.py rename to merlin/dag/ops/__init__.py diff --git a/merlin/graph/ops/concat_columns.py b/merlin/dag/ops/concat_columns.py similarity index 95% rename from merlin/graph/ops/concat_columns.py rename to merlin/dag/ops/concat_columns.py index b5c9d94da..b0ab598d7 100644 --- a/merlin/graph/ops/concat_columns.py +++ b/merlin/dag/ops/concat_columns.py @@ -15,8 +15,8 @@ # from merlin.core.dispatch import DataFrameType -from merlin.graph.base_operator import BaseOperator -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator +from merlin.dag.selector import ColumnSelector from merlin.schema import Schema diff --git a/merlin/graph/ops/identity.py b/merlin/dag/ops/identity.py similarity index 93% rename from merlin/graph/ops/identity.py rename to merlin/dag/ops/identity.py index fcb2e74c2..884a72dcd 100644 --- a/merlin/graph/ops/identity.py +++ b/merlin/dag/ops/identity.py @@ -15,8 +15,8 @@ # from merlin.core.dispatch import DataFrameType -from merlin.graph.base_operator import BaseOperator -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator +from merlin.dag.selector import ColumnSelector class Identity(BaseOperator): diff --git a/merlin/graph/ops/selection.py b/merlin/dag/ops/selection.py similarity index 94% rename from merlin/graph/ops/selection.py rename to merlin/dag/ops/selection.py index 73b10ce4b..6f1d5810b 100644 --- a/merlin/graph/ops/selection.py +++ b/merlin/dag/ops/selection.py @@ -18,8 +18,8 @@ import logging from merlin.core.dispatch import DataFrameType -from merlin.graph.base_operator import BaseOperator -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator +from merlin.dag.selector import ColumnSelector from merlin.schema import Schema LOG = logging.getLogger("SelectionOp") diff --git a/merlin/graph/ops/subset_columns.py b/merlin/dag/ops/subset_columns.py similarity index 94% rename from merlin/graph/ops/subset_columns.py rename to merlin/dag/ops/subset_columns.py index f133e8b52..a71e39c23 100644 --- a/merlin/graph/ops/subset_columns.py +++ b/merlin/dag/ops/subset_columns.py @@ -15,8 +15,8 @@ # from merlin.core.dispatch import DataFrameType -from merlin.graph.base_operator import BaseOperator -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator +from merlin.dag.selector import ColumnSelector from merlin.schema import Schema diff --git a/merlin/graph/ops/subtraction.py b/merlin/dag/ops/subtraction.py similarity index 94% rename from merlin/graph/ops/subtraction.py rename to merlin/dag/ops/subtraction.py index b277df3d7..a7a585205 100644 --- a/merlin/graph/ops/subtraction.py +++ b/merlin/dag/ops/subtraction.py @@ -16,8 +16,8 @@ from __future__ import annotations from merlin.core.dispatch import DataFrameType -from merlin.graph.base_operator import BaseOperator -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator +from merlin.dag.selector import ColumnSelector from merlin.schema import Schema diff --git a/merlin/graph/selector.py b/merlin/dag/selector.py similarity index 96% rename from merlin/graph/selector.py rename to merlin/dag/selector.py index 9531d8525..485267e2f 100644 --- a/merlin/graph/selector.py +++ b/merlin/dag/selector.py @@ -46,7 +46,7 @@ def __init__( self._tags = tags if tags is not None else [] self.subgroups = subgroups if subgroups is not None else [] - if isinstance(self._names, merlin.graph.Node): + if isinstance(self._names, merlin.dag.Node): raise TypeError("ColumnSelectors can not contain Nodes") if isinstance(self._names, str): @@ -59,7 +59,7 @@ def __init__( for name in self._names: if isinstance(name, str): plain_names.append(name) - elif isinstance(name, merlin.graph.Node): + elif isinstance(name, merlin.dag.Node): raise ValueError("ColumnSelectors can not contain Nodes") elif isinstance(name, ColumnSelector): self.subgroups.append(name) @@ -101,7 +101,7 @@ def _nested_check(self, nests=0): def __add__(self, other): if other is None: return self - elif isinstance(other, merlin.graph.Node): + elif isinstance(other, merlin.dag.Node): return other + self elif isinstance(other, ColumnSelector): @@ -121,7 +121,7 @@ def __radd__(self, other): return self + other def __rshift__(self, operator): - if isinstance(operator, type) and issubclass(operator, merlin.graph.BaseOperator): + if isinstance(operator, type) and issubclass(operator, merlin.dag.BaseOperator): # handle case where an operator class is passed operator = operator() diff --git a/tests/unit/graph/ops/test_selection.py b/tests/unit/dag/ops/test_selection.py similarity index 94% rename from tests/unit/graph/ops/test_selection.py rename to tests/unit/dag/ops/test_selection.py index b5f76a453..f8a5ef414 100644 --- a/tests/unit/graph/ops/test_selection.py +++ b/tests/unit/dag/ops/test_selection.py @@ -15,8 +15,8 @@ # import pytest -from merlin.graph import ColumnSelector -from merlin.graph.ops.selection import SelectionOp +from merlin.dag import ColumnSelector +from merlin.dag.ops.selection import SelectionOp from merlin.schema import ColumnSchema, Schema diff --git a/tests/unit/graph/test_base_operator.py b/tests/unit/dag/test_base_operator.py similarity index 94% rename from tests/unit/graph/test_base_operator.py rename to tests/unit/dag/test_base_operator.py index d2a77bb06..d85326b9d 100644 --- a/tests/unit/graph/test_base_operator.py +++ b/tests/unit/dag/test_base_operator.py @@ -15,9 +15,9 @@ # import pytest -from merlin.graph.base_operator import BaseOperator as Operator -from merlin.graph.graph import Graph -from merlin.graph.selector import ColumnSelector +from merlin.dag.base_operator import BaseOperator as Operator +from merlin.dag.graph import Graph +from merlin.dag.selector import ColumnSelector from merlin.schema import Schema diff --git a/tests/unit/graph/test_column_schemas.py b/tests/unit/dag/test_column_schemas.py similarity index 99% rename from tests/unit/graph/test_column_schemas.py rename to tests/unit/dag/test_column_schemas.py index d524497a8..6353c9222 100644 --- a/tests/unit/graph/test_column_schemas.py +++ b/tests/unit/dag/test_column_schemas.py @@ -18,7 +18,7 @@ import numpy import pytest -from merlin.graph.selector import ColumnSelector +from merlin.dag.selector import ColumnSelector from merlin.schema import ColumnSchema, Schema from merlin.schema.io.tensorflow_metadata import TensorflowMetadata from merlin.schema.tags import Tags, TagSet diff --git a/tests/unit/graph/test_column_selector.py b/tests/unit/dag/test_column_selector.py similarity index 97% rename from tests/unit/graph/test_column_selector.py rename to tests/unit/dag/test_column_selector.py index 3e69e1c98..18986a214 100644 --- a/tests/unit/graph/test_column_selector.py +++ b/tests/unit/dag/test_column_selector.py @@ -15,10 +15,10 @@ # import pytest -from merlin.graph import BaseOperator -from merlin.graph.node import Node -from merlin.graph.ops.selection import SelectionOp -from merlin.graph.selector import ColumnSelector +from merlin.dag import BaseOperator +from merlin.dag.node import Node +from merlin.dag.ops.selection import SelectionOp +from merlin.dag.selector import ColumnSelector from merlin.schema.tags import Tags diff --git a/tests/unit/graph/test_tags.py b/tests/unit/dag/test_tags.py similarity index 100% rename from tests/unit/graph/test_tags.py rename to tests/unit/dag/test_tags.py