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
In [2]: e = 3 | |
In [3]: x = {} | |
In [4]: try: | |
...: x['a'] | |
...: except Exception as e: | |
...: pass | |
...: |
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
>>> AssertionError = ValueError | |
>>> assert False, "Assert Failed!" | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
ValueError: Assert Failed! | |
>>> AssertionError = None | |
>>> assert False, "Assert Failed!" | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: 'NoneType' object is not callable |
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
In [2]: x = 3 | |
In [3]: def foo(): | |
...: global x | |
...: def x(): | |
...: pass | |
...: | |
In [4]: x | |
Out[4]: 3 |
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
>>> def outer(): | |
... def inner(): | |
"Fails with SyntaxError" | |
... from numpy import * | |
... return array | |
... return inner() | |
... | |
<stdin>:2: SyntaxWarning: import * only allowed at module level | |
File "<stdin>", line 3 | |
SyntaxError: import * is not allowed in function 'inner' because it is a nested function |
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 gc | |
import objgraph | |
class Foo(object): | |
def __init__(self): | |
self._gen = None | |
def __iter__(self): | |
self._gen = self.gen() |
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
# Run flake8 against any added/modified python files in the current git repo. | |
function check8 () | |
{ | |
errors=`git diff --relative --name-only --diff-filter AM --ignore-submodules | grep -e "\.py" | xargs flake8` | |
retval=$? | |
# xargs returns 127 if flake8 couldn't be found | |
if [ "$retval" = "127" ] | |
then |
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
### Loading CSV for EIDO Data since 2014 | |
## Branch | |
2428414 function calls (2416047 primitive calls) in 9.570 seconds | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
1 0.000 0.000 8.094 8.094 qexec/qexec/sources/requests_csv.py:384(__init__) | |
1 0.254 0.254 8.094 8.094 qexec/qexec/sources/requests_csv.py:269(load_df) | |
## Master | |
9529341 function calls (9517154 primitive calls) in 30.053 seconds | |
ncalls tottime percall cumtime percall filename:lineno(function) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Min Variance | |
Staging: | |
real 0m24.313s | |
user 0m23.650s | |
sys 0m0.330s | |
real 0m23.974s | |
user 0m23.210s | |
sys 0m0.420s |
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
;; Root directory for Quantopian projects. | |
(setq quantopian-root | |
(let (temp) | |
(setq temp (getenv "QUANTO_ROOT")) | |
(if temp (file-name-as-directory temp) "~/quantopian"))) | |
;; ============= | |
;; Package Repos | |
;; ============= | |
(require 'package) |