(self)
| 50 | |
| 51 | @property |
| 52 | def commit_date(self): |
| 53 | if self._commit_date is None: |
| 54 | commit_url = "https://api.github.com/repos/{}/commits".format( |
| 55 | self.repo_full_name) |
| 56 | params = { |
| 57 | "per_page": 1, |
| 58 | "path": self.path |
| 59 | } |
| 60 | try: |
| 61 | |
| 62 | commit_info = github_client(commit_url, params=params) |
| 63 | assert commit_info |
| 64 | |
| 65 | # 先保存为字符串吧 |
| 66 | self._commit_date = str(parse_datetime(commit_info[0]["commit"]["author"]["date"])) |
| 67 | except Exception as e: |
| 68 | logger.info("error on {}, {}".format(commit_url, self.path)) |
| 69 | logger.exception(e) |
| 70 | self._commit_date = "" |
| 71 | |
| 72 | return self._commit_date |
| 73 | |
| 74 | def human_content(self, keyword): |
| 75 | lines = self.content.split("\n") |
nothing calls this directly
no test coverage detected