(_arg, top, names)
| 18 | ''' |
| 19 | |
| 20 | def append_example(_arg, top, names): |
| 21 | global out |
| 22 | for name in names: |
| 23 | if not (name.endswith('.py') and name != __file__): |
| 24 | continue |
| 25 | path = os.path.join(top, name)[2:] # strip './' |
| 26 | log.info('-> %s' % path) |
| 27 | data = read(path).strip().decode() |
| 28 | if data[0:3] not in ('"""', "'''"): |
| 29 | log.warning(' Has no docstring!') |
| 30 | continue |
| 31 | try: |
| 32 | i = data.index(data[0:3], 3) |
| 33 | except ValueError: |
| 34 | log.warning(' Docstring is weird') |
| 35 | continue |
| 36 | doc = util.safeeval.const(data[0:i + 3]) |
| 37 | out += '* `%s`\n' % path |
| 38 | out += '```%s```\n' % doc |
| 39 | |
| 40 | for path, dirs, files in os.walk('.', onerror=None): |
| 41 | append_example(dirs, path, sorted(files)) |
no test coverage detected