Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project edits for pr517 #534

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8a11c5c
modification in tests
Jan 28, 2019
f53c43c
removing obsolete examples
Jan 28, 2019
1396abb
removing old style (yield from) in docs
Jan 28, 2019
6f08679
rename psycopg2 to psycopg2-binary in docs
Jan 28, 2019
52df1ed
added note in docs about going to python3.5.2+
Jan 28, 2019
b76222a
interim fix due to issues #533
Jan 28, 2019
a8d454a
add docs example and style
Jan 29, 2019
bfbb7ba
refactor docs
Jan 29, 2019
c4f5968
add isort and deleted obsolete non-asynchronous cursor iteration
Jan 30, 2019
325f48a
fix async iter for python 3.5
Jan 30, 2019
3935e8d
add readthedocs.yml
Jan 30, 2019
9098886
travis allow failures python:nightly
Jan 31, 2019
f146b1a
travis allow failures python:nightly
Jan 31, 2019
6d6cb25
travis allow failures python:nightly
Jan 31, 2019
44a9a54
travis allow failures python:nightly
Jan 31, 2019
3826cb7
travis remove docker cache
Jan 31, 2019
d347c0b
fix code style yml
Feb 2, 2019
a39c9ea
refactor
Feb 2, 2019
eb1a0e1
sync master
Mar 13, 2019
76ccf6c
fix docs
Mar 13, 2019
d0b157b
normalized version c to rc pep440
Mar 13, 2019
a1dd506
edit docs
Mar 14, 2019
8d86ae9
refactor sa connection
Mar 14, 2019
a12c0d6
sync pr517
Mar 14, 2019
c230b86
fix travis
Mar 14, 2019
7940492
fix travis
Mar 14, 2019
1af7564
fix travis
Mar 14, 2019
71b4f58
fix test
Mar 14, 2019
7aa0e18
Update aiopg/cursor.py
vir-mir Sep 20, 2019
073921c
Update docs/one_cursor.rst
vir-mir Sep 20, 2019
2006d87
Update .readthedocs.yml
vir-mir Sep 20, 2019
03412b0
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
6795ec5
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
e6afb32
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
d5fa21b
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
655d436
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
2b01c1f
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
2a1afbb
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
81514dc
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
a72f3ac
Update CONTRIBUTING.rst
vir-mir Sep 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[settings]
line_length=79
multi_line_output=3
include_trailing_comma=True
indent=' '
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
12 changes: 12 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

build:
image: latest

python:
version: 3.7
vir-mir marked this conversation as resolved.
Show resolved Hide resolved
install:
- requirements: requirements.txt
- method: pip
path: .
vir-mir marked this conversation as resolved.
Show resolved Hide resolved
system_packages: true
17 changes: 5 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,9 @@ services:
python:
- "3.5"
- "3.6"
- "3.7"
- "nightly"

.mixtures:
- &py3_7-base
python: "3.7"
dist: xenial
sudo: required
jobs:
include:
- <<: *py3_7-base

- <<: *py3_7-base
env:

install:
- pip install -U setuptools
- python setup.py install
Expand All @@ -39,6 +28,10 @@ env:
- PYTHONASYNCIODEBUG=x
- PYTHONASYNCIODEBUG=

matrix:
allow_failures:
- python: "nightly"

cache:
directories:
- $HOME/.cache/pip
Expand Down
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ doc:
cd docs && make html
@echo "open file://`pwd`/docs/_build/html/index.html"

pep:
pep8 aiopg examples tests

flake:
extra=$$(python -c "import sys;sys.stdout.write('--exclude tests/pep492 --builtins=StopAsyncIteration') if sys.version_info[:3] < (3, 5, 0) else sys.stdout.write('examples')"); \
flake8 aiopg tests $$extra
isort:
isort -rc aiopg
isort -rc tests
isort -rc examples

flake: .flake

.flake: $(shell find aiopg -type f) \
$(shell find tests -type f) \
$(shell find examples -type f)
flake8 aiopg tests examples
python setup.py check -rms
@if ! isort -c -rc aiopg tests examples; then \
echo "Import sort errors, run 'make isort' to fix them!!!"; \
isort --diff -rc aiopg tests examples; \
false; \
fi

test: flake
pytest -q tests
Expand All @@ -22,7 +33,10 @@ cov cover coverage: flake
@echo "open file://`pwd`/htmlcov/index.html"

cov-ci: flake
py.test -v --cov --cov-report=term tests --pg_tag all
py.test -v --cov=aiopg --cov-report=term tests --pg_tag all

clean-pip:
pip freeze | grep -v "^-e" | xargs pip uninstall -y
vir-mir marked this conversation as resolved.
Show resolved Hide resolved

clean:
find . -name __pycache__ |xargs rm -rf
Expand All @@ -38,4 +52,4 @@ clean:
rm -rf docs/_build
rm -rf .tox

.PHONY: all pep test vtest cov clean
.PHONY: all isort flake test vtest cov clean clean-pip
6 changes: 2 additions & 4 deletions aiopg/connection.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import asyncio
import contextlib
import errno
import platform
import select
import sys
import traceback
import warnings
import weakref
import platform

import psycopg2
from psycopg2.extensions import (
POLL_OK, POLL_READ, POLL_WRITE, POLL_ERROR)
from psycopg2 import extras
from psycopg2.extensions import POLL_ERROR, POLL_OK, POLL_READ, POLL_WRITE

from .cursor import Cursor
from .utils import _ContextManager, create_future


__all__ = ('connect',)


Expand Down
14 changes: 1 addition & 13 deletions aiopg/cursor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import asyncio
import warnings

import psycopg2

from .log import logger
from .transaction import Transaction, IsolationLevel
from .transaction import IsolationLevel, Transaction
from .utils import _TransactionBeginContextManager


Expand Down Expand Up @@ -366,17 +365,6 @@ def timeout(self):
"""Return default timeout for cursor operations."""
return self._timeout

def __iter__(self):
warnings.warn("Iteration over cursor is deprecated",
DeprecationWarning,
stacklevel=2)
while True:
row = yield from self.fetchone().__await__()
if row is None:
return
else:
yield row

def __aiter__(self):
return self

Expand Down
1 change: 0 additions & 1 deletion aiopg/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

import logging


# Name the logger after the package.
logger = logging.getLogger(__package__)
15 changes: 9 additions & 6 deletions aiopg/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import sys
import warnings


from psycopg2.extensions import TRANSACTION_STATUS_IDLE

from .connection import connect, TIMEOUT
from .connection import TIMEOUT, connect
from .log import logger
from .utils import (_PoolContextManager, _PoolConnectionContextManager,
_PoolCursorContextManager, _PoolAcquireContextManager,
ensure_future, create_future)

from .utils import (
_PoolAcquireContextManager,
_PoolConnectionContextManager,
_PoolContextManager,
_PoolCursorContextManager,
create_future,
ensure_future,
)

PY_341 = sys.version_info >= (3, 4, 1)

Expand Down
10 changes: 7 additions & 3 deletions aiopg/sa/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
from sqlalchemy.sql.dml import UpdateBase

from . import exc
from .result import ResultProxy
from .transaction import (RootTransaction, Transaction,
NestedTransaction, TwoPhaseTransaction)
from ..utils import _SAConnectionContextManager, _TransactionContextManager
from .result import ResultProxy
from .transaction import (
NestedTransaction,
RootTransaction,
Transaction,
TwoPhaseTransaction,
)


class SAConnection:
Expand Down
4 changes: 2 additions & 2 deletions aiopg/sa/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import aiopg

from ..connection import TIMEOUT
from ..utils import _PoolAcquireContextManager, _PoolContextManager
from .connection import SAConnection
from .exc import InvalidRequestError
from ..connection import TIMEOUT
from ..utils import _PoolContextManager, _PoolAcquireContextManager

try:
from sqlalchemy.dialects.postgresql.psycopg2 import PGDialect_psycopg2
Expand Down
1 change: 1 addition & 0 deletions aiopg/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from abc import ABC, abstractmethod

import psycopg2

from aiopg.utils import _TransactionPointContextManager

__all__ = ('IsolationLevel', 'Transaction')
Expand Down
4 changes: 2 additions & 2 deletions aiopg/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from collections.abc import Coroutine
import asyncio
import psycopg2
from collections.abc import Coroutine

import psycopg2

try:
ensure_future = asyncio.ensure_future
Expand Down
Binary file added docs/_static/aiopg-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading