Skip to content

Commit

Permalink
Merge pull request #9 from njsmith/trioify
Browse files Browse the repository at this point in the history
Adapt to trio norms + add @asynccontextmanager + add sphinx docs
  • Loading branch information
njsmith committed Jan 19, 2018
2 parents 339fc63 + a1974c6 commit d9ca342
Show file tree
Hide file tree
Showing 36 changed files with 1,725 additions and 480 deletions.
28 changes: 28 additions & 0 deletions .appveyor.yml
@@ -0,0 +1,28 @@
skip_tags: true

os: Visual Studio 2015

environment:
matrix:
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36"
- PYTHON: "C:\\Python36-x64"

build_script:
- "git --no-pager log -n2"
- "echo %APPVEYOR_REPO_COMMIT%"
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;;%PATH%"
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- "pip install ."
- "pip install -Ur test-requirements.txt"
- "pip install codecov"

test_script:
- "mkdir empty"
- "cd empty"
# Make sure it's being imported from where we expect
- "python -c \"import os, async_generator; print(os.path.dirname(async_generator.__file__))\""
- "python -u -m pytest -W error -ra -v -s --pyargs async_generator --cov=async_generator --cov-config=../.coveragerc"
- "codecov"
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
# Project-specific generated files
docs/build/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
10 changes: 10 additions & 0 deletions .readthedocs.yml
@@ -0,0 +1,10 @@
# https://docs.readthedocs.io/en/latest/yaml-config.html
formats:
- htmlzip
- epub

requirements_file: ci/rtd-requirements.txt

python:
version: 3
pip_install: True
180 changes: 180 additions & 0 deletions .style.yapf
@@ -0,0 +1,180 @@
[style]
# Align closing bracket with visual indentation.
align_closing_bracket_with_visual_indent=True

# Allow dictionary keys to exist on multiple lines. For example:
#
# x = {
# ('this is the first element of a tuple',
# 'this is the second element of a tuple'):
# value,
# }
allow_multiline_dictionary_keys=False

# Allow lambdas to be formatted on more than one line.
allow_multiline_lambdas=False

# Insert a blank line before a class-level docstring.
blank_line_before_class_docstring=False

# Insert a blank line before a 'def' or 'class' immediately nested
# within another 'def' or 'class'. For example:
#
# class Foo:
# # <------ this blank line
# def method():
# ...
blank_line_before_nested_class_or_def=False

# Do not split consecutive brackets. Only relevant when
# dedent_closing_brackets is set. For example:
#
# call_func_that_takes_a_dict(
# {
# 'key1': 'value1',
# 'key2': 'value2',
# }
# )
#
# would reformat to:
#
# call_func_that_takes_a_dict({
# 'key1': 'value1',
# 'key2': 'value2',
# })
coalesce_brackets=False

# The column limit.
column_limit=79

# Indent width used for line continuations.
continuation_indent_width=4

# Put closing brackets on a separate line, dedented, if the bracketed
# expression can't fit in a single line. Applies to all kinds of brackets,
# including function definitions and calls. For example:
#
# config = {
# 'key1': 'value1',
# 'key2': 'value2',
# } # <--- this bracket is dedented and on a separate line
#
# time_series = self.remote_client.query_entity_counters(
# entity='dev3246.region1',
# key='dns.query_latency_tcp',
# transform=Transformation.AVERAGE(window=timedelta(seconds=60)),
# start_ts=now()-timedelta(days=3),
# end_ts=now(),
# ) # <--- this bracket is dedented and on a separate line
dedent_closing_brackets=True

# Place each dictionary entry onto its own line.
each_dict_entry_on_separate_line=True

# The regex for an i18n comment. The presence of this comment stops
# reformatting of that line, because the comments are required to be
# next to the string they translate.
i18n_comment=

# The i18n function call names. The presence of this function stops
# reformattting on that line, because the string it has cannot be moved
# away from the i18n comment.
i18n_function_call=

# Indent the dictionary value if it cannot fit on the same line as the
# dictionary key. For example:
#
# config = {
# 'key1':
# 'value1',
# 'key2': value1 +
# value2,
# }
indent_dictionary_value=True

# The number of columns to use for indentation.
indent_width=4

# Join short lines into one line. E.g., single line 'if' statements.
join_multiple_lines=False

# Use spaces around default or named assigns.
spaces_around_default_or_named_assign=False

# Use spaces around the power operator.
spaces_around_power_operator=False

# The number of spaces required before a trailing comment.
spaces_before_comment=2

# Insert a space between the ending comma and closing bracket of a list,
# etc.
space_between_ending_comma_and_closing_bracket=False

# Split before arguments if the argument list is terminated by a
# comma.
split_arguments_when_comma_terminated=True

# Set to True to prefer splitting before '&', '|' or '^' rather than
# after.
split_before_bitwise_operator=True

# Split before a dictionary or set generator (comp_for). For example, note
# the split before the 'for':
#
# foo = {
# variable: 'Hello world, have a nice day!'
# for variable in bar if variable != 42
# }
split_before_dict_set_generator=True

# If an argument / parameter list is going to be split, then split before
# the first argument.
split_before_first_argument=True

# Set to True to prefer splitting before 'and' or 'or' rather than
# after.
split_before_logical_operator=True

# Split named assignments onto individual lines.
split_before_named_assigns=True

# The penalty for splitting right after the opening bracket.
split_penalty_after_opening_bracket=30

# The penalty for splitting the line after a unary operator.
split_penalty_after_unary_operator=10000

# The penalty for splitting right before an if expression.
split_penalty_before_if_expr=0

# The penalty of splitting the line around the '&', '|', and '^'
# operators.
split_penalty_bitwise_operator=300

# The penalty for characters over the column limit.
split_penalty_excess_character=4500

# The penalty incurred by adding a line split to the unwrapped line. The
# more line splits added the higher the penalty.
split_penalty_for_added_line_split=30

# The penalty of splitting a list of "import as" names. For example:
#
# from a_very_long_or_indented_module_name_yada_yad import (long_argument_1,
# long_argument_2,
# long_argument_3)
#
# would reformat to something like:
#
# from a_very_long_or_indented_module_name_yada_yad import (
# long_argument_1, long_argument_2, long_argument_3)
split_penalty_import_names=0

# The penalty of splitting the line around the 'and' and 'or'
# operators.
split_penalty_logical_operator=0

# Use the Tab character for indentation.
use_tabs=False

43 changes: 26 additions & 17 deletions .travis.yml
Expand Up @@ -2,27 +2,36 @@ language: python
python:
- 3.5.0
- 3.5.2
- 3.6
- 3.5-dev
- 3.6
- 3.6-dev
- 3.7-dev
- pypy3.5-5.8.0
sudo: false
dist: trusty

before_install:
- pip install -Ur test-requirements.txt
- pip install codecov

install:
- python setup.py sdist --formats=zip
- pip install dist/*.zip
matrix:
include:
- os: linux
language: generic
env: USE_PYPY_RELEASE_VERSION=5.9-beta
# Uncomment if you want to test on pypy nightly
# - os: linux
# language: generic
# env: USE_PYPY_NIGHTLY=1
# - os: osx
# language: generic
# env: MACPYTHON=3.5.4
# - os: osx
# language: generic
# env: MACPYTHON=3.6.3
- os: linux
language: python
python: 3.6
env: CHECK_DOCS=1
- os: linux
language: python
python: 3.6
env: CHECK_FORMATTING=1

script:
- mkdir empty
- cd empty
- INSTALLDIR=$(python -c "import os, async_generator; print(os.path.dirname(async_generator.__file__))")
- py.test --pyargs async_generator --cov="$INSTALLDIR" --cov-config=../.coveragerc


after_success:
- codecov
- ci/travis.sh
52 changes: 2 additions & 50 deletions CODE_OF_CONDUCT.md
@@ -1,50 +1,2 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of
fostering an open and welcoming community, we pledge to respect all people who
contribute through reporting issues, posting feature requests, updating
documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free
experience for everyone, regardless of level of experience, gender, gender
identity and expression, sexual orientation, disability, personal appearance,
body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

By adopting this Code of Conduct, project maintainers commit themselves to
fairly and consistently applying these principles to every aspect of managing
this project. Project maintainers who do not follow or enforce the Code of
Conduct may be permanently removed from the project team.

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting a project maintainer at njs@pobox.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. Maintainers are
obligated to maintain confidentiality with regard to the reporter of an
incident.


This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.3.0, available at
[http://contributor-covenant.org/version/1/3/0/][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/3/0/
For the Trio code of conduct, see:
https://trio.readthedocs.io/en/latest/code-of-conduct.html
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,2 @@
For the Trio contributing guide, see:
https://trio.readthedocs.io/en/latest/contributing.html
3 changes: 3 additions & 0 deletions LICENSE
@@ -0,0 +1,3 @@
This software is made available under the terms of *either* of the
licenses found in LICENSE.APACHE2 or LICENSE.MIT. Contributions to
trio are made under the terms of *both* these licenses.

0 comments on commit d9ca342

Please sign in to comment.