index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | monosans <hsyqixco@protonmail.com> | 2021-07-16 10:42:29 +0300 |
---|---|---|
committer | monosans <hsyqixco@protonmail.com> | 2021-07-16 10:42:29 +0300 |
commit | 3d4f58a04e06ef4bdd023effc52d4cb33b49080c (patch) | |
tree | f57bda983c38061cd363252a845cf2ead046518b | |
parent | 3a4076419418dcdac538c543903cfc6e16bde35f (diff) |
-rw-r--r-- | archinstall/lib/general.py | 5 | ||||
-rw-r--r-- | archinstall/lib/hardware.py | 5 | ||||
-rw-r--r-- | archinstall/lib/mirrors.py | 4 | ||||
-rw-r--r-- | archinstall/lib/packages.py | 15 | ||||
-rw-r--r-- | docs/conf.py | 4 |
diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index b9dc66ab..5200033a 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -98,10 +98,7 @@ class JsonEncoder: elif isinstance(obj, (datetime, date)): return obj.isoformat() elif isinstance(obj, (list, set, tuple)): - r = [] - for item in obj: - r.append(json.loads(json.dumps(item, cls=JSON))) - return r + return [json.loads(json.dumps(item, cls=JSON)) for item in obj] else: return obj diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index a63155f5..b1ac516d 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -131,7 +131,10 @@ def product_name() -> Optional[str]: def mem_info(): # This implementation is from https://stackoverflow.com/a/28161352 - return dict((i.split()[0].rstrip(':'), int(i.split()[1])) for i in open('/proc/meminfo').readlines()) + return { + i.split()[0].rstrip(':'): int(i.split()[1]) + for i in open('/proc/meminfo').readlines() + } def mem_available() -> Optional[str]: diff --git a/archinstall/lib/mirrors.py b/archinstall/lib/mirrors.py index 95fb5ac6..1b62a61b 100644 --- a/archinstall/lib/mirrors.py +++ b/archinstall/lib/mirrors.py @@ -59,9 +59,7 @@ def filter_mirrors_by_region(regions, destination='/etc/pacman.d/mirrorlist', so :param regions: A series of country codes separated by `,`. For instance `SE,US` for sweden and United States. :type regions: str """ - region_list = [] - for region in regions.split(','): - region_list.append(f'country={region}') + region_list = [f'country={region}' for region in regions.split(',')] response = urllib.request.urlopen(urllib.request.Request(f"https://archlinux.org/mirrorlist/?{'&'.join(region_list)}&protocol=https&protocol=http&ip_version=4&ip_version=6&use_mirror_status=on'", headers={'User-Agent': 'ArchInstall'})) new_list = response.read().replace(b"#Server", b"Server") diff --git a/archinstall/lib/packages.py b/archinstall/lib/packages.py index 0ea195d2..0178d257 100644 --- a/archinstall/lib/packages.py +++ b/archinstall/lib/packages.py @@ -46,10 +46,7 @@ def find_packages(*names): The function itself is rather slow, so consider not sending to many packages to the search query. """ - result = {} - for package in names: - result[package] = find_package(package) - return result + return {package: find_package(package) for package in names} def validate_package_list(packages: list): @@ -57,11 +54,11 @@ def validate_package_list(packages: list): Validates a list of given packages. Raises `RequirementError` if one or more packages are not found. """ - invalid_packages = [] - for package in packages: - if not find_package(package)['results'] and not find_group(package): - invalid_packages.append(package) - + invalid_packages = [ + package + for package in packages + if not find_package(package)['results'] and not find_group(package) + ] if invalid_packages: raise RequirementError(f"Invalid package names: {invalid_packages}") diff --git a/docs/conf.py b/docs/conf.py index add1c5e7..33aeeae8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -7,9 +7,7 @@ sys.path.insert(0, os.path.abspath('..')) def process_docstring(app, what, name, obj, options, lines): spaces_pat = re.compile(r"( {8})") - ll = [] - for line in lines: - ll.append(spaces_pat.sub(" ", line)) + ll = [spaces_pat.sub(" ", line) for line in lines] lines[:] = ll |