MCPcopy
hub / github.com/saltstack/salt / parse

Method parse

salt/utils/pkg/deb.py:374–405  ·  view source on GitHub ↗

Parse lines from sources files

(self, line)

Source from the content-addressed store, hash-verified

372 return pieces
373
374 def parse(self, line):
375 """
376 Parse lines from sources files
377 """
378 self.disabled, self.invalid, self.comment, repo_line = _invalid(line)
379 if self.invalid:
380 return False
381 if repo_line[1].startswith("["):
382 repo_line = [x for x in (line.strip("[]") for line in repo_line) if x]
383 opts = _get_opts(self.line)
384 if "arch" in opts:
385 self.architectures.extend(opts["arch"]["value"])
386 if "signedby" in opts:
387 self.signedby = opts["signedby"]["value"]
388 if "trusted" in opts:
389 self.trusted = opts["trusted"]["value"]
390 for opt in opts.values():
391 opt = opt["full"]
392 if opt:
393 try:
394 repo_line.pop(repo_line.index(opt))
395 except ValueError:
396 repo_line.pop(repo_line.index(f"[{opt}]"))
397 if len(repo_line) < 3:
398 raise SaltInvocationError(
399 f"Invalid repository definition: {' '.join(repo_line)}"
400 )
401 self.type = repo_line[0]
402 self.uri = repo_line[1]
403 self.dist = repo_line[2]
404 self.comps = repo_line[3:]
405 return True
406
407 def __str__(self):
408 """

Callers 15

__init__Method · 0.95
prep_trans_tarFunction · 0.45
is_cachedMethod · 0.45
build_schedule_itemFunction · 0.45
queryFunction · 0.45
get_valueFunction · 0.45
set_valueFunction · 0.45
get_attributeFunction · 0.45
set_attributeFunction · 0.45
rpcFunction · 0.45
commitFunction · 0.45
pingFunction · 0.45

Calls 7

SaltInvocationErrorClass · 0.90
_invalidFunction · 0.85
_get_optsFunction · 0.85
extendMethod · 0.45
valuesMethod · 0.45
popMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected