def add_code_example(self, filepath): description_lines = checker.get_description(file) with open(filepath, 'rb') as lines: code = [ line.rstrip("\n") for line in lines if line.rstrip('\n') not in description_lines and not re.match("#\s[d|D]escription", line) ] self.code = "```python\n%s\n```" % "\n".join(code)
def add_code_example(self, filepath): description_lines = checker.get_description(file) with open(filepath, 'rb') as lines: code = [line.rstrip("\n") for line in lines if line.rstrip('\n') not in description_lines and not re.match("#\s[d|D]escription", line)] self.code = "```python\n%s\n```" % "\n".join(code)
def add_description(self, filepath): self.description = "\n".join([line.lstrip('# ') for line in checker.get_description(file)])
def add_description(self, filepath): self.description = "\n".join( [line.lstrip('# ') for line in checker.get_description(file)])