Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88ec64d

Browse filesBrowse files
committed
changes to format
1 parent d74a7fe commit 88ec64d
Copy full SHA for 88ec64d

File tree

1 file changed

+15
-14
lines changed
Filter options

1 file changed

+15
-14
lines changed

‎tfx_addons/copy_example_gen/component.py

Copy file name to clipboardExpand all lines: tfx_addons/copy_example_gen/component.py
+15-14Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,25 @@
4646

4747

4848
def _split_names_string_builder(split_names_list: List):
49-
5049
"""
5150
_split_names_string_builder() creates a string of split-names for input to
5251
output_example.split_names property.
5352
5453
"""
5554

5655
str1 = "["
57-
urlist_len = len(split_names_list)-1
56+
urlist_len = len(split_names_list) - 1
5857
index = 0
5958

6059
for element in split_names_list:
61-
if(index==urlist_len):
62-
str1 += "\""+element+"\""+"]"
60+
if(index == urlist_len):
61+
str1 += "\"" + element + "\"" + "]"
6362
break
64-
str1 += "\""+element+"\""+","
65-
index+=1
63+
str1 += "\"" + element + "\"" + ","
64+
index += 1
6665
return str1
6766

67+
6868
@component
6969
def CopyExampleGen(
7070
input_json_str: tfx.dsl.components.Parameter[str],
@@ -84,23 +84,24 @@ def CopyExampleGen(
8484
input_dict = json.loads(input_json_str)
8585

8686
# Parse input_dict: creates a directory from the split-names and tfrecord uris provided
87-
split_names=[]
87+
split_names = []
8888
for key, value in input_dict.items():
8989
split_names.append(key)
9090

91-
split_names_string=_split_names_string_builder(split_names)
92-
output_example.split_names=str(split_names_string)
91+
split_names_string = _split_names_string_builder(split_names)
92+
output_example.split_names = str(split_names_string)
9393

9494
# Make directories
95-
tfrecords_list=[]
96-
output_example_uri=output_example.uri
95+
tfrecords_list = []
96+
output_example_uri = output_example.uri
9797

9898
for key, value in input_dict.items():
9999
split_value=(f"/Split-{key}/")
100100
fileio.mkdir(f"{output_example_uri}{split_value}")
101-
tfrecords_list=fileio.glob(f"{input_dict[key]}*.gz")
101+
tfrecords_list = fileio.glob(f"{input_dict[key]}*.gz")
102102

103103
# Copy files into directories
104104
for tfrecord in tfrecords_list:
105-
file_name=os.path.basename(os.path.normpath(tfrecord))
106-
fileio.copy(tfrecord, output_example.uri+split_value+file_name, True)
105+
file_name = os.path.basename(os.path.normpath(tfrecord))
106+
fileio.copy(tfrecord, output_example.uri + split_value + file_name,
107+
True)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.