Skip to content

Commit

Permalink
Add __name__ guards on usage examples
Browse files Browse the repository at this point in the history
Also to account for the multiprocessing behaviour that happens when the code tries to spawn processes on Windows but can result in an infinite loop
  • Loading branch information
daniel-tran committed Jan 14, 2021
1 parent 593e9b1 commit 57451f9
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ The Web Extractor is used to obtain passage information directly from [Bible Gat
```python
from meaningless import WebExtractor

bible = WebExtractor()
passage = bible.get_passage('Ecclesiastes', 1, 2)
print(passage)
if __name__ == '__main__':
bible = WebExtractor()
passage = bible.get_passage('Ecclesiastes', 1, 2)
print(passage)
```
Output:
```
Expand All @@ -44,8 +45,9 @@ The YAML Downloader is which formats passages obtained from the Bible Gateway we
```python
from meaningless import YAMLDownloader

downloader = YAMLDownloader()
downloader.download_passage('Ecclesiastes', 1, 2)
if __name__ == '__main__':
downloader = YAMLDownloader()
downloader.download_passage('Ecclesiastes', 1, 2)
```
Output:

Expand All @@ -65,9 +67,10 @@ The YAML Extractor uses the generated files from the YAML Downloader to find pas
```python
from meaningless import YAMLExtractor

bible = YAMLExtractor()
passage = bible.get_passage('Ecclesiastes', 1, 2)
print(passage)
if __name__ == '__main__':
bible = YAMLExtractor()
passage = bible.get_passage('Ecclesiastes', 1, 2)
print(passage)
```
Output:

Expand All @@ -84,11 +87,12 @@ The YAML File Interface is a set of helper methods used to read and write YAML f
```python
from meaningless import YAMLDownloader, yaml_file_interface

downloader = YAMLDownloader()
downloader.download_passage('Ecclesiastes', 1, 2)
bible = yaml_file_interface.read('./Ecclesiastes.yaml')
bible['Info']['Customised?'] = True
yaml_file_interface.write('./Ecclesiastes.yaml', bible)
if __name__ == '__main__':
downloader = YAMLDownloader()
downloader.download_passage('Ecclesiastes', 1, 2)
bible = yaml_file_interface.read('./Ecclesiastes.yaml')
bible['Info']['Customised?'] = True
yaml_file_interface.write('./Ecclesiastes.yaml', bible)
```
Output:

Expand Down

0 comments on commit 57451f9

Please sign in to comment.