repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
QuantEcon/QuantEcon.py
quantecon/lss.py
LinearStateSpace.simulate
def simulate(self, ts_length=100, random_state=None): r""" Simulate a time series of length ts_length, first drawing .. math:: x_0 \sim N(\mu_0, \Sigma_0) Parameters ---------- ts_length : scalar(int), optional(default=100) The length of the sim...
python
def simulate(self, ts_length=100, random_state=None): r""" Simulate a time series of length ts_length, first drawing .. math:: x_0 \sim N(\mu_0, \Sigma_0) Parameters ---------- ts_length : scalar(int), optional(default=100) The length of the sim...
[ "def", "simulate", "(", "self", ",", "ts_length", "=", "100", ",", "random_state", "=", "None", ")", ":", "random_state", "=", "check_random_state", "(", "random_state", ")", "x0", "=", "multivariate_normal", "(", "self", ".", "mu_0", ".", "flatten", "(", ...
r""" Simulate a time series of length ts_length, first drawing .. math:: x_0 \sim N(\mu_0, \Sigma_0) Parameters ---------- ts_length : scalar(int), optional(default=100) The length of the simulation random_state : int or np.random.RandomState, o...
[ "r", "Simulate", "a", "time", "series", "of", "length", "ts_length", "first", "drawing" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lss.py#L160-L200
train
r Simulate a time series of length ts_length using the linear model.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/lss.py
LinearStateSpace.replicate
def replicate(self, T=10, num_reps=100, random_state=None): r""" Simulate num_reps observations of :math:`x_T` and :math:`y_T` given :math:`x_0 \sim N(\mu_0, \Sigma_0)`. Parameters ---------- T : scalar(int), optional(default=10) The period that we want to re...
python
def replicate(self, T=10, num_reps=100, random_state=None): r""" Simulate num_reps observations of :math:`x_T` and :math:`y_T` given :math:`x_0 \sim N(\mu_0, \Sigma_0)`. Parameters ---------- T : scalar(int), optional(default=10) The period that we want to re...
[ "def", "replicate", "(", "self", ",", "T", "=", "10", ",", "num_reps", "=", "100", ",", "random_state", "=", "None", ")", ":", "random_state", "=", "check_random_state", "(", "random_state", ")", "x", "=", "np", ".", "empty", "(", "(", "self", ".", "...
r""" Simulate num_reps observations of :math:`x_T` and :math:`y_T` given :math:`x_0 \sim N(\mu_0, \Sigma_0)`. Parameters ---------- T : scalar(int), optional(default=10) The period that we want to replicate values for num_reps : scalar(int), optional(default=...
[ "r", "Simulate", "num_reps", "observations", "of", ":", "math", ":", "x_T", "and", ":", "math", ":", "y_T", "given", ":", "math", ":", "x_0", "\\", "sim", "N", "(", "\\", "mu_0", "\\", "Sigma_0", ")", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lss.py#L202-L242
train
r Simulate num_reps observations of x_T and y_T and return the x y array.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/lss.py
LinearStateSpace.moment_sequence
def moment_sequence(self): r""" Create a generator to calculate the population mean and variance-convariance matrix for both :math:`x_t` and :math:`y_t` starting at the initial condition (self.mu_0, self.Sigma_0). Each iteration produces a 4-tuple of items (mu_x, mu_y, Sigma_x, ...
python
def moment_sequence(self): r""" Create a generator to calculate the population mean and variance-convariance matrix for both :math:`x_t` and :math:`y_t` starting at the initial condition (self.mu_0, self.Sigma_0). Each iteration produces a 4-tuple of items (mu_x, mu_y, Sigma_x, ...
[ "def", "moment_sequence", "(", "self", ")", ":", "# == Simplify names == #", "A", ",", "C", ",", "G", ",", "H", "=", "self", ".", "A", ",", "self", ".", "C", ",", "self", ".", "G", ",", "self", ".", "H", "# == Initial moments == #", "mu_x", ",", "Sig...
r""" Create a generator to calculate the population mean and variance-convariance matrix for both :math:`x_t` and :math:`y_t` starting at the initial condition (self.mu_0, self.Sigma_0). Each iteration produces a 4-tuple of items (mu_x, mu_y, Sigma_x, Sigma_y) for the next period...
[ "r", "Create", "a", "generator", "to", "calculate", "the", "population", "mean", "and", "variance", "-", "convariance", "matrix", "for", "both", ":", "math", ":", "x_t", "and", ":", "math", ":", "y_t", "starting", "at", "the", "initial", "condition", "(", ...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lss.py#L244-L282
train
r Generate a sequence of moments and variance - variance matrices for the current species.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/lss.py
LinearStateSpace.stationary_distributions
def stationary_distributions(self, max_iter=200, tol=1e-5): r""" Compute the moments of the stationary distributions of :math:`x_t` and :math:`y_t` if possible. Computation is by iteration, starting from the initial conditions self.mu_0 and self.Sigma_0 Parameters -----...
python
def stationary_distributions(self, max_iter=200, tol=1e-5): r""" Compute the moments of the stationary distributions of :math:`x_t` and :math:`y_t` if possible. Computation is by iteration, starting from the initial conditions self.mu_0 and self.Sigma_0 Parameters -----...
[ "def", "stationary_distributions", "(", "self", ",", "max_iter", "=", "200", ",", "tol", "=", "1e-5", ")", ":", "# == Initialize iteration == #", "m", "=", "self", ".", "moment_sequence", "(", ")", "mu_x", ",", "mu_y", ",", "Sigma_x", ",", "Sigma_y", "=", ...
r""" Compute the moments of the stationary distributions of :math:`x_t` and :math:`y_t` if possible. Computation is by iteration, starting from the initial conditions self.mu_0 and self.Sigma_0 Parameters ---------- max_iter : scalar(int), optional(default=200) ...
[ "r", "Compute", "the", "moments", "of", "the", "stationary", "distributions", "of", ":", "math", ":", "x_t", "and", ":", "math", ":", "y_t", "if", "possible", ".", "Computation", "is", "by", "iteration", "starting", "from", "the", "initial", "conditions", ...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lss.py#L284-L336
train
r Compute the moments of the stationary distributions of the current state of the modules.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/lss.py
LinearStateSpace.impulse_response
def impulse_response(self, j=5): r""" Pulls off the imuplse response coefficients to a shock in :math:`w_{t}` for :math:`x` and :math:`y` Important to note: We are uninterested in the shocks to v for this method * :math:`x` coefficients are :math:`C, AC, A^2 C...` ...
python
def impulse_response(self, j=5): r""" Pulls off the imuplse response coefficients to a shock in :math:`w_{t}` for :math:`x` and :math:`y` Important to note: We are uninterested in the shocks to v for this method * :math:`x` coefficients are :math:`C, AC, A^2 C...` ...
[ "def", "impulse_response", "(", "self", ",", "j", "=", "5", ")", ":", "# Pull out matrices", "A", ",", "C", ",", "G", ",", "H", "=", "self", ".", "A", ",", "self", ".", "C", ",", "self", ".", "G", ",", "self", ".", "H", "Apower", "=", "np", "...
r""" Pulls off the imuplse response coefficients to a shock in :math:`w_{t}` for :math:`x` and :math:`y` Important to note: We are uninterested in the shocks to v for this method * :math:`x` coefficients are :math:`C, AC, A^2 C...` * :math:`y` coefficients are :math:`GC...
[ "r", "Pulls", "off", "the", "imuplse", "response", "coefficients", "to", "a", "shock", "in", ":", "math", ":", "w_", "{", "t", "}", "for", ":", "math", ":", "x", "and", ":", "math", ":", "y" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lss.py#L372-L408
train
r Returns the coefficients x and y coefficients for the imuplse response of the current shock.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/util/array.py
searchsorted
def searchsorted(a, v): """ Custom version of np.searchsorted. Return the largest index `i` such that `a[i-1] <= v < a[i]` (for `i = 0`, `v < a[0]`); if `v[n-1] <= v`, return `n`, where `n = len(a)`. Parameters ---------- a : ndarray(float, ndim=1) Input array. Must be sorted in asc...
python
def searchsorted(a, v): """ Custom version of np.searchsorted. Return the largest index `i` such that `a[i-1] <= v < a[i]` (for `i = 0`, `v < a[0]`); if `v[n-1] <= v`, return `n`, where `n = len(a)`. Parameters ---------- a : ndarray(float, ndim=1) Input array. Must be sorted in asc...
[ "def", "searchsorted", "(", "a", ",", "v", ")", ":", "lo", "=", "-", "1", "hi", "=", "len", "(", "a", ")", "while", "(", "lo", "<", "hi", "-", "1", ")", ":", "m", "=", "(", "lo", "+", "hi", ")", "//", "2", "if", "v", "<", "a", "[", "m...
Custom version of np.searchsorted. Return the largest index `i` such that `a[i-1] <= v < a[i]` (for `i = 0`, `v < a[0]`); if `v[n-1] <= v`, return `n`, where `n = len(a)`. Parameters ---------- a : ndarray(float, ndim=1) Input array. Must be sorted in ascending order. v : scalar(float)...
[ "Custom", "version", "of", "np", ".", "searchsorted", ".", "Return", "the", "largest", "index", "i", "such", "that", "a", "[", "i", "-", "1", "]", "<", "=", "v", "<", "a", "[", "i", "]", "(", "for", "i", "=", "0", "v", "<", "a", "[", "0", "...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/util/array.py#L18-L62
train
Custom version of np. searchsorted.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/scalar_maximization.py
brent_max
def brent_max(func, a, b, args=(), xtol=1e-5, maxiter=500): """ Uses a jitted version of the maximization routine from SciPy's fminbound. The algorithm is identical except that it's been switched to maximization rather than minimization, and the tests for convergence have been stripped out to allow ...
python
def brent_max(func, a, b, args=(), xtol=1e-5, maxiter=500): """ Uses a jitted version of the maximization routine from SciPy's fminbound. The algorithm is identical except that it's been switched to maximization rather than minimization, and the tests for convergence have been stripped out to allow ...
[ "def", "brent_max", "(", "func", ",", "a", ",", "b", ",", "args", "=", "(", ")", ",", "xtol", "=", "1e-5", ",", "maxiter", "=", "500", ")", ":", "if", "not", "np", ".", "isfinite", "(", "a", ")", ":", "raise", "ValueError", "(", "\"a must be fini...
Uses a jitted version of the maximization routine from SciPy's fminbound. The algorithm is identical except that it's been switched to maximization rather than minimization, and the tests for convergence have been stripped out to allow for jit compilation. Note that the input function `func` must be ji...
[ "Uses", "a", "jitted", "version", "of", "the", "maximization", "routine", "from", "SciPy", "s", "fminbound", ".", "The", "algorithm", "is", "identical", "except", "that", "it", "s", "been", "switched", "to", "maximization", "rather", "than", "minimization", "a...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/scalar_maximization.py#L5-L152
train
Uses a jitted version of the maximization routine from SciPy s fminbound method to perform the maximum function call.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/distributions.py
BetaBinomial.mean
def mean(self): "mean" n, a, b = self.n, self.a, self.b return n * a / (a + b)
python
def mean(self): "mean" n, a, b = self.n, self.a, self.b return n * a / (a + b)
[ "def", "mean", "(", "self", ")", ":", "n", ",", "a", ",", "b", "=", "self", ".", "n", ",", "self", ".", "a", ",", "self", ".", "b", "return", "n", "*", "a", "/", "(", "a", "+", "b", ")" ]
mean
[ "mean" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/distributions.py#L38-L41
train
get the mean value of the record set
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/distributions.py
BetaBinomial.var
def var(self): "Variance" n, a, b = self.n, self.a, self.b top = n*a*b * (a + b + n) btm = (a+b)**2.0 * (a+b+1.0) return top / btm
python
def var(self): "Variance" n, a, b = self.n, self.a, self.b top = n*a*b * (a + b + n) btm = (a+b)**2.0 * (a+b+1.0) return top / btm
[ "def", "var", "(", "self", ")", ":", "n", ",", "a", ",", "b", "=", "self", ".", "n", ",", "self", ".", "a", ",", "self", ".", "b", "top", "=", "n", "*", "a", "*", "b", "*", "(", "a", "+", "b", "+", "n", ")", "btm", "=", "(", "a", "+...
Variance
[ "Variance" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/distributions.py#L49-L54
train
Variance of the current set of resources.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/distributions.py
BetaBinomial.skew
def skew(self): "skewness" n, a, b = self.n, self.a, self.b t1 = (a+b+2*n) * (b - a) / (a+b+2) t2 = sqrt((1+a+b) / (n*a*b * (n+a+b))) return t1 * t2
python
def skew(self): "skewness" n, a, b = self.n, self.a, self.b t1 = (a+b+2*n) * (b - a) / (a+b+2) t2 = sqrt((1+a+b) / (n*a*b * (n+a+b))) return t1 * t2
[ "def", "skew", "(", "self", ")", ":", "n", ",", "a", ",", "b", "=", "self", ".", "n", ",", "self", ".", "a", ",", "self", ".", "b", "t1", "=", "(", "a", "+", "b", "+", "2", "*", "n", ")", "*", "(", "b", "-", "a", ")", "/", "(", "a",...
skewness
[ "skewness" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/distributions.py#L57-L62
train
skewness of the current set of entries
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/distributions.py
BetaBinomial.pdf
def pdf(self): r""" Generate the vector of probabilities for the Beta-binomial (n, a, b) distribution. The Beta-binomial distribution takes the form .. math:: p(k \,|\, n, a, b) = {n \choose k} \frac{B(k + a, n - k + b)}{B(a, b)}, \qquad k = ...
python
def pdf(self): r""" Generate the vector of probabilities for the Beta-binomial (n, a, b) distribution. The Beta-binomial distribution takes the form .. math:: p(k \,|\, n, a, b) = {n \choose k} \frac{B(k + a, n - k + b)}{B(a, b)}, \qquad k = ...
[ "def", "pdf", "(", "self", ")", ":", "n", ",", "a", ",", "b", "=", "self", ".", "n", ",", "self", ".", "a", ",", "self", ".", "b", "k", "=", "np", ".", "arange", "(", "n", "+", "1", ")", "probs", "=", "binom", "(", "n", ",", "k", ")", ...
r""" Generate the vector of probabilities for the Beta-binomial (n, a, b) distribution. The Beta-binomial distribution takes the form .. math:: p(k \,|\, n, a, b) = {n \choose k} \frac{B(k + a, n - k + b)}{B(a, b)}, \qquad k = 0, \ldots, n, ...
[ "r", "Generate", "the", "vector", "of", "probabilities", "for", "the", "Beta", "-", "binomial", "(", "n", "a", "b", ")", "distribution", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/distributions.py#L64-L96
train
r Returns the probability of the beta - binomial distribution.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
_equilibrium_payoffs_abreu_sannikov
def _equilibrium_payoffs_abreu_sannikov(rpg, tol=1e-12, max_iter=500, u_init=np.zeros(2)): """ Using 'abreu_sannikov' algorithm to compute the set of payoff pairs of all pure-strategy subgame-perfect equilibria with public randomization for any repeated two-player...
python
def _equilibrium_payoffs_abreu_sannikov(rpg, tol=1e-12, max_iter=500, u_init=np.zeros(2)): """ Using 'abreu_sannikov' algorithm to compute the set of payoff pairs of all pure-strategy subgame-perfect equilibria with public randomization for any repeated two-player...
[ "def", "_equilibrium_payoffs_abreu_sannikov", "(", "rpg", ",", "tol", "=", "1e-12", ",", "max_iter", "=", "500", ",", "u_init", "=", "np", ".", "zeros", "(", "2", ")", ")", ":", "sg", ",", "delta", "=", "rpg", ".", "sg", ",", "rpg", ".", "delta", "...
Using 'abreu_sannikov' algorithm to compute the set of payoff pairs of all pure-strategy subgame-perfect equilibria with public randomization for any repeated two-player games with perfect monitoring and discounting, following Abreu and Sannikov (2014). Parameters ---------- rpg : RepeatedGame ...
[ "Using", "abreu_sannikov", "algorithm", "to", "compute", "the", "set", "of", "payoff", "pairs", "of", "all", "pure", "-", "strategy", "subgame", "-", "perfect", "equilibria", "with", "public", "randomization", "for", "any", "repeated", "two", "-", "player", "g...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L85-L175
train
This function computes the set of payoff pairs for all pure - strategy subgame - perfect equilibria with public randomization and public randomization of the two - player repeated game with perfect monitoring and public randomization of the two - player repeated game with public randomization.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
_best_dev_gains
def _best_dev_gains(rpg): """ Calculate the normalized payoff gains from deviating from the current action to the best response for each player. Parameters ---------- rpg : RepeatedGame Two player repeated game. Returns ------- best_dev_gains : tuple(ndarray(float, ndim=2))...
python
def _best_dev_gains(rpg): """ Calculate the normalized payoff gains from deviating from the current action to the best response for each player. Parameters ---------- rpg : RepeatedGame Two player repeated game. Returns ------- best_dev_gains : tuple(ndarray(float, ndim=2))...
[ "def", "_best_dev_gains", "(", "rpg", ")", ":", "sg", ",", "delta", "=", "rpg", ".", "sg", ",", "rpg", ".", "delta", "best_dev_gains", "=", "(", "(", "1", "-", "delta", ")", "/", "delta", "*", "(", "np", ".", "max", "(", "sg", ".", "payoff_arrays...
Calculate the normalized payoff gains from deviating from the current action to the best response for each player. Parameters ---------- rpg : RepeatedGame Two player repeated game. Returns ------- best_dev_gains : tuple(ndarray(float, ndim=2)) The normalized best deviation...
[ "Calculate", "the", "normalized", "payoff", "gains", "from", "deviating", "from", "the", "current", "action", "to", "the", "best", "response", "for", "each", "player", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L178-L202
train
Calculate the normalized payoff gains from deviating from the current action to the best response for each player.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
_R
def _R(delta, nums_actions, payoff_arrays, best_dev_gains, points, vertices, equations, u, IC, action_profile_payoff, extended_payoff, new_pts, W_new, tol=1e-10): """ Updating the payoff convex hull by iterating all action pairs. Using the R operator proposed by Abreu and Sannikov 2014. P...
python
def _R(delta, nums_actions, payoff_arrays, best_dev_gains, points, vertices, equations, u, IC, action_profile_payoff, extended_payoff, new_pts, W_new, tol=1e-10): """ Updating the payoff convex hull by iterating all action pairs. Using the R operator proposed by Abreu and Sannikov 2014. P...
[ "def", "_R", "(", "delta", ",", "nums_actions", ",", "payoff_arrays", ",", "best_dev_gains", ",", "points", ",", "vertices", ",", "equations", ",", "u", ",", "IC", ",", "action_profile_payoff", ",", "extended_payoff", ",", "new_pts", ",", "W_new", ",", "tol"...
Updating the payoff convex hull by iterating all action pairs. Using the R operator proposed by Abreu and Sannikov 2014. Parameters ---------- delta : scalar(float) The common discount rate at which all players discount the future. nums_actions : tuple(int) Tuple of...
[ "Updating", "the", "payoff", "convex", "hull", "by", "iterating", "all", "action", "pairs", ".", "Using", "the", "R", "operator", "proposed", "by", "Abreu", "and", "Sannikov", "2014", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L206-L302
train
This function is used to update the payoff convex hull by iterating all action pairs and updating the payoff convex hull.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
_find_C
def _find_C(C, points, vertices, equations, extended_payoff, IC, tol): """ Find all the intersection points between the current convex hull and the two IC constraints. It is done by iterating simplex counterclockwise. Parameters ---------- C : ndarray(float, ndim=2) The 4 by 2 array...
python
def _find_C(C, points, vertices, equations, extended_payoff, IC, tol): """ Find all the intersection points between the current convex hull and the two IC constraints. It is done by iterating simplex counterclockwise. Parameters ---------- C : ndarray(float, ndim=2) The 4 by 2 array...
[ "def", "_find_C", "(", "C", ",", "points", ",", "vertices", ",", "equations", ",", "extended_payoff", ",", "IC", ",", "tol", ")", ":", "n", "=", "0", "weights", "=", "np", ".", "empty", "(", "2", ")", "# vertices is ordered counterclockwise", "for", "i",...
Find all the intersection points between the current convex hull and the two IC constraints. It is done by iterating simplex counterclockwise. Parameters ---------- C : ndarray(float, ndim=2) The 4 by 2 array for storing the generated potential extreme points of one action profile. ...
[ "Find", "all", "the", "intersection", "points", "between", "the", "current", "convex", "hull", "and", "the", "two", "IC", "constraints", ".", "It", "is", "done", "by", "iterating", "simplex", "counterclockwise", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L306-L366
train
This function finds all the intersection points between the current convex hull and the two IC constraints.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
_intersect
def _intersect(C, n, weights, IC, pt0, pt1, tol): """ Find the intersection points of a half-closed simplex (pt0, pt1] and IC constraints. Parameters ---------- C : ndarray(float, ndim=2) The 4 by 2 array for storing the generated points of one action profile. One action profile...
python
def _intersect(C, n, weights, IC, pt0, pt1, tol): """ Find the intersection points of a half-closed simplex (pt0, pt1] and IC constraints. Parameters ---------- C : ndarray(float, ndim=2) The 4 by 2 array for storing the generated points of one action profile. One action profile...
[ "def", "_intersect", "(", "C", ",", "n", ",", "weights", ",", "IC", ",", "pt0", ",", "pt1", ",", "tol", ")", ":", "for", "i", "in", "range", "(", "2", ")", ":", "if", "(", "abs", "(", "pt0", "[", "i", "]", "-", "pt1", "[", "i", "]", ")", ...
Find the intersection points of a half-closed simplex (pt0, pt1] and IC constraints. Parameters ---------- C : ndarray(float, ndim=2) The 4 by 2 array for storing the generated points of one action profile. One action profile can only generate at most 4 points. n : scalar(i...
[ "Find", "the", "intersection", "points", "of", "a", "half", "-", "closed", "simplex", "(", "pt0", "pt1", "]", "and", "IC", "constraints", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L370-L431
train
This function finds the intersection points of two simplex and IC and returns the intersection points of the two simplex and IC.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
_update_u
def _update_u(u, W): """ Update the threat points if it not feasible in the new W, by the minimum of new feasible payoffs. Parameters ---------- u : ndarray(float, ndim=1) The threat points. W : ndarray(float, ndim=1) The points that construct the feasible payoff convex hul...
python
def _update_u(u, W): """ Update the threat points if it not feasible in the new W, by the minimum of new feasible payoffs. Parameters ---------- u : ndarray(float, ndim=1) The threat points. W : ndarray(float, ndim=1) The points that construct the feasible payoff convex hul...
[ "def", "_update_u", "(", "u", ",", "W", ")", ":", "for", "i", "in", "range", "(", "2", ")", ":", "W_min", "=", "W", "[", ":", ",", "i", "]", ".", "min", "(", ")", "if", "u", "[", "i", "]", "<", "W_min", ":", "u", "[", "i", "]", "=", "...
Update the threat points if it not feasible in the new W, by the minimum of new feasible payoffs. Parameters ---------- u : ndarray(float, ndim=1) The threat points. W : ndarray(float, ndim=1) The points that construct the feasible payoff convex hull. Returns ------- u...
[ "Update", "the", "threat", "points", "if", "it", "not", "feasible", "in", "the", "new", "W", "by", "the", "minimum", "of", "new", "feasible", "payoffs", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L435-L458
train
Update the threat points u by the minimum of feasible payoffs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/repeated_game.py
RepeatedGame.equilibrium_payoffs
def equilibrium_payoffs(self, method=None, options=None): """ Compute the set of payoff pairs of all pure-strategy subgame-perfect equilibria with public randomization for any repeated two-player games with perfect monitoring and discounting. Parameters ---------- ...
python
def equilibrium_payoffs(self, method=None, options=None): """ Compute the set of payoff pairs of all pure-strategy subgame-perfect equilibria with public randomization for any repeated two-player games with perfect monitoring and discounting. Parameters ---------- ...
[ "def", "equilibrium_payoffs", "(", "self", ",", "method", "=", "None", ",", "options", "=", "None", ")", ":", "if", "method", "is", "None", ":", "method", "=", "'abreu_sannikov'", "if", "options", "is", "None", ":", "options", "=", "{", "}", "if", "met...
Compute the set of payoff pairs of all pure-strategy subgame-perfect equilibria with public randomization for any repeated two-player games with perfect monitoring and discounting. Parameters ---------- method : str, optional The method for solving the equilibrium pa...
[ "Compute", "the", "set", "of", "payoff", "pairs", "of", "all", "pure", "-", "strategy", "subgame", "-", "perfect", "equilibria", "with", "public", "randomization", "for", "any", "repeated", "two", "-", "player", "games", "with", "perfect", "monitoring", "and",...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/repeated_game.py#L43-L82
train
Compute the set of payoff pairs of all pure - strategy subgame - perfect and public randomization for any repeated two - player games with perfect monitoring and discounting.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/random.py
random_game
def random_game(nums_actions, random_state=None): """ Return a random NormalFormGame instance where the payoffs are drawn independently from the uniform distribution on [0, 1). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. ran...
python
def random_game(nums_actions, random_state=None): """ Return a random NormalFormGame instance where the payoffs are drawn independently from the uniform distribution on [0, 1). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. ran...
[ "def", "random_game", "(", "nums_actions", ",", "random_state", "=", "None", ")", ":", "N", "=", "len", "(", "nums_actions", ")", "if", "N", "==", "0", ":", "raise", "ValueError", "(", "'nums_actions must be non-empty'", ")", "random_state", "=", "check_random...
Return a random NormalFormGame instance where the payoffs are drawn independently from the uniform distribution on [0, 1). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional Ran...
[ "Return", "a", "random", "NormalFormGame", "instance", "where", "the", "payoffs", "are", "drawn", "independently", "from", "the", "uniform", "distribution", "on", "[", "0", "1", ")", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/random.py#L13-L44
train
Returns a random NormalFormGame instance where the payoffs are drawn independently from the uniform distribution on [ 0 1 ).
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/random.py
covariance_game
def covariance_game(nums_actions, rho, random_state=None): """ Return a random NormalFormGame instance where the payoff profiles are drawn independently from the standard multi-normal with the covariance of any pair of payoffs equal to `rho`, as studied in [1]_. Parameters ---------- nu...
python
def covariance_game(nums_actions, rho, random_state=None): """ Return a random NormalFormGame instance where the payoff profiles are drawn independently from the standard multi-normal with the covariance of any pair of payoffs equal to `rho`, as studied in [1]_. Parameters ---------- nu...
[ "def", "covariance_game", "(", "nums_actions", ",", "rho", ",", "random_state", "=", "None", ")", ":", "N", "=", "len", "(", "nums_actions", ")", "if", "N", "<=", "1", ":", "raise", "ValueError", "(", "'length of nums_actions must be at least 2'", ")", "if", ...
Return a random NormalFormGame instance where the payoff profiles are drawn independently from the standard multi-normal with the covariance of any pair of payoffs equal to `rho`, as studied in [1]_. Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one fo...
[ "Return", "a", "random", "NormalFormGame", "instance", "where", "the", "payoff", "profiles", "are", "drawn", "independently", "from", "the", "standard", "multi", "-", "normal", "with", "the", "covariance", "of", "any", "pair", "of", "payoffs", "equal", "to", "...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/random.py#L47-L96
train
Returns a random NormalFormGame instance where the payoff profiles are drawn independently from the standard multi - normal with the covariance of any pair of payoffs equal to rho.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/random.py
random_pure_actions
def random_pure_actions(nums_actions, random_state=None): """ Return a tuple of random pure actions (integers). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional Random see...
python
def random_pure_actions(nums_actions, random_state=None): """ Return a tuple of random pure actions (integers). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional Random see...
[ "def", "random_pure_actions", "(", "nums_actions", ",", "random_state", "=", "None", ")", ":", "random_state", "=", "check_random_state", "(", "random_state", ")", "action_profile", "=", "tuple", "(", "[", "random_state", ".", "randint", "(", "num_actions", ")", ...
Return a tuple of random pure actions (integers). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional Random seed (integer) or np.random.RandomState instance to set the initi...
[ "Return", "a", "tuple", "of", "random", "pure", "actions", "(", "integers", ")", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/random.py#L99-L124
train
Returns a tuple of random pure actions ( integers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/game_theory/random.py
random_mixed_actions
def random_mixed_actions(nums_actions, random_state=None): """ Return a tuple of random mixed actions (vectors of floats). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional ...
python
def random_mixed_actions(nums_actions, random_state=None): """ Return a tuple of random mixed actions (vectors of floats). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional ...
[ "def", "random_mixed_actions", "(", "nums_actions", ",", "random_state", "=", "None", ")", ":", "random_state", "=", "check_random_state", "(", "random_state", ")", "action_profile", "=", "tuple", "(", "[", "probvec", "(", "1", ",", "num_actions", ",", "random_s...
Return a tuple of random mixed actions (vectors of floats). Parameters ---------- nums_actions : tuple(int) Tuple of the numbers of actions, one for each player. random_state : int or np.random.RandomState, optional Random seed (integer) or np.random.RandomState instance to set ...
[ "Return", "a", "tuple", "of", "random", "mixed", "actions", "(", "vectors", "of", "floats", ")", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/game_theory/random.py#L127-L153
train
Returns a tuple of random mixed actions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/util/notebooks.py
fetch_nb_dependencies
def fetch_nb_dependencies(files, repo=REPO, raw=RAW, branch=BRANCH, folder=FOLDER, overwrite=False, verbose=True): """ Retrieve raw files from QuantEcon.notebooks or other Github repo Parameters ---------- file_list list or dict A list of files to specify a collection of filen...
python
def fetch_nb_dependencies(files, repo=REPO, raw=RAW, branch=BRANCH, folder=FOLDER, overwrite=False, verbose=True): """ Retrieve raw files from QuantEcon.notebooks or other Github repo Parameters ---------- file_list list or dict A list of files to specify a collection of filen...
[ "def", "fetch_nb_dependencies", "(", "files", ",", "repo", "=", "REPO", ",", "raw", "=", "RAW", ",", "branch", "=", "BRANCH", ",", "folder", "=", "FOLDER", ",", "overwrite", "=", "False", ",", "verbose", "=", "True", ")", ":", "import", "requests", "#-...
Retrieve raw files from QuantEcon.notebooks or other Github repo Parameters ---------- file_list list or dict A list of files to specify a collection of filenames A dict of dir : list(files) to specify a directory repo str, optional(default=REPO) raw ...
[ "Retrieve", "raw", "files", "from", "QuantEcon", ".", "notebooks", "or", "other", "Github", "repo", "Parameters", "----------", "file_list", "list", "or", "dict", "A", "list", "of", "files", "to", "specify", "a", "collection", "of", "filenames", "A", "dict", ...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/util/notebooks.py#L32-L106
train
This function fetches raw files from QuantEcon. notebooks or other Github repository and returns a list of files in the specified branch.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/lqnash.py
nnash
def nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2, beta=1.0, tol=1e-8, max_iter=1000, random_state=None): r""" Compute the limit of a Nash linear quadratic dynamic game. In this problem, player i minimizes .. math:: \sum_{t=0}^{\infty} \left\{ x_t' r_i x_...
python
def nnash(A, B1, B2, R1, R2, Q1, Q2, S1, S2, W1, W2, M1, M2, beta=1.0, tol=1e-8, max_iter=1000, random_state=None): r""" Compute the limit of a Nash linear quadratic dynamic game. In this problem, player i minimizes .. math:: \sum_{t=0}^{\infty} \left\{ x_t' r_i x_...
[ "def", "nnash", "(", "A", ",", "B1", ",", "B2", ",", "R1", ",", "R2", ",", "Q1", ",", "Q2", ",", "S1", ",", "S2", ",", "W1", ",", "W2", ",", "M1", ",", "M2", ",", "beta", "=", "1.0", ",", "tol", "=", "1e-8", ",", "max_iter", "=", "1000", ...
r""" Compute the limit of a Nash linear quadratic dynamic game. In this problem, player i minimizes .. math:: \sum_{t=0}^{\infty} \left\{ x_t' r_i x_t + 2 x_t' w_i u_{it} +u_{it}' q_i u_{it} + u_{jt}' s_i u_{jt} + 2 u_{jt}' m_i u_{it} \right\} ...
[ "r", "Compute", "the", "limit", "of", "a", "Nash", "linear", "quadratic", "dynamic", "game", ".", "In", "this", "problem", "player", "i", "minimizes" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/lqnash.py#L7-L154
train
r Nash linear game.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/root_finding.py
_results
def _results(r): r"""Select from a tuple of(root, funccalls, iterations, flag)""" x, funcalls, iterations, flag = r return results(x, funcalls, iterations, flag == 0)
python
def _results(r): r"""Select from a tuple of(root, funccalls, iterations, flag)""" x, funcalls, iterations, flag = r return results(x, funcalls, iterations, flag == 0)
[ "def", "_results", "(", "r", ")", ":", "x", ",", "funcalls", ",", "iterations", ",", "flag", "=", "r", "return", "results", "(", "x", ",", "funcalls", ",", "iterations", ",", "flag", "==", "0", ")" ]
r"""Select from a tuple of(root, funccalls, iterations, flag)
[ "r", "Select", "from", "a", "tuple", "of", "(", "root", "funccalls", "iterations", "flag", ")" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/root_finding.py#L18-L21
train
r Select from a tuple of root funccalls iterations and flag
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/root_finding.py
newton
def newton(func, x0, fprime, args=(), tol=1.48e-8, maxiter=50, disp=True): """ Find a zero from the Newton-Raphson method using the jitted version of Scipy's newton for scalars. Note that this does not provide an alternative method such as secant. Thus, it is important that `fprime` can be pr...
python
def newton(func, x0, fprime, args=(), tol=1.48e-8, maxiter=50, disp=True): """ Find a zero from the Newton-Raphson method using the jitted version of Scipy's newton for scalars. Note that this does not provide an alternative method such as secant. Thus, it is important that `fprime` can be pr...
[ "def", "newton", "(", "func", ",", "x0", ",", "fprime", ",", "args", "=", "(", ")", ",", "tol", "=", "1.48e-8", ",", "maxiter", "=", "50", ",", "disp", "=", "True", ")", ":", "if", "tol", "<=", "0", ":", "raise", "ValueError", "(", "\"tol is too ...
Find a zero from the Newton-Raphson method using the jitted version of Scipy's newton for scalars. Note that this does not provide an alternative method such as secant. Thus, it is important that `fprime` can be provided. Note that `func` and `fprime` must be jitted via Numba. They are recommended to b...
[ "Find", "a", "zero", "from", "the", "Newton", "-", "Raphson", "method", "using", "the", "jitted", "version", "of", "Scipy", "s", "newton", "for", "scalars", ".", "Note", "that", "this", "does", "not", "provide", "an", "alternative", "method", "such", "as",...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/root_finding.py#L25-L107
train
This function is used to find a zero from the Newton - Raphson method using the jitted version of the Scala algorithm.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/root_finding.py
newton_secant
def newton_secant(func, x0, args=(), tol=1.48e-8, maxiter=50, disp=True): """ Find a zero from the secant method using the jitted version of Scipy's secant method. Note that `func` must be jitted via Numba. Parameters ---------- func : callable and jitted The func...
python
def newton_secant(func, x0, args=(), tol=1.48e-8, maxiter=50, disp=True): """ Find a zero from the secant method using the jitted version of Scipy's secant method. Note that `func` must be jitted via Numba. Parameters ---------- func : callable and jitted The func...
[ "def", "newton_secant", "(", "func", ",", "x0", ",", "args", "=", "(", ")", ",", "tol", "=", "1.48e-8", ",", "maxiter", "=", "50", ",", "disp", "=", "True", ")", ":", "if", "tol", "<=", "0", ":", "raise", "ValueError", "(", "\"tol is too small <= 0\"...
Find a zero from the secant method using the jitted version of Scipy's secant method. Note that `func` must be jitted via Numba. Parameters ---------- func : callable and jitted The function whose zero is wanted. It must be a function of a single variable of the form f(x,a,b,c...),...
[ "Find", "a", "zero", "from", "the", "secant", "method", "using", "the", "jitted", "version", "of", "Scipy", "s", "secant", "method", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/root_finding.py#L197-L274
train
This function returns a newton version of the current state of the newton s secant method.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/root_finding.py
_bisect_interval
def _bisect_interval(a, b, fa, fb): """Conditional checks for intervals in methods involving bisection""" if fa*fb > 0: raise ValueError("f(a) and f(b) must have different signs") root = 0.0 status = _ECONVERR # Root found at either end of [a,b] if fa == 0: root = a stat...
python
def _bisect_interval(a, b, fa, fb): """Conditional checks for intervals in methods involving bisection""" if fa*fb > 0: raise ValueError("f(a) and f(b) must have different signs") root = 0.0 status = _ECONVERR # Root found at either end of [a,b] if fa == 0: root = a stat...
[ "def", "_bisect_interval", "(", "a", ",", "b", ",", "fa", ",", "fb", ")", ":", "if", "fa", "*", "fb", ">", "0", ":", "raise", "ValueError", "(", "\"f(a) and f(b) must have different signs\"", ")", "root", "=", "0.0", "status", "=", "_ECONVERR", "# Root fou...
Conditional checks for intervals in methods involving bisection
[ "Conditional", "checks", "for", "intervals", "in", "methods", "involving", "bisection" ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/root_finding.py#L278-L293
train
Conditional checks for intervals in methods involving bisection
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/root_finding.py
bisect
def bisect(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, disp=True): """ Find root of a function within an interval adapted from Scipy's bisect. Basic bisection routine to find a zero of the function `f` between the arguments `a` and `b`. `f(a)` and `f(b)` cannot have the same sig...
python
def bisect(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, disp=True): """ Find root of a function within an interval adapted from Scipy's bisect. Basic bisection routine to find a zero of the function `f` between the arguments `a` and `b`. `f(a)` and `f(b)` cannot have the same sig...
[ "def", "bisect", "(", "f", ",", "a", ",", "b", ",", "args", "=", "(", ")", ",", "xtol", "=", "_xtol", ",", "rtol", "=", "_rtol", ",", "maxiter", "=", "_iter", ",", "disp", "=", "True", ")", ":", "if", "xtol", "<=", "0", ":", "raise", "ValueEr...
Find root of a function within an interval adapted from Scipy's bisect. Basic bisection routine to find a zero of the function `f` between the arguments `a` and `b`. `f(a)` and `f(b)` cannot have the same signs. `f` must be jitted via numba. Parameters ---------- f : jitted and callable ...
[ "Find", "root", "of", "a", "function", "within", "an", "interval", "adapted", "from", "Scipy", "s", "bisect", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/root_finding.py#L297-L374
train
This is a simple bisect algorithm that uses a function f to find a root of a function within a bracketing interval.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/optimize/root_finding.py
brentq
def brentq(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, disp=True): """ Find a root of a function in a bracketing interval using Brent's method adapted from Scipy's brentq. Uses the classic Brent's method to find a zero of the function `f` on the sign changing interval [a , b...
python
def brentq(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, disp=True): """ Find a root of a function in a bracketing interval using Brent's method adapted from Scipy's brentq. Uses the classic Brent's method to find a zero of the function `f` on the sign changing interval [a , b...
[ "def", "brentq", "(", "f", ",", "a", ",", "b", ",", "args", "=", "(", ")", ",", "xtol", "=", "_xtol", ",", "rtol", "=", "_rtol", ",", "maxiter", "=", "_iter", ",", "disp", "=", "True", ")", ":", "if", "xtol", "<=", "0", ":", "raise", "ValueEr...
Find a root of a function in a bracketing interval using Brent's method adapted from Scipy's brentq. Uses the classic Brent's method to find a zero of the function `f` on the sign changing interval [a , b]. `f` must be jitted via numba. Parameters ---------- f : jitted and callable ...
[ "Find", "a", "root", "of", "a", "function", "in", "a", "bracketing", "interval", "using", "Brent", "s", "method", "adapted", "from", "Scipy", "s", "brentq", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/optimize/root_finding.py#L378-L497
train
This function returns a root of a function in a bracketing interval using the classic Brent s method.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/compute_fp.py
compute_fixed_point
def compute_fixed_point(T, v, error_tol=1e-3, max_iter=50, verbose=2, print_skip=5, method='iteration', *args, **kwargs): r""" Computes and returns an approximate fixed point of the function `T`. The default method `'iteration'` simply iterates the function given an initial cond...
python
def compute_fixed_point(T, v, error_tol=1e-3, max_iter=50, verbose=2, print_skip=5, method='iteration', *args, **kwargs): r""" Computes and returns an approximate fixed point of the function `T`. The default method `'iteration'` simply iterates the function given an initial cond...
[ "def", "compute_fixed_point", "(", "T", ",", "v", ",", "error_tol", "=", "1e-3", ",", "max_iter", "=", "50", ",", "verbose", "=", "2", ",", "print_skip", "=", "5", ",", "method", "=", "'iteration'", ",", "*", "args", ",", "*", "*", "kwargs", ")", "...
r""" Computes and returns an approximate fixed point of the function `T`. The default method `'iteration'` simply iterates the function given an initial condition `v` and returns :math:`T^k v` when the condition :math:`\lVert T^k v - T^{k-1} v\rVert \leq \mathrm{error\_tol}` is satisfied or the num...
[ "r", "Computes", "and", "returns", "an", "approximate", "fixed", "point", "of", "the", "function", "T", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/compute_fp.py#L46-L155
train
r Computes and returns an approximate fixed point of the function T.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/compute_fp.py
_compute_fixed_point_ig
def _compute_fixed_point_ig(T, v, max_iter, verbose, print_skip, is_approx_fp, *args, **kwargs): """ Implement the imitation game algorithm by McLennan and Tourky (2006) for computing an approximate fixed point of `T`. Parameters ---------- is_approx_fp : callable ...
python
def _compute_fixed_point_ig(T, v, max_iter, verbose, print_skip, is_approx_fp, *args, **kwargs): """ Implement the imitation game algorithm by McLennan and Tourky (2006) for computing an approximate fixed point of `T`. Parameters ---------- is_approx_fp : callable ...
[ "def", "_compute_fixed_point_ig", "(", "T", ",", "v", ",", "max_iter", ",", "verbose", ",", "print_skip", ",", "is_approx_fp", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "verbose", "==", "2", ":", "start_time", "=", "time", ".", "time",...
Implement the imitation game algorithm by McLennan and Tourky (2006) for computing an approximate fixed point of `T`. Parameters ---------- is_approx_fp : callable A callable with signature `is_approx_fp(v)` which determines whether `v` is an approximate fixed point with a bool return ...
[ "Implement", "the", "imitation", "game", "algorithm", "by", "McLennan", "and", "Tourky", "(", "2006", ")", "for", "computing", "an", "approximate", "fixed", "point", "of", "T", "." ]
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/compute_fp.py#L158-L281
train
This function computes an approximate fixed point of T.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
QuantEcon/QuantEcon.py
quantecon/compute_fp.py
_initialize_tableaux_ig
def _initialize_tableaux_ig(X, Y, tableaux, bases): """ Given sequences `X` and `Y` of ndarrays, initialize the tableau and basis arrays in place for the "geometric" imitation game as defined in McLennan and Tourky (2006), to be passed to `_lemke_howson_tbl`. Parameters ---------- X, Y : nd...
python
def _initialize_tableaux_ig(X, Y, tableaux, bases): """ Given sequences `X` and `Y` of ndarrays, initialize the tableau and basis arrays in place for the "geometric" imitation game as defined in McLennan and Tourky (2006), to be passed to `_lemke_howson_tbl`. Parameters ---------- X, Y : nd...
[ "def", "_initialize_tableaux_ig", "(", "X", ",", "Y", ",", "tableaux", ",", "bases", ")", ":", "m", "=", "X", ".", "shape", "[", "0", "]", "min_", "=", "np", ".", "zeros", "(", "m", ")", "# Mover", "for", "i", "in", "range", "(", "m", ")", ":",...
Given sequences `X` and `Y` of ndarrays, initialize the tableau and basis arrays in place for the "geometric" imitation game as defined in McLennan and Tourky (2006), to be passed to `_lemke_howson_tbl`. Parameters ---------- X, Y : ndarray(float) Arrays of the same shape (m, n). table...
[ "Given", "sequences", "X", "and", "Y", "of", "ndarrays", "initialize", "the", "tableau", "and", "basis", "arrays", "in", "place", "for", "the", "geometric", "imitation", "game", "as", "defined", "in", "McLennan", "and", "Tourky", "(", "2006", ")", "to", "b...
26a66c552f2a73967d7efb6e1f4b4c4985a12643
https://github.com/QuantEcon/QuantEcon.py/blob/26a66c552f2a73967d7efb6e1f4b4c4985a12643/quantecon/compute_fp.py#L285-L352
train
Initializes the tableaux and base arrays in place for the geometric imitation game as defined by McLennan and Tourky 2006.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.get_participants
def get_participants(self, namespace, room): """Return an iterable with the active participants in a room.""" for sid, active in six.iteritems(self.rooms[namespace][room].copy()): yield sid
python
def get_participants(self, namespace, room): """Return an iterable with the active participants in a room.""" for sid, active in six.iteritems(self.rooms[namespace][room].copy()): yield sid
[ "def", "get_participants", "(", "self", ",", "namespace", ",", "room", ")", ":", "for", "sid", ",", "active", "in", "six", ".", "iteritems", "(", "self", ".", "rooms", "[", "namespace", "]", "[", "room", "]", ".", "copy", "(", ")", ")", ":", "yield...
Return an iterable with the active participants in a room.
[ "Return", "an", "iterable", "with", "the", "active", "participants", "in", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L38-L41
train
Return an iterable with the active participants in a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.connect
def connect(self, sid, namespace): """Register a client connection to a namespace.""" self.enter_room(sid, namespace, None) self.enter_room(sid, namespace, sid)
python
def connect(self, sid, namespace): """Register a client connection to a namespace.""" self.enter_room(sid, namespace, None) self.enter_room(sid, namespace, sid)
[ "def", "connect", "(", "self", ",", "sid", ",", "namespace", ")", ":", "self", ".", "enter_room", "(", "sid", ",", "namespace", ",", "None", ")", "self", ".", "enter_room", "(", "sid", ",", "namespace", ",", "sid", ")" ]
Register a client connection to a namespace.
[ "Register", "a", "client", "connection", "to", "a", "namespace", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L43-L46
train
Register a client connection to a namespace.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.pre_disconnect
def pre_disconnect(self, sid, namespace): """Put the client in the to-be-disconnected list. This allows the client data structures to be present while the disconnect handler is invoked, but still recognize the fact that the client is soon going away. """ if namespace not...
python
def pre_disconnect(self, sid, namespace): """Put the client in the to-be-disconnected list. This allows the client data structures to be present while the disconnect handler is invoked, but still recognize the fact that the client is soon going away. """ if namespace not...
[ "def", "pre_disconnect", "(", "self", ",", "sid", ",", "namespace", ")", ":", "if", "namespace", "not", "in", "self", ".", "pending_disconnect", ":", "self", ".", "pending_disconnect", "[", "namespace", "]", "=", "[", "]", "self", ".", "pending_disconnect", ...
Put the client in the to-be-disconnected list. This allows the client data structures to be present while the disconnect handler is invoked, but still recognize the fact that the client is soon going away.
[ "Put", "the", "client", "in", "the", "to", "-", "be", "-", "disconnected", "list", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L58-L67
train
Put the client in the to - be - disconnected list.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.disconnect
def disconnect(self, sid, namespace): """Register a client disconnect from a namespace.""" if namespace not in self.rooms: return rooms = [] for room_name, room in six.iteritems(self.rooms[namespace].copy()): if sid in room: rooms.append(room_name)...
python
def disconnect(self, sid, namespace): """Register a client disconnect from a namespace.""" if namespace not in self.rooms: return rooms = [] for room_name, room in six.iteritems(self.rooms[namespace].copy()): if sid in room: rooms.append(room_name)...
[ "def", "disconnect", "(", "self", ",", "sid", ",", "namespace", ")", ":", "if", "namespace", "not", "in", "self", ".", "rooms", ":", "return", "rooms", "=", "[", "]", "for", "room_name", ",", "room", "in", "six", ".", "iteritems", "(", "self", ".", ...
Register a client disconnect from a namespace.
[ "Register", "a", "client", "disconnect", "from", "a", "namespace", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L69-L87
train
Register a client disconnect from a namespace.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.enter_room
def enter_room(self, sid, namespace, room): """Add a client to a room.""" if namespace not in self.rooms: self.rooms[namespace] = {} if room not in self.rooms[namespace]: self.rooms[namespace][room] = {} self.rooms[namespace][room][sid] = True
python
def enter_room(self, sid, namespace, room): """Add a client to a room.""" if namespace not in self.rooms: self.rooms[namespace] = {} if room not in self.rooms[namespace]: self.rooms[namespace][room] = {} self.rooms[namespace][room][sid] = True
[ "def", "enter_room", "(", "self", ",", "sid", ",", "namespace", ",", "room", ")", ":", "if", "namespace", "not", "in", "self", ".", "rooms", ":", "self", ".", "rooms", "[", "namespace", "]", "=", "{", "}", "if", "room", "not", "in", "self", ".", ...
Add a client to a room.
[ "Add", "a", "client", "to", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L89-L95
train
Add a client to a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.leave_room
def leave_room(self, sid, namespace, room): """Remove a client from a room.""" try: del self.rooms[namespace][room][sid] if len(self.rooms[namespace][room]) == 0: del self.rooms[namespace][room] if len(self.rooms[namespace]) == 0: ...
python
def leave_room(self, sid, namespace, room): """Remove a client from a room.""" try: del self.rooms[namespace][room][sid] if len(self.rooms[namespace][room]) == 0: del self.rooms[namespace][room] if len(self.rooms[namespace]) == 0: ...
[ "def", "leave_room", "(", "self", ",", "sid", ",", "namespace", ",", "room", ")", ":", "try", ":", "del", "self", ".", "rooms", "[", "namespace", "]", "[", "room", "]", "[", "sid", "]", "if", "len", "(", "self", ".", "rooms", "[", "namespace", "]...
Remove a client from a room.
[ "Remove", "a", "client", "from", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L97-L106
train
Remove a client from a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.close_room
def close_room(self, room, namespace): """Remove all participants from a room.""" try: for sid in self.get_participants(namespace, room): self.leave_room(sid, namespace, room) except KeyError: pass
python
def close_room(self, room, namespace): """Remove all participants from a room.""" try: for sid in self.get_participants(namespace, room): self.leave_room(sid, namespace, room) except KeyError: pass
[ "def", "close_room", "(", "self", ",", "room", ",", "namespace", ")", ":", "try", ":", "for", "sid", "in", "self", ".", "get_participants", "(", "namespace", ",", "room", ")", ":", "self", ".", "leave_room", "(", "sid", ",", "namespace", ",", "room", ...
Remove all participants from a room.
[ "Remove", "all", "participants", "from", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L108-L114
train
Remove all participants from a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.get_rooms
def get_rooms(self, sid, namespace): """Return the rooms a client is in.""" r = [] try: for room_name, room in six.iteritems(self.rooms[namespace]): if room_name is not None and sid in room and room[sid]: r.append(room_name) except KeyError...
python
def get_rooms(self, sid, namespace): """Return the rooms a client is in.""" r = [] try: for room_name, room in six.iteritems(self.rooms[namespace]): if room_name is not None and sid in room and room[sid]: r.append(room_name) except KeyError...
[ "def", "get_rooms", "(", "self", ",", "sid", ",", "namespace", ")", ":", "r", "=", "[", "]", "try", ":", "for", "room_name", ",", "room", "in", "six", ".", "iteritems", "(", "self", ".", "rooms", "[", "namespace", "]", ")", ":", "if", "room_name", ...
Return the rooms a client is in.
[ "Return", "the", "rooms", "a", "client", "is", "in", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L116-L125
train
Return the rooms a client is in.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager.trigger_callback
def trigger_callback(self, sid, namespace, id, data): """Invoke an application callback.""" callback = None try: callback = self.callbacks[sid][namespace][id] except KeyError: # if we get an unknown callback we just ignore it self._get_logger().warning...
python
def trigger_callback(self, sid, namespace, id, data): """Invoke an application callback.""" callback = None try: callback = self.callbacks[sid][namespace][id] except KeyError: # if we get an unknown callback we just ignore it self._get_logger().warning...
[ "def", "trigger_callback", "(", "self", ",", "sid", ",", "namespace", ",", "id", ",", "data", ")", ":", "callback", "=", "None", "try", ":", "callback", "=", "self", ".", "callbacks", "[", "sid", "]", "[", "namespace", "]", "[", "id", "]", "except", ...
Invoke an application callback.
[ "Invoke", "an", "application", "callback", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L141-L152
train
Invoke an application callback.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager._generate_ack_id
def _generate_ack_id(self, sid, namespace, callback): """Generate a unique identifier for an ACK packet.""" namespace = namespace or '/' if sid not in self.callbacks: self.callbacks[sid] = {} if namespace not in self.callbacks[sid]: self.callbacks[sid][namespace] ...
python
def _generate_ack_id(self, sid, namespace, callback): """Generate a unique identifier for an ACK packet.""" namespace = namespace or '/' if sid not in self.callbacks: self.callbacks[sid] = {} if namespace not in self.callbacks[sid]: self.callbacks[sid][namespace] ...
[ "def", "_generate_ack_id", "(", "self", ",", "sid", ",", "namespace", ",", "callback", ")", ":", "namespace", "=", "namespace", "or", "'/'", "if", "sid", "not", "in", "self", ".", "callbacks", ":", "self", ".", "callbacks", "[", "sid", "]", "=", "{", ...
Generate a unique identifier for an ACK packet.
[ "Generate", "a", "unique", "identifier", "for", "an", "ACK", "packet", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L154-L163
train
Generate a unique identifier for an ACK packet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/base_manager.py
BaseManager._get_logger
def _get_logger(self): """Get the appropriate logger Prevents uninitialized servers in write-only mode from failing. """ if self.logger: return self.logger elif self.server: return self.server.logger else: return default_logger
python
def _get_logger(self): """Get the appropriate logger Prevents uninitialized servers in write-only mode from failing. """ if self.logger: return self.logger elif self.server: return self.server.logger else: return default_logger
[ "def", "_get_logger", "(", "self", ")", ":", "if", "self", ".", "logger", ":", "return", "self", ".", "logger", "elif", "self", ".", "server", ":", "return", "self", ".", "server", ".", "logger", "else", ":", "return", "default_logger" ]
Get the appropriate logger Prevents uninitialized servers in write-only mode from failing.
[ "Get", "the", "appropriate", "logger" ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/base_manager.py#L165-L176
train
Get the appropriate logger for this instance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.on
def on(self, event, handler=None, namespace=None): """Register an event handler. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param handler:...
python
def on(self, event, handler=None, namespace=None): """Register an event handler. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param handler:...
[ "def", "on", "(", "self", ",", "event", ",", "handler", "=", "None", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "def", "set_handler", "(", "handler", ")", ":", "if", "namespace", "not", "in", "self", ".", "ha...
Register an event handler. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param handler: The function that should be invoked to handle the ...
[ "Register", "an", "event", "handler", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L140-L187
train
Register an event handler for the specified event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.register_namespace
def register_namespace(self, namespace_handler): """Register a namespace handler object. :param namespace_handler: An instance of a :class:`Namespace` subclass that handles all the event traffic for a namespace. """ if ...
python
def register_namespace(self, namespace_handler): """Register a namespace handler object. :param namespace_handler: An instance of a :class:`Namespace` subclass that handles all the event traffic for a namespace. """ if ...
[ "def", "register_namespace", "(", "self", ",", "namespace_handler", ")", ":", "if", "not", "isinstance", "(", "namespace_handler", ",", "namespace", ".", "Namespace", ")", ":", "raise", "ValueError", "(", "'Not a namespace instance'", ")", "if", "self", ".", "is...
Register a namespace handler object. :param namespace_handler: An instance of a :class:`Namespace` subclass that handles all the event traffic for a namespace.
[ "Register", "a", "namespace", "handler", "object", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L189-L202
train
Register a namespace handler object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.enter_room
def enter_room(self, sid, room, namespace=None): """Enter a room. This function adds the client to a room. The :func:`emit` and :func:`send` functions can optionally broadcast events to all the clients in a room. :param sid: Session ID of the client. :param room: Room n...
python
def enter_room(self, sid, room, namespace=None): """Enter a room. This function adds the client to a room. The :func:`emit` and :func:`send` functions can optionally broadcast events to all the clients in a room. :param sid: Session ID of the client. :param room: Room n...
[ "def", "enter_room", "(", "self", ",", "sid", ",", "room", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "logger", ".", "info", "(", "'%s is entering room %s [%s]'", ",", "sid", ",", "room", ",", "names...
Enter a room. This function adds the client to a room. The :func:`emit` and :func:`send` functions can optionally broadcast events to all the clients in a room. :param sid: Session ID of the client. :param room: Room name. If the room does not exist it is created. :para...
[ "Enter", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L324-L338
train
Enter a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.leave_room
def leave_room(self, sid, room, namespace=None): """Leave a room. This function removes the client from a room. :param sid: Session ID of the client. :param room: Room name. :param namespace: The Socket.IO namespace for the event. If this argument is o...
python
def leave_room(self, sid, room, namespace=None): """Leave a room. This function removes the client from a room. :param sid: Session ID of the client. :param room: Room name. :param namespace: The Socket.IO namespace for the event. If this argument is o...
[ "def", "leave_room", "(", "self", ",", "sid", ",", "room", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "logger", ".", "info", "(", "'%s is leaving room %s [%s]'", ",", "sid", ",", "room", ",", "namesp...
Leave a room. This function removes the client from a room. :param sid: Session ID of the client. :param room: Room name. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is used.
[ "Leave", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L340-L352
train
This function removes the client from a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.rooms
def rooms(self, sid, namespace=None): """Return the rooms a client is in. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is used. """ namespace = namespace...
python
def rooms(self, sid, namespace=None): """Return the rooms a client is in. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is used. """ namespace = namespace...
[ "def", "rooms", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "return", "self", ".", "manager", ".", "get_rooms", "(", "sid", ",", "namespace", ")" ]
Return the rooms a client is in. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is used.
[ "Return", "the", "rooms", "a", "client", "is", "in", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L367-L375
train
Return the rooms a client is in.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.get_session
def get_session(self, sid, namespace=None): """Return the user session for a client. :param sid: The session id of the client. :param namespace: The Socket.IO namespace. If this argument is omitted the default namespace is used. The return value is a dictionar...
python
def get_session(self, sid, namespace=None): """Return the user session for a client. :param sid: The session id of the client. :param namespace: The Socket.IO namespace. If this argument is omitted the default namespace is used. The return value is a dictionar...
[ "def", "get_session", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "eio_session", "=", "self", ".", "eio", ".", "get_session", "(", "sid", ")", "return", "eio_session", ".", "setdefault", "...
Return the user session for a client. :param sid: The session id of the client. :param namespace: The Socket.IO namespace. If this argument is omitted the default namespace is used. The return value is a dictionary. Modifications made to this dictionary are no...
[ "Return", "the", "user", "session", "for", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L377-L391
train
Return the user session for a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.save_session
def save_session(self, sid, session, namespace=None): """Store the user session for a client. :param sid: The session id of the client. :param session: The session dictionary. :param namespace: The Socket.IO namespace. If this argument is omitted the default na...
python
def save_session(self, sid, session, namespace=None): """Store the user session for a client. :param sid: The session id of the client. :param session: The session dictionary. :param namespace: The Socket.IO namespace. If this argument is omitted the default na...
[ "def", "save_session", "(", "self", ",", "sid", ",", "session", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "eio_session", "=", "self", ".", "eio", ".", "get_session", "(", "sid", ")", "eio_session", "[", "namespa...
Store the user session for a client. :param sid: The session id of the client. :param session: The session dictionary. :param namespace: The Socket.IO namespace. If this argument is omitted the default namespace is used.
[ "Store", "the", "user", "session", "for", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L393-L403
train
Store the user session for a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.session
def session(self, sid, namespace=None): """Return the user session for a client with context manager syntax. :param sid: The session id of the client. This is a context manager that returns the user session dictionary for the client. Any changes that are made to this dictionary inside ...
python
def session(self, sid, namespace=None): """Return the user session for a client with context manager syntax. :param sid: The session id of the client. This is a context manager that returns the user session dictionary for the client. Any changes that are made to this dictionary inside ...
[ "def", "session", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "class", "_session_context_manager", "(", "object", ")", ":", "def", "__init__", "(", "self", ",", "server", ",", "sid", ",", "namespace", ")", ":", "self", ".", "serve...
Return the user session for a client with context manager syntax. :param sid: The session id of the client. This is a context manager that returns the user session dictionary for the client. Any changes that are made to this dictionary inside the context manager block are saved back to...
[ "Return", "the", "user", "session", "for", "a", "client", "with", "context", "manager", "syntax", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L405-L443
train
Return the user session dictionary for a client with context manager syntax.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server.start_background_task
def start_background_task(self, target, *args, **kwargs): """Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param targe...
python
def start_background_task(self, target, *args, **kwargs): """Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param targe...
[ "def", "start_background_task", "(", "self", ",", "target", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "eio", ".", "start_background_task", "(", "target", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Start a background task using the appropriate async model. This is a utility function that applications can use to start a background task using the method that is compatible with the selected async mode. :param target: the target function to execute. :param args: arguments to ...
[ "Start", "a", "background", "task", "using", "the", "appropriate", "async", "model", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L487-L502
train
Start a background task using the appropriate async model.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._emit_internal
def _emit_internal(self, sid, event, data, namespace=None, id=None): """Send a message to a client.""" if six.PY2 and not self.binary: binary = False # pragma: nocover else: binary = None # tuples are expanded to multiple arguments, everything else is sent ...
python
def _emit_internal(self, sid, event, data, namespace=None, id=None): """Send a message to a client.""" if six.PY2 and not self.binary: binary = False # pragma: nocover else: binary = None # tuples are expanded to multiple arguments, everything else is sent ...
[ "def", "_emit_internal", "(", "self", ",", "sid", ",", "event", ",", "data", ",", "namespace", "=", "None", ",", "id", "=", "None", ")", ":", "if", "six", ".", "PY2", "and", "not", "self", ".", "binary", ":", "binary", "=", "False", "# pragma: nocove...
Send a message to a client.
[ "Send", "a", "message", "to", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L514-L528
train
Send a message to a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._send_packet
def _send_packet(self, sid, pkt): """Send a Socket.IO packet to a client.""" encoded_packet = pkt.encode() if isinstance(encoded_packet, list): binary = False for ep in encoded_packet: self.eio.send(sid, ep, binary=binary) binary = True ...
python
def _send_packet(self, sid, pkt): """Send a Socket.IO packet to a client.""" encoded_packet = pkt.encode() if isinstance(encoded_packet, list): binary = False for ep in encoded_packet: self.eio.send(sid, ep, binary=binary) binary = True ...
[ "def", "_send_packet", "(", "self", ",", "sid", ",", "pkt", ")", ":", "encoded_packet", "=", "pkt", ".", "encode", "(", ")", "if", "isinstance", "(", "encoded_packet", ",", "list", ")", ":", "binary", "=", "False", "for", "ep", "in", "encoded_packet", ...
Send a Socket.IO packet to a client.
[ "Send", "a", "Socket", ".", "IO", "packet", "to", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L530-L539
train
Send a Socket. IO packet to a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._handle_connect
def _handle_connect(self, sid, namespace): """Handle a client connection request.""" namespace = namespace or '/' self.manager.connect(sid, namespace) if self.always_connect: self._send_packet(sid, packet.Packet(packet.CONNECT, ...
python
def _handle_connect(self, sid, namespace): """Handle a client connection request.""" namespace = namespace or '/' self.manager.connect(sid, namespace) if self.always_connect: self._send_packet(sid, packet.Packet(packet.CONNECT, ...
[ "def", "_handle_connect", "(", "self", ",", "sid", ",", "namespace", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "manager", ".", "connect", "(", "sid", ",", "namespace", ")", "if", "self", ".", "always_connect", ":", "self", ".", ...
Handle a client connection request.
[ "Handle", "a", "client", "connection", "request", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L541-L570
train
Handle a client connection request.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._handle_disconnect
def _handle_disconnect(self, sid, namespace): """Handle a client disconnect.""" namespace = namespace or '/' if namespace == '/': namespace_list = list(self.manager.get_namespaces()) else: namespace_list = [namespace] for n in namespace_list: i...
python
def _handle_disconnect(self, sid, namespace): """Handle a client disconnect.""" namespace = namespace or '/' if namespace == '/': namespace_list = list(self.manager.get_namespaces()) else: namespace_list = [namespace] for n in namespace_list: i...
[ "def", "_handle_disconnect", "(", "self", ",", "sid", ",", "namespace", ")", ":", "namespace", "=", "namespace", "or", "'/'", "if", "namespace", "==", "'/'", ":", "namespace_list", "=", "list", "(", "self", ".", "manager", ".", "get_namespaces", "(", ")", ...
Handle a client disconnect.
[ "Handle", "a", "client", "disconnect", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L572-L585
train
Handle a client disconnect.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._handle_event
def _handle_event(self, sid, namespace, id, data): """Handle an incoming client event.""" namespace = namespace or '/' self.logger.info('received event "%s" from %s [%s]', data[0], sid, namespace) if self.async_handlers: self.start_background_task(sel...
python
def _handle_event(self, sid, namespace, id, data): """Handle an incoming client event.""" namespace = namespace or '/' self.logger.info('received event "%s" from %s [%s]', data[0], sid, namespace) if self.async_handlers: self.start_background_task(sel...
[ "def", "_handle_event", "(", "self", ",", "sid", ",", "namespace", ",", "id", ",", "data", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "logger", ".", "info", "(", "'received event \"%s\" from %s [%s]'", ",", "data", "[", "0", "]", ...
Handle an incoming client event.
[ "Handle", "an", "incoming", "client", "event", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L587-L596
train
Handle an incoming client event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._trigger_event
def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event if namespace in self.handlers and event in self.handlers[namespace]: return self.handlers[namespace][event](*args) # or else...
python
def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event if namespace in self.handlers and event in self.handlers[namespace]: return self.handlers[namespace][event](*args) # or else...
[ "def", "_trigger_event", "(", "self", ",", "event", ",", "namespace", ",", "*", "args", ")", ":", "# first see if we have an explicit handler for the event", "if", "namespace", "in", "self", ".", "handlers", "and", "event", "in", "self", ".", "handlers", "[", "n...
Invoke an application event handler.
[ "Invoke", "an", "application", "event", "handler", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L624-L633
train
Invoke an application event handler.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._handle_eio_connect
def _handle_eio_connect(self, sid, environ): """Handle the Engine.IO connection event.""" if not self.manager_initialized: self.manager_initialized = True self.manager.initialize() self.environ[sid] = environ return self._handle_connect(sid, '/')
python
def _handle_eio_connect(self, sid, environ): """Handle the Engine.IO connection event.""" if not self.manager_initialized: self.manager_initialized = True self.manager.initialize() self.environ[sid] = environ return self._handle_connect(sid, '/')
[ "def", "_handle_eio_connect", "(", "self", ",", "sid", ",", "environ", ")", ":", "if", "not", "self", ".", "manager_initialized", ":", "self", ".", "manager_initialized", "=", "True", "self", ".", "manager", ".", "initialize", "(", ")", "self", ".", "envir...
Handle the Engine.IO connection event.
[ "Handle", "the", "Engine", ".", "IO", "connection", "event", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L635-L641
train
Handle the Engine. IO connection event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._handle_eio_message
def _handle_eio_message(self, sid, data): """Dispatch Engine.IO messages.""" if sid in self._binary_packet: pkt = self._binary_packet[sid] if pkt.add_attachment(data): del self._binary_packet[sid] if pkt.packet_type == packet.BINARY_EVENT: ...
python
def _handle_eio_message(self, sid, data): """Dispatch Engine.IO messages.""" if sid in self._binary_packet: pkt = self._binary_packet[sid] if pkt.add_attachment(data): del self._binary_packet[sid] if pkt.packet_type == packet.BINARY_EVENT: ...
[ "def", "_handle_eio_message", "(", "self", ",", "sid", ",", "data", ")", ":", "if", "sid", "in", "self", ".", "_binary_packet", ":", "pkt", "=", "self", ".", "_binary_packet", "[", "sid", "]", "if", "pkt", ".", "add_attachment", "(", "data", ")", ":", ...
Dispatch Engine.IO messages.
[ "Dispatch", "Engine", ".", "IO", "messages", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L643-L669
train
Dispatch Engine. IO messages.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/server.py
Server._handle_eio_disconnect
def _handle_eio_disconnect(self, sid): """Handle Engine.IO disconnect event.""" self._handle_disconnect(sid, '/') if sid in self.environ: del self.environ[sid]
python
def _handle_eio_disconnect(self, sid): """Handle Engine.IO disconnect event.""" self._handle_disconnect(sid, '/') if sid in self.environ: del self.environ[sid]
[ "def", "_handle_eio_disconnect", "(", "self", ",", "sid", ")", ":", "self", ".", "_handle_disconnect", "(", "sid", ",", "'/'", ")", "if", "sid", "in", "self", ".", "environ", ":", "del", "self", ".", "environ", "[", "sid", "]" ]
Handle Engine.IO disconnect event.
[ "Handle", "Engine", ".", "IO", "disconnect", "event", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/server.py#L671-L675
train
Handle Engine. IO disconnect event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_pubsub_manager.py
AsyncPubSubManager.emit
async def emit(self, event, data, namespace=None, room=None, skip_sid=None, callback=None, **kwargs): """Emit a message to a single client, a room, or all the clients connected to the namespace. This method takes care or propagating the message to all the servers that...
python
async def emit(self, event, data, namespace=None, room=None, skip_sid=None, callback=None, **kwargs): """Emit a message to a single client, a room, or all the clients connected to the namespace. This method takes care or propagating the message to all the servers that...
[ "async", "def", "emit", "(", "self", ",", "event", ",", "data", ",", "namespace", "=", "None", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "callback", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(...
Emit a message to a single client, a room, or all the clients connected to the namespace. This method takes care or propagating the message to all the servers that are connected through the message queue. The parameters are the same as in :meth:`.Server.emit`. Note: this metho...
[ "Emit", "a", "message", "to", "a", "single", "client", "a", "room", "or", "all", "the", "clients", "connected", "to", "the", "namespace", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_pubsub_manager.py#L40-L70
train
Emit a message to a single client or a room or all the servers that are connected to the namespace.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_client.py
AsyncClient.connect
async def connect(self, url, headers={}, transports=None, namespaces=None, socketio_path='socket.io'): """Connect to a Socket.IO server. :param url: The URL of the Socket.IO server. It can include custom query string parameters if required by the server. ...
python
async def connect(self, url, headers={}, transports=None, namespaces=None, socketio_path='socket.io'): """Connect to a Socket.IO server. :param url: The URL of the Socket.IO server. It can include custom query string parameters if required by the server. ...
[ "async", "def", "connect", "(", "self", ",", "url", ",", "headers", "=", "{", "}", ",", "transports", "=", "None", ",", "namespaces", "=", "None", ",", "socketio_path", "=", "'socket.io'", ")", ":", "self", ".", "connection_url", "=", "url", "self", "....
Connect to a Socket.IO server. :param url: The URL of the Socket.IO server. It can include custom query string parameters if required by the server. :param headers: A dictionary with custom headers to send with the connection request. :param transport...
[ "Connect", "to", "a", "Socket", ".", "IO", "server", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_client.py#L59-L104
train
Connect to a Socket. IO server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_client.py
AsyncClient.wait
async def wait(self): """Wait until the connection with the server ends. Client applications can use this function to block the main thread during the life of the connection. Note: this method is a coroutine. """ while True: await self.eio.wait() ...
python
async def wait(self): """Wait until the connection with the server ends. Client applications can use this function to block the main thread during the life of the connection. Note: this method is a coroutine. """ while True: await self.eio.wait() ...
[ "async", "def", "wait", "(", "self", ")", ":", "while", "True", ":", "await", "self", ".", "eio", ".", "wait", "(", ")", "await", "self", ".", "sleep", "(", "1", ")", "# give the reconnect task time to start up", "if", "not", "self", ".", "_reconnect_task"...
Wait until the connection with the server ends. Client applications can use this function to block the main thread during the life of the connection. Note: this method is a coroutine.
[ "Wait", "until", "the", "connection", "with", "the", "server", "ends", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_client.py#L106-L121
train
Wait until the connection with the server ends.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/client.py
Client.register_namespace
def register_namespace(self, namespace_handler): """Register a namespace handler object. :param namespace_handler: An instance of a :class:`Namespace` subclass that handles all the event traffic for a namespace. """ if ...
python
def register_namespace(self, namespace_handler): """Register a namespace handler object. :param namespace_handler: An instance of a :class:`Namespace` subclass that handles all the event traffic for a namespace. """ if ...
[ "def", "register_namespace", "(", "self", ",", "namespace_handler", ")", ":", "if", "not", "isinstance", "(", "namespace_handler", ",", "namespace", ".", "ClientNamespace", ")", ":", "raise", "ValueError", "(", "'Not a namespace instance'", ")", "if", "self", ".",...
Register a namespace handler object. :param namespace_handler: An instance of a :class:`Namespace` subclass that handles all the event traffic for a namespace.
[ "Register", "a", "namespace", "handler", "object", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L153-L166
train
Register a namespace handler object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/client.py
Client.emit
def emit(self, event, data=None, namespace=None, callback=None): """Emit a custom event to one or more connected clients. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and sh...
python
def emit(self, event, data=None, namespace=None, callback=None): """Emit a custom event to one or more connected clients. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and sh...
[ "def", "emit", "(", "self", ",", "event", ",", "data", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "logger", ".", "info", "(", "'Emitting event \"%s\" [%s]'"...
Emit a custom event to one or more connected clients. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client or cli...
[ "Emit", "a", "custom", "event", "to", "one", "or", "more", "connected", "clients", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L227-L265
train
Emit a custom event to one or more connected clients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/client.py
Client.send
def send(self, data, namespace=None, callback=None): """Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of ...
python
def send(self, data, namespace=None, callback=None): """Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of ...
[ "def", "send", "(", "self", ",", "data", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "self", ".", "emit", "(", "'message'", ",", "data", "=", "data", ",", "namespace", "=", "namespace", ",", "callback", "=", "callback", ")"...
Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of type ``str``, ``bytes``, ``list`` or ``dict``. If...
[ "Send", "a", "message", "to", "one", "or", "more", "connected", "clients", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L267-L286
train
Send a message to one or more connected clients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/client.py
Client.call
def call(self, event, data=None, namespace=None, timeout=60): """Emit a custom event to a client and wait for the response. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and ...
python
def call(self, event, data=None, namespace=None, timeout=60): """Emit a custom event to a client and wait for the response. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and ...
[ "def", "call", "(", "self", ",", "event", ",", "data", "=", "None", ",", "namespace", "=", "None", ",", "timeout", "=", "60", ")", ":", "callback_event", "=", "self", ".", "eio", ".", "create_event", "(", ")", "callback_args", "=", "[", "]", "def", ...
Emit a custom event to a client and wait for the response. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client o...
[ "Emit", "a", "custom", "event", "to", "a", "client", "and", "wait", "for", "the", "response", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L288-L317
train
Emit a custom event to a client and wait for the response.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/client.py
Client.disconnect
def disconnect(self): """Disconnect from the server.""" # here we just request the disconnection # later in _handle_eio_disconnect we invoke the disconnect handler for n in self.namespaces: self._send_packet(packet.Packet(packet.DISCONNECT, namespace=n)) self._send_pa...
python
def disconnect(self): """Disconnect from the server.""" # here we just request the disconnection # later in _handle_eio_disconnect we invoke the disconnect handler for n in self.namespaces: self._send_packet(packet.Packet(packet.DISCONNECT, namespace=n)) self._send_pa...
[ "def", "disconnect", "(", "self", ")", ":", "# here we just request the disconnection", "# later in _handle_eio_disconnect we invoke the disconnect handler", "for", "n", "in", "self", ".", "namespaces", ":", "self", ".", "_send_packet", "(", "packet", ".", "Packet", "(", ...
Disconnect from the server.
[ "Disconnect", "from", "the", "server", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L319-L327
train
Disconnect from the server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/client.py
Client._handle_eio_disconnect
def _handle_eio_disconnect(self): """Handle the Engine.IO disconnection event.""" self.logger.info('Engine.IO connection dropped') for n in self.namespaces: self._trigger_event('disconnect', namespace=n) self._trigger_event('disconnect', namespace='/') self.callbacks ...
python
def _handle_eio_disconnect(self): """Handle the Engine.IO disconnection event.""" self.logger.info('Engine.IO connection dropped') for n in self.namespaces: self._trigger_event('disconnect', namespace=n) self._trigger_event('disconnect', namespace='/') self.callbacks ...
[ "def", "_handle_eio_disconnect", "(", "self", ")", ":", "self", ".", "logger", ".", "info", "(", "'Engine.IO connection dropped'", ")", "for", "n", "in", "self", ".", "namespaces", ":", "self", ".", "_trigger_event", "(", "'disconnect'", ",", "namespace", "=",...
Handle the Engine.IO disconnection event.
[ "Handle", "the", "Engine", ".", "IO", "disconnection", "event", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/client.py#L516-L526
train
Handle the Engine. IO disconnection event.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/packet.py
Packet.encode
def encode(self): """Encode the packet for transmission. If the packet contains binary elements, this function returns a list of packets where the first is the original packet with placeholders for the binary components and the remaining ones the binary attachments. """ ...
python
def encode(self): """Encode the packet for transmission. If the packet contains binary elements, this function returns a list of packets where the first is the original packet with placeholders for the binary components and the remaining ones the binary attachments. """ ...
[ "def", "encode", "(", "self", ")", ":", "encoded_packet", "=", "six", ".", "text_type", "(", "self", ".", "packet_type", ")", "if", "self", ".", "packet_type", "==", "BINARY_EVENT", "or", "self", ".", "packet_type", "==", "BINARY_ACK", ":", "data", ",", ...
Encode the packet for transmission. If the packet contains binary elements, this function returns a list of packets where the first is the original packet with placeholders for the binary components and the remaining ones the binary attachments.
[ "Encode", "the", "packet", "for", "transmission", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/packet.py#L45-L74
train
Encode the packet for transmission.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/packet.py
Packet.decode
def decode(self, encoded_packet): """Decode a transmitted package. The return value indicates how many binary attachment packets are necessary to fully decode the packet. """ ep = encoded_packet try: self.packet_type = int(ep[0:1]) except TypeError: ...
python
def decode(self, encoded_packet): """Decode a transmitted package. The return value indicates how many binary attachment packets are necessary to fully decode the packet. """ ep = encoded_packet try: self.packet_type = int(ep[0:1]) except TypeError: ...
[ "def", "decode", "(", "self", ",", "encoded_packet", ")", ":", "ep", "=", "encoded_packet", "try", ":", "self", ".", "packet_type", "=", "int", "(", "ep", "[", "0", ":", "1", "]", ")", "except", "TypeError", ":", "self", ".", "packet_type", "=", "ep"...
Decode a transmitted package. The return value indicates how many binary attachment packets are necessary to fully decode the packet.
[ "Decode", "a", "transmitted", "package", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/packet.py#L76-L114
train
Decode a transmitted package.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/packet.py
Packet.reconstruct_binary
def reconstruct_binary(self, attachments): """Reconstruct a decoded packet using the given list of binary attachments. """ self.data = self._reconstruct_binary_internal(self.data, self.attachments)
python
def reconstruct_binary(self, attachments): """Reconstruct a decoded packet using the given list of binary attachments. """ self.data = self._reconstruct_binary_internal(self.data, self.attachments)
[ "def", "reconstruct_binary", "(", "self", ",", "attachments", ")", ":", "self", ".", "data", "=", "self", ".", "_reconstruct_binary_internal", "(", "self", ".", "data", ",", "self", ".", "attachments", ")" ]
Reconstruct a decoded packet using the given list of binary attachments.
[ "Reconstruct", "a", "decoded", "packet", "using", "the", "given", "list", "of", "binary", "attachments", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/packet.py#L125-L130
train
Reconstruct a decoded packet using the given list of binary attachments.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/packet.py
Packet._deconstruct_binary
def _deconstruct_binary(self, data): """Extract binary components in the packet.""" attachments = [] data = self._deconstruct_binary_internal(data, attachments) return data, attachments
python
def _deconstruct_binary(self, data): """Extract binary components in the packet.""" attachments = [] data = self._deconstruct_binary_internal(data, attachments) return data, attachments
[ "def", "_deconstruct_binary", "(", "self", ",", "data", ")", ":", "attachments", "=", "[", "]", "data", "=", "self", ".", "_deconstruct_binary_internal", "(", "data", ",", "attachments", ")", "return", "data", ",", "attachments" ]
Extract binary components in the packet.
[ "Extract", "binary", "components", "in", "the", "packet", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/packet.py#L146-L150
train
Extract binary components in the packet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/packet.py
Packet._data_is_binary
def _data_is_binary(self, data): """Check if the data contains binary components.""" if isinstance(data, six.binary_type): return True elif isinstance(data, list): return functools.reduce( lambda a, b: a or b, [self._data_is_binary(item) ...
python
def _data_is_binary(self, data): """Check if the data contains binary components.""" if isinstance(data, six.binary_type): return True elif isinstance(data, list): return functools.reduce( lambda a, b: a or b, [self._data_is_binary(item) ...
[ "def", "_data_is_binary", "(", "self", ",", "data", ")", ":", "if", "isinstance", "(", "data", ",", "six", ".", "binary_type", ")", ":", "return", "True", "elif", "isinstance", "(", "data", ",", "list", ")", ":", "return", "functools", ".", "reduce", "...
Check if the data contains binary components.
[ "Check", "if", "the", "data", "contains", "binary", "components", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/packet.py#L165-L179
train
Check if the data contains binary components.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_namespace.py
AsyncNamespace.trigger_event
async def trigger_event(self, event, *args): """Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are ...
python
async def trigger_event(self, event, *args): """Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are ...
[ "async", "def", "trigger_event", "(", "self", ",", "event", ",", "*", "args", ")", ":", "handler_name", "=", "'on_'", "+", "event", "if", "hasattr", "(", "self", ",", "handler_name", ")", ":", "handler", "=", "getattr", "(", "self", ",", "handler_name", ...
Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are needed, or if having a single method that catche...
[ "Dispatch", "an", "event", "to", "the", "proper", "handler", "method", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_namespace.py#L22-L42
train
Dispatch an event to the proper handler method.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_namespace.py
AsyncNamespace.close_room
async def close_room(self, room, namespace=None): """Close a room. The only difference with the :func:`socketio.Server.close_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine. ...
python
async def close_room(self, room, namespace=None): """Close a room. The only difference with the :func:`socketio.Server.close_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine. ...
[ "async", "def", "close_room", "(", "self", ",", "room", ",", "namespace", "=", "None", ")", ":", "return", "await", "self", ".", "server", ".", "close_room", "(", "room", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace", ")" ]
Close a room. The only difference with the :func:`socketio.Server.close_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine.
[ "Close", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_namespace.py#L73-L83
train
Close a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_namespace.py
AsyncNamespace.disconnect
async def disconnect(self, sid, namespace=None): """Disconnect a client. The only difference with the :func:`socketio.Server.disconnect` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine...
python
async def disconnect(self, sid, namespace=None): """Disconnect a client. The only difference with the :func:`socketio.Server.disconnect` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine...
[ "async", "def", "disconnect", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "return", "await", "self", ".", "server", ".", "disconnect", "(", "sid", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace", ")" ]
Disconnect a client. The only difference with the :func:`socketio.Server.disconnect` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine.
[ "Disconnect", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_namespace.py#L118-L128
train
Disconnect a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_namespace.py
AsyncClientNamespace.emit
async def emit(self, event, data=None, namespace=None, callback=None): """Emit a custom event to the server. The only difference with the :func:`socketio.Client.emit` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. No...
python
async def emit(self, event, data=None, namespace=None, callback=None): """Emit a custom event to the server. The only difference with the :func:`socketio.Client.emit` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. No...
[ "async", "def", "emit", "(", "self", ",", "event", ",", "data", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "await", "self", ".", "client", ".", "emit", "(", "event", ",", "data", "=", "data", ",", ...
Emit a custom event to the server. The only difference with the :func:`socketio.Client.emit` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine.
[ "Emit", "a", "custom", "event", "to", "the", "server", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_namespace.py#L169-L180
train
Emit a custom event to the server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_namespace.py
AsyncClientNamespace.send
async def send(self, data, namespace=None, callback=None): """Send a message to the server. The only difference with the :func:`socketio.Client.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method i...
python
async def send(self, data, namespace=None, callback=None): """Send a message to the server. The only difference with the :func:`socketio.Client.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method i...
[ "async", "def", "send", "(", "self", ",", "data", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "await", "self", ".", "client", ".", "send", "(", "data", ",", "namespace", "=", "namespace", "or", "self", ".", "names...
Send a message to the server. The only difference with the :func:`socketio.Client.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. Note: this method is a coroutine.
[ "Send", "a", "message", "to", "the", "server", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_namespace.py#L182-L193
train
Send a message to the server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
BaseNamespace.trigger_event
def trigger_event(self, event, *args): """Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are needed...
python
def trigger_event(self, event, *args): """Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are needed...
[ "def", "trigger_event", "(", "self", ",", "event", ",", "*", "args", ")", ":", "handler_name", "=", "'on_'", "+", "event", "if", "hasattr", "(", "self", ",", "handler_name", ")", ":", "return", "getattr", "(", "self", ",", "handler_name", ")", "(", "*"...
Dispatch an event to the proper handler method. In the most common usage, this method is not overloaded by subclasses, as it performs the routing of events to methods. However, this method can be overriden if special dispatching rules are needed, or if having a single method that catche...
[ "Dispatch", "an", "event", "to", "the", "proper", "handler", "method", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L8-L18
train
Dispatch an event to the proper handler method.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.emit
def emit(self, event, data=None, room=None, skip_sid=None, namespace=None, callback=None): """Emit a custom event to one or more connected clients. The only difference with the :func:`socketio.Server.emit` method is that when the ``namespace`` argument is not given the namespace ...
python
def emit(self, event, data=None, room=None, skip_sid=None, namespace=None, callback=None): """Emit a custom event to one or more connected clients. The only difference with the :func:`socketio.Server.emit` method is that when the ``namespace`` argument is not given the namespace ...
[ "def", "emit", "(", "self", ",", "event", ",", "data", "=", "None", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "server", ".", "emit", "(", ...
Emit a custom event to one or more connected clients. The only difference with the :func:`socketio.Server.emit` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Emit", "a", "custom", "event", "to", "one", "or", "more", "connected", "clients", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L40-L50
train
Emit a custom event to one or more connected clients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.send
def send(self, data, room=None, skip_sid=None, namespace=None, callback=None): """Send a message to one or more connected clients. The only difference with the :func:`socketio.Server.send` method is that when the ``namespace`` argument is not given the namespace associated ...
python
def send(self, data, room=None, skip_sid=None, namespace=None, callback=None): """Send a message to one or more connected clients. The only difference with the :func:`socketio.Server.send` method is that when the ``namespace`` argument is not given the namespace associated ...
[ "def", "send", "(", "self", ",", "data", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "server", ".", "send", "(", "data", ",", "room", "=", "...
Send a message to one or more connected clients. The only difference with the :func:`socketio.Server.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Send", "a", "message", "to", "one", "or", "more", "connected", "clients", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L52-L62
train
Send a message to one or more connected clients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.enter_room
def enter_room(self, sid, room, namespace=None): """Enter a room. The only difference with the :func:`socketio.Server.enter_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return self.server.enter_roo...
python
def enter_room(self, sid, room, namespace=None): """Enter a room. The only difference with the :func:`socketio.Server.enter_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return self.server.enter_roo...
[ "def", "enter_room", "(", "self", ",", "sid", ",", "room", ",", "namespace", "=", "None", ")", ":", "return", "self", ".", "server", ".", "enter_room", "(", "sid", ",", "room", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace", ")" ]
Enter a room. The only difference with the :func:`socketio.Server.enter_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Enter", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L64-L72
train
Enter a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.leave_room
def leave_room(self, sid, room, namespace=None): """Leave a room. The only difference with the :func:`socketio.Server.leave_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return self.server.leave_roo...
python
def leave_room(self, sid, room, namespace=None): """Leave a room. The only difference with the :func:`socketio.Server.leave_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return self.server.leave_roo...
[ "def", "leave_room", "(", "self", ",", "sid", ",", "room", ",", "namespace", "=", "None", ")", ":", "return", "self", ".", "server", ".", "leave_room", "(", "sid", ",", "room", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace", ")" ]
Leave a room. The only difference with the :func:`socketio.Server.leave_room` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Leave", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L74-L82
train
Leave a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.rooms
def rooms(self, sid, namespace=None): """Return the rooms a client is in. The only difference with the :func:`socketio.Server.rooms` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return self.server.rooms(...
python
def rooms(self, sid, namespace=None): """Return the rooms a client is in. The only difference with the :func:`socketio.Server.rooms` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return self.server.rooms(...
[ "def", "rooms", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "return", "self", ".", "server", ".", "rooms", "(", "sid", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace", ")" ]
Return the rooms a client is in. The only difference with the :func:`socketio.Server.rooms` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Return", "the", "rooms", "a", "client", "is", "in", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L94-L101
train
Return the rooms a client is in.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.get_session
def get_session(self, sid, namespace=None): """Return the user session for a client. The only difference with the :func:`socketio.Server.get_session` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return s...
python
def get_session(self, sid, namespace=None): """Return the user session for a client. The only difference with the :func:`socketio.Server.get_session` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ return s...
[ "def", "get_session", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "return", "self", ".", "server", ".", "get_session", "(", "sid", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace", ")" ]
Return the user session for a client. The only difference with the :func:`socketio.Server.get_session` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Return", "the", "user", "session", "for", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L103-L111
train
Return the user session for a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
Namespace.save_session
def save_session(self, sid, session, namespace=None): """Store the user session for a client. The only difference with the :func:`socketio.Server.save_session` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ ...
python
def save_session(self, sid, session, namespace=None): """Store the user session for a client. The only difference with the :func:`socketio.Server.save_session` method is that when the ``namespace`` argument is not given the namespace associated with the class is used. """ ...
[ "def", "save_session", "(", "self", ",", "sid", ",", "session", ",", "namespace", "=", "None", ")", ":", "return", "self", ".", "server", ".", "save_session", "(", "sid", ",", "session", ",", "namespace", "=", "namespace", "or", "self", ".", "namespace",...
Store the user session for a client. The only difference with the :func:`socketio.Server.save_session` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Store", "the", "user", "session", "for", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L113-L121
train
Store the user session for a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/namespace.py
ClientNamespace.send
def send(self, data, room=None, skip_sid=None, namespace=None, callback=None): """Send a message to the server. The only difference with the :func:`socketio.Client.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is u...
python
def send(self, data, room=None, skip_sid=None, namespace=None, callback=None): """Send a message to the server. The only difference with the :func:`socketio.Client.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is u...
[ "def", "send", "(", "self", ",", "data", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ")", ":", "return", "self", ".", "client", ".", "send", "(", "data", ",", "namespace", "="...
Send a message to the server. The only difference with the :func:`socketio.Client.send` method is that when the ``namespace`` argument is not given the namespace associated with the class is used.
[ "Send", "a", "message", "to", "the", "server", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/namespace.py#L173-L182
train
Send a message to the server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_manager.py
AsyncManager.emit
async def emit(self, event, data, namespace, room=None, skip_sid=None, callback=None, **kwargs): """Emit a message to a single client, a room, or all the clients connected to the namespace. Note: this method is a coroutine. """ if namespace not in self.rooms o...
python
async def emit(self, event, data, namespace, room=None, skip_sid=None, callback=None, **kwargs): """Emit a message to a single client, a room, or all the clients connected to the namespace. Note: this method is a coroutine. """ if namespace not in self.rooms o...
[ "async", "def", "emit", "(", "self", ",", "event", ",", "data", ",", "namespace", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "callback", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "namespace", "not", "in", "self", ".", ...
Emit a message to a single client, a room, or all the clients connected to the namespace. Note: this method is a coroutine.
[ "Emit", "a", "message", "to", "a", "single", "client", "a", "room", "or", "all", "the", "clients", "connected", "to", "the", "namespace", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_manager.py#L8-L28
train
Emit a message to a single client a room or all the clients that are connected to the namespace.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_manager.py
AsyncManager.trigger_callback
async def trigger_callback(self, sid, namespace, id, data): """Invoke an application callback. Note: this method is a coroutine. """ callback = None try: callback = self.callbacks[sid][namespace][id] except KeyError: # if we get an unknown callbac...
python
async def trigger_callback(self, sid, namespace, id, data): """Invoke an application callback. Note: this method is a coroutine. """ callback = None try: callback = self.callbacks[sid][namespace][id] except KeyError: # if we get an unknown callbac...
[ "async", "def", "trigger_callback", "(", "self", ",", "sid", ",", "namespace", ",", "id", ",", "data", ")", ":", "callback", "=", "None", "try", ":", "callback", "=", "self", ".", "callbacks", "[", "sid", "]", "[", "namespace", "]", "[", "id", "]", ...
Invoke an application callback. Note: this method is a coroutine.
[ "Invoke", "an", "application", "callback", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_manager.py#L37-L56
train
Invoke an application callback.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_server.py
AsyncServer.emit
async def emit(self, event, data=None, room=None, skip_sid=None, namespace=None, callback=None, **kwargs): """Emit a custom event to one or more connected clients. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` a...
python
async def emit(self, event, data=None, room=None, skip_sid=None, namespace=None, callback=None, **kwargs): """Emit a custom event to one or more connected clients. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` a...
[ "async", "def", "emit", "(", "self", ",", "event", ",", "data", "=", "None", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ",", "*", "*", "kwargs", ")", ":", "namespace", "=", ...
Emit a custom event to one or more connected clients. :param event: The event name. It can be any string. The event names ``'connect'``, ``'message'`` and ``'disconnect'`` are reserved and should not be used. :param data: The data to send to the client or cli...
[ "Emit", "a", "custom", "event", "to", "one", "or", "more", "connected", "clients", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L78-L119
train
Emit a custom event to one or more connected clients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_server.py
AsyncServer.send
async def send(self, data, room=None, skip_sid=None, namespace=None, callback=None, **kwargs): """Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The...
python
async def send(self, data, room=None, skip_sid=None, namespace=None, callback=None, **kwargs): """Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The...
[ "async", "def", "send", "(", "self", ",", "data", ",", "room", "=", "None", ",", "skip_sid", "=", "None", ",", "namespace", "=", "None", ",", "callback", "=", "None", ",", "*", "*", "kwargs", ")", ":", "await", "self", ".", "emit", "(", "'message'"...
Send a message to one or more connected clients. This function emits an event with the name ``'message'``. Use :func:`emit` to issue custom event names. :param data: The data to send to the client or clients. Data can be of type ``str``, ``bytes``, ``list`` or ``dict``. If...
[ "Send", "a", "message", "to", "one", "or", "more", "connected", "clients", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L121-L158
train
Send a message to one or more connected clients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_server.py
AsyncServer.close_room
async def close_room(self, room, namespace=None): """Close a room. This function removes all the clients from the given room. :param room: Room name. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is ...
python
async def close_room(self, room, namespace=None): """Close a room. This function removes all the clients from the given room. :param room: Room name. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is ...
[ "async", "def", "close_room", "(", "self", ",", "room", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "logger", ".", "info", "(", "'room %s is closing [%s]'", ",", "room", ",", "namespace", ")", "await", ...
Close a room. This function removes all the clients from the given room. :param room: Room name. :param namespace: The Socket.IO namespace for the event. If this argument is omitted the default namespace is used. Note: this method is a coroutine.
[ "Close", "a", "room", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L205-L218
train
Close a room.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_server.py
AsyncServer.disconnect
async def disconnect(self, sid, namespace=None): """Disconnect a client. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace to disconnect. If this argument is omitted the default namespace is used. Note: this method is a coroutine....
python
async def disconnect(self, sid, namespace=None): """Disconnect a client. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace to disconnect. If this argument is omitted the default namespace is used. Note: this method is a coroutine....
[ "async", "def", "disconnect", "(", "self", ",", "sid", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "namespace", "or", "'/'", "if", "self", ".", "manager", ".", "is_connected", "(", "sid", ",", "namespace", "=", "namespace", ")", ":", "se...
Disconnect a client. :param sid: Session ID of the client. :param namespace: The Socket.IO namespace to disconnect. If this argument is omitted the default namespace is used. Note: this method is a coroutine.
[ "Disconnect", "a", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L287-L303
train
Disconnect a client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_server.py
AsyncServer._handle_ack
async def _handle_ack(self, sid, namespace, id, data): """Handle ACK packets from the client.""" namespace = namespace or '/' self.logger.info('received ack from %s [%s]', sid, namespace) await self.manager.trigger_callback(sid, namespace, id, data)
python
async def _handle_ack(self, sid, namespace, id, data): """Handle ACK packets from the client.""" namespace = namespace or '/' self.logger.info('received ack from %s [%s]', sid, namespace) await self.manager.trigger_callback(sid, namespace, id, data)
[ "async", "def", "_handle_ack", "(", "self", ",", "sid", ",", "namespace", ",", "id", ",", "data", ")", ":", "namespace", "=", "namespace", "or", "'/'", "self", ".", "logger", ".", "info", "(", "'received ack from %s [%s]'", ",", "sid", ",", "namespace", ...
Handle ACK packets from the client.
[ "Handle", "ACK", "packets", "from", "the", "client", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L440-L444
train
Handle ACK packets from the client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
miguelgrinberg/python-socketio
socketio/asyncio_server.py
AsyncServer._trigger_event
async def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event if namespace in self.handlers and event in self.handlers[namespace]: if asyncio.iscoroutinefunction(self.handlers[namespace][ev...
python
async def _trigger_event(self, event, namespace, *args): """Invoke an application event handler.""" # first see if we have an explicit handler for the event if namespace in self.handlers and event in self.handlers[namespace]: if asyncio.iscoroutinefunction(self.handlers[namespace][ev...
[ "async", "def", "_trigger_event", "(", "self", ",", "event", ",", "namespace", ",", "*", "args", ")", ":", "# first see if we have an explicit handler for the event", "if", "namespace", "in", "self", ".", "handlers", "and", "event", "in", "self", ".", "handlers", ...
Invoke an application event handler.
[ "Invoke", "an", "application", "event", "handler", "." ]
c0c1bf8d21e3597389b18938550a0724dd9676b7
https://github.com/miguelgrinberg/python-socketio/blob/c0c1bf8d21e3597389b18938550a0724dd9676b7/socketio/asyncio_server.py#L446-L463
train
Invoke an application event handler.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pallets/flask-sqlalchemy
flask_sqlalchemy/model.py
should_set_tablename
def should_set_tablename(cls): """Determine whether ``__tablename__`` should be automatically generated for a model. * If no class in the MRO sets a name, one should be generated. * If a declared attr is found, it should be used instead. * If a name is found, it should be used if the class is a mix...
python
def should_set_tablename(cls): """Determine whether ``__tablename__`` should be automatically generated for a model. * If no class in the MRO sets a name, one should be generated. * If a declared attr is found, it should be used instead. * If a name is found, it should be used if the class is a mix...
[ "def", "should_set_tablename", "(", "cls", ")", ":", "if", "(", "cls", ".", "__dict__", ".", "get", "(", "'__abstract__'", ",", "False", ")", "or", "not", "any", "(", "isinstance", "(", "b", ",", "DeclarativeMeta", ")", "for", "b", "in", "cls", ".", ...
Determine whether ``__tablename__`` should be automatically generated for a model. * If no class in the MRO sets a name, one should be generated. * If a declared attr is found, it should be used instead. * If a name is found, it should be used if the class is a mixin, otherwise one should be gene...
[ "Determine", "whether", "__tablename__", "should", "be", "automatically", "generated", "for", "a", "model", "." ]
3d3261f4fc6d28f5bf407cf7d523e36a09a8c144
https://github.com/pallets/flask-sqlalchemy/blob/3d3261f4fc6d28f5bf407cf7d523e36a09a8c144/flask_sqlalchemy/model.py#L11-L44
train
Determine whether the name of the class cls is set.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
pallets/flask-sqlalchemy
examples/flaskr/flaskr/auth/views.py
login_required
def login_required(view): """View decorator that redirects anonymous users to the login page.""" @functools.wraps(view) def wrapped_view(**kwargs): if g.user is None: return redirect(url_for("auth.login")) return view(**kwargs) return wrapped_view
python
def login_required(view): """View decorator that redirects anonymous users to the login page.""" @functools.wraps(view) def wrapped_view(**kwargs): if g.user is None: return redirect(url_for("auth.login")) return view(**kwargs) return wrapped_view
[ "def", "login_required", "(", "view", ")", ":", "@", "functools", ".", "wraps", "(", "view", ")", "def", "wrapped_view", "(", "*", "*", "kwargs", ")", ":", "if", "g", ".", "user", "is", "None", ":", "return", "redirect", "(", "url_for", "(", "\"auth....
View decorator that redirects anonymous users to the login page.
[ "View", "decorator", "that", "redirects", "anonymous", "users", "to", "the", "login", "page", "." ]
3d3261f4fc6d28f5bf407cf7d523e36a09a8c144
https://github.com/pallets/flask-sqlalchemy/blob/3d3261f4fc6d28f5bf407cf7d523e36a09a8c144/examples/flaskr/flaskr/auth/views.py#L18-L28
train
View decorator that redirects anonymous users to the login page.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...