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

Commit 4caf45a

Browse files
committed
Fixed object naming conventions to match python
1 parent da099c0 commit 4caf45a

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

genomespaceclient/client.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class GSDataFormat(object):
2525
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_c
2626
"""
2727

28-
def __init__(self, name, url, fileExtension, description):
28+
def __init__(self, name, url, file_extension, description):
2929
self.name = name
3030
self.url = url
31-
self.fileExtension = fileExtension
31+
self.file_extension = file_extension
3232
self.description = description
3333

3434
@staticmethod
@@ -93,9 +93,9 @@ class GSAclObject(object):
9393
See: http://www.genomespace.org/support/api/restful-access-to-dm#acl
9494
"""
9595

96-
def __init__(self, objectId, objectType):
97-
self.objectId = objectId
98-
self.objectType = objectType
96+
def __init__(self, object_id, object_type):
97+
self.object_id = object_id
98+
self.object_type = object_type
9999

100100
@staticmethod
101101
def from_json(json_data):
@@ -113,9 +113,9 @@ class GSEffectiveAcl(object):
113113
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_f
114114
"""
115115

116-
def __init__(self, accessControlEntries, effective_acl_object,
116+
def __init__(self, access_control_entries, effective_acl_object,
117117
effective_acl_id=None):
118-
self.accessControlEntries = accessControlEntries
118+
self.access_control_entries = access_control_entries
119119
self.object = effective_acl_object
120120
self.id = effective_acl_id
121121

@@ -137,22 +137,22 @@ class GSFileMetadata(object):
137137
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_a
138138
"""
139139

140-
def __init__(self, name, path, url, parentUrl, size, owner, isDirectory,
141-
isLink, targetPath, lastModified, dataFormat,
142-
availableDataFormats, effectiveAcl):
140+
def __init__(self, name, path, url, parentUrl, size, owner, is_directory,
141+
is_link, target_path, last_modified, data_format,
142+
available_data_formats, effective_acl):
143143
self.name = name
144144
self.path = path
145145
self.url = url
146-
self.parentUrl = parentUrl
146+
self.parent_url = parentUrl
147147
self.size = size
148148
self.owner = owner
149-
self.isDirectory = isDirectory
150-
self.isLink = isLink
151-
self.targetPath = targetPath
152-
self.lastModified = lastModified
153-
self.dataFormat = dataFormat
154-
self.availableDataFormats = availableDataFormats
155-
self.effectiveAcl = effectiveAcl
149+
self.is_directory = is_directory
150+
self.is_link = is_link
151+
self.target_path = target_path
152+
self.last_modified = last_modified
153+
self.data_format = data_format
154+
self.available_data_formats = available_data_formats
155+
self.effective_acl = effective_acl
156156

157157
@staticmethod
158158
def from_json(json_data):
@@ -578,7 +578,7 @@ def isdir(self, genomespace_url):
578578
"""
579579
try:
580580
md = self.get_metadata(genomespace_url)
581-
return md.isDirectory
581+
return md.is_directory
582582
except GSClientException:
583583
return False
584584
except HTTPError as e:

genomespaceclient/shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ def genomespace_list_files(args):
4141
for folder in folder_contents.contents:
4242
print("{isdir:<3s} {owner:<10s} {size:>10s} {last_modified:>26s}"
4343
" {name:s}".format(
44-
isdir="d" if folder.isDirectory else "_",
44+
isdir="d" if folder.is_directory else "_",
4545
owner=folder.owner["name"] or "",
4646
size=util.format_file_size(folder.size),
47-
last_modified=folder.lastModified or "",
47+
last_modified=folder.last_modified or "",
4848
name=folder.name))
4949

5050

test/test_genomespace_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_mkdir_rmdir(self):
7070
filelist = client.list(helpers.get_remote_test_folder())
7171
found_file = [f for f in filelist.contents
7272
if self._adjust_gs_swift_bug(f.name) == remote_name1 and
73-
f.isDirectory]
73+
f.is_directory]
7474
self.assertTrue(len(found_file) == 1,
7575
"Expected to find one created folder")
7676
# The recurse is needed to compensate for a bug in GenomeSpace swift
@@ -245,25 +245,25 @@ def test_get_metadata(self):
245245
metadata, GSFileMetadata,
246246
"Expected metadata to be of type GSFileMetadata")
247247
self.assertIsInstance(
248-
metadata.dataFormat, GSDataFormat,
248+
metadata.data_format, GSDataFormat,
249249
"Expected metadata's dataFormat to be of type GSDataFormat")
250250
self.assertIsInstance(
251-
metadata.availableDataFormats, list,
251+
metadata.available_data_formats, list,
252252
"Expected metadata's available formats to be of type list")
253253

254254
owner = get_test_username()
255255
self.assertTrue(
256256
metadata.owner['name'] == owner,
257257
"Expected file to owned by uploader")
258-
acl_object = metadata.effectiveAcl.object
258+
acl_object = metadata.effective_acl.object
259259
self.assertTrue(
260-
acl_object.objectId.endswith(remote_name),
260+
acl_object.object_id.endswith(remote_name),
261261
"Expected acl object path of %s to end with %s" % (
262-
acl_object.objectId, remote_name))
262+
acl_object.object_id, remote_name))
263263
self.assertTrue(
264-
acl_object.objectType == 'DataManagerFileObject',
264+
acl_object.object_type == 'DataManagerFileObject',
265265
"Expected acl object type has changed?")
266-
access_control_entries = metadata.effectiveAcl.accessControlEntries
266+
access_control_entries = metadata.effective_acl.access_control_entries
267267
self.assertTrue(
268268
len(access_control_entries) == 2,
269269
"Expected only two entries in ACL")

0 commit comments

Comments
 (0)