Skip to content

Commit

Permalink
Merge pull request #1 from Morilli/fix-syntaxwarning-re
Browse files Browse the repository at this point in the history
Fix python SyntaxWarnings on non-raw regex strings
  • Loading branch information
Q2297045667 authored Oct 13, 2024
2 parents 599e027 + d584a44 commit dcae3ff
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion scripts/extractWSA.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ def __repr__(self):
elif g.filename == 'AppxManifest.xml':
g.filename = f'resources.{name}.xml'
l.extract(g, xmldir)
elif re.search(u'Images/.+\.png', g.filename):
elif re.search(r'Images/.+\.png', g.filename):
l.extract(g, archdir)
4 changes: 2 additions & 2 deletions scripts/generateGappsLink.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def __call__(self, r):
download_files = {}
assets = json_data["assets"]
for asset in assets:
if re.match(f'gapps.*{release}.*\.rc$', asset["name"]):
if re.match(rf'gapps.*{release}.*\.rc$', asset["name"]):
download_files[asset["name"]] = asset["browser_download_url"]
elif re.match(f'gapps.*{release}.*{abi_map[arch]}.*\.img$', asset["name"]):
elif re.match(rf'gapps.*{release}.*{abi_map[arch]}.*\.img$', asset["name"]):
download_files[asset["name"]] = asset["browser_download_url"]
with open(download_dir/tempScript, 'a') as f:
for key, value in download_files.items():
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateKernelSULink.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __repr__(self):
assets = json_data["assets"]
for asset in assets:
asset_name = asset["name"]
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset_name) and asset["content_type"] == "application/zip":
if re.match(rf'kernel-WSA-{abi_map[arch]}-{kernelVersion}.*\.zip$', asset_name) and asset["content_type"] == "application/zip":
tmp_kernel_ver = re.search(
u'\d{1}.\d{1,}.\d{1,}.\d{1,}', asset_name.split("-")[3]).group()
if (kernel_ver == 0):
Expand All @@ -76,7 +76,7 @@ def __repr__(self):
kernel_ver = tmp_kernel_ver
print(f"Kernel version: {kernel_ver}", flush=True)
for asset in assets:
if re.match(f'kernel-WSA-{abi_map[arch]}-{kernel_ver}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
if re.match(rf'kernel-WSA-{abi_map[arch]}-{kernel_ver}.*\.zip$', asset["name"]) and asset["content_type"] == "application/zip":
link = asset["browser_download_url"]
break
if link == "":
Expand Down
14 changes: 7 additions & 7 deletions scripts/generateWSALinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,26 +145,26 @@ def send_req(i, v, out_file_name):
threads = []
wsa_build_ver = 0
for filename, values in identities.items():
if re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
if re.match(rf"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
tmp_wsa_build_ver = re.search(
u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
if (wsa_build_ver == 0):
wsa_build_ver = tmp_wsa_build_ver
elif version.parse(wsa_build_ver) < version.parse(tmp_wsa_build_ver):
wsa_build_ver = tmp_wsa_build_ver
for filename, values in identities.items():
if re.match(f"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename):
if re.match(rf"Microsoft\.UI\.Xaml\..*_{arch}_.*\.appx", filename):
out_file_name = f"{values[1]}_{arch}.appx"
out_file = download_dir / out_file_name
elif re.match(f"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename):
elif re.match(rf"Microsoft\.VCLibs\..+\.UWPDesktop_.*_{arch}_.*\.appx", filename):
out_file_name = f"{values[1]}_{arch}.appx"
out_file = download_dir / out_file_name
elif re.match(f"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename):
elif re.match(rf"Microsoft\.VCLibs\..+_.*_{arch}_.*\.appx", filename):
out_file_name = f"{values[1]}_{arch}.appx"
out_file = download_dir / out_file_name
elif not skip_wsa_download and re.match(f"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
elif not skip_wsa_download and re.match(rf"MicrosoftCorporationII\.WindowsSubsystemForAndroid_.*\.msixbundle", filename):
tmp_wsa_build_ver = re.search(
u'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
r'\d{4}.\d{5}.\d{1,}.\d{1,}', filename).group()
if (wsa_build_ver != tmp_wsa_build_ver):
continue
version_splitted = wsa_build_ver.split(".")
Expand Down

0 comments on commit dcae3ff

Please sign in to comment.