OreosLab / SSRSpeedN

with statements can be merged PTC-W0062
Anti-pattern
Major
2 occurrences in this check
Consider merging collapsible With statements`
205        )  # 如果没有提供下载地址则用默认的
206        print("Download URL:", _url)
207        # 从网络上下载
208        async with ClientSession(headers={"user-agent": "SSRSpeedN"}) as session:209            async with session.get(_url, proxy=proxy, timeout=20) as resp:
210                if resp.status != 200:
211                    raise Exception(f"NetworkError: {resp.status}==>\t{_url}")
Consider merging collapsible With statements`
118
119    def get_emoji(self, emoji: str, /) -> Optional[BytesIO]:
120        file_path = self.get_file_path(emoji)
121        with contextlib.suppress(FileNotFoundError):122            with open(file_path, "rb") as file:
123                return BytesIO(file.read())
124        return None