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 |
|---|---|---|---|---|---|---|---|---|---|
6d3e131fdc5057dda4e6c398e217429128cb6c967684b892de338d14141b6742 | def _get_feedback_inner(self, state: np.ndarray, action: int, reward: float, next_state: np.ndarray, finished: bool):
'\n implement this function if you want to gather informations about your game\n :param state:\n :param action:\n :param reward:\n :param next_state:\n :par... | implement this function if you want to gather informations about your game
:param state:
:param action:
:param reward:
:param next_state:
:param finished:
:return: | checkers/agents/Agent.py | _get_feedback_inner | FelixKleineBoesing/CheckersAI | 1 | python | def _get_feedback_inner(self, state: np.ndarray, action: int, reward: float, next_state: np.ndarray, finished: bool):
'\n implement this function if you want to gather informations about your game\n :param state:\n :param action:\n :param reward:\n :param next_state:\n :par... | def _get_feedback_inner(self, state: np.ndarray, action: int, reward: float, next_state: np.ndarray, finished: bool):
'\n implement this function if you want to gather informations about your game\n :param state:\n :param action:\n :param reward:\n :param next_state:\n :par... |
0a8d1534a1307d704414125b2db952c2a54256e637ab531437544228fbce21ad | @abc.abstractmethod
def decision(self, state_space: np.ndarray, action_space: ActionSpace):
'\n this function must implement a decision based in the action_space and other delivered arguments\n return must be a dictionary with the following keys: "stone_id" and "move_index" which indicates\n th... | this function must implement a decision based in the action_space and other delivered arguments
return must be a dictionary with the following keys: "stone_id" and "move_index" which indicates
the stone and move that should be executed
:param action_space:
:return: np.array(X_From, Y_From, X_To, Y_To) | checkers/agents/Agent.py | decision | FelixKleineBoesing/CheckersAI | 1 | python | @abc.abstractmethod
def decision(self, state_space: np.ndarray, action_space: ActionSpace):
'\n this function must implement a decision based in the action_space and other delivered arguments\n return must be a dictionary with the following keys: "stone_id" and "move_index" which indicates\n th... | @abc.abstractmethod
def decision(self, state_space: np.ndarray, action_space: ActionSpace):
'\n this function must implement a decision based in the action_space and other delivered arguments\n return must be a dictionary with the following keys: "stone_id" and "move_index" which indicates\n th... |
6d0cea5ea2bc00367f5186d62b3e1127f424344be4b49fb6e2d67ff285f8e035 | def produce_scattertext_explorer(corpus, category, category_name=None, not_category_name=None, protocol='https', pmi_threshold_coefficient=DEFAULT_MINIMUM_TERM_FREQUENCY, minimum_term_frequency=DEFAULT_PMI_THRESHOLD_COEFFICIENT, minimum_not_category_term_frequency=0, max_terms=None, filter_unigrams=False, height_in_pix... | Returns html code of visualization.
Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
category_name : str
Name of category to use. E.g., "5-star reviews."
Optional, defaults to category name.
not_category_name : str
Na... | scattertext/__init__.py | produce_scattertext_explorer | JasonKessler/scattertext | 1,823 | python | def produce_scattertext_explorer(corpus, category, category_name=None, not_category_name=None, protocol='https', pmi_threshold_coefficient=DEFAULT_MINIMUM_TERM_FREQUENCY, minimum_term_frequency=DEFAULT_PMI_THRESHOLD_COEFFICIENT, minimum_not_category_term_frequency=0, max_terms=None, filter_unigrams=False, height_in_pix... | def produce_scattertext_explorer(corpus, category, category_name=None, not_category_name=None, protocol='https', pmi_threshold_coefficient=DEFAULT_MINIMUM_TERM_FREQUENCY, minimum_term_frequency=DEFAULT_PMI_THRESHOLD_COEFFICIENT, minimum_not_category_term_frequency=0, max_terms=None, filter_unigrams=False, height_in_pix... |
a7c967290024c048739dd95473368eecdb2f670f17d77c502f3c560f877016f4 | def produce_scattertext_html(term_doc_matrix, category, category_name, not_category_name, protocol='https', minimum_term_frequency=DEFAULT_MINIMUM_TERM_FREQUENCY, pmi_threshold_coefficient=DEFAULT_PMI_THRESHOLD_COEFFICIENT, max_terms=None, filter_unigrams=False, height_in_pixels=None, width_in_pixels=None, term_ranker=... | Returns html code of visualization.
Parameters
----------
term_doc_matrix : TermDocMatrix
Corpus to use
category : str
name of category column
category_name: str
name of category to mine for
not_category_name: str
name of everything that isn't in category
protocol : str
optional, used prototcol of ... | scattertext/__init__.py | produce_scattertext_html | JasonKessler/scattertext | 1,823 | python | def produce_scattertext_html(term_doc_matrix, category, category_name, not_category_name, protocol='https', minimum_term_frequency=DEFAULT_MINIMUM_TERM_FREQUENCY, pmi_threshold_coefficient=DEFAULT_PMI_THRESHOLD_COEFFICIENT, max_terms=None, filter_unigrams=False, height_in_pixels=None, width_in_pixels=None, term_ranker=... | def produce_scattertext_html(term_doc_matrix, category, category_name, not_category_name, protocol='https', minimum_term_frequency=DEFAULT_MINIMUM_TERM_FREQUENCY, pmi_threshold_coefficient=DEFAULT_PMI_THRESHOLD_COEFFICIENT, max_terms=None, filter_unigrams=False, height_in_pixels=None, width_in_pixels=None, term_ranker=... |
aacf3801ac081b1cc0251bbc08fe587a5c3f08db0e470c34ee5d13d4ff41bfbe | def get_semiotic_square_html(num_terms_semiotic_square, semiotic_square):
'\n\n :param num_terms_semiotic_square: int\n :param semiotic_square: SemioticSquare\n :return: str\n '
semiotic_square_html = None
if semiotic_square:
semiotic_square_viz = HTMLSemioticSquareViz(semiotic_square)
... | :param num_terms_semiotic_square: int
:param semiotic_square: SemioticSquare
:return: str | scattertext/__init__.py | get_semiotic_square_html | JasonKessler/scattertext | 1,823 | python | def get_semiotic_square_html(num_terms_semiotic_square, semiotic_square):
'\n\n :param num_terms_semiotic_square: int\n :param semiotic_square: SemioticSquare\n :return: str\n '
semiotic_square_html = None
if semiotic_square:
semiotic_square_viz = HTMLSemioticSquareViz(semiotic_square)
... | def get_semiotic_square_html(num_terms_semiotic_square, semiotic_square):
'\n\n :param num_terms_semiotic_square: int\n :param semiotic_square: SemioticSquare\n :return: str\n '
semiotic_square_html = None
if semiotic_square:
semiotic_square_viz = HTMLSemioticSquareViz(semiotic_square)
... |
291fa0eec5af1e76d416d826d90468f885bb7e7cf93e14dd80e1b817828fc2a4 | def word_similarity_explorer_gensim(corpus, category, target_term, category_name=None, not_category_name=None, word2vec=None, alpha=0.01, max_p_val=0.1, term_significance=None, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n ... | Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
category_name : str
Name of category to use. E.g., "5-star reviews."
not_category_name : str
Name of everything that isn't in category. E.g., "Below 5-star reviews".
target... | scattertext/__init__.py | word_similarity_explorer_gensim | JasonKessler/scattertext | 1,823 | python | def word_similarity_explorer_gensim(corpus, category, target_term, category_name=None, not_category_name=None, word2vec=None, alpha=0.01, max_p_val=0.1, term_significance=None, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n ... | def word_similarity_explorer_gensim(corpus, category, target_term, category_name=None, not_category_name=None, word2vec=None, alpha=0.01, max_p_val=0.1, term_significance=None, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n ... |
9c328fd966582a8a4e79104b9610a923b16c6fbaac40d81d0740614a77311b1b | def word_similarity_explorer(corpus, category, category_name, not_category_name, target_term, nlp=None, alpha=0.01, max_p_val=0.1, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n Name of category column as it appears in original data frame.\n ... | Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
category_name : str
Name of category to use. E.g., "5-star reviews."
not_category_name : str
Name of everything that isn't in category. E.g., "Below 5-star reviews".
target... | scattertext/__init__.py | word_similarity_explorer | JasonKessler/scattertext | 1,823 | python | def word_similarity_explorer(corpus, category, category_name, not_category_name, target_term, nlp=None, alpha=0.01, max_p_val=0.1, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n Name of category column as it appears in original data frame.\n ... | def word_similarity_explorer(corpus, category, category_name, not_category_name, target_term, nlp=None, alpha=0.01, max_p_val=0.1, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n Name of category column as it appears in original data frame.\n ... |
ced7867293f0cae8ba22766ee982a465a2c07b5431b64f29ab1fb6ecad88eae2 | def produce_frequency_explorer(corpus, category, category_name=None, not_category_name=None, term_ranker=termranking.AbsoluteFrequencyRanker, alpha=0.01, use_term_significance=False, term_scorer=None, not_categories=None, grey_threshold=0, y_axis_values=None, frequency_transform=(lambda x: scale((np.log(x) - np.log(1))... | Produces a Monroe et al. style visualization, with the x-axis being the log frequency
Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
category_name : str or None
Name of category to use. E.g., "5-star reviews."
Defaults ... | scattertext/__init__.py | produce_frequency_explorer | JasonKessler/scattertext | 1,823 | python | def produce_frequency_explorer(corpus, category, category_name=None, not_category_name=None, term_ranker=termranking.AbsoluteFrequencyRanker, alpha=0.01, use_term_significance=False, term_scorer=None, not_categories=None, grey_threshold=0, y_axis_values=None, frequency_transform=(lambda x: scale((np.log(x) - np.log(1))... | def produce_frequency_explorer(corpus, category, category_name=None, not_category_name=None, term_ranker=termranking.AbsoluteFrequencyRanker, alpha=0.01, use_term_significance=False, term_scorer=None, not_categories=None, grey_threshold=0, y_axis_values=None, frequency_transform=(lambda x: scale((np.log(x) - np.log(1))... |
573bfc02faca91fe4799d1319bf7247bd9826ac829f031cee9d2e92965a82918 | def produce_semiotic_square_explorer(semiotic_square, x_label, y_label, category_name=None, not_category_name=None, neutral_category_name=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_zero_mean, **kwargs):
'... | Produces a semiotic square visualization.
Parameters
----------
semiotic_square : SemioticSquare
The basis of the visualization
x_label : str
The x-axis label in the scatter plot. Relationship between `category_a` and `category_b`.
y_label
The y-axis label in the scatter plot. Relationship neutral term a... | scattertext/__init__.py | produce_semiotic_square_explorer | JasonKessler/scattertext | 1,823 | python | def produce_semiotic_square_explorer(semiotic_square, x_label, y_label, category_name=None, not_category_name=None, neutral_category_name=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_zero_mean, **kwargs):
'... | def produce_semiotic_square_explorer(semiotic_square, x_label, y_label, category_name=None, not_category_name=None, neutral_category_name=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_zero_mean, **kwargs):
'... |
37156dd7318bd06ce18a3e4025f0690de906b8b8e8be661eb3a332d6ce452dbd | def produce_four_square_explorer(four_square, x_label=None, y_label=None, a_category_name=None, b_category_name=None, not_a_category_name=None, not_b_category_name=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_z... | Produces a semiotic square visualization.
Parameters
----------
four_square : FourSquare
The basis of the visualization
x_label : str
The x-axis label in the scatter plot. Relationship between `category_a` and `category_b`.
y_label
The y-axis label in the scatter plot. Relationship neutral term and compl... | scattertext/__init__.py | produce_four_square_explorer | JasonKessler/scattertext | 1,823 | python | def produce_four_square_explorer(four_square, x_label=None, y_label=None, a_category_name=None, b_category_name=None, not_a_category_name=None, not_b_category_name=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_z... | def produce_four_square_explorer(four_square, x_label=None, y_label=None, a_category_name=None, b_category_name=None, not_a_category_name=None, not_b_category_name=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_z... |
64223550e6f20db44e98ca384c939517d4771af97ba8eeac05f33beaf56f2527 | def produce_four_square_axes_explorer(four_square_axes, x_label=None, y_label=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_zero_mean, **kwargs):
'\n Produces a semiotic square visualization.\n\n Param... | Produces a semiotic square visualization.
Parameters
----------
four_square : FourSquareAxes
The basis of the visualization
x_label : str
The x-axis label in the scatter plot. Relationship between `category_a` and `category_b`.
y_label
The y-axis label in the scatter plot. Relationship neutral term and c... | scattertext/__init__.py | produce_four_square_axes_explorer | JasonKessler/scattertext | 1,823 | python | def produce_four_square_axes_explorer(four_square_axes, x_label=None, y_label=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_zero_mean, **kwargs):
'\n Produces a semiotic square visualization.\n\n Param... | def produce_four_square_axes_explorer(four_square_axes, x_label=None, y_label=None, num_terms_semiotic_square=None, get_tooltip_content=None, x_axis_values=None, y_axis_values=None, color_func=None, axis_scaler=scale_neg_1_to_1_with_zero_mean, **kwargs):
'\n Produces a semiotic square visualization.\n\n Param... |
c67037e1966c0df8a7a863cf0cd1a9649ef9969c3d20b060e3462e47e63965a1 | def produce_projection_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, term_acceptance_re=re.compile('[a-z]{3,}'), show_axes=False, **kwargs):
"\n Parameters\n ----------\n corpus : ParsedCorpus\n It is highly recommended to use a stoplisted, unigram corpus-- ... | Parameters
----------
corpus : ParsedCorpus
It is highly recommended to use a stoplisted, unigram corpus-- `corpus.get_stoplisted_unigram_corpus()`
category : str
word2vec_model : Word2Vec
A gensim word2vec model. A default model will be used instead. See Word2VecFromParsedCorpus for the default
model.
pro... | scattertext/__init__.py | produce_projection_explorer | JasonKessler/scattertext | 1,823 | python | def produce_projection_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, term_acceptance_re=re.compile('[a-z]{3,}'), show_axes=False, **kwargs):
"\n Parameters\n ----------\n corpus : ParsedCorpus\n It is highly recommended to use a stoplisted, unigram corpus-- ... | def produce_projection_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, term_acceptance_re=re.compile('[a-z]{3,}'), show_axes=False, **kwargs):
"\n Parameters\n ----------\n corpus : ParsedCorpus\n It is highly recommended to use a stoplisted, unigram corpus-- ... |
d4685dd38f0716bab30e6f9d3c748627a6c4de990d95572a25b06ace4bd14935 | def produce_pca_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, projection=None, term_acceptance_re=re.compile('[a-z]{3,}'), x_dim=0, y_dim=1, scaler=scale, show_axes=False, show_dimensions_on_tooltip=True, x_label='', y_label='', **kwargs):
"\n Parameters\n ----------\... | Parameters
----------
corpus : ParsedCorpus
It is highly recommended to use a stoplisted, unigram corpus-- `corpus.get_stoplisted_unigram_corpus()`
category : str
word2vec_model : Word2Vec
A gensim word2vec model. A default model will be used instead. See Word2VecFromParsedCorpus for the default
model.
pro... | scattertext/__init__.py | produce_pca_explorer | JasonKessler/scattertext | 1,823 | python | def produce_pca_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, projection=None, term_acceptance_re=re.compile('[a-z]{3,}'), x_dim=0, y_dim=1, scaler=scale, show_axes=False, show_dimensions_on_tooltip=True, x_label=, y_label=, **kwargs):
"\n Parameters\n ----------\n ... | def produce_pca_explorer(corpus, category, word2vec_model=None, projection_model=None, embeddings=None, projection=None, term_acceptance_re=re.compile('[a-z]{3,}'), x_dim=0, y_dim=1, scaler=scale, show_axes=False, show_dimensions_on_tooltip=True, x_label=, y_label=, **kwargs):
"\n Parameters\n ----------\n ... |
e2021d9654767be892baf9b5aab4976b7e22f63367a8286c0ef3fa69dc00ac8e | def produce_characteristic_explorer(corpus, category, category_name=None, not_category_name=None, not_categories=None, characteristic_scorer=DenseRankCharacteristicness(), term_ranker=termranking.AbsoluteFrequencyRanker, term_scorer=RankDifference(), x_label='Characteristic to Corpus', y_label=None, y_axis_labels=None,... | Parameters
----------
corpus : Corpus
It is highly recommended to use a stoplisted, unigram corpus-- `corpus.get_stoplisted_unigram_corpus()`
category : str
category_name : str
not_category_name : str
not_categories : list
characteristic_scorer : CharacteristicScorer
term_ranker
term_scorer
term_acceptance_re : SRE... | scattertext/__init__.py | produce_characteristic_explorer | JasonKessler/scattertext | 1,823 | python | def produce_characteristic_explorer(corpus, category, category_name=None, not_category_name=None, not_categories=None, characteristic_scorer=DenseRankCharacteristicness(), term_ranker=termranking.AbsoluteFrequencyRanker, term_scorer=RankDifference(), x_label='Characteristic to Corpus', y_label=None, y_axis_labels=None,... | def produce_characteristic_explorer(corpus, category, category_name=None, not_category_name=None, not_categories=None, characteristic_scorer=DenseRankCharacteristicness(), term_ranker=termranking.AbsoluteFrequencyRanker, term_scorer=RankDifference(), x_label='Characteristic to Corpus', y_label=None, y_axis_labels=None,... |
2cd27fe9bf6f230e49845ac0136b6f22496fa71f5bde5de1b313855975c32bd7 | def sparse_explorer(corpus, category, scores, category_name=None, not_category_name=None, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n Name of category column as it appears in original data frame.\n category_name : str\n Name of cat... | Parameters
----------
corpus : Corpus
Corpus to use.
category : str
Name of category column as it appears in original data frame.
category_name : str
Name of category to use. E.g., "5-star reviews."
not_category_name : str
Name of everything that isn't in category. E.g., "Below 5-star reviews".
scores... | scattertext/__init__.py | sparse_explorer | JasonKessler/scattertext | 1,823 | python | def sparse_explorer(corpus, category, scores, category_name=None, not_category_name=None, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n Name of category column as it appears in original data frame.\n category_name : str\n Name of cat... | def sparse_explorer(corpus, category, scores, category_name=None, not_category_name=None, **kwargs):
'\n Parameters\n ----------\n corpus : Corpus\n Corpus to use.\n category : str\n Name of category column as it appears in original data frame.\n category_name : str\n Name of cat... |
06d36e8ad97bf554053debc968bf6f74320149612cf99df61dec0d7fe01d4d38 | def produce_two_axis_plot(corpus, x_score_df, y_score_df, x_label, y_label, statistic_column='cohens_d', p_value_column='cohens_d_p', statistic_name='d', use_non_text_features=False, pick_color=pick_color, axis_scaler=scale_neg_1_to_1_with_zero_mean, distance_measure=EuclideanDistance, semiotic_square_labels=None, x_to... | :param corpus: Corpus
:param x_score_df: pd.DataFrame, contains effect_size_column, p_value_column. outputted by CohensD
:param y_score_df: pd.DataFrame, contains effect_size_column, p_value_column. outputted by CohensD
:param x_label: str
:param y_label: str
:param statistic_column: str, column in x_score_df, y_score_... | scattertext/__init__.py | produce_two_axis_plot | JasonKessler/scattertext | 1,823 | python | def produce_two_axis_plot(corpus, x_score_df, y_score_df, x_label, y_label, statistic_column='cohens_d', p_value_column='cohens_d_p', statistic_name='d', use_non_text_features=False, pick_color=pick_color, axis_scaler=scale_neg_1_to_1_with_zero_mean, distance_measure=EuclideanDistance, semiotic_square_labels=None, x_to... | def produce_two_axis_plot(corpus, x_score_df, y_score_df, x_label, y_label, statistic_column='cohens_d', p_value_column='cohens_d_p', statistic_name='d', use_non_text_features=False, pick_color=pick_color, axis_scaler=scale_neg_1_to_1_with_zero_mean, distance_measure=EuclideanDistance, semiotic_square_labels=None, x_to... |
845538801cacea268aeec1f856af913e8c1ccc646a22a1cf0ad3b2bd613b81b3 | def produce_scattertext_digraph(df, text_col, source_col, dest_col, source_name='Source', dest_name='Destination', graph_width=500, graph_height=500, metadata_func=None, enable_pan_and_zoom=True, engine='dot', graph_params=None, node_params=None, **kwargs):
'\n\n :param df: pd.DataFrame\n :param text_col: str... | :param df: pd.DataFrame
:param text_col: str
:param source_col: str
:param dest_col: str
:param source_name: str
:param dest_name: str
:param graph_width: int
:param graph_height: int
:param metadata_func: lambda
:param enable_pan_and_zoom: bool
:param engine: str, The graphviz engine (e.g., dot or neat)
:param graph_p... | scattertext/__init__.py | produce_scattertext_digraph | JasonKessler/scattertext | 1,823 | python | def produce_scattertext_digraph(df, text_col, source_col, dest_col, source_name='Source', dest_name='Destination', graph_width=500, graph_height=500, metadata_func=None, enable_pan_and_zoom=True, engine='dot', graph_params=None, node_params=None, **kwargs):
'\n\n :param df: pd.DataFrame\n :param text_col: str... | def produce_scattertext_digraph(df, text_col, source_col, dest_col, source_name='Source', dest_name='Destination', graph_width=500, graph_height=500, metadata_func=None, enable_pan_and_zoom=True, engine='dot', graph_params=None, node_params=None, **kwargs):
'\n\n :param df: pd.DataFrame\n :param text_col: str... |
6ca7136dc4d4596b06a55dded04f5a111e1720c3eafc260e0a1e0b790056f966 | def produce_scattertext_table(corpus, num_rows=10, use_non_text_features=False, plot_width=500, plot_height=700, category_order=None, **kwargs):
'\n\n :param df: pd.DataFrame\n :param text_col: str\n :param source_col: str\n :param dest_col: str\n :param source_name: str\n :param dest_name: str\n ... | :param df: pd.DataFrame
:param text_col: str
:param source_col: str
:param dest_col: str
:param source_name: str
:param dest_name: str
:param plot_width: int
:param plot_height: int
:param enable_pan_and_zoom: bool
:param engine: str, The graphviz engine (e.g., dot or neat)
:param graph_params dict or None, graph param... | scattertext/__init__.py | produce_scattertext_table | JasonKessler/scattertext | 1,823 | python | def produce_scattertext_table(corpus, num_rows=10, use_non_text_features=False, plot_width=500, plot_height=700, category_order=None, **kwargs):
'\n\n :param df: pd.DataFrame\n :param text_col: str\n :param source_col: str\n :param dest_col: str\n :param source_name: str\n :param dest_name: str\n ... | def produce_scattertext_table(corpus, num_rows=10, use_non_text_features=False, plot_width=500, plot_height=700, category_order=None, **kwargs):
'\n\n :param df: pd.DataFrame\n :param text_col: str\n :param source_col: str\n :param dest_col: str\n :param source_name: str\n :param dest_name: str\n ... |
6fa6cf4900bed0d3449062b30e52b009c8fa015a0821fc9977a62aa904c5c436 | @subcommand()
def cmd_init(args):
'Initialize the papers directory (first use only).'
with Papers(setup=True) as p:
print('Initialized {} as Papers directory'.format(p.base_dir)) | Initialize the papers directory (first use only). | papers.py | cmd_init | FilippoBiga/Papers | 1 | python | @subcommand()
def cmd_init(args):
with Papers(setup=True) as p:
print('Initialized {} as Papers directory'.format(p.base_dir)) | @subcommand()
def cmd_init(args):
with Papers(setup=True) as p:
print('Initialized {} as Papers directory'.format(p.base_dir))<|docstring|>Initialize the papers directory (first use only).<|endoftext|> |
7ca7e810de2443da5c1fe414b324ab33ccd728163b8be0a4b818bb577400c5a4 | @subcommand([arg('-f', '--file', required=True, help='The file you want to import.'), arg('-t', '--title', required=True, help='The title of the paper being imported.'), arg('-k', '--keywords', help='Comma-separated list of keywords')])
def cmd_import(args):
'Import a new paper.'
keywords = []
if (args.keyw... | Import a new paper. | papers.py | cmd_import | FilippoBiga/Papers | 1 | python | @subcommand([arg('-f', '--file', required=True, help='The file you want to import.'), arg('-t', '--title', required=True, help='The title of the paper being imported.'), arg('-k', '--keywords', help='Comma-separated list of keywords')])
def cmd_import(args):
keywords = []
if (args.keywords is not None):
... | @subcommand([arg('-f', '--file', required=True, help='The file you want to import.'), arg('-t', '--title', required=True, help='The title of the paper being imported.'), arg('-k', '--keywords', help='Comma-separated list of keywords')])
def cmd_import(args):
keywords = []
if (args.keywords is not None):
... |
9823d4024369fefa210518fd64db581f2979aa4a14dca443e7b5f688a0d24e68 | @subcommand([arg('-p', '--paper_id', required=True, help='The identifier of the paper to delete.')])
def cmd_delete(args):
'Delete a paper and all the data related to it.'
with Papers() as p:
p.delete(args.paper_id)
print('Removed {}'.format(args.paper_id)) | Delete a paper and all the data related to it. | papers.py | cmd_delete | FilippoBiga/Papers | 1 | python | @subcommand([arg('-p', '--paper_id', required=True, help='The identifier of the paper to delete.')])
def cmd_delete(args):
with Papers() as p:
p.delete(args.paper_id)
print('Removed {}'.format(args.paper_id)) | @subcommand([arg('-p', '--paper_id', required=True, help='The identifier of the paper to delete.')])
def cmd_delete(args):
with Papers() as p:
p.delete(args.paper_id)
print('Removed {}'.format(args.paper_id))<|docstring|>Delete a paper and all the data related to it.<|endoftext|> |
7c9ba77aad7686e622559fbd36d00901b17fe42a57089c34e44e4aea48098f9d | @subcommand([arg('-s', '--show-status', required=False, action='store_true', help='Show status of each paper.'), arg('-d', '--show-date', required=False, action='store_true', help='Show date of each paper.')])
def cmd_list(args):
'List papers.'
with Papers() as p:
for paper in p.list():
prin... | List papers. | papers.py | cmd_list | FilippoBiga/Papers | 1 | python | @subcommand([arg('-s', '--show-status', required=False, action='store_true', help='Show status of each paper.'), arg('-d', '--show-date', required=False, action='store_true', help='Show date of each paper.')])
def cmd_list(args):
with Papers() as p:
for paper in p.list():
print(format_entry... | @subcommand([arg('-s', '--show-status', required=False, action='store_true', help='Show status of each paper.'), arg('-d', '--show-date', required=False, action='store_true', help='Show date of each paper.')])
def cmd_list(args):
with Papers() as p:
for paper in p.list():
print(format_entry... |
e3867a5eca910b5b68ef0884b38f9957b274c116ee2976be0e1fa9a546981287 | @subcommand([arg('-s', '--show-status', required=False, action='store_true', help='Show status of the paper.'), arg('-d', '--show-date', required=False, action='store_true', help='Show date of the paper.')])
def cmd_last(args):
'Retrieve the last added paper.'
with Papers() as p:
print(format_entry(p.la... | Retrieve the last added paper. | papers.py | cmd_last | FilippoBiga/Papers | 1 | python | @subcommand([arg('-s', '--show-status', required=False, action='store_true', help='Show status of the paper.'), arg('-d', '--show-date', required=False, action='store_true', help='Show date of the paper.')])
def cmd_last(args):
with Papers() as p:
print(format_entry(p.last(), status=args.show_status, d... | @subcommand([arg('-s', '--show-status', required=False, action='store_true', help='Show status of the paper.'), arg('-d', '--show-date', required=False, action='store_true', help='Show date of the paper.')])
def cmd_last(args):
with Papers() as p:
print(format_entry(p.last(), status=args.show_status, d... |
68a930d78b747689aa919c6c9ffc5562ef223a4ce8c4c7e6293630fc9695915c | @subcommand([arg('-s', '--status', required=True, choices=['unread', 'wip', 'skimmed', 'read'], help='Read status of the paper.'), arg('-p', '--paper_id', required=True, help='The identifier of the paper to update.')])
def cmd_mark(args):
'Set the status of a paper.'
with Papers() as p:
p.mark(args.stat... | Set the status of a paper. | papers.py | cmd_mark | FilippoBiga/Papers | 1 | python | @subcommand([arg('-s', '--status', required=True, choices=['unread', 'wip', 'skimmed', 'read'], help='Read status of the paper.'), arg('-p', '--paper_id', required=True, help='The identifier of the paper to update.')])
def cmd_mark(args):
with Papers() as p:
p.mark(args.status, args.paper_id)
p... | @subcommand([arg('-s', '--status', required=True, choices=['unread', 'wip', 'skimmed', 'read'], help='Read status of the paper.'), arg('-p', '--paper_id', required=True, help='The identifier of the paper to update.')])
def cmd_mark(args):
with Papers() as p:
p.mark(args.status, args.paper_id)
p... |
8a7b30f303e2c8ee248ba983be3bfb65ae2e84a110fa1f748d445e9341625a36 | @subcommand([arg('-a', '--add', help='Associate a keyword to a paper.'), arg('-r', '--remove', help='Remove a keyword from a paper.'), arg('-l', '--list', action='store_true', help='List all the keywords associated to a paper.'), arg('-p', '--paper_id', required=True, help='The identifier of the paper to update.')])
de... | Manage keywords associated with a paper. | papers.py | cmd_word | FilippoBiga/Papers | 1 | python | @subcommand([arg('-a', '--add', help='Associate a keyword to a paper.'), arg('-r', '--remove', help='Remove a keyword from a paper.'), arg('-l', '--list', action='store_true', help='List all the keywords associated to a paper.'), arg('-p', '--paper_id', required=True, help='The identifier of the paper to update.')])
de... | @subcommand([arg('-a', '--add', help='Associate a keyword to a paper.'), arg('-r', '--remove', help='Remove a keyword from a paper.'), arg('-l', '--list', action='store_true', help='List all the keywords associated to a paper.'), arg('-p', '--paper_id', required=True, help='The identifier of the paper to update.')])
de... |
2a147d3f007379b7871667de976eff299978fb2627ca837bdc937247a02b4ca8 | @subcommand([arg('-k', '--keyword', help='Search on keywords.'), arg('-t', '--title', help='Search on paper titles')])
def cmd_search(args):
'Search through keywords and titles'
with Papers() as p:
for (paper, keywords) in p.filter(args.title, args.keyword):
title = paper.title
i... | Search through keywords and titles | papers.py | cmd_search | FilippoBiga/Papers | 1 | python | @subcommand([arg('-k', '--keyword', help='Search on keywords.'), arg('-t', '--title', help='Search on paper titles')])
def cmd_search(args):
with Papers() as p:
for (paper, keywords) in p.filter(args.title, args.keyword):
title = paper.title
if (args.keyword is not None):
... | @subcommand([arg('-k', '--keyword', help='Search on keywords.'), arg('-t', '--title', help='Search on paper titles')])
def cmd_search(args):
with Papers() as p:
for (paper, keywords) in p.filter(args.title, args.keyword):
title = paper.title
if (args.keyword is not None):
... |
031133afb11cf3a78b00daf40d7b2e1c2cc9f2b091e704fced2f9e3f9ad07c95 | @subcommand([arg('-p', '--paper_id', required=True, help='The identifier of the paper to open.')])
def cmd_open(args):
'Open the directory containing the given paper.'
with Papers() as p:
p.open(args.paper_id) | Open the directory containing the given paper. | papers.py | cmd_open | FilippoBiga/Papers | 1 | python | @subcommand([arg('-p', '--paper_id', required=True, help='The identifier of the paper to open.')])
def cmd_open(args):
with Papers() as p:
p.open(args.paper_id) | @subcommand([arg('-p', '--paper_id', required=True, help='The identifier of the paper to open.')])
def cmd_open(args):
with Papers() as p:
p.open(args.paper_id)<|docstring|>Open the directory containing the given paper.<|endoftext|> |
d5cd94d2dd61c3df8a05af713485cc927a3ac01d1c538dc61983958b18e3e9b2 | @staticmethod
def wrap(s, c):
' Wrap s with color c and the terminator '
return '{}{}{}'.format(c, s, Color._ENDC) | Wrap s with color c and the terminator | papers.py | wrap | FilippoBiga/Papers | 1 | python | @staticmethod
def wrap(s, c):
' '
return '{}{}{}'.format(c, s, Color._ENDC) | @staticmethod
def wrap(s, c):
' '
return '{}{}{}'.format(c, s, Color._ENDC)<|docstring|>Wrap s with color c and the terminator<|endoftext|> |
73e18e850bd617377698b94cbcd58c705378fbbeffe60d3b9e6eed4b7194ea4e | @staticmethod
def highlight_matches(s, match):
' Highlight all the occurrences of match in s with the MATCHING color '
pattern = re.compile(match, re.IGNORECASE)
for m in re.finditer(pattern, s):
s = ((s[0:m.start()] + Color.matching(s[m.start():m.end()])) + s[m.end():])
return s | Highlight all the occurrences of match in s with the MATCHING color | papers.py | highlight_matches | FilippoBiga/Papers | 1 | python | @staticmethod
def highlight_matches(s, match):
' '
pattern = re.compile(match, re.IGNORECASE)
for m in re.finditer(pattern, s):
s = ((s[0:m.start()] + Color.matching(s[m.start():m.end()])) + s[m.end():])
return s | @staticmethod
def highlight_matches(s, match):
' '
pattern = re.compile(match, re.IGNORECASE)
for m in re.finditer(pattern, s):
s = ((s[0:m.start()] + Color.matching(s[m.start():m.end()])) + s[m.end():])
return s<|docstring|>Highlight all the occurrences of match in s with the MATCHING color<|e... |
fe18d402a829f24a498a4715907946f5bc04edc718fdc030fbf05e7d3c87d6f0 | def translate_last(method):
"\n\t\tConvert 'last' to the pid of the last added paper.\n\t\tDecorator to be applied to every method that takes a paper id (as a last argument)\n\t\t"
def wrapped(instance, *args):
pid_arg = args[(- 1)]
arg_list = list(args)
arg_list[(- 1)] = (instance.last... | Convert 'last' to the pid of the last added paper.
Decorator to be applied to every method that takes a paper id (as a last argument) | papers.py | translate_last | FilippoBiga/Papers | 1 | python | def translate_last(method):
"\n\t\tConvert 'last' to the pid of the last added paper.\n\t\tDecorator to be applied to every method that takes a paper id (as a last argument)\n\t\t"
def wrapped(instance, *args):
pid_arg = args[(- 1)]
arg_list = list(args)
arg_list[(- 1)] = (instance.last... | def translate_last(method):
"\n\t\tConvert 'last' to the pid of the last added paper.\n\t\tDecorator to be applied to every method that takes a paper id (as a last argument)\n\t\t"
def wrapped(instance, *args):
pid_arg = args[(- 1)]
arg_list = list(args)
arg_list[(- 1)] = (instance.last... |
f2ee45e42943c8e4230a5fb401292587fc1bab3da9084ea1b07dfaf43c705b70 | def last_paper(self):
' Retrieve the last added paper '
try:
self.cur.execute('\n\t\t\t\tSELECT * FROM papers\n\t\t\t\tORDER BY date_added DESC\n\t\t\t')
return Database.Entry(*self.cur.fetchone())
except sqlite3.Error as e:
self._err('Error retrieving last paper', e) | Retrieve the last added paper | papers.py | last_paper | FilippoBiga/Papers | 1 | python | def last_paper(self):
' '
try:
self.cur.execute('\n\t\t\t\tSELECT * FROM papers\n\t\t\t\tORDER BY date_added DESC\n\t\t\t')
return Database.Entry(*self.cur.fetchone())
except sqlite3.Error as e:
self._err('Error retrieving last paper', e) | def last_paper(self):
' '
try:
self.cur.execute('\n\t\t\t\tSELECT * FROM papers\n\t\t\t\tORDER BY date_added DESC\n\t\t\t')
return Database.Entry(*self.cur.fetchone())
except sqlite3.Error as e:
self._err('Error retrieving last paper', e)<|docstring|>Retrieve the last added paper<|e... |
1a9ce711d8d0971015c585875298596784ddb264754737f61268a9adcd5ce540 | @translate_last
def get_keywords(self, pid):
' Retrieve all the keywords associated to a certain paper '
try:
self.cur.execute('\n\t\t\t\tSELECT word FROM keywords\n\t\t\t\tWHERE pid = ?\n\t\t\t', (pid,))
return list(map((lambda x: x[0]), self.cur.fetchall()))
except sqlite3.Error as e:
... | Retrieve all the keywords associated to a certain paper | papers.py | get_keywords | FilippoBiga/Papers | 1 | python | @translate_last
def get_keywords(self, pid):
' '
try:
self.cur.execute('\n\t\t\t\tSELECT word FROM keywords\n\t\t\t\tWHERE pid = ?\n\t\t\t', (pid,))
return list(map((lambda x: x[0]), self.cur.fetchall()))
except sqlite3.Error as e:
self._err('Error retrieving keywords', e) | @translate_last
def get_keywords(self, pid):
' '
try:
self.cur.execute('\n\t\t\t\tSELECT word FROM keywords\n\t\t\t\tWHERE pid = ?\n\t\t\t', (pid,))
return list(map((lambda x: x[0]), self.cur.fetchall()))
except sqlite3.Error as e:
self._err('Error retrieving keywords', e)<|docstrin... |
0cd3498f353fd275baad8b06519790213fca9e0e06cc4422e3e1c9a951075052 | def insert(self, title, relpath, keywords):
' Insert a paper entry into the database (and possibly the keywords) '
try:
self.cur.execute('\n\t\t\t\tINSERT INTO papers(title, relpath)\n\t\t\t\tVALUES(?,?)', (title, relpath))
pid = self.last_paper().id
for kword in keywords:
se... | Insert a paper entry into the database (and possibly the keywords) | papers.py | insert | FilippoBiga/Papers | 1 | python | def insert(self, title, relpath, keywords):
' '
try:
self.cur.execute('\n\t\t\t\tINSERT INTO papers(title, relpath)\n\t\t\t\tVALUES(?,?)', (title, relpath))
pid = self.last_paper().id
for kword in keywords:
self.add_keyword(kword, pid)
self.conn.commit()
except s... | def insert(self, title, relpath, keywords):
' '
try:
self.cur.execute('\n\t\t\t\tINSERT INTO papers(title, relpath)\n\t\t\t\tVALUES(?,?)', (title, relpath))
pid = self.last_paper().id
for kword in keywords:
self.add_keyword(kword, pid)
self.conn.commit()
except s... |
1afdfef9f165ae684c82aff93a9183addf6b8458f3c61e1657877b4d8abea4fe | @translate_last
def remove(self, pid):
' Remove a paper from the DB '
try:
found = self.find_paper(pid)
relpath = found.relpath
self.cur.execute('DELETE FROM papers WHERE id = ?', (pid,))
self.conn.commit()
return relpath
except sqlite3.Error as e:
self._err('... | Remove a paper from the DB | papers.py | remove | FilippoBiga/Papers | 1 | python | @translate_last
def remove(self, pid):
' '
try:
found = self.find_paper(pid)
relpath = found.relpath
self.cur.execute('DELETE FROM papers WHERE id = ?', (pid,))
self.conn.commit()
return relpath
except sqlite3.Error as e:
self._err('Error deleting paper', e) | @translate_last
def remove(self, pid):
' '
try:
found = self.find_paper(pid)
relpath = found.relpath
self.cur.execute('DELETE FROM papers WHERE id = ?', (pid,))
self.conn.commit()
return relpath
except sqlite3.Error as e:
self._err('Error deleting paper', e)<... |
14fc74a81b4112b7cb90370279f242458ea2c7fa69b07d725495373f4514e054 | def search(self, title=None, keyword=None):
'\n\t\tSearch the papers, expose an iterator.\n\t\tNote that if both title and keyword are None, all the papers will match.\n\t\t(This is indeed how Papers.list() is implemented)\n\t\t'
def _match(etitle, ekwds):
keyword_match = False
title_match = Fa... | Search the papers, expose an iterator.
Note that if both title and keyword are None, all the papers will match.
(This is indeed how Papers.list() is implemented) | papers.py | search | FilippoBiga/Papers | 1 | python | def search(self, title=None, keyword=None):
'\n\t\tSearch the papers, expose an iterator.\n\t\tNote that if both title and keyword are None, all the papers will match.\n\t\t(This is indeed how Papers.list() is implemented)\n\t\t'
def _match(etitle, ekwds):
keyword_match = False
title_match = Fa... | def search(self, title=None, keyword=None):
'\n\t\tSearch the papers, expose an iterator.\n\t\tNote that if both title and keyword are None, all the papers will match.\n\t\t(This is indeed how Papers.list() is implemented)\n\t\t'
def _match(etitle, ekwds):
keyword_match = False
title_match = Fa... |
e5288d986fbb604dc02ede2890e5c2a867229f7a744e808be913eefaac7b8dfd | @translate_last
def update_status(self, status, pid):
' Update the reading status of a paper '
try:
code = Status(status).code
self.cur.execute('\n\t\t\t\tUPDATE papers\n\t\t\t\tSET status = ?\n\t\t\t\tWHERE id = ?\n\t\t\t', (code, pid))
self.conn.commit()
except sqlite3.Error as e:
... | Update the reading status of a paper | papers.py | update_status | FilippoBiga/Papers | 1 | python | @translate_last
def update_status(self, status, pid):
' '
try:
code = Status(status).code
self.cur.execute('\n\t\t\t\tUPDATE papers\n\t\t\t\tSET status = ?\n\t\t\t\tWHERE id = ?\n\t\t\t', (code, pid))
self.conn.commit()
except sqlite3.Error as e:
self._err('Error updating pa... | @translate_last
def update_status(self, status, pid):
' '
try:
code = Status(status).code
self.cur.execute('\n\t\t\t\tUPDATE papers\n\t\t\t\tSET status = ?\n\t\t\t\tWHERE id = ?\n\t\t\t', (code, pid))
self.conn.commit()
except sqlite3.Error as e:
self._err('Error updating pa... |
21ce652fa8f253bc6294599cff8037d36b0fa97d280a5dc3ed74037027bd7e10 | def paper_subdir(self, ntitle):
' Subdirectory of a paper given the normalized title '
return os.path.join(self.directory, ntitle) | Subdirectory of a paper given the normalized title | papers.py | paper_subdir | FilippoBiga/Papers | 1 | python | def paper_subdir(self, ntitle):
' '
return os.path.join(self.directory, ntitle) | def paper_subdir(self, ntitle):
' '
return os.path.join(self.directory, ntitle)<|docstring|>Subdirectory of a paper given the normalized title<|endoftext|> |
f422fb6caa4ffbc8bfa835f47451b840e59e0d25b0f1e27fe0af6ab7f915703b | def add(self, file, title):
' Import a paper (create subdir, copy file, create notes.txt) '
normalized_title = title.replace(' ', '_').lower()
paper_dir = self.paper_subdir(normalized_title)
assert (not os.path.exists(paper_dir)), Color.fail('{} already exists'.format(paper_dir))
os.makedirs(paper_d... | Import a paper (create subdir, copy file, create notes.txt) | papers.py | add | FilippoBiga/Papers | 1 | python | def add(self, file, title):
' '
normalized_title = title.replace(' ', '_').lower()
paper_dir = self.paper_subdir(normalized_title)
assert (not os.path.exists(paper_dir)), Color.fail('{} already exists'.format(paper_dir))
os.makedirs(paper_dir)
shutil.copy2(file, paper_dir)
open(os.path.join... | def add(self, file, title):
' '
normalized_title = title.replace(' ', '_').lower()
paper_dir = self.paper_subdir(normalized_title)
assert (not os.path.exists(paper_dir)), Color.fail('{} already exists'.format(paper_dir))
os.makedirs(paper_dir)
shutil.copy2(file, paper_dir)
open(os.path.join... |
b1436ebb4ddc18c9d52b36f154fe34d712c5487338d31222c80813947f125f2d | def add(self, file, title, keywords):
' Add a paper '
assert os.path.exists(file), Color.fail('{} does not exist'.format(file))
relpath = self.storage.add(file, title)
self.db.insert(title, relpath, keywords) | Add a paper | papers.py | add | FilippoBiga/Papers | 1 | python | def add(self, file, title, keywords):
' '
assert os.path.exists(file), Color.fail('{} does not exist'.format(file))
relpath = self.storage.add(file, title)
self.db.insert(title, relpath, keywords) | def add(self, file, title, keywords):
' '
assert os.path.exists(file), Color.fail('{} does not exist'.format(file))
relpath = self.storage.add(file, title)
self.db.insert(title, relpath, keywords)<|docstring|>Add a paper<|endoftext|> |
167cf3f22ae5d79e02ed62eebb246aa68ded4b15e14dec046929b6b95fde2fe8 | def delete(self, pid):
' Delete a paper '
relpath = self.db.remove(pid)
self.storage.delete(relpath) | Delete a paper | papers.py | delete | FilippoBiga/Papers | 1 | python | def delete(self, pid):
' '
relpath = self.db.remove(pid)
self.storage.delete(relpath) | def delete(self, pid):
' '
relpath = self.db.remove(pid)
self.storage.delete(relpath)<|docstring|>Delete a paper<|endoftext|> |
5127ac9d1466a8d7bbf9bb6a4b0b7dc93c5e1e38276d104bb7e0615b2d703c9f | def list(self):
' List all the papers '
result = []
for (entry, keywords) in self.db.search(title=None, keyword=None):
result.append(entry)
return result | List all the papers | papers.py | list | FilippoBiga/Papers | 1 | python | def list(self):
' '
result = []
for (entry, keywords) in self.db.search(title=None, keyword=None):
result.append(entry)
return result | def list(self):
' '
result = []
for (entry, keywords) in self.db.search(title=None, keyword=None):
result.append(entry)
return result<|docstring|>List all the papers<|endoftext|> |
be194935a6338b85a60ff3d8378deeb499204238f54693079901ee4fa9d957a6 | def filter(self, title=None, keyword=None):
' Filter the papers based on title and keyword '
assert ((title is not None) or (keyword is not None)), Color.fail('Either title or keyword should not be empty')
return self.db.search(title=title, keyword=keyword) | Filter the papers based on title and keyword | papers.py | filter | FilippoBiga/Papers | 1 | python | def filter(self, title=None, keyword=None):
' '
assert ((title is not None) or (keyword is not None)), Color.fail('Either title or keyword should not be empty')
return self.db.search(title=title, keyword=keyword) | def filter(self, title=None, keyword=None):
' '
assert ((title is not None) or (keyword is not None)), Color.fail('Either title or keyword should not be empty')
return self.db.search(title=title, keyword=keyword)<|docstring|>Filter the papers based on title and keyword<|endoftext|> |
b95a94568ecf08e6e150be96994c97da21d5b89a2851ec0178592d0c9aa9bbde | def mark(self, status, pid):
' Update reading status '
self.db.update_status(status, pid) | Update reading status | papers.py | mark | FilippoBiga/Papers | 1 | python | def mark(self, status, pid):
' '
self.db.update_status(status, pid) | def mark(self, status, pid):
' '
self.db.update_status(status, pid)<|docstring|>Update reading status<|endoftext|> |
70338f46440d448f81b39db8e9d1db2a833311fd1180aa7a5461b57faeb0fd9e | def retrieve(self, pid, keywords=False):
' Retrieve a paper with the given pid '
entry = self.db.find_paper(pid)
assert (entry is not None), Color.fail('Could not retrieve paper')
if keywords:
stored_keywords = self.db.get_keywords(pid)
return (entry, stored_keywords)
return (entry,) | Retrieve a paper with the given pid | papers.py | retrieve | FilippoBiga/Papers | 1 | python | def retrieve(self, pid, keywords=False):
' '
entry = self.db.find_paper(pid)
assert (entry is not None), Color.fail('Could not retrieve paper')
if keywords:
stored_keywords = self.db.get_keywords(pid)
return (entry, stored_keywords)
return (entry,) | def retrieve(self, pid, keywords=False):
' '
entry = self.db.find_paper(pid)
assert (entry is not None), Color.fail('Could not retrieve paper')
if keywords:
stored_keywords = self.db.get_keywords(pid)
return (entry, stored_keywords)
return (entry,)<|docstring|>Retrieve a paper with ... |
99451948d132a63c803cc170b4cac65fb0a32fd7061f4e80fe84ab6cc81044b9 | def tag(self, keyword, pid):
' Associate keyword to a paper '
self.db.add_keyword(keyword, pid) | Associate keyword to a paper | papers.py | tag | FilippoBiga/Papers | 1 | python | def tag(self, keyword, pid):
' '
self.db.add_keyword(keyword, pid) | def tag(self, keyword, pid):
' '
self.db.add_keyword(keyword, pid)<|docstring|>Associate keyword to a paper<|endoftext|> |
30325577e5a6d300f5b00fff511f23fd29315a3b58d0781c3c8ace3d25a5fc68 | def untag(self, keyword, pid):
' Remove keyword from a paper '
self.db.remove_keyword(keyword, pid) | Remove keyword from a paper | papers.py | untag | FilippoBiga/Papers | 1 | python | def untag(self, keyword, pid):
' '
self.db.remove_keyword(keyword, pid) | def untag(self, keyword, pid):
' '
self.db.remove_keyword(keyword, pid)<|docstring|>Remove keyword from a paper<|endoftext|> |
71d54027d9e353a75ef37355877ebd2d4dd067bef19c2ba97d905981596ed48e | def open(self, pid):
' Open the subfolder for a given paper '
entry = self.db.find_paper(pid)
full_path = self.storage.paper_subdir(entry.relpath)
os.system('open "{}"'.format(full_path)) | Open the subfolder for a given paper | papers.py | open | FilippoBiga/Papers | 1 | python | def open(self, pid):
' '
entry = self.db.find_paper(pid)
full_path = self.storage.paper_subdir(entry.relpath)
os.system('open "{}"'.format(full_path)) | def open(self, pid):
' '
entry = self.db.find_paper(pid)
full_path = self.storage.paper_subdir(entry.relpath)
os.system('open "{}"'.format(full_path))<|docstring|>Open the subfolder for a given paper<|endoftext|> |
a6d68e42205cde97132691a14d7bde5e04b55d87b2809400028ec9ce0b65851d | def load_pkgs(model: VetiverModel=None, packages: list=None, path=''):
'Load packages necessary for predictions\n\n Args\n ----\n model: VetiverModel\n VetiverModel to extract packages from\n packages: list\n List of extra packages to include\n path: str\n ... | Load packages necessary for predictions
Args
----
model: VetiverModel
VetiverModel to extract packages from
packages: list
List of extra packages to include
path: str
Where to save output file | vetiver/attach_pkgs.py | load_pkgs | isabelizimm/vetiver-python | 0 | python | def load_pkgs(model: VetiverModel=None, packages: list=None, path=):
'Load packages necessary for predictions\n\n Args\n ----\n model: VetiverModel\n VetiverModel to extract packages from\n packages: list\n List of extra packages to include\n path: str\n W... | def load_pkgs(model: VetiverModel=None, packages: list=None, path=):
'Load packages necessary for predictions\n\n Args\n ----\n model: VetiverModel\n VetiverModel to extract packages from\n packages: list\n List of extra packages to include\n path: str\n W... |
4f126c63dced00f20d91af92f0a93b1372236199c626380ce38bbd1547578b23 | def _layer(inputs, mode, layer_num, filters, kernel_size, dilation_rate, dropout_rate):
'Layer building block of MeshNet.\n\n Performs 3D convolution, activation, batch normalization, and dropout on\n `inputs` tensor.\n\n Args:\n inputs : float `Tensor`, input tensor.\n mode : string, a Tenso... | Layer building block of MeshNet.
Performs 3D convolution, activation, batch normalization, and dropout on
`inputs` tensor.
Args:
inputs : float `Tensor`, input tensor.
mode : string, a TensorFlow mode key.
layer_num : int, value to append to each operator name. This should be
the layer number in t... | nobrainer/models/meshnet.py | _layer | soichih/kwyk_neuronet | 3 | python | def _layer(inputs, mode, layer_num, filters, kernel_size, dilation_rate, dropout_rate):
'Layer building block of MeshNet.\n\n Performs 3D convolution, activation, batch normalization, and dropout on\n `inputs` tensor.\n\n Args:\n inputs : float `Tensor`, input tensor.\n mode : string, a Tenso... | def _layer(inputs, mode, layer_num, filters, kernel_size, dilation_rate, dropout_rate):
'Layer building block of MeshNet.\n\n Performs 3D convolution, activation, batch normalization, and dropout on\n `inputs` tensor.\n\n Args:\n inputs : float `Tensor`, input tensor.\n mode : string, a Tenso... |
1b56b5ccc87ea0811ce044355c4f526030dc0b993cbe518f8e3f83b26d260640 | def model_fn(features, labels, mode, params, config=None):
'MeshNet model function.\n\n Args:\n features: 5D float `Tensor`, input tensor. This is the first item\n returned from the `input_fn` passed to `train`, `evaluate`, and\n `predict`. Use `NDHWC` format.\n labels: 4D flo... | MeshNet model function.
Args:
features: 5D float `Tensor`, input tensor. This is the first item
returned from the `input_fn` passed to `train`, `evaluate`, and
`predict`. Use `NDHWC` format.
labels: 4D float `Tensor`, labels tensor. This is the second item
returned from the `input_fn` p... | nobrainer/models/meshnet.py | model_fn | soichih/kwyk_neuronet | 3 | python | def model_fn(features, labels, mode, params, config=None):
'MeshNet model function.\n\n Args:\n features: 5D float `Tensor`, input tensor. This is the first item\n returned from the `input_fn` passed to `train`, `evaluate`, and\n `predict`. Use `NDHWC` format.\n labels: 4D flo... | def model_fn(features, labels, mode, params, config=None):
'MeshNet model function.\n\n Args:\n features: 5D float `Tensor`, input tensor. This is the first item\n returned from the `input_fn` passed to `train`, `evaluate`, and\n `predict`. Use `NDHWC` format.\n labels: 4D flo... |
be1f0c9e514eaaca98d5e234dd0eed6ac65e16463fe22756af836e59ff93a996 | def stem(self, text):
'Stem a text string to its common stem form.'
normalizedText = TextNormalizer.normalize_text(text)
words = normalizedText.split(' ')
stems = []
for word in words:
stems.append(self.stem_word(word))
return ' '.join(stems) | Stem a text string to its common stem form. | Stemmer/Stemmer.py | stem | edho08/Sastrawize | 0 | python | def stem(self, text):
normalizedText = TextNormalizer.normalize_text(text)
words = normalizedText.split(' ')
stems = []
for word in words:
stems.append(self.stem_word(word))
return ' '.join(stems) | def stem(self, text):
normalizedText = TextNormalizer.normalize_text(text)
words = normalizedText.split(' ')
stems = []
for word in words:
stems.append(self.stem_word(word))
return ' '.join(stems)<|docstring|>Stem a text string to its common stem form.<|endoftext|> |
b4d791c4bb3edd60d5b1df3e487594556039561344c1bb0a3ba07a84372335d5 | def stem_word(self, word):
'Stem a word to its common stem form.'
if self.is_plural(word):
return self.stem_plural_word(word)
else:
return self.stem_singular_word(word) | Stem a word to its common stem form. | Stemmer/Stemmer.py | stem_word | edho08/Sastrawize | 0 | python | def stem_word(self, word):
if self.is_plural(word):
return self.stem_plural_word(word)
else:
return self.stem_singular_word(word) | def stem_word(self, word):
if self.is_plural(word):
return self.stem_plural_word(word)
else:
return self.stem_singular_word(word)<|docstring|>Stem a word to its common stem form.<|endoftext|> |
630f2cf85563c9ab0bb18d4d558be57108a43e06bb237a598802da86ee10d0d6 | def stem_plural_word(self, plural):
'Stem a plural word to its common stem form.\n Asian J. (2007) "Effective Techniques for Indonesian Text Retrieval" page 76-77.\n\n @link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf\n '
matches = re.match('^(.*)-(.*)$', plural)
if (not... | Stem a plural word to its common stem form.
Asian J. (2007) "Effective Techniques for Indonesian Text Retrieval" page 76-77.
@link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf | Stemmer/Stemmer.py | stem_plural_word | edho08/Sastrawize | 0 | python | def stem_plural_word(self, plural):
'Stem a plural word to its common stem form.\n Asian J. (2007) "Effective Techniques for Indonesian Text Retrieval" page 76-77.\n\n @link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf\n '
matches = re.match('^(.*)-(.*)$', plural)
if (not... | def stem_plural_word(self, plural):
'Stem a plural word to its common stem form.\n Asian J. (2007) "Effective Techniques for Indonesian Text Retrieval" page 76-77.\n\n @link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf\n '
matches = re.match('^(.*)-(.*)$', plural)
if (not... |
d6e53aefb5c477efee20bc0011e34397b45caa00ec271cf68211f105c96dad2a | def stem_singular_word(self, word):
'Stem a singular word to its common stem form.'
context = Context(word, self.dictionary, self.visitor_provider)
context.execute()
return context.result | Stem a singular word to its common stem form. | Stemmer/Stemmer.py | stem_singular_word | edho08/Sastrawize | 0 | python | def stem_singular_word(self, word):
context = Context(word, self.dictionary, self.visitor_provider)
context.execute()
return context.result | def stem_singular_word(self, word):
context = Context(word, self.dictionary, self.visitor_provider)
context.execute()
return context.result<|docstring|>Stem a singular word to its common stem form.<|endoftext|> |
10b3166fd2d210b858fa1c0ac383dfb1dde604f9fe2499a073817604d28791bb | def __setitem__(self, k, v):
'Annotates this file with a ``(k, v)`` pair, which will be\n included in its JSON serialized form.\n\n '
if (k in {'location', 'contentType', 'contentLength', 'metadata'}):
raise ValueError("Invalid key '{}'".format(k))
self._metadata[k] = v | Annotates this file with a ``(k, v)`` pair, which will be
included in its JSON serialized form. | src/servicelib/results.py | __setitem__ | ecmwf/servicelib | 2 | python | def __setitem__(self, k, v):
'Annotates this file with a ``(k, v)`` pair, which will be\n included in its JSON serialized form.\n\n '
if (k in {'location', 'contentType', 'contentLength', 'metadata'}):
raise ValueError("Invalid key '{}'".format(k))
self._metadata[k] = v | def __setitem__(self, k, v):
'Annotates this file with a ``(k, v)`` pair, which will be\n included in its JSON serialized form.\n\n '
if (k in {'location', 'contentType', 'contentLength', 'metadata'}):
raise ValueError("Invalid key '{}'".format(k))
self._metadata[k] = v<|docstring|>Ann... |
911ff57cd974538b1d89615cfd816b08b225df44537cd4b5001395530bef131d | def init_connection(self):
' create a connection and a cursor to access db '
config = app_config[self.config_type]
database_url = config.DATABASE_URL
self.admin_email = config.ADMIN_EMAIL
self.admin_password = config.ADMIN_PASSWORD
try:
global conn, cur
conn = psycopg2.connect(d... | create a connection and a cursor to access db | app/v2/db/database_config.py | init_connection | martinMutuma/def-politico | 0 | python | def init_connection(self):
' '
config = app_config[self.config_type]
database_url = config.DATABASE_URL
self.admin_email = config.ADMIN_EMAIL
self.admin_password = config.ADMIN_PASSWORD
try:
global conn, cur
conn = psycopg2.connect(database_url)
cur = conn.cursor(cursor_... | def init_connection(self):
' '
config = app_config[self.config_type]
database_url = config.DATABASE_URL
self.admin_email = config.ADMIN_EMAIL
self.admin_password = config.ADMIN_PASSWORD
try:
global conn, cur
conn = psycopg2.connect(database_url)
cur = conn.cursor(cursor_... |
4a08e5fcc58fc375d51ba2904083673337a5ee53bc12e11e3039da4262eea747 | def create_db(self):
' Creates all the tables for the database '
for query in table_queries:
cur.execute(query)
conn.commit() | Creates all the tables for the database | app/v2/db/database_config.py | create_db | martinMutuma/def-politico | 0 | python | def create_db(self):
' '
for query in table_queries:
cur.execute(query)
conn.commit() | def create_db(self):
' '
for query in table_queries:
cur.execute(query)
conn.commit()<|docstring|>Creates all the tables for the database<|endoftext|> |
4d53a471fc69c1b70f0e0521354d407332f523cbea661c599c991f7c9a66b1d2 | def drop_db(self):
' Drops all tables '
for table in table_names:
cur.execute('DROP TABLE IF EXISTS {} CASCADE'.format(table))
conn.commit() | Drops all tables | app/v2/db/database_config.py | drop_db | martinMutuma/def-politico | 0 | python | def drop_db(self):
' '
for table in table_names:
cur.execute('DROP TABLE IF EXISTS {} CASCADE'.format(table))
conn.commit() | def drop_db(self):
' '
for table in table_names:
cur.execute('DROP TABLE IF EXISTS {} CASCADE'.format(table))
conn.commit()<|docstring|>Drops all tables<|endoftext|> |
98094455662b4d10fef1812469cf93026b7fa92febef86c9b4a3aa074f4df39e | def create_super_user(self):
' creates a default user who is an admin '
query = "SELECT * FROM users WHERE email = 'example@example.com'"
cur.execute(query)
user = cur.fetchone()
if (not user):
cur.execute("INSERT INTO users (firstname, lastname, phonenumber,\n email, password, pa... | creates a default user who is an admin | app/v2/db/database_config.py | create_super_user | martinMutuma/def-politico | 0 | python | def create_super_user(self):
' '
query = "SELECT * FROM users WHERE email = 'example@example.com'"
cur.execute(query)
user = cur.fetchone()
if (not user):
cur.execute("INSERT INTO users (firstname, lastname, phonenumber,\n email, password, passport_url, admin) VALUES ('Bedan', 'K... | def create_super_user(self):
' '
query = "SELECT * FROM users WHERE email = 'example@example.com'"
cur.execute(query)
user = cur.fetchone()
if (not user):
cur.execute("INSERT INTO users (firstname, lastname, phonenumber,\n email, password, passport_url, admin) VALUES ('Bedan', 'K... |
16708a39c9e1bb46f8338eba71e225d0cf7d738b4b4eb54f04a783619743f42b | def insert(self, query):
' Add new item in the db '
cur.execute(query)
data = cur.fetchone()
conn.commit()
return data | Add new item in the db | app/v2/db/database_config.py | insert | martinMutuma/def-politico | 0 | python | def insert(self, query):
' '
cur.execute(query)
data = cur.fetchone()
conn.commit()
return data | def insert(self, query):
' '
cur.execute(query)
data = cur.fetchone()
conn.commit()
return data<|docstring|>Add new item in the db<|endoftext|> |
633ab661bf0f2f39cb6885c777b8d84d8af80e13cad05b891678139e252ab40e | def get_one(self, query):
' Get one item form the db '
cur.execute(query)
data = cur.fetchone()
return data | Get one item form the db | app/v2/db/database_config.py | get_one | martinMutuma/def-politico | 0 | python | def get_one(self, query):
' '
cur.execute(query)
data = cur.fetchone()
return data | def get_one(self, query):
' '
cur.execute(query)
data = cur.fetchone()
return data<|docstring|>Get one item form the db<|endoftext|> |
78d6917ada2a1500f525e989e8fe63e23c49f497c7b0de6a8630d03f23a49e6f | def get_all(self, query):
' Get all items from the db '
cur.execute(query)
data = cur.fetchall()
return data | Get all items from the db | app/v2/db/database_config.py | get_all | martinMutuma/def-politico | 0 | python | def get_all(self, query):
' '
cur.execute(query)
data = cur.fetchall()
return data | def get_all(self, query):
' '
cur.execute(query)
data = cur.fetchall()
return data<|docstring|>Get all items from the db<|endoftext|> |
8535eb060bed0d7d7bd6513c455666412721c1d259ddcb04e05177d8481734a6 | def execute(self, query):
' Execute any other query '
cur.execute(query)
conn.commit() | Execute any other query | app/v2/db/database_config.py | execute | martinMutuma/def-politico | 0 | python | def execute(self, query):
' '
cur.execute(query)
conn.commit() | def execute(self, query):
' '
cur.execute(query)
conn.commit()<|docstring|>Execute any other query<|endoftext|> |
e7ea5827f2a37df11b28cd48d729a0cee91a78a59fd38710ce7ad60b8c61e9e3 | def truncate(self):
' Clear all database table '
cur.execute((('TRUNCATE TABLE ' + ','.join(table_names)) + ' CASCADE'))
conn.commit() | Clear all database table | app/v2/db/database_config.py | truncate | martinMutuma/def-politico | 0 | python | def truncate(self):
' '
cur.execute((('TRUNCATE TABLE ' + ','.join(table_names)) + ' CASCADE'))
conn.commit() | def truncate(self):
' '
cur.execute((('TRUNCATE TABLE ' + ','.join(table_names)) + ' CASCADE'))
conn.commit()<|docstring|>Clear all database table<|endoftext|> |
e290db9b7e1b3f83fd2780add618ee108937bcfc6598040b661d5b96e5db6cf8 | def __init__(self, min_face_size: int=20, steps_threshold: list=None, scale_factor: float=0.709, runner_cls=None):
"\n Initializes the MTCNN.\n :param min_face_size: minimum size of the face to detect\n :param steps_threshold: step's thresholds values\n :param scale_factor: scale factor\... | Initializes the MTCNN.
:param min_face_size: minimum size of the face to detect
:param steps_threshold: step's thresholds values
:param scale_factor: scale factor | mtcnn_ort/mtcnn_ort.py | __init__ | yiyuezhuo/mtcnn-onnxruntime | 6 | python | def __init__(self, min_face_size: int=20, steps_threshold: list=None, scale_factor: float=0.709, runner_cls=None):
"\n Initializes the MTCNN.\n :param min_face_size: minimum size of the face to detect\n :param steps_threshold: step's thresholds values\n :param scale_factor: scale factor\... | def __init__(self, min_face_size: int=20, steps_threshold: list=None, scale_factor: float=0.709, runner_cls=None):
"\n Initializes the MTCNN.\n :param min_face_size: minimum size of the face to detect\n :param steps_threshold: step's thresholds values\n :param scale_factor: scale factor\... |
bfe12643347b69f12997cbd17259dac68285cdd6f964fe382d729804d89e9f0c | @staticmethod
def __scale_image(image, scale: float):
'\n Scales the image to a given scale.\n :param image:\n :param scale:\n :return:\n '
(height, width, _) = image.shape
width_scaled = int(np.ceil((width * scale)))
height_scaled = int(np.ceil((height * scale)))
... | Scales the image to a given scale.
:param image:
:param scale:
:return: | mtcnn_ort/mtcnn_ort.py | __scale_image | yiyuezhuo/mtcnn-onnxruntime | 6 | python | @staticmethod
def __scale_image(image, scale: float):
'\n Scales the image to a given scale.\n :param image:\n :param scale:\n :return:\n '
(height, width, _) = image.shape
width_scaled = int(np.ceil((width * scale)))
height_scaled = int(np.ceil((height * scale)))
... | @staticmethod
def __scale_image(image, scale: float):
'\n Scales the image to a given scale.\n :param image:\n :param scale:\n :return:\n '
(height, width, _) = image.shape
width_scaled = int(np.ceil((width * scale)))
height_scaled = int(np.ceil((height * scale)))
... |
cb2068d039b5ae99acc2d73b0400f523156f41dfa3bceb8bb049c6fa72d381c0 | @staticmethod
def __nms(boxes, threshold, method):
"\n Non Maximum Suppression.\n :param boxes: np array with bounding boxes.\n :param threshold:\n :param method: NMS method to apply. Available values ('Min', 'Union')\n :return:\n "
if (boxes.size == 0):
return ... | Non Maximum Suppression.
:param boxes: np array with bounding boxes.
:param threshold:
:param method: NMS method to apply. Available values ('Min', 'Union')
:return: | mtcnn_ort/mtcnn_ort.py | __nms | yiyuezhuo/mtcnn-onnxruntime | 6 | python | @staticmethod
def __nms(boxes, threshold, method):
"\n Non Maximum Suppression.\n :param boxes: np array with bounding boxes.\n :param threshold:\n :param method: NMS method to apply. Available values ('Min', 'Union')\n :return:\n "
if (boxes.size == 0):
return ... | @staticmethod
def __nms(boxes, threshold, method):
"\n Non Maximum Suppression.\n :param boxes: np array with bounding boxes.\n :param threshold:\n :param method: NMS method to apply. Available values ('Min', 'Union')\n :return:\n "
if (boxes.size == 0):
return ... |
b68c110c699373c96e7cb46b2eff4b2d09d7dbd7a9df383accaee726c137a904 | def detect_faces(self, img) -> list:
'\n Detects bounding boxes from the specified image.\n :param img: image to process\n :return: list containing all the bounding boxes detected with their keypoints. box: (x, y, w, h), point: (x, y)\n '
(total_boxes, points) = self.detect_faces_raw... | Detects bounding boxes from the specified image.
:param img: image to process
:return: list containing all the bounding boxes detected with their keypoints. box: (x, y, w, h), point: (x, y) | mtcnn_ort/mtcnn_ort.py | detect_faces | yiyuezhuo/mtcnn-onnxruntime | 6 | python | def detect_faces(self, img) -> list:
'\n Detects bounding boxes from the specified image.\n :param img: image to process\n :return: list containing all the bounding boxes detected with their keypoints. box: (x, y, w, h), point: (x, y)\n '
(total_boxes, points) = self.detect_faces_raw... | def detect_faces(self, img) -> list:
'\n Detects bounding boxes from the specified image.\n :param img: image to process\n :return: list containing all the bounding boxes detected with their keypoints. box: (x, y, w, h), point: (x, y)\n '
(total_boxes, points) = self.detect_faces_raw... |
1a19b9e14ada165034bf266aa132a1327ed36b7dcc48f969ecf9e7d8dec1c558 | def mark_faces(self, image_data) -> bytes:
'\n Mark all the faces\n '
ext = imghdr.what(None, image_data)
im = cv2.imdecode(np.frombuffer(image_data, np.uint8), cv2.IMREAD_COLOR)
image = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
results = self.detect_faces(image)
for result in results:
... | Mark all the faces | mtcnn_ort/mtcnn_ort.py | mark_faces | yiyuezhuo/mtcnn-onnxruntime | 6 | python | def mark_faces(self, image_data) -> bytes:
'\n \n '
ext = imghdr.what(None, image_data)
im = cv2.imdecode(np.frombuffer(image_data, np.uint8), cv2.IMREAD_COLOR)
image = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
results = self.detect_faces(image)
for result in results:
bounding_bo... | def mark_faces(self, image_data) -> bytes:
'\n \n '
ext = imghdr.what(None, image_data)
im = cv2.imdecode(np.frombuffer(image_data, np.uint8), cv2.IMREAD_COLOR)
image = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
results = self.detect_faces(image)
for result in results:
bounding_bo... |
f28931ec3909cd9940573169afe52097ee8d6c416296c52b3e0f5bc0ff5dee72 | def __stage1(self, image, scales: list, stage_status: StageStatus):
'\n First stage of the MTCNN.\n :param image:\n :param scales:\n :param stage_status:\n :return:\n '
total_boxes = np.empty((0, 9))
status = stage_status
for scale in scales:
scaled_imag... | First stage of the MTCNN.
:param image:
:param scales:
:param stage_status:
:return: | mtcnn_ort/mtcnn_ort.py | __stage1 | yiyuezhuo/mtcnn-onnxruntime | 6 | python | def __stage1(self, image, scales: list, stage_status: StageStatus):
'\n First stage of the MTCNN.\n :param image:\n :param scales:\n :param stage_status:\n :return:\n '
total_boxes = np.empty((0, 9))
status = stage_status
for scale in scales:
scaled_imag... | def __stage1(self, image, scales: list, stage_status: StageStatus):
'\n First stage of the MTCNN.\n :param image:\n :param scales:\n :param stage_status:\n :return:\n '
total_boxes = np.empty((0, 9))
status = stage_status
for scale in scales:
scaled_imag... |
d7192790f656e537139ebd4499a96ffcac6afb0856dc6db92254df8b75646d96 | def __stage2(self, img, total_boxes, stage_status: StageStatus):
'\n Second stage of the MTCNN.\n :param img:\n :param total_boxes:\n :param stage_status:\n :return:\n '
num_boxes = total_boxes.shape[0]
if (num_boxes == 0):
return (total_boxes, stage_status)... | Second stage of the MTCNN.
:param img:
:param total_boxes:
:param stage_status:
:return: | mtcnn_ort/mtcnn_ort.py | __stage2 | yiyuezhuo/mtcnn-onnxruntime | 6 | python | def __stage2(self, img, total_boxes, stage_status: StageStatus):
'\n Second stage of the MTCNN.\n :param img:\n :param total_boxes:\n :param stage_status:\n :return:\n '
num_boxes = total_boxes.shape[0]
if (num_boxes == 0):
return (total_boxes, stage_status)... | def __stage2(self, img, total_boxes, stage_status: StageStatus):
'\n Second stage of the MTCNN.\n :param img:\n :param total_boxes:\n :param stage_status:\n :return:\n '
num_boxes = total_boxes.shape[0]
if (num_boxes == 0):
return (total_boxes, stage_status)... |
0677f3583d973b0724c6713fa3bccd8198056704e90aa347ef35df545418628a | def __stage3(self, img, total_boxes, stage_status: StageStatus):
'\n Third stage of the MTCNN.\n :param img:\n :param total_boxes:\n :param stage_status:\n :return:\n '
num_boxes = total_boxes.shape[0]
if (num_boxes == 0):
return (total_boxes, np.empty(shape... | Third stage of the MTCNN.
:param img:
:param total_boxes:
:param stage_status:
:return: | mtcnn_ort/mtcnn_ort.py | __stage3 | yiyuezhuo/mtcnn-onnxruntime | 6 | python | def __stage3(self, img, total_boxes, stage_status: StageStatus):
'\n Third stage of the MTCNN.\n :param img:\n :param total_boxes:\n :param stage_status:\n :return:\n '
num_boxes = total_boxes.shape[0]
if (num_boxes == 0):
return (total_boxes, np.empty(shape... | def __stage3(self, img, total_boxes, stage_status: StageStatus):
'\n Third stage of the MTCNN.\n :param img:\n :param total_boxes:\n :param stage_status:\n :return:\n '
num_boxes = total_boxes.shape[0]
if (num_boxes == 0):
return (total_boxes, np.empty(shape... |
df199b114696f6aaee8e78d8d873ef16b23cf58bb4aa4f7e375341f411732fc7 | def __init__(self, runtime_group: RuntimeGroup):
'Initialization method.\n\n Args:\n runtime_group: The group where the workers will be started.\n '
super().__init__(runtime_group)
self.dbpath: Optional[str] = None | Initialization method.
Args:
runtime_group: The group where the workers will be started. | src/lazycluster/cluster/hyperopt_cluster.py | __init__ | prototypefund/lazycluster | 44 | python | def __init__(self, runtime_group: RuntimeGroup):
'Initialization method.\n\n Args:\n runtime_group: The group where the workers will be started.\n '
super().__init__(runtime_group)
self.dbpath: Optional[str] = None | def __init__(self, runtime_group: RuntimeGroup):
'Initialization method.\n\n Args:\n runtime_group: The group where the workers will be started.\n '
super().__init__(runtime_group)
self.dbpath: Optional[str] = None<|docstring|>Initialization method.
Args:
runtime_group: The gro... |
bf449272052829cfb2be3b0ae5c381585718efb5d06aeef3fa8879b0703c75c3 | def start(self, ports: Union[(List[int], int)], timeout: int=0, debug: bool=False) -> List[int]:
'Launch a master instance.\n\n Note:\n If you create a custom subclass of MasterLauncher which will not start the master instance on localhost\n then you should pass the debug flag on to `ex... | Launch a master instance.
Note:
If you create a custom subclass of MasterLauncher which will not start the master instance on localhost
then you should pass the debug flag on to `execute_task()` of the `RuntimeGroup` or `Runtime` so that you
can benefit from the debug feature of `RuntimeTask.execute()`.
A... | src/lazycluster/cluster/hyperopt_cluster.py | start | prototypefund/lazycluster | 44 | python | def start(self, ports: Union[(List[int], int)], timeout: int=0, debug: bool=False) -> List[int]:
'Launch a master instance.\n\n Note:\n If you create a custom subclass of MasterLauncher which will not start the master instance on localhost\n then you should pass the debug flag on to `ex... | def start(self, ports: Union[(List[int], int)], timeout: int=0, debug: bool=False) -> List[int]:
'Launch a master instance.\n\n Note:\n If you create a custom subclass of MasterLauncher which will not start the master instance on localhost\n then you should pass the debug flag on to `ex... |
5570a1cd7afdf371d801b0434203a922b24a7f382ade81474f15b0ce09e1a2e6 | def get_mongod_start_cmd(self) -> str:
'Get the shell command for starting mongod as a deamon process.\n\n Returns:\n str: The shell command.\n '
return f'mongod --fork --logpath={self.dbpath}/{HyperoptCluster.MONGO_LOG_FILENAME} --dbpath={self.dbpath} --port={self._port}' | Get the shell command for starting mongod as a deamon process.
Returns:
str: The shell command. | src/lazycluster/cluster/hyperopt_cluster.py | get_mongod_start_cmd | prototypefund/lazycluster | 44 | python | def get_mongod_start_cmd(self) -> str:
'Get the shell command for starting mongod as a deamon process.\n\n Returns:\n str: The shell command.\n '
return f'mongod --fork --logpath={self.dbpath}/{HyperoptCluster.MONGO_LOG_FILENAME} --dbpath={self.dbpath} --port={self._port}' | def get_mongod_start_cmd(self) -> str:
'Get the shell command for starting mongod as a deamon process.\n\n Returns:\n str: The shell command.\n '
return f'mongod --fork --logpath={self.dbpath}/{HyperoptCluster.MONGO_LOG_FILENAME} --dbpath={self.dbpath} --port={self._port}'<|docstring|>G... |
28e1927f3492e5c25459504d9ed6577516e1accd5f03e81ed45fd8bbf05adf2b | def get_mongod_stop_cmd(self) -> str:
'Get the shell command for stopping the currently running mongod process.\n\n Returns:\n str: The shell command.\n '
return f'mongod --shutdown --dbpath={self.dbpath}' | Get the shell command for stopping the currently running mongod process.
Returns:
str: The shell command. | src/lazycluster/cluster/hyperopt_cluster.py | get_mongod_stop_cmd | prototypefund/lazycluster | 44 | python | def get_mongod_stop_cmd(self) -> str:
'Get the shell command for stopping the currently running mongod process.\n\n Returns:\n str: The shell command.\n '
return f'mongod --shutdown --dbpath={self.dbpath}' | def get_mongod_stop_cmd(self) -> str:
'Get the shell command for stopping the currently running mongod process.\n\n Returns:\n str: The shell command.\n '
return f'mongod --shutdown --dbpath={self.dbpath}'<|docstring|>Get the shell command for stopping the currently running mongod proce... |
dcc776077e803bdaa0ea9d08995b8e6884bcac48cbec131aa8d90af27031f8f2 | def cleanup(self) -> None:
'Release all resources.'
self.log.info('Stop the MongoDB ...')
self.log.debug('Cleaning up the LocalMasterLauncher ...')
return_code = os.system(self.get_mongod_stop_cmd())
if (return_code == 0):
self.log.info('MongoDB successfully stopped.')
else:
self... | Release all resources. | src/lazycluster/cluster/hyperopt_cluster.py | cleanup | prototypefund/lazycluster | 44 | python | def cleanup(self) -> None:
self.log.info('Stop the MongoDB ...')
self.log.debug('Cleaning up the LocalMasterLauncher ...')
return_code = os.system(self.get_mongod_stop_cmd())
if (return_code == 0):
self.log.info('MongoDB successfully stopped.')
else:
self.log.warning('MongoDB da... | def cleanup(self) -> None:
self.log.info('Stop the MongoDB ...')
self.log.debug('Cleaning up the LocalMasterLauncher ...')
return_code = os.system(self.get_mongod_stop_cmd())
if (return_code == 0):
self.log.info('MongoDB successfully stopped.')
else:
self.log.warning('MongoDB da... |
add0b8a3ef0756471cb7fbc958b45ab9201485dc57bb8610148c282aefb5fe8d | def __init__(self, runtime_group: RuntimeGroup, dbname: str, poll_interval: float):
'Initialization method.\n\n Args:\n runtime_group: The group where the workers will be started.\n dbname: The name of the mongodb instance.\n poll_interval: The poll interval of the hyperopt w... | Initialization method.
Args:
runtime_group: The group where the workers will be started.
dbname: The name of the mongodb instance.
poll_interval: The poll interval of the hyperopt worker.
Raises.
ValueError: In case dbname is empty. | src/lazycluster/cluster/hyperopt_cluster.py | __init__ | prototypefund/lazycluster | 44 | python | def __init__(self, runtime_group: RuntimeGroup, dbname: str, poll_interval: float):
'Initialization method.\n\n Args:\n runtime_group: The group where the workers will be started.\n dbname: The name of the mongodb instance.\n poll_interval: The poll interval of the hyperopt w... | def __init__(self, runtime_group: RuntimeGroup, dbname: str, poll_interval: float):
'Initialization method.\n\n Args:\n runtime_group: The group where the workers will be started.\n dbname: The name of the mongodb instance.\n poll_interval: The poll interval of the hyperopt w... |
f56555c7b8c59deeed396517fbff951f473a1abd3ebca5c14005ae3f2b1a915a | def start(self, worker_count: int, master_port: int, ports: List[int]=None, debug: bool=True) -> List[int]:
'Launches the worker instances in the `RuntimeGroup`.\n\n Args:\n worker_count: The number of worker instances to be started in the group.\n master_port: The port of the master i... | Launches the worker instances in the `RuntimeGroup`.
Args:
worker_count: The number of worker instances to be started in the group.
master_port: The port of the master instance.
ports: Without use here. Only here because we need to adhere to the interface defined by the
WorkerLauncher class.
... | src/lazycluster/cluster/hyperopt_cluster.py | start | prototypefund/lazycluster | 44 | python | def start(self, worker_count: int, master_port: int, ports: List[int]=None, debug: bool=True) -> List[int]:
'Launches the worker instances in the `RuntimeGroup`.\n\n Args:\n worker_count: The number of worker instances to be started in the group.\n master_port: The port of the master i... | def start(self, worker_count: int, master_port: int, ports: List[int]=None, debug: bool=True) -> List[int]:
'Launches the worker instances in the `RuntimeGroup`.\n\n Args:\n worker_count: The number of worker instances to be started in the group.\n master_port: The port of the master i... |
19416986d5cd4e8b7aaf5be7ec2bcc95f784d9a96cdf6fbb362bf4bf48eefdee | def _launch_single_worker(self, host: str, worker_index: int, master_port: int, debug: bool) -> None:
'Launch a single worker instance in a `Runtime` in the `RuntimeGroup`.'
task = RuntimeTask(('launch-hyperopt-worker-' + str(worker_index)))
task.run_command(self._get_launch_command(master_port, self._dbnam... | Launch a single worker instance in a `Runtime` in the `RuntimeGroup`. | src/lazycluster/cluster/hyperopt_cluster.py | _launch_single_worker | prototypefund/lazycluster | 44 | python | def _launch_single_worker(self, host: str, worker_index: int, master_port: int, debug: bool) -> None:
task = RuntimeTask(('launch-hyperopt-worker-' + str(worker_index)))
task.run_command(self._get_launch_command(master_port, self._dbname, self._poll_interval))
self._group.execute_task(task, host, omit_... | def _launch_single_worker(self, host: str, worker_index: int, master_port: int, debug: bool) -> None:
task = RuntimeTask(('launch-hyperopt-worker-' + str(worker_index)))
task.run_command(self._get_launch_command(master_port, self._dbname, self._poll_interval))
self._group.execute_task(task, host, omit_... |
57ca66111a27a97f89b88bc967aff3245e720cdb516e16028972c8e70c01557b | @classmethod
def _get_launch_command(cls, master_port: int, dbname: str, poll_interval: float=0.1) -> str:
'Get the shell command for starting a worker instance.\n\n Returns:\n str: The launch command.\n '
return f'hyperopt-mongo-worker --mongo=localhost:{str(master_port)}/{dbname} --p... | Get the shell command for starting a worker instance.
Returns:
str: The launch command. | src/lazycluster/cluster/hyperopt_cluster.py | _get_launch_command | prototypefund/lazycluster | 44 | python | @classmethod
def _get_launch_command(cls, master_port: int, dbname: str, poll_interval: float=0.1) -> str:
'Get the shell command for starting a worker instance.\n\n Returns:\n str: The launch command.\n '
return f'hyperopt-mongo-worker --mongo=localhost:{str(master_port)}/{dbname} --p... | @classmethod
def _get_launch_command(cls, master_port: int, dbname: str, poll_interval: float=0.1) -> str:
'Get the shell command for starting a worker instance.\n\n Returns:\n str: The launch command.\n '
return f'hyperopt-mongo-worker --mongo=localhost:{str(master_port)}/{dbname} --p... |
38ead3314edd9a18d8cec37f38b62eec5e3705875f73fbbc08a202085e96cef7 | def cleanup(self) -> None:
'Release all resources.'
self.log.info('Cleanup the RoundRobinLauncher ...')
super().cleanup() | Release all resources. | src/lazycluster/cluster/hyperopt_cluster.py | cleanup | prototypefund/lazycluster | 44 | python | def cleanup(self) -> None:
self.log.info('Cleanup the RoundRobinLauncher ...')
super().cleanup() | def cleanup(self) -> None:
self.log.info('Cleanup the RoundRobinLauncher ...')
super().cleanup()<|docstring|>Release all resources.<|endoftext|> |
3f56806686a5cdae57913b35abfad6fa866ee8675039fe5bba715f8b924f6093 | def __init__(self, runtime_group: RuntimeGroup, mongo_launcher: Optional[MongoLauncher]=None, worker_launcher: Optional[WorkerLauncher]=None, dbpath: Optional[str]=None, dbname: str='hyperopt', worker_poll_intervall: float=0.1):
'Initialization method.\n\n Args:\n runtime_group: The `RuntimeGroup`... | Initialization method.
Args:
runtime_group: The `RuntimeGroup` contains all `Runtimes` which can be used for starting the entities.
mongo_launcher: Optionally, an instance implementing the `MasterLauncher` interface can be given, which
implements the strategy for launching the master instan... | src/lazycluster/cluster/hyperopt_cluster.py | __init__ | prototypefund/lazycluster | 44 | python | def __init__(self, runtime_group: RuntimeGroup, mongo_launcher: Optional[MongoLauncher]=None, worker_launcher: Optional[WorkerLauncher]=None, dbpath: Optional[str]=None, dbname: str='hyperopt', worker_poll_intervall: float=0.1):
'Initialization method.\n\n Args:\n runtime_group: The `RuntimeGroup`... | def __init__(self, runtime_group: RuntimeGroup, mongo_launcher: Optional[MongoLauncher]=None, worker_launcher: Optional[WorkerLauncher]=None, dbpath: Optional[str]=None, dbname: str='hyperopt', worker_poll_intervall: float=0.1):
'Initialization method.\n\n Args:\n runtime_group: The `RuntimeGroup`... |
416be4f67ca40aa0a88504de3269962f1778a51c8a231d64a6146d0cfab695af | @property
def mongo_trial_url(self) -> str:
'The MongoDB url indicating what mongod process and which database to use.\n\n Note:\n The format is the format required by the hyperopt MongoTrials object.\n\n Returns:\n str: URL string.\n '
if (not self.master_port):
... | The MongoDB url indicating what mongod process and which database to use.
Note:
The format is the format required by the hyperopt MongoTrials object.
Returns:
str: URL string. | src/lazycluster/cluster/hyperopt_cluster.py | mongo_trial_url | prototypefund/lazycluster | 44 | python | @property
def mongo_trial_url(self) -> str:
'The MongoDB url indicating what mongod process and which database to use.\n\n Note:\n The format is the format required by the hyperopt MongoTrials object.\n\n Returns:\n str: URL string.\n '
if (not self.master_port):
... | @property
def mongo_trial_url(self) -> str:
'The MongoDB url indicating what mongod process and which database to use.\n\n Note:\n The format is the format required by the hyperopt MongoTrials object.\n\n Returns:\n str: URL string.\n '
if (not self.master_port):
... |
370b9640a65d2da63f069e130791b039d5f515bc75294adc340181a1c4044d3c | @property
def mongo_url(self) -> str:
'The MongoDB url indicating what mongod process and which database to use.\n\n Note:\n The format is `mongo://host:port/dbname`.\n\n Returns:\n str: URL string.\n '
if (not self.master_port):
self.log.warning('HyperoptClust... | The MongoDB url indicating what mongod process and which database to use.
Note:
The format is `mongo://host:port/dbname`.
Returns:
str: URL string. | src/lazycluster/cluster/hyperopt_cluster.py | mongo_url | prototypefund/lazycluster | 44 | python | @property
def mongo_url(self) -> str:
'The MongoDB url indicating what mongod process and which database to use.\n\n Note:\n The format is `mongo://host:port/dbname`.\n\n Returns:\n str: URL string.\n '
if (not self.master_port):
self.log.warning('HyperoptClust... | @property
def mongo_url(self) -> str:
'The MongoDB url indicating what mongod process and which database to use.\n\n Note:\n The format is `mongo://host:port/dbname`.\n\n Returns:\n str: URL string.\n '
if (not self.master_port):
self.log.warning('HyperoptClust... |
582f53ecf9947e8b01858fd17f2f804b7b0d92653117e09362abf545355ab04d | @property
def dbname(self) -> str:
'The name of the MongoDB database to be used for experiments.'
return self._dbname | The name of the MongoDB database to be used for experiments. | src/lazycluster/cluster/hyperopt_cluster.py | dbname | prototypefund/lazycluster | 44 | python | @property
def dbname(self) -> str:
return self._dbname | @property
def dbname(self) -> str:
return self._dbname<|docstring|>The name of the MongoDB database to be used for experiments.<|endoftext|> |
ecafe82af23035ae92828c50784d06f7809888d1518b5ecdc53883330238e21d | def start_master(self, master_port: Optional[int]=None, timeout: int=3, debug: bool=False) -> None:
'Start the master instance.\n\n Note:\n How the master is actually started is determined by the the actual `MasterLauncher` implementation. Another\n implementation adhering to the `Maste... | Start the master instance.
Note:
How the master is actually started is determined by the the actual `MasterLauncher` implementation. Another
implementation adhering to the `MasterLauncher` interface can be provided in the constructor of the cluster
class.
Args:
master_port: Port of the master instance... | src/lazycluster/cluster/hyperopt_cluster.py | start_master | prototypefund/lazycluster | 44 | python | def start_master(self, master_port: Optional[int]=None, timeout: int=3, debug: bool=False) -> None:
'Start the master instance.\n\n Note:\n How the master is actually started is determined by the the actual `MasterLauncher` implementation. Another\n implementation adhering to the `Maste... | def start_master(self, master_port: Optional[int]=None, timeout: int=3, debug: bool=False) -> None:
'Start the master instance.\n\n Note:\n How the master is actually started is determined by the the actual `MasterLauncher` implementation. Another\n implementation adhering to the `Maste... |
041562261bfcdc7657dbf87d829ef0df3cee891ef2d548c79f59040aa3db2bed | def cleanup(self) -> None:
'Release all resources.'
self.log.info('Shutting down the HyperoptCluster...')
super().cleanup() | Release all resources. | src/lazycluster/cluster/hyperopt_cluster.py | cleanup | prototypefund/lazycluster | 44 | python | def cleanup(self) -> None:
self.log.info('Shutting down the HyperoptCluster...')
super().cleanup() | def cleanup(self) -> None:
self.log.info('Shutting down the HyperoptCluster...')
super().cleanup()<|docstring|>Release all resources.<|endoftext|> |
435730aa88fe1fdfdab1c6aa1a95c84d8fff72140ba3f2b9996fccef19ddab78 | def html2markdown(html):
'Converts `html` to Markdown-formatted text\n '
markdown_text = pypandoc.convert_text(html, 'markdown_strict', format='html')
return markdown_text | Converts `html` to Markdown-formatted text | utils/text/converters.py | html2markdown | aweandreverence/django-htk | 206 | python | def html2markdown(html):
'\n '
markdown_text = pypandoc.convert_text(html, 'markdown_strict', format='html')
return markdown_text | def html2markdown(html):
'\n '
markdown_text = pypandoc.convert_text(html, 'markdown_strict', format='html')
return markdown_text<|docstring|>Converts `html` to Markdown-formatted text<|endoftext|> |
e5116d825f04d81d592c1b5885a9543f11251893927846bd96c44318b7f4647a | def markdown2slack(markdown_text):
'Converts Markdown-formatted text to Slack-formatted text\n '
markdown_lines = markdown_text.split('\n')
slack_lines = []
for line in markdown_lines:
line = line.strip()
line = re.sub('\\*\\*(.+?)\\*\\*', '<b>\\1<b>', line)
line = re.sub('(\\... | Converts Markdown-formatted text to Slack-formatted text | utils/text/converters.py | markdown2slack | aweandreverence/django-htk | 206 | python | def markdown2slack(markdown_text):
'\n '
markdown_lines = markdown_text.split('\n')
slack_lines = []
for line in markdown_lines:
line = line.strip()
line = re.sub('\\*\\*(.+?)\\*\\*', '<b>\\1<b>', line)
line = re.sub('(\\*(.+?)\\*)', '_\\1_', line)
line = re.sub('<b>(.... | def markdown2slack(markdown_text):
'\n '
markdown_lines = markdown_text.split('\n')
slack_lines = []
for line in markdown_lines:
line = line.strip()
line = re.sub('\\*\\*(.+?)\\*\\*', '<b>\\1<b>', line)
line = re.sub('(\\*(.+?)\\*)', '_\\1_', line)
line = re.sub('<b>(.... |
98d824085d17c4c7feac93cce3a8323b140a45bfd05f8680229e4898c48578cc | def check_input(args):
'Checks whether to read from stdin/file and validates user input/options.\n '
option = ''
fh = sys.stdin
if (not len(args)):
if sys.stdin.isatty():
sys.stderr.write(__doc__)
sys.exit(1)
elif (len(args) == 1):
if args[0].startswith('-'... | Checks whether to read from stdin/file and validates user input/options. | pdbtools/pdb_selseg.py | check_input | andrewsb8/pdb-tools | 192 | python | def check_input(args):
'\n '
option =
fh = sys.stdin
if (not len(args)):
if sys.stdin.isatty():
sys.stderr.write(__doc__)
sys.exit(1)
elif (len(args) == 1):
if args[0].startswith('-'):
option = args[0][1:]
if sys.stdin.isatty():
... | def check_input(args):
'\n '
option =
fh = sys.stdin
if (not len(args)):
if sys.stdin.isatty():
sys.stderr.write(__doc__)
sys.exit(1)
elif (len(args) == 1):
if args[0].startswith('-'):
option = args[0][1:]
if sys.stdin.isatty():
... |
bc8c167e7e07c1060a9dac07e5cd5bc17b3dfa59c38e16dc3b8c6a8eb497b9cb | def run(fhandle, segment_set):
'\n Filter the PDB file for specific segment identifiers.\n\n This function is a generator.\n\n Parameters\n ----------\n fhandle : a line-by-line iterator of the original PDB file.\n\n segment_set : set, list, or tuple\n The set of segment identifiers.\n\n ... | Filter the PDB file for specific segment identifiers.
This function is a generator.
Parameters
----------
fhandle : a line-by-line iterator of the original PDB file.
segment_set : set, list, or tuple
The set of segment identifiers.
Yields
------
str (line-by-line)
The lines only from the segment set. | pdbtools/pdb_selseg.py | run | andrewsb8/pdb-tools | 192 | python | def run(fhandle, segment_set):
'\n Filter the PDB file for specific segment identifiers.\n\n This function is a generator.\n\n Parameters\n ----------\n fhandle : a line-by-line iterator of the original PDB file.\n\n segment_set : set, list, or tuple\n The set of segment identifiers.\n\n ... | def run(fhandle, segment_set):
'\n Filter the PDB file for specific segment identifiers.\n\n This function is a generator.\n\n Parameters\n ----------\n fhandle : a line-by-line iterator of the original PDB file.\n\n segment_set : set, list, or tuple\n The set of segment identifiers.\n\n ... |
9c065f67ca15415eb67f1409bbe000fc762cc08ca1efe1019f5a51222e09a9de | def abspath(myPath):
' Get absolute path to resource, works for dev and for PyInstaller '
import os, sys
try:
base_path = sys._MEIPASS
return os.path.join(base_path, os.path.basename(myPath))
except Exception:
base_path = os.path.abspath(os.path.dirname(__file__))
return ... | Get absolute path to resource, works for dev and for PyInstaller | gputools/core/ocltypes.py | abspath | VolkerH/gputools | 0 | python | def abspath(myPath):
' '
import os, sys
try:
base_path = sys._MEIPASS
return os.path.join(base_path, os.path.basename(myPath))
except Exception:
base_path = os.path.abspath(os.path.dirname(__file__))
return os.path.join(base_path, myPath) | def abspath(myPath):
' '
import os, sys
try:
base_path = sys._MEIPASS
return os.path.join(base_path, os.path.basename(myPath))
except Exception:
base_path = os.path.abspath(os.path.dirname(__file__))
return os.path.join(base_path, myPath)<|docstring|>Get absolute path to... |
f2f3cbe2c92e8ca6fd299143e7973707cc48df42b6265db90a64d609a54fe405 | def _wrap_OCLArray(cls):
'\n WRAPPER\n '
def prepare(arr):
return np.require(arr, None, 'C')
@classmethod
def from_array(cls, arr, *args, **kwargs):
queue = get_device().queue
return cl_array.to_device(queue, prepare(arr), *args, **kwargs)
@classmethod
def empty(... | WRAPPER | gputools/core/ocltypes.py | _wrap_OCLArray | VolkerH/gputools | 0 | python | def _wrap_OCLArray(cls):
'\n \n '
def prepare(arr):
return np.require(arr, None, 'C')
@classmethod
def from_array(cls, arr, *args, **kwargs):
queue = get_device().queue
return cl_array.to_device(queue, prepare(arr), *args, **kwargs)
@classmethod
def empty(cls, sh... | def _wrap_OCLArray(cls):
'\n \n '
def prepare(arr):
return np.require(arr, None, 'C')
@classmethod
def from_array(cls, arr, *args, **kwargs):
queue = get_device().queue
return cl_array.to_device(queue, prepare(arr), *args, **kwargs)
@classmethod
def empty(cls, sh... |
f4e609022adc7bb5f7608a0e5e18e0186b94bd5f6353c2dcad2be5c4e58e4a3d | def copy_buffer(self, buf):
'\n copy content of buf into im\n '
queue = get_device().queue
if hasattr(self, 'shape'):
imshape = self.shape
else:
imshape = (self.width,)
assert (imshape == buf.shape[::(- 1)])
ndim = len(imshape)
cl.enqueue_copy(queue, self, buf.d... | copy content of buf into im | gputools/core/ocltypes.py | copy_buffer | VolkerH/gputools | 0 | python | def copy_buffer(self, buf):
'\n \n '
queue = get_device().queue
if hasattr(self, 'shape'):
imshape = self.shape
else:
imshape = (self.width,)
assert (imshape == buf.shape[::(- 1)])
ndim = len(imshape)
cl.enqueue_copy(queue, self, buf.data, offset=0, origin=((0,)... | def copy_buffer(self, buf):
'\n \n '
queue = get_device().queue
if hasattr(self, 'shape'):
imshape = self.shape
else:
imshape = (self.width,)
assert (imshape == buf.shape[::(- 1)])
ndim = len(imshape)
cl.enqueue_copy(queue, self, buf.data, offset=0, origin=((0,)... |
dce64e88cd004287f07ead989b1bba546e53c940e517cd78faf174c6a74c4e79 | def _profile(user):
'Create an User Profile.'
profile = UserProfile()
profile.user_id = user.id
profile.save() | Create an User Profile. | shop/accounts/utils.py | _profile | Anych/mila-iris | 0 | python | def _profile(user):
profile = UserProfile()
profile.user_id = user.id
profile.save() | def _profile(user):
profile = UserProfile()
profile.user_id = user.id
profile.save()<|docstring|>Create an User Profile.<|endoftext|> |
234f92ee4550ce5c4c7c07378902f3c7360b2156b7db574303d4b0a9aee26dd3 | def _redirect_to_next_page(request):
"\n Redirect users to 'next' page\n when they were redirect to login page.\n "
url = request.META.get('HTTP_REFERER')
query = requests.utils.urlparse(url).query
params = dict((x.split('=') for x in query.split('&')))
if ('next' in params):
nextPa... | Redirect users to 'next' page
when they were redirect to login page. | shop/accounts/utils.py | _redirect_to_next_page | Anych/mila-iris | 0 | python | def _redirect_to_next_page(request):
"\n Redirect users to 'next' page\n when they were redirect to login page.\n "
url = request.META.get('HTTP_REFERER')
query = requests.utils.urlparse(url).query
params = dict((x.split('=') for x in query.split('&')))
if ('next' in params):
nextPa... | def _redirect_to_next_page(request):
"\n Redirect users to 'next' page\n when they were redirect to login page.\n "
url = request.META.get('HTTP_REFERER')
query = requests.utils.urlparse(url).query
params = dict((x.split('=') for x in query.split('&')))
if ('next' in params):
nextPa... |
31bd608d790561ac5d0b0684afb8d27867410a3cc3edd8ac7509bd3991497260 | def to_boolean(value, ctx):
'\n Tries conversion of any value to a boolean\n '
if isinstance(value, bool):
return value
elif isinstance(value, int):
return (value != 0)
elif isinstance(value, Decimal):
return (value != Decimal(0))
elif isinstance(value, six.string_types... | Tries conversion of any value to a boolean | python/temba_expressions/conversions.py | to_boolean | greatnonprofits-nfp/ccl-expressions | 0 | python | def to_boolean(value, ctx):
'\n \n '
if isinstance(value, bool):
return value
elif isinstance(value, int):
return (value != 0)
elif isinstance(value, Decimal):
return (value != Decimal(0))
elif isinstance(value, six.string_types):
value = value.lower()
i... | def to_boolean(value, ctx):
'\n \n '
if isinstance(value, bool):
return value
elif isinstance(value, int):
return (value != 0)
elif isinstance(value, Decimal):
return (value != Decimal(0))
elif isinstance(value, six.string_types):
value = value.lower()
i... |
1e17a0755e17456d5b7160dac461beb229b265744ad37589d52fcfe48e6b232f | def to_integer(value, ctx):
'\n Tries conversion of any value to an integer\n '
if isinstance(value, bool):
return (1 if value else 0)
elif isinstance(value, int):
return value
elif isinstance(value, Decimal):
try:
val = int(value.to_integral_exact(ROUND_HALF_UP... | Tries conversion of any value to an integer | python/temba_expressions/conversions.py | to_integer | greatnonprofits-nfp/ccl-expressions | 0 | python | def to_integer(value, ctx):
'\n \n '
if isinstance(value, bool):
return (1 if value else 0)
elif isinstance(value, int):
return value
elif isinstance(value, Decimal):
try:
val = int(value.to_integral_exact(ROUND_HALF_UP))
if isinstance(val, int):
... | def to_integer(value, ctx):
'\n \n '
if isinstance(value, bool):
return (1 if value else 0)
elif isinstance(value, int):
return value
elif isinstance(value, Decimal):
try:
val = int(value.to_integral_exact(ROUND_HALF_UP))
if isinstance(val, int):
... |
7f5aeef4b9da61ff9f823151601aeb049006a1ee42416767aabc5d096ae5f580 | def to_decimal(value, ctx):
'\n Tries conversion of any value to a decimal\n '
if isinstance(value, bool):
return (Decimal(1) if value else Decimal(0))
elif isinstance(value, int):
return Decimal(value)
elif isinstance(value, Decimal):
return value
elif isinstance(value... | Tries conversion of any value to a decimal | python/temba_expressions/conversions.py | to_decimal | greatnonprofits-nfp/ccl-expressions | 0 | python | def to_decimal(value, ctx):
'\n \n '
if isinstance(value, bool):
return (Decimal(1) if value else Decimal(0))
elif isinstance(value, int):
return Decimal(value)
elif isinstance(value, Decimal):
return value
elif isinstance(value, six.string_types):
try:
... | def to_decimal(value, ctx):
'\n \n '
if isinstance(value, bool):
return (Decimal(1) if value else Decimal(0))
elif isinstance(value, int):
return Decimal(value)
elif isinstance(value, Decimal):
return value
elif isinstance(value, six.string_types):
try:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.