-
Notifications
You must be signed in to change notification settings - Fork 5
Build status #33
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
Build status #33
Changes from 7 commits
c63bbe5
e80c83d
24b2f1c
16ea987
6d01497
6cc936f
56b5dce
5bfd768
289824f
e4965d5
2db4095
a1a7f33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,37 @@ | ||||||||||||||||
| """ | ||||||||||||||||
| Fetch build status of languages in the https://docs.python.org. | ||||||||||||||||
| Yield a tuple of language code and a Boolean indicating | ||||||||||||||||
| whether it is in the language switcher. | ||||||||||||||||
| """ | ||||||||||||||||
|
|
||||||||||||||||
| import tomllib | ||||||||||||||||
| from collections.abc import Generator | ||||||||||||||||
|
|
||||||||||||||||
| import requests | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| def get_languages() -> Generator[tuple[str, bool]]: | ||||||||||||||||
| data = requests.get( | ||||||||||||||||
| 'https://raw.githubusercontent.com/' | ||||||||||||||||
| 'python/docsbuild-scripts/refs/heads/main/config.toml', | ||||||||||||||||
| timeout=10, | ||||||||||||||||
| ).text | ||||||||||||||||
| config = tomllib.loads(data) | ||||||||||||||||
| languages = config['languages'] | ||||||||||||||||
| defaults = config['defaults'] | ||||||||||||||||
| for code, language in languages.items(): | ||||||||||||||||
| language_code = code.lower().replace('_', '-') | ||||||||||||||||
| in_switcher = language.get('in_prod', defaults['in_prod']) | ||||||||||||||||
|
||||||||||||||||
| defaults = config['defaults'] | |
| for code, language in languages.items(): | |
| language_code = code.lower().replace('_', '-') | |
| in_switcher = language.get('in_prod', defaults['in_prod']) | |
| for code, language in languages.items(): | |
| language_code = code.lower().replace('_', '-') | |
| in_switcher = language.get('in_prod', True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reviewing! I agree that this suggestion improves readability. I'm concerned it doesn't honour https://github.com/python/docsbuild-scripts/blob/e4a8aff9772738a63d0945042777d18c3d926930/config.toml#L3; I was thinking if to propose a simplification upstream, but it makes the toml config file better self-describing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've simplified this code a bit https://github.com/m-aciek/pydocs-translation-dashboard/pull/33/commits/2db4095e9ff47d33a578234b5aa9f0f52fd6f940
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.