body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
dfbb32565e802695cdc054c8e06f66ec55244968d2a96d74d139710fb5223ea3 | def simulate_highest_outlier(self, s_all, lpost, t0, max_post=True, seed=None):
'\n Simulate :math:`n` power spectra from a model and then find the highest\n data/model outlier in each.\n\n The data/model outlier is defined as\n\n .. math::\n\n \\max{(T_R = 2(\\mathrm{data}/\... | Simulate :math:`n` power spectra from a model and then find the highest
data/model outlier in each.
The data/model outlier is defined as
.. math::
\max{(T_R = 2(\mathrm{data}/\mathrm{model}))} .
Parameters
----------
s_all : numpy.ndarray
A list of parameter values derived either from an approximation of t... | stingray/modeling/parameterestimation.py | simulate_highest_outlier | nimeshvashistha/stingray | 133 | python | def simulate_highest_outlier(self, s_all, lpost, t0, max_post=True, seed=None):
'\n Simulate :math:`n` power spectra from a model and then find the highest\n data/model outlier in each.\n\n The data/model outlier is defined as\n\n .. math::\n\n \\max{(T_R = 2(\\mathrm{data}/\... | def simulate_highest_outlier(self, s_all, lpost, t0, max_post=True, seed=None):
'\n Simulate :math:`n` power spectra from a model and then find the highest\n data/model outlier in each.\n\n The data/model outlier is defined as\n\n .. math::\n\n \\max{(T_R = 2(\\mathrm{data}/\... |
8c162a907f11f84f8db0bcafa20588617686ba885a15dfb4e9f7f02760531d8d | def _compute_highest_outlier(self, lpost, res, nmax=1):
'\n Auxiliary method calculating the highest outlier statistic in\n a power spectrum.\n\n The maximum data/model outlier is defined as\n\n .. math::\n\n \\max{(T_R = 2(\\mathrm{data}/\\mathrm{model}))}\n\n Paramet... | Auxiliary method calculating the highest outlier statistic in
a power spectrum.
The maximum data/model outlier is defined as
.. math::
\max{(T_R = 2(\mathrm{data}/\mathrm{model}))}
Parameters
----------
lpost : instance of a :class:`Posterior` subclass
and instance of class :class:`Posterior` or one of its... | stingray/modeling/parameterestimation.py | _compute_highest_outlier | nimeshvashistha/stingray | 133 | python | def _compute_highest_outlier(self, lpost, res, nmax=1):
'\n Auxiliary method calculating the highest outlier statistic in\n a power spectrum.\n\n The maximum data/model outlier is defined as\n\n .. math::\n\n \\max{(T_R = 2(\\mathrm{data}/\\mathrm{model}))}\n\n Paramet... | def _compute_highest_outlier(self, lpost, res, nmax=1):
'\n Auxiliary method calculating the highest outlier statistic in\n a power spectrum.\n\n The maximum data/model outlier is defined as\n\n .. math::\n\n \\max{(T_R = 2(\\mathrm{data}/\\mathrm{model}))}\n\n Paramet... |
83ec51142c5a1cb0a2c6c24e5a97b956f19b380dbfe933b54c0df5f46aa0a37b | @staticmethod
def _find_outlier(xdata, ratio, max_y):
'\n Small auxiliary method that finds the index where an array has\n its maximum, and the corresponding value in ``xdata``.\n\n Parameters\n ----------\n xdata : numpy.ndarray\n A list of independent variables\n\n ... | Small auxiliary method that finds the index where an array has
its maximum, and the corresponding value in ``xdata``.
Parameters
----------
xdata : numpy.ndarray
A list of independent variables
ratio : Numpy.ndarray
A list of dependent variables corresponding to ``xdata``
max_y : float
The maximum value ... | stingray/modeling/parameterestimation.py | _find_outlier | nimeshvashistha/stingray | 133 | python | @staticmethod
def _find_outlier(xdata, ratio, max_y):
'\n Small auxiliary method that finds the index where an array has\n its maximum, and the corresponding value in ``xdata``.\n\n Parameters\n ----------\n xdata : numpy.ndarray\n A list of independent variables\n\n ... | @staticmethod
def _find_outlier(xdata, ratio, max_y):
'\n Small auxiliary method that finds the index where an array has\n its maximum, and the corresponding value in ``xdata``.\n\n Parameters\n ----------\n xdata : numpy.ndarray\n A list of independent variables\n\n ... |
eb3ffc947aecf8cb6b71db818a4b0e7f55049c6ffc5385c4e95afe0b8dcce6fc | def plotfits(self, res1, res2=None, save_plot=False, namestr='test', log=False):
'\n Plotting method that allows to plot either one or two best-fit models\n with the data.\n\n Plots a power spectrum with the best-fit model, as well as the data/model\n residuals for each model.\n\n ... | Plotting method that allows to plot either one or two best-fit models
with the data.
Plots a power spectrum with the best-fit model, as well as the data/model
residuals for each model.
Parameters
----------
res1 : :class:`OptimizationResults` object
Output of a successful fitting procedure
res2 : :class:`Optimiz... | stingray/modeling/parameterestimation.py | plotfits | nimeshvashistha/stingray | 133 | python | def plotfits(self, res1, res2=None, save_plot=False, namestr='test', log=False):
'\n Plotting method that allows to plot either one or two best-fit models\n with the data.\n\n Plots a power spectrum with the best-fit model, as well as the data/model\n residuals for each model.\n\n ... | def plotfits(self, res1, res2=None, save_plot=False, namestr='test', log=False):
'\n Plotting method that allows to plot either one or two best-fit models\n with the data.\n\n Plots a power spectrum with the best-fit model, as well as the data/model\n residuals for each model.\n\n ... |
538d41151e7e3ba2606711975241ad9162c75ca573e054dee7e31c37bafffd88 | def _cosine_similarity(sentence_1, sentence_2):
'\n Calculates and returns cosine similarity using raw count tf-idf of two sentence objects\n '
numerator = 0
denominator_1 = 0
denominator_2 = 0
for i in sentence_1.tf_idf.keys():
numerator += (sentence_1.tf_idf.get(i) * sentence_2.tf_id... | Calculates and returns cosine similarity using raw count tf-idf of two sentence objects | src/content_selection.py | _cosine_similarity | aventon1/text-summarizer | 0 | python | def _cosine_similarity(sentence_1, sentence_2):
'\n \n '
numerator = 0
denominator_1 = 0
denominator_2 = 0
for i in sentence_1.tf_idf.keys():
numerator += (sentence_1.tf_idf.get(i) * sentence_2.tf_idf.get(i, 0.0))
denominator_1 += (sentence_1.tf_idf.get(i) ** 2)
for i in se... | def _cosine_similarity(sentence_1, sentence_2):
'\n \n '
numerator = 0
denominator_1 = 0
denominator_2 = 0
for i in sentence_1.tf_idf.keys():
numerator += (sentence_1.tf_idf.get(i) * sentence_2.tf_idf.get(i, 0.0))
denominator_1 += (sentence_1.tf_idf.get(i) ** 2)
for i in se... |
5d1460f6daed088b5c5a426ee4a902de8fb0eb3b469d16a03e48babdd6027ef2 | def _build_sim_matrix(sent_list, intersent_threshold, intersent_formula, mle_lambda, k, topic):
'\n Builds and returns a 2D numpy matrix of inter-sentential similarity.\n '
num_sent = len(sent_list)
sim_matrix = np.zeros((num_sent, num_sent))
for i in range(num_sent):
sim_vals = []
... | Builds and returns a 2D numpy matrix of inter-sentential similarity. | src/content_selection.py | _build_sim_matrix | aventon1/text-summarizer | 0 | python | def _build_sim_matrix(sent_list, intersent_threshold, intersent_formula, mle_lambda, k, topic):
'\n \n '
num_sent = len(sent_list)
sim_matrix = np.zeros((num_sent, num_sent))
for i in range(num_sent):
sim_vals = []
for j in range(i, num_sent):
if (intersent_formula == '... | def _build_sim_matrix(sent_list, intersent_threshold, intersent_formula, mle_lambda, k, topic):
'\n \n '
num_sent = len(sent_list)
sim_matrix = np.zeros((num_sent, num_sent))
for i in range(num_sent):
sim_vals = []
for j in range(i, num_sent):
if (intersent_formula == '... |
300c28843b14038664679bbb9378455b0a15a8a88af6ecdc813c9a14cf9818f0 | def _build_bias_vec(sent_list, topic_sent, include_narrative, bias_formula, mle_lambda, topic):
'\n Builds and returns a 1D numpy vector of the similarity between each sentence\n and the topic title. Additionally adds the similarity of the narrative if include_narrative.\n '
narrative = topic.narrative... | Builds and returns a 1D numpy vector of the similarity between each sentence
and the topic title. Additionally adds the similarity of the narrative if include_narrative. | src/content_selection.py | _build_bias_vec | aventon1/text-summarizer | 0 | python | def _build_bias_vec(sent_list, topic_sent, include_narrative, bias_formula, mle_lambda, topic):
'\n Builds and returns a 1D numpy vector of the similarity between each sentence\n and the topic title. Additionally adds the similarity of the narrative if include_narrative.\n '
narrative = topic.narrative... | def _build_bias_vec(sent_list, topic_sent, include_narrative, bias_formula, mle_lambda, topic):
'\n Builds and returns a 1D numpy vector of the similarity between each sentence\n and the topic title. Additionally adds the similarity of the narrative if include_narrative.\n '
narrative = topic.narrative... |
726fcaff19246c779050bf409be9cc4ed9adbdaf30032ec725f3f3ef4a34fde0 | def _calc_relevance(sent, topic_sent, topic):
'Calculates relevance for two sentences.'
rel_sum = 0
for i in topic_sent.raw_counts.keys():
rel_sum += ((math.log((sent.raw_counts.get(i, 0.0) + 1)) * math.log((topic_sent.raw_counts.get(i) + 1))) * topic.idf.get(i))
return rel_sum | Calculates relevance for two sentences. | src/content_selection.py | _calc_relevance | aventon1/text-summarizer | 0 | python | def _calc_relevance(sent, topic_sent, topic):
rel_sum = 0
for i in topic_sent.raw_counts.keys():
rel_sum += ((math.log((sent.raw_counts.get(i, 0.0) + 1)) * math.log((topic_sent.raw_counts.get(i) + 1))) * topic.idf.get(i))
return rel_sum | def _calc_relevance(sent, topic_sent, topic):
rel_sum = 0
for i in topic_sent.raw_counts.keys():
rel_sum += ((math.log((sent.raw_counts.get(i, 0.0) + 1)) * math.log((topic_sent.raw_counts.get(i) + 1))) * topic.idf.get(i))
return rel_sum<|docstring|>Calculates relevance for two sentences.<|endof... |
3ce365cd8adc5423e1f0b5c533bca8304150b7ae0216bf27a9e225611d93ae59 | def _calc_smoothed_mle(word, sent, mle_lambda, topic):
'\n Calculates the smoothed MLE (Maximum Likelihood Estimate) for a word\n in a sentence, smoothing with the tf values from the entire topic cluster.\n Returns the smoothed MLE value.\n '
return (((1 - mle_lambda) * sent.tf_norm_values.get(word,... | Calculates the smoothed MLE (Maximum Likelihood Estimate) for a word
in a sentence, smoothing with the tf values from the entire topic cluster.
Returns the smoothed MLE value. | src/content_selection.py | _calc_smoothed_mle | aventon1/text-summarizer | 0 | python | def _calc_smoothed_mle(word, sent, mle_lambda, topic):
'\n Calculates the smoothed MLE (Maximum Likelihood Estimate) for a word\n in a sentence, smoothing with the tf values from the entire topic cluster.\n Returns the smoothed MLE value.\n '
return (((1 - mle_lambda) * sent.tf_norm_values.get(word,... | def _calc_smoothed_mle(word, sent, mle_lambda, topic):
'\n Calculates the smoothed MLE (Maximum Likelihood Estimate) for a word\n in a sentence, smoothing with the tf values from the entire topic cluster.\n Returns the smoothed MLE value.\n '
return (((1 - mle_lambda) * sent.tf_norm_values.get(word,... |
213ab628b22277859c80a8044d95ac0e0f7a29ba26615492d1adc20a503148b0 | def _calc_gen_prob(sent_1, sent_2, mle_lambda, topic):
'\n Calculates and returns the generative probability of sent_1 given sent_2.\n '
gen_prod = 1
for word in sent_1.raw_counts:
gen_prod *= (_calc_smoothed_mle(word, sent_2, mle_lambda, topic) ** sent_1.raw_counts[word])
return gen_prod | Calculates and returns the generative probability of sent_1 given sent_2. | src/content_selection.py | _calc_gen_prob | aventon1/text-summarizer | 0 | python | def _calc_gen_prob(sent_1, sent_2, mle_lambda, topic):
'\n \n '
gen_prod = 1
for word in sent_1.raw_counts:
gen_prod *= (_calc_smoothed_mle(word, sent_2, mle_lambda, topic) ** sent_1.raw_counts[word])
return gen_prod | def _calc_gen_prob(sent_1, sent_2, mle_lambda, topic):
'\n \n '
gen_prod = 1
for word in sent_1.raw_counts:
gen_prod *= (_calc_smoothed_mle(word, sent_2, mle_lambda, topic) ** sent_1.raw_counts[word])
return gen_prod<|docstring|>Calculates and returns the generative probability of sent_1 g... |
6f461c779df92fcbb14da4aa0cbb67eb072cebd2812e6ee17346d0d16cbaa788 | def _calc_norm_gen_prob(sent_1, sent_2, mle_lambda, topic):
'\n Calculates and returns the length-normalized generative probability of sent_1 given sent_2.\n '
sent_1_len = sum([count for count in sent_1.raw_counts.values()])
return (_calc_gen_prob(sent_1, sent_2, mle_lambda, topic) ** (1.0 / sent_1_l... | Calculates and returns the length-normalized generative probability of sent_1 given sent_2. | src/content_selection.py | _calc_norm_gen_prob | aventon1/text-summarizer | 0 | python | def _calc_norm_gen_prob(sent_1, sent_2, mle_lambda, topic):
'\n \n '
sent_1_len = sum([count for count in sent_1.raw_counts.values()])
return (_calc_gen_prob(sent_1, sent_2, mle_lambda, topic) ** (1.0 / sent_1_len)) | def _calc_norm_gen_prob(sent_1, sent_2, mle_lambda, topic):
'\n \n '
sent_1_len = sum([count for count in sent_1.raw_counts.values()])
return (_calc_gen_prob(sent_1, sent_2, mle_lambda, topic) ** (1.0 / sent_1_len))<|docstring|>Calculates and returns the length-normalized generative probability of sen... |
8d5963394c300f8a235cdc853a01aa8ee234f0321101b7d0a448dfe4ac9cce47 | def _build_markov_matrix(sim_matrix, bias_vec, d):
'\n Builds and returns the markov matrix (matrix to multiply by in the power method)\n using the Biased LexRank formula with cosine similarity.\n '
markov_matrix = ((d * bias_vec) + ((1 - d) * sim_matrix))
return markov_matrix | Builds and returns the markov matrix (matrix to multiply by in the power method)
using the Biased LexRank formula with cosine similarity. | src/content_selection.py | _build_markov_matrix | aventon1/text-summarizer | 0 | python | def _build_markov_matrix(sim_matrix, bias_vec, d):
'\n Builds and returns the markov matrix (matrix to multiply by in the power method)\n using the Biased LexRank formula with cosine similarity.\n '
markov_matrix = ((d * bias_vec) + ((1 - d) * sim_matrix))
return markov_matrix | def _build_markov_matrix(sim_matrix, bias_vec, d):
'\n Builds and returns the markov matrix (matrix to multiply by in the power method)\n using the Biased LexRank formula with cosine similarity.\n '
markov_matrix = ((d * bias_vec) + ((1 - d) * sim_matrix))
return markov_matrix<|docstring|>Builds an... |
91dfaaf7aaf45cbe9bad2f859bd1f444a8a9a381dc7e96c5bc81defd74c6be7c | def _power_method(markov_matrix, epsilon):
'\n Uses the power method to find the LexRank values of each sentence\n and returns a 1D vector of the final LexRank values after convergence.\n '
num_sent = len(markov_matrix)
transition_matrix = markov_matrix.T
prob_vec = (np.ones(num_sent) / num_sen... | Uses the power method to find the LexRank values of each sentence
and returns a 1D vector of the final LexRank values after convergence. | src/content_selection.py | _power_method | aventon1/text-summarizer | 0 | python | def _power_method(markov_matrix, epsilon):
'\n Uses the power method to find the LexRank values of each sentence\n and returns a 1D vector of the final LexRank values after convergence.\n '
num_sent = len(markov_matrix)
transition_matrix = markov_matrix.T
prob_vec = (np.ones(num_sent) / num_sen... | def _power_method(markov_matrix, epsilon):
'\n Uses the power method to find the LexRank values of each sentence\n and returns a 1D vector of the final LexRank values after convergence.\n '
num_sent = len(markov_matrix)
transition_matrix = markov_matrix.T
prob_vec = (np.ones(num_sent) / num_sen... |
a80375e348afb5e65ce3484c79d88b982b1a42ca6eeb93c71496c741f6516eaf | def _select_sentences(sorted_sentences, summary_threshold):
' \n Takes a list of sentences sorted by LexRank value (descending)\n and selects the sentences to add to the summary greedily based on LexRank value\n while excluding sentences with cosine similarity >= summary_threshold (default = 0.5)\n to a... | Takes a list of sentences sorted by LexRank value (descending)
and selects the sentences to add to the summary greedily based on LexRank value
while excluding sentences with cosine similarity >= summary_threshold (default = 0.5)
to any sentence already in the summary.
Returns a list of selected sentences. | src/content_selection.py | _select_sentences | aventon1/text-summarizer | 0 | python | def _select_sentences(sorted_sentences, summary_threshold):
' \n Takes a list of sentences sorted by LexRank value (descending)\n and selects the sentences to add to the summary greedily based on LexRank value\n while excluding sentences with cosine similarity >= summary_threshold (default = 0.5)\n to a... | def _select_sentences(sorted_sentences, summary_threshold):
' \n Takes a list of sentences sorted by LexRank value (descending)\n and selects the sentences to add to the summary greedily based on LexRank value\n while excluding sentences with cosine similarity >= summary_threshold (default = 0.5)\n to a... |
cb778c36d162df755a08e90987107e06cb4e0d197948df7ca6fa9421bf19834f | def select_content(topics_list, d=0.7, intersent_threshold=0.0, summary_threshold=0.5, epsilon=0.1, mle_lambda=0.6, k=20, min_sent_len=5, include_narrative=False, bias_formula='cos', intersent_formula='cos'):
'\n For each topic, creates summaries of <= 100 words (full sentences only) \n using a Biased LexRank... | For each topic, creates summaries of <= 100 words (full sentences only)
using a Biased LexRank similarity graph algorithm
with tf-idf cosine similarity and a bias for query topic.
Args:
topic_list: a list of Topic objects (which include Documents and Sentences)
d: damping factor, amount to prioritize topic bi... | src/content_selection.py | select_content | aventon1/text-summarizer | 0 | python | def select_content(topics_list, d=0.7, intersent_threshold=0.0, summary_threshold=0.5, epsilon=0.1, mle_lambda=0.6, k=20, min_sent_len=5, include_narrative=False, bias_formula='cos', intersent_formula='cos'):
'\n For each topic, creates summaries of <= 100 words (full sentences only) \n using a Biased LexRank... | def select_content(topics_list, d=0.7, intersent_threshold=0.0, summary_threshold=0.5, epsilon=0.1, mle_lambda=0.6, k=20, min_sent_len=5, include_narrative=False, bias_formula='cos', intersent_formula='cos'):
'\n For each topic, creates summaries of <= 100 words (full sentences only) \n using a Biased LexRank... |
1e0966f935ded95592f0d0d13deb349fcd0e5e0dd317eb6c93c69a308b936529 | def deprecated(func):
'This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted\n when the function is used.'
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning)
warnings.wa... | This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used. | valorant/utils/helper.py | deprecated | vnpnh/Pyvalo | 0 | python | def deprecated(func):
'This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted\n when the function is used.'
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning)
warnings.wa... | def deprecated(func):
'This is a decorator which can be used to mark functions\n as deprecated. It will result in a warning being emitted\n when the function is used.'
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter('always', DeprecationWarning)
warnings.wa... |
8552c9d0b1f65cb24eeedf59925dc56354a28c678c5428fdaa9fcdaf8f0ae034 | @responses.activate
def test_1000(self, gmn_client_v1_v2):
'MNCore.getCapabilities(): Returns a valid Node Registry document.'
with d1_gmn.tests.gmn_mock.disable_auth():
node = gmn_client_v1_v2.getCapabilities()
assert isinstance(node, gmn_client_v1_v2.pyxb_binding.Node) | MNCore.getCapabilities(): Returns a valid Node Registry document. | gmn/src/d1_gmn/tests/test_get_capabilities.py | test_1000 | DataONEorg/d1_python | 15 | python | @responses.activate
def test_1000(self, gmn_client_v1_v2):
with d1_gmn.tests.gmn_mock.disable_auth():
node = gmn_client_v1_v2.getCapabilities()
assert isinstance(node, gmn_client_v1_v2.pyxb_binding.Node) | @responses.activate
def test_1000(self, gmn_client_v1_v2):
with d1_gmn.tests.gmn_mock.disable_auth():
node = gmn_client_v1_v2.getCapabilities()
assert isinstance(node, gmn_client_v1_v2.pyxb_binding.Node)<|docstring|>MNCore.getCapabilities(): Returns a valid Node Registry document.<|endoftext|> |
7f589a8e9487eae09b7f02a1b7031d86f1296d3057b8114cdeb889e83e52b5cd | def get_dataset(identifier):
'Returns the correct CrepeDataset based on Id in `{ag,amazon,dbpedia,sogou,yahoo,yelp,yelp-polarity}`'
if (identifier == 'ag'):
dataset = AgNews
elif (identifier == 'amazon-polarity'):
dataset = AmazonReviewPolarity
elif (identifier == 'amazon'):
data... | Returns the correct CrepeDataset based on Id in `{ag,amazon,dbpedia,sogou,yahoo,yelp,yelp-polarity}` | evaluate/load/dataset.py | get_dataset | YannDubs/Hash-Embeddings | 159 | python | def get_dataset(identifier):
if (identifier == 'ag'):
dataset = AgNews
elif (identifier == 'amazon-polarity'):
dataset = AmazonReviewPolarity
elif (identifier == 'amazon'):
dataset = AmazonReview
elif (identifier == 'dbpedia'):
dataset = DbPedia
elif (identifier ... | def get_dataset(identifier):
if (identifier == 'ag'):
dataset = AgNews
elif (identifier == 'amazon-polarity'):
dataset = AmazonReviewPolarity
elif (identifier == 'amazon'):
dataset = AmazonReview
elif (identifier == 'dbpedia'):
dataset = DbPedia
elif (identifier ... |
28545d89b7c0ccd19730b1e2c3bc6b7affee242b20ade6e44122f2ff206ff319 | def get_path(identifier):
'Returns the correct root directory to dataset based on Id in `{ag,amazon,dbpedia,sogou,yahoo,yelp,yelp-polarity}`'
if (identifier == 'ag'):
path = '../../data/ag_news_csv'
elif (identifier == 'amazon-polarity'):
path = '../../data/amazon_review_polarity_csv'
el... | Returns the correct root directory to dataset based on Id in `{ag,amazon,dbpedia,sogou,yahoo,yelp,yelp-polarity}` | evaluate/load/dataset.py | get_path | YannDubs/Hash-Embeddings | 159 | python | def get_path(identifier):
if (identifier == 'ag'):
path = '../../data/ag_news_csv'
elif (identifier == 'amazon-polarity'):
path = '../../data/amazon_review_polarity_csv'
elif (identifier == 'amazon'):
path = '../../data/amazon_review_full_csv'
elif (identifier == 'dbpedia'):... | def get_path(identifier):
if (identifier == 'ag'):
path = '../../data/ag_news_csv'
elif (identifier == 'amazon-polarity'):
path = '../../data/amazon_review_polarity_csv'
elif (identifier == 'amazon'):
path = '../../data/amazon_review_full_csv'
elif (identifier == 'dbpedia'):... |
59d0ffbf432b12b6aff0426ae575bcddee3276ede9a6c0992664f8b8e4127c4a | def get_skin(self, request=None):
'Get skin matching this content' | Get skin matching this content | src/pyams_layer/interfaces.py | get_skin | Py-AMS/pyams-layer | 0 | python | def get_skin(self, request=None):
| def get_skin(self, request=None):
<|docstring|>Get skin matching this content<|endoftext|> |
190d9d3641cfaa44cfa4ba5ce3e70f73c7cdcb54035776d6dc22704623b2dc4a | @pytest.mark.parametrize('numpy_dtype', [np.int8, np.uint8, np.int16, np.uint16, np.int32, np.uint32, np.int64])
def test_torch_tensorable_types(numpy_dtype):
"Make sure that we 'sanitize' only integer types that can not be made into torch tensors natively"
value = np.zeros((2, 2), dtype=numpy_dtype)
dict_t... | Make sure that we 'sanitize' only integer types that can not be made into torch tensors natively | petastorm/tests/test_pytorch_dataloader.py | test_torch_tensorable_types | dongpohezui/petastorm | 0 | python | @pytest.mark.parametrize('numpy_dtype', [np.int8, np.uint8, np.int16, np.uint16, np.int32, np.uint32, np.int64])
def test_torch_tensorable_types(numpy_dtype):
value = np.zeros((2, 2), dtype=numpy_dtype)
dict_to_sanitize = {'value': value}
_sanitize_pytorch_types(dict_to_sanitize)
torchable = False
... | @pytest.mark.parametrize('numpy_dtype', [np.int8, np.uint8, np.int16, np.uint16, np.int32, np.uint32, np.int64])
def test_torch_tensorable_types(numpy_dtype):
value = np.zeros((2, 2), dtype=numpy_dtype)
dict_to_sanitize = {'value': value}
_sanitize_pytorch_types(dict_to_sanitize)
torchable = False
... |
4e7aecb36a9df3e69a27231b1d72358ba7cc431ab23442e15428f6b48f8b14a4 | @pytest.mark.parametrize('shuffling_queue_capacity', [0, 3, 11, 1000])
@pytest.mark.parametrize('data_loader_type', ALL_DATA_LOADERS)
def test_with_batch_reader(scalar_dataset, shuffling_queue_capacity, data_loader_type):
'See if we are getting correct batch sizes when using DataLoader with make_batch_reader'
p... | See if we are getting correct batch sizes when using DataLoader with make_batch_reader | petastorm/tests/test_pytorch_dataloader.py | test_with_batch_reader | dongpohezui/petastorm | 0 | python | @pytest.mark.parametrize('shuffling_queue_capacity', [0, 3, 11, 1000])
@pytest.mark.parametrize('data_loader_type', ALL_DATA_LOADERS)
def test_with_batch_reader(scalar_dataset, shuffling_queue_capacity, data_loader_type):
pytorch_compatible_fields = [k for (k, v) in scalar_dataset.data[0].items() if (not isins... | @pytest.mark.parametrize('shuffling_queue_capacity', [0, 3, 11, 1000])
@pytest.mark.parametrize('data_loader_type', ALL_DATA_LOADERS)
def test_with_batch_reader(scalar_dataset, shuffling_queue_capacity, data_loader_type):
pytorch_compatible_fields = [k for (k, v) in scalar_dataset.data[0].items() if (not isins... |
db9eaf20cc4e18550506bdd3da2e0099b1d1eae7eb10da1b40363299e7b010b1 | def validate(self, data):
'validate data before we save '
confirmed_password = data.get('confirmed_password')
try:
validate_password(data['password'])
except ValidationError as e:
raise serializers.ValidationError({'password': str(e).replace('[, ).replace(]', '')})
if (not self.do_pa... | validate data before we save | authentication/serializers.py | validate | kelvinndmo/scholarship_system | 0 | python | def validate(self, data):
' '
confirmed_password = data.get('confirmed_password')
try:
validate_password(data['password'])
except ValidationError as e:
raise serializers.ValidationError({'password': str(e).replace('[, ).replace(]', )})
if (not self.do_passwords_match(data['password']... | def validate(self, data):
' '
confirmed_password = data.get('confirmed_password')
try:
validate_password(data['password'])
except ValidationError as e:
raise serializers.ValidationError({'password': str(e).replace('[, ).replace(]', )})
if (not self.do_passwords_match(data['password']... |
6cc80fc473ed497c4f81c8412ddc4fb9c36e71b88523a1d3977752d6af7faf8f | def create(self, validated_data):
'Create a user.'
del validated_data['confirmed_password']
return User.objects.create_user(**validated_data) | Create a user. | authentication/serializers.py | create | kelvinndmo/scholarship_system | 0 | python | def create(self, validated_data):
del validated_data['confirmed_password']
return User.objects.create_user(**validated_data) | def create(self, validated_data):
del validated_data['confirmed_password']
return User.objects.create_user(**validated_data)<|docstring|>Create a user.<|endoftext|> |
91e4dfa418d86950e4f252bd6820f22b07ddaf8fb5a27b044c7fe618b480e092 | def do_passwords_match(self, password1, password2):
'Check if passwords match.'
return (password1 == password2) | Check if passwords match. | authentication/serializers.py | do_passwords_match | kelvinndmo/scholarship_system | 0 | python | def do_passwords_match(self, password1, password2):
return (password1 == password2) | def do_passwords_match(self, password1, password2):
return (password1 == password2)<|docstring|>Check if passwords match.<|endoftext|> |
676a33cfadfbdc179635c6432b0978d9b2821b4e9d6bdf0761b2cb90f59ff01d | def main():
'Reads in raw log files/pcap and writes entries to an sqlite database'
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--endpoint', dest='host', type=str, required=False, help='endpoint, aka host ("client", "server", etc.)')
parser.add_argument('-c', '--cpu-file', dest='cpu_fil... | Reads in raw log files/pcap and writes entries to an sqlite database | spar_python/perf_monitoring/perf_logs_to_db.py | main | nathanawmk/SPARTA | 37 | python | def main():
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--endpoint', dest='host', type=str, required=False, help='endpoint, aka host ("client", "server", etc.)')
parser.add_argument('-c', '--cpu-file', dest='cpu_file', type=str, required=False, default=None, help='(uncompressed) cpu l... | def main():
parser = argparse.ArgumentParser()
parser.add_argument('-e', '--endpoint', dest='host', type=str, required=False, help='endpoint, aka host ("client", "server", etc.)')
parser.add_argument('-c', '--cpu-file', dest='cpu_file', type=str, required=False, default=None, help='(uncompressed) cpu l... |
bf4981d8e131d914796245212a2de77c81c4e5821875e3b2b17f67e8b18fe1d5 | def on(self):
'\n Turns the device on.\n '
self._write(True) | Turns the device on. | gpiozero/output_devices.py | on | lurch/python-gpiozero | 0 | python | def on(self):
'\n \n '
self._write(True) | def on(self):
'\n \n '
self._write(True)<|docstring|>Turns the device on.<|endoftext|> |
e4b761944f334631b322a25ec017e7c0e4ce3626a022ed6703e6e027e43efbf3 | def off(self):
'\n Turns the device off.\n '
self._write(False) | Turns the device off. | gpiozero/output_devices.py | off | lurch/python-gpiozero | 0 | python | def off(self):
'\n \n '
self._write(False) | def off(self):
'\n \n '
self._write(False)<|docstring|>Turns the device off.<|endoftext|> |
9bea51fee3d5e19ab8069a9c87f54d9b719cfe411e07ea3becf42624221528fa | def toggle(self):
"\n Reverse the state of the device. If it's on, turn it off; if it's off,\n turn it on.\n "
with self._lock:
if self.is_active:
self.off()
else:
self.on() | Reverse the state of the device. If it's on, turn it off; if it's off,
turn it on. | gpiozero/output_devices.py | toggle | lurch/python-gpiozero | 0 | python | def toggle(self):
"\n Reverse the state of the device. If it's on, turn it off; if it's off,\n turn it on.\n "
with self._lock:
if self.is_active:
self.off()
else:
self.on() | def toggle(self):
"\n Reverse the state of the device. If it's on, turn it off; if it's off,\n turn it on.\n "
with self._lock:
if self.is_active:
self.off()
else:
self.on()<|docstring|>Reverse the state of the device. If it's on, turn it off; if it's... |
9afa24e9c959fef1db0e5e3ddc79897fac6294398ef2a3e413bf507e753dc1f5 | @property
def value(self):
'\n Returns ``True`` if the device is currently active and ``False``\n otherwise. Setting this property changes the state of the device.\n '
return super(OutputDevice, self).value | Returns ``True`` if the device is currently active and ``False``
otherwise. Setting this property changes the state of the device. | gpiozero/output_devices.py | value | lurch/python-gpiozero | 0 | python | @property
def value(self):
'\n Returns ``True`` if the device is currently active and ``False``\n otherwise. Setting this property changes the state of the device.\n '
return super(OutputDevice, self).value | @property
def value(self):
'\n Returns ``True`` if the device is currently active and ``False``\n otherwise. Setting this property changes the state of the device.\n '
return super(OutputDevice, self).value<|docstring|>Returns ``True`` if the device is currently active and ``False``
otherwi... |
4a2f1c0a9f6c47f1b4cae396b4d73204ad2b1854f517aa15d170c84996961a16 | @property
def active_high(self):
"\n When ``True``, the :attr:`value` property is ``True`` when the device's\n :attr:`pin` is high. When ``False`` the :attr:`value` property is\n ``True`` when the device's pin is low (i.e. the value is inverted).\n\n This property can be set after constr... | When ``True``, the :attr:`value` property is ``True`` when the device's
:attr:`pin` is high. When ``False`` the :attr:`value` property is
``True`` when the device's pin is low (i.e. the value is inverted).
This property can be set after construction; be warned that changing it
will invert :attr:`value` (i.e. changing ... | gpiozero/output_devices.py | active_high | lurch/python-gpiozero | 0 | python | @property
def active_high(self):
"\n When ``True``, the :attr:`value` property is ``True`` when the device's\n :attr:`pin` is high. When ``False`` the :attr:`value` property is\n ``True`` when the device's pin is low (i.e. the value is inverted).\n\n This property can be set after constr... | @property
def active_high(self):
"\n When ``True``, the :attr:`value` property is ``True`` when the device's\n :attr:`pin` is high. When ``False`` the :attr:`value` property is\n ``True`` when the device's pin is low (i.e. the value is inverted).\n\n This property can be set after constr... |
f7e6118514b711ae28fc2d2206dbd32164251ed49f7b1f5f3e2b367132c2b601 | def blink(self, on_time=1, off_time=1, n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time:\n Number of seconds off. Defaults to 1 second.\n\n :pa... | Make the device turn on and off repeatedly.
:param float on_time:
Number of seconds on. Defaults to 1 second.
:param float off_time:
Number of seconds off. Defaults to 1 second.
:param int n:
Number of times to blink; ``None`` (the default) means forever.
:param bool background:
If ``True`` (the def... | gpiozero/output_devices.py | blink | lurch/python-gpiozero | 0 | python | def blink(self, on_time=1, off_time=1, n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time:\n Number of seconds off. Defaults to 1 second.\n\n :pa... | def blink(self, on_time=1, off_time=1, n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time:\n Number of seconds off. Defaults to 1 second.\n\n :pa... |
9e313deae59eb8d3be9625a17e4ebab539a4402fbed737ba1ebad953bbf48a7a | @property
def value(self):
'\n The duty cycle of the PWM device. 0.0 is off, 1.0 is fully on. Values\n in between may be specified for varying levels of power in the device.\n '
return self._read() | The duty cycle of the PWM device. 0.0 is off, 1.0 is fully on. Values
in between may be specified for varying levels of power in the device. | gpiozero/output_devices.py | value | lurch/python-gpiozero | 0 | python | @property
def value(self):
'\n The duty cycle of the PWM device. 0.0 is off, 1.0 is fully on. Values\n in between may be specified for varying levels of power in the device.\n '
return self._read() | @property
def value(self):
'\n The duty cycle of the PWM device. 0.0 is off, 1.0 is fully on. Values\n in between may be specified for varying levels of power in the device.\n '
return self._read()<|docstring|>The duty cycle of the PWM device. 0.0 is off, 1.0 is fully on. Values
in between ... |
0213df2fb3ae0466bb4bfa469a2c9de398929661bc259ccc179e1061ebc843de | def toggle(self):
'\n Toggle the state of the device. If the device is currently off\n (:attr:`value` is 0.0), this changes it to "fully" on (:attr:`value` is\n 1.0). If the device has a duty cycle (:attr:`value`) of 0.1, this will\n toggle it to 0.9, and so on.\n '
self._sto... | Toggle the state of the device. If the device is currently off
(:attr:`value` is 0.0), this changes it to "fully" on (:attr:`value` is
1.0). If the device has a duty cycle (:attr:`value`) of 0.1, this will
toggle it to 0.9, and so on. | gpiozero/output_devices.py | toggle | lurch/python-gpiozero | 0 | python | def toggle(self):
'\n Toggle the state of the device. If the device is currently off\n (:attr:`value` is 0.0), this changes it to "fully" on (:attr:`value` is\n 1.0). If the device has a duty cycle (:attr:`value`) of 0.1, this will\n toggle it to 0.9, and so on.\n '
self._sto... | def toggle(self):
'\n Toggle the state of the device. If the device is currently off\n (:attr:`value` is 0.0), this changes it to "fully" on (:attr:`value` is\n 1.0). If the device has a duty cycle (:attr:`value`) of 0.1, this will\n toggle it to 0.9, and so on.\n '
self._sto... |
75bee28abce166cc7fe1be0cb6538da52876946303b72b518afdc4be1300ce07 | @property
def is_active(self):
'\n Returns ``True`` if the device is currently active (:attr:`value` is\n non-zero) and ``False`` otherwise.\n '
return (self.value != 0) | Returns ``True`` if the device is currently active (:attr:`value` is
non-zero) and ``False`` otherwise. | gpiozero/output_devices.py | is_active | lurch/python-gpiozero | 0 | python | @property
def is_active(self):
'\n Returns ``True`` if the device is currently active (:attr:`value` is\n non-zero) and ``False`` otherwise.\n '
return (self.value != 0) | @property
def is_active(self):
'\n Returns ``True`` if the device is currently active (:attr:`value` is\n non-zero) and ``False`` otherwise.\n '
return (self.value != 0)<|docstring|>Returns ``True`` if the device is currently active (:attr:`value` is
non-zero) and ``False`` otherwise.<|endo... |
0c040a050b5d90233877468dd078cd893a08953b3414185a391f29c27aa166e1 | @property
def frequency(self):
'\n The frequency of the pulses used with the PWM device, in Hz. The\n default is 100Hz.\n '
return self.pin.frequency | The frequency of the pulses used with the PWM device, in Hz. The
default is 100Hz. | gpiozero/output_devices.py | frequency | lurch/python-gpiozero | 0 | python | @property
def frequency(self):
'\n The frequency of the pulses used with the PWM device, in Hz. The\n default is 100Hz.\n '
return self.pin.frequency | @property
def frequency(self):
'\n The frequency of the pulses used with the PWM device, in Hz. The\n default is 100Hz.\n '
return self.pin.frequency<|docstring|>The frequency of the pulses used with the PWM device, in Hz. The
default is 100Hz.<|endoftext|> |
96d7c5134b6bf485ec2bdc61f47ae3c2dfe749a6af4514a2a1308c2bb02f1146 | def blink(self, on_time=1, off_time=1, fade_in_time=0, fade_out_time=0, n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time:\n Number of seconds off. Def... | Make the device turn on and off repeatedly.
:param float on_time:
Number of seconds on. Defaults to 1 second.
:param float off_time:
Number of seconds off. Defaults to 1 second.
:param float fade_in_time:
Number of seconds to spend fading in. Defaults to 0.
:param float fade_out_time:
Number of seco... | gpiozero/output_devices.py | blink | lurch/python-gpiozero | 0 | python | def blink(self, on_time=1, off_time=1, fade_in_time=0, fade_out_time=0, n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time:\n Number of seconds off. Def... | def blink(self, on_time=1, off_time=1, fade_in_time=0, fade_out_time=0, n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time:\n Number of seconds off. Def... |
cdd1186bcf75b03c499ccde542e196cb3e01ac46d07de638a295b9aab485d5dc | def pulse(self, fade_in_time=1, fade_out_time=1, n=None, background=True):
'\n Make the device fade in and out repeatedly.\n\n :param float fade_in_time:\n Number of seconds to spend fading in. Defaults to 1.\n\n :param float fade_out_time:\n Number of seconds to spend fad... | Make the device fade in and out repeatedly.
:param float fade_in_time:
Number of seconds to spend fading in. Defaults to 1.
:param float fade_out_time:
Number of seconds to spend fading out. Defaults to 1.
:param int n:
Number of times to pulse; ``None`` (the default) means forever.
:param bool backgrou... | gpiozero/output_devices.py | pulse | lurch/python-gpiozero | 0 | python | def pulse(self, fade_in_time=1, fade_out_time=1, n=None, background=True):
'\n Make the device fade in and out repeatedly.\n\n :param float fade_in_time:\n Number of seconds to spend fading in. Defaults to 1.\n\n :param float fade_out_time:\n Number of seconds to spend fad... | def pulse(self, fade_in_time=1, fade_out_time=1, n=None, background=True):
'\n Make the device fade in and out repeatedly.\n\n :param float fade_in_time:\n Number of seconds to spend fading in. Defaults to 1.\n\n :param float fade_out_time:\n Number of seconds to spend fad... |
8a233cd1fa58d83b282e33776c734ef5d6d44d844fd6289a066cffdd7d2bb7bb | @property
def value(self):
'\n Represents the color of the LED as an RGB 3-tuple of ``(red, green,\n blue)`` where each value is between 0 and 1 if ``pwm`` was ``True``\n when the class was constructed (and only 0 or 1 if not).\n\n For example, purple would be ``(1, 0, 1)`` and yellow wo... | Represents the color of the LED as an RGB 3-tuple of ``(red, green,
blue)`` where each value is between 0 and 1 if ``pwm`` was ``True``
when the class was constructed (and only 0 or 1 if not).
For example, purple would be ``(1, 0, 1)`` and yellow would be ``(1, 1,
0)``, while orange would be ``(1, 0.5, 0)``. | gpiozero/output_devices.py | value | lurch/python-gpiozero | 0 | python | @property
def value(self):
'\n Represents the color of the LED as an RGB 3-tuple of ``(red, green,\n blue)`` where each value is between 0 and 1 if ``pwm`` was ``True``\n when the class was constructed (and only 0 or 1 if not).\n\n For example, purple would be ``(1, 0, 1)`` and yellow wo... | @property
def value(self):
'\n Represents the color of the LED as an RGB 3-tuple of ``(red, green,\n blue)`` where each value is between 0 and 1 if ``pwm`` was ``True``\n when the class was constructed (and only 0 or 1 if not).\n\n For example, purple would be ``(1, 0, 1)`` and yellow wo... |
16b607cc81b48b65315aab218ea506402c95c039692689a64f1c5c016bcf5c38 | @property
def is_active(self):
'\n Returns ``True`` if the LED is currently active (not black) and\n ``False`` otherwise.\n '
return (self.value != (0, 0, 0)) | Returns ``True`` if the LED is currently active (not black) and
``False`` otherwise. | gpiozero/output_devices.py | is_active | lurch/python-gpiozero | 0 | python | @property
def is_active(self):
'\n Returns ``True`` if the LED is currently active (not black) and\n ``False`` otherwise.\n '
return (self.value != (0, 0, 0)) | @property
def is_active(self):
'\n Returns ``True`` if the LED is currently active (not black) and\n ``False`` otherwise.\n '
return (self.value != (0, 0, 0))<|docstring|>Returns ``True`` if the LED is currently active (not black) and
``False`` otherwise.<|endoftext|> |
8fea2b74b05ae68b379f2dfa3a4d73f2ef48657516834ac0a1c7bf1bf1928ab0 | def on(self):
'\n Turn the LED on. This equivalent to setting the LED color to white\n ``(1, 1, 1)``.\n '
self.value = (1, 1, 1) | Turn the LED on. This equivalent to setting the LED color to white
``(1, 1, 1)``. | gpiozero/output_devices.py | on | lurch/python-gpiozero | 0 | python | def on(self):
'\n Turn the LED on. This equivalent to setting the LED color to white\n ``(1, 1, 1)``.\n '
self.value = (1, 1, 1) | def on(self):
'\n Turn the LED on. This equivalent to setting the LED color to white\n ``(1, 1, 1)``.\n '
self.value = (1, 1, 1)<|docstring|>Turn the LED on. This equivalent to setting the LED color to white
``(1, 1, 1)``.<|endoftext|> |
5e0ba0b608f06959baf11927f7877da59c859ae1d40d6c8c0f22c511a1cbf354 | def off(self):
'\n Turn the LED off. This is equivalent to setting the LED color to black\n ``(0, 0, 0)``.\n '
self.value = (0, 0, 0) | Turn the LED off. This is equivalent to setting the LED color to black
``(0, 0, 0)``. | gpiozero/output_devices.py | off | lurch/python-gpiozero | 0 | python | def off(self):
'\n Turn the LED off. This is equivalent to setting the LED color to black\n ``(0, 0, 0)``.\n '
self.value = (0, 0, 0) | def off(self):
'\n Turn the LED off. This is equivalent to setting the LED color to black\n ``(0, 0, 0)``.\n '
self.value = (0, 0, 0)<|docstring|>Turn the LED off. This is equivalent to setting the LED color to black
``(0, 0, 0)``.<|endoftext|> |
923566da9952616fc66bb8fbc7262f7a49cfe1317bc63a2e4d3cbb4a554c5cd3 | def toggle(self):
'\n Toggle the state of the device. If the device is currently off\n (:attr:`value` is ``(0, 0, 0)``), this changes it to "fully" on\n (:attr:`value` is ``(1, 1, 1)``). If the device has a specific color,\n this method inverts the color.\n '
(r, g, b) = self... | Toggle the state of the device. If the device is currently off
(:attr:`value` is ``(0, 0, 0)``), this changes it to "fully" on
(:attr:`value` is ``(1, 1, 1)``). If the device has a specific color,
this method inverts the color. | gpiozero/output_devices.py | toggle | lurch/python-gpiozero | 0 | python | def toggle(self):
'\n Toggle the state of the device. If the device is currently off\n (:attr:`value` is ``(0, 0, 0)``), this changes it to "fully" on\n (:attr:`value` is ``(1, 1, 1)``). If the device has a specific color,\n this method inverts the color.\n '
(r, g, b) = self... | def toggle(self):
'\n Toggle the state of the device. If the device is currently off\n (:attr:`value` is ``(0, 0, 0)``), this changes it to "fully" on\n (:attr:`value` is ``(1, 1, 1)``). If the device has a specific color,\n this method inverts the color.\n '
(r, g, b) = self... |
ca25742d1cc67cc3042b3ac92f721a4b05d06caa6f080ebb78bafb1ba4e1d78d | def blink(self, on_time=1, off_time=1, fade_in_time=0, fade_out_time=0, on_color=(1, 1, 1), off_color=(0, 0, 0), n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time... | Make the device turn on and off repeatedly.
:param float on_time:
Number of seconds on. Defaults to 1 second.
:param float off_time:
Number of seconds off. Defaults to 1 second.
:param float fade_in_time:
Number of seconds to spend fading in. Defaults to 0. Must be 0 if
``pwm`` was ``False`` when the... | gpiozero/output_devices.py | blink | lurch/python-gpiozero | 0 | python | def blink(self, on_time=1, off_time=1, fade_in_time=0, fade_out_time=0, on_color=(1, 1, 1), off_color=(0, 0, 0), n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time... | def blink(self, on_time=1, off_time=1, fade_in_time=0, fade_out_time=0, on_color=(1, 1, 1), off_color=(0, 0, 0), n=None, background=True):
'\n Make the device turn on and off repeatedly.\n\n :param float on_time:\n Number of seconds on. Defaults to 1 second.\n\n :param float off_time... |
db93cced240802ef8b77fdcd0fe6a4392aa787ac711161a838d0172240d777c3 | def pulse(self, fade_in_time=1, fade_out_time=1, on_color=(1, 1, 1), off_color=(0, 0, 0), n=None, background=True):
'\n Make the device fade in and out repeatedly.\n\n :param float fade_in_time:\n Number of seconds to spend fading in. Defaults to 1.\n\n :param float fade_out_time:\n ... | Make the device fade in and out repeatedly.
:param float fade_in_time:
Number of seconds to spend fading in. Defaults to 1.
:param float fade_out_time:
Number of seconds to spend fading out. Defaults to 1.
:param tuple on_color:
The color to use when the LED is "on". Defaults to white.
:param tuple off_... | gpiozero/output_devices.py | pulse | lurch/python-gpiozero | 0 | python | def pulse(self, fade_in_time=1, fade_out_time=1, on_color=(1, 1, 1), off_color=(0, 0, 0), n=None, background=True):
'\n Make the device fade in and out repeatedly.\n\n :param float fade_in_time:\n Number of seconds to spend fading in. Defaults to 1.\n\n :param float fade_out_time:\n ... | def pulse(self, fade_in_time=1, fade_out_time=1, on_color=(1, 1, 1), off_color=(0, 0, 0), n=None, background=True):
'\n Make the device fade in and out repeatedly.\n\n :param float fade_in_time:\n Number of seconds to spend fading in. Defaults to 1.\n\n :param float fade_out_time:\n ... |
4c5a2b604c96344f7690346cdf699b51a8b2ca144be24dc616e0ac1b810c6431 | @property
def value(self):
'\n Represents the speed of the motor as a floating point value between -1\n (full speed backward) and 1 (full speed forward), with 0 representing\n stopped.\n '
return (self.forward_device.value - self.backward_device.value) | Represents the speed of the motor as a floating point value between -1
(full speed backward) and 1 (full speed forward), with 0 representing
stopped. | gpiozero/output_devices.py | value | lurch/python-gpiozero | 0 | python | @property
def value(self):
'\n Represents the speed of the motor as a floating point value between -1\n (full speed backward) and 1 (full speed forward), with 0 representing\n stopped.\n '
return (self.forward_device.value - self.backward_device.value) | @property
def value(self):
'\n Represents the speed of the motor as a floating point value between -1\n (full speed backward) and 1 (full speed forward), with 0 representing\n stopped.\n '
return (self.forward_device.value - self.backward_device.value)<|docstring|>Represents the spee... |
9c3c522d7fe9009b86cdffa7fb58d5ea6caf9a1444a76311a7c908164827d2a8 | @property
def is_active(self):
'\n Returns ``True`` if the motor is currently running and ``False``\n otherwise.\n '
return (self.value != 0) | Returns ``True`` if the motor is currently running and ``False``
otherwise. | gpiozero/output_devices.py | is_active | lurch/python-gpiozero | 0 | python | @property
def is_active(self):
'\n Returns ``True`` if the motor is currently running and ``False``\n otherwise.\n '
return (self.value != 0) | @property
def is_active(self):
'\n Returns ``True`` if the motor is currently running and ``False``\n otherwise.\n '
return (self.value != 0)<|docstring|>Returns ``True`` if the motor is currently running and ``False``
otherwise.<|endoftext|> |
4d6deef7e2b0183c8da46c3a35021b7316b4c6121563c863e291163454319503 | def forward(self, speed=1):
'\n Drive the motor forwards.\n\n :param float speed:\n The speed at which the motor should turn. Can be any value between\n 0 (stopped) and the default 1 (maximum speed) if ``pwm`` was\n ``True`` when the class was constructed (and only 0 o... | Drive the motor forwards.
:param float speed:
The speed at which the motor should turn. Can be any value between
0 (stopped) and the default 1 (maximum speed) if ``pwm`` was
``True`` when the class was constructed (and only 0 or 1 if not). | gpiozero/output_devices.py | forward | lurch/python-gpiozero | 0 | python | def forward(self, speed=1):
'\n Drive the motor forwards.\n\n :param float speed:\n The speed at which the motor should turn. Can be any value between\n 0 (stopped) and the default 1 (maximum speed) if ``pwm`` was\n ``True`` when the class was constructed (and only 0 o... | def forward(self, speed=1):
'\n Drive the motor forwards.\n\n :param float speed:\n The speed at which the motor should turn. Can be any value between\n 0 (stopped) and the default 1 (maximum speed) if ``pwm`` was\n ``True`` when the class was constructed (and only 0 o... |
1605a5ddb5bd6a4c809686d017a97226c67f0d4678acb4c394cfa0750f72da1d | def backward(self, speed=1):
'\n Drive the motor backwards.\n\n :param float speed:\n The speed at which the motor should turn. Can be any value between\n 0 (stopped) and the default 1 (maximum speed) if ``pwm`` was\n ``True`` when the class was constructed (and only 0... | Drive the motor backwards.
:param float speed:
The speed at which the motor should turn. Can be any value between
0 (stopped) and the default 1 (maximum speed) if ``pwm`` was
``True`` when the class was constructed (and only 0 or 1 if not). | gpiozero/output_devices.py | backward | lurch/python-gpiozero | 0 | python | def backward(self, speed=1):
'\n Drive the motor backwards.\n\n :param float speed:\n The speed at which the motor should turn. Can be any value between\n 0 (stopped) and the default 1 (maximum speed) if ``pwm`` was\n ``True`` when the class was constructed (and only 0... | def backward(self, speed=1):
'\n Drive the motor backwards.\n\n :param float speed:\n The speed at which the motor should turn. Can be any value between\n 0 (stopped) and the default 1 (maximum speed) if ``pwm`` was\n ``True`` when the class was constructed (and only 0... |
2139cfd07c83439c71e7c6649e92daf722ae03e631b81e483d6c7a0f4061e438 | def reverse(self):
"\n Reverse the current direction of the motor. If the motor is currently\n idle this does nothing. Otherwise, the motor's direction will be\n reversed at the current speed.\n "
self.value = (- self.value) | Reverse the current direction of the motor. If the motor is currently
idle this does nothing. Otherwise, the motor's direction will be
reversed at the current speed. | gpiozero/output_devices.py | reverse | lurch/python-gpiozero | 0 | python | def reverse(self):
"\n Reverse the current direction of the motor. If the motor is currently\n idle this does nothing. Otherwise, the motor's direction will be\n reversed at the current speed.\n "
self.value = (- self.value) | def reverse(self):
"\n Reverse the current direction of the motor. If the motor is currently\n idle this does nothing. Otherwise, the motor's direction will be\n reversed at the current speed.\n "
self.value = (- self.value)<|docstring|>Reverse the current direction of the motor. If ... |
35d639d8b86f1328c7e86df48f9f9a2831bc8cc095e4bf3fa495fbb90e9beb23 | def stop(self):
'\n Stop the motor.\n '
self.forward_device.off()
self.backward_device.off() | Stop the motor. | gpiozero/output_devices.py | stop | lurch/python-gpiozero | 0 | python | def stop(self):
'\n \n '
self.forward_device.off()
self.backward_device.off() | def stop(self):
'\n \n '
self.forward_device.off()
self.backward_device.off()<|docstring|>Stop the motor.<|endoftext|> |
7575dd5cb669b4029dd7d93f02784a3eb9812d3a83cc0df23fb0b8ead5cce6af | @property
def frame_width(self):
'\n The time between control pulses, measured in seconds.\n '
return self._frame_width | The time between control pulses, measured in seconds. | gpiozero/output_devices.py | frame_width | lurch/python-gpiozero | 0 | python | @property
def frame_width(self):
'\n \n '
return self._frame_width | @property
def frame_width(self):
'\n \n '
return self._frame_width<|docstring|>The time between control pulses, measured in seconds.<|endoftext|> |
146081473f58777ffd536f10d4a5948d98210eb41abaed75237d68f45977d6e0 | @property
def min_pulse_width(self):
"\n The control pulse width corresponding to the servo's minimum position,\n measured in seconds.\n "
return (self._min_dc * self.frame_width) | The control pulse width corresponding to the servo's minimum position,
measured in seconds. | gpiozero/output_devices.py | min_pulse_width | lurch/python-gpiozero | 0 | python | @property
def min_pulse_width(self):
"\n The control pulse width corresponding to the servo's minimum position,\n measured in seconds.\n "
return (self._min_dc * self.frame_width) | @property
def min_pulse_width(self):
"\n The control pulse width corresponding to the servo's minimum position,\n measured in seconds.\n "
return (self._min_dc * self.frame_width)<|docstring|>The control pulse width corresponding to the servo's minimum position,
measured in seconds.<|endoft... |
a94f00be4208aa4e6c16ed88af80f2257af4550169c6dd09012f292c5a640a74 | @property
def max_pulse_width(self):
"\n The control pulse width corresponding to the servo's maximum position,\n measured in seconds.\n "
return ((self._dc_range * self.frame_width) + self.min_pulse_width) | The control pulse width corresponding to the servo's maximum position,
measured in seconds. | gpiozero/output_devices.py | max_pulse_width | lurch/python-gpiozero | 0 | python | @property
def max_pulse_width(self):
"\n The control pulse width corresponding to the servo's maximum position,\n measured in seconds.\n "
return ((self._dc_range * self.frame_width) + self.min_pulse_width) | @property
def max_pulse_width(self):
"\n The control pulse width corresponding to the servo's maximum position,\n measured in seconds.\n "
return ((self._dc_range * self.frame_width) + self.min_pulse_width)<|docstring|>The control pulse width corresponding to the servo's maximum position,
m... |
0d945e4237d730290113d6831988ee32592b502691e575e114345b0059a5d877 | @property
def pulse_width(self):
'\n Returns the current pulse width controlling the servo.\n '
if (self.pwm_device.pin.frequency is None):
return None
else:
return (self.pwm_device.pin.state * self.frame_width) | Returns the current pulse width controlling the servo. | gpiozero/output_devices.py | pulse_width | lurch/python-gpiozero | 0 | python | @property
def pulse_width(self):
'\n \n '
if (self.pwm_device.pin.frequency is None):
return None
else:
return (self.pwm_device.pin.state * self.frame_width) | @property
def pulse_width(self):
'\n \n '
if (self.pwm_device.pin.frequency is None):
return None
else:
return (self.pwm_device.pin.state * self.frame_width)<|docstring|>Returns the current pulse width controlling the servo.<|endoftext|> |
90474062eaaab6393055369a0083c4fec2d97f951acb850f4b0cae301dcf2a8c | def min(self):
'\n Set the servo to its minimum position.\n '
self.value = (- 1) | Set the servo to its minimum position. | gpiozero/output_devices.py | min | lurch/python-gpiozero | 0 | python | def min(self):
'\n \n '
self.value = (- 1) | def min(self):
'\n \n '
self.value = (- 1)<|docstring|>Set the servo to its minimum position.<|endoftext|> |
266b0345e71b99fb05e599b80ef09a39b7e5918bf99dc68a0c4cc3eb4b0233ec | def mid(self):
'\n Set the servo to its mid-point position.\n '
self.value = 0 | Set the servo to its mid-point position. | gpiozero/output_devices.py | mid | lurch/python-gpiozero | 0 | python | def mid(self):
'\n \n '
self.value = 0 | def mid(self):
'\n \n '
self.value = 0<|docstring|>Set the servo to its mid-point position.<|endoftext|> |
95db6bb633030cc35777a616333515b83ae9599f148feef39ed694069e73fd0b | def max(self):
'\n Set the servo to its maximum position.\n '
self.value = 1 | Set the servo to its maximum position. | gpiozero/output_devices.py | max | lurch/python-gpiozero | 0 | python | def max(self):
'\n \n '
self.value = 1 | def max(self):
'\n \n '
self.value = 1<|docstring|>Set the servo to its maximum position.<|endoftext|> |
471e4322d224bdf3d917ee015c85657aee9f0de601010ebeabe5632952d80430 | def detach(self):
'\n Temporarily disable control of the servo. This is equivalent to\n setting :attr:`value` to ``None``.\n '
self.value = None | Temporarily disable control of the servo. This is equivalent to
setting :attr:`value` to ``None``. | gpiozero/output_devices.py | detach | lurch/python-gpiozero | 0 | python | def detach(self):
'\n Temporarily disable control of the servo. This is equivalent to\n setting :attr:`value` to ``None``.\n '
self.value = None | def detach(self):
'\n Temporarily disable control of the servo. This is equivalent to\n setting :attr:`value` to ``None``.\n '
self.value = None<|docstring|>Temporarily disable control of the servo. This is equivalent to
setting :attr:`value` to ``None``.<|endoftext|> |
b59fa5873924e2ac1a7166a58de9d78c0cfbff6781d2563cd221154aa486943d | @property
def value(self):
'\n Represents the position of the servo as a value between -1 (the minimum\n position) and +1 (the maximum position). This can also be the special\n value ``None`` indicating that the servo is currently "uncontrolled",\n i.e. that no control signal is being se... | Represents the position of the servo as a value between -1 (the minimum
position) and +1 (the maximum position). This can also be the special
value ``None`` indicating that the servo is currently "uncontrolled",
i.e. that no control signal is being sent. Typically this means the
servo's position remains unchanged, but ... | gpiozero/output_devices.py | value | lurch/python-gpiozero | 0 | python | @property
def value(self):
'\n Represents the position of the servo as a value between -1 (the minimum\n position) and +1 (the maximum position). This can also be the special\n value ``None`` indicating that the servo is currently "uncontrolled",\n i.e. that no control signal is being se... | @property
def value(self):
'\n Represents the position of the servo as a value between -1 (the minimum\n position) and +1 (the maximum position). This can also be the special\n value ``None`` indicating that the servo is currently "uncontrolled",\n i.e. that no control signal is being se... |
c656e676edb000b41109a7f17f9e2a9b1ca63fe59af28e8f15b658656bf0bab1 | @property
def min_angle(self):
'\n The minimum angle that the servo will rotate to when :meth:`min` is\n called.\n '
return self._min_angle | The minimum angle that the servo will rotate to when :meth:`min` is
called. | gpiozero/output_devices.py | min_angle | lurch/python-gpiozero | 0 | python | @property
def min_angle(self):
'\n The minimum angle that the servo will rotate to when :meth:`min` is\n called.\n '
return self._min_angle | @property
def min_angle(self):
'\n The minimum angle that the servo will rotate to when :meth:`min` is\n called.\n '
return self._min_angle<|docstring|>The minimum angle that the servo will rotate to when :meth:`min` is
called.<|endoftext|> |
a4c3e605b60bed82e1d6d2b38fcbd7d64482d63699bbf5dce19737cb01b5ccde | @property
def max_angle(self):
'\n The maximum angle that the servo will rotate to when :meth:`max` is\n called.\n '
return (self._min_angle + self._angular_range) | The maximum angle that the servo will rotate to when :meth:`max` is
called. | gpiozero/output_devices.py | max_angle | lurch/python-gpiozero | 0 | python | @property
def max_angle(self):
'\n The maximum angle that the servo will rotate to when :meth:`max` is\n called.\n '
return (self._min_angle + self._angular_range) | @property
def max_angle(self):
'\n The maximum angle that the servo will rotate to when :meth:`max` is\n called.\n '
return (self._min_angle + self._angular_range)<|docstring|>The maximum angle that the servo will rotate to when :meth:`max` is
called.<|endoftext|> |
4387e04ddfca88ab10bd1d6f83eb6c5f18b1c5623e34e925311bcc4a86755a1a | @property
def angle(self):
'\n The position of the servo as an angle measured in degrees. This will\n only be accurate if *min_angle* and *max_angle* have been set\n appropriately in the constructor.\n\n This can also be the special value ``None`` indicating that the servo\n is cu... | The position of the servo as an angle measured in degrees. This will
only be accurate if *min_angle* and *max_angle* have been set
appropriately in the constructor.
This can also be the special value ``None`` indicating that the servo
is currently "uncontrolled", i.e. that no control signal is being sent.
Typically th... | gpiozero/output_devices.py | angle | lurch/python-gpiozero | 0 | python | @property
def angle(self):
'\n The position of the servo as an angle measured in degrees. This will\n only be accurate if *min_angle* and *max_angle* have been set\n appropriately in the constructor.\n\n This can also be the special value ``None`` indicating that the servo\n is cu... | @property
def angle(self):
'\n The position of the servo as an angle measured in degrees. This will\n only be accurate if *min_angle* and *max_angle* have been set\n appropriately in the constructor.\n\n This can also be the special value ``None`` indicating that the servo\n is cu... |
0c6bbe42f4a49d1979a3eaf66b50bf19eec214b7f88c5931c57b650fa665b0e7 | @pytest.fixture(scope='function')
def app(request):
'Provide instance for basic Flask app.'
app = flask.Flask(__name__)
app.config['TESTING'] = True
app.config['DEBUG'] = True
return app | Provide instance for basic Flask app. | tests/test_flask_pushjack.py | app | bugzzbunny007/flask-pushjack | 74 | python | @pytest.fixture(scope='function')
def app(request):
app = flask.Flask(__name__)
app.config['TESTING'] = True
app.config['DEBUG'] = True
return app | @pytest.fixture(scope='function')
def app(request):
app = flask.Flask(__name__)
app.config['TESTING'] = True
app.config['DEBUG'] = True
return app<|docstring|>Provide instance for basic Flask app.<|endoftext|> |
b5429ef3eaa9eda0bbf4c8858a6ee6ce9a783187a60706228444beb09b321fc4 | def setUp(self):
'Initializes the environment for each test.'
self._db = sqlite3.connect(':memory:')
self.add_data_into_db(self._db, random.randint(100, 10000)) | Initializes the environment for each test. | pycast/tests/timeseriesdatabasetest.py | setUp | yuvaraja2303/pycast | 76 | python | def setUp(self):
self._db = sqlite3.connect(':memory:')
self.add_data_into_db(self._db, random.randint(100, 10000)) | def setUp(self):
self._db = sqlite3.connect(':memory:')
self.add_data_into_db(self._db, random.randint(100, 10000))<|docstring|>Initializes the environment for each test.<|endoftext|> |
23569cbd3b83cb9ce15ff35766dfb17329df3c30e8b46f9bf9c8e7a906e9ab1c | def tearDown(self):
'This function gets called after each test function.'
self._db.close()
del self._db | This function gets called after each test function. | pycast/tests/timeseriesdatabasetest.py | tearDown | yuvaraja2303/pycast | 76 | python | def tearDown(self):
self._db.close()
del self._db | def tearDown(self):
self._db.close()
del self._db<|docstring|>This function gets called after each test function.<|endoftext|> |
a111f570ced226d3e731c5f32d96fae6ab6a24f80187469ec60624ed385b92f9 | def add_data_into_db(self, database, numberOfTuples):
'Inserts a numberOfTuples tuples into the given database.\n\n This automatically creates a table called TestTable with the following schema:\n timestamp REAL\n value REAL\n junk_one REAL\n junk_two TEXT\n\... | Inserts a numberOfTuples tuples into the given database.
This automatically creates a table called TestTable with the following schema:
timestamp REAL
value REAL
junk_one REAL
junk_two TEXT
The time stamps will be inserted as an ordered sequence.
@param database dbapi2.connection Instance for t... | pycast/tests/timeseriesdatabasetest.py | add_data_into_db | yuvaraja2303/pycast | 76 | python | def add_data_into_db(self, database, numberOfTuples):
'Inserts a numberOfTuples tuples into the given database.\n\n This automatically creates a table called TestTable with the following schema:\n timestamp REAL\n value REAL\n junk_one REAL\n junk_two TEXT\n\... | def add_data_into_db(self, database, numberOfTuples):
'Inserts a numberOfTuples tuples into the given database.\n\n This automatically creates a table called TestTable with the following schema:\n timestamp REAL\n value REAL\n junk_one REAL\n junk_two TEXT\n\... |
21bd296b40f8564e88c63f57920f32da66d51fa07cd3fa96101901f5a3c68a93 | def select_to_many_attributes_test(self):
'SELECT timestamp, value, junk, FROM TestTable\n\n This function tests if statements like\n\n SELECT timestamp, value, junk, ... FROM\n\n can be used to initialize a TimeSeries instance. TimeSeries should therefore only\n take the first two attri... | SELECT timestamp, value, junk, FROM TestTable
This function tests if statements like
SELECT timestamp, value, junk, ... FROM
can be used to initialize a TimeSeries instance. TimeSeries should therefore only
take the first two attributes for data initialization, regardless of their names. | pycast/tests/timeseriesdatabasetest.py | select_to_many_attributes_test | yuvaraja2303/pycast | 76 | python | def select_to_many_attributes_test(self):
'SELECT timestamp, value, junk, FROM TestTable\n\n This function tests if statements like\n\n SELECT timestamp, value, junk, ... FROM\n\n can be used to initialize a TimeSeries instance. TimeSeries should therefore only\n take the first two attri... | def select_to_many_attributes_test(self):
'SELECT timestamp, value, junk, FROM TestTable\n\n This function tests if statements like\n\n SELECT timestamp, value, junk, ... FROM\n\n can be used to initialize a TimeSeries instance. TimeSeries should therefore only\n take the first two attri... |
ff71eb748af5f24afa08d5e80f2c5c468ad614bcbeb977bf15bace08c3f12983 | def select_star_test(self):
'SELECT * FROM TestTable\n\n This function tests if statements like\n\n SELECT * FROM\n\n can be used to initialize a TimeSeries instance. TimeSeries should therefore only\n take the first two attributes for data initialization, regardless of their names.\n ... | SELECT * FROM TestTable
This function tests if statements like
SELECT * FROM
can be used to initialize a TimeSeries instance. TimeSeries should therefore only
take the first two attributes for data initialization, regardless of their names. | pycast/tests/timeseriesdatabasetest.py | select_star_test | yuvaraja2303/pycast | 76 | python | def select_star_test(self):
'SELECT * FROM TestTable\n\n This function tests if statements like\n\n SELECT * FROM\n\n can be used to initialize a TimeSeries instance. TimeSeries should therefore only\n take the first two attributes for data initialization, regardless of their names.\n ... | def select_star_test(self):
'SELECT * FROM TestTable\n\n This function tests if statements like\n\n SELECT * FROM\n\n can be used to initialize a TimeSeries instance. TimeSeries should therefore only\n take the first two attributes for data initialization, regardless of their names.\n ... |
f3495d775cb2234835e23aa5a32b34442ac7704679cc33562067e044095aa902 | def multidimensionaltimeseries_test(self):
'Test the initialization of the MultiDimensionalTimeSeries.'
cur = self._db.cursor().execute('SELECT COUNT(*) from TestTable')
nbrOfTuples = cur.fetchall()[0][0]
cur = self._db.cursor().execute('SELECT timestamp, value, junk_one FROM TestTable')
ts = MultiD... | Test the initialization of the MultiDimensionalTimeSeries. | pycast/tests/timeseriesdatabasetest.py | multidimensionaltimeseries_test | yuvaraja2303/pycast | 76 | python | def multidimensionaltimeseries_test(self):
cur = self._db.cursor().execute('SELECT COUNT(*) from TestTable')
nbrOfTuples = cur.fetchall()[0][0]
cur = self._db.cursor().execute('SELECT timestamp, value, junk_one FROM TestTable')
ts = MultiDimensionalTimeSeries(dimensions=2)
ts.initialize_from_sq... | def multidimensionaltimeseries_test(self):
cur = self._db.cursor().execute('SELECT COUNT(*) from TestTable')
nbrOfTuples = cur.fetchall()[0][0]
cur = self._db.cursor().execute('SELECT timestamp, value, junk_one FROM TestTable')
ts = MultiDimensionalTimeSeries(dimensions=2)
ts.initialize_from_sq... |
e58da5917852c20f48e7cf2af100da82b9d501caf0ec2622cb11e1eeeb618ade | def check_for_consistency_test(self):
'Tests if database initialization and manual initialization create equal TimeSeries instances.'
cur = self._db.cursor().execute('SELECT COUNT(*) from TestTable')
nbrOfTuples = cur.fetchall()[0][0]
sqlstmt = 'SELECT timestamp, value FROM TestTable ORDER BY timestamp ... | Tests if database initialization and manual initialization create equal TimeSeries instances. | pycast/tests/timeseriesdatabasetest.py | check_for_consistency_test | yuvaraja2303/pycast | 76 | python | def check_for_consistency_test(self):
cur = self._db.cursor().execute('SELECT COUNT(*) from TestTable')
nbrOfTuples = cur.fetchall()[0][0]
sqlstmt = 'SELECT timestamp, value FROM TestTable ORDER BY timestamp ASC'
tsManual = TimeSeries()
data = self._db.cursor().execute(sqlstmt).fetchall()
f... | def check_for_consistency_test(self):
cur = self._db.cursor().execute('SELECT COUNT(*) from TestTable')
nbrOfTuples = cur.fetchall()[0][0]
sqlstmt = 'SELECT timestamp, value FROM TestTable ORDER BY timestamp ASC'
tsManual = TimeSeries()
data = self._db.cursor().execute(sqlstmt).fetchall()
f... |
afa97195bd608ef2d6d9b11ac18c30bce46f20a900a8770e9138364cdb34a6ee | def hoverStiff(self, x_c, y_c, z_c, yaw_c, goal_r):
'\n Hovers the drone to an accurate global setpoint\n Drone will stay at setpoint until other function is called\n Stiff refers to optimization for global positional accuracy\n\n Parameters\n ----------\n x_c, y_c, z_c, ya... | Hovers the drone to an accurate global setpoint
Drone will stay at setpoint until other function is called
Stiff refers to optimization for global positional accuracy
Parameters
----------
x_c, y_c, z_c, yaw_c = reference setpoints
goal_r = bounding radius for when drone is "close enough" to commanded setpoint | crazyflie_demo/scripts/hover_stiff.py | hoverStiff | CooperControlsLab/crazyflie_cooper_ros | 3 | python | def hoverStiff(self, x_c, y_c, z_c, yaw_c, goal_r):
'\n Hovers the drone to an accurate global setpoint\n Drone will stay at setpoint until other function is called\n Stiff refers to optimization for global positional accuracy\n\n Parameters\n ----------\n x_c, y_c, z_c, ya... | def hoverStiff(self, x_c, y_c, z_c, yaw_c, goal_r):
'\n Hovers the drone to an accurate global setpoint\n Drone will stay at setpoint until other function is called\n Stiff refers to optimization for global positional accuracy\n\n Parameters\n ----------\n x_c, y_c, z_c, ya... |
7efc9c123630dccf5ba20be7dd68f8232ee30e8a47c56f9bb665e583963613db | def test_001_simple(self):
" Very simple functionality testing:\n - static equalizer\n - init channel state with all ones\n - transmit all ones\n - make sure we rx all ones\n - Tag check: put in frame length tag and one other random tag,\n make sure they're pro... | Very simple functionality testing:
- static equalizer
- init channel state with all ones
- transmit all ones
- make sure we rx all ones
- Tag check: put in frame length tag and one other random tag,
make sure they're propagated | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_001_simple | v1259397/cosmic-gnuradio | 1 | python | def test_001_simple(self):
" Very simple functionality testing:\n - static equalizer\n - init channel state with all ones\n - transmit all ones\n - make sure we rx all ones\n - Tag check: put in frame length tag and one other random tag,\n make sure they're pro... | def test_001_simple(self):
" Very simple functionality testing:\n - static equalizer\n - init channel state with all ones\n - transmit all ones\n - make sure we rx all ones\n - Tag check: put in frame length tag and one other random tag,\n make sure they're pro... |
59496e9d50d4b1713da19342169d43e029fd186be6b994eaa0d601bf4db74ebb | def test_001b_simple_skip_nothing(self):
'\n Same as before, but put a skip-header in there\n '
fft_len = 8
equalizer = digital.ofdm_equalizer_static(fft_len, symbols_skipped=1)
n_syms = 3
tx_data = (((1,) * fft_len) * n_syms)
chan_tag = gr.tag_t()
chan_tag.offset = 0
chan_... | Same as before, but put a skip-header in there | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_001b_simple_skip_nothing | v1259397/cosmic-gnuradio | 1 | python | def test_001b_simple_skip_nothing(self):
'\n \n '
fft_len = 8
equalizer = digital.ofdm_equalizer_static(fft_len, symbols_skipped=1)
n_syms = 3
tx_data = (((1,) * fft_len) * n_syms)
chan_tag = gr.tag_t()
chan_tag.offset = 0
chan_tag.key = pmt.string_to_symbol('ofdm_sync_chan... | def test_001b_simple_skip_nothing(self):
'\n \n '
fft_len = 8
equalizer = digital.ofdm_equalizer_static(fft_len, symbols_skipped=1)
n_syms = 3
tx_data = (((1,) * fft_len) * n_syms)
chan_tag = gr.tag_t()
chan_tag.offset = 0
chan_tag.key = pmt.string_to_symbol('ofdm_sync_chan... |
c7287557c4f0089e10465f4b48c2e60c63e3509b122b67eb906e3252acaca86b | def test_001c_carrier_offset_no_cp(self):
'\n Same as before, but put a carrier offset in there\n '
fft_len = 8
cp_len = 0
n_syms = 1
carr_offset = 1
occupied_carriers = (((- 2), (- 1), 1, 2),)
tx_data = (0, 0, 0, (- 1j), (- 1j), 0, (- 1j), (- 1j))
rx_expected = ((0, 0, 1, ... | Same as before, but put a carrier offset in there | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_001c_carrier_offset_no_cp | v1259397/cosmic-gnuradio | 1 | python | def test_001c_carrier_offset_no_cp(self):
'\n \n '
fft_len = 8
cp_len = 0
n_syms = 1
carr_offset = 1
occupied_carriers = (((- 2), (- 1), 1, 2),)
tx_data = (0, 0, 0, (- 1j), (- 1j), 0, (- 1j), (- 1j))
rx_expected = ((0, 0, 1, 1, 0, 1, 1, 0) * n_syms)
equalizer = digital.... | def test_001c_carrier_offset_no_cp(self):
'\n \n '
fft_len = 8
cp_len = 0
n_syms = 1
carr_offset = 1
occupied_carriers = (((- 2), (- 1), 1, 2),)
tx_data = (0, 0, 0, (- 1j), (- 1j), 0, (- 1j), (- 1j))
rx_expected = ((0, 0, 1, 1, 0, 1, 1, 0) * n_syms)
equalizer = digital.... |
2c41c85e45cabe0f3f20781fafe225212ec714b0321fa98bcee977ece8c9f185 | def test_001c_carrier_offset_cp(self):
'\n Same as before, but put a carrier offset in there and a CP\n '
fft_len = 8
cp_len = 2
n_syms = 3
occupied_carriers = (((- 2), (- 1), 1, 2),)
carr_offset = (- 1)
tx_data = (0, (- 1j), (- 1j), 0, (- 1j), (- 1j), 0, 0, 0, (- 1), (- 1), 0,... | Same as before, but put a carrier offset in there and a CP | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_001c_carrier_offset_cp | v1259397/cosmic-gnuradio | 1 | python | def test_001c_carrier_offset_cp(self):
'\n \n '
fft_len = 8
cp_len = 2
n_syms = 3
occupied_carriers = (((- 2), (- 1), 1, 2),)
carr_offset = (- 1)
tx_data = (0, (- 1j), (- 1j), 0, (- 1j), (- 1j), 0, 0, 0, (- 1), (- 1), 0, (- 1), (- 1), 0, 0, 0, 1j, 1j, 0, 1j, 1j, 0, 0)
rx_ex... | def test_001c_carrier_offset_cp(self):
'\n \n '
fft_len = 8
cp_len = 2
n_syms = 3
occupied_carriers = (((- 2), (- 1), 1, 2),)
carr_offset = (- 1)
tx_data = (0, (- 1j), (- 1j), 0, (- 1j), (- 1j), 0, 0, 0, (- 1), (- 1), 0, (- 1), (- 1), 0, 0, 0, 1j, 1j, 0, 1j, 1j, 0, 0)
rx_ex... |
0c788000d54012b7e5e1acca19f029e605decfc1c40ce0a7260ae1f398768487 | def test_002_static(self):
'\n - Add a simple channel\n - Make symbols QPSK\n '
fft_len = 8
tx_data = [(- 1), (- 1), 1, 2, (- 1), 3, 0, (- 1), (- 1), (- 1), 0, 2, (- 1), 2, 0, (- 1), (- 1), (- 1), 3, 0, (- 1), 1, 0, (- 1), (- 1), (- 1), 1, 1, (- 1), 0, 2, (- 1)]
cnst = digital.const... | - Add a simple channel
- Make symbols QPSK | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_002_static | v1259397/cosmic-gnuradio | 1 | python | def test_002_static(self):
'\n - Add a simple channel\n - Make symbols QPSK\n '
fft_len = 8
tx_data = [(- 1), (- 1), 1, 2, (- 1), 3, 0, (- 1), (- 1), (- 1), 0, 2, (- 1), 2, 0, (- 1), (- 1), (- 1), 3, 0, (- 1), 1, 0, (- 1), (- 1), (- 1), 1, 1, (- 1), 0, 2, (- 1)]
cnst = digital.const... | def test_002_static(self):
'\n - Add a simple channel\n - Make symbols QPSK\n '
fft_len = 8
tx_data = [(- 1), (- 1), 1, 2, (- 1), 3, 0, (- 1), (- 1), (- 1), 0, 2, (- 1), 2, 0, (- 1), (- 1), (- 1), 3, 0, (- 1), 1, 0, (- 1), (- 1), (- 1), 1, 1, (- 1), 0, 2, (- 1)]
cnst = digital.const... |
16e916e895b2530944a3104401cc471e1b566f722ab700a23d1fee135f66512d | def test_002_static_wo_tags(self):
' Same as before, but the input stream has no tag.\n We specify the frame size in the constructor.\n We also specify a tag key, so the output stream *should* have\n a TSB tag.\n '
fft_len = 8
n_syms = 4
tx_data = [(- 1), (- 1), 1, 2, (- 1), ... | Same as before, but the input stream has no tag.
We specify the frame size in the constructor.
We also specify a tag key, so the output stream *should* have
a TSB tag. | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_002_static_wo_tags | v1259397/cosmic-gnuradio | 1 | python | def test_002_static_wo_tags(self):
' Same as before, but the input stream has no tag.\n We specify the frame size in the constructor.\n We also specify a tag key, so the output stream *should* have\n a TSB tag.\n '
fft_len = 8
n_syms = 4
tx_data = [(- 1), (- 1), 1, 2, (- 1), ... | def test_002_static_wo_tags(self):
' Same as before, but the input stream has no tag.\n We specify the frame size in the constructor.\n We also specify a tag key, so the output stream *should* have\n a TSB tag.\n '
fft_len = 8
n_syms = 4
tx_data = [(- 1), (- 1), 1, 2, (- 1), ... |
8d35363dd73f32a84cf53d4457ee773800c9ab99c380fb15a46a72af10deb1b0 | def test_002_simpledfe(self):
' Use the simple DFE equalizer. '
fft_len = 8
tx_data = [(- 1), (- 1), 1, 2, (- 1), 3, 0, (- 1), (- 1), (- 1), 0, 2, (- 1), 2, 0, (- 1), (- 1), (- 1), 3, 0, (- 1), 1, 0, (- 1), (- 1), (- 1), 1, 1, (- 1), 0, 2, (- 1)]
cnst = digital.constellation_qpsk()
tx_signal = [(cns... | Use the simple DFE equalizer. | gnuradio-3.7.13.4/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py | test_002_simpledfe | v1259397/cosmic-gnuradio | 1 | python | def test_002_simpledfe(self):
' '
fft_len = 8
tx_data = [(- 1), (- 1), 1, 2, (- 1), 3, 0, (- 1), (- 1), (- 1), 0, 2, (- 1), 2, 0, (- 1), (- 1), (- 1), 3, 0, (- 1), 1, 0, (- 1), (- 1), (- 1), 1, 1, (- 1), 0, 2, (- 1)]
cnst = digital.constellation_qpsk()
tx_signal = [(cnst.map_to_points_v(x)[0] if (x... | def test_002_simpledfe(self):
' '
fft_len = 8
tx_data = [(- 1), (- 1), 1, 2, (- 1), 3, 0, (- 1), (- 1), (- 1), 0, 2, (- 1), 2, 0, (- 1), (- 1), (- 1), 3, 0, (- 1), 1, 0, (- 1), (- 1), (- 1), 1, 1, (- 1), 0, 2, (- 1)]
cnst = digital.constellation_qpsk()
tx_signal = [(cnst.map_to_points_v(x)[0] if (x... |
77ed5cb7ec9cd5e8188f2a12d256d44d065dc58b379bbcf79127d8331514fe93 | def main():
'Run all of the tests when run as a module with -m.'
suite = tests.get_suite()
runner = unittest.TextTestRunner()
runner.run(suite) | Run all of the tests when run as a module with -m. | mdx_picture/tests/__main__.py | main | speechkey/mdx_picture | 0 | python | def main():
suite = tests.get_suite()
runner = unittest.TextTestRunner()
runner.run(suite) | def main():
suite = tests.get_suite()
runner = unittest.TextTestRunner()
runner.run(suite)<|docstring|>Run all of the tests when run as a module with -m.<|endoftext|> |
e695571a2ac3d1b0383fe90ec6b4d92ff61e1752a9190c1099d334517ea527f4 | def add_contact(self, segment_id, contact_id):
'\n Add a contact to the segment\n\n :param segment_id: int Segment ID\n :param contact_id: int Contact ID\n :return: dict|str\n '
response = self._client.session.post('{url}/{segment_id}/contact/add/{contact_id}'.format(url=self.... | Add a contact to the segment
:param segment_id: int Segment ID
:param contact_id: int Contact ID
:return: dict|str | mautic/segments.py | add_contact | resumov/python-mautic | 18 | python | def add_contact(self, segment_id, contact_id):
'\n Add a contact to the segment\n\n :param segment_id: int Segment ID\n :param contact_id: int Contact ID\n :return: dict|str\n '
response = self._client.session.post('{url}/{segment_id}/contact/add/{contact_id}'.format(url=self.... | def add_contact(self, segment_id, contact_id):
'\n Add a contact to the segment\n\n :param segment_id: int Segment ID\n :param contact_id: int Contact ID\n :return: dict|str\n '
response = self._client.session.post('{url}/{segment_id}/contact/add/{contact_id}'.format(url=self.... |
41781b31ce9ecc80f5326f6e6808907201031b7c5a3cfb0b5cab547a99d8f994 | def train_preprocess(partition, file_list, max_len):
'\n Return processed data (ndarray) and original file length (list)\n '
corpus = []
pkeys = partition.keys()
for fn in file_list:
if (fn not in pkeys):
logging.critical((fn + ' not exists in partition'))
else:
... | Return processed data (ndarray) and original file length (list) | src/utils/preprocess.py | train_preprocess | anandharaju/Echelon_TF2 | 0 | python | def train_preprocess(partition, file_list, max_len):
'\n \n '
corpus = []
pkeys = partition.keys()
for fn in file_list:
if (fn not in pkeys):
logging.critical((fn + ' not exists in partition'))
else:
data = partition[fn]['whole_bytes']
corpus.app... | def train_preprocess(partition, file_list, max_len):
'\n \n '
corpus = []
pkeys = partition.keys()
for fn in file_list:
if (fn not in pkeys):
logging.critical((fn + ' not exists in partition'))
else:
data = partition[fn]['whole_bytes']
corpus.app... |
827ffa743ea17e895b1e0e21c79308b264b5906589541618dd4741fdb7b9e180 | def train_preprocess_by_section(spartition, file_list, max_len, sections):
'\n Return processed data (ndarray) and original section length (list)\n '
if (sections is None):
logging.critical('No sections supplied to process. Check if Q-criterion based selection completed successfully.')
corpus ... | Return processed data (ndarray) and original section length (list) | src/utils/preprocess.py | train_preprocess_by_section | anandharaju/Echelon_TF2 | 0 | python | def train_preprocess_by_section(spartition, file_list, max_len, sections):
'\n \n '
if (sections is None):
logging.critical('No sections supplied to process. Check if Q-criterion based selection completed successfully.')
corpus = []
pkeys = spartition.keys()
for fn in file_list:
... | def train_preprocess_by_section(spartition, file_list, max_len, sections):
'\n \n '
if (sections is None):
logging.critical('No sections supplied to process. Check if Q-criterion based selection completed successfully.')
corpus = []
pkeys = spartition.keys()
for fn in file_list:
... |
275698f3c81a475e477d8b0e2a5e4e14c22fcbeb87c9d846eb153b5c074d677f | def preprocess(partition, file_list):
'\n Return processed data (ndarray) and original file length (list)\n '
a1 = time.time()
corpus = [partition[fn[:(- 4)]]['whole_bytes'] for fn in file_list]
b1 = time.time()
seq = pad_sequences(corpus, maxlen=cnst.MAX_FILE_SIZE_LIMIT, truncating='post', pa... | Return processed data (ndarray) and original file length (list) | src/utils/preprocess.py | preprocess | anandharaju/Echelon_TF2 | 0 | python | def preprocess(partition, file_list):
'\n \n '
a1 = time.time()
corpus = [partition[fn[:(- 4)]]['whole_bytes'] for fn in file_list]
b1 = time.time()
seq = pad_sequences(corpus, maxlen=cnst.MAX_FILE_SIZE_LIMIT, truncating='post', padding='post')
c1 = time.time()
return seq | def preprocess(partition, file_list):
'\n \n '
a1 = time.time()
corpus = [partition[fn[:(- 4)]]['whole_bytes'] for fn in file_list]
b1 = time.time()
seq = pad_sequences(corpus, maxlen=cnst.MAX_FILE_SIZE_LIMIT, truncating='post', padding='post')
c1 = time.time()
return seq<|docstring|>R... |
b899e222924564ff95be7a4af326213c039cd140444e5ef989a87f0b5b1f9c38 | def preprocess_by_section_by_samples(file_list, max_len, sections):
'\n Return processed data (ndarray) and original section length (list)\n '
if (sections is None):
logging.critical('No sections supplied to process. Check if Q-criterion based selection completed successfully.')
corpus = []
... | Return processed data (ndarray) and original section length (list) | src/utils/preprocess.py | preprocess_by_section_by_samples | anandharaju/Echelon_TF2 | 0 | python | def preprocess_by_section_by_samples(file_list, max_len, sections):
'\n \n '
if (sections is None):
logging.critical('No sections supplied to process. Check if Q-criterion based selection completed successfully.')
corpus = []
for fn in file_list:
if (not os.path.isfile((((cnst.PKL_... | def preprocess_by_section_by_samples(file_list, max_len, sections):
'\n \n '
if (sections is None):
logging.critical('No sections supplied to process. Check if Q-criterion based selection completed successfully.')
corpus = []
for fn in file_list:
if (not os.path.isfile((((cnst.PKL_... |
6a8f0bf4fda9ef31891081e596b6dc287a31eeb2da211e89908c5372959f3d0f | def preprocess_by_section(spartition, file_list, sections):
'\n Return processed data (ndarray) and original section length (list)\n '
corpus = []
for fn in file_list:
fjson = spartition[fn[:(- 4)]]
combined = np.zeros(cnst.MAX_FILE_SIZE_LIMIT)
keys = fjson['section_info'].keys... | Return processed data (ndarray) and original section length (list) | src/utils/preprocess.py | preprocess_by_section | anandharaju/Echelon_TF2 | 0 | python | def preprocess_by_section(spartition, file_list, sections):
'\n \n '
corpus = []
for fn in file_list:
fjson = spartition[fn[:(- 4)]]
combined = np.zeros(cnst.MAX_FILE_SIZE_LIMIT)
keys = fjson['section_info'].keys()
for section in sections:
if (section in key... | def preprocess_by_section(spartition, file_list, sections):
'\n \n '
corpus = []
for fn in file_list:
fjson = spartition[fn[:(- 4)]]
combined = np.zeros(cnst.MAX_FILE_SIZE_LIMIT)
keys = fjson['section_info'].keys()
for section in sections:
if (section in key... |
105cb08ebfdbb575bef4211671567307609e675995ebb597ce72116f6c680e4a | def __init__(self, pattern, topleft):
u'コンストラクタ。\n '
super(_Operatable, self).__init__(pattern)
(self._left, self._top) = topleft | コンストラクタ。 | Source/pieces/falling.py | __init__ | LucXyMan/starseeker | 0 | python | def __init__(self, pattern, topleft):
u'\n '
super(_Operatable, self).__init__(pattern)
(self._left, self._top) = topleft | def __init__(self, pattern, topleft):
u'\n '
super(_Operatable, self).__init__(pattern)
(self._left, self._top) = topleft<|docstring|>コンストラクタ。<|endoftext|> |
c4be8b43fec8790768adb2fe5af148d5fdd6304f8d66f64bffacc13692345e16 | @property
def left(self):
u'左位置取得。\n '
return self._left | 左位置取得。 | Source/pieces/falling.py | left | LucXyMan/starseeker | 0 | python | @property
def left(self):
u'\n '
return self._left | @property
def left(self):
u'\n '
return self._left<|docstring|>左位置取得。<|endoftext|> |
42966b22b6894f87ef552852f6f33ebba7831dd6a410232bbe47d8614431283c | @left.setter
def left(self, value):
u'左位置設定。\n '
self.clear()
self._left = value
self._create() | 左位置設定。 | Source/pieces/falling.py | left | LucXyMan/starseeker | 0 | python | @left.setter
def left(self, value):
u'\n '
self.clear()
self._left = value
self._create() | @left.setter
def left(self, value):
u'\n '
self.clear()
self._left = value
self._create()<|docstring|>左位置設定。<|endoftext|> |
4291841eacca199d93dc3a124400297650b232ac972624937eb3e364947485c8 | @property
def top(self):
u'上位置取得。\n '
return self._top | 上位置取得。 | Source/pieces/falling.py | top | LucXyMan/starseeker | 0 | python | @property
def top(self):
u'\n '
return self._top | @property
def top(self):
u'\n '
return self._top<|docstring|>上位置取得。<|endoftext|> |
84ee7c721a91eed2f45e7b6bacdc8fae49d0401f5b9aa456f4be7cfac19923b6 | @top.setter
def top(self, value):
u'上位置設定。\n '
self.clear()
self._top = value
self._create() | 上位置設定。 | Source/pieces/falling.py | top | LucXyMan/starseeker | 0 | python | @top.setter
def top(self, value):
u'\n '
self.clear()
self._top = value
self._create() | @top.setter
def top(self, value):
u'\n '
self.clear()
self._top = value
self._create()<|docstring|>上位置設定。<|endoftext|> |
af2d594c199d507fd550f4e83fa4b252b4a5b63f32426b2afb75357b2a77fce7 | def __init__(self, pattern, pos=(0, 0), is_virtual=False):
u'コンストラクタ。\n '
super(Falling, self).__init__(pattern, pos)
self.__is_rested = False
self.__rotated = 0
self.__is_commanded = False
self.__is_t_spin = False
self.__is_virtual = is_virtual
self._create() | コンストラクタ。 | Source/pieces/falling.py | __init__ | LucXyMan/starseeker | 0 | python | def __init__(self, pattern, pos=(0, 0), is_virtual=False):
u'\n '
super(Falling, self).__init__(pattern, pos)
self.__is_rested = False
self.__rotated = 0
self.__is_commanded = False
self.__is_t_spin = False
self.__is_virtual = is_virtual
self._create() | def __init__(self, pattern, pos=(0, 0), is_virtual=False):
u'\n '
super(Falling, self).__init__(pattern, pos)
self.__is_rested = False
self.__rotated = 0
self.__is_commanded = False
self.__is_t_spin = False
self.__is_virtual = is_virtual
self._create()<|docstring|>コンストラクタ。<|endoft... |
4514d02500d0a6340afba837f984f726c6c10d90d74d588e615426eb7c81288c | def _create(self):
u'ブロック作成。\n '
for block in self._pattern.get_blocks((self.left, self.top), self.__is_virtual):
block.piece = self
self._blocks.append(block) | ブロック作成。 | Source/pieces/falling.py | _create | LucXyMan/starseeker | 0 | python | def _create(self):
u'\n '
for block in self._pattern.get_blocks((self.left, self.top), self.__is_virtual):
block.piece = self
self._blocks.append(block) | def _create(self):
u'\n '
for block in self._pattern.get_blocks((self.left, self.top), self.__is_virtual):
block.piece = self
self._blocks.append(block)<|docstring|>ブロック作成。<|endoftext|> |
d132679a0d6e8547991a78af23928a79eff987ce15e96c88acc4e633ad9891e1 | def remove(self, block):
u'ブロック削除。\n '
if (block in self._blocks[:]):
self._blocks.remove(block) | ブロック削除。 | Source/pieces/falling.py | remove | LucXyMan/starseeker | 0 | python | def remove(self, block):
u'\n '
if (block in self._blocks[:]):
self._blocks.remove(block) | def remove(self, block):
u'\n '
if (block in self._blocks[:]):
self._blocks.remove(block)<|docstring|>ブロック削除。<|endoftext|> |
387a4dbbcf86a68f486b93048caac060d6486ed91d7329479c73ff27c8e3fe58 | def clear(self):
u'ブロック消去。\n '
self._blocks = [] | ブロック消去。 | Source/pieces/falling.py | clear | LucXyMan/starseeker | 0 | python | def clear(self):
u'\n '
self._blocks = [] | def clear(self):
u'\n '
self._blocks = []<|docstring|>ブロック消去。<|endoftext|> |
24c56527fe9ec5aa71d609fc15ee88118bc947da5e0aaf03c6dd9b4d2a547eed | def stamp(self, field):
u'ピースをフィールドに転写。\n '
if (not self.__is_rested):
field.add(*self._pattern.get_blocks((self.left, self.top), self.__is_virtual))
self.clear() | ピースをフィールドに転写。 | Source/pieces/falling.py | stamp | LucXyMan/starseeker | 0 | python | def stamp(self, field):
u'\n '
if (not self.__is_rested):
field.add(*self._pattern.get_blocks((self.left, self.top), self.__is_virtual))
self.clear() | def stamp(self, field):
u'\n '
if (not self.__is_rested):
field.add(*self._pattern.get_blocks((self.left, self.top), self.__is_virtual))
self.clear()<|docstring|>ピースをフィールドに転写。<|endoftext|> |
d4426db95877125dbaf1d7cd752226e8071221203e281bcc6605b4458929d98f | def rest(self, field):
u'ピースの固着。\n '
if (not self.__is_rested):
self.stamp(field)
self.__is_rested = True | ピースの固着。 | Source/pieces/falling.py | rest | LucXyMan/starseeker | 0 | python | def rest(self, field):
u'\n '
if (not self.__is_rested):
self.stamp(field)
self.__is_rested = True | def rest(self, field):
u'\n '
if (not self.__is_rested):
self.stamp(field)
self.__is_rested = True<|docstring|>ピースの固着。<|endoftext|> |
aec38290ace9c8a31128d8c069b5319150e35bac7aba3881e2634d9fb1cdd1e3 | def skip(self):
u'ピースを消去して固着。\n '
self.clear()
self.__is_rested = True | ピースを消去して固着。 | Source/pieces/falling.py | skip | LucXyMan/starseeker | 0 | python | def skip(self):
u'\n '
self.clear()
self.__is_rested = True | def skip(self):
u'\n '
self.clear()
self.__is_rested = True<|docstring|>ピースを消去して固着。<|endoftext|> |
5478d69c2f153c834d3cbb59db98080faab195b624c6d1c189717178d72e3775 | def move(self, field, vector):
u'ピースの移動。\n '
if (not self.__is_rested):
old_topleft = (self.left, self.top)
self.clear()
self._left += vector[0]
self._top += vector[1]
self._create()
if self.is_collide(field):
self.topleft = old_topleft
... | ピースの移動。 | Source/pieces/falling.py | move | LucXyMan/starseeker | 0 | python | def move(self, field, vector):
u'\n '
if (not self.__is_rested):
old_topleft = (self.left, self.top)
self.clear()
self._left += vector[0]
self._top += vector[1]
self._create()
if self.is_collide(field):
self.topleft = old_topleft
ret... | def move(self, field, vector):
u'\n '
if (not self.__is_rested):
old_topleft = (self.left, self.top)
self.clear()
self._left += vector[0]
self._top += vector[1]
self._create()
if self.is_collide(field):
self.topleft = old_topleft
ret... |
4e78b2ef6f2574112d36a65bdcd3e18d214b0e2d56dd6a273dcf2f0a422aab52 | def slide(self, field, is_right):
u'左右移動。\n '
self.__is_commanded = True
return (self.move(field, _const.RIGHT) if is_right else self.move(field, _const.LEFT)) | 左右移動。 | Source/pieces/falling.py | slide | LucXyMan/starseeker | 0 | python | def slide(self, field, is_right):
u'\n '
self.__is_commanded = True
return (self.move(field, _const.RIGHT) if is_right else self.move(field, _const.LEFT)) | def slide(self, field, is_right):
u'\n '
self.__is_commanded = True
return (self.move(field, _const.RIGHT) if is_right else self.move(field, _const.LEFT))<|docstring|>左右移動。<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.