-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_bug_challenge.py
More file actions
33 lines (25 loc) · 1.21 KB
/
Copy pathgithub_bug_challenge.py
File metadata and controls
33 lines (25 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import time
# GitHub Open Source Plan: This is sent during code cleaning.
def buggy_opensource_cleaner(raw_text):
if raw_text is None:
return ""
# BUG POINT: If the input returns None or the data is completely empty,
# So, the .strip() or .split() method throws an AttributeError directly and crashes the entire engine!
processed_text = raw_text.strip().upper()
return processed_text
def run_challenge_session():
print("🚀 Running Sudhir's GitHub Open-Source Bug Reproduction Test...\n")
# Mock data reported by the GitHub user: The second record has a 'None' value!
dirty_scraped_records = [" python backend developer ", None, " javascript consultant "]
print("📥 Starting batch text processing loop:")
print("-" * 65)
# Reproducing the bug by running a loop
for idx, record in enumerate(dirty_scraped_records, start=1):
print(f"⚡ Processing Element #{idx}...")
# The code will crash here!
clean_output = buggy_opensource_cleaner(record)
print(f"🎯 Clean Result: '{clean_output}'")
print("-" * 65)
print("🎉 Pipeline completed successfully!")
if __name__ == "__main__":
run_challenge_session()