"docs/git@developer.sourcefind.cn:change/sglang.git" did not exist on "a5e0defb5a560a6d42882008c1dd8a739002ab7d"
Commit cc9357f9 authored by Hongkun Yu's avatar Hongkun Yu Committed by A. Unique TensorFlower
Browse files

Respectful code cleanup

PiperOrigin-RevId: 353315689
parent 624ac92d
...@@ -30,7 +30,7 @@ from official.modeling.hyperparams import params_dict ...@@ -30,7 +30,7 @@ from official.modeling.hyperparams import params_dict
class Config(params_dict.ParamsDict): class Config(params_dict.ParamsDict):
"""The base configuration class that supports YAML/JSON based overrides. """The base configuration class that supports YAML/JSON based overrides.
* It recursively enforces a whitelist of basic types and container types, so * It recursively enforces a allowlist of basic types and container types, so
it avoids surprises with copy and reuse caused by unanticipated types. it avoids surprises with copy and reuse caused by unanticipated types.
* It converts dict to Config even within sequences, * It converts dict to Config even within sequences,
e.g. for config = Config({'key': [([{'a': 42}],)]), e.g. for config = Config({'key': [([{'a': 42}],)]),
......
...@@ -34,10 +34,10 @@ do_pylint() { ...@@ -34,10 +34,10 @@ do_pylint() {
# --incremental Performs check on only the python files changed in the # --incremental Performs check on only the python files changed in the
# last non-merge git commit. # last non-merge git commit.
# Use this list to whitelist pylint errors # Use this list to ALLOWLIST pylint errors
ERROR_WHITELIST="" ERROR_ALLOWLIST=""
echo "ERROR_WHITELIST=\"${ERROR_WHITELIST}\"" echo "ERROR_ALLOWLIST=\"${ERROR_ALLOWLIST}\""
PYLINT_BIN="python3 -m pylint" PYLINT_BIN="python3 -m pylint"
...@@ -92,16 +92,16 @@ do_pylint() { ...@@ -92,16 +92,16 @@ do_pylint() {
N_ERRORS=0 N_ERRORS=0
while read -r LINE; do while read -r LINE; do
IS_WHITELISTED=0 IS_ALLOWLISTED=0
for WL_REGEX in ${ERROR_WHITELIST}; do for WL_REGEX in ${ERROR_ALLOWLIST}; do
if echo ${LINE} | grep -q "${WL_REGEX}"; then if echo ${LINE} | grep -q "${WL_REGEX}"; then
echo "Found a whitelisted error:" echo "Found a ALLOWLISTed error:"
echo " ${LINE}" echo " ${LINE}"
IS_WHITELISTED=1 IS_ALLOWLISTED=1
fi fi
done done
if [[ ${IS_WHITELISTED} == "0" ]]; then if [[ ${IS_ALLOWLISTED} == "0" ]]; then
echo "${LINE}" >> ${NONWL_ERRORS_FILE} echo "${LINE}" >> ${NONWL_ERRORS_FILE}
echo "" >> ${NONWL_ERRORS_FILE} echo "" >> ${NONWL_ERRORS_FILE}
((N_ERRORS++)) ((N_ERRORS++))
...@@ -116,7 +116,7 @@ do_pylint() { ...@@ -116,7 +116,7 @@ do_pylint() {
cat "${NONWL_ERRORS_FILE}" cat "${NONWL_ERRORS_FILE}"
return 1 return 1
else else
echo "PASS: No non-whitelisted pylint errors were found." echo "PASS: No non-ALLOWLISTed pylint errors were found."
return 0 return 0
fi fi
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment