Python 3.5.0a1 (default, Feb 14 2015, 11:41:57)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> b"%s"
b'%s'
>>> b"%s" % 'a'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %b requires bytes, or an object that implements __bytes__, not 'str'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tox] | |
envlist = py33,py34,py35 | |
skipsdist = true | |
[testenv] | |
deps = wheel | |
commands = pip wheel -r requirements.txt -f wheelhouse | |
[testenv:py35] | |
basepython = python3.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from pprint import pprint | |
import distlib.database | |
dist_name = sys.argv[1] | |
dist_path = distlib.database.DistributionPath(include_egg=True) | |
dists = list(dist_path.get_distributions()) | |
dist = dist_path.get_distribution(dist_name) |
>>> d = dateutil.parser.parse('2015-01-01 00:00:00+00') >>> d datetime.datetime(2015, 1, 1, 0, 0, tzinfo=tzutc()) >>> d.astimezone(dateutil.tz.tzlocal()) datetime.datetime(2015, 1, 1, 9, 0, tzinfo=tzlocal()) >>> d.astimezone(dateutil.tz.tzlocal()).strftime('%c') '01/01/15 09:00:00' >>> d.astimezone(dateutil.tz.tzlocal()).strftime('%z') '+0900' >>> d.astimezone(dateutil.tz.tzlocal()).strftime('%X')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy.sql import func | |
def query_maker(session, cls): | |
query = session.query(cls) | |
return Adapter(query, cls) | |
def faster_count_query(query): | |
count_q = query.statement.with_only_columns([func.count()]).order_by(None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import logging | |
import deform | |
import pkg_resources | |
import whitenoise | |
from webob.exc import ( | |
HTTPFound, | |
HTTPNotFound, | |
) | |
from colanderalchemy import SQLAlchemySchemaNode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function g | |
{ | |
cd $(ghq list -p | peco) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from sqlalchemy.sql.expression import table, column | |
>>> from sqlalchemy.sql.expression import select | |
>>> from sqlalchemy.sql.types import VARCHAR | |
>>> from sqlalchemy.dialects.postgresql import dialect | |
>>> employee = table('employee', column('id', VARCHAR), column('job_id', VARCHAR)) | |
>>> job = table('job', column('id', VARCHAR), column('name', VARCHAR)) | |
>>> str(select([employee.join(job, employee.c.job_id == job.c.id)]).compile(dialect=dialect())) | |
'SELECT employee.id, employee.job_id, job.id, job.name \nFROM employee JOIN job ON employee.job_id = job.id' | |
>>> stmt = select([employee.join(job, employee.c.job_id == job.c.id)]).where(job.c.name == 'programmer') | |
>>> str(stmt.compile(dialect=dialect())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g prefix C-t | |
unbind C-b | |
bind C-t send-prefix |
(.venv) PS C:\Users\aodag\Documents\works\日本語> pip --version
pip 7.1.1 from c:\users\aodag\documents\works\日本語\.venv\lib\site-packages (python 3.5)