-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathtranslate.py
76 lines (70 loc) · 2.4 KB
/
translate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import copy
from awscli.arguments import CustomArgument, CLIArgument
from awscli.customizations.binaryhoist import (
BinaryBlobArgumentHoister,
ArgumentParameters,
)
FILE_DOCSTRING = (
"<p>The path to the file of the code you are uploading. "
"Example: fileb://data.csv</p>"
)
FILE_ERRORSTRING = (
"File cannot be provided as part of the "
"'--terminology-data' argument. Please use the "
"'--data-file' option instead to specify a "
"file."
)
DOCUMENT_DOCSTRING = (
"<p>The path to a file of the content you are uploading "
"Example: fileb://data.txt</p>"
)
DOCUMENT_ERRORSTRING = (
"Content cannot be provided as a part of the "
"'--document' argument. Please use the '--document-content' option instead "
"to specify a file."
)
def register_translate_import_terminology(cli):
cli.register(
"building-argument-table.translate.import-terminology",
BinaryBlobArgumentHoister(
new_argument=ArgumentParameters(
name="data-file",
help_text=FILE_DOCSTRING,
required=True,
),
original_argument=ArgumentParameters(
name="terminology-data",
member="File",
required=False,
),
error_if_original_used=FILE_ERRORSTRING,
),
),
cli.register(
"building-argument-table.translate.translate-document",
BinaryBlobArgumentHoister(
new_argument=ArgumentParameters(
name="document-content",
help_text=DOCUMENT_DOCSTRING,
required=True,
),
original_argument=ArgumentParameters(
name="document",
member="Content",
required=True,
),
error_if_original_used=DOCUMENT_ERRORSTRING,
),
)