Python genericpath._unicode() Examples
The following are 30
code examples of genericpath._unicode().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
genericpath
, or try the search function
.
Example #1
Source File: posixpath.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return a canonical path (i.e. the absolute location of a file on the # filesystem).
Example #2
Source File: ntpath.py From ImageFusion with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #3
Source File: ntpath.py From ImageFusion with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #4
Source File: macpath.py From datafari with Apache License 2.0 | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #5
Source File: ntpath.py From datafari with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #6
Source File: ntpath.py From datafari with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #7
Source File: macpath.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #8
Source File: macpath.py From ironpython2 with Apache License 2.0 | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #9
Source File: ntpath.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #10
Source File: ntpath.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #11
Source File: ntpath.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #12
Source File: posixpath.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return a canonical path (i.e. the absolute location of a file on the # filesystem).
Example #13
Source File: os2emxpath.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def abspath(path): """Return the absolute version of a path""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #14
Source File: ntpath.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #15
Source File: ntpath.py From PhonePi_SampleServer with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #16
Source File: ntpath.py From PhonePi_SampleServer with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #17
Source File: posixpath.py From PhonePi_SampleServer with MIT License | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" # Preserve unicode (if path is unicode) slash, dot = (u'/', u'.') if isinstance(path, _unicode) else ('/', '.') if path == '': return dot initial_slashes = path.startswith('/') # POSIX allows one or two initial slashes, but treats three or more # as single slash. if (initial_slashes and path.startswith('//') and not path.startswith('///')): initial_slashes = 2 comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slashes and not new_comps) or (new_comps and new_comps[-1] == '..')): new_comps.append(comp) elif new_comps: new_comps.pop() comps = new_comps path = slash.join(comps) if initial_slashes: path = slash*initial_slashes + path return path or dot
Example #18
Source File: macpath.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #19
Source File: ntpath.py From syntheticmass with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #20
Source File: ntpath.py From syntheticmass with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #21
Source File: posixpath.py From syntheticmass with Apache License 2.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" # Preserve unicode (if path is unicode) slash, dot = (u'/', u'.') if isinstance(path, _unicode) else ('/', '.') if path == '': return dot initial_slashes = path.startswith('/') # POSIX allows one or two initial slashes, but treats three or more # as single slash. if (initial_slashes and path.startswith('//') and not path.startswith('///')): initial_slashes = 2 comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slashes and not new_comps) or (new_comps and new_comps[-1] == '..')): new_comps.append(comp) elif new_comps: new_comps.pop() comps = new_comps path = slash.join(comps) if initial_slashes: path = slash*initial_slashes + path return path or dot
Example #22
Source File: posixpath.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" # Preserve unicode (if path is unicode) slash, dot = (u'/', u'.') if isinstance(path, _unicode) else ('/', '.') if path == '': return dot initial_slashes = path.startswith('/') # POSIX allows one or two initial slashes, but treats three or more # as single slash. if (initial_slashes and path.startswith('//') and not path.startswith('///')): initial_slashes = 2 comps = path.split('/') new_comps = [] for comp in comps: if comp in ('', '.'): continue if (comp != '..' or (not initial_slashes and not new_comps) or (new_comps and new_comps[-1] == '..')): new_comps.append(comp) elif new_comps: new_comps.pop() comps = new_comps path = slash.join(comps) if initial_slashes: path = slash*initial_slashes + path return path or dot
Example #23
Source File: os2emxpath.py From unity-python with MIT License | 5 votes |
def abspath(path): """Return the absolute version of a path""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #24
Source File: ntpath.py From ironpython2 with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #25
Source File: ntpath.py From ironpython2 with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support
Example #26
Source File: posixpath.py From unity-python with MIT License | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return a canonical path (i.e. the absolute location of a file on the # filesystem).
Example #27
Source File: posixpath.py From ironpython2 with Apache License 2.0 | 5 votes |
def abspath(path): """Return an absolute path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # Return a canonical path (i.e. the absolute location of a file on the # filesystem).
Example #28
Source File: os2emxpath.py From ironpython2 with Apache License 2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path) # realpath is a no-op on systems without islink support
Example #29
Source File: ntpath.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if not isabs(path): if isinstance(path, _unicode): cwd = os.getcwdu() else: cwd = os.getcwd() path = join(cwd, path) return normpath(path)
Example #30
Source File: ntpath.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def abspath(path): """Return the absolute version of a path.""" if path: # Empty path must return current working directory. try: path = _getfullpathname(path) except WindowsError: pass # Bad path - return unchanged. elif isinstance(path, _unicode): path = os.getcwdu() else: path = os.getcwd() return normpath(path) # realpath is a no-op on systems without islink support