George-Wu commented on a change in pull request #12331:
URL: https://github.com/apache/beam/pull/12331#discussion_r459590786
##########
File path: sdks/python/apache_beam/io/gcp/dicomio.py
##########
@@ -248,31 +268,31 @@ def __init__(self, destination_dict, credential=None):
self.destination_dict = destination_dict
def expand(self, pcoll):
- return pcoll | beam.ParDo(StoreInstanceBytes(self.destination_dict,
self.credential))
+ return pcoll | beam.ParDo(
+ StoreInstanceBytes(self.destination_dict, self.credential))
class StoreInstanceBytes(beam.DoFn):
"""A DoFn execute every file input."""
Review comment:
Examples and more comments added
##########
File path: sdks/python/apache_beam/io/gcp/dicomio.py
##########
@@ -157,27 +172,33 @@ class ConvertPubsubToQido(beam.DoFn):
def process(self, element):
# Check if all required keys present.
required_keys = [
- 'projects', 'locations', 'datasets', 'dicomStores', 'dicomWeb',
- 'studies', 'series', 'instances'
- ]
-
+ 'projects',
+ 'locations',
+ 'datasets',
+ 'dicomStores',
+ 'dicomWeb',
+ 'studies',
+ 'series',
+ 'instances'
+ ]
+
entries = element.split('/')
valid = True
-
+
if len(entries) != 15:
valid = False
-
+
if valid:
# check if the position of keys are correct
for i in range(5):
- if required_keys[i] != entries[i*2]:
- valid = False
- break
- for i in range(5,8):
- if required_keys[i] != entries[i*2 - 1]:
- valid = False
- break
-
+ if required_keys[i] != entries[i * 2]:
+ valid = False
+ break
+ for i in range(5, 8):
+ if required_keys[i] != entries[i * 2 - 1]:
+ valid = False
+ break
+
Review comment:
magic numbers removed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]