MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / infer_size_from_path

Function infer_size_from_path

server/icon_export.py:16–24  ·  view source on GitHub ↗
(file_path: str)

Source from the content-addressed store, hash-verified

14
15
16def infer_size_from_path(file_path: str) -> tuple[int, int] | None:
17 raw = file_path.replace("\\", "/")
18 for part in raw.split("/"):
19 m = re.match(r"^(\d+)x(\d+)$", part, re.I)
20 if m:
21 w, h = int(m.group(1)), int(m.group(2))
22 if w > 0 and h > 0:
23 return w, h
24 return None
25
26
27def safe_symbol_from_path(path: str) -> str:

Callers 1

export_iconsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected