当前位置: 首页>>代码示例>>Python>>正文


Python LOG.debug方法代码示例

本文整理汇总了Python中mycroft.util.log.LOG.debug方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.debug方法的具体用法?Python LOG.debug怎么用?Python LOG.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mycroft.util.log.LOG的用法示例。


在下文中一共展示了LOG.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
    def initialize(self):
        """
        Initialization function to be implemented by all Skills.

        Usually used to create intents rules and register them.
        """
        LOG.debug("No initialize function implemented")
开发者ID:antlarr,项目名称:mycroft-core,代码行数:9,代码来源:core.py

示例2: __insert_new_namespace

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
    def __insert_new_namespace(self, namespace, pages):
        """ Insert new namespace and pages.

        This first sends a message adding a new namespace at the
        highest priority (position 0 in the namespace stack)

        Args:
            namespace (str):  The skill namespace to create
            pages (str):      Pages to insert (name matches QML)
        """
        LOG.debug("Inserting new namespace")
        self.send({"type": "mycroft.session.list.insert",
                   "namespace": "mycroft.system.active_skills",
                   "position": 0,
                   "data": [{"skill_id": namespace}]
                   })

        # Load any already stored Data
        data = self.datastore.get(namespace, {})
        for key in data:
            msg = {"type": "mycroft.session.set",
                   "namespace": namespace,
                   "data": {key: data[key]}}
            self.send(msg)

        LOG.debug("Inserting new page")
        self.send({"type": "mycroft.gui.list.insert",
                   "namespace": namespace,
                   "position": 0,
                   "data": [{"url": p} for p in pages]
                   })
        # Make sure the local copy is updated
        self.loaded.insert(0, Namespace(namespace, pages))
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:35,代码来源:base.py

示例3: execute

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
    def execute(self, sentence, ident=None):
        """
            Convert sentence to speech, preprocessing out unsupported ssml

            The method caches results if possible using the hash of the
            sentence.

            Args:
                sentence:   Sentence to be spoken
                ident:      Id reference to current interaction
        """
        sentence = self.validate_ssml(sentence)

        create_signal("isSpeaking")
        if self.phonetic_spelling:
            for word in re.findall(r"[\w']+", sentence):
                if word.lower() in self.spellings:
                    sentence = sentence.replace(word,
                                                self.spellings[word.lower()])

        key = str(hashlib.md5(sentence.encode('utf-8', 'ignore')).hexdigest())
        wav_file = os.path.join(mycroft.util.get_cache_directory("tts"),
                                key + '.' + self.audio_ext)

        if os.path.exists(wav_file):
            LOG.debug("TTS cache hit")
            phonemes = self.load_phonemes(key)
        else:
            wav_file, phonemes = self.get_tts(sentence, wav_file)
            if phonemes:
                self.save_phonemes(key, phonemes)

        vis = self.visime(phonemes)
        self.queue.put((self.audio_ext, wav_file, vis, ident))
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:36,代码来源:__init__.py

示例4: _load_config

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
    def _load_config(self):
        """
            Load configuration parameters from configuration
        """
        config = Configuration.get()
        self.config_core = config
        self._config_hash = hash(str(config))
        self.lang = config.get('lang')
        self.config = config.get('listener')
        rate = self.config.get('sample_rate')

        device_index = self.config.get('device_index')
        device_name = self.config.get('device_name')
        if not device_index and device_name:
            device_index = find_input_device(device_name)

        LOG.debug('Using microphone (None = default): '+str(device_index))

        self.microphone = MutableMicrophone(device_index, rate,
                                            mute=self.mute_calls > 0)
        # TODO:19.02 - channels are not been used, remove from mycroft.conf
        #              and from code.
        self.microphone.CHANNELS = self.config.get('channels')
        self.wakeword_recognizer = self.create_wake_word_recognizer()
        # TODO - localization
        self.wakeup_recognizer = self.create_wakeup_recognizer()
        self.responsive_recognizer = ResponsiveRecognizer(
            self.wakeword_recognizer)
        self.state = RecognizerLoopState()
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:31,代码来源:listener.py

示例5: get

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
def get(phrase, lang=None, context=None):
    """
    Looks up a resource file for the given phrase.  If no file
    is found, the requested phrase is returned as the string.
    This will use the default language for translations.

    Args:
        phrase (str): resource phrase to retrieve/translate
        lang (str): the language to use
        context (dict): values to be inserted into the string

    Returns:
        str: a randomized and/or translated version of the phrase
    """

    if not lang:
        from mycroft.configuration import Configuration
        lang = Configuration.get().get("lang")

    filename = "text/" + lang.lower() + "/" + phrase + ".dialog"
    template = resolve_resource_file(filename)
    if not template:
        LOG.debug("Resource file not found: " + filename)
        return phrase

    stache = MustacheDialogRenderer()
    stache.load_template_file("template", template)
    if not context:
        context = {}
    return stache.render("template", context)
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:32,代码来源:__init__.py

示例6: transcribe

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
 def transcribe(self, audio):
     text = None
     try:
         # Invoke the STT engine on the audio clip
         text = self.stt.execute(audio).lower().strip()
         LOG.debug("STT: " + text)
     except sr.RequestError as e:
         LOG.error("Could not request Speech Recognition {0}".format(e))
     except ConnectionError as e:
         LOG.error("Connection Error: {0}".format(e))
         self.emitter.emit("recognizer_loop:no_internet")
     except HTTPError as e:
         if e.response.status_code == 401:
             text = "pair my device"  # phrase to start the pairing process
             LOG.warning("Access Denied at mycroft.ai")
     except Exception as e:
         LOG.error(e)
         LOG.error("Speech Recognition could not understand audio")
     if text:
         # STT succeeded, send the transcribed speech on for processing
         payload = {
             'utterances': [text],
             'lang': self.stt.lang,
             'session': SessionManager.get().session_id
         }
         self.emitter.emit("recognizer_loop:utterance", payload)
         self.metrics.attr('utterances', [text])
开发者ID:aatchison,项目名称:mycroft-core,代码行数:29,代码来源:listener.py

示例7: transcribe

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
    def transcribe(self, audio):
        try:
            # Invoke the STT engine on the audio clip
            text = self.stt.execute(audio).lower().strip()
            LOG.debug("STT: " + text)
            return text
        except sr.RequestError as e:
            LOG.error("Could not request Speech Recognition {0}".format(e))
        except ConnectionError as e:
            LOG.error("Connection Error: {0}".format(e))

            self.emitter.emit("recognizer_loop:no_internet")
        except HTTPError as e:
            if e.response.status_code == 401:
                LOG.warning("Access Denied at mycroft.ai")
                return "pair my device"  # phrase to start the pairing process
            else:
                LOG.error(e.__class__.__name__ + ': ' + str(e))
        except RequestException as e:
            LOG.error(e.__class__.__name__ + ': ' + str(e))
        except Exception as e:
            self.emitter.emit('recognizer_loop:speech.recognition.unknown')
            if isinstance(e, IndexError):
                LOG.info('no words were transcribed')
            else:
                LOG.error(e)
            LOG.error("Speech Recognition could not understand audio")
            return None
        if connected():
            dialog_name = 'backend.down'
        else:
            dialog_name = 'not connected to the internet'
        self.emitter.emit('speak', {'utterance': dialog.get(dialog_name)})
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:35,代码来源:listener.py

示例8: _load

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
 def _load():
     LOG.debug('Loading identity')
     try:
         with FileSystemAccess('identity').open('identity2.json', 'r') as f:
             IdentityManager.__identity = DeviceIdentity(**json.load(f))
     except Exception:
         IdentityManager.__identity = DeviceIdentity()
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:9,代码来源:__init__.py

示例9: main

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
def main():
    # Read the system configuration
    system_config = LocalConf(SYSTEM_CONFIG)
    platform = system_config.get("enclosure", {}).get("platform")

    if platform == "mycroft_mark_1":
        LOG.debug("Creating Mark I Enclosure")
        from mycroft.client.enclosure.mark1 import EnclosureMark1
        enclosure = EnclosureMark1()
    elif platform == "mycroft_mark_2":
        LOG.debug("Creating Mark II Enclosure")
        from mycroft.client.enclosure.mark2 import EnclosureMark2
        enclosure = EnclosureMark2()
    else:
        LOG.debug("Creating generic enclosure, platform='{}'".format(platform))

        # TODO: Mechanism to load from elsewhere.  E.g. read a script path from
        # the mycroft.conf, then load/launch that script.
        from mycroft.client.enclosure.generic import EnclosureGeneric
        enclosure = EnclosureGeneric()

    if enclosure:
        try:
            LOG.debug("Enclosure started!")
            enclosure.run()
        except Exception as e:
            print(e)
        finally:
            sys.exit()
    else:
        LOG.debug("No enclosure available for this hardware, running headless")
开发者ID:Dark5ide,项目名称:mycroft-core,代码行数:33,代码来源:__main__.py

示例10: _upload_file

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
    def _upload_file(self, filename):
        server = self.upload_config['server']
        keyfile = resolve_resource_file('wakeword_rsa')
        userfile = expanduser('~/.mycroft/wakeword_rsa')

        if not isfile(userfile):
            shutil.copy2(keyfile, userfile)
            os.chmod(userfile, 0o600)
            keyfile = userfile

        address = self.upload_config['user'] + '@' + \
            server + ':' + self.upload_config['folder']

        self.upload_lock.acquire()
        try:
            self.filenames_to_upload.append(filename)
            for i, fn in enumerate(self.filenames_to_upload):
                LOG.debug('Uploading ' + fn + '...')
                os.chmod(fn, 0o666)
                cmd = 'scp -o StrictHostKeyChecking=no -P ' + \
                      str(self.upload_config['port']) + ' -i ' + \
                      keyfile + ' ' + fn + ' ' + address
                if os.system(cmd) == 0:
                    del self.filenames_to_upload[i]
                    os.remove(fn)
                else:
                    LOG.debug('Could not upload ' + fn + ' to ' + server)
        finally:
            self.upload_lock.release()
开发者ID:aatchison,项目名称:mycroft-core,代码行数:31,代码来源:mic.py

示例11: set_active

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
def set_active(skill_name):
    """ Sets skill name as active in the display Manager
        args:
            string: skill_name
    """
    _write_data({"active_skill": skill_name})
    LOG.debug("Setting active skill to " + skill_name)
开发者ID:aatchison,项目名称:mycroft-core,代码行数:9,代码来源:display_manager.py

示例12: _update

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
 def _update(login=None):
     LOG.debug('Updaing identity')
     login = login or {}
     expiration = login.get("expiration", 0)
     IdentityManager.__identity.uuid = login.get("uuid", "")
     IdentityManager.__identity.access = login.get("accessToken", "")
     IdentityManager.__identity.refresh = login.get("refreshToken", "")
     IdentityManager.__identity.expires_at = time.time() + expiration
开发者ID:seymour-bootay,项目名称:mycroft-core,代码行数:10,代码来源:__init__.py

示例13: __init__

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
 def __init__(self, name, emitter=None, basedir=None):
     super(ScheduledCRUDSkill, self).__init__(name, emitter)
     self.data = {}
     self.repeat_data = {}
     if basedir:
         LOG.debug('basedir argument is no longer required and is ' +
                   'depreciated.')
         self.basedir = basedir
开发者ID:Ceda-EI,项目名称:mycroft-core,代码行数:10,代码来源:scheduled_skills.py

示例14: on_connection_closed

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
 def on_connection_closed(self, socket):
     # Self-destruct (can't reconnect on the same port)
     LOG.debug("on_connection_closed")
     if self.socket:
         LOG.debug("Server stopped: {}".format(self.socket))
         # TODO: How to stop the webapp for this socket?
         # self.socket.stop()
         self.socket = None
     self.callback_disconnect(self.id)
开发者ID:MycroftAI,项目名称:mycroft-core,代码行数:11,代码来源:base.py

示例15: echo

# 需要导入模块: from mycroft.util.log import LOG [as 别名]
# 或者: from mycroft.util.log.LOG import debug [as 别名]
 def echo(message):
     try:
         _message = json.loads(message)
         if 'mycroft.audio.service' not in _message.get('type'):
             return
         message = json.dumps(_message)
     except:
         pass
     LOG.debug(message)
开发者ID:antlarr,项目名称:mycroft-core,代码行数:11,代码来源:main.py


注:本文中的mycroft.util.log.LOG.debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。