Skip to content
This repository was archived by the owner on Oct 2, 2021. It is now read-only.

Commit 937056f

Browse files
committed
Improved documentation and fixed import
1 parent 976e25f commit 937056f

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

README.rst

+14-7
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,23 @@ Commandline usage example
3838

3939
.. code-block:: bash
4040
41-
# copy local file to remote location
42-
genomespace -u <username> -p <password> cp /tmp/local_file.txt https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt
41+
# Create remote folder, including all intermediate paths
42+
genomespace -u <username> -p <password> mkdir -p https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/f1/f2/
43+
44+
# copy local files recursively to remote location
45+
genomespace -u <username> -p <password> cp -R /tmp/ https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/
46+
47+
# copy local files matching pattern to remote location - note that paths with wildcards must be enclosed in quotes
48+
genomespace -u <username> -p <password> cp '/tmp/*.txt' https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/
4349
4450
# list remote files
4551
genomespace -u <username> -p <password> ls https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/
4652
4753
# move remote file to new location
4854
genomespace -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt
4955
50-
# download remote file, with verbose output
51-
genomespace -vvv -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt /tmp/new_local_file.txt
56+
# download remote files matching pattern, with verbose output
57+
genomespace -vvv -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt /tmp/
5258
5359
# delete remote file
5460
genomespace -u <username> -p <password> rm https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt
@@ -62,11 +68,12 @@ Python usage example
6268
from genomespaceclient import GenomeSpaceClient
6369
6470
client = GenomeSpaceClient(username="<username>", password="<password>")
65-
client.copy("/tmp/local_file.txt", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt")
71+
client.mkdir("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/f1/f2". create_path=True)
72+
client.copy("/tmp/", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/", recurse=True)
6673
client.list("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/")
6774
client.move("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt")
68-
client.copy("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt", "/tmp/new_local_file.txt")
69-
client.delete("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt")
75+
client.copy("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt", "/tmp/")
76+
client.delete("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt")
7077
7178
7279
Documentation

docs/index.rst

+21-7
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,23 @@ Commandline usage example
2020

2121
.. code-block:: bash
2222
23-
# copy local file to remote location
24-
genomespace -u <username> -p <password> cp /tmp/local_file.txt https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt
23+
# Create remote folder, including all intermediate paths
24+
genomespace -u <username> -p <password> mkdir -p https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/f1/f2/
25+
26+
# copy local files recursively to remote location
27+
genomespace -u <username> -p <password> cp -R /tmp/ https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/
28+
29+
# copy local files matching pattern to remote location - note that paths with wildcards must be enclosed in quotes
30+
genomespace -u <username> -p <password> cp '/tmp/*.txt' https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/
2531
2632
# list remote files
2733
genomespace -u <username> -p <password> ls https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/
2834
2935
# move remote file to new location
3036
genomespace -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt
3137
32-
# download remote file, with verbose output
33-
genomespace -vvv -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt /tmp/new_local_file.txt
38+
# download remote files matching pattern, with verbose output
39+
genomespace -vvv -u <username> -p <password> mv https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt /tmp/
3440
3541
# delete remote file
3642
genomespace -u <username> -p <password> rm https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt
@@ -44,11 +50,19 @@ Python usage example
4450
from genomespaceclient import GenomeSpaceClient
4551
4652
client = GenomeSpaceClient(username="<username>", password="<password>")
47-
client.copy("/tmp/local_file.txt", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt")
53+
client.mkdir("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/f1/f2". create_path=True)
54+
client.copy("/tmp/", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/", recurse=True)
4855
client.list("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/")
4956
client.move("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt", "https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt")
50-
client.copy("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt", "/tmp/new_local_file.txt")
51-
client.delete("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt")
57+
client.copy("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt", "/tmp/")
58+
client.delete("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/*.txt")
59+
60+
61+
Notes
62+
~~~~~~~~~~~~~~~~~~~~
63+
Wildcard copying syntax is the same as unix path globbing, except that the '?'
64+
symbol is not supported (This is because the '?' is a reserved character in a URL)
65+
5266

5367
Documentation
5468
-------------

genomespaceclient/gs_glob.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
import fnmatch
55
import os
66
import re
7-
import urlparse
7+
try:
8+
from urllib.parse import urlparse
9+
except ImportError:
10+
from urlparse import urlparse
811

912

1013
GENOMESPACE_URL_REGEX = re.compile(

0 commit comments

Comments
 (0)