Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit78db6b8

Browse files
committed
black
1 parent52fefb8 commit78db6b8

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

‎scripts/generate_txconfig.py‎

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
frompathlibimportPath
1313

1414
# Replaces required to fix the default values set by 'tx add remote' command.
15-
# Add or remove
15+
# Add or remove
1616
TEXT_TO_REPLACE= {
1717
"2_":"2.",
1818
"3_":"3.",
@@ -38,20 +38,20 @@
3838
"xml_etree_":"xml.etree.",
3939
"xmlrpc_":"xmlrpc.",
4040
"xml_sax_":"xml.sax.",
41-
"xml_":"xml."
41+
"xml_":"xml.",
4242
}
4343

44+
4445
defparse_args():
4546
parser=argparse.ArgumentParser(description=__doc__)
4647
parser.add_argument(
4748
"--root-path",
4849
"-p",
4950
default=Path("."),
50-
help="Path to the translation files, and also the .tx/config (defaults to current directory)"
51+
help="Path to the translation files, and also the .tx/config (defaults to current directory)",
5152
)
5253
parser.add_argument(
53-
"tx_project",
54-
help="Slug of the Transifex project to query resources from"
54+
"tx_project",help="Slug of the Transifex project to query resources from"
5555
)
5656
returnparser.parse_args()
5757

@@ -65,11 +65,19 @@ def reset_tx_config(txconfig: Path):
6565

6666
defpopulate_resources_from_remote(config_file:Path,tx_project:str):
6767
"""Add the remote resources from the Transifex project to .tx/config."""
68-
result=subprocess.run([
69-
"tx","--config",str(config_file),"add","remote",
70-
"--file-filter","<lang>/<resource_slug>.<ext>",
71-
f"https://app.transifex.com/python-doc/{tx_project}/"
72-
],check=True)
68+
result=subprocess.run(
69+
[
70+
"tx",
71+
"--config",
72+
str(config_file),
73+
"add",
74+
"remote",
75+
"--file-filter",
76+
"<lang>/<resource_slug>.<ext>",
77+
f"https://app.transifex.com/python-doc/{tx_project}/",
78+
],
79+
check=True,
80+
)
7381
ifresult.returncode!=0:
7482
print("Failed to add the resources from remote:")
7583
print(result.stderr.strip())
@@ -91,9 +99,9 @@ def patch_config(txconfig: Path):
9199
line=line.replace("--","/")
92100

93101
forpattern,replacementinTEXT_TO_REPLACE.items():
94-
ifpatterninline:
95-
line=line.replace(pattern,replacement)
96-
break
102+
ifpatterninline:
103+
line=line.replace(pattern,replacement)
104+
break
97105

98106
new_lines.append(line)
99107

@@ -102,6 +110,7 @@ def patch_config(txconfig: Path):
102110
txconfig.write_text(text+"\n",encoding="utf-8")
103111
print("Updated .tx/config with character substitutions")
104112

113+
105114
defmain():
106115
args=parse_args()
107116
config_path=Path(".tx/config")

‎scripts/stats.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def main() -> None:
2222
iflang_dir:
2323
pofiles_path=Path(lang_dir)
2424
else:
25-
language=os.environ.get("PYDOC_LANGUAGE")
26-
ifnotlanguage:
27-
raiseValueError("Environment variable PYDOC_LANGUAGE is not set.")
28-
pofiles_path=Path(f"cpython/Doc/locales/{language}/LC_MESSAGES")
25+
language=os.environ.get("PYDOC_LANGUAGE")
26+
ifnotlanguage:
27+
raiseValueError("Environment variable PYDOC_LANGUAGE is not set.")
28+
pofiles_path=Path(f"cpython/Doc/locales/{language}/LC_MESSAGES")
2929

3030
ifnotpofiles_path.exists():
3131
raiseFileNotFoundError(f"Path does not exist:{pofiles_path}")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp