MCPcopy
hub / github.com/pytest-dev/pytest / chown

Method chown

src/_pytest/_py/path.py:301–313  ·  src/_pytest/_py/path.py::LocalPath.chown

Change ownership to the given user and group. user and group may be specified by a number or by a name. if rec is True change ownership recursively.

(self, user, group, rec=0)

Source from the content-addressed store, hash-verified

299 if sys.platform != class="st">"win32":
300
301 def chown(self, user, group, rec=0):
302 class="st">"""Change ownership to the given user and group.
303 user and group may be specified by a number or
304 by a name. if rec is True change ownership
305 recursively.
306 class="st">"""
307 uid = getuserid(user)
308 gid = getgroupid(group)
309 if rec:
310 for x in self.visit(rec=lambda x: x.check(link=0)):
311 if x.check(link=0):
312 error.checked_call(os.chown, str(x), uid, gid)
313 error.checked_call(os.chown, str(self), uid, gid)
314
315 def readlink(self) -> str:
316 class="st">""class="st">"Return value of a symbolic link."class="st">""

Callers 3

test_chown_identityMethod · 0.80

Calls 5

visitMethod · 0.95
getuseridFunction · 0.85
getgroupidFunction · 0.85
checked_callMethod · 0.80
checkMethod · 0.45

Tested by 3

test_chown_identityMethod · 0.64