Skip to content

Commit d9ca342

Browse files
authored
Merge pull request #9 from njsmith/trioify
Adapt to trio norms + add @asynccontextmanager + add sphinx docs
2 parents 339fc63 + a1974c6 commit d9ca342

36 files changed

+1725
-480
lines changed

.appveyor.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
skip_tags: true
2+
3+
os: Visual Studio 2015
4+
5+
environment:
6+
matrix:
7+
- PYTHON: "C:\\Python35"
8+
- PYTHON: "C:\\Python35-x64"
9+
- PYTHON: "C:\\Python36"
10+
- PYTHON: "C:\\Python36-x64"
11+
12+
build_script:
13+
- "git --no-pager log -n2"
14+
- "echo %APPVEYOR_REPO_COMMIT%"
15+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;;%PATH%"
16+
- "python --version"
17+
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
18+
- "pip install ."
19+
- "pip install -Ur test-requirements.txt"
20+
- "pip install codecov"
21+
22+
test_script:
23+
- "mkdir empty"
24+
- "cd empty"
25+
# Make sure it's being imported from where we expect
26+
- "python -c \"import os, async_generator; print(os.path.dirname(async_generator.__file__))\""
27+
- "python -u -m pytest -W error -ra -v -s --pyargs async_generator --cov=async_generator --cov-config=../.coveragerc"
28+
- "codecov"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Project-specific generated files
2+
docs/build/
23

34
# Byte-compiled / optimized / DLL files
45
__pycache__/

.readthedocs.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# https://docs.readthedocs.io/en/latest/yaml-config.html
2+
formats:
3+
- htmlzip
4+
- epub
5+
6+
requirements_file: ci/rtd-requirements.txt
7+
8+
python:
9+
version: 3
10+
pip_install: True

.style.yapf

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
[style]
2+
# Align closing bracket with visual indentation.
3+
align_closing_bracket_with_visual_indent=True
4+
5+
# Allow dictionary keys to exist on multiple lines. For example:
6+
#
7+
# x = {
8+
# ('this is the first element of a tuple',
9+
# 'this is the second element of a tuple'):
10+
# value,
11+
# }
12+
allow_multiline_dictionary_keys=False
13+
14+
# Allow lambdas to be formatted on more than one line.
15+
allow_multiline_lambdas=False
16+
17+
# Insert a blank line before a class-level docstring.
18+
blank_line_before_class_docstring=False
19+
20+
# Insert a blank line before a 'def' or 'class' immediately nested
21+
# within another 'def' or 'class'. For example:
22+
#
23+
# class Foo:
24+
# # <------ this blank line
25+
# def method():
26+
# ...
27+
blank_line_before_nested_class_or_def=False
28+
29+
# Do not split consecutive brackets. Only relevant when
30+
# dedent_closing_brackets is set. For example:
31+
#
32+
# call_func_that_takes_a_dict(
33+
# {
34+
# 'key1': 'value1',
35+
# 'key2': 'value2',
36+
# }
37+
# )
38+
#
39+
# would reformat to:
40+
#
41+
# call_func_that_takes_a_dict({
42+
# 'key1': 'value1',
43+
# 'key2': 'value2',
44+
# })
45+
coalesce_brackets=False
46+
47+
# The column limit.
48+
column_limit=79
49+
50+
# Indent width used for line continuations.
51+
continuation_indent_width=4
52+
53+
# Put closing brackets on a separate line, dedented, if the bracketed
54+
# expression can't fit in a single line. Applies to all kinds of brackets,
55+
# including function definitions and calls. For example:
56+
#
57+
# config = {
58+
# 'key1': 'value1',
59+
# 'key2': 'value2',
60+
# } # <--- this bracket is dedented and on a separate line
61+
#
62+
# time_series = self.remote_client.query_entity_counters(
63+
# entity='dev3246.region1',
64+
# key='dns.query_latency_tcp',
65+
# transform=Transformation.AVERAGE(window=timedelta(seconds=60)),
66+
# start_ts=now()-timedelta(days=3),
67+
# end_ts=now(),
68+
# ) # <--- this bracket is dedented and on a separate line
69+
dedent_closing_brackets=True
70+
71+
# Place each dictionary entry onto its own line.
72+
each_dict_entry_on_separate_line=True
73+
74+
# The regex for an i18n comment. The presence of this comment stops
75+
# reformatting of that line, because the comments are required to be
76+
# next to the string they translate.
77+
i18n_comment=
78+
79+
# The i18n function call names. The presence of this function stops
80+
# reformattting on that line, because the string it has cannot be moved
81+
# away from the i18n comment.
82+
i18n_function_call=
83+
84+
# Indent the dictionary value if it cannot fit on the same line as the
85+
# dictionary key. For example:
86+
#
87+
# config = {
88+
# 'key1':
89+
# 'value1',
90+
# 'key2': value1 +
91+
# value2,
92+
# }
93+
indent_dictionary_value=True
94+
95+
# The number of columns to use for indentation.
96+
indent_width=4
97+
98+
# Join short lines into one line. E.g., single line 'if' statements.
99+
join_multiple_lines=False
100+
101+
# Use spaces around default or named assigns.
102+
spaces_around_default_or_named_assign=False
103+
104+
# Use spaces around the power operator.
105+
spaces_around_power_operator=False
106+
107+
# The number of spaces required before a trailing comment.
108+
spaces_before_comment=2
109+
110+
# Insert a space between the ending comma and closing bracket of a list,
111+
# etc.
112+
space_between_ending_comma_and_closing_bracket=False
113+
114+
# Split before arguments if the argument list is terminated by a
115+
# comma.
116+
split_arguments_when_comma_terminated=True
117+
118+
# Set to True to prefer splitting before '&', '|' or '^' rather than
119+
# after.
120+
split_before_bitwise_operator=True
121+
122+
# Split before a dictionary or set generator (comp_for). For example, note
123+
# the split before the 'for':
124+
#
125+
# foo = {
126+
# variable: 'Hello world, have a nice day!'
127+
# for variable in bar if variable != 42
128+
# }
129+
split_before_dict_set_generator=True
130+
131+
# If an argument / parameter list is going to be split, then split before
132+
# the first argument.
133+
split_before_first_argument=True
134+
135+
# Set to True to prefer splitting before 'and' or 'or' rather than
136+
# after.
137+
split_before_logical_operator=True
138+
139+
# Split named assignments onto individual lines.
140+
split_before_named_assigns=True
141+
142+
# The penalty for splitting right after the opening bracket.
143+
split_penalty_after_opening_bracket=30
144+
145+
# The penalty for splitting the line after a unary operator.
146+
split_penalty_after_unary_operator=10000
147+
148+
# The penalty for splitting right before an if expression.
149+
split_penalty_before_if_expr=0
150+
151+
# The penalty of splitting the line around the '&', '|', and '^'
152+
# operators.
153+
split_penalty_bitwise_operator=300
154+
155+
# The penalty for characters over the column limit.
156+
split_penalty_excess_character=4500
157+
158+
# The penalty incurred by adding a line split to the unwrapped line. The
159+
# more line splits added the higher the penalty.
160+
split_penalty_for_added_line_split=30
161+
162+
# The penalty of splitting a list of "import as" names. For example:
163+
#
164+
# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1,
165+
# long_argument_2,
166+
# long_argument_3)
167+
#
168+
# would reformat to something like:
169+
#
170+
# from a_very_long_or_indented_module_name_yada_yad import (
171+
# long_argument_1, long_argument_2, long_argument_3)
172+
split_penalty_import_names=0
173+
174+
# The penalty of splitting the line around the 'and' and 'or'
175+
# operators.
176+
split_penalty_logical_operator=0
177+
178+
# Use the Tab character for indentation.
179+
use_tabs=False
180+

.travis.yml

+26-17
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,36 @@ language: python
22
python:
33
- 3.5.0
44
- 3.5.2
5-
- 3.6
65
- 3.5-dev
6+
- 3.6
77
- 3.6-dev
88
- 3.7-dev
9-
- pypy3.5-5.8.0
109
sudo: false
10+
dist: trusty
1111

12-
before_install:
13-
- pip install -Ur test-requirements.txt
14-
- pip install codecov
15-
16-
install:
17-
- python setup.py sdist --formats=zip
18-
- pip install dist/*.zip
12+
matrix:
13+
include:
14+
- os: linux
15+
language: generic
16+
env: USE_PYPY_RELEASE_VERSION=5.9-beta
17+
# Uncomment if you want to test on pypy nightly
18+
# - os: linux
19+
# language: generic
20+
# env: USE_PYPY_NIGHTLY=1
21+
# - os: osx
22+
# language: generic
23+
# env: MACPYTHON=3.5.4
24+
# - os: osx
25+
# language: generic
26+
# env: MACPYTHON=3.6.3
27+
- os: linux
28+
language: python
29+
python: 3.6
30+
env: CHECK_DOCS=1
31+
- os: linux
32+
language: python
33+
python: 3.6
34+
env: CHECK_FORMATTING=1
1935

2036
script:
21-
- mkdir empty
22-
- cd empty
23-
- INSTALLDIR=$(python -c "import os, async_generator; print(os.path.dirname(async_generator.__file__))")
24-
- py.test --pyargs async_generator --cov="$INSTALLDIR" --cov-config=../.coveragerc
25-
26-
27-
after_success:
28-
- codecov
37+
- ci/travis.sh

CODE_OF_CONDUCT.md

+2-50
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,2 @@
1-
# Contributor Code of Conduct
2-
3-
As contributors and maintainers of this project, and in the interest of
4-
fostering an open and welcoming community, we pledge to respect all people who
5-
contribute through reporting issues, posting feature requests, updating
6-
documentation, submitting pull requests or patches, and other activities.
7-
8-
We are committed to making participation in this project a harassment-free
9-
experience for everyone, regardless of level of experience, gender, gender
10-
identity and expression, sexual orientation, disability, personal appearance,
11-
body size, race, ethnicity, age, religion, or nationality.
12-
13-
Examples of unacceptable behavior by participants include:
14-
15-
* The use of sexualized language or imagery
16-
* Personal attacks
17-
* Trolling or insulting/derogatory comments
18-
* Public or private harassment
19-
* Publishing other's private information, such as physical or electronic
20-
addresses, without explicit permission
21-
* Other unethical or unprofessional conduct
22-
23-
Project maintainers have the right and responsibility to remove, edit, or
24-
reject comments, commits, code, wiki edits, issues, and other contributions
25-
that are not aligned to this Code of Conduct, or to ban temporarily or
26-
permanently any contributor for other behaviors that they deem inappropriate,
27-
threatening, offensive, or harmful.
28-
29-
By adopting this Code of Conduct, project maintainers commit themselves to
30-
fairly and consistently applying these principles to every aspect of managing
31-
this project. Project maintainers who do not follow or enforce the Code of
32-
Conduct may be permanently removed from the project team.
33-
34-
This Code of Conduct applies both within project spaces and in public spaces
35-
when an individual is representing the project or its community.
36-
37-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
38-
reported by contacting a project maintainer at [email protected]. All
39-
complaints will be reviewed and investigated and will result in a response that
40-
is deemed necessary and appropriate to the circumstances. Maintainers are
41-
obligated to maintain confidentiality with regard to the reporter of an
42-
incident.
43-
44-
45-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
46-
version 1.3.0, available at
47-
[http://contributor-covenant.org/version/1/3/0/][version]
48-
49-
[homepage]: http://contributor-covenant.org
50-
[version]: http://contributor-covenant.org/version/1/3/0/
1+
For the Trio code of conduct, see:
2+
https://trio.readthedocs.io/en/latest/code-of-conduct.html

CONTRIBUTING.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
For the Trio contributing guide, see:
2+
https://trio.readthedocs.io/en/latest/contributing.html

LICENSE

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This software is made available under the terms of *either* of the
2+
licenses found in LICENSE.APACHE2 or LICENSE.MIT. Contributions to
3+
trio are made under the terms of *both* these licenses.

0 commit comments

Comments
 (0)