Skip to content

Commit

Permalink
add pycodestyle recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
akcano committed Oct 15, 2024
1 parent ae0aed0 commit a7abebf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 25 deletions.
15 changes: 12 additions & 3 deletions sp-files/.sphinx/get_vale_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ def main():
else:
os.makedirs(f"{DIR}/.sphinx/styles/Canonical")

url = "https://api.github.com/repos/canonical/praecepta/contents/styles/Canonical"
url = (
"https://api.github.com/repos/canonical/praecepta/"
+ "contents/styles/Canonical"
)
r = requests.get(url)
for item in r.json():
download = requests.get(item["download_url"])
Expand All @@ -25,11 +28,17 @@ def main():
else:
os.makedirs(f"{DIR}/.sphinx/styles/config/vocabularies/Canonical")

url = "https://api.github.com/repos/canonical/praecepta/contents/styles/config/vocabularies/Canonical"
url = (
"https://api.github.com/repos/canonical/praecepta/"
+ "contents/styles/config/vocabularies/Canonical"
)
r = requests.get(url)
for item in r.json():
download = requests.get(item["download_url"])
file = open(".sphinx/styles/config/vocabularies/Canonical/" + item["name"], "w")
file = open(
".sphinx/styles/config/vocabularies/Canonical/" + item["name"],
"w"
)
file.write(download.text)
file.close()
config = requests.get(
Expand Down
50 changes: 28 additions & 22 deletions sp-files/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# https://github.com/canonical/canonical-sphinx


###########################
### Project information ###
###########################
#######################
# Project information #
#######################

# Project name
#
Expand All @@ -41,12 +41,12 @@
# Now, the starter pack uses CC-BY-SA as the license
# and the current year as the copyright year.
#
# TODO: If your docs need a different license, specify it instead of 'CC-BY-SA'.
# TODO: If your docs need another license, specify it instead of 'CC-BY-SA'.
#
# TODO: If your documentation is a part of the code repository of your project,
# it inherits the code license instead; specify it instead of 'CC-BY-SA'.
#
# NOTE: For static works, it is common to provide the year of first publication.
# NOTE: For static works, it is common to provide the first publication year.
# Another option is to provide both the first year of publication
# and the current year, especially for docs that frequently change,
# e.g. 2022–2023 (note the en-dash).
Expand Down Expand Up @@ -83,7 +83,8 @@
#
# TODO: To customise the preview image, update as needed.

ogp_image = "https://assets.ubuntu.com/v1/253da317-image-document-ubuntudocs.svg"
ogp_image = \
"https://assets.ubuntu.com/v1/253da317-image-document-ubuntudocs.svg"


# Product favicon; shown in bookmarks, browser tabs, etc.
Expand Down Expand Up @@ -120,7 +121,8 @@
# Your Mattermost channel URL
#
# TODO: Change to your Mattermost channel URL or leave empty.
"mattermost": "https://chat.canonical.com/canonical/channels/documentation",
"mattermost":
"https://chat.canonical.com/canonical/channels/documentation",
# Your Matrix channel URL
#
# TODO: Change to your Matrix channel URL or leave empty.
Expand Down Expand Up @@ -156,9 +158,9 @@
templates_path = [".sphinx/_templates"]


#################
### Redirects ###
#################
#############
# Redirects #
#############

# To set up redirects: https://documatt.gitlab.io/sphinx-reredirects/usage.html
# For example: 'explanation/old-name.html': '../how-to/prettify.html',
Expand All @@ -172,25 +174,28 @@
redirects = {}


###############################
### Link checker exceptions ###
###############################
###########################
# Link checker exceptions #
###########################

# A regex list of URLs that are ignored by 'make linkcheck'
#
# TODO: Remove or adjust the ACME entry after you update the contributing guide

linkcheck_ignore = ["http://127.0.0.1:8000", "https://github.com/canonical/ACME/*"]
linkcheck_ignore = [
"http://127.0.0.1:8000",
"https://github.com/canonical/ACME/*"
]


# A regex list of URLs where anchors are ignored by 'make linkcheck'

linkcheck_anchors_ignore_for_url = [r"https://github\.com/.*"]


############################
### Configuration extras ###
############################
########################
# Configuration extras #
########################

# Custom MyST syntax extensions; see
# https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
Expand Down Expand Up @@ -263,7 +268,8 @@
# NOTE: If set, adding ':manpage:' to an .rst file
# adds a link to the corresponding man section at the bottom of the page.

# manpages_url = 'https://manpages.ubuntu.com/manpages/noble/en/man{section}/{page}.{section}.html'
# manpages_url = f'https://manpages.ubuntu.com/manpages/{codename}/en/' + \
# f'man{section}/{page}.{section}.html'


# Specifies a reST snippet to be prepended to each .rst file
Expand All @@ -279,12 +285,12 @@

# Workaround for https://github.com/canonical/canonical-sphinx/issues/34

if not "discourse_prefix" in html_context and "discourse" in html_context:
if "discourse_prefix" not in html_context and "discourse" in html_context:
html_context["discourse_prefix"] = html_context["discourse"] + "/t/"

############################################################
### PDF configuration
############################################################
#####################
# PDF configuration #
#####################

latex_additional_files = [
"./.sphinx/fonts/Ubuntu-B.ttf",
Expand Down

0 comments on commit a7abebf

Please sign in to comment.