MCPcopy Index your code
hub / github.com/python/cpython / expanduser

Method expanduser

Lib/pathlib/__init__.py:1439–1451  ·  view source on GitHub ↗

Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)

(self)

Source from the content-addressed store, hash-verified

1437 raise UnsupportedOperation(f"{f} is unsupported on this system")
1438
1439 def expanduser(self):
1440 """ Return a new path with expanded ~ and ~user constructs
1441 (as returned by os.path.expanduser)
1442 """
1443 if (not (self.drive or self.root) and
1444 self._tail and self._tail[0][:1] == '~'):
1445 homedir = os.path.expanduser(self._tail[0])
1446 if homedir[:1] == "~":
1447 raise RuntimeError("Could not determine home directory.")
1448 drv, root, tail = self._parse_path(homedir)
1449 return self._from_parsed_parts(drv, root, tail + self._tail[1:])
1450
1451 return self
1452
1453 @classmethod
1454 def home(cls):

Callers 15

joinuserFunction · 0.80
gethistoryfileFunction · 0.80
__init__Method · 0.80
_candidate_tempdir_listFunction · 0.80
__init__Method · 0.80
parse_ignore_dirFunction · 0.80
__init__Method · 0.80
goMethod · 0.80
get_filterMethod · 0.80
get_selectionMethod · 0.80
joinuserFunction · 0.80
_expand_varsFunction · 0.80

Calls 2

_parse_pathMethod · 0.80
_from_parsed_partsMethod · 0.80

Tested by 10

test_expanduserMethod · 0.64
test_expanduser_pwdMethod · 0.64
test_expanduser_pwd2Method · 0.64
_test_homeMethod · 0.64
test_with_segmentsMethod · 0.64
test_expanduser_posixMethod · 0.64
checkMethod · 0.64