function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def logspace(xmin,xmax,N): return np.exp(np.linspace(np.log(xmin), np.log(xmax), N))
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def window_hanning(x): "return x times the hanning window of len(x)" return np.hanning(len(x))*x
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def detrend(x, key=None): if key is None or key=='constant': return detrend_mean(x) elif key=='linear': return detrend_linear(x)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def detrend_mean(x): "Return x minus the mean(x)" return x - x.mean()
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def detrend_linear(y): "Return y minus best fit line; 'linear' detrending " # This is faster than an algorithm based on linalg.lstsq. x = np.arange(len(y), dtype=np.float_) C = np.cov(x, y, bias=1) b = C[0,1]/C[0,0] a = y.mean() - b*x.mean() return y - (b*x + a)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def _spectral_helper(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0, pad_to=None, sides='default', scale_by_freq=None): #The checks for if y is x are so that we can use the same function to #implement the core of psd(), csd(), and spectrogram() without doing #e...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def psd(x, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0, pad_to=None, sides='default', scale_by_freq=None): """ The power spectral density by Welch's average periodogram method. The vector *x* is divided into *NFFT* length blocks. Each block is detrended by the functi...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def csd(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0, pad_to=None, sides='default', scale_by_freq=None): """ The cross power spectral density by Welch's average periodogram method. The vectors *x* and *y* are divided into *NFFT* length blocks. Each block is det...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def specgram(x, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=128, pad_to=None, sides='default', scale_by_freq=None): """ Compute a spectrogram of data in *x*. Data are split into *NFFT* length segments and the PSD of each section is computed. The windowing function *wi...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0, pad_to=None, sides='default', scale_by_freq=None): """ The coherence between *x* and *y*. Coherence is the normalized cross spectral density: .. math:: C_{xy} = \\frac{|P_{xy}|^2}{P_{xx}P_{yy}} ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def cohere_pairs( X, ij, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0, preferSpeedOverMemory=True, progressCallback=donothing_callback, returnPxx=False): u""" Call signature:: Cxy, Phase, freqs = cohere_pa...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def normpdf(x, *args): "Return the normal pdf evaluated at *x*; args provides *mu*, *sigma*" mu, sigma = args return 1./(np.sqrt(2*np.pi)*sigma)*np.exp(-0.5 * (1./sigma*(x - mu))**2)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def find(condition): "Return the indices where ravel(condition) is true" res, = np.nonzero(np.ravel(condition)) return res
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def longest_ones(x): '''alias for longest_contiguous_ones''' return longest_contiguous_ones(x)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, a): """ compute the SVD of a and store data for PCA. Use project to project the data onto a reduced set of dimensions Inputs: *a*: a numobservations x numdims array Attrs: *a* a centered unit sigma version of input a *numrows...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def center(self, x): 'center the data using the mean and sigma from training set a' return (x - self.mu)/self.sigma
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def _get_colinear(): c0 = np.array([ 0.19294738, 0.6202667 , 0.45962655, 0.07608613, 0.135818 , 0.83580842, 0.07218851, 0.48318321, 0.84472463, 0.18348462, 0.81585306, 0.96923926, 0.12835919, 0.35075355, 0.15807861, 0.837437 , 0.10824303, 0.1723387...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def _interpolate(a, b, fraction): """Returns the point at the given fraction between a and b, where 'fraction' must be between 0 and 1. """ return a + (b - a)*fraction
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def prctile_rank(x, p): """ Return the rank for each element in *x*, return the rank 0..len(*p*). Eg if *p* = (25, 50, 75), the return value will be a len(*x*) array with values in [0,1,2,3] where 0 indicates the value is less than the 25th percentile, 1 indicates the value is >= the 25th and <...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def rk4(derivs, y0, t): """ Integrate 1D or ND system of ODEs using 4-th order Runge-Kutta. This is a toy implementation which may be useful if you find yourself stranded on a system w/o scipy. Otherwise use :func:`scipy.integrate`. *y0* initial state vector *t* sample tim...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def get_xyz_where(Z, Cond): """ *Z* and *Cond* are *M* x *N* matrices. *Z* are data and *Cond* is a boolean matrix where some condition is satisfied. Return value is (*x*, *y*, *z*) where *x* and *y* are the indices into *Z* and *z* are the values of *Z* at those indices. *x*, *y*, and *z* are ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def dist(x,y): """ Return the distance between two points. """ d = x-y return np.sqrt(np.dot(d,d))
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def segments_intersect(s1, s2): """ Return *True* if *s1* and *s2* intersect. *s1* and *s2* are defined as:: s1: (x1, y1), (x2, y2) s2: (x3, y3), (x4, y4) """ (x1, y1), (x2, y2) = s1 (x3, y3), (x4, y4) = s2 den = ((y4-y3) * (x2-x1)) - ((x4-x3)*(y2-y1)) n1 = ((x4-x3) * (y1-...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def liaupunov(x, fprime): """ *x* is a very long trajectory from a map, and *fprime* returns the derivative of *x*. This function will be removed from matplotlib. Returns : .. math:: \lambda = \\frac{1}{n}\\sum \\ln|f^'(x_i)| .. seealso:: Lyapunov Exponent Sec...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, nmax): """ Buffer up to *nmax* points. """ self._xa = np.zeros((nmax,), np.float_) self._ya = np.zeros((nmax,), np.float_) self._xs = np.zeros((nmax,), np.float_) self._ys = np.zeros((nmax,), np.float_) self._ind = 0 self._nmax =...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def add(self, x, y): """ Add scalar *x* and *y* to the queue. """ if self.dataLim is not None: xy = np.asarray([(x,y),]) self.dataLim.update_from_data_xy(xy, None) ind = self._ind % self._nmax #print 'adding to fifo:', ind, x, y self._xs[i...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def asarrays(self): """ Return *x* and *y* as arrays; their length will be the len of data added or *nmax*. """ if self._ind<self._nmax: return self._xs[:self._ind], self._ys[:self._ind] ind = self._ind % self._nmax self._xa[:self._nmax-ind] = self._x...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def movavg(x,n): """ Compute the len(*n*) moving average of *x*. """ w = np.empty((n,), dtype=np.float_) w[:] = 1.0/n return np.convolve(x, w, mode='valid')
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def load(fname,comments='#',delimiter=None, converters=None,skiprows=0, usecols=None, unpack=False, dtype=np.float_): """ Load ASCII data from *fname* into an array and return the array. Deprecated: use numpy.loadtxt. The data must be regular, same number of values in every row *fname* c...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def exp_safe(x): """ Compute exponentials which safely underflow to zero. Slow, but convenient to use. Note that numpy provides proper floating point exception handling with access to the underlying hardware. """ if type(x) is np.ndarray: return exp(np.clip(x,exp_safe_MIN,exp_safe_...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def rms_flat(a): """ Return the root mean square of all the elements of *a*, flattened out. """ return np.sqrt(np.mean(np.absolute(a)**2))
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def l2norm(a): """ Return the *l2* norm of *a*, flattened out. Implemented as a separate function (not a call to :func:`norm` for speed). """ return np.sqrt(np.sum(np.absolute(a)**2))
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def frange(xini,xfin=None,delta=None,**kw): """ frange([start,] stop[, step, keywords]) -> array of floats Return a numpy ndarray containing a progression of floats. Similar to :func:`numpy.arange`, but defaults to a closed interval. ``frange(x0, x1)`` returns ``[x0, x0+1, x0+2, ..., x1]``; *start...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def identity(n, rank=2, dtype='l', typecode=None): """ Returns the identity matrix of shape (*n*, *n*, ..., *n*) (rank *r*). For ranks higher than 2, this object is simply a multi-index Kronecker delta:: / 1 if i0=i1=...=iR, id[i0,i1,...,iR] = -| ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def binary_repr(number, max_length = 1025): """ Return the binary representation of the input *number* as a string. This is more efficient than using :func:`base_repr` with base 2. Increase the value of max_length for very large numbers. Note that on 32-bit machines, 2**1023 is the largest int...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def ispower2(n): """ Returns the log base 2 of *n* if *n* is a power of 2, zero otherwise. Note the potential ambiguity if *n* == 1: 2**0 == 1, interpret accordingly. """ bin_n = binary_repr(n)[1:] if '1' in bin_n: return 0 else: return len(bin_n)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def safe_isnan(x): ':func:`numpy.isnan` for arbitrary types' if cbook.is_string_like(x): return False try: b = np.isnan(x) except NotImplementedError: return False except TypeError: return False else: return b
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def rec_append_fields(rec, names, arrs, dtypes=None): """ Return a new record array with field names populated with data from arrays in *arrs*. If appending a single field, then *names*, *arrs* and *dtypes* do not have to be lists. They can just be the values themselves. """ if (not cbook.i...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def rec_keep_fields(rec, names): """ Return a new numpy record array with only fields listed in names """ if cbook.is_string_like(names): names = names.split(',') arrays = [] for name in names: arrays.append(rec[name]) return np.rec.fromarrays(arrays, names=names)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def rec_summarize(r, summaryfuncs): """ *r* is a numpy record array *summaryfuncs* is a list of (*attr*, *func*, *outname*) tuples which will apply *func* to the the array *r*[attr] and assign the output to a new attribute name *outname*. The returned record array is identical to *r*, with ext...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def makekey(row): return tuple([row[name] for name in key])
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def key_desc(name): 'if name is a string key, use the larger size of r1 or r2 before merging' dt1 = r1.dtype[name] if dt1.type != np.string_: return (name, dt1.descr[0][1]) dt2 = r1.dtype[name] assert dt2==dt1 if dt1.num>dt2.num: return (name, dt1...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def mapped_r1field(name): """ The column name in *newrec* that corresponds to the column in *r1*. """ if name in key or name not in r2.dtype.names: return name else: return name + r1postfix
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def recs_join(key, name, recs, jointype='outer', missing=0., postfixes=None): """ Join a sequence of record arrays on single column key. This function only joins a single column of the multiple record arrays *key* is the column name that acts as a key *name* is the name of the column ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, fh): self.fh = fh
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def seek(self, arg): self.fh.seek(arg)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def next(self): return self.fix(self.fh.next())
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def process_skiprows(reader): if skiprows: for i, row in enumerate(reader): if i>=(skiprows-1): break return fh, reader
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def ismissing(name, val): "Should the value val in column name be masked?" if val == missing or val == missingd.get(name) or val == '': return True else: return False
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def newfunc(name, val): if ismissing(name, val): return default else: return func(val)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def mybool(x): if x=='True': return True elif x=='False': return False else: raise ValueError('invalid bool')
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def mydate(x): # try and return a date object d = dateparser(x) if d.hour>0 or d.minute>0 or d.second>0: raise ValueError('not a date') return d.date()
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def get_func(name, item, func): # promote functions in this order funcmap = {mybool:myint,myint:myfloat, myfloat:mydate, mydate:mydateparser, mydateparser:mystr} try: func(name, item) except: if func==mystr: raise ValueError('Could not find a working conversio...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def get_converters(reader): converters = None for i, row in enumerate(reader): if i==0: converters = [mybool]*len(row) if checkrows and i>checkrows: break #print i, len(names), len(row) #print 'converters', zip(converters, ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def tostr(self, x): return self.toval(x)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def fromstr(self, s): return s
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def tostr(self, x): val = repr(x) return val[1:-1]
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, fmt): self.fmt = fmt
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, precision=4, scale=1.): FormatFormatStr.__init__(self, '%%1.%df'%precision) self.precision = precision self.scale = scale
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def toval(self, x): if x is not None: x = x * self.scale return x
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def tostr(self, x): return '%d'%int(x)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def fromstr(self, s): return int(s)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def toval(self, x): return str(x)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, precision=4): FormatFloat.__init__(self, precision, scale=100.)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, precision=4): FormatFloat.__init__(self, precision, scale=1e-3)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, precision=4): FormatFloat.__init__(self, precision, scale=1e-6)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, fmt): self.fmt = fmt
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def toval(self, x): if x is None: return 'None' return x.strftime(self.fmt)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def __init__(self, fmt='%Y-%m-%d %H:%M:%S'): FormatDate.__init__(self, fmt)
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def get_formatd(r, formatd=None): 'build a formatd guaranteed to have a key for every dtype name' if formatd is None: formatd = dict() for i, name in enumerate(r.dtype.names): dt = r.dtype[name] format = formatd.get(name) if format is None: format = defaultformat...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def rec2txt(r, header=None, padding=3, precision=3, fields=None): """ Returns a textual representation of a record array. *r*: numpy recarray *header*: list of column headers *padding*: space between each column *precision*: number of decimal places to use for floats. Set to an integ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def with_mask(func): def newfunc(val, mask, mval): if mask: return mval else: return func(val) return newfunc
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def griddata(x,y,z,xi,yi,interp='nn'): """ ``zi = griddata(x,y,z,xi,yi)`` fits a surface of the form *z* = *f*(*x*, *y*) to the data in the (usually) nonuniformly spaced vectors (*x*, *y*, *z*). :func:`griddata` interpolates this surface at the points specified by (*xi*, *yi*) to produce *zi*. ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def less_simple_linear_interpolation( x, y, xi, extrap=False ): """ This function provides simple (but somewhat less so than :func:`cbook.simple_linear_interpolation`) linear interpolation. :func:`simple_linear_interpolation` will give a list of point between a start and an end, while this does true...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def stineman_interp(xi,x,y,yp=None): """ Given data vectors *x* and *y*, the slope vector *yp* and a new abscissa vector *xi*, the function :func:`stineman_interp` uses Stineman interpolation to calculate a vector *yi* corresponding to *xi*. Here's an example that generates a coarse sine curve,...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def inside_poly(points, verts): """ *points* is a sequence of *x*, *y* points. *verts* is a sequence of *x*, *y* vertices of a polygon. Return value is a sequence of indices into points for the points that are inside the polygon. """ res, = np.nonzero(nxutils.points_inside_poly(points, ver...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def poly_between(x, ylower, yupper): """ Given a sequence of *x*, *ylower* and *yupper*, return the polygon that fills the regions between them. *ylower* or *yupper* can be scalar or iterable. If they are iterable, they must be equal in length to *x*. Return value is *x*, *y* arrays for use w...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def contiguous_regions(mask): """ return a list of (ind0, ind1) such that mask[ind0:ind1].all() is True and we cover all such regions TODO: this is a pure python implementation which probably has a much faster numpy impl """ in_region = None boundaries = [] for i, val in enumerate(mask...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def cross_from_above(x, threshold): """ return the indices into *x* where *x* crosses some threshold from below, eg the i's where:: x[i-1]>threshold and x[i]<=threshold .. seealso:: :func:`cross_from_below` and :func:`contiguous_regions` """ x = np.asarray(x) ind = np.nonze...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def vector_lengths( X, P=2., axis=None ): """ Finds the length of a set of vectors in *n* dimensions. This is like the :func:`numpy.norm` function for vectors, but has the ability to work over a particular axis of the supplied array or matrix. Computes ``(sum((x_i)^P))^(1/P)`` for each ``{x_i}`` b...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def path_length(X): """ Computes the distance travelled along a polygonal curve in *N* dimensions. Where *X* is an *M* x *N* array or matrix. Returns an array of length *M* consisting of the distance along the curve at each point (i.e., the rows of *X*). """ X = distances_along_curve(X) ...
SpaceKatt/CSPLN
[ 1, 1, 1, 1, 1441155989 ]
def map_type(self, obj): # TODO: Replace all str with unicode when done in property.default attribute # TODO: Fix ToGuessProp as it may be a list. if isinstance(obj, ListProp): return list if isinstance(obj, StringProp): return str if isinstance(obj, Un...
naparuba/shinken
[ 1129, 344, 1129, 221, 1290510176 ]
def add(self, b): if isinstance(b, Brok): self.broks[b.id] = b return if isinstance(b, ExternalCommand): self.sched.run_external_command(b.cmd_line)
naparuba/shinken
[ 1129, 344, 1129, 221, 1290510176 ]
def get(self): self.response.out.write("Test 1:" +self.test1() +"<br>") self.response.out.write("Test 2:" + self.test2() +"<br>") self.response.out.write("Test 3:" + self.test3() +"<br>") self.response.out.write("Test 4:" + self.test4() +"<br>")
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def test1(self): key = "test@test.com" ent_type = "Accounts" trophy_case_widget = TrophyCase(key_name=key) points_widget = Points(key_name=key) rank_widget = Rank(key_name=key) newacc = Accounts(key_name=key, password="aaa", email=key, ...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def test2(self): account_key = "raj" trophy_case_widget = TrophyCase(key_name=account_key) points_widget = Points(key_name=account_key) rank_widget = Rank(key_name=account_key) newacc = Accounts(key_name=account_key, password="aaa", email="a@a.a", ...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def test3(self): account_key = "a@a.a" trophy_case_widget = TrophyCase(key_name=account_key) points_widget = Points(key_name=account_key) rank_widget = Rank(key_name=account_key) newacc = Accounts(key_name=account_key, password="aaa", email="a@a.a", ...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def test4(self): account_key = "a@a.a" trophy_case_widget = TrophyCase(key_name=account_key) points_widget = Points(key_name=account_key) rank_widget = Rank(key_name=account_key) newacc = Accounts(key_name=account_key, password="aaa", email="a@a.a", ...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): """ Add to the db, get, and delete """
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): from serverside.tools import encryption """Do some simple encryption and show results """ mystr = "hello, world" self.response.out.write("encrypt string: " + mystr + "<br/>") mystr_enc = encryption.des_encrypt_str("hello, world") self.response.out.write("encrypted: " + mystr_enc +...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): print "OS: " + os.environ["SERVER_SOFTWARE"] self.response.out.write("OS server software: " + os.environ["SERVER_SOFTWARE"])
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def post(self): pass
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): self.response.out.write("Creating session and setting cookie")
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): self.response.out.write("<br/>If you reached here you are logged in!")
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): self.response.out.write("terminating the follow session:") sess = Session().get_current_session(self) if(sess == None): self.response.out.write("<br/>You are not logged in!!") else: self.response.out.write("<br/>You are logged in as:") email = sess.get_email() self...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): self.response.out.write("You should be able to see this page, logged in or not...") sess = Session().get_current_session(self) if(sess == None): self.response.out.write("<br/>You are not logged in!!") else: self.response.out.write("<br/>You are logged in as:") email = se...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): log1 = {"account":"test@test.test", 'event':'getuserdata', 'api': 'get_user_data', 'is_api':'yes', 'user':"test_user", 'success':'true', 'ip':'127.0.0.1'} log1["details"] = u"HELLO 0" logs.create(log1) log1["is_a...
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): q = Logs.all() q.filter("account = ", "test@test.test") ents = q.fetch(10) count = 0 for ii in ents: count += 1 self.response.out.write(ii.details) self.response.out.write("<br/>") self.response.out.write("Number fetched " + str(count))
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): pass
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]
def get(self): pass
nlake44/UserInfuser
[ 101, 54, 101, 3, 1311320106 ]