edenscm/mercurial: Replace whitelist/blacklist term

Summary: Replaces usages of whitelist/blacklist with include/exclude/allowed. These terms are more descriptive and less likely to contribute to racial stereotyping. More context: https://fb.workplace.com/groups/sourcecontrolteam/permalink/2926049127516414/

Reviewed By: kulshrax

Differential Revision: D22039297

fbshipit-source-id: ab6e55889e6cf42aed35c856475b2ff92f4cb802
This commit is contained in:
Carolyn Busch 2020-06-15 12:45:26 -07:00 committed by Facebook GitHub Bot
parent e462d84681
commit 990926cbc6
8 changed files with 22 additions and 22 deletions

View File

@ -68,7 +68,7 @@ _ignoreextensions = {
"uncommit",
"upgradegeneraldelta",
}
_blacklist = {"extlib"}
_exclude_list = {"extlib"}
# root of the directory, or installed distribution
@ -393,7 +393,7 @@ def _runextsetup(name, ui):
return True
def loadall(ui, whitelist=None):
def loadall(ui, include_list=None):
result = ui.configitems("extensions")
resultkeys = set([name for name, loc in result])
@ -407,8 +407,8 @@ def loadall(ui, whitelist=None):
result = [(k, v) for (k, v) in result if k not in ALWAYS_ON_EXTENSIONS]
result += [(name, "") for name in sorted(ALWAYS_ON_EXTENSIONS)]
if whitelist is not None:
result = [(k, v) for (k, v) in result if k in whitelist]
if include_list is not None:
result = [(k, v) for (k, v) in result if k in include_list]
newindex = len(_order)
for (name, path) in result:
@ -841,7 +841,7 @@ def disabled():
return dict(
(name, gettext(desc))
for name, desc in pycompat.iteritems(__index__.docs)
if name not in _order and name not in _blacklist
if name not in _order and name not in _exclude_list
)
except (ImportError, AttributeError):
pass
@ -853,7 +853,7 @@ def disabled():
exts = {}
for name, path in pycompat.iteritems(paths):
doc = _disabledhelp(path)
if doc and name not in _blacklist:
if doc and name not in _exclude_list:
exts[name] = doc.splitlines()[0]
return exts
@ -866,7 +866,7 @@ def disabledext(name):
if name in _order: # enabled
return
elif name in _blacklist: # blacklisted
elif name in _exclude_list:
return
else:
return gettext(__index__.docs.get(name))
@ -874,7 +874,7 @@ def disabledext(name):
pass
paths = _disabledpaths()
if name in paths and name not in _blacklist:
if name in paths and name not in _exclude_list:
return _disabledhelp(paths[name])

View File

@ -448,11 +448,11 @@ class mergestate(object):
See the docstring for _readrecordsv2 for why we use 't'."""
# these are the records that all version 2 clients can read
whitelist = "LOF"
allowedkeys = "LOF"
f = self._repo.localvfs(self.statepathv2, "w")
for key, data in records:
assert len(key) == 1
if key not in whitelist:
if key not in allowedkeys:
key, data = "t", "%s%s" % (key, data)
key = encodeutf8(key)
data = encodeutf8(data)

View File

@ -25,7 +25,7 @@ from .pycompat import decodeutf8
def _loadprofiler(ui, profiler):
"""load profiler extension. return profile method, or None on failure"""
extname = profiler
extensions.loadall(ui, whitelist=[extname])
extensions.loadall(ui, include_list=[extname])
try:
mod = extensions.find(extname)
except KeyError:

View File

@ -872,7 +872,7 @@ def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
# * Numerous samples take almost no time, but introduce lots of
# noisy, oft-deep "spines" into a rendered profile.
blacklist = set()
exclude_list = set()
totaltime = data.samples[-1].time - data.samples[0].time
minthreshold = totaltime * minthreshold
maxthreshold = max(totaltime * maxthreshold, clamp)
@ -896,7 +896,7 @@ def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
)
)
else:
blacklist.add(oldidx)
exclude_list.add(oldidx)
# Much fiddling to synthesize correctly(ish) nested begin/end
# events given only stack snapshots.
@ -930,7 +930,7 @@ def write_to_chrome(data, fp, minthreshold=0.005, maxthreshold=0.999):
laststack = collections.deque(stack)
while laststack:
poplast()
events = [s[1] for s in enumerate(samples) if s[0] not in blacklist]
events = [s[1] for s in enumerate(samples) if s[0] not in exclude_list]
frames = collections.OrderedDict((str(k), v) for (k, v) in enumerate(id2stack))
json.dump(dict(traceEvents=events, stackFrames=frames), fp, indent=1)
fp.write("\n")

View File

@ -20,9 +20,9 @@ def _split_what(what):
def include(*what):
"""
Whitelist *what*.
Include *what*.
:param what: What to whitelist.
:param what: What to include.
:type what: :class:`list` of :class:`type` or :class:`attr.Attribute`\ s
:rtype: :class:`callable`
@ -37,9 +37,9 @@ def include(*what):
def exclude(*what):
"""
Blacklist *what*.
Exclude *what*.
:param what: What to blacklist.
:param what: What to exclude.
:type what: :class:`list` of classes or :class:`attr.Attribute`\ s.
:rtype: :class:`callable`

View File

@ -640,7 +640,7 @@ def validatedynamicconfig(ui):
# Configs that are allowed to be different, usually because they must come
# from external configuration (like hotfixes).
whitelist = [
allowedlist = [
("extensions", "hotfix"),
("configs", "autogeneratedynamicconfig"),
("configs", "generationtime"),
@ -653,7 +653,7 @@ def validatedynamicconfig(ui):
if testrcs:
originalrcs.extend(testrcs)
issues = ui._uiconfig._rcfg.ensure_location_supersets(
"hgrc.dynamic", originalrcs, whitelist
"hgrc.dynamic", originalrcs, allowedlist
)
for section, key, dynamic_value, file_value in issues:

View File

@ -98,7 +98,7 @@ def allowednewrequirements(repo):
they weren't present before.
We use a list of allowed requirement additions instead of a list of known
bad additions because the whitelist approach is safer and will prevent
bad additions because the allowed list approach is safer and will prevent
future, unknown requirements from accidentally being added.
"""
return {"dotencode", "fncache", "generaldelta", "storerequirements"}

View File

@ -1309,7 +1309,7 @@ def copyfile(src, dest, hardlink=False, copystat=False, checkambig=False):
unlink(dest)
if hardlink:
# Hardlinks are problematic on CIFS (issue4546), do not allow hardlinks
# unless we are confident that dest is on a whitelisted filesystem.
# unless we are confident that dest is on an allowed filesystem.
fstype = getfstype(os.path.dirname(dest))
if not fscap.getfscap(fstype, fscap.HARDLINK):
hardlink = False