Skip to content

Commit

Permalink
Avoid the terms whitelist and blacklist.
Browse files Browse the repository at this point in the history
Though pretty standard, I can see how the use of these terms could
reasonably be viewed as offensive.
  • Loading branch information
robertwb committed Dec 18, 2020
1 parent 3cc9cdb commit a1dd447
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions Cython/Compiler/AnalysedTreeTransforms.py
Expand Up @@ -10,9 +10,9 @@
class AutoTestDictTransform(ScopeTrackingTransform):
# Handles autotestdict directive

blacklist = ['__cinit__', '__dealloc__', '__richcmp__',
'__nonzero__', '__bool__',
'__len__', '__contains__']
excludelist = ['__cinit__', '__dealloc__', '__richcmp__',
'__nonzero__', '__bool__',
'__len__', '__contains__']

def visit_ModuleNode(self, node):
if node.is_pxd:
Expand Down Expand Up @@ -81,7 +81,7 @@ def visit_FuncDefNode(self, node):
name = node.entry.name
else:
name = node.name
if self.scope_type == 'cclass' and name in self.blacklist:
if self.scope_type == 'cclass' and name in self.excludelist:
return node
if self.scope_type == 'pyclass':
class_name = self.scope_node.name
Expand Down
2 changes: 1 addition & 1 deletion Cython/Compiler/CythonScope.py
Expand Up @@ -125,7 +125,7 @@ def load_cythonscope(self):

view_utility_scope = MemoryView.view_utility_code.declare_in_scope(
self.viewscope, cython_scope=self,
whitelist=MemoryView.view_utility_whitelist)
allowlist=MemoryView.view_utility_allowlist)

# Marks the types as being cython_builtin_type so that they can be
# extended from without Cython attempting to import cython.view
Expand Down
2 changes: 1 addition & 1 deletion Cython/Compiler/MemoryView.py
Expand Up @@ -857,7 +857,7 @@ def use_cython_array_utility_code(env):
copy_contents_new_utility,
ModuleNode.capsule_utility_code],
)
view_utility_whitelist = ('array', 'memoryview', 'array_cwrapper',
view_utility_allowlist = ('array', 'memoryview', 'array_cwrapper',
'generic', 'strided', 'indirect', 'contiguous',
'indirect_contiguous')

Expand Down
4 changes: 2 additions & 2 deletions Cython/Compiler/Symtab.py
Expand Up @@ -387,11 +387,11 @@ def __init__(self, name, outer_scope, parent_scope):
def __deepcopy__(self, memo):
return self

def merge_in(self, other, merge_unused=True, whitelist=None):
def merge_in(self, other, merge_unused=True, allowlist=None):
# Use with care...
entries = []
for name, entry in other.entries.items():
if not whitelist or name in whitelist:
if not allowlist or name in allowlist:
if entry.used or merge_unused:
entries.append((name, entry))

Expand Down
4 changes: 2 additions & 2 deletions Cython/Compiler/UtilityCode.py
Expand Up @@ -199,7 +199,7 @@ def load_as_string(cls, util_code_name, from_file=None, **kwargs):
return util.proto, util.impl # keep line numbers => no lstrip()

def declare_in_scope(self, dest_scope, used=False, cython_scope=None,
whitelist=None):
allowlist=None):
"""
Declare all entries from the utility code in dest_scope. Code will only
be included for used entries. If module_name is given, declare the
Expand All @@ -218,7 +218,7 @@ def declare_in_scope(self, dest_scope, used=False, cython_scope=None,
entry.used = used

original_scope = tree.scope
dest_scope.merge_in(original_scope, merge_unused=True, whitelist=whitelist)
dest_scope.merge_in(original_scope, merge_unused=True, allowlist=allowlist)
tree.scope = dest_scope

for dep in self.requires:
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Expand Up @@ -10,7 +10,7 @@
# Profiled execution.
profile=no

# Add files or directories to the blacklist. They should be base names, not
# Add files or directories to the ignorelist. They should be base names, not
# paths.
ignore=.git,.gitmarker

Expand Down
6 changes: 3 additions & 3 deletions runtests.py
Expand Up @@ -1683,13 +1683,13 @@ def package_matches(dirname):
return dirname not in ("Mac", "Distutils", "Plex", "Tempita")
def file_matches(filename):
filename, ext = os.path.splitext(filename)
blacklist = ['libcython', 'libpython', 'test_libcython_in_gdb',
'TestLibCython']
excludelist = ['libcython', 'libpython', 'test_libcython_in_gdb',
'TestLibCython']
return (ext == '.py' and not
'~' in filename and not
'#' in filename and not
filename.startswith('.') and not
filename in blacklist)
filename in excludelist)
import doctest
for dirpath, dirnames, filenames in os.walk(path):
for dir in list(dirnames):
Expand Down

0 comments on commit a1dd447

Please sign in to comment.