Module materialize.checks.checks

Expand source code Browse git
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0.

from typing import List

from materialize.checks.actions import Testdrive
from materialize.checks.executors import Executor


class Check:
    def __init__(self) -> None:
        self._initialize = self.initialize()
        self._manipulate = self.manipulate()
        self._validate = self.validate()

    def initialize(self) -> Testdrive:
        return Testdrive("")

    def manipulate(self) -> List[Testdrive]:
        assert False

    def validate(self) -> Testdrive:
        assert False

    def start_initialize(self, e: Executor) -> None:
        self._initialize.execute(e)

    def join_initialize(self, e: Executor) -> None:
        self._initialize.join(e)

    def start_manipulate(self, e: Executor, phase: int) -> None:
        self._manipulate[phase].execute(e)

    def join_manipulate(self, e: Executor, phase: int) -> None:
        self._manipulate[phase].join(e)

    def start_validate(self, e: Executor) -> None:
        self._validate.execute(e)

    def join_validate(self, e: Executor) -> None:
        self._validate.join(e)


class CheckDisabled(Check):
    def manipulate(self) -> List[Testdrive]:
        return [Testdrive(""), Testdrive("")]

    def validate(self) -> Testdrive:
        return Testdrive("")

Classes

class Check
Expand source code Browse git
class Check:
    def __init__(self) -> None:
        self._initialize = self.initialize()
        self._manipulate = self.manipulate()
        self._validate = self.validate()

    def initialize(self) -> Testdrive:
        return Testdrive("")

    def manipulate(self) -> List[Testdrive]:
        assert False

    def validate(self) -> Testdrive:
        assert False

    def start_initialize(self, e: Executor) -> None:
        self._initialize.execute(e)

    def join_initialize(self, e: Executor) -> None:
        self._initialize.join(e)

    def start_manipulate(self, e: Executor, phase: int) -> None:
        self._manipulate[phase].execute(e)

    def join_manipulate(self, e: Executor, phase: int) -> None:
        self._manipulate[phase].join(e)

    def start_validate(self, e: Executor) -> None:
        self._validate.execute(e)

    def join_validate(self, e: Executor) -> None:
        self._validate.join(e)

Subclasses

Methods

def initialize(self) ‑> Testdrive
Expand source code Browse git
def initialize(self) -> Testdrive:
    return Testdrive("")
def join_initialize(self, e: Executor) ‑> None
Expand source code Browse git
def join_initialize(self, e: Executor) -> None:
    self._initialize.join(e)
def join_manipulate(self, e: Executor, phase: int) ‑> None
Expand source code Browse git
def join_manipulate(self, e: Executor, phase: int) -> None:
    self._manipulate[phase].join(e)
def join_validate(self, e: Executor) ‑> None
Expand source code Browse git
def join_validate(self, e: Executor) -> None:
    self._validate.join(e)
def manipulate(self) ‑> List[Testdrive]
Expand source code Browse git
def manipulate(self) -> List[Testdrive]:
    assert False
def start_initialize(self, e: Executor) ‑> None
Expand source code Browse git
def start_initialize(self, e: Executor) -> None:
    self._initialize.execute(e)
def start_manipulate(self, e: Executor, phase: int) ‑> None
Expand source code Browse git
def start_manipulate(self, e: Executor, phase: int) -> None:
    self._manipulate[phase].execute(e)
def start_validate(self, e: Executor) ‑> None
Expand source code Browse git
def start_validate(self, e: Executor) -> None:
    self._validate.execute(e)
def validate(self) ‑> Testdrive
Expand source code Browse git
def validate(self) -> Testdrive:
    assert False
class CheckDisabled
Expand source code Browse git
class CheckDisabled(Check):
    def manipulate(self) -> List[Testdrive]:
        return [Testdrive(""), Testdrive("")]

    def validate(self) -> Testdrive:
        return Testdrive("")

Ancestors

Subclasses

Methods

def manipulate(self) ‑> List[Testdrive]
Expand source code Browse git
def manipulate(self) -> List[Testdrive]:
    return [Testdrive(""), Testdrive("")]
def validate(self) ‑> Testdrive
Expand source code Browse git
def validate(self) -> Testdrive:
    return Testdrive("")