MCPcopy Index your code
hub / github.com/SkyworkAI/DeepResearchAgent / initialize

Method initialize

src/benchmark/leetcode.py:134–170  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

132 self.output_file = os.path.join(self.output_dir, "results.jsonl")
133
134 async def initialize(self):
135 logger.info("| 🚀 Initializing LeetCode Benchmark Submitter...")
136
137 self.repo_slug = self.project_url.rstrip('/').replace('https://github.com/', '').replace('http://github.com/', '')
138 self.leetcode_cookie = os.getenv("LEETCODE_COOKIE") or None
139
140 # output_file 已在 __init__ 中设置,这里只打印日志
141 logger.info(f"| 📝 Results will be saved to: {self.output_file}")
142 # 保持原始引用
143 self.base_dir = os.path.join(config.workdir, "benchmark", "leetcode")
144 os.makedirs(self.base_dir, exist_ok=True)
145
146 # 1. Setup git repository
147 await self._setup_git_repo()
148
149 # 2. Setup browser
150 self.playwright = await async_playwright().start()
151 user_data_dir = os.path.join(self.base_dir, "playwright_user_data")
152 self.context = await self.playwright.chromium.launch_persistent_context(
153 user_data_dir=user_data_dir,
154 headless=self.headless,
155 viewport={'width': 1280, 'height': 800},
156 args=["--disable-blink-features=AutomationControlled"],
157 permissions=["clipboard-read", "clipboard-write"]
158 )
159 self.page = self.context.pages[0] if self.context.pages else await self.context.new_page()
160
161 # 3. Setup LeetCode cookie
162 await self._setup_leetcode_cookie()
163
164 # 4. Login GitHub and enter Codespace
165 await self._login_and_navigate()
166
167 # 5. Verify LeetCode login status
168 await self._ensure_leetcode_login()
169
170 logger.info("| ✅ Environment all ready, can start evaluation")
171
172
173

Callers 2

initializeMethod · 0.45
flush_eval_queueMethod · 0.45

Calls 9

_setup_git_repoMethod · 0.95
_login_and_navigateMethod · 0.95
joinMethod · 0.80
new_pageMethod · 0.80
infoMethod · 0.45
replaceMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected