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

Function parse_gid

celery/platforms.py:513–527  ·  view source on GitHub ↗

Parse group id. Arguments: gid (str, int): Actual gid, or the name of a group. Returns: int: The actual gid of the group.

(gid)

Source from the content-addressed store, hash-verified

511
512
513def parse_gid(gid):
514 """Parse group id.
515
516 Arguments:
517 gid (str, int): Actual gid, or the name of a group.
518 Returns:
519 int: The actual gid of the group.
520 """
521 try:
522 return int(gid)
523 except ValueError:
524 try:
525 return grp.getgrnam(gid).gr_gid
526 except (AttributeError, KeyError):
527 raise KeyError(f'Group does not exist: {gid}')
528
529
530def _setgroups_hack(groups):

Callers 5

setgidFunction · 0.85
maybe_drop_privilegesFunction · 0.85

Calls

no outgoing calls