Skip to content

Instantly share code, notes, and snippets.

View jd's full-sized avatar
🦾

Julien Danjou jd

🦾
View GitHub Profile
def create_engine(sql_connection, sqlite_fk=False,
mysql_traditional_mode=False):
return session.create_engine(sql_connection,
sqlite_fk,
mysql_traditional_mode,
idle_timeout=CONF.database.idle_timeout,
connection_debug=CONF.databse.connection_debug,
max_pool_size=CONF.database.max_pool_size,
max_overflow=CONF.database.max_overflow,
pool_timeout=CONF.database.pool_timeout,
@jd
jd / gist:6210206
Last active December 20, 2015 23:09
=> GET /v2/meter/instances/statistics?reset_on=metadata.vm_state
<= {
'off': [ { avg: ... max: ... start: '2013-07-01 00:00:00', end: '2013-07-01 00:59:59' },
{ avg: ... max: ... start: '2013-07-01 03:00:00', end: '2013-07-01 03:59:59' },
'on': [ { avg: ... max: ... start: '2013-07-01 01:00:00', end: '2013-07-01 01:59:59' } ],
'suspended': [ { avg: ... max: ... start: '2013-07-01 02:00:00', end: '2013-07-01 02:59:59' } ]
}
% git diff
diff --git a/ceilometer/storage/impl_mongodb.py b/ceilometer/storage/impl_mongodb.py
index 4580833..84bd8fc 100644
--- a/ceilometer/storage/impl_mongodb.py
+++ b/ceilometer/storage/impl_mongodb.py
@@ -288,6 +288,8 @@ class Connection(base.Connection):
self.db.clear()
else:
self.conn.drop_database(self.db)
+ import time
(if (if 1 2) 1)
Generates the tree
ast.stmt.If
`-> ast.stmt.If
`-> ast.expr.Num
`-> ast.expr.Num
`-> ast.expr.Num
diff --git a/hy/compiler.py b/hy/compiler.py
index 24ba107..22687ca 100644
--- a/hy/compiler.py
+++ b/hy/compiler.py
@@ -157,6 +157,19 @@ class HyASTCompiler(object):
return self._mangle_branch([branch])
@builds("if")
+ def wraps_if_expression(self, expr):
+ return ast.Expr(