mirror of
				https://github.com/onyx-and-iris/duckypad-twitch.git
				synced 2025-11-04 06:01:45 +00:00 
			
		
		
		
	use parenthesized context managers
This commit is contained in:
		
							parent
							
								
									ed890ab9e7
								
							
						
					
					
						commit
						ca0f6a8e9a
					
				
							
								
								
									
										12
									
								
								.pre-commit-config.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								.pre-commit-config.yaml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
repos:
 | 
			
		||||
  - repo: https://github.com/pre-commit/pre-commit-hooks
 | 
			
		||||
    rev: v2.3.0
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: check-yaml
 | 
			
		||||
      - id: end-of-file-fixer
 | 
			
		||||
      - id: trailing-whitespace
 | 
			
		||||
 | 
			
		||||
  - repo: https://github.com/tox-dev/pyproject-fmt
 | 
			
		||||
    rev: 'v2.5.0'
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: pyproject-fmt
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# SPDX-FileCopyrightText: 2023-present onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com>
 | 
			
		||||
#
 | 
			
		||||
# SPDX-License-Identifier: MIT
 | 
			
		||||
__version__ = '1.0.6'
 | 
			
		||||
__version__ = '1.0.7'
 | 
			
		||||
 | 
			
		||||
@ -60,9 +60,11 @@ def register_hotkeys(duckypad):
 | 
			
		||||
def run():
 | 
			
		||||
    xair_config = configuration.get('xair')
 | 
			
		||||
 | 
			
		||||
    with voicemeeterlib.api('potato') as vm:
 | 
			
		||||
        with xair_api.connect('MR18', **xair_config) as mixer:
 | 
			
		||||
            with duckypad_twitch.connect(vm=vm, mixer=mixer) as duckypad:
 | 
			
		||||
    with (
 | 
			
		||||
        voicemeeterlib.api('potato') as vm,
 | 
			
		||||
        xair_api.connect('MR18', **xair_config) as mixer,
 | 
			
		||||
        duckypad_twitch.connect(vm=vm, mixer=mixer) as duckypad,
 | 
			
		||||
    ):
 | 
			
		||||
        vm.apply_config('streaming_extender')  # extends the streaming config
 | 
			
		||||
 | 
			
		||||
        register_hotkeys(duckypad)
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										160
									
								
								pyproject.toml
									
									
									
									
									
								
							
							
						
						
									
										160
									
								
								pyproject.toml
									
									
									
									
									
								
							@ -1,47 +1,44 @@
 | 
			
		||||
[build-system]
 | 
			
		||||
requires = ["hatchling"]
 | 
			
		||||
build-backend = "hatchling.build"
 | 
			
		||||
 | 
			
		||||
requires = [ "hatchling" ]
 | 
			
		||||
 | 
			
		||||
[project]
 | 
			
		||||
name = "duckypad-twitch"
 | 
			
		||||
dynamic = ["version"]
 | 
			
		||||
description = ''
 | 
			
		||||
description = "DuckyPad macros for streaming software"
 | 
			
		||||
readme = "README.md"
 | 
			
		||||
requires-python = ">=3.7"
 | 
			
		||||
keywords = [  ]
 | 
			
		||||
license = "MIT"
 | 
			
		||||
keywords = []
 | 
			
		||||
authors = [
 | 
			
		||||
  { name = "onyx-and-iris", email = "code@onyxandiris.online" },
 | 
			
		||||
]
 | 
			
		||||
authors.email = "code@onyxandiris.online"
 | 
			
		||||
authors.name = "onyx-and-iris"
 | 
			
		||||
requires-python = ">=3.12,<4.0"
 | 
			
		||||
classifiers = [
 | 
			
		||||
  "Development Status :: 4 - Beta",
 | 
			
		||||
  "Programming Language :: Python",
 | 
			
		||||
  "Programming Language :: Python :: 3.7",
 | 
			
		||||
  "Programming Language :: Python :: 3.8",
 | 
			
		||||
  "Programming Language :: Python :: 3.9",
 | 
			
		||||
  "Programming Language :: Python :: 3.10",
 | 
			
		||||
  "Programming Language :: Python :: 3.11",
 | 
			
		||||
  "Programming Language :: Python :: 3 :: Only",
 | 
			
		||||
  "Programming Language :: Python :: 3.12",
 | 
			
		||||
  "Programming Language :: Python :: 3.13",
 | 
			
		||||
  "Programming Language :: Python :: Implementation :: CPython",
 | 
			
		||||
  "Programming Language :: Python :: Implementation :: PyPy",
 | 
			
		||||
]
 | 
			
		||||
dynamic = [ "version" ]
 | 
			
		||||
dependencies = [
 | 
			
		||||
  "tomli >= 2.0.1;python_version < '3.11'",
 | 
			
		||||
  "websocket-client",
 | 
			
		||||
  "keyboard",
 | 
			
		||||
  "voicemeeter-api>=2.6.1",
 | 
			
		||||
  "xair-api>=2.4.1",
 | 
			
		||||
  "slobs_websocket@git+https://git@github.com/onyx-and-iris/slobs_websocket@v0.1.4#egg=slobs_websocket",
 | 
			
		||||
  "obsws-python>=1.7.0",
 | 
			
		||||
  "obsws-python>=1.7",
 | 
			
		||||
  "slobs-websocket @ git+https://git@github.com/onyx-and-iris/slobs_websocket@v0.1.4#egg=slobs_websocket",
 | 
			
		||||
  "tomli>=2.0.1; python_version<'3.11'",
 | 
			
		||||
  "vban-cmd>=2.5.2",
 | 
			
		||||
  "voicemeeter-api>=2.6.1",
 | 
			
		||||
  "websocket-client",
 | 
			
		||||
  "xair-api>=2.4.1",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[project.scripts]
 | 
			
		||||
duckypad-macros = "duckypad_twitch.macros:run"
 | 
			
		||||
urls.Documentation = "https://github.com/unknown/duckypad-twitch#readme"
 | 
			
		||||
urls.Issues = "https://github.com/unknown/duckypad-twitch/issues"
 | 
			
		||||
 | 
			
		||||
[project.urls]
 | 
			
		||||
Documentation = "https://github.com/unknown/duckypad-twitch#readme"
 | 
			
		||||
Issues = "https://github.com/unknown/duckypad-twitch/issues"
 | 
			
		||||
Source = "https://github.com/unknown/duckypad-twitch"
 | 
			
		||||
urls.Source = "https://github.com/unknown/duckypad-twitch"
 | 
			
		||||
 | 
			
		||||
scripts.duckypad-macros = "duckypad_twitch.macros:run"
 | 
			
		||||
 | 
			
		||||
[tool.hatch.metadata]
 | 
			
		||||
allow-direct-references = true
 | 
			
		||||
@ -50,26 +47,32 @@ allow-direct-references = true
 | 
			
		||||
path = "duckypad_twitch/__about__.py"
 | 
			
		||||
 | 
			
		||||
[tool.hatch.envs.default]
 | 
			
		||||
dependencies = ["coverage[toml]>=6.5", "pytest"]
 | 
			
		||||
dependencies = [ "coverage[toml]>=6.5", "pytest" ]
 | 
			
		||||
 | 
			
		||||
[tool.hatch.envs.default.scripts]
 | 
			
		||||
test = "pytest {args:tests}"
 | 
			
		||||
test-cov = "coverage run -m pytest {args:tests}"
 | 
			
		||||
cov-report = ["- coverage combine", "coverage report"]
 | 
			
		||||
cov = ["test-cov", "cov-report"]
 | 
			
		||||
cov-report = [ "- coverage combine", "coverage report" ]
 | 
			
		||||
cov = [ "test-cov", "cov-report" ]
 | 
			
		||||
 | 
			
		||||
[[tool.hatch.envs.all.matrix]]
 | 
			
		||||
python = ["3.7", "3.8", "3.9", "3.10", "3.11"]
 | 
			
		||||
python = [ "3.12", "3.13" ]
 | 
			
		||||
 | 
			
		||||
[tool.hatch.envs.lint]
 | 
			
		||||
detached = true
 | 
			
		||||
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
 | 
			
		||||
dependencies = [ "black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243" ]
 | 
			
		||||
 | 
			
		||||
[tool.hatch.envs.lint.scripts]
 | 
			
		||||
typing = "mypy --install-types --non-interactive {args:duckypad_twitch tests}"
 | 
			
		||||
style = ["ruff {args:.}", "black --check --diff {args:.}"]
 | 
			
		||||
fmt = ["black {args:.}", "ruff --fix {args:.}", "style"]
 | 
			
		||||
all = ["style", "typing"]
 | 
			
		||||
style = [ "ruff {args:.}", "black --check --diff {args:.}" ]
 | 
			
		||||
fmt = [ "black {args:.}", "ruff --fix {args:.}", "style" ]
 | 
			
		||||
all = [ "style", "typing" ]
 | 
			
		||||
 | 
			
		||||
[tool.ruff]
 | 
			
		||||
target-version = "py312"
 | 
			
		||||
 | 
			
		||||
line-length = 120
 | 
			
		||||
indent-width = 4
 | 
			
		||||
exclude = [
 | 
			
		||||
  ".bzr",
 | 
			
		||||
  ".direnv",
 | 
			
		||||
@ -93,81 +96,32 @@ exclude = [
 | 
			
		||||
  "node_modules",
 | 
			
		||||
  "venv",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
line-length = 120
 | 
			
		||||
indent-width = 4
 | 
			
		||||
 | 
			
		||||
# Assume Python 3.10
 | 
			
		||||
target-version = "py310"
 | 
			
		||||
 | 
			
		||||
[tool.ruff.lint]
 | 
			
		||||
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`)  codes by default.
 | 
			
		||||
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
 | 
			
		||||
# McCabe complexity (`C901`) by default.
 | 
			
		||||
select = ["E4", "E7", "E9", "F"]
 | 
			
		||||
ignore = []
 | 
			
		||||
 | 
			
		||||
# Allow fix for all enabled rules (when `--fix`) is provided.
 | 
			
		||||
fixable = ["ALL"]
 | 
			
		||||
unfixable = []
 | 
			
		||||
 | 
			
		||||
# Allow unused variables when underscore-prefixed.
 | 
			
		||||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[tool.ruff.format]
 | 
			
		||||
# Unlike Black, use single quotes for strings.
 | 
			
		||||
quote-style = "single"
 | 
			
		||||
 | 
			
		||||
# Like Black, indent with spaces, rather than tabs.
 | 
			
		||||
indent-style = "space"
 | 
			
		||||
 | 
			
		||||
# Like Black, respect magic trailing commas.
 | 
			
		||||
skip-magic-trailing-comma = false
 | 
			
		||||
 | 
			
		||||
# Like Black, automatically detect the appropriate line ending.
 | 
			
		||||
line-ending = "auto"
 | 
			
		||||
 | 
			
		||||
# Enable auto-formatting of code examples in docstrings. Markdown,
 | 
			
		||||
# reStructuredText code/literal blocks and doctests are all supported.
 | 
			
		||||
#
 | 
			
		||||
# This is currently disabled by default, but it is planned for this
 | 
			
		||||
# to be opt-out in the future.
 | 
			
		||||
docstring-code-format = false
 | 
			
		||||
 | 
			
		||||
# Set the line length limit used when formatting code snippets in
 | 
			
		||||
# docstrings.
 | 
			
		||||
#
 | 
			
		||||
# This only has an effect when the `docstring-code-format` setting is
 | 
			
		||||
# enabled.
 | 
			
		||||
docstring-code-line-length = "dynamic"
 | 
			
		||||
 | 
			
		||||
[tool.ruff.lint.mccabe]
 | 
			
		||||
max-complexity = 10
 | 
			
		||||
 | 
			
		||||
[tool.ruff.lint.per-file-ignores]
 | 
			
		||||
"__init__.py" = [
 | 
			
		||||
    "E402",
 | 
			
		||||
    "F401",
 | 
			
		||||
]
 | 
			
		||||
# Tests can use magic values, assertions, and relative imports
 | 
			
		||||
"tests/**/*" = ["PLR2004", "S101", "TID252"]
 | 
			
		||||
 | 
			
		||||
[tool.ruff.isort]
 | 
			
		||||
known-first-party = ["duckypad_twitch"]
 | 
			
		||||
 | 
			
		||||
[tool.ruff.flake8-tidy-imports]
 | 
			
		||||
ban-relative-imports = "all"
 | 
			
		||||
format.indent-style = "space"
 | 
			
		||||
format.quote-style = "single"
 | 
			
		||||
format.line-ending = "auto"
 | 
			
		||||
format.skip-magic-trailing-comma = false
 | 
			
		||||
format.docstring-code-line-length = "dynamic"
 | 
			
		||||
format.docstring-code-format = false
 | 
			
		||||
lint.select = [ "E4", "E7", "E9", "F" ]
 | 
			
		||||
lint.ignore = [  ]
 | 
			
		||||
lint.per-file-ignores."__init__.py" = [ "E402", "F401" ]
 | 
			
		||||
lint.per-file-ignores."tests/**/*" = [ "PLR2004", "S101", "TID252" ]
 | 
			
		||||
lint.fixable = [ "ALL" ]
 | 
			
		||||
lint.unfixable = [  ]
 | 
			
		||||
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
 | 
			
		||||
lint.mccabe.max-complexity = 10
 | 
			
		||||
isort.known-first-party = [ "duckypad_twitch" ]
 | 
			
		||||
flake8-tidy-imports.ban-relative-imports = "all"
 | 
			
		||||
 | 
			
		||||
[tool.coverage.run]
 | 
			
		||||
source_pkgs = ["duckypad_twitch", "tests"]
 | 
			
		||||
source_pkgs = [ "duckypad_twitch", "tests" ]
 | 
			
		||||
branch = true
 | 
			
		||||
parallel = true
 | 
			
		||||
omit = ["duckypad_twitch/__about__.py"]
 | 
			
		||||
omit = [ "duckypad_twitch/__about__.py" ]
 | 
			
		||||
 | 
			
		||||
[tool.coverage.paths]
 | 
			
		||||
duckypad_twitch = ["duckypad_twitch", "*/duckypad-twitch/duckypad_twitch"]
 | 
			
		||||
tests = ["tests", "*/duckypad-twitch/tests"]
 | 
			
		||||
duckypad_twitch = [ "duckypad_twitch", "*/duckypad-twitch/duckypad_twitch" ]
 | 
			
		||||
tests = [ "tests", "*/duckypad-twitch/tests" ]
 | 
			
		||||
 | 
			
		||||
[tool.coverage.report]
 | 
			
		||||
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
 | 
			
		||||
exclude_lines = [ "no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:" ]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user