Completed
Push — master ( 3c108b...266306 )
by Oleksandr
03:35
created

validate_gettext_tools_exist()   A

Complexity

Conditions 3

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 3
nop 0
1
import itertools
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
3
from pathlib import Path
4
5
from typing import List
6
from typing import Text
7
8
from .text import normalize_eols
9
from .text import stringify_path
10
11
from .utils import find_executable
12
from .utils import popen_wrapper
13
from .utils import print_err
14
15
16
GETTEXT_TOOLS_STATUS_OK = 0
17
GETTEXT_TOOLS_EXECUTABLES = [
18
  "xgettext",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
19
  "msguniq",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
20
  "msgmerge",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
21
  "msgattrib",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
22
  "msgfmt",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
23
]
24
25
26
def validate_gettext_tools_exist() -> None:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
27
  for executable_name in GETTEXT_TOOLS_EXECUTABLES:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
28
    if find_executable(executable_name) is None:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
29
      raise OSError(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 12 spaces were expected, but 6 were found.
Loading history...
30
        f"cannot find executable '{executable_name}': make sure you have GNU "
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
31
        f"gettext tools 0.15 or newer installed"
32
      )
33
34
35
def get_gettext_tool_output(args: List[Text]) -> Text:
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
36
  content, errors, status = popen_wrapper(args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
37
38
  if errors:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
39
    if status != GETTEXT_TOOLS_STATUS_OK:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
Unused Code introduced by
Unnecessary "else" after "raise"
Loading history...
40
      tool_name = args[0]
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 12 spaces were expected, but 6 were found.
Loading history...
41
      raise RuntimeError(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 12 spaces were expected, but 6 were found.
Loading history...
42
        f"failed to run gettext tool '{tool_name}' (status={status}): "
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
43
        f"{errors}"
44
      )
45
    else:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
46
      print_err(errors)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 12 spaces were expected, but 6 were found.
Loading history...
47
48
  if content:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
49
    content = normalize_eols(content)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
50
51
  return content
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
52
53
54
def _make_xgettext_args(
0 ignored issues
show
best-practice introduced by
Too many arguments (6/5)
Loading history...
55
  source_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
56
  domain: Text,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
57
  keywords: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
58
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
59
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
60
  extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
61
) -> List[Text]:
62
63
  args = [
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
64
    "xgettext",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
65
    "-d", domain,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
66
    "--from-code=UTF-8",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
67
    "--add-comments=Translators",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
68
    "--output=-",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
69
  ]
70
71
  args.extend([f"--keyword={x}" for x in keywords])
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
72
73
  if no_wrap:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
74
    args.append("--no-wrap")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
75
76
  if no_location:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
77
    args.append("--no-location")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
78
79
  if extra_args:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
80
    args.extend(extra_args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
81
82
  args.append(stringify_path(source_file_path))
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
83
84
  return args
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
85
86
87
def extract_translations(
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
best-practice introduced by
Too many arguments (6/5)
Loading history...
88
  source_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
89
  domain: Text,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
90
  keywords: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
91
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
92
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
93
  xgettext_extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
94
) -> Text:
95
96
  args = _make_xgettext_args(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
97
    source_file_path=source_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
98
    domain=domain,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
99
    keywords=keywords,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
100
    no_wrap=no_wrap,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
101
    no_location=no_location,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
102
    extra_args=xgettext_extra_args,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
103
  )
104
  return get_gettext_tool_output(args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
105
106
107
def strip_translations_header(translations: Text) -> Text:
108
  """
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
109
  Strip header from translations generated by ``xgettext``.
110
111
  Header consists of multiple lines separated from the body by an empty line.
112
113
  """
114
  return "\n".join(itertools.dropwhile(len, translations.splitlines()))
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
115
116
117
def _make_msguniq_args(
118
  pot_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
119
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
120
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
121
  extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
122
) -> List[Text]:
123
124
  args = [
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
125
    "msguniq",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
126
    "--to-code=utf-8",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
127
  ]
128
129
  if no_wrap:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
130
    args.append("--no-wrap")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
131
132
  if no_location:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
133
    args.append("--no-location")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
134
135
  if extra_args:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
136
    args.extend(extra_args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
137
138
  args.append(stringify_path(pot_file_path))
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
139
140
  return args
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
141
142
143
def extract_unique_messages(
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
144
  pot_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
145
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
146
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
147
  msguniq_extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
148
) -> Text:
149
150
  args = _make_msguniq_args(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
151
    pot_file_path=pot_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
152
    no_wrap=no_wrap,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
153
    no_location=no_location,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
154
    extra_args=msguniq_extra_args,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
155
  )
156
  return get_gettext_tool_output(args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
157
158
159
def _make_msgmerge_args(
160
  po_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
161
  pot_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
162
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
163
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
164
  extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
165
) -> List[Text]:
166
167
  args = [
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
168
    "msgmerge",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
169
    "-q",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
170
    "--previous",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
171
  ]
172
173
  if no_wrap:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
174
    args.append("--no-wrap")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
175
176
  if no_location:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
177
    args.append("--no-location")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
178
179
  if extra_args:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
180
    args.extend(extra_args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
181
182
  args.append(stringify_path(po_file_path))
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
183
  args.append(stringify_path(pot_file_path))
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
184
185
  return args
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
186
187
188
def merge_new_and_existing_translations(
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
189
  po_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
190
  pot_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
191
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
192
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
193
  msgmerge_extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
194
) -> Text:
195
196
  args = _make_msgmerge_args(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
197
    po_file_path=po_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
198
    pot_file_path=pot_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
199
    no_wrap=no_wrap,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
200
    no_location=no_location,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
201
    extra_args=msgmerge_extra_args,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
202
  )
203
  return get_gettext_tool_output(args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
204
205
206
def _make_msgattrib_args(
207
  po_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
208
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
209
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
210
  extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
211
) -> List[Text]:
212
213
  args = [
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
214
    "msgattrib",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
215
    "--no-obsolete",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
216
  ]
217
218
  if no_wrap:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
219
    args.append("--no-wrap")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
220
221
  if no_location:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
222
    args.append("--no-location")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
223
224
  if extra_args:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
225
    args.extend(extra_args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
226
227
  po_file_path_str = stringify_path(po_file_path)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
228
229
  args.extend([
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
230
    "-o",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
231
    po_file_path_str,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
232
    po_file_path_str,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
233
  ])
234
235
  return args
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
236
237
238
def remove_obsolete_translations(
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
239
  po_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
240
  no_wrap: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
241
  no_location: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
242
  msgattrib_extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
243
) -> Text:
244
245
  args = _make_msgattrib_args(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
246
    po_file_path=po_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
247
    no_wrap=no_wrap,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
248
    no_location=no_location,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
249
    extra_args=msgattrib_extra_args,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
250
  )
251
  _ = get_gettext_tool_output(args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
252
253
254
def _make_msgfmt_args(
255
  mo_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
256
  po_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
257
  fuzzy: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
258
  extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
259
) -> List[Text]:
260
261
  args = [
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
262
    "msgfmt",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
263
    "--check-format",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
264
  ]
265
266
  if fuzzy:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
267
    args.append("-f")
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
268
269
  if extra_args:
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
270
    args.extend(extra_args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 8 spaces were expected, but 4 were found.
Loading history...
271
272
  args.extend([
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
273
    "-o",
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
274
    stringify_path(mo_file_path),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
275
    stringify_path(po_file_path),
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
276
  ])
277
278
  return args
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
279
280
281
def compile_translations(
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
282
  mo_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
283
  po_file_path: Path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
284
  fuzzy: bool,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
285
  msgfmt_extra_args: List[Text],
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation before block.
Loading history...
286
) -> None:
287
288
  args = _make_msgfmt_args(
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
289
    mo_file_path=mo_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
290
    po_file_path=po_file_path,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
291
    fuzzy=fuzzy,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
292
    extra_args=msgfmt_extra_args,
0 ignored issues
show
Coding Style introduced by
Wrong hanging indentation (add 2 spaces).
Loading history...
293
  )
294
  _ = get_gettext_tool_output(args)
0 ignored issues
show
Coding Style introduced by
The indentation here looks off. 4 spaces were expected, but 2 were found.
Loading history...
295