<commit_before># vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2011 Grid Dynamics
# Copyright 2011 OpenStack Foundation
# 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.

import itertools
import os

from oslo.config import cfg
from webob import exc

from nova.api.openstack import common
from nova.api.openstack import extensions
from nova import compute
from nova import exception
from nova import utils

ALIAS = "os-fping"
authorize = extensions.extension_authorizer('compute', 'v3:' + ALIAS)
authorize_all_tenants = extensions.extension_authorizer(
    'compute', 'v3:' + ALIAS + ':all_tenants')
fping_opts = [
    cfg.StrOpt("fping_path",
               default="/usr/sbin/fping",
               help="Full path to fping."),
]

CONF = cfg.CONF
CONF.register_opts(fping_opts)


class FpingController(object):

    def __init__(self, network_api=None):
        self.compute_api = compute.API()
        self.last_call = {}

    def check_fping(self):
        if not os.access(CONF.fping_path, os.X_OK):
            raise exc.HTTPServiceUnavailable(
                explanation=_("fping utility is not found."))

    @staticmethod
    def fping(ips):
        fping_ret = utils.execute(CONF.fping_path, *ips,
                                  check_exit_code=False)
        if not fping_ret:
            return set()
        alive_ips = set()
        for line in fping_ret[0].split("\n"):<commit_msg>Fix duplicate fping_path config option<commit_after># vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2011 Grid Dynamics
# Copyright 2011 OpenStack Foundation
# 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.

import itertools
import os

from oslo.config import cfg
from webob import exc

from nova.api.openstack import common
from nova.api.openstack import extensions
from nova import compute
from nova import exception
from nova import utils

ALIAS = "os-fping"
authorize = extensions.extension_authorizer('compute', 'v3:' + ALIAS)
authorize_all_tenants = extensions.extension_authorizer(
    'compute', 'v3:' + ALIAS + ':all_tenants')

CONF = cfg.CONF
CONF.import_opt('fping_path', 'nova.api.openstack.compute.contrib.fping')


class FpingController(object):

    def __init__(self, network_api=None):
        self.compute_api = compute.API()
        self.last_call = {}

    def check_fping(self):
        if not os.access(CONF.fping_path, os.X_OK):
            raise exc.HTTPServiceUnavailable(
                explanation=_("fping utility is not found."))

    @staticmethod
    def fping(ips):
        fping_ret = utils.execute(CONF.fping_path, *ips,
                                  check_exit_code=False)
        if not fping_ret:
            return set()
        alive_ips = set()
        for line in fping_ret[0].split("\n"):
{'fraction_non_alphanumeric': 0.08710348413936557, 'fraction_numerical': 0.0093603744149766, 'mean_word_length': 3.1454741379310347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4432683', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1125, 'n_words': 371}