licenses = ["CC0", "CC BY", "CC BY-SA"]
if re_match.group('license'):
print(re_match.group('license'))
for license in licenses:
print(license)
if not any(license in re_match.group('license') for license in licenses):
return
The string to be matched:
"Testing" by Tester (CC BY SA)
The Prints:
CC BY SA
CC0
CC BY
CC BY-SA
any(license
is always true licenses = ["CC0", "CC BY", "CC BY-SA"]
if re_match.group('license'):
print(re_match.group('license'))
for license in licenses:
print(license)
if not any(license in re_match.group('license') for license in licenses):
return
The string to be matched:
"Testing" by Tester (CC BY SA)
The Prints:
CC BY SA
CC0
CC BY
CC BY-SA
re_match.group("license") in licenses
any(license
is always true import re
def abc(string) -> bool:
regex = re.compile(r'^\((?P<license>.{3,8})\)$')
re_match = regex.match(string)
licenses = ["CC0", "CC BY", "CC BY-SA"]
if re_match.group('license'):
if not any(license in re_match.group('license') for license in licenses):
return False
return True
result = abc("(CC SA-BY)")
print(result)
Result is FalseMsg.AddString("", 0); // HTTPS map download URL
import re
def abc(string) -> bool:
regex = re.compile(r'^\((?P<license>.{3,8})\)$')
re_match = regex.match(string)
licenses = ["CC0", "CC BY", "CC BY-SA"]
if re_match.group('license'):
if not any(license in re_match.group('license') for license in licenses):
return False
return True
result = abc("(CC SA-BY)")
print(result)
Result is False re_match.group("license") in licenses
re_match.group("license") in licenses
any
is a function that turns a list of booleans into a booleanCC0
, CC BY
or CC BY-SA
appear in your license stringABCC0DEF
will also be accepted by the checkIOHANDLE
effectively FILE *
on all systems again. We still use CreateFileW
to open a HANDLE
initially so we can specify the necessary flag so the file can be moved/deleted while open, which we can't do with the FILE *
based fopen
functions on Windows. This brings back the automatic I/O buffering on Windows, causing significantly less system calls when saving files. Closes #7226.