<commit_before># Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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 __future__ import absolute_import
import os
import socket
import sys

from oslo_config import cfg
from distutils.spawn import find_executable

from st2common.constants.system import VERSION_STRING
from st2common.constants.system import DEFAULT_CONFIG_FILE_PATH
from st2common.constants.runners import PYTHON_RUNNER_DEFAULT_LOG_LEVEL
from st2common.constants.action import LIVEACTION_COMPLETED_STATES

__all__ = [
    'do_register_opts',
    'do_register_cli_opts',

    'parse_args'
]


def do_register_opts(opts, group=None, ignore_errors=False):
    try:
        cfg.CONF.register_opts(opts, group=group)
    except:
        if not ignore_errors:
            raise


def do_register_cli_opts(opt, ignore_errors=False):
    # TODO: This function has broken name, it should work with lists :/
    if not isinstance(opt, (list, tuple)):
        opts = [opt]
    else:
        opts = opt

    try:
        cfg.CONF.register_cli_opts(opts)
    except:
        if not ignore_errors:
            raise


def register_opts(ignore_errors=False):
    rbac_opts = [
        cfg.BoolOpt(
            'enable', default=False,
            help='Enable RBAC.'),
        cfg.BoolOpt(
            'sync_remote_groups', default=False,
            help='True to synchronize remote groups returned by the auth backed for each '
                 'StackStorm user with local StackStorm roles based on the group to role '
                 'mapping definition files.'),
        cfg.BoolOpt(
            'permission_isolation', default=False,
            help='Isolate resources by user. For now, these resources only include rules and '<commit_msg>Add new rbac.backend config option which defaults to noop.<commit_after># Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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 __future__ import absolute_import
import os
import socket
import sys

from oslo_config import cfg
from distutils.spawn import find_executable

from st2common.constants.system import VERSION_STRING
from st2common.constants.system import DEFAULT_CONFIG_FILE_PATH
from st2common.constants.runners import PYTHON_RUNNER_DEFAULT_LOG_LEVEL
from st2common.constants.action import LIVEACTION_COMPLETED_STATES

__all__ = [
    'do_register_opts',
    'do_register_cli_opts',

    'parse_args'
]


def do_register_opts(opts, group=None, ignore_errors=False):
    try:
        cfg.CONF.register_opts(opts, group=group)
    except:
        if not ignore_errors:
            raise


def do_register_cli_opts(opt, ignore_errors=False):
    # TODO: This function has broken name, it should work with lists :/
    if not isinstance(opt, (list, tuple)):
        opts = [opt]
    else:
        opts = opt

    try:
        cfg.CONF.register_cli_opts(opts)
    except:
        if not ignore_errors:
            raise


def register_opts(ignore_errors=False):
    rbac_opts = [
        cfg.BoolOpt(
            'enable', default=False,
            help='Enable RBAC.'),
        cfg.BoolOpt(
            'backend', default='noop',
            help='RBAC backend to use.'),
        cfg.BoolOpt(
            'sync_remote_groups', default=False,
            help='True to synchronize remote groups returned by the auth backed for each '
                 'StackStorm user with local StackStorm roles based on the group to role '
                 'mapping definition files.'),
        cfg.BoolOpt(
            'permission_isolation', default=False,
            help='Isolate resources by user. For now, these resources only include rules and '
{'fraction_non_alphanumeric': 0.0678135627125425, 'fraction_numerical': 0.003200640128025605, 'mean_word_length': 3.208754208754209, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6318959', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1340, 'n_words': 507}