From aa15c73406af38fa0f1060207632d3b368e8b9b2 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 30 Nov 2019 12:21:19 +0200 Subject: [PATCH 1/4] Added unwanted pattern test case --- ci/code_checks.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 4e25fd0ddb5ea..6df85255b76f0 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -194,6 +194,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then invgrep -R --include="*.py" -P '# type: (?!ignore)' pandas RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Check for use of .__class__' ; echo $MSG + invgrep -R --include=*.{py,pyx} '\.__class__' pandas + RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Check that no file in the repo contains trailing whitespaces' ; echo $MSG INVGREP_APPEND=" <- trailing whitespaces found" invgrep -RI --exclude=\*.{svg,c,cpp,html,js} --exclude-dir=env "\s$" * From ae99b929b7a621d40406da58afa3fb14b785f267 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 30 Nov 2019 20:16:45 +0200 Subject: [PATCH 2/4] POC --- pandas/tseries/holiday.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py index 2e5477ea00e39..9417dc4b48499 100644 --- a/pandas/tseries/holiday.py +++ b/pandas/tseries/holiday.py @@ -363,7 +363,7 @@ def __init__(self, name=None, rules=None): """ super().__init__() if name is None: - name = type(self).__name__ + name = self.__class__.__name__ self.name = name if rules is not None: From 86263684a12644a6f513cb6af672a950b5043fff Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Sat, 30 Nov 2019 20:19:35 +0200 Subject: [PATCH 3/4] Added unwanted pattern test case --- pandas/tseries/holiday.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tseries/holiday.py b/pandas/tseries/holiday.py index 9417dc4b48499..2e5477ea00e39 100644 --- a/pandas/tseries/holiday.py +++ b/pandas/tseries/holiday.py @@ -363,7 +363,7 @@ def __init__(self, name=None, rules=None): """ super().__init__() if name is None: - name = self.__class__.__name__ + name = type(self).__name__ self.name = name if rules is not None: From 6fefaca5241eed655a68e8678719a491e27a3897 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <50263213+MomIsBestFriend@users.noreply.github.com> Date: Sat, 30 Nov 2019 21:25:59 +0200 Subject: [PATCH 4/4] Fixes for comment https://github.com/pandas-dev/pandas/pull/29937#issuecomment-560011935 --- ci/code_checks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 6df85255b76f0..ceb13c52ded9c 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -194,7 +194,7 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then invgrep -R --include="*.py" -P '# type: (?!ignore)' pandas RET=$(($RET + $?)) ; echo $MSG "DONE" - MSG='Check for use of .__class__' ; echo $MSG + MSG='Check for use of foo.__class__ instead of type(foo)' ; echo $MSG invgrep -R --include=*.{py,pyx} '\.__class__' pandas RET=$(($RET + $?)) ; echo $MSG "DONE"