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 13, 2024
1 parent 571de1c commit c12a556
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
with:
python-version: 3.8
- name: Install packages
run: pip install black ruff
run: pip install ruff
- name: Run linters
run: |
ruff src tests
black --check --diff src tests
ruff .
ruff format --check --diff .
test:
runs-on: ${{ matrix.os }}
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@
*.so
.coverage
.eggs
.idea
.mypy_cache
.vscode
/build
/dist
/docs/_build

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
71 changes: 34 additions & 37 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 os, sys
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 @@ -29,33 +30,33 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc']
extensions = ["sphinx.ext.autodoc"]

# 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 = 'pylibsrtp'
copyright = u'2018, Jeremy Lainé'
author = u'Jeremy Lainé'
project = "pylibsrtp"
copyright = "2018, 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 @@ -67,10 +68,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 @@ -81,40 +82,40 @@
# 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 = {
'github_button': True,
'github_user': 'aiortc',
'github_repo': 'pylibsrtp',
"github_button": True,
"github_user": "aiortc",
"github_repo": "pylibsrtp",
}

# 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 = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
"**": [
"relations.html", # needs 'show_related': True theme option to display
"searchbox.html",
]
}


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

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


# -- Options for LaTeX output ---------------------------------------------
Expand All @@ -123,15 +124,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 @@ -141,19 +139,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pylibsrtp.tex', 'pylibsrtp Documentation',
u'Jeremy Lainé', 'manual'),
(master_doc, "pylibsrtp.tex", "pylibsrtp Documentation", "Jeremy Lainé", "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, 'pylibsrtp', 'pylibsrtp Documentation',
[author], 1)
]
man_pages = [(master_doc, "pylibsrtp", "pylibsrtp Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -162,10 +156,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pylibsrtp', 'pylibsrtp Documentation',
author, 'pylibsrtp', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"pylibsrtp",
"pylibsrtp Documentation",
author,
"pylibsrtp",
"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 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ def get_tag(self):


setuptools.setup(
cffi_modules = ["src/_cffi_src/build_srtp.py:ffibuilder"],
cffi_modules=["src/_cffi_src/build_srtp.py:ffibuilder"],
cmdclass={"bdist_wheel": bdist_wheel_abi3},
)
11 changes: 7 additions & 4 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
from pylibsrtp import Error, Policy, Session

RTP = (
b"\x80\x08\x00\x00" # version, packet type, sequence number
b"\x00\x00\x00\x00" # timestamp
b"\x00\x00\x30\x39" # ssrc: 12345
) + (b"\xd4" * 160)
(
b"\x80\x08\x00\x00" # version, packet type, sequence number
b"\x00\x00\x00\x00" # timestamp
b"\x00\x00\x30\x39" # ssrc: 12345
)
+ (b"\xd4" * 160)
)
RTCP = (
b"\x80\xc8\x00\x06\xf3\xcb\x20\x01\x83\xab\x03\xa1\xeb\x02\x0b\x3a"
b"\x00\x00\x94\x20\x00\x00\x00\x9e\x00\x00\x9b\x88"
Expand Down

0 comments on commit c12a556

Please sign in to comment.