Skip to content

Commit 6545ae0

Browse files
committed
dev
1 parent 2b6e171 commit 6545ae0

File tree

1 file changed

+7
-42
lines changed

1 file changed

+7
-42
lines changed

cf/functions.py

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,48 +2695,11 @@ def flat(x):
26952695
yield a
26962696

26972697

2698-
def abspath(filename):
2699-
"""Return a normalized absolute version of a file name.
2698+
def abspath(path, uri=None):
2699+
return cfdm.abspath(path, uri=uri)
27002700

2701-
If `None` or a string containing URL is provided then it is
2702-
returned unchanged.
27032701

2704-
.. seealso:: `cf.dirname`, `cf.pathjoin`, `cf.relpath`
2705-
2706-
:Parameters:
2707-
2708-
filename: `str` or `None`
2709-
The name of the file, or `None`
2710-
2711-
:Returns:
2712-
2713-
`str`
2714-
2715-
The normalized absolutised version of *filename*, or
2716-
`None`.
2717-
2718-
**Examples**
2719-
2720-
>>> import os
2721-
>>> os.getcwd()
2722-
'/data/archive'
2723-
>>> cf.abspath('file.nc')
2724-
'/data/archive/file.nc'
2725-
>>> cf.abspath('..//archive///file.nc')
2726-
'/data/archive/file.nc'
2727-
>>> cf.abspath('http://data/archive/file.nc')
2728-
'http://data/archive/file.nc'
2729-
2730-
"""
2731-
u = urlparse(filename)
2732-
scheme = u.scheme
2733-
if not scheme:
2734-
return _os_path_abspath(filename)
2735-
2736-
if scheme == "file":
2737-
return u.path
2738-
2739-
return filename
2702+
abspath.__doc__ = cfdm.abspath.__doc__.replace("cfdm.", "cf.")
27402703

27412704

27422705
def relpath(filename, start=None):
@@ -2783,8 +2746,10 @@ def relpath(filename, start=None):
27832746
return _os_path_relpath(filename)
27842747

27852748

2786-
def dirname(path, isdir=False):
2787-
return cfdm.dirname(path, isdir=isdir)
2749+
def dirname(path, normalise=False, uri=None, isdir=False, sep=False):
2750+
return cfdm.dirname(
2751+
path, normalise=normalise, uri=uri, isdir=isdir, sep=sep
2752+
)
27882753

27892754

27902755
dirname.__doc__ = cfdm.dirname.__doc__.replace("cfdm.", "cf.")

0 commit comments

Comments
 (0)