Skip to content

Commit 1cc9c3e

Browse files
committed
Rename some variables.
1 parent c41cac1 commit 1cc9c3e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

sdl3/__init__.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def SDL_CHECK_BINARY_NAME(name: str) -> bool:
150150
except requests.RequestException:
151151
...
152152

153-
functions, binaryMap = {binary: {} for binary in SDL_MODULES}, {}
153+
functions, binaryMap = {module: {} for module in SDL_MODULES}, {}
154154
binaryData, missing = {"system": SDL_SYSTEM, "arch": SDL_ARCH, "files": []}, None
155155
binaryPath = os.environ.get("SDL_BINARY_PATH", os.path.join(os.path.dirname(__file__), "bin"))
156156
absPath = lambda path: path if os.path.isabs(path) else os.path.abspath(os.path.join(binaryPath, path))
@@ -202,15 +202,15 @@ def SDL_CHECK_BINARY_NAME(name: str) -> bool:
202202
if int(os.environ.get("SDL_FIND_BINARIES", "1" if binaryData.get("find", missing is None) else "0")) > 0:
203203
binaryData["files"] += SDL_FIND_BINARIES(SDL_MODULES)
204204

205-
for binary in SDL_MODULES:
205+
for module in SDL_MODULES:
206206
for path in binaryData["files"]:
207-
if binary in binaryMap:
207+
if module in binaryMap:
208208
break
209209

210210
if os.path.exists(path) and SDL_CHECK_BINARY_NAME(name := os.path.split(path)[1]):
211-
for _binary in [binary, f"{binary}d"]:
212-
if (name.split(".")[0] if "." in name else name).endswith(_binary):
213-
binaryMap[binary] = ctypes.CDLL(os.path.abspath(path))
211+
for _name in [module, f"{module}d"]:
212+
if (name.split(".")[0] if "." in name else name).endswith(_name):
213+
binaryMap[module] = ctypes.CDLL(os.path.abspath(path))
214214

215215
BaseType = typing.TypeVar("BaseType")
216216
TargetType = typing.TypeVar("TargetType")
@@ -377,18 +377,18 @@ async def SDL_GET_LATEST_RELEASES() -> dict[str, str]:
377377
if "SDL_GITHUB_TOKEN" in os.environ:
378378
headers["Authorization"] = f"Bearer {os.environ['SDL_GITHUB_TOKEN']}"
379379

380-
for repo in SDL_MODULES:
381-
url = f"https://api.github.com/repos/libsdl-org/{repo}/releases"
380+
for module in SDL_MODULES:
381+
url = f"https://api.github.com/repos/libsdl-org/{module}/releases"
382382
tasks.append(asyncio.create_task(session.get(url, headers = headers, ssl = False)))
383383
SDL_LOGGER.Log(SDL_LOGGER.Info, f"Sending a request to '{url}'.")
384384

385385
responses = await asyncio.gather(*tasks)
386386
SDL_LOGGER.Log(SDL_LOGGER.Info, f"Response gathering completed ({len(responses)} responses).")
387387

388-
for response, repo in zip(responses, SDL_MODULES):
388+
for response, module in zip(responses, SDL_MODULES):
389389
if response.status != 200:
390390
SDL_LOGGER.Log(SDL_LOGGER.Warning, f"Failed to get latest release of '{response.url}', skipping (status: {response.status}).")
391-
releases[repo] = None
391+
releases[module] = None
392392

393393
else:
394394
latestRelease = (None, None)
@@ -399,7 +399,7 @@ async def SDL_GET_LATEST_RELEASES() -> dict[str, str]:
399399
if not latestRelease[0] or score > latestRelease[0]:
400400
latestRelease = (score, release["tag_name"])
401401

402-
releases[repo] = latestRelease[1]
402+
releases[module] = latestRelease[1]
403403

404404
await session.close()
405405
return releases
@@ -709,8 +709,8 @@ def __new__(cls, name: str, _: typing.Any, attributes: dict[str, typing.Any]) ->
709709

710710
if not __initialized__:
711711
if int(os.environ.get("SDL_CHECK_BINARY_VERSION", "1")) > 0:
712-
for binary, left, right in zip(SDL_MODULES, [SDL_GetVersion, IMG_Version, Mix_Version, TTF_Version, RTF_Version, NET_GetVersion], [SDL_VERSION, SDL_IMAGE_VERSION, SDL_MIXER_VERSION, SDL_TTF_VERSION, SDL_RTF_VERSION, SDL_NET_VERSION]):
713-
if binary in binaryMap and (_ := left()) != right: SDL_LOGGER.Log(SDL_LOGGER.Warning, f"Version mismatch with binary: '{SDL_BINARY_PATTERNS[SDL_SYSTEM][0].format(binary)}' (expected: {SDL_VERSIONNUM_STRING(right)}, got: {SDL_VERSIONNUM_STRING(_)}).")
712+
for module, left, right in zip(SDL_MODULES, [SDL_GetVersion, IMG_Version, Mix_Version, TTF_Version, RTF_Version, NET_GetVersion], [SDL_VERSION, SDL_IMAGE_VERSION, SDL_MIXER_VERSION, SDL_TTF_VERSION, SDL_RTF_VERSION, SDL_NET_VERSION]):
713+
if module in binaryMap and (_ := left()) != right: SDL_LOGGER.Log(SDL_LOGGER.Warning, f"Version mismatch with binary: '{SDL_BINARY_PATTERNS[SDL_SYSTEM][0].format(module)}' (expected: {SDL_VERSIONNUM_STRING(right)}, got: {SDL_VERSIONNUM_STRING(_)}).")
714714

715715
def SDL_TRY_WRITE_DOCS() -> bool | None:
716716
try:

0 commit comments

Comments
 (0)