SELECT
file.project,
COUNT(*) as total_downloads,
FROM
TABLE_DATE_RANGE(
[the-psf:pypi.downloads],
TIMESTAMP("20160114"),
This file contains hidden or 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 flask_sqlalchemy | |
from sqlalchemy import schema | |
from sqlalchemy.ext.compiler import compiles | |
db = flask_sqlalchemy.SQLAlchemy() | |
class Tag(db.Model): | |
__table_args__ = {'info': {'without_rowid': True}} | |
text = db.Column(db.String, primary_key=True) |
This file contains hidden or 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
""" | |
Module implementing an enhanced string column type for SQLAlchemy | |
with a support for regular expression operators in Postgres and SQLite. | |
""" | |
import re | |
from sqlalchemy import String as _String, event, exc | |
from sqlalchemy.engine import Engine | |
from sqlalchemy.ext.compiler import compiles | |
from sqlalchemy.sql.expression import BinaryExpression, func, literal |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import posixpath | |
try: | |
from urlparse import urlsplit | |
from urllib import unquote | |
except ImportError: # Python 3 | |
from urllib.parse import urlsplit, unquote |
This file contains hidden or 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
""" | |
floyd_warshall_fastest() is a fast Python+NumPy implementation of the Floyd-Warshall algorithm | |
for finding the shortest path distances between all nodes of a weighted Graph. For more details see | |
http://en.wikipedia.org/wiki/Floyd-Warshall_algorithm | |
Tests and time comparisons to slower versions are provided. | |
Result of test_floyd_warshall_compatibility_on_large_matrix(): | |
Matrix size: 100 | |
Slow algorithm (with allocations): 0.726 seconds elapsed |
This file contains hidden or 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 re | |
def re_sub(pattern, replacement, string): | |
def _r(m): | |
# Now this is ugly. | |
# Python has a "feature" where unmatched groups return None | |
# then re.sub chokes on this. | |
# see http://bugs.python.org/issue1519638 | |
# this works around and hooks into the internal of the re module... |
Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺
Locally, I'm at this commit:
$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <[email protected]>
Date: Sun Apr 15 16:35:03 2012 +0200
When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.
This file contains hidden or 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
#!/usr/bin/env ruby | |
=begin | |
= Geographic Searches With Postgres's Earthdistance and Cube Extensions | |
This program shows how to easily create a Postgres database that uses the Cube | |
and Earthdistance extensions to perform fast queries on geographic data. | |
Briefly, the problem this code solves is "show me all places within 50 | |
kilometers of New York City." |