hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
qsc_code_num_words_quality_signal
int64
qsc_code_num_chars_quality_signal
float64
qsc_code_mean_word_length_quality_signal
float64
qsc_code_frac_words_unique_quality_signal
float64
qsc_code_frac_chars_top_2grams_quality_signal
float64
qsc_code_frac_chars_top_3grams_quality_signal
float64
qsc_code_frac_chars_top_4grams_quality_signal
float64
qsc_code_frac_chars_dupe_5grams_quality_signal
float64
qsc_code_frac_chars_dupe_6grams_quality_signal
float64
qsc_code_frac_chars_dupe_7grams_quality_signal
float64
qsc_code_frac_chars_dupe_8grams_quality_signal
float64
qsc_code_frac_chars_dupe_9grams_quality_signal
float64
qsc_code_frac_chars_dupe_10grams_quality_signal
float64
qsc_code_frac_chars_replacement_symbols_quality_signal
float64
qsc_code_frac_chars_digital_quality_signal
float64
qsc_code_frac_chars_whitespace_quality_signal
float64
qsc_code_size_file_byte_quality_signal
float64
qsc_code_num_lines_quality_signal
float64
qsc_code_num_chars_line_max_quality_signal
float64
qsc_code_num_chars_line_mean_quality_signal
float64
qsc_code_frac_chars_alphabet_quality_signal
float64
qsc_code_frac_chars_comments_quality_signal
float64
qsc_code_cate_xml_start_quality_signal
float64
qsc_code_frac_lines_dupe_lines_quality_signal
float64
qsc_code_cate_autogen_quality_signal
float64
qsc_code_frac_lines_long_string_quality_signal
float64
qsc_code_frac_chars_string_length_quality_signal
float64
qsc_code_frac_chars_long_word_length_quality_signal
float64
qsc_code_frac_lines_string_concat_quality_signal
float64
qsc_code_cate_encoded_data_quality_signal
float64
qsc_code_frac_chars_hex_words_quality_signal
float64
qsc_code_frac_lines_prompt_comments_quality_signal
float64
qsc_code_frac_lines_assert_quality_signal
float64
qsc_codepython_cate_ast_quality_signal
float64
qsc_codepython_frac_lines_func_ratio_quality_signal
float64
qsc_codepython_cate_var_zero_quality_signal
bool
qsc_codepython_frac_lines_pass_quality_signal
float64
qsc_codepython_frac_lines_import_quality_signal
float64
qsc_codepython_frac_lines_simplefunc_quality_signal
float64
qsc_codepython_score_lines_no_logic_quality_signal
float64
qsc_codepython_frac_lines_print_quality_signal
float64
qsc_code_num_words
int64
qsc_code_num_chars
int64
qsc_code_mean_word_length
int64
qsc_code_frac_words_unique
null
qsc_code_frac_chars_top_2grams
int64
qsc_code_frac_chars_top_3grams
int64
qsc_code_frac_chars_top_4grams
int64
qsc_code_frac_chars_dupe_5grams
int64
qsc_code_frac_chars_dupe_6grams
int64
qsc_code_frac_chars_dupe_7grams
int64
qsc_code_frac_chars_dupe_8grams
int64
qsc_code_frac_chars_dupe_9grams
int64
qsc_code_frac_chars_dupe_10grams
int64
qsc_code_frac_chars_replacement_symbols
int64
qsc_code_frac_chars_digital
int64
qsc_code_frac_chars_whitespace
int64
qsc_code_size_file_byte
int64
qsc_code_num_lines
int64
qsc_code_num_chars_line_max
int64
qsc_code_num_chars_line_mean
int64
qsc_code_frac_chars_alphabet
int64
qsc_code_frac_chars_comments
int64
qsc_code_cate_xml_start
int64
qsc_code_frac_lines_dupe_lines
int64
qsc_code_cate_autogen
int64
qsc_code_frac_lines_long_string
int64
qsc_code_frac_chars_string_length
int64
qsc_code_frac_chars_long_word_length
int64
qsc_code_frac_lines_string_concat
null
qsc_code_cate_encoded_data
int64
qsc_code_frac_chars_hex_words
int64
qsc_code_frac_lines_prompt_comments
int64
qsc_code_frac_lines_assert
int64
qsc_codepython_cate_ast
int64
qsc_codepython_frac_lines_func_ratio
int64
qsc_codepython_cate_var_zero
int64
qsc_codepython_frac_lines_pass
int64
qsc_codepython_frac_lines_import
int64
qsc_codepython_frac_lines_simplefunc
int64
qsc_codepython_score_lines_no_logic
int64
qsc_codepython_frac_lines_print
int64
effective
string
hits
int64
073dcba49060e809569efacf6ea30ee7f0bbd718
229
py
Python
review/templatetags/review_tags.py
ChristopherOloo/KilimoQAPortal
c905a42282bbce70b5477862185ad332185307ce
[ "MIT" ]
67
2022-01-05T18:59:23.000Z
2022-03-18T13:13:39.000Z
review/templatetags/review_tags.py
ChristopherOloo/KilimoQAPortal
c905a42282bbce70b5477862185ad332185307ce
[ "MIT" ]
3
2022-01-10T10:03:23.000Z
2022-03-11T16:58:38.000Z
review/templatetags/review_tags.py
ChristopherOloo/KilimoQAPortal
c905a42282bbce70b5477862185ad332185307ce
[ "MIT" ]
4
2022-01-08T17:39:19.000Z
2022-02-28T07:40:16.000Z
from django import template register = template.Library() @register.filter def sortIt(queryset, order): return queryset.order_by(order)[:5] # @register.filter # def filterIt(queryset, by): # return queryset.filter(by)
19.083333
39
0.733624
29
229
5.758621
0.517241
0.167665
0.203593
0
0
0
0
0
0
0
0
0.005102
0.144105
229
12
40
19.083333
0.846939
0.327511
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
075c45f2689ab853ef866f137585ce373a96f02c
11,323
py
Python
code/plotting/regions_plot.py
tiwari1302/sentiment-analysis
7c4114a3fedecf10235ee7a0f35b1346bc455923
[ "MIT" ]
null
null
null
code/plotting/regions_plot.py
tiwari1302/sentiment-analysis
7c4114a3fedecf10235ee7a0f35b1346bc455923
[ "MIT" ]
null
null
null
code/plotting/regions_plot.py
tiwari1302/sentiment-analysis
7c4114a3fedecf10235ee7a0f35b1346bc455923
[ "MIT" ]
null
null
null
from collections import Counter import csv import pandas as pd import seaborn as sns import numpy as np from matplotlib import pyplot as plt plt.style.use('ggplot') df = pd.read_csv("textblob_unclean_csv.csv") #print(df['loaction'].value_counts()) Days = ['2020-06-15', '2020-06-16','2020-06-17', '2020-06-18', '2020-06-19', '2020-06-20', '2020-06-21'] n = 38583 i = 0 j = 0 d_pos_count = np.array([0, 0, 0, 0, 0, 0, 0]) d_neg_count = np.array([0, 0, 0, 0, 0, 0, 0]) d_neu_count = np.array([0, 0, 0, 0, 0, 0, 0]) m_pos_count = np.array([0, 0, 0, 0, 0, 0, 0]) m_neg_count = np.array([0, 0, 0, 0, 0, 0, 0]) m_neu_count = np.array([0, 0, 0, 0, 0, 0, 0]) h_pos_count = np.array([0, 0, 0, 0, 0, 0, 0]) h_neg_count = np.array([0, 0, 0, 0, 0, 0, 0]) h_neu_count = np.array([0, 0, 0, 0, 0, 0, 0]) for i in range(n): if (df.loc[i, 'loaction'].find('Mumbai')) != -1 or (df.loc[i, 'loaction'].find('mumbai')) != -1: if df.loc[i, 'date'].find('-15') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j] += 1 else: m_neu_count[j] += 1 if df.loc[i, 'date'].find('-16') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j+1] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j+1] += 1 else: m_neu_count[j+1] += 1 if df.loc[i, 'date'].find('-17') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j+2] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j+2] += 1 else: m_neu_count[j+2] += 1 if df.loc[i, 'date'].find('-18') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j+3] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j+3] += 1 else: m_neu_count[j+3] += 1 if df.loc[i, 'date'].find('-19') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j+4] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j+4] += 1 else: m_neu_count[j+4] += 1 if df.loc[i, 'date'].find('-20') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j+5] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j+5] += 1 else: m_neu_count[j+5] += 1 if df.loc[i, 'date'].find('-21') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: m_pos_count[j+6] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: m_neg_count[j+6] += 1 else: m_neu_count[j+6] += 1 if (df.loc[i, 'loaction'].find('Delhi')) != -1 or (df.loc[i, 'loaction'].find('delhi')) != -1: if df.loc[i, 'date'].find('-15') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j] += 1 else: d_neu_count[j] += 1 if df.loc[i, 'date'].find('-16') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j+1] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j+1] += 1 else: d_neu_count[j+1] += 1 if df.loc[i, 'date'].find('-17') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j+2] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j+2] += 1 else: d_neu_count[j+2] += 1 if df.loc[i, 'date'].find('-18') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j+3] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j+3] += 1 else: d_neu_count[j+3] += 1 if df.loc[i, 'date'].find('-19') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j+4] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j+4] += 1 else: d_neu_count[j+4] += 1 if df.loc[i, 'date'].find('-20') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j+5] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j+5] += 1 else: d_neu_count[j+5] += 1 if df.loc[i, 'date'].find('-21') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: d_pos_count[j+6] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: d_neg_count[j+6] += 1 else: d_neu_count[j+6] += 1 if (df.loc[i, 'loaction'].find('Hyderabad')) != -1 or (df.loc[i, 'loaction'].find('hyderabad')) != -1: if df.loc[i, 'date'].find('-15') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j] += 1 else: h_neu_count[j] += 1 if df.loc[i, 'date'].find('-16') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j+1] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j+1] += 1 else: h_neu_count[j+1] += 1 if df.loc[i, 'date'].find('-17') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j+2] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j+2] += 1 else: h_neu_count[j+2] += 1 if df.loc[i, 'date'].find('-18') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j+3] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j+3] += 1 else: h_neu_count[j+3] += 1 if df.loc[i, 'date'].find('-19') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j+4] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j+4] += 1 else: h_neu_count[j+4] += 1 if df.loc[i, 'date'].find('-20') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j+5] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j+5] += 1 else: h_neu_count[j+5] += 1 if df.loc[i, 'date'].find('-21') != -1: if df.loc[i, 'TextBlob_Sentiment_clean']==1: h_pos_count[j+6] += 1 elif df.loc[i, 'TextBlob_Sentiment_clean']==-1: h_neg_count[j+6] += 1 else: h_neu_count[j+6] += 1 x_indexs = np.arange(len(Days)) BarWidth = 0.25 epsilon = 0.006 opacity = 0.75 pos_posn = np.arange(len(Days)) neg_posn = pos_posn + BarWidth neu_posn = neg_posn + BarWidth pos_bar_d = plt.bar(pos_posn, d_pos_count, BarWidth-epsilon, color = 'blue', label='Positive', alpha = opacity) neg_bar_d = plt.bar(pos_posn, d_neg_count, BarWidth-epsilon, color = 'red', bottom = d_pos_count, alpha = opacity, label='Negative') neu_bar_d = plt.bar(pos_posn, d_neu_count, BarWidth-epsilon, color = 'green', bottom = d_neg_count + d_pos_count, alpha = opacity, label='Neutral') pos_bar_m = plt.bar(neg_posn, m_pos_count, BarWidth-epsilon, color = 'blue', alpha = opacity) neg_bar_m = plt.bar(neg_posn, m_neg_count, BarWidth-epsilon, color = 'red', bottom = m_pos_count, alpha = opacity) neu_bar_m = plt.bar(neg_posn, m_neu_count, BarWidth-epsilon, color = 'green', bottom = m_pos_count + m_neg_count, alpha = opacity) pos_bar_h = plt.bar(neu_posn, h_pos_count, BarWidth-epsilon, color = 'blue', alpha = opacity) neg_bar_h = plt.bar(neu_posn, h_neg_count, BarWidth-epsilon, color = 'red', bottom = h_pos_count, alpha = opacity) neu_bar_h = plt.bar(neu_posn, h_neu_count, BarWidth-epsilon, color = 'green', bottom = h_pos_count + h_neg_count, alpha = opacity) text = plt.annotate("New Delhi", xy=(0,14), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(0.25,8), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(0.50,6), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("New Delhi", xy=(1,725), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(1.25,413), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(1.50,322), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("New Delhi", xy=(2,740), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(2.25,448), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(2.50,227), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("New Delhi", xy=(3,448), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(3.25,290), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(3.50,123), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("New Delhi", xy=(4, 906), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(4.25,460), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(4.50,312), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("New Delhi", xy=(5,806), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(5.25,502), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(5.50,234), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("New Delhi", xy=(6,456), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Mumbai", xy=(6.25,267), ha="center", va="bottom") text.set_rotation(90) text = plt.annotate("Hyderabad", xy=(6.5,100), ha="center", va="bottom") text.set_rotation(90) plt.xticks(pos_posn, Days, rotation=45) plt.title('Sentiment of top 3 active regions over the period of 7 days') plt.xlabel('Date') plt.ylabel('Counts') plt.legend() #plt.legend(bbox_to_anchor=(0, 1.02, 1, 0.8)) # plt.annotate(Days, ('Delhi', 'Mumbai', 'Hyderabad')) plt.show() """ print("\nDelhi Sentiments over the period of a week") print("Positive", d_pos_count) print("Negative", d_neg_count) print("Neutral", d_neu_count) print("Mumbai Sentiments over the period of a week") print("Positive", m_pos_count) print("Negative", m_neg_count) print("Neutral", m_neu_count) print("\Hyderabad Sentiments over the period of a week") print("Positive", h_pos_count) print("Negative", h_neg_count) print("Neutral", h_neu_count) """
38.513605
147
0.552415
1,794
11,323
3.295429
0.080825
0.058356
0.070027
0.060893
0.829838
0.829499
0.78366
0.692659
0.687077
0.665257
0
0.062627
0.262475
11,323
293
148
38.645051
0.645312
0.011746
0
0.444915
0
0
0.176104
0.096107
0
0
0
0
0
1
0
false
0
0.025424
0
0.025424
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0762ec9535de03c0d3d2c15c6c5af10ca2f14595
13,900
py
Python
examples/CROMU_00096/poller/for-release/machine.py
li-xin-yi/cgc-cbs
eda14dc564ab0e57b44dfcd38a77d95086fee96f
[ "MIT" ]
5
2019-06-11T13:06:42.000Z
2022-02-21T15:37:22.000Z
examples/CROMU_00096/poller/for-release/machine.py
li-xin-yi/cgc-cbs
eda14dc564ab0e57b44dfcd38a77d95086fee96f
[ "MIT" ]
1
2021-11-20T03:46:09.000Z
2021-11-22T16:42:52.000Z
examples/CROMU_00096/poller/for-release/machine.py
li-xin-yi/cgc-cbs
eda14dc564ab0e57b44dfcd38a77d95086fee96f
[ "MIT" ]
2
2020-11-06T23:16:00.000Z
2022-02-20T01:12:40.000Z
#!/usr/bin/env python import random import string from struct import pack, unpack from generator.actions import Actions FILE_TEXT = 0xf1 FILE_EXECUTABLE = 0xf2 FILE_IMAGE = 0xf3 FILE_LINK = 0xf4 FILE_RAW = 0xf5 FILE_LIBRARY = 0xf6 FILE_DIRECTORY = 0xf7 FILE_INVALID = 0xf8 MAX_FILE_SIZE = 2048 MAX_FILESYSTEM_DEPTH = 10 MAX_FILES_IN_SYSTEM = 256 FS_SUCCESS = 0 FS_ERROR_INVALID_INPUT = -1 FS_ERROR_FILE_NOT_FOUND = -2 FS_ERROR_DUPLICATE_NAME = -3 FS_ERROR_ACCESS_DENIED = -4 FS_ERROR_FS_FULL = -5 UPLOAD_A_FILE = 'u' READ_A_FILE = 'r' DELETE_A_FILE = 'd' LIST_FILES = 'l' LIST_FILES_LONG = 'g' CREATE_DIR = 'c' MOVE_FILE = 'm' PWD = 'w' CHANGE_DIR = 'h' EXIT_CMD = 'x' EXECUTABLE_FILE_MAGIC =0xC67CC76C EXECUTABLE_TYPE_LIBRARY =0xe1 EXECUTABLE_TYPE_EXECUTABLE =0xe2 OPCODE_READ_MEM =0x37 OPCODE_WRITE_MEM =0x38 OPCODE_WRITE_REG =0x39 OPCODE_EXIT =0x40 SHORTCUT_MAGIC = 0x4c494e4b class FileNode(): def __init__(self, name, type, contents, fileID): self.name = name self.type = type if (type != FILE_DIRECTORY): self.contents = contents else: self.contents = "" self.next = None self.prev = None self.child = None self.parent = None self.fileID = fileID class FileSystem(): file_types = [FILE_TEXT, FILE_EXECUTABLE, FILE_IMAGE, FILE_LINK, FILE_RAW, FILE_LIBRARY, FILE_DIRECTORY] FLAVOR_SL_FILE = '/\x02\x00\x00l\xc7|\xc6\xe1\x01\x00\x15\x00\x07\x00[\x00\x06\x00)\x02SharedLibraryMain\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00)\x02\x00\x00\x00\x00This is a text file\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00This is an executable\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00This is an image\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00This is a link\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00This file is raw\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00This is a shared library\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00This is a directory\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x007\xa0\x80\x04\x08@' def __init__(self, magic_page): self.fileIdIndex = 0 self.magic_page = magic_page self.root = FileNode("root", FILE_DIRECTORY, "", 0) self.cwd = self.root self.numFiles = 1 self.allFiles = [] self.currentFile = None user = FileNode("User", FILE_DIRECTORY, "", self.getNextFileID()) documents = FileNode("Documents", FILE_DIRECTORY, "", self.getNextFileID()) self.root.child = documents documents.parent = self.root system = FileNode("System", FILE_DIRECTORY, "", self.getNextFileID()) documents.next = system system.prev = documents system.parent = self.root system.next = user user.prev = system user.parent = self.root special = FileNode("Special", FILE_DIRECTORY, "", self.getNextFileID()) special.parent = system system.child = special flavor = FileNode("Flavor.sl", FILE_LIBRARY, self.FLAVOR_SL_FILE, self.getNextFileID()) flavor.resources = ["This is a text file", "This is an executable", "This is an image", "This is a link", "This file is raw", "This is a shared library", "This is a directory"] flavor.parent = special special.child = flavor self.reservedFiles = ["System", "Special", "Flavor.sl", "root"] self.resourceDefault = flavor def getNextFileID(self): fileId = unpack("<H", self.magic_page[self.fileIdIndex:self.fileIdIndex+2])[0] self.fileIdIndex += 2 if (self.fileIdIndex >= 4096): self.fileIdIndex = 0 return (fileId & 0xff) def CreateFile(self, name, type, contents, parent): newNode = FileNode(name, type, contents, self.getNextFileID()) self.numFiles += 1 newNode.parent = parent prev = parent.child self.allFiles.append(newNode) self.currentFile = newNode if (prev == None): parent.child = newNode return FS_SUCCESS while (prev != None): if (name == prev.name): self.allFiles.remove(newNode) return FS_ERROR_DUPLICATE_NAME if (name < prev.name): #Insert here if (prev.prev == None): #First in Directory newNode.next = prev prev.prev = newNode parent.child = newNode return FS_SUCCESS else: newNode.next = prev newNode.prev = prev.prev prev.prev.next = newNode newNode.next.prev = newNode return FS_SUCCESS else: #Keep looking last = prev prev = prev.next last.next = newNode newNode.prev = last return FS_SUCCESS def pickAFile(self): if (len(self.allFiles) > 0): return random.choice(self.allFiles) else: return None def pickAResourceFile(self): resourceFiles = [self.resourceDefault] for file in self.allFiles: if (file.type == FILE_LIBRARY): resourceFiles.append(file) return random.choice(resourceFiles) def Delete(self, file): #remove links if (file.parent.child == file): file.parent.child = file.next if (file.prev): file.prev.next = file.next if (file.next): file.next.prev = file.prev file.prev = None file.next = None self.RemoveNode(file) def RemoveNode(self, file): if (file): self.numFiles -= 1 self.RemoveNode(file.child) self.RemoveNode(file.next) if (file in self.allFiles): self.allFiles.remove(file) def ListFiles(self): output = "" output = self.ListFilesRecurse(output, self.cwd, 0) return output def ListFilesRecurse(self, output, file, level): if (file): output += " " * level * 4 output += "%s (%d)\n" % (file.name, file.fileID) output += self.ListFilesRecurse("", file.child, level + 1) output += self.ListFilesRecurse("", file.next, level) return output def ListFilesLong(self): output = "" file = self.cwd.child while (file): flavorText = self.resourceDefault.resources[file.type - FILE_TEXT] if (file.type == FILE_LINK): resourceFile = self.GetFile(file.resourceName) if (resourceFile == self.resourceDefault): flavorText = resourceFile.resources[file.resourceIndex] output += "%s \t%d\t%s\n" % (file.name, len(file.contents), flavorText) file = file.next return output def ChangeDirectory(self): possible = ["upone"] next = self.cwd.child while (next): if ((next.type == FILE_DIRECTORY) and (next.name != "System")): possible.append(next) next = next.next newDir = random.choice(possible) if (newDir == "upone"): if (self.cwd != self.root): self.cwd = self.cwd.parent else: self.cwd = newDir self.allFiles = [] file = self.cwd.child while (file != None): if (file.name not in self.reservedFiles): self.allFiles.append(file) file = file.next return newDir def GetFile(self, name): if (name == "System%Special%Flavor.sl"): return self.resourceDefault for each in self.allFiles: if each.name == name: return each return None def pwd(self): walk = [] output = "" node = self.cwd.parent while (node): walk.append(node) node = node.parent while (len(walk) > 0): node = walk.pop() output += node.name + "%" output += self.cwd.name return output class CROMU_00096_Generator(Actions): def start(self): self.delay(50) self.commands = 0 self.fs = FileSystem(self.magic_page) def menu(self): self.read(length=1, expect=">") if (self.commands > 20): self.exit() return -1 def randomString(self, min, max): s = ''.join(random.choice(string.ascii_letters) for _ in range(random.randint(min, max))) return s def writeCString(self, s): if ((s != None) and (len(s)>0)): self.write(pack("<H", len(s))) self.write(s) else: self.write(pack("<H", 0)) def cwd(self): self.write(PWD+'\n') output = self.fs.pwd() self.read(length=len(output) + 1, expect=output + "\n") def UploadFile(self): self.write(UPLOAD_A_FILE + '\n') type = random.choice(self.fs.file_types) if (type == FILE_LIBRARY): name = self.randomString(1, 61) + ".sl" (contents, resources) = self.BuildLibraryFile(name) elif (type == FILE_LINK): name = self.randomString(1, 61) + ".lk" resourceFile = self.fs.pickAResourceFile() if (resourceFile): if (resourceFile == self.fs.resourceDefault): resourceName = "System%Special%Flavor.sl" else: resourceName = resourceFile.name resourceIndex = random.randint(0, len(resourceFile.resources) - 1) else: resourceName = self.randomString(1, 61) + ".sl" resourceIndex = 0 contents = self.BuildShortcutFile(resourceName, resourceIndex) else: contents = self.randomString(1, 2048) name = self.randomString(1, 64) if (name in self.fs.reservedFiles): name = "A" + name self.writeCString(name) self.write(pack("<B", type)) self.writeCString(contents) if self.fs.CreateFile(name, type, contents, self.fs.cwd) != FS_SUCCESS: self.read(delim='\n', expect="FAILED") file = self.fs.GetFile(name) if (file.type == FILE_LIBRARY): file.resources = resources elif (file.type == FILE_LINK): file.resourceIndex = resourceIndex file.resourceName = resourceName def ReadAFile(self): file = self.fs.pickAFile() if (file == None): self.write("\n\n") self.read(delim='\n', expect="Invalid Command\n") return self.write(READ_A_FILE + "\n") self.writeCString(file.name) output = file.contents.split('\x00')[0] + '\n' self.read(length=len(output), expect=output) def DeleteAFile(self): file = self.fs.pickAFile() if (file == None): self.write("\n\n") self.read(delim='\n', expect="Invalid Command\n") return self.write(DELETE_A_FILE + '\n') self.writeCString(file.name) self.fs.Delete(file) def ListFiles(self): self.write(LIST_FILES + '\n') fileList = self.fs.ListFiles() self.read(length=len(fileList), expect=fileList) def CreateDir(self): self.write(CREATE_DIR + '\n') name = self.randomString(1, 64) type = FILE_DIRECTORY self.writeCString(name) if self.fs.CreateFile(name, type, "", self.fs.cwd) != FS_SUCCESS: self.read(delim='\n', expect="FAILED") def ChangeDir(self): newDir = self.fs.ChangeDirectory() self.write(CHANGE_DIR + '\n') if (newDir == "upone"): self.writeCString("upone") else: self.writeCString(newDir.name) def ListFilesLong(self): self.write(LIST_FILES_LONG + '\n') fileList = self.fs.ListFilesLong() if (len(fileList) > 0): self.read(length=len(fileList), expect=fileList) def padString(self, s, length): if (len(s) > length): return s[0:length] return s + '\x00' * (length - len(s)) def BuildShortcutFile(self, targetName, index): file = pack("<I", 0x4c494e4b) file += self.padString(targetName, 65) file += pack("<I", index) file = pack("<I", 4 + len(file)) + file return file def BuildLibraryFile(self, name): functions = "\x37\xa0\x80\x04\x08\x40" header = pack("<I", 0xC67CC76C) #magic header += pack("<B", 0xe1) #type header += pack("<H", 1) #func count header += pack("<H", 21) #func table offset numResources = random.randint(1, 10) header += pack("<H", numResources) #resource count header += pack("<H", 21 + 1*(64+2+4)) #resource offset header += pack("<H", len(functions)) #functionssize header += pack("<H", 21 + 1*(64+2+4) + numResources*(2+64)) #functions offset functionTable = self.padString("SharedLibraryMain", 64) functionTable += "\x00\x00" functionTable += pack("<I", 21 + 1*(64+2+4) + numResources*(2+64)) resourceTable = "" resources = [] for num in range(numResources): resource = ''.join(random.choice(string.ascii_letters) for _ in range(random.randint(1, 64))) resources.append(resource) resourceTable += "\x00\x00" + self.padString(resource, 64) file = pack("<I", 4 + len(header) + len(functionTable) + len(resourceTable) + len(functions)) file += header + functionTable + resourceTable + functions return (file, resources) def exit(self): self.write(EXIT_CMD + "\n") self.read(length=1, expect='\n')
32.25058
1,795
0.635108
1,922
13,900
4.526535
0.128512
0.255172
0.370345
0.481379
0.288736
0.226667
0.205172
0.198276
0.18023
0.18023
0
0.092719
0.219424
13,900
430
1,796
32.325581
0.709124
0.012014
0
0.184136
0
0.002833
0.165646
0.130286
0
0
0.007582
0
0
1
0.084986
false
0
0.011331
0
0.181303
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
076304d1737c6f8563cb0e87a9d5966481b4732c
7,592
py
Python
tests/08_session_operator_test.py
mrk-its/airflow-livy-operators
5e2b14a917500af736e0486bbf3b564c13fe208a
[ "MIT" ]
null
null
null
tests/08_session_operator_test.py
mrk-its/airflow-livy-operators
5e2b14a917500af736e0486bbf3b564c13fe208a
[ "MIT" ]
null
null
null
tests/08_session_operator_test.py
mrk-its/airflow-livy-operators
5e2b14a917500af736e0486bbf3b564c13fe208a
[ "MIT" ]
null
null
null
import requests import responses from airflow import AirflowException from airflow.models import Connection from airflow.providers.http.hooks.http import HttpHook from pytest import mark, raises from airflow_home.plugins.airflow_livy.session import LivySessionOperator from tests.helpers import MockedResponse from tests.mock_sessions import STATEMENT_ID, mock_livy_session_responses @responses.activate def test_run_session_successfully(dag, mocker): st1 = LivySessionOperator.Statement(kind="spark", code="x = 1;") st2 = LivySessionOperator.Statement(kind="pyspark", code="print 'hi';") statements = [st1, st2] op = LivySessionOperator( statements=statements, spill_logs=False, task_id="test_run_session_successfully", dag=dag, ) spill_logs_spy = mocker.spy(op, "spill_session_logs") submit_statement_spy = mocker.spy(op, "submit_statement") mock_livy_session_responses(mocker) op.execute({}) submit_statement_spy.call_count = len(statements) # spill_logs is False and session completed successfully, so we don't expect logs. spill_logs_spy.assert_not_called() op.spill_logs = True op.execute({}) submit_statement_spy.call_count = len(statements) * 2 # We set spill_logs to True this time, therefore expecting logs. spill_logs_spy.assert_called_once() def test_run_session_error_before_session_created(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_error_before_session_created", dag=dag, ) spill_logs_spy = mocker.spy(op, "spill_session_logs") mocker.patch.object( HttpHook, "get_connection", return_value=Connection(host="HOST", port=123), ) with raises(requests.exceptions.ConnectionError) as ae: op.execute({}) print( f"\n\nNo response from server was mocked, " f"got the expected exception:\n<{ae.value}>" ) # Even though we set spill_logs to True, Operator doesn't have a session_id yet. spill_logs_spy.assert_not_called() @responses.activate @mark.parametrize("code", [404, 403, 500, 503, 504]) def test_run_session_error_during_status_probing(dag, mocker, code): op = LivySessionOperator( statements=[], spill_logs=True, task_id=f"test_run_session_error_during_status_probing_{code}", dag=dag, ) spill_logs_spy = mocker.spy(op, "spill_session_logs") mock_livy_session_responses( mocker, mock_get_session=[MockedResponse(code, body=f"Response from server:{code}")], ) with raises(AirflowException) as ae: op.execute({}) print( f"\n\nImitated {code} response from server during session creation probing , " f"got the expected exception:\n<{ae.value}>" ) # spill_logs=True, and Operator had the session_id by the time error occured. spill_logs_spy.assert_called_once() op.spill_logs = False with raises(AirflowException): op.execute({}) # spill_logs=False, but error occured and Operator had the session_id. assert spill_logs_spy.call_count == 2 @responses.activate @mark.parametrize("code", [404, 403, 500, 503, 504]) def test_run_session_error_when_submitting_statement(dag, mocker, code): st1 = LivySessionOperator.Statement(kind="spark", code="x = 1;") st2 = LivySessionOperator.Statement(kind="pyspark", code="print 'hi';") op = LivySessionOperator( statements=[st1, st2], spill_logs=True, task_id=f"test_run_session_error_when_submitting_statement_{code}", dag=dag, ) spill_logs_spy = mocker.spy(op, "spill_session_logs") submit_statement_spy = mocker.spy(op, "submit_statement") mock_livy_session_responses( mocker, mock_post_statement=[ MockedResponse(200, json_body={"id": STATEMENT_ID}), MockedResponse(code, body=f"Response from server:{code}"), MockedResponse(200, json_body={"no id here": "haha"}), ], ) with raises(AirflowException) as ae: op.execute({}) print( f"\n\nImitated {code} response from server during second statement submission, " f"got the expected exception:\n<{ae.value}>" ) # spill_logs=True, and Operator had the session_id by the time error occured. spill_logs_spy.assert_called_once() assert submit_statement_spy.call_count == 2 op.spill_logs = False with raises(AirflowException): op.execute({}) print( f"\n\nImitated {code} response from server during first statement submission, " f"got the expected exception:\n<{ae.value}>" ) # spill_logs=False, but error occured and Operator had the session_id. assert spill_logs_spy.call_count == 2 assert submit_statement_spy.call_count == 3 @responses.activate def test_run_session_logs_less_pages_than_page_size(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_logs_less_pages_than_page_size", dag=dag, ) fetch_log_page_spy = mocker.spy(op, "fetch_log_page") mock_livy_session_responses(mocker, log_lines=7) op.execute({}) fetch_log_page_spy.assert_called_once() @responses.activate def test_run_session_logs_one_page_size(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_logs_one_page_size", dag=dag, ) fetch_log_page_spy = mocker.spy(op, "fetch_log_page") mock_livy_session_responses(mocker, log_lines=100) op.execute({}) fetch_log_page_spy.assert_called_once() @responses.activate def test_run_session_logs_multiple_of_page_size(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_logs_multiple_of_page_size", dag=dag, ) fetch_log_page_spy = mocker.spy(op, "fetch_log_page") mock_livy_session_responses(mocker, log_lines=300) op.execute({}) assert fetch_log_page_spy.call_count == 3 @responses.activate def test_run_session_logs_greater_than_page_size(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_logs_greater_than_page_size", dag=dag, ) fetch_log_page_spy = mocker.spy(op, "fetch_log_page") mock_livy_session_responses(mocker, log_lines=321) op.execute({}) assert fetch_log_page_spy.call_count == 4 @responses.activate def test_run_session_logs_malformed_json(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_logs_malformed_json", dag=dag, ) mock_livy_session_responses(mocker, log_override_response='{"invalid":json]}') with raises(AirflowException) as ae: op.execute({}) print( f"\n\nImitated malformed response when calling /logs , " f"got the expected exception:\n<{ae.value}>" ) @responses.activate def test_run_session_logs_missing_attrs_in_json(dag, mocker): op = LivySessionOperator( statements=[], spill_logs=True, task_id="test_run_session_logs_missing_attrs_in_json", dag=dag, ) mock_livy_session_responses(mocker, log_override_response='{"id": 1, "from": 2}') with raises(AirflowException) as ae: op.execute({}) print( f"\n\nImitated missing attributes when calling /logs , " f"got the expected exception:\n<{ae.value}>" )
34.352941
88
0.699947
990
7,592
5.056566
0.164646
0.055733
0.055933
0.043148
0.80863
0.797044
0.747503
0.711546
0.667
0.59968
0
0.011179
0.198762
7,592
220
89
34.509091
0.811771
0.067439
0
0.571429
0
0
0.197822
0.080882
0
0
0
0
0.068783
1
0.05291
false
0
0.047619
0
0.100529
0.042328
0
0
0
null
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
076452767753ab382c36a10701f870744025a213
3,136
py
Python
Doc/tools/docutils/readers/python/pynodes.py
cocoatomo/Python3.2_C_API_Tutorial
e33d4a285429935aca3178dc2a97aca3ab484232
[ "PSF-2.0" ]
2
2019-03-03T00:04:36.000Z
2020-10-06T16:22:38.000Z
Doc/tools/docutils/readers/python/pynodes.py
cocoatomo/Python3.2_C_API_Tutorial
e33d4a285429935aca3178dc2a97aca3ab484232
[ "PSF-2.0" ]
null
null
null
Doc/tools/docutils/readers/python/pynodes.py
cocoatomo/Python3.2_C_API_Tutorial
e33d4a285429935aca3178dc2a97aca3ab484232
[ "PSF-2.0" ]
1
2019-03-03T00:04:38.000Z
2019-03-03T00:04:38.000Z
#! /usr/bin/env python # $Id: pynodes.py 78909 2010-03-13 10:49:23Z georg.brandl $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. from docutils import nodes from docutils.nodes import Element, TextElement, Structural, Inline, Part, \ Text import types # This is the parent class of all the other pynode classes: class PythonStructural(Structural): pass # ===================== # Structural Elements # ===================== class module_section(PythonStructural, Element): pass class class_section(PythonStructural, Element): pass class class_base(PythonStructural, Element): pass class method_section(PythonStructural, Element): pass class attribute(PythonStructural, Element): pass class function_section(PythonStructural, Element): pass class class_attribute_section(PythonStructural, Element): pass class class_attribute(PythonStructural, Element): pass class expression_value(PythonStructural, Element): pass class attribute(PythonStructural, Element): pass # Structural Support Elements # --------------------------- class parameter_list(PythonStructural, Element): pass class parameter_tuple(PythonStructural, Element): pass class parameter_default(PythonStructural, TextElement): pass class import_group(PythonStructural, TextElement): pass class import_from(PythonStructural, TextElement): pass class import_name(PythonStructural, TextElement): pass class import_alias(PythonStructural, TextElement): pass class docstring(PythonStructural, Element): pass # ================= # Inline Elements # ================= # These elements cannot become references until the second # pass. Initially, we'll use "reference" or "name". class object_name(PythonStructural, TextElement): pass class parameter_list(PythonStructural, TextElement): pass class parameter(PythonStructural, TextElement): pass class parameter_default(PythonStructural, TextElement): pass class class_attribute(PythonStructural, TextElement): pass class attribute_tuple(PythonStructural, TextElement): pass # ================= # Unused Elements # ================= # These were part of the model, and maybe should be in the future, but # aren't now. #class package_section(PythonStructural, Element): pass #class module_attribute_section(PythonStructural, Element): pass #class instance_attribute_section(PythonStructural, Element): pass #class module_attribute(PythonStructural, TextElement): pass #class instance_attribute(PythonStructural, TextElement): pass #class exception_class(PythonStructural, TextElement): pass #class warning_class(PythonStructural, TextElement): pass # Collect all the classes we've written above def install_node_class_names(): node_class_names = [] for name, var in globals().items(): if (type(var) is types.ClassType and issubclass(var, PythonStructural) \ and name.lower() == name): node_class_names.append(var.tagname or name) # Register the new node names with GenericNodeVisitor and # SpecificNodeVisitor: nodes._add_node_class_names(node_class_names) install_node_class_names()
38.243902
76
0.759885
355
3,136
6.583099
0.343662
0.103979
0.184852
0.191699
0.496363
0.299957
0.201968
0.110398
0
0
0
0.006894
0.121173
3,136
81
77
38.716049
0.841074
0.38074
0
0.105263
0
0
0
0
0
0
0
0
0
1
0.026316
false
0.657895
0.184211
0
0.868421
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
4ad12f838318ceee31689a391d29dfee1e71ad86
142
py
Python
apps/front/views.py
whan6795/myweb
3fad3960d7c33d269fa20f49f96a4c0ee219ddf4
[ "MIT" ]
null
null
null
apps/front/views.py
whan6795/myweb
3fad3960d7c33d269fa20f49f96a4c0ee219ddf4
[ "MIT" ]
null
null
null
apps/front/views.py
whan6795/myweb
3fad3960d7c33d269fa20f49f96a4c0ee219ddf4
[ "MIT" ]
null
null
null
# encoding:utf-8 from flask import Blueprint bp = Blueprint('front', __name__) @bp.route('/front') def index(): return '前台首页'
14.2
34
0.633803
18
142
4.777778
0.833333
0
0
0
0
0
0
0
0
0
0
0.009009
0.21831
142
9
35
15.777778
0.765766
0.098592
0
0
0
0
0.128205
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0.4
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
4
4ad27a020c6780b5a5bee5c813f8c89f61b83e2b
799
py
Python
tcfcli/cmds/eventdata/cli.py
tencentyun/scfcli
ef15508ad34a851cf0d2750dfaa5202f6a600887
[ "Apache-2.0" ]
103
2019-06-11T06:09:56.000Z
2021-12-18T22:48:59.000Z
tcfcli/cmds/eventdata/cli.py
TencentCloud/Serverless-cli
57f98b24cfd10712770a4806212cfb69d981a11a
[ "Apache-2.0" ]
8
2019-07-12T12:08:40.000Z
2020-10-20T07:18:17.000Z
tcfcli/cmds/eventdata/cli.py
TencentCloud/Serverless-cli
57f98b24cfd10712770a4806212cfb69d981a11a
[ "Apache-2.0" ]
49
2019-06-11T06:26:05.000Z
2020-02-19T08:13:36.000Z
# -*- coding: utf-8 -*- import click from .list.cli import list from .get.cli import get from .update.cli import update from tcfcli.help.message import EventdataHelp as help @click.group(name='eventdata', short_help=help.SHORT_HELP) def eventdata(): ''' \b Scf remote function event manage. \b Common usage: \b * Show the SCF function event list $ scf eventdata list --name Function1 \b * Get a function event $ scf eventdata get --name test --event event \b * Update eventdata to remote function $ scf eventdata update --name test --dir . ''' pass eventdata.add_command(list) eventdata.add_command(get) eventdata.add_command(update)
24.212121
60
0.598248
97
799
4.876289
0.391753
0.057082
0.120507
0
0
0
0
0
0
0
0
0.003656
0.315394
799
32
61
24.96875
0.86106
0.434293
0
0
0
0
0.02719
0
0
0
0
0
0
1
0.090909
true
0.090909
0.454545
0
0.545455
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
1
0
0
4
4ae105aa59f45a089a765821666023fa1ed64939
9,013
py
Python
ironicclient/tests/unit/test_client.py
pyrrrat/moved-python-ironicclient
836abe5c6e8365ad1c409e98d430dd674dcc4aba
[ "Apache-2.0" ]
null
null
null
ironicclient/tests/unit/test_client.py
pyrrrat/moved-python-ironicclient
836abe5c6e8365ad1c409e98d430dd674dcc4aba
[ "Apache-2.0" ]
null
null
null
ironicclient/tests/unit/test_client.py
pyrrrat/moved-python-ironicclient
836abe5c6e8365ad1c409e98d430dd674dcc4aba
[ "Apache-2.0" ]
null
null
null
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import fixtures import mock import ironicclient from ironicclient.client import get_client from ironicclient.common import filecache from ironicclient import exc from ironicclient.tests.unit import utils from ironicclient.v1 import client as v1 def fake_get_ksclient(**kwargs): return utils.FakeKeystone('KSCLIENT_AUTH_TOKEN') class ClientTest(utils.BaseTestCase): def test_get_client_with_auth_token_ironic_url(self): self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'ironic_url': 'http://ironic.example.org:6385/', 'os_auth_token': 'USER_AUTH_TOKEN', } client = get_client('1', **kwargs) self.assertEqual('USER_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://ironic.example.org:6385/', client.http_client.endpoint) def test_get_client_no_auth_token(self): self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', } client = get_client('1', **kwargs) self.assertEqual('KSCLIENT_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://localhost:6385/v1/f14b41234', client.http_client.endpoint) self.assertEqual(fake_get_ksclient().auth_ref, client.http_client.auth_ref) def test_get_client_with_region_no_auth_token(self): self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_region_name': 'REGIONONE', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', } client = get_client('1', **kwargs) self.assertEqual('KSCLIENT_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://regionhost:6385/v1/f14b41234', client.http_client.endpoint) self.assertEqual(fake_get_ksclient().auth_ref, client.http_client.auth_ref) def test_get_client_with_auth_token(self): self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': 'USER_AUTH_TOKEN', } client = get_client('1', **kwargs) self.assertEqual('USER_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://localhost:6385/v1/f14b41234', client.http_client.endpoint) self.assertEqual(fake_get_ksclient().auth_ref, client.http_client.auth_ref) def test_get_client_with_region_name_auth_token(self): self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_region_name': 'REGIONONE', 'os_auth_token': 'USER_AUTH_TOKEN', } client = get_client('1', **kwargs) self.assertEqual('USER_AUTH_TOKEN', client.http_client.auth_token) self.assertEqual('http://regionhost:6385/v1/f14b41234', client.http_client.endpoint) self.assertEqual(fake_get_ksclient().auth_ref, client.http_client.auth_ref) def test_get_client_no_url_and_no_token(self): self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', fake_get_ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': '', 'os_auth_token': '', } self.assertRaises(exc.AmbiguousAuthSystem, get_client, '1', **kwargs) # test the alias as well to ensure backwards compatibility self.assertRaises(exc.AmbigiousAuthSystem, get_client, '1', **kwargs) def test_ensure_auth_ref_propagated(self): ksclient = fake_get_ksclient self.useFixture(fixtures.MonkeyPatch( 'ironicclient.client._get_ksclient', ksclient)) kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', } client = get_client('1', **kwargs) self.assertEqual(ksclient().auth_ref, client.http_client.auth_ref) @mock.patch.object(filecache, 'retrieve_data', autospec=True) @mock.patch.object(ironicclient.client, '_get_ksclient', autospec=True) def _get_client_with_api_version(self, version, mock_ksclient, mock_retrieve_data): mock_ksclient.return_value = fake_get_ksclient() kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', 'os_ironic_api_version': version, } client = get_client('1', **kwargs) self.assertEqual(0, mock_retrieve_data.call_count) self.assertEqual(version, client.http_client.os_ironic_api_version) self.assertEqual('user', client.http_client.api_version_select_state) def test_get_client_with_api_version_latest(self): self._get_client_with_api_version("latest") def test_get_client_with_api_version_numeric(self): self._get_client_with_api_version("1.4") @mock.patch.object(filecache, 'retrieve_data', autospec=True) @mock.patch.object(ironicclient.client, '_get_ksclient', autospec=True) def test_get_client_default_version_set_no_cache(self, mock_ksclient, mock_retrieve_data): mock_ksclient.return_value = fake_get_ksclient() mock_retrieve_data.return_value = None kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', } client = get_client('1', **kwargs) mock_retrieve_data.assert_called_once_with( host=utils.DEFAULT_TEST_HOST, port=utils.DEFAULT_TEST_PORT) self.assertEqual(v1.DEFAULT_VER, client.http_client.os_ironic_api_version) self.assertEqual('default', client.http_client.api_version_select_state) @mock.patch.object(filecache, 'retrieve_data', autospec=True) @mock.patch.object(ironicclient.client, '_get_ksclient', autospec=True) def test_get_client_default_version_set_cached(self, mock_ksclient, mock_retrieve_data): version = '1.3' # Make sure we don't coincidentally succeed self.assertNotEqual(v1.DEFAULT_VER, version) mock_ksclient.return_value = fake_get_ksclient() mock_retrieve_data.return_value = version kwargs = { 'os_tenant_name': 'TENANT_NAME', 'os_username': 'USERNAME', 'os_password': 'PASSWORD', 'os_auth_url': 'http://localhost:35357/v2.0', 'os_auth_token': '', } client = get_client('1', **kwargs) mock_retrieve_data.assert_called_once_with(host=mock.ANY, port=mock.ANY) self.assertEqual(version, client.http_client.os_ironic_api_version) self.assertEqual('cached', client.http_client.api_version_select_state)
42.314554
79
0.629313
1,020
9,013
5.217647
0.15098
0.049042
0.063134
0.03307
0.758925
0.742954
0.726794
0.670613
0.654077
0.64487
0
0.020463
0.262621
9,013
212
80
42.514151
0.780319
0.071563
0
0.657143
0
0
0.213747
0.030176
0
0
0
0
0.154286
1
0.074286
false
0.051429
0.045714
0.005714
0.131429
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
4ae17c8425e72279dd675e3b5b8ace9186b73de2
730
py
Python
backend-project/small_eod/cases/migrations/0010_auto_20200420_0705.py
WlodzimierzKorza/small_eod
027022bd71122a949a2787d0fb86518df80e48cd
[ "MIT" ]
64
2019-12-30T11:24:03.000Z
2021-06-24T01:04:56.000Z
backend-project/small_eod/cases/migrations/0010_auto_20200420_0705.py
WlodzimierzKorza/small_eod
027022bd71122a949a2787d0fb86518df80e48cd
[ "MIT" ]
465
2018-06-13T21:43:43.000Z
2022-01-04T23:33:56.000Z
backend-project/small_eod/cases/migrations/0010_auto_20200420_0705.py
WlodzimierzKorza/small_eod
027022bd71122a949a2787d0fb86518df80e48cd
[ "MIT" ]
72
2018-12-02T19:47:03.000Z
2022-01-04T22:54:49.000Z
# Generated by Django 3.0.5 on 2020-04-20 07:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('cases', '0009_case_featureoptions'), ] operations = [ migrations.RenameField(model_name='case', old_name='comment', new_name='comments'), migrations.RenameField(model_name='case', old_name='tag', new_name='tags'), migrations.RenameField(model_name='case', old_name='audited_institution', new_name='audited_institutions'), migrations.RenameField(model_name='case', old_name='notified_user', new_name='notified_users'), migrations.RenameField(model_name='case', old_name='responsible_user', new_name='responsible_users'), ]
38.421053
115
0.715068
88
730
5.670455
0.454545
0.210421
0.260521
0.300601
0.410822
0.410822
0.410822
0
0
0
0
0.030547
0.147945
730
18
116
40.555556
0.771704
0.061644
0
0
1
0
0.248902
0.035139
0
0
0
0
0
1
0
false
0
0.083333
0
0.333333
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
ab052bc882362b39b418397c4f1d205f72817ca5
145
py
Python
libs/__init__.py
reshalfahsi/myqlanet
f0eeadd2e6c4760aaf769c469f39f0d73f5044ee
[ "MIT" ]
2
2020-12-06T07:39:07.000Z
2021-04-13T21:02:35.000Z
libs/__init__.py
reshalfahsi/myqlanet
f0eeadd2e6c4760aaf769c469f39f0d73f5044ee
[ "MIT" ]
null
null
null
libs/__init__.py
reshalfahsi/myqlanet
f0eeadd2e6c4760aaf769c469f39f0d73f5044ee
[ "MIT" ]
1
2019-11-27T22:50:26.000Z
2019-11-27T22:50:26.000Z
from .openfile import OpenFile from .alertdialog import AlertDialog __version_info__ = ('1', '0', '1') __version__ = '.'.join(__version_info__)
24.166667
40
0.744828
17
145
5.529412
0.529412
0.234043
0
0
0
0
0
0
0
0
0
0.023438
0.117241
145
5
41
29
0.710938
0
0
0
0
0
0.027586
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
ab3224167c1a0cbc101ff703931fb59fec9ee4ed
88
py
Python
app/common/error_handling.py
dgazcon27/api_erp_gestional_inc
e759120ce6177615a32616681539e2dbc722beba
[ "MIT" ]
null
null
null
app/common/error_handling.py
dgazcon27/api_erp_gestional_inc
e759120ce6177615a32616681539e2dbc722beba
[ "MIT" ]
null
null
null
app/common/error_handling.py
dgazcon27/api_erp_gestional_inc
e759120ce6177615a32616681539e2dbc722beba
[ "MIT" ]
null
null
null
class AppErrorBaseClass(Exception): pass class ObjectNotFound(AppErrorBaseClass): pass
22
40
0.852273
8
88
9.375
0.625
0
0
0
0
0
0
0
0
0
0
0
0.079545
88
4
41
22
0.925926
0
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
ab375548f742ded12d5cbbe58ff42b4b48f4dab4
1,581
py
Python
api/apps/utils/models.py
nxexox/boilerplate-generator
85975c968edad124b778a80e6e028ac3847c511e
[ "Apache-2.0" ]
null
null
null
api/apps/utils/models.py
nxexox/boilerplate-generator
85975c968edad124b778a80e6e028ac3847c511e
[ "Apache-2.0" ]
null
null
null
api/apps/utils/models.py
nxexox/boilerplate-generator
85975c968edad124b778a80e6e028ac3847c511e
[ "Apache-2.0" ]
null
null
null
""" Предоставляет готовые интерефейсы для разных типов моделей. """ import logging from django.db import models logger = logging.getLogger(__name__) class DateAutoModelMixin(models.Model): """ Предоставляет интерфейс для работы с date_create и date_update Date. """ date_create = models.DateField(verbose_name='Дата создания', auto_now_add=True) date_update = models.DateField(verbose_name='Дата последнего изменения', auto_now=True) class Meta: abstract = True class DateTimeAutoModelMixin(models.Model): """ Предоставляет интерфейс для работы с date_create и date_update типа DateTime. """ date_create = models.DateTimeField(verbose_name='Дата создания', auto_now_add=True) date_update = models.DateTimeField(verbose_name='Дата последнего изменения', auto_now=True) class Meta: abstract = True class DateModelMixin(DateAutoModelMixin): """ Предоставляет интерфейс для работы с date_create и date_update Date без авто заполнения. """ date_create = models.DateField(verbose_name='Дата создания') date_update = models.DateField(verbose_name='Дата последнего изменения') class Meta: abstract = True class DateTimeModelMixin(DateTimeAutoModelMixin): """ Предоставляет интерфейс для работы с date_create и date_update DateTime без авто заполнения. """ date_create = models.DateTimeField(verbose_name='Дата создания') date_update = models.DateTimeField(verbose_name='Дата последнего изменения') class Meta: abstract = True
25.5
95
0.73055
181
1,581
6.19337
0.259669
0.071365
0.107047
0.110616
0.775201
0.77074
0.74041
0.74041
0.603033
0.43711
0
0
0.189753
1,581
61
96
25.918033
0.875098
0.245414
0
0.347826
0
0
0.137681
0
0
0
0
0
0
1
0
false
0
0.086957
0
0.782609
0
0
0
0
null
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
ab3af27c1901cde28f154a1650da1927e3a457b1
470
py
Python
tic-tac-toe/player.py
Dafov/python-projects
4cec3621effe3a24f677b73fc009680292640b32
[ "MIT" ]
null
null
null
tic-tac-toe/player.py
Dafov/python-projects
4cec3621effe3a24f677b73fc009680292640b32
[ "MIT" ]
null
null
null
tic-tac-toe/player.py
Dafov/python-projects
4cec3621effe3a24f677b73fc009680292640b32
[ "MIT" ]
null
null
null
import math import random class Player: def __init__(self, letter): # letter is X or O self.letter = letter def get_move(self, game): pass class RandomComputerPlayer(Player): def __init__(self, letter): super().__init__(letter) def get_move(self, game): pass class HumanComputerPlayer(Player): def __init__(self, letter): super().__init__(letter) def get_move(self, game): pass
17.407407
35
0.621277
56
470
4.803571
0.357143
0.148699
0.144981
0.189591
0.672862
0.587361
0.587361
0.587361
0.446097
0.446097
0
0
0.285106
470
27
36
17.407407
0.800595
0.034043
0
0.647059
0
0
0
0
0
0
0
0
0
1
0.352941
false
0.176471
0.117647
0
0.647059
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
ab4f5759bd8d4f8472723dfe5db36e86227ebf6e
421
py
Python
chimeranet/__init__.py
leichtrhino/ChimeraNet
2a9ecc4eabfc720cfd816e4414f3f96e87d90246
[ "MIT" ]
6
2019-11-21T14:49:06.000Z
2021-05-18T00:48:41.000Z
chimeranet/__init__.py
arity-r/ChimeraNet
2a9ecc4eabfc720cfd816e4414f3f96e87d90246
[ "MIT" ]
6
2019-01-31T06:49:38.000Z
2019-08-14T07:05:13.000Z
chimeranet/__init__.py
leichtrhino/ChimeraNet
2a9ecc4eabfc720cfd816e4414f3f96e87d90246
[ "MIT" ]
2
2019-11-05T06:24:50.000Z
2021-05-18T00:48:47.000Z
from .datasets import Dataset, DirDataset, ZipDataset, TarDataset from .datasets import VoxCeleb, DSD100, DSD100Melody, DSD100Vocal, ESC50, LMD from .sampling import Sampler, DatasetSampler, AsyncSampler, SyncSampler from .training import to_training_data from .reconstruction import from_embedding, from_mask from .windowutils import split_window from .windowutils import merge_windows_mean, merge_windows_most_common
42.1
77
0.850356
51
421
6.823529
0.627451
0.068966
0.103448
0
0
0
0
0
0
0
0
0.029101
0.102138
421
9
78
46.777778
0.891534
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
db8bb2f57869e90d2005e496c2fb72ddfe9c2cf7
120
py
Python
client/py/get-consolidated-report.py
victorkryz/HR-Utils
e2fe8186f4256d7ff59acc82ca0453f4576c1813
[ "MIT" ]
null
null
null
client/py/get-consolidated-report.py
victorkryz/HR-Utils
e2fe8186f4256d7ff59acc82ca0453f4576c1813
[ "MIT" ]
null
null
null
client/py/get-consolidated-report.py
victorkryz/HR-Utils
e2fe8186f4256d7ff59acc82ca0453f4576c1813
[ "MIT" ]
null
null
null
from launch_script import launchScript if __name__ == "__main__": exit(launchScript("get-consolidated-report.pls"));
30
53
0.775
14
120
6
0.928571
0
0
0
0
0
0
0
0
0
0
0
0.1
120
4
53
30
0.777778
0
0
0
0
0
0.289256
0.223141
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
dbb3b7378fc1d4d36230e52125419f4d55adffdf
175
py
Python
app2/models.py
bmampaey/rest_test
4b13d153dfed725de2aae5b687c724299595eddb
[ "MIT" ]
null
null
null
app2/models.py
bmampaey/rest_test
4b13d153dfed725de2aae5b687c724299595eddb
[ "MIT" ]
null
null
null
app2/models.py
bmampaey/rest_test
4b13d153dfed725de2aae5b687c724299595eddb
[ "MIT" ]
null
null
null
from __future__ import unicode_literals from django.db import models # Create your models here. class Record(models.Model): name = models.TextField(null=True, blank=True)
19.444444
47
0.788571
25
175
5.32
0.76
0
0
0
0
0
0
0
0
0
0
0
0.131429
175
8
48
21.875
0.875
0.137143
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
dbd8369667fde9df7f26010f8a86a360a33a5768
156
py
Python
shop/source/database/models/__init__.py
icYFTL/RTULAB_Service
a16d0fc2ac9ac103f0a14e90824caded7156bf11
[ "Apache-2.0" ]
null
null
null
shop/source/database/models/__init__.py
icYFTL/RTULAB_Service
a16d0fc2ac9ac103f0a14e90824caded7156bf11
[ "Apache-2.0" ]
null
null
null
shop/source/database/models/__init__.py
icYFTL/RTULAB_Service
a16d0fc2ac9ac103f0a14e90824caded7156bf11
[ "Apache-2.0" ]
null
null
null
from .shop import Shop from .slot import Slot from .transaction import Transaction from .user import User __all__ = ['Shop', 'Slot', 'User', 'Transaction']
26
49
0.74359
21
156
5.333333
0.333333
0
0
0
0
0
0
0
0
0
0
0
0.141026
156
6
49
26
0.835821
0
0
0
0
0
0.146497
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
91609ac1c6601ec54772687bfd268fbcbc80d174
2,053
py
Python
welcome/migrations/0010_auto_20161123_1354.py
akshaybabloo/Abies
fd7e2b926b4ae3c9089bc6b433747e67f8157472
[ "MIT" ]
null
null
null
welcome/migrations/0010_auto_20161123_1354.py
akshaybabloo/Abies
fd7e2b926b4ae3c9089bc6b433747e67f8157472
[ "MIT" ]
null
null
null
welcome/migrations/0010_auto_20161123_1354.py
akshaybabloo/Abies
fd7e2b926b4ae3c9089bc6b433747e67f8157472
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-11-23 13:54 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('welcome', '0009_auto_20161123_1308'), ] operations = [ migrations.AlterField( model_name='abiesmodel', name='city', field=models.CharField(blank=True, max_length=240), ), migrations.AlterField( model_name='abiesmodel', name='company_logo_location', field=models.ImageField(blank=True, upload_to='images'), ), migrations.AlterField( model_name='abiesmodel', name='company_name', field=models.CharField(blank=True, max_length=240), ), migrations.AlterField( model_name='abiesmodel', name='country', field=models.CharField(blank=True, max_length=240), ), migrations.AlterField( model_name='abiesmodel', name='email', field=models.EmailField(blank=True, max_length=254), ), migrations.AlterField( model_name='abiesmodel', name='first_name', field=models.CharField(blank=True, max_length=120), ), migrations.AlterField( model_name='abiesmodel', name='last_name', field=models.CharField(blank=True, max_length=120), ), migrations.AlterField( model_name='abiesmodel', name='password', field=models.CharField(blank=True, max_length=30), ), migrations.AlterField( model_name='abiesmodel', name='profile_image_location', field=models.ImageField(blank=True, upload_to='images'), ), migrations.AlterField( model_name='abiesmodel', name='username', field=models.CharField(blank=True, max_length=120), ), ]
31.106061
68
0.570385
194
2,053
5.85567
0.324742
0.176056
0.22007
0.255282
0.742958
0.742958
0.629401
0.583627
0.544014
0.544014
0
0.039007
0.3132
2,053
65
69
31.584615
0.766667
0.032635
0
0.655172
1
0
0.125063
0.033283
0
0
0
0
0
1
0
false
0.017241
0.034483
0
0.086207
0
0
0
0
null
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
916d782e9b60374c43c213ade31a66f5fa386ed1
213
py
Python
tests/views.py
sajeeshen/captcha_rest_validator
b825270ad2be55cfdac7aa4cd113e3b88e00e624
[ "MIT" ]
null
null
null
tests/views.py
sajeeshen/captcha_rest_validator
b825270ad2be55cfdac7aa4cd113e3b88e00e624
[ "MIT" ]
null
null
null
tests/views.py
sajeeshen/captcha_rest_validator
b825270ad2be55cfdac7aa4cd113e3b88e00e624
[ "MIT" ]
1
2019-11-15T12:53:02.000Z
2019-11-15T12:53:02.000Z
from rest_framework import viewsets from .models import Item from .serializers import ItemSerializer class ItemView(viewsets.ModelViewSet): serializer_class = ItemSerializer queryset = Item.objects.all()
26.625
39
0.807512
24
213
7.083333
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.13615
213
7
40
30.428571
0.923913
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
91a18e94c5bbb59681a6777d7dbd22e6adeb84e1
770
py
Python
server/src/jsonwrap.py
pombredanne/brat
c411494b9d8cad5ed068db24b7662d388bf1fa3e
[ "CC-BY-3.0" ]
1,406
2015-01-11T16:30:22.000Z
2022-03-31T01:42:25.000Z
server/src/jsonwrap.py
hse-cl-masterskaya-prozhito/brat
82895250f0c53e2e3ba3352f59f62969e5526218
[ "CC-BY-3.0" ]
277
2015-01-19T15:07:11.000Z
2022-03-09T02:43:01.000Z
server/src/jsonwrap.py
hse-cl-masterskaya-prozhito/brat
82895250f0c53e2e3ba3352f59f62969e5526218
[ "CC-BY-3.0" ]
491
2015-01-27T15:17:26.000Z
2022-03-24T09:07:47.000Z
"""json wrapper to be used instead of a direct call. Author: Pontus Stenetorp <pontus is s u-tokyo ac jp> Version: 2011-04-21 """ # use ultrajson if set up try: from ujson import dumps as lib_dumps from ujson import loads as lib_loads # ultrajson doesn't have encoding except ImportError: # fall back to native json if available from json import dumps as lib_dumps from json import loads as lib_loads # ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, # encoding def dumps(dic): # ultrajson has neither sort_keys nor indent # return lib_dumps(dic, sort_keys=True, indent=2) return lib_dumps(dic) def loads(s): return lib_loads(s) # TODO: Unittest that tries the import, encoding etc.
24.0625
73
0.707792
120
770
4.441667
0.591667
0.037523
0.056285
0.060038
0.172608
0.093809
0
0
0
0
0
0.014975
0.219481
770
31
74
24.83871
0.87188
0.592208
0
0
0
0
0
0
0
0
0
0.032258
0
1
0.2
false
0
0.5
0.2
0.9
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
1
1
1
0
0
4
91a3655639965d02cb56b233c9f91b84a5917d82
142
py
Python
django_gotolong/uploaddoc/admin.py
ParikhKadam/gotolong
839beb8aa37055a2078eaa289b8ae05b62e8905e
[ "BSD-2-Clause", "BSD-3-Clause" ]
15
2019-12-06T16:19:45.000Z
2021-08-20T13:22:22.000Z
django_gotolong/uploaddoc/admin.py
ParikhKadam/gotolong
839beb8aa37055a2078eaa289b8ae05b62e8905e
[ "BSD-2-Clause", "BSD-3-Clause" ]
14
2020-12-08T10:45:05.000Z
2021-09-21T17:23:45.000Z
django_gotolong/uploaddoc/admin.py
ParikhKadam/gotolong
839beb8aa37055a2078eaa289b8ae05b62e8905e
[ "BSD-2-Clause", "BSD-3-Clause" ]
9
2020-01-01T03:04:29.000Z
2021-04-18T08:42:30.000Z
from django.contrib import admin # Register your models here. from .models import UploadDocModel # ... admin.site.register(UploadDocModel)
15.777778
35
0.78169
17
142
6.529412
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.133803
142
8
36
17.75
0.902439
0.211268
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
91b5078e83ee3f8ebd6cdfd9eb7bf46b962ce414
26
py
Python
waf/demos/python/foo.py
yankee14/reflow-oven-atmega328p
e6792143576f13f0a3a49edfd54dbb2ef851d95a
[ "Apache-2.0" ]
24
2019-08-13T02:39:01.000Z
2022-03-03T15:44:54.000Z
waf/demos/python/foo.py
yankee14/reflow-oven-atmega328p
e6792143576f13f0a3a49edfd54dbb2ef851d95a
[ "Apache-2.0" ]
4
2020-11-16T02:03:09.000Z
2021-08-19T08:16:48.000Z
waf/demos/python/foo.py
yankee14/reflow-oven-atmega328p
e6792143576f13f0a3a49edfd54dbb2ef851d95a
[ "Apache-2.0" ]
11
2016-07-01T02:21:06.000Z
2020-11-23T08:29:22.000Z
zbr = "bar" assert zbr
4.333333
11
0.576923
4
26
3.75
0.75
0
0
0
0
0
0
0
0
0
0
0
0.307692
26
5
12
5.2
0.833333
0
0
0
0
0
0.125
0
0
0
0
0
0.5
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
91d7b65acf7aa0bb36363293ddc18f2bc82a3107
1,219
py
Python
src/sequences/tests/test_increasing_subsequence.py
seahrh/coding-interview
517d19e7e88c02acec4aa6336bc20206ce3f1897
[ "MIT" ]
null
null
null
src/sequences/tests/test_increasing_subsequence.py
seahrh/coding-interview
517d19e7e88c02acec4aa6336bc20206ce3f1897
[ "MIT" ]
null
null
null
src/sequences/tests/test_increasing_subsequence.py
seahrh/coding-interview
517d19e7e88c02acec4aa6336bc20206ce3f1897
[ "MIT" ]
null
null
null
from sequences.increasing_subsequence import * class TestIncreasingTriple: def test_when_array_length_is_less_than_3_then_return_none(self): assert increasing_triple([]) is None assert increasing_triple([1]) is None assert increasing_triple([1, 2]) is None def test_array_length_three_or_greater(self): assert increasing_triple([1, 2, 3]) == (0, 1, 2) assert increasing_triple([12, 11, 10, 5, 6, 2, 30]) == (3, 4, 6) assert increasing_triple([1, 2, 3, 4]) == (0, 1, 2) assert increasing_triple([4, 3, 1, 2]) is None assert increasing_triple([12, 1, 11, 10, 5, 4, 3]) is None assert increasing_triple([12, 1, 11, 10, 5, 4, 7]) == (1, 5, 6) assert increasing_triple([12, 11, 10, 5, 2, 4, 1, 3]) is None assert increasing_triple([12, 11, 10, 5, 2, 4, 1, 6]) == (4, 5, 7) assert increasing_triple([5, 13, 6, 10, 3, 7, 2]) == (0, 2, 3) assert increasing_triple([1, 5, 1, 5, 2, 2, 5]) == (0, 5, 6) assert increasing_triple([1, 5, 1, 5, 2, 1, 5]) == (0, 4, 6) assert increasing_triple([2, 3, 1, 4]) == (0, 1, 3) assert increasing_triple([3, 1, 2, 4]) == (1, 2, 3)
50.791667
75
0.574241
198
1,219
3.373737
0.186869
0.383234
0.526946
0.206587
0.592814
0.546407
0.342814
0.287425
0.206587
0.206587
0
0.143653
0.263331
1,219
23
76
53
0.600223
0
0
0
0
0
0
0
0
0
0
0
0.8
1
0.1
false
0
0.05
0
0.2
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
91d9f06dabfe0f32529d979463888500424403c4
109
py
Python
code/pyFoamModifyGGIBoundary.py
sosohungry/pyfoam
b19e40a0ef1f41268930122226660414722178e6
[ "MIT" ]
null
null
null
code/pyFoamModifyGGIBoundary.py
sosohungry/pyfoam
b19e40a0ef1f41268930122226660414722178e6
[ "MIT" ]
null
null
null
code/pyFoamModifyGGIBoundary.py
sosohungry/pyfoam
b19e40a0ef1f41268930122226660414722178e6
[ "MIT" ]
null
null
null
#!/usr/bin/python from PyFoam.Applications.ModifyGGIBoundary import ModifyGGIBoundary ModifyGGIBoundary()
18.166667
67
0.834862
10
109
9.1
0.8
0
0
0
0
0
0
0
0
0
0
0
0.082569
109
5
68
21.8
0.91
0.146789
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
91e6ebaa07e0ac12b2c09c557ebede8193acd38b
844
py
Python
tests/test_util.py
odowakar/viztracer
be26e277c6679f86dbaa262634958854187e5ad3
[ "Apache-2.0" ]
null
null
null
tests/test_util.py
odowakar/viztracer
be26e277c6679f86dbaa262634958854187e5ad3
[ "Apache-2.0" ]
6
2020-12-19T04:25:05.000Z
2021-03-07T15:27:30.000Z
tests/test_util.py
Mu-L/viztracer
c41704158227d34ecadf3173b0c11ffa2085a9ee
[ "Apache-2.0" ]
1
2021-11-15T05:41:34.000Z
2021-11-15T05:41:34.000Z
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt import viztracer.util from .base_tmpl import BaseTmpl class TestUtil(BaseTmpl): def test_size_fmt(self): size_fmt = viztracer.util.size_fmt self.assertEqual(size_fmt(1024), "1.0KiB") self.assertEqual(size_fmt(1024**5), "1024.0TiB") def test_compare_version(self): compare_version = viztracer.util.compare_version self.assertEqual(compare_version("0.10.1", "0.10.0"), 1) self.assertEqual(compare_version("0.10.0", "0.9.10"), 1) self.assertEqual(compare_version("0.10.0", "0.10.0"), 0) self.assertEqual(compare_version("0.7.3", "0.8.1"), -1) self.assertEqual(compare_version("0.20.3", "0.31.0"), -1)
40.190476
81
0.68128
127
844
4.401575
0.393701
0.200358
0.19678
0.259392
0.384615
0.237925
0.125224
0.125224
0.125224
0
0
0.085674
0.156398
844
20
82
42.2
0.699438
0.186019
0
0
0
0
0.106725
0
0
0
0
0
0.5
1
0.142857
false
0
0.142857
0
0.357143
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
37ce497a54f5fd4a0b51f968d43dcd031b7109b7
1,675
py
Python
sdk/python/pulumi_azure/apimanagement/__init__.py
roderik/pulumi-azure
f6d0c058d6f9111a709bc5f1515d1638f9d615f0
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure/apimanagement/__init__.py
roderik/pulumi-azure
f6d0c058d6f9111a709bc5f1515d1638f9d615f0
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
sdk/python/pulumi_azure/apimanagement/__init__.py
roderik/pulumi-azure
f6d0c058d6f9111a709bc5f1515d1638f9d615f0
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from .. import _utilities import typing # Export this package's modules as members: from .api import * from .api_diagnostic import * from .api_operation import * from .api_operation_policy import * from .api_operation_tag import * from .api_policy import * from .api_release import * from .api_schema import * from .api_version_set import * from .authorization_server import * from .backend import * from .certificate import * from .custom_domain import * from .diagnostic import * from .email_template import * from .gateway import * from .gateway_api import * from .get_api import * from .get_api_version_set import * from .get_gateway import * from .get_group import * from .get_product import * from .get_service import * from .get_user import * from .group import * from .group_user import * from .identity_provider_aad import * from .identity_provider_aadb2c import * from .identity_provider_facebook import * from .identity_provider_google import * from .identity_provider_microsoft import * from .identity_provider_twitter import * from .logger import * from .named_value import * from .notification_recipient_email import * from .open_id_connect_provider import * from .policy import * from .product import * from .product_api import * from .product_group import * from .product_policy import * from .property import * from .redis_cache import * from .service import * from .subscription import * from .tag import * from .user import * from ._inputs import * from . import outputs
29.385965
87
0.779701
236
1,675
5.326271
0.347458
0.381862
0.082737
0.124105
0.062053
0
0
0
0
0
0
0.001398
0.145672
1,675
56
88
29.910714
0.877009
0.130746
0
0
1
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
37fc7f7b07e9cfcebc6c12a95320faffd60cd854
436
py
Python
mstrio/server/__init__.py
czyzq/mstrio-py
b25fd19936b659d503a7eaaa96c8d0b4e118cb7c
[ "Apache-2.0" ]
1
2022-02-15T13:18:04.000Z
2022-02-15T13:18:04.000Z
mstrio/server/__init__.py
czyzq/mstrio-py
b25fd19936b659d503a7eaaa96c8d0b4e118cb7c
[ "Apache-2.0" ]
null
null
null
mstrio/server/__init__.py
czyzq/mstrio-py
b25fd19936b659d503a7eaaa96c8d0b4e118cb7c
[ "Apache-2.0" ]
null
null
null
# flake8: noqa from .project import (ProjectStatus, IdleMode, compare_project_settings, Project, ProjectSettings) from .cluster import GroupBy, ServiceAction, Cluster from .environment import Environment from .node import Node from .server import ServerSettings from .job_monitor import (Job, JobStatus, JobType, kill_all_jobs, kill_jobs, list_jobs, ObjectType, PUName, SubscriptionType)
43.6
99
0.736239
47
436
6.680851
0.595745
0
0
0
0
0
0
0
0
0
0
0.002882
0.204128
436
9
100
48.444444
0.902017
0.027523
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.75
0
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
37ffd371af5a8ef8d333bc5ff57e4ce341429899
146
py
Python
test_pkg/overload/__init__.py
nonebot/nb-autodoc
b9d69419dddf49c57f4cc47d5c2bcdbec673d32d
[ "MIT" ]
3
2021-11-23T14:42:47.000Z
2022-02-12T13:28:54.000Z
test_pkg/overload/__init__.py
nonebot/nb-autodoc
b9d69419dddf49c57f4cc47d5c2bcdbec673d32d
[ "MIT" ]
null
null
null
test_pkg/overload/__init__.py
nonebot/nb-autodoc
b9d69419dddf49c57f4cc47d5c2bcdbec673d32d
[ "MIT" ]
1
2022-02-16T08:01:13.000Z
2022-02-16T08:01:13.000Z
def func(arg, **kwargs): """main docstring. (only document this description!)""" return 1 class A: def foo(self, s): return
16.222222
59
0.589041
19
146
4.526316
0.894737
0
0
0
0
0
0
0
0
0
0
0.009346
0.267123
146
8
60
18.25
0.794393
0.335616
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0
0.2
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
530b0ba3225dc4dd7f2872afb534d7d5a596e198
790
py
Python
domainmodel/actor.py
TheImaginaryOne/movies-py
a3b601228cde6850919eaf84c0175f5ce3822e2b
[ "MIT" ]
null
null
null
domainmodel/actor.py
TheImaginaryOne/movies-py
a3b601228cde6850919eaf84c0175f5ce3822e2b
[ "MIT" ]
null
null
null
domainmodel/actor.py
TheImaginaryOne/movies-py
a3b601228cde6850919eaf84c0175f5ce3822e2b
[ "MIT" ]
null
null
null
class Actor: def __init__(self, actor_full_name: str): if actor_full_name == "" or type(actor_full_name) is not str: self.full_name = None else: self.full_name = actor_full_name.strip() self.colleagues = [] def __repr__(self): return f"<Actor {self.full_name}>" def __eq__(self, other: 'Actor') -> bool: return self.full_name == other.full_name def __lt__(self, other: 'Actor') -> bool: return self.full_name < other.full_name def __hash__(self): return hash(self.full_name) def add_actor_colleague(self, colleague: 'Actor'): self.colleagues.append(colleague) def check_if_this_actor_worked_with(self, colleague: 'Actor'): return colleague in self.colleagues
29.259259
69
0.641772
104
790
4.461538
0.317308
0.206897
0.155172
0.064655
0.224138
0.224138
0.224138
0.224138
0.224138
0.224138
0
0
0.250633
790
26
70
30.384615
0.783784
0
0
0
0
0
0.055767
0
0
0
0
0
0
1
0.368421
false
0
0
0.263158
0.684211
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
532743112487c1ec610902f50dae5758f6dc439b
61
py
Python
sim21/data/chemsep_consts.py
kpatvt/sim21
4cbbfcbef6371d3dc5404429545e003a48c69ba5
[ "Artistic-2.0" ]
7
2021-08-23T18:46:27.000Z
2022-01-26T07:10:22.000Z
sim21/data/chemsep_consts.py
kpatvt/sim21
4cbbfcbef6371d3dc5404429545e003a48c69ba5
[ "Artistic-2.0" ]
null
null
null
sim21/data/chemsep_consts.py
kpatvt/sim21
4cbbfcbef6371d3dc5404429545e003a48c69ba5
[ "Artistic-2.0" ]
null
null
null
# J/kmol-K or m3-Pa/kmol-K GAS_CONSTANT = 8.31446261815324e3
20.333333
33
0.754098
12
61
3.75
0.833333
0.222222
0
0
0
0
0
0
0
0
0
0.314815
0.114754
61
2
34
30.5
0.518519
0.393443
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
532b9c562b674e5dd6e1a8bbe8113ceca0093578
198
py
Python
python/helpers/python-skeletons/py/__init__.py
jnthn/intellij-community
8fa7c8a3ace62400c838e0d5926a7be106aa8557
[ "Apache-2.0" ]
93
2015-01-20T06:36:59.000Z
2021-11-08T09:49:59.000Z
python/helpers/python-skeletons/py/__init__.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/helpers/python-skeletons/py/__init__.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
62
2015-01-30T13:13:39.000Z
2022-03-19T08:26:45.000Z
"""Skeleton for py.path. Project: py 1.4.31 <https://bitbucket.org/pytest-dev/py> Skeleton by: Aleks Bunin <github@compuix.com> """ from . import path from . import error import py.error as error
19.8
56
0.722222
33
198
4.333333
0.69697
0.13986
0
0
0
0
0
0
0
0
0
0.023392
0.136364
198
9
57
22
0.812866
0.631313
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
53516624d548e02242c2e42bc4fc22b6b0cb832c
98
py
Python
login_system/apps.py
askhatkenenbay/Learning_Management_System_Backend
3e241a9f401623eec1c705ee5a38ad595b899c3b
[ "MIT" ]
null
null
null
login_system/apps.py
askhatkenenbay/Learning_Management_System_Backend
3e241a9f401623eec1c705ee5a38ad595b899c3b
[ "MIT" ]
null
null
null
login_system/apps.py
askhatkenenbay/Learning_Management_System_Backend
3e241a9f401623eec1c705ee5a38ad595b899c3b
[ "MIT" ]
null
null
null
from django.apps import AppConfig class LoginSystemConfig(AppConfig): name = 'login_system'
16.333333
35
0.77551
11
98
6.818182
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.153061
98
5
36
19.6
0.903614
0
0
0
0
0
0.122449
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
727677819ad6dae1002991015091115d8e2ab2af
228
py
Python
spacedr/errors.py
sttlr/spacedr
543f0d4dcdac4298a6c19145cd085322103c30d6
[ "MIT" ]
1
2019-08-04T09:49:30.000Z
2019-08-04T09:49:30.000Z
spacedr/errors.py
sttlr/spacedr
543f0d4dcdac4298a6c19145cd085322103c30d6
[ "MIT" ]
4
2020-03-24T16:32:46.000Z
2021-06-01T23:14:12.000Z
spacedr/errors.py
sttlr/spacedr
543f0d4dcdac4298a6c19145cd085322103c30d6
[ "MIT" ]
null
null
null
class DeckNotFoundError(Exception): '''No deck with given id.''' class CardNotFoundError(Exception): '''No card with given id.''' class CardAlreadyExists(Exception): '''There is a card with the same question.'''
20.727273
49
0.692982
27
228
5.851852
0.62963
0.139241
0.139241
0.202532
0
0
0
0
0
0
0
0
0.175439
228
10
50
22.8
0.840426
0.372807
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
1
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
1
0
0
4
72a8bbbcd9414f5cb951ffd4e77b2316f173836a
391
py
Python
examples/different_ai_servers.py
Creepy-Creeper3625/randomstuff.py
d2590fa949d69c268019ecabe0c27fc10818d147
[ "MIT" ]
1
2021-08-24T06:38:30.000Z
2021-08-24T06:38:30.000Z
examples/different_ai_servers.py
Creepy-Creeper3625/randomstuff.py
d2590fa949d69c268019ecabe0c27fc10818d147
[ "MIT" ]
1
2021-08-24T07:24:35.000Z
2021-08-24T07:24:35.000Z
examples/different_ai_servers.py
DevInfinix/randomstuff.py
e1ec766b98ec2274f1a3bd90c5e69c3f56a249bf
[ "MIT" ]
null
null
null
""" You can change the get_ai_response server to primary, backup and unstable. Warning! Use primary for general and backup if primary is down. unstable will have problems """ import randomstuff with randomstuff.Client(key="api-key-here") as client: client.get_ai_response(message="Hi", server="primary") # Pass in type in server argument. Choose from `primary`, `backup` and `unstable`.
39.1
139
0.764706
59
391
5
0.661017
0.033898
0.088136
0.162712
0
0
0
0
0
0
0
0
0.13555
391
9
140
43.444444
0.872781
0.636829
0
0
0
0
0.156716
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
72c3a4aa8a80e40a92a15d2cd9ec5a9961db3361
166
py
Python
src/snsary/outputs/__init__.py
benthorner/snsary
f5ee0dd548a68e029c5ae4aa1b7174ac0c0f3c9d
[ "MIT" ]
null
null
null
src/snsary/outputs/__init__.py
benthorner/snsary
f5ee0dd548a68e029c5ae4aa1b7174ac0c0f3c9d
[ "MIT" ]
1
2022-01-22T22:59:00.000Z
2022-01-22T22:59:00.000Z
src/snsary/outputs/__init__.py
benthorner/snsary
f5ee0dd548a68e029c5ae4aa1b7174ac0c0f3c9d
[ "MIT" ]
null
null
null
from .batch_output import BatchOutput from .mock_output import MockOutput from .output import Output __all__ = [ "BatchOutput", "MockOutput", "Output" ]
16.6
37
0.722892
18
166
6.333333
0.444444
0.315789
0
0
0
0
0
0
0
0
0
0
0.192771
166
9
38
18.444444
0.850746
0
0
0
0
0
0.162651
0
0
0
0
0
0
1
0
false
0
0.375
0
0.375
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
72e0c029c7dde94094e8e3d23a3350a01e511db0
227
py
Python
students/k3343/practical_works/Zhabrovets_Ekaterina/simple_django_web_project/project_first_app/admin.py
ekalandr/ITMO_ICT_WebProgramming_2020
0d4fa3854647d5c3466333a910a22f4e8bdd72fa
[ "MIT" ]
null
null
null
students/k3343/practical_works/Zhabrovets_Ekaterina/simple_django_web_project/project_first_app/admin.py
ekalandr/ITMO_ICT_WebProgramming_2020
0d4fa3854647d5c3466333a910a22f4e8bdd72fa
[ "MIT" ]
null
null
null
students/k3343/practical_works/Zhabrovets_Ekaterina/simple_django_web_project/project_first_app/admin.py
ekalandr/ITMO_ICT_WebProgramming_2020
0d4fa3854647d5c3466333a910a22f4e8bdd72fa
[ "MIT" ]
null
null
null
from django.contrib import admin # Register your models here. from .models import Owner, License, Car, Ownership admin.site.register(Owner) admin.site.register(License) admin.site.register(Car) admin.site.register(Ownership)
22.7
50
0.801762
32
227
5.6875
0.4375
0.197802
0.373626
0
0
0
0
0
0
0
0
0
0.096916
227
9
51
25.222222
0.887805
0.114537
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
72ed7c074cfabb5bbc9a99fc562eb79cbdd78bb9
71
py
Python
{{cookiecutter.github_repository_name}}/conf.py
gikoluo/cookiecutter-drf-microservice
f05a6279ae8437790f818ee5f0794256e03ee1d7
[ "Apache-2.0" ]
8
2019-09-29T22:49:52.000Z
2022-02-28T08:39:38.000Z
{{cookiecutter.github_repository_name}}/conf.py
gikoluo/cookiecutter-drf-microservice
f05a6279ae8437790f818ee5f0794256e03ee1d7
[ "Apache-2.0" ]
34
2019-10-30T23:25:49.000Z
2021-11-24T10:26:25.000Z
{{cookiecutter.github_repository_name}}/conf.py
gikoluo/cookiecutter-drf-microservice
f05a6279ae8437790f818ee5f0794256e03ee1d7
[ "Apache-2.0" ]
4
2020-03-16T08:36:28.000Z
2021-03-19T02:28:44.000Z
# we use the one in docs dir for but sphinx actually want this file!!!
35.5
70
0.732394
14
71
3.714286
1
0
0
0
0
0
0
0
0
0
0
0
0.211268
71
1
71
71
0.928571
0.957746
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
f426b578eb79ff38282f2500bf2097db0c8f2882
144
py
Python
accounts/lib/definitions/message.py
ko-naka-3010527/accup-python
e10ff96111be889573d830f4b710d9b8b19e1828
[ "MIT" ]
null
null
null
accounts/lib/definitions/message.py
ko-naka-3010527/accup-python
e10ff96111be889573d830f4b710d9b8b19e1828
[ "MIT" ]
null
null
null
accounts/lib/definitions/message.py
ko-naka-3010527/accup-python
e10ff96111be889573d830f4b710d9b8b19e1828
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- RESPONSE_MESSAGE = { 'update_success': "Acc-Up アカウント情報を更新しました。", 'create_success': "Acc-Up アカウントを作成しました。", }
16
47
0.625
15
144
5.8
0.8
0.229885
0.275862
0
0
0
0
0
0
0
0
0.008475
0.180556
144
8
48
18
0.728814
0.145833
0
0
0
0
0.588235
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
f4421686c5211c98bb8773a9d46c9f088924ba85
64
py
Python
lib/diazo/__init__.py
plone/diazo
81bdf00b437572bf860b758a99b9cc45ebcfc78c
[ "BSD-3-Clause" ]
22
2015-02-01T10:07:17.000Z
2021-11-12T21:12:24.000Z
lib/diazo/__init__.py
plone/diazo
81bdf00b437572bf860b758a99b9cc45ebcfc78c
[ "BSD-3-Clause" ]
41
2015-01-16T19:11:09.000Z
2022-03-30T08:27:30.000Z
lib/diazo/__init__.py
plone/diazo
81bdf00b437572bf860b758a99b9cc45ebcfc78c
[ "BSD-3-Clause" ]
14
2015-01-08T11:24:19.000Z
2019-01-21T17:32:34.000Z
# -*- coding: utf-8 -*- import logging logging.basicConfig()
9.142857
23
0.640625
7
64
5.857143
0.857143
0
0
0
0
0
0
0
0
0
0
0.018868
0.171875
64
6
24
10.666667
0.754717
0.328125
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f44cb4c7fb8ede24b023033687c884e0734d63f6
974
py
Python
release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/RebarHookOrientation.py
htlcnn/ironpython-stubs
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
[ "MIT" ]
182
2017-06-27T02:26:15.000Z
2022-03-30T18:53:43.000Z
release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/RebarHookOrientation.py
htlcnn/ironpython-stubs
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
[ "MIT" ]
28
2017-06-27T13:38:23.000Z
2022-03-15T11:19:44.000Z
release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/RebarHookOrientation.py
htlcnn/ironpython-stubs
780d829e2104b2789d5f4d6f32b0ec9f2930ca03
[ "MIT" ]
67
2017-06-28T09:43:59.000Z
2022-03-20T21:17:10.000Z
class RebarHookOrientation(Enum,IComparable,IFormattable,IConvertible): """ Orientation of a rebar hook relative to the path of the Rebar Shape. enum RebarHookOrientation,values: Left (1),Right (-1) """ def __eq__(self,*args): """ x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """ pass def __format__(self,*args): """ __format__(formattable: IFormattable,format: str) -> str """ pass def __ge__(self,*args): pass def __gt__(self,*args): pass def __init__(self,*args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass def __le__(self,*args): pass def __lt__(self,*args): pass def __ne__(self,*args): pass def __reduce_ex__(self,*args): pass def __str__(self,*args): pass Left=None Right=None value__=None
27.055556
215
0.663244
130
974
4.238462
0.361538
0.145191
0.15245
0.163339
0.23412
0.23412
0.23412
0.205082
0.205082
0.205082
0
0.002503
0.179671
974
35
216
27.828571
0.687109
0.465092
0
0.416667
0
0
0
0
0
0
0
0
0
1
0.416667
false
0.416667
0
0
0.583333
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
f44cca62010f0e61d56b5d33b2c16d1b5b572bc8
583
py
Python
boost/tools/build/v2/util/os_j.py
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
2,831
2015-12-24T03:21:07.000Z
2022-03-31T18:37:29.000Z
boost/tools/build/v2/util/os_j.py
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
238
2016-01-26T03:35:35.000Z
2022-03-18T11:17:00.000Z
boost/tools/build/v2/util/os_j.py
randolphwong/mcsema
eb5b376736e7f57ff0a61f7e4e5a436bbb874720
[ "BSD-3-Clause" ]
781
2015-12-24T04:28:34.000Z
2022-03-26T05:23:12.000Z
# Status: stub, just enough to make tests work. # # Named os_j to avoid conflicts with standard 'os'. See # project.py:import for special-casing. # # Copyright 2001, 2002, 2003, 2005 Dave Abrahams # Copyright 2006 Rene Rivera # Copyright 2003, 2005 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import bjam __OS = bjam.call("peek", [], "OS")[0] # Return Jam's name of OS to prevent existing code from burning # when faced with Python naming def name(): return __OS
29.15
81
0.737564
94
583
4.478723
0.723404
0.014252
0.042755
0.057007
0
0
0
0
0
0
0
0.071869
0.164666
583
19
82
30.684211
0.792608
0.818182
0
0
0
0
0.064516
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
0.75
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
f45446665feebfbc5fd8173557e0f32ef055409a
15,196
py
Python
rodan/test/views/test_resultspackage.py
carrieeex/Rodan
458e72990c2571fa727a0d026fb235faf30bffec
[ "MIT" ]
31
2015-01-06T17:23:45.000Z
2022-03-30T02:46:16.000Z
rodan/test/views/test_resultspackage.py
carrieeex/Rodan
458e72990c2571fa727a0d026fb235faf30bffec
[ "MIT" ]
258
2015-01-02T19:34:57.000Z
2022-01-19T16:34:21.000Z
rodan/test/views/test_resultspackage.py
carrieeex/Rodan
458e72990c2571fa727a0d026fb235faf30bffec
[ "MIT" ]
8
2015-08-19T16:09:31.000Z
2021-10-03T23:46:46.000Z
import os # import json import zipfile # import uuid import datetime import socket from django.core.files.base import ContentFile from rest_framework import status from rest_framework.test import APITestCase from rest_framework.reverse import reverse from model_mommy import mommy from rodan.constants import task_status from rodan.models import WorkflowRun, Job, ResultsPackage from rodan.test.helpers import RodanTestSetUpMixin, RodanTestTearDownMixin bag_metadata = ( "bag-info.txt", "bagit.txt", "fetch.txt", "manifest-sha1.txt", "tagmanifest-sha1.txt", ) class ResultsPackageViewTest(RodanTestTearDownMixin, APITestCase, RodanTestSetUpMixin): def setUp(self): self.setUp_rodan() self.setUp_user() self.client.force_authenticate(user=self.test_superuser) # def test_unfinished_workflowrun(self): # wfr = mommy.make('rodan.WorkflowRun', status=task_status.PROCESSING) # resultspackage_obj = { # 'workflow_run': 'http://localhost:8000/workflowrun/{0}/'.format(wfr.uuid), # 'packaging_mode': 0 # } # response = self.client.post("/api/resultspackages/", resultspackage_obj, format='json') # self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) # self.assertEqual( # response.data, # {'workflow_run': ["Cannot package results of an unfinished or failed WorkflowRun."]} # ) # def test_nonexist_port(self): # wfr = mommy.make('rodan.WorkflowRun', status=task_status.FINISHED) # resultspackage_obj = { # 'workflow_run': 'http://localhost:8000/workflowrun/{0}/'.format(wfr.uuid), # 'output_ports': ['http://localhost:8000/api/outputport/{0}/'.format(uuid.uuid1()) # ], # 'packaging_mode': 0 # } # response = self.client.post("/api/resultspackages/", resultspackage_obj, format='json') # self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) # self.assertEqual(response.data, { # 'output_ports': [u'Invalid hyperlink - Object does not exist.']}) def test_post_invalid_status(self): wfr = mommy.make("rodan.WorkflowRun", status=task_status.FINISHED) resultspackage_obj = { "workflow_run": "http://localhost:8000/api/workflowrun/{0}/".format(wfr.uuid), "status": task_status.CANCELLED, "packaging_mode": 0, } response = self.client.post( "/api/resultspackages/", resultspackage_obj, format="json" ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual( response.data, { "status": [ u"Cannot create a cancelled, failed, finished or expired ResultsPackage." ] }, ) def test_patch_cancel(self): wfr = mommy.make("rodan.ResultsPackage", status=task_status.SCHEDULED) req = {"status": task_status.CANCELLED} try: response = self.client.patch( "/api/resultspackage/{0}/".format(wfr.uuid), req, format="json" ) self.assertEqual(response.status_code, status.HTTP_200_OK) except socket.error: # rabbitmq not running pass def test_patch_invalid_status_update(self): wfr = mommy.make("rodan.ResultsPackage", status=task_status.EXPIRED) req = {"status": task_status.PROCESSING} response = self.client.patch( "/api/resultspackage/{0}/".format(wfr.uuid), req, format="json" ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertEqual(response.data, {"status": ["Invalid status update"]}) class ResultsPackageSimpleTest( RodanTestTearDownMixin, APITestCase, RodanTestSetUpMixin ): def setUp(self): self.setUp_rodan() self.setUp_user() self.setUp_simple_dummy_workflow() self.client.force_authenticate(user=self.test_superuser) response = self.client.patch( "/api/workflow/{0}/".format(self.test_workflow.uuid), {"valid": True}, format="json", ) self.assertEqual(response.status_code, status.HTTP_200_OK) # Run this dummy workflow ra = self.setUp_resources_for_simple_dummy_workflow() self.test_resource.resource_file.save( "dummy.txt", ContentFile('{"test": "hahaha"}') ) workflowrun_obj = { "creator": "http://localhost:8000/api/user/{0}/".format(self.test_user.pk), "workflow": "http://localhost:8000/api/workflow/{0}/".format( self.test_workflow.uuid ), "resource_assignments": ra, } response = self.client.post(reverse("workflowrun-list"), workflowrun_obj, format="json") self.assertEqual(response.status_code, status.HTTP_201_CREATED) wfrun_id = response.data["uuid"] dummy_m_runjob = self.dummy_m_wfjob.run_jobs.first() self.test_user_input = {"foo": "bar"} response = self.client.post( "/api/interactive/{0}/".format(str(dummy_m_runjob.uuid)), self.test_user_input ) self.test_workflowrun = WorkflowRun.objects.get(uuid=wfrun_id) # self.assertEqual(self.test_workflowrun.status, task_status.SCHEDULED) # workflowrun_update = {'status': task_status.REQUEST_PROCESSING} # response = self.client.patch( # "/workflowrun/{0}/".format(str(wfrun_id)), workflowrun_update, format='json') # self.assertEqual(response.status_code, status.HTTP_200_OK) # self.assertEqual(self.test_workflowrun.status, task_status.FINISHED) self.output_a = self.dummy_a_wfjob.run_jobs.first().outputs.first() self.output_m = self.dummy_m_wfjob.run_jobs.first().outputs.first() def test_all_ports(self): resultspackage_obj = { "workflow_run": "http://localhost:8000/api/workflowrun/{0}/".format( self.test_workflowrun.uuid ), "output_ports": [ "http://localhost:8000/api/outputport/{0}/".format( self.output_a.output_port.uuid ), "http://localhost:8000/api/outputport/{0}/".format( self.output_m.output_port.uuid ), ], "packaging_mode": 0, } response = self.client.post( "/api/resultspackages/", resultspackage_obj, format="json" ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) rp_id = response.data["uuid"] rp = ResultsPackage.objects.get(uuid=rp_id) # print(rp.error_summary, rp.error_details) self.assertEqual(rp.status, task_status.FINISHED) self.assertEqual(rp.percent_completed, 100) self.assertEqual(os.path.isfile(rp.package_path), True) with zipfile.ZipFile(rp.package_path, "r") as z: files = z.namelist() files = filter(lambda f: f not in bag_metadata, files) # self.assertEqual(len(files), 2) # print(files) # TODO: test file names def test_one_port(self): resultspackage_obj = { "workflow_run": "http://localhost:8000/api/workflowrun/{0}/".format( self.test_workflowrun.uuid ), "output_ports": [ "http://localhost:8000/api/outputport/{0}/".format( self.output_a.output_port.uuid ) ], "packaging_mode": 0, } response = self.client.post( "/api/resultspackages/", resultspackage_obj, format="json" ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) rp_id = response.data["uuid"] rp = ResultsPackage.objects.get(uuid=rp_id) self.assertEqual(rp.status, task_status.FINISHED) self.assertEqual(rp.percent_completed, 100) self.assertEqual(os.path.isfile(rp.package_path), True) with zipfile.ZipFile(rp.package_path, "r") as z: files = z.namelist() files = filter(lambda f: f not in bag_metadata, files) # self.assertEqual(len(files), 1) # print(files) # TODO: test file names # def test_invalid_port(self): # invalid_op = mommy.make('rodan.OutputPort') # resultspackage_obj = { # 'workflow_run': 'http://localhost:8000/workflowrun/{0}/'.format( # self.test_workflowrun.uuid # ), # 'output_ports': [ # 'http://localhost:8000/api/outputport/{0}/'.format(invalid_op.uuid) # ], # 'packaging_mode': 0 # } # response = self.client.post("/api/resultspackages/", resultspackage_obj, format='json') # self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) # self.assertEqual( # response.data, # { # u'non_field_errors': [ # ( # "Confliction between WorkflowRun and OutputPort: OutputPort {0} not in" # " WorkflowRun {1}'s Workflow." # ).format( # invalid_op.uuid, # self.test_workflowrun.uuid # ) # ] # } # ) class ResultsPackageComplexTest( RodanTestTearDownMixin, APITestCase, RodanTestSetUpMixin ): def setUp(self): self.setUp_rodan() self.setUp_user() self.setUp_complex_dummy_workflow() self.client.force_authenticate(user=self.test_superuser) # modify all manual job to automatic to save effort (and in/output ports) from rodan.test.dummy_jobs import dummy_automatic_job # from rodan.test.dummy_jobs import dummy_manual_job job_a = Job.objects.get(name=dummy_automatic_job.name) # job_m = Job.objects.get(name=dummy_manual_job.name) ipt_aA = job_a.input_port_types.get(name="in_typeA") ipt_aB = job_a.input_port_types.get(name="in_typeB") ipt_aL = job_a.input_port_types.get(name="in_typeL") opt_aA = job_a.output_port_types.get(name="out_typeA") # opt_aB = job_a.output_port_types.get(name="out_typeB") opt_aL = job_a.output_port_types.get(name="out_typeL") self.test_wfjob_B.job = job_a self.test_wfjob_B.save() self.test_wfjob_D.job = job_a self.test_wfjob_D.save() self.test_Bop.output_port_type = opt_aL self.test_Bop.save() self.test_Dip1.input_port_type = ipt_aA self.test_Dip1.save() self.test_Dip2.input_port_type = ipt_aB self.test_Dip2.save() self.test_Dip3.input_port_type = ipt_aL self.test_Dip3.save() self.test_Dop.output_port_type = opt_aA self.test_Dop.save() response = self.client.patch( "/api/workflow/{0}/".format(self.test_workflow.uuid), {"valid": True}, format="json", ) self.assertEqual(response.status_code, status.HTTP_200_OK) # Run this dummy workflow ra = self.setUp_resources_for_complex_dummy_workflow() workflowrun_obj = { "creator": "http://localhost:8000/user/{0}/".format(self.test_superuser.pk), "workflow": "http://localhost:8000/api/workflow/{0}/".format( self.test_workflow.uuid ), "resource_assignments": ra, } response = self.client.post(reverse("workflowrun-list"), workflowrun_obj, format="json") self.assertEqual(response.status_code, status.HTTP_201_CREATED) wfrun_id = response.data["uuid"] self.test_workflowrun = WorkflowRun.objects.get(uuid=wfrun_id) # self.assertEqual(self.test_workflowrun.status, task_status.SCHEDULED) # self.assertEqual(self.test_workflowrun.status, task_status.PROCESSING) # workflowrun_update = {'status': task_status.REQUEST_PROCESSING} # response = self.client.patch( # "/workflowrun/{0}/".format( # str(wfrun_id)), # workflowrun_update, # format='json' # ) # self.assertEqual(response.status_code, status.HTTP_200_OK) self.test_workflowrun = WorkflowRun.objects.get(uuid=wfrun_id) self.assertEqual(self.test_workflowrun.status, task_status.FINISHED) def test_one_port(self): resultspackage_obj = { "workflow_run": "http://localhost:8000/api/workflowrun/{0}/".format( self.test_workflowrun.uuid ), "output_ports": [ "http://localhost:8000/api/outputport/{0}/".format(self.test_Fop.uuid) ], "packaging_mode": 0, } response = self.client.post( "/api/resultspackages/", resultspackage_obj, format="json" ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) rp_id = response.data["uuid"] rp = ResultsPackage.objects.get(uuid=rp_id) self.assertEqual(rp.status, task_status.FINISHED) self.assertEqual(rp.percent_completed, 100) self.assertEqual(os.path.isfile(rp.package_path), True) with zipfile.ZipFile(rp.package_path, "r") as z: files = z.namelist() files = filter(lambda f: f not in bag_metadata, files) # self.assertEqual(len(files), 10) # print(files) # TODO: test file names def test_default_ports(self): resultspackage_obj = { "workflow_run": "http://localhost:8000/api/workflowrun/{0}/".format( self.test_workflowrun.uuid ), "packaging_mode": 0, } response = self.client.post( "/api/resultspackages/", resultspackage_obj, format="json" ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) # rp_id = response.data['uuid'] # rp = ResultsPackage.objects.get(uuid=rp_id) # self.assertEqual( # set([self.test_Cop2, self.test_Fop, self.test_Eop]), set(rp.output_ports.all())) def test_expire(self): resultspackage_obj = { "workflow_run": "http://localhost:8000/api/workflowrun/{0}/".format( self.test_workflowrun.uuid ), "output_ports": [ "http://localhost:8000/api/outputport/{0}/".format(self.test_Fop.uuid) ], "expiry_time": datetime.datetime.now() + datetime.timedelta(minutes=1), "packaging_mode": 0, } response = self.client.post( "/api/resultspackages/", resultspackage_obj, format="json" ) rp_id = response.data["uuid"] rp = ResultsPackage.objects.get(uuid=rp_id) self.assertEqual( rp.status, task_status.EXPIRED ) # in test, scheduled expiry task is eagerly executed self.assertEqual(os.path.isfile(rp.package_path), False)
40.414894
98
0.611608
1,682
15,196
5.314507
0.131391
0.041168
0.054033
0.044748
0.764851
0.748294
0.730731
0.717306
0.672894
0.64392
0
0.017056
0.266912
15,196
375
99
40.522667
0.785368
0.244209
0
0.572
0
0
0.1364
0.017116
0
0
0
0.002667
0.1
1
0.044
false
0.004
0.052
0
0.108
0
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
f46b7c5a92b4af9695a287d5955ff460af5293d2
60
py
Python
robust_kalman/__init__.py
Seven-Tree/robust-kalman
15b039cbbc4d10055a581fdfafb41e9dfa1d6f6f
[ "MIT" ]
92
2018-02-07T17:07:24.000Z
2022-03-21T15:06:37.000Z
robust_kalman/__init__.py
Seven-Tree/robust-kalman
15b039cbbc4d10055a581fdfafb41e9dfa1d6f6f
[ "MIT" ]
15
2015-03-07T12:46:41.000Z
2015-04-11T09:08:36.000Z
self_driving/deps/robust_kalman/robust_kalman/__init__.py
zaqwes8811/micro-apps
7f63fdf613eff5d441a3c2c7b52d2a3d02d9736a
[ "MIT" ]
34
2018-01-01T19:16:07.000Z
2022-03-31T11:58:35.000Z
from .robust_kalman import RobustKalman from . import utils
20
39
0.833333
8
60
6.125
0.75
0
0
0
0
0
0
0
0
0
0
0
0.133333
60
2
40
30
0.942308
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f472bffcffa0a0f576ae35f7d89b52bb4e1bf917
136
py
Python
rov/tools/__init__.py
jiena76/X11-Core
95aec844822ab4e53c09accc48ef25d70e9b4f08
[ "MIT" ]
9
2017-09-21T22:00:46.000Z
2018-12-26T15:46:40.000Z
rov/tools/__init__.py
jiena76/X11-Core
95aec844822ab4e53c09accc48ef25d70e9b4f08
[ "MIT" ]
25
2017-10-06T17:25:51.000Z
2018-04-19T00:51:50.000Z
rov/tools/__init__.py
jiena76/X11-Core
95aec844822ab4e53c09accc48ef25d70e9b4f08
[ "MIT" ]
2
2017-10-19T22:41:37.000Z
2018-05-10T20:33:45.000Z
from manipulator import Manipulator from obs_tool import OBS_Tool from elecmagnet import Elecmagnet from transmitter import Transmitter
27.2
35
0.882353
18
136
6.555556
0.388889
0.118644
0
0
0
0
0
0
0
0
0
0
0.117647
136
4
36
34
0.983333
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
f485c254b9a57400710eae8baa63496344de1a4c
2,169
py
Python
tests/test_diary.py
Man-Jain/yoda
1eb13cc7534b2c6bca9a0f190308f22194746ab4
[ "MIT" ]
null
null
null
tests/test_diary.py
Man-Jain/yoda
1eb13cc7534b2c6bca9a0f190308f22194746ab4
[ "MIT" ]
null
null
null
tests/test_diary.py
Man-Jain/yoda
1eb13cc7534b2c6bca9a0f190308f22194746ab4
[ "MIT" ]
null
null
null
# coding=utf-8 from unittest import TestCase from click.testing import CliRunner import yoda class TestDiary(TestCase): """ Test for the following commands: Assumes empty diary. | Module: diary | command: diary tasks, nt, ct , nn , notes """ def __init__(self, methodName='runTest'): super(TestDiary, self).__init__() self.runner = CliRunner() def runTest(self): result = self.runner.invoke(yoda.cli, ['diary']) self.assertEqual(result.exit_code, 0) # tasks result = self.runner.invoke(yoda.cli, ['diary', 'tasks']) self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'ct'], input="2") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'nt'], input="test task\n-") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'ct'], input="1") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'nt'], input="test task 2\n-") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'ct'], input="2") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'ct'], input="3") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'tasks']) self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'analyze']) self.assertEqual(result.exit_code, 0) # notes result = self.runner.invoke(yoda.cli, ['diary', 'notes']) self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'nn'], input="test title\ntitle text") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'nn'], input="test title2\ntitle text2") self.assertEqual(result.exit_code, 0) result = self.runner.invoke(yoda.cli, ['diary', 'notes']) self.assertEqual(result.exit_code, 0)
39.436364
96
0.617335
273
2,169
4.824176
0.197802
0.113895
0.170084
0.233865
0.759301
0.759301
0.713743
0.687927
0.687927
0.687927
0
0.013056
0.223144
2,169
54
97
40.166667
0.768546
0.065007
0
0.555556
0
0
0.099291
0
0
0
0
0
0.388889
1
0.055556
false
0
0.083333
0
0.166667
0
0
0
0
null
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
be6334058b6677d1689ed7b0907846e8657534fe
206
py
Python
decoders/__init__.py
Landanjs/visdial-challenge-starter-pytorch
dce6a04203f428b01a25231f2ca867c259419f12
[ "BSD-3-Clause" ]
35
2019-08-19T16:12:58.000Z
2021-04-02T14:01:19.000Z
decoders/__init__.py
Landanjs/visdial-challenge-starter-pytorch
dce6a04203f428b01a25231f2ca867c259419f12
[ "BSD-3-Clause" ]
7
2019-08-26T00:43:08.000Z
2021-04-20T11:51:15.000Z
decoders/__init__.py
Landanjs/visdial-challenge-starter-pytorch
dce6a04203f428b01a25231f2ca867c259419f12
[ "BSD-3-Clause" ]
12
2019-09-05T02:23:06.000Z
2021-03-17T07:52:32.000Z
from .disc import DiscriminativeDecoder def Decoder(model_args, encoder): name_dec_map = { 'disc': DiscriminativeDecoder } return name_dec_map[model_args.decoder](model_args, encoder)
20.6
64
0.73301
24
206
6
0.541667
0.1875
0.222222
0.319444
0
0
0
0
0
0
0
0
0.184466
206
9
65
22.888889
0.857143
0
0
0
0
0
0.019512
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0
0.5
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
be87c57d94a23fa0eb4036e5daf2cb44ebdb0a5a
141
py
Python
inversefed/data/__init__.py
MelonDLI/ATSPrivacy
2cf4bd67c9c0c69092b63dcdc3d06b33acf32812
[ "MIT" ]
119
2020-04-01T02:56:03.000Z
2022-03-30T13:01:49.000Z
inversefed/data/__init__.py
MelonDLI/ATSPrivacy
2cf4bd67c9c0c69092b63dcdc3d06b33acf32812
[ "MIT" ]
8
2020-04-08T08:52:19.000Z
2021-12-08T04:22:37.000Z
inversefed/data/__init__.py
MelonDLI/ATSPrivacy
2cf4bd67c9c0c69092b63dcdc3d06b33acf32812
[ "MIT" ]
47
2020-04-06T07:14:59.000Z
2022-03-21T15:57:53.000Z
"""Data stuff that I usually don't want to see.""" from .data_processing import construct_dataloaders __all__ = ['construct_dataloaders']
20.142857
50
0.765957
19
141
5.315789
0.842105
0.39604
0
0
0
0
0
0
0
0
0
0
0.134752
141
6
51
23.5
0.827869
0.312057
0
0
0
0
0.230769
0.230769
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
bea50e0318ff341945aa6bb054c63bcef2794ad6
499
py
Python
data/beam_debug.py
tarrade/proj_NLP_text_classification_with_GCP
ac09d6dbf8c07470d03cfb8140a26db7cd5bef9f
[ "Apache-2.0" ]
1
2020-07-19T16:10:19.000Z
2020-07-19T16:10:19.000Z
data/beam_debug.py
tarrade/proj_NLP_text_classification_with_GCP
ac09d6dbf8c07470d03cfb8140a26db7cd5bef9f
[ "Apache-2.0" ]
46
2019-11-01T08:53:32.000Z
2022-01-15T10:27:56.000Z
data/beam_debug.py
tarrade/proj_NLP_text_classification_with_GCP
ac09d6dbf8c07470d03cfb8140a26db7cd5bef9f
[ "Apache-2.0" ]
null
null
null
minute_1 =(26851913,5992543,27556005,4323714,8425153,1311014,35493761,14755141,25932091,33087356,23020837,26386134,30369841,19056067,25513336,28846641,16417313,14789474,5426396,29798959,24355670,22100123,13683488,34144629,18526919,5632409,19473860,31378818,14348779,12845369,29918454,6782647,33504529,35264399,30323595,22394663,35405984,16420199,34038689,3432666,37370238,23944942,28497672,4067837,24994962) minute_5 = (32584268, 11432394, 35438993, 24131283, 5674247, 15192468, 34283351, 23980047)
166.333333
407
0.861723
57
499
7.508772
0.982456
0
0
0
0
0
0
0
0
0
0
0.854209
0.024048
499
3
408
166.333333
0.024641
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
fe2e157c6e7259a28b864886596e067c07d2485a
480
py
Python
tests/unit/models/test_pod.py
jina-ai/jinad
4fb874b145357668ecd84cb015c9db1939ed013c
[ "Apache-2.0" ]
3
2020-10-29T10:11:42.000Z
2022-03-15T02:32:43.000Z
tests/unit/models/test_pod.py
jina-ai/jinad
4fb874b145357668ecd84cb015c9db1939ed013c
[ "Apache-2.0" ]
41
2020-10-23T13:06:39.000Z
2021-01-06T19:55:06.000Z
tests/unit/models/test_pod.py
jina-ai/jinad
4fb874b145357668ecd84cb015c9db1939ed013c
[ "Apache-2.0" ]
null
null
null
from jinad.models import SinglePodModel, ParallelPodModel def test_single_no_exceptions(): SinglePodModel() # this gets executed while verifying inputs SinglePodModel().dict() # this gets executed while creating docs SinglePodModel().schema() def test_parallel_no_exceptions(): ParallelPodModel() # this gets executed while verifying inputs ParallelPodModel().dict() # this gets executed while creating docs ParallelPodModel().schema()
26.666667
57
0.74375
50
480
7.02
0.44
0.091168
0.182336
0.239316
0.415954
0.415954
0.210826
0
0
0
0
0
0.18125
480
17
58
28.235294
0.89313
0.335417
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
true
0
0.111111
0
0.333333
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
0
0
0
0
4
fe52f60558e61b197539affd5cf186cbdb84ea59
406
py
Python
fairseq/data/dataset_readers/__init__.py
naetherm/NSEC_NMT
bba533116f37d0f48dbe96150097a1e84ecf162e
[ "MIT" ]
null
null
null
fairseq/data/dataset_readers/__init__.py
naetherm/NSEC_NMT
bba533116f37d0f48dbe96150097a1e84ecf162e
[ "MIT" ]
null
null
null
fairseq/data/dataset_readers/__init__.py
naetherm/NSEC_NMT
bba533116f37d0f48dbe96150097a1e84ecf162e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- ''' Copyright 2019, University of Freiburg. Chair of Algorithms and Data Structures. Markus Näther <naetherm@informatik.uni-freiburg.de> ''' from fairseq.data.dataset_readers.dataset_reader import DatasetReader from fairseq.data.dataset_readers.seq2seq_reader import Seq2SeqDatasetReader from fairseq.data.dataset_readers.spell_correction_reader import SpellCorrectionDatasetReader
40.6
93
0.837438
49
406
6.795918
0.632653
0.099099
0.135135
0.198198
0.261261
0
0
0
0
0
0
0.018767
0.081281
406
10
93
40.6
0.873995
0.381773
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
fe7a7915b31d345c95beb0be77f9f18d87cf6103
90
py
Python
akari/__init__.py
kennydo/akari
ddf431889b07f74087ba0ab1b487c7b6db31fcb7
[ "MIT" ]
null
null
null
akari/__init__.py
kennydo/akari
ddf431889b07f74087ba0ab1b487c7b6db31fcb7
[ "MIT" ]
null
null
null
akari/__init__.py
kennydo/akari
ddf431889b07f74087ba0ab1b487c7b6db31fcb7
[ "MIT" ]
null
null
null
import logging import akari.log_config # noqa: F401 log = logging.getLogger(__name__)
12.857143
37
0.766667
12
90
5.333333
0.75
0
0
0
0
0
0
0
0
0
0
0.039474
0.155556
90
6
38
15
0.802632
0.111111
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
fe82150b732c95f6ea7ecdc0dba65918e5b47054
4,252
py
Python
sdk/python/pulumi_azure_nextgen/devtestlab/v20160515/__init__.py
pulumi/pulumi-azure-nextgen
452736b0a1cf584c2d4c04666e017af6e9b2c15c
[ "Apache-2.0" ]
31
2020-09-21T09:41:01.000Z
2021-02-26T13:21:59.000Z
sdk/python/pulumi_azure_nextgen/devtestlab/v20160515/__init__.py
pulumi/pulumi-azure-nextgen
452736b0a1cf584c2d4c04666e017af6e9b2c15c
[ "Apache-2.0" ]
231
2020-09-21T09:38:45.000Z
2021-03-01T11:16:03.000Z
sdk/python/pulumi_azure_nextgen/devtestlab/v20160515/__init__.py
pulumi/pulumi-azure-nextgen
452736b0a1cf584c2d4c04666e017af6e9b2c15c
[ "Apache-2.0" ]
4
2020-09-29T14:14:59.000Z
2021-02-10T20:38:16.000Z
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** # Export this package's modules as members: from ._enums import * from .artifact_source import * from .custom_image import * from .disk import * from .environment import * from .formula import * from .get_artifact_source import * from .get_custom_image import * from .get_disk import * from .get_environment import * from .get_formula import * from .get_global_schedule import * from .get_lab import * from .get_notification_channel import * from .get_policy import * from .get_schedule import * from .get_secret import * from .get_service_runner import * from .get_user import * from .get_virtual_machine import * from .get_virtual_machine_schedule import * from .get_virtual_network import * from .global_schedule import * from .lab import * from .list_lab_vhds import * from .list_schedule_applicable import * from .list_virtual_machine_applicable_schedules import * from .notification_channel import * from .policy import * from .schedule import * from .secret import * from .service_runner import * from .user import * from .virtual_machine import * from .virtual_machine_schedule import * from .virtual_network import * from ._inputs import * from . import outputs def _register_module(): import pulumi from ... import _utilities class Module(pulumi.runtime.ResourceModule): _version = _utilities.get_semver_version() def version(self): return Module._version def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource: if typ == "azure-nextgen:devtestlab/v20160515:ArtifactSource": return ArtifactSource(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:CustomImage": return CustomImage(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Disk": return Disk(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Environment": return Environment(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Formula": return Formula(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:GlobalSchedule": return GlobalSchedule(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Lab": return Lab(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:NotificationChannel": return NotificationChannel(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Policy": return Policy(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Schedule": return Schedule(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:Secret": return Secret(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:ServiceRunner": return ServiceRunner(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:User": return User(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:VirtualMachine": return VirtualMachine(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:VirtualMachineSchedule": return VirtualMachineSchedule(name, pulumi.ResourceOptions(urn=urn)) elif typ == "azure-nextgen:devtestlab/v20160515:VirtualNetwork": return VirtualNetwork(name, pulumi.ResourceOptions(urn=urn)) else: raise Exception(f"unknown resource type {typ}") _module_instance = Module() pulumi.runtime.register_resource_module("azure-nextgen", "devtestlab/v20160515", _module_instance) _register_module()
43.835052
102
0.695673
474
4,252
6.113924
0.21097
0.127674
0.129055
0.18185
0.415459
0.357143
0.357143
0.357143
0.357143
0.357143
0
0.040677
0.207902
4,252
96
103
44.291667
0.819774
0.047742
0
0
1
0
0.195351
0.180514
0
0
0
0
0
1
0.036145
false
0
0.481928
0.012048
0.746988
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
fe89d8b281eacf124b39fa0f177674c3d491eacc
109
py
Python
django/django_fundamentals/django_intro/userstemps_with_templates/users_template_app/apps.py
fatimaalheeh/python_stack
9ba84e6dc030a65494f105152a97f0a38aa2e4f3
[ "MIT" ]
null
null
null
django/django_fundamentals/django_intro/userstemps_with_templates/users_template_app/apps.py
fatimaalheeh/python_stack
9ba84e6dc030a65494f105152a97f0a38aa2e4f3
[ "MIT" ]
null
null
null
django/django_fundamentals/django_intro/userstemps_with_templates/users_template_app/apps.py
fatimaalheeh/python_stack
9ba84e6dc030a65494f105152a97f0a38aa2e4f3
[ "MIT" ]
null
null
null
from django.apps import AppConfig class UsersTemplateAppConfig(AppConfig): name = 'users_template_app'
18.166667
40
0.798165
12
109
7.083333
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.137615
109
5
41
21.8
0.904255
0
0
0
0
0
0.165138
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
fe8c357c7dee3eb143cb951e110e06c49a8f5fe6
113
py
Python
problems/euler010.py
branning/euler
b9f53cdca4b246fab45a8ea4a19f432e7f733594
[ "MIT" ]
null
null
null
problems/euler010.py
branning/euler
b9f53cdca4b246fab45a8ea4a19f432e7f733594
[ "MIT" ]
null
null
null
problems/euler010.py
branning/euler
b9f53cdca4b246fab45a8ea4a19f432e7f733594
[ "MIT" ]
null
null
null
#!/usr/bin/env python from euler007 import eratosthenes primes = eratosthenes(2000000) print sum(primes)
16.142857
34
0.743363
14
113
6
0.857143
0
0
0
0
0
0
0
0
0
0
0.106383
0.168142
113
6
35
18.833333
0.787234
0.176991
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.333333
null
null
0.333333
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
4
fe9800e40a0ab202d0fb6394cff3a12a549d5ac8
92
py
Python
Kitchen_Order/Order_app/apps.py
remiljw/Kitchen-Order
cbf758f765e05548ec8a4f30de3c5ee7b73b8e9d
[ "MIT" ]
null
null
null
Kitchen_Order/Order_app/apps.py
remiljw/Kitchen-Order
cbf758f765e05548ec8a4f30de3c5ee7b73b8e9d
[ "MIT" ]
null
null
null
Kitchen_Order/Order_app/apps.py
remiljw/Kitchen-Order
cbf758f765e05548ec8a4f30de3c5ee7b73b8e9d
[ "MIT" ]
1
2021-01-13T19:24:48.000Z
2021-01-13T19:24:48.000Z
from django.apps import AppConfig class OrderAppConfig(AppConfig): name = 'Order_app'
15.333333
33
0.76087
11
92
6.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.163043
92
5
34
18.4
0.896104
0
0
0
0
0
0.097826
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
fe98a576084480757c323e9ae34b416ddafb6e87
87
py
Python
africa/apps.py
Mutugiii/Pinstagram
40436facfb068eea135c6dffcdaf85028ff803c1
[ "MIT" ]
null
null
null
africa/apps.py
Mutugiii/Pinstagram
40436facfb068eea135c6dffcdaf85028ff803c1
[ "MIT" ]
6
2021-03-30T13:09:41.000Z
2021-09-08T01:50:42.000Z
africa/apps.py
Mutugiii/Pinstagram
40436facfb068eea135c6dffcdaf85028ff803c1
[ "MIT" ]
null
null
null
from django.apps import AppConfig class AfricaConfig(AppConfig): name = 'africa'
14.5
33
0.747126
10
87
6.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.172414
87
5
34
17.4
0.902778
0
0
0
0
0
0.068966
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
feb2c0370224c37c28ac459c7262af1da9898333
86
py
Python
pyprojecttemplate/__init__.py
patrickshiel/python-package-template
1b08725a4419cf83ad058649b560b35215058375
[ "MIT" ]
null
null
null
pyprojecttemplate/__init__.py
patrickshiel/python-package-template
1b08725a4419cf83ad058649b560b35215058375
[ "MIT" ]
4
2020-03-24T17:56:02.000Z
2021-06-02T00:48:51.000Z
pyprojecttemplate/__init__.py
patrickshiel/python-package-template
1b08725a4419cf83ad058649b560b35215058375
[ "MIT" ]
null
null
null
""" Python Package Template - main entry-point """ import pyprojecttemplate.basicmath
17.2
42
0.77907
9
86
7.444444
1
0
0
0
0
0
0
0
0
0
0
0
0.116279
86
5
43
17.2
0.881579
0.488372
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
22813972b68456b5e6827236f111f0c6c5159432
127
py
Python
moto/budgets/__init__.py
andormarkus/moto
67cda6d7d6f42118ccd7e2170e7ff0a1f92fa6a6
[ "Apache-2.0" ]
null
null
null
moto/budgets/__init__.py
andormarkus/moto
67cda6d7d6f42118ccd7e2170e7ff0a1f92fa6a6
[ "Apache-2.0" ]
null
null
null
moto/budgets/__init__.py
andormarkus/moto
67cda6d7d6f42118ccd7e2170e7ff0a1f92fa6a6
[ "Apache-2.0" ]
null
null
null
from .models import budgets_backends from ..core.models import base_decorator mock_budgets = base_decorator(budgets_backends)
25.4
47
0.850394
17
127
6.058824
0.529412
0.23301
0
0
0
0
0
0
0
0
0
0
0.094488
127
4
48
31.75
0.895652
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
228bb818e624e1de200951873e665f0359e2112a
40,060
py
Python
testsSDW__copy/card_tests/hunter_tests.py
jomyhuang/sdwle
9b6e916567e09c7cba4a171fe0adf0f47009a8c3
[ "MIT" ]
null
null
null
testsSDW__copy/card_tests/hunter_tests.py
jomyhuang/sdwle
9b6e916567e09c7cba4a171fe0adf0f47009a8c3
[ "MIT" ]
null
null
null
testsSDW__copy/card_tests/hunter_tests.py
jomyhuang/sdwle
9b6e916567e09c7cba4a171fe0adf0f47009a8c3
[ "MIT" ]
null
null
null
import random import unittest from SDWLE.agents.basic_agents import DoNothingAgent, PredictableAgent from SDWLE.constants import MINION_TYPE from testsSDW.agents.testing_agents import CardTestingAgent, OneCardPlayingAgent, WeaponTestingAgent, \ PlayAndAttackAgent, SelfSpellTestingAgent from testsSDW.testing_utils import generate_game_for, mock from SDWLE.cards import * class TestHunter(unittest.TestCase): def setUp(self): random.seed(1857) def test_HuntersMark(self): game = generate_game_for(HuntersMark, MogushanWarden, CardTestingAgent, OneCardPlayingAgent) for turn in range(0, 8): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(7, game.current_player.minions[0].health) self.assertEqual(7, game.current_player.minions[0].calculate_max_health()) # This will play all the hunter's marks currently in the player's hand game.play_single_turn() self.assertEqual(1, game.other_player.minions[0].health) self.assertEqual(1, game.other_player.minions[0].calculate_max_health()) def test_TimberWolf(self): game = generate_game_for([StonetuskBoar, FaerieDragon, KoboldGeomancer, TimberWolf], StonetuskBoar, CardTestingAgent, DoNothingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(4, len(game.current_player.minions)) self.assertEqual(2, game.current_player.minions[3].calculate_attack()) self.assertEqual(3, game.current_player.minions[2].calculate_attack()) self.assertEqual(2, game.current_player.minions[1].calculate_attack()) self.assertEqual(1, game.current_player.minions[0].calculate_attack()) for turn in range(0, 2): game.play_single_turn() self.assertEqual(6, len(game.current_player.minions)) self.assertEqual(2, game.current_player.minions[5].calculate_attack()) self.assertEqual(3, game.current_player.minions[4].calculate_attack()) self.assertEqual(2, game.current_player.minions[3].calculate_attack()) self.assertEqual(1, game.current_player.minions[2].calculate_attack()) self.assertEqual(2, game.current_player.minions[1].calculate_attack()) self.assertEqual(3, game.current_player.minions[0].calculate_attack()) game.current_player.minions[1].die(None) game.current_player.minions[1].activate_delayed() self.assertEqual(5, len(game.current_player.minions)) self.assertEqual(2, game.current_player.minions[4].calculate_attack()) self.assertEqual(3, game.current_player.minions[3].calculate_attack()) self.assertEqual(2, game.current_player.minions[2].calculate_attack()) self.assertEqual(1, game.current_player.minions[1].calculate_attack()) self.assertEqual(3, game.current_player.minions[0].calculate_attack()) game.current_player.minions[3].die(None) game.current_player.minions[3].activate_delayed() self.assertEqual(4, len(game.current_player.minions)) self.assertEqual(2, game.current_player.minions[3].calculate_attack()) self.assertEqual(2, game.current_player.minions[2].calculate_attack()) self.assertEqual(1, game.current_player.minions[1].calculate_attack()) self.assertEqual(3, game.current_player.minions[0].calculate_attack()) wolf = game.current_player.minions[1] wolf.die(None) wolf.activate_delayed() self.assertEqual(3, len(game.current_player.minions)) self.assertEqual(1, game.current_player.minions[2].calculate_attack()) self.assertEqual(2, game.current_player.minions[1].calculate_attack()) self.assertEqual(3, game.current_player.minions[0].calculate_attack()) def test_ArcaneShot(self): game = generate_game_for(ArcaneShot, StonetuskBoar, CardTestingAgent, DoNothingAgent) game.players[0].spell_damage = 1 game.play_single_turn() self.assertEqual(27, game.other_player.hero.health) def test_BestialWrath(self): def verify_bwrath(): self.assertEqual(5, game.players[0].minions[0].calculate_attack()) self.assertTrue(game.players[0].minions[0].immune) def verify_silence(): self.assertFalse(game.players[0].minions[0].immune) self.assertEqual(1, game.players[0].minions[0].calculate_attack()) game = generate_game_for([StonetuskBoar, BestialWrath, BestialWrath, BestialWrath, Silence, Archmage], Wisp, CardTestingAgent, DoNothingAgent) game.play_single_turn() game.play_single_turn() game.players[0].bind_once("turn_ended", verify_bwrath) game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertFalse(game.players[0].minions[0].immune) self.assertEqual(1, game.players[0].minions[0].calculate_attack()) game.play_single_turn() game.players[0].bind_once("turn_ended", verify_silence) game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertFalse(game.players[0].minions[0].immune) self.assertEqual(1, game.players[0].minions[0].calculate_attack()) self.assertEqual(1, len(game.players[0].hand)) def test_Flare(self): game = generate_game_for(Vaporize, [WorgenInfiltrator, WorgenInfiltrator], CardTestingAgent, CardTestingAgent) for turn in range(0, 5): game.play_single_turn() # Vaporize is in place and two Infiltrators are down self.assertEqual(1, len(game.current_player.secrets)) self.assertEqual(3, len(game.other_player.minions)) self.assertTrue(game.other_player.minions[0].stealth) self.assertTrue(game.other_player.minions[1].stealth) self.assertEqual(4, len(game.other_player.hand)) old_play = game.other_player.agent.do_turn def _play_and_attack(player): flare = Flare() flare.target = None flare.use(player, player.game) old_play(player) player.minions[4].attack() game.other_player.agent.do_turn = _play_and_attack game.play_single_turn() # All of the Worgens should still be alive, because Vaporize is gone. self.assertEqual(0, len(game.other_player.secrets)) self.assertEqual(7, len(game.current_player.minions)) for minion in game.current_player.minions[4:]: self.assertFalse(minion.stealth) def test_EaglehornBow(self): game = generate_game_for([Snipe, EaglehornBow], StonetuskBoar, PlayAndAttackAgent, OneCardPlayingAgent) for turn in range(0, 9): game.play_single_turn() self.assertEqual(1, game.players[0].weapon.durability) self.assertEqual(3, game.players[0].weapon.base_attack) # Snipe should trigger, granting our weapon +1 durability game.play_single_turn() self.assertEqual(2, game.players[0].weapon.durability) self.assertEqual(3, game.players[0].weapon.base_attack) def test_GladiatorsLongbow(self): game = generate_game_for(GladiatorsLongbow, WaterElemental, WeaponTestingAgent, OneCardPlayingAgent) for turn in range(0, 13): game.play_single_turn() self.assertEqual(3, len(game.other_player.minions)) self.assertEqual(1, game.other_player.minions[0].health) self.assertEqual(30, game.current_player.hero.health) self.assertFalse(game.current_player.hero.frozen) self.assertFalse(game.current_player.hero.immune) game.play_single_turn() game.play_single_turn() self.assertEqual(4, len(game.other_player.minions)) self.assertEqual(1, game.other_player.minions[0].health) self.assertEqual(1, game.other_player.minions[1].health) self.assertEqual(30, game.current_player.hero.health) self.assertFalse(game.current_player.hero.frozen) self.assertFalse(game.current_player.hero.immune) self.assertEqual(0, len(game.current_player.events)) def test_Tracking(self): game = generate_game_for([Tracking, Tracking, Tracking, Tracking, StonetuskBoar, BloodfenRaptor, KoboldGeomancer], StonetuskBoar, CardTestingAgent, DoNothingAgent) game.players[0].agent.choose_option = lambda options, player: options[0] game.play_single_turn() self.assertEqual(4, len(game.current_player.hand)) self.assertEqual("Stonetusk Boar", game.current_player.hand[3].name) self.assertEqual(23, game.current_player.deck.left) def test_ExplosiveTrap(self): game = generate_game_for(ExplosiveTrap, StonetuskBoar, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 3): game.play_single_turn() self.assertEqual(1, len(game.current_player.secrets)) self.assertEqual(1, len(game.other_player.minions)) game.play_single_turn() self.assertEqual(0, len(game.other_player.secrets)) self.assertEqual(0, len(game.current_player.minions)) self.assertEqual(28, game.current_player.hero.health) self.assertEqual(29, game.other_player.hero.health) random.seed(1857) game = generate_game_for(ExplosiveTrap, Frostbolt, CardTestingAgent, CardTestingAgent) for turn in range(0, 4): game.play_single_turn() self.assertEqual(1, len(game.other_player.secrets)) self.assertEqual(30, game.current_player.hero.health) self.assertEqual(27, game.other_player.hero.health) def test_FreezingTrap(self): game = generate_game_for(FreezingTrap, BluegillWarrior, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 4): game.play_single_turn() self.assertEqual(0, len(game.players[1].minions)) self.assertEqual(4, len(game.players[0].hand)) self.assertEqual(7, len(game.players[1].hand)) self.assertEqual(4, game.players[1].hand[6].mana_cost()) self.assertEqual(0, len(game.players[0].secrets)) self.assertEqual(30, game.players[0].hero.health) game.play_single_turn() self.assertEqual(4, len(game.players[0].hand)) game.play_single_turn() self.assertEqual(0, len(game.current_player.minions)) self.assertEqual(30, game.players[0].hero.health) self.assertEqual(8, len(game.players[1].hand)) self.assertEqual(4, game.players[1].hand[5].mana_cost()) self.assertEqual(4, game.players[1].hand[7].mana_cost()) def test_FreezingTrap_many_cards(self): class FreezingTrapAgent(DoNothingAgent): def do_turn(self, player): if player.mana == 6: game.play_card(player.hand[0]) if player.mana == 7: player.minions[0].attack() game = generate_game_for(FreezingTrap, BoulderfistOgre, CardTestingAgent, FreezingTrapAgent) for turn in range(0, 12): game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) death_mock = mock.Mock() game.players[1].minions[0].bind_once("died", death_mock) game.play_single_turn() game.play_single_turn() self.assertEqual(10, len(game.current_player.hand)) self.assertEqual(0, len(game.current_player.minions)) for card in game.current_player.hand: if card.name != "The Coin": self.assertEqual(6, card.mana_cost()) self.assertEqual(30, game.other_player.hero.health) death_mock.assert_called_once_with(None) def test_Misdirection(self): game = generate_game_for(Misdirection, StonetuskBoar, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 4): game.play_single_turn() self.assertEqual(28, game.other_player.hero.health) self.assertEqual(1, len(game.current_player.minions)) # The boar has been misdirected into another boar self.assertEqual(30, game.current_player.hero.health) def test_MisdirectionToHero(self): game = generate_game_for(Misdirection, BluegillWarrior, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 4): game.play_single_turn() self.assertEqual(30, game.other_player.hero.health) # The murloc should be misdirected self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(28, game.current_player.hero.health) def test_FreezingTrapAndMisdirection(self): game = generate_game_for([Misdirection, FreezingTrap], Wolfrider, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 6): game.play_single_turn() # Misdirection was played first so it triggers first redirecting the atttack to the enemy hero, but # Freezing Trap triggers, bouncing the charging Wolfrider self.assertEqual(0, len(game.players[1].minions)) self.assertEqual(8, len(game.players[1].hand)) self.assertEqual(5, game.players[1].hand[7].mana_cost()) self.assertEqual(4, len(game.players[0].hand)) self.assertEqual(30, game.other_player.hero.health) self.assertEqual(30, game.current_player.hero.health) self.assertEqual(0, len(game.players[0].secrets)) game.play_single_turn() # Should be able to play both Misdirection and Freezing Trap again self.assertEqual(3, len(game.players[0].hand)) def test_Snipe(self): game = generate_game_for([MagmaRager, OasisSnapjaw, FeralSpirit], Snipe, CardTestingAgent, CardTestingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(0, len(game.current_player.minions)) game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(3, game.current_player.minions[0].health) game.play_single_turn() game.play_single_turn() self.assertEqual(3, len(game.current_player.minions)) self.assertEqual(3, game.current_player.minions[0].health) self.assertEqual(3, game.current_player.minions[1].health) self.assertEqual(3, game.current_player.minions[2].health) def test_ExplosiveTrap_hero(self): game = generate_game_for(ExplosiveTrap, Naturalize, OneCardPlayingAgent, PredictableAgent) for turn in range(0, 3): game.play_single_turn() self.assertEqual(1, len(game.current_player.secrets)) self.assertEqual(30, game.current_player.hero.health) self.assertEqual(30, game.other_player.hero.health) game.play_single_turn() self.assertEqual(0, len(game.other_player.secrets)) self.assertEqual(29, game.current_player.hero.health) self.assertEqual(29, game.other_player.hero.health) def test_SavannahHighmane(self): game = generate_game_for(SavannahHighmane, SiphonSoul, OneCardPlayingAgent, CardTestingAgent) for turn in range(0, 12): game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual("Hyena", game.players[0].minions[0].card.name) self.assertEqual("Hyena", game.players[0].minions[1].card.name) def test_Houndmaster(self): game = generate_game_for([Houndmaster, StonetuskBoar], IronfurGrizzly, CardTestingAgent, OneCardPlayingAgent) for turn in range(0, 7): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(4, game.players[0].minions[0].calculate_attack()) self.assertEqual(3, game.players[0].minions[0].health) self.assertEqual(3, game.players[1].minions[0].calculate_attack()) self.assertEqual(3, game.players[1].minions[0].health) game.play_single_turn() game.play_single_turn() self.assertEqual(3, len(game.players[0].minions)) self.assertEqual(4, game.players[0].minions[0].calculate_attack()) self.assertEqual(3, game.players[0].minions[0].health) self.assertEqual(3, game.players[0].minions[1].calculate_attack()) self.assertEqual(3, game.players[0].minions[1].health) self.assertTrue(game.players[0].minions[1].taunt) self.assertEqual("Stonetusk Boar", game.players[0].minions[1].card.name) self.assertEqual(4, game.players[0].minions[2].calculate_attack()) self.assertEqual(3, game.players[0].minions[2].health) def test_DeadlyShot(self): game = generate_game_for(DeadlyShot, SenjinShieldmasta, CardTestingAgent, OneCardPlayingAgent) for turn in range(0, 8): game.play_single_turn() self.assertEqual(7, len(game.players[0].hand)) self.assertEqual(1, len(game.players[1].minions)) # Can't use until a unit is on the field game.play_single_turn() self.assertEqual(7, len(game.players[0].hand)) self.assertEqual(0, len(game.players[1].minions)) def test_MultiShot(self): game = generate_game_for(MultiShot, SenjinShieldmasta, CardTestingAgent, OneCardPlayingAgent) for turn in range(0, 10): game.play_single_turn() self.assertEqual(8, len(game.players[0].hand)) self.assertEqual(2, len(game.players[1].minions)) self.assertEqual(5, game.players[1].minions[0].health) self.assertEqual(5, game.players[1].minions[1].health) # Can't use until 2 units are on the field game.play_single_turn() self.assertEqual(8, len(game.players[0].hand)) self.assertEqual(2, len(game.players[1].minions)) self.assertEqual(2, game.players[1].minions[0].health) self.assertEqual(2, game.players[1].minions[1].health) def test_ExplosiveShot(self): game = generate_game_for(IronfurGrizzly, ExplosiveShot, OneCardPlayingAgent, CardTestingAgent) for turn in range(0, 9): game.play_single_turn() game.players[1].agent.choose_target = lambda targets: targets[len(targets) - 2] self.assertEqual(3, len(game.players[0].minions)) game.play_single_turn() # Explosive Shot the middle Grizzly self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(1, game.players[0].minions[0].health) self.assertEqual(1, game.players[0].minions[1].health) def test_KillCommand(self): game = generate_game_for([KillCommand, StonetuskBoar], StonetuskBoar, SelfSpellTestingAgent, OneCardPlayingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(27, game.players[0].hero.health) game.play_single_turn() game.play_single_turn() self.assertEqual(22, game.players[0].hero.health) def test_UnleashTheHounds(self): game = generate_game_for(UnleashTheHounds, StonetuskBoar, CardTestingAgent, OneCardPlayingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(2, len(game.players[1].minions)) self.assertEqual("Hound", game.players[0].minions[0].card.name) self.assertEqual("Hound", game.players[0].minions[1].card.name) def test_StarvingBuzzard(self): game = generate_game_for(StarvingBuzzard, StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 9): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(4, len(game.players[1].minions)) self.assertEqual(7, len(game.players[0].hand)) self.assertEqual(5, len(game.players[1].hand)) game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(5, len(game.players[1].minions)) self.assertEqual(7, len(game.players[0].hand)) self.assertEqual(4, len(game.players[1].hand)) game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(5, len(game.players[1].minions)) self.assertEqual(8, len(game.players[0].hand)) self.assertEqual(4, len(game.players[1].hand)) def test_BuzzardAndOwl(self): game = generate_game_for([StarvingBuzzard, IronbeakOwl], StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) for turn in range(0, 11): game.play_single_turn() # The buzzard should be silenced, but only after drawing a card from the owl self.assertEqual(8, len(game.current_player.hand)) self.assertEqual(0, len(game.current_player.minions[1].effects)) def test_TundraRhino(self): game = generate_game_for([StonetuskBoar, OasisSnapjaw, TundraRhino], StonetuskBoar, PlayAndAttackAgent, DoNothingAgent) for turn in range(0, 6): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(27, game.players[1].hero.health) game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(26, game.players[1].hero.health) game.play_single_turn() game.play_single_turn() self.assertEqual(3, len(game.players[0].minions)) self.assertEqual(21, game.players[1].hero.health) self.assertTrue(game.players[0].minions[0].charge()) self.assertTrue(game.players[0].minions[1].charge()) self.assertTrue(game.players[0].minions[2].charge()) game.players[0].minions[2].silence() self.assertTrue(game.players[0].minions[2].charge()) def test_TundraRhino_with_silence(self): game = generate_game_for([StonetuskBoar, OasisSnapjaw, TundraRhino, Silence], StonetuskBoar, PlayAndAttackAgent, DoNothingAgent) for turn in range(0, 8): game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(26, game.players[1].hero.health) game.play_single_turn() self.assertEqual(3, len(game.players[0].minions)) self.assertEqual(23, game.players[1].hero.health) self.assertFalse(game.players[0].minions[0].charge()) self.assertFalse(game.players[0].minions[1].charge()) self.assertTrue(game.players[0].minions[2].charge()) def test_AnimalCompanion(self): game = generate_game_for(AnimalCompanion, StonetuskBoar, CardTestingAgent, DoNothingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual("Leokk", game.players[0].minions[0].card.name) game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual("Leokk", game.players[0].minions[0].card.name) self.assertEqual("Misha", game.players[0].minions[1].card.name) self.assertEqual(2, game.players[0].minions[0].calculate_attack()) self.assertEqual(5, game.players[0].minions[1].calculate_attack()) game.play_single_turn() game.play_single_turn() self.assertEqual(3, len(game.players[0].minions)) self.assertEqual("Leokk", game.players[0].minions[0].card.name) self.assertEqual("Misha", game.players[0].minions[1].card.name) self.assertEqual("Huffer", game.players[0].minions[2].card.name) def test_ScavengingHyena(self): game = generate_game_for([ScavengingHyena, ScavengingHyena, Consecration], [StonetuskBoar, ShadowBolt], OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(2, game.players[0].minions[0].calculate_attack()) self.assertEqual(2, game.players[0].minions[1].calculate_attack()) self.assertEqual(2, game.players[0].minions[0].health) self.assertEqual(2, game.players[0].minions[1].health) game.play_single_turn() # Kills 1 Hyena, other Hyena grows self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(4, game.players[0].minions[0].calculate_attack()) self.assertEqual(3, game.players[0].minions[0].health) def test_SnakeTrap(self): game = generate_game_for([SnakeTrap, IronfurGrizzly], BluegillWarrior, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 5): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(1, len(game.players[0].secrets)) game.play_single_turn() self.assertEqual(3, len(game.players[0].minions)) self.assertEqual(0, len(game.players[1].minions)) self.assertEqual(0, len(game.players[0].secrets)) def test_SnakeTrap_full_board(self): game = generate_game_for([SnakeTrap, Onyxia], KingKrush, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 17): game.play_single_turn() self.assertEqual(7, len(game.current_player.minions)) self.assertEqual(1, len(game.current_player.secrets)) self.assertEqual(0, len(game.other_player.minions)) game.play_single_turn() # Player 2 will play King Krush, which will charge a whelp self.assertEqual(1, len(game.other_player.secrets)) # The snake trap will not be proced as the board is full self.assertEqual(6, len(game.other_player.minions)) self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(30, game.other_player.hero.health) def test_Webspinner(self): game = generate_game_for(Webspinner, MortalCoil, OneCardPlayingAgent, CardTestingAgent) game.play_single_turn() game.play_single_turn() self.assertEqual(0, len(game.other_player.minions)) self.assertEqual(4, len(game.other_player.hand)) self.assertEqual(MINION_TYPE.BEAST, game.other_player.hand[3].minion_type) def test_CallPet(self): game = generate_game_for([CallPet, CallPet, MoltenGiant, MoltenGiant, MoltenGiant, KingKrush, MoltenGiant, MoltenGiant], MortalCoil, CardTestingAgent, DoNothingAgent) for turn in range(0, 4): game.play_single_turn() # King Krush should cost 4 less (9 - 4 = 5) self.assertEqual(5, len(game.players[0].hand)) self.assertEqual(5, game.players[0].hand[4].mana_cost()) for turn in range(0, 2): game.play_single_turn() # Molten Giant should not be affected since it's not a beast self.assertEqual(20, game.players[0].hand[5].mana_cost()) def test_CobraShot(self): game = generate_game_for(CobraShot, StonetuskBoar, CardTestingAgent, CardTestingAgent) for turn in range(0, 8): game.play_single_turn() self.assertEqual(30, game.players[1].hero.health) self.assertEqual(7, len(game.players[1].minions)) game.play_single_turn() self.assertEqual(27, game.players[1].hero.health) self.assertEqual(6, len(game.players[1].minions)) def test_Glaivezooka(self): game = generate_game_for([StonetuskBoar, Glaivezooka], StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) for turn in range(0, 2): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(1, game.players[0].minions[0].calculate_attack()) game.play_single_turn() self.assertEqual(2, game.players[0].weapon.base_attack) self.assertEqual(2, game.players[0].weapon.durability) self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(2, game.players[0].minions[0].calculate_attack()) def test_MetaltoothLeaper(self): game = generate_game_for([MetaltoothLeaper, Wisp], SpiderTank, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(0, 8): game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) self.assertEqual(3, game.players[0].minions[1].calculate_attack()) self.assertEqual(1, game.players[0].minions[0].calculate_attack()) self.assertEqual(2, len(game.players[1].minions)) self.assertEqual(3, game.players[1].minions[1].calculate_attack()) self.assertEqual(3, game.players[1].minions[0].calculate_attack()) # The second leaper will buff the first, but won't be buffed by anything game.play_single_turn() self.assertEqual(3, len(game.players[0].minions)) self.assertEqual(3, game.players[0].minions[0].calculate_attack()) self.assertEqual(1, game.players[0].minions[1].calculate_attack()) self.assertEqual(5, game.players[0].minions[2].calculate_attack()) def test_KingOfBeasts(self): game = generate_game_for([StonetuskBoar, StonetuskBoar, StonetuskBoar, KingOfBeasts], StonetuskBoar, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(9): game.play_single_turn() self.assertEqual(4, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[0].calculate_attack()) game.play_single_turn() game.play_single_turn() self.assertEqual(5, len(game.current_player.minions)) self.assertEqual(5, game.current_player.minions[1].calculate_attack()) def test_Gahzrilla(self): game = generate_game_for([Gahzrilla, ShatteredSunCleric, RaidLeader], ArcaneExplosion, OneCardPlayingAgent, OneCardPlayingAgent) for turn in range(13): game.play_single_turn() self.assertEqual(6, game.current_player.minions[0].calculate_attack()) game.play_single_turn() # Arcane explosion damages the Gahz'rilla, doubling its attack self.assertEqual(12, game.other_player.minions[0].calculate_attack()) # The buff from the cleric is applies after the double, increases by 1 game.play_single_turn() self.assertEqual(13, game.current_player.minions[1].calculate_attack()) # Should double exactly the current attack game.play_single_turn() self.assertEqual(26, game.other_player.minions[1].calculate_attack()) # Raid leader gives a +1 Bonus game.play_single_turn() self.assertEqual(27, game.current_player.minions[2].calculate_attack()) # The raid leader's aura is not included in the double, but is applied afterwards # Tested by @jleclanche for patch 2.1.0.7785 game.play_single_turn() self.assertEqual(53, game.other_player.minions[1].calculate_attack()) def testGahzrilla_temp_buff(self): env = self class TestAgent(CardTestingAgent): def do_turn(self, player): super().do_turn(player) if turn == 14: # Gahz'rilla's double comes after the buff from abusive, so total attack is # (6 + 2) * 2 = 16 env.assertEqual(16, game.current_player.minions[0].calculate_attack()) game = generate_game_for([Gahzrilla, AbusiveSergeant, Hellfire], StonetuskBoar, TestAgent, DoNothingAgent) for turn in range(15): game.play_single_turn() # After the buff wears off, the double no longer includes it, so the total attack is # 6 * 2 = 12 # Tested by @jleclanche for patch 2.1.0.7785 self.assertEqual(12, game.current_player.minions[0].calculate_attack()) def test_ogre_misdirection(self): game = generate_game_for(OgreBrute, Misdirection, PlayAndAttackAgent, OneCardPlayingAgent) random.seed(1850) for turn in range(0, 7): game.play_single_turn() self.assertEqual(26, game.players[0].hero.health) self.assertEqual(30, game.players[1].hero.health) def test_FeignDeath(self): game = generate_game_for([HauntedCreeper, LootHoarder, Malorne, FeignDeath], StonetuskBoar, OneCardPlayingAgent, DoNothingAgent) for turn in range(14): game.play_single_turn() self.assertEqual(3, len(game.other_player.minions)) self.assertEqual(7, len(game.other_player.hand)) game.play_single_turn() self.assertEqual(4, len(game.current_player.minions)) self.assertEqual(8, len(game.current_player.hand)) def test_SteamwheedleSniper(self): game = generate_game_for(SteamwheedleSniper, StonetuskBoar, PredictableAgent, DoNothingAgent) for turn in range(9): game.play_single_turn() self.assertEqual(2, len(game.current_player.minions)) self.assertEqual(22, game.other_player.hero.health) self.assertEqual(1, game.current_player.minions[1].health) self.assertEqual(3, game.current_player.minions[0].health) def test_Quickshot(self): game = generate_game_for(QuickShot, Wisp, CardTestingAgent, CardTestingAgent) for turn in range(2): game.play_single_turn() self.assertEqual(5, len(game.players[1].minions)) self.assertEqual(4, len(game.players[0].hand)) game.play_single_turn() # We should have played a quick shot and not drawn a card self.assertEqual(30, game.players[1].hero.health) self.assertEqual(4, len(game.players[1].minions)) self.assertEqual(4, len(game.players[0].hand)) game.play_single_turn() game.play_single_turn() # We should have played a quick shot and not drawn a card self.assertEqual(30, game.players[1].hero.health) self.assertEqual(4, len(game.players[1].minions)) self.assertEqual(4, len(game.players[0].hand)) game.play_single_turn() game.play_single_turn() # We should have played two shots and not drawn a card self.assertEqual(30, game.players[1].hero.health) self.assertEqual(3, len(game.players[1].minions)) self.assertEqual(3, len(game.players[0].hand)) game.play_single_turn() game.play_single_turn() # We should have played two shots and not drawn a card self.assertEqual(30, game.players[1].hero.health) self.assertEqual(2, len(game.players[1].minions)) self.assertEqual(2, len(game.players[0].hand)) game.play_single_turn() game.play_single_turn() # We should have played three shots and not drawn a card self.assertEqual(30, game.players[1].hero.health) self.assertEqual(0, len(game.players[1].minions)) self.assertEqual(1, len(game.players[0].hand)) game.play_single_turn() game.play_single_turn() # We should have played three shots, one of which was drawn, and have one card left over self.assertEqual(24, game.players[1].hero.health) self.assertEqual(0, len(game.players[1].minions)) self.assertEqual(1, len(game.players[0].hand)) def test_CoreRager(self): game = generate_game_for([CoreRager, Deathwing], Wisp, OneCardPlayingAgent, DoNothingAgent) for turn in range(18): game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(4, game.players[0].minions[0].calculate_attack()) self.assertEqual(4, game.players[0].minions[0].health) game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) # Deathwing discards whole hand self.assertEqual(12, game.players[0].minions[0].calculate_attack()) self.assertEqual(12, game.players[0].minions[0].health) game.play_single_turn() game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) # Deathwing the sequel self.assertEqual(12, game.players[0].minions[0].calculate_attack()) self.assertEqual(12, game.players[0].minions[0].health) game.play_single_turn() game.play_single_turn() self.assertEqual(2, len(game.players[0].minions)) # Core Rager activates battlecry self.assertEqual(7, game.players[0].minions[0].calculate_attack()) self.assertEqual(7, game.players[0].minions[0].health) def test_Acidmaw(self): game = generate_game_for([Acidmaw, ArcaneExplosion, InjuredBlademaster], OasisSnapjaw, CardTestingAgent, OneCardPlayingAgent) for turn in range(14): game.play_single_turn() # Three snapjaws self.assertEqual(4, len(game.current_player.minions)) # One Acidmaw self.assertEqual(1, len(game.other_player.minions)) self.assertEqual("Acidmaw", game.other_player.minions[0].card.name) game.play_single_turn() # The snapjaws are dead from the arcane explosion self.assertEqual(0, len(game.other_player.minions)) # The blademaster dies as well. self.assertEqual(1, len(game.current_player.minions)) self.assertEqual("Acidmaw", game.current_player.minions[0].card.name) def test_BearTrap(self): game = generate_game_for(BearTrap, StonetuskBoar, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 3): game.play_single_turn() self.assertEqual(1, len(game.players[1].minions)) self.assertEqual(1, len(game.players[0].secrets)) game.play_single_turn() self.assertEqual(1, len(game.players[0].minions)) self.assertEqual(0, len(game.players[0].secrets)) def test_BearTrap_full_board(self): game = generate_game_for([BearTrap, Onyxia], KingKrush, CardTestingAgent, PlayAndAttackAgent) for turn in range(0, 17): game.play_single_turn() self.assertEqual(7, len(game.current_player.minions)) self.assertEqual(1, len(game.current_player.secrets)) self.assertEqual(0, len(game.other_player.minions)) game.other_player.agent.choose_target = lambda x: game.players[0].hero game.play_single_turn() # Player 2 will play King Krush, which will charge the enemy hero's face self.assertEqual(1, len(game.other_player.secrets)) # The bear trap will not be proced as the board is full self.assertEqual(7, len(game.other_player.minions)) self.assertEqual(1, len(game.current_player.minions)) self.assertEqual(22, game.other_player.hero.health) def test_Powershot(self): game = generate_game_for(ManaWyrm, Powershot, OneCardPlayingAgent, CardTestingAgent) for turn in range(0, 5): game.play_single_turn() game.players[1].agent.choose_target = lambda targets: targets[len(targets) - 2] self.assertEqual(3, len(game.players[0].minions)) game.play_single_turn() # Powershot the middle Wyrm self.assertEqual(3, len(game.players[0].minions)) self.assertEqual(1, game.players[0].minions[0].health) self.assertEqual(1, game.players[0].minions[1].health) self.assertEqual(1, game.players[0].minions[2].health)
43.168103
117
0.669446
4,997
40,060
5.23314
0.075645
0.178394
0.065163
0.085354
0.81587
0.768375
0.720191
0.668528
0.596176
0.552734
0
0.026813
0.212381
40,060
927
118
43.214671
0.801978
0.057364
0
0.615156
0
0
0.003314
0
0
0
0
0
0.493314
1
0.080238
false
0
0.010401
0
0.095097
0
0
0
0
null
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
22a5c90d40a67a5861842d5eae65c04f2b84f587
96
py
Python
src/pump/feed.py
ElDiabloRojo/Xylem
00052fe613d738f3bb881d6367ec9e03c0b91c23
[ "MIT" ]
null
null
null
src/pump/feed.py
ElDiabloRojo/Xylem
00052fe613d738f3bb881d6367ec9e03c0b91c23
[ "MIT" ]
null
null
null
src/pump/feed.py
ElDiabloRojo/Xylem
00052fe613d738f3bb881d6367ec9e03c0b91c23
[ "MIT" ]
null
null
null
#!/bin/python3 import time import sys from adafruit_motorkit import MotorKit def main():
10.666667
38
0.739583
13
96
5.384615
0.769231
0
0
0
0
0
0
0
0
0
0
0.012821
0.1875
96
9
39
10.666667
0.884615
0.135417
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.75
null
null
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
4
22ad3b0b32a8336ee4eff81fad70a48d303c052c
5,619
py
Python
tests/unit/test_models.py
YellowFlash2012/stock-portfolio-io
0a39c9a692aecc8d6b39e728efd63061112bc975
[ "MIT" ]
null
null
null
tests/unit/test_models.py
YellowFlash2012/stock-portfolio-io
0a39c9a692aecc8d6b39e728efd63061112bc975
[ "MIT" ]
null
null
null
tests/unit/test_models.py
YellowFlash2012/stock-portfolio-io
0a39c9a692aecc8d6b39e728efd63061112bc975
[ "MIT" ]
null
null
null
""" This file (test_models.py) contains the unit tests for the models.py file. """ from datetime import datetime from freezegun import freeze_time def test_new_stock(new_stock): """ GIVEN a Stock model WHEN a new Stock object is created THEN check the symbol, number of shares, and purchase price fields are defined correctly """ assert new_stock.stock_symbol == 'AAPL' assert new_stock.number_of_shares == 16 assert new_stock.purchase_price == 406.78 assert new_stock.user_id == 7 assert new_stock.purchase_date.year == 2022 assert new_stock.purchase_date.month == 2 assert new_stock.purchase_date.day == 12 def test_new_user(new_user): """ GIVEN a User model WHEN a new User object is created THEN check the email is valid and hashed password does not equal the password provided """ assert new_user.email == 'geisa@email.com' assert new_user.password_hashed != 'FlaskIsAwesome123' def test_set_password(new_user): """ GIVEN a User model WHEN the user's password is changed THEN check the password has been changed """ new_user.set_password('FlaskIsStillAwesome456') assert new_user.email == 'geisa@email.com' assert new_user.password_hashed != 'FlaskIsStillAwesome456' assert new_user.is_password_correct('FlaskIsStillAwesome456') # this test uses the mock_requests_get_success_daily fixture to mimic a successful response from Alpha Vantage def test_get_stock_data_success(new_stock, mock_requests_get_success_daily): """ GIVEN a Flask application configured for testing and a monkeypatched version of requests.get() WHEN the HTTP response is set to successful THEN check that the stock data is updated """ new_stock.get_stock_data() assert new_stock.stock_symbol == 'AAPL' assert new_stock.number_of_shares == 16 assert new_stock.purchase_price == 147.78 assert new_stock.purchase_date.date() == datetime(2022, 2, 10).date() assert new_stock.current_price == 148.34 assert new_stock.current_price_date.date() == datetime.now().date() assert new_stock.position_value == (148.34*16) def test_get_stock_data_api_rate_limit_exceeded(new_stock, mock_requests_get_api_rate_limit_exceeded): """ GIVEN a Flask application configured for testing and a monkeypatched version of requests.get() WHEN the HTTP response is set to successful but the API rate limit is exceeded THEN check that the stock data is not updated """ new_stock.get_stock_data() assert new_stock.stock_symbol == 'AAPL' assert new_stock.number_of_shares == 16 assert new_stock.purchase_price == 148.78 assert new_stock.purchase_date.date() == datetime(2022, 2, 10).date() assert new_stock.current_price == 0 assert new_stock.current_price_date is None assert new_stock.position_value == 0 def test_get_stock_data_failure(new_stock, mock_requests_get_failure): """ GIVEN a Flask application configured for testing and a monkeypatched version of requests.get() WHEN the HTTP response is set to failed THEN check that the stock data is not updated """ new_stock.get_stock_data() assert new_stock.stock_symbol == 'AAPL' assert new_stock.number_of_shares == 16 assert new_stock.purchase_price == 147.78 assert new_stock.purchase_date.date() == datetime(2022, 2, 10).date() assert new_stock.current_price == 0 assert new_stock.current_price_date is None assert new_stock.position_value == 0 def test_get_stock_data_success_two_calls(new_stock, mock_requests_get_success_daily): """ GIVEN a Flask application configured for testing and a monkeypatched version of requests.get() WHEN the HTTP response is set to successful THEN check that the stock data is updated """ assert new_stock.stock_symbol == 'AAPL' assert new_stock.current_price == 0 assert new_stock.current_price_date is None assert new_stock.position_value == 0 new_stock.get_stock_data() assert new_stock.current_price == 148.34 assert new_stock.current_price_date.date() == datetime.now().date() assert new_stock.position_value == (148.34*16) new_stock.get_stock_data() assert new_stock.current_price == 148.34 assert new_stock.current_price_date.date() == datetime.now().date() assert new_stock.position_value == (148.34*16) @freeze_time('2020-07-28') def test_get_weekly_stock_data_success(new_stock, mock_requests_get_success_weekly): """ GIVEN a Flask application configured for testing and a monkeypatched version of requests.get() WHEN the HTTP response is set to successful THEN check the HTTP response """ title, labels, values = new_stock.get_weekly_stock_data() assert title == 'Weekly Prices (AAPL)' assert len(labels) == 3 assert labels[0].date() == datetime(2020, 6, 11).date() assert labels[1].date() == datetime(2020, 7, 17).date() assert labels[2].date() == datetime(2020, 7, 24).date() assert len(values) == 3 assert values[0] == '354.3400' assert values[1] == '362.7600' assert values[2] == '379.2400' assert datetime.now() == datetime(2020, 7, 28) def test_get_weekly_stock_data_failure(new_stock, mock_requests_get_failure): """ GIVEN a Flask application configured for testing and a monkeypatched version of requests.get() WHEN the HTTP response is set to failed THEN check the HTTP response """ title, labels, values = new_stock.get_weekly_stock_data() assert title == '' assert len(labels) == 0 assert len(values) == 0
41.014599
110
0.730201
835
5,619
4.677844
0.161677
0.110599
0.136201
0.064516
0.74296
0.705325
0.687148
0.664619
0.664619
0.641321
0
0.038814
0.183841
5,619
137
111
41.014599
0.812909
0.295248
0
0.539474
0
0
0.04992
0.017619
0
0
0
0
0.736842
1
0.118421
false
0.065789
0.026316
0
0.144737
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
1
0
0
0
0
0
4
22ad4006e23c4578c91569b478151d520d57a8ec
92
py
Python
napari_foobar/_tests/test_writer.py
tlambert03/napari-foobar
ef679b318f9efde72710f0d460ca4e535e5052b2
[ "BSD-3-Clause" ]
null
null
null
napari_foobar/_tests/test_writer.py
tlambert03/napari-foobar
ef679b318f9efde72710f0d460ca4e535e5052b2
[ "BSD-3-Clause" ]
null
null
null
napari_foobar/_tests/test_writer.py
tlambert03/napari-foobar
ef679b318f9efde72710f0d460ca4e535e5052b2
[ "BSD-3-Clause" ]
null
null
null
# from napari_foobar import napari_get_writer, napari_write_image # add your tests here...
23
65
0.804348
14
92
4.928571
0.857143
0
0
0
0
0
0
0
0
0
0
0
0.130435
92
3
66
30.666667
0.8625
0.934783
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
22b073bb087e031c3ccf6ce6e16ddf2bcae9e001
137
py
Python
kpack_linux/load.py
komlog-io/kpack_linux
08d17814c22b584d79360d64a0b9dea44a9a8142
[ "Apache-2.0" ]
2
2017-08-28T16:44:26.000Z
2017-10-28T00:36:34.000Z
kpack_linux/load.py
komlog-io/kpack_linux
08d17814c22b584d79360d64a0b9dea44a9a8142
[ "Apache-2.0" ]
null
null
null
kpack_linux/load.py
komlog-io/kpack_linux
08d17814c22b584d79360d64a0b9dea44a9a8142
[ "Apache-2.0" ]
null
null
null
import asyncio from kpack_linux import LinuxHost, settings my_host = LinuxHost(settings.BASE_URI) asyncio.ensure_future(my_host.load())
22.833333
43
0.832117
20
137
5.45
0.7
0.311927
0
0
0
0
0
0
0
0
0
0
0.087591
137
5
44
27.4
0.872
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
22b51019045cac59ad5f3c31a3c47edb1c5d3dd3
89
py
Python
tests/syntax/print_is_a_function.py
matan-h/friendly
3ab0fc6541c837271e8865e247750007acdd18fb
[ "MIT" ]
287
2019-04-08T13:18:29.000Z
2021-03-14T19:10:21.000Z
test/brackets_samples/missing_brackets_print_error.py
kaareloide/error-explainer
786fa558efd0c26534e51a27924167000f1d1eef
[ "MIT" ]
191
2019-04-08T14:39:18.000Z
2021-03-14T22:14:56.000Z
test/brackets_samples/missing_brackets_print_error.py
kaareloide/error-explainer
786fa558efd0c26534e51a27924167000f1d1eef
[ "MIT" ]
9
2019-04-08T12:54:08.000Z
2020-11-20T02:26:27.000Z
"""Should raise SyntaxError: Missing parentheses in call to 'print' ...""" print 'hello'
29.666667
74
0.707865
11
89
5.727273
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.134831
89
2
75
44.5
0.818182
0
0
0
0
0
0.333333
0
0
0
0
0
0
0
null
null
0
0
null
null
1
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
4
22e28af4ea30611f98d6268d075d2160a047dd1f
163
py
Python
app/upload/tasks/test.py
louisguitton/friendly-broccoli
391f84e9cbabe973afefb8af1783f2905e1202c5
[ "Apache-2.0" ]
1
2018-08-09T11:42:33.000Z
2018-08-09T11:42:33.000Z
app/upload/tasks/test.py
louisguitton/personalityinterview.com
391f84e9cbabe973afefb8af1783f2905e1202c5
[ "Apache-2.0" ]
22
2018-08-10T09:37:21.000Z
2019-06-14T11:32:25.000Z
app/upload/tasks/test.py
louisguitton/personalityinterview.com
391f84e9cbabe973afefb8af1783f2905e1202c5
[ "Apache-2.0" ]
null
null
null
from celery.utils.log import get_task_logger from app import celery logger = get_task_logger(__name__) @celery.task def print_hello(): logger.info("Hello")
16.3
44
0.773006
25
163
4.68
0.56
0.119658
0.222222
0
0
0
0
0
0
0
0
0
0.134969
163
9
45
18.111111
0.829787
0
0
0
0
0
0.030675
0
0
0
0
0
0
1
0.166667
false
0
0.333333
0
0.5
0.166667
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
22ea7fc5eda6ad7097d69cc0c3abd8c91b4af22a
228
py
Python
demo_sklearn/sklearn_basic_param_randomizedSearchCV.py
caserwin/daily-learning-python
01fea4c5d4e86cbea2dbef8817146f018b5f1479
[ "Apache-2.0" ]
1
2019-05-04T07:27:18.000Z
2019-05-04T07:27:18.000Z
demo_sklearn/sklearn_basic_param_randomizedSearchCV.py
caserwin/daily-learning-python
01fea4c5d4e86cbea2dbef8817146f018b5f1479
[ "Apache-2.0" ]
null
null
null
demo_sklearn/sklearn_basic_param_randomizedSearchCV.py
caserwin/daily-learning-python
01fea4c5d4e86cbea2dbef8817146f018b5f1479
[ "Apache-2.0" ]
1
2018-09-20T01:49:36.000Z
2018-09-20T01:49:36.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-06-10 10:58 # @Author : erwin from sklearn.model_selection import RandomizedSearchCV """ 随机参数搜索器: https://www.kaggle.com/dkim1992/grid-search-vs-random-search """
22.8
60
0.692982
32
228
4.90625
0.9375
0
0
0
0
0
0
0
0
0
0
0.085
0.122807
228
9
61
25.333333
0.7
0.381579
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
fe010e5008dcdafa6a3fa13928ce2a99a2ed8125
173
py
Python
src/app/views/user/__init__.py
rico0821/fridge
c564f9a4b656c06384d5c40db038328c35ccf1ed
[ "MIT" ]
null
null
null
src/app/views/user/__init__.py
rico0821/fridge
c564f9a4b656c06384d5c40db038328c35ccf1ed
[ "MIT" ]
null
null
null
src/app/views/user/__init__.py
rico0821/fridge
c564f9a4b656c06384d5c40db038328c35ccf1ed
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ app.views.user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Module for initialising app user API package. :copyright: (c)2020 by rico0821 """
19.222222
49
0.485549
18
173
4.666667
0.888889
0
0
0
0
0
0
0
0
0
0
0.066176
0.213873
173
9
50
19.222222
0.551471
0.849711
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
a3ad9285e57855712b72c56bb4fffdb5ce82a381
114
py
Python
repocribro/app.py
xhusar2/repocribro
66b665c5fcef6049e4d455b55b1c7e4481db1536
[ "MIT" ]
5
2016-12-07T15:17:22.000Z
2019-10-09T03:53:18.000Z
repocribro/app.py
xhusar2/repocribro
66b665c5fcef6049e4d455b55b1c7e4481db1536
[ "MIT" ]
33
2017-07-10T14:45:40.000Z
2021-06-02T03:44:26.000Z
repocribro/app.py
xhusar2/repocribro
66b665c5fcef6049e4d455b55b1c7e4481db1536
[ "MIT" ]
1
2021-09-12T22:15:54.000Z
2021-09-12T22:15:54.000Z
from .repocribro import create_app #: Default Flask app for standard usage (export FLASK_APP) app = create_app()
22.8
58
0.780702
17
114
5.058824
0.647059
0.209302
0
0
0
0
0
0
0
0
0
0
0.149123
114
4
59
28.5
0.886598
0.5
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
a3d492baf24aad43bf9c4d45a7c31589d923b5c8
265
py
Python
rllib/agents/ppo/__init__.py
hershg/ray
a1744f67fe954d8408c5b84e28ecccc130157f8e
[ "Apache-2.0" ]
2
2019-06-17T12:38:24.000Z
2020-11-11T07:52:26.000Z
rllib/agents/ppo/__init__.py
hershg/ray
a1744f67fe954d8408c5b84e28ecccc130157f8e
[ "Apache-2.0" ]
4
2019-03-04T13:03:24.000Z
2019-06-06T11:25:07.000Z
rllib/agents/ppo/__init__.py
hershg/ray
a1744f67fe954d8408c5b84e28ecccc130157f8e
[ "Apache-2.0" ]
2
2017-10-31T23:20:07.000Z
2019-11-13T20:16:03.000Z
from ray.rllib.agents.ppo.ppo import PPOTrainer, DEFAULT_CONFIG from ray.rllib.agents.ppo.appo import APPOTrainer from ray.rllib.utils import renamed_agent PPOAgent = renamed_agent(PPOTrainer) __all__ = ["PPOAgent", "APPOTrainer", "PPOTrainer", "DEFAULT_CONFIG"]
33.125
69
0.803774
35
265
5.857143
0.457143
0.102439
0.17561
0.17561
0.204878
0
0
0
0
0
0
0
0.090566
265
7
70
37.857143
0.850622
0
0
0
0
0
0.162264
0
0
0
0
0
0
1
0
false
0
0.6
0
0.6
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a3d8cd07f28d7e468d22b1d99a41dc130150101e
43
py
Python
python/basic/while.py
fabriciofmsilva/labs
38310a359c21ef6b7184208a601698757e4390be
[ "MIT" ]
null
null
null
python/basic/while.py
fabriciofmsilva/labs
38310a359c21ef6b7184208a601698757e4390be
[ "MIT" ]
null
null
null
python/basic/while.py
fabriciofmsilva/labs
38310a359c21ef6b7184208a601698757e4390be
[ "MIT" ]
null
null
null
x = 0 while x <= 100: x = x + 1 print x
7.166667
15
0.465116
10
43
2
0.6
0
0
0
0
0
0
0
0
0
0
0.192308
0.395349
43
5
16
8.6
0.576923
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0.25
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
a3deb51a47442137be780db02951eb0575229a0f
232
py
Python
flask_of_oil/__init__.py
curityio/flask-of-oil
91daf66ec55a2a433ed4da02b07e8ea95b94bcda
[ "Apache-2.0" ]
6
2020-02-05T16:59:45.000Z
2021-10-14T06:19:58.000Z
flask_of_oil/__init__.py
curityio/flask-of-oil
91daf66ec55a2a433ed4da02b07e8ea95b94bcda
[ "Apache-2.0" ]
7
2020-01-08T12:51:46.000Z
2021-12-16T16:26:39.000Z
flask_of_oil/__init__.py
curityio/flask-of-oil
91daf66ec55a2a433ed4da02b07e8ea95b94bcda
[ "Apache-2.0" ]
2
2021-04-30T07:05:10.000Z
2021-05-20T14:22:48.000Z
__version__ = '1.1.0' from flask_of_oil.jwt_validator import JwtValidator, JwtValidatorException from flask_of_oil.oauth_filter import OAuthFilter from flask_of_oil.opaque_validator import OpaqueValidator, OpaqueValidatorException
38.666667
83
0.87931
30
232
6.366667
0.6
0.141361
0.172775
0.219895
0
0
0
0
0
0
0
0.014019
0.077586
232
5
84
46.4
0.878505
0
0
0
0
0
0.021552
0
0
0
0
0
0
1
0
false
0
0.75
0
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
a3e7cd953a4ca014e7439a3d0927d3b6c8ac5e68
36
py
Python
py/polarbear/events.py
Mkac003/PolarBear
39719bc69f811927a518e1d06257cb61b45a6d6c
[ "MIT" ]
2
2022-03-18T09:39:19.000Z
2022-03-18T09:39:31.000Z
py/polarbear/events.py
Mkac003/PolarBear
39719bc69f811927a518e1d06257cb61b45a6d6c
[ "MIT" ]
null
null
null
py/polarbear/events.py
Mkac003/PolarBear
39719bc69f811927a518e1d06257cb61b45a6d6c
[ "MIT" ]
null
null
null
from polarbear QUIT = lib.PB_QUIT
9
18
0.75
6
36
4.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.194444
36
3
19
12
0.896552
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
a3ea3e1301eb86f83e98583025b91c7c3aab1e47
26
py
Python
src/pygooglechart/examples/settings.py
santiago-iturriaga/dolardo
d132fd15b8d7302e80dd58876f6fdcdf60f5c3a2
[ "Unlicense" ]
68
2015-01-20T10:50:51.000Z
2021-02-28T10:47:09.000Z
src/pygooglechart/examples/settings.py
santiago-iturriaga/dolardo
d132fd15b8d7302e80dd58876f6fdcdf60f5c3a2
[ "Unlicense" ]
120
2015-01-03T04:38:11.000Z
2021-03-16T17:50:39.000Z
src/pygooglechart/examples/settings.py
santiago-iturriaga/dolardo
d132fd15b8d7302e80dd58876f6fdcdf60f5c3a2
[ "Unlicense" ]
30
2015-01-23T06:33:44.000Z
2021-11-15T06:34:19.000Z
width = 250 height = 100
6.5
12
0.653846
4
26
4.25
1
0
0
0
0
0
0
0
0
0
0
0.315789
0.269231
26
3
13
8.666667
0.578947
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a3ed15a9997438e8702a44d319f485a4d0ad1ddb
835
py
Python
htm_rl/htm_rl/mdp_agent/sar_value.py
pkuderov/htm_rl
00512efdbc052b48dfbe2f041b8713e2df90b735
[ "MIT" ]
null
null
null
htm_rl/htm_rl/mdp_agent/sar_value.py
pkuderov/htm_rl
00512efdbc052b48dfbe2f041b8713e2df90b735
[ "MIT" ]
null
null
null
htm_rl/htm_rl/mdp_agent/sar_value.py
pkuderov/htm_rl
00512efdbc052b48dfbe2f041b8713e2df90b735
[ "MIT" ]
null
null
null
from typing import Union, List from htm_rl.mdp_agent.sar import Sar # TODO: rollback to non-vectorized def encode_sar_value(sar: Union[Sar, List[Sar]]) -> Union[int, List[int]]: def _encode_sar_value(sar: Sar) -> int: s, a, r = sar return s * 100 + a * 10 + r if isinstance(sar, list): sars = sar return [_encode_sar_value(sar) for sar in sars] return _encode_sar_value(sar) def decode_sar_value(sar_value: Union[int, List[int]]) -> Union[Sar, List[Sar]]: def _decode_sar_value(sar_value: int) -> Sar: s, ar = divmod(sar_value, 100) a, r = divmod(ar, 10) return Sar(s, a, r) if isinstance(sar_value, list): sar_values = sar_value return [_decode_sar_value(sar_value) for sar_value in sar_values] return _decode_sar_value(sar_value)
29.821429
80
0.651497
133
835
3.834586
0.255639
0.25098
0.172549
0.133333
0.382353
0.219608
0.109804
0
0
0
0
0.015699
0.237126
835
27
81
30.925926
0.784929
0.038323
0
0
0
0
0
0
0
0
0
0.037037
0
1
0.210526
false
0
0.105263
0
0.631579
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
0
1
0
0
4
a3f816b80b8718b54345cd62311f279f95711993
299
py
Python
src/mds/tasks/forms.py
m-socha/sana.mds
4d3b71b7ba939c91570fee4f60444cf07035bd51
[ "BSD-3-Clause" ]
2
2016-05-19T02:32:13.000Z
2017-09-06T07:06:25.000Z
src/mds/tasks/forms.py
m-socha/sana.mds
4d3b71b7ba939c91570fee4f60444cf07035bd51
[ "BSD-3-Clause" ]
6
2015-07-19T17:40:49.000Z
2016-12-20T21:54:59.000Z
src/mds/tasks/forms.py
m-socha/sana.mds
4d3b71b7ba939c91570fee4f60444cf07035bd51
[ "BSD-3-Clause" ]
14
2015-10-30T09:50:21.000Z
2019-06-15T13:07:37.000Z
from django import forms from .models import * __all__ = [ 'EncounterTaskForm', 'ObservationTaskForm'] class EncounterTaskForm(forms.ModelForm): class Meta: model = EncounterTask class ObservationTaskForm(forms.ModelForm): class Meta: model = ObservationTask
19.933333
43
0.702341
26
299
7.923077
0.538462
0.135922
0.184466
0.223301
0.271845
0
0
0
0
0
0
0
0.22408
299
14
44
21.357143
0.887931
0
0
0.2
0
0
0.120401
0
0
0
0
0
0
1
0
false
0
0.2
0
0.6
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
a3faf78b084aa0ee7cc6b460c82f3dee79a26f10
189
py
Python
media/admin.py
City-of-Turku/munpalvelut_backend
9baa530f2f3405322f74ccc145641148f253341b
[ "MIT" ]
null
null
null
media/admin.py
City-of-Turku/munpalvelut_backend
9baa530f2f3405322f74ccc145641148f253341b
[ "MIT" ]
null
null
null
media/admin.py
City-of-Turku/munpalvelut_backend
9baa530f2f3405322f74ccc145641148f253341b
[ "MIT" ]
null
null
null
from django.contrib import admin from . import models @admin.register(models.Image) class ImageAdmin(admin.ModelAdmin): list_display = ('sha256', 'image', 'width', 'height', 'added')
23.625
66
0.724868
23
189
5.913043
0.73913
0
0
0
0
0
0
0
0
0
0
0.018182
0.126984
189
7
67
27
0.806061
0
0
0
0
0
0.142857
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
4312cd3041e75644170567269e0840c64f7ea6e9
81
py
Python
day08/t08/apps.py
SunShuoJia/pyproject
71f3cada463fd90243b2cdac8c982fb622f9ef9c
[ "Apache-2.0" ]
null
null
null
day08/t08/apps.py
SunShuoJia/pyproject
71f3cada463fd90243b2cdac8c982fb622f9ef9c
[ "Apache-2.0" ]
null
null
null
day08/t08/apps.py
SunShuoJia/pyproject
71f3cada463fd90243b2cdac8c982fb622f9ef9c
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class T08Config(AppConfig): name = 't08'
13.5
33
0.728395
10
81
5.9
0.9
0
0
0
0
0
0
0
0
0
0
0.060606
0.185185
81
5
34
16.2
0.833333
0
0
0
0
0
0.037037
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
432df216dc75fb9170b2b990e5c0786ed2fcc86c
1,998
py
Python
constants.py
sorrowise/polyomino-solver
4ae3c45a60c6d597c94254a3cba48f2966f9ce39
[ "MIT" ]
7
2021-12-14T09:59:25.000Z
2021-12-15T03:27:07.000Z
constants.py
sorrowise/polyomino-solver
4ae3c45a60c6d597c94254a3cba48f2966f9ce39
[ "MIT" ]
null
null
null
constants.py
sorrowise/polyomino-solver
4ae3c45a60c6d597c94254a3cba48f2966f9ce39
[ "MIT" ]
1
2021-12-15T08:29:38.000Z
2021-12-15T08:29:38.000Z
import numpy as np from models import Base # Define constants related to pentoominoes PENT_BASES = [Base('L', 1, np.array([[1, 1, 1, 1], [0, 0, 0, 1]])), Base('F', 2, np.array([[0, 2, 2], [2, 2, 0], [0, 2, 0]])), Base('N', 3, np.array([[3, 0], [3, 0], [3, 3], [0, 3]])), Base('P', 4, np.array([[4, 4, 4], [4, 4, 0]])), Base('Y', 5, np.array([[5, 0], [5, 0], [5, 5], [5, 0]])), Base('T', 6, np.array([[6, 6, 6], [0, 6, 0], [0, 6, 0]]), 4, 1), Base('U', 7, np.array([[7, 0, 7], [7, 7, 7]]), 4, 1), Base('V', 8, np.array([[8, 0, 0], [8, 0, 0], [8, 8, 8]]), 4, 1), Base('W', 9, np.array([[9, 0, 0], [9, 9, 0], [0, 9, 9]]), 4, 1), Base('Z', 10, np.array( [[10, 10, 0], [0, 10, 0], [0, 10, 10]]), 2, 2), Base('I', 11, np.array([[11], [11], [11], [11], [11]]), 2, 1), Base('X', 12, np.array( [[0, 12, 0], [12, 12, 12], [0, 12, 0]]), 1, 1) ] # Define constants related to smartgames IQ puzzle SGIQ_BASES = [Base('A', 1, np.array([[0, 0, 1, 0], [1, 1, 1, 1]])), Base('B', 2, np.array([[0, 0, 2], [2, 2, 2], [0, 2, 0]])), Base('C', 3, np.array([[3, 3, 3, 3], [0, 0, 0, 3]])), Base('D', 4, np.array([[0, 4], [4, 4], [4, 0]]),2,2), Base('E', 5, np.array([[5, 0], [5, 0], [5, 5], [0, 5]])), Base('F', 6, np.array([[0, 6, 6], [6, 6, 0], [6, 0, 0]]), 4, 1), Base('G', 7, np.array([[7, 7, 7], [7, 0, 0]])), Base('H', 8, np.array([[0, 0, 8], [0, 0, 8], [8, 8, 8]]), 4, 1), Base('I', 9, np.array([[9, 9], [0, 9]]), 4, 1), Base('J', 10, np.array([[10, 0], [10, 10], [10, 10]])), Base('K', 11, np.array([[11, 11, 11], [0, 11, 0]]), 4, 1), Base('L', 12, np.array([[12, 12], [0, 12], [12, 12]]), 4, 1) ]
51.230769
79
0.343343
350
1,998
1.954286
0.151429
0.245614
0.070175
0.017544
0.219298
0.165205
0.084795
0.064327
0.040936
0
0
0.203846
0.349349
1,998
38
80
52.578947
0.322308
0.044545
0
0
0
0
0.012848
0
0
0
0
0
0
1
0
false
0
0.066667
0
0.066667
0
0
0
1
null
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4a37269c4493434c123a84ec26007be27f5ae1d8
6,037
py
Python
test/cnnl/op_test/test_sigmoid.py
Cambricon/catch
2625da389f25a67066d20fb6b0c38250ef98f8ab
[ "BSD-2-Clause" ]
20
2022-03-01T11:40:51.000Z
2022-03-30T08:17:47.000Z
test/cnnl/op_test/test_sigmoid.py
Cambricon/catch
2625da389f25a67066d20fb6b0c38250ef98f8ab
[ "BSD-2-Clause" ]
null
null
null
test/cnnl/op_test/test_sigmoid.py
Cambricon/catch
2625da389f25a67066d20fb6b0c38250ef98f8ab
[ "BSD-2-Clause" ]
null
null
null
from __future__ import print_function import sys import os import copy import unittest import logging import torch import torch_mlu.core.mlu_model as ct cur_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(cur_dir + "/../../") from common_utils import testinfo, TestCase # pylint: disable=C0413,C0411 logging.basicConfig(level=logging.DEBUG) class TestSigmoidOp(TestCase): #@unittest.skip("not test") @testinfo() def test_sigmoid(self): # mlu device support torch.half, while cpu not type_list = [ torch.float ] for Type in type_list: # test_dim_0 x_0 = torch.tensor(8.0, dtype=Type) out_cpu = torch.sigmoid(x_0) out_mlu = torch.sigmoid(copy.deepcopy(x_0).to(ct.mlu_device())) self.assertTensorsEqual(out_cpu, out_mlu.cpu().float(), 0.003) for in_shape in [(1), (2,3), (8, 224, 224), (1,1,1,1), (1, 3, 16, 16), (1, 3, 16, 16, 3)]: input_mlu = torch.randn(in_shape, dtype=Type) input_cpu = copy.deepcopy(input_mlu) input_mlu_raw = copy.deepcopy(input_mlu) output_cpu = torch.sigmoid(input_cpu) output_mlu = torch.sigmoid(input_mlu.to(ct.mlu_device())) self.assertTensorsEqual(output_cpu, output_mlu.cpu(), 0.003) self.assertTensorsEqual(input_mlu_raw, input_mlu, 0.003) #@unittest.skip("not test") @testinfo() def test_sigmoid_channel_last(self): for in_shape in [(2, 3, 16, 16)]: input_mlu = torch.randn(in_shape).to(memory_format=torch.channels_last) input_cpu = copy.deepcopy(input_mlu) input_mlu_raw = copy.deepcopy(input_mlu) output_cpu = torch.sigmoid(input_cpu) output_mlu = torch.sigmoid(input_mlu.to(ct.mlu_device())) self.assertTensorsEqual(output_cpu, output_mlu.cpu(), 0.003) self.assertTensorsEqual(input_mlu_raw, input_mlu, 0.003) #@unittest.skip("not test") @testinfo() def test_sigmoid_not_dense(self): for in_shape in [(2, 3, 16, 16)]: input_mlu = torch.randn(in_shape) input_cpu = copy.deepcopy(input_mlu) input_mlu_raw = copy.deepcopy(input_mlu) output_cpu = torch.sigmoid(input_cpu[:,:,:,:2]) output_mlu = torch.sigmoid(input_mlu.to(ct.mlu_device())[:,:,:,:2]) self.assertTensorsEqual(output_cpu, output_mlu.cpu(), 0.003) self.assertTensorsEqual(input_mlu_raw, input_mlu, 0.003) #@unittest.skip("not test") @testinfo() def test_sigmoid_inplace(self): # mlu device support torch.half, while cpu not type_list = [ torch.float ] for Type in type_list: # test_dim_0 x_0 = torch.tensor(8.0, dtype=Type) out_cpu = x_0 out_mlu = copy.deepcopy(x_0).to(ct.mlu_device()) out_cpu.sigmoid_() out_mlu_ptr = out_mlu.data_ptr() out_mlu.sigmoid_() self.assertEqual(out_mlu_ptr, out_mlu.data_ptr()) self.assertTensorsEqual(out_cpu, out_mlu.cpu(), 0.003) for in_shape in [(1), (2, 3), (8, 224, 224), (1, 1, 1, 1), (1, 3, 16, 16), (1, 3, 16, 16, 3)]: input_cpu = torch.randn(in_shape, dtype=Type) input_mlu = copy.deepcopy(input_cpu).to(ct.mlu_device()) input_cpu.sigmoid_() input_mlu_ptr = input_mlu.data_ptr() input_mlu.sigmoid_() self.assertEqual(input_mlu_ptr, input_mlu.data_ptr()) self.assertTensorsEqual(input_cpu, input_mlu.cpu(), 0.003) #@unittest.skip("not test") @testinfo() def test_sigmoid_inplace_channel_last(self): for in_shape in [(2, 3, 16, 16)]: input_cpu = torch.randn(in_shape).to(memory_format=torch.channels_last) input_mlu = copy.deepcopy(input_cpu).to(ct.mlu_device()) input_cpu.sigmoid_() input_mlu_ptr = input_mlu.data_ptr() input_mlu.sigmoid_() self.assertEqual(input_mlu_ptr, input_mlu.data_ptr()) self.assertTensorsEqual(input_cpu, input_mlu.cpu(), 0.003) #@unittest.skip("not test") @testinfo() def test_sigmoid_inplace_not_dense(self): for in_shape in [(2, 3, 16, 16)]: input_cpu = torch.randn(in_shape) input_mlu = copy.deepcopy(input_cpu).to(ct.mlu_device()) input_cpu[:,:,:,:2].sigmoid_() input_mlu_ptr = input_mlu.data_ptr() input_mlu[:,:,:,:2].sigmoid_() self.assertEqual(input_mlu_ptr, input_mlu.data_ptr()) self.assertTensorsEqual(input_cpu, input_mlu.cpu(), 0.003) #@unittest.skip("not test") @testinfo() def test_sigmoid_backward(self): for in_shape in [(1), (2, 3), (8, 224, 224), (1, 1, 1, 1), (1, 3, 16, 16), (1, 3, 16, 16, 3)]: x = torch.randn(in_shape, dtype=torch.float, requires_grad=True) x_mlu = x.to(ct.mlu_device()) # use float on cpu kernel out_cpu = x.sigmoid() out_mlu = x_mlu.sigmoid() grad = torch.randn(out_cpu.shape) grad_mlu = grad.to(ct.mlu_device()) out_cpu.backward(grad) out_grad_cpu = copy.deepcopy(x.grad) x.grad.zero_() out_mlu.backward(grad_mlu) out_grad_mlu = copy.deepcopy(x.grad) self.assertTensorsEqual( out_grad_cpu, out_grad_mlu.cpu().float(), 0.003 ) if __name__ == '__main__': unittest.main()
34.695402
83
0.557562
770
6,037
4.088312
0.122078
0.106734
0.022236
0.041296
0.785578
0.770966
0.761118
0.707116
0.676938
0.676938
0
0.043234
0.321849
6,037
173
84
34.895954
0.725696
0.057148
0
0.52381
0
0
0.002642
0
0
0
0
0
0.126984
1
0.055556
false
0
0.071429
0
0.134921
0.007937
0
0
0
null
0
0
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4a5a56674da19b63da2acf5877cbf0cb7f4a7de1
46
py
Python
scarface/__init__.py
gianluigiruggeri/django-scarface-fix
207f7e856baadf55338333b97944a2065c660583
[ "MIT" ]
null
null
null
scarface/__init__.py
gianluigiruggeri/django-scarface-fix
207f7e856baadf55338333b97944a2065c660583
[ "MIT" ]
null
null
null
scarface/__init__.py
gianluigiruggeri/django-scarface-fix
207f7e856baadf55338333b97944a2065c660583
[ "MIT" ]
null
null
null
default_app_config = 'scarface.apps.AppConfig'
46
46
0.847826
6
46
6.166667
1
0
0
0
0
0
0
0
0
0
0
0
0.043478
46
1
46
46
0.840909
0
0
0
0
0
0.489362
0.489362
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4a63ea232ffa165e2ab999016f28e427b3392db1
140
py
Python
{{cookiecutter.package_name}}/{{cookiecutter.package_name}}/__init__.py
fate0/cookiecutter-python
70aa22eb734316e9cb05e45c5a2c92129d6349be
[ "Apache-2.0" ]
1
2018-09-19T08:36:44.000Z
2018-09-19T08:36:44.000Z
{{cookiecutter.package_name}}/{{cookiecutter.package_name}}/__init__.py
fate0/cookiecutter-python
70aa22eb734316e9cb05e45c5a2c92129d6349be
[ "Apache-2.0" ]
null
null
null
{{cookiecutter.package_name}}/{{cookiecutter.package_name}}/__init__.py
fate0/cookiecutter-python
70aa22eb734316e9cb05e45c5a2c92129d6349be
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- __email__ = '{{ cookiecutter.author_email }}' __author__ = '{{ cookiecutter.author_name }}' __version__ = '0.0.1'
20
45
0.642857
15
140
5.066667
0.666667
0.473684
0
0
0
0
0
0
0
0
0
0.033333
0.142857
140
6
46
23.333333
0.6
0.15
0
0
0
0
0.564103
0.418803
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4a643d034bb95b2c89180ea6f20c91c9f432790b
3,728
py
Python
tests/containers/test_Mapping.py
ankitshah009/dcase_util
738571ce78faf60b0fdfa1d59fd42f42c8944f3d
[ "MIT" ]
null
null
null
tests/containers/test_Mapping.py
ankitshah009/dcase_util
738571ce78faf60b0fdfa1d59fd42f42c8944f3d
[ "MIT" ]
null
null
null
tests/containers/test_Mapping.py
ankitshah009/dcase_util
738571ce78faf60b0fdfa1d59fd42f42c8944f3d
[ "MIT" ]
null
null
null
""" Unit tests for ListDictContainer """ import nose.tools import dcase_util from dcase_util.containers import OneToOneMappingContainer from nose.tools import * import tempfile import os def test_OneToOneMappingContainer(): m = OneToOneMappingContainer( { 'key1': 'mapped1', 'key2': 'mapped2', 'key3': 'mapped3', 'key4': 'mapped4', } ) nose.tools.eq_(m.map('key1'), 'mapped1') nose.tools.eq_(m.map('key2'), 'mapped2') nose.tools.eq_(m.map('key3'), 'mapped3') nose.tools.eq_(m.map('key4'), 'mapped4') nose.tools.eq_(m.map('key5', 'default'), 'default') m_ = m.flipped nose.tools.eq_(m_.map('mapped1'), 'key1') nose.tools.eq_(m_.map('mapped2'), 'key2') nose.tools.eq_(m_.map('mapped3'), 'key3') nose.tools.eq_(m_.map('mapped4'), 'key4') nose.tools.eq_(m_.map('mapped5', 'default'), 'default') delimiters = [',', ';', '\t'] for delimiter in delimiters: tmp = tempfile.NamedTemporaryFile('r+', suffix='.txt', dir='/tmp', delete=False) try: tmp.write('key1' + delimiter + 'mapped1\n') tmp.write('key2' + delimiter + 'mapped2\n') tmp.close() m = OneToOneMappingContainer(filename=tmp.name).load() nose.tools.eq_(m.map('key1'), 'mapped1') nose.tools.eq_(m.map('key2'), 'mapped2') finally: os.unlink(tmp.name) tmp = tempfile.NamedTemporaryFile('r+', suffix='.txt', dir='/tmp', delete=False) try: m = OneToOneMappingContainer( { 'key1': 'mapped1', 'key2': 'mapped2', 'key3': 'mapped3', 'key4': 'mapped4', }, filename=tmp.name ).save() m_ = OneToOneMappingContainer(filename=tmp.name).load() nose.tools.eq_(m_.map('key1'), 'mapped1') nose.tools.eq_(m_.map('key2'), 'mapped2') nose.tools.eq_(m_.map('key3'), 'mapped3') nose.tools.eq_(m_.map('key4'), 'mapped4') nose.tools.eq_(m_.map('key5', 'default'), 'default') finally: os.unlink(tmp.name) def test_save(): # Empty content OneToOneMappingContainer({}).save(filename=os.path.join(tempfile.gettempdir(), 'saved.csv')) OneToOneMappingContainer({}).save(filename=os.path.join(tempfile.gettempdir(), 'saved.txt')) OneToOneMappingContainer({}).save(filename=os.path.join(tempfile.gettempdir(), 'saved.cpickle')) # Content data = { 'key1': 'mapped1', 'key2': 'mapped2', 'key3': 'mapped3', 'key4': 'mapped4' } OneToOneMappingContainer(data).save(filename=os.path.join(tempfile.gettempdir(), 'saved.csv')) d = OneToOneMappingContainer().load(filename=os.path.join(tempfile.gettempdir(), 'saved.csv')) nose.tools.assert_dict_equal(d, data) OneToOneMappingContainer(data).save(filename=os.path.join(tempfile.gettempdir(), 'saved.txt')) d = OneToOneMappingContainer().load(filename=os.path.join(tempfile.gettempdir(), 'saved.txt')) nose.tools.assert_dict_equal(d, data) OneToOneMappingContainer(data).save(filename=os.path.join(tempfile.gettempdir(), 'saved.cpickle')) d = OneToOneMappingContainer().load(filename=os.path.join(tempfile.gettempdir(), 'saved.cpickle')) nose.tools.assert_dict_equal(d, data) @raises(IOError) def test_load_not_found2(): with dcase_util.utils.DisableLogger(): OneToOneMappingContainer().load(filename=os.path.join(tempfile.gettempdir(), 'wrong.txt')) @raises(IOError) def test_load_wrong_type(): with dcase_util.utils.DisableLogger(): OneToOneMappingContainer().load(filename=os.path.join(tempfile.gettempdir(), 'wrong.abc'))
35.504762
102
0.623927
416
3,728
5.478365
0.182692
0.08688
0.082054
0.089513
0.808688
0.73541
0.73541
0.722685
0.697674
0.595437
0
0.020094
0.199034
3,728
104
103
35.846154
0.743135
0.015021
0
0.385542
0
0
0.137555
0
0
0
0
0
0.036145
1
0.048193
false
0
0.072289
0
0.120482
0
0
0
0
null
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4a9894176f6da463023d4e71d4fc582eb643660d
2,843
py
Python
test/get_delimited_string_regex_pattern_frequencies_test.py
AustinHellerRepo/Common
2d42599e5d7c0d5fcba2d2c9a726d51f946f67bc
[ "MIT" ]
null
null
null
test/get_delimited_string_regex_pattern_frequencies_test.py
AustinHellerRepo/Common
2d42599e5d7c0d5fcba2d2c9a726d51f946f67bc
[ "MIT" ]
null
null
null
test/get_delimited_string_regex_pattern_frequencies_test.py
AustinHellerRepo/Common
2d42599e5d7c0d5fcba2d2c9a726d51f946f67bc
[ "MIT" ]
null
null
null
from __future__ import annotations import re from src.austin_heller_repo.common import get_delimited_string_regex_pattern_frequencies import unittest class CommonRegexTest(unittest.TestCase): def test_basic_regex(self): source = "test here a b c d\n" \ "something here a b f g\n" \ "another here a b\n" \ "something here x y" total_per_regex = {k: v for k, v in sorted(get_delimited_string_regex_pattern_frequencies( text=source ).items(), key=lambda item: item[1])} print(f"total_per_regex: {total_per_regex}") print(f"len(total_per_regex): {len(total_per_regex)}") self.assertEqual(47, len(total_per_regex)) def test_escaped_regex_a_hyphen_z(self): source = "test (here) a-z c d\n" \ "something (here) a-z f g\n" \ "another (here) x y a-z\n" \ "something (here) x y" total_per_regex = {k: v for k, v in reversed(sorted(get_delimited_string_regex_pattern_frequencies( text=source ).items(), key=lambda item: item[1]))} print(f"total_per_regex: {total_per_regex}") self.assertEqual(4, total_per_regex["\\(here\\)"]) regex_pattern = list(total_per_regex.keys())[1] print(f"regex_pattern: {regex_pattern}") compiled_regex_pattern = re.compile(regex_pattern) match = compiled_regex_pattern.search(source) print(f"match: {match}") self.assertEqual((12, 15), match.span()) def test_escaped_regex_meta_regex_word_anchor(self): source = "x cat x \\<cat\\> \\<cat\\> \\<cat\\> \\<cat\\>\n" total_per_regex = {k: v for k, v in reversed(sorted(get_delimited_string_regex_pattern_frequencies( text=source ).items(), key=lambda item: item[1]))} print(f"total_per_regex: {total_per_regex}") regex_pattern = list(total_per_regex.keys())[0] print(f"regex_pattern: {regex_pattern}") compiled_regex_pattern = re.compile(regex_pattern) match = compiled_regex_pattern.search(source) print(f"match: {match}") self.assertEqual((8, 15), match.span()) def test_escaped_regex_period(self): source = "x cat x . . . . .\n" total_per_regex = {k: v for k, v in reversed(sorted(get_delimited_string_regex_pattern_frequencies( text=source ).items(), key=lambda item: item[1]))} print(f"total_per_regex: {total_per_regex}") regex_pattern = list(total_per_regex.keys())[0] print(f"regex_pattern: {regex_pattern}") compiled_regex_pattern = re.compile(regex_pattern) match = compiled_regex_pattern.search(source) print(f"match: {match}") self.assertEqual((8, 9), match.span())
29.926316
107
0.626803
383
2,843
4.368146
0.198433
0.164973
0.147639
0.068739
0.829647
0.746563
0.701733
0.646145
0.646145
0.646145
0
0.008899
0.249033
2,843
94
108
30.244681
0.774707
0
0
0.5
0
0
0.196975
0.015125
0
0
0
0
0.089286
1
0.071429
false
0
0.071429
0
0.160714
0.196429
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4aa1dac22323accd2b55362c383ba74628e918cd
410
py
Python
tests/test_serializers.py
jukanntenn/django-tree-comments
c31a99443220817e2020e21efc675b5d4eb16102
[ "BSD-3-Clause" ]
1
2021-12-01T12:09:51.000Z
2021-12-01T12:09:51.000Z
tests/test_serializers.py
jukanntenn/django-tree-comments
c31a99443220817e2020e21efc675b5d4eb16102
[ "BSD-3-Clause" ]
1
2022-01-15T10:48:58.000Z
2022-01-23T14:41:41.000Z
tests/test_serializers.py
jukanntenn/django-tree-comments
c31a99443220817e2020e21efc675b5d4eb16102
[ "BSD-3-Clause" ]
null
null
null
import importlib from tree_comments import serializers def test_use_default_user_serializer(): assert serializers.UserSerializer.__name__ == "DefaultUserSerializer" def test_use_custom_user_serializer(settings): settings.TREE_COMMENTS_USER_SERIALIZER = "tests.app.serializers.MyUserSerializer" importlib.reload(serializers) assert serializers.UserSerializer.__name__ == "MyUserSerializer"
29.285714
85
0.826829
42
410
7.595238
0.52381
0.131661
0.062696
0.219436
0
0
0
0
0
0
0
0
0.104878
410
13
86
31.538462
0.86921
0
0
0
0
0
0.182927
0.143902
0
0
0
0
0.25
1
0.25
false
0
0.375
0
0.625
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
1
0
1
0
0
4
4aaf3e5fb6c6b9464918ea4bce9692e5b2cea937
97
py
Python
setup.py
scott-diprose/py_dmm
a4ed91d3957f3ed36bd82100d2849e1c67e3cddb
[ "MIT" ]
null
null
null
setup.py
scott-diprose/py_dmm
a4ed91d3957f3ed36bd82100d2849e1c67e3cddb
[ "MIT" ]
null
null
null
setup.py
scott-diprose/py_dmm
a4ed91d3957f3ed36bd82100d2849e1c67e3cddb
[ "MIT" ]
null
null
null
"""Only present in order to support editable installs. """ from setuptools import setup setup()
16.166667
54
0.752577
13
97
5.615385
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.154639
97
5
55
19.4
0.890244
0.525773
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
4ab414f62d81d556355c49d19fccd27572166790
186
py
Python
src/tools/__init__.py
IOverflow/cool-compiler-2020
65ee19af19973e25b79de70e0dca7721b93c82b6
[ "MIT" ]
null
null
null
src/tools/__init__.py
IOverflow/cool-compiler-2020
65ee19af19973e25b79de70e0dca7721b93c82b6
[ "MIT" ]
null
null
null
src/tools/__init__.py
IOverflow/cool-compiler-2020
65ee19af19973e25b79de70e0dca7721b93c82b6
[ "MIT" ]
null
null
null
def setup(): import os from sys import path BASE = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) path.append(BASE) if __name__ == '__main__': setup()
18.6
70
0.650538
26
186
4.192308
0.576923
0.165138
0.238532
0.275229
0.293578
0
0
0
0
0
0
0
0.209677
186
9
71
20.666667
0.741497
0
0
0
0
0
0.043243
0
0
0
0
0
0
1
0.142857
false
0
0.285714
0
0.428571
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
4ab55e083e917927af720056cb35fffa485e44fd
93
py
Python
RecipeProject/RecipeApp/apps.py
cs-fullstack-2019-spring/django-mini-project5-PorcheWooten
336075965a19200b618e6af2191cf4b4a486c0c1
[ "Apache-2.0" ]
null
null
null
RecipeProject/RecipeApp/apps.py
cs-fullstack-2019-spring/django-mini-project5-PorcheWooten
336075965a19200b618e6af2191cf4b4a486c0c1
[ "Apache-2.0" ]
null
null
null
RecipeProject/RecipeApp/apps.py
cs-fullstack-2019-spring/django-mini-project5-PorcheWooten
336075965a19200b618e6af2191cf4b4a486c0c1
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class RecipeappConfig(AppConfig): name = 'RecipeApp'
15.5
33
0.763441
10
93
7.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.16129
93
5
34
18.6
0.910256
0
0
0
0
0
0.096774
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
4377becb5592e3e2c47083bd8c60e4cde469b48d
116
py
Python
matplotlib/1.py
MiracleWong/PythonBasic
cb8ec59dc646842b41966ea4ea4b1ee66a342eee
[ "MIT" ]
null
null
null
matplotlib/1.py
MiracleWong/PythonBasic
cb8ec59dc646842b41966ea4ea4b1ee66a342eee
[ "MIT" ]
null
null
null
matplotlib/1.py
MiracleWong/PythonBasic
cb8ec59dc646842b41966ea4ea4b1ee66a342eee
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from matplotlib import pyplot as plt plt.plot([1,2,3,2,1,2,3,4,5,6,5,4,3,2,1]) plt.show()
19.333333
41
0.603448
28
116
2.5
0.607143
0.057143
0.085714
0
0
0
0
0
0
0
0
0.158416
0.12931
116
5
42
23.2
0.534653
0.181034
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
437d1b87573292ef0608bba998788952874e87f7
51
py
Python
lambdata_granero0011/example_module.py
Granero0011/lambdata
c31afa997f825997ecc70a57f46805122a42fd5e
[ "MIT" ]
null
null
null
lambdata_granero0011/example_module.py
Granero0011/lambdata
c31afa997f825997ecc70a57f46805122a42fd5e
[ "MIT" ]
null
null
null
lambdata_granero0011/example_module.py
Granero0011/lambdata
c31afa997f825997ecc70a57f46805122a42fd5e
[ "MIT" ]
null
null
null
x=2 def increment(number): return number + 1
8.5
22
0.647059
8
51
4.125
0.875
0
0
0
0
0
0
0
0
0
0
0.052632
0.254902
51
5
23
10.2
0.815789
0
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
438667a68a4a5bdf30807bce28521bb437c62322
395
py
Python
tests/pre/registervm/test_registervm.py
sota/lang
cce40333f1b7bdcb5fed3471c5db0105d0263328
[ "MIT" ]
2
2015-03-10T20:31:18.000Z
2015-11-08T06:29:56.000Z
tests/pre/registervm/test_registervm.py
sota/lang
cce40333f1b7bdcb5fed3471c5db0105d0263328
[ "MIT" ]
null
null
null
tests/pre/registervm/test_registervm.py
sota/lang
cce40333f1b7bdcb5fed3471c5db0105d0263328
[ "MIT" ]
null
null
null
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- from pytest import fixture from sota.registervm import SotaRegisterVM @fixture def registervm(): return SotaRegisterVM() def test_ctor(registervm): assert isinstance(registervm, SotaRegisterVM) def test_registervm(registervm): #bytecode = registervm.execute() assert True #FIXME: implement execute to return a bytecode object
23.235294
69
0.751899
47
395
6.276596
0.617021
0.115254
0.142373
0
0
0
0
0
0
0
0
0.008955
0.151899
395
16
70
24.6875
0.871642
0.324051
0
0
0
0
0
0
0
0
0
0.0625
0.222222
1
0.333333
false
0
0.222222
0.111111
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
1
0
0
0
1
1
0
0
4
4387549880c536e0051983d1c5a4c790f9559cf4
102
py
Python
haskpy/typeclasses/bifunctor.py
jluttine/haskpy
79fca70b5f46d8551ed61b4bbd040de5f5ba0440
[ "MIT" ]
2
2021-04-08T18:34:39.000Z
2022-02-24T18:02:45.000Z
haskpy/typeclasses/bifunctor.py
jluttine/haskpy
79fca70b5f46d8551ed61b4bbd040de5f5ba0440
[ "MIT" ]
null
null
null
haskpy/typeclasses/bifunctor.py
jluttine/haskpy
79fca70b5f46d8551ed61b4bbd040de5f5ba0440
[ "MIT" ]
null
null
null
"""**TODO** .. autosummary:: :toctree: Bifunctor """ class Bifunctor(): """**TODO**"""
7.846154
18
0.480392
7
102
7
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.235294
102
12
19
8.5
0.628205
0.607843
0
0
0
0
0
0
0
0
0
0.166667
0
1
0
true
0
0
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
1
0
0
0
1
0
0
4
438e55a38291ae1f9eaa121988cae2b46b26288b
609
py
Python
src/py_dss_interface/models/Sensors/Sensors.py
davilamds/py_dss_interface
a447c97787aeac962381db88dd622ccb235eef4b
[ "MIT" ]
8
2020-08-15T12:56:03.000Z
2022-01-04T15:51:14.000Z
src/py_dss_interface/models/Sensors/Sensors.py
rodolfoplondero/py_dss_interface
cb6771b34ed322a5df7ef1cc194611e794f26441
[ "MIT" ]
24
2021-04-24T18:33:19.000Z
2021-11-13T14:59:54.000Z
src/py_dss_interface/models/Sensors/Sensors.py
rodolfoplondero/py_dss_interface
cb6771b34ed322a5df7ef1cc194611e794f26441
[ "MIT" ]
7
2020-08-15T12:56:04.000Z
2021-10-04T16:14:30.000Z
# -*- encoding: utf-8 -*- """ Created by eniocc at 11/10/2020 """ from py_dss_interface.models.Sensors.SensorsF import SensorsF from py_dss_interface.models.Sensors.SensorsI import SensorsI from py_dss_interface.models.Sensors.SensorsS import SensorsS from py_dss_interface.models.Sensors.SensorsV import SensorsV class Sensors(SensorsV, SensorsS, SensorsI, SensorsF): """ This interface implements the Sensors (ISensors) interface of OpenDSS by declaring 4 procedures for accessing the different properties included in this interface: SensorsV, SensorsS, SensorsI, SensorsF. """ pass
33.833333
117
0.779967
79
609
5.911392
0.481013
0.051392
0.077088
0.154176
0.265525
0.265525
0
0
0
0
0
0.01912
0.141215
609
17
118
35.823529
0.873805
0.425287
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.166667
0.666667
0
0.833333
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
1
0
1
0
0
4
43991078ce2b16dfd985d4bbbd8ef51c4747f3a2
2,939
py
Python
src/pytools/expression/__init__.py
BCG-Gamma/pytools
d7be703e0665917cd75b671564d5c0163f13b77b
[ "Apache-2.0" ]
17
2021-01-12T08:07:11.000Z
2022-03-03T22:59:04.000Z
src/pytools/expression/__init__.py
BCG-Gamma/pytools
d7be703e0665917cd75b671564d5c0163f13b77b
[ "Apache-2.0" ]
10
2021-01-08T17:04:39.000Z
2022-01-18T13:21:52.000Z
src/pytools/expression/__init__.py
BCG-Gamma/pytools
d7be703e0665917cd75b671564d5c0163f13b77b
[ "Apache-2.0" ]
1
2021-11-06T00:16:43.000Z
2021-11-06T00:16:43.000Z
""" Representations of Python expressions and support for pretty-printed multi-line output. Useful for generating representations of complex Python objects. The simplest expressions are `atomic` identifiers and literals, represented by instances of :class:`.Id` and :class:`.Lit`. To create an identifier, use one of .. code-block:: python Id.x Id("x") To create identifiers with a leading or trailing underscore, you need to use the :class:`.Id` constructor as demonstrated in the second variant above. .. code-block:: python Id._x # will raise exception Id.x_ # will raise exception Id("_x") # works Id("x_") # works To create a literal, use one of .. code-block:: python Lit(3) Lit(3.3) Lit("text") See :func:`.make_expression` below for more ways to create literals. You can use most Python operators to create composite expressions – even using literals without :class:`.Lit` where the context makes it clear that an expression object is being constructed, e.g.: .. code-block:: python x, y, z, f, g = Id.x, Id.y, Id.z, Id.f, Id.g x + 3 # x is an Expression instance, hence 3 is converted to a Literal object 3 + x # this also works if only the second argument is an Expression object x == y f(3, 5, z) g[5] g.a Function :func:`.make_expression` translates most Python objects to useful expressions: .. code-block:: python make_expression(3) make_expression(3.3) make_expression("text") make_expression([3, 5, Id.x]) make_expression({"a": 3, "b": 5, "c": 6}) If you pass named object to :func:`.make_expression`, e.g., a function or a class, it will return an identifier with the name of that object. .. code-block:: python make_expression(my_function) make_expression(MyClass) Note that ``a == b`` does not compare two expressions for equality, but creates a comparison expression. To compare two expressions, instead use ``a.eq_(b)``, or convert both expressions to `frozen expressions` using :func:`.freeze`, thus removing their ability to create new expressions using Python operators: ``freeze(a) == freeze(b)``. Also note the trailing underscore of method :meth:`~.Expression.eq_`. By convention, all methods and attributes of expression objects have a trailing underscore, to distinguish them from the shortcut to generate attribute access expressions: ``a.eq(b)`` creates a new expression object, rather than comparing two expressions. Finally, :class:`.HasExpressionRepr` is a mix-in class that provides a simple way for any class to produce well-formatted :func:`.repr` string representations by implementing method :meth:`~.HasExpressionRepr.to_expression` and generating an :class:`Expression` representation of themselves. Even class :class:`Expression` subclasses :class:`.HasExpressionRepr`; :meth:`.Expression.to_expression` returns the expression itself. """ from ._expression import *
33.022472
87
0.726778
440
2,939
4.811364
0.375
0.066131
0.042513
0.011337
0.078885
0.042985
0.021257
0
0
0
0
0.007013
0.17523
2,939
88
88
33.397727
0.865924
0.987411
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
439fcd081f15b38d362f0feb49ffbee45433842c
350
py
Python
astropy/analytic_functions/__init__.py
REMeyer/astropy
28c49fb618538a01812e586cd07bccdf0591a6c6
[ "BSD-3-Clause" ]
3
2018-03-20T15:09:16.000Z
2021-05-27T11:17:33.000Z
astropy/analytic_functions/__init__.py
REMeyer/astropy
28c49fb618538a01812e586cd07bccdf0591a6c6
[ "BSD-3-Clause" ]
null
null
null
astropy/analytic_functions/__init__.py
REMeyer/astropy
28c49fb618538a01812e586cd07bccdf0591a6c6
[ "BSD-3-Clause" ]
null
null
null
# Licensed under a 3-clause BSD style license - see LICENSE.rst """This package contains analytic functions useful for astronomy. In future versions of ``astropy``, many of these might be accessible as `~astropy.modeling.core.Model`. """ # Shortcuts for most commonly used blackbody functions from .blackbody import blackbody_nu, blackbody_lambda
31.818182
65
0.785714
49
350
5.571429
0.836735
0
0
0
0
0
0
0
0
0
0
0.003322
0.14
350
10
66
35
0.903654
0.808571
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
43a8c4af31036790ddf59400c510ee4b0b71f242
87
py
Python
aureus/helper/__init__.py
YouwangDeng/Aureus
859c64470d8e592a4e282586ad085c73c38df7d0
[ "BSD-3-Clause" ]
1
2018-09-24T00:48:08.000Z
2018-09-24T00:48:08.000Z
aureus/helper/__init__.py
YouwangDeng/Aureus
859c64470d8e592a4e282586ad085c73c38df7d0
[ "BSD-3-Clause" ]
null
null
null
aureus/helper/__init__.py
YouwangDeng/Aureus
859c64470d8e592a4e282586ad085c73c38df7d0
[ "BSD-3-Clause" ]
null
null
null
# 以“.”分割文件名,获取文件后缀类型 def parse_static_key(filename): return filename.split(".")[-1]
29
34
0.701149
12
87
4.916667
0.916667
0
0
0
0
0
0
0
0
0
0
0.012821
0.103448
87
3
34
29
0.74359
0.206897
0
0
0
0
0.014706
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
43c81b01f3a4475c84e44b4ef5559bd63626e06f
85
py
Python
apps/sushi/apps.py
remocrevo/celus
682b13168eb475d7f970502113e756e40a899877
[ "MIT" ]
7
2020-02-20T13:24:40.000Z
2022-01-28T19:36:04.000Z
apps/sushi/apps.py
techlib/czechelib-stats
ca132e326af0924740a525710474870b1fb5fd37
[ "MIT" ]
15
2020-04-28T13:09:02.000Z
2021-11-03T15:21:24.000Z
apps/sushi/apps.py
techlib/czechelib-stats
ca132e326af0924740a525710474870b1fb5fd37
[ "MIT" ]
4
2020-02-20T13:48:30.000Z
2021-03-19T00:33:34.000Z
from django.apps import AppConfig class SushiConfig(AppConfig): name = 'sushi'
14.166667
33
0.741176
10
85
6.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.176471
85
5
34
17
0.9
0
0
0
0
0
0.058824
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
43d1ba0e657b0f43807beba786a95cd6f65e8689
220
py
Python
Django/django_project_lsc_05/jinja2_env.py
MarioKarting/Django_basic
437556628f72ccf8fdfd63c46191dcee39602b00
[ "MIT" ]
null
null
null
Django/django_project_lsc_05/jinja2_env.py
MarioKarting/Django_basic
437556628f72ccf8fdfd63c46191dcee39602b00
[ "MIT" ]
null
null
null
Django/django_project_lsc_05/jinja2_env.py
MarioKarting/Django_basic
437556628f72ccf8fdfd63c46191dcee39602b00
[ "MIT" ]
null
null
null
from jinja2 import Environment def environment(**options): env = Environment(**options)#实例化jinja2环境 env.filters["jinja_filter"] = jinja_filter return env # 1.写函数 def jinja_filter(x): return x * 100
14.666667
46
0.695455
28
220
5.357143
0.571429
0.22
0
0
0
0
0
0
0
0
0
0.034091
0.2
220
14
47
15.714286
0.818182
0.077273
0
0
0
0
0.059701
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0.142857
0.714286
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
43d51a78c7365f41f305e79556c98039d5efcf9c
11,398
py
Python
tests/corpus/assets/test_label.py
toddrme2178/audiomate
14e932ce9c0b0bebb895d496cb6054521fc80ab1
[ "MIT" ]
null
null
null
tests/corpus/assets/test_label.py
toddrme2178/audiomate
14e932ce9c0b0bebb895d496cb6054521fc80ab1
[ "MIT" ]
null
null
null
tests/corpus/assets/test_label.py
toddrme2178/audiomate
14e932ce9c0b0bebb895d496cb6054521fc80ab1
[ "MIT" ]
null
null
null
import unittest import numpy as np import librosa import pytest from audiomate.corpus import assets from tests import resources class TestLabelList(unittest.TestCase): def setUp(self): file = assets.File('wav', resources.sample_wav_file('wav_1.wav')) utt = assets.Utterance('utt', file, start=0.3, end=-1) ll = assets.LabelList() self.test_label = assets.Label('a', start=0.5, end=-1) ll.append(self.test_label) utt.set_label_list(ll) def test_start_abs(self): assert self.test_label.start_abs == pytest.approx(0.8) def test_end_abs(self): assert self.test_label.end_abs == pytest.approx(2.5951875) def test_duration(self): assert self.test_label.duration == pytest.approx(1.7951875) def test_append(self): ll = assets.LabelList() label = assets.Label('some text') ll.append(label) assert len(ll) == 1 assert label.label_list == ll def test_extend(self): ll = assets.LabelList() label_a = assets.Label('some text') label_b = assets.Label('more text') label_c = assets.Label('text again') ll.extend([label_a, label_b, label_c]) assert len(ll) == 3 assert label_a.label_list == ll assert label_b.label_list == ll assert label_c.label_list == ll def test_ranges(self): ll = assets.LabelList(labels=[ assets.Label('a', 3.2, 4.5), assets.Label('b', 5.1, 8.9), assets.Label('c', 7.2, 10.5), assets.Label('d', 10.5, 14) ]) ranges = ll.ranges() r = next(ranges) self.assertEqual(3.2, r[0]) self.assertEqual(4.5, r[1]) self.assertIn(ll[0], r[2]) r = next(ranges) self.assertEqual(5.1, r[0]) self.assertEqual(7.2, r[1]) self.assertIn(ll[1], r[2]) r = next(ranges) self.assertEqual(7.2, r[0]) self.assertEqual(8.9, r[1]) self.assertIn(ll[1], r[2]) self.assertIn(ll[2], r[2]) r = next(ranges) self.assertEqual(8.9, r[0]) self.assertEqual(10.5, r[1]) self.assertIn(ll[2], r[2]) r = next(ranges) self.assertEqual(10.5, r[0]) self.assertEqual(14, r[1]) self.assertIn(ll[3], r[2]) with self.assertRaises(StopIteration): next(ranges) def test_ranges_with_empty(self): ll = assets.LabelList(labels=[ assets.Label('a', 3.2, 4.5), assets.Label('b', 5.1, 8.9), assets.Label('c', 7.2, 10.5), assets.Label('d', 10.5, 14) ]) ranges = ll.ranges(yield_ranges_without_labels=True) r = next(ranges) self.assertEqual(3.2, r[0]) self.assertEqual(4.5, r[1]) self.assertIn(ll[0], r[2]) r = next(ranges) self.assertEqual(4.5, r[0]) self.assertEqual(5.1, r[1]) self.assertEqual(0, len(r[2])) r = next(ranges) self.assertEqual(5.1, r[0]) self.assertEqual(7.2, r[1]) self.assertIn(ll[1], r[2]) r = next(ranges) self.assertEqual(7.2, r[0]) self.assertEqual(8.9, r[1]) self.assertIn(ll[1], r[2]) self.assertIn(ll[2], r[2]) r = next(ranges) self.assertEqual(8.9, r[0]) self.assertEqual(10.5, r[1]) self.assertIn(ll[2], r[2]) r = next(ranges) self.assertEqual(10.5, r[0]) self.assertEqual(14, r[1]) self.assertIn(ll[3], r[2]) with self.assertRaises(StopIteration): next(ranges) def test_ranges_include_labels(self): ll = assets.LabelList(labels=[ assets.Label('a', 3.2, 4.5), assets.Label('b', 5.1, 8.9) ]) ranges = ll.ranges(include_labels=['a']) r = next(ranges) self.assertEqual(3.2, r[0]) self.assertEqual(4.5, r[1]) self.assertIn(ll[0], r[2]) with self.assertRaises(StopIteration): next(ranges) def test_ranges_zero_to_end(self): ll = assets.LabelList(labels=[ assets.Label('a', 0, -1), assets.Label('b', 5.1, 8.9) ]) ranges = ll.ranges() r = next(ranges) self.assertEqual(0, r[0]) self.assertEqual(5.1, r[1]) self.assertIn(ll[0], r[2]) r = next(ranges) self.assertEqual(5.1, r[0]) self.assertEqual(8.9, r[1]) self.assertIn(ll[0], r[2]) self.assertIn(ll[1], r[2]) r = next(ranges) self.assertEqual(8.9, r[0]) self.assertEqual(-1, r[1]) self.assertIn(ll[0], r[2]) with self.assertRaises(StopIteration): next(ranges) def test_ranges_with_same_start_times(self): ll = assets.LabelList(labels=[ assets.Label('a', 1.2, 1.3), assets.Label('b', 1.2, 5.6) ]) ranges = ll.ranges() r = next(ranges) assert r[0] == 1.2 assert r[1] == 1.3 assert len(r[2]) == 2 assert ll[0] in r[2] assert ll[1] in r[2] r = next(ranges) assert r[0] == 1.3 assert r[1] == 5.6 assert len(r[2]) == 1 assert ll[1] in r[2] with self.assertRaises(StopIteration): next(ranges) def test_label_count(self): ll = assets.LabelList(labels=[ assets.Label('a', 3.2, 4.5), assets.Label('b', 5.1, 8.9), assets.Label('c', 7.2, 10.5), assets.Label('a', 10.5, 14), assets.Label('c', 13, 14) ]) res = ll.label_count() self.assertEqual(2, res['a']) self.assertEqual(1, res['b']) self.assertEqual(2, res['c']) def test_label_total_durations(self): ll = assets.LabelList(labels=[ assets.Label('a', 3.2, 4.5), assets.Label('b', 5.1, 8.9), assets.Label('c', 7.2, 10.5), assets.Label('a', 10.5, 14), assets.Label('c', 13, 14) ]) res = ll.label_total_duration() assert res['a'] == pytest.approx(4.8) assert res['b'] == pytest.approx(3.8) assert res['c'] == pytest.approx(4.3) def test_create_single(self): ll = assets.LabelList.create_single('bob') assert len(ll) == 1 assert ll.idx == 'default' assert ll[0].value == 'bob' assert ll[0].start == 0 assert ll[0].end == -1 def test_create_single_with_custom_idx(self): ll = assets.LabelList.create_single('bob', idx='name') assert len(ll) == 1 assert ll.idx == 'name' assert ll[0].value == 'bob' assert ll[0].start == 0 assert ll[0].end == -1 class TestLabel(object): def test_label_creation(self): a = assets.Label('value', 6.2, 8.9) assert a.value == 'value' assert a.start == 6.2 assert a.end == 8.9 assert len(a.meta) == 0 def test_label_creation_with_info(self): a = assets.Label('value', 6.2, 8.9, meta={'something': 2}) assert a.value == 'value' assert a.start == 6.2 assert a.end == 8.9 assert len(a.meta) == 1 assert a.meta['something'] == 2 def test_lt_start_time_considered_first(self): a = assets.Label('some label', 1.0, 2.0) b = assets.Label('some label', 1.1, 2.0) assert a < b def test_lt_end_time_considered_second(self): a = assets.Label('some label', 1.0, 1.9) b = assets.Label('some label', 1.0, 2.0) assert a < b def test_lt_end_time_properly_handles_custom_infinity(self): a = assets.Label('some label', 1.0, 1.9) b = assets.Label('some label', 1.0, -1) assert a < b def test_lt_value_considered_third(self): a = assets.Label('some label a', 1.0, 2.0) b = assets.Label('some label b', 1.0, 2.0) assert a < b def test_lt_value_ignores_capitalization(self): a = assets.Label('some label A', 1.0, 2.0) b = assets.Label('some label a', 1.0, 2.0) assert not a < b # not == because == tests different method assert not a > b # not == because == tests different method def test_eq_ignores_capitalization(self): a = assets.Label('some label A', 1.0, 2.0) b = assets.Label('some label a', 1.0, 2.0) assert a == b def test_eq_ignores_label_list_relation(self): a = assets.Label('some label A', 1.0, 2.0) b = assets.Label('some label a', 1.0, 2.0) al = assets.LabelList(idx='one', labels=[a]) bl = assets.LabelList(idx='another', labels=[b]) assert a.label_list == al assert b.label_list == bl assert a == b def test_lt_ignores_label_list_relation(self): a = assets.Label('some label A', 1.0, 2.0) b = assets.Label('some label a', 1.0, 2.0) al = assets.LabelList(idx='one', labels=[a]) bl = assets.LabelList(idx='another', labels=[b]) assert a.label_list == al assert b.label_list == bl assert not a < b assert not a > b def test_read_samples(self): file = assets.File('wav', resources.sample_wav_file('wav_1.wav')) issuer = assets.Issuer('toni') utt = assets.Utterance('test', file, issuer=issuer, start=1.0, end=2.30) l1 = assets.Label('a', 0.15, 0.448) l2 = assets.Label('a', 0.5, 0.73) ll = assets.LabelList(labels=[l1, l2]) utt.set_label_list(ll) expected, __ = librosa.core.load(file.path, sr=None, offset=1.15, duration=0.298) assert np.array_equal(l1.read_samples(), expected) expected, __ = librosa.core.load(file.path, sr=None, offset=1.5, duration=0.23) assert np.array_equal(l2.read_samples(), expected) def test_read_samples_no_utterance_and_label_end(self): file = assets.File('wav', resources.sample_wav_file('wav_1.wav')) issuer = assets.Issuer('toni') utt = assets.Utterance('test', file, issuer=issuer, start=1.0, end=-1) l1 = assets.Label('a', 0.15, 0.448) l2 = assets.Label('a', 0.5, -1) ll = assets.LabelList(labels=[l1, l2]) utt.set_label_list(ll) expected, __ = librosa.core.load(file.path, sr=None, offset=1.15, duration=0.298) assert np.array_equal(l1.read_samples(), expected) expected, __ = librosa.core.load(file.path, sr=None, offset=1.5) assert np.array_equal(l2.read_samples(), expected) def test_start_abs(self): label = assets.Label('a', 2, 5) ll = assets.LabelList(labels=[label]) assets.Utterance('utt-1', None, start=1, end=19, label_lists=[ll]) assert label.start_abs == 3 def test_start_abs_no_utterance(self): label = assets.Label('a', 2, 5) assert label.start_abs == 2 def test_end_abs(self): label = assets.Label('a', 2, 5) ll = assets.LabelList(labels=[label]) assets.Utterance('utt-1', None, start=1, end=19, label_lists=[ll]) assert label.end_abs == 6 def test_end_abs_no_utterance(self): label = assets.Label('a', 2, 5) assert label.end_abs == 5 def test_duration(self): label = assets.Label('a', 2, 5) assert label.duration == 3
29.002545
89
0.554132
1,683
11,398
3.651218
0.086156
0.100244
0.037103
0.052075
0.780797
0.743531
0.726932
0.696664
0.675183
0.63629
0
0.058242
0.29049
11,398
392
90
29.076531
0.70162
0.007107
0
0.652921
0
0
0.036062
0
0
0
0
0
0.408935
1
0.109966
false
0
0.020619
0
0.137457
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
4
78e4c3cbc184e63c5bb2363237bb1803e55e0903
890
py
Python
Regressions/regressions.py
someonenamedmatt/Machine-Learning-Sample-Algorithms
fbc9cf7a8c2186aed06a27e3bb8692dc29c1c544
[ "MIT" ]
null
null
null
Regressions/regressions.py
someonenamedmatt/Machine-Learning-Sample-Algorithms
fbc9cf7a8c2186aed06a27e3bb8692dc29c1c544
[ "MIT" ]
null
null
null
Regressions/regressions.py
someonenamedmatt/Machine-Learning-Sample-Algorithms
fbc9cf7a8c2186aed06a27e3bb8692dc29c1c544
[ "MIT" ]
null
null
null
import numpy as np from gradient_descent import GradientAscent # class Regression(object): # ''' # A generic regression class which has a variety of cost functions # ''' # def __init__(self, type, regularizer, l = 0.0): # ''' # Input: type of regression (OLS, logit) # Regularizer (ridge, lasso, anything else is nothing) # Output: None # ''' # # self.l = l # if type == 'OLS': # self.cost_func = self._OLS_cost # # if regularizer == 'lasso': # self.cost_func = lambda X,y: self.cost_func(X,y) + _lasso_cost() # # # # def fit(self, X, y, starting_guess = np.array([0])): # if type == 'OLS': # # # # def _OLS_cost(self): # return lambda X, y: np.sum((self.predict(X)-y)**2) # # def _lasso_cost(self): # return self.l * np.sum(self.coeff_**2)
26.176471
78
0.547191
114
890
4.114035
0.447368
0.021322
0.076759
0
0
0
0
0
0
0
0
0.008078
0.304494
890
33
79
26.969697
0.749596
0.859551
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
600588b386ef3efc71243301d7ac2e42ab429688
104
py
Python
task_controller/apps.py
saranshabd/long-running-task-controller
7fc193a6bbd3a226167eef9511ef9047aa4fed2d
[ "Apache-2.0" ]
null
null
null
task_controller/apps.py
saranshabd/long-running-task-controller
7fc193a6bbd3a226167eef9511ef9047aa4fed2d
[ "Apache-2.0" ]
null
null
null
task_controller/apps.py
saranshabd/long-running-task-controller
7fc193a6bbd3a226167eef9511ef9047aa4fed2d
[ "Apache-2.0" ]
null
null
null
from django.apps import AppConfig class TaskControllerConfig(AppConfig): name = 'task_controller'
17.333333
38
0.788462
11
104
7.363636
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.144231
104
5
39
20.8
0.910112
0
0
0
0
0
0.144231
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4