mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-19 23:09:55 +08:00
Use ‘exclude list’ instead of ‘blacklist’ (#4297)
This replaces all uses of ‘blacklist’ with ‘exclude list’. Benefits: - It is racially neutral terminology; see e.g. [1] - It makes the meaning more clear. In fact, with the popular Python autoformatter called ‘black’, also used by this project, files can be ‘blackened’ which is something completely different from them being on a blacklist. [1] https://chromium.googlesource.com/chromium/src/+/master/styleguide/inclusive_code.md#racially-neutral
This commit is contained in:
committed by
GitHub
parent
b8f6d5fc54
commit
3efb675dba
+7
-7
@@ -39,9 +39,9 @@ def log(args, *varargs):
|
||||
print(*varargs)
|
||||
|
||||
|
||||
def match(fn, args, blacklist):
|
||||
if blacklist.match(fn):
|
||||
log(args, fn, 'exluded by blacklist')
|
||||
def match(fn, args, exclude_list):
|
||||
if exclude_list.match(fn):
|
||||
log(args, fn, 'exluded by exclude list')
|
||||
return False
|
||||
if not args.filter and not args.exclude:
|
||||
log(args, fn, 'accept by default')
|
||||
@@ -80,8 +80,8 @@ def libpath(major, minor):
|
||||
def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), "mypy_blacklist.txt")) as f:
|
||||
blacklist = re.compile("(%s)$" % "|".join(
|
||||
with open(os.path.join(os.path.dirname(__file__), "mypy_exclude_list.txt")) as f:
|
||||
exclude_list = re.compile("(%s)$" % "|".join(
|
||||
re.findall(r"^\s*([^\s#]+)\s*(?:#.*)?$", f.read(), flags=re.M)))
|
||||
|
||||
try:
|
||||
@@ -112,7 +112,7 @@ def main():
|
||||
if mod in seen or mod.startswith('.'):
|
||||
continue
|
||||
if ext in ['.pyi', '.py']:
|
||||
if match(full, args, blacklist):
|
||||
if match(full, args, exclude_list):
|
||||
seen.add(mod)
|
||||
files.append(full)
|
||||
elif (os.path.isfile(os.path.join(full, '__init__.pyi')) or
|
||||
@@ -124,7 +124,7 @@ def main():
|
||||
m, x = os.path.splitext(f)
|
||||
if x in ['.pyi', '.py']:
|
||||
fn = os.path.join(r, f)
|
||||
if match(fn, args, blacklist):
|
||||
if match(fn, args, exclude_list):
|
||||
seen.add(mod)
|
||||
files.append(fn)
|
||||
if files:
|
||||
|
||||
Reference in New Issue
Block a user