Skip to content

Commit 6895464

Browse files
isratenedastsewd
authored andcommitted
Añadir black y formatear archivos de python
1 parent bb94457 commit 6895464

File tree

8 files changed

+109
-84
lines changed

8 files changed

+109
-84
lines changed

.github/workflows/ci.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ jobs:
2020
run: |
2121
python3 -m pip install --upgrade pip
2222
python3 -m pip install nox
23-
- name: Lint and build
24-
run: nox
23+
- name: Tests
24+
run: python -m nox -s tests
25+
- name: Lint
26+
run: python -m nox -s lint_rst lint_yaml lint_python
2527
- name: Deploy
2628
if: ${{ github.ref == 'refs/heads/main' }}
2729
uses: peaceiris/actions-gh-pages@v3

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,10 @@ serve:
77
deploy:
88
NIKOLA_DEPLOY=python.ec nikola github_deploy
99

10+
lint:
11+
python -m nox -r -s lint_python
12+
13+
format:
14+
python -m nox -r -s format_python
15+
1016
.PHONY: clean serve

conf.py

+49-44
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020
BLOG_TITLE = "Python Ecuador" # (translatable)
2121
# This is the main URL for your site. It will be used
2222
# in a prominent link. Don't forget the protocol (http/https)!
23-
deploy_site = os.environ.get('NIKOLA_DEPLOY')
23+
deploy_site = os.environ.get("NIKOLA_DEPLOY")
2424
if deploy_site:
25-
SITE_URL = 'https://{}/'.format(deploy_site.rstrip('/'))
25+
SITE_URL = "https://{}/".format(deploy_site.rstrip("/"))
2626
else:
27-
SITE_URL = 'http://localhost:8000/'
27+
SITE_URL = "http://localhost:8000/"
2828
# This is the URL where Nikola's output will be deployed.
2929
# If not set, defaults to SITE_URL
3030
# BASE_URL = "https://pythonecuador.github.io/"
3131
BLOG_EMAIL = "[email protected]"
32-
BLOG_DESCRIPTION = "Comunidad de Python, Open Source y Software Libre de Ecuador" # (translatable)
32+
BLOG_DESCRIPTION = (
33+
"Comunidad de Python, Open Source y Software Libre de Ecuador" # (translatable)
34+
)
3335

3436
# Nikola is multilingual!
3537
#
@@ -156,16 +158,14 @@
156158
# Alternative navigation links. Works the same way NAVIGATION_LINKS does,
157159
# although themes may not always support them. (translatable)
158160
# (Bootstrap 4: right-side of navbar, Bootblog 4: right side of title)
159-
NAVIGATION_ALT_LINKS = {
160-
DEFAULT_LANG: {}
161-
}
161+
NAVIGATION_ALT_LINKS = {DEFAULT_LANG: {}}
162162

163163
# Name of the theme to use.
164164
THEME = "custom"
165165

166166
# Primary color of your theme. This will be used to customize your theme.
167167
# Must be a HEX value.
168-
THEME_COLOR = '#5670d4'
168+
THEME_COLOR = "#5670d4"
169169

170170
# Theme configuration. Fully theme-dependent. (translatable)
171171
# Examples below are for bootblog4.
@@ -175,18 +175,18 @@
175175
THEME_CONFIG = {
176176
DEFAULT_LANG: {
177177
# Show the latest featured post in a large box, with the previewimage as its background.
178-
'featured_large': False,
178+
"featured_large": False,
179179
# Show the first (remaining) two featured posts in small boxes.
180-
'featured_small': False,
180+
"featured_small": False,
181181
# Show featured posts on mobile.
182-
'featured_on_mobile': True,
182+
"featured_on_mobile": True,
183183
# Show image in `featured_large` on mobile.
184184
# `featured_small` displays them only on desktop.
185-
'featured_large_image_on_mobile': True,
185+
"featured_large_image_on_mobile": True,
186186
# Strip HTML from featured post text.
187-
'featured_strip_html': False,
187+
"featured_strip_html": False,
188188
# Contents of the sidebar, If empty, the sidebar is not displayed.
189-
'sidebar': ''
189+
"sidebar": "",
190190
}
191191
}
192192

@@ -257,7 +257,7 @@
257257
# Date format used to display post dates. (translatable)
258258
# Used by babel.dates, CLDR style: http://cldr.unicode.org/translation/date-time
259259
# You can also use 'full', 'long', 'medium', or 'short'
260-
DATE_FORMAT = 'YYYY-MM-dd'
260+
DATE_FORMAT = "YYYY-MM-dd"
261261

262262
# Date format used to display post dates, if local dates are used. (translatable)
263263
# Used by moment.js: https://momentjs.com/docs/#/displaying/format/
@@ -296,18 +296,18 @@
296296
# 'markdown' is Markdown
297297
# 'html' assumes the file is HTML and just copies it
298298
COMPILERS = {
299-
"rest": ('.rst', '.txt'),
300-
"markdown": ('.md', '.mdown', '.markdown'),
301-
"textile": ('.textile',),
302-
"txt2tags": ('.t2t',),
303-
"bbcode": ('.bb',),
304-
"wiki": ('.wiki',),
305-
"ipynb": ('.ipynb',),
306-
"html": ('.html', '.htm'),
299+
"rest": (".rst", ".txt"),
300+
"markdown": (".md", ".mdown", ".markdown"),
301+
"textile": (".textile",),
302+
"txt2tags": (".t2t",),
303+
"bbcode": (".bb",),
304+
"wiki": (".wiki",),
305+
"ipynb": (".ipynb",),
306+
"html": (".html", ".htm"),
307307
# PHP files are rendered the usual way (i.e. with the full templates).
308308
# The resulting files have .php extensions, making it possible to run
309309
# them without reconfiguring your server to recognize them.
310-
"php": ('.php',),
310+
"php": (".php",),
311311
# Pandoc detects the input from the source filename
312312
# but is disabled by default as it would conflict
313313
# with many of the others.
@@ -392,7 +392,7 @@
392392
# If you do not want to display a tag publicly, you can mark it as hidden.
393393
# The tag will not be displayed on the tag list page and posts.
394394
# Tag pages will still be generated.
395-
HIDDEN_TAGS = ['mathjax']
395+
HIDDEN_TAGS = ["mathjax"]
396396

397397
# Only include tags on the tag list/overview page if there are at least
398398
# TAGLIST_MINIMUM_POSTS number of posts or more with every tag. Every tag
@@ -538,15 +538,15 @@
538538
"""
539539
<a href="https://seburath.github.io">https://seburath.github.io</a>
540540
"""
541-
)
541+
),
542542
},
543543
}
544544

545545

546546
# If you do not want to display an author publicly, you can mark it as hidden.
547547
# The author will not be displayed on the author list page and posts.
548548
# Tag pages will still be generated.
549-
HIDDEN_AUTHORS = ['Guest']
549+
HIDDEN_AUTHORS = ["Guest"]
550550

551551
# Final location for the main blog page and sibling paginated pages is
552552
# output / TRANSLATION[lang] / INDEX_PATH / index-*.html
@@ -555,9 +555,7 @@
555555

556556
# Optional HTML that displayed on “main” blog index.html files.
557557
# May be used for a greeting. (translatable)
558-
FRONT_INDEX_HEADER = {
559-
DEFAULT_LANG: ''
560-
}
558+
FRONT_INDEX_HEADER = {DEFAULT_LANG: ""}
561559

562560
# Create per-month archives instead of per-year
563561
# CREATE_MONTHLY_ARCHIVE = False
@@ -651,11 +649,11 @@
651649
# For more details, read the manual:
652650
# https://getnikola.com/handbook.html#deploying-to-github
653651
# You will need to configure the deployment branch on GitHub.
654-
GITHUB_SOURCE_BRANCH = 'main'
655-
GITHUB_DEPLOY_BRANCH = 'gh-pages'
652+
GITHUB_SOURCE_BRANCH = "main"
653+
GITHUB_DEPLOY_BRANCH = "gh-pages"
656654

657655
# The name of the remote where you wish to push to, using github_deploy.
658-
GITHUB_REMOTE_NAME = 'origin'
656+
GITHUB_REMOTE_NAME = "origin"
659657

660658
# Whether or not github_deploy should commit to the source branch automatically
661659
# before deploying.
@@ -820,7 +818,7 @@
820818
# (the thumbnail has ``.thumbnail`` added before the file extension by default,
821819
# but a different naming template can be configured with IMAGE_THUMBNAIL_FORMAT).
822820

823-
IMAGE_FOLDERS = {'images': 'images'}
821+
IMAGE_FOLDERS = {"images": "images"}
824822
# IMAGE_THUMBNAIL_SIZE = 400
825823
# IMAGE_THUMBNAIL_FORMAT = '{name}.thumbnail{ext}'
826824

@@ -943,7 +941,7 @@
943941

944942
# A small copyright notice for the page footer (in HTML).
945943
# (translatable)
946-
CONTENT_FOOTER = '''
944+
CONTENT_FOOTER = """
947945
<div class="container">
948946
<div class="row text-center">
949947
<div class="col">
@@ -979,7 +977,7 @@
979977
</div>
980978
</div>
981979
</div>
982-
'''
980+
"""
983981

984982
# Things that will be passed to CONTENT_FOOTER.format(). This is done
985983
# for translatability, as dicts are not formattable. Nikola will
@@ -995,11 +993,12 @@
995993
# do not need formatting)
996994
# (translatable)
997995
def get_last_commit():
998-
encoding = 'utf-8'
996+
encoding = "utf-8"
999997
command = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True)
1000998
last_hash = command.stdout.decode(encoding)
1001999
return last_hash[0:8]
10021000

1001+
10031002
CONTENT_FOOTER_FORMATS = {
10041003
DEFAULT_LANG: (
10051004
(),
@@ -1008,15 +1007,15 @@ def get_last_commit():
10081007
"author": BLOG_AUTHOR,
10091008
"date": time.gmtime().tm_year,
10101009
"license": LICENSE,
1011-
"commit": get_last_commit()
1012-
}
1010+
"commit": get_last_commit(),
1011+
},
10131012
)
10141013
}
10151014

10161015
# A simple copyright tag for inclusion in RSS feeds that works just
10171016
# like CONTENT_FOOTER and CONTENT_FOOTER_FORMATS
10181017
RSS_COPYRIGHT = 'Contents © {date} <a href="mailto:{email}">{author}</a> {license}'
1019-
RSS_COPYRIGHT_PLAIN = 'Contents © {date} {author} {license}'
1018+
RSS_COPYRIGHT_PLAIN = "Contents © {date} {author} {license}"
10201019
RSS_COPYRIGHT_FORMATS = CONTENT_FOOTER_FORMATS
10211020

10221021
# To use comments, you can choose between different third party comment
@@ -1131,7 +1130,11 @@ def get_last_commit():
11311130
# with the MarkdownExtension class and should not be added here.
11321131
# Defaults are markdown.extensions.(fenced_code|codehilite|extra)
11331132
# markdown.extensions.meta is required for Markdown metadata.
1134-
MARKDOWN_EXTENSIONS = ['markdown.extensions.fenced_code', 'markdown.extensions.codehilite', 'markdown.extensions.extra']
1133+
MARKDOWN_EXTENSIONS = [
1134+
"markdown.extensions.fenced_code",
1135+
"markdown.extensions.codehilite",
1136+
"markdown.extensions.extra",
1137+
]
11351138

11361139
# Options to be passed to markdown extensions (See https://python-markdown.github.io/reference/)
11371140
# Default is {} (no config at all)
@@ -1334,11 +1337,11 @@ def get_last_commit():
13341337
# Images displayed come from the `previewimage` meta tag.
13351338
# You can specify the card type by using the `card` parameter in TWITTER_CARD.
13361339
TWITTER_CARD = {
1337-
'use_twitter_cards': True, # enable Twitter Cards
1340+
"use_twitter_cards": True, # enable Twitter Cards
13381341
# Card type, you can also use 'summary_large_image',
13391342
# see https://dev.twitter.com/cards/types
1340-
'card': 'summary',
1341-
'site': '@pyecuador', # twitter nick for the website
1343+
"card": "summary",
1344+
"site": "@pyecuador", # twitter nick for the website
13421345
# 'creator': '@username', # Username for the content creator / author.
13431346
}
13441347

@@ -1403,13 +1406,15 @@ def get_last_commit():
14031406
# those.
14041407
TEMPLATE_FILTERS = {}
14051408

1409+
14061410
def time_to_date(text):
14071411
import datetime
14081412

14091413
seconds = int(text) / 1000
14101414
time = datetime.date.fromtimestamp(seconds)
14111415
return time.strftime("%d/%m/%Y")
14121416

1417+
14131418
TEMPLATE_FILTERS["time"] = time_to_date
14141419

14151420
# Put in global_context things you want available on all your templates.

noxfile.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@
33

44
@nox.session
55
def tests(session):
6-
session.install('-r', 'requirements.txt')
7-
session.run('nikola', 'build', '--strict')
8-
session.run('nikola', 'check', '--check-links', '--check-files')
6+
session.install("-r", "requirements.txt")
7+
session.run("nikola", "build", "--strict")
8+
session.run("nikola", "check", "--check-links", "--check-files")
99

1010

1111
@nox.session
1212
def lint_rst(session):
13-
session.install('rstcheck')
14-
session.run('rstcheck', '-r', '.')
13+
session.install("rstcheck")
14+
session.run("rstcheck", "-r", ".")
1515

1616

1717
@nox.session
1818
def lint_yaml(session):
19-
session.install('yamllint')
20-
session.run('yamllint', '-s', 'data')
19+
session.install("yamllint")
20+
session.run("yamllint", "-s", "data")
21+
22+
23+
@nox.session
24+
def lint_python(session):
25+
session.install("black")
26+
session.run("black", "--check", ".")
27+
28+
29+
@nox.session
30+
def format_python(session):
31+
session.install("black")
32+
session.run("black", ".")

plugins/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Plugin modules go here.
1+
# Plugin modules go here.

plugins/sphinx_roles/sphinx_roles.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def emph_literal_role(typ, rawtext, text, lineno, inliner, options={}, content=[
196196
retnode = nodes.literal(role=typ.lower(), classes=[typ])
197197
for m in _litvar_re.finditer(text):
198198
if m.start() > pos:
199-
txt = text[pos:m.start()]
199+
txt = text[pos : m.start()]
200200
retnode += nodes.Text(txt, txt)
201201
retnode += nodes.emphasis(m.group(1), m.group(1))
202202
pos = m.end()

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nikola[extras]==8.1.3
1+
nikola[extras]==8.1.3

0 commit comments

Comments
 (0)