Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indentation #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions docs/skill-development/introduction/your-first-skill.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@ This method is the _constructor_. It is called when the Skill is first construct
An example `__init__` method might be:

```python
def __init__(self):
super().__init__()
self.already_said_hello = False
self.be_friendly = True
def __init__(self):
super().__init__()
self.already_said_hello = False
self.be_friendly = True
```

#### initialize\(\)

Perform any final setup needed for the skill here. This function is invoked after the skill is fully constructed and registered with the system. Intents will be registered and Skill settings will be available.

```python
def initialize(self):
my_setting = self.settings.get('my_setting')
def initialize(self):
my_setting = self.settings.get('my_setting')
```

#### Intent handlers
Expand All @@ -183,17 +183,17 @@ In our current HelloWorldSkill we can see two different styles.
1. An Adapt handler, triggered by a keyword defined in a `ThankYouKeyword.voc` file.

```python
@intent_handler(IntentBuilder('ThankYouIntent').require('ThankYouKeyword'))
def handle_thank_you_intent(self, message):
self.speak_dialog("welcome")
@intent_handler(IntentBuilder('ThankYouIntent').require('ThankYouKeyword'))
def handle_thank_you_intent(self, message):
self.speak_dialog("welcome")
```

1. A Padatious intent handler, triggered using a list of sample phrases.

```python
@intent_file_handler('HowAreYou.intent')
def handle_how_are_you_intent(self, message):
self.speak_dialog("how.are.you")
@intent_file_handler('HowAreYou.intent')
def handle_how_are_you_intent(self, message):
self.speak_dialog("how.are.you")
```

In both cases, the function receives two _parameters_:
Expand All @@ -210,8 +210,8 @@ You will usually also have a `stop()` method.
This tells Mycroft what your Skill should do if a stop intent is detected.

```python
def stop(self):
pass
def stop(self):
pass
```

In the above code block, the [`pass` statement](https://docs.python.org/3/reference/simple_stmts.html#the-pass-statement) is used as a placeholder; it doesn't actually have any function. However, if the Skill had any active functionality, the stop\(\) method would terminate the functionality, leaving the Skill in a known good state.
Expand All @@ -221,8 +221,8 @@ In the above code block, the [`pass` statement](https://docs.python.org/3/refere
The final code block in our Skill is the `create_skill` function that returns our new Skill:

```python
def create_skill():
return HelloWorldSkill()
def create_skill():
return HelloWorldSkill()
```

This is required by Mycroft and is responsible for actually creating an instance of your Skill that Mycroft can load.
Expand Down