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
print(r''' | |
The Classic Diamond Pattern | |
or | |
How I Learned to Stop Worrying and Love Python | |
--> := 'inherets from' | |
A | |
^ |
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
class LockError(Exception): | |
def __init__(self,call_stack): | |
self.call_stack = call_stack[:] | |
def __str__(self): | |
msg = 'Not enough information.\n' | |
msg += ' call stack:\n ' | |
msg += '\n '.join(self.call_stack) | |
return msg |
Loading
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
from matplotlib.colors import LinearSegmentedColormap | |
from numpy import nan, inf | |
# Used to reconstruct the colormap in pycam02ucs.cm.viscm | |
parameters = {'xp': [22.674387857633945, -10.903679653679603, -27.867965367965326, -46.32034632034626, 9.9296536796537396, -1.2562144886363136], | |
'yp': [-20.102530541012214, -39.58333333333333, -51.19047619047619, 60.714285714285694, 66.369047619047592, -0.46657986111111427], | |
'min_Jp': 18.8671875, | |
'max_Jp': 99.79166666666667} |
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
#include <iostream> | |
struct Foo | |
{ | |
public: | |
Foo(int d) : x(d) {} | |
int x; | |
}; | |
int main() |
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
#include <unordered_map> | |
#include <memory> | |
using namespace std; | |
struct Node { | |
bool end; | |
unordered_map<char,unique_ptr<Node>> children; | |
Node() : end(false), children() {} | |
}; |
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
#!/usr/bin/python3 | |
import sys | |
import os | |
import argparse | |
import fnmatch | |
import re | |
class AppendAction(argparse.Action): | |
def __call__(self, parser, namespace, values, option_string=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 numpy as np | |
from scipy import optimize as opt | |
from scipy import stats | |
from matplotlib import pyplot | |
xx,yy = np.array([ | |
[760.0500, 195], | |
[760.1500, 193], | |
[760.2500, 187], | |
[760.3500, 185], |
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
#!/usr/bin/env python3 | |
import sys | |
import os | |
import re | |
from os import path | |
from glob import glob | |
from graph_tool.all import * |
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 re | |
from ctypes import * | |
from nose.tools import * | |
from six import * | |
from unittest.mock import * | |
def ref_to_pointer(ref, ctype): | |
'''convert byref() object to real pointer''' | |
addr = int(re.search(r'(0x[\dabcdefABCDEF]+)',repr(ref)).group(1), 0) |
OlderNewer