@talking.alias('sum') def another(*args, to_float: bool = False, double=None, additional_add: int = None): """ my sum command """ # using type annotation in keyword argument makes the argument # cast to the specific type. ret = sum(map(int, args)) if double: ret = ret * 2 if to_float: ret = float(ret) if additional_add: ret += additional_add return ret if __name__ == '__main__': talking.on()
with open(path.join(dir, 'index.rst'), 'w', encoding='utf8') as w, \ open(path.join(dir, 'index.rst.template'), 'r', encoding='utf8') as r: write = w.write write(r.read()) write('\n') for each in dy: title = each['title'] where = each['where'] where = "./" + "/".join(where.split('.')) + '.html' time = each['release_date'] keywords = each['keywords'] write('\n') write(card(title=title, link=where, time=time, keywords=keywords)) os.system('sphinx-build -b html ./src ./') @cmd def clean(): for each in Path('.').list_dir(): filename = each.relative() if filename.startswith('.') or filename in ('src', 'manage.py', '_config.yml', 'favicon.ico'): continue each.delete() if __name__ == '__main__': cmd.on()