<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#

from kubernetes.models.v1.OwnerReference import OwnerReference
from kubernetes.utils import is_valid_string, filter_model, is_valid_list, is_valid_dict


class ObjectMeta(object):
    """
    http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta
    """

    def __init__(self, model=None):
        super(ObjectMeta, self).__init__()
        self._name = None
        self._generate_name = None
        self._namespace = None
        self._self_link = None
        self._uid = None
        self._resource_version = None
        self._generation = None
        self._creation_timestamp = None
        self._deletion_timestamp = None
        self._deletion_grace_period_seconds = None
        self._labels = {}
        self._annotations = {}
        self._owner_references = None
        self._finalizers = None
        self._cluster_name = None

        if model is not None:
            m = filter_model(model)
            self._build_with_model(m)

    def _build_with_model(self, model=None):
        if 'name' in model:
            self.name = model['name']
        if 'generateName' in model:
            self.generate_name = model['generateName']
        if 'namespace' in model:
            self.namespace = model['namespace']
        if 'selfLink' in model:
            self.self_link = model['selfLink']
        if 'uid' in model:
            self.uid = model['uid']
        if 'resourceVersion' in model:
            self.resource_version = model['resourceVersion']
        if 'generation' in model:
            self.generation = model['generation']
        if 'creationTimestamp' in model:
            self.creation_timestamp = model['creationTimestamp']
        if 'deletionTimestamp' in model:
            self.deletion_timestamp = model['deletionTimestamp']
        if 'deletionGracePeriodSeconds' in model:
            self.deletion_grace_period_seconds = model['deletionGracePeriodSeconds']
        if 'labels' in model:
            self.labels = model['labels']
        if 'annotations' in model:
            self.annotations = model['annotations']
        if 'ownerReferences' in model:
            refs = []
            for o in model['ownerReferences']:
                ref = OwnerReference(model=o)
                refs.append(ref)
            self.owner_references = refs
        if 'finalizers' in model:
            self.finalizers = model['finalizers']
        if 'clusterName' in model:
            self.cluster_name = model['clusterName']

    # ------------------------------------------------------------------------------------- name

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, name=None):
        if not is_valid_string(name):
            raise SyntaxError('ObjectMeta: name: [ {0} ] is invalid.'.format(name))
        self._name = name<commit_msg>- v1.ObjectMeta: add strip() method to remove server-generated data.<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#

from kubernetes.models.v1.OwnerReference import OwnerReference
from kubernetes.utils import is_valid_string, filter_model, is_valid_list, is_valid_dict


class ObjectMeta(object):
    """
    http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_objectmeta
    """

    def __init__(self, model=None):
        super(ObjectMeta, self).__init__()

        self._name = None
        self._generate_name = None
        self._namespace = None
        self._self_link = None
        self._uid = None
        self._resource_version = None
        self._generation = None
        self._creation_timestamp = None
        self._deletion_timestamp = None
        self._deletion_grace_period_seconds = None
        self._labels = {}
        self._annotations = {}
        self._owner_references = None
        self._finalizers = None
        self._cluster_name = None

        if model is not None:
            m = filter_model(model)
            self._build_with_model(m)

    def _build_with_model(self, model=None):
        if 'name' in model:
            self.name = model['name']
        if 'generateName' in model:
            self.generate_name = model['generateName']
        if 'namespace' in model:
            self.namespace = model['namespace']
        if 'selfLink' in model:
            self.self_link = model['selfLink']
        if 'uid' in model:
            self.uid = model['uid']
        if 'resourceVersion' in model:
            self.resource_version = model['resourceVersion']
        if 'generation' in model:
            self.generation = model['generation']
        if 'creationTimestamp' in model:
            self.creation_timestamp = model['creationTimestamp']
        if 'deletionTimestamp' in model:
            self.deletion_timestamp = model['deletionTimestamp']
        if 'deletionGracePeriodSeconds' in model:
            self.deletion_grace_period_seconds = model['deletionGracePeriodSeconds']
        if 'labels' in model:
            self.labels = model['labels']
        if 'annotations' in model:
            self.annotations = model['annotations']
        if 'ownerReferences' in model:
            refs = []
            for o in model['ownerReferences']:
                ref = OwnerReference(model=o)
                refs.append(ref)
            self.owner_references = refs
        if 'finalizers' in model:
            self.finalizers = model['finalizers']
        if 'clusterName' in model:
            self.cluster_name = model['clusterName']

    # ------------------------------------------------------------------------------------- name

    def strip(self):
        # self._name = None
        self._generate_name = None
        # self._namespace = None
        self._self_link = None
        self._uid = None
        self._resource_version = None
        self._generation = None
        self._creation_timestamp = None
        self._deletion_timestamp = None
        self._deletion_grace_period_seconds = None
        # self._labels = {}
        # self._annotations = {}
        self._owner_references = None
        self._finalizers = None
        self._cluster_name = None

    # ------------------------------------------------------------------------------------- name

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, name=None):
        if not is_valid_string(name):
            raise SyntaxError('ObjectMeta: name: [ {0} ] is invalid.'.format(name))
        self._name = name
{'fraction_non_alphanumeric': 0.1298318087931543, 'fraction_numerical': 0.001622897609914429, 'mean_word_length': 1.9525261324041812, 'pattern_counts': {'":': 0, '<': 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': '6593690', 'n_tokens_mistral': 1834, 'n_tokens_neox': 1759, 'n_words': 442}