()
| 197 | |
| 198 | |
| 199 | def main(): |
| 200 | # Get all the information we need out of the README files in the samples. |
| 201 | samples, keyword_set = scan_readme_files("./samples") |
| 202 | |
| 203 | # Now build a wiki page with all that information. Accumulate all the |
| 204 | # information as string to be concatenated when were done. |
| 205 | page = ['<wiki:toc max_depth="3" />\n= Samples By API =\n'] |
| 206 | |
| 207 | # All the samples, grouped by API. |
| 208 | current_api = None |
| 209 | for api, keywords, dirname, desc, uri in samples: |
| 210 | context = context_from_sample(api, keywords, dirname, desc, uri) |
| 211 | if context is None: |
| 212 | continue |
| 213 | if current_api != api: |
| 214 | page.append( |
| 215 | """ |
| 216 | === %(api_icon)s %(api_name)s === |
| 217 | |
| 218 | %(api_desc)s |
| 219 | |
| 220 | Documentation for the %(api_name)s in [https://google-api-client-libraries.appspot.com/documentation/%(api)s/%(version)s/python/latest/ PyDoc] |
| 221 | |
| 222 | """ |
| 223 | % context |
| 224 | ) |
| 225 | current_api = api |
| 226 | |
| 227 | page.append("|| [%(uri)s %(dir)s] || %(desc)s ||\n" % context) |
| 228 | |
| 229 | # Now group the samples by keywords. |
| 230 | for keyword, keyword_name in KEYWORDS.iteritems(): |
| 231 | if keyword not in keyword_set: |
| 232 | continue |
| 233 | page.append("\n= %s Samples =\n\n" % keyword_name) |
| 234 | page.append("<table border=1 cellspacing=0 cellpadding=8px>\n") |
| 235 | for _, keywords, dirname, desc, uri in samples: |
| 236 | context = keyword_context_from_sample(keywords, dirname, desc, uri) |
| 237 | if keyword not in keywords: |
| 238 | continue |
| 239 | page.append( |
| 240 | """ |
| 241 | <tr> |
| 242 | <td>[%(uri)s %(dir)s] </td> |
| 243 | <td> %(desc)s </td> |
| 244 | </tr>""" |
| 245 | % context |
| 246 | ) |
| 247 | page.append("</table>\n") |
| 248 | |
| 249 | print("".join(page)) |
| 250 | |
| 251 | |
| 252 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…