From 428270c7470de0a900820fb2ce9063dde80d938c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Althviz=20Mor=C3=A9?= <16781833+dalthviz@users.noreply.github.com> Date: Wed, 27 Mar 2024 16:56:51 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Carlos Cordoba --- setupbase.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/setupbase.py b/setupbase.py index 442b4d6..a59fe8f 100644 --- a/setupbase.py +++ b/setupbase.py @@ -268,7 +268,9 @@ def initialize_options(self): def finalize_options(self): """Validate the command options.""" - assert bool(self.msc_version), 'Codicons version is mandatory for this command.' + assert bool( + self.msc_version + ), 'Codicons version is mandatory for this command.' def __print(self, msg): """Shortcut for printing with the setuptools logger.""" @@ -278,15 +280,25 @@ def run(self): """Run command.""" # Download .json to a temporary path: - download_url_json = self.DOWNLOAD_URL_JSON.format(version=self.msc_version) + download_url_json = self.DOWNLOAD_URL_JSON.format( + version=self.msc_version + ) package_json = urlopen(download_url_json) package_info = json.load(package_json) package_version = package_info['version'] - assert self.msc_version == package_version, 'Codicons version does not match with `package.json` info. %s and %s' % (self.msc_version, package_version) + assert self.msc_version == package_version, ( + "Codicons version does not match with `package.json` info. %s and %s" + % ( + self.msc_version, + package_version, + ) + ) self.__print('Will download codicons version: %s' % package_version) # Download .css: - donwload_url_css = self.DOWNLOAD_URL_CSS.format(version=self.msc_version) + donwload_url_css = self.DOWNLOAD_URL_CSS.format( + version=self.msc_version + ) req = urlopen(donwload_url_css) if req.status != 200: raise Exception('Failed to download CSS Charmap') @@ -311,7 +323,9 @@ def run(self): json.dump(charmap, f, indent=4, sort_keys=True) # Dump a .ttf font file: - download_url_ttf = self.DOWNLOAD_URL_TTF.format(version=self.msc_version) + download_url_ttf = self.DOWNLOAD_URL_TTF.format( + version=self.msc_version + ) ttf_path = self.TTF_PATH.format(version=package_version) with open(ttf_path, 'wb+') as ttfFile: self.__print(