Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat with latest version of Black #3

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: prism-dev
channels:
- defaults
dependencies:
- python=3.7
- click>=6,<8
- requests>=2.20.0,<3
- python=3.8
- click
- requests
- pytest
- black=19.10b0
- black
- flake8
23 changes: 20 additions & 3 deletions prism/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ def param_fixup(value, config, config_name, option):
@click.group(help="CLI for interacting with Workday’s Prism API")
# Tenant specific parameters
@click.option(
"--base_url", envvar="workday_base_url", type=str, required=False, help="The base URL for the API client",
"--base_url",
envvar="workday_base_url",
type=str,
required=False,
help="The base URL for the API client",
)
@click.option(
"--tenant_name", envvar="workday_tenant_name", type=str, required=False, help="The name of your Workday tenant",
"--tenant_name",
envvar="workday_tenant_name",
type=str,
required=False,
help="The name of your Workday tenant",
)
@click.option(
"--client_id",
Expand Down Expand Up @@ -86,7 +94,16 @@ def param_fixup(value, config, config_name, option):
)
@click.pass_context
def cli(
ctx, base_url, tenant_name, client_id, client_secret, refresh_token, log_level, log_file, config_file, config_name,
ctx,
base_url,
tenant_name,
client_id,
client_secret,
refresh_token,
log_level,
log_file,
config_file,
config_name,
):
# Attempt to locate a configuration file - this is not required and config
# parameters are only used if the configuration values are not passed on
Expand Down
48 changes: 40 additions & 8 deletions prism/commands/buckets_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

@click.command("get")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the bucket or table argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the bucket or table argument as a name.",
)
@click.option(
"-l",
Expand All @@ -33,7 +37,12 @@
help="How much information to be returned in response JSON.",
)
@click.option(
"-s", "--search", is_flag=True, show_default=True, default=False, help="Use substring search bucket or table.",
"-s",
"--search",
is_flag=True,
show_default=True,
default=False,
help="Use substring search bucket or table.",
)
@click.option("--table", help="The id or name of a Prism table to list all buckets.")
@click.argument("bucket", required=False)
Expand Down Expand Up @@ -90,7 +99,11 @@ def buckets_get(ctx, bucket, table, isname, limit, offset, type_, search):
help="Schema JSON file for the target table.",
)
@click.option(
"-o", "--operation", default="TruncateAndInsert", show_default=True, help="Operation to perform on the table.",
"-o",
"--operation",
default="TruncateAndInsert",
show_default=True,
help="Operation to perform on the table.",
)
@click.argument("bucket", required=False)
@click.pass_context
Expand All @@ -107,7 +120,11 @@ def buckets_create(ctx, target_name, target_id, file, operation, bucket):
sys.exit(1)

bucket = p.buckets_create(
bucket_name=bucket, target_id=target_id, target_name=target_name, schema=file, operation=operation,
bucket_name=bucket,
target_id=target_id,
target_name=target_name,
schema=file,
operation=operation,
)

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

@click.command("files")
@click.option(
"-n", "--target_name", default=None, help="Name of the table to associate with the bucket.",
"-n",
"--target_name",
default=None,
help="Name of the table to associate with the bucket.",
)
@click.option("-i", "--target_id", default=None, help="Table ID to associate with the table.")
@click.option("-f", "--file", default=None, help="Schema JSON file for the target table.")
@click.option(
"-o", "--operation", default="TruncateAndInsert", show_default=True, help="Operation to perform on the table.",
"-o",
"--operation",
default="TruncateAndInsert",
show_default=True,
help="Operation to perform on the table.",
)
@click.option("-b", "--bucket", help="Bucket name to load files.", default=None)
@click.option(
Expand Down Expand Up @@ -165,7 +189,11 @@ def buckets_files(ctx, target_name, target_id, file, operation, bucket, complete

@click.command("complete")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the bucket argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the bucket argument as a name.",
)
@click.argument("bucket", required=True)
@click.pass_context
Expand Down Expand Up @@ -202,7 +230,11 @@ def buckets_complete(ctx, isname, bucket):

@click.command("errorFile")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the bucket argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the bucket argument as a name.",
)
@click.argument("bucket", required=True)
@click.pass_context
Expand Down
58 changes: 48 additions & 10 deletions prism/commands/dataChanges_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@

@click.command("get")
@click.option(
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
"-n",
"--isName",
default=False,
is_flag=True,
help="Flag to treat the dct argument as a name.",
)
@click.option(
"-l", "--limit", default=-1, help="The maximum number of object data entries included in the response.",
"-l",
"--limit",
default=-1,
help="The maximum number of object data entries included in the response.",
)
@click.option(
"-o", "--offset", default=0, help="The offset to the first object in a collection to include in the response.",
"-o",
"--offset",
default=0,
help="The offset to the first object in a collection to include in the response.",
)
@click.option(
"-t",
Expand Down Expand Up @@ -65,7 +75,11 @@ def dataChanges_get(ctx, isname, dct, limit, offset, type_, search):

@click.command("validate")
@click.option(
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
"-n",
"--isName",
default=False,
is_flag=True,
help="Flag to treat the dct argument as a name.",
)
@click.option("-s", "--search", is_flag=True, help="Use contains search substring for --name.")
@click.argument("dct", required=True)
Expand Down Expand Up @@ -106,7 +120,11 @@ def dataChanges_validate(ctx, isname, dct, search):

@click.command("run")
@click.option(
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
"-n",
"--isName",
default=False,
is_flag=True,
help="Flag to treat the dct argument as a name.",
)
@click.argument("dct", required=True)
@click.argument("fid", required=False)
Expand Down Expand Up @@ -146,10 +164,18 @@ def dataChanges_run(ctx, dct, fid, isname):

@click.command("activities")
@click.option(
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
"-n",
"--isName",
default=False,
is_flag=True,
help="Flag to treat the dct argument as a name.",
)
@click.option(
"-s", "--status", is_flag=True, default=False, help="Return only the status of the activity.",
"-s",
"--status",
is_flag=True,
default=False,
help="Return only the status of the activity.",
)
@click.argument("dct", required=True)
@click.argument("activityID", required=True)
Expand Down Expand Up @@ -190,13 +216,25 @@ def dataChanges_activities(ctx, dct, activityid, status, isname):

@click.command("upload")
@click.option(
"-n", "--isName", default=False, is_flag=True, help="Flag to treat the dct argument as a name.",
"-n",
"--isName",
default=False,
is_flag=True,
help="Flag to treat the dct argument as a name.",
)
@click.option(
"-w", "--wait", default=False, is_flag=True, help="Wait for the data change task to complete.",
"-w",
"--wait",
default=False,
is_flag=True,
help="Wait for the data change task to complete.",
)
@click.option(
"-v", "--verbose", default=False, is_flag=True, help="Display additional information.",
"-v",
"--verbose",
default=False,
is_flag=True,
help="Display additional information.",
)
@click.argument("dct", required=True)
@click.argument("file", required=True, nargs=-1, type=click.Path(exists=True))
Expand Down
5 changes: 4 additions & 1 deletion prism/commands/fileContainers_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def fileContainers_get(ctx, id):

@click.command("load")
@click.option(
"-i", "--id", default=None, help="Target File container ID - defaults to a new container.",
"-i",
"--id",
default=None,
help="Target File container ID - defaults to a new container.",
)
@click.argument("file", nargs=-1, type=click.Path(exists=True))
@click.pass_context
Expand Down
53 changes: 44 additions & 9 deletions prism/commands/tables_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

@click.command("get")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the table argument as a name.",
)
@click.option(
"-l",
Expand All @@ -35,10 +39,17 @@
help="How much information returned for each table.",
)
@click.option(
"-c", "--compact", is_flag=True, default=False, help="Compact the table schema for use in edit (put) operations.",
"-c",
"--compact",
is_flag=True,
default=False,
help="Compact the table schema for use in edit (put) operations.",
)
@click.option(
"-s", "--search", is_flag=True, help="Enable substring search of NAME in api name or display name.",
"-s",
"--search",
is_flag=True,
help="Enable substring search of NAME in api name or display name.",
)
@click.argument("table", required=False)
@click.pass_context
Expand Down Expand Up @@ -86,7 +97,12 @@ def tables_get(ctx, isname, table, limit, offset, type_, compact, search):
@click.option("-n", "--table_name", help="Table name - overrides name from schema.")
@click.option("-d", "--displayName", help="Specify a display name - defaults to name.")
@click.option(
"-e", "--enableForAnalysis", type=bool, is_flag=True, default=None, help="Enable this table for analytics.",
"-e",
"--enableForAnalysis",
type=bool,
is_flag=True,
default=None,
help="Enable this table for analytics.",
)
@click.option("-s", "--sourceName", help="The API name of an existing table to copy.")
@click.option("-w", "--sourceWID", help="The WID of an existing table to copy.")
Expand Down Expand Up @@ -148,7 +164,11 @@ def tables_create(ctx, table_name, displayname, enableforanalysis, sourcename, s

@click.command("edit")
@click.option(
"-t", "--truncate", is_flag=True, default=False, help="Truncate the table before updating.",
"-t",
"--truncate",
is_flag=True,
default=False,
help="Truncate the table before updating.",
)
@click.argument("file", required=True, type=click.Path(exists=True, dir_okay=False, readable=True))
@click.pass_context
Expand All @@ -174,7 +194,11 @@ def tables_edit(ctx, file, truncate):

@click.command("patch")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the table argument as a name.",
)
@click.option(
"--displayName",
Expand All @@ -198,7 +222,10 @@ def tables_edit(ctx, file, truncate):
help="Set the documentation for an existing table.",
)
@click.option(
"--enableForAnalysis", is_flag=False, default=None, type=click.Choice(["true", "false"], case_sensitive=False),
"--enableForAnalysis",
is_flag=False,
default=None,
type=click.Choice(["true", "false"], case_sensitive=False),
)
@click.argument("table", required=True, type=str)
@click.argument("file", required=False, type=click.Path(dir_okay=False))
Expand Down Expand Up @@ -307,7 +334,11 @@ def set_patch_value(attr, value):

@click.command("upload")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the table argument as a name.",
)
@click.option(
"-o",
Expand Down Expand Up @@ -344,7 +375,11 @@ def tables_upload(ctx, table, isname, operation, file):

@click.command("truncate")
@click.option(
"-n", "--isName", is_flag=True, default=False, help="Flag to treat the table argument as a name.",
"-n",
"--isName",
is_flag=True,
default=False,
help="Flag to treat the table argument as a name.",
)
@click.argument("table", required=True)
@click.pass_context
Expand Down
Loading