<commit_before>#!/usr/bin/env python

__author__ = '<NAME>, <NAME>'
__license__ = 'Apache 2.0'

from pyon.core.exception import BadRequest
from pyon.ion.directory import Directory

from interface.services.coi.idirectory_service import BaseDirectoryService


class DirectoryService(BaseDirectoryService):
    """
    Provides a directory of services and other resources specific to an Org.
    The directory is backed by a persistent datastore and is system/Org wide.
    """

    def on_init(self):
        self.directory = Directory.get_instance()

        # For easier interactive debugging
        self.dss = None
        self.ds = self.directory.datastore
        try:
            self.dss = self.directory.datastore.server[self.directory.datastore.datastore_name]
        except Exception:
            pass

    def register(self, parent='/', key='', attributes={}):
        return self.directory.register(parent, key, **attributes)

    def unregister(self, parent='/', key=''):
        return self.directory.unregister(parent, key)

    def lookup(self, qualified_key=''):
        return self.directory.lookup(qualified_key)

    def find(self, parent='/', pattern=''):
        raise BadRequest("Not Implemented")<commit_msg>directory service start bug fix<commit_after>#!/usr/bin/env python

__author__ = '<NAME>, <NAME>'
__license__ = 'Apache 2.0'

from pyon.core.exception import BadRequest
from pyon.ion.directory import Directory

from interface.services.coi.idirectory_service import BaseDirectoryService


class DirectoryService(BaseDirectoryService):
    """
    Provides a directory of services and other resources specific to an Org.
    The directory is backed by a persistent datastore and is system/Org wide.
    """

    def on_init(self):
        self.directory = Directory.get_instance()

        # For easier interactive debugging
        self.dss = None
        self.ds = self.directory.dir_store
        try:
            self.dss = self.directory.datastore.server[self.directory.datastore.datastore_name]
        except Exception:
            pass

    def register(self, parent='/', key='', attributes={}):
        return self.directory.register(parent, key, **attributes)

    def unregister(self, parent='/', key=''):
        return self.directory.unregister(parent, key)

    def lookup(self, qualified_key=''):
        return self.directory.lookup(qualified_key)

    def find(self, parent='/', pattern=''):
        raise BadRequest("Not Implemented")
{'fraction_non_alphanumeric': 0.10797743755036261, 'fraction_numerical': 0.0016116035455278, 'mean_word_length': 3.2884283246977546, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1273562', 'n_tokens_mistral': 707, 'n_tokens_neox': 676, 'n_words': 187}