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

# ======================================================================
# Copyright 2016 <NAME>
# 
# 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.
# ======================================================================

from socket import gethostname
from collections import OrderedDict


class AddressMapper(object):
    """ Class used for storage of the addresses defined in the configuration file.
    These addresses are expected to be host names or IP addresses where a Supvisors instance is running.
    The instance holds:
        - logger: a reference to the common logger,
        - addresses: the list of addresses defined in the Supvisors configuration file,
        - local_addresses: the list of known aliases of the current host, i.e. the host name and the IPv4 addresses,
        - local_address: the usage name of the current host, i.e. the name in the known aliases corresponding
        to an address of the Supvisors list. """

    def __init__(self, logger):
        """ Initialization of the attributes. """
        # keep reference of common logger
        self.logger = logger
        # init
        self._addresses = []
        self.local_addresses = [gethostname()] + self.ipv4()
        self.local_address = None

    @property
    def addresses(self):
        """ Property for the 'address' attribute.
        The setter stores the addresses of the configuration file and determine the usage name of the local address. """
        return self._addresses

    @addresses.setter
    def addresses(self, addr):
        self.logger.info('Expected addresses: {}'.format(addr))
        # store IP list as found in config file
        self._addresses = addr
        # get IP list for local board
        self.local_address = self.expected(self.local_addresses)<commit_msg>add doc text<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

# ======================================================================
# Copyright 2016 <NAME>
# 
# 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.
# ======================================================================

from socket import gethostname
from collections import OrderedDict


class AddressMapper(object):
    """ Class used for storage of the addresses defined in the configuration file.
    These addresses are expected to be host names or IP addresses where a Supvisors instance is running.
    The instance holds:
        - logger: a reference to the common logger,
        - addresses: the list of addresses defined in the Supvisors configuration file,
        - local_addresses: the list of known aliases of the current host, i.e. the host name and the IPv4 addresses,
        - local_address: the usage name of the current host, i.e. the name in the known aliases corresponding
        to an address of the Supvisors list. """

    def __init__(self, logger):
        """ Initialization of the attributes. """
        # keep reference of common logger
        self.logger = logger
        # init
        self._addresses = []
        self.local_addresses = [gethostname()] + self.ipv4()
        self.local_address = None

    @property
    def addresses(self):
        """ Property for the 'address' attribute.
        The setter stores the addresses of the configuration file and determine the usage name of the local address. """
        return self._addresses

    @addresses.setter
    def addresses(self, addr):
        """ Determine usage name of local address among the addresses provided in option file. """
        self.logger.info('Expected addresses: {}'.format(addr))
        # store IP list as found in config file
        self._addresses = addr
        # get IP list for local board
        self.local_address = self.expected(self.local_addresses)
{'fraction_non_alphanumeric': 0.12734472696957067, 'fraction_numerical': 0.004585243851604835, 'mean_word_length': 3.228193832599119, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4981230', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1125, 'n_words': 532}