Skip to content

Commit

Permalink
Switched to Black for code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed May 11, 2022
1 parent 7d8ac2f commit 85eec8c
Show file tree
Hide file tree
Showing 54 changed files with 3,353 additions and 1,898 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ repos:
- id: pyupgrade
args: [ "--py36-plus", "--keep-mock" ]

- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: autopep8
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.10.1
Expand Down
37 changes: 17 additions & 20 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,31 @@
from packaging.version import parse

extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints'
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx_autodoc_typehints",
]

templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'AnyIO'
author = 'Alex Grönholm'
copyright = '2018, ' + author
templates_path = ["_templates"]
source_suffix = ".rst"
master_doc = "index"
project = "AnyIO"
author = "Alex Grönholm"
copyright = "2018, " + author

v = parse(get_version('anyio'))
v = parse(get_version("anyio"))
version = v.base_version
release = v.public

language = None

exclude_patterns = ['_build']
pygments_style = 'sphinx'
autodoc_default_options = {
'members': True,
'show-inheritance': True
}
exclude_patterns = ["_build"]
pygments_style = "sphinx"
autodoc_default_options = {"members": True, "show-inheritance": True}
todo_include_todos = False

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
htmlhelp_basename = 'anyiodoc'
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
htmlhelp_basename = "anyiodoc"

intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}
intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}
8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,12 @@ version_scheme = "post-release"
local_scheme = "dirty-tag"

[tool.isort]
src_paths = ["src"]
skip_gitignore = true
line_length = 99
multi_line_output = 4

[tool.autopep8]
max_line_length = 99
profile = "black"

[tool.flake8]
max-line-length = 99
ignore = ["E203", "W503"]

[tool.mypy]
python_version = "3.10"
Expand Down
184 changes: 113 additions & 71 deletions src/anyio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,88 +1,130 @@
__all__ = (
'run',
'sleep',
'sleep_forever',
'sleep_until',
'current_time',
'get_all_backends',
'get_cancelled_exc_class',
'BrokenResourceError',
'BrokenWorkerProcess',
'BusyResourceError',
'ClosedResourceError',
'DelimiterNotFound',
'EndOfStream',
'IncompleteRead',
'TypedAttributeLookupError',
'WouldBlock',
'AsyncFile',
'Path',
'open_file',
'wrap_file',
'aclose_forcefully',
'open_signal_receiver',
'connect_tcp',
'connect_unix',
'create_tcp_listener',
'create_unix_listener',
'create_udp_socket',
'create_connected_udp_socket',
'getaddrinfo',
'getnameinfo',
'wait_socket_readable',
'wait_socket_writable',
'create_memory_object_stream',
'run_process',
'open_process',
'CapacityLimiter',
'CapacityLimiterStatistics',
'Condition',
'ConditionStatistics',
'Event',
'EventStatistics',
'Lock',
'LockStatistics',
'Semaphore',
'SemaphoreStatistics',
'fail_after',
'move_on_after',
'current_effective_deadline',
'TASK_STATUS_IGNORED',
'CancelScope',
'create_task_group',
'TaskInfo',
'get_current_task',
'get_running_tasks',
'wait_all_tasks_blocked',
'start_blocking_portal',
'typed_attribute',
'TypedAttributeSet',
'TypedAttributeProvider'
"run",
"sleep",
"sleep_forever",
"sleep_until",
"current_time",
"get_all_backends",
"get_cancelled_exc_class",
"BrokenResourceError",
"BrokenWorkerProcess",
"BusyResourceError",
"ClosedResourceError",
"DelimiterNotFound",
"EndOfStream",
"IncompleteRead",
"TypedAttributeLookupError",
"WouldBlock",
"AsyncFile",
"Path",
"open_file",
"wrap_file",
"aclose_forcefully",
"open_signal_receiver",
"connect_tcp",
"connect_unix",
"create_tcp_listener",
"create_unix_listener",
"create_udp_socket",
"create_connected_udp_socket",
"getaddrinfo",
"getnameinfo",
"wait_socket_readable",
"wait_socket_writable",
"create_memory_object_stream",
"run_process",
"open_process",
"CapacityLimiter",
"CapacityLimiterStatistics",
"Condition",
"ConditionStatistics",
"Event",
"EventStatistics",
"Lock",
"LockStatistics",
"Semaphore",
"SemaphoreStatistics",
"fail_after",
"move_on_after",
"current_effective_deadline",
"TASK_STATUS_IGNORED",
"CancelScope",
"create_task_group",
"TaskInfo",
"get_current_task",
"get_running_tasks",
"wait_all_tasks_blocked",
"start_blocking_portal",
"typed_attribute",
"TypedAttributeSet",
"TypedAttributeProvider",
)

from typing import Any

from ._core._eventloop import (
current_time, get_all_backends, get_cancelled_exc_class, run, sleep, sleep_forever,
sleep_until)
current_time,
get_all_backends,
get_cancelled_exc_class,
run,
sleep,
sleep_forever,
sleep_until,
)
from ._core._exceptions import (
BrokenResourceError, BrokenWorkerProcess, BusyResourceError, ClosedResourceError,
DelimiterNotFound, EndOfStream, IncompleteRead, TypedAttributeLookupError, WouldBlock)
BrokenResourceError,
BrokenWorkerProcess,
BusyResourceError,
ClosedResourceError,
DelimiterNotFound,
EndOfStream,
IncompleteRead,
TypedAttributeLookupError,
WouldBlock,
)
from ._core._fileio import AsyncFile, Path, open_file, wrap_file
from ._core._resources import aclose_forcefully
from ._core._signals import open_signal_receiver
from ._core._sockets import (
connect_tcp, connect_unix, create_connected_udp_socket, create_tcp_listener, create_udp_socket,
create_unix_listener, getaddrinfo, getnameinfo, wait_socket_readable, wait_socket_writable)
connect_tcp,
connect_unix,
create_connected_udp_socket,
create_tcp_listener,
create_udp_socket,
create_unix_listener,
getaddrinfo,
getnameinfo,
wait_socket_readable,
wait_socket_writable,
)
from ._core._streams import create_memory_object_stream
from ._core._subprocesses import open_process, run_process
from ._core._synchronization import (
CapacityLimiter, CapacityLimiterStatistics, Condition, ConditionStatistics, Event,
EventStatistics, Lock, LockStatistics, Semaphore, SemaphoreStatistics)
CapacityLimiter,
CapacityLimiterStatistics,
Condition,
ConditionStatistics,
Event,
EventStatistics,
Lock,
LockStatistics,
Semaphore,
SemaphoreStatistics,
)
from ._core._tasks import (
TASK_STATUS_IGNORED, CancelScope, create_task_group, current_effective_deadline, fail_after,
move_on_after)
from ._core._testing import TaskInfo, get_current_task, get_running_tasks, wait_all_tasks_blocked
TASK_STATUS_IGNORED,
CancelScope,
create_task_group,
current_effective_deadline,
fail_after,
move_on_after,
)
from ._core._testing import (
TaskInfo,
get_current_task,
get_running_tasks,
wait_all_tasks_blocked,
)
from ._core._typedattr import TypedAttributeProvider, TypedAttributeSet, typed_attribute

# Re-exported here, for backwards compatibility
Expand All @@ -93,5 +135,5 @@
key: str
value: Any
for key, value in list(locals().items()):
if getattr(value, '__module__', '').startswith('anyio.'):
if getattr(value, "__module__", "").startswith("anyio."):
value.__module__ = __name__
Loading

0 comments on commit 85eec8c

Please sign in to comment.