repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
cbclab/MOT | mot/mcmc_diagnostics.py | get_auto_correlation_time | def get_auto_correlation_time(chain, max_lag=None):
r"""Compute the auto correlation time up to the given lag for the given chain (1d vector).
This will halt when the maximum lag :math:`m` is reached or when the sum of two consecutive lags for any
odd lag is lower or equal to zero.
The auto correlatio... | python | def get_auto_correlation_time(chain, max_lag=None):
r"""Compute the auto correlation time up to the given lag for the given chain (1d vector).
This will halt when the maximum lag :math:`m` is reached or when the sum of two consecutive lags for any
odd lag is lower or equal to zero.
The auto correlatio... | [
"def",
"get_auto_correlation_time",
"(",
"chain",
",",
"max_lag",
"=",
"None",
")",
":",
"max_lag",
"=",
"max_lag",
"or",
"min",
"(",
"len",
"(",
"chain",
")",
"//",
"3",
",",
"1000",
")",
"normalized_chain",
"=",
"chain",
"-",
"np",
".",
"mean",
"(",
... | r"""Compute the auto correlation time up to the given lag for the given chain (1d vector).
This will halt when the maximum lag :math:`m` is reached or when the sum of two consecutive lags for any
odd lag is lower or equal to zero.
The auto correlation sum is estimated as:
.. math::
\tau = 1 ... | [
"r",
"Compute",
"the",
"auto",
"correlation",
"time",
"up",
"to",
"the",
"given",
"lag",
"for",
"the",
"given",
"chain",
"(",
"1d",
"vector",
")",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L153-L194 |
cbclab/MOT | mot/mcmc_diagnostics.py | estimate_univariate_ess_standard_error | def estimate_univariate_ess_standard_error(chain, batch_size_generator=None, compute_method=None):
r"""Compute the univariate ESS using the standard error method.
This computes the ESS using:
.. math::
ESS(X) = n * \frac{\lambda^{2}}{\sigma^{2}}
Where :math:`\lambda` is the standard deviatio... | python | def estimate_univariate_ess_standard_error(chain, batch_size_generator=None, compute_method=None):
r"""Compute the univariate ESS using the standard error method.
This computes the ESS using:
.. math::
ESS(X) = n * \frac{\lambda^{2}}{\sigma^{2}}
Where :math:`\lambda` is the standard deviatio... | [
"def",
"estimate_univariate_ess_standard_error",
"(",
"chain",
",",
"batch_size_generator",
"=",
"None",
",",
"compute_method",
"=",
"None",
")",
":",
"sigma",
"=",
"(",
"monte_carlo_standard_error",
"(",
"chain",
",",
"batch_size_generator",
"=",
"batch_size_generator"... | r"""Compute the univariate ESS using the standard error method.
This computes the ESS using:
.. math::
ESS(X) = n * \frac{\lambda^{2}}{\sigma^{2}}
Where :math:`\lambda` is the standard deviation of the chain and :math:`\sigma` is estimated using the monte carlo
standard error (which in turn ... | [
"r",
"Compute",
"the",
"univariate",
"ESS",
"using",
"the",
"standard",
"error",
"method",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L230-L255 |
cbclab/MOT | mot/mcmc_diagnostics.py | minimum_multivariate_ess | def minimum_multivariate_ess(nmr_params, alpha=0.05, epsilon=0.05):
r"""Calculate the minimum multivariate Effective Sample Size you will need to obtain the desired precision.
This implements the inequality from Vats et al. (2016):
.. math::
\widehat{ESS} \geq \frac{2^{2/p}\pi}{(p\Gamma(p/2))^{2/... | python | def minimum_multivariate_ess(nmr_params, alpha=0.05, epsilon=0.05):
r"""Calculate the minimum multivariate Effective Sample Size you will need to obtain the desired precision.
This implements the inequality from Vats et al. (2016):
.. math::
\widehat{ESS} \geq \frac{2^{2/p}\pi}{(p\Gamma(p/2))^{2/... | [
"def",
"minimum_multivariate_ess",
"(",
"nmr_params",
",",
"alpha",
"=",
"0.05",
",",
"epsilon",
"=",
"0.05",
")",
":",
"tmp",
"=",
"2.0",
"/",
"nmr_params",
"log_min_ess",
"=",
"tmp",
"*",
"np",
".",
"log",
"(",
"2",
")",
"+",
"np",
".",
"log",
"(",... | r"""Calculate the minimum multivariate Effective Sample Size you will need to obtain the desired precision.
This implements the inequality from Vats et al. (2016):
.. math::
\widehat{ESS} \geq \frac{2^{2/p}\pi}{(p\Gamma(p/2))^{2/p}} \frac{\chi^{2}_{1-\alpha,p}}{\epsilon^{2}}
Where :math:`p` is t... | [
"r",
"Calculate",
"the",
"minimum",
"multivariate",
"Effective",
"Sample",
"Size",
"you",
"will",
"need",
"to",
"obtain",
"the",
"desired",
"precision",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L258-L288 |
cbclab/MOT | mot/mcmc_diagnostics.py | multivariate_ess_precision | def multivariate_ess_precision(nmr_params, multi_variate_ess, alpha=0.05):
r"""Calculate the precision given your multivariate Effective Sample Size.
Given that you obtained :math:`ESS` multivariate effective samples in your estimate you can calculate the
precision with which you approximated your desired ... | python | def multivariate_ess_precision(nmr_params, multi_variate_ess, alpha=0.05):
r"""Calculate the precision given your multivariate Effective Sample Size.
Given that you obtained :math:`ESS` multivariate effective samples in your estimate you can calculate the
precision with which you approximated your desired ... | [
"def",
"multivariate_ess_precision",
"(",
"nmr_params",
",",
"multi_variate_ess",
",",
"alpha",
"=",
"0.05",
")",
":",
"tmp",
"=",
"2.0",
"/",
"nmr_params",
"log_min_ess",
"=",
"tmp",
"*",
"np",
".",
"log",
"(",
"2",
")",
"+",
"np",
".",
"log",
"(",
"n... | r"""Calculate the precision given your multivariate Effective Sample Size.
Given that you obtained :math:`ESS` multivariate effective samples in your estimate you can calculate the
precision with which you approximated your desired confidence region.
This implements the inequality from Vats et al. (2016),... | [
"r",
"Calculate",
"the",
"precision",
"given",
"your",
"multivariate",
"Effective",
"Sample",
"Size",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L291-L323 |
cbclab/MOT | mot/mcmc_diagnostics.py | estimate_multivariate_ess_sigma | def estimate_multivariate_ess_sigma(samples, batch_size):
r"""Calculates the Sigma matrix which is part of the multivariate ESS calculation.
This implementation is based on the Matlab implementation found at: https://github.com/lacerbi/multiESS
The Sigma matrix is defined as:
.. math::
\Sigm... | python | def estimate_multivariate_ess_sigma(samples, batch_size):
r"""Calculates the Sigma matrix which is part of the multivariate ESS calculation.
This implementation is based on the Matlab implementation found at: https://github.com/lacerbi/multiESS
The Sigma matrix is defined as:
.. math::
\Sigm... | [
"def",
"estimate_multivariate_ess_sigma",
"(",
"samples",
",",
"batch_size",
")",
":",
"sample_means",
"=",
"np",
".",
"mean",
"(",
"samples",
",",
"axis",
"=",
"1",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"nmr_params",
",",
"chain_length",
"=",
"sam... | r"""Calculates the Sigma matrix which is part of the multivariate ESS calculation.
This implementation is based on the Matlab implementation found at: https://github.com/lacerbi/multiESS
The Sigma matrix is defined as:
.. math::
\Sigma = \Lambda + 2 * \sum_{k=1}^{\infty}{Cov(Y_{1}, Y_{1+k})}
... | [
"r",
"Calculates",
"the",
"Sigma",
"matrix",
"which",
"is",
"part",
"of",
"the",
"multivariate",
"ESS",
"calculation",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L326-L377 |
cbclab/MOT | mot/mcmc_diagnostics.py | estimate_multivariate_ess | def estimate_multivariate_ess(samples, batch_size_generator=None, full_output=False):
r"""Compute the multivariate Effective Sample Size of your (single instance set of) samples.
This multivariate ESS is defined in Vats et al. (2016) and is given by:
.. math::
ESS = n \bigg(\frac{|\Lambda|}{|\Sig... | python | def estimate_multivariate_ess(samples, batch_size_generator=None, full_output=False):
r"""Compute the multivariate Effective Sample Size of your (single instance set of) samples.
This multivariate ESS is defined in Vats et al. (2016) and is given by:
.. math::
ESS = n \bigg(\frac{|\Lambda|}{|\Sig... | [
"def",
"estimate_multivariate_ess",
"(",
"samples",
",",
"batch_size_generator",
"=",
"None",
",",
"full_output",
"=",
"False",
")",
":",
"batch_size_generator",
"=",
"batch_size_generator",
"or",
"SquareRootSingleBatch",
"(",
")",
"batch_sizes",
"=",
"batch_size_genera... | r"""Compute the multivariate Effective Sample Size of your (single instance set of) samples.
This multivariate ESS is defined in Vats et al. (2016) and is given by:
.. math::
ESS = n \bigg(\frac{|\Lambda|}{|\Sigma|}\bigg)^{1/p}
Where :math:`n` is the number of samples, :math:`p` the number of pa... | [
"r",
"Compute",
"the",
"multivariate",
"Effective",
"Sample",
"Size",
"of",
"your",
"(",
"single",
"instance",
"set",
"of",
")",
"samples",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L380-L441 |
cbclab/MOT | mot/mcmc_diagnostics.py | monte_carlo_standard_error | def monte_carlo_standard_error(chain, batch_size_generator=None, compute_method=None):
"""Compute Monte Carlo standard errors for the expectations
This is a convenience function that calls the compute method for each batch size and returns the lowest ESS
over the used batch sizes.
Args:
chain ... | python | def monte_carlo_standard_error(chain, batch_size_generator=None, compute_method=None):
"""Compute Monte Carlo standard errors for the expectations
This is a convenience function that calls the compute method for each batch size and returns the lowest ESS
over the used batch sizes.
Args:
chain ... | [
"def",
"monte_carlo_standard_error",
"(",
"chain",
",",
"batch_size_generator",
"=",
"None",
",",
"compute_method",
"=",
"None",
")",
":",
"batch_size_generator",
"=",
"batch_size_generator",
"or",
"SquareRootSingleBatch",
"(",
")",
"compute_method",
"=",
"compute_metho... | Compute Monte Carlo standard errors for the expectations
This is a convenience function that calls the compute method for each batch size and returns the lowest ESS
over the used batch sizes.
Args:
chain (ndarray): the Markov chain
batch_size_generator (UniVariateESSBatchSizeGenerator): th... | [
"Compute",
"Monte",
"Carlo",
"standard",
"errors",
"for",
"the",
"expectations"
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/mcmc_diagnostics.py#L444-L462 |
cbclab/MOT | mot/stats.py | fit_gaussian | def fit_gaussian(samples, ddof=0):
"""Calculates the mean and the standard deviation of the given samples.
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we calculate the fit using all
values. If two dimensional, we fit the Gaussian for every set of samples over... | python | def fit_gaussian(samples, ddof=0):
"""Calculates the mean and the standard deviation of the given samples.
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we calculate the fit using all
values. If two dimensional, we fit the Gaussian for every set of samples over... | [
"def",
"fit_gaussian",
"(",
"samples",
",",
"ddof",
"=",
"0",
")",
":",
"if",
"len",
"(",
"samples",
".",
"shape",
")",
"==",
"1",
":",
"return",
"np",
".",
"mean",
"(",
"samples",
")",
",",
"np",
".",
"std",
"(",
"samples",
",",
"ddof",
"=",
"... | Calculates the mean and the standard deviation of the given samples.
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we calculate the fit using all
values. If two dimensional, we fit the Gaussian for every set of samples over the first dimension.
ddof (int): ... | [
"Calculates",
"the",
"mean",
"and",
"the",
"standard",
"deviation",
"of",
"the",
"given",
"samples",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L18-L28 |
cbclab/MOT | mot/stats.py | fit_circular_gaussian | def fit_circular_gaussian(samples, high=np.pi, low=0):
"""Compute the circular mean for samples in a range
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we calculate the fit using all
values. If two dimensional, we fit the Gaussian for every set of samples over... | python | def fit_circular_gaussian(samples, high=np.pi, low=0):
"""Compute the circular mean for samples in a range
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we calculate the fit using all
values. If two dimensional, we fit the Gaussian for every set of samples over... | [
"def",
"fit_circular_gaussian",
"(",
"samples",
",",
"high",
"=",
"np",
".",
"pi",
",",
"low",
"=",
"0",
")",
":",
"cl_func",
"=",
"SimpleCLFunction",
".",
"from_string",
"(",
"'''\n void compute(global mot_float_type* samples,\n global mot_floa... | Compute the circular mean for samples in a range
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we calculate the fit using all
values. If two dimensional, we fit the Gaussian for every set of samples over the first dimension.
high (float): The maximum wrap p... | [
"Compute",
"the",
"circular",
"mean",
"for",
"samples",
"in",
"a",
"range"
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L31-L91 |
cbclab/MOT | mot/stats.py | fit_truncated_gaussian | def fit_truncated_gaussian(samples, lower_bounds, upper_bounds):
"""Fits a truncated gaussian distribution on the given samples.
This will do a maximum likelihood estimation of a truncated Gaussian on the provided samples, with the
truncation points given by the lower and upper bounds.
Args:
s... | python | def fit_truncated_gaussian(samples, lower_bounds, upper_bounds):
"""Fits a truncated gaussian distribution on the given samples.
This will do a maximum likelihood estimation of a truncated Gaussian on the provided samples, with the
truncation points given by the lower and upper bounds.
Args:
s... | [
"def",
"fit_truncated_gaussian",
"(",
"samples",
",",
"lower_bounds",
",",
"upper_bounds",
")",
":",
"if",
"len",
"(",
"samples",
".",
"shape",
")",
"==",
"1",
":",
"return",
"_TruncatedNormalFitter",
"(",
")",
"(",
"(",
"samples",
",",
"lower_bounds",
",",
... | Fits a truncated gaussian distribution on the given samples.
This will do a maximum likelihood estimation of a truncated Gaussian on the provided samples, with the
truncation points given by the lower and upper bounds.
Args:
samples (ndarray): a one or two dimensional array. If one dimensional we ... | [
"Fits",
"a",
"truncated",
"gaussian",
"distribution",
"on",
"the",
"given",
"samples",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L94-L130 |
cbclab/MOT | mot/stats.py | gaussian_overlapping_coefficient | def gaussian_overlapping_coefficient(means_0, stds_0, means_1, stds_1, lower=None, upper=None):
"""Compute the overlapping coefficient of two Gaussian continuous_distributions.
This computes the :math:`\int_{-\infty}^{\infty}{\min(f(x), g(x))\partial x}` where
:math:`f \sim \mathcal{N}(\mu_0, \sigma_0^{2})... | python | def gaussian_overlapping_coefficient(means_0, stds_0, means_1, stds_1, lower=None, upper=None):
"""Compute the overlapping coefficient of two Gaussian continuous_distributions.
This computes the :math:`\int_{-\infty}^{\infty}{\min(f(x), g(x))\partial x}` where
:math:`f \sim \mathcal{N}(\mu_0, \sigma_0^{2})... | [
"def",
"gaussian_overlapping_coefficient",
"(",
"means_0",
",",
"stds_0",
",",
"means_1",
",",
"stds_1",
",",
"lower",
"=",
"None",
",",
"upper",
"=",
"None",
")",
":",
"if",
"lower",
"is",
"None",
":",
"lower",
"=",
"-",
"np",
".",
"inf",
"if",
"upper... | Compute the overlapping coefficient of two Gaussian continuous_distributions.
This computes the :math:`\int_{-\infty}^{\infty}{\min(f(x), g(x))\partial x}` where
:math:`f \sim \mathcal{N}(\mu_0, \sigma_0^{2})` and :math:`f \sim \mathcal{N}(\mu_1, \sigma_1^{2})` are normally
distributed variables.
This... | [
"Compute",
"the",
"overlapping",
"coefficient",
"of",
"two",
"Gaussian",
"continuous_distributions",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L133-L159 |
cbclab/MOT | mot/stats.py | deviance_information_criterions | def deviance_information_criterions(mean_posterior_lls, ll_per_sample):
r"""Calculates the Deviance Information Criteria (DIC) using three methods.
This returns a dictionary returning the ``DIC_2002``, the ``DIC_2004`` and the ``DIC_Ando_2011`` method.
The first is based on Spiegelhalter et al (2002), the ... | python | def deviance_information_criterions(mean_posterior_lls, ll_per_sample):
r"""Calculates the Deviance Information Criteria (DIC) using three methods.
This returns a dictionary returning the ``DIC_2002``, the ``DIC_2004`` and the ``DIC_Ando_2011`` method.
The first is based on Spiegelhalter et al (2002), the ... | [
"def",
"deviance_information_criterions",
"(",
"mean_posterior_lls",
",",
"ll_per_sample",
")",
":",
"mean_deviance",
"=",
"-",
"2",
"*",
"np",
".",
"mean",
"(",
"ll_per_sample",
",",
"axis",
"=",
"1",
")",
"deviance_at_mean",
"=",
"-",
"2",
"*",
"mean_posteri... | r"""Calculates the Deviance Information Criteria (DIC) using three methods.
This returns a dictionary returning the ``DIC_2002``, the ``DIC_2004`` and the ``DIC_Ando_2011`` method.
The first is based on Spiegelhalter et al (2002), the second based on Gelman et al. (2004) and the last on
Ando (2011). All ca... | [
"r",
"Calculates",
"the",
"Deviance",
"Information",
"Criteria",
"(",
"DIC",
")",
"using",
"three",
"methods",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L162-L239 |
cbclab/MOT | mot/stats.py | _TruncatedNormalFitter.truncated_normal_log_likelihood | def truncated_normal_log_likelihood(params, low, high, data):
"""Calculate the log likelihood of the truncated normal distribution.
Args:
params: tuple with (mean, std), the parameters under which we evaluate the model
low (float): the lower truncation bound
high (fl... | python | def truncated_normal_log_likelihood(params, low, high, data):
"""Calculate the log likelihood of the truncated normal distribution.
Args:
params: tuple with (mean, std), the parameters under which we evaluate the model
low (float): the lower truncation bound
high (fl... | [
"def",
"truncated_normal_log_likelihood",
"(",
"params",
",",
"low",
",",
"high",
",",
"data",
")",
":",
"mu",
"=",
"params",
"[",
"0",
"]",
"sigma",
"=",
"params",
"[",
"1",
"]",
"if",
"sigma",
"==",
"0",
":",
"return",
"np",
".",
"inf",
"ll",
"="... | Calculate the log likelihood of the truncated normal distribution.
Args:
params: tuple with (mean, std), the parameters under which we evaluate the model
low (float): the lower truncation bound
high (float): the upper truncation bound
data (ndarray): the one dime... | [
"Calculate",
"the",
"log",
"likelihood",
"of",
"the",
"truncated",
"normal",
"distribution",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L291-L310 |
cbclab/MOT | mot/stats.py | _TruncatedNormalFitter.truncated_normal_ll_gradient | def truncated_normal_ll_gradient(params, low, high, data):
"""Return the gradient of the log likelihood of the truncated normal at the given position.
Args:
params: tuple with (mean, std), the parameters under which we evaluate the model
low (float): the lower truncation bound
... | python | def truncated_normal_ll_gradient(params, low, high, data):
"""Return the gradient of the log likelihood of the truncated normal at the given position.
Args:
params: tuple with (mean, std), the parameters under which we evaluate the model
low (float): the lower truncation bound
... | [
"def",
"truncated_normal_ll_gradient",
"(",
"params",
",",
"low",
",",
"high",
",",
"data",
")",
":",
"if",
"params",
"[",
"1",
"]",
"==",
"0",
":",
"return",
"np",
".",
"array",
"(",
"[",
"np",
".",
"inf",
",",
"np",
".",
"inf",
"]",
")",
"retur... | Return the gradient of the log likelihood of the truncated normal at the given position.
Args:
params: tuple with (mean, std), the parameters under which we evaluate the model
low (float): the lower truncation bound
high (float): the upper truncation bound
data (... | [
"Return",
"the",
"gradient",
"of",
"the",
"log",
"likelihood",
"of",
"the",
"truncated",
"normal",
"at",
"the",
"given",
"position",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L313-L329 |
cbclab/MOT | mot/stats.py | _TruncatedNormalFitter.partial_derivative_mu | def partial_derivative_mu(mu, sigma, low, high, data):
"""The partial derivative with respect to the mean.
Args:
mu (float): the mean of the truncated normal
sigma (float): the std of the truncated normal
low (float): the lower truncation bound
high (floa... | python | def partial_derivative_mu(mu, sigma, low, high, data):
"""The partial derivative with respect to the mean.
Args:
mu (float): the mean of the truncated normal
sigma (float): the std of the truncated normal
low (float): the lower truncation bound
high (floa... | [
"def",
"partial_derivative_mu",
"(",
"mu",
",",
"sigma",
",",
"low",
",",
"high",
",",
"data",
")",
":",
"pd_mu",
"=",
"np",
".",
"sum",
"(",
"data",
"-",
"mu",
")",
"/",
"sigma",
"**",
"2",
"pd_mu",
"-=",
"len",
"(",
"data",
")",
"*",
"(",
"("... | The partial derivative with respect to the mean.
Args:
mu (float): the mean of the truncated normal
sigma (float): the std of the truncated normal
low (float): the lower truncation bound
high (float): the upper truncation bound
data (ndarray): the one... | [
"The",
"partial",
"derivative",
"with",
"respect",
"to",
"the",
"mean",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L332-L348 |
cbclab/MOT | mot/stats.py | _TruncatedNormalFitter.partial_derivative_sigma | def partial_derivative_sigma(mu, sigma, low, high, data):
"""The partial derivative with respect to the standard deviation.
Args:
mu (float): the mean of the truncated normal
sigma (float): the std of the truncated normal
low (float): the lower truncation bound
... | python | def partial_derivative_sigma(mu, sigma, low, high, data):
"""The partial derivative with respect to the standard deviation.
Args:
mu (float): the mean of the truncated normal
sigma (float): the std of the truncated normal
low (float): the lower truncation bound
... | [
"def",
"partial_derivative_sigma",
"(",
"mu",
",",
"sigma",
",",
"low",
",",
"high",
",",
"data",
")",
":",
"pd_sigma",
"=",
"np",
".",
"sum",
"(",
"-",
"(",
"1",
"/",
"sigma",
")",
"+",
"(",
"(",
"data",
"-",
"mu",
")",
"**",
"2",
"/",
"(",
... | The partial derivative with respect to the standard deviation.
Args:
mu (float): the mean of the truncated normal
sigma (float): the std of the truncated normal
low (float): the lower truncation bound
high (float): the upper truncation bound
data (nda... | [
"The",
"partial",
"derivative",
"with",
"respect",
"to",
"the",
"standard",
"deviation",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/stats.py#L351-L367 |
cbclab/MOT | mot/library_functions/__init__.py | NMSimplex.get_kernel_data | def get_kernel_data(self):
"""Get the kernel data needed for this optimization routine to work."""
return {
'nmsimplex_scratch': LocalMemory(
'mot_float_type', self._nmr_parameters * 2 + (self._nmr_parameters + 1) ** 2 + 1),
'initial_simplex_scale': LocalMemory('m... | python | def get_kernel_data(self):
"""Get the kernel data needed for this optimization routine to work."""
return {
'nmsimplex_scratch': LocalMemory(
'mot_float_type', self._nmr_parameters * 2 + (self._nmr_parameters + 1) ** 2 + 1),
'initial_simplex_scale': LocalMemory('m... | [
"def",
"get_kernel_data",
"(",
"self",
")",
":",
"return",
"{",
"'nmsimplex_scratch'",
":",
"LocalMemory",
"(",
"'mot_float_type'",
",",
"self",
".",
"_nmr_parameters",
"*",
"2",
"+",
"(",
"self",
".",
"_nmr_parameters",
"+",
"1",
")",
"**",
"2",
"+",
"1",... | Get the kernel data needed for this optimization routine to work. | [
"Get",
"the",
"kernel",
"data",
"needed",
"for",
"this",
"optimization",
"routine",
"to",
"work",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/library_functions/__init__.py#L498-L504 |
cbclab/MOT | mot/library_functions/__init__.py | Subplex.get_kernel_data | def get_kernel_data(self):
"""Get the kernel data needed for this optimization routine to work."""
return {
'subplex_scratch_float': LocalMemory(
'mot_float_type', 4 + self._var_replace_dict['NMR_PARAMS'] * 2
+ self._var_replace_dict['MAX_S... | python | def get_kernel_data(self):
"""Get the kernel data needed for this optimization routine to work."""
return {
'subplex_scratch_float': LocalMemory(
'mot_float_type', 4 + self._var_replace_dict['NMR_PARAMS'] * 2
+ self._var_replace_dict['MAX_S... | [
"def",
"get_kernel_data",
"(",
"self",
")",
":",
"return",
"{",
"'subplex_scratch_float'",
":",
"LocalMemory",
"(",
"'mot_float_type'",
",",
"4",
"+",
"self",
".",
"_var_replace_dict",
"[",
"'NMR_PARAMS'",
"]",
"*",
"2",
"+",
"self",
".",
"_var_replace_dict",
... | Get the kernel data needed for this optimization routine to work. | [
"Get",
"the",
"kernel",
"data",
"needed",
"for",
"this",
"optimization",
"routine",
"to",
"work",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/library_functions/__init__.py#L549-L561 |
cbclab/MOT | mot/library_functions/__init__.py | LevenbergMarquardt.get_kernel_data | def get_kernel_data(self):
"""Get the kernel data needed for this optimization routine to work."""
return {
'scratch_mot_float_type': LocalMemory(
'mot_float_type', 8 +
2 * self._var_replace_dict['NMR_OBSERVATIONS'] +
... | python | def get_kernel_data(self):
"""Get the kernel data needed for this optimization routine to work."""
return {
'scratch_mot_float_type': LocalMemory(
'mot_float_type', 8 +
2 * self._var_replace_dict['NMR_OBSERVATIONS'] +
... | [
"def",
"get_kernel_data",
"(",
"self",
")",
":",
"return",
"{",
"'scratch_mot_float_type'",
":",
"LocalMemory",
"(",
"'mot_float_type'",
",",
"8",
"+",
"2",
"*",
"self",
".",
"_var_replace_dict",
"[",
"'NMR_OBSERVATIONS'",
"]",
"+",
"5",
"*",
"self",
".",
"_... | Get the kernel data needed for this optimization routine to work. | [
"Get",
"the",
"kernel",
"data",
"needed",
"for",
"this",
"optimization",
"routine",
"to",
"work",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/library_functions/__init__.py#L605-L614 |
cbclab/MOT | mot/optimize/__init__.py | minimize | def minimize(func, x0, data=None, method=None, lower_bounds=None, upper_bounds=None, constraints_func=None,
nmr_observations=None, cl_runtime_info=None, options=None):
"""Minimization of one or more variables.
For an easy wrapper of function maximization, see :func:`maximize`.
All boundary co... | python | def minimize(func, x0, data=None, method=None, lower_bounds=None, upper_bounds=None, constraints_func=None,
nmr_observations=None, cl_runtime_info=None, options=None):
"""Minimization of one or more variables.
For an easy wrapper of function maximization, see :func:`maximize`.
All boundary co... | [
"def",
"minimize",
"(",
"func",
",",
"x0",
",",
"data",
"=",
"None",
",",
"method",
"=",
"None",
",",
"lower_bounds",
"=",
"None",
",",
"upper_bounds",
"=",
"None",
",",
"constraints_func",
"=",
"None",
",",
"nmr_observations",
"=",
"None",
",",
"cl_runt... | Minimization of one or more variables.
For an easy wrapper of function maximization, see :func:`maximize`.
All boundary conditions are enforced using the penalty method. That is, we optimize the objective function:
.. math::
F(x) = f(x) \mu \sum \max(0, g_i(x))^2
where :math:`F(x)` is the n... | [
"Minimization",
"of",
"one",
"or",
"more",
"variables",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L16-L119 |
cbclab/MOT | mot/optimize/__init__.py | _bounds_to_array | def _bounds_to_array(bounds):
"""Create a CompositeArray to hold the bounds."""
elements = []
for value in bounds:
if all_elements_equal(value):
elements.append(Scalar(get_single_value(value), ctype='mot_float_type'))
else:
elements.append(Array(value, ctype='mot_floa... | python | def _bounds_to_array(bounds):
"""Create a CompositeArray to hold the bounds."""
elements = []
for value in bounds:
if all_elements_equal(value):
elements.append(Scalar(get_single_value(value), ctype='mot_float_type'))
else:
elements.append(Array(value, ctype='mot_floa... | [
"def",
"_bounds_to_array",
"(",
"bounds",
")",
":",
"elements",
"=",
"[",
"]",
"for",
"value",
"in",
"bounds",
":",
"if",
"all_elements_equal",
"(",
"value",
")",
":",
"elements",
".",
"append",
"(",
"Scalar",
"(",
"get_single_value",
"(",
"value",
")",
... | Create a CompositeArray to hold the bounds. | [
"Create",
"a",
"CompositeArray",
"to",
"hold",
"the",
"bounds",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L122-L130 |
cbclab/MOT | mot/optimize/__init__.py | maximize | def maximize(func, x0, nmr_observations, **kwargs):
"""Maximization of a function.
This wraps the objective function to take the negative of the computed values and passes it then on to one
of the minimization routines.
Args:
func (mot.lib.cl_function.CLFunction): A CL function with the signat... | python | def maximize(func, x0, nmr_observations, **kwargs):
"""Maximization of a function.
This wraps the objective function to take the negative of the computed values and passes it then on to one
of the minimization routines.
Args:
func (mot.lib.cl_function.CLFunction): A CL function with the signat... | [
"def",
"maximize",
"(",
"func",
",",
"x0",
",",
"nmr_observations",
",",
"*",
"*",
"kwargs",
")",
":",
"wrapped_func",
"=",
"SimpleCLFunction",
".",
"from_string",
"(",
"'''\n double _negate_'''",
"+",
"func",
".",
"get_cl_function_name",
"(",
")",
"+",
... | Maximization of a function.
This wraps the objective function to take the negative of the computed values and passes it then on to one
of the minimization routines.
Args:
func (mot.lib.cl_function.CLFunction): A CL function with the signature:
.. code-block:: c
double... | [
"Maximization",
"of",
"a",
"function",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L133-L183 |
cbclab/MOT | mot/optimize/__init__.py | get_minimizer_options | def get_minimizer_options(method):
"""Return a dictionary with the default options for the given minimization method.
Args:
method (str): the name of the method we want the options off
Returns:
dict: a dictionary with the default options
"""
if method == 'Powell':
return {'... | python | def get_minimizer_options(method):
"""Return a dictionary with the default options for the given minimization method.
Args:
method (str): the name of the method we want the options off
Returns:
dict: a dictionary with the default options
"""
if method == 'Powell':
return {'... | [
"def",
"get_minimizer_options",
"(",
"method",
")",
":",
"if",
"method",
"==",
"'Powell'",
":",
"return",
"{",
"'patience'",
":",
"2",
",",
"'patience_line_search'",
":",
"None",
",",
"'reset_method'",
":",
"'EXTRAPOLATED_POINT'",
"}",
"elif",
"method",
"==",
... | Return a dictionary with the default options for the given minimization method.
Args:
method (str): the name of the method we want the options off
Returns:
dict: a dictionary with the default options | [
"Return",
"a",
"dictionary",
"with",
"the",
"default",
"options",
"for",
"the",
"given",
"minimization",
"method",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L186-L216 |
cbclab/MOT | mot/optimize/__init__.py | _clean_options | def _clean_options(method, provided_options):
"""Clean the given input options.
This will make sure that all options are present, either with their default values or with the given values,
and that no other options are present then those supported.
Args:
method (str): the method name
p... | python | def _clean_options(method, provided_options):
"""Clean the given input options.
This will make sure that all options are present, either with their default values or with the given values,
and that no other options are present then those supported.
Args:
method (str): the method name
p... | [
"def",
"_clean_options",
"(",
"method",
",",
"provided_options",
")",
":",
"provided_options",
"=",
"provided_options",
"or",
"{",
"}",
"default_options",
"=",
"get_minimizer_options",
"(",
"method",
")",
"result",
"=",
"{",
"}",
"for",
"name",
",",
"default",
... | Clean the given input options.
This will make sure that all options are present, either with their default values or with the given values,
and that no other options are present then those supported.
Args:
method (str): the method name
provided_options (dict): the given options
Return... | [
"Clean",
"the",
"given",
"input",
"options",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L219-L242 |
cbclab/MOT | mot/optimize/__init__.py | _minimize_powell | def _minimize_powell(func, x0, cl_runtime_info, lower_bounds, upper_bounds,
constraints_func=None, data=None, options=None):
"""
Options:
patience (int): Used to set the maximum number of iterations to patience*(number_of_parameters+1)
reset_method (str): one of 'EXTRAPOLATE... | python | def _minimize_powell(func, x0, cl_runtime_info, lower_bounds, upper_bounds,
constraints_func=None, data=None, options=None):
"""
Options:
patience (int): Used to set the maximum number of iterations to patience*(number_of_parameters+1)
reset_method (str): one of 'EXTRAPOLATE... | [
"def",
"_minimize_powell",
"(",
"func",
",",
"x0",
",",
"cl_runtime_info",
",",
"lower_bounds",
",",
"upper_bounds",
",",
"constraints_func",
"=",
"None",
",",
"data",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"options",
"=",
"options",
"or",
"{"... | Options:
patience (int): Used to set the maximum number of iterations to patience*(number_of_parameters+1)
reset_method (str): one of 'EXTRAPOLATED_POINT' or 'RESET_TO_IDENTITY' lower case or upper case.
patience_line_search (int): the patience of the searching algorithm. Defaults to the
... | [
"Options",
":",
"patience",
"(",
"int",
")",
":",
"Used",
"to",
"set",
"the",
"maximum",
"number",
"of",
"iterations",
"to",
"patience",
"*",
"(",
"number_of_parameters",
"+",
"1",
")",
"reset_method",
"(",
"str",
")",
":",
"one",
"of",
"EXTRAPOLATED_POINT... | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L245-L296 |
cbclab/MOT | mot/optimize/__init__.py | _lm_numdiff_jacobian | def _lm_numdiff_jacobian(eval_func, nmr_params, nmr_observations):
"""Get a numerical differentiated Jacobian function.
This computes the Jacobian of the observations (function vector) with respect to the parameters.
Args:
eval_func (mot.lib.cl_function.CLFunction): the evaluation function
... | python | def _lm_numdiff_jacobian(eval_func, nmr_params, nmr_observations):
"""Get a numerical differentiated Jacobian function.
This computes the Jacobian of the observations (function vector) with respect to the parameters.
Args:
eval_func (mot.lib.cl_function.CLFunction): the evaluation function
... | [
"def",
"_lm_numdiff_jacobian",
"(",
"eval_func",
",",
"nmr_params",
",",
"nmr_observations",
")",
":",
"return",
"SimpleCLFunction",
".",
"from_string",
"(",
"r'''\n /**\n * Compute the Jacobian for use in the Levenberg-Marquardt optimization routine.\n *\n ... | Get a numerical differentiated Jacobian function.
This computes the Jacobian of the observations (function vector) with respect to the parameters.
Args:
eval_func (mot.lib.cl_function.CLFunction): the evaluation function
nmr_params (int): the number of parameters
nmr_observations (int)... | [
"Get",
"a",
"numerical",
"differentiated",
"Jacobian",
"function",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L535-L739 |
cbclab/MOT | mot/optimize/__init__.py | _get_penalty_function | def _get_penalty_function(nmr_parameters, constraints_func=None):
"""Get a function to compute the penalty term for the boundary conditions.
This is meant to be used in the evaluation function of the optimization routines.
Args:
nmr_parameters (int): the number of parameters in the model
c... | python | def _get_penalty_function(nmr_parameters, constraints_func=None):
"""Get a function to compute the penalty term for the boundary conditions.
This is meant to be used in the evaluation function of the optimization routines.
Args:
nmr_parameters (int): the number of parameters in the model
c... | [
"def",
"_get_penalty_function",
"(",
"nmr_parameters",
",",
"constraints_func",
"=",
"None",
")",
":",
"dependencies",
"=",
"[",
"]",
"data_requirements",
"=",
"{",
"'scratch'",
":",
"LocalMemory",
"(",
"'double'",
",",
"1",
")",
"}",
"constraints_code",
"=",
... | Get a function to compute the penalty term for the boundary conditions.
This is meant to be used in the evaluation function of the optimization routines.
Args:
nmr_parameters (int): the number of parameters in the model
constraints_func (mot.optimize.base.ConstraintFunction): function to compu... | [
"Get",
"a",
"function",
"to",
"compute",
"the",
"penalty",
"term",
"for",
"the",
"boundary",
"conditions",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/__init__.py#L742-L822 |
cbclab/MOT | mot/optimize/base.py | SimpleConstraintFunction.from_string | def from_string(cls, cl_function, dependencies=(), nmr_constraints=None):
"""Parse the given CL function into a SimpleCLFunction object.
Args:
cl_function (str): the function we wish to turn into an object
dependencies (list or tuple of CLLibrary): The list of CL libraries this ... | python | def from_string(cls, cl_function, dependencies=(), nmr_constraints=None):
"""Parse the given CL function into a SimpleCLFunction object.
Args:
cl_function (str): the function we wish to turn into an object
dependencies (list or tuple of CLLibrary): The list of CL libraries this ... | [
"def",
"from_string",
"(",
"cls",
",",
"cl_function",
",",
"dependencies",
"=",
"(",
")",
",",
"nmr_constraints",
"=",
"None",
")",
":",
"return_type",
",",
"function_name",
",",
"parameter_list",
",",
"body",
"=",
"split_cl_function",
"(",
"cl_function",
")",... | Parse the given CL function into a SimpleCLFunction object.
Args:
cl_function (str): the function we wish to turn into an object
dependencies (list or tuple of CLLibrary): The list of CL libraries this function depends on
Returns:
SimpleCLFunction: the CL data type ... | [
"Parse",
"the",
"given",
"CL",
"function",
"into",
"a",
"SimpleCLFunction",
"object",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/optimize/base.py#L90-L102 |
ksbg/sparklanes | sparklanes/_framework/validation.py | validate_schema | def validate_schema(yaml_def, branch=False):
"""Validates the schema of a dict
Parameters
----------
yaml_def : dict
dict whose schema shall be validated
branch : bool
Indicates whether `yaml_def` is a dict of a top-level lane, or of a branch
inside a lane (needed for recurs... | python | def validate_schema(yaml_def, branch=False):
"""Validates the schema of a dict
Parameters
----------
yaml_def : dict
dict whose schema shall be validated
branch : bool
Indicates whether `yaml_def` is a dict of a top-level lane, or of a branch
inside a lane (needed for recurs... | [
"def",
"validate_schema",
"(",
"yaml_def",
",",
"branch",
"=",
"False",
")",
":",
"schema",
"=",
"Schema",
"(",
"{",
"'lane'",
"if",
"not",
"branch",
"else",
"'branch'",
":",
"{",
"Optional",
"(",
"'name'",
")",
":",
"str",
",",
"Optional",
"(",
"'run_... | Validates the schema of a dict
Parameters
----------
yaml_def : dict
dict whose schema shall be validated
branch : bool
Indicates whether `yaml_def` is a dict of a top-level lane, or of a branch
inside a lane (needed for recursion)
Returns
-------
bool
True ... | [
"Validates",
"the",
"schema",
"of",
"a",
"dict"
] | train | https://github.com/ksbg/sparklanes/blob/62e70892e6ae025be2f4c419f4afc34714d6884c/sparklanes/_framework/validation.py#L10-L52 |
ksbg/sparklanes | sparklanes/_framework/validation.py | validate_params | def validate_params(cls, mtd_name, *args, **kwargs):
"""Validates if the given args/kwargs match the method signature. Checks if:
- at least all required args/kwargs are given
- no redundant args/kwargs are given
Parameters
----------
cls : Class
mtd_name : str
Name of the method wh... | python | def validate_params(cls, mtd_name, *args, **kwargs):
"""Validates if the given args/kwargs match the method signature. Checks if:
- at least all required args/kwargs are given
- no redundant args/kwargs are given
Parameters
----------
cls : Class
mtd_name : str
Name of the method wh... | [
"def",
"validate_params",
"(",
"cls",
",",
"mtd_name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mtd",
"=",
"getattr",
"(",
"cls",
",",
"mtd_name",
")",
"py3_mtd_condition",
"=",
"(",
"not",
"(",
"inspect",
".",
"isfunction",
"(",
"mtd",
... | Validates if the given args/kwargs match the method signature. Checks if:
- at least all required args/kwargs are given
- no redundant args/kwargs are given
Parameters
----------
cls : Class
mtd_name : str
Name of the method whose parameters shall be validated
args: list
Pos... | [
"Validates",
"if",
"the",
"given",
"args",
"/",
"kwargs",
"match",
"the",
"method",
"signature",
".",
"Checks",
"if",
":",
"-",
"at",
"least",
"all",
"required",
"args",
"/",
"kwargs",
"are",
"given",
"-",
"no",
"redundant",
"args",
"/",
"kwargs",
"are",... | train | https://github.com/ksbg/sparklanes/blob/62e70892e6ae025be2f4c419f4afc34714d6884c/sparklanes/_framework/validation.py#L55-L105 |
ksbg/sparklanes | sparklanes/_framework/validation.py | arg_spec | def arg_spec(cls, mtd_name):
"""Cross-version argument signature inspection
Parameters
----------
cls : class
mtd_name : str
Name of the method to be inspected
Returns
-------
required_params : list of str
List of required, positional parameters
optional_params : li... | python | def arg_spec(cls, mtd_name):
"""Cross-version argument signature inspection
Parameters
----------
cls : class
mtd_name : str
Name of the method to be inspected
Returns
-------
required_params : list of str
List of required, positional parameters
optional_params : li... | [
"def",
"arg_spec",
"(",
"cls",
",",
"mtd_name",
")",
":",
"mtd",
"=",
"getattr",
"(",
"cls",
",",
"mtd_name",
")",
"required_params",
"=",
"[",
"]",
"optional_params",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"inspect",
",",
"'signature'",
")",
":",
"# Pyt... | Cross-version argument signature inspection
Parameters
----------
cls : class
mtd_name : str
Name of the method to be inspected
Returns
-------
required_params : list of str
List of required, positional parameters
optional_params : list of str
List of optional p... | [
"Cross",
"-",
"version",
"argument",
"signature",
"inspection"
] | train | https://github.com/ksbg/sparklanes/blob/62e70892e6ae025be2f4c419f4afc34714d6884c/sparklanes/_framework/validation.py#L108-L156 |
cbclab/MOT | mot/random.py | uniform | def uniform(nmr_distributions, nmr_samples, low=0, high=1, ctype='float', seed=None):
"""Draw random samples from the Uniform distribution.
Args:
nmr_distributions (int): the number of unique continuous_distributions to create
nmr_samples (int): The number of samples to draw
low (double... | python | def uniform(nmr_distributions, nmr_samples, low=0, high=1, ctype='float', seed=None):
"""Draw random samples from the Uniform distribution.
Args:
nmr_distributions (int): the number of unique continuous_distributions to create
nmr_samples (int): The number of samples to draw
low (double... | [
"def",
"uniform",
"(",
"nmr_distributions",
",",
"nmr_samples",
",",
"low",
"=",
"0",
",",
"high",
"=",
"1",
",",
"ctype",
"=",
"'float'",
",",
"seed",
"=",
"None",
")",
":",
"if",
"is_scalar",
"(",
"low",
")",
":",
"low",
"=",
"np",
".",
"ones",
... | Draw random samples from the Uniform distribution.
Args:
nmr_distributions (int): the number of unique continuous_distributions to create
nmr_samples (int): The number of samples to draw
low (double): The minimum value of the random numbers
high (double): The minimum value of the ra... | [
"Draw",
"random",
"samples",
"from",
"the",
"Uniform",
"distribution",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/random.py#L36-L73 |
cbclab/MOT | mot/random.py | normal | def normal(nmr_distributions, nmr_samples, mean=0, std=1, ctype='float', seed=None):
"""Draw random samples from the Gaussian distribution.
Args:
nmr_distributions (int): the number of unique continuous_distributions to create
nmr_samples (int): The number of samples to draw
mean (float... | python | def normal(nmr_distributions, nmr_samples, mean=0, std=1, ctype='float', seed=None):
"""Draw random samples from the Gaussian distribution.
Args:
nmr_distributions (int): the number of unique continuous_distributions to create
nmr_samples (int): The number of samples to draw
mean (float... | [
"def",
"normal",
"(",
"nmr_distributions",
",",
"nmr_samples",
",",
"mean",
"=",
"0",
",",
"std",
"=",
"1",
",",
"ctype",
"=",
"'float'",
",",
"seed",
"=",
"None",
")",
":",
"if",
"is_scalar",
"(",
"mean",
")",
":",
"mean",
"=",
"np",
".",
"ones",
... | Draw random samples from the Gaussian distribution.
Args:
nmr_distributions (int): the number of unique continuous_distributions to create
nmr_samples (int): The number of samples to draw
mean (float or ndarray): The mean of the distribution
std (float or ndarray): The standard devi... | [
"Draw",
"random",
"samples",
"from",
"the",
"Gaussian",
"distribution",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/random.py#L76-L112 |
cbclab/MOT | mot/sample/base.py | AbstractSampler.sample | def sample(self, nmr_samples, burnin=0, thinning=1):
"""Take additional samples from the given likelihood and prior, using this sampler.
This method can be called multiple times in which the sample state is stored in between.
Args:
nmr_samples (int): the number of samples to return... | python | def sample(self, nmr_samples, burnin=0, thinning=1):
"""Take additional samples from the given likelihood and prior, using this sampler.
This method can be called multiple times in which the sample state is stored in between.
Args:
nmr_samples (int): the number of samples to return... | [
"def",
"sample",
"(",
"self",
",",
"nmr_samples",
",",
"burnin",
"=",
"0",
",",
"thinning",
"=",
"1",
")",
":",
"if",
"not",
"thinning",
"or",
"thinning",
"<",
"1",
":",
"thinning",
"=",
"1",
"if",
"not",
"burnin",
"or",
"burnin",
"<",
"0",
":",
... | Take additional samples from the given likelihood and prior, using this sampler.
This method can be called multiple times in which the sample state is stored in between.
Args:
nmr_samples (int): the number of samples to return
burnin (int): the number of samples to discard befo... | [
"Take",
"additional",
"samples",
"from",
"the",
"given",
"likelihood",
"and",
"prior",
"using",
"this",
"sampler",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L108-L138 |
cbclab/MOT | mot/sample/base.py | AbstractSampler._sample | def _sample(self, nmr_samples, thinning=1, return_output=True):
"""Sample the given number of samples with the given thinning.
If ``return_output`` we will return the samples, log likelihoods and log priors. If not, we will advance the
state of the sampler without returning storing the samples.... | python | def _sample(self, nmr_samples, thinning=1, return_output=True):
"""Sample the given number of samples with the given thinning.
If ``return_output`` we will return the samples, log likelihoods and log priors. If not, we will advance the
state of the sampler without returning storing the samples.... | [
"def",
"_sample",
"(",
"self",
",",
"nmr_samples",
",",
"thinning",
"=",
"1",
",",
"return_output",
"=",
"True",
")",
":",
"kernel_data",
"=",
"self",
".",
"_get_kernel_data",
"(",
"nmr_samples",
",",
"thinning",
",",
"return_output",
")",
"sample_func",
"="... | Sample the given number of samples with the given thinning.
If ``return_output`` we will return the samples, log likelihoods and log priors. If not, we will advance the
state of the sampler without returning storing the samples.
Args:
nmr_samples (int): the number of iterations to ... | [
"Sample",
"the",
"given",
"number",
"of",
"samples",
"with",
"the",
"given",
"thinning",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L140-L163 |
cbclab/MOT | mot/sample/base.py | AbstractSampler._initialize_likelihood_prior | def _initialize_likelihood_prior(self, positions, log_likelihoods, log_priors):
"""Initialize the likelihood and the prior using the given positions.
This is a general method for computing the log likelihoods and log priors for given positions.
Subclasses can use this to instantiate secondary ... | python | def _initialize_likelihood_prior(self, positions, log_likelihoods, log_priors):
"""Initialize the likelihood and the prior using the given positions.
This is a general method for computing the log likelihoods and log priors for given positions.
Subclasses can use this to instantiate secondary ... | [
"def",
"_initialize_likelihood_prior",
"(",
"self",
",",
"positions",
",",
"log_likelihoods",
",",
"log_priors",
")",
":",
"func",
"=",
"SimpleCLFunction",
".",
"from_string",
"(",
"'''\n void compute(global mot_float_type* chain_position,\n glo... | Initialize the likelihood and the prior using the given positions.
This is a general method for computing the log likelihoods and log priors for given positions.
Subclasses can use this to instantiate secondary chains as well. | [
"Initialize",
"the",
"likelihood",
"and",
"the",
"prior",
"using",
"the",
"given",
"positions",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L165-L203 |
cbclab/MOT | mot/sample/base.py | AbstractSampler._get_kernel_data | def _get_kernel_data(self, nmr_samples, thinning, return_output):
"""Get the kernel data we will input to the MCMC sampler.
This sets the items:
* data: the pointer to the user provided data
* method_data: the data specific to the MCMC method
* nmr_iterations: the number of ite... | python | def _get_kernel_data(self, nmr_samples, thinning, return_output):
"""Get the kernel data we will input to the MCMC sampler.
This sets the items:
* data: the pointer to the user provided data
* method_data: the data specific to the MCMC method
* nmr_iterations: the number of ite... | [
"def",
"_get_kernel_data",
"(",
"self",
",",
"nmr_samples",
",",
"thinning",
",",
"return_output",
")",
":",
"kernel_data",
"=",
"{",
"'data'",
":",
"self",
".",
"_data",
",",
"'method_data'",
":",
"self",
".",
"_get_mcmc_method_kernel_data",
"(",
")",
",",
... | Get the kernel data we will input to the MCMC sampler.
This sets the items:
* data: the pointer to the user provided data
* method_data: the data specific to the MCMC method
* nmr_iterations: the number of iterations to sample
* iteration_offset: the current sample index, that ... | [
"Get",
"the",
"kernel",
"data",
"we",
"will",
"input",
"to",
"the",
"MCMC",
"sampler",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L205-L253 |
cbclab/MOT | mot/sample/base.py | AbstractSampler._get_compute_func | def _get_compute_func(self, nmr_samples, thinning, return_output):
"""Get the MCMC algorithm as a computable function.
Args:
nmr_samples (int): the number of samples we will draw
thinning (int): the thinning factor we want to use
return_output (boolean): if the kerne... | python | def _get_compute_func(self, nmr_samples, thinning, return_output):
"""Get the MCMC algorithm as a computable function.
Args:
nmr_samples (int): the number of samples we will draw
thinning (int): the thinning factor we want to use
return_output (boolean): if the kerne... | [
"def",
"_get_compute_func",
"(",
"self",
",",
"nmr_samples",
",",
"thinning",
",",
"return_output",
")",
":",
"cl_func",
"=",
"'''\n void compute(global uint* rng_state, \n global mot_float_type* current_chain_position,\n global ... | Get the MCMC algorithm as a computable function.
Args:
nmr_samples (int): the number of samples we will draw
thinning (int): the thinning factor we want to use
return_output (boolean): if the kernel should return output
Returns:
mot.lib.cl_function.CLFun... | [
"Get",
"the",
"MCMC",
"algorithm",
"as",
"a",
"computable",
"function",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L255-L321 |
cbclab/MOT | mot/sample/base.py | AbstractSampler._get_log_prior_cl_func | def _get_log_prior_cl_func(self):
"""Get the CL log prior compute function.
Returns:
str: the compute function for computing the log prior.
"""
return SimpleCLFunction.from_string('''
mot_float_type _computeLogPrior(local const mot_float_type* x, void* data){
... | python | def _get_log_prior_cl_func(self):
"""Get the CL log prior compute function.
Returns:
str: the compute function for computing the log prior.
"""
return SimpleCLFunction.from_string('''
mot_float_type _computeLogPrior(local const mot_float_type* x, void* data){
... | [
"def",
"_get_log_prior_cl_func",
"(",
"self",
")",
":",
"return",
"SimpleCLFunction",
".",
"from_string",
"(",
"'''\n mot_float_type _computeLogPrior(local const mot_float_type* x, void* data){\n return '''",
"+",
"self",
".",
"_log_prior_func",
".",
"get_... | Get the CL log prior compute function.
Returns:
str: the compute function for computing the log prior. | [
"Get",
"the",
"CL",
"log",
"prior",
"compute",
"function",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L323-L333 |
cbclab/MOT | mot/sample/base.py | AbstractSampler._get_log_likelihood_cl_func | def _get_log_likelihood_cl_func(self):
"""Get the CL log likelihood compute function.
This uses local reduction to compute the log likelihood for every observation in CL local space.
The results are then summed in the first work item and returned using a pointer.
Returns:
s... | python | def _get_log_likelihood_cl_func(self):
"""Get the CL log likelihood compute function.
This uses local reduction to compute the log likelihood for every observation in CL local space.
The results are then summed in the first work item and returned using a pointer.
Returns:
s... | [
"def",
"_get_log_likelihood_cl_func",
"(",
"self",
")",
":",
"return",
"SimpleCLFunction",
".",
"from_string",
"(",
"'''\n double _computeLogLikelihood(local const mot_float_type* current_position, void* data){\n return '''",
"+",
"self",
".",
"_ll_func",
".... | Get the CL log likelihood compute function.
This uses local reduction to compute the log likelihood for every observation in CL local space.
The results are then summed in the first work item and returned using a pointer.
Returns:
str: the CL code for the log likelihood compute fun... | [
"Get",
"the",
"CL",
"log",
"likelihood",
"compute",
"function",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L335-L348 |
cbclab/MOT | mot/sample/base.py | AbstractRWMSampler._get_mcmc_method_kernel_data_elements | def _get_mcmc_method_kernel_data_elements(self):
"""Get the mcmc method kernel data elements. Used by :meth:`_get_mcmc_method_kernel_data`."""
return {'proposal_stds': Array(self._proposal_stds, 'mot_float_type', mode='rw', ensure_zero_copy=True),
'x_tmp': LocalMemory('mot_float_type', n... | python | def _get_mcmc_method_kernel_data_elements(self):
"""Get the mcmc method kernel data elements. Used by :meth:`_get_mcmc_method_kernel_data`."""
return {'proposal_stds': Array(self._proposal_stds, 'mot_float_type', mode='rw', ensure_zero_copy=True),
'x_tmp': LocalMemory('mot_float_type', n... | [
"def",
"_get_mcmc_method_kernel_data_elements",
"(",
"self",
")",
":",
"return",
"{",
"'proposal_stds'",
":",
"Array",
"(",
"self",
".",
"_proposal_stds",
",",
"'mot_float_type'",
",",
"mode",
"=",
"'rw'",
",",
"ensure_zero_copy",
"=",
"True",
")",
",",
"'x_tmp'... | Get the mcmc method kernel data elements. Used by :meth:`_get_mcmc_method_kernel_data`. | [
"Get",
"the",
"mcmc",
"method",
"kernel",
"data",
"elements",
".",
"Used",
"by",
":",
"meth",
":",
"_get_mcmc_method_kernel_data",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/sample/base.py#L423-L426 |
cbclab/MOT | mot/cl_routines/__init__.py | compute_log_likelihood | def compute_log_likelihood(ll_func, parameters, data=None, cl_runtime_info=None):
"""Calculate and return the log likelihood of the given model for the given parameters.
This calculates the log likelihoods for every problem in the model (typically after optimization),
or a log likelihood for every sample o... | python | def compute_log_likelihood(ll_func, parameters, data=None, cl_runtime_info=None):
"""Calculate and return the log likelihood of the given model for the given parameters.
This calculates the log likelihoods for every problem in the model (typically after optimization),
or a log likelihood for every sample o... | [
"def",
"compute_log_likelihood",
"(",
"ll_func",
",",
"parameters",
",",
"data",
"=",
"None",
",",
"cl_runtime_info",
"=",
"None",
")",
":",
"def",
"get_cl_function",
"(",
")",
":",
"nmr_params",
"=",
"parameters",
".",
"shape",
"[",
"1",
"]",
"if",
"len",... | Calculate and return the log likelihood of the given model for the given parameters.
This calculates the log likelihoods for every problem in the model (typically after optimization),
or a log likelihood for every sample of every model (typically after sample). In the case of the first (after
optimization)... | [
"Calculate",
"and",
"return",
"the",
"log",
"likelihood",
"of",
"the",
"given",
"model",
"for",
"the",
"given",
"parameters",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/cl_routines/__init__.py#L12-L89 |
cbclab/MOT | mot/cl_routines/__init__.py | compute_objective_value | def compute_objective_value(objective_func, parameters, data=None, cl_runtime_info=None):
"""Calculate and return the objective function value of the given model for the given parameters.
Args:
objective_func (mot.lib.cl_function.CLFunction): A CL function with the signature:
.. code-block... | python | def compute_objective_value(objective_func, parameters, data=None, cl_runtime_info=None):
"""Calculate and return the objective function value of the given model for the given parameters.
Args:
objective_func (mot.lib.cl_function.CLFunction): A CL function with the signature:
.. code-block... | [
"def",
"compute_objective_value",
"(",
"objective_func",
",",
"parameters",
",",
"data",
"=",
"None",
",",
"cl_runtime_info",
"=",
"None",
")",
":",
"return",
"objective_func",
".",
"evaluate",
"(",
"{",
"'data'",
":",
"data",
",",
"'parameters'",
":",
"Array"... | Calculate and return the objective function value of the given model for the given parameters.
Args:
objective_func (mot.lib.cl_function.CLFunction): A CL function with the signature:
.. code-block:: c
double <func_name>(local const mot_float_type* const x,
... | [
"Calculate",
"and",
"return",
"the",
"objective",
"function",
"value",
"of",
"the",
"given",
"model",
"for",
"the",
"given",
"parameters",
"."
] | train | https://github.com/cbclab/MOT/blob/fb3243b65025705842e82704705c00902f9a35af/mot/cl_routines/__init__.py#L92-L113 |
aaugustin/django-userlog | userlog/util.py | get_log | def get_log(username):
"""
Return a list of page views.
Each item is a dict with `datetime`, `method`, `path` and `code` keys.
"""
redis = get_redis_client()
log_key = 'log:{}'.format(username)
raw_log = redis.lrange(log_key, 0, -1)
log = []
for raw_item in raw_log:
item = j... | python | def get_log(username):
"""
Return a list of page views.
Each item is a dict with `datetime`, `method`, `path` and `code` keys.
"""
redis = get_redis_client()
log_key = 'log:{}'.format(username)
raw_log = redis.lrange(log_key, 0, -1)
log = []
for raw_item in raw_log:
item = j... | [
"def",
"get_log",
"(",
"username",
")",
":",
"redis",
"=",
"get_redis_client",
"(",
")",
"log_key",
"=",
"'log:{}'",
".",
"format",
"(",
"username",
")",
"raw_log",
"=",
"redis",
".",
"lrange",
"(",
"log_key",
",",
"0",
",",
"-",
"1",
")",
"log",
"="... | Return a list of page views.
Each item is a dict with `datetime`, `method`, `path` and `code` keys. | [
"Return",
"a",
"list",
"of",
"page",
"views",
"."
] | train | https://github.com/aaugustin/django-userlog/blob/6cd34d0a319f6a954fec74420d0d391c32c46060/userlog/util.py#L58-L72 |
aaugustin/django-userlog | userlog/util.py | get_token | def get_token(username, length=20, timeout=20):
"""
Obtain an access token that can be passed to a websocket client.
"""
redis = get_redis_client()
token = get_random_string(length)
token_key = 'token:{}'.format(token)
redis.set(token_key, username)
redis.expire(token_key, timeout)
r... | python | def get_token(username, length=20, timeout=20):
"""
Obtain an access token that can be passed to a websocket client.
"""
redis = get_redis_client()
token = get_random_string(length)
token_key = 'token:{}'.format(token)
redis.set(token_key, username)
redis.expire(token_key, timeout)
r... | [
"def",
"get_token",
"(",
"username",
",",
"length",
"=",
"20",
",",
"timeout",
"=",
"20",
")",
":",
"redis",
"=",
"get_redis_client",
"(",
")",
"token",
"=",
"get_random_string",
"(",
"length",
")",
"token_key",
"=",
"'token:{}'",
".",
"format",
"(",
"to... | Obtain an access token that can be passed to a websocket client. | [
"Obtain",
"an",
"access",
"token",
"that",
"can",
"be",
"passed",
"to",
"a",
"websocket",
"client",
"."
] | train | https://github.com/aaugustin/django-userlog/blob/6cd34d0a319f6a954fec74420d0d391c32c46060/userlog/util.py#L75-L84 |
aaugustin/django-userlog | userlog/middleware.py | UserLogMiddleware.get_log | def get_log(self, request, response):
"""
Return a dict of data to log for a given request and response.
Override this method if you need to log a different set of values.
"""
return {
'method': request.method,
'path': request.get_full_path(),
... | python | def get_log(self, request, response):
"""
Return a dict of data to log for a given request and response.
Override this method if you need to log a different set of values.
"""
return {
'method': request.method,
'path': request.get_full_path(),
... | [
"def",
"get_log",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"return",
"{",
"'method'",
":",
"request",
".",
"method",
",",
"'path'",
":",
"request",
".",
"get_full_path",
"(",
")",
",",
"'code'",
":",
"response",
".",
"status_code",
",",
... | Return a dict of data to log for a given request and response.
Override this method if you need to log a different set of values. | [
"Return",
"a",
"dict",
"of",
"data",
"to",
"log",
"for",
"a",
"given",
"request",
"and",
"response",
"."
] | train | https://github.com/aaugustin/django-userlog/blob/6cd34d0a319f6a954fec74420d0d391c32c46060/userlog/middleware.py#L42-L53 |
thebigmunch/google-music | src/google_music/clients/musicmanager.py | MusicManager.download | def download(self, song):
"""Download a song from a Google Music library.
Parameters:
song (dict): A song dict.
Returns:
tuple: Song content as bytestring, suggested filename.
"""
song_id = song['id']
response = self._call(
mm_calls.Export,
self.uploader_id,
song_id)
audio = response.bo... | python | def download(self, song):
"""Download a song from a Google Music library.
Parameters:
song (dict): A song dict.
Returns:
tuple: Song content as bytestring, suggested filename.
"""
song_id = song['id']
response = self._call(
mm_calls.Export,
self.uploader_id,
song_id)
audio = response.bo... | [
"def",
"download",
"(",
"self",
",",
"song",
")",
":",
"song_id",
"=",
"song",
"[",
"'id'",
"]",
"response",
"=",
"self",
".",
"_call",
"(",
"mm_calls",
".",
"Export",
",",
"self",
".",
"uploader_id",
",",
"song_id",
")",
"audio",
"=",
"response",
".... | Download a song from a Google Music library.
Parameters:
song (dict): A song dict.
Returns:
tuple: Song content as bytestring, suggested filename. | [
"Download",
"a",
"song",
"from",
"a",
"Google",
"Music",
"library",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/musicmanager.py#L84-L105 |
thebigmunch/google-music | src/google_music/clients/musicmanager.py | MusicManager.quota | def quota(self):
"""Get the uploaded track count and allowance.
Returns:
tuple: Number of uploaded tracks, number of tracks allowed.
"""
response = self._call(
mm_calls.ClientState,
self.uploader_id
)
client_state = response.body.clientstate_response
return (client_state.total_track_count, cli... | python | def quota(self):
"""Get the uploaded track count and allowance.
Returns:
tuple: Number of uploaded tracks, number of tracks allowed.
"""
response = self._call(
mm_calls.ClientState,
self.uploader_id
)
client_state = response.body.clientstate_response
return (client_state.total_track_count, cli... | [
"def",
"quota",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mm_calls",
".",
"ClientState",
",",
"self",
".",
"uploader_id",
")",
"client_state",
"=",
"response",
".",
"body",
".",
"clientstate_response",
"return",
"(",
"client_state",... | Get the uploaded track count and allowance.
Returns:
tuple: Number of uploaded tracks, number of tracks allowed. | [
"Get",
"the",
"uploaded",
"track",
"count",
"and",
"allowance",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/musicmanager.py#L107-L120 |
thebigmunch/google-music | src/google_music/clients/musicmanager.py | MusicManager.songs | def songs(self, *, uploaded=True, purchased=True):
"""Get a listing of Music Library songs.
Returns:
list: Song dicts.
"""
if not uploaded and not purchased:
raise ValueError("'uploaded' and 'purchased' cannot both be False.")
if purchased and uploaded:
song_list = []
for chunk in self.songs_it... | python | def songs(self, *, uploaded=True, purchased=True):
"""Get a listing of Music Library songs.
Returns:
list: Song dicts.
"""
if not uploaded and not purchased:
raise ValueError("'uploaded' and 'purchased' cannot both be False.")
if purchased and uploaded:
song_list = []
for chunk in self.songs_it... | [
"def",
"songs",
"(",
"self",
",",
"*",
",",
"uploaded",
"=",
"True",
",",
"purchased",
"=",
"True",
")",
":",
"if",
"not",
"uploaded",
"and",
"not",
"purchased",
":",
"raise",
"ValueError",
"(",
"\"'uploaded' and 'purchased' cannot both be False.\"",
")",
"if"... | Get a listing of Music Library songs.
Returns:
list: Song dicts. | [
"Get",
"a",
"listing",
"of",
"Music",
"Library",
"songs",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/musicmanager.py#L122-L152 |
thebigmunch/google-music | src/google_music/clients/musicmanager.py | MusicManager.songs_iter | def songs_iter(self, *, continuation_token=None, export_type=1):
"""Get a paged iterator of Music Library songs.
Parameters:
continuation_token (str, Optional): The token of the page to return.
Default: Not sent to get first page.
export_type (int, Optional): The type of tracks to return. 1 for all track... | python | def songs_iter(self, *, continuation_token=None, export_type=1):
"""Get a paged iterator of Music Library songs.
Parameters:
continuation_token (str, Optional): The token of the page to return.
Default: Not sent to get first page.
export_type (int, Optional): The type of tracks to return. 1 for all track... | [
"def",
"songs_iter",
"(",
"self",
",",
"*",
",",
"continuation_token",
"=",
"None",
",",
"export_type",
"=",
"1",
")",
":",
"def",
"track_info_to_dict",
"(",
"track_info",
")",
":",
"return",
"dict",
"(",
"(",
"field",
".",
"name",
",",
"value",
")",
"... | Get a paged iterator of Music Library songs.
Parameters:
continuation_token (str, Optional): The token of the page to return.
Default: Not sent to get first page.
export_type (int, Optional): The type of tracks to return. 1 for all tracks, 2 for promotional and purchased.
Default: ``1``
Yields:
l... | [
"Get",
"a",
"paged",
"iterator",
"of",
"Music",
"Library",
"songs",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/musicmanager.py#L154-L192 |
thebigmunch/google-music | src/google_music/clients/musicmanager.py | MusicManager.upload | def upload(
self,
song,
*,
album_art_path=None,
no_sample=False
):
"""Upload a song to a Google Music library.
Parameters:
song (os.PathLike or str or audio_metadata.Format):
The path to an audio file or an instance of :class:`audio_metadata.Format`.
album_art_path (os.PathLike or str, Optiona... | python | def upload(
self,
song,
*,
album_art_path=None,
no_sample=False
):
"""Upload a song to a Google Music library.
Parameters:
song (os.PathLike or str or audio_metadata.Format):
The path to an audio file or an instance of :class:`audio_metadata.Format`.
album_art_path (os.PathLike or str, Optiona... | [
"def",
"upload",
"(",
"self",
",",
"song",
",",
"*",
",",
"album_art_path",
"=",
"None",
",",
"no_sample",
"=",
"False",
")",
":",
"if",
"not",
"isinstance",
"(",
"song",
",",
"audio_metadata",
".",
"Format",
")",
":",
"try",
":",
"song",
"=",
"audio... | Upload a song to a Google Music library.
Parameters:
song (os.PathLike or str or audio_metadata.Format):
The path to an audio file or an instance of :class:`audio_metadata.Format`.
album_art_path (os.PathLike or str, Optional):
The relative filename or absolute filepath to external album art.
no_sam... | [
"Upload",
"a",
"song",
"to",
"a",
"Google",
"Music",
"library",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/musicmanager.py#L196-L425 |
thebigmunch/google-music | src/google_music/clients/base.py | GoogleMusicClient.login | def login(self, username, *, token=None):
"""Log in to Google Music.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
device_id (str, Optional): A mobile device ID or music manager uploader ID.
Default: MAC address ... | python | def login(self, username, *, token=None):
"""Log in to Google Music.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
device_id (str, Optional): A mobile device ID or music manager uploader ID.
Default: MAC address ... | [
"def",
"login",
"(",
"self",
",",
"username",
",",
"*",
",",
"token",
"=",
"None",
")",
":",
"self",
".",
"_username",
"=",
"username",
"self",
".",
"_oauth",
"(",
"username",
",",
"token",
"=",
"token",
")",
"return",
"self",
".",
"is_authenticated"
] | Log in to Google Music.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
device_id (str, Optional): A mobile device ID or music manager uploader ID.
Default: MAC address is used.
token (dict, Optional): An OAuth to... | [
"Log",
"in",
"to",
"Google",
"Music",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/base.py#L107-L124 |
thebigmunch/google-music | src/google_music/clients/base.py | GoogleMusicClient.switch_user | def switch_user(self, username='', *, token=None):
"""Log in to Google Music with a different user.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
token (dict, Optional): An OAuth token compatible with ``requests-oaut... | python | def switch_user(self, username='', *, token=None):
"""Log in to Google Music with a different user.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
token (dict, Optional): An OAuth token compatible with ``requests-oaut... | [
"def",
"switch_user",
"(",
"self",
",",
"username",
"=",
"''",
",",
"*",
",",
"token",
"=",
"None",
")",
":",
"if",
"self",
".",
"logout",
"(",
")",
":",
"return",
"self",
".",
"login",
"(",
"username",
",",
"token",
"=",
"token",
")",
"return",
... | Log in to Google Music with a different user.
Parameters:
username (str, Optional): Your Google Music username.
Used for keeping stored OAuth tokens for multiple accounts separate.
token (dict, Optional): An OAuth token compatible with ``requests-oauthlib``.
Returns:
bool: ``True`` if successfully au... | [
"Log",
"in",
"to",
"Google",
"Music",
"with",
"a",
"different",
"user",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/base.py#L136-L151 |
anrosent/LT-code | lt/sampler.py | gen_tau | def gen_tau(S, K, delta):
"""The Robust part of the RSD, we precompute an
array for speed
"""
pivot = floor(K/S)
return [S/K * 1/d for d in range(1, pivot)] \
+ [S/K * log(S/delta)] \
+ [0 for d in range(pivot, K)] | python | def gen_tau(S, K, delta):
"""The Robust part of the RSD, we precompute an
array for speed
"""
pivot = floor(K/S)
return [S/K * 1/d for d in range(1, pivot)] \
+ [S/K * log(S/delta)] \
+ [0 for d in range(pivot, K)] | [
"def",
"gen_tau",
"(",
"S",
",",
"K",
",",
"delta",
")",
":",
"pivot",
"=",
"floor",
"(",
"K",
"/",
"S",
")",
"return",
"[",
"S",
"/",
"K",
"*",
"1",
"/",
"d",
"for",
"d",
"in",
"range",
"(",
"1",
",",
"pivot",
")",
"]",
"+",
"[",
"S",
... | The Robust part of the RSD, we precompute an
array for speed | [
"The",
"Robust",
"part",
"of",
"the",
"RSD",
"we",
"precompute",
"an",
"array",
"for",
"speed"
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L25-L32 |
anrosent/LT-code | lt/sampler.py | gen_mu | def gen_mu(K, delta, c):
"""The Robust Soliton Distribution on the degree of
transmitted blocks
"""
S = c * log(K/delta) * sqrt(K)
tau = gen_tau(S, K, delta)
rho = gen_rho(K)
normalizer = sum(rho) + sum(tau)
return [(rho[d] + tau[d])/normalizer for d in range(K)] | python | def gen_mu(K, delta, c):
"""The Robust Soliton Distribution on the degree of
transmitted blocks
"""
S = c * log(K/delta) * sqrt(K)
tau = gen_tau(S, K, delta)
rho = gen_rho(K)
normalizer = sum(rho) + sum(tau)
return [(rho[d] + tau[d])/normalizer for d in range(K)] | [
"def",
"gen_mu",
"(",
"K",
",",
"delta",
",",
"c",
")",
":",
"S",
"=",
"c",
"*",
"log",
"(",
"K",
"/",
"delta",
")",
"*",
"sqrt",
"(",
"K",
")",
"tau",
"=",
"gen_tau",
"(",
"S",
",",
"K",
",",
"delta",
")",
"rho",
"=",
"gen_rho",
"(",
"K"... | The Robust Soliton Distribution on the degree of
transmitted blocks | [
"The",
"Robust",
"Soliton",
"Distribution",
"on",
"the",
"degree",
"of",
"transmitted",
"blocks"
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L40-L49 |
anrosent/LT-code | lt/sampler.py | gen_rsd_cdf | def gen_rsd_cdf(K, delta, c):
"""The CDF of the RSD on block degree, precomputed for
sampling speed"""
mu = gen_mu(K, delta, c)
return [sum(mu[:d+1]) for d in range(K)] | python | def gen_rsd_cdf(K, delta, c):
"""The CDF of the RSD on block degree, precomputed for
sampling speed"""
mu = gen_mu(K, delta, c)
return [sum(mu[:d+1]) for d in range(K)] | [
"def",
"gen_rsd_cdf",
"(",
"K",
",",
"delta",
",",
"c",
")",
":",
"mu",
"=",
"gen_mu",
"(",
"K",
",",
"delta",
",",
"c",
")",
"return",
"[",
"sum",
"(",
"mu",
"[",
":",
"d",
"+",
"1",
"]",
")",
"for",
"d",
"in",
"range",
"(",
"K",
")",
"]... | The CDF of the RSD on block degree, precomputed for
sampling speed | [
"The",
"CDF",
"of",
"the",
"RSD",
"on",
"block",
"degree",
"precomputed",
"for",
"sampling",
"speed"
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L51-L56 |
anrosent/LT-code | lt/sampler.py | PRNG._get_next | def _get_next(self):
"""Executes the next iteration of the PRNG
evolution process, and returns the result
"""
self.state = PRNG_A * self.state % PRNG_M
return self.state | python | def _get_next(self):
"""Executes the next iteration of the PRNG
evolution process, and returns the result
"""
self.state = PRNG_A * self.state % PRNG_M
return self.state | [
"def",
"_get_next",
"(",
"self",
")",
":",
"self",
".",
"state",
"=",
"PRNG_A",
"*",
"self",
".",
"state",
"%",
"PRNG_M",
"return",
"self",
".",
"state"
] | Executes the next iteration of the PRNG
evolution process, and returns the result | [
"Executes",
"the",
"next",
"iteration",
"of",
"the",
"PRNG",
"evolution",
"process",
"and",
"returns",
"the",
"result"
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L74-L80 |
anrosent/LT-code | lt/sampler.py | PRNG._sample_d | def _sample_d(self):
"""Samples degree given the precomputed
distributions above and the linear PRNG output
"""
p = self._get_next() / PRNG_MAX_RAND
for ix, v in enumerate(self.cdf):
if v > p:
return ix + 1
return ix + 1 | python | def _sample_d(self):
"""Samples degree given the precomputed
distributions above and the linear PRNG output
"""
p = self._get_next() / PRNG_MAX_RAND
for ix, v in enumerate(self.cdf):
if v > p:
return ix + 1
return ix + 1 | [
"def",
"_sample_d",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"_get_next",
"(",
")",
"/",
"PRNG_MAX_RAND",
"for",
"ix",
",",
"v",
"in",
"enumerate",
"(",
"self",
".",
"cdf",
")",
":",
"if",
"v",
">",
"p",
":",
"return",
"ix",
"+",
"1",
"ret... | Samples degree given the precomputed
distributions above and the linear PRNG output | [
"Samples",
"degree",
"given",
"the",
"precomputed",
"distributions",
"above",
"and",
"the",
"linear",
"PRNG",
"output"
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L82-L91 |
anrosent/LT-code | lt/sampler.py | PRNG.get_src_blocks | def get_src_blocks(self, seed=None):
"""Returns the indices of a set of `d` source blocks
sampled from indices i = 1, ..., K-1 uniformly, where
`d` is sampled from the RSD described above.
"""
if seed:
self.state = seed
blockseed = self.state
d = sel... | python | def get_src_blocks(self, seed=None):
"""Returns the indices of a set of `d` source blocks
sampled from indices i = 1, ..., K-1 uniformly, where
`d` is sampled from the RSD described above.
"""
if seed:
self.state = seed
blockseed = self.state
d = sel... | [
"def",
"get_src_blocks",
"(",
"self",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
":",
"self",
".",
"state",
"=",
"seed",
"blockseed",
"=",
"self",
".",
"state",
"d",
"=",
"self",
".",
"_sample_d",
"(",
")",
"have",
"=",
"0",
"nums",
"=",
"... | Returns the indices of a set of `d` source blocks
sampled from indices i = 1, ..., K-1 uniformly, where
`d` is sampled from the RSD described above. | [
"Returns",
"the",
"indices",
"of",
"a",
"set",
"of",
"d",
"source",
"blocks",
"sampled",
"from",
"indices",
"i",
"=",
"1",
"...",
"K",
"-",
"1",
"uniformly",
"where",
"d",
"is",
"sampled",
"from",
"the",
"RSD",
"described",
"above",
"."
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/sampler.py#L101-L119 |
anrosent/LT-code | lt/encode/__main__.py | run | def run(fn, blocksize, seed, c, delta):
"""Run the encoder until the channel is broken, signalling that the
receiver has successfully reconstructed the file
"""
with open(fn, 'rb') as f:
for block in encode.encoder(f, blocksize, seed, c, delta):
sys.stdout.buffer.write(block) | python | def run(fn, blocksize, seed, c, delta):
"""Run the encoder until the channel is broken, signalling that the
receiver has successfully reconstructed the file
"""
with open(fn, 'rb') as f:
for block in encode.encoder(f, blocksize, seed, c, delta):
sys.stdout.buffer.write(block) | [
"def",
"run",
"(",
"fn",
",",
"blocksize",
",",
"seed",
",",
"c",
",",
"delta",
")",
":",
"with",
"open",
"(",
"fn",
",",
"'rb'",
")",
"as",
"f",
":",
"for",
"block",
"in",
"encode",
".",
"encoder",
"(",
"f",
",",
"blocksize",
",",
"seed",
",",... | Run the encoder until the channel is broken, signalling that the
receiver has successfully reconstructed the file | [
"Run",
"the",
"encoder",
"until",
"the",
"channel",
"is",
"broken",
"signalling",
"that",
"the",
"receiver",
"has",
"successfully",
"reconstructed",
"the",
"file"
] | train | https://github.com/anrosent/LT-code/blob/e13a4c927effc90f9d41ab3884f9fcbd95b9450d/lt/encode/__main__.py#L26-L33 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.is_subscribed | def is_subscribed(self):
"""The subscription status of the account linked to the :class:`MobileClient` instance."""
subscribed = next(
(
config_item['value'] == 'true'
for config_item in self.config()
if config_item['key'] == 'isNautilusUser'
),
None
)
if subscribed:
self.tier = 'aa'
... | python | def is_subscribed(self):
"""The subscription status of the account linked to the :class:`MobileClient` instance."""
subscribed = next(
(
config_item['value'] == 'true'
for config_item in self.config()
if config_item['key'] == 'isNautilusUser'
),
None
)
if subscribed:
self.tier = 'aa'
... | [
"def",
"is_subscribed",
"(",
"self",
")",
":",
"subscribed",
"=",
"next",
"(",
"(",
"config_item",
"[",
"'value'",
"]",
"==",
"'true'",
"for",
"config_item",
"in",
"self",
".",
"config",
"(",
")",
"if",
"config_item",
"[",
"'key'",
"]",
"==",
"'isNautilu... | The subscription status of the account linked to the :class:`MobileClient` instance. | [
"The",
"subscription",
"status",
"of",
"the",
"account",
"linked",
"to",
"the",
":",
"class",
":",
"MobileClient",
"instance",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L87-L104 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.album | def album(self, album_id, *, include_description=True, include_songs=True):
"""Get information about an album.
Parameters:
album_id (str): An album ID. Album IDs start with a 'B'.
include_description (bool, Optional): Include description of the album in the returned dict.
include_songs (bool, Optional): I... | python | def album(self, album_id, *, include_description=True, include_songs=True):
"""Get information about an album.
Parameters:
album_id (str): An album ID. Album IDs start with a 'B'.
include_description (bool, Optional): Include description of the album in the returned dict.
include_songs (bool, Optional): I... | [
"def",
"album",
"(",
"self",
",",
"album_id",
",",
"*",
",",
"include_description",
"=",
"True",
",",
"include_songs",
"=",
"True",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"FetchAlbum",
",",
"album_id",
",",
"include_descript... | Get information about an album.
Parameters:
album_id (str): An album ID. Album IDs start with a 'B'.
include_description (bool, Optional): Include description of the album in the returned dict.
include_songs (bool, Optional): Include songs from the album in the returned dict.
Default: ``True``.
Retur... | [
"Get",
"information",
"about",
"an",
"album",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L137-L158 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.artist | def artist(
self, artist_id, *, include_albums=True, num_related_artists=5, num_top_tracks=5
):
"""Get information about an artist.
Parameters:
artist_id (str): An artist ID. Artist IDs start with an 'A'.
include_albums (bool, Optional): Include albums by the artist in returned dict.
Default: ``True``... | python | def artist(
self, artist_id, *, include_albums=True, num_related_artists=5, num_top_tracks=5
):
"""Get information about an artist.
Parameters:
artist_id (str): An artist ID. Artist IDs start with an 'A'.
include_albums (bool, Optional): Include albums by the artist in returned dict.
Default: ``True``... | [
"def",
"artist",
"(",
"self",
",",
"artist_id",
",",
"*",
",",
"include_albums",
"=",
"True",
",",
"num_related_artists",
"=",
"5",
",",
"num_top_tracks",
"=",
"5",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"FetchArtist",
","... | Get information about an artist.
Parameters:
artist_id (str): An artist ID. Artist IDs start with an 'A'.
include_albums (bool, Optional): Include albums by the artist in returned dict.
Default: ``True``.
num_related_artists (int, Optional): Include up to given number of related artists in returned dict... | [
"Get",
"information",
"about",
"an",
"artist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L160-L187 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.browse_podcasts | def browse_podcasts(self, podcast_genre_id='JZCpodcasttopchartall'):
"""Get the podcasts for a genre from the Podcasts browse tab.
Parameters:
podcast_genre_id (str, Optional): A podcast genre ID as found
in :meth:`browse_podcasts_genres`.
Default: ``'JZCpodcasttopchartall'``.
Returns:
list: Podca... | python | def browse_podcasts(self, podcast_genre_id='JZCpodcasttopchartall'):
"""Get the podcasts for a genre from the Podcasts browse tab.
Parameters:
podcast_genre_id (str, Optional): A podcast genre ID as found
in :meth:`browse_podcasts_genres`.
Default: ``'JZCpodcasttopchartall'``.
Returns:
list: Podca... | [
"def",
"browse_podcasts",
"(",
"self",
",",
"podcast_genre_id",
"=",
"'JZCpodcasttopchartall'",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"PodcastBrowse",
",",
"podcast_genre_id",
"=",
"podcast_genre_id",
")",
"podcast_series_list",
"=",... | Get the podcasts for a genre from the Podcasts browse tab.
Parameters:
podcast_genre_id (str, Optional): A podcast genre ID as found
in :meth:`browse_podcasts_genres`.
Default: ``'JZCpodcasttopchartall'``.
Returns:
list: Podcast dicts. | [
"Get",
"the",
"podcasts",
"for",
"a",
"genre",
"from",
"the",
"Podcasts",
"browse",
"tab",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L189-L207 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.browse_podcasts_genres | def browse_podcasts_genres(self):
"""Get the genres from the Podcasts browse tab dropdown.
Returns:
list: Genre groups that contain sub groups.
"""
response = self._call(
mc_calls.PodcastBrowseHierarchy
)
genres = response.body.get('groups', [])
return genres | python | def browse_podcasts_genres(self):
"""Get the genres from the Podcasts browse tab dropdown.
Returns:
list: Genre groups that contain sub groups.
"""
response = self._call(
mc_calls.PodcastBrowseHierarchy
)
genres = response.body.get('groups', [])
return genres | [
"def",
"browse_podcasts_genres",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"PodcastBrowseHierarchy",
")",
"genres",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'groups'",
",",
"[",
"]",
")",
"return",
"genres"
... | Get the genres from the Podcasts browse tab dropdown.
Returns:
list: Genre groups that contain sub groups. | [
"Get",
"the",
"genres",
"from",
"the",
"Podcasts",
"browse",
"tab",
"dropdown",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L209-L221 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.browse_stations | def browse_stations(self, station_category_id):
"""Get the stations for a category from Browse Stations.
Parameters:
station_category_id (str): A station category ID as
found with :meth:`browse_stations_categories`.
Returns:
list: Station dicts.
"""
response = self._call(
mc_calls.BrowseStatio... | python | def browse_stations(self, station_category_id):
"""Get the stations for a category from Browse Stations.
Parameters:
station_category_id (str): A station category ID as
found with :meth:`browse_stations_categories`.
Returns:
list: Station dicts.
"""
response = self._call(
mc_calls.BrowseStatio... | [
"def",
"browse_stations",
"(",
"self",
",",
"station_category_id",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"BrowseStations",
",",
"station_category_id",
")",
"stations",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'stations'"... | Get the stations for a category from Browse Stations.
Parameters:
station_category_id (str): A station category ID as
found with :meth:`browse_stations_categories`.
Returns:
list: Station dicts. | [
"Get",
"the",
"stations",
"for",
"a",
"category",
"from",
"Browse",
"Stations",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L223-L240 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.browse_stations_categories | def browse_stations_categories(self):
"""Get the categories from Browse Stations.
Returns:
list: Station categories that can contain subcategories.
"""
response = self._call(
mc_calls.BrowseStationCategories
)
station_categories = response.body.get('root', {}).get('subcategories', [])
return stat... | python | def browse_stations_categories(self):
"""Get the categories from Browse Stations.
Returns:
list: Station categories that can contain subcategories.
"""
response = self._call(
mc_calls.BrowseStationCategories
)
station_categories = response.body.get('root', {}).get('subcategories', [])
return stat... | [
"def",
"browse_stations_categories",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"BrowseStationCategories",
")",
"station_categories",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'root'",
",",
"{",
"}",
")",
".",
... | Get the categories from Browse Stations.
Returns:
list: Station categories that can contain subcategories. | [
"Get",
"the",
"categories",
"from",
"Browse",
"Stations",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L242-L254 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.config | def config(self):
"""Get a listing of mobile client configuration settings."""
response = self._call(
mc_calls.Config
)
config_list = response.body.get('data', {}).get('entries', [])
return config_list | python | def config(self):
"""Get a listing of mobile client configuration settings."""
response = self._call(
mc_calls.Config
)
config_list = response.body.get('data', {}).get('entries', [])
return config_list | [
"def",
"config",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"Config",
")",
"config_list",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'data'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'entries'",
",",
"[",
... | Get a listing of mobile client configuration settings. | [
"Get",
"a",
"listing",
"of",
"mobile",
"client",
"configuration",
"settings",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L256-L264 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.device_set | def device_set(self, device):
"""Set device used by :class:`MobileClient` instance.
Parameters:
device (dict): A device dict as returned by :meth:`devices`.
"""
if device['id'].startswith('0x'):
self.device_id = device['id'][2:]
elif device['id'].startswith('ios:'):
self.device_id = device['id'].re... | python | def device_set(self, device):
"""Set device used by :class:`MobileClient` instance.
Parameters:
device (dict): A device dict as returned by :meth:`devices`.
"""
if device['id'].startswith('0x'):
self.device_id = device['id'][2:]
elif device['id'].startswith('ios:'):
self.device_id = device['id'].re... | [
"def",
"device_set",
"(",
"self",
",",
"device",
")",
":",
"if",
"device",
"[",
"'id'",
"]",
".",
"startswith",
"(",
"'0x'",
")",
":",
"self",
".",
"device_id",
"=",
"device",
"[",
"'id'",
"]",
"[",
"2",
":",
"]",
"elif",
"device",
"[",
"'id'",
"... | Set device used by :class:`MobileClient` instance.
Parameters:
device (dict): A device dict as returned by :meth:`devices`. | [
"Set",
"device",
"used",
"by",
":",
"class",
":",
"MobileClient",
"instance",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L280-L292 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.devices | def devices(self):
"""Get a listing of devices registered to the Google Music account."""
response = self._call(
mc_calls.DeviceManagementInfo
)
registered_devices = response.body.get('data', {}).get('items', [])
return registered_devices | python | def devices(self):
"""Get a listing of devices registered to the Google Music account."""
response = self._call(
mc_calls.DeviceManagementInfo
)
registered_devices = response.body.get('data', {}).get('items', [])
return registered_devices | [
"def",
"devices",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"DeviceManagementInfo",
")",
"registered_devices",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'data'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'ite... | Get a listing of devices registered to the Google Music account. | [
"Get",
"a",
"listing",
"of",
"devices",
"registered",
"to",
"the",
"Google",
"Music",
"account",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L294-L302 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.explore_genres | def explore_genres(self, parent_genre_id=None):
"""Get a listing of song genres.
Parameters:
parent_genre_id (str, Optional): A genre ID.
If given, a listing of this genre's sub-genres is returned.
Returns:
list: Genre dicts.
"""
response = self._call(
mc_calls.ExploreGenres,
parent_genre_i... | python | def explore_genres(self, parent_genre_id=None):
"""Get a listing of song genres.
Parameters:
parent_genre_id (str, Optional): A genre ID.
If given, a listing of this genre's sub-genres is returned.
Returns:
list: Genre dicts.
"""
response = self._call(
mc_calls.ExploreGenres,
parent_genre_i... | [
"def",
"explore_genres",
"(",
"self",
",",
"parent_genre_id",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"ExploreGenres",
",",
"parent_genre_id",
")",
"genre_list",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'g... | Get a listing of song genres.
Parameters:
parent_genre_id (str, Optional): A genre ID.
If given, a listing of this genre's sub-genres is returned.
Returns:
list: Genre dicts. | [
"Get",
"a",
"listing",
"of",
"song",
"genres",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L304-L321 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.explore_tabs | def explore_tabs(self, *, num_items=100, genre_id=None):
"""Get a listing of explore tabs.
Parameters:
num_items (int, Optional): Number of items per tab to return.
Default: ``100``
genre_id (genre_id, Optional): Genre ID from :meth:`explore_genres` to explore.
Default: ``None``.
Returns:
dict:... | python | def explore_tabs(self, *, num_items=100, genre_id=None):
"""Get a listing of explore tabs.
Parameters:
num_items (int, Optional): Number of items per tab to return.
Default: ``100``
genre_id (genre_id, Optional): Genre ID from :meth:`explore_genres` to explore.
Default: ``None``.
Returns:
dict:... | [
"def",
"explore_tabs",
"(",
"self",
",",
"*",
",",
"num_items",
"=",
"100",
",",
"genre_id",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"ExploreTabs",
",",
"num_items",
"=",
"num_items",
",",
"genre_id",
"=",
"g... | Get a listing of explore tabs.
Parameters:
num_items (int, Optional): Number of items per tab to return.
Default: ``100``
genre_id (genre_id, Optional): Genre ID from :meth:`explore_genres` to explore.
Default: ``None``.
Returns:
dict: Explore tabs content. | [
"Get",
"a",
"listing",
"of",
"explore",
"tabs",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L323-L347 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.listen_now_dismissed_items | def listen_now_dismissed_items(self):
"""Get a listing of items dismissed from Listen Now tab."""
response = self._call(
mc_calls.ListenNowGetDismissedItems
)
dismissed_items = response.body.get('items', [])
return dismissed_items | python | def listen_now_dismissed_items(self):
"""Get a listing of items dismissed from Listen Now tab."""
response = self._call(
mc_calls.ListenNowGetDismissedItems
)
dismissed_items = response.body.get('items', [])
return dismissed_items | [
"def",
"listen_now_dismissed_items",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"ListenNowGetDismissedItems",
")",
"dismissed_items",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'items'",
",",
"[",
"]",
")",
"retu... | Get a listing of items dismissed from Listen Now tab. | [
"Get",
"a",
"listing",
"of",
"items",
"dismissed",
"from",
"Listen",
"Now",
"tab",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L349-L357 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.listen_now_items | def listen_now_items(self):
"""Get a listing of Listen Now items.
Note:
This does not include situations;
use the :meth:`situations` method instead.
Returns:
dict: With ``albums`` and ``stations`` keys of listen now items.
"""
response = self._call(
mc_calls.ListenNowGetListenNowItems
)
lis... | python | def listen_now_items(self):
"""Get a listing of Listen Now items.
Note:
This does not include situations;
use the :meth:`situations` method instead.
Returns:
dict: With ``albums`` and ``stations`` keys of listen now items.
"""
response = self._call(
mc_calls.ListenNowGetListenNowItems
)
lis... | [
"def",
"listen_now_items",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"ListenNowGetListenNowItems",
")",
"listen_now_item_list",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'listennow_items'",
",",
"[",
"]",
")",
... | Get a listing of Listen Now items.
Note:
This does not include situations;
use the :meth:`situations` method instead.
Returns:
dict: With ``albums`` and ``stations`` keys of listen now items. | [
"Get",
"a",
"listing",
"of",
"Listen",
"Now",
"items",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L359-L380 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_song | def playlist_song(self, playlist_song_id):
"""Get information about a playlist song.
Note:
This returns the playlist entry information only.
For full song metadata, use :meth:`song` with
the ``'trackId'`` field.
Parameters:
playlist_song_id (str): A playlist song ID.
Returns:
dict: Playlist so... | python | def playlist_song(self, playlist_song_id):
"""Get information about a playlist song.
Note:
This returns the playlist entry information only.
For full song metadata, use :meth:`song` with
the ``'trackId'`` field.
Parameters:
playlist_song_id (str): A playlist song ID.
Returns:
dict: Playlist so... | [
"def",
"playlist_song",
"(",
"self",
",",
"playlist_song_id",
")",
":",
"playlist_song_info",
"=",
"next",
"(",
"(",
"playlist_song",
"for",
"playlist",
"in",
"self",
".",
"playlists",
"(",
"include_songs",
"=",
"True",
")",
"for",
"playlist_song",
"in",
"play... | Get information about a playlist song.
Note:
This returns the playlist entry information only.
For full song metadata, use :meth:`song` with
the ``'trackId'`` field.
Parameters:
playlist_song_id (str): A playlist song ID.
Returns:
dict: Playlist song information. | [
"Get",
"information",
"about",
"a",
"playlist",
"song",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L394-L419 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_song_add | def playlist_song_add(
self,
song,
playlist,
*,
after=None,
before=None,
index=None,
position=None
):
"""Add a song to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pro... | python | def playlist_song_add(
self,
song,
playlist,
*,
after=None,
before=None,
index=None,
position=None
):
"""Add a song to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pro... | [
"def",
"playlist_song_add",
"(",
"self",
",",
"song",
",",
"playlist",
",",
"*",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
",",
"index",
"=",
"None",
",",
"position",
"=",
"None",
")",
":",
"prev",
",",
"next_",
"=",
"get_ple_prev_next",
... | Add a song to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Provide a one-based ``position``.
Songs are inserted *at* given index or position.
It's also possible to add to the end ... | [
"Add",
"a",
"song",
"to",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L421-L477 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_songs_add | def playlist_songs_add(
self,
songs,
playlist,
*,
after=None,
before=None,
index=None,
position=None
):
"""Add songs to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pr... | python | def playlist_songs_add(
self,
songs,
playlist,
*,
after=None,
before=None,
index=None,
position=None
):
"""Add songs to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pr... | [
"def",
"playlist_songs_add",
"(",
"self",
",",
"songs",
",",
"playlist",
",",
"*",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
",",
"index",
"=",
"None",
",",
"position",
"=",
"None",
")",
":",
"playlist_songs",
"=",
"self",
".",
"playlist_s... | Add songs to a playlist.
Note:
* Provide no optional arguments to add to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Provide a one-based ``position``.
Songs are inserted *at* given index or position.
It's also possible to add to the end b... | [
"Add",
"songs",
"to",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L479-L550 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_song_delete | def playlist_song_delete(self, playlist_song):
"""Delete song from playlist.
Parameters:
playlist_song (str): A playlist song dict.
Returns:
dict: Playlist dict including songs.
"""
self.playlist_songs_delete([playlist_song])
return self.playlist(playlist_song['playlistId'], include_songs=True) | python | def playlist_song_delete(self, playlist_song):
"""Delete song from playlist.
Parameters:
playlist_song (str): A playlist song dict.
Returns:
dict: Playlist dict including songs.
"""
self.playlist_songs_delete([playlist_song])
return self.playlist(playlist_song['playlistId'], include_songs=True) | [
"def",
"playlist_song_delete",
"(",
"self",
",",
"playlist_song",
")",
":",
"self",
".",
"playlist_songs_delete",
"(",
"[",
"playlist_song",
"]",
")",
"return",
"self",
".",
"playlist",
"(",
"playlist_song",
"[",
"'playlistId'",
"]",
",",
"include_songs",
"=",
... | Delete song from playlist.
Parameters:
playlist_song (str): A playlist song dict.
Returns:
dict: Playlist dict including songs. | [
"Delete",
"song",
"from",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L552-L564 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_songs_delete | def playlist_songs_delete(self, playlist_songs):
"""Delete songs from playlist.
Parameters:
playlist_songs (list): A list of playlist song dicts.
Returns:
dict: Playlist dict including songs.
"""
if not more_itertools.all_equal(
playlist_song['playlistId']
for playlist_song in playlist_songs
... | python | def playlist_songs_delete(self, playlist_songs):
"""Delete songs from playlist.
Parameters:
playlist_songs (list): A list of playlist song dicts.
Returns:
dict: Playlist dict including songs.
"""
if not more_itertools.all_equal(
playlist_song['playlistId']
for playlist_song in playlist_songs
... | [
"def",
"playlist_songs_delete",
"(",
"self",
",",
"playlist_songs",
")",
":",
"if",
"not",
"more_itertools",
".",
"all_equal",
"(",
"playlist_song",
"[",
"'playlistId'",
"]",
"for",
"playlist_song",
"in",
"playlist_songs",
")",
":",
"raise",
"ValueError",
"(",
"... | Delete songs from playlist.
Parameters:
playlist_songs (list): A list of playlist song dicts.
Returns:
dict: Playlist dict including songs. | [
"Delete",
"songs",
"from",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L566-L587 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_song_move | def playlist_song_move(
self,
playlist_song,
*,
after=None,
before=None,
index=None,
position=None
):
"""Move a song in a playlist.
Note:
* Provide no optional arguments to move to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pro... | python | def playlist_song_move(
self,
playlist_song,
*,
after=None,
before=None,
index=None,
position=None
):
"""Move a song in a playlist.
Note:
* Provide no optional arguments to move to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pro... | [
"def",
"playlist_song_move",
"(",
"self",
",",
"playlist_song",
",",
"*",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
",",
"index",
"=",
"None",
",",
"position",
"=",
"None",
")",
":",
"playlist_songs",
"=",
"self",
".",
"playlist",
"(",
"pl... | Move a song in a playlist.
Note:
* Provide no optional arguments to move to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Provide a one-based ``position``.
Songs are inserted *at* given index or position.
It's also possible to move to the e... | [
"Move",
"a",
"song",
"in",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L589-L641 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_songs_move | def playlist_songs_move(
self,
playlist_songs,
*,
after=None,
before=None,
index=None,
position=None
):
"""Move songs in a playlist.
Note:
* Provide no optional arguments to move to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pr... | python | def playlist_songs_move(
self,
playlist_songs,
*,
after=None,
before=None,
index=None,
position=None
):
"""Move songs in a playlist.
Note:
* Provide no optional arguments to move to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Pr... | [
"def",
"playlist_songs_move",
"(",
"self",
",",
"playlist_songs",
",",
"*",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
",",
"index",
"=",
"None",
",",
"position",
"=",
"None",
")",
":",
"if",
"not",
"more_itertools",
".",
"all_equal",
"(",
... | Move songs in a playlist.
Note:
* Provide no optional arguments to move to end.
* Provide playlist song dicts for ``after`` and/or ``before``.
* Provide a zero-based ``index``.
* Provide a one-based ``position``.
Songs are inserted *at* given index or position.
It's also possible to move to the en... | [
"Move",
"songs",
"in",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L643-L716 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_songs | def playlist_songs(self, playlist):
"""Get a listing of songs from a playlist.
Paramters:
playlist (dict): A playlist dict.
Returns:
list: Playlist song dicts.
"""
playlist_type = playlist.get('type')
playlist_song_list = []
if playlist_type in ('USER_GENERATED', None):
start_token = None
... | python | def playlist_songs(self, playlist):
"""Get a listing of songs from a playlist.
Paramters:
playlist (dict): A playlist dict.
Returns:
list: Playlist song dicts.
"""
playlist_type = playlist.get('type')
playlist_song_list = []
if playlist_type in ('USER_GENERATED', None):
start_token = None
... | [
"def",
"playlist_songs",
"(",
"self",
",",
"playlist",
")",
":",
"playlist_type",
"=",
"playlist",
".",
"get",
"(",
"'type'",
")",
"playlist_song_list",
"=",
"[",
"]",
"if",
"playlist_type",
"in",
"(",
"'USER_GENERATED'",
",",
"None",
")",
":",
"start_token"... | Get a listing of songs from a playlist.
Paramters:
playlist (dict): A playlist dict.
Returns:
list: Playlist song dicts. | [
"Get",
"a",
"listing",
"of",
"songs",
"from",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L718-L772 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist | def playlist(self, playlist_id, *, include_songs=False):
"""Get information about a playlist.
Parameters:
playlist_id (str): A playlist ID.
include_songs (bool, Optional): Include songs from
the playlist in the returned dict.
Default: ``False``
Returns:
dict: Playlist information.
"""
play... | python | def playlist(self, playlist_id, *, include_songs=False):
"""Get information about a playlist.
Parameters:
playlist_id (str): A playlist ID.
include_songs (bool, Optional): Include songs from
the playlist in the returned dict.
Default: ``False``
Returns:
dict: Playlist information.
"""
play... | [
"def",
"playlist",
"(",
"self",
",",
"playlist_id",
",",
"*",
",",
"include_songs",
"=",
"False",
")",
":",
"playlist_info",
"=",
"next",
"(",
"(",
"playlist",
"for",
"playlist",
"in",
"self",
".",
"playlists",
"(",
"include_songs",
"=",
"include_songs",
"... | Get information about a playlist.
Parameters:
playlist_id (str): A playlist ID.
include_songs (bool, Optional): Include songs from
the playlist in the returned dict.
Default: ``False``
Returns:
dict: Playlist information. | [
"Get",
"information",
"about",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L774-L796 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_create | def playlist_create(
self,
name,
description='',
*,
make_public=False,
songs=None
):
"""Create a playlist.
Parameters:
name (str): Name to give the playlist.
description (str): Description to give the playlist.
make_public (bool, Optional): If ``True`` and account has a subscription,
make... | python | def playlist_create(
self,
name,
description='',
*,
make_public=False,
songs=None
):
"""Create a playlist.
Parameters:
name (str): Name to give the playlist.
description (str): Description to give the playlist.
make_public (bool, Optional): If ``True`` and account has a subscription,
make... | [
"def",
"playlist_create",
"(",
"self",
",",
"name",
",",
"description",
"=",
"''",
",",
"*",
",",
"make_public",
"=",
"False",
",",
"songs",
"=",
"None",
")",
":",
"share_state",
"=",
"'PUBLIC'",
"if",
"make_public",
"else",
"'PRIVATE'",
"playlist",
"=",
... | Create a playlist.
Parameters:
name (str): Name to give the playlist.
description (str): Description to give the playlist.
make_public (bool, Optional): If ``True`` and account has a subscription,
make playlist public.
Default: ``False``
songs (list, Optional): A list of song dicts to add to the ... | [
"Create",
"a",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L798-L832 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_edit | def playlist_edit(self, playlist, *, name=None, description=None, public=None):
"""Edit playlist(s).
Parameters:
playlist (dict): A playlist dict.
name (str): Name to give the playlist.
description (str, Optional): Description to give the playlist.
make_public (bool, Optional): If ``True`` and account ... | python | def playlist_edit(self, playlist, *, name=None, description=None, public=None):
"""Edit playlist(s).
Parameters:
playlist (dict): A playlist dict.
name (str): Name to give the playlist.
description (str, Optional): Description to give the playlist.
make_public (bool, Optional): If ``True`` and account ... | [
"def",
"playlist_edit",
"(",
"self",
",",
"playlist",
",",
"*",
",",
"name",
"=",
"None",
",",
"description",
"=",
"None",
",",
"public",
"=",
"None",
")",
":",
"if",
"all",
"(",
"value",
"is",
"None",
"for",
"value",
"in",
"(",
"name",
",",
"descr... | Edit playlist(s).
Parameters:
playlist (dict): A playlist dict.
name (str): Name to give the playlist.
description (str, Optional): Description to give the playlist.
make_public (bool, Optional): If ``True`` and account has a subscription,
make playlist public.
Default: ``False``
Returns:
d... | [
"Edit",
"playlist",
"(",
"s",
")",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L847-L887 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlist_subscribe | def playlist_subscribe(self, playlist):
"""Subscribe to a public playlist.
Parameters:
playlist (dict): A public playlist dict.
Returns:
dict: Playlist information.
"""
mutation = mc_calls.PlaylistBatch.create(
playlist['name'],
playlist['description'],
'SHARED',
owner_name=playlist.get('... | python | def playlist_subscribe(self, playlist):
"""Subscribe to a public playlist.
Parameters:
playlist (dict): A public playlist dict.
Returns:
dict: Playlist information.
"""
mutation = mc_calls.PlaylistBatch.create(
playlist['name'],
playlist['description'],
'SHARED',
owner_name=playlist.get('... | [
"def",
"playlist_subscribe",
"(",
"self",
",",
"playlist",
")",
":",
"mutation",
"=",
"mc_calls",
".",
"PlaylistBatch",
".",
"create",
"(",
"playlist",
"[",
"'name'",
"]",
",",
"playlist",
"[",
"'description'",
"]",
",",
"'SHARED'",
",",
"owner_name",
"=",
... | Subscribe to a public playlist.
Parameters:
playlist (dict): A public playlist dict.
Returns:
dict: Playlist information. | [
"Subscribe",
"to",
"a",
"public",
"playlist",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L889-L914 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlists | def playlists(self, *, include_songs=False):
"""Get a listing of library playlists.
Parameters:
include_songs (bool, Optional): Include songs in the returned playlist dicts.
Default: ``False``.
Returns:
list: A list of playlist dicts.
"""
playlist_list = []
for chunk in self.playlists_iter(page... | python | def playlists(self, *, include_songs=False):
"""Get a listing of library playlists.
Parameters:
include_songs (bool, Optional): Include songs in the returned playlist dicts.
Default: ``False``.
Returns:
list: A list of playlist dicts.
"""
playlist_list = []
for chunk in self.playlists_iter(page... | [
"def",
"playlists",
"(",
"self",
",",
"*",
",",
"include_songs",
"=",
"False",
")",
":",
"playlist_list",
"=",
"[",
"]",
"for",
"chunk",
"in",
"self",
".",
"playlists_iter",
"(",
"page_size",
"=",
"49995",
")",
":",
"for",
"playlist",
"in",
"chunk",
":... | Get a listing of library playlists.
Parameters:
include_songs (bool, Optional): Include songs in the returned playlist dicts.
Default: ``False``.
Returns:
list: A list of playlist dicts. | [
"Get",
"a",
"listing",
"of",
"library",
"playlists",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L926-L945 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.playlists_iter | def playlists_iter(self, *, start_token=None, page_size=250):
"""Get a paged iterator of library playlists.
Parameters:
start_token (str): The token of the page to return.
Default: Not sent to get first page.
page_size (int, Optional): The maximum number of results per returned page.
Max allowed is `... | python | def playlists_iter(self, *, start_token=None, page_size=250):
"""Get a paged iterator of library playlists.
Parameters:
start_token (str): The token of the page to return.
Default: Not sent to get first page.
page_size (int, Optional): The maximum number of results per returned page.
Max allowed is `... | [
"def",
"playlists_iter",
"(",
"self",
",",
"*",
",",
"start_token",
"=",
"None",
",",
"page_size",
"=",
"250",
")",
":",
"start_token",
"=",
"None",
"while",
"True",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"PlaylistFeed",
",",
... | Get a paged iterator of library playlists.
Parameters:
start_token (str): The token of the page to return.
Default: Not sent to get first page.
page_size (int, Optional): The maximum number of results per returned page.
Max allowed is ``49995``.
Default: ``250``
Yields:
list: Playlist dicts. | [
"Get",
"a",
"paged",
"iterator",
"of",
"library",
"playlists",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L947-L976 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.podcast | def podcast(self, podcast_series_id, *, max_episodes=50):
"""Get information about a podcast series.
Parameters:
podcast_series_id (str): A podcast series ID.
max_episodes (int, Optional): Include up to given number of episodes in returned dict.
Default: ``50``
Returns:
dict: Podcast series informa... | python | def podcast(self, podcast_series_id, *, max_episodes=50):
"""Get information about a podcast series.
Parameters:
podcast_series_id (str): A podcast series ID.
max_episodes (int, Optional): Include up to given number of episodes in returned dict.
Default: ``50``
Returns:
dict: Podcast series informa... | [
"def",
"podcast",
"(",
"self",
",",
"podcast_series_id",
",",
"*",
",",
"max_episodes",
"=",
"50",
")",
":",
"podcast_info",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"PodcastFetchSeries",
",",
"podcast_series_id",
",",
"max_episodes",
"=",
"max_episode... | Get information about a podcast series.
Parameters:
podcast_series_id (str): A podcast series ID.
max_episodes (int, Optional): Include up to given number of episodes in returned dict.
Default: ``50``
Returns:
dict: Podcast series information. | [
"Get",
"information",
"about",
"a",
"podcast",
"series",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L978-L996 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.podcasts | def podcasts(self, *, device_id=None):
"""Get a listing of subsribed podcast series.
Paramaters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
Returns:
list: Podcast series dict.
"""
if device_id is None:
device_id = self.devic... | python | def podcasts(self, *, device_id=None):
"""Get a listing of subsribed podcast series.
Paramaters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
Returns:
list: Podcast series dict.
"""
if device_id is None:
device_id = self.devic... | [
"def",
"podcasts",
"(",
"self",
",",
"*",
",",
"device_id",
"=",
"None",
")",
":",
"if",
"device_id",
"is",
"None",
":",
"device_id",
"=",
"self",
".",
"device_id",
"podcast_list",
"=",
"[",
"]",
"for",
"chunk",
"in",
"self",
".",
"podcasts_iter",
"(",... | Get a listing of subsribed podcast series.
Paramaters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
Returns:
list: Podcast series dict. | [
"Get",
"a",
"listing",
"of",
"subsribed",
"podcast",
"series",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L998-L1016 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.podcasts_iter | def podcasts_iter(self, *, device_id=None, page_size=250):
"""Get a paged iterator of subscribed podcast series.
Parameters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
page_size (int, Optional): The maximum number of results per return... | python | def podcasts_iter(self, *, device_id=None, page_size=250):
"""Get a paged iterator of subscribed podcast series.
Parameters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
page_size (int, Optional): The maximum number of results per return... | [
"def",
"podcasts_iter",
"(",
"self",
",",
"*",
",",
"device_id",
"=",
"None",
",",
"page_size",
"=",
"250",
")",
":",
"if",
"device_id",
"is",
"None",
":",
"device_id",
"=",
"self",
".",
"device_id",
"start_token",
"=",
"None",
"prev_items",
"=",
"None",... | Get a paged iterator of subscribed podcast series.
Parameters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
page_size (int, Optional): The maximum number of results per returned page.
Max allowed is ``49995``.
Default: ``250``
Y... | [
"Get",
"a",
"paged",
"iterator",
"of",
"subscribed",
"podcast",
"series",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1018-L1063 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.podcast_episode | def podcast_episode(self, podcast_episode_id):
"""Get information about a podcast_episode.
Parameters:
podcast_episode_id (str): A podcast episode ID.
Returns:
dict: Podcast episode information.
"""
response = self._call(
mc_calls.PodcastFetchEpisode,
podcast_episode_id
)
podcast_episode_in... | python | def podcast_episode(self, podcast_episode_id):
"""Get information about a podcast_episode.
Parameters:
podcast_episode_id (str): A podcast episode ID.
Returns:
dict: Podcast episode information.
"""
response = self._call(
mc_calls.PodcastFetchEpisode,
podcast_episode_id
)
podcast_episode_in... | [
"def",
"podcast_episode",
"(",
"self",
",",
"podcast_episode_id",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"PodcastFetchEpisode",
",",
"podcast_episode_id",
")",
"podcast_episode_info",
"=",
"[",
"podcast_episode",
"for",
"podcast_episo... | Get information about a podcast_episode.
Parameters:
podcast_episode_id (str): A podcast episode ID.
Returns:
dict: Podcast episode information. | [
"Get",
"information",
"about",
"a",
"podcast_episode",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1065-L1085 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.podcast_episodes | def podcast_episodes(self, *, device_id=None):
"""Get a listing of podcast episodes for all subscribed podcasts.
Paramaters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
Returns:
list: Podcast episode dicts.
"""
if device_id is N... | python | def podcast_episodes(self, *, device_id=None):
"""Get a listing of podcast episodes for all subscribed podcasts.
Paramaters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
Returns:
list: Podcast episode dicts.
"""
if device_id is N... | [
"def",
"podcast_episodes",
"(",
"self",
",",
"*",
",",
"device_id",
"=",
"None",
")",
":",
"if",
"device_id",
"is",
"None",
":",
"device_id",
"=",
"self",
".",
"device_id",
"podcast_episode_list",
"=",
"[",
"]",
"for",
"chunk",
"in",
"self",
".",
"podcas... | Get a listing of podcast episodes for all subscribed podcasts.
Paramaters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
Returns:
list: Podcast episode dicts. | [
"Get",
"a",
"listing",
"of",
"podcast",
"episodes",
"for",
"all",
"subscribed",
"podcasts",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1087-L1108 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.podcast_episodes_iter | def podcast_episodes_iter(self, *, device_id=None, page_size=250):
"""Get a paged iterator of podcast episode for all subscribed podcasts.
Parameters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
page_size (int, Optional): The maximum nu... | python | def podcast_episodes_iter(self, *, device_id=None, page_size=250):
"""Get a paged iterator of podcast episode for all subscribed podcasts.
Parameters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
page_size (int, Optional): The maximum nu... | [
"def",
"podcast_episodes_iter",
"(",
"self",
",",
"*",
",",
"device_id",
"=",
"None",
",",
"page_size",
"=",
"250",
")",
":",
"if",
"device_id",
"is",
"None",
":",
"device_id",
"=",
"self",
".",
"device_id",
"start_token",
"=",
"None",
"prev_items",
"=",
... | Get a paged iterator of podcast episode for all subscribed podcasts.
Parameters:
device_id (str, Optional): A mobile device ID.
Default: Use ``device_id`` of the :class:`MobileClient` instance.
page_size (int, Optional): The maximum number of results per returned page.
Max allowed is ``49995``.
Def... | [
"Get",
"a",
"paged",
"iterator",
"of",
"podcast",
"episode",
"for",
"all",
"subscribed",
"podcasts",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1110-L1149 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.search | def search(self, query, *, max_results=100, **kwargs):
"""Search Google Music and library for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type per
location to retrieve. I.e up to 100 Google and 100 library
for a total of 200 for the defaul... | python | def search(self, query, *, max_results=100, **kwargs):
"""Search Google Music and library for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type per
location to retrieve. I.e up to 100 Google and 100 library
for a total of 200 for the defaul... | [
"def",
"search",
"(",
"self",
",",
"query",
",",
"*",
",",
"max_results",
"=",
"100",
",",
"*",
"*",
"kwargs",
")",
":",
"results",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"type_",
",",
"results_",
"in",
"self",
".",
"search_library",
"(",
"quer... | Search Google Music and library for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type per
location to retrieve. I.e up to 100 Google and 100 library
for a total of 200 for the default value.
Google only accepts values up to 100.
Defau... | [
"Search",
"Google",
"Music",
"and",
"library",
"for",
"content",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1151-L1192 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.search_google | def search_google(self, query, *, max_results=100, **kwargs):
"""Search Google Music for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type to retrieve.
Google only accepts values up to 100.
Default: ``100``
kwargs (bool, Optional): Any o... | python | def search_google(self, query, *, max_results=100, **kwargs):
"""Search Google Music for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type to retrieve.
Google only accepts values up to 100.
Default: ``100``
kwargs (bool, Optional): Any o... | [
"def",
"search_google",
"(",
"self",
",",
"query",
",",
"*",
",",
"max_results",
"=",
"100",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"Query",
",",
"query",
",",
"max_results",
"=",
"max_results",
... | Search Google Music for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type to retrieve.
Google only accepts values up to 100.
Default: ``100``
kwargs (bool, Optional): Any of ``albums``, ``artists``, ``genres``,
``playlists``, ``podcast... | [
"Search",
"Google",
"Music",
"for",
"content",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1194-L1240 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.search_library | def search_library(self, query, *, max_results=100, **kwargs):
"""Search Google Music for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type to retrieve.
Default: ``100``
kwargs (bool, Optional): Any of ``playlists``, ``podcasts``,
``song... | python | def search_library(self, query, *, max_results=100, **kwargs):
"""Search Google Music for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type to retrieve.
Default: ``100``
kwargs (bool, Optional): Any of ``playlists``, ``podcasts``,
``song... | [
"def",
"search_library",
"(",
"self",
",",
"query",
",",
"*",
",",
"max_results",
"=",
"100",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"match_fields",
"(",
"item",
",",
"fields",
")",
":",
"return",
"any",
"(",
"query",
".",
"casefold",
"(",
")",
... | Search Google Music for content.
Parameters:
query (str): Search text.
max_results (int, Optional): Maximum number of results per type to retrieve.
Default: ``100``
kwargs (bool, Optional): Any of ``playlists``, ``podcasts``,
``songs``, ``stations``, ``videos`` set to ``True``
will include that ... | [
"Search",
"Google",
"Music",
"for",
"content",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1242-L1298 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.search_suggestion | def search_suggestion(self, query):
"""Get search query suggestions for query.
Parameters:
query (str): Search text.
Returns:
list: Suggested query strings.
"""
response = self._call(
mc_calls.QuerySuggestion,
query
)
suggested_queries = response.body.get('suggested_queries', [])
return ... | python | def search_suggestion(self, query):
"""Get search query suggestions for query.
Parameters:
query (str): Search text.
Returns:
list: Suggested query strings.
"""
response = self._call(
mc_calls.QuerySuggestion,
query
)
suggested_queries = response.body.get('suggested_queries', [])
return ... | [
"def",
"search_suggestion",
"(",
"self",
",",
"query",
")",
":",
"response",
"=",
"self",
".",
"_call",
"(",
"mc_calls",
".",
"QuerySuggestion",
",",
"query",
")",
"suggested_queries",
"=",
"response",
".",
"body",
".",
"get",
"(",
"'suggested_queries'",
","... | Get search query suggestions for query.
Parameters:
query (str): Search text.
Returns:
list: Suggested query strings. | [
"Get",
"search",
"query",
"suggestions",
"for",
"query",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1300-L1319 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.shuffle_album | def shuffle_album(
self, album, *, num_songs=100, only_library=False, recently_played=None
):
"""Get a listing of album shuffle/mix songs.
Parameters:
album (dict): An album dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Default: ``100``
only_library (bool,... | python | def shuffle_album(
self, album, *, num_songs=100, only_library=False, recently_played=None
):
"""Get a listing of album shuffle/mix songs.
Parameters:
album (dict): An album dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Default: ``100``
only_library (bool,... | [
"def",
"shuffle_album",
"(",
"self",
",",
"album",
",",
"*",
",",
"num_songs",
"=",
"100",
",",
"only_library",
"=",
"False",
",",
"recently_played",
"=",
"None",
")",
":",
"station_info",
"=",
"{",
"'seed'",
":",
"{",
"'albumId'",
":",
"album",
"[",
"... | Get a listing of album shuffle/mix songs.
Parameters:
album (dict): An album dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Default: ``100``
only_library (bool, Optional): Only return content from library.
Default: False
recently_played (list, Optional): ... | [
"Get",
"a",
"listing",
"of",
"album",
"shuffle",
"/",
"mix",
"songs",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1321-L1362 |
thebigmunch/google-music | src/google_music/clients/mobileclient.py | MobileClient.shuffle_artist | def shuffle_artist(
self,
artist,
*,
num_songs=100,
only_library=False,
recently_played=None,
only_artist=False
):
"""Get a listing of artist shuffle/mix songs.
Parameters:
artist (dict): An artist dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Def... | python | def shuffle_artist(
self,
artist,
*,
num_songs=100,
only_library=False,
recently_played=None,
only_artist=False
):
"""Get a listing of artist shuffle/mix songs.
Parameters:
artist (dict): An artist dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Def... | [
"def",
"shuffle_artist",
"(",
"self",
",",
"artist",
",",
"*",
",",
"num_songs",
"=",
"100",
",",
"only_library",
"=",
"False",
",",
"recently_played",
"=",
"None",
",",
"only_artist",
"=",
"False",
")",
":",
"station_info",
"=",
"{",
"'num_entries'",
":",... | Get a listing of artist shuffle/mix songs.
Parameters:
artist (dict): An artist dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Default: ``100``
only_library (bool, Optional): Only return content from library.
Default: False
recently_played (list, Optional... | [
"Get",
"a",
"listing",
"of",
"artist",
"shuffle",
"/",
"mix",
"songs",
"."
] | train | https://github.com/thebigmunch/google-music/blob/d8a94dab462a1f063fbc1152187a73dc2f0e2a85/src/google_music/clients/mobileclient.py#L1364-L1421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.