diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-06 01:19:47 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-06 18:23:11 -0500 |
| commit | 1e278de4cc9a4181e0747640a960e80efcea1ca9 (patch) | |
| tree | 13d0c035807613bfa07e734acad79b9c843cb8b0 /examples/performance | |
| parent | 1e1a38e7801f410f244e4bbb44ec795ae152e04e (diff) | |
| download | sqlalchemy-1e278de4cc9a4181e0747640a960e80efcea1ca9.tar.gz | |
Post black reformatting
Applied on top of a pure run of black -l 79 in
I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes
resolves all remaining flake8 conditions for those codes
we have enabled in setup.cfg.
Included are resolutions for all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.
Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
Diffstat (limited to 'examples/performance')
| -rw-r--r-- | examples/performance/__init__.py | 10 | ||||
| -rw-r--r-- | examples/performance/__main__.py | 1 | ||||
| -rw-r--r-- | examples/performance/bulk_inserts.py | 10 | ||||
| -rw-r--r-- | examples/performance/bulk_updates.py | 9 | ||||
| -rw-r--r-- | examples/performance/large_resultsets.py | 14 | ||||
| -rw-r--r-- | examples/performance/short_selects.py | 24 | ||||
| -rw-r--r-- | examples/performance/single_inserts.py | 11 |
7 files changed, 48 insertions, 31 deletions
diff --git a/examples/performance/__init__.py b/examples/performance/__init__.py index b66199f3c..f1f59026c 100644 --- a/examples/performance/__init__.py +++ b/examples/performance/__init__.py @@ -31,8 +31,8 @@ individual suites to be run:: -h, --help show this help message and exit --test TEST run specific test name --dburl DBURL database URL, default sqlite:///profile.db - --num NUM Number of iterations/items/etc for tests; default is 0 - module-specific + --num NUM Number of iterations/items/etc for tests; + default is module-specific --profile run profiling and dump call counts --dump dump full call profile (implies --profile) --runsnake invoke runsnakerun (implies --profile) @@ -217,14 +217,14 @@ As well as see RunSnake output for an individual test:: $ python test_loads.py --num 100 --runsnake --test test_joinedload -""" +""" # noqa import argparse import cProfile -import pstats import os -import time +import pstats import re import sys +import time class Profiler(object): diff --git a/examples/performance/__main__.py b/examples/performance/__main__.py index 945458651..aeb124e1d 100644 --- a/examples/performance/__main__.py +++ b/examples/performance/__main__.py @@ -2,5 +2,6 @@ from . import Profiler + if __name__ == "__main__": Profiler.main() diff --git a/examples/performance/bulk_inserts.py b/examples/performance/bulk_inserts.py index 52f0f32e6..49469581d 100644 --- a/examples/performance/bulk_inserts.py +++ b/examples/performance/bulk_inserts.py @@ -3,11 +3,15 @@ of rows in bulk. """ -from . import Profiler - +from sqlalchemy import bindparam +from sqlalchemy import Column +from sqlalchemy import create_engine +from sqlalchemy import Integer +from sqlalchemy import String from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy import Column, Integer, String, create_engine, bindparam from sqlalchemy.orm import Session +from . import Profiler + Base = declarative_base() engine = None diff --git a/examples/performance/bulk_updates.py b/examples/performance/bulk_updates.py index ebb700068..0657c96f3 100644 --- a/examples/performance/bulk_updates.py +++ b/examples/performance/bulk_updates.py @@ -3,11 +3,14 @@ of rows in bulk. """ -from . import Profiler - +from sqlalchemy import Column +from sqlalchemy import create_engine +from sqlalchemy import Integer +from sqlalchemy import String from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy import Column, Integer, String, create_engine, bindparam from sqlalchemy.orm import Session +from . import Profiler + Base = declarative_base() engine = None diff --git a/examples/performance/large_resultsets.py b/examples/performance/large_resultsets.py index ad1c23194..2945040b5 100644 --- a/examples/performance/large_resultsets.py +++ b/examples/performance/large_resultsets.py @@ -13,11 +13,15 @@ full blown ORM doesn't do terribly either even though mapped objects provide a huge amount of functionality. """ +from sqlalchemy import Column +from sqlalchemy import create_engine +from sqlalchemy import Integer +from sqlalchemy import String +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import Bundle +from sqlalchemy.orm import Session from . import Profiler -from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy import Column, Integer, String, create_engine -from sqlalchemy.orm import Session, Bundle Base = declarative_base() engine = None @@ -165,8 +169,8 @@ def _test_dbapi_raw(n, make_objects): # going to do this, so see how this pushes you right back into # ORM land anyway :) class SimpleCustomer(object): - def __init__(self, id, name, description): - self.id = id + def __init__(self, id_, name, description): + self.id = id_ self.name = name self.description = description diff --git a/examples/performance/short_selects.py b/examples/performance/short_selects.py index 4a8d401ad..376f18f02 100644 --- a/examples/performance/short_selects.py +++ b/examples/performance/short_selects.py @@ -3,20 +3,20 @@ record by primary key """ -from . import Profiler +import random -from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy import ( - Column, - Integer, - String, - create_engine, - bindparam, - select, -) -from sqlalchemy.orm import Session, deferred +from sqlalchemy import bindparam +from sqlalchemy import Column +from sqlalchemy import create_engine +from sqlalchemy import Integer +from sqlalchemy import select +from sqlalchemy import String from sqlalchemy.ext import baked -import random +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import deferred +from sqlalchemy.orm import Session +from . import Profiler + Base = declarative_base() engine = None diff --git a/examples/performance/single_inserts.py b/examples/performance/single_inserts.py index 79e34dfe6..428eb5c41 100644 --- a/examples/performance/single_inserts.py +++ b/examples/performance/single_inserts.py @@ -4,11 +4,16 @@ within a distinct transaction, and afterwards returns to essentially a a database connection, inserts the row, commits and closes. """ -from . import Profiler - +from sqlalchemy import bindparam +from sqlalchemy import Column +from sqlalchemy import create_engine +from sqlalchemy import Integer +from sqlalchemy import pool +from sqlalchemy import String from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy import Column, Integer, String, create_engine, bindparam, pool from sqlalchemy.orm import Session +from . import Profiler + Base = declarative_base() engine = None |
