Skip to content

Commit

Permalink
Reformat code using ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaine committed Jan 12, 2024
1 parent 1db3fa7 commit 28d4487
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 53 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
with:
python-version: 3.8
- name: Install packages
run: pip install black mypy ruff types-certifi types-cryptography types-pyopenssl
run: pip install mypy ruff types-certifi types-cryptography types-pyopenssl
- name: Run linters
run: |
ruff examples src tests
black --check --diff examples src tests
ruff .
ruff format --check --diff .
mypy src tests
codespell:
Expand Down
5 changes: 1 addition & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aioquic
=======

|rtd| |pypi-v| |pypi-pyversions| |pypi-l| |tests| |codecov| |black|
|rtd| |pypi-v| |pypi-pyversions| |pypi-l| |tests| |codecov|

.. |rtd| image:: https://readthedocs.org/projects/aioquic/badge/?version=latest
:target: https://aioquic.readthedocs.io/
Expand All @@ -21,9 +21,6 @@ aioquic
.. |codecov| image:: https://img.shields.io/codecov/c/github/aiortc/aioquic.svg
:target: https://codecov.io/gh/aiortc/aioquic

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/python/black

What is ``aioquic``?
--------------------

Expand Down
86 changes: 43 additions & 43 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os
import os
import sys

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath(".."))


# -- General configuration ------------------------------------------------
Expand All @@ -31,41 +32,41 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints',
'sphinxcontrib_trio',
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx_autodoc_typehints",
"sphinxcontrib_trio",
]
intersphinx_mapping = {
'cryptography': ('https://cryptography.io/en/latest', None),
'python': ('https://docs.python.org/3', None),
"cryptography": ("https://cryptography.io/en/latest", None),
"python": ("https://docs.python.org/3", None),
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'aioquic'
copyright = u'2019, Jeremy Lainé'
author = u'Jeremy Lainé'
project = "aioquic"
copyright = "2019, Jeremy Lainé"
author = "Jeremy Lainé"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = ''
version = ""
# The full version, including alpha/beta/rc tags.
release = ''
release = ""

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -77,10 +78,10 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -91,44 +92,44 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
'description': 'A library for QUIC in Python.',
'github_button': True,
'github_user': 'aiortc',
'github_repo': 'aioquic',
'logo': 'aioquic.svg',
"description": "A library for QUIC in Python.",
"github_button": True,
"github_user": "aiortc",
"github_repo": "aioquic",
"logo": "aioquic.svg",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html',
'searchbox.html',
"**": [
"about.html",
"navigation.html",
"relations.html",
"searchbox.html",
]
}


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'aioquicdoc'
htmlhelp_basename = "aioquicdoc"


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -137,15 +138,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -155,19 +153,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'aioquic.tex', 'aioquic Documentation',
author, 'manual'),
(master_doc, "aioquic.tex", "aioquic Documentation", author, "manual"),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'aioquic', 'aioquic Documentation',
[author], 1)
]
man_pages = [(master_doc, "aioquic", "aioquic Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -176,7 +170,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'aioquic', 'aioquic Documentation',
author, 'aioquic', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"aioquic",
"aioquic Documentation",
author,
"aioquic",
"One line description of project.",
"Miscellaneous",
),
]
2 changes: 1 addition & 1 deletion scripts/fetch-vendor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse
import logging
import json
import logging
import os
import platform
import shutil
Expand Down
2 changes: 1 addition & 1 deletion src/aioquic/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ def decode_public_key(
def encode_public_key(
public_key: Union[
ec.EllipticCurvePublicKey, x25519.X25519PublicKey, x448.X448PublicKey
]
],
) -> KeyShareEntry:
if isinstance(public_key, x25519.X25519PublicKey):
return (Group.X25519, public_key.public_bytes(Encoding.Raw, PublicFormat.Raw))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def test_pull_version_negotiation(self):
versions = []
while not buf.eof():
versions.append(buf.pull_uint32())
self.assertEqual(versions, [0x45474716, QuicProtocolVersion.VERSION_1]),
self.assertEqual(versions, [0x45474716, QuicProtocolVersion.VERSION_1])

def test_pull_long_header_dcid_too_long(self):
buf = Buffer(
Expand Down

0 comments on commit 28d4487

Please sign in to comment.