<commit_before># -*- coding: utf-8 -*-

class Autoscaling(object):
    def __init__(self, min_replicas=None, max_replicas=None, min_scale=None, max_scale=None):
        raise NotImplementedError

    def _as_json(self):
        raise NotImplementedError

    def add_metric(self, metric):
        raise NotImplementedError<commit_msg>VR-5553 Implement Autoscaling class (#1173)<commit_after># -*- coding: utf-8 -*-
from .metrics import _AutoscalingMetric

class Autoscaling(object):
    def __init__(self, min_replicas=None, max_replicas=None, min_scale=None, max_scale=None):
        self._min_replicas = min_replicas
        self._max_replicas = max_replicas
        self._min_scale = min_scale
        self._max_scale = max_scale
        self._metrics = []

    def _as_dict(self):
        return {
            "quantities": {
                "min_replicas": self._min_replicas,
                "max_replicas": self._max_replicas,
                "min_scale": self._min_scale,
                "max_scale": self._max_scale
            },
            "metrics": list(map(lambda metric: metric._as_dict(), self._metrics))
        }

    def add_metric(self, metric):
        if not isinstance(metric, _AutoscalingMetric):
            raise TypeError("`metric` must be an object from verta.deployment.autoscaling.metrics")

        self._metrics.append(metric)
{'fraction_non_alphanumeric': 0.10301692420897719, 'fraction_numerical': 0.007358351729212656, 'mean_word_length': 2.746556473829201, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2888776', 'n_tokens_mistral': 435, 'n_tokens_neox': 414, 'n_words': 82}