| Total Complexity | 0 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/local/bin/python |
||
|
|
|||
| 2 | # coding: utf-8 |
||
| 3 | |||
| 4 | from titlesearch.mal import MyAnimeList |
||
| 5 | |||
| 6 | example_title = "Baka to Test" |
||
| 7 | |||
| 8 | print('similar titles for: "{0:s}"'.format(example_title)) |
||
| 9 | results = MyAnimeList.get_similar_titles(example_title) |
||
| 10 | for title in results: |
||
| 11 | print('similarity: {1:.2f}%, title: "{0:s}"'.format(title['title'], float(title['similarity']) * 100)) |
||
| 12 | |||
| 13 | print('') |
||
| 14 | print('alternative titles for: "{0:s}"'.format(example_title)) |
||
| 15 | alternate_titles = MyAnimeList.get_alternative_titles(title=example_title) |
||
| 16 | for language in alternate_titles: |
||
| 17 | for title in alternate_titles[language]: |
||
| 18 | print("[{0:s}]: {1:s}".format(language, title)) |
||
| 19 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.