# Copyright (C) 2020 Alteryx, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Mock record creator class definition."""
from typing import Any, TYPE_CHECKING
from .record_ref import RecordRef
if TYPE_CHECKING:
from .record_info import RecordInfo
[docs]class RecordCreator:
"""Record Creator mock."""
def __init__(self, record_info: "RecordInfo") -> None:
"""Construct a record creator."""
self.record_ref = RecordRef(record_info)
self.record_info = record_info
[docs] def finalize_record(self) -> RecordRef:
"""Finalize a record ref."""
return self.record_ref
[docs] def reset(self, var_data_size: int = 0) -> None:
"""Reset the creator."""
self.record_ref = RecordRef(self.record_info)
[docs] def set_field(self, name: str, value: Any) -> None:
"""Set a field in the underlying record ref."""
self.record_ref.set_field(name, value)