Skip to content

Commit b1272ec

Browse files
authored
Merge pull request #2 from wd-mgreynolds/curtlh-patch-02
Format using Black
2 parents 709f700 + 5ad16f3 commit b1272ec

File tree

6 files changed

+39
-184
lines changed

6 files changed

+39
-184
lines changed

prism/cli.py

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,10 @@ def param_fixup(value, config, config_name, option):
2828
@click.group(help="CLI for interacting with Workday’s Prism API")
2929
# Tenant specific parameters
3030
@click.option(
31-
"--base_url",
32-
envvar="workday_base_url",
33-
type=str,
34-
required=False,
35-
help="The base URL for the API client",
31+
"--base_url", envvar="workday_base_url", type=str, required=False, help="The base URL for the API client",
3632
)
3733
@click.option(
38-
"--tenant_name",
39-
envvar="workday_tenant_name",
40-
type=str,
41-
required=False,
42-
help="The name of your Workday tenant",
34+
"--tenant_name", envvar="workday_tenant_name", type=str, required=False, help="The name of your Workday tenant",
4335
)
4436
@click.option(
4537
"--client_id",
@@ -94,16 +86,7 @@ def param_fixup(value, config, config_name, option):
9486
)
9587
@click.pass_context
9688
def cli(
97-
ctx,
98-
base_url,
99-
tenant_name,
100-
client_id,
101-
client_secret,
102-
refresh_token,
103-
log_level,
104-
log_file,
105-
config_file,
106-
config_name,
89+
ctx, base_url, tenant_name, client_id, client_secret, refresh_token, log_level, log_file, config_file, config_name,
10790
):
10891
# Attempt to locate a configuration file - this is not required and config
10992
# parameters are only used if the configuration values are not passed on

prism/commands/buckets_commands.py

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88

99
@click.command("get")
1010
@click.option(
11-
"-n",
12-
"--isName",
13-
is_flag=True,
14-
default=False,
15-
help="Flag to treat the bucket or table argument as a name.",
11+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the bucket or table argument as a name.",
1612
)
1713
@click.option(
1814
"-l",
@@ -37,12 +33,7 @@
3733
help="How much information to be returned in response JSON.",
3834
)
3935
@click.option(
40-
"-s",
41-
"--search",
42-
is_flag=True,
43-
show_default=True,
44-
default=False,
45-
help="Use substring search bucket or table.",
36+
"-s", "--search", is_flag=True, show_default=True, default=False, help="Use substring search bucket or table.",
4637
)
4738
@click.option("--table", help="The id or name of a Prism table to list all buckets.")
4839
@click.argument("bucket", required=False)
@@ -99,11 +90,7 @@ def buckets_get(ctx, bucket, table, isname, limit, offset, type_, search):
9990
help="Schema JSON file for the target table.",
10091
)
10192
@click.option(
102-
"-o",
103-
"--operation",
104-
default="TruncateAndInsert",
105-
show_default=True,
106-
help="Operation to perform on the table.",
93+
"-o", "--operation", default="TruncateAndInsert", show_default=True, help="Operation to perform on the table.",
10794
)
10895
@click.argument("bucket", required=False)
10996
@click.pass_context
@@ -120,11 +107,7 @@ def buckets_create(ctx, target_name, target_id, file, operation, bucket):
120107
sys.exit(1)
121108

122109
bucket = p.buckets_create(
123-
bucket_name=bucket,
124-
target_id=target_id,
125-
target_name=target_name,
126-
schema=file,
127-
operation=operation,
110+
bucket_name=bucket, target_id=target_id, target_name=target_name, schema=file, operation=operation,
128111
)
129112

130113
if bucket is not None:
@@ -136,19 +119,12 @@ def buckets_create(ctx, target_name, target_id, file, operation, bucket):
136119

137120
@click.command("files")
138121
@click.option(
139-
"-n",
140-
"--target_name",
141-
default=None,
142-
help="Name of the table to associate with the bucket.",
122+
"-n", "--target_name", default=None, help="Name of the table to associate with the bucket.",
143123
)
144124
@click.option("-i", "--target_id", default=None, help="Table ID to associate with the table.")
145125
@click.option("-f", "--file", default=None, help="Schema JSON file for the target table.")
146126
@click.option(
147-
"-o",
148-
"--operation",
149-
default="TruncateAndInsert",
150-
show_default=True,
151-
help="Operation to perform on the table.",
127+
"-o", "--operation", default="TruncateAndInsert", show_default=True, help="Operation to perform on the table.",
152128
)
153129
@click.option("-b", "--bucket", help="Bucket name to load files.", default=None)
154130
@click.option(
@@ -189,11 +165,7 @@ def buckets_files(ctx, target_name, target_id, file, operation, bucket, complete
189165

190166
@click.command("complete")
191167
@click.option(
192-
"-n",
193-
"--isName",
194-
is_flag=True,
195-
default=False,
196-
help="Flag to treat the bucket argument as a name.",
168+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the bucket argument as a name.",
197169
)
198170
@click.argument("bucket", required=True)
199171
@click.pass_context
@@ -230,11 +202,7 @@ def buckets_complete(ctx, isname, bucket):
230202

231203
@click.command("errorFile")
232204
@click.option(
233-
"-n",
234-
"--isName",
235-
is_flag=True,
236-
default=False,
237-
help="Flag to treat the bucket argument as a name.",
205+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the bucket argument as a name.",
238206
)
239207
@click.argument("bucket", required=True)
240208
@click.pass_context

prism/commands/dataChanges_commands.py

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,13 @@
99

1010
@click.command("get")
1111
@click.option(
12-
"-n",
13-
"--isName",
14-
default=False,
15-
is_flag=True,
16-
help="Flag to treat the dct argument as a name.",
12+
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
1713
)
1814
@click.option(
19-
"-l",
20-
"--limit",
21-
default=-1,
22-
help="The maximum number of object data entries included in the response.",
15+
"-l", "--limit", default=-1, help="The maximum number of object data entries included in the response.",
2316
)
2417
@click.option(
25-
"-o",
26-
"--offset",
27-
default=0,
28-
help="The offset to the first object in a collection to include in the response.",
18+
"-o", "--offset", default=0, help="The offset to the first object in a collection to include in the response.",
2919
)
3020
@click.option(
3121
"-t",
@@ -75,11 +65,7 @@ def dataChanges_get(ctx, isname, dct, limit, offset, type_, search):
7565

7666
@click.command("validate")
7767
@click.option(
78-
"-n",
79-
"--isName",
80-
default=False,
81-
is_flag=True,
82-
help="Flag to treat the dct argument as a name.",
68+
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
8369
)
8470
@click.option("-s", "--search", is_flag=True, help="Use contains search substring for --name.")
8571
@click.argument("dct", required=True)
@@ -120,11 +106,7 @@ def dataChanges_validate(ctx, isname, dct, search):
120106

121107
@click.command("run")
122108
@click.option(
123-
"-n",
124-
"--isName",
125-
default=False,
126-
is_flag=True,
127-
help="Flag to treat the dct argument as a name.",
109+
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
128110
)
129111
@click.argument("dct", required=True)
130112
@click.argument("fid", required=False)
@@ -164,18 +146,10 @@ def dataChanges_run(ctx, dct, fid, isname):
164146

165147
@click.command("activities")
166148
@click.option(
167-
"-n",
168-
"--isName",
169-
default=False,
170-
is_flag=True,
171-
help="Flag to treat the dct argument as a name.",
149+
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
172150
)
173151
@click.option(
174-
"-s",
175-
"--status",
176-
is_flag=True,
177-
default=False,
178-
help="Return only the status of the activity.",
152+
"-s", "--status", is_flag=True, default=False, help="Return only the status of the activity.",
179153
)
180154
@click.argument("dct", required=True)
181155
@click.argument("activityID", required=True)
@@ -216,25 +190,13 @@ def dataChanges_activities(ctx, dct, activityid, status, isname):
216190

217191
@click.command("upload")
218192
@click.option(
219-
"-n",
220-
"--isName",
221-
default=False,
222-
is_flag=True,
223-
help="Flag to treat the dct argument as a name.",
193+
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
224194
)
225195
@click.option(
226-
"-w",
227-
"--wait",
228-
default=False,
229-
is_flag=True,
230-
help="Wait for the data change task to complete.",
196+
"-w", "--wait", default=False, is_flag=True, help="Wait for the data change task to complete.",
231197
)
232198
@click.option(
233-
"-v",
234-
"--verbose",
235-
default=False,
236-
is_flag=True,
237-
help="Display additional information.",
199+
"-v", "--verbose", default=False, is_flag=True, help="Display additional information.",
238200
)
239201
@click.argument("dct", required=True)
240202
@click.argument("file", required=True, nargs=-1, type=click.Path(exists=True))

prism/commands/fileContainers_commands.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ def fileContainers_get(ctx, id):
4040

4141
@click.command("load")
4242
@click.option(
43-
"-i",
44-
"--id",
45-
default=None,
46-
help="Target File container ID - defaults to a new container.",
43+
"-i", "--id", default=None, help="Target File container ID - defaults to a new container.",
4744
)
4845
@click.argument("file", nargs=-1, type=click.Path(exists=True))
4946
@click.pass_context

prism/commands/tables_commands.py

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010

1111
@click.command("get")
1212
@click.option(
13-
"-n",
14-
"--isName",
15-
is_flag=True,
16-
default=False,
17-
help="Flag to treat the table argument as a name.",
13+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
1814
)
1915
@click.option(
2016
"-l",
@@ -39,17 +35,10 @@
3935
help="How much information returned for each table.",
4036
)
4137
@click.option(
42-
"-c",
43-
"--compact",
44-
is_flag=True,
45-
default=False,
46-
help="Compact the table schema for use in edit (put) operations.",
38+
"-c", "--compact", is_flag=True, default=False, help="Compact the table schema for use in edit (put) operations.",
4739
)
4840
@click.option(
49-
"-s",
50-
"--search",
51-
is_flag=True,
52-
help="Enable substring search of NAME in api name or display name.",
41+
"-s", "--search", is_flag=True, help="Enable substring search of NAME in api name or display name.",
5342
)
5443
@click.argument("table", required=False)
5544
@click.pass_context
@@ -97,12 +86,7 @@ def tables_get(ctx, isname, table, limit, offset, type_, compact, search):
9786
@click.option("-n", "--table_name", help="Table name - overrides name from schema.")
9887
@click.option("-d", "--displayName", help="Specify a display name - defaults to name.")
9988
@click.option(
100-
"-e",
101-
"--enableForAnalysis",
102-
type=bool,
103-
is_flag=True,
104-
default=None,
105-
help="Enable this table for analytics.",
89+
"-e", "--enableForAnalysis", type=bool, is_flag=True, default=None, help="Enable this table for analytics.",
10690
)
10791
@click.option("-s", "--sourceName", help="The API name of an existing table to copy.")
10892
@click.option("-w", "--sourceWID", help="The WID of an existing table to copy.")
@@ -164,11 +148,7 @@ def tables_create(ctx, table_name, displayname, enableforanalysis, sourcename, s
164148

165149
@click.command("edit")
166150
@click.option(
167-
"-t",
168-
"--truncate",
169-
is_flag=True,
170-
default=False,
171-
help="Truncate the table before updating.",
151+
"-t", "--truncate", is_flag=True, default=False, help="Truncate the table before updating.",
172152
)
173153
@click.argument("file", required=True, type=click.Path(exists=True, dir_okay=False, readable=True))
174154
@click.pass_context
@@ -194,11 +174,7 @@ def tables_edit(ctx, file, truncate):
194174

195175
@click.command("patch")
196176
@click.option(
197-
"-n",
198-
"--isName",
199-
is_flag=True,
200-
default=False,
201-
help="Flag to treat the table argument as a name.",
177+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
202178
)
203179
@click.option(
204180
"--displayName",
@@ -222,10 +198,7 @@ def tables_edit(ctx, file, truncate):
222198
help="Set the documentation for an existing table.",
223199
)
224200
@click.option(
225-
"--enableForAnalysis",
226-
is_flag=False,
227-
default=None,
228-
type=click.Choice(["true", "false"], case_sensitive=False),
201+
"--enableForAnalysis", is_flag=False, default=None, type=click.Choice(["true", "false"], case_sensitive=False),
229202
)
230203
@click.argument("table", required=True, type=str)
231204
@click.argument("file", required=False, type=click.Path(dir_okay=False))
@@ -334,11 +307,7 @@ def set_patch_value(attr, value):
334307

335308
@click.command("upload")
336309
@click.option(
337-
"-n",
338-
"--isName",
339-
is_flag=True,
340-
default=False,
341-
help="Flag to treat the table argument as a name.",
310+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
342311
)
343312
@click.option(
344313
"-o",
@@ -375,11 +344,7 @@ def tables_upload(ctx, table, isname, operation, file):
375344

376345
@click.command("truncate")
377346
@click.option(
378-
"-n",
379-
"--isName",
380-
is_flag=True,
381-
default=False,
382-
help="Flag to treat the table argument as a name.",
347+
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
383348
)
384349
@click.argument("table", required=True)
385350
@click.pass_context

0 commit comments

Comments
 (0)