<commit_before>import os
import posixpath

try:
    from collections.abc import Callable
except ImportError:
    from collections import Callable

from daemonocle._utils import to_bytes
from daemonocle.core import Daemon


class FHSDaemon(Daemon):
    """A Daemon subclass that makes opinionatedly complies with the
    Filesystem Hierarchy Standard"""

    def __init__(self, name=None, prefix='/opt', **kwargs):
        if name is not None:
            self.name = name
        elif not getattr(self, 'name', None):
            raise ValueError('name must be defined for FHSDaemon')

        kwargs.update({
            'chrootdir': None,
            'detach': True,
        })

        if prefix == '/opt':
            kwargs.update({
                'pid_file': '/var/opt/{name}/run/{name}.pid'.format(<commit_msg>Resolve full path of prefix<commit_after>import os
import posixpath

try:
    from collections.abc import Callable
except ImportError:
    from collections import Callable

from daemonocle._utils import to_bytes
from daemonocle.core import Daemon


class FHSDaemon(Daemon):
    """A Daemon subclass that makes opinionatedly complies with the
    Filesystem Hierarchy Standard"""

    def __init__(self, name=None, prefix='/opt', **kwargs):
        if name is not None:
            self.name = name
        elif not getattr(self, 'name', None):
            raise ValueError('name must be defined for FHSDaemon')

        kwargs.update({
            'chrootdir': None,
            'detach': True,
        })

        prefix = posixpath.realpath(prefix)

        if prefix == '/opt':
            kwargs.update({
                'pid_file': '/var/opt/{name}/run/{name}.pid'.format(
{'fraction_non_alphanumeric': 0.10029498525073746, 'fraction_numerical': 0.0, 'mean_word_length': 2.5186721991701244, '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': '196235', 'n_tokens_mistral': 485, 'n_tokens_neox': 469, 'n_words': 149}