MCPcopy Create free account
hub / github.com/BuddySirJava/SSH-Studio / _resolve_includes

Method _resolve_includes

src/ssh_config_parser.py:274–297  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

272 self.config.hosts.append(current_host)
273
274 def _resolve_includes(self) -> None:
275 resolved: Dict[Path, List[str]] = {}
276 base_dir = self.config_path.parent
277 for pattern in self.config.include_directives:
278 expanded = os.path.expanduser(pattern)
279 if not os.path.isabs(expanded):
280 expanded = str(base_dir / expanded)
281
282 try:
283 matches = glob.glob(expanded, recursive=False)
284 if not matches and "**" in expanded:
285 matches = glob.glob(expanded, recursive=True)
286 except Exception:
287 matches = []
288
289 for path_str in matches:
290 p = Path(path_str)
291 try:
292 with p.open("r", encoding="utf-8") as f:
293 resolved[p] = f.readlines()
294 except Exception:
295 continue
296
297 self.config.includes_resolved = resolved
298
299 def _backup_file(self) -> None:
300 ts = datetime.now().strftime("%Y%m%d-%H%M%S")

Callers 1

parseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected