partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
_coeff4
a common internal function to some window functions with 4 coeffs For the blackmna harris for instance, the results are identical to octave if N is odd but not for even values...if n =0 whatever N is, the w(0) must be equal to a0-a1+a2-a3, which is the case here, but not in octave...
src/spectrum/window.py
def _coeff4(N, a0, a1, a2, a3): """a common internal function to some window functions with 4 coeffs For the blackmna harris for instance, the results are identical to octave if N is odd but not for even values...if n =0 whatever N is, the w(0) must be equal to a0-a1+a2-a3, which is the case here, but...
def _coeff4(N, a0, a1, a2, a3): """a common internal function to some window functions with 4 coeffs For the blackmna harris for instance, the results are identical to octave if N is odd but not for even values...if n =0 whatever N is, the w(0) must be equal to a0-a1+a2-a3, which is the case here, but...
[ "a", "common", "internal", "function", "to", "some", "window", "functions", "with", "4", "coeffs" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L879-L894
[ "def", "_coeff4", "(", "N", ",", "a0", ",", "a1", ",", "a2", ",", "a3", ")", ":", "if", "N", "==", "1", ":", "return", "ones", "(", "1", ")", "n", "=", "arange", "(", "0", ",", "N", ")", "N1", "=", "N", "-", "1.", "w", "=", "a0", "-", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_nuttall
r"""Nuttall tapering window :param N: window length .. math:: w(n) = a_0 - a_1 \cos\left(\frac{2\pi n}{N-1}\right)+ a_2 \cos\left(\frac{4\pi n}{N-1}\right)- a_3 \cos\left(\frac{6\pi n}{N-1}\right) with :math:`a_0 = 0.355768`, :math:`a_1 = 0.487396`, :math:`a_2=0.144232` and :math:`a_3=0.012604` .. p...
src/spectrum/window.py
def window_nuttall(N): r"""Nuttall tapering window :param N: window length .. math:: w(n) = a_0 - a_1 \cos\left(\frac{2\pi n}{N-1}\right)+ a_2 \cos\left(\frac{4\pi n}{N-1}\right)- a_3 \cos\left(\frac{6\pi n}{N-1}\right) with :math:`a_0 = 0.355768`, :math:`a_1 = 0.487396`, :math:`a_2=0.144232` and :ma...
def window_nuttall(N): r"""Nuttall tapering window :param N: window length .. math:: w(n) = a_0 - a_1 \cos\left(\frac{2\pi n}{N-1}\right)+ a_2 \cos\left(\frac{4\pi n}{N-1}\right)- a_3 \cos\left(\frac{6\pi n}{N-1}\right) with :math:`a_0 = 0.355768`, :math:`a_1 = 0.487396`, :math:`a_2=0.144232` and :ma...
[ "r", "Nuttall", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L896-L920
[ "def", "window_nuttall", "(", "N", ")", ":", "a0", "=", "0.355768", "a1", "=", "0.487396", "a2", "=", "0.144232", "a3", "=", "0.012604", "return", "_coeff4", "(", "N", ",", "a0", ",", "a1", ",", "a2", ",", "a3", ")" ]
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_blackman_nuttall
r"""Blackman Nuttall window returns a minimum, 4-term Blackman-Harris window. The window is minimum in the sense that its maximum sidelobes are minimized. The coefficients for this window differ from the Blackman-Harris window coefficients and produce slightly lower sidelobes. :param N: window length ...
src/spectrum/window.py
def window_blackman_nuttall(N): r"""Blackman Nuttall window returns a minimum, 4-term Blackman-Harris window. The window is minimum in the sense that its maximum sidelobes are minimized. The coefficients for this window differ from the Blackman-Harris window coefficients and produce slightly lower sidelobe...
def window_blackman_nuttall(N): r"""Blackman Nuttall window returns a minimum, 4-term Blackman-Harris window. The window is minimum in the sense that its maximum sidelobes are minimized. The coefficients for this window differ from the Blackman-Harris window coefficients and produce slightly lower sidelobe...
[ "r", "Blackman", "Nuttall", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L923-L950
[ "def", "window_blackman_nuttall", "(", "N", ")", ":", "a0", "=", "0.3635819", "a1", "=", "0.4891775", "a2", "=", "0.1365995", "a3", "=", "0.0106411", "return", "_coeff4", "(", "N", ",", "a0", ",", "a1", ",", "a2", ",", "a3", ")" ]
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_blackman_harris
r"""Blackman Harris window :param N: window length .. math:: w(n) = a_0 - a_1 \cos\left(\frac{2\pi n}{N-1}\right)+ a_2 \cos\left(\frac{4\pi n}{N-1}\right)- a_3 \cos\left(\frac{6\pi n}{N-1}\right) =============== ========= coeff value =============== ========= :math:`a_0` 0.3587...
src/spectrum/window.py
def window_blackman_harris(N): r"""Blackman Harris window :param N: window length .. math:: w(n) = a_0 - a_1 \cos\left(\frac{2\pi n}{N-1}\right)+ a_2 \cos\left(\frac{4\pi n}{N-1}\right)- a_3 \cos\left(\frac{6\pi n}{N-1}\right) =============== ========= coeff value =============== =...
def window_blackman_harris(N): r"""Blackman Harris window :param N: window length .. math:: w(n) = a_0 - a_1 \cos\left(\frac{2\pi n}{N-1}\right)+ a_2 \cos\left(\frac{4\pi n}{N-1}\right)- a_3 \cos\left(\frac{6\pi n}{N-1}\right) =============== ========= coeff value =============== =...
[ "r", "Blackman", "Harris", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L953-L983
[ "def", "window_blackman_harris", "(", "N", ")", ":", "a0", "=", "0.35875", "a1", "=", "0.48829", "a2", "=", "0.14128", "a3", "=", "0.01168", "return", "_coeff4", "(", "N", ",", "a0", ",", "a1", ",", "a2", ",", "a3", ")" ]
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_bohman
r"""Bohman tapering window :param N: window length .. math:: w(n) = (1-|x|) \cos (\pi |x|) + \frac{1}{\pi} \sin(\pi |x|) where x is a length N vector of linearly spaced values between -1 and 1. .. plot:: :width: 80% :include-source: from spectrum import window_visu ...
src/spectrum/window.py
def window_bohman(N): r"""Bohman tapering window :param N: window length .. math:: w(n) = (1-|x|) \cos (\pi |x|) + \frac{1}{\pi} \sin(\pi |x|) where x is a length N vector of linearly spaced values between -1 and 1. .. plot:: :width: 80% :include-source: from spectru...
def window_bohman(N): r"""Bohman tapering window :param N: window length .. math:: w(n) = (1-|x|) \cos (\pi |x|) + \frac{1}{\pi} \sin(\pi |x|) where x is a length N vector of linearly spaced values between -1 and 1. .. plot:: :width: 80% :include-source: from spectru...
[ "r", "Bohman", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L986-L1007
[ "def", "window_bohman", "(", "N", ")", ":", "x", "=", "linspace", "(", "-", "1", ",", "1", ",", "N", ")", "w", "=", "(", "1.", "-", "abs", "(", "x", ")", ")", "*", "cos", "(", "pi", "*", "abs", "(", "x", ")", ")", "+", "1.", "/", "pi", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_tukey
Tukey tapering window (or cosine-tapered window) :param N: window length :param r: defines the ratio between the constant section and the cosine section. It has to be between 0 and 1. The function returns a Hanning window for `r=0` and a full box for `r=1`. .. plot:: :width: 80% ...
src/spectrum/window.py
def window_tukey(N, r=0.5): """Tukey tapering window (or cosine-tapered window) :param N: window length :param r: defines the ratio between the constant section and the cosine section. It has to be between 0 and 1. The function returns a Hanning window for `r=0` and a full box for `r=1`. .....
def window_tukey(N, r=0.5): """Tukey tapering window (or cosine-tapered window) :param N: window length :param r: defines the ratio between the constant section and the cosine section. It has to be between 0 and 1. The function returns a Hanning window for `r=0` and a full box for `r=1`. .....
[ "Tukey", "tapering", "window", "(", "or", "cosine", "-", "tapered", "window", ")" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1011-L1053
[ "def", "window_tukey", "(", "N", ",", "r", "=", "0.5", ")", ":", "assert", "r", ">=", "0", "and", "r", "<=", "1", ",", "\"r must be in [0,1]\"", "if", "N", "==", "1", ":", "return", "ones", "(", "1", ")", "if", "r", "==", "0", ":", "return", "o...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_parzen
r"""Parsen tapering window (also known as de la Valle-Poussin) :param N: window length Parzen windows are piecewise cubic approximations of Gaussian windows. Parzen window sidelobes fall off as :math:`1/\omega^4`. if :math:`0\leq|x|\leq (N-1)/4`: .. math:: w(n) = 1-6 \left( \frac{|n|}{N/2} \righ...
src/spectrum/window.py
def window_parzen(N): r"""Parsen tapering window (also known as de la Valle-Poussin) :param N: window length Parzen windows are piecewise cubic approximations of Gaussian windows. Parzen window sidelobes fall off as :math:`1/\omega^4`. if :math:`0\leq|x|\leq (N-1)/4`: .. math:: w(n) = 1-6 \l...
def window_parzen(N): r"""Parsen tapering window (also known as de la Valle-Poussin) :param N: window length Parzen windows are piecewise cubic approximations of Gaussian windows. Parzen window sidelobes fall off as :math:`1/\omega^4`. if :math:`0\leq|x|\leq (N-1)/4`: .. math:: w(n) = 1-6 \l...
[ "r", "Parsen", "tapering", "window", "(", "also", "known", "as", "de", "la", "Valle", "-", "Poussin", ")" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1056-L1096
[ "def", "window_parzen", "(", "N", ")", ":", "from", "numpy", "import", "where", ",", "concatenate", "n", "=", "linspace", "(", "-", "(", "N", "-", "1", ")", "/", "2.", ",", "(", "N", "-", "1", ")", "/", "2.", ",", "N", ")", "n1", "=", "n", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_flattop
r"""Flat-top tapering window Returns symmetric or periodic flat top window. :param N: window length :param mode: way the data are normalised. If mode is *symmetric*, then divide n by N-1. IF mode is *periodic*, divide by N, to be consistent with octave code. When using windows for fil...
src/spectrum/window.py
def window_flattop(N, mode='symmetric',precision=None): r"""Flat-top tapering window Returns symmetric or periodic flat top window. :param N: window length :param mode: way the data are normalised. If mode is *symmetric*, then divide n by N-1. IF mode is *periodic*, divide by N, to be ...
def window_flattop(N, mode='symmetric',precision=None): r"""Flat-top tapering window Returns symmetric or periodic flat top window. :param N: window length :param mode: way the data are normalised. If mode is *symmetric*, then divide n by N-1. IF mode is *periodic*, divide by N, to be ...
[ "r", "Flat", "-", "top", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1099-L1165
[ "def", "window_flattop", "(", "N", ",", "mode", "=", "'symmetric'", ",", "precision", "=", "None", ")", ":", "assert", "mode", "in", "[", "'periodic'", ",", "'symmetric'", "]", "t", "=", "arange", "(", "0", ",", "N", ")", "# FIXME: N=1 for mode = periodic ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_taylor
Taylor tapering window Taylor windows allows you to make tradeoffs between the mainlobe width and sidelobe level (sll). Implemented as described by Carrara, Goodman, and Majewski in 'Spotlight Synthetic Aperture Radar: Signal Processing Algorithms' Pages 512-513 :param N: window length :...
src/spectrum/window.py
def window_taylor(N, nbar=4, sll=-30): """Taylor tapering window Taylor windows allows you to make tradeoffs between the mainlobe width and sidelobe level (sll). Implemented as described by Carrara, Goodman, and Majewski in 'Spotlight Synthetic Aperture Radar: Signal Processing Algorithms' Pa...
def window_taylor(N, nbar=4, sll=-30): """Taylor tapering window Taylor windows allows you to make tradeoffs between the mainlobe width and sidelobe level (sll). Implemented as described by Carrara, Goodman, and Majewski in 'Spotlight Synthetic Aperture Radar: Signal Processing Algorithms' Pa...
[ "Taylor", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1168-L1204
[ "def", "window_taylor", "(", "N", ",", "nbar", "=", "4", ",", "sll", "=", "-", "30", ")", ":", "B", "=", "10", "**", "(", "-", "sll", "/", "20", ")", "A", "=", "log", "(", "B", "+", "sqrt", "(", "B", "**", "2", "-", "1", ")", ")", "/", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_riesz
r"""Riesz tapering window :param N: window length .. math:: w(n) = 1 - \left| \frac{n}{N/2} \right|^2 with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'riesz') .. seealso:: :func:`create_...
src/spectrum/window.py
def window_riesz(N): r"""Riesz tapering window :param N: window length .. math:: w(n) = 1 - \left| \frac{n}{N/2} \right|^2 with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'riesz') .....
def window_riesz(N): r"""Riesz tapering window :param N: window length .. math:: w(n) = 1 - \left| \frac{n}{N/2} \right|^2 with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'riesz') .....
[ "r", "Riesz", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1206-L1227
[ "def", "window_riesz", "(", "N", ")", ":", "n", "=", "linspace", "(", "-", "N", "/", "2.", ",", "(", "N", ")", "/", "2.", ",", "N", ")", "w", "=", "1", "-", "abs", "(", "n", "/", "(", "N", "/", "2.", ")", ")", "**", "2.", "return", "w" ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_riemann
r"""Riemann tapering window :param int N: window length .. math:: w(n) = 1 - \left| \frac{n}{N/2} \right|^2 with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'riesz') .. seealso:: :func:`c...
src/spectrum/window.py
def window_riemann(N): r"""Riemann tapering window :param int N: window length .. math:: w(n) = 1 - \left| \frac{n}{N/2} \right|^2 with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'riesz')...
def window_riemann(N): r"""Riemann tapering window :param int N: window length .. math:: w(n) = 1 - \left| \frac{n}{N/2} \right|^2 with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'riesz')...
[ "r", "Riemann", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1230-L1250
[ "def", "window_riemann", "(", "N", ")", ":", "n", "=", "linspace", "(", "-", "N", "/", "2.", ",", "(", "N", ")", "/", "2.", ",", "N", ")", "w", "=", "sin", "(", "n", "/", "float", "(", "N", ")", "*", "2.", "*", "pi", ")", "/", "(", "n",...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_poisson
r"""Poisson tapering window :param int N: window length .. math:: w(n) = \exp^{-\alpha \frac{|n|}{N/2} } with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'poisson') window_visu(64, 'poi...
src/spectrum/window.py
def window_poisson(N, alpha=2): r"""Poisson tapering window :param int N: window length .. math:: w(n) = \exp^{-\alpha \frac{|n|}{N/2} } with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'po...
def window_poisson(N, alpha=2): r"""Poisson tapering window :param int N: window length .. math:: w(n) = \exp^{-\alpha \frac{|n|}{N/2} } with :math:`-N/2 \leq n \leq N/2`. .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'po...
[ "r", "Poisson", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1254-L1276
[ "def", "window_poisson", "(", "N", ",", "alpha", "=", "2", ")", ":", "n", "=", "linspace", "(", "-", "N", "/", "2.", ",", "(", "N", ")", "/", "2.", ",", "N", ")", "w", "=", "exp", "(", "-", "alpha", "*", "abs", "(", "n", ")", "/", "(", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_poisson_hanning
r"""Hann-Poisson tapering window This window is constructed as the product of the Hanning and Poisson windows. The parameter **alpha** is the Poisson parameter. :param int N: window length :param float alpha: parameter of the poisson window .. plot:: :width: 80% :include-source: ...
src/spectrum/window.py
def window_poisson_hanning(N, alpha=2): r"""Hann-Poisson tapering window This window is constructed as the product of the Hanning and Poisson windows. The parameter **alpha** is the Poisson parameter. :param int N: window length :param float alpha: parameter of the poisson window .. plot:: ...
def window_poisson_hanning(N, alpha=2): r"""Hann-Poisson tapering window This window is constructed as the product of the Hanning and Poisson windows. The parameter **alpha** is the Poisson parameter. :param int N: window length :param float alpha: parameter of the poisson window .. plot:: ...
[ "r", "Hann", "-", "Poisson", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1279-L1301
[ "def", "window_poisson_hanning", "(", "N", ",", "alpha", "=", "2", ")", ":", "w1", "=", "window_hann", "(", "N", ")", "w2", "=", "window_poisson", "(", "N", ",", "alpha", "=", "alpha", ")", "return", "w1", "*", "w2" ]
bad6c32e3f10e185098748f67bb421b378b06afe
valid
window_cauchy
r"""Cauchy tapering window :param int N: window length :param float alpha: parameter of the poisson window .. math:: w(n) = \frac{1}{1+\left(\frac{\alpha*n}{N/2}\right)**2} .. plot:: :width: 80% :include-source: from spectrum import window_visu window_visu(64, 'cauchy...
src/spectrum/window.py
def window_cauchy(N, alpha=3): r"""Cauchy tapering window :param int N: window length :param float alpha: parameter of the poisson window .. math:: w(n) = \frac{1}{1+\left(\frac{\alpha*n}{N/2}\right)**2} .. plot:: :width: 80% :include-source: from spectrum import window_v...
def window_cauchy(N, alpha=3): r"""Cauchy tapering window :param int N: window length :param float alpha: parameter of the poisson window .. math:: w(n) = \frac{1}{1+\left(\frac{\alpha*n}{N/2}\right)**2} .. plot:: :width: 80% :include-source: from spectrum import window_v...
[ "r", "Cauchy", "tapering", "window" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L1304-L1326
[ "def", "window_cauchy", "(", "N", ",", "alpha", "=", "3", ")", ":", "n", "=", "linspace", "(", "-", "N", "/", "2.", ",", "(", "N", ")", "/", "2.", ",", "N", ")", "w", "=", "1.", "/", "(", "1.", "+", "(", "alpha", "*", "n", "/", "(", "N"...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
Window.compute_response
Compute the window data frequency response :param norm: True by default. normalised the frequency data. :param int NFFT: total length of the final data sets( 2048 by default. if less than data length, then NFFT is set to the data length*2). The response is stored in :attr:`respons...
src/spectrum/window.py
def compute_response(self, **kargs): """Compute the window data frequency response :param norm: True by default. normalised the frequency data. :param int NFFT: total length of the final data sets( 2048 by default. if less than data length, then NFFT is set to the data length*2). ...
def compute_response(self, **kargs): """Compute the window data frequency response :param norm: True by default. normalised the frequency data. :param int NFFT: total length of the final data sets( 2048 by default. if less than data length, then NFFT is set to the data length*2). ...
[ "Compute", "the", "window", "data", "frequency", "response" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L194-L226
[ "def", "compute_response", "(", "self", ",", "*", "*", "kargs", ")", ":", "from", "numpy", ".", "fft", "import", "fft", ",", "fftshift", "norm", "=", "kargs", ".", "get", "(", "'norm'", ",", "self", ".", "norm", ")", "# do some padding. Default is max(2048...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
Window.plot_frequencies
Plot the window in the frequency domain :param mindB: change the default lower y bound :param maxdB: change the default upper lower bound :param bool norm: if True, normalise the frequency response. .. plot:: :width: 80% :include-source: from spectr...
src/spectrum/window.py
def plot_frequencies(self, mindB=None, maxdB=None, norm=True): """Plot the window in the frequency domain :param mindB: change the default lower y bound :param maxdB: change the default upper lower bound :param bool norm: if True, normalise the frequency response. .. plot:: ...
def plot_frequencies(self, mindB=None, maxdB=None, norm=True): """Plot the window in the frequency domain :param mindB: change the default lower y bound :param maxdB: change the default upper lower bound :param bool norm: if True, normalise the frequency response. .. plot:: ...
[ "Plot", "the", "window", "in", "the", "frequency", "domain" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L228-L264
[ "def", "plot_frequencies", "(", "self", ",", "mindB", "=", "None", ",", "maxdB", "=", "None", ",", "norm", "=", "True", ")", ":", "from", "pylab", "import", "plot", ",", "title", ",", "xlim", ",", "grid", ",", "ylim", ",", "xlabel", ",", "ylabel", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
Window.plot_window
Plot the window in the time domain .. plot:: :width: 80% :include-source: from spectrum.window import Window w = Window(64, name='hamming') w.plot_window()
src/spectrum/window.py
def plot_window(self): """Plot the window in the time domain .. plot:: :width: 80% :include-source: from spectrum.window import Window w = Window(64, name='hamming') w.plot_window() """ from pylab import plot, xlim, grid, tit...
def plot_window(self): """Plot the window in the time domain .. plot:: :width: 80% :include-source: from spectrum.window import Window w = Window(64, name='hamming') w.plot_window() """ from pylab import plot, xlim, grid, tit...
[ "Plot", "the", "window", "in", "the", "time", "domain" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L266-L285
[ "def", "plot_window", "(", "self", ")", ":", "from", "pylab", "import", "plot", ",", "xlim", ",", "grid", ",", "title", ",", "ylabel", ",", "axis", "x", "=", "linspace", "(", "0", ",", "1", ",", "self", ".", "N", ")", "xlim", "(", "0", ",", "1"...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
Window.plot_time_freq
Plotting method to plot both time and frequency domain results. See :meth:`plot_frequencies` for the optional arguments. .. plot:: :width: 80% :include-source: from spectrum.window import Window w = Window(64, name='hamming') w.plot_time_fre...
src/spectrum/window.py
def plot_time_freq(self, mindB=-100, maxdB=None, norm=True, yaxis_label_position="right"): """Plotting method to plot both time and frequency domain results. See :meth:`plot_frequencies` for the optional arguments. .. plot:: :width: 80% :include-source: ...
def plot_time_freq(self, mindB=-100, maxdB=None, norm=True, yaxis_label_position="right"): """Plotting method to plot both time and frequency domain results. See :meth:`plot_frequencies` for the optional arguments. .. plot:: :width: 80% :include-source: ...
[ "Plotting", "method", "to", "plot", "both", "time", "and", "frequency", "domain", "results", "." ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/window.py#L287-L315
[ "def", "plot_time_freq", "(", "self", ",", "mindB", "=", "-", "100", ",", "maxdB", "=", "None", ",", "norm", "=", "True", ",", "yaxis_label_position", "=", "\"right\"", ")", ":", "from", "pylab", "import", "subplot", ",", "gca", "subplot", "(", "1", ",...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
TOEPLITZ
solve the general toeplitz linear equations Solve TX=Z :param T0: zero lag value :param TC: r1 to rN :param TR: r1 to rN returns X requires 3M^2+M operations instead of M^3 with gaussian elimination .. warning:: not used right now
src/spectrum/toeplitz.py
def TOEPLITZ(T0, TC, TR, Z): """solve the general toeplitz linear equations Solve TX=Z :param T0: zero lag value :param TC: r1 to rN :param TR: r1 to rN returns X requires 3M^2+M operations instead of M^3 with gaussian elimination .. warning:: not used right now """ ...
def TOEPLITZ(T0, TC, TR, Z): """solve the general toeplitz linear equations Solve TX=Z :param T0: zero lag value :param TC: r1 to rN :param TR: r1 to rN returns X requires 3M^2+M operations instead of M^3 with gaussian elimination .. warning:: not used right now """ ...
[ "solve", "the", "general", "toeplitz", "linear", "equations" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/toeplitz.py#L21-L81
[ "def", "TOEPLITZ", "(", "T0", ",", "TC", ",", "TR", ",", "Z", ")", ":", "assert", "len", "(", "TC", ")", ">", "0", "assert", "len", "(", "TC", ")", "==", "len", "(", "TR", ")", "M", "=", "len", "(", "TC", ")", "X", "=", "numpy", ".", "zer...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
HERMTOEP
solve Tx=Z by a variation of Levinson algorithm where T is a complex hermitian toeplitz matrix :param T0: zero lag value :param T: r1 to rN :return: X used by eigen PSD method
src/spectrum/toeplitz.py
def HERMTOEP(T0, T, Z): """solve Tx=Z by a variation of Levinson algorithm where T is a complex hermitian toeplitz matrix :param T0: zero lag value :param T: r1 to rN :return: X used by eigen PSD method """ assert len(T)>0 M = len(T) X = numpy.zeros(M+1,dtype=complex...
def HERMTOEP(T0, T, Z): """solve Tx=Z by a variation of Levinson algorithm where T is a complex hermitian toeplitz matrix :param T0: zero lag value :param T: r1 to rN :return: X used by eigen PSD method """ assert len(T)>0 M = len(T) X = numpy.zeros(M+1,dtype=complex...
[ "solve", "Tx", "=", "Z", "by", "a", "variation", "of", "Levinson", "algorithm", "where", "T", "is", "a", "complex", "hermitian", "toeplitz", "matrix" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/toeplitz.py#L84-L134
[ "def", "HERMTOEP", "(", "T0", ",", "T", ",", "Z", ")", ":", "assert", "len", "(", "T", ")", ">", "0", "M", "=", "len", "(", "T", ")", "X", "=", "numpy", ".", "zeros", "(", "M", "+", "1", ",", "dtype", "=", "complex", ")", "A", "=", "numpy...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
get_short_module_name
Get the shortest possible module name
doc/sphinxext/sphinx_gallery/backreferences.py
def get_short_module_name(module_name, obj_name): """ Get the shortest possible module name """ parts = module_name.split('.') short_name = module_name for i in range(len(parts) - 1, 0, -1): short_name = '.'.join(parts[:i]) try: exec('from %s import %s' % (short_name, obj_nam...
def get_short_module_name(module_name, obj_name): """ Get the shortest possible module name """ parts = module_name.split('.') short_name = module_name for i in range(len(parts) - 1, 0, -1): short_name = '.'.join(parts[:i]) try: exec('from %s import %s' % (short_name, obj_nam...
[ "Get", "the", "shortest", "possible", "module", "name" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/backreferences.py#L70-L82
[ "def", "get_short_module_name", "(", "module_name", ",", "obj_name", ")", ":", "parts", "=", "module_name", ".", "split", "(", "'.'", ")", "short_name", "=", "module_name", "for", "i", "in", "range", "(", "len", "(", "parts", ")", "-", "1", ",", "0", "...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
identify_names
Builds a codeobj summary by identifying and resolving used names >>> code = ''' ... from a.b import c ... import d as e ... print(c) ... e.HelloWorld().f.g ... ''' >>> for name, o in sorted(identify_names(code).items()): ... print(name, o['name'], o['module'], o['module_short']) ...
doc/sphinxext/sphinx_gallery/backreferences.py
def identify_names(code): """Builds a codeobj summary by identifying and resolving used names >>> code = ''' ... from a.b import c ... import d as e ... print(c) ... e.HelloWorld().f.g ... ''' >>> for name, o in sorted(identify_names(code).items()): ... print(name, o['name'], o[...
def identify_names(code): """Builds a codeobj summary by identifying and resolving used names >>> code = ''' ... from a.b import c ... import d as e ... print(c) ... e.HelloWorld().f.g ... ''' >>> for name, o in sorted(identify_names(code).items()): ... print(name, o['name'], o[...
[ "Builds", "a", "codeobj", "summary", "by", "identifying", "and", "resolving", "used", "names" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/backreferences.py#L85-L112
[ "def", "identify_names", "(", "code", ")", ":", "finder", "=", "NameFinder", "(", ")", "finder", ".", "visit", "(", "ast", ".", "parse", "(", "code", ")", ")", "example_code_obj", "=", "{", "}", "for", "name", ",", "full_name", "in", "finder", ".", "...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
_thumbnail_div
Generates RST to place a thumbnail in a gallery
doc/sphinxext/sphinx_gallery/backreferences.py
def _thumbnail_div(full_dir, fname, snippet, is_backref=False): """Generates RST to place a thumbnail in a gallery""" thumb = os.path.join(full_dir, 'images', 'thumb', 'sphx_glr_%s_thumb.png' % fname[:-3]) ref_name = os.path.join(full_dir, fname).replace(os.path.sep, '_') templ...
def _thumbnail_div(full_dir, fname, snippet, is_backref=False): """Generates RST to place a thumbnail in a gallery""" thumb = os.path.join(full_dir, 'images', 'thumb', 'sphx_glr_%s_thumb.png' % fname[:-3]) ref_name = os.path.join(full_dir, fname).replace(os.path.sep, '_') templ...
[ "Generates", "RST", "to", "place", "a", "thumbnail", "in", "a", "gallery" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/doc/sphinxext/sphinx_gallery/backreferences.py#L153-L160
[ "def", "_thumbnail_div", "(", "full_dir", ",", "fname", ",", "snippet", ",", "is_backref", "=", "False", ")", ":", "thumb", "=", "os", ".", "path", ".", "join", "(", "full_dir", ",", "'images'", ",", "'thumb'", ",", "'sphx_glr_%s_thumb.png'", "%", "fname",...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
modcovar_marple
Fast algorithm for the solution of the modified covariance least squares normal equations. This implementation is based on [Marple]_. This code is far more complicated and slower than :func:`modcovar` function, which is now the official version. See :func:`modcovar` for a detailed description of Modified C...
src/spectrum/modcovar.py
def modcovar_marple (X,IP): """Fast algorithm for the solution of the modified covariance least squares normal equations. This implementation is based on [Marple]_. This code is far more complicated and slower than :func:`modcovar` function, which is now the official version. See :func:`modcovar` for a...
def modcovar_marple (X,IP): """Fast algorithm for the solution of the modified covariance least squares normal equations. This implementation is based on [Marple]_. This code is far more complicated and slower than :func:`modcovar` function, which is now the official version. See :func:`modcovar` for a...
[ "Fast", "algorithm", "for", "the", "solution", "of", "the", "modified", "covariance", "least", "squares", "normal", "equations", "." ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/modcovar.py#L13-L215
[ "def", "modcovar_marple", "(", "X", ",", "IP", ")", ":", "Pv", "=", "[", "]", "N", "=", "len", "(", "X", ")", "A", "=", "np", ".", "zeros", "(", "N", ",", "dtype", "=", "complex", ")", "D", "=", "np", ".", "zeros", "(", "N", ",", "dtype", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
modcovar
Simple and fast implementation of the covariance AR estimate This code is 10 times faster than :func:`modcovar_marple` and more importantly only 10 lines of code, compared to a 200 loc for :func:`modcovar_marple` :param X: Array of complex data samples :param int order: Order of linear predic...
src/spectrum/modcovar.py
def modcovar(x, order): """Simple and fast implementation of the covariance AR estimate This code is 10 times faster than :func:`modcovar_marple` and more importantly only 10 lines of code, compared to a 200 loc for :func:`modcovar_marple` :param X: Array of complex data samples :param int ...
def modcovar(x, order): """Simple and fast implementation of the covariance AR estimate This code is 10 times faster than :func:`modcovar_marple` and more importantly only 10 lines of code, compared to a 200 loc for :func:`modcovar_marple` :param X: Array of complex data samples :param int ...
[ "Simple", "and", "fast", "implementation", "of", "the", "covariance", "AR", "estimate" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/modcovar.py#L218-L271
[ "def", "modcovar", "(", "x", ",", "order", ")", ":", "from", "spectrum", "import", "corrmtx", "import", "scipy", ".", "linalg", "X", "=", "corrmtx", "(", "x", ",", "order", ",", "'modified'", ")", "Xc", "=", "np", ".", "matrix", "(", "X", "[", ":",...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
aryule
r"""Compute AR coefficients using Yule-Walker method :param X: Array of complex data values, X(1) to X(N) :param int order: Order of autoregressive process to be fitted (integer) :param str norm: Use a biased or unbiased correlation. :param bool allow_singularity: :return: * AR coefficient...
src/spectrum/yulewalker.py
def aryule(X, order, norm='biased', allow_singularity=True): r"""Compute AR coefficients using Yule-Walker method :param X: Array of complex data values, X(1) to X(N) :param int order: Order of autoregressive process to be fitted (integer) :param str norm: Use a biased or unbiased correlation. :par...
def aryule(X, order, norm='biased', allow_singularity=True): r"""Compute AR coefficients using Yule-Walker method :param X: Array of complex data values, X(1) to X(N) :param int order: Order of autoregressive process to be fitted (integer) :param str norm: Use a biased or unbiased correlation. :par...
[ "r", "Compute", "AR", "coefficients", "using", "Yule", "-", "Walker", "method" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/yulewalker.py#L23-L116
[ "def", "aryule", "(", "X", ",", "order", ",", "norm", "=", "'biased'", ",", "allow_singularity", "=", "True", ")", ":", "assert", "norm", "in", "[", "'biased'", ",", "'unbiased'", "]", "r", "=", "CORRELATION", "(", "X", ",", "maxlags", "=", "order", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
LEVINSON
r"""Levinson-Durbin recursion. Find the coefficients of a length(r)-1 order autoregressive linear process :param r: autocorrelation sequence of length N + 1 (first element being the zero-lag autocorrelation) :param order: requested order of the autoregressive coefficients. default is N. :param allow_s...
src/spectrum/levinson.py
def LEVINSON(r, order=None, allow_singularity=False): r"""Levinson-Durbin recursion. Find the coefficients of a length(r)-1 order autoregressive linear process :param r: autocorrelation sequence of length N + 1 (first element being the zero-lag autocorrelation) :param order: requested order of the aut...
def LEVINSON(r, order=None, allow_singularity=False): r"""Levinson-Durbin recursion. Find the coefficients of a length(r)-1 order autoregressive linear process :param r: autocorrelation sequence of length N + 1 (first element being the zero-lag autocorrelation) :param order: requested order of the aut...
[ "r", "Levinson", "-", "Durbin", "recursion", "." ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/levinson.py#L16-L137
[ "def", "LEVINSON", "(", "r", ",", "order", "=", "None", ",", "allow_singularity", "=", "False", ")", ":", "#from numpy import isrealobj", "T0", "=", "numpy", ".", "real", "(", "r", "[", "0", "]", ")", "T", "=", "r", "[", "1", ":", "]", "M", "=", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
rlevinson
computes the autocorrelation coefficients, R based on the prediction polynomial A and the final prediction error Efinal, using the stepdown algorithm. Works for real or complex data :param a: :param efinal: :return: * R, the autocorrelation * U prediction coefficient ...
src/spectrum/levinson.py
def rlevinson(a, efinal): """computes the autocorrelation coefficients, R based on the prediction polynomial A and the final prediction error Efinal, using the stepdown algorithm. Works for real or complex data :param a: :param efinal: :return: * R, the autocorrelation * U...
def rlevinson(a, efinal): """computes the autocorrelation coefficients, R based on the prediction polynomial A and the final prediction error Efinal, using the stepdown algorithm. Works for real or complex data :param a: :param efinal: :return: * R, the autocorrelation * U...
[ "computes", "the", "autocorrelation", "coefficients", "R", "based", "on", "the", "prediction", "polynomial", "A", "and", "the", "final", "prediction", "error", "Efinal", "using", "the", "stepdown", "algorithm", "." ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/levinson.py#L140-L239
[ "def", "rlevinson", "(", "a", ",", "efinal", ")", ":", "a", "=", "numpy", ".", "array", "(", "a", ")", "realdata", "=", "numpy", ".", "isrealobj", "(", "a", ")", "assert", "a", "[", "0", "]", "==", "1", ",", "'First coefficient of the prediction polyno...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
levdown
One step backward Levinson recursion :param anxt: :param enxt: :return: * acur the P'th order prediction polynomial based on the P+1'th order prediction polynomial, anxt. * ecur the the P'th order prediction error based on the P+1'th order prediction error, enxt. .. * knxt the P+1'th...
src/spectrum/levinson.py
def levdown(anxt, enxt=None): """One step backward Levinson recursion :param anxt: :param enxt: :return: * acur the P'th order prediction polynomial based on the P+1'th order prediction polynomial, anxt. * ecur the the P'th order prediction error based on the P+1'th order prediction er...
def levdown(anxt, enxt=None): """One step backward Levinson recursion :param anxt: :param enxt: :return: * acur the P'th order prediction polynomial based on the P+1'th order prediction polynomial, anxt. * ecur the the P'th order prediction error based on the P+1'th order prediction er...
[ "One", "step", "backward", "Levinson", "recursion" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/levinson.py#L242-L275
[ "def", "levdown", "(", "anxt", ",", "enxt", "=", "None", ")", ":", "#% Some preliminaries first", "#if nargout>=2 & nargin<2", "# raise ValueError('Insufficient number of input arguments');", "if", "anxt", "[", "0", "]", "!=", "1", ":", "raise", "ValueError", "(", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
levup
LEVUP One step forward Levinson recursion :param acur: :param knxt: :return: * anxt the P+1'th order prediction polynomial based on the P'th order prediction polynomial, acur, and the P+1'th order reflection coefficient, Knxt. * enxt the P+1'th order prediction prediction error,...
src/spectrum/levinson.py
def levup(acur, knxt, ecur=None): """LEVUP One step forward Levinson recursion :param acur: :param knxt: :return: * anxt the P+1'th order prediction polynomial based on the P'th order prediction polynomial, acur, and the P+1'th order reflection coefficient, Knxt. * enxt the P...
def levup(acur, knxt, ecur=None): """LEVUP One step forward Levinson recursion :param acur: :param knxt: :return: * anxt the P+1'th order prediction polynomial based on the P'th order prediction polynomial, acur, and the P+1'th order reflection coefficient, Knxt. * enxt the P...
[ "LEVUP", "One", "step", "forward", "Levinson", "recursion" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/levinson.py#L278-L305
[ "def", "levup", "(", "acur", ",", "knxt", ",", "ecur", "=", "None", ")", ":", "if", "acur", "[", "0", "]", "!=", "1", ":", "raise", "ValueError", "(", "'At least one of the reflection coefficients is equal to one.'", ")", "acur", "=", "acur", "[", "1", ":"...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
arcovar_marple
r"""Estimate AR model parameters using covariance method This implementation is based on [Marple]_. This code is far more complicated and slower than :func:`arcovar` function, which is now the official version. See :func:`arcovar` for a detailed description of Covariance method. This function should b...
src/spectrum/covar.py
def arcovar_marple(x, order): r"""Estimate AR model parameters using covariance method This implementation is based on [Marple]_. This code is far more complicated and slower than :func:`arcovar` function, which is now the official version. See :func:`arcovar` for a detailed description of Covariance m...
def arcovar_marple(x, order): r"""Estimate AR model parameters using covariance method This implementation is based on [Marple]_. This code is far more complicated and slower than :func:`arcovar` function, which is now the official version. See :func:`arcovar` for a detailed description of Covariance m...
[ "r", "Estimate", "AR", "model", "parameters", "using", "covariance", "method" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/covar.py#L10-L257
[ "def", "arcovar_marple", "(", "x", ",", "order", ")", ":", "assert", "len", "(", "x", ")", ">=", "order", ",", "\"X must be dimensioned >=N\"", "# ----------------------------------------------------- Initialization", "x", "=", "np", ".", "array", "(", "x", ")", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
arcovar
r"""Simple and fast implementation of the covariance AR estimate This code is 10 times faster than :func:`arcovar_marple` and more importantly only 10 lines of code, compared to a 200 loc for :func:`arcovar_marple` :param array X: Array of complex data samples :param int oder: Order of linear predic...
src/spectrum/covar.py
def arcovar(x, order): r"""Simple and fast implementation of the covariance AR estimate This code is 10 times faster than :func:`arcovar_marple` and more importantly only 10 lines of code, compared to a 200 loc for :func:`arcovar_marple` :param array X: Array of complex data samples :param int o...
def arcovar(x, order): r"""Simple and fast implementation of the covariance AR estimate This code is 10 times faster than :func:`arcovar_marple` and more importantly only 10 lines of code, compared to a 200 loc for :func:`arcovar_marple` :param array X: Array of complex data samples :param int o...
[ "r", "Simple", "and", "fast", "implementation", "of", "the", "covariance", "AR", "estimate" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/covar.py#L260-L328
[ "def", "arcovar", "(", "x", ",", "order", ")", ":", "from", "spectrum", "import", "corrmtx", "import", "scipy", ".", "linalg", "X", "=", "corrmtx", "(", "x", ",", "order", ",", "'covariance'", ")", "Xc", "=", "np", ".", "matrix", "(", "X", "[", ":"...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
lpc
Linear Predictor Coefficients. :param x: :param int N: default is length(X) - 1 :Details: Finds the coefficients :math:`A=(1, a(2), \dots a(N+1))`, of an Nth order forward linear predictor that predicts the current value value of the real-valued time series x based on past samples: .. ma...
src/spectrum/lpc.py
def lpc(x, N=None): """Linear Predictor Coefficients. :param x: :param int N: default is length(X) - 1 :Details: Finds the coefficients :math:`A=(1, a(2), \dots a(N+1))`, of an Nth order forward linear predictor that predicts the current value value of the real-valued time series x based ...
def lpc(x, N=None): """Linear Predictor Coefficients. :param x: :param int N: default is length(X) - 1 :Details: Finds the coefficients :math:`A=(1, a(2), \dots a(N+1))`, of an Nth order forward linear predictor that predicts the current value value of the real-valued time series x based ...
[ "Linear", "Predictor", "Coefficients", "." ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/lpc.py#L10-L72
[ "def", "lpc", "(", "x", ",", "N", "=", "None", ")", ":", "m", "=", "len", "(", "x", ")", "if", "N", "is", "None", ":", "N", "=", "m", "-", "1", "#default value if N is not provided", "elif", "N", ">", "m", "-", "1", ":", "#disp('Warning: zero-paddi...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
minvar
r"""Minimum Variance Spectral Estimation (MV) This function computes the minimum variance spectral estimate using the Musicus procedure. The Burg algorithm from :func:`~spectrum.burg.arburg` is used for the estimation of the autoregressive parameters. The MV spectral estimator is given by: .. mat...
src/spectrum/minvar.py
def minvar(X, order, sampling=1., NFFT=default_NFFT): r"""Minimum Variance Spectral Estimation (MV) This function computes the minimum variance spectral estimate using the Musicus procedure. The Burg algorithm from :func:`~spectrum.burg.arburg` is used for the estimation of the autoregressive paramete...
def minvar(X, order, sampling=1., NFFT=default_NFFT): r"""Minimum Variance Spectral Estimation (MV) This function computes the minimum variance spectral estimate using the Musicus procedure. The Burg algorithm from :func:`~spectrum.burg.arburg` is used for the estimation of the autoregressive paramete...
[ "r", "Minimum", "Variance", "Spectral", "Estimation", "(", "MV", ")" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/minvar.py#L23-L135
[ "def", "minvar", "(", "X", ",", "order", ",", "sampling", "=", "1.", ",", "NFFT", "=", "default_NFFT", ")", ":", "errors", ".", "is_positive_integer", "(", "order", ")", "errors", ".", "is_positive_integer", "(", "NFFT", ")", "psi", "=", "np", ".", "ze...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
pascal
Return Pascal matrix :param int n: size of the matrix .. doctest:: >>> from spectrum import pascal >>> pascal(6) array([[ 1., 1., 1., 1., 1., 1.], [ 1., 2., 3., 4., 5., 6.], [ 1., 3., 6., 10., 15., 21.], ...
src/spectrum/linalg.py
def pascal(n): """Return Pascal matrix :param int n: size of the matrix .. doctest:: >>> from spectrum import pascal >>> pascal(6) array([[ 1., 1., 1., 1., 1., 1.], [ 1., 2., 3., 4., 5., 6.], [ 1., 3., 6., 1...
def pascal(n): """Return Pascal matrix :param int n: size of the matrix .. doctest:: >>> from spectrum import pascal >>> pascal(6) array([[ 1., 1., 1., 1., 1., 1.], [ 1., 2., 3., 4., 5., 6.], [ 1., 3., 6., 1...
[ "Return", "Pascal", "matrix" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/linalg.py#L21-L50
[ "def", "pascal", "(", "n", ")", ":", "errors", ".", "is_positive_integer", "(", "n", ")", "result", "=", "numpy", ".", "zeros", "(", "(", "n", ",", "n", ")", ")", "#fill the first row and column", "for", "i", "in", "range", "(", "0", ",", "n", ")", ...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
corrmtx
r"""Correlation matrix This function is used by PSD estimator functions. It generates the correlation matrix from a correlation data set and a maximum lag. :param array x: autocorrelation samples (1D) :param int m: the maximum lag Depending on the choice of the method, the correlation matrix has ...
src/spectrum/linalg.py
def corrmtx(x_input, m, method='autocorrelation'): r"""Correlation matrix This function is used by PSD estimator functions. It generates the correlation matrix from a correlation data set and a maximum lag. :param array x: autocorrelation samples (1D) :param int m: the maximum lag Depending o...
def corrmtx(x_input, m, method='autocorrelation'): r"""Correlation matrix This function is used by PSD estimator functions. It generates the correlation matrix from a correlation data set and a maximum lag. :param array x: autocorrelation samples (1D) :param int m: the maximum lag Depending o...
[ "r", "Correlation", "matrix" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/linalg.py#L54-L219
[ "def", "corrmtx", "(", "x_input", ",", "m", ",", "method", "=", "'autocorrelation'", ")", ":", "valid_methods", "=", "[", "'autocorrelation'", ",", "'prewindowed'", ",", "'postwindowed'", ",", "'covariance'", ",", "'modified'", "]", "if", "method", "not", "in"...
bad6c32e3f10e185098748f67bb421b378b06afe
valid
csvd
SVD decomposition using numpy.linalg.svd :param A: a M by N matrix :return: * U, a M by M matrix * S the N eigen values * V a N by N matrix See :func:`numpy.linalg.svd` for a detailed documentation. Should return the same as in [Marple]_ , CSVD routine. :: U, S,...
src/spectrum/linalg.py
def csvd(A): """SVD decomposition using numpy.linalg.svd :param A: a M by N matrix :return: * U, a M by M matrix * S the N eigen values * V a N by N matrix See :func:`numpy.linalg.svd` for a detailed documentation. Should return the same as in [Marple]_ , CSVD routine. ...
def csvd(A): """SVD decomposition using numpy.linalg.svd :param A: a M by N matrix :return: * U, a M by M matrix * S the N eigen values * V a N by N matrix See :func:`numpy.linalg.svd` for a detailed documentation. Should return the same as in [Marple]_ , CSVD routine. ...
[ "SVD", "decomposition", "using", "numpy", ".", "linalg", ".", "svd" ]
cokelaer/spectrum
python
https://github.com/cokelaer/spectrum/blob/bad6c32e3f10e185098748f67bb421b378b06afe/src/spectrum/linalg.py#L226-L247
[ "def", "csvd", "(", "A", ")", ":", "U", ",", "S", ",", "V", "=", "numpy", ".", "linalg", ".", "svd", "(", "A", ")", "return", "U", ",", "S", ",", "V" ]
bad6c32e3f10e185098748f67bb421b378b06afe
valid
compatible_staticpath
Try to return a path to static the static files compatible all the way back to Django 1.2. If anyone has a cleaner or better way to do this let me know!
pagedown/utils.py
def compatible_staticpath(path): """ Try to return a path to static the static files compatible all the way back to Django 1.2. If anyone has a cleaner or better way to do this let me know! """ if VERSION >= (1, 10): # Since Django 1.10, forms.Media automatically invoke static #...
def compatible_staticpath(path): """ Try to return a path to static the static files compatible all the way back to Django 1.2. If anyone has a cleaner or better way to do this let me know! """ if VERSION >= (1, 10): # Since Django 1.10, forms.Media automatically invoke static #...
[ "Try", "to", "return", "a", "path", "to", "static", "the", "static", "files", "compatible", "all", "the", "way", "back", "to", "Django", "1", ".", "2", ".", "If", "anyone", "has", "a", "cleaner", "or", "better", "way", "to", "do", "this", "let", "me"...
timmyomahony/django-pagedown
python
https://github.com/timmyomahony/django-pagedown/blob/30f90346f72ac736868402e6630df9622cf6624f/pagedown/utils.py#L5-L31
[ "def", "compatible_staticpath", "(", "path", ")", ":", "if", "VERSION", ">=", "(", "1", ",", "10", ")", ":", "# Since Django 1.10, forms.Media automatically invoke static", "# lazily on the path if it is relative.", "return", "path", "try", ":", "# >= 1.4", "from", "dja...
30f90346f72ac736868402e6630df9622cf6624f
valid
main
Main command line interface.
keyring/cli.py
def main(argv=None): """Main command line interface.""" if argv is None: argv = sys.argv[1:] cli = CommandLineTool() return cli.run(argv)
def main(argv=None): """Main command line interface.""" if argv is None: argv = sys.argv[1:] cli = CommandLineTool() return cli.run(argv)
[ "Main", "command", "line", "interface", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/cli.py#L121-L128
[ "def", "main", "(", "argv", "=", "None", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "cli", "=", "CommandLineTool", "(", ")", "return", "cli", ".", "run", "(", "argv", ")" ]
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
CommandLineTool.pass_from_pipe
Return password from pipe if not on TTY, else False.
keyring/cli.py
def pass_from_pipe(cls): """Return password from pipe if not on TTY, else False. """ is_pipe = not sys.stdin.isatty() return is_pipe and cls.strip_last_newline(sys.stdin.read())
def pass_from_pipe(cls): """Return password from pipe if not on TTY, else False. """ is_pipe = not sys.stdin.isatty() return is_pipe and cls.strip_last_newline(sys.stdin.read())
[ "Return", "password", "from", "pipe", "if", "not", "on", "TTY", "else", "False", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/cli.py#L101-L105
[ "def", "pass_from_pipe", "(", "cls", ")", ":", "is_pipe", "=", "not", "sys", ".", "stdin", ".", "isatty", "(", ")", "return", "is_pipe", "and", "cls", ".", "strip_last_newline", "(", "sys", ".", "stdin", ".", "read", "(", ")", ")" ]
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
_load_plugins
Locate all setuptools entry points by the name 'keyring backends' and initialize them. Any third-party library may register an entry point by adding the following to their setup.py:: entry_points = { 'keyring.backends': [ 'plugin_name = mylib.mymodule:initialize_func', ...
keyring/backend.py
def _load_plugins(): """ Locate all setuptools entry points by the name 'keyring backends' and initialize them. Any third-party library may register an entry point by adding the following to their setup.py:: entry_points = { 'keyring.backends': [ 'plugin_name = m...
def _load_plugins(): """ Locate all setuptools entry points by the name 'keyring backends' and initialize them. Any third-party library may register an entry point by adding the following to their setup.py:: entry_points = { 'keyring.backends': [ 'plugin_name = m...
[ "Locate", "all", "setuptools", "entry", "points", "by", "the", "name", "keyring", "backends", "and", "initialize", "them", ".", "Any", "third", "-", "party", "library", "may", "register", "an", "entry", "point", "by", "adding", "the", "following", "to", "the...
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backend.py#L167-L194
[ "def", "_load_plugins", "(", ")", ":", "group", "=", "'keyring.backends'", "entry_points", "=", "entrypoints", ".", "get_group_all", "(", "group", "=", "group", ")", "for", "ep", "in", "entry_points", ":", "try", ":", "log", ".", "info", "(", "'Loading %s'",...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
get_all_keyring
Return a list of all implemented keyrings that can be constructed without parameters.
keyring/backend.py
def get_all_keyring(): """ Return a list of all implemented keyrings that can be constructed without parameters. """ _load_plugins() viable_classes = KeyringBackend.get_viable_backends() rings = util.suppress_exceptions(viable_classes, exceptions=TypeError) return list(rings)
def get_all_keyring(): """ Return a list of all implemented keyrings that can be constructed without parameters. """ _load_plugins() viable_classes = KeyringBackend.get_viable_backends() rings = util.suppress_exceptions(viable_classes, exceptions=TypeError) return list(rings)
[ "Return", "a", "list", "of", "all", "implemented", "keyrings", "that", "can", "be", "constructed", "without", "parameters", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backend.py#L198-L206
[ "def", "get_all_keyring", "(", ")", ":", "_load_plugins", "(", ")", "viable_classes", "=", "KeyringBackend", ".", "get_viable_backends", "(", ")", "rings", "=", "util", ".", "suppress_exceptions", "(", "viable_classes", ",", "exceptions", "=", "TypeError", ")", ...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
KeyringBackend.name
The keyring name, suitable for display. The name is derived from module and class name.
keyring/backend.py
def name(cls): """ The keyring name, suitable for display. The name is derived from module and class name. """ parent, sep, mod_name = cls.__module__.rpartition('.') mod_name = mod_name.replace('_', ' ') return ' '.join([mod_name, cls.__name__])
def name(cls): """ The keyring name, suitable for display. The name is derived from module and class name. """ parent, sep, mod_name = cls.__module__.rpartition('.') mod_name = mod_name.replace('_', ' ') return ' '.join([mod_name, cls.__name__])
[ "The", "keyring", "name", "suitable", "for", "display", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backend.py#L75-L83
[ "def", "name", "(", "cls", ")", ":", "parent", ",", "sep", ",", "mod_name", "=", "cls", ".", "__module__", ".", "rpartition", "(", "'.'", ")", "mod_name", "=", "mod_name", ".", "replace", "(", "'_'", ",", "' '", ")", "return", "' '", ".", "join", "...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
KeyringBackend.get_credential
Gets the username and password for the service. Returns a Credential instance. The *username* argument is optional and may be omitted by the caller or ignored by the backend. Callers must use the returned username.
keyring/backend.py
def get_credential(self, service, username): """Gets the username and password for the service. Returns a Credential instance. The *username* argument is optional and may be omitted by the caller or ignored by the backend. Callers must use the returned username. """ ...
def get_credential(self, service, username): """Gets the username and password for the service. Returns a Credential instance. The *username* argument is optional and may be omitted by the caller or ignored by the backend. Callers must use the returned username. """ ...
[ "Gets", "the", "username", "and", "password", "for", "the", "service", ".", "Returns", "a", "Credential", "instance", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backend.py#L120-L136
[ "def", "get_credential", "(", "self", ",", "service", ",", "username", ")", ":", "# The default implementation requires a username here.", "if", "username", "is", "not", "None", ":", "password", "=", "self", ".", "get_password", "(", "service", ",", "username", ")...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
DBusKeyring.get_password
Get password of the username for the service
keyring/backends/kwallet.py
def get_password(self, service, username): """Get password of the username for the service """ if not self.connected(service): # the user pressed "cancel" when prompted to unlock their keyring. raise KeyringLocked("Failed to unlock the keyring!") if not self.iface...
def get_password(self, service, username): """Get password of the username for the service """ if not self.connected(service): # the user pressed "cancel" when prompted to unlock their keyring. raise KeyringLocked("Failed to unlock the keyring!") if not self.iface...
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/kwallet.py#L95-L105
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "if", "not", "self", ".", "connected", "(", "service", ")", ":", "# the user pressed \"cancel\" when prompted to unlock their keyring.", "raise", "KeyringLocked", "(", "\"Failed to unlock the...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
DBusKeyring.set_password
Set password for the username of the service
keyring/backends/kwallet.py
def set_password(self, service, username, password): """Set password for the username of the service """ if not self.connected(service): # the user pressed "cancel" when prompted to unlock their keyring. raise PasswordSetError("Cancelled by user") self.iface.write...
def set_password(self, service, username, password): """Set password for the username of the service """ if not self.connected(service): # the user pressed "cancel" when prompted to unlock their keyring. raise PasswordSetError("Cancelled by user") self.iface.write...
[ "Set", "password", "for", "the", "username", "of", "the", "service" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/kwallet.py#L107-L114
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "if", "not", "self", ".", "connected", "(", "service", ")", ":", "# the user pressed \"cancel\" when prompted to unlock their keyring.", "raise", "PasswordSetError", "(", ...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
DBusKeyring.delete_password
Delete the password for the username of the service.
keyring/backends/kwallet.py
def delete_password(self, service, username): """Delete the password for the username of the service. """ if not self.connected(service): # the user pressed "cancel" when prompted to unlock their keyring. raise PasswordDeleteError("Cancelled by user") if not self....
def delete_password(self, service, username): """Delete the password for the username of the service. """ if not self.connected(service): # the user pressed "cancel" when prompted to unlock their keyring. raise PasswordDeleteError("Cancelled by user") if not self....
[ "Delete", "the", "password", "for", "the", "username", "of", "the", "service", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/kwallet.py#L116-L124
[ "def", "delete_password", "(", "self", ",", "service", ",", "username", ")", ":", "if", "not", "self", ".", "connected", "(", "service", ")", ":", "# the user pressed \"cancel\" when prompted to unlock their keyring.", "raise", "PasswordDeleteError", "(", "\"Cancelled b...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
EnvironCredential._get_env
Helper to read an environment variable
keyring/credentials.py
def _get_env(self, env_var): """Helper to read an environment variable """ value = os.environ.get(env_var) if not value: raise ValueError('Missing environment variable:%s' % env_var) return value
def _get_env(self, env_var): """Helper to read an environment variable """ value = os.environ.get(env_var) if not value: raise ValueError('Missing environment variable:%s' % env_var) return value
[ "Helper", "to", "read", "an", "environment", "variable" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/credentials.py#L46-L52
[ "def", "_get_env", "(", "self", ",", "env_var", ")", ":", "value", "=", "os", ".", "environ", ".", "get", "(", "env_var", ")", "if", "not", "value", ":", "raise", "ValueError", "(", "'Missing environment variable:%s'", "%", "env_var", ")", "return", "value...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
Keyring.get_preferred_collection
If self.preferred_collection contains a D-Bus path, the collection at that address is returned. Otherwise, the default collection is returned.
keyring/backends/SecretService.py
def get_preferred_collection(self): """If self.preferred_collection contains a D-Bus path, the collection at that address is returned. Otherwise, the default collection is returned. """ bus = secretstorage.dbus_init() try: if hasattr(self, 'preferred_collectio...
def get_preferred_collection(self): """If self.preferred_collection contains a D-Bus path, the collection at that address is returned. Otherwise, the default collection is returned. """ bus = secretstorage.dbus_init() try: if hasattr(self, 'preferred_collectio...
[ "If", "self", ".", "preferred_collection", "contains", "a", "D", "-", "Bus", "path", "the", "collection", "at", "that", "address", "is", "returned", ".", "Otherwise", "the", "default", "collection", "is", "returned", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/SecretService.py#L41-L59
[ "def", "get_preferred_collection", "(", "self", ")", ":", "bus", "=", "secretstorage", ".", "dbus_init", "(", ")", "try", ":", "if", "hasattr", "(", "self", ",", "'preferred_collection'", ")", ":", "collection", "=", "secretstorage", ".", "Collection", "(", ...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
Keyring.get_password
Get password of the username for the service
keyring/backends/SecretService.py
def get_password(self, service, username): """Get password of the username for the service """ collection = self.get_preferred_collection() items = collection.search_items( {"username": username, "service": service}) for item in items: if hasattr(item, 'un...
def get_password(self, service, username): """Get password of the username for the service """ collection = self.get_preferred_collection() items = collection.search_items( {"username": username, "service": service}) for item in items: if hasattr(item, 'un...
[ "Get", "password", "of", "the", "username", "for", "the", "service" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/SecretService.py#L61-L72
[ "def", "get_password", "(", "self", ",", "service", ",", "username", ")", ":", "collection", "=", "self", ".", "get_preferred_collection", "(", ")", "items", "=", "collection", ".", "search_items", "(", "{", "\"username\"", ":", "username", ",", "\"service\"",...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
Keyring.set_password
Set password for the username of the service
keyring/backends/SecretService.py
def set_password(self, service, username, password): """Set password for the username of the service """ collection = self.get_preferred_collection() attributes = { "application": self.appid, "service": service, "username": username } l...
def set_password(self, service, username, password): """Set password for the username of the service """ collection = self.get_preferred_collection() attributes = { "application": self.appid, "service": service, "username": username } l...
[ "Set", "password", "for", "the", "username", "of", "the", "service" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/SecretService.py#L74-L84
[ "def", "set_password", "(", "self", ",", "service", ",", "username", ",", "password", ")", ":", "collection", "=", "self", ".", "get_preferred_collection", "(", ")", "attributes", "=", "{", "\"application\"", ":", "self", ".", "appid", ",", "\"service\"", ":...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
Keyring.delete_password
Delete the stored password (only the first one)
keyring/backends/SecretService.py
def delete_password(self, service, username): """Delete the stored password (only the first one) """ collection = self.get_preferred_collection() items = collection.search_items( {"username": username, "service": service}) for item in items: return item.de...
def delete_password(self, service, username): """Delete the stored password (only the first one) """ collection = self.get_preferred_collection() items = collection.search_items( {"username": username, "service": service}) for item in items: return item.de...
[ "Delete", "the", "stored", "password", "(", "only", "the", "first", "one", ")" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/SecretService.py#L86-L94
[ "def", "delete_password", "(", "self", ",", "service", ",", "username", ")", ":", "collection", "=", "self", ".", "get_preferred_collection", "(", ")", "items", "=", "collection", ".", "search_items", "(", "{", "\"username\"", ":", "username", ",", "\"service\...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
PackedAttributes.unpack
r""" >>> PackedAttributes.unpack(0) 0 >>> PackedAttributes.unpack('\x00\x00\x00\x01') 1 >>> PackedAttributes.unpack('abcd') 1633837924
keyring/backends/_OS_X_API.py
def unpack(word): r""" >>> PackedAttributes.unpack(0) 0 >>> PackedAttributes.unpack('\x00\x00\x00\x01') 1 >>> PackedAttributes.unpack('abcd') 1633837924 """ if not isinstance(word, str): return word val, = struct.unpack('!I', wo...
def unpack(word): r""" >>> PackedAttributes.unpack(0) 0 >>> PackedAttributes.unpack('\x00\x00\x00\x01') 1 >>> PackedAttributes.unpack('abcd') 1633837924 """ if not isinstance(word, str): return word val, = struct.unpack('!I', wo...
[ "r", ">>>", "PackedAttributes", ".", "unpack", "(", "0", ")", "0", ">>>", "PackedAttributes", ".", "unpack", "(", "\\", "x00", "\\", "x00", "\\", "x00", "\\", "x01", ")", "1", ">>>", "PackedAttributes", ".", "unpack", "(", "abcd", ")", "1633837924" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/_OS_X_API.py#L154-L166
[ "def", "unpack", "(", "word", ")", ":", "if", "not", "isinstance", "(", "word", ",", "str", ")", ":", "return", "word", "val", ",", "=", "struct", ".", "unpack", "(", "'!I'", ",", "word", ".", "encode", "(", "'ascii'", ")", ")", "return", "val" ]
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
ChainerBackend.backends
Discover all keyrings for chaining.
keyring/backends/chainer.py
def backends(cls): """ Discover all keyrings for chaining. """ allowed = ( keyring for keyring in filter(backend._limit, backend.get_all_keyring()) if not isinstance(keyring, ChainerBackend) and keyring.priority > 0 ) return...
def backends(cls): """ Discover all keyrings for chaining. """ allowed = ( keyring for keyring in filter(backend._limit, backend.get_all_keyring()) if not isinstance(keyring, ChainerBackend) and keyring.priority > 0 ) return...
[ "Discover", "all", "keyrings", "for", "chaining", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/backends/chainer.py#L30-L40
[ "def", "backends", "(", "cls", ")", ":", "allowed", "=", "(", "keyring", "for", "keyring", "in", "filter", "(", "backend", ".", "_limit", ",", "backend", ".", "get_all_keyring", "(", ")", ")", "if", "not", "isinstance", "(", "keyring", ",", "ChainerBacke...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
set_keyring
Set current keyring backend.
keyring/core.py
def set_keyring(keyring): """Set current keyring backend. """ global _keyring_backend if not isinstance(keyring, backend.KeyringBackend): raise TypeError("The keyring must be a subclass of KeyringBackend") _keyring_backend = keyring
def set_keyring(keyring): """Set current keyring backend. """ global _keyring_backend if not isinstance(keyring, backend.KeyringBackend): raise TypeError("The keyring must be a subclass of KeyringBackend") _keyring_backend = keyring
[ "Set", "current", "keyring", "backend", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L20-L26
[ "def", "set_keyring", "(", "keyring", ")", ":", "global", "_keyring_backend", "if", "not", "isinstance", "(", "keyring", ",", "backend", ".", "KeyringBackend", ")", ":", "raise", "TypeError", "(", "\"The keyring must be a subclass of KeyringBackend\"", ")", "_keyring_...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
disable
Configure the null keyring as the default.
keyring/core.py
def disable(): """ Configure the null keyring as the default. """ root = platform.config_root() try: os.makedirs(root) except OSError: pass filename = os.path.join(root, 'keyringrc.cfg') if os.path.exists(filename): msg = "Refusing to overwrite {filename}".format(...
def disable(): """ Configure the null keyring as the default. """ root = platform.config_root() try: os.makedirs(root) except OSError: pass filename = os.path.join(root, 'keyringrc.cfg') if os.path.exists(filename): msg = "Refusing to overwrite {filename}".format(...
[ "Configure", "the", "null", "keyring", "as", "the", "default", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L35-L49
[ "def", "disable", "(", ")", ":", "root", "=", "platform", ".", "config_root", "(", ")", "try", ":", "os", ".", "makedirs", "(", "root", ")", "except", "OSError", ":", "pass", "filename", "=", "os", ".", "path", ".", "join", "(", "root", ",", "'keyr...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
init_backend
Load a keyring specified in the config file or infer the best available. Limit, if supplied, should be a callable taking a backend and returning True if that backend should be included for consideration.
keyring/core.py
def init_backend(limit=None): """ Load a keyring specified in the config file or infer the best available. Limit, if supplied, should be a callable taking a backend and returning True if that backend should be included for consideration. """ # save the limit for the chainer to honor backend...
def init_backend(limit=None): """ Load a keyring specified in the config file or infer the best available. Limit, if supplied, should be a callable taking a backend and returning True if that backend should be included for consideration. """ # save the limit for the chainer to honor backend...
[ "Load", "a", "keyring", "specified", "in", "the", "config", "file", "or", "infer", "the", "best", "available", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L80-L97
[ "def", "init_backend", "(", "limit", "=", "None", ")", ":", "# save the limit for the chainer to honor", "backend", ".", "_limit", "=", "limit", "# get all keyrings passing the limit filter", "keyrings", "=", "filter", "(", "limit", ",", "backend", ".", "get_all_keyring...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
_load_keyring_class
Load the keyring class indicated by name. These popular names are tested to ensure their presence. >>> popular_names = [ ... 'keyring.backends.Windows.WinVaultKeyring', ... 'keyring.backends.OS_X.Keyring', ... 'keyring.backends.kwallet.DBusKeyring', ... 'keyring.backends.Se...
keyring/core.py
def _load_keyring_class(keyring_name): """ Load the keyring class indicated by name. These popular names are tested to ensure their presence. >>> popular_names = [ ... 'keyring.backends.Windows.WinVaultKeyring', ... 'keyring.backends.OS_X.Keyring', ... 'keyring.backends.kwal...
def _load_keyring_class(keyring_name): """ Load the keyring class indicated by name. These popular names are tested to ensure their presence. >>> popular_names = [ ... 'keyring.backends.Windows.WinVaultKeyring', ... 'keyring.backends.OS_X.Keyring', ... 'keyring.backends.kwal...
[ "Load", "the", "keyring", "class", "indicated", "by", "name", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L100-L125
[ "def", "_load_keyring_class", "(", "keyring_name", ")", ":", "module_name", ",", "sep", ",", "class_name", "=", "keyring_name", ".", "rpartition", "(", "'.'", ")", "__import__", "(", "module_name", ")", "module", "=", "sys", ".", "modules", "[", "module_name",...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
load_config
Load a keyring using the config file in the config root.
keyring/core.py
def load_config(): """Load a keyring using the config file in the config root.""" filename = 'keyringrc.cfg' keyring_cfg = os.path.join(platform.config_root(), filename) if not os.path.exists(keyring_cfg): return config = configparser.RawConfigParser() config.read(keyring_cfg) _l...
def load_config(): """Load a keyring using the config file in the config root.""" filename = 'keyringrc.cfg' keyring_cfg = os.path.join(platform.config_root(), filename) if not os.path.exists(keyring_cfg): return config = configparser.RawConfigParser() config.read(keyring_cfg) _l...
[ "Load", "a", "keyring", "using", "the", "config", "file", "in", "the", "config", "root", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L147-L174
[ "def", "load_config", "(", ")", ":", "filename", "=", "'keyringrc.cfg'", "keyring_cfg", "=", "os", ".", "path", ".", "join", "(", "platform", ".", "config_root", "(", ")", ",", "filename", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "keyri...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
_load_keyring_path
load the keyring-path option (if present)
keyring/core.py
def _load_keyring_path(config): "load the keyring-path option (if present)" try: path = config.get("backend", "keyring-path").strip() sys.path.insert(0, path) except (configparser.NoOptionError, configparser.NoSectionError): pass
def _load_keyring_path(config): "load the keyring-path option (if present)" try: path = config.get("backend", "keyring-path").strip() sys.path.insert(0, path) except (configparser.NoOptionError, configparser.NoSectionError): pass
[ "load", "the", "keyring", "-", "path", "option", "(", "if", "present", ")" ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/core.py#L177-L183
[ "def", "_load_keyring_path", "(", "config", ")", ":", "try", ":", "path", "=", "config", ".", "get", "(", "\"backend\"", ",", "\"keyring-path\"", ")", ".", "strip", "(", ")", "sys", ".", "path", ".", "insert", "(", "0", ",", "path", ")", "except", "(...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
_data_root_Linux
Use freedesktop.org Base Dir Specfication to determine storage location.
keyring/util/platform_.py
def _data_root_Linux(): """ Use freedesktop.org Base Dir Specfication to determine storage location. """ fallback = os.path.expanduser('~/.local/share') root = os.environ.get('XDG_DATA_HOME', None) or fallback return os.path.join(root, 'python_keyring')
def _data_root_Linux(): """ Use freedesktop.org Base Dir Specfication to determine storage location. """ fallback = os.path.expanduser('~/.local/share') root = os.environ.get('XDG_DATA_HOME', None) or fallback return os.path.join(root, 'python_keyring')
[ "Use", "freedesktop", ".", "org", "Base", "Dir", "Specfication", "to", "determine", "storage", "location", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/util/platform_.py#L19-L26
[ "def", "_data_root_Linux", "(", ")", ":", "fallback", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.local/share'", ")", "root", "=", "os", ".", "environ", ".", "get", "(", "'XDG_DATA_HOME'", ",", "None", ")", "or", "fallback", "return", "os", ".",...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
_check_old_config_root
Prior versions of keyring would search for the config in XDG_DATA_HOME, but should probably have been searching for config in XDG_CONFIG_HOME. If the config exists in the former but not in the latter, raise a RuntimeError to force the change.
keyring/util/platform_.py
def _check_old_config_root(): """ Prior versions of keyring would search for the config in XDG_DATA_HOME, but should probably have been searching for config in XDG_CONFIG_HOME. If the config exists in the former but not in the latter, raise a RuntimeError to force the change. """ # disab...
def _check_old_config_root(): """ Prior versions of keyring would search for the config in XDG_DATA_HOME, but should probably have been searching for config in XDG_CONFIG_HOME. If the config exists in the former but not in the latter, raise a RuntimeError to force the change. """ # disab...
[ "Prior", "versions", "of", "keyring", "would", "search", "for", "the", "config", "in", "XDG_DATA_HOME", "but", "should", "probably", "have", "been", "searching", "for", "config", "in", "XDG_CONFIG_HOME", ".", "If", "the", "config", "exists", "in", "the", "form...
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/util/platform_.py#L32-L48
[ "def", "_check_old_config_root", "(", ")", ":", "# disable the check - once is enough and avoids infinite loop", "globals", "(", ")", "[", "'_check_old_config_root'", "]", "=", "lambda", ":", "None", "config_file_new", "=", "os", ".", "path", ".", "join", "(", "_confi...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
_config_root_Linux
Use freedesktop.org Base Dir Specfication to determine config location.
keyring/util/platform_.py
def _config_root_Linux(): """ Use freedesktop.org Base Dir Specfication to determine config location. """ _check_old_config_root() fallback = os.path.expanduser('~/.local/share') key = 'XDG_CONFIG_HOME' root = os.environ.get(key, None) or fallback return os.path.join(root, 'python_ke...
def _config_root_Linux(): """ Use freedesktop.org Base Dir Specfication to determine config location. """ _check_old_config_root() fallback = os.path.expanduser('~/.local/share') key = 'XDG_CONFIG_HOME' root = os.environ.get(key, None) or fallback return os.path.join(root, 'python_ke...
[ "Use", "freedesktop", ".", "org", "Base", "Dir", "Specfication", "to", "determine", "config", "location", "." ]
jaraco/keyring
python
https://github.com/jaraco/keyring/blob/71c798378e365286b7cc03c06e4d7d24c7de8fc4/keyring/util/platform_.py#L51-L60
[ "def", "_config_root_Linux", "(", ")", ":", "_check_old_config_root", "(", ")", "fallback", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.local/share'", ")", "key", "=", "'XDG_CONFIG_HOME'", "root", "=", "os", ".", "environ", ".", "get", "(", "key", ...
71c798378e365286b7cc03c06e4d7d24c7de8fc4
valid
make_formatter
Returns a callable that outputs the data. Defaults to print.
pynetgear/__main__.py
def make_formatter(format_name): """Returns a callable that outputs the data. Defaults to print.""" if "json" in format_name: from json import dumps import datetime def jsonhandler(obj): obj.isoformat() if isinstance(obj, (datetime.datetime, datetime.date)) else obj if format_na...
def make_formatter(format_name): """Returns a callable that outputs the data. Defaults to print.""" if "json" in format_name: from json import dumps import datetime def jsonhandler(obj): obj.isoformat() if isinstance(obj, (datetime.datetime, datetime.date)) else obj if format_na...
[ "Returns", "a", "callable", "that", "outputs", "the", "data", ".", "Defaults", "to", "print", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__main__.py#L9-L36
[ "def", "make_formatter", "(", "format_name", ")", ":", "if", "\"json\"", "in", "format_name", ":", "from", "json", "import", "dumps", "import", "datetime", "def", "jsonhandler", "(", "obj", ")", ":", "obj", ".", "isoformat", "(", ")", "if", "isinstance", "...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
argparser
Constructs the ArgumentParser for the CLI
pynetgear/__main__.py
def argparser(): """Constructs the ArgumentParser for the CLI""" parser = ArgumentParser(prog='pynetgear') parser.add_argument("--format", choices=['json', 'prettyjson', 'py'], default='prettyjson') router_args = parser.add_argument_group("router connection config") router_args.add_argument("--ho...
def argparser(): """Constructs the ArgumentParser for the CLI""" parser = ArgumentParser(prog='pynetgear') parser.add_argument("--format", choices=['json', 'prettyjson', 'py'], default='prettyjson') router_args = parser.add_argument_group("router connection config") router_args.add_argument("--ho...
[ "Constructs", "the", "ArgumentParser", "for", "the", "CLI" ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__main__.py#L39-L88
[ "def", "argparser", "(", ")", ":", "parser", "=", "ArgumentParser", "(", "prog", "=", "'pynetgear'", ")", "parser", ".", "add_argument", "(", "\"--format\"", ",", "choices", "=", "[", "'json'", ",", "'prettyjson'", ",", "'py'", "]", ",", "default", "=", ...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
run_subcommand
Runs the subcommand configured in args on the netgear session
pynetgear/__main__.py
def run_subcommand(netgear, args): """Runs the subcommand configured in args on the netgear session""" subcommand = args.subcommand if subcommand == "block_device" or subcommand == "allow_device": return netgear.allow_block_device(args.mac_addr, BLOCK if subcommand == "block_device" else ALLOW) ...
def run_subcommand(netgear, args): """Runs the subcommand configured in args on the netgear session""" subcommand = args.subcommand if subcommand == "block_device" or subcommand == "allow_device": return netgear.allow_block_device(args.mac_addr, BLOCK if subcommand == "block_device" else ALLOW) ...
[ "Runs", "the", "subcommand", "configured", "in", "args", "on", "the", "netgear", "session" ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__main__.py#L91-L111
[ "def", "run_subcommand", "(", "netgear", ",", "args", ")", ":", "subcommand", "=", "args", ".", "subcommand", "if", "subcommand", "==", "\"block_device\"", "or", "subcommand", "==", "\"allow_device\"", ":", "return", "netgear", ".", "allow_block_device", "(", "a...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
main
Scan for devices and print results.
pynetgear/__main__.py
def main(): """Scan for devices and print results.""" args = argparser().parse_args(sys.argv[1:]) password = os.environ.get('PYNETGEAR_PASSWORD') or args.password netgear = Netgear(password, args.host, args.user, args.port, args.ssl, args.url, args.force_login_v2) results = run_subcommand(netgear...
def main(): """Scan for devices and print results.""" args = argparser().parse_args(sys.argv[1:]) password = os.environ.get('PYNETGEAR_PASSWORD') or args.password netgear = Netgear(password, args.host, args.user, args.port, args.ssl, args.url, args.force_login_v2) results = run_subcommand(netgear...
[ "Scan", "for", "devices", "and", "print", "results", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__main__.py#L114-L129
[ "def", "main", "(", ")", ":", "args", "=", "argparser", "(", ")", ".", "parse_args", "(", "sys", ".", "argv", "[", "1", ":", "]", ")", "password", "=", "os", ".", "environ", ".", "get", "(", "'PYNETGEAR_PASSWORD'", ")", "or", "args", ".", "password...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
autodetect_url
Try to autodetect the base URL of the router SOAP service. Returns None if it can't be found.
pynetgear/__init__.py
def autodetect_url(): """ Try to autodetect the base URL of the router SOAP service. Returns None if it can't be found. """ for url in ["http://routerlogin.net:5000", "https://routerlogin.net", "http://routerlogin.net"]: try: r = requests.get(url + "/soap/server_...
def autodetect_url(): """ Try to autodetect the base URL of the router SOAP service. Returns None if it can't be found. """ for url in ["http://routerlogin.net:5000", "https://routerlogin.net", "http://routerlogin.net"]: try: r = requests.get(url + "/soap/server_...
[ "Try", "to", "autodetect", "the", "base", "URL", "of", "the", "router", "SOAP", "service", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L405-L422
[ "def", "autodetect_url", "(", ")", ":", "for", "url", "in", "[", "\"http://routerlogin.net:5000\"", ",", "\"https://routerlogin.net\"", ",", "\"http://routerlogin.net\"", "]", ":", "try", ":", "r", "=", "requests", ".", "get", "(", "url", "+", "\"/soap/server_sa/\...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
_xml_get
Returns the value of the subnode "name" of element e. Returns None if the subnode doesn't exist
pynetgear/__init__.py
def _xml_get(e, name): """ Returns the value of the subnode "name" of element e. Returns None if the subnode doesn't exist """ r = e.find(name) if r is not None: return r.text return None
def _xml_get(e, name): """ Returns the value of the subnode "name" of element e. Returns None if the subnode doesn't exist """ r = e.find(name) if r is not None: return r.text return None
[ "Returns", "the", "value", "of", "the", "subnode", "name", "of", "element", "e", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L441-L450
[ "def", "_xml_get", "(", "e", ",", "name", ")", ":", "r", "=", "e", ".", "find", "(", "name", ")", "if", "r", "is", "not", "None", ":", "return", "r", ".", "text", "return", "None" ]
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
_convert
Convert value to to_type, returns default if fails.
pynetgear/__init__.py
def _convert(value, to_type, default=None): """Convert value to to_type, returns default if fails.""" try: return default if value is None else to_type(value) except ValueError: # If value could not be converted return default
def _convert(value, to_type, default=None): """Convert value to to_type, returns default if fails.""" try: return default if value is None else to_type(value) except ValueError: # If value could not be converted return default
[ "Convert", "value", "to", "to_type", "returns", "default", "if", "fails", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L474-L480
[ "def", "_convert", "(", "value", ",", "to_type", ",", "default", "=", "None", ")", ":", "try", ":", "return", "default", "if", "value", "is", "None", "else", "to_type", "(", "value", ")", "except", "ValueError", ":", "# If value could not be converted", "ret...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.login
Login to the router. Will be called automatically by other actions.
pynetgear/__init__.py
def login(self): """ Login to the router. Will be called automatically by other actions. """ if not self.force_login_v2: v1_result = self.login_v1() if v1_result: return v1_result return self.login_v2()
def login(self): """ Login to the router. Will be called automatically by other actions. """ if not self.force_login_v2: v1_result = self.login_v1() if v1_result: return v1_result return self.login_v2()
[ "Login", "to", "the", "router", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L82-L93
[ "def", "login", "(", "self", ")", ":", "if", "not", "self", ".", "force_login_v2", ":", "v1_result", "=", "self", ".", "login_v1", "(", ")", "if", "v1_result", ":", "return", "v1_result", "return", "self", ".", "login_v2", "(", ")" ]
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.get_attached_devices
Return list of connected devices to the router. Returns None if error occurred.
pynetgear/__init__.py
def get_attached_devices(self): """ Return list of connected devices to the router. Returns None if error occurred. """ _LOGGER.info("Get attached devices") success, response = self._make_request(SERVICE_DEVICE_INFO, "GetAt...
def get_attached_devices(self): """ Return list of connected devices to the router. Returns None if error occurred. """ _LOGGER.info("Get attached devices") success, response = self._make_request(SERVICE_DEVICE_INFO, "GetAt...
[ "Return", "list", "of", "connected", "devices", "to", "the", "router", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L127-L200
[ "def", "get_attached_devices", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Get attached devices\"", ")", "success", ",", "response", "=", "self", ".", "_make_request", "(", "SERVICE_DEVICE_INFO", ",", "\"GetAttachDevice\"", ")", "if", "not", "success", ...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.get_attached_devices_2
Return list of connected devices to the router with details. This call is slower and probably heavier on the router load. Returns None if error occurred.
pynetgear/__init__.py
def get_attached_devices_2(self): """ Return list of connected devices to the router with details. This call is slower and probably heavier on the router load. Returns None if error occurred. """ _LOGGER.info("Get attached devices 2") success, response = self._...
def get_attached_devices_2(self): """ Return list of connected devices to the router with details. This call is slower and probably heavier on the router load. Returns None if error occurred. """ _LOGGER.info("Get attached devices 2") success, response = self._...
[ "Return", "list", "of", "connected", "devices", "to", "the", "router", "with", "details", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L202-L241
[ "def", "get_attached_devices_2", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Get attached devices 2\"", ")", "success", ",", "response", "=", "self", ".", "_make_request", "(", "SERVICE_DEVICE_INFO", ",", "\"GetAttachDevice2\"", ")", "if", "not", "succe...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.get_traffic_meter
Return dict of traffic meter stats. Returns None if error occurred.
pynetgear/__init__.py
def get_traffic_meter(self): """ Return dict of traffic meter stats. Returns None if error occurred. """ _LOGGER.info("Get traffic meter") def parse_text(text): """ there are three kinds of values in the returned data This fun...
def get_traffic_meter(self): """ Return dict of traffic meter stats. Returns None if error occurred. """ _LOGGER.info("Get traffic meter") def parse_text(text): """ there are three kinds of values in the returned data This fun...
[ "Return", "dict", "of", "traffic", "meter", "stats", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L243-L280
[ "def", "get_traffic_meter", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Get traffic meter\"", ")", "def", "parse_text", "(", "text", ")", ":", "\"\"\"\n there are three kinds of values in the returned data\n This function parses the differ...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.config_start
Start a configuration session. For managing router admin functionality (ie allowing/blocking devices)
pynetgear/__init__.py
def config_start(self): """ Start a configuration session. For managing router admin functionality (ie allowing/blocking devices) """ _LOGGER.info("Config start") success, _ = self._make_request( SERVICE_DEVICE_CONFIG, "ConfigurationStarted", {"NewSessionID":...
def config_start(self): """ Start a configuration session. For managing router admin functionality (ie allowing/blocking devices) """ _LOGGER.info("Config start") success, _ = self._make_request( SERVICE_DEVICE_CONFIG, "ConfigurationStarted", {"NewSessionID":...
[ "Start", "a", "configuration", "session", ".", "For", "managing", "router", "admin", "functionality", "(", "ie", "allowing", "/", "blocking", "devices", ")" ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L282-L293
[ "def", "config_start", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Config start\"", ")", "success", ",", "_", "=", "self", ".", "_make_request", "(", "SERVICE_DEVICE_CONFIG", ",", "\"ConfigurationStarted\"", ",", "{", "\"NewSessionID\"", ":", "SESSION...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.config_finish
End of a configuration session. Tells the router we're done managing admin functionality.
pynetgear/__init__.py
def config_finish(self): """ End of a configuration session. Tells the router we're done managing admin functionality. """ _LOGGER.info("Config finish") if not self.config_started: return True success, _ = self._make_request( SERVICE_DEVIC...
def config_finish(self): """ End of a configuration session. Tells the router we're done managing admin functionality. """ _LOGGER.info("Config finish") if not self.config_started: return True success, _ = self._make_request( SERVICE_DEVIC...
[ "End", "of", "a", "configuration", "session", ".", "Tells", "the", "router", "we", "re", "done", "managing", "admin", "functionality", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L295-L308
[ "def", "config_finish", "(", "self", ")", ":", "_LOGGER", ".", "info", "(", "\"Config finish\"", ")", "if", "not", "self", ".", "config_started", ":", "return", "True", "success", ",", "_", "=", "self", ".", "_make_request", "(", "SERVICE_DEVICE_CONFIG", ","...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear.allow_block_device
Allow or Block a device via its Mac Address. Pass in the mac address for the device that you want to set. Pass in the device_status you wish to set the device to: Allow (allow device to access the network) or Block (block the device from accessing the network).
pynetgear/__init__.py
def allow_block_device(self, mac_addr, device_status=BLOCK): """ Allow or Block a device via its Mac Address. Pass in the mac address for the device that you want to set. Pass in the device_status you wish to set the device to: Allow (allow device to access the network) or Block ...
def allow_block_device(self, mac_addr, device_status=BLOCK): """ Allow or Block a device via its Mac Address. Pass in the mac address for the device that you want to set. Pass in the device_status you wish to set the device to: Allow (allow device to access the network) or Block ...
[ "Allow", "or", "Block", "a", "device", "via", "its", "Mac", "Address", ".", "Pass", "in", "the", "mac", "address", "for", "the", "device", "that", "you", "want", "to", "set", ".", "Pass", "in", "the", "device_status", "you", "wish", "to", "set", "the",...
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L310-L338
[ "def", "allow_block_device", "(", "self", ",", "mac_addr", ",", "device_status", "=", "BLOCK", ")", ":", "_LOGGER", ".", "info", "(", "\"Allow block device\"", ")", "if", "self", ".", "config_started", ":", "_LOGGER", ".", "error", "(", "\"Inconsistant configura...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
Netgear._make_request
Make an API request to the router.
pynetgear/__init__.py
def _make_request(self, service, method, params=None, body="", need_auth=True): """Make an API request to the router.""" # If we have no cookie (v2) or never called login before (v1) # and we need auth, the request will fail for sure. if need_auth and not self.cooki...
def _make_request(self, service, method, params=None, body="", need_auth=True): """Make an API request to the router.""" # If we have no cookie (v2) or never called login before (v1) # and we need auth, the request will fail for sure. if need_auth and not self.cooki...
[ "Make", "an", "API", "request", "to", "the", "router", "." ]
MatMaul/pynetgear
python
https://github.com/MatMaul/pynetgear/blob/247d6b9524fcee4b2da0e65ca12c52ebdd3676b2/pynetgear/__init__.py#L348-L402
[ "def", "_make_request", "(", "self", ",", "service", ",", "method", ",", "params", "=", "None", ",", "body", "=", "\"\"", ",", "need_auth", "=", "True", ")", ":", "# If we have no cookie (v2) or never called login before (v1)", "# and we need auth, the request will fail...
247d6b9524fcee4b2da0e65ca12c52ebdd3676b2
valid
ip2long
Wrapper function for IPv4 and IPv6 converters. :arg ip: IPv4 or IPv6 address
pygeoip/util.py
def ip2long(ip): """ Wrapper function for IPv4 and IPv6 converters. :arg ip: IPv4 or IPv6 address """ try: return int(binascii.hexlify(socket.inet_aton(ip)), 16) except socket.error: return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)
def ip2long(ip): """ Wrapper function for IPv4 and IPv6 converters. :arg ip: IPv4 or IPv6 address """ try: return int(binascii.hexlify(socket.inet_aton(ip)), 16) except socket.error: return int(binascii.hexlify(socket.inet_pton(socket.AF_INET6, ip)), 16)
[ "Wrapper", "function", "for", "IPv4", "and", "IPv6", "converters", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/util.py#L30-L39
[ "def", "ip2long", "(", "ip", ")", ":", "try", ":", "return", "int", "(", "binascii", ".", "hexlify", "(", "socket", ".", "inet_aton", "(", "ip", ")", ")", ",", "16", ")", "except", "socket", ".", "error", ":", "return", "int", "(", "binascii", ".",...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
str2fp
Convert bytes data to file handle object (StringIO or BytesIO). :arg data: String data to transform
pygeoip/util.py
def str2fp(data): """ Convert bytes data to file handle object (StringIO or BytesIO). :arg data: String data to transform """ return BytesIO(bytearray(data, const.ENCODING)) if const.PY3 else StringIO(data)
def str2fp(data): """ Convert bytes data to file handle object (StringIO or BytesIO). :arg data: String data to transform """ return BytesIO(bytearray(data, const.ENCODING)) if const.PY3 else StringIO(data)
[ "Convert", "bytes", "data", "to", "file", "handle", "object", "(", "StringIO", "or", "BytesIO", ")", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/util.py#L42-L48
[ "def", "str2fp", "(", "data", ")", ":", "return", "BytesIO", "(", "bytearray", "(", "data", ",", "const", ".", "ENCODING", ")", ")", "if", "const", ".", "PY3", "else", "StringIO", "(", "data", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP._setup_segments
Parses the database file to determine what kind of database is being used and setup segment sizes and start points that will be used by the seek*() methods later.
pygeoip/__init__.py
def _setup_segments(self): """ Parses the database file to determine what kind of database is being used and setup segment sizes and start points that will be used by the seek*() methods later. """ self._databaseType = const.COUNTRY_EDITION self._recordLength = co...
def _setup_segments(self): """ Parses the database file to determine what kind of database is being used and setup segment sizes and start points that will be used by the seek*() methods later. """ self._databaseType = const.COUNTRY_EDITION self._recordLength = co...
[ "Parses", "the", "database", "file", "to", "determine", "what", "kind", "of", "database", "is", "being", "used", "and", "setup", "segment", "sizes", "and", "start", "points", "that", "will", "be", "used", "by", "the", "seek", "*", "()", "methods", "later",...
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L127-L191
[ "def", "_setup_segments", "(", "self", ")", ":", "self", ".", "_databaseType", "=", "const", ".", "COUNTRY_EDITION", "self", ".", "_recordLength", "=", "const", ".", "STANDARD_RECORD_LENGTH", "self", ".", "_databaseSegments", "=", "const", ".", "COUNTRY_BEGIN", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP._seek_country
Using the record length and appropriate start points, seek to the country that corresponds to the converted IP address integer. Return offset of record. :arg ipnum: Result of ip2long conversion
pygeoip/__init__.py
def _seek_country(self, ipnum): """ Using the record length and appropriate start points, seek to the country that corresponds to the converted IP address integer. Return offset of record. :arg ipnum: Result of ip2long conversion """ try: offset = 0 ...
def _seek_country(self, ipnum): """ Using the record length and appropriate start points, seek to the country that corresponds to the converted IP address integer. Return offset of record. :arg ipnum: Result of ip2long conversion """ try: offset = 0 ...
[ "Using", "the", "record", "length", "and", "appropriate", "start", "points", "seek", "to", "the", "country", "that", "corresponds", "to", "the", "converted", "IP", "address", "integer", ".", "Return", "offset", "of", "record", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L193-L241
[ "def", "_seek_country", "(", "self", ",", "ipnum", ")", ":", "try", ":", "offset", "=", "0", "seek_depth", "=", "127", "if", "len", "(", "str", "(", "ipnum", ")", ")", ">", "10", "else", "31", "for", "depth", "in", "range", "(", "seek_depth", ",", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP._get_org
Seek and return organization or ISP name for ipnum. Return org/isp name. :arg ipnum: Result of ip2long conversion
pygeoip/__init__.py
def _get_org(self, ipnum): """ Seek and return organization or ISP name for ipnum. Return org/isp name. :arg ipnum: Result of ip2long conversion """ seek_org = self._seek_country(ipnum) if seek_org == self._databaseSegments: return None read_...
def _get_org(self, ipnum): """ Seek and return organization or ISP name for ipnum. Return org/isp name. :arg ipnum: Result of ip2long conversion """ seek_org = self._seek_country(ipnum) if seek_org == self._databaseSegments: return None read_...
[ "Seek", "and", "return", "organization", "or", "ISP", "name", "for", "ipnum", ".", "Return", "org", "/", "isp", "name", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L243-L265
[ "def", "_get_org", "(", "self", ",", "ipnum", ")", ":", "seek_org", "=", "self", ".", "_seek_country", "(", "ipnum", ")", "if", "seek_org", "==", "self", ".", "_databaseSegments", ":", "return", "None", "read_length", "=", "(", "2", "*", "self", ".", "...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP._get_region
Seek and return the region information. Returns dict containing country_code and region_code. :arg ipnum: Result of ip2long conversion
pygeoip/__init__.py
def _get_region(self, ipnum): """ Seek and return the region information. Returns dict containing country_code and region_code. :arg ipnum: Result of ip2long conversion """ region_code = None country_code = None seek_country = self._seek_country(ipnum) ...
def _get_region(self, ipnum): """ Seek and return the region information. Returns dict containing country_code and region_code. :arg ipnum: Result of ip2long conversion """ region_code = None country_code = None seek_country = self._seek_country(ipnum) ...
[ "Seek", "and", "return", "the", "region", "information", ".", "Returns", "dict", "containing", "country_code", "and", "region_code", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L267-L309
[ "def", "_get_region", "(", "self", ",", "ipnum", ")", ":", "region_code", "=", "None", "country_code", "=", "None", "seek_country", "=", "self", ".", "_seek_country", "(", "ipnum", ")", "def", "get_region_code", "(", "offset", ")", ":", "region1", "=", "ch...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP._get_record
Populate location dict for converted IP. Returns dict with numerous location properties. :arg ipnum: Result of ip2long conversion
pygeoip/__init__.py
def _get_record(self, ipnum): """ Populate location dict for converted IP. Returns dict with numerous location properties. :arg ipnum: Result of ip2long conversion """ seek_country = self._seek_country(ipnum) if seek_country == self._databaseSegments: ...
def _get_record(self, ipnum): """ Populate location dict for converted IP. Returns dict with numerous location properties. :arg ipnum: Result of ip2long conversion """ seek_country = self._seek_country(ipnum) if seek_country == self._databaseSegments: ...
[ "Populate", "location", "dict", "for", "converted", "IP", ".", "Returns", "dict", "with", "numerous", "location", "properties", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L311-L382
[ "def", "_get_record", "(", "self", ",", "ipnum", ")", ":", "seek_country", "=", "self", ".", "_seek_country", "(", "ipnum", ")", "if", "seek_country", "==", "self", ".", "_databaseSegments", ":", "return", "{", "}", "read_length", "=", "(", "2", "*", "se...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP._gethostbyname
Hostname lookup method, supports both IPv4 and IPv6.
pygeoip/__init__.py
def _gethostbyname(self, hostname): """ Hostname lookup method, supports both IPv4 and IPv6. """ if self._databaseType in const.IPV6_EDITIONS: response = socket.getaddrinfo(hostname, 0, socket.AF_INET6) family, socktype, proto, canonname, sockaddr = response[0] ...
def _gethostbyname(self, hostname): """ Hostname lookup method, supports both IPv4 and IPv6. """ if self._databaseType in const.IPV6_EDITIONS: response = socket.getaddrinfo(hostname, 0, socket.AF_INET6) family, socktype, proto, canonname, sockaddr = response[0] ...
[ "Hostname", "lookup", "method", "supports", "both", "IPv4", "and", "IPv6", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L384-L394
[ "def", "_gethostbyname", "(", "self", ",", "hostname", ")", ":", "if", "self", ".", "_databaseType", "in", "const", ".", "IPV6_EDITIONS", ":", "response", "=", "socket", ".", "getaddrinfo", "(", "hostname", ",", "0", ",", "socket", ".", "AF_INET6", ")", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.id_by_name
Returns the database ID for specified hostname. The id might be useful as array index. 0 is unknown. :arg hostname: Hostname to get ID from.
pygeoip/__init__.py
def id_by_name(self, hostname): """ Returns the database ID for specified hostname. The id might be useful as array index. 0 is unknown. :arg hostname: Hostname to get ID from. """ addr = self._gethostbyname(hostname) return self.id_by_addr(addr)
def id_by_name(self, hostname): """ Returns the database ID for specified hostname. The id might be useful as array index. 0 is unknown. :arg hostname: Hostname to get ID from. """ addr = self._gethostbyname(hostname) return self.id_by_addr(addr)
[ "Returns", "the", "database", "ID", "for", "specified", "hostname", ".", "The", "id", "might", "be", "useful", "as", "array", "index", ".", "0", "is", "unknown", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L396-L404
[ "def", "id_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "id_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.id_by_addr
Returns the database ID for specified address. The ID might be useful as array index. 0 is unknown. :arg addr: IPv4 or IPv6 address (eg. 203.0.113.30)
pygeoip/__init__.py
def id_by_addr(self, addr): """ Returns the database ID for specified address. The ID might be useful as array index. 0 is unknown. :arg addr: IPv4 or IPv6 address (eg. 203.0.113.30) """ if self._databaseType in (const.PROXY_EDITION, const.NETSPEED_EDITION_REV1, const.NE...
def id_by_addr(self, addr): """ Returns the database ID for specified address. The ID might be useful as array index. 0 is unknown. :arg addr: IPv4 or IPv6 address (eg. 203.0.113.30) """ if self._databaseType in (const.PROXY_EDITION, const.NETSPEED_EDITION_REV1, const.NE...
[ "Returns", "the", "database", "ID", "for", "specified", "address", ".", "The", "ID", "might", "be", "useful", "as", "array", "index", ".", "0", "is", "unknown", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L406-L422
[ "def", "id_by_addr", "(", "self", ",", "addr", ")", ":", "if", "self", ".", "_databaseType", "in", "(", "const", ".", "PROXY_EDITION", ",", "const", ".", "NETSPEED_EDITION_REV1", ",", "const", ".", "NETSPEED_EDITION_REV1_V6", ")", ":", "raise", "GeoIPError", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.country_code_by_addr
Returns 2-letter country code (e.g. US) from IP address. :arg addr: IP address (e.g. 203.0.113.30)
pygeoip/__init__.py
def country_code_by_addr(self, addr): """ Returns 2-letter country code (e.g. US) from IP address. :arg addr: IP address (e.g. 203.0.113.30) """ VALID_EDITIONS = (const.COUNTRY_EDITION, const.COUNTRY_EDITION_V6) if self._databaseType in VALID_EDITIONS: countr...
def country_code_by_addr(self, addr): """ Returns 2-letter country code (e.g. US) from IP address. :arg addr: IP address (e.g. 203.0.113.30) """ VALID_EDITIONS = (const.COUNTRY_EDITION, const.COUNTRY_EDITION_V6) if self._databaseType in VALID_EDITIONS: countr...
[ "Returns", "2", "-", "letter", "country", "code", "(", "e", ".", "g", ".", "US", ")", "from", "IP", "address", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L430-L443
[ "def", "country_code_by_addr", "(", "self", ",", "addr", ")", ":", "VALID_EDITIONS", "=", "(", "const", ".", "COUNTRY_EDITION", ",", "const", ".", "COUNTRY_EDITION_V6", ")", "if", "self", ".", "_databaseType", "in", "VALID_EDITIONS", ":", "country_id", "=", "s...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.country_code_by_name
Returns 2-letter country code (e.g. US) from hostname. :arg hostname: Hostname (e.g. example.com)
pygeoip/__init__.py
def country_code_by_name(self, hostname): """ Returns 2-letter country code (e.g. US) from hostname. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.country_code_by_addr(addr)
def country_code_by_name(self, hostname): """ Returns 2-letter country code (e.g. US) from hostname. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.country_code_by_addr(addr)
[ "Returns", "2", "-", "letter", "country", "code", "(", "e", ".", "g", ".", "US", ")", "from", "hostname", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L445-L452
[ "def", "country_code_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "country_code_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.netspeed_by_addr
Returns NetSpeed name from address. :arg addr: IP address (e.g. 203.0.113.30)
pygeoip/__init__.py
def netspeed_by_addr(self, addr): """ Returns NetSpeed name from address. :arg addr: IP address (e.g. 203.0.113.30) """ if self._databaseType == const.NETSPEED_EDITION: return const.NETSPEED_NAMES[self.id_by_addr(addr)] elif self._databaseType in (const.NETSP...
def netspeed_by_addr(self, addr): """ Returns NetSpeed name from address. :arg addr: IP address (e.g. 203.0.113.30) """ if self._databaseType == const.NETSPEED_EDITION: return const.NETSPEED_NAMES[self.id_by_addr(addr)] elif self._databaseType in (const.NETSP...
[ "Returns", "NetSpeed", "name", "from", "address", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L454-L468
[ "def", "netspeed_by_addr", "(", "self", ",", "addr", ")", ":", "if", "self", ".", "_databaseType", "==", "const", ".", "NETSPEED_EDITION", ":", "return", "const", ".", "NETSPEED_NAMES", "[", "self", ".", "id_by_addr", "(", "addr", ")", "]", "elif", "self",...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.netspeed_by_name
Returns NetSpeed name from hostname. Can be Unknown, Dial-up, Cable, or Corporate. :arg hostname: Hostname (e.g. example.com)
pygeoip/__init__.py
def netspeed_by_name(self, hostname): """ Returns NetSpeed name from hostname. Can be Unknown, Dial-up, Cable, or Corporate. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.netspeed_by_addr(addr)
def netspeed_by_name(self, hostname): """ Returns NetSpeed name from hostname. Can be Unknown, Dial-up, Cable, or Corporate. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.netspeed_by_addr(addr)
[ "Returns", "NetSpeed", "name", "from", "hostname", ".", "Can", "be", "Unknown", "Dial", "-", "up", "Cable", "or", "Corporate", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L470-L478
[ "def", "netspeed_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "netspeed_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.country_name_by_addr
Returns full country name for specified IP address. :arg addr: IP address (e.g. 203.0.113.30)
pygeoip/__init__.py
def country_name_by_addr(self, addr): """ Returns full country name for specified IP address. :arg addr: IP address (e.g. 203.0.113.30) """ VALID_EDITIONS = (const.COUNTRY_EDITION, const.COUNTRY_EDITION_V6) if self._databaseType in VALID_EDITIONS: country_id ...
def country_name_by_addr(self, addr): """ Returns full country name for specified IP address. :arg addr: IP address (e.g. 203.0.113.30) """ VALID_EDITIONS = (const.COUNTRY_EDITION, const.COUNTRY_EDITION_V6) if self._databaseType in VALID_EDITIONS: country_id ...
[ "Returns", "full", "country", "name", "for", "specified", "IP", "address", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L480-L494
[ "def", "country_name_by_addr", "(", "self", ",", "addr", ")", ":", "VALID_EDITIONS", "=", "(", "const", ".", "COUNTRY_EDITION", ",", "const", ".", "COUNTRY_EDITION_V6", ")", "if", "self", ".", "_databaseType", "in", "VALID_EDITIONS", ":", "country_id", "=", "s...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.country_name_by_name
Returns full country name for specified hostname. :arg hostname: Hostname (e.g. example.com)
pygeoip/__init__.py
def country_name_by_name(self, hostname): """ Returns full country name for specified hostname. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.country_name_by_addr(addr)
def country_name_by_name(self, hostname): """ Returns full country name for specified hostname. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.country_name_by_addr(addr)
[ "Returns", "full", "country", "name", "for", "specified", "hostname", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L496-L503
[ "def", "country_name_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "country_name_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.org_by_addr
Returns Organization, ISP, or ASNum name for given IP address. :arg addr: IP address (e.g. 203.0.113.30)
pygeoip/__init__.py
def org_by_addr(self, addr): """ Returns Organization, ISP, or ASNum name for given IP address. :arg addr: IP address (e.g. 203.0.113.30) """ valid = (const.ORG_EDITION, const.ISP_EDITION, const.ASNUM_EDITION, const.ASNUM_EDITION_V6) if self._databaseTyp...
def org_by_addr(self, addr): """ Returns Organization, ISP, or ASNum name for given IP address. :arg addr: IP address (e.g. 203.0.113.30) """ valid = (const.ORG_EDITION, const.ISP_EDITION, const.ASNUM_EDITION, const.ASNUM_EDITION_V6) if self._databaseTyp...
[ "Returns", "Organization", "ISP", "or", "ASNum", "name", "for", "given", "IP", "address", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L505-L518
[ "def", "org_by_addr", "(", "self", ",", "addr", ")", ":", "valid", "=", "(", "const", ".", "ORG_EDITION", ",", "const", ".", "ISP_EDITION", ",", "const", ".", "ASNUM_EDITION", ",", "const", ".", "ASNUM_EDITION_V6", ")", "if", "self", ".", "_databaseType", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.org_by_name
Returns Organization, ISP, or ASNum name for given hostname. :arg hostname: Hostname (e.g. example.com)
pygeoip/__init__.py
def org_by_name(self, hostname): """ Returns Organization, ISP, or ASNum name for given hostname. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.org_by_addr(addr)
def org_by_name(self, hostname): """ Returns Organization, ISP, or ASNum name for given hostname. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.org_by_addr(addr)
[ "Returns", "Organization", "ISP", "or", "ASNum", "name", "for", "given", "hostname", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L520-L527
[ "def", "org_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "org_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.record_by_addr
Returns dictionary with city data containing `country_code`, `country_name`, `region`, `city`, `postal_code`, `latitude`, `longitude`, `dma_code`, `metro_code`, `area_code`, `region_code` and `time_zone`. :arg addr: IP address (e.g. 203.0.113.30)
pygeoip/__init__.py
def record_by_addr(self, addr): """ Returns dictionary with city data containing `country_code`, `country_name`, `region`, `city`, `postal_code`, `latitude`, `longitude`, `dma_code`, `metro_code`, `area_code`, `region_code` and `time_zone`. :arg addr: IP address (e.g. 203.0.113....
def record_by_addr(self, addr): """ Returns dictionary with city data containing `country_code`, `country_name`, `region`, `city`, `postal_code`, `latitude`, `longitude`, `dma_code`, `metro_code`, `area_code`, `region_code` and `time_zone`. :arg addr: IP address (e.g. 203.0.113....
[ "Returns", "dictionary", "with", "city", "data", "containing", "country_code", "country_name", "region", "city", "postal_code", "latitude", "longitude", "dma_code", "metro_code", "area_code", "region_code", "and", "time_zone", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L534-L551
[ "def", "record_by_addr", "(", "self", ",", "addr", ")", ":", "if", "self", ".", "_databaseType", "not", "in", "const", ".", "CITY_EDITIONS", ":", "message", "=", "'Invalid database type, expected City'", "raise", "GeoIPError", "(", "message", ")", "ipnum", "=", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.record_by_name
Returns dictionary with city data containing `country_code`, `country_name`, `region`, `city`, `postal_code`, `latitude`, `longitude`, `dma_code`, `metro_code`, `area_code`, `region_code` and `time_zone`. :arg hostname: Hostname (e.g. example.com)
pygeoip/__init__.py
def record_by_name(self, hostname): """ Returns dictionary with city data containing `country_code`, `country_name`, `region`, `city`, `postal_code`, `latitude`, `longitude`, `dma_code`, `metro_code`, `area_code`, `region_code` and `time_zone`. :arg hostname: Hostname (e.g. exam...
def record_by_name(self, hostname): """ Returns dictionary with city data containing `country_code`, `country_name`, `region`, `city`, `postal_code`, `latitude`, `longitude`, `dma_code`, `metro_code`, `area_code`, `region_code` and `time_zone`. :arg hostname: Hostname (e.g. exam...
[ "Returns", "dictionary", "with", "city", "data", "containing", "country_code", "country_name", "region", "city", "postal_code", "latitude", "longitude", "dma_code", "metro_code", "area_code", "region_code", "and", "time_zone", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L553-L562
[ "def", "record_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "record_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.region_by_addr
Returns dictionary containing `country_code` and `region_code`. :arg addr: IP address (e.g. 203.0.113.30)
pygeoip/__init__.py
def region_by_addr(self, addr): """ Returns dictionary containing `country_code` and `region_code`. :arg addr: IP address (e.g. 203.0.113.30) """ if self._databaseType not in const.REGION_CITY_EDITIONS: message = 'Invalid database type, expected Region or City' ...
def region_by_addr(self, addr): """ Returns dictionary containing `country_code` and `region_code`. :arg addr: IP address (e.g. 203.0.113.30) """ if self._databaseType not in const.REGION_CITY_EDITIONS: message = 'Invalid database type, expected Region or City' ...
[ "Returns", "dictionary", "containing", "country_code", "and", "region_code", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L564-L575
[ "def", "region_by_addr", "(", "self", ",", "addr", ")", ":", "if", "self", ".", "_databaseType", "not", "in", "const", ".", "REGION_CITY_EDITIONS", ":", "message", "=", "'Invalid database type, expected Region or City'", "raise", "GeoIPError", "(", "message", ")", ...
2a725df0b727e8b08f217ab84f7b8243c42554f5
valid
GeoIP.region_by_name
Returns dictionary containing `country_code` and `region_code`. :arg hostname: Hostname (e.g. example.com)
pygeoip/__init__.py
def region_by_name(self, hostname): """ Returns dictionary containing `country_code` and `region_code`. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.region_by_addr(addr)
def region_by_name(self, hostname): """ Returns dictionary containing `country_code` and `region_code`. :arg hostname: Hostname (e.g. example.com) """ addr = self._gethostbyname(hostname) return self.region_by_addr(addr)
[ "Returns", "dictionary", "containing", "country_code", "and", "region_code", "." ]
appliedsec/pygeoip
python
https://github.com/appliedsec/pygeoip/blob/2a725df0b727e8b08f217ab84f7b8243c42554f5/pygeoip/__init__.py#L577-L584
[ "def", "region_by_name", "(", "self", ",", "hostname", ")", ":", "addr", "=", "self", ".", "_gethostbyname", "(", "hostname", ")", "return", "self", ".", "region_by_addr", "(", "addr", ")" ]
2a725df0b727e8b08f217ab84f7b8243c42554f5