MCPcopy Create free account
hub / github.com/celery/celery / parse_uid

Function parse_uid

celery/platforms.py:496–510  ·  view source on GitHub ↗

Parse user id. Arguments: uid (str, int): Actual uid, or the username of a user. Returns: int: The actual uid.

(uid)

Source from the content-addressed store, hash-verified

494
495
496def parse_uid(uid):
497 """Parse user id.
498
499 Arguments:
500 uid (str, int): Actual uid, or the username of a user.
501 Returns:
502 int: The actual uid.
503 """
504 try:
505 return int(uid)
506 except ValueError:
507 try:
508 return pwd.getpwnam(uid).pw_uid
509 except (AttributeError, KeyError):
510 raise KeyError(f'User does not exist: {uid}')
511
512
513def parse_gid(gid):

Callers 5

setuidFunction · 0.85
maybe_drop_privilegesFunction · 0.85

Calls

no outgoing calls