Search is not available for this dataset
id stringlengths 1 8 | text stringlengths 72 9.81M | addition_count int64 0 10k | commit_subject stringlengths 0 3.7k | deletion_count int64 0 8.43k | file_extension stringlengths 0 32 | lang stringlengths 1 94 | license stringclasses 10
values | repo_name stringlengths 9 59 |
|---|---|---|---|---|---|---|---|---|
1500 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 5 | Add ability to override autocommit option for the session. | 4 | .py | py | bsd-3-clause | gmr/queries |
1501 | <NME> setup.py
<BEF> import os
import platform
import setuptools
# PYPY vs cpython
if platform.python_implementation() == 'PyPy':
install_requires = ['psycopg2cffi>=2.7.2,<3']
else:
install_requires = ['psycopg2>=2.5.1,<3']
# Install tornado if generating docs on readthedocs
if os.environ.get('READTHEDOCS', ... | 1 | Bump rev, dates | 1 | .py | py | bsd-3-clause | gmr/queries |
1502 | <NME> setup.py
<BEF> import os
import platform
import setuptools
# PYPY vs cpython
if platform.python_implementation() == 'PyPy':
install_requires = ['psycopg2cffi>=2.7.2,<3']
else:
install_requires = ['psycopg2>=2.5.1,<3']
# Install tornado if generating docs on readthedocs
if os.environ.get('READTHEDOCS', ... | 1 | Bump rev, dates | 1 | .py | py | bsd-3-clause | gmr/queries |
1503 | <NME> __init__.py
<BEF> """
Queries: PostgreSQL database access simplified
Queries is an opinionated wrapper for interfacing with PostgreSQL that offers
caching of connections and support for PyPy via psycopg2ct.
The core `queries.Queries` class will automatically register support for UUIDs,
Unicode and Unicode array... | 8 | Updates to defaults and what is imported into the queries namespace | 2 | .py | py | bsd-3-clause | gmr/queries |
1504 | <NME> __init__.py
<BEF> """
Queries: PostgreSQL database access simplified
Queries is an opinionated wrapper for interfacing with PostgreSQL that offers
caching of connections and support for PyPy via psycopg2ct.
The core `queries.Queries` class will automatically register support for UUIDs,
Unicode and Unicode array... | 8 | Updates to defaults and what is imported into the queries namespace | 2 | .py | py | bsd-3-clause | gmr/queries |
1505 | <NME> LICENSE
<BEF> Copyright (c) 2014 - 2018 Gavin M. Roy
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of condi... | 1 | Bump the year in the license | 1 | LICENSE | bsd-3-clause | gmr/queries | |
1506 | <NME> LICENSE
<BEF> Copyright (c) 2014 - 2018 Gavin M. Roy
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of condi... | 1 | Bump the year in the license | 1 | LICENSE | bsd-3-clause | gmr/queries | |
1507 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import unittest2 as unittest
except ImportError:
import unittest
from queries import pool
def test_add_when_pool_is_full_raises(self):
obj = pool.Pool(str(uuid.uuid4()), max_size=1)
... | 73 | Test coverage of pool.Connection | 0 | .py | py | bsd-3-clause | gmr/queries |
1508 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import unittest2 as unittest
except ImportError:
import unittest
from queries import pool
def test_add_when_pool_is_full_raises(self):
obj = pool.Pool(str(uuid.uuid4()), max_size=1)
... | 73 | Test coverage of pool.Connection | 0 | .py | py | bsd-3-clause | gmr/queries |
1509 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import mock
import unittest
try:
from psycopg2cffi import extras
except ImportError:
from psycopg2 import extras
from tornado import concurrent
from tornado import gen
from tornado import ioloop
from tornado im... | 5 | Clean up imports and import order | 12 | .py | py | bsd-3-clause | gmr/queries |
1510 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import mock
import unittest
try:
from psycopg2cffi import extras
except ImportError:
from psycopg2 import extras
from tornado import concurrent
from tornado import gen
from tornado import ioloop
from tornado im... | 5 | Clean up imports and import order | 12 | .py | py | bsd-3-clause | gmr/queries |
1511 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 1 | add missing comma | 1 | .py | py | bsd-3-clause | gmr/queries |
1512 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 1 | add missing comma | 1 | .py | py | bsd-3-clause | gmr/queries |
1513 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession(pool_max_size=60)
@gen.coroutine
... | 6 | Merge pull request #23 from dave-shawley/add-results-free-warning | 0 | .py | py | bsd-3-clause | gmr/queries |
1514 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession(pool_max_size=60)
@gen.coroutine
... | 6 | Merge pull request #23 from dave-shawley/add-results-free-warning | 0 | .py | py | bsd-3-clause | gmr/queries |
1515 | <NME> utils_tests.py
<BEF> ADDFILE
<MSG> Add utils tests
<DFF> @@ -0,0 +1,84 @@
+"""
+Tests for functionality in the utils module
+
+"""
+import mock
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+
+from queries import utils
+
+
+class GetCurrentUserTests(unittest.TestCase):
+
+ ... | 84 | Add utils tests | 0 | .py | py | bsd-3-clause | gmr/queries |
1516 | <NME> utils_tests.py
<BEF> ADDFILE
<MSG> Add utils tests
<DFF> @@ -0,0 +1,84 @@
+"""
+Tests for functionality in the utils module
+
+"""
+import mock
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
+
+from queries import utils
+
+
+class GetCurrentUserTests(unittest.TestCase):
+
+ ... | 84 | Add utils tests | 0 | .py | py | bsd-3-clause | gmr/queries |
1517 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 8 | Merge pull request #25 from gmr/autoclean | 8 | .py | py | bsd-3-clause | gmr/queries |
1518 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 8 | Merge pull request #25 from gmr/autoclean | 8 | .py | py | bsd-3-clause | gmr/queries |
1519 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
from tornado import stack_context
import psycopg2
from queries import session
from queries ... | 13 | Add ability to pass in pool size into the constructor | 2 | .py | py | bsd-3-clause | gmr/queries |
1520 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
from tornado import stack_context
import psycopg2
from queries import session
from queries ... | 13 | Add ability to pass in pool size into the constructor | 2 | .py | py | bsd-3-clause | gmr/queries |
1521 | <NME> README.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often repeating the same st... | 2 | Typos in README.rst | 2 | .rst | rst | bsd-3-clause | gmr/queries |
1522 | <NME> README.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often repeating the same st... | 2 | Typos in README.rst | 2 | .rst | rst | bsd-3-clause | gmr/queries |
1523 | <NME> pool_exception_tests.py
<BEF> """
Tests for Exceptions in queries.pool
"""
import unittest
import uuid
from queries import pool
class ActivePoolErrorTestCase(unittest.TestCase):
from queries import pool
class ActiveConnectionErrorTestCase(unittest.TestCase):
def setUp(self):
self.pid = uuid.uui... | 0 | Remove unused exception | 20 | .py | py | bsd-3-clause | gmr/queries |
1524 | <NME> pool_exception_tests.py
<BEF> """
Tests for Exceptions in queries.pool
"""
import unittest
import uuid
from queries import pool
class ActivePoolErrorTestCase(unittest.TestCase):
from queries import pool
class ActiveConnectionErrorTestCase(unittest.TestCase):
def setUp(self):
self.pid = uuid.uui... | 0 | Remove unused exception | 20 | .py | py | bsd-3-clause | gmr/queries |
1525 | <NME> utils.py
<BEF> """
Utility functions for access to OS level info and URI parsing
"""
import collections
import getpass
import logging
import os
import platform
# All systems do not support pwd module
try:
import pwd
'scheme,netloc,path,params,query,fragment,'
... | 2 | Remove the default hostname and port in URI parsing | 5 | .py | py | bsd-3-clause | gmr/queries |
1526 | <NME> utils.py
<BEF> """
Utility functions for access to OS level info and URI parsing
"""
import collections
import getpass
import logging
import os
import platform
# All systems do not support pwd module
try:
import pwd
'scheme,netloc,path,params,query,fragment,'
... | 2 | Remove the default hostname and port in URI parsing | 5 | .py | py | bsd-3-clause | gmr/queries |
1527 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 1 | Fix test with dupe name | 1 | .py | py | bsd-3-clause | gmr/queries |
1528 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 1 | Fix test with dupe name | 1 | .py | py | bsd-3-clause | gmr/queries |
1529 | <NME> README.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often repeating the same st... | 4 | Add gitter badge | 1 | .rst | rst | bsd-3-clause | gmr/queries |
1530 | <NME> README.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often repeating the same st... | 4 | Add gitter badge | 1 | .rst | rst | bsd-3-clause | gmr/queries |
1531 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = 100
class Connection(object):
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(objec... | 2 | Change the max size for a pool to 1 | 1 | .py | py | bsd-3-clause | gmr/queries |
1532 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = 100
class Connection(object):
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(objec... | 2 | Change the max size for a pool to 1 | 1 | .py | py | bsd-3-clause | gmr/queries |
1533 | <NME> LICENSE
<BEF> Copyright (c) 2012 MeetMe, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions a... | 2 | Update license | 2 | LICENSE | bsd-3-clause | gmr/queries | |
1534 | <NME> LICENSE
<BEF> Copyright (c) 2012 MeetMe, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions a... | 2 | Update license | 2 | LICENSE | bsd-3-clause | gmr/queries | |
1535 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import uuid
import mock
from queries import pool
MAX_POOL_SIZE = 100
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
c... | 1 | Fix pool test to add 100% coverage | 1 | .py | py | bsd-3-clause | gmr/queries |
1536 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import uuid
import mock
from queries import pool
MAX_POOL_SIZE = 100
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
c... | 1 | Fix pool test to add 100% coverage | 1 | .py | py | bsd-3-clause | gmr/queries |
1537 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
from psycopg2 import extras
from tornado import gen
from tornado import ioloop
from queries import pool
from queries import torn... | 65 | Move to using tornado.concurrent.Future | 4 | .py | py | bsd-3-clause | gmr/queries |
1538 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
from psycopg2 import extras
from tornado import gen
from tornado import ioloop
from queries import pool
from queries import torn... | 65 | Move to using tornado.concurrent.Future | 4 | .py | py | bsd-3-clause | gmr/queries |
1539 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 4 | update docstring | 1 | .py | py | bsd-3-clause | gmr/queries |
1540 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 4 | update docstring | 1 | .py | py | bsd-3-clause | gmr/queries |
1541 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 1 | async is a keyword in 3.7 and now in all pypys | 1 | .py | py | bsd-3-clause | gmr/queries |
1542 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 1 | async is a keyword in 3.7 and now in all pypys | 1 | .py | py | bsd-3-clause | gmr/queries |
1543 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | Docstring fix, process -> pool | 1 | .py | py | bsd-3-clause | gmr/queries |
1544 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | Docstring fix, process -> pool | 1 | .py | py | bsd-3-clause | gmr/queries |
1545 | <NME> __init__.py
<BEF> """
Queries: PostgreSQL database access simplified
Queries is an opinionated wrapper for interfacing with PostgreSQL that offers
caching of connections and support for PyPy via psycopg2ct.
The core `queries.Queries` class will automatically register support for UUIDs,
Unicode and Unicode array... | 0 | Additional documentation updates | 4 | .py | py | bsd-3-clause | gmr/queries |
1546 | <NME> __init__.py
<BEF> """
Queries: PostgreSQL database access simplified
Queries is an opinionated wrapper for interfacing with PostgreSQL that offers
caching of connections and support for PyPy via psycopg2ct.
The core `queries.Queries` class will automatically register support for UUIDs,
Unicode and Unicode array... | 0 | Additional documentation updates | 4 | .py | py | bsd-3-clause | gmr/queries |
1547 | <NME> index.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
|Version| |License|
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often r... | 0 | Remove non-working PythonVersions tag | 3 | .rst | rst | bsd-3-clause | gmr/queries |
1548 | <NME> index.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
|Version| |License|
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often r... | 0 | Remove non-working PythonVersions tag | 3 | .rst | rst | bsd-3-clause | gmr/queries |
1549 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession(pool_max_size=60)
@gen.coroutine
... | 2 | Merge pull request #26 from dave-shawley/absolute-time | 1 | .py | py | bsd-3-clause | gmr/queries |
1550 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession(pool_max_size=60)
@gen.coroutine
... | 2 | Merge pull request #26 from dave-shawley/absolute-time | 1 | .py | py | bsd-3-clause | gmr/queries |
1551 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import uuid
import mock
from queries import pool
MAX_POOL_SIZE = 100
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
c... | 2 | Fix typo in pool.close test. | 1 | .py | py | bsd-3-clause | gmr/queries |
1552 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import uuid
import mock
from queries import pool
MAX_POOL_SIZE = 100
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
c... | 2 | Fix typo in pool.close test. | 1 | .py | py | bsd-3-clause | gmr/queries |
1553 | <NME> index.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
|Version| |License|
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often r... | 2 | Update index.rst | 2 | .rst | rst | bsd-3-clause | gmr/queries |
1554 | <NME> index.rst
<BEF> Queries: PostgreSQL Simplified
==============================
*Queries* is a BSD licensed opinionated wrapper of the psycopg2_ library for
interacting with PostgreSQL.
|Version| |License|
The popular psycopg2_ package is a full-featured python client. Unfortunately
as a developer, you're often r... | 2 | Update index.rst | 2 | .rst | rst | bsd-3-clause | gmr/queries |
1555 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
"""
_lock = threading.Lock()
... | 12 | Ensure used_by and handler are not class scoped, refactor busy | 7 | .py | py | bsd-3-clause | gmr/queries |
1556 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
"""
_lock = threading.Lock()
... | 12 | Ensure used_by and handler are not class scoped, refactor busy | 7 | .py | py | bsd-3-clause | gmr/queries |
1557 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import time
import weakref
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contains the handle... | 16 | Address possible race condition | 3 | .py | py | bsd-3-clause | gmr/queries |
1558 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import time
import weakref
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contains the handle... | 16 | Address possible race condition | 3 | .py | py | bsd-3-clause | gmr/queries |
1559 | <NME> session_tests.py
<BEF> """
Tests for functionality in the session module
"""
import hashlib
import logging
import unittest
import mock
from psycopg2 import extras
import psycopg2
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, results, session, utils
LOGGER = logging.getLo... | 4 | Test that JSON is registered as well | 0 | .py | py | bsd-3-clause | gmr/queries |
1560 | <NME> session_tests.py
<BEF> """
Tests for functionality in the session module
"""
import hashlib
import logging
import unittest
import mock
from psycopg2 import extras
import psycopg2
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, results, session, utils
LOGGER = logging.getLo... | 4 | Test that JSON is registered as well | 0 | .py | py | bsd-3-clause | gmr/queries |
1561 | <NME> utils_tests.py
<BEF> """
Tests for functionality in the utils module
"""
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
from queries import utils
import queries
from queries import utils
class GetCurrentUserTests(unittest.TestCase):
@mock.patch('pwd.getpwuid')
... | 1 | Remove unittest2 use | 4 | .py | py | bsd-3-clause | gmr/queries |
1562 | <NME> utils_tests.py
<BEF> """
Tests for functionality in the utils module
"""
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
from queries import utils
import queries
from queries import utils
class GetCurrentUserTests(unittest.TestCase):
@mock.patch('pwd.getpwuid')
... | 1 | Remove unittest2 use | 4 | .py | py | bsd-3-clause | gmr/queries |
1563 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession(pool_max_size=60)
@gen.coroutine
... | 18 | Documentation updates | 2 | .py | py | bsd-3-clause | gmr/queries |
1564 | <NME> tornado_session.py
<BEF> """
Tornado Session Adapter
Use Queries asynchronously within the Tornado framework.
Example Use:
.. code:: python
class NameListHandler(web.RequestHandler):
def initialize(self):
self.session = queries.TornadoSession(pool_max_size=60)
@gen.coroutine
... | 18 | Documentation updates | 2 | .py | py | bsd-3-clause | gmr/queries |
1565 | <NME> conf.py
<BEF> # -*- coding: utf-8 -*-
#
# Queries documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 25 10:36:39 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | 7 | Make the end year dynamic | 229 | .py | py | bsd-3-clause | gmr/queries |
1566 | <NME> conf.py
<BEF> # -*- coding: utf-8 -*-
#
# Queries documentation build configuration file, created by
# sphinx-quickstart on Fri Apr 25 10:36:39 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autog... | 7 | Make the end year dynamic | 229 | .py | py | bsd-3-clause | gmr/queries |
1567 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 6 | Use strings for pool ids, add class level constants to reduce code in child classes | 1 | .py | py | bsd-3-clause | gmr/queries |
1568 | <NME> session.py
<BEF> """The Session class allows for a unified (and simplified) view of
interfacing with a PostgreSQL database server.
Connection details are passed in as a PostgreSQL URI and connections are pooled
by default, allowing for reuse of connections across modules in the Python
runtime without having to p... | 6 | Use strings for pool ids, add class level constants to reduce code in child classes | 1 | .py | py | bsd-3-clause | gmr/queries |
1569 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 14 | Fix scoping issues and bugs with free() and idle_connections | 14 | .py | py | bsd-3-clause | gmr/queries |
1570 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 14 | Fix scoping issues and bugs with free() and idle_connections | 14 | .py | py | bsd-3-clause | gmr/queries |
1571 | <NME> utils.py
<BEF> """
Utility functions for access to OS level info and URI parsing
"""
import collections
import getpass
import logging
import os
import platform
# All systems do not support pwd module
try:
import pwd
except ImportError:
pwd = None
# Python 2 & 3 compatibility
try:
from urllib import... | 2 | Update urlparse to deal with python 2.6 | 2 | .py | py | bsd-3-clause | gmr/queries |
1572 | <NME> utils.py
<BEF> """
Utility functions for access to OS level info and URI parsing
"""
import collections
import getpass
import logging
import os
import platform
# All systems do not support pwd module
try:
import pwd
except ImportError:
pwd = None
# Python 2 & 3 compatibility
try:
from urllib import... | 2 | Update urlparse to deal with python 2.6 | 2 | .py | py | bsd-3-clause | gmr/queries |
1573 | <NME> history.rst
<BEF> Version History
===============
- Next Release
- Implement ``Results.__bool__`` to be explicit about Python 3 support.
- 1.10.3 2017-11-01
- Remove the functionality from ``TornadoSession.validate`` and make it raise a ``DeprecationWarning``
- Catch the ``KeyError`` raised when ``PoolManag... | 3 | Merge the history file updates | 1 | .rst | rst | bsd-3-clause | gmr/queries |
1574 | <NME> history.rst
<BEF> Version History
===============
- Next Release
- Implement ``Results.__bool__`` to be explicit about Python 3 support.
- 1.10.3 2017-11-01
- Remove the functionality from ``TornadoSession.validate`` and make it raise a ``DeprecationWarning``
- Catch the ``KeyError`` raised when ``PoolManag... | 3 | Merge the history file updates | 1 | .rst | rst | bsd-3-clause | gmr/queries |
1575 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | Check the correct iterable | 1 | .py | py | bsd-3-clause | gmr/queries |
1576 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | Check the correct iterable | 1 | .py | py | bsd-3-clause | gmr/queries |
1577 | <NME> simple-tornado.py
<BEF> import datetime
import logging
from queries import pool
import queries
from tornado import gen, ioloop, web
def initialize(self):
self.session = queries.TornadoSession()
@gen.coroutine
def prepare(self):
try:
yield self.session.validate()
... | 2 | Move example | 10 | .py | py | bsd-3-clause | gmr/queries |
1578 | <NME> simple-tornado.py
<BEF> import datetime
import logging
from queries import pool
import queries
from tornado import gen, ioloop, web
def initialize(self):
self.session = queries.TornadoSession()
@gen.coroutine
def prepare(self):
try:
yield self.session.validate()
... | 2 | Move example | 10 | .py | py | bsd-3-clause | gmr/queries |
1579 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 3 | Temporarily disable tests | 1 | .py | py | bsd-3-clause | gmr/queries |
1580 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 3 | Temporarily disable tests | 1 | .py | py | bsd-3-clause | gmr/queries |
1581 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 0 | Remove broken test | 14 | .py | py | bsd-3-clause | gmr/queries |
1582 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 0 | Remove broken test | 14 | .py | py | bsd-3-clause | gmr/queries |
1583 | <NME> setup.py
<BEF> import os
import platform
import setuptools
# PYPY vs cpython
if platform.python_implementation() == 'PyPy':
install_requires = ['psycopg2cffi>=2.7.2,<3']
else:
install_requires = ['psycopg2>=2.5.1,<3']
# Install tornado if generating docs on readthedocs
if os.environ.get('READTHEDOCS', ... | 1 | Bump version | 1 | .py | py | bsd-3-clause | gmr/queries |
1584 | <NME> setup.py
<BEF> import os
import platform
import setuptools
# PYPY vs cpython
if platform.python_implementation() == 'PyPy':
install_requires = ['psycopg2cffi>=2.7.2,<3']
else:
install_requires = ['psycopg2>=2.5.1,<3']
# Install tornado if generating docs on readthedocs
if os.environ.get('READTHEDOCS', ... | 1 | Bump version | 1 | .py | py | bsd-3-clause | gmr/queries |
1585 | <NME> pool_connection_tests.py
<BEF> """
Tests for Connection class in the pool module
"""
import unittest
import weakref
import mock
from queries import pool
class ConnectionTests(unittest.TestCase):
def setUp(self):
self.handle = mock.Mock()
self.handle.close = mock.Mock()
self.handl... | 1 | Fix the test for Python 3.5 | 1 | .py | py | bsd-3-clause | gmr/queries |
1586 | <NME> pool_connection_tests.py
<BEF> """
Tests for Connection class in the pool module
"""
import unittest
import weakref
import mock
from queries import pool
class ConnectionTests(unittest.TestCase):
def setUp(self):
self.handle = mock.Mock()
self.handle.close = mock.Mock()
self.handl... | 1 | Fix the test for Python 3.5 | 1 | .py | py | bsd-3-clause | gmr/queries |
1587 | <NME> results.py
<BEF> """
query or callproc Results
"""
import logging
import psycopg2
LOGGER = logging.getLogger(__name__)
class Results(object):
"""The :py:class:`Results` class contains the results returned from
:py:meth:`Session.query <queries.Session.query>` and
:py:meth:`Session.callproc <queries... | 5 | Add coverage of results.Results | 5 | .py | py | bsd-3-clause | gmr/queries |
1588 | <NME> results.py
<BEF> """
query or callproc Results
"""
import logging
import psycopg2
LOGGER = logging.getLogger(__name__)
class Results(object):
"""The :py:class:`Results` class contains the results returned from
:py:meth:`Session.query <queries.Session.query>` and
:py:meth:`Session.callproc <queries... | 5 | Add coverage of results.Results | 5 | .py | py | bsd-3-clause | gmr/queries |
1589 | <NME> pool_manager_tests.py
<BEF> """
Tests for Manager class in the pool module
"""
import unittest
import uuid
import mock
from queries import pool
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
conn.isexecuting = mock.Mo... | 193 | Add additional test coverage of PoolManager | 1 | .py | py | bsd-3-clause | gmr/queries |
1590 | <NME> pool_manager_tests.py
<BEF> """
Tests for Manager class in the pool module
"""
import unittest
import uuid
import mock
from queries import pool
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
conn.isexecuting = mock.Mo... | 193 | Add additional test coverage of PoolManager | 1 | .py | py | bsd-3-clause | gmr/queries |
1591 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 11 | Add a few more tests to bump over 90% \o/ | 0 | .py | py | bsd-3-clause | gmr/queries |
1592 | <NME> tornado_session_tests.py
<BEF> """
Tests for functionality in the tornado_session module
"""
import unittest
import mock
# Out of order import to ensure psycopg2cffi is registered
from queries import pool, tornado_session
from psycopg2 import extras
from tornado import concurrent, gen, ioloop, testing
class... | 11 | Add a few more tests to bump over 90% \o/ | 0 | .py | py | bsd-3-clause | gmr/queries |
1593 | <NME> .travis.yml
<BEF> sudo: false
language: python
dist: xenial
env:
global:
- PATH=$HOME/.local/bin:$PATH
- AWS_DEFAULT_REGION=us-east-1
- secure: "inURdx4ldkJqQXL1TyvKImC3EnL5TixC1DlNMBYi5ttygwAk+mSSSw8Yc7klB6D1m6q79xUlHRk06vbz23CsXTM4AClC5Emrk6XN2GlUKl5WI+z+A2skI59buEhLWe7e2KzhB/AVx2E3TfKa0oY7raM0UUnaOkpV... | 2 | Make parts of .travis.yml conditional | 0 | .yml | travis | bsd-3-clause | gmr/queries |
1594 | <NME> .travis.yml
<BEF> sudo: false
language: python
dist: xenial
env:
global:
- PATH=$HOME/.local/bin:$PATH
- AWS_DEFAULT_REGION=us-east-1
- secure: "inURdx4ldkJqQXL1TyvKImC3EnL5TixC1DlNMBYi5ttygwAk+mSSSw8Yc7klB6D1m6q79xUlHRk06vbz23CsXTM4AClC5Emrk6XN2GlUKl5WI+z+A2skI59buEhLWe7e2KzhB/AVx2E3TfKa0oY7raM0UUnaOkpV... | 2 | Make parts of .travis.yml conditional | 0 | .yml | travis | bsd-3-clause | gmr/queries |
1595 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import uuid
import mock
from queries import pool
MAX_POOL_SIZE = 100
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
c... | 2 | Merge pull request #7 from chrismcguire/pool-close-fixes | 1 | .py | py | bsd-3-clause | gmr/queries |
1596 | <NME> pool_tests.py
<BEF> """
Tests for functionality in the pool module
"""
import time
import unittest
import uuid
import mock
from queries import pool
MAX_POOL_SIZE = 100
def mock_connection():
conn = mock.MagicMock('psycopg2.extensions.connection')
conn.close = mock.Mock()
conn.closed = True
c... | 2 | Merge pull request #7 from chrismcguire/pool-close-fixes | 1 | .py | py | bsd-3-clause | gmr/queries |
1597 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | Simplify the remove close logic to fall through to Connection for busy validation | 4 | .py | py | bsd-3-clause | gmr/queries |
1598 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | Simplify the remove close logic to fall through to Connection for busy validation | 4 | .py | py | bsd-3-clause | gmr/queries |
1599 | <NME> pool.py
<BEF> """
Connection Pooling
"""
import datetime
import logging
import os
import threading
import time
import weakref
import psycopg2
LOGGER = logging.getLogger(__name__)
DEFAULT_IDLE_TTL = 60
DEFAULT_MAX_SIZE = int(os.environ.get('QUERIES_MAX_POOL_SIZE', 1))
class Connection(object):
"""Contain... | 1 | queries.pool: Iterate over connection.keys() in close method. | 1 | .py | py | bsd-3-clause | gmr/queries |