Remove remote if it is not consistent with METADATA Change-Id: I3166b87445dfdd5f3966086e32f71e7f6e69e730
diff --git a/github_archive_updater.py b/github_archive_updater.py index d5a4e29..cc3840f 100644 --- a/github_archive_updater.py +++ b/github_archive_updater.py
@@ -102,9 +102,9 @@ ] return (data[self.VERSION_FIELD], supported_assets) - def _fetch_latest_tag(self): + def _fetch_latest_tag(self) -> Tuple[str, List[str]]: page = 1 - tags = [] + tags: List[str] = [] # fetches at most 20 pages. for page in range(1, 21): # Sleeps 10s to avoid rate limit. @@ -119,8 +119,8 @@ def _fetch_latest_version(self) -> None: """Checks upstream and gets the latest release tag.""" - self._new_ver, urls = self._fetch_latest_release( - ) or self._fetch_latest_tag() + self._new_ver, urls = (self._fetch_latest_release() + or self._fetch_latest_tag()) # Adds source code urls. urls.append('https://github.com/{}/{}/archive/{}.tar.gz'.format( @@ -137,9 +137,11 @@ with urllib.request.urlopen(url) as request: data = json.loads(request.read().decode()) self._new_ver = data['sha'] - self._new_url.value = f'https://github.com/{self.owner}/{self.repo}/archive/{self._new_ver}.zip' + self._new_url.value = ( + f'https://github.com/{self.owner}/{self.repo}/archive/{self._new_ver}.zip' + ) - def check(self): + def check(self) -> None: """Checks update for package. Returns True if a new version is available. @@ -149,14 +151,15 @@ else: self._fetch_latest_version() - def update(self): + def update(self) -> None: """Updates the package. Has to call check() before this function. """ temporary_dir = None try: - temporary_dir = archive_utils.download_and_extract(self._new_url.value) + temporary_dir = archive_utils.download_and_extract( + self._new_url.value) package_dir = archive_utils.find_archive_root(temporary_dir) updater_utils.replace_package(package_dir, self._proj_path) finally: