id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
48,000
markovmodel/msmtools
msmtools/estimation/api.py
connected_sets
def connected_sets(C, directed=True): r"""Compute connected sets of microstates. Connected components for a directed graph with edge-weights given by the count matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional ...
python
def connected_sets(C, directed=True): r"""Compute connected sets of microstates. Connected components for a directed graph with edge-weights given by the count matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional ...
[ "def", "connected_sets", "(", "C", ",", "directed", "=", "True", ")", ":", "if", "isdense", "(", "C", ")", ":", "return", "sparse", ".", "connectivity", ".", "connected_sets", "(", "csr_matrix", "(", "C", ")", ",", "directed", "=", "directed", ")", "el...
r"""Compute connected sets of microstates. Connected components for a directed graph with edge-weights given by the count matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components...
[ "r", "Compute", "connected", "sets", "of", "microstates", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L402-L455
48,001
markovmodel/msmtools
msmtools/estimation/api.py
largest_connected_set
def largest_connected_set(C, directed=True): r"""Largest connected component for a directed graph with edge-weights given by the count matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connecte...
python
def largest_connected_set(C, directed=True): r"""Largest connected component for a directed graph with edge-weights given by the count matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connecte...
[ "def", "largest_connected_set", "(", "C", ",", "directed", "=", "True", ")", ":", "if", "isdense", "(", "C", ")", ":", "return", "sparse", ".", "connectivity", ".", "largest_connected_set", "(", "csr_matrix", "(", "C", ")", ",", "directed", "=", "directed"...
r"""Largest connected component for a directed graph with edge-weights given by the count matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed or undirected...
[ "r", "Largest", "connected", "component", "for", "a", "directed", "graph", "with", "edge", "-", "weights", "given", "by", "the", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L458-L510
48,002
markovmodel/msmtools
msmtools/estimation/api.py
largest_connected_submatrix
def largest_connected_submatrix(C, directed=True, lcc=None): r"""Compute the count matrix on the largest connected set. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed...
python
def largest_connected_submatrix(C, directed=True, lcc=None): r"""Compute the count matrix on the largest connected set. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed...
[ "def", "largest_connected_submatrix", "(", "C", ",", "directed", "=", "True", ",", "lcc", "=", "None", ")", ":", "if", "isdense", "(", "C", ")", ":", "return", "sparse", ".", "connectivity", ".", "largest_connected_submatrix", "(", "csr_matrix", "(", "C", ...
r"""Compute the count matrix on the largest connected set. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed or undirected graph. Default is True lcc : (M,) ndarr...
[ "r", "Compute", "the", "count", "matrix", "on", "the", "largest", "connected", "set", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L514-L572
48,003
markovmodel/msmtools
msmtools/estimation/api.py
is_connected
def is_connected(C, directed=True): """Check connectivity of the given matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed or undirected graph. Default is T...
python
def is_connected(C, directed=True): """Check connectivity of the given matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed or undirected graph. Default is T...
[ "def", "is_connected", "(", "C", ",", "directed", "=", "True", ")", ":", "if", "isdense", "(", "C", ")", ":", "return", "sparse", ".", "connectivity", ".", "is_connected", "(", "csr_matrix", "(", "C", ")", ",", "directed", "=", "directed", ")", "else",...
Check connectivity of the given matrix. Parameters ---------- C : scipy.sparse matrix Count matrix specifying edge weights. directed : bool, optional Whether to compute connected components for a directed or undirected graph. Default is True. Returns ------- is_connec...
[ "Check", "connectivity", "of", "the", "given", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L575-L623
48,004
markovmodel/msmtools
msmtools/estimation/api.py
prior_neighbor
def prior_neighbor(C, alpha=0.001): r"""Neighbor prior for the given count matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray or scipy.sparse matrix ...
python
def prior_neighbor(C, alpha=0.001): r"""Neighbor prior for the given count matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray or scipy.sparse matrix ...
[ "def", "prior_neighbor", "(", "C", ",", "alpha", "=", "0.001", ")", ":", "if", "isdense", "(", "C", ")", ":", "B", "=", "sparse", ".", "prior", ".", "prior_neighbor", "(", "csr_matrix", "(", "C", ")", ",", "alpha", "=", "alpha", ")", "return", "B",...
r"""Neighbor prior for the given count matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray or scipy.sparse matrix Prior count matrix Notes ---...
[ "r", "Neighbor", "prior", "for", "the", "given", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L630-L673
48,005
markovmodel/msmtools
msmtools/estimation/api.py
prior_const
def prior_const(C, alpha=0.001): r"""Constant prior for given count matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray Prior count matrix Not...
python
def prior_const(C, alpha=0.001): r"""Constant prior for given count matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray Prior count matrix Not...
[ "def", "prior_const", "(", "C", ",", "alpha", "=", "0.001", ")", ":", "if", "isdense", "(", "C", ")", ":", "return", "sparse", ".", "prior", ".", "prior_const", "(", "C", ",", "alpha", "=", "alpha", ")", "else", ":", "warnings", ".", "warn", "(", ...
r"""Constant prior for given count matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix alpha : float (optional) Value of prior counts Returns ------- B : (M, M) ndarray Prior count matrix Notes ----- The prior is defined...
[ "r", "Constant", "prior", "for", "given", "count", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L676-L715
48,006
markovmodel/msmtools
msmtools/estimation/api.py
transition_matrix
def transition_matrix(C, reversible=False, mu=None, method='auto', **kwargs): r"""Estimate the transition matrix from the given countmatrix. Parameters ---------- C : numpy ndarray or scipy.sparse matrix Count matrix reversible : bool (optional) If True restrict the ensemble of tran...
python
def transition_matrix(C, reversible=False, mu=None, method='auto', **kwargs): r"""Estimate the transition matrix from the given countmatrix. Parameters ---------- C : numpy ndarray or scipy.sparse matrix Count matrix reversible : bool (optional) If True restrict the ensemble of tran...
[ "def", "transition_matrix", "(", "C", ",", "reversible", "=", "False", ",", "mu", "=", "None", ",", "method", "=", "'auto'", ",", "*", "*", "kwargs", ")", ":", "if", "issparse", "(", "C", ")", ":", "sparse_input_type", "=", "True", "elif", "isdense", ...
r"""Estimate the transition matrix from the given countmatrix. Parameters ---------- C : numpy ndarray or scipy.sparse matrix Count matrix reversible : bool (optional) If True restrict the ensemble of transition matrices to those having a detailed balance symmetry otherwise ...
[ "r", "Estimate", "the", "transition", "matrix", "from", "the", "given", "countmatrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L782-L1000
48,007
markovmodel/msmtools
msmtools/estimation/api.py
log_likelihood
def log_likelihood(C, T): r"""Log-likelihood of the count matrix given a transition matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix T : (M, M) ndarray orscipy.sparse matrix Transition matrix Returns ------- logL : float Log-l...
python
def log_likelihood(C, T): r"""Log-likelihood of the count matrix given a transition matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix T : (M, M) ndarray orscipy.sparse matrix Transition matrix Returns ------- logL : float Log-l...
[ "def", "log_likelihood", "(", "C", ",", "T", ")", ":", "if", "issparse", "(", "C", ")", "and", "issparse", "(", "T", ")", ":", "return", "sparse", ".", "likelihood", ".", "log_likelihood", "(", "C", ",", "T", ")", "else", ":", "# use the dense likeliho...
r"""Log-likelihood of the count matrix given a transition matrix. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix T : (M, M) ndarray orscipy.sparse matrix Transition matrix Returns ------- logL : float Log-likelihood of the count matrix ...
[ "r", "Log", "-", "likelihood", "of", "the", "count", "matrix", "given", "a", "transition", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L1003-L1073
48,008
markovmodel/msmtools
msmtools/estimation/api.py
tmatrix_cov
def tmatrix_cov(C, k=None): r"""Covariance tensor for non-reversible transition matrix posterior. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix k : int (optional) Return only covariance matrix for entires in the k-th row of the transition matri...
python
def tmatrix_cov(C, k=None): r"""Covariance tensor for non-reversible transition matrix posterior. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix k : int (optional) Return only covariance matrix for entires in the k-th row of the transition matri...
[ "def", "tmatrix_cov", "(", "C", ",", "k", "=", "None", ")", ":", "if", "issparse", "(", "C", ")", ":", "warnings", ".", "warn", "(", "\"Covariance matrix will be dense for sparse input\"", ")", "C", "=", "C", ".", "toarray", "(", ")", "return", "dense", ...
r"""Covariance tensor for non-reversible transition matrix posterior. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix k : int (optional) Return only covariance matrix for entires in the k-th row of the transition matrix Returns ------- c...
[ "r", "Covariance", "tensor", "for", "non", "-", "reversible", "transition", "matrix", "posterior", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L1076-L1111
48,009
markovmodel/msmtools
msmtools/estimation/api.py
sample_tmatrix
def sample_tmatrix(C, nsample=1, nsteps=None, reversible=False, mu=None, T0=None, return_statdist=False): r"""samples transition matrices from the posterior distribution Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix nsample : int number of samples to b...
python
def sample_tmatrix(C, nsample=1, nsteps=None, reversible=False, mu=None, T0=None, return_statdist=False): r"""samples transition matrices from the posterior distribution Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix nsample : int number of samples to b...
[ "def", "sample_tmatrix", "(", "C", ",", "nsample", "=", "1", ",", "nsteps", "=", "None", ",", "reversible", "=", "False", ",", "mu", "=", "None", ",", "T0", "=", "None", ",", "return_statdist", "=", "False", ")", ":", "if", "issparse", "(", "C", ")...
r"""samples transition matrices from the posterior distribution Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix nsample : int number of samples to be drawn nstep : int, default=None number of full Gibbs sampling sweeps internally done for each sa...
[ "r", "samples", "transition", "matrices", "from", "the", "posterior", "distribution" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L1172-L1224
48,010
markovmodel/msmtools
msmtools/estimation/api.py
tmatrix_sampler
def tmatrix_sampler(C, reversible=False, mu=None, T0=None, nsteps=None, prior='sparse'): r"""Generate transition matrix sampler object. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix reversible : bool If true sample from the ensemble of transition matri...
python
def tmatrix_sampler(C, reversible=False, mu=None, T0=None, nsteps=None, prior='sparse'): r"""Generate transition matrix sampler object. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix reversible : bool If true sample from the ensemble of transition matri...
[ "def", "tmatrix_sampler", "(", "C", ",", "reversible", "=", "False", ",", "mu", "=", "None", ",", "T0", "=", "None", ",", "nsteps", "=", "None", ",", "prior", "=", "'sparse'", ")", ":", "if", "issparse", "(", "C", ")", ":", "_showSparseConversionWarnin...
r"""Generate transition matrix sampler object. Parameters ---------- C : (M, M) ndarray or scipy.sparse matrix Count matrix reversible : bool If true sample from the ensemble of transition matrices restricted to those obeying a detailed balance condition, else draw from ...
[ "r", "Generate", "transition", "matrix", "sampler", "object", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/api.py#L1227-L1295
48,011
markovmodel/msmtools
msmtools/flux/sparse/tpt.py
remove_negative_entries
def remove_negative_entries(A): r"""Remove all negative entries from sparse matrix. Aplus=max(0, A) Parameters ---------- A : (M, M) scipy.sparse matrix Input matrix Returns ------- Aplus : (M, M) scipy.sparse matrix Input matrix with negative entries set to zero. ...
python
def remove_negative_entries(A): r"""Remove all negative entries from sparse matrix. Aplus=max(0, A) Parameters ---------- A : (M, M) scipy.sparse matrix Input matrix Returns ------- Aplus : (M, M) scipy.sparse matrix Input matrix with negative entries set to zero. ...
[ "def", "remove_negative_entries", "(", "A", ")", ":", "A", "=", "A", ".", "tocoo", "(", ")", "data", "=", "A", ".", "data", "row", "=", "A", ".", "row", "col", "=", "A", ".", "col", "\"\"\"Positive entries\"\"\"", "pos", "=", "data", ">", "0.0", "d...
r"""Remove all negative entries from sparse matrix. Aplus=max(0, A) Parameters ---------- A : (M, M) scipy.sparse matrix Input matrix Returns ------- Aplus : (M, M) scipy.sparse matrix Input matrix with negative entries set to zero.
[ "r", "Remove", "all", "negative", "entries", "from", "sparse", "matrix", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/tpt.py#L32-L62
48,012
markovmodel/msmtools
msmtools/flux/sparse/tpt.py
flux_matrix
def flux_matrix(T, pi, qminus, qplus, netflux=True): r"""Compute the flux. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix pi : (M,) ndarray Stationary distribution corresponding to T qminus : (M,) ndarray Backward comittor qplus : (M,) ndarray...
python
def flux_matrix(T, pi, qminus, qplus, netflux=True): r"""Compute the flux. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix pi : (M,) ndarray Stationary distribution corresponding to T qminus : (M,) ndarray Backward comittor qplus : (M,) ndarray...
[ "def", "flux_matrix", "(", "T", ",", "pi", ",", "qminus", ",", "qplus", ",", "netflux", "=", "True", ")", ":", "D1", "=", "diags", "(", "(", "pi", "*", "qminus", ",", ")", ",", "(", "0", ",", ")", ")", "D2", "=", "diags", "(", "(", "qplus", ...
r"""Compute the flux. Parameters ---------- T : (M, M) scipy.sparse matrix Transition matrix pi : (M,) ndarray Stationary distribution corresponding to T qminus : (M,) ndarray Backward comittor qplus : (M,) ndarray Forward committor netflux : boolean ...
[ "r", "Compute", "the", "flux", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/tpt.py#L70-L105
48,013
markovmodel/msmtools
msmtools/flux/sparse/tpt.py
to_netflux
def to_netflux(flux): r"""Compute the netflux. f_ij^{+}=max{0, f_ij-f_ji} for all pairs i,j Parameters ---------- flux : (M, M) scipy.sparse matrix Matrix of flux values between pairs of states. Returns ------- netflux : (M, M) scipy.sparse matrix Matrix of netflux...
python
def to_netflux(flux): r"""Compute the netflux. f_ij^{+}=max{0, f_ij-f_ji} for all pairs i,j Parameters ---------- flux : (M, M) scipy.sparse matrix Matrix of flux values between pairs of states. Returns ------- netflux : (M, M) scipy.sparse matrix Matrix of netflux...
[ "def", "to_netflux", "(", "flux", ")", ":", "netflux", "=", "flux", "-", "flux", ".", "T", "\"\"\"Set negative entries to zero\"\"\"", "netflux", "=", "remove_negative_entries", "(", "netflux", ")", "return", "netflux" ]
r"""Compute the netflux. f_ij^{+}=max{0, f_ij-f_ji} for all pairs i,j Parameters ---------- flux : (M, M) scipy.sparse matrix Matrix of flux values between pairs of states. Returns ------- netflux : (M, M) scipy.sparse matrix Matrix of netflux values between pairs of s...
[ "r", "Compute", "the", "netflux", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/tpt.py#L108-L129
48,014
markovmodel/msmtools
msmtools/flux/sparse/tpt.py
total_flux
def total_flux(flux, A): r"""Compute the total flux between reactant and product. Parameters ---------- flux : (M, M) scipy.sparse matrix Matrix of flux values between pairs of states. A : array_like List of integer state labels for set A (reactant) Returns ------- F : ...
python
def total_flux(flux, A): r"""Compute the total flux between reactant and product. Parameters ---------- flux : (M, M) scipy.sparse matrix Matrix of flux values between pairs of states. A : array_like List of integer state labels for set A (reactant) Returns ------- F : ...
[ "def", "total_flux", "(", "flux", ",", "A", ")", ":", "X", "=", "set", "(", "np", ".", "arange", "(", "flux", ".", "shape", "[", "0", "]", ")", ")", "# total state space", "A", "=", "set", "(", "A", ")", "notA", "=", "X", ".", "difference", "("...
r"""Compute the total flux between reactant and product. Parameters ---------- flux : (M, M) scipy.sparse matrix Matrix of flux values between pairs of states. A : array_like List of integer state labels for set A (reactant) Returns ------- F : float The total flux ...
[ "r", "Compute", "the", "total", "flux", "between", "reactant", "and", "product", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/sparse/tpt.py#L165-L193
48,015
markovmodel/msmtools
msmtools/analysis/dense/sensitivity.py
stationary_distribution_sensitivity
def stationary_distribution_sensitivity(T, j): r"""Calculate the sensitivity matrix for entry j the stationary distribution vector given transition matrix T. Parameters ---------- T : numpy.ndarray shape = (n, n) Transition matrix j : int entry of stationary distribution for whi...
python
def stationary_distribution_sensitivity(T, j): r"""Calculate the sensitivity matrix for entry j the stationary distribution vector given transition matrix T. Parameters ---------- T : numpy.ndarray shape = (n, n) Transition matrix j : int entry of stationary distribution for whi...
[ "def", "stationary_distribution_sensitivity", "(", "T", ",", "j", ")", ":", "n", "=", "len", "(", "T", ")", "lEV", "=", "numpy", ".", "ones", "(", "n", ")", "rEV", "=", "stationary_distribution", "(", "T", ")", "eVal", "=", "1.0", "T", "=", "numpy", ...
r"""Calculate the sensitivity matrix for entry j the stationary distribution vector given transition matrix T. Parameters ---------- T : numpy.ndarray shape = (n, n) Transition matrix j : int entry of stationary distribution for which the sensitivity is to be computed Returns ...
[ "r", "Calculate", "the", "sensitivity", "matrix", "for", "entry", "j", "the", "stationary", "distribution", "vector", "given", "transition", "matrix", "T", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/sensitivity.py#L301-L343
48,016
markovmodel/msmtools
msmtools/analysis/dense/expectations.py
geometric_series
def geometric_series(q, n): """ Compute finite geometric series. \frac{1-q^{n+1}}{1-q} q \neq 1 \sum_{k=0}^{n} q^{k}= n+1 q = 1 Parameters ---------- q : array-like The common ratio of the geome...
python
def geometric_series(q, n): """ Compute finite geometric series. \frac{1-q^{n+1}}{1-q} q \neq 1 \sum_{k=0}^{n} q^{k}= n+1 q = 1 Parameters ---------- q : array-like The common ratio of the geome...
[ "def", "geometric_series", "(", "q", ",", "n", ")", ":", "q", "=", "np", ".", "asarray", "(", "q", ")", "if", "n", "<", "0", ":", "raise", "ValueError", "(", "'Finite geometric series is only defined for n>=0.'", ")", "else", ":", "\"\"\"q is scalar\"\"\"", ...
Compute finite geometric series. \frac{1-q^{n+1}}{1-q} q \neq 1 \sum_{k=0}^{n} q^{k}= n+1 q = 1 Parameters ---------- q : array-like The common ratio of the geometric series. n : int The num...
[ "Compute", "finite", "geometric", "series", "." ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/analysis/dense/expectations.py#L105-L147
48,017
markovmodel/msmtools
msmtools/estimation/sparse/newton/mle_rev.py
solve_mle_rev
def solve_mle_rev(C, tol=1e-10, maxiter=100, show_progress=False, full_output=False, return_statdist=True, **kwargs): """Number of states""" M = C.shape[0] """Initial guess for primal-point""" z0 = np.zeros(2*M) z0[0:M] = 1.0 """Inequality constraints""" # G = np.zeros((M...
python
def solve_mle_rev(C, tol=1e-10, maxiter=100, show_progress=False, full_output=False, return_statdist=True, **kwargs): """Number of states""" M = C.shape[0] """Initial guess for primal-point""" z0 = np.zeros(2*M) z0[0:M] = 1.0 """Inequality constraints""" # G = np.zeros((M...
[ "def", "solve_mle_rev", "(", "C", ",", "tol", "=", "1e-10", ",", "maxiter", "=", "100", ",", "show_progress", "=", "False", ",", "full_output", "=", "False", ",", "return_statdist", "=", "True", ",", "*", "*", "kwargs", ")", ":", "M", "=", "C", ".", ...
Number of states
[ "Number", "of", "states" ]
54dc76dd2113a0e8f3d15d5316abab41402941be
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/estimation/sparse/newton/mle_rev.py#L303-L363
48,018
mlavin/django-all-access
example/example/views.py
home
def home(request): "Simple homepage view." context = {} if request.user.is_authenticated(): try: access = request.user.accountaccess_set.all()[0] except IndexError: access = None else: client = access.api_client context['info'] = client...
python
def home(request): "Simple homepage view." context = {} if request.user.is_authenticated(): try: access = request.user.accountaccess_set.all()[0] except IndexError: access = None else: client = access.api_client context['info'] = client...
[ "def", "home", "(", "request", ")", ":", "context", "=", "{", "}", "if", "request", ".", "user", ".", "is_authenticated", "(", ")", ":", "try", ":", "access", "=", "request", ".", "user", ".", "accountaccess_set", ".", "all", "(", ")", "[", "0", "]...
Simple homepage view.
[ "Simple", "homepage", "view", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/example/example/views.py#L4-L15
48,019
mlavin/django-all-access
allaccess/clients.py
get_client
def get_client(provider, token=''): "Return the API client for the given provider." cls = OAuth2Client if provider.request_token_url: cls = OAuthClient return cls(provider, token)
python
def get_client(provider, token=''): "Return the API client for the given provider." cls = OAuth2Client if provider.request_token_url: cls = OAuthClient return cls(provider, token)
[ "def", "get_client", "(", "provider", ",", "token", "=", "''", ")", ":", "cls", "=", "OAuth2Client", "if", "provider", ".", "request_token_url", ":", "cls", "=", "OAuthClient", "return", "cls", "(", "provider", ",", "token", ")" ]
Return the API client for the given provider.
[ "Return", "the", "API", "client", "for", "the", "given", "provider", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/clients.py#L231-L236
48,020
mlavin/django-all-access
allaccess/clients.py
OAuth2Client.check_application_state
def check_application_state(self, request, callback): "Check optional state parameter." stored = request.session.get(self.session_key, None) returned = request.GET.get('state', None) check = False if stored is not None: if returned is not None: check =...
python
def check_application_state(self, request, callback): "Check optional state parameter." stored = request.session.get(self.session_key, None) returned = request.GET.get('state', None) check = False if stored is not None: if returned is not None: check =...
[ "def", "check_application_state", "(", "self", ",", "request", ",", "callback", ")", ":", "stored", "=", "request", ".", "session", ".", "get", "(", "self", ".", "session_key", ",", "None", ")", "returned", "=", "request", ".", "GET", ".", "get", "(", ...
Check optional state parameter.
[ "Check", "optional", "state", "parameter", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/clients.py#L144-L156
48,021
jayvdb/flake8-putty
flake8_putty/config.py
_stripped_codes
def _stripped_codes(codes): """Return a tuple of stripped codes split by ','.""" return tuple([ code.strip() for code in codes.split(',') if code.strip() ])
python
def _stripped_codes(codes): """Return a tuple of stripped codes split by ','.""" return tuple([ code.strip() for code in codes.split(',') if code.strip() ])
[ "def", "_stripped_codes", "(", "codes", ")", ":", "return", "tuple", "(", "[", "code", ".", "strip", "(", ")", "for", "code", "in", "codes", ".", "split", "(", "','", ")", "if", "code", ".", "strip", "(", ")", "]", ")" ]
Return a tuple of stripped codes split by ','.
[ "Return", "a", "tuple", "of", "stripped", "codes", "split", "by", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L28-L33
48,022
jayvdb/flake8-putty
flake8_putty/config.py
RegexSelector.regex
def regex(self): """Return compiled regex.""" if not self._compiled_regex: self._compiled_regex = re.compile(self.raw) return self._compiled_regex
python
def regex(self): """Return compiled regex.""" if not self._compiled_regex: self._compiled_regex = re.compile(self.raw) return self._compiled_regex
[ "def", "regex", "(", "self", ")", ":", "if", "not", "self", ".", "_compiled_regex", ":", "self", ".", "_compiled_regex", "=", "re", ".", "compile", "(", "self", ".", "raw", ")", "return", "self", ".", "_compiled_regex" ]
Return compiled regex.
[ "Return", "compiled", "regex", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L69-L73
48,023
jayvdb/flake8-putty
flake8_putty/config.py
EnvironmentMarkerSelector.marker
def marker(self): """Return environment marker.""" if not self._marker: assert markers, 'Package packaging is needed for environment markers' self._marker = markers.Marker(self.raw) return self._marker
python
def marker(self): """Return environment marker.""" if not self._marker: assert markers, 'Package packaging is needed for environment markers' self._marker = markers.Marker(self.raw) return self._marker
[ "def", "marker", "(", "self", ")", ":", "if", "not", "self", ".", "_marker", ":", "assert", "markers", ",", "'Package packaging is needed for environment markers'", "self", ".", "_marker", "=", "markers", ".", "Marker", "(", "self", ".", "raw", ")", "return", ...
Return environment marker.
[ "Return", "environment", "marker", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L106-L111
48,024
jayvdb/flake8-putty
flake8_putty/config.py
RegexRule.regex_match_any
def regex_match_any(self, line, codes=None): """Match any regex.""" for selector in self.regex_selectors: for match in selector.regex.finditer(line): if codes and match.lastindex: # Currently the group name must be 'codes' try: ...
python
def regex_match_any(self, line, codes=None): """Match any regex.""" for selector in self.regex_selectors: for match in selector.regex.finditer(line): if codes and match.lastindex: # Currently the group name must be 'codes' try: ...
[ "def", "regex_match_any", "(", "self", ",", "line", ",", "codes", "=", "None", ")", ":", "for", "selector", "in", "self", ".", "regex_selectors", ":", "for", "match", "in", "selector", ".", "regex", ".", "finditer", "(", "line", ")", ":", "if", "codes"...
Match any regex.
[ "Match", "any", "regex", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L164-L183
48,025
jayvdb/flake8-putty
flake8_putty/config.py
RegexRule.match
def match(self, filename, line, codes): """Match rule and set attribute codes.""" if self.regex_match_any(line, codes): if self._vary_codes: self.codes = tuple([codes[-1]]) return True
python
def match(self, filename, line, codes): """Match rule and set attribute codes.""" if self.regex_match_any(line, codes): if self._vary_codes: self.codes = tuple([codes[-1]]) return True
[ "def", "match", "(", "self", ",", "filename", ",", "line", ",", "codes", ")", ":", "if", "self", ".", "regex_match_any", "(", "line", ",", "codes", ")", ":", "if", "self", ".", "_vary_codes", ":", "self", ".", "codes", "=", "tuple", "(", "[", "code...
Match rule and set attribute codes.
[ "Match", "rule", "and", "set", "attribute", "codes", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L185-L190
48,026
jayvdb/flake8-putty
flake8_putty/config.py
Rule.file_match_any
def file_match_any(self, filename): """Match any filename.""" if filename.startswith('.' + os.sep): filename = filename[len(os.sep) + 1:] if os.sep != '/': filename = filename.replace(os.sep, '/') for selector in self.file_selectors: if (selector.patt...
python
def file_match_any(self, filename): """Match any filename.""" if filename.startswith('.' + os.sep): filename = filename[len(os.sep) + 1:] if os.sep != '/': filename = filename.replace(os.sep, '/') for selector in self.file_selectors: if (selector.patt...
[ "def", "file_match_any", "(", "self", ",", "filename", ")", ":", "if", "filename", ".", "startswith", "(", "'.'", "+", "os", ".", "sep", ")", ":", "filename", "=", "filename", "[", "len", "(", "os", ".", "sep", ")", "+", "1", ":", "]", "if", "os"...
Match any filename.
[ "Match", "any", "filename", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L238-L251
48,027
jayvdb/flake8-putty
flake8_putty/config.py
Rule.codes_match_any
def codes_match_any(self, codes): """Match any code.""" for selector in self.code_selectors: if selector.code in codes: return True return False
python
def codes_match_any(self, codes): """Match any code.""" for selector in self.code_selectors: if selector.code in codes: return True return False
[ "def", "codes_match_any", "(", "self", ",", "codes", ")", ":", "for", "selector", "in", "self", ".", "code_selectors", ":", "if", "selector", ".", "code", "in", "codes", ":", "return", "True", "return", "False" ]
Match any code.
[ "Match", "any", "code", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L253-L258
48,028
jayvdb/flake8-putty
flake8_putty/config.py
Rule.match
def match(self, filename, line, codes): """Match rule.""" if ((not self.file_selectors or self.file_match_any(filename)) and (not self.environment_marker_selector or self.environment_marker_evaluate()) and (not self.code_selectors or self.codes_match_any(...
python
def match(self, filename, line, codes): """Match rule.""" if ((not self.file_selectors or self.file_match_any(filename)) and (not self.environment_marker_selector or self.environment_marker_evaluate()) and (not self.code_selectors or self.codes_match_any(...
[ "def", "match", "(", "self", ",", "filename", ",", "line", ",", "codes", ")", ":", "if", "(", "(", "not", "self", ".", "file_selectors", "or", "self", ".", "file_match_any", "(", "filename", ")", ")", "and", "(", "not", "self", ".", "environment_marker...
Match rule.
[ "Match", "rule", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/config.py#L267-L278
48,029
mlavin/django-all-access
allaccess/backends.py
AuthorizedServiceBackend.authenticate
def authenticate(self, provider=None, identifier=None): "Fetch user for a given provider by id." provider_q = Q(provider__name=provider) if isinstance(provider, Provider): provider_q = Q(provider=provider) try: access = AccountAccess.objects.filter( ...
python
def authenticate(self, provider=None, identifier=None): "Fetch user for a given provider by id." provider_q = Q(provider__name=provider) if isinstance(provider, Provider): provider_q = Q(provider=provider) try: access = AccountAccess.objects.filter( ...
[ "def", "authenticate", "(", "self", ",", "provider", "=", "None", ",", "identifier", "=", "None", ")", ":", "provider_q", "=", "Q", "(", "provider__name", "=", "provider", ")", "if", "isinstance", "(", "provider", ",", "Provider", ")", ":", "provider_q", ...
Fetch user for a given provider by id.
[ "Fetch", "user", "for", "a", "given", "provider", "by", "id", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/backends.py#L12-L24
48,030
aiscenblue/flask-blueprint
flask_blueprint/package_extractor.py
PackageExtractor.__extract_modules
def __extract_modules(self, loader, name, is_pkg): """ if module found load module and save all attributes in the module found """ mod = loader.find_module(name).load_module(name) """ find the attribute method on each module """ if hasattr(mod, '__method__'): """ register ...
python
def __extract_modules(self, loader, name, is_pkg): """ if module found load module and save all attributes in the module found """ mod = loader.find_module(name).load_module(name) """ find the attribute method on each module """ if hasattr(mod, '__method__'): """ register ...
[ "def", "__extract_modules", "(", "self", ",", "loader", ",", "name", ",", "is_pkg", ")", ":", "mod", "=", "loader", ".", "find_module", "(", "name", ")", ".", "load_module", "(", "name", ")", "\"\"\" find the attribute method on each module \"\"\"", "if", "hasat...
if module found load module and save all attributes in the module found
[ "if", "module", "found", "load", "module", "and", "save", "all", "attributes", "in", "the", "module", "found" ]
c558d9d5d9630bab53c297ce2c33f4ceb3874724
https://github.com/aiscenblue/flask-blueprint/blob/c558d9d5d9630bab53c297ce2c33f4ceb3874724/flask_blueprint/package_extractor.py#L59-L78
48,031
mlavin/django-all-access
allaccess/views.py
OAuthCallback.get_or_create_user
def get_or_create_user(self, provider, access, info): "Create a shell auth.User." digest = hashlib.sha1(smart_bytes(access)).digest() # Base 64 encode to get below 30 characters # Removed padding characters username = force_text(base64.urlsafe_b64encode(digest)).replace('=', '') ...
python
def get_or_create_user(self, provider, access, info): "Create a shell auth.User." digest = hashlib.sha1(smart_bytes(access)).digest() # Base 64 encode to get below 30 characters # Removed padding characters username = force_text(base64.urlsafe_b64encode(digest)).replace('=', '') ...
[ "def", "get_or_create_user", "(", "self", ",", "provider", ",", "access", ",", "info", ")", ":", "digest", "=", "hashlib", ".", "sha1", "(", "smart_bytes", "(", "access", ")", ")", ".", "digest", "(", ")", "# Base 64 encode to get below 30 characters", "# Remo...
Create a shell auth.User.
[ "Create", "a", "shell", "auth", ".", "User", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/views.py#L123-L135
48,032
mlavin/django-all-access
allaccess/views.py
OAuthCallback.get_user_id
def get_user_id(self, provider, info): "Return unique identifier from the profile info." id_key = self.provider_id or 'id' result = info try: for key in id_key.split('.'): result = result[key] return result except KeyError: retu...
python
def get_user_id(self, provider, info): "Return unique identifier from the profile info." id_key = self.provider_id or 'id' result = info try: for key in id_key.split('.'): result = result[key] return result except KeyError: retu...
[ "def", "get_user_id", "(", "self", ",", "provider", ",", "info", ")", ":", "id_key", "=", "self", ".", "provider_id", "or", "'id'", "result", "=", "info", "try", ":", "for", "key", "in", "id_key", ".", "split", "(", "'.'", ")", ":", "result", "=", ...
Return unique identifier from the profile info.
[ "Return", "unique", "identifier", "from", "the", "profile", "info", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/views.py#L141-L150
48,033
mlavin/django-all-access
allaccess/views.py
OAuthCallback.handle_existing_user
def handle_existing_user(self, provider, user, access, info): "Login user and redirect." login(self.request, user) return redirect(self.get_login_redirect(provider, user, access))
python
def handle_existing_user(self, provider, user, access, info): "Login user and redirect." login(self.request, user) return redirect(self.get_login_redirect(provider, user, access))
[ "def", "handle_existing_user", "(", "self", ",", "provider", ",", "user", ",", "access", ",", "info", ")", ":", "login", "(", "self", ".", "request", ",", "user", ")", "return", "redirect", "(", "self", ".", "get_login_redirect", "(", "provider", ",", "u...
Login user and redirect.
[ "Login", "user", "and", "redirect", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/views.py#L152-L155
48,034
mlavin/django-all-access
allaccess/views.py
OAuthCallback.handle_new_user
def handle_new_user(self, provider, access, info): "Create a shell auth.User and redirect." user = self.get_or_create_user(provider, access, info) access.user = user AccountAccess.objects.filter(pk=access.pk).update(user=user) user = authenticate(provider=access.provider, identif...
python
def handle_new_user(self, provider, access, info): "Create a shell auth.User and redirect." user = self.get_or_create_user(provider, access, info) access.user = user AccountAccess.objects.filter(pk=access.pk).update(user=user) user = authenticate(provider=access.provider, identif...
[ "def", "handle_new_user", "(", "self", ",", "provider", ",", "access", ",", "info", ")", ":", "user", "=", "self", ".", "get_or_create_user", "(", "provider", ",", "access", ",", "info", ")", "access", ".", "user", "=", "user", "AccountAccess", ".", "obj...
Create a shell auth.User and redirect.
[ "Create", "a", "shell", "auth", ".", "User", "and", "redirect", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/views.py#L163-L170
48,035
balloob/aiohue
aiohue/discovery.py
discover_nupnp
async def discover_nupnp(websession): """Discover bridges via NUPNP.""" async with websession.get(URL_NUPNP) as res: return [Bridge(item['internalipaddress'], websession=websession) for item in (await res.json())]
python
async def discover_nupnp(websession): """Discover bridges via NUPNP.""" async with websession.get(URL_NUPNP) as res: return [Bridge(item['internalipaddress'], websession=websession) for item in (await res.json())]
[ "async", "def", "discover_nupnp", "(", "websession", ")", ":", "async", "with", "websession", ".", "get", "(", "URL_NUPNP", ")", "as", "res", ":", "return", "[", "Bridge", "(", "item", "[", "'internalipaddress'", "]", ",", "websession", "=", "websession", ...
Discover bridges via NUPNP.
[ "Discover", "bridges", "via", "NUPNP", "." ]
c0270637a8a6ce3f5684c8559decac79fb0f0192
https://github.com/balloob/aiohue/blob/c0270637a8a6ce3f5684c8559decac79fb0f0192/aiohue/discovery.py#L6-L10
48,036
bitlabstudio/django-account-keeping
account_keeping/utils.py
get_months_of_year
def get_months_of_year(year): """ Returns the number of months that have already passed in the given year. This is useful for calculating averages on the year view. For past years, we should divide by 12, but for the current year, we should divide by the current month. """ current_year = n...
python
def get_months_of_year(year): """ Returns the number of months that have already passed in the given year. This is useful for calculating averages on the year view. For past years, we should divide by 12, but for the current year, we should divide by the current month. """ current_year = n...
[ "def", "get_months_of_year", "(", "year", ")", ":", "current_year", "=", "now", "(", ")", ".", "year", "if", "year", "==", "current_year", ":", "return", "now", "(", ")", ".", "month", "if", "year", ">", "current_year", ":", "return", "1", "if", "year"...
Returns the number of months that have already passed in the given year. This is useful for calculating averages on the year view. For past years, we should divide by 12, but for the current year, we should divide by the current month.
[ "Returns", "the", "number", "of", "months", "that", "have", "already", "passed", "in", "the", "given", "year", "." ]
9f579a5fd912442a2948e2da858a5720de072568
https://github.com/bitlabstudio/django-account-keeping/blob/9f579a5fd912442a2948e2da858a5720de072568/account_keeping/utils.py#L20-L35
48,037
balloob/aiohue
aiohue/lights.py
Light.colorgamut
def colorgamut(self): """The color gamut information of the light.""" try: light_spec = self.controlcapabilities gtup = tuple([XYPoint(*x) for x in light_spec['colorgamut']]) color_gamut = GamutType(*gtup) except KeyError: color_gamut = None ...
python
def colorgamut(self): """The color gamut information of the light.""" try: light_spec = self.controlcapabilities gtup = tuple([XYPoint(*x) for x in light_spec['colorgamut']]) color_gamut = GamutType(*gtup) except KeyError: color_gamut = None ...
[ "def", "colorgamut", "(", "self", ")", ":", "try", ":", "light_spec", "=", "self", ".", "controlcapabilities", "gtup", "=", "tuple", "(", "[", "XYPoint", "(", "*", "x", ")", "for", "x", "in", "light_spec", "[", "'colorgamut'", "]", "]", ")", "color_gam...
The color gamut information of the light.
[ "The", "color", "gamut", "information", "of", "the", "light", "." ]
c0270637a8a6ce3f5684c8559decac79fb0f0192
https://github.com/balloob/aiohue/blob/c0270637a8a6ce3f5684c8559decac79fb0f0192/aiohue/lights.py#L81-L90
48,038
bitlabstudio/django-account-keeping
account_keeping/models.py
TransactionManager.get_totals_by_payee
def get_totals_by_payee(self, account, start_date=None, end_date=None): """ Returns transaction totals grouped by Payee. """ qs = Transaction.objects.filter(account=account, parent__isnull=True) qs = qs.values('payee').annotate(models.Sum('value_gross')) qs = qs.order_by...
python
def get_totals_by_payee(self, account, start_date=None, end_date=None): """ Returns transaction totals grouped by Payee. """ qs = Transaction.objects.filter(account=account, parent__isnull=True) qs = qs.values('payee').annotate(models.Sum('value_gross')) qs = qs.order_by...
[ "def", "get_totals_by_payee", "(", "self", ",", "account", ",", "start_date", "=", "None", ",", "end_date", "=", "None", ")", ":", "qs", "=", "Transaction", ".", "objects", ".", "filter", "(", "account", "=", "account", ",", "parent__isnull", "=", "True", ...
Returns transaction totals grouped by Payee.
[ "Returns", "transaction", "totals", "grouped", "by", "Payee", "." ]
9f579a5fd912442a2948e2da858a5720de072568
https://github.com/bitlabstudio/django-account-keeping/blob/9f579a5fd912442a2948e2da858a5720de072568/account_keeping/models.py#L328-L336
48,039
bitlabstudio/django-account-keeping
account_keeping/models.py
TransactionManager.get_without_invoice
def get_without_invoice(self): """ Returns transactions that don't have an invoice. We filter out transactions that have children, because those transactions never have invoices - their children are the ones that would each have one invoice. """ qs = Transaction...
python
def get_without_invoice(self): """ Returns transactions that don't have an invoice. We filter out transactions that have children, because those transactions never have invoices - their children are the ones that would each have one invoice. """ qs = Transaction...
[ "def", "get_without_invoice", "(", "self", ")", ":", "qs", "=", "Transaction", ".", "objects", ".", "filter", "(", "children__isnull", "=", "True", ",", "invoice__isnull", "=", "True", ")", "return", "qs" ]
Returns transactions that don't have an invoice. We filter out transactions that have children, because those transactions never have invoices - their children are the ones that would each have one invoice.
[ "Returns", "transactions", "that", "don", "t", "have", "an", "invoice", "." ]
9f579a5fd912442a2948e2da858a5720de072568
https://github.com/bitlabstudio/django-account-keeping/blob/9f579a5fd912442a2948e2da858a5720de072568/account_keeping/models.py#L338-L349
48,040
mlavin/django-all-access
allaccess/context_processors.py
_get_enabled
def _get_enabled(): """Wrapped function for filtering enabled providers.""" providers = Provider.objects.all() return [p for p in providers if p.enabled()]
python
def _get_enabled(): """Wrapped function for filtering enabled providers.""" providers = Provider.objects.all() return [p for p in providers if p.enabled()]
[ "def", "_get_enabled", "(", ")", ":", "providers", "=", "Provider", ".", "objects", ".", "all", "(", ")", "return", "[", "p", "for", "p", "in", "providers", "if", "p", ".", "enabled", "(", ")", "]" ]
Wrapped function for filtering enabled providers.
[ "Wrapped", "function", "for", "filtering", "enabled", "providers", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/context_processors.py#L10-L13
48,041
mlavin/django-all-access
allaccess/context_processors.py
available_providers
def available_providers(request): "Adds the list of enabled providers to the context." if APPENGINE: # Note: AppEngine inequality queries are limited to one property. # See https://developers.google.com/appengine/docs/python/datastore/queries#Python_Restrictions_on_queries # Users have a...
python
def available_providers(request): "Adds the list of enabled providers to the context." if APPENGINE: # Note: AppEngine inequality queries are limited to one property. # See https://developers.google.com/appengine/docs/python/datastore/queries#Python_Restrictions_on_queries # Users have a...
[ "def", "available_providers", "(", "request", ")", ":", "if", "APPENGINE", ":", "# Note: AppEngine inequality queries are limited to one property.", "# See https://developers.google.com/appengine/docs/python/datastore/queries#Python_Restrictions_on_queries", "# Users have also noted that the e...
Adds the list of enabled providers to the context.
[ "Adds", "the", "list", "of", "enabled", "providers", "to", "the", "context", "." ]
4b15b6c9dedf8080a7c477e0af1142c609ec5598
https://github.com/mlavin/django-all-access/blob/4b15b6c9dedf8080a7c477e0af1142c609ec5598/allaccess/context_processors.py#L16-L27
48,042
brandon-rhodes/uncommitted
uncommitted/command.py
run
def run(command, **kw): """Run `command`, catch any exception, and return lines of output.""" # Windows low-level subprocess API wants str for current working # directory. if sys.platform == 'win32': _cwd = kw.get('cwd', None) if _cwd is not None: kw['cwd'] = _cwd.decode() ...
python
def run(command, **kw): """Run `command`, catch any exception, and return lines of output.""" # Windows low-level subprocess API wants str for current working # directory. if sys.platform == 'win32': _cwd = kw.get('cwd', None) if _cwd is not None: kw['cwd'] = _cwd.decode() ...
[ "def", "run", "(", "command", ",", "*", "*", "kw", ")", ":", "# Windows low-level subprocess API wants str for current working", "# directory.", "if", "sys", ".", "platform", "==", "'win32'", ":", "_cwd", "=", "kw", ".", "get", "(", "'cwd'", ",", "None", ")", ...
Run `command`, catch any exception, and return lines of output.
[ "Run", "command", "catch", "any", "exception", "and", "return", "lines", "of", "output", "." ]
80ebd95a3735e26bd8b9b7b62ff25e1e749a7472
https://github.com/brandon-rhodes/uncommitted/blob/80ebd95a3735e26bd8b9b7b62ff25e1e749a7472/uncommitted/command.py#L27-L44
48,043
brandon-rhodes/uncommitted
uncommitted/command.py
status_mercurial
def status_mercurial(path, ignore_set, options): """Run hg status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since hg does not support them. """ lines = run(['hg', '--config', 'extensions.color=!', 'st'], cwd=path) subrepo...
python
def status_mercurial(path, ignore_set, options): """Run hg status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since hg does not support them. """ lines = run(['hg', '--config', 'extensions.color=!', 'st'], cwd=path) subrepo...
[ "def", "status_mercurial", "(", "path", ",", "ignore_set", ",", "options", ")", ":", "lines", "=", "run", "(", "[", "'hg'", ",", "'--config'", ",", "'extensions.color=!'", ",", "'st'", "]", ",", "cwd", "=", "path", ")", "subrepos", "=", "(", ")", "retu...
Run hg status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since hg does not support them.
[ "Run", "hg", "status", "." ]
80ebd95a3735e26bd8b9b7b62ff25e1e749a7472
https://github.com/brandon-rhodes/uncommitted/blob/80ebd95a3735e26bd8b9b7b62ff25e1e749a7472/uncommitted/command.py#L96-L105
48,044
brandon-rhodes/uncommitted
uncommitted/command.py
status_git
def status_git(path, ignore_set, options): """Run git status. Returns a 2-element tuple: * Text lines describing the status of the repository. * List of subrepository paths, relative to the repository itself. """ # Check whether current branch is dirty: lines = [l for l in run(('git', 'stat...
python
def status_git(path, ignore_set, options): """Run git status. Returns a 2-element tuple: * Text lines describing the status of the repository. * List of subrepository paths, relative to the repository itself. """ # Check whether current branch is dirty: lines = [l for l in run(('git', 'stat...
[ "def", "status_git", "(", "path", ",", "ignore_set", ",", "options", ")", ":", "# Check whether current branch is dirty:", "lines", "=", "[", "l", "for", "l", "in", "run", "(", "(", "'git'", ",", "'status'", ",", "'-s'", ",", "'-b'", ")", ",", "cwd", "="...
Run git status. Returns a 2-element tuple: * Text lines describing the status of the repository. * List of subrepository paths, relative to the repository itself.
[ "Run", "git", "status", "." ]
80ebd95a3735e26bd8b9b7b62ff25e1e749a7472
https://github.com/brandon-rhodes/uncommitted/blob/80ebd95a3735e26bd8b9b7b62ff25e1e749a7472/uncommitted/command.py#L107-L139
48,045
brandon-rhodes/uncommitted
uncommitted/command.py
status_subversion
def status_subversion(path, ignore_set, options): """Run svn status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since svn does not support them. """ subrepos = () if path in ignore_set: return None, subrepos kee...
python
def status_subversion(path, ignore_set, options): """Run svn status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since svn does not support them. """ subrepos = () if path in ignore_set: return None, subrepos kee...
[ "def", "status_subversion", "(", "path", ",", "ignore_set", ",", "options", ")", ":", "subrepos", "=", "(", ")", "if", "path", "in", "ignore_set", ":", "return", "None", ",", "subrepos", "keepers", "=", "[", "]", "for", "line", "in", "run", "(", "[", ...
Run svn status. Returns a 2-element tuple: * Text lines describing the status of the repository. * Empty sequence of subrepos, since svn does not support them.
[ "Run", "svn", "status", "." ]
80ebd95a3735e26bd8b9b7b62ff25e1e749a7472
https://github.com/brandon-rhodes/uncommitted/blob/80ebd95a3735e26bd8b9b7b62ff25e1e749a7472/uncommitted/command.py#L141-L165
48,046
jayvdb/flake8-putty
flake8_putty/extension.py
get_reporter_state
def get_reporter_state(): """Get pep8 reporter state from stack.""" # Stack # 1. get_reporter_state (i.e. this function) # 2. putty_ignore_code # 3. QueueReport.error or pep8.StandardReport.error for flake8 -j 1 # 4. pep8.Checker.check_ast or check_physical or check_logical # locals conta...
python
def get_reporter_state(): """Get pep8 reporter state from stack.""" # Stack # 1. get_reporter_state (i.e. this function) # 2. putty_ignore_code # 3. QueueReport.error or pep8.StandardReport.error for flake8 -j 1 # 4. pep8.Checker.check_ast or check_physical or check_logical # locals conta...
[ "def", "get_reporter_state", "(", ")", ":", "# Stack", "# 1. get_reporter_state (i.e. this function)", "# 2. putty_ignore_code", "# 3. QueueReport.error or pep8.StandardReport.error for flake8 -j 1", "# 4. pep8.Checker.check_ast or check_physical or check_logical", "# locals contains `tree` (...
Get pep8 reporter state from stack.
[ "Get", "pep8", "reporter", "state", "from", "stack", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/extension.py#L27-L41
48,047
jayvdb/flake8-putty
flake8_putty/extension.py
putty_ignore_code
def putty_ignore_code(options, code): """Implement pep8 'ignore_code' hook.""" reporter, line_number, offset, text, check = get_reporter_state() try: line = reporter.lines[line_number - 1] except IndexError: line = '' options.ignore = options._orig_ignore options.select = option...
python
def putty_ignore_code(options, code): """Implement pep8 'ignore_code' hook.""" reporter, line_number, offset, text, check = get_reporter_state() try: line = reporter.lines[line_number - 1] except IndexError: line = '' options.ignore = options._orig_ignore options.select = option...
[ "def", "putty_ignore_code", "(", "options", ",", "code", ")", ":", "reporter", ",", "line_number", ",", "offset", ",", "text", ",", "check", "=", "get_reporter_state", "(", ")", "try", ":", "line", "=", "reporter", ".", "lines", "[", "line_number", "-", ...
Implement pep8 'ignore_code' hook.
[ "Implement", "pep8", "ignore_code", "hook", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/extension.py#L44-L69
48,048
jayvdb/flake8-putty
flake8_putty/extension.py
PuttyExtension.add_options
def add_options(cls, parser): """Add options for command line and config file.""" parser.add_option( '--putty-select', metavar='errors', default='', help='putty select list', ) parser.add_option( '--putty-ignore', metavar='errors', default='', ...
python
def add_options(cls, parser): """Add options for command line and config file.""" parser.add_option( '--putty-select', metavar='errors', default='', help='putty select list', ) parser.add_option( '--putty-ignore', metavar='errors', default='', ...
[ "def", "add_options", "(", "cls", ",", "parser", ")", ":", "parser", ".", "add_option", "(", "'--putty-select'", ",", "metavar", "=", "'errors'", ",", "default", "=", "''", ",", "help", "=", "'putty select list'", ",", ")", "parser", ".", "add_option", "("...
Add options for command line and config file.
[ "Add", "options", "for", "command", "line", "and", "config", "file", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/extension.py#L110-L134
48,049
jayvdb/flake8-putty
flake8_putty/extension.py
PuttyExtension.parse_options
def parse_options(cls, options): """Parse options and activate `ignore_code` handler.""" if (not options.putty_select and not options.putty_ignore and not options.putty_auto_ignore): return options._orig_select = options.select options._orig_ignore = options....
python
def parse_options(cls, options): """Parse options and activate `ignore_code` handler.""" if (not options.putty_select and not options.putty_ignore and not options.putty_auto_ignore): return options._orig_select = options.select options._orig_ignore = options....
[ "def", "parse_options", "(", "cls", ",", "options", ")", ":", "if", "(", "not", "options", ".", "putty_select", "and", "not", "options", ".", "putty_ignore", "and", "not", "options", ".", "putty_auto_ignore", ")", ":", "return", "options", ".", "_orig_select...
Parse options and activate `ignore_code` handler.
[ "Parse", "options", "and", "activate", "ignore_code", "handler", "." ]
854b2c6daef409974c2f5e9c5acaf0a069b0ff23
https://github.com/jayvdb/flake8-putty/blob/854b2c6daef409974c2f5e9c5acaf0a069b0ff23/flake8_putty/extension.py#L137-L157
48,050
balloob/aiohue
aiohue/bridge.py
_raise_on_error
def _raise_on_error(data): """Check response for error message.""" if isinstance(data, list): data = data[0] if isinstance(data, dict) and 'error' in data: raise_error(data['error'])
python
def _raise_on_error(data): """Check response for error message.""" if isinstance(data, list): data = data[0] if isinstance(data, dict) and 'error' in data: raise_error(data['error'])
[ "def", "_raise_on_error", "(", "data", ")", ":", "if", "isinstance", "(", "data", ",", "list", ")", ":", "data", "=", "data", "[", "0", "]", "if", "isinstance", "(", "data", ",", "dict", ")", "and", "'error'", "in", "data", ":", "raise_error", "(", ...
Check response for error message.
[ "Check", "response", "for", "error", "message", "." ]
c0270637a8a6ce3f5684c8559decac79fb0f0192
https://github.com/balloob/aiohue/blob/c0270637a8a6ce3f5684c8559decac79fb0f0192/aiohue/bridge.py#L72-L78
48,051
balloob/aiohue
aiohue/sensors.py
DaylightSensor.set_config
async def set_config(self, on=None, long=None, lat=None, sunriseoffset=None, sunsetoffset=None): """Change config of a Daylight sensor.""" data = { key: value for key, value in { 'on': on, 'long': long, 'lat': lat, ...
python
async def set_config(self, on=None, long=None, lat=None, sunriseoffset=None, sunsetoffset=None): """Change config of a Daylight sensor.""" data = { key: value for key, value in { 'on': on, 'long': long, 'lat': lat, ...
[ "async", "def", "set_config", "(", "self", ",", "on", "=", "None", ",", "long", "=", "None", ",", "lat", "=", "None", ",", "sunriseoffset", "=", "None", ",", "sunsetoffset", "=", "None", ")", ":", "data", "=", "{", "key", ":", "value", "for", "key"...
Change config of a Daylight sensor.
[ "Change", "config", "of", "a", "Daylight", "sensor", "." ]
c0270637a8a6ce3f5684c8559decac79fb0f0192
https://github.com/balloob/aiohue/blob/c0270637a8a6ce3f5684c8559decac79fb0f0192/aiohue/sensors.py#L164-L178
48,052
balloob/aiohue
aiohue/sensors.py
CLIPLightLevelSensor.set_config
async def set_config(self, on=None, tholddark=None, tholdoffset=None): """Change config of a CLIP LightLevel sensor.""" data = { key: value for key, value in { 'on': on, 'tholddark': tholddark, 'tholdoffset': tholdoffset, }.items() ...
python
async def set_config(self, on=None, tholddark=None, tholdoffset=None): """Change config of a CLIP LightLevel sensor.""" data = { key: value for key, value in { 'on': on, 'tholddark': tholddark, 'tholdoffset': tholdoffset, }.items() ...
[ "async", "def", "set_config", "(", "self", ",", "on", "=", "None", ",", "tholddark", "=", "None", ",", "tholdoffset", "=", "None", ")", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "{", "'on'", ":", "on", ",", "'t...
Change config of a CLIP LightLevel sensor.
[ "Change", "config", "of", "a", "CLIP", "LightLevel", "sensor", "." ]
c0270637a8a6ce3f5684c8559decac79fb0f0192
https://github.com/balloob/aiohue/blob/c0270637a8a6ce3f5684c8559decac79fb0f0192/aiohue/sensors.py#L322-L333
48,053
bitlabstudio/django-account-keeping
account_keeping/freckle_api.py
get_unpaid_invoices_with_transactions
def get_unpaid_invoices_with_transactions(branch=None): """ Returns all invoices that are unpaid on freckle but have transactions. This means, that the invoice is either partially paid and can be left as unpaid in freckle, or the invoice has been fully paid and should be set to paid in freckle as w...
python
def get_unpaid_invoices_with_transactions(branch=None): """ Returns all invoices that are unpaid on freckle but have transactions. This means, that the invoice is either partially paid and can be left as unpaid in freckle, or the invoice has been fully paid and should be set to paid in freckle as w...
[ "def", "get_unpaid_invoices_with_transactions", "(", "branch", "=", "None", ")", ":", "if", "not", "client", ":", "# pragma: nocover", "return", "None", "result", "=", "{", "}", "try", ":", "unpaid_invoices", "=", "client", ".", "fetch_json", "(", "'invoices'", ...
Returns all invoices that are unpaid on freckle but have transactions. This means, that the invoice is either partially paid and can be left as unpaid in freckle, or the invoice has been fully paid and should be set to paid in freckle as well.
[ "Returns", "all", "invoices", "that", "are", "unpaid", "on", "freckle", "but", "have", "transactions", "." ]
9f579a5fd912442a2948e2da858a5720de072568
https://github.com/bitlabstudio/django-account-keeping/blob/9f579a5fd912442a2948e2da858a5720de072568/account_keeping/freckle_api.py#L15-L44
48,054
tkhyn/dirsync
dirsync/syncer.py
Syncer._compare
def _compare(self, dir1, dir2): """ Compare contents of two directories """ left = set() right = set() self._numdirs += 1 excl_patterns = set(self._exclude).union(self._ignore) for cwd, dirs, files in os.walk(dir1): self._numdirs += len(dirs) f...
python
def _compare(self, dir1, dir2): """ Compare contents of two directories """ left = set() right = set() self._numdirs += 1 excl_patterns = set(self._exclude).union(self._ignore) for cwd, dirs, files in os.walk(dir1): self._numdirs += len(dirs) f...
[ "def", "_compare", "(", "self", ",", "dir1", ",", "dir2", ")", ":", "left", "=", "set", "(", ")", "right", "=", "set", "(", ")", "self", ".", "_numdirs", "+=", "1", "excl_patterns", "=", "set", "(", "self", ".", "_exclude", ")", ".", "union", "("...
Compare contents of two directories
[ "Compare", "contents", "of", "two", "directories" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L113-L181
48,055
tkhyn/dirsync
dirsync/syncer.py
Syncer._dowork
def _dowork(self, dir1, dir2, copyfunc=None, updatefunc=None): """ Private attribute for doing work """ if self._verbose: self.log('Source directory: %s:' % dir1) self._dcmp = self._compare(dir1, dir2) # Files & directories only in target directory if self._purge: ...
python
def _dowork(self, dir1, dir2, copyfunc=None, updatefunc=None): """ Private attribute for doing work """ if self._verbose: self.log('Source directory: %s:' % dir1) self._dcmp = self._compare(dir1, dir2) # Files & directories only in target directory if self._purge: ...
[ "def", "_dowork", "(", "self", ",", "dir1", ",", "dir2", ",", "copyfunc", "=", "None", ",", "updatefunc", "=", "None", ")", ":", "if", "self", ".", "_verbose", ":", "self", ".", "log", "(", "'Source directory: %s:'", "%", "dir1", ")", "self", ".", "_...
Private attribute for doing work
[ "Private", "attribute", "for", "doing", "work" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L203-L266
48,056
tkhyn/dirsync
dirsync/syncer.py
Syncer._copy
def _copy(self, filename, dir1, dir2): """ Private function for copying a file """ # NOTE: dir1 is source & dir2 is target if self._copyfiles: rel_path = filename.replace('\\', '/').split('/') rel_dir = '/'.join(rel_path[:-1]) filename = rel_path[-1] ...
python
def _copy(self, filename, dir1, dir2): """ Private function for copying a file """ # NOTE: dir1 is source & dir2 is target if self._copyfiles: rel_path = filename.replace('\\', '/').split('/') rel_dir = '/'.join(rel_path[:-1]) filename = rel_path[-1] ...
[ "def", "_copy", "(", "self", ",", "filename", ",", "dir1", ",", "dir2", ")", ":", "# NOTE: dir1 is source & dir2 is target", "if", "self", ".", "_copyfiles", ":", "rel_path", "=", "filename", ".", "replace", "(", "'\\\\'", ",", "'/'", ")", ".", "split", "(...
Private function for copying a file
[ "Private", "function", "for", "copying", "a", "file" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L269-L351
48,057
tkhyn/dirsync
dirsync/syncer.py
Syncer._update
def _update(self, filename, dir1, dir2): """ Private function for updating a file based on last time stamp of modification """ # NOTE: dir1 is source & dir2 is target if self._updatefiles: file1 = os.path.join(dir1, filename) file2 = os.path.join(dir2, filename)...
python
def _update(self, filename, dir1, dir2): """ Private function for updating a file based on last time stamp of modification """ # NOTE: dir1 is source & dir2 is target if self._updatefiles: file1 = os.path.join(dir1, filename) file2 = os.path.join(dir2, filename)...
[ "def", "_update", "(", "self", ",", "filename", ",", "dir1", ",", "dir2", ")", ":", "# NOTE: dir1 is source & dir2 is target", "if", "self", ".", "_updatefiles", ":", "file1", "=", "os", ".", "path", ".", "join", "(", "dir1", ",", "filename", ")", "file2",...
Private function for updating a file based on last time stamp of modification
[ "Private", "function", "for", "updating", "a", "file", "based", "on", "last", "time", "stamp", "of", "modification" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L364-L445
48,058
tkhyn/dirsync
dirsync/syncer.py
Syncer._dirdiffandcopy
def _dirdiffandcopy(self, dir1, dir2): """ Private function which does directory diff & copy """ self._dowork(dir1, dir2, self._copy)
python
def _dirdiffandcopy(self, dir1, dir2): """ Private function which does directory diff & copy """ self._dowork(dir1, dir2, self._copy)
[ "def", "_dirdiffandcopy", "(", "self", ",", "dir1", ",", "dir2", ")", ":", "self", ".", "_dowork", "(", "dir1", ",", "dir2", ",", "self", ".", "_copy", ")" ]
Private function which does directory diff & copy
[ "Private", "function", "which", "does", "directory", "diff", "&", "copy" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L447-L451
48,059
tkhyn/dirsync
dirsync/syncer.py
Syncer._dirdiffandupdate
def _dirdiffandupdate(self, dir1, dir2): """ Private function which does directory diff & update """ self._dowork(dir1, dir2, None, self._update)
python
def _dirdiffandupdate(self, dir1, dir2): """ Private function which does directory diff & update """ self._dowork(dir1, dir2, None, self._update)
[ "def", "_dirdiffandupdate", "(", "self", ",", "dir1", ",", "dir2", ")", ":", "self", ".", "_dowork", "(", "dir1", ",", "dir2", ",", "None", ",", "self", ".", "_update", ")" ]
Private function which does directory diff & update
[ "Private", "function", "which", "does", "directory", "diff", "&", "update" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L453-L457
48,060
tkhyn/dirsync
dirsync/syncer.py
Syncer._diff
def _diff(self, dir1, dir2): """ Private function which only does directory diff """ self._dcmp = self._compare(dir1, dir2) if self._dcmp.left_only: self.log('Only in %s' % dir1) for x in sorted(self._dcmp.left_only): self.log('>> %s' % x...
python
def _diff(self, dir1, dir2): """ Private function which only does directory diff """ self._dcmp = self._compare(dir1, dir2) if self._dcmp.left_only: self.log('Only in %s' % dir1) for x in sorted(self._dcmp.left_only): self.log('>> %s' % x...
[ "def", "_diff", "(", "self", ",", "dir1", ",", "dir2", ")", ":", "self", ".", "_dcmp", "=", "self", ".", "_compare", "(", "dir1", ",", "dir2", ")", "if", "self", ".", "_dcmp", ".", "left_only", ":", "self", ".", "log", "(", "'Only in %s'", "%", "...
Private function which only does directory diff
[ "Private", "function", "which", "only", "does", "directory", "diff" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L465-L489
48,061
tkhyn/dirsync
dirsync/syncer.py
Syncer.update
def update(self): """ Update will try to update the target directory w.r.t source directory. Only files that are common to both directories will be updated, no new files or directories are created """ self._copyfiles = False self._updatefiles = True self._purge =...
python
def update(self): """ Update will try to update the target directory w.r.t source directory. Only files that are common to both directories will be updated, no new files or directories are created """ self._copyfiles = False self._updatefiles = True self._purge =...
[ "def", "update", "(", "self", ")", ":", "self", ".", "_copyfiles", "=", "False", "self", ".", "_updatefiles", "=", "True", "self", ".", "_purge", "=", "False", "self", ".", "_creatdirs", "=", "False", "if", "self", ".", "_verbose", ":", "self", ".", ...
Update will try to update the target directory w.r.t source directory. Only files that are common to both directories will be updated, no new files or directories are created
[ "Update", "will", "try", "to", "update", "the", "target", "directory", "w", ".", "r", ".", "t", "source", "directory", ".", "Only", "files", "that", "are", "common", "to", "both", "directories", "will", "be", "updated", "no", "new", "files", "or", "direc...
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L509-L523
48,062
tkhyn/dirsync
dirsync/syncer.py
Syncer.diff
def diff(self): """ Only report difference in content between two directories """ self._copyfiles = False self._updatefiles = False self._purge = False self._creatdirs = False self._updatefiles = False self.log('Difference of directory %s from %s...
python
def diff(self): """ Only report difference in content between two directories """ self._copyfiles = False self._updatefiles = False self._purge = False self._creatdirs = False self._updatefiles = False self.log('Difference of directory %s from %s...
[ "def", "diff", "(", "self", ")", ":", "self", ".", "_copyfiles", "=", "False", "self", ".", "_updatefiles", "=", "False", "self", ".", "_purge", "=", "False", "self", ".", "_creatdirs", "=", "False", "self", ".", "_updatefiles", "=", "False", "self", "...
Only report difference in content between two directories
[ "Only", "report", "difference", "in", "content", "between", "two", "directories" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L525-L538
48,063
tkhyn/dirsync
dirsync/syncer.py
Syncer.report
def report(self): """ Print report of work at the end """ # We need only the first 4 significant digits tt = (str(self._endtime - self._starttime))[:4] self.log('\n%s finished in %s seconds.' % (__pkg_name__, tt)) self.log('%d directories parsed, %d files copied' % ...
python
def report(self): """ Print report of work at the end """ # We need only the first 4 significant digits tt = (str(self._endtime - self._starttime))[:4] self.log('\n%s finished in %s seconds.' % (__pkg_name__, tt)) self.log('%d directories parsed, %d files copied' % ...
[ "def", "report", "(", "self", ")", ":", "# We need only the first 4 significant digits", "tt", "=", "(", "str", "(", "self", ".", "_endtime", "-", "self", ".", "_starttime", ")", ")", "[", ":", "4", "]", "self", ".", "log", "(", "'\\n%s finished in %s second...
Print report of work at the end
[ "Print", "report", "of", "work", "at", "the", "end" ]
a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce
https://github.com/tkhyn/dirsync/blob/a461a6c31a4cf521c1b6a8bcfcd8602e6288e8ce/dirsync/syncer.py#L540-L574
48,064
balloob/aiohue
aiohue/groups.py
Group.set_action
async def set_action(self, on=None, bri=None, hue=None, sat=None, xy=None, ct=None, alert=None, effect=None, transitiontime=None, bri_inc=None, sat_inc=None, hue_inc=None, ct_inc=None, xy_inc=None, scene=None): """Change action of a grou...
python
async def set_action(self, on=None, bri=None, hue=None, sat=None, xy=None, ct=None, alert=None, effect=None, transitiontime=None, bri_inc=None, sat_inc=None, hue_inc=None, ct_inc=None, xy_inc=None, scene=None): """Change action of a grou...
[ "async", "def", "set_action", "(", "self", ",", "on", "=", "None", ",", "bri", "=", "None", ",", "hue", "=", "None", ",", "sat", "=", "None", ",", "xy", "=", "None", ",", "ct", "=", "None", ",", "alert", "=", "None", ",", "effect", "=", "None",...
Change action of a group.
[ "Change", "action", "of", "a", "group", "." ]
c0270637a8a6ce3f5684c8559decac79fb0f0192
https://github.com/balloob/aiohue/blob/c0270637a8a6ce3f5684c8559decac79fb0f0192/aiohue/groups.py#L54-L80
48,065
ulule/django-badgify
example/management/commands/create_fixtures.py
Command._pre_tasks
def _pre_tasks(self): """ Pre-tasks handler. """ if self.flushdb: management.call_command('flush', verbosity=0, interactive=False) logger.info('Flushed database')
python
def _pre_tasks(self): """ Pre-tasks handler. """ if self.flushdb: management.call_command('flush', verbosity=0, interactive=False) logger.info('Flushed database')
[ "def", "_pre_tasks", "(", "self", ")", ":", "if", "self", ".", "flushdb", ":", "management", ".", "call_command", "(", "'flush'", ",", "verbosity", "=", "0", ",", "interactive", "=", "False", ")", "logger", ".", "info", "(", "'Flushed database'", ")" ]
Pre-tasks handler.
[ "Pre", "-", "tasks", "handler", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/example/management/commands/create_fixtures.py#L43-L49
48,066
ulule/django-badgify
example/management/commands/create_fixtures.py
Command._create_users
def _create_users(self): """ Creates users. """ rn = RandomNicknames() for name in rn.random_nicks(count=50): username = '%s%d' % (slugify(name), random.randrange(1, 99)) user = User.objects.create_user( username=username, ...
python
def _create_users(self): """ Creates users. """ rn = RandomNicknames() for name in rn.random_nicks(count=50): username = '%s%d' % (slugify(name), random.randrange(1, 99)) user = User.objects.create_user( username=username, ...
[ "def", "_create_users", "(", "self", ")", ":", "rn", "=", "RandomNicknames", "(", ")", "for", "name", "in", "rn", ".", "random_nicks", "(", "count", "=", "50", ")", ":", "username", "=", "'%s%d'", "%", "(", "slugify", "(", "name", ")", ",", "random",...
Creates users.
[ "Creates", "users", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/example/management/commands/create_fixtures.py#L51-L63
48,067
ulule/django-badgify
example/management/commands/create_fixtures.py
Command._create_badges
def _create_badges(self): """ Creates badges. """ rn = RandomNicknames() for name in rn.random_nicks(count=20): slug = slugify(name) badge = Badge.objects.create( name=name, slug=slug, description='Lorem ips...
python
def _create_badges(self): """ Creates badges. """ rn = RandomNicknames() for name in rn.random_nicks(count=20): slug = slugify(name) badge = Badge.objects.create( name=name, slug=slug, description='Lorem ips...
[ "def", "_create_badges", "(", "self", ")", ":", "rn", "=", "RandomNicknames", "(", ")", "for", "name", "in", "rn", ".", "random_nicks", "(", "count", "=", "20", ")", ":", "slug", "=", "slugify", "(", "name", ")", "badge", "=", "Badge", ".", "objects"...
Creates badges.
[ "Creates", "badges", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/example/management/commands/create_fixtures.py#L65-L77
48,068
ulule/django-badgify
example/management/commands/create_fixtures.py
Command._create_awards
def _create_awards(self): """ Creates awards. """ users = User.objects.all() for user in users: everyone_badge = Badge.objects.last() badge = Badge.objects.order_by('?')[0] try: award = Award.objects.create(user=user, badge=bad...
python
def _create_awards(self): """ Creates awards. """ users = User.objects.all() for user in users: everyone_badge = Badge.objects.last() badge = Badge.objects.order_by('?')[0] try: award = Award.objects.create(user=user, badge=bad...
[ "def", "_create_awards", "(", "self", ")", ":", "users", "=", "User", ".", "objects", ".", "all", "(", ")", "for", "user", "in", "users", ":", "everyone_badge", "=", "Badge", ".", "objects", ".", "last", "(", ")", "badge", "=", "Badge", ".", "objects...
Creates awards.
[ "Creates", "awards", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/example/management/commands/create_fixtures.py#L79-L93
48,069
ulule/django-badgify
badgify/utils.py
chunks
def chunks(l, n): """ Yields successive n-sized chunks from l. """ for i in _range(0, len(l), n): yield l[i:i + n]
python
def chunks(l, n): """ Yields successive n-sized chunks from l. """ for i in _range(0, len(l), n): yield l[i:i + n]
[ "def", "chunks", "(", "l", ",", "n", ")", ":", "for", "i", "in", "_range", "(", "0", ",", "len", "(", "l", ")", ",", "n", ")", ":", "yield", "l", "[", "i", ":", "i", "+", "n", "]" ]
Yields successive n-sized chunks from l.
[ "Yields", "successive", "n", "-", "sized", "chunks", "from", "l", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/utils.py#L115-L120
48,070
ulule/django-badgify
badgify/utils.py
sanitize_command_options
def sanitize_command_options(options): """ Sanitizes command options. """ multiples = [ 'badges', 'exclude_badges', ] for option in multiples: if options.get(option): value = options[option] if value: options[option] = [v for v in ...
python
def sanitize_command_options(options): """ Sanitizes command options. """ multiples = [ 'badges', 'exclude_badges', ] for option in multiples: if options.get(option): value = options[option] if value: options[option] = [v for v in ...
[ "def", "sanitize_command_options", "(", "options", ")", ":", "multiples", "=", "[", "'badges'", ",", "'exclude_badges'", ",", "]", "for", "option", "in", "multiples", ":", "if", "options", ".", "get", "(", "option", ")", ":", "value", "=", "options", "[", ...
Sanitizes command options.
[ "Sanitizes", "command", "options", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/utils.py#L133-L148
48,071
ulule/django-badgify
badgify/registry.py
BadgifyRegistry.register
def register(self, recipe): """ Registers a new recipe class. """ if not isinstance(recipe, (list, tuple)): recipe = [recipe, ] for item in recipe: recipe = self.get_recipe_instance_from_class(item) self._registry[recipe.slug] = recipe
python
def register(self, recipe): """ Registers a new recipe class. """ if not isinstance(recipe, (list, tuple)): recipe = [recipe, ] for item in recipe: recipe = self.get_recipe_instance_from_class(item) self._registry[recipe.slug] = recipe
[ "def", "register", "(", "self", ",", "recipe", ")", ":", "if", "not", "isinstance", "(", "recipe", ",", "(", "list", ",", "tuple", ")", ")", ":", "recipe", "=", "[", "recipe", ",", "]", "for", "item", "in", "recipe", ":", "recipe", "=", "self", "...
Registers a new recipe class.
[ "Registers", "a", "new", "recipe", "class", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/registry.py#L35-L45
48,072
ulule/django-badgify
badgify/registry.py
BadgifyRegistry.unregister
def unregister(self, recipe): """ Unregisters a given recipe class. """ recipe = self.get_recipe_instance_from_class(recipe) if recipe.slug in self._registry: del self._registry[recipe.slug]
python
def unregister(self, recipe): """ Unregisters a given recipe class. """ recipe = self.get_recipe_instance_from_class(recipe) if recipe.slug in self._registry: del self._registry[recipe.slug]
[ "def", "unregister", "(", "self", ",", "recipe", ")", ":", "recipe", "=", "self", ".", "get_recipe_instance_from_class", "(", "recipe", ")", "if", "recipe", ".", "slug", "in", "self", ".", "_registry", ":", "del", "self", ".", "_registry", "[", "recipe", ...
Unregisters a given recipe class.
[ "Unregisters", "a", "given", "recipe", "class", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/registry.py#L47-L53
48,073
ulule/django-badgify
badgify/registry.py
BadgifyRegistry.get_recipe_instance
def get_recipe_instance(self, badge): """ Returns the recipe instance for the given badge slug. If badge has not been registered, raises ``exceptions.BadgeNotFound``. """ from .exceptions import BadgeNotFound if badge in self._registry: return self.recipes[bad...
python
def get_recipe_instance(self, badge): """ Returns the recipe instance for the given badge slug. If badge has not been registered, raises ``exceptions.BadgeNotFound``. """ from .exceptions import BadgeNotFound if badge in self._registry: return self.recipes[bad...
[ "def", "get_recipe_instance", "(", "self", ",", "badge", ")", ":", "from", ".", "exceptions", "import", "BadgeNotFound", "if", "badge", "in", "self", ".", "_registry", ":", "return", "self", ".", "recipes", "[", "badge", "]", "raise", "BadgeNotFound", "(", ...
Returns the recipe instance for the given badge slug. If badge has not been registered, raises ``exceptions.BadgeNotFound``.
[ "Returns", "the", "recipe", "instance", "for", "the", "given", "badge", "slug", ".", "If", "badge", "has", "not", "been", "registered", "raises", "exceptions", ".", "BadgeNotFound", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/registry.py#L61-L69
48,074
ulule/django-badgify
badgify/registry.py
BadgifyRegistry.get_recipe_instances
def get_recipe_instances(self, badges=None, excluded=None): """ Returns all recipe instances or just those for the given badges. """ if badges: if not isinstance(badges, (list, tuple)): badges = [badges] if excluded: if not isinstance(excl...
python
def get_recipe_instances(self, badges=None, excluded=None): """ Returns all recipe instances or just those for the given badges. """ if badges: if not isinstance(badges, (list, tuple)): badges = [badges] if excluded: if not isinstance(excl...
[ "def", "get_recipe_instances", "(", "self", ",", "badges", "=", "None", ",", "excluded", "=", "None", ")", ":", "if", "badges", ":", "if", "not", "isinstance", "(", "badges", ",", "(", "list", ",", "tuple", ")", ")", ":", "badges", "=", "[", "badges"...
Returns all recipe instances or just those for the given badges.
[ "Returns", "all", "recipe", "instances", "or", "just", "those", "for", "the", "given", "badges", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/registry.py#L71-L88
48,075
nosegae/NoseGAE
nosegae.py
NoseGAE._init_taskqueue_stub
def _init_taskqueue_stub(self, **stub_kwargs): """Initializes the taskqueue stub using nosegae config magic""" task_args = {} # root_path is required so the stub can find 'queue.yaml' or 'queue.yml' if 'root_path' not in stub_kwargs: for p in self._app_path: #...
python
def _init_taskqueue_stub(self, **stub_kwargs): """Initializes the taskqueue stub using nosegae config magic""" task_args = {} # root_path is required so the stub can find 'queue.yaml' or 'queue.yml' if 'root_path' not in stub_kwargs: for p in self._app_path: #...
[ "def", "_init_taskqueue_stub", "(", "self", ",", "*", "*", "stub_kwargs", ")", ":", "task_args", "=", "{", "}", "# root_path is required so the stub can find 'queue.yaml' or 'queue.yml'", "if", "'root_path'", "not", "in", "stub_kwargs", ":", "for", "p", "in", "self", ...
Initializes the taskqueue stub using nosegae config magic
[ "Initializes", "the", "taskqueue", "stub", "using", "nosegae", "config", "magic" ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/nosegae.py#L192-L205
48,076
nosegae/NoseGAE
nosegae.py
NoseGAE._init_datastore_v3_stub
def _init_datastore_v3_stub(self, **stub_kwargs): """Initializes the datastore stub using nosegae config magic""" task_args = dict(datastore_file=self._data_path) task_args.update(stub_kwargs) self.testbed.init_datastore_v3_stub(**task_args)
python
def _init_datastore_v3_stub(self, **stub_kwargs): """Initializes the datastore stub using nosegae config magic""" task_args = dict(datastore_file=self._data_path) task_args.update(stub_kwargs) self.testbed.init_datastore_v3_stub(**task_args)
[ "def", "_init_datastore_v3_stub", "(", "self", ",", "*", "*", "stub_kwargs", ")", ":", "task_args", "=", "dict", "(", "datastore_file", "=", "self", ".", "_data_path", ")", "task_args", ".", "update", "(", "stub_kwargs", ")", "self", ".", "testbed", ".", "...
Initializes the datastore stub using nosegae config magic
[ "Initializes", "the", "datastore", "stub", "using", "nosegae", "config", "magic" ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/nosegae.py#L207-L211
48,077
nosegae/NoseGAE
nosegae.py
NoseGAE._init_user_stub
def _init_user_stub(self, **stub_kwargs): """Initializes the user stub using nosegae config magic""" # do a little dance to keep the same kwargs for multiple tests in the same class # because the user stub will barf if you pass these items into it # stub = user_service_stub.UserServiceSt...
python
def _init_user_stub(self, **stub_kwargs): """Initializes the user stub using nosegae config magic""" # do a little dance to keep the same kwargs for multiple tests in the same class # because the user stub will barf if you pass these items into it # stub = user_service_stub.UserServiceSt...
[ "def", "_init_user_stub", "(", "self", ",", "*", "*", "stub_kwargs", ")", ":", "# do a little dance to keep the same kwargs for multiple tests in the same class", "# because the user stub will barf if you pass these items into it", "# stub = user_service_stub.UserServiceStub(**stub_kw_args)"...
Initializes the user stub using nosegae config magic
[ "Initializes", "the", "user", "stub", "using", "nosegae", "config", "magic" ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/nosegae.py#L213-L224
48,078
nosegae/NoseGAE
nosegae.py
NoseGAE._init_modules_stub
def _init_modules_stub(self, **_): """Initializes the modules stub based off of your current yaml files Implements solution from http://stackoverflow.com/questions/28166558/invalidmoduleerror-when-using-testbed-to-unit-test-google-app-engine """ from google.appengine.api import ...
python
def _init_modules_stub(self, **_): """Initializes the modules stub based off of your current yaml files Implements solution from http://stackoverflow.com/questions/28166558/invalidmoduleerror-when-using-testbed-to-unit-test-google-app-engine """ from google.appengine.api import ...
[ "def", "_init_modules_stub", "(", "self", ",", "*", "*", "_", ")", ":", "from", "google", ".", "appengine", ".", "api", "import", "request_info", "# edit all_versions per modules & versions thereof needing tests", "all_versions", "=", "{", "}", "# {'default': [1], 'ands...
Initializes the modules stub based off of your current yaml files Implements solution from http://stackoverflow.com/questions/28166558/invalidmoduleerror-when-using-testbed-to-unit-test-google-app-engine
[ "Initializes", "the", "modules", "stub", "based", "off", "of", "your", "current", "yaml", "files" ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/nosegae.py#L226-L249
48,079
nosegae/NoseGAE
nosegae.py
NoseGAE._init_stub
def _init_stub(self, stub_init, **stub_kwargs): """Initializes all other stubs for consistency's sake""" getattr(self.testbed, stub_init, lambda **kwargs: None)(**stub_kwargs)
python
def _init_stub(self, stub_init, **stub_kwargs): """Initializes all other stubs for consistency's sake""" getattr(self.testbed, stub_init, lambda **kwargs: None)(**stub_kwargs)
[ "def", "_init_stub", "(", "self", ",", "stub_init", ",", "*", "*", "stub_kwargs", ")", ":", "getattr", "(", "self", ".", "testbed", ",", "stub_init", ",", "lambda", "*", "*", "kwargs", ":", "None", ")", "(", "*", "*", "stub_kwargs", ")" ]
Initializes all other stubs for consistency's sake
[ "Initializes", "all", "other", "stubs", "for", "consistency", "s", "sake" ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/nosegae.py#L251-L253
48,080
nosegae/NoseGAE
examples/modules_example/printenv.py
html_for_env_var
def html_for_env_var(key): """Returns an HTML snippet for an environment variable. Args: key: A string representing an environment variable name. Returns: String HTML representing the value and variable. """ value = os.getenv(key) return KEY_VALUE_TEMPLATE.format(key, value)
python
def html_for_env_var(key): """Returns an HTML snippet for an environment variable. Args: key: A string representing an environment variable name. Returns: String HTML representing the value and variable. """ value = os.getenv(key) return KEY_VALUE_TEMPLATE.format(key, value)
[ "def", "html_for_env_var", "(", "key", ")", ":", "value", "=", "os", ".", "getenv", "(", "key", ")", "return", "KEY_VALUE_TEMPLATE", ".", "format", "(", "key", ",", "value", ")" ]
Returns an HTML snippet for an environment variable. Args: key: A string representing an environment variable name. Returns: String HTML representing the value and variable.
[ "Returns", "an", "HTML", "snippet", "for", "an", "environment", "variable", "." ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/examples/modules_example/printenv.py#L33-L43
48,081
nosegae/NoseGAE
examples/modules_example/printenv.py
html_for_cgi_argument
def html_for_cgi_argument(argument, form): """Returns an HTML snippet for a CGI argument. Args: argument: A string representing an CGI argument name in a form. form: A CGI FieldStorage object. Returns: String HTML representing the CGI value and variable. """ value = form[ar...
python
def html_for_cgi_argument(argument, form): """Returns an HTML snippet for a CGI argument. Args: argument: A string representing an CGI argument name in a form. form: A CGI FieldStorage object. Returns: String HTML representing the CGI value and variable. """ value = form[ar...
[ "def", "html_for_cgi_argument", "(", "argument", ",", "form", ")", ":", "value", "=", "form", "[", "argument", "]", ".", "value", "if", "argument", "in", "form", "else", "None", "return", "KEY_VALUE_TEMPLATE", ".", "format", "(", "argument", ",", "value", ...
Returns an HTML snippet for a CGI argument. Args: argument: A string representing an CGI argument name in a form. form: A CGI FieldStorage object. Returns: String HTML representing the CGI value and variable.
[ "Returns", "an", "HTML", "snippet", "for", "a", "CGI", "argument", "." ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/examples/modules_example/printenv.py#L46-L57
48,082
nosegae/NoseGAE
examples/modules_example/printenv.py
html_for_modules_method
def html_for_modules_method(method_name, *args, **kwargs): """Returns an HTML snippet for a Modules API method. Args: method_name: A string containing a Modules API method. args: Positional arguments to be passed to the method. kwargs: Keyword arguments to be passed to the method. ...
python
def html_for_modules_method(method_name, *args, **kwargs): """Returns an HTML snippet for a Modules API method. Args: method_name: A string containing a Modules API method. args: Positional arguments to be passed to the method. kwargs: Keyword arguments to be passed to the method. ...
[ "def", "html_for_modules_method", "(", "method_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "method", "=", "getattr", "(", "modules", ",", "method_name", ")", "value", "=", "method", "(", "*", "args", ",", "*", "*", "kwargs", ")", "retur...
Returns an HTML snippet for a Modules API method. Args: method_name: A string containing a Modules API method. args: Positional arguments to be passed to the method. kwargs: Keyword arguments to be passed to the method. Returns: String HTML representing the Modules API method a...
[ "Returns", "an", "HTML", "snippet", "for", "a", "Modules", "API", "method", "." ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/examples/modules_example/printenv.py#L60-L73
48,083
nosegae/NoseGAE
examples/modules_example/printenv.py
MainHandler.get
def get(self): """GET handler that serves environment data.""" environment_variables_output = [html_for_env_var(key) for key in sorted(os.environ)] cgi_arguments_output = [] if os.getenv('CONTENT_TYPE') == 'application/x-www-form-urlencoded': ...
python
def get(self): """GET handler that serves environment data.""" environment_variables_output = [html_for_env_var(key) for key in sorted(os.environ)] cgi_arguments_output = [] if os.getenv('CONTENT_TYPE') == 'application/x-www-form-urlencoded': ...
[ "def", "get", "(", "self", ")", ":", "environment_variables_output", "=", "[", "html_for_env_var", "(", "key", ")", "for", "key", "in", "sorted", "(", "os", ".", "environ", ")", "]", "cgi_arguments_output", "=", "[", "]", "if", "os", ".", "getenv", "(", ...
GET handler that serves environment data.
[ "GET", "handler", "that", "serves", "environment", "data", "." ]
fca9fab22b480bb9721ecaa0967a636107648d92
https://github.com/nosegae/NoseGAE/blob/fca9fab22b480bb9721ecaa0967a636107648d92/examples/modules_example/printenv.py#L78-L117
48,084
ulule/django-badgify
badgify/commands.py
sync_badges
def sync_badges(**kwargs): """ Iterates over registered recipes and creates missing badges. """ update = kwargs.get('update', False) created_badges = [] instances = registry.get_recipe_instances() for instance in instances: reset_queries() badge, created = instance.create_ba...
python
def sync_badges(**kwargs): """ Iterates over registered recipes and creates missing badges. """ update = kwargs.get('update', False) created_badges = [] instances = registry.get_recipe_instances() for instance in instances: reset_queries() badge, created = instance.create_ba...
[ "def", "sync_badges", "(", "*", "*", "kwargs", ")", ":", "update", "=", "kwargs", ".", "get", "(", "'update'", ",", "False", ")", "created_badges", "=", "[", "]", "instances", "=", "registry", ".", "get_recipe_instances", "(", ")", "for", "instance", "in...
Iterates over registered recipes and creates missing badges.
[ "Iterates", "over", "registered", "recipes", "and", "creates", "missing", "badges", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/commands.py#L17-L32
48,085
ulule/django-badgify
badgify/commands.py
sync_awards
def sync_awards(**kwargs): """ Iterates over registered recipes and possibly creates awards. """ badges = kwargs.get('badges') excluded = kwargs.get('exclude_badges') disable_signals = kwargs.get('disable_signals') batch_size = kwargs.get('batch_size', None) db_read = kwargs.get('db_read...
python
def sync_awards(**kwargs): """ Iterates over registered recipes and possibly creates awards. """ badges = kwargs.get('badges') excluded = kwargs.get('exclude_badges') disable_signals = kwargs.get('disable_signals') batch_size = kwargs.get('batch_size', None) db_read = kwargs.get('db_read...
[ "def", "sync_awards", "(", "*", "*", "kwargs", ")", ":", "badges", "=", "kwargs", ".", "get", "(", "'badges'", ")", "excluded", "=", "kwargs", ".", "get", "(", "'exclude_badges'", ")", "disable_signals", "=", "kwargs", ".", "get", "(", "'disable_signals'",...
Iterates over registered recipes and possibly creates awards.
[ "Iterates", "over", "registered", "recipes", "and", "possibly", "creates", "awards", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/commands.py#L58-L82
48,086
ulule/django-badgify
badgify/commands.py
show_stats
def show_stats(**kwargs): """ Shows badges stats. """ db_read = kwargs.get('db_read', DEFAULT_DB_ALIAS) badges = (Badge.objects.using(db_read) .all() .annotate(u_count=Count('users')) .order_by('u_count')) for bad...
python
def show_stats(**kwargs): """ Shows badges stats. """ db_read = kwargs.get('db_read', DEFAULT_DB_ALIAS) badges = (Badge.objects.using(db_read) .all() .annotate(u_count=Count('users')) .order_by('u_count')) for bad...
[ "def", "show_stats", "(", "*", "*", "kwargs", ")", ":", "db_read", "=", "kwargs", ".", "get", "(", "'db_read'", ",", "DEFAULT_DB_ALIAS", ")", "badges", "=", "(", "Badge", ".", "objects", ".", "using", "(", "db_read", ")", ".", "all", "(", ")", ".", ...
Shows badges stats.
[ "Shows", "badges", "stats", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/commands.py#L85-L100
48,087
ulule/django-badgify
badgify/recipe.py
BaseRecipe.get_current_user_ids
def get_current_user_ids(self, db_read=None): """ Returns current user ids and the count. """ db_read = db_read or self.db_read return self.user_ids.using(db_read)
python
def get_current_user_ids(self, db_read=None): """ Returns current user ids and the count. """ db_read = db_read or self.db_read return self.user_ids.using(db_read)
[ "def", "get_current_user_ids", "(", "self", ",", "db_read", "=", "None", ")", ":", "db_read", "=", "db_read", "or", "self", ".", "db_read", "return", "self", ".", "user_ids", ".", "using", "(", "db_read", ")" ]
Returns current user ids and the count.
[ "Returns", "current", "user", "ids", "and", "the", "count", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/recipe.py#L174-L180
48,088
ulule/django-badgify
badgify/management/commands/badgify_sync.py
Command.add_arguments
def add_arguments(self, parser): """ Command arguments. """ super(Command, self).add_arguments(parser) parser.add_argument('--badges', action='store', dest='badges', type=str) parser.add...
python
def add_arguments(self, parser): """ Command arguments. """ super(Command, self).add_arguments(parser) parser.add_argument('--badges', action='store', dest='badges', type=str) parser.add...
[ "def", "add_arguments", "(", "self", ",", "parser", ")", ":", "super", "(", "Command", ",", "self", ")", ".", "add_arguments", "(", "parser", ")", "parser", ".", "add_argument", "(", "'--badges'", ",", "action", "=", "'store'", ",", "dest", "=", "'badges...
Command arguments.
[ "Command", "arguments", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/management/commands/badgify_sync.py#L14-L46
48,089
sunlightlabs/name-cleaver
name_cleaver/cleaver.py
OrganizationNameCleaver.compare
def compare(cls, match, subject): """ Accepts two OrganizationName objects and returns an arbitrary, numerical score based upon how well the names match. """ if match.expand().lower() == subject.expand().lower(): return 4 elif match.kernel().lower() ==...
python
def compare(cls, match, subject): """ Accepts two OrganizationName objects and returns an arbitrary, numerical score based upon how well the names match. """ if match.expand().lower() == subject.expand().lower(): return 4 elif match.kernel().lower() ==...
[ "def", "compare", "(", "cls", ",", "match", ",", "subject", ")", ":", "if", "match", ".", "expand", "(", ")", ".", "lower", "(", ")", "==", "subject", ".", "expand", "(", ")", ".", "lower", "(", ")", ":", "return", "4", "elif", "match", ".", "k...
Accepts two OrganizationName objects and returns an arbitrary, numerical score based upon how well the names match.
[ "Accepts", "two", "OrganizationName", "objects", "and", "returns", "an", "arbitrary", "numerical", "score", "based", "upon", "how", "well", "the", "names", "match", "." ]
48d3838fd9521235bd1586017fa4b31236ffc88e
https://github.com/sunlightlabs/name-cleaver/blob/48d3838fd9521235bd1586017fa4b31236ffc88e/name_cleaver/cleaver.py#L265-L280
48,090
ulule/django-badgify
badgify/templatetags/badgify_tags.py
badgify_badges
def badgify_badges(**kwargs): """ Returns all badges or only awarded badges for the given user. """ User = get_user_model() user = kwargs.get('user', None) username = kwargs.get('username', None) if username: try: user = User.objects.get(username=username) except ...
python
def badgify_badges(**kwargs): """ Returns all badges or only awarded badges for the given user. """ User = get_user_model() user = kwargs.get('user', None) username = kwargs.get('username', None) if username: try: user = User.objects.get(username=username) except ...
[ "def", "badgify_badges", "(", "*", "*", "kwargs", ")", ":", "User", "=", "get_user_model", "(", ")", "user", "=", "kwargs", ".", "get", "(", "'user'", ",", "None", ")", "username", "=", "kwargs", ".", "get", "(", "'username'", ",", "None", ")", "if",...
Returns all badges or only awarded badges for the given user.
[ "Returns", "all", "badges", "or", "only", "awarded", "badges", "for", "the", "given", "user", "." ]
1bf233ffeb6293ee659454de7b3794682128b6ca
https://github.com/ulule/django-badgify/blob/1bf233ffeb6293ee659454de7b3794682128b6ca/badgify/templatetags/badgify_tags.py#L13-L29
48,091
sunlightlabs/name-cleaver
name_cleaver/names.py
OrganizationName.without_extra_phrases
def without_extra_phrases(self): """Removes parenthethical and dashed phrases""" # the last parenthesis is optional, because sometimes they are truncated name = re.sub(r'\s*\([^)]*\)?\s*$', '', self.name) name = re.sub(r'(?i)\s* formerly.*$', '', name) name = re.sub(r'(?i)\s*and ...
python
def without_extra_phrases(self): """Removes parenthethical and dashed phrases""" # the last parenthesis is optional, because sometimes they are truncated name = re.sub(r'\s*\([^)]*\)?\s*$', '', self.name) name = re.sub(r'(?i)\s* formerly.*$', '', name) name = re.sub(r'(?i)\s*and ...
[ "def", "without_extra_phrases", "(", "self", ")", ":", "# the last parenthesis is optional, because sometimes they are truncated", "name", "=", "re", ".", "sub", "(", "r'\\s*\\([^)]*\\)?\\s*$'", ",", "''", ",", "self", ".", "name", ")", "name", "=", "re", ".", "sub"...
Removes parenthethical and dashed phrases
[ "Removes", "parenthethical", "and", "dashed", "phrases" ]
48d3838fd9521235bd1586017fa4b31236ffc88e
https://github.com/sunlightlabs/name-cleaver/blob/48d3838fd9521235bd1586017fa4b31236ffc88e/name_cleaver/names.py#L98-L120
48,092
sunlightlabs/name-cleaver
name_cleaver/names.py
OrganizationName.kernel
def kernel(self): """ The 'kernel' is an attempt to get at just the most pithy words in the name """ stop_words = [ y.lower() for y in self.abbreviations.values() + self.filler_words ] kernel = ' '.join([ x for x in self.expand().split() if x.lower() not in stop_words ]) # this is a hac...
python
def kernel(self): """ The 'kernel' is an attempt to get at just the most pithy words in the name """ stop_words = [ y.lower() for y in self.abbreviations.values() + self.filler_words ] kernel = ' '.join([ x for x in self.expand().split() if x.lower() not in stop_words ]) # this is a hac...
[ "def", "kernel", "(", "self", ")", ":", "stop_words", "=", "[", "y", ".", "lower", "(", ")", "for", "y", "in", "self", ".", "abbreviations", ".", "values", "(", ")", "+", "self", ".", "filler_words", "]", "kernel", "=", "' '", ".", "join", "(", "...
The 'kernel' is an attempt to get at just the most pithy words in the name
[ "The", "kernel", "is", "an", "attempt", "to", "get", "at", "just", "the", "most", "pithy", "words", "in", "the", "name" ]
48d3838fd9521235bd1586017fa4b31236ffc88e
https://github.com/sunlightlabs/name-cleaver/blob/48d3838fd9521235bd1586017fa4b31236ffc88e/name_cleaver/names.py#L129-L138
48,093
sunlightlabs/name-cleaver
name_cleaver/names.py
PersonName.detect_and_fix_two_part_surname
def detect_and_fix_two_part_surname(self, args): """ This detects common family name prefixes and joins them to the last name, so names like "De Kuyper" don't end up with "De" as a middle name. """ i = 0 while i < len(args) - 1: if args[i].lower() in self.fami...
python
def detect_and_fix_two_part_surname(self, args): """ This detects common family name prefixes and joins them to the last name, so names like "De Kuyper" don't end up with "De" as a middle name. """ i = 0 while i < len(args) - 1: if args[i].lower() in self.fami...
[ "def", "detect_and_fix_two_part_surname", "(", "self", ",", "args", ")", ":", "i", "=", "0", "while", "i", "<", "len", "(", "args", ")", "-", "1", ":", "if", "args", "[", "i", "]", ".", "lower", "(", ")", "in", "self", ".", "family_name_prefixes", ...
This detects common family name prefixes and joins them to the last name, so names like "De Kuyper" don't end up with "De" as a middle name.
[ "This", "detects", "common", "family", "name", "prefixes", "and", "joins", "them", "to", "the", "last", "name", "so", "names", "like", "De", "Kuyper", "don", "t", "end", "up", "with", "De", "as", "a", "middle", "name", "." ]
48d3838fd9521235bd1586017fa4b31236ffc88e
https://github.com/sunlightlabs/name-cleaver/blob/48d3838fd9521235bd1586017fa4b31236ffc88e/name_cleaver/names.py#L256-L268
48,094
sunlightlabs/name-cleaver
name_cleaver/names.py
PersonName.case_name_parts
def case_name_parts(self): """ Convert all the parts of the name to the proper case... carefully! """ if not self.is_mixed_case(): self.honorific = self.honorific.title() if self.honorific else None self.nick = self.nick.title() if self.nick else None ...
python
def case_name_parts(self): """ Convert all the parts of the name to the proper case... carefully! """ if not self.is_mixed_case(): self.honorific = self.honorific.title() if self.honorific else None self.nick = self.nick.title() if self.nick else None ...
[ "def", "case_name_parts", "(", "self", ")", ":", "if", "not", "self", ".", "is_mixed_case", "(", ")", ":", "self", ".", "honorific", "=", "self", ".", "honorific", ".", "title", "(", ")", "if", "self", ".", "honorific", "else", "None", "self", ".", "...
Convert all the parts of the name to the proper case... carefully!
[ "Convert", "all", "the", "parts", "of", "the", "name", "to", "the", "proper", "case", "...", "carefully!" ]
48d3838fd9521235bd1586017fa4b31236ffc88e
https://github.com/sunlightlabs/name-cleaver/blob/48d3838fd9521235bd1586017fa4b31236ffc88e/name_cleaver/names.py#L286-L311
48,095
ungarj/s2reader
s2reader/cli/inspect.py
main
def main(args=None): """Print metadata as JSON strings.""" args = sys.argv[1:] parser = argparse.ArgumentParser() parser.add_argument("safe_file", type=str, nargs='+') parser.add_argument("--granules", action="store_true") parsed = parser.parse_args(args) pp = pprint.PrettyPrinter() for...
python
def main(args=None): """Print metadata as JSON strings.""" args = sys.argv[1:] parser = argparse.ArgumentParser() parser.add_argument("safe_file", type=str, nargs='+') parser.add_argument("--granules", action="store_true") parsed = parser.parse_args(args) pp = pprint.PrettyPrinter() for...
[ "def", "main", "(", "args", "=", "None", ")", ":", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"safe_file\"", ",", "type", "=", "str", ",", "...
Print metadata as JSON strings.
[ "Print", "metadata", "as", "JSON", "strings", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/cli/inspect.py#L10-L54
48,096
ungarj/s2reader
s2reader/s2reader.py
open
def open(safe_file): """Return a SentinelDataSet object.""" if os.path.isdir(safe_file) or os.path.isfile(safe_file): return SentinelDataSet(safe_file) else: raise IOError("file not found: %s" % safe_file)
python
def open(safe_file): """Return a SentinelDataSet object.""" if os.path.isdir(safe_file) or os.path.isfile(safe_file): return SentinelDataSet(safe_file) else: raise IOError("file not found: %s" % safe_file)
[ "def", "open", "(", "safe_file", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "safe_file", ")", "or", "os", ".", "path", ".", "isfile", "(", "safe_file", ")", ":", "return", "SentinelDataSet", "(", "safe_file", ")", "else", ":", "raise", "IO...
Return a SentinelDataSet object.
[ "Return", "a", "SentinelDataSet", "object", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L25-L30
48,097
ungarj/s2reader
s2reader/s2reader.py
_granule_identifier_to_xml_name
def _granule_identifier_to_xml_name(granule_identifier): """ Very ugly way to convert the granule identifier. e.g. From Granule Identifier: S2A_OPER_MSI_L1C_TL_SGS__20150817T131818_A000792_T28QBG_N01.03 To Granule Metadata XML name: S2A_OPER_MTD_L1C_TL_SGS__20150817T131818_A000792_T...
python
def _granule_identifier_to_xml_name(granule_identifier): """ Very ugly way to convert the granule identifier. e.g. From Granule Identifier: S2A_OPER_MSI_L1C_TL_SGS__20150817T131818_A000792_T28QBG_N01.03 To Granule Metadata XML name: S2A_OPER_MTD_L1C_TL_SGS__20150817T131818_A000792_T...
[ "def", "_granule_identifier_to_xml_name", "(", "granule_identifier", ")", ":", "# Replace \"MSI\" with \"MTD\".", "changed_item_type", "=", "re", ".", "sub", "(", "\"_MSI_\"", ",", "\"_MTD_\"", ",", "granule_identifier", ")", "# Split string up by underscores.", "split_by_und...
Very ugly way to convert the granule identifier. e.g. From Granule Identifier: S2A_OPER_MSI_L1C_TL_SGS__20150817T131818_A000792_T28QBG_N01.03 To Granule Metadata XML name: S2A_OPER_MTD_L1C_TL_SGS__20150817T131818_A000792_T28QBG.xml
[ "Very", "ugly", "way", "to", "convert", "the", "granule", "identifier", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L553-L577
48,098
ungarj/s2reader
s2reader/s2reader.py
_polygon_from_coords
def _polygon_from_coords(coords, fix_geom=False, swap=True, dims=2): """ Return Shapely Polygon from coordinates. - coords: list of alterating latitude / longitude coordinates - fix_geom: automatically fix geometry """ assert len(coords) % dims == 0 number_of_points = len(coords)/dims c...
python
def _polygon_from_coords(coords, fix_geom=False, swap=True, dims=2): """ Return Shapely Polygon from coordinates. - coords: list of alterating latitude / longitude coordinates - fix_geom: automatically fix geometry """ assert len(coords) % dims == 0 number_of_points = len(coords)/dims c...
[ "def", "_polygon_from_coords", "(", "coords", ",", "fix_geom", "=", "False", ",", "swap", "=", "True", ",", "dims", "=", "2", ")", ":", "assert", "len", "(", "coords", ")", "%", "dims", "==", "0", "number_of_points", "=", "len", "(", "coords", ")", "...
Return Shapely Polygon from coordinates. - coords: list of alterating latitude / longitude coordinates - fix_geom: automatically fix geometry
[ "Return", "Shapely", "Polygon", "from", "coordinates", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L580-L603
48,099
ungarj/s2reader
s2reader/s2reader.py
SentinelDataSet.product_metadata_path
def product_metadata_path(self): """Return path to product metadata XML file.""" data_object_section = self._manifest_safe.find("dataObjectSection") for data_object in data_object_section: # Find product metadata XML. if data_object.attrib.get("ID") == "S2_Level-1C_Produc...
python
def product_metadata_path(self): """Return path to product metadata XML file.""" data_object_section = self._manifest_safe.find("dataObjectSection") for data_object in data_object_section: # Find product metadata XML. if data_object.attrib.get("ID") == "S2_Level-1C_Produc...
[ "def", "product_metadata_path", "(", "self", ")", ":", "data_object_section", "=", "self", ".", "_manifest_safe", ".", "find", "(", "\"dataObjectSection\"", ")", "for", "data_object", "in", "data_object_section", ":", "# Find product metadata XML.", "if", "data_object",...
Return path to product metadata XML file.
[ "Return", "path", "to", "product", "metadata", "XML", "file", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L96-L116