<commit_before>#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Plinth module to configure Tahoe-LAFS.
"""

import json
import os

from django.utils.translation import ugettext_lazy as _

from plinth import action_utils
from plinth import actions
from plinth import cfg
from plinth import frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.utils import format_lazy

from .errors import TahoeConfigurationError

version = 1

managed_services = ['tahoe-lafs']

managed_packages = ['tahoe-lafs']

name = _('LAFS')

short_description = _('Distributed File Storage')

service = None

tahoe_home = '/var/lib/tahoe-lafs'
introducer_name = 'introducer'
storage_node_name = 'storage_node'
domain_name_file = os.path.join(tahoe_home, 'domain_name')
introducers_file = os.path.join(
    tahoe_home, '{}/private/introducers.yaml'.format(storage_node_name))
introducer_furl_file = os.path.join(
    tahoe_home, '{0}/private/{0}.furl'.format(introducer_name))


def is_setup():
    """Check whether Tahoe-LAFS is setup"""
    return os.path.exists(domain_name_file)


def get_configured_domain_name():
    """Extract and return the domain name from the domain name file.
    Throws TahoeConfigurationError if the domain name file is not found.
    """
    if not os.path.exists(domain_name_file):
        raise TahoeConfigurationError
    else:<commit_msg>Correct LAFS to Tahoe-LAFS in apps page<commit_after>#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
"""
Plinth module to configure Tahoe-LAFS.
"""

import json
import os

from django.utils.translation import ugettext_lazy as _

from plinth import action_utils
from plinth import actions
from plinth import cfg
from plinth import frontpage
from plinth import service as service_module
from plinth.menu import main_menu
from plinth.utils import format_lazy

from .errors import TahoeConfigurationError

version = 1

managed_services = ['tahoe-lafs']

managed_packages = ['tahoe-lafs']

name = _('Tahoe-LAFS')

short_description = _('Distributed File Storage')

service = None

tahoe_home = '/var/lib/tahoe-lafs'
introducer_name = 'introducer'
storage_node_name = 'storage_node'
domain_name_file = os.path.join(tahoe_home, 'domain_name')
introducers_file = os.path.join(
    tahoe_home, '{}/private/introducers.yaml'.format(storage_node_name))
introducer_furl_file = os.path.join(
    tahoe_home, '{0}/private/{0}.furl'.format(introducer_name))


def is_setup():
    """Check whether Tahoe-LAFS is setup"""
    return os.path.exists(domain_name_file)


def get_configured_domain_name():
    """Extract and return the domain name from the domain name file.
    Throws TahoeConfigurationError if the domain name file is not found.
    """
    if not os.path.exists(domain_name_file):
        raise TahoeConfigurationError
    else:
{'fraction_non_alphanumeric': 0.08126520681265206, 'fraction_numerical': 0.0019464720194647203, 'mean_word_length': 4.578018995929444, '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': '5774584', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1207, 'n_words': 457}