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
ff0d32b3df551f2b5b099141d4926c1e59ea3520
44
py
Python
foiamachine/local/lib/python2.7/encodings/mac_cyrillic.py
dwillis/foiamachine
26d3b02870227696cdaab639c39d47b2a7a42ae5
[ "Unlicense", "MIT" ]
3
2021-08-07T04:01:55.000Z
2021-08-07T05:12:11.000Z
foiamachine/local/lib/python2.7/encodings/mac_cyrillic.py
dwillis/foiamachine
26d3b02870227696cdaab639c39d47b2a7a42ae5
[ "Unlicense", "MIT" ]
null
null
null
foiamachine/local/lib/python2.7/encodings/mac_cyrillic.py
dwillis/foiamachine
26d3b02870227696cdaab639c39d47b2a7a42ae5
[ "Unlicense", "MIT" ]
1
2021-08-05T22:51:14.000Z
2021-08-05T22:51:14.000Z
/usr/lib/python2.7/encodings/mac_cyrillic.py
44
44
0.840909
8
44
4.5
1
0
0
0
0
0
0
0
0
0
0
0.045455
0
44
1
44
44
0.772727
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
ff1a79fb32d365ea57abc446fde2add8425da437
66
py
Python
testsuite/modulegraph-dir/global_import.py
xoviat/modulegraph2
766d00bdb40e5b2fe206b53a87b1bce3f9dc9c2a
[ "MIT" ]
9
2020-03-22T14:48:01.000Z
2021-05-30T12:18:12.000Z
testsuite/modulegraph-dir/global_import.py
xoviat/modulegraph2
766d00bdb40e5b2fe206b53a87b1bce3f9dc9c2a
[ "MIT" ]
15
2020-01-06T10:02:32.000Z
2021-05-28T12:22:44.000Z
testsuite/modulegraph-dir/global_import.py
ronaldoussoren/modulegraph2
b6ab1766b0098651b51083235ff8a18a5639128b
[ "MIT" ]
4
2020-05-10T18:51:41.000Z
2021-04-07T14:03:12.000Z
import no_imports def foo(): pass class MyClass: pass
6.6
17
0.636364
9
66
4.555556
0.888889
0
0
0
0
0
0
0
0
0
0
0
0.30303
66
9
18
7.333333
0.891304
0
0
0.4
0
0
0
0
0
0
0
0
0
1
0.2
true
0.4
0.2
0
0.6
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
ff1b6490773908c6417872bb4b1f4ddb1b8b7d8b
1,630
py
Python
modules/spider/spider/spiders/__init__.py
Ladder-Climbers/mayne-code
d355cc56013db4ac2db50fddde3e9d203d965ab6
[ "MIT" ]
null
null
null
modules/spider/spider/spiders/__init__.py
Ladder-Climbers/mayne-code
d355cc56013db4ac2db50fddde3e9d203d965ab6
[ "MIT" ]
null
null
null
modules/spider/spider/spiders/__init__.py
Ladder-Climbers/mayne-code
d355cc56013db4ac2db50fddde3e9d203d965ab6
[ "MIT" ]
null
null
null
# This package will contain the spiders of your Scrapy project # # Please refer to the documentation for information on how to create and manage # your spiders. DOUBAN_COOKIE = { "__gads": "ID=2421173a5ca57aed-228b4c29c5c800c1:T=1621494084:RT=1621494084:S=ALNI_MaJlRkH7cibeVPuRhGgoy4NehQdpw", "__utma": "81379588.766923198.1621432056.1634626277.1634642692.15", "__utmv": "30149280.23826", "__utmz": "81379588.1634626277.14.8.utmcsr=cn.bing.com|utmccn=(referral)|utmcmd=referral|utmcct=/", "__yadk_uid": "mpCqcudA39rNIrjPG2dzOaZVU9YKWwMV", "_ga": "GA1.2.2128100270.1634613032", "_ga_RXNMP372GL": "GS1.1.1634613031.1.0.1634613033.58", "_pk_id.100001.3ac3": "e2d5b8eca75bca93.1621432056.15.1634642691.1634626483.", "_pk_ref.100001.3ac3": "[\"\",\"\",1634642691,\"https://cn.bing.com/\"]", "_vwo_uuid_v2": "DF8649AFF718CAD037CCABE9EC9DA0284|35908c2cbe71e8172adb1d18e8eb654d", "ap_v": "0,6.0", "bid": "nvSOKb3e_kY", "ck": "vPPv", "ct": "y", "dbcl2": "\"238268017:3kJuTVIhGR8\"", "douban-fav-remind": "1", "gr_cs1_816e1a27-0db8-472b-bedd-a0ce47a62b39": "user_id:0", "gr_cs1_a0853268-d85f-4a95-90d5-70006915ab52": "user_id:1", "gr_session_id_22c937bbd8ebd703f2d8e9445f7dfd03": "a0853268-d85f-4a95-90d5-70006915ab52", "gr_session_id_22c937bbd8ebd703f2d8e9445f7dfd03_a0853268-d85f-4a95-90d5-70006915ab52": "true", "gr_user_id": "322312de-376f-4247-911e-4d511f4f93bd", "ll": "\"118282\"", "push_doumail_num": "0", "push_noty_num": "0", "viewed": "\"1000647_35541390_1000001_35252459_35378783_1043815_1200840_4913064_26261735_30348068\"" }
49.393939
117
0.722699
189
1,630
5.952381
0.714286
0.016
0.042667
0.053333
0.161778
0.133333
0.133333
0.133333
0.133333
0
0
0.372061
0.112883
1,630
32
118
50.9375
0.405947
0.093252
0
0
0
0.037037
0.678887
0.501697
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
0
0
0
1
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
2074e9ae1d1d2bddde402a21becfcd713ec53a16
11,680
py
Python
Bin/model_vdsr.py
MingSun-Tse/pytorch-vdsr
597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7
[ "MIT" ]
1
2018-10-18T05:57:50.000Z
2018-10-18T05:57:50.000Z
Bin/model_vdsr.py
MingSun-Tse/pytorch-vdsr
597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7
[ "MIT" ]
null
null
null
Bin/model_vdsr.py
MingSun-Tse/pytorch-vdsr
597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7
[ "MIT" ]
null
null
null
import numpy as np import os import torch.nn as nn import torch # Load param from model1 to model2 # For each layer of model2, if model1 has the same layer, then copy the params. def load_param(model1_path, model2): dict_param1 = torch.load(model1_path) # model1_path: .pth model path dict_param2 = dict(model2.named_parameters()) for name2 in dict_param2: if name2 in dict_param1: # print("tensor '%s' found in both models, so copy it from model 1 to model 2" % name2) dict_param2[name2].data.copy_(dict_param1[name2].data) model2.load_state_dict(dict_param2) return model2 # Original VDSR model class VDSR(nn.Module): def __init__(self, model=False, fixed=False): super(VDSR, self).__init__() self.fixed = fixed self.conv1 = nn.Conv2d( 1,64,3,1,1,bias=False) self.conv2 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv3 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv4 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv5 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv6 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv7 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv8 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv9 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv10 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv11 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv12 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv13 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv14 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv15 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv16 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv17 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv18 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv19 = nn.Conv2d(64,64,3,1,1,bias=False) self.conv20 = nn.Conv2d(64, 1,3,1,1,bias=False) self.relu = nn.ReLU(inplace=True) if model: load_param(model, self) # self.load_state_dict(torch.load(model, map_location=lambda storage, location: storage)) if fixed: for param in self.parameters(): param.requires_grad = False def forward(self, y): y = self.relu(self.conv1(y)) y = self.relu(self.conv2(y)) y = self.relu(self.conv3(y)) y = self.relu(self.conv4(y)) y = self.relu(self.conv5(y)) y = self.relu(self.conv6(y)) y = self.relu(self.conv7(y)) y = self.relu(self.conv8(y)) y = self.relu(self.conv9(y)) y = self.relu(self.conv10(y)) y = self.relu(self.conv11(y)) y = self.relu(self.conv12(y)) y = self.relu(self.conv13(y)) y = self.relu(self.conv14(y)) y = self.relu(self.conv15(y)) y = self.relu(self.conv16(y)) y = self.relu(self.conv17(y)) y = self.relu(self.conv18(y)) y = self.relu(self.conv19(y)) y = self.conv20(y) # note there is no relu in the output layer return y def forward_stem(self, y): y = self.relu(self.conv1(y)); out1 = y y = self.relu(self.conv2(y)) y = self.relu(self.conv3(y)); out3 = y y = self.relu(self.conv4(y)) y = self.relu(self.conv5(y)); out5 = y y = self.relu(self.conv6(y)) y = self.relu(self.conv7(y)); out7 = y y = self.relu(self.conv8(y)) y = self.relu(self.conv9(y)); out9 = y y = self.relu(self.conv10(y)) y = self.relu(self.conv11(y)); out11 = y y = self.relu(self.conv12(y)) y = self.relu(self.conv13(y)); out13 = y y = self.relu(self.conv14(y)) y = self.relu(self.conv15(y)); out15 = y y = self.relu(self.conv16(y)) y = self.relu(self.conv17(y)); out17 = y y = self.relu(self.conv18(y)) y = self.relu(self.conv19(y)); out19 = y y = self.conv20(y) # return out1, out3, out5, out7, out9, \ # out11, out13, out15, out17, out19, y return out1, out5, out9, out13, out17, y # the last element of return is the residual def forward_dense(self, y): y = self.relu(self.conv1(y)); out1 = y y = self.relu(self.conv2(y)); out2 = y y = self.relu(self.conv3(y)); out3 = y y = self.relu(self.conv4(y)); out4 = y y = self.relu(self.conv5(y)); out5 = y y = self.relu(self.conv6(y)); out6 = y y = self.relu(self.conv7(y)); out7 = y y = self.relu(self.conv8(y)); out8 = y y = self.relu(self.conv9(y)); out9 = y y = self.relu(self.conv10(y)); out10 = y y = self.relu(self.conv11(y)); out11 = y y = self.relu(self.conv12(y)); out12 = y y = self.relu(self.conv13(y)); out13 = y y = self.relu(self.conv14(y)); out14 = y y = self.relu(self.conv15(y)); out15 = y y = self.relu(self.conv16(y)); out16 = y y = self.relu(self.conv17(y)); out17 = y y = self.relu(self.conv18(y)); out18 = y y = self.relu(self.conv19(y)); out19 = y y = self.conv20(y); out20 = y return out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, \ out11, out12, out13, out14, out15, out16, out17, out18, out19, out20 class SmallVDSR_16x(nn.Module): def __init__(self, model=False, fixed=False): super(SmallVDSR_16x, self).__init__() self.fixed = fixed self.conv1 = nn.Conv2d( 1,16,3,1,1,bias=False) self.conv2 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv3 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv4 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv5 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv6 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv7 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv8 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv9 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv10 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv11 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv12 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv13 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv14 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv15 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv16 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv17 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv18 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv19 = nn.Conv2d(16,16,3,1,1,bias=False) self.conv20 = nn.Conv2d(16, 1,3,1,1,bias=False) self.prelu = nn.PReLU() self.relu = nn.ReLU() self.conv1_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv3_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv5_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv7_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv9_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv11_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv13_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv15_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv17_aux = nn.Conv2d(16,64,1,1,0,bias=False) self.conv19_aux = nn.Conv2d(16,64,1,1,0,bias=False) if model: load_param(model, self) if fixed: for param in self.parameters(): param.requires_grad = False def forward_aux(self, y): y = self.relu(self.conv1(y)); out1_aux = self.prelu(self.conv1_aux(y)) y = self.relu(self.conv2(y)); out2_aux = self.prelu(self.conv2_aux(y)) y = self.relu(self.conv3(y)); out3_aux = self.prelu(self.conv3_aux(y)) y = self.relu(self.conv4(y)); out4_aux = self.prelu(self.conv4_aux(y)) y = self.relu(self.conv5(y)); out5_aux = self.prelu(self.conv5_aux(y)) y = self.relu(self.conv6(y)); out5_aux = self.prelu(self.conv5_aux(y)) y = self.relu(self.conv7(y)); out7_aux = self.prelu(self.conv7_aux(y)) y = self.relu(self.conv8(y)); out5_aux = self.prelu(self.conv5_aux(y)) y = self.relu(self.conv9(y)); out9_aux = self.prelu(self.conv9_aux(y)) y = self.relu(self.conv10(y)); out10_aux = self.prelu(self.conv10_aux(y)) y = self.relu(self.conv11(y)); out11_aux = self.prelu(self.conv11_aux(y)) y = self.relu(self.conv12(y)); out12_aux = self.prelu(self.conv12_aux(y)) y = self.relu(self.conv13(y)); out13_aux = self.prelu(self.conv13_aux(y)) y = self.relu(self.conv14(y)); out14_aux = self.prelu(self.conv14_aux(y)) y = self.relu(self.conv15(y)); out15_aux = self.prelu(self.conv15_aux(y)) y = self.relu(self.conv16(y)); out16_aux = self.prelu(self.conv16_aux(y)) y = self.relu(self.conv17(y)); out17_aux = self.prelu(self.conv17_aux(y)) y = self.relu(self.conv18(y)); out18_aux = self.prelu(self.conv18_aux(y)) y = self.relu(self.conv19(y)); out19_aux = self.prelu(self.conv19_aux(y)) y = self.conv20(y) # return out1_aux, out3_aux, out5_aux, out7_aux, out9_aux, \ # out11_aux, out13_aux, out15_aux, out17_aux, out19_aux, y return out1_aux, out5_aux, out9_aux, out13_aux, out17_aux, y # the last element of return is the residual def forward_dense(self, y): y = self.relu(self.conv1(y)); out1 = y y = self.relu(self.conv2(y)); out2 = y y = self.relu(self.conv3(y)); out3 = y y = self.relu(self.conv4(y)); out4 = y y = self.relu(self.conv5(y)); out5 = y y = self.relu(self.conv6(y)); out6 = y y = self.relu(self.conv7(y)); out7 = y y = self.relu(self.conv8(y)); out8 = y y = self.relu(self.conv9(y)); out9 = y y = self.relu(self.conv10(y)); out10 = y y = self.relu(self.conv11(y)); out11 = y y = self.relu(self.conv12(y)); out12 = y y = self.relu(self.conv13(y)); out13 = y y = self.relu(self.conv14(y)); out14 = y y = self.relu(self.conv15(y)); out15 = y y = self.relu(self.conv16(y)); out16 = y y = self.relu(self.conv17(y)); out17 = y y = self.relu(self.conv18(y)); out18 = y y = self.relu(self.conv19(y)); out19 = y y = self.conv20(y); out20 = y return out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, \ out11, out12, out13, out14, out15, out16, out17, out18, out19, out20 def forward(self, y): y = self.relu(self.conv1(y)) y = self.relu(self.conv2(y)) y = self.relu(self.conv3(y)) y = self.relu(self.conv4(y)) y = self.relu(self.conv5(y)) y = self.relu(self.conv6(y)) y = self.relu(self.conv7(y)) y = self.relu(self.conv8(y)) y = self.relu(self.conv9(y)) y = self.relu(self.conv10(y)) y = self.relu(self.conv11(y)) y = self.relu(self.conv12(y)) y = self.relu(self.conv13(y)) y = self.relu(self.conv14(y)) y = self.relu(self.conv15(y)) y = self.relu(self.conv16(y)) y = self.relu(self.conv17(y)) y = self.relu(self.conv18(y)) y = self.relu(self.conv19(y)) y = self.conv20(y) return y class KTSmallVDSR_16x(nn.Module): def __init__(self, e1, e2): super(KTSmallVDSR_16x, self).__init__() self.e1 = VDSR(e1, fixed=True) self.e2 = SmallVDSR_16x(e2) def forward(self, LR): feats_1 = self.e1.forward_stem(LR); predictedHR_1 = torch.add(feats_1[-1], LR) feats_2 = self.e1.forward_stem(predictedHR_1); predictedHR_2 = torch.add(feats_2[-1], predictedHR_1) feats_3 = self.e1.forward_stem(predictedHR_2); predictedHR_3 = torch.add(feats_3[-1], predictedHR_2) feats2_1 = self.e2.forward_aux(LR); predictedHR2_1 = torch.add(feats2_1[-1], LR) feats2_2 = self.e2.forward_aux(predictedHR2_1); predictedHR2_2 = torch.add(feats2_2[-1], predictedHR2_1) feats2_3 = self.e2.forward_aux(predictedHR2_2); predictedHR2_3 = torch.add(feats2_3[-1], predictedHR2_2) return feats_1, feats2_1, predictedHR_1, predictedHR2_1, \ feats_2, feats2_2, predictedHR_2, predictedHR2_2, \ feats_3, feats2_3, predictedHR_3, predictedHR2_3 Autoencoders = { "16x": KTSmallVDSR_16x, }
43.745318
110
0.619178
2,032
11,680
3.478839
0.067913
0.033951
0.101853
0.161268
0.742962
0.727118
0.709294
0.695855
0.643372
0.602631
0
0.109895
0.210017
11,680
266
111
43.909774
0.656226
0.055908
0
0.531915
0
0
0.000279
0
0
0
0
0
0
1
0.046809
false
0
0.017021
0
0.110638
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
2074fa25f29ea8b07a929bec8448b6b334b3c09d
218
py
Python
pinax/projects/temp_group_project/apps/temp_tribes/admin.py
skabber/pinax
6fdee6b7bbbb597074d45122badf3a6dd75e0b92
[ "MIT" ]
2
2015-12-27T23:07:51.000Z
2016-05-09T08:57:28.000Z
pinax/projects/temp_group_project/apps/temp_tribes/admin.py
skabber/pinax
6fdee6b7bbbb597074d45122badf3a6dd75e0b92
[ "MIT" ]
null
null
null
pinax/projects/temp_group_project/apps/temp_tribes/admin.py
skabber/pinax
6fdee6b7bbbb597074d45122badf3a6dd75e0b92
[ "MIT" ]
null
null
null
from django.contrib import admin from temp_tribes.models import Tribe class TribeAdmin(admin.ModelAdmin): list_display = ('name', 'slug', 'creator', 'created', 'deleted') admin.site.register(Tribe, TribeAdmin)
27.25
70
0.747706
27
218
5.962963
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.123853
218
7
71
31.142857
0.842932
0
0
0
0
0
0.133028
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
207b6b6b480fcab76b5c6efa9284353f9ad48904
412
py
Python
python/testData/paramInfo/InitializingDataclassHierarchy/a.py
Sajaki/intellij-community
6748af2c40567839d11fd652ec77ba263c074aad
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/paramInfo/InitializingDataclassHierarchy/a.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2022-02-19T09:45:05.000Z
2022-02-27T20:32:55.000Z
python/testData/paramInfo/InitializingDataclassHierarchy/a.py
Cyril-lamirand/intellij-community
60ab6c61b82fc761dd68363eca7d9d69663cfa39
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
from dataclasses import dataclass @dataclass class A1: a: int @dataclass class B1(A1): b: str B1(<arg1>) @dataclass(init=False) class A2: a: int @dataclass class B2(A2): b: str B2(<arg2>) @dataclass class A3: a: int @dataclass(init=False) class B3(A3): b: str B3(<arg3>) @dataclass(init=False) class A4: a: int @dataclass(init=False) class B4(A4): b: str B4(<arg4>)
9.363636
33
0.626214
64
412
4.03125
0.359375
0.217054
0.20155
0.356589
0.209302
0.209302
0
0
0
0
0
0.062893
0.228155
412
44
34
9.363636
0.748428
0
0
0.551724
0
0
0
0
0
0
0
0
0
0
null
null
0
0.034483
null
null
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
0
1
0
0
0
0
0
0
0
0
4
209598f6921861012811a5bdfd568ddfb6cb638f
697
py
Python
twitchat/permissions.py
Fittiboy/twitchat
c82341675f5eb7ce49c06f41f0f71ecf07bdcdea
[ "MIT" ]
6
2021-01-11T05:50:03.000Z
2022-03-24T01:55:41.000Z
twitchat/permissions.py
Fittiboy/twitchat
c82341675f5eb7ce49c06f41f0f71ecf07bdcdea
[ "MIT" ]
4
2020-07-30T19:39:26.000Z
2021-06-12T20:08:54.000Z
twitchat/permissions.py
Fittiboy/python-twitch-bot
b810688bb0d24bf059a228e771eb2aae91cc43d0
[ "MIT" ]
1
2021-08-04T17:35:23.000Z
2021-08-04T17:35:23.000Z
permissions = { "on_permissions": { "all": "0", "uids": [], "badges": { "broadcaster": "1" }, "forbid": { "all": "0", "uids": [], "badges": {} } }, "on_channel": { "all": "0", "uids": [], "badges": {}, "forbid": { "all": "0", "uids": [], "badges": {} } }, "on_commadd": { "all": "0", "uids": [], "badges": { "broadcaster": "1" }, "forbid": { "all": "0", "uids": [], "badges": {} } } }
18.837838
30
0.245337
38
697
4.421053
0.289474
0.142857
0.285714
0.5
0.690476
0.690476
0.547619
0.547619
0.547619
0.547619
0
0.024922
0.539455
697
36
31
19.361111
0.498442
0
0
0.611111
0
0
0.229555
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
1
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
20b2bfc3038d3a597e4edda67da813610f90ebc4
618
py
Python
tests/test_522.py
sungho-joo/leetcode2github
ce7730ef40f6051df23681dd3c0e1e657abba620
[ "MIT" ]
null
null
null
tests/test_522.py
sungho-joo/leetcode2github
ce7730ef40f6051df23681dd3c0e1e657abba620
[ "MIT" ]
null
null
null
tests/test_522.py
sungho-joo/leetcode2github
ce7730ef40f6051df23681dd3c0e1e657abba620
[ "MIT" ]
null
null
null
#!/usr/bin/env python import pytest """ Test 522. Longest Uncommon Subsequence II """ @pytest.fixture(scope="session") def init_variables_522(): from src.leetcode_522_longest_uncommon_subsequence_ii import Solution solution = Solution() def _init_variables_522(): return solution yield _init_variables_522 class TestClass522: def test_solution_0(self, init_variables_522): assert init_variables_522().findLUSlength(["aba", "cdc", "eae"]) == 3 def test_solution_1(self, init_variables_522): assert init_variables_522().findLUSlength(["aaa", "aaa", "aa"]) == -1
22.071429
77
0.710356
78
618
5.307692
0.474359
0.219807
0.270531
0.140097
0.415459
0.2657
0.2657
0.2657
0.2657
0
0
0.066406
0.171521
618
27
78
22.888889
0.742188
0.032362
0
0
0
0
0.043796
0
0
0
0
0
0.153846
1
0.307692
false
0
0.153846
0.076923
0.615385
0
0
0
0
null
1
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
1
0
0
0
0
1
0
0
4
20c46c37feb562b746ac0429cb5a041872f87b8b
46
py
Python
data_tools/__init__.py
erik-grabljevec/Tennis-Modelling
ca67a4e642a6e6b4d905c701de38160a4cf25495
[ "MIT" ]
4
2020-02-07T18:48:54.000Z
2021-04-22T21:07:00.000Z
data_tools/__init__.py
erik-grabljevec/Tennis-Modelling
ca67a4e642a6e6b4d905c701de38160a4cf25495
[ "MIT" ]
null
null
null
data_tools/__init__.py
erik-grabljevec/Tennis-Modelling
ca67a4e642a6e6b4d905c701de38160a4cf25495
[ "MIT" ]
null
null
null
__author__ = 'riko' from handle_data import *
15.333333
25
0.76087
6
46
5
1
0
0
0
0
0
0
0
0
0
0
0
0.152174
46
3
25
15.333333
0.769231
0
0
0
0
0
0.085106
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
0
0
0
0
1
0
0
0
0
4
454b2fbb6e5f5c99780058f8c3742138f13288e3
1,834
py
Python
test/BaseCurrencyAdjustmentTest.py
harshal-choudhari/books-python-wrappers
43616ee451a78ef2f02facc1cfb1d7f1121a1464
[ "MIT" ]
1
2021-04-21T06:40:48.000Z
2021-04-21T06:40:48.000Z
test/BaseCurrencyAdjustmentTest.py
harshal-choudhari/books-python-wrappers
43616ee451a78ef2f02facc1cfb1d7f1121a1464
[ "MIT" ]
null
null
null
test/BaseCurrencyAdjustmentTest.py
harshal-choudhari/books-python-wrappers
43616ee451a78ef2f02facc1cfb1d7f1121a1464
[ "MIT" ]
1
2021-04-21T07:31:47.000Z
2021-04-21T07:31:47.000Z
#$Id$# from books.model.BaseCurrencyAdjustment import BaseCurrencyAdjustment from books.service.ZohoBooks import ZohoBooks import os access_token = os.environ.get('ACCESS_TOKEN') organization_id = os.environ.get('ORGANIZATION_ID') zoho_books = ZohoBooks(access_token, organization_id) base_currency_adjustment_api = zoho_books.get_base_currency_adjustment_api() base_currency_adjustment_id = base_currency_adjustment_api.get_base_currency_adjustments().get_base_currency_adjustments()[0].get_base_currency_adjustment_id() #List base currency adjustment parameter = { 'filter_by': 'Date.All', 'sort_column': 'adjustment_date'} print base_currency_adjustment_api.get_base_currency_adjustments() print base_currency_adjustment_api.get_base_currency_adjustments(parameter) #Get a base currency adjustment print base_currency_adjustment_api.get(base_currency_adjustment_id) # List account details for base currency adjustments settings_api = zoho_books.get_settings_api() currency_id = settings_api.get_currencies().get_currencies()[0].get_currency_id() parameter = {'currency_id': currency_id, 'adjustment_date': '2014-04-21', 'exchange_rate': 20.0, 'notes': 'sdfs'} print base_currency_adjustment_api.list_account_details(parameter) # Create a base currency adjustment account_ids = '71127000000000367' base_currency_adjustment = BaseCurrencyAdjustment() base_currency_adjustment.set_currency_id('71127000000000105') base_currency_adjustment.set_adjustment_date('2014-04-21') base_currency_adjustment.set_exchange_rate(20.0) base_currency_adjustment.set_notes('hello') print base_currency_adjustment_api.create(base_currency_adjustment, account_ids) #Delete a base currency adjustment print base_currency_adjustment_api.delete(base_currency_adjustment_id)
36.68
159
0.81952
235
1,834
5.965957
0.217021
0.239658
0.360913
0.160485
0.376605
0.236091
0.202568
0.202568
0.155492
0
0
0.035109
0.099237
1,834
49
160
37.428571
0.813559
0.099237
0
0
0
0
0.107664
0
0
0
0
0
0
0
null
null
0
0.107143
null
null
0.214286
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
0
1
0
0
0
0
0
0
0
0
4
455e8725098f15e1e3d0c07d743184a4ff565dec
2,997
py
Python
list_files/rootpath.py
alepuzio/listfiles
cddc329cf773016a4703946c338a6e16d81380f5
[ "MIT" ]
null
null
null
list_files/rootpath.py
alepuzio/listfiles
cddc329cf773016a4703946c338a6e16d81380f5
[ "MIT" ]
null
null
null
list_files/rootpath.py
alepuzio/listfiles
cddc329cf773016a4703946c338a6e16d81380f5
[ "MIT" ]
1
2021-06-13T12:44:31.000Z
2021-06-13T12:44:31.000Z
import sys import os from tests.test_single_file import PhysicalData from tests.test_single_file import SingleFile import pytest class Rootpath: """ @overvieww: class of the absolute path of root directory """ def __init__(self, opts): self.rootpath = opts[1] #TODO study how to resolve the constants in Python def data(self): return str(self.rootpath ) def exists(self): return os.path.exists(self.data()) def files ( self ): #TODO move in class Rootpath """ It read a directory recursavely """ readfiles = [] try: self.subdir(self.data(), readfiles) except: print ( sys.exc_info() ) print ( "The total number of the read files is {0}".format ( str( len ( readfiles ) ) ) ) return readfiles; def subdir(self, root_path, readfiles ): """ It traverses root directory, and list directories as dirs and files as files ---------- root_path: string root of the path readfiles: list list of read files inside path """ for root, dirs, files in os.walk(root_path) : path = root.split(os.sep) for fileTmp in files: readfiles.append ( SingleFile ( PhysicalData ( fileTmp, os.sep.join ( path ) ) ) ) for directory in dirs: self.subdir(directory, readfiles) def __repr__(self): return "Rootpath.repr:{0}".format( str ( self.rootpath) ) def __str__(self): #return "{0}".format( str ( self.rootpath) ) return "Rootpath:{0}".format( str ( self.rootpath) ) class OnlyVisible(Rootpath): """ It reads only visible directory """ def __init__(self, new_rootpath): self.rootpath = new_rootpath def data(self): return self.rootpath.data() def exists(self): return super().exists() def files ( self ): #TODO move in class Rootpath readfiles = [] try: if ( self.exists() ): readfiles = self.rootpath.files() else: print ( "The directory [{0}] doesn'nt exists".format ( self.data() ) ) except: print ( sys.exc_info() ) return readfiles; def subdir(self, root_path, readfiles ): if "\\." in root_path : print ("Directory with dot (.), then it's hidden: {0}".format ( directory )) else: return self.rootpath.subdir(root_path, readfiles) def __repr__(self): return "OnlyVisible.repr:{0}".format( str ( self.rootpath) ) def __str__(self): return "OnlyVisible:{0}".format( str ( self.rootpath) ) def test_dot_in_path(): path = "C:\\Users\\apuzielli\\Documents\\personale\\mio-github\\.metadata\\.plugins\\org.jboss.tools.central\\proxyWizards\\1596464026525\\.rcache\\.orphans" result = ( "." in path) assert True == result
30.896907
161
0.577911
345
2,997
4.901449
0.310145
0.07806
0.053223
0.041396
0.274985
0.193377
0.144293
0.144293
0.049675
0.049675
0
0.010567
0.305305
2,997
96
162
31.21875
0.801633
0.150484
0
0.393443
0
0.016393
0.138912
0.061006
0
0
0
0.020833
0.016393
1
0.245902
false
0
0.081967
0.131148
0.540984
0.081967
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
455fee5d9022f710f6eae5a92cedde18dfa93e24
157
py
Python
Experiments/Aljazeera/web_scrap/wlog.py
Ahmad-Fahad/Web-Scraping
361ace93825dea2b9c908d8c95ca1af42d2e7eb8
[ "Apache-2.0" ]
null
null
null
Experiments/Aljazeera/web_scrap/wlog.py
Ahmad-Fahad/Web-Scraping
361ace93825dea2b9c908d8c95ca1af42d2e7eb8
[ "Apache-2.0" ]
null
null
null
Experiments/Aljazeera/web_scrap/wlog.py
Ahmad-Fahad/Web-Scraping
361ace93825dea2b9c908d8c95ca1af42d2e7eb8
[ "Apache-2.0" ]
null
null
null
import logging def set_custom_log_info(file): logging.basicConfig(filename=file , level=logging.INFO) def report(e:Exception): logging.exception(str(e))
22.428571
56
0.789809
23
157
5.26087
0.652174
0
0
0
0
0
0
0
0
0
0
0
0.089172
157
7
57
22.428571
0.846154
0
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0.2
0
0.6
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
0
1
0
0
4
45623edeecab00ec4536412589629e8198dc68c6
5,080
py
Python
api/lastfm.py
notnola/pinybot
8ad579fe5652b42a8fb9486c8d11962f5972f817
[ "MIT" ]
null
null
null
api/lastfm.py
notnola/pinybot
8ad579fe5652b42a8fb9486c8d11962f5972f817
[ "MIT" ]
null
null
null
api/lastfm.py
notnola/pinybot
8ad579fe5652b42a8fb9486c8d11962f5972f817
[ "MIT" ]
1
2019-01-31T01:07:56.000Z
2019-01-31T01:07:56.000Z
import logging import web_request import youtube log = logging.getLogger(__name__) def get_lastfm_chart(chart_items=5): """ Finds the currently most played tunes on last.fm and turns them in to a youtube list of tracks. :param chart_items: int the amount of tracks we want. :return: list[ dict{'type=youtube', 'video_id', 'int(video_time)', 'video_title'} ] or None on error. """ url = 'http://lastfm-ajax-vip1.phx1.cbsig.net/kerve/charts?nr=%s&type=track&format=json' % chart_items lastfm = web_request.get_request(url, json=True) log.debug(lastfm) if lastfm is not None: if 'results' in lastfm['content']: if 'track' in lastfm['content']['results']: if len(lastfm['content']['results']['track']) is not 0: yt_tracks = [] for track in lastfm['content']['results']['track']: search_str = '%s - %s' % (track['artist'], track['name']) yt = youtube.youtube_search(search_str) log.info(yt) if yt is not None: yt_tracks.append(yt) return yt_tracks return None def search_lastfm_by_tag(search_str, by_id=True, max_tunes=40): """ Search last.fm for tunes matching the search term and turns them in to a youtube list of tracks. :param search_str: str the search term to search for. :param by_id: bool if set to True, only tunes that have a youtube id will be added(recommended) :param max_tunes: int the max amount of tunes to return. :return: list[ dict{'type=youtube', 'video_id', 'int(video_time)', 'video_title'} ] or None on error. """ url = 'http://lastfm-ajax-vip1.phx1.cbsig.net/kerve/charts?nr=%s&type=track&f=tag:%s&format=json' % \ (max_tunes, search_str) lastfm = web_request.get_request(url, json=True) log.debug(lastfm) if lastfm is not None: if 'track' in lastfm['content']['results']: if len(lastfm['content']['results']['track']) is not 0: yt_tracks = [] for track in lastfm['content']['results']['track']: search_str = '%s - %s' % (track['artist'], track['name']) if 'playlink' in track: if 'data-youtube-id' in track['playlink']: youtube_id = track['playlink']['data-youtube-id'] yt = youtube.youtube_time(youtube_id) log.debug(yt) if yt is not None: yt_tracks.append(yt) else: if not by_id: yt = youtube.youtube_search(search_str) log.debug('search by search string: %s result: %s' % (search_str, yt)) if yt is not None: yt_tracks.append(yt) else: if not by_id: yt = youtube.youtube_search(search_str) log.debug('search by search string: %s result: %s' % (search_str, yt)) if yt is not None: yt_tracks.append(yt) return yt_tracks return None def lastfm_listening_now(max_tunes, by_id=True): """ Gets a list of tunes other people using last.fm are listening to, and turns them in to a youtube list of tracks. :param max_tunes: int the amount of tracks we want. :param by_id: bool if set to True, only tunes that have a youtube id will be added(recommended) :return: list[ dict{'type=youtube', 'video_id', 'int(video_time)', 'video_title'} ] or None on error. """ url = 'http://lastfm-ajax-vip1.phx1.cbsig.net/kerve/listeningnow?limit=%s&format=json' % max_tunes lastfm = web_request.get_request(url, json=True) log.debug(lastfm) if lastfm is not None: if len(lastfm['content']['Users']) is not 0: yt_tracks = [] for user in lastfm['content']['Users']: if 'playlink' in user: if 'data-youtube-id' in user['playlink']: youtube_id = user['playlink']['data-youtube-id'] yt = youtube.youtube_time(youtube_id) log.debug(yt) if yt is not None: yt_tracks.append(yt) else: if 'Track' in user: search_str = '%s - %s' % (user['Track']['Artist'], user['Track']['Name']) if not by_id: yt = youtube.youtube_search(search_str) log.debug('search by search string: %s result: %s' % (search_str, yt)) if yt is not None: yt_tracks.append(yt) return yt_tracks return None
48.846154
116
0.524606
633
5,080
4.086888
0.172196
0.045226
0.03131
0.018554
0.756475
0.718206
0.711635
0.678392
0.678392
0.678392
0
0.003726
0.365945
5,080
103
117
49.320388
0.799441
0.200787
0
0.705128
0
0.038462
0.1727
0
0
0
0
0
0
1
0.038462
false
0
0.038462
0
0.153846
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
45833e1c5ea0d457d107bcecf827a6f4e50acc31
136
py
Python
data-science-master/Section-2-Basics-of-Python-Programming/Lec-2.15-Creating-Python-Modules-and-Packages/module-files/myscript.py
Hamid-Ali-99/Python_Just_Python
6d542044b685af11abf49bfdecc7bbacf2b9c892
[ "BSL-1.0" ]
null
null
null
data-science-master/Section-2-Basics-of-Python-Programming/Lec-2.15-Creating-Python-Modules-and-Packages/module-files/myscript.py
Hamid-Ali-99/Python_Just_Python
6d542044b685af11abf49bfdecc7bbacf2b9c892
[ "BSL-1.0" ]
null
null
null
data-science-master/Section-2-Basics-of-Python-Programming/Lec-2.15-Creating-Python-Modules-and-Packages/module-files/myscript.py
Hamid-Ali-99/Python_Just_Python
6d542044b685af11abf49bfdecc7bbacf2b9c892
[ "BSL-1.0" ]
null
null
null
def myFunction(): print('The value of __name__ is ' + __name__) def main(): myFunction() if __name__ == '__main__': main()
17
49
0.625
16
136
4.3125
0.625
0
0
0
0
0
0
0
0
0
0
0
0.227941
136
8
50
17
0.657143
0
0
0
0
0
0.240876
0
0
0
0
0
0
1
0.333333
true
0
0
0
0.333333
0.166667
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
1
0
0
0
0
0
0
4
458734f0b86044f9689357d6430b31b7701d69bd
96
py
Python
__init__.py
challenger-zpp/dataflow
825a8f26858ccbb299f3ebd1c6172569ae6b417f
[ "MIT" ]
null
null
null
__init__.py
challenger-zpp/dataflow
825a8f26858ccbb299f3ebd1c6172569ae6b417f
[ "MIT" ]
null
null
null
__init__.py
challenger-zpp/dataflow
825a8f26858ccbb299f3ebd1c6172569ae6b417f
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Tue Apr 2 10:39:47 2019 @author: ldh """ # __init__.py
12
35
0.572917
16
96
3.1875
1
0
0
0
0
0
0
0
0
0
0
0.157895
0.208333
96
8
36
12
0.513158
0.875
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
45b983d6b792b5901e481dda7979fa25b29b062b
402
py
Python
api/admin.py
surajsonee/Ionic-Django
cfede4b6f1100aedbe41aea861fe965efd799989
[ "MIT" ]
null
null
null
api/admin.py
surajsonee/Ionic-Django
cfede4b6f1100aedbe41aea861fe965efd799989
[ "MIT" ]
null
null
null
api/admin.py
surajsonee/Ionic-Django
cfede4b6f1100aedbe41aea861fe965efd799989
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Team, Kpi, KpiValue, Organization # Register your models here. @admin.register(Organization) class OrganizationAdmin(admin.ModelAdmin): pass @admin.register(Team) class TeamAdmin(admin.ModelAdmin): pass @admin.register(Kpi) class KpiAdmin(admin.ModelAdmin): pass @admin.register(KpiValue) class KpiAdmin(admin.ModelAdmin): pass
19.142857
53
0.771144
48
402
6.458333
0.395833
0.167742
0.245161
0.232258
0.454839
0
0
0
0
0
0
0
0.131841
402
21
54
19.142857
0.888252
0.064677
0
0.428571
0
0
0
0
0
0
0
0
0
1
0
true
0.285714
0.142857
0
0.428571
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
1
1
0
0
0
0
0
4
afee8d5d175102a92e32c8c47239e0e9fa4d1c60
32
py
Python
homeassistant/components/derivative/__init__.py
domwillcode/home-assistant
f170c80bea70c939c098b5c88320a1c789858958
[ "Apache-2.0" ]
22,481
2020-03-02T13:09:59.000Z
2022-03-31T23:34:28.000Z
homeassistant/components/derivative/__init__.py
jagadeeshvenkatesh/core
1bd982668449815fee2105478569f8e4b5670add
[ "Apache-2.0" ]
31,101
2020-03-02T13:00:16.000Z
2022-03-31T23:57:36.000Z
homeassistant/components/derivative/__init__.py
jagadeeshvenkatesh/core
1bd982668449815fee2105478569f8e4b5670add
[ "Apache-2.0" ]
11,411
2020-03-02T14:19:20.000Z
2022-03-31T22:46:07.000Z
"""The derivative component."""
16
31
0.6875
3
32
7.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.09375
32
1
32
32
0.758621
0.78125
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
1
0
0
0
0
0
0
4
aff935eec8d66962adb0012785a07bfd62e73327
119
py
Python
qcarsim/constructors.py
QUT-Motorsport/QUTMS_VehicleSim
5c69a76beb889f3e1fb8a157751f5b6dc12d6d10
[ "MIT" ]
2
2020-05-10T13:44:05.000Z
2021-11-30T14:59:26.000Z
qcarsim/constructors.py
QUT-Motorsport/QUTMS_VehicleSim
5c69a76beb889f3e1fb8a157751f5b6dc12d6d10
[ "MIT" ]
24
2020-01-12T14:12:26.000Z
2020-07-22T02:34:53.000Z
qcarsim/constructors.py
QUT-Motorsport/QUTMS_VehicleSim
5c69a76beb889f3e1fb8a157751f5b6dc12d6d10
[ "MIT" ]
2
2020-01-13T06:51:31.000Z
2021-12-30T16:45:43.000Z
from qcarsim import * def dummy_output(number): doubled_value = dummy_calc(number) return p_tag(doubled_value)
23.8
38
0.764706
17
119
5.058824
0.764706
0.27907
0
0
0
0
0
0
0
0
0
0
0.159664
119
5
39
23.8
0.86
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
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
1
0
0
0
0
0
0
0
4
b32ec5ef7b19edc48886995bebe3199fbec842f3
32
py
Python
tests/components/slack/__init__.py
tbarbette/core
8e58c3aa7bc8d2c2b09b6bd329daa1c092d52d3c
[ "Apache-2.0" ]
22,481
2020-03-02T13:09:59.000Z
2022-03-31T23:34:28.000Z
tests/components/slack/__init__.py
jagadeeshvenkatesh/core
1bd982668449815fee2105478569f8e4b5670add
[ "Apache-2.0" ]
31,101
2020-03-02T13:00:16.000Z
2022-03-31T23:57:36.000Z
tests/components/slack/__init__.py
jagadeeshvenkatesh/core
1bd982668449815fee2105478569f8e4b5670add
[ "Apache-2.0" ]
11,411
2020-03-02T14:19:20.000Z
2022-03-31T22:46:07.000Z
"""Slack notification tests."""
16
31
0.6875
3
32
7.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.09375
32
1
32
32
0.758621
0.78125
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
1
0
0
0
0
0
0
4
b347d2df0d9836307993eae357f51e1badf085cd
115
py
Python
pdxpixel/apps/search/views.py
nicorellius/pdxpixel
f4dc84e25481624e24ab6303e0342219901f6241
[ "MIT" ]
1
2017-06-11T14:30:28.000Z
2017-06-11T14:30:28.000Z
pdxpixel/apps/search/views.py
nicorellius/pdxpixel
f4dc84e25481624e24ab6303e0342219901f6241
[ "MIT" ]
null
null
null
pdxpixel/apps/search/views.py
nicorellius/pdxpixel
f4dc84e25481624e24ab6303e0342219901f6241
[ "MIT" ]
null
null
null
from watson.views import BaseListView class SearchView(BaseListView): template_name = 'search/default.html'
16.428571
41
0.782609
13
115
6.846154
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.13913
115
6
42
19.166667
0.89899
0
0
0
0
0
0.165217
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
2fa406eb7f8aebd534601307105f5fa9b6669e3d
267
py
Python
Python/loop4.py
AungWinnHtut/CStutorial
4b57721b814e9c2d288af64a979704dd70f14ddb
[ "MIT" ]
null
null
null
Python/loop4.py
AungWinnHtut/CStutorial
4b57721b814e9c2d288af64a979704dd70f14ddb
[ "MIT" ]
null
null
null
Python/loop4.py
AungWinnHtut/CStutorial
4b57721b814e9c2d288af64a979704dd70f14ddb
[ "MIT" ]
1
2022-03-15T12:20:26.000Z
2022-03-15T12:20:26.000Z
# loop3 userinput = input("Enter a letter in the range A - C : ") while (userinput != "A") and (userinput != "a") and (userinput != "B") and (userinput != "b") and (userinput != "C") and (userinput != "c"): userinput = input("Enter a letter in the range A-C : ")
53.4
140
0.602996
39
267
4.128205
0.333333
0.372671
0.236025
0.248447
0.708075
0.47205
0.47205
0.47205
0.47205
0.47205
0
0.004695
0.202247
267
4
141
66.75
0.751174
0.018727
0
0.666667
0
0
0.292308
0
0
0
0
0
0
1
0
false
0
0
0
0
0
0
0
0
null
1
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
2fbc1e6af6bbf920e8802a5da14fd3c35f314b43
124
py
Python
Chatbot/typography.py
carmensteenbrink/getyourreview
c449e176a9629b1a457a14f9113cc0f95c5c23a5
[ "MIT" ]
null
null
null
Chatbot/typography.py
carmensteenbrink/getyourreview
c449e176a9629b1a457a14f9113cc0f95c5c23a5
[ "MIT" ]
null
null
null
Chatbot/typography.py
carmensteenbrink/getyourreview
c449e176a9629b1a457a14f9113cc0f95c5c23a5
[ "MIT" ]
null
null
null
typography = [{'fontforge', 'Calligraphr', 'Birdfont', 'Glyphr', 'fontstruct', 'Google Fonts', 'Make Word Art', 'Word Art'}]
124
124
0.669355
13
124
6.384615
0.846154
0.168675
0
0
0
0
0
0
0
0
0
0
0.104839
124
1
124
124
0.747748
0
0
0
0
0
0.616
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
2fcc20aef5b1e4bad329c497ff802eb7207ef290
82
py
Python
cryptography/the_var/__init__.py
JASTYN/pythonmaster
46638ab09d28b65ce5431cd0759fe6df272fb85d
[ "Apache-2.0", "MIT" ]
3
2017-05-02T10:28:13.000Z
2019-02-06T09:10:11.000Z
cryptography/the_var/__init__.py
JASTYN/pythonmaster
46638ab09d28b65ce5431cd0759fe6df272fb85d
[ "Apache-2.0", "MIT" ]
2
2017-06-21T20:39:14.000Z
2020-02-25T10:28:57.000Z
cryptography/the_var/__init__.py
JASTYN/pythonmaster
46638ab09d28b65ce5431cd0759fe6df272fb85d
[ "Apache-2.0", "MIT" ]
2
2016-07-29T04:35:22.000Z
2017-01-18T17:05:36.000Z
def the_var(var): n = [ord(i) - 96 for i in var.split("+")] return sum(n)
20.5
45
0.536585
16
82
2.6875
0.75
0
0
0
0
0
0
0
0
0
0
0.032787
0.256098
82
3
46
27.333333
0.672131
0
0
0
0
0
0.012195
0
0
0
0
0
0
1
0.333333
false
0
0
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
1
0
0
0
0
1
0
0
4
2fd4875f2bad3ca17965fe17e99e819332a9f16a
110
py
Python
server/main.py
gtluu/timsconvert
93ae663fd67d46a90c4adc1256a7b9b8517fd7c6
[ "Apache-2.0" ]
3
2021-12-16T17:48:19.000Z
2022-03-31T11:41:24.000Z
server/main.py
gtluu/timsconvert
93ae663fd67d46a90c4adc1256a7b9b8517fd7c6
[ "Apache-2.0" ]
3
2022-01-18T23:23:53.000Z
2022-03-29T19:38:40.000Z
server/main.py
gtluu/timsconvert
93ae663fd67d46a90c4adc1256a7b9b8517fd7c6
[ "Apache-2.0" ]
3
2021-12-14T10:51:45.000Z
2022-02-21T16:16:21.000Z
# main.py from app import app import views if __name__ == '__main__': app.run(host='0.0.0.0',port='5000')
18.333333
39
0.663636
20
110
3.25
0.65
0.092308
0.092308
0
0
0
0
0
0
0
0
0.086022
0.154545
110
6
39
18.333333
0.612903
0.063636
0
0
0
0
0.186275
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
6402403c641d8b20acc96f33df6b80e58ef6b0fb
2,158
py
Python
src/sima/simo/blueprints/timedependentvolumemass.py
SINTEF/simapy
650b8c2f15503dad98e2bfc0d0788509593822c7
[ "MIT" ]
null
null
null
src/sima/simo/blueprints/timedependentvolumemass.py
SINTEF/simapy
650b8c2f15503dad98e2bfc0d0788509593822c7
[ "MIT" ]
null
null
null
src/sima/simo/blueprints/timedependentvolumemass.py
SINTEF/simapy
650b8c2f15503dad98e2bfc0d0788509593822c7
[ "MIT" ]
null
null
null
# # Generated with TimeDependentVolumeMassBlueprint from dmt.blueprint import Blueprint from dmt.dimension import Dimension from dmt.attribute import Attribute from dmt.enum_attribute import EnumAttribute from dmt.blueprint_attribute import BlueprintAttribute from sima.sima.blueprints.namedobject import NamedObjectBlueprint class TimeDependentVolumeMassBlueprint(NamedObjectBlueprint): """""" def __init__(self, name="TimeDependentVolumeMass", package_path="sima/simo", description=""): super().__init__(name,package_path,description) self.attributes.append(Attribute("name","string","",default="")) self.attributes.append(Attribute("description","string","",default="")) self.attributes.append(Attribute("_id","string","",default="")) self.attributes.append(BlueprintAttribute("scriptableValues","sima/sima/ScriptableValue","",True,Dimension("*"))) self.attributes.append(BlueprintAttribute("point","sima/sima/Point3","Mass point (local coordinates).",True)) self.attributes.append(BlueprintAttribute("flowRates","sima/simo/FlowRateItem","",True,Dimension("*"))) self.attributes.append(Attribute("vol0","number","Volume of liquid at t=0",default=0.0)) self.attributes.append(Attribute("volMax","number","Maximum allowable volume",default=0.0)) self.attributes.append(Attribute("volMin","number","Minimum allowable volume",default=0.0)) self.attributes.append(Attribute("volRateMax","number","Maximum allowable volume rate (HLA only)",default=0.0)) self.attributes.append(Attribute("volRateMin","number","Minimum allowable volume rate (HLA only)",default=0.0)) self.attributes.append(Attribute("density","number","Density of liquid in tank",default=0.0)) self.attributes.append(BlueprintAttribute("vectorZ","sima/sima/Vector3","Vector defining portion z-axis in local system",True)) self.attributes.append(BlueprintAttribute("vectorXZ","sima/sima/Vector3","Vector in local xz-plane def. portion x-axis",True)) self.attributes.append(BlueprintAttribute("portions","sima/simo/VolumeMassPortion","",True,Dimension("*")))
74.413793
135
0.741427
238
2,158
6.668067
0.323529
0.132325
0.189036
0.164461
0.384373
0.242596
0.171393
0.147448
0.147448
0.080655
0
0.008808
0.105653
2,158
29
136
74.413793
0.813472
0.021779
0
0
1
0
0.29686
0.046147
0
0
0
0
0
1
0.041667
false
0
0.25
0
0.333333
0.416667
0
0
0
null
0
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
1
0
4
ff70d146e2c905845c2460998d78926d4e9ae9ba
75
py
Python
example/test/core/geometry/simple/plane/__init__.py
dmilos/IceRay
4e01f141363c0d126d3c700c1f5f892967e3d520
[ "MIT-0" ]
2
2020-09-04T12:27:15.000Z
2022-01-17T14:49:40.000Z
example/test/core/geometry/simple/plane/__init__.py
dmilos/IceRay
4e01f141363c0d126d3c700c1f5f892967e3d520
[ "MIT-0" ]
null
null
null
example/test/core/geometry/simple/plane/__init__.py
dmilos/IceRay
4e01f141363c0d126d3c700c1f5f892967e3d520
[ "MIT-0" ]
1
2020-09-04T12:27:52.000Z
2020-09-04T12:27:52.000Z
#__name__ = "sphere" #__package__ = "sphere" #__all__ = ['make']
15
26
0.56
6
75
5
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.253333
75
4
27
18.75
0.535714
0.853333
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
ff7a574d42f56babc568588a65d2daf7b58c69a3
124
py
Python
unfolders/result.py
peguerosdc/unfolding_benchmark
58c278c00317d8900f5f3cd986610f2f1c538f28
[ "MIT" ]
null
null
null
unfolders/result.py
peguerosdc/unfolding_benchmark
58c278c00317d8900f5f3cd986610f2f1c538f28
[ "MIT" ]
null
null
null
unfolders/result.py
peguerosdc/unfolding_benchmark
58c278c00317d8900f5f3cd986610f2f1c538f28
[ "MIT" ]
null
null
null
class UnfoldingResult: def __init__(self, solution, error): self.solution = solution self.error = error
24.8
40
0.66129
13
124
6
0.538462
0.307692
0
0
0
0
0
0
0
0
0
0
0.258065
124
4
41
31
0.847826
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0
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
1
0
0
0
0
0
0
0
4
4407d534e5e7d5d171c3b1a73068931fb8fb82d2
401
py
Python
arrays/tests/test_remove_element.py
ahcode0919/python-ds-algorithms
0d617b78c50b6c18da40d9fa101438749bfc82e1
[ "MIT" ]
null
null
null
arrays/tests/test_remove_element.py
ahcode0919/python-ds-algorithms
0d617b78c50b6c18da40d9fa101438749bfc82e1
[ "MIT" ]
null
null
null
arrays/tests/test_remove_element.py
ahcode0919/python-ds-algorithms
0d617b78c50b6c18da40d9fa101438749bfc82e1
[ "MIT" ]
3
2020-10-07T20:24:45.000Z
2020-12-16T04:53:19.000Z
from arrays.remove_element import remove_element def test_remove_element(): arr = [3, 2, 2, 3] length = remove_element(arr, 3) assert length == 2 assert arr == [2, 2, 2, 3] arr = [1] length = remove_element(arr, 1) assert length == 0 assert arr == [1] arr = [2, 2, 3, 3] length = remove_element(arr, 3) assert length == 2 assert arr == [2, 2, 3, 3]
21.105263
48
0.57606
62
401
3.612903
0.225806
0.348214
0.285714
0.227679
0.464286
0.428571
0.428571
0.428571
0.428571
0.428571
0
0.083916
0.286783
401
18
49
22.277778
0.699301
0
0
0.285714
0
0
0
0
0
0
0
0
0.428571
1
0.071429
false
0
0.071429
0
0.142857
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
44607bfd87060218fe0f6879da2a44f90bc023da
754
py
Python
s/index_gen.py
andiac/compass
9a10355004eb5b13ae1187a88f1f2ebce0303184
[ "MIT" ]
1
2017-05-22T21:58:01.000Z
2017-05-22T21:58:01.000Z
s/index_gen.py
andiac/compass
9a10355004eb5b13ae1187a88f1f2ebce0303184
[ "MIT" ]
null
null
null
s/index_gen.py
andiac/compass
9a10355004eb5b13ae1187a88f1f2ebce0303184
[ "MIT" ]
1
2017-10-11T09:14:39.000Z
2017-10-11T09:14:39.000Z
import os f = os.popen("ls"); file_list = f.read().split("\n"); print ''' <!-- Here you can add your Google Analytics Tracking code. If you do so, do not forget to set the include_analytics attribute to true on the _config.yml file --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-68639768-1', 'auto'); ga('send', 'pageview'); </script> ''' for one_file in file_list: print '<p><a href="http://andi.ac/s/'+one_file+'">'+one_file+'</a></p>'
31.416667
81
0.647215
133
754
3.616541
0.586466
0.02079
0.012474
0
0
0
0
0
0
0
0
0.017778
0.104775
754
23
82
32.782609
0.694815
0
0
0
0
0.235294
0.816733
0.409031
0
0
0
0
0
0
null
null
0
0.058824
null
null
0.117647
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
1
1
1
null
0
0
0
0
1
0
0
0
0
0
0
0
0
4
4467726a842f7a60a47b398c4a2e3a5fe2ee0914
1,060
py
Python
app/project/users/forms.py
ritchie46/base-flask-mvc
3169dda74eafe0b5c3447ff0d4973f3550f14617
[ "MIT" ]
1
2021-11-21T09:43:00.000Z
2021-11-21T09:43:00.000Z
app/project/users/forms.py
ritchie46/base-flask-mvc
3169dda74eafe0b5c3447ff0d4973f3550f14617
[ "MIT" ]
null
null
null
app/project/users/forms.py
ritchie46/base-flask-mvc
3169dda74eafe0b5c3447ff0d4973f3550f14617
[ "MIT" ]
1
2021-04-19T00:33:28.000Z
2021-04-19T00:33:28.000Z
from flask_wtf import Form from wtforms import StringField, PasswordField from wtforms.validators import DataRequired, Length, EqualTo, Email class RegisterForm(Form): email = StringField('Email', validators=[DataRequired(), Email(), Length(min=6, max=40)]) password = PasswordField('Password', validators=[DataRequired(), Length(min=6, max=40)]) confirm = PasswordField('Repeat password', validators=[DataRequired(), EqualTo('password')]) class LoginForm(Form): email = StringField('Email', validators=[DataRequired(), Email(), Length(min=6, max=40)]) password = PasswordField('Password', validators=[DataRequired()]) class EmailForm(Form): email = StringField('Email', validators=[DataRequired(), Email(), Length(min=6, max=40)]) class PasswordForm(Form): password = PasswordField('Password', validators=[DataRequired(), Length(min=6, max=40)]) confirm = PasswordField('Repeat password', validators=[DataRequired(), EqualTo('password')]) old_password = PasswordField('Old password', validators=[DataRequired()])
39.259259
96
0.727358
111
1,060
6.927928
0.234234
0.257477
0.23407
0.084525
0.684005
0.684005
0.684005
0.684005
0.684005
0.684005
0
0.016026
0.116981
1,060
26
97
40.769231
0.805556
0
0
0.4375
0
0
0.091682
0
0
0
0
0
0
1
0
false
0.5
0.1875
0
1
0
0
0
0
null
1
1
0
0
0
0
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
4492da2406026a6c5ce1bf7a6ca916ff1d6db27c
478
py
Python
stamps/includes/W_hotbox/Rules/Stamps/001.py
adrianpueyo/stamps
5d61bf6b47b6cf0ba2dd8870f6e73fe420d353b7
[ "BSD-2-Clause" ]
18
2019-12-29T16:48:07.000Z
2022-03-09T16:50:34.000Z
stamps/includes/W_hotbox/Rules/Stamps/001.py
CreativeLyons/Stamps
c863ab9d8f7c748ea1913d4a1f3a5d903a7e7ade
[ "BSD-2-Clause" ]
5
2019-12-18T16:09:05.000Z
2021-06-24T08:25:07.000Z
stamps/includes/W_hotbox/Rules/Stamps/001.py
CreativeLyons/Stamps
c863ab9d8f7c748ea1913d4a1f3a5d903a7e7ade
[ "BSD-2-Clause" ]
4
2020-01-29T16:46:23.000Z
2022-02-19T14:33:27.000Z
#---------------------------------------------------------------------------------------------------------- # # AUTOMATICALLY GENERATED FILE TO BE USED BY W_HOTBOX # # NAME: Reconnect by Title # COLOR: #6b4930 # #---------------------------------------------------------------------------------------------------------- ns = [n for n in nuke.selectedNodes() if n.knob("identifier")] for n in ns: try: n["reconnect_by_title_this"].execute() except: pass
29.875
107
0.355649
39
478
4.25641
0.717949
0.13253
0.192771
0
0
0
0
0
0
0
0
0.012077
0.133891
478
15
108
31.866667
0.388889
0.633891
0
0
1
0
0.198795
0.138554
0
0
0
0
0
1
0
false
0.166667
0
0
0
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
4495dd46dfb9ed1d0c0ff94b72babc05e5d28813
99
py
Python
optimus/data/__init__.py
IanTayler/tao-exercises
ecca88175d7716b5dcc0d6184e6e5d59323910a0
[ "MIT" ]
3
2021-09-23T21:53:48.000Z
2021-10-07T22:21:40.000Z
optimus/data/__init__.py
IanTayler/tao-exercises
ecca88175d7716b5dcc0d6184e6e5d59323910a0
[ "MIT" ]
null
null
null
optimus/data/__init__.py
IanTayler/tao-exercises
ecca88175d7716b5dcc0d6184e6e5d59323910a0
[ "MIT" ]
null
null
null
"""Module for manipulation of physical data. Mostly conveniences for reading and writing files."""
49.5
98
0.787879
13
99
6
0.923077
0
0
0
0
0
0
0
0
0
0
0
0.131313
99
1
99
99
0.906977
0.929293
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
923c527b5c4a77ff9df0e9a76faa9f7de865c2c6
682
py
Python
generated-libraries/python/netapp/sis/sis_chkpoint_op_type.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
2
2017-03-28T15:31:26.000Z
2018-08-16T22:15:18.000Z
generated-libraries/python/netapp/sis/sis_chkpoint_op_type.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
generated-libraries/python/netapp/sis/sis_chkpoint_op_type.py
radekg/netapp-ontap-lib-get
6445ebb071ec147ea82a486fbe9f094c56c5c40d
[ "MIT" ]
null
null
null
class SisChkpointOpType(basestring): """ Checkpoint type Possible values: <ul> <li> "scan" - Scanning volume for fingerprints, <li> "start" - Starting a storage efficiency operation, <li> "check" - Checking for stale data in the fingerprint database, <li> "undo" - Undoing storage efficiency on the volume, <li> "downgrade" - Storage efficiency operations necessary for downgrade activity, <li> "post_transfer" - Starting a storage efficiency operation post mirror transfer </ul> """ @staticmethod def get_api_name(): return "sis-chkpoint-op-type"
28.416667
66
0.612903
70
682
5.928571
0.671429
0.163855
0.077108
0.125301
0.168675
0
0
0
0
0
0
0
0.300587
682
23
67
29.652174
0.870021
0.697947
0
0
0
0
0.149254
0
0
0
0
0
0
1
0.25
true
0
0
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
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
0
1
1
0
0
4
92522a061699c1fab7b1cf833c93983d849f5c78
208
py
Python
AC_TD3_code/utils/__init__.py
Jiang-HB/AC_CDQ
4b4ec2d611c4481ad0b99cf7ea79eb23014a0325
[ "MIT" ]
7
2021-05-03T05:50:14.000Z
2022-03-24T15:35:59.000Z
AC_TD3_code/utils/__init__.py
Jiang-HB/AC_CDQ
4b4ec2d611c4481ad0b99cf7ea79eb23014a0325
[ "MIT" ]
null
null
null
AC_TD3_code/utils/__init__.py
Jiang-HB/AC_CDQ
4b4ec2d611c4481ad0b99cf7ea79eb23014a0325
[ "MIT" ]
1
2022-03-25T02:24:53.000Z
2022-03-25T02:24:53.000Z
from .attr_dict import AttrDict from .commons import * from .options import opts from .recorder import Recoder from .replay_buffer import ReplayBuffer from .eval_policy import eval_policy from .run import run
29.714286
39
0.831731
31
208
5.451613
0.516129
0.118343
0
0
0
0
0
0
0
0
0
0
0.129808
208
7
40
29.714286
0.933702
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
925ce4bf295e6ccee07c03596db62b168a9c013e
206
py
Python
passenger_wsgi.py
fraigo/python-cors-proxy
1d74141fb810f50a651e606b45c52204be23e9d5
[ "MIT" ]
null
null
null
passenger_wsgi.py
fraigo/python-cors-proxy
1d74141fb810f50a651e606b45c52204be23e9d5
[ "MIT" ]
null
null
null
passenger_wsgi.py
fraigo/python-cors-proxy
1d74141fb810f50a651e606b45c52204be23e9d5
[ "MIT" ]
null
null
null
import imp import os import sys from corsproxy.wsgi import application sys.path.insert(0, os.path.dirname(__file__)) # wsgi = imp.load_source('wsgi', 'passenger_wsgi.py') # application = wsgi.application
20.6
53
0.771845
30
206
5.1
0.566667
0
0
0
0
0
0
0
0
0
0
0.005464
0.11165
206
9
54
22.888889
0.830601
0.398058
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.8
0
0.8
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
9281e47609a7bc804a97408e160060ad0358ac20
60
py
Python
ox_mon/common/__init__.py
emin63/ox_mon
965a36c430950c47d3cce79486c1ab2cc5ee89a4
[ "MIT" ]
null
null
null
ox_mon/common/__init__.py
emin63/ox_mon
965a36c430950c47d3cce79486c1ab2cc5ee89a4
[ "MIT" ]
null
null
null
ox_mon/common/__init__.py
emin63/ox_mon
965a36c430950c47d3cce79486c1ab2cc5ee89a4
[ "MIT" ]
null
null
null
"""Package with toosl common to various areas of ox_mon """
20
55
0.733333
10
60
4.3
1
0
0
0
0
0
0
0
0
0
0
0
0.166667
60
2
56
30
0.86
0.866667
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
92927dad5f2ffdea23038a335f299465de9fcf79
175
py
Python
narwhal/plotting/colors.py
njwilson23/narwhal
734bc4e0ebf322fc1f770df5473f423611fce5bf
[ "MIT" ]
10
2015-09-04T01:42:26.000Z
2022-03-02T08:18:14.000Z
narwhal/plotting/colors.py
njwilson23/narwhal
734bc4e0ebf322fc1f770df5473f423611fce5bf
[ "MIT" ]
5
2015-02-19T20:13:58.000Z
2019-01-24T04:41:01.000Z
narwhal/plotting/colors.py
njwilson23/narwhal
734bc4e0ebf322fc1f770df5473f423611fce5bf
[ "MIT" ]
7
2018-09-12T18:04:11.000Z
2022-03-02T08:18:15.000Z
def default_colors(n): n = max(n, 8) clist = ["#1b9e77", "#d95f02", "#7570b3", "#e7298a", "#66a61e", "#e6ab02", "#a6761d", "#666666"] return clist[:n]
29.166667
78
0.508571
20
175
4.4
0.8
0
0
0
0
0
0
0
0
0
0
0.263158
0.24
175
5
79
35
0.398496
0
0
0
0
0
0.32
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
1
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
2baeab5a7a76106da7a691e35e1e78ec9abb9ab0
5,622
py
Python
tests/core/tests_category.py
caputomarcos/django-bmf
0d07a7d3f6a3ecfaca6c9376e764add1715cfd33
[ "BSD-3-Clause" ]
null
null
null
tests/core/tests_category.py
caputomarcos/django-bmf
0d07a7d3f6a3ecfaca6c9376e764add1715cfd33
[ "BSD-3-Clause" ]
null
null
null
tests/core/tests_category.py
caputomarcos/django-bmf
0d07a7d3f6a3ecfaca6c9376e764add1715cfd33
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/python # ex:set fileencoding=utf-8: # flake8: noqa from __future__ import unicode_literals from django.test import TestCase from django.utils.translation import ugettext_lazy as _ from djangobmf.core.category import Category from collections import OrderedDict class ClassTests(TestCase): pass # def setUp(self): # noqa # self.view1 = View(model='empty', name="Test1", slug="test1") # self.view2 = View(model='empty', name="Test2", slug="test2") # super(ClassTests, self).setUp() # def test_init_empty(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory() # self.assertEqual(td.data, OrderedDict([ # ])) # def test_init_data1(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory(self.view1) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ])) # def test_init_data2(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory(self.view1, self.view2) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ('test2', self.view2), # ])) # def test_add_view(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory() # td.add_view(self.view1) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ])) # td.add_view(self.view1) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ])) # td.add_view(self.view2) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ('test2', self.view2), # ])) # td.add_view(self.view1) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ('test2', self.view2), # ])) # td.add_view(self.view2) # self.assertEqual(td.data, OrderedDict([ # ('test1', self.view1), # ('test2', self.view2), # ])) # def test_key(self): # class TestCategory(Category): # name = "Test" # slug = "test" # td = TestCategory() # self.assertEqual(td.key, "test") # def test_merge(self): # class TestCategory1(Category): # name = "Test1" # slug = "test1" # class TestCategory2(Category): # name = "Test1" # slug = "test1" # td1 = TestCategory1() # td2 = TestCategory2() # td1.merge(td2) # self.assertEqual(td1.data, OrderedDict([ # ])) # td1 = TestCategory1() # td2 = TestCategory2(self.view1) # td1.merge(td2) # self.assertEqual(td1.data, OrderedDict([ # ('test1', self.view1), # ])) # td1 = TestCategory1(self.view1) # td2 = TestCategory2(self.view2) # td1.merge(td2) # self.assertEqual(td1.data, OrderedDict([ # ('test1', self.view1), # ('test2', self.view2), # ])) # td1 = TestCategory1(self.view2) # td2 = TestCategory2(self.view2) # td1.merge(td2) # self.assertEqual(td1.data, OrderedDict([ # ('test2', self.view2), # ])) # td1 = TestCategory1(self.view2, self.view1) # td2 = TestCategory2(self.view2) # td1.merge(td2) # self.assertEqual(td1.data, OrderedDict([ # ('test2', self.view2), # ('test1', self.view1), # ])) # def test_bool(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory() # self.assertFalse(td) # td.add_view(self.view1) # self.assertTrue(td) # def test_len(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory() # self.assertEqual(len(td), 0) # td = TestCategory(self.view1, self.view2) # self.assertEqual(len(td), 2) # def test_eq(self): # class TestCategory1(Category): # name = "test1" # slug = "test1" # class TestCategory2(Category): # name = "test2" # slug = "test2" # class TestCategory3(Category): # name = "test1" # slug = "test1" # td1 = TestCategory1() # td2 = TestCategory2() # td3 = TestCategory3() # self.assertEqual(td1, td3) # self.assertNotEqual(td1, td2) # self.assertNotEqual(td1, self.view1) # def test_contains(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory(self.view1) # self.assertFalse('test2' in td) # self.assertFalse(self.view2 in td) # self.assertTrue('test1' in td) # self.assertTrue(self.view1 in td) # def test_getitem(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory(self.view1, self.view2) # self.assertEqual(td['test1'], self.view1) # self.assertEqual(td['test2'], self.view2) # with self.assertRaises(KeyError): # test = td['test3'] # def test_iter(self): # class TestCategory(Category): # name = "test" # slug = "test" # td = TestCategory(self.view1) # for i in td: # self.assertEqual(i, self.view1) # td = TestCategory(self.view1, self.view2) # self.assertEqual([i for i in td], [self.view1, self.view2])
26.518868
68
0.542512
569
5,622
5.309315
0.137083
0.089374
0.051639
0.095995
0.698775
0.667991
0.660708
0.644158
0.593843
0.559417
0
0.037047
0.303806
5,622
211
69
26.64455
0.734798
0.890786
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.142857
0.714286
0
0.857143
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
1
1
0
0
0
0
4
2bd2107ac178fead7c60c2d9f7594e604d39ece4
836
py
Python
source/yorm/mixins.py
faraazkhan/aws-control-tower-customizations
1e6a6e29911f7d9e02b99adb0b0165ce029d0c2d
[ "Apache-2.0" ]
20
2015-04-28T04:02:38.000Z
2020-09-25T08:13:50.000Z
source/yorm/mixins.py
faraazkhan/aws-control-tower-customizations
1e6a6e29911f7d9e02b99adb0b0165ce029d0c2d
[ "Apache-2.0" ]
59
2015-01-02T21:03:01.000Z
2018-12-09T21:35:00.000Z
source/yorm/mixins.py
faraazkhan/aws-control-tower-customizations
1e6a6e29911f7d9e02b99adb0b0165ce029d0c2d
[ "Apache-2.0" ]
10
2015-05-22T10:40:07.000Z
2020-09-29T04:40:55.000Z
import warnings from yorm import utilities class ModelMixin: """Adds ORM methods to a mapped class.""" @classmethod def create(cls, *args, **kwargs): return utilities.create(cls, *args, **kwargs) @classmethod def new(cls, *args, **kwargs): msg = "ModelMixin.new() has been renamed to ModelMixin.create()" warnings.warn(msg, DeprecationWarning) return utilities.create(cls, *args, **kwargs) @classmethod def find(cls, *args, **kwargs): return utilities.find(cls, *args, **kwargs) @classmethod def match(cls, *args, **kwargs): return utilities.match(cls, *args, **kwargs) def load(self): return utilities.load(self) def save(self): return utilities.save(self) def delete(self): return utilities.delete(self)
23.885714
72
0.629187
97
836
5.42268
0.340206
0.106464
0.197719
0.108365
0.365019
0.18251
0.18251
0.18251
0
0
0
0
0.242823
836
34
73
24.588235
0.830964
0.041866
0
0.26087
0
0
0.07044
0
0
0
0
0
0
1
0.304348
false
0
0.086957
0.26087
0.73913
0
0
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
1
0
0
0
1
1
0
0
4
ecf75e3c4f8e9f819904665f14cffd554546bef1
274
py
Python
02-basics/my_package/a_module.py
vicente-gonzalez-ruiz/python-tutorial
e6a79510a0b3663786d6476a40e79fc8e8726f61
[ "CC0-1.0" ]
4
2017-03-06T09:49:11.000Z
2019-10-16T00:09:38.000Z
02-basics/my_package/a_module.py
vicente-gonzalez-ruiz/python-tutorial
e6a79510a0b3663786d6476a40e79fc8e8726f61
[ "CC0-1.0" ]
null
null
null
02-basics/my_package/a_module.py
vicente-gonzalez-ruiz/python-tutorial
e6a79510a0b3663786d6476a40e79fc8e8726f61
[ "CC0-1.0" ]
7
2017-11-02T11:00:30.000Z
2020-01-31T22:41:27.000Z
a = 1 print("a_module: Hi from my_package/" + __name__ + ".py!") if __name__ == "__main__": print("a_module: I was invoked from a script.") else: print("a_module: I was invoked from a Pyton module (probably using 'import').") print("a_module: My name is =", __name__)
30.444444
82
0.678832
44
274
3.75
0.5
0.145455
0.290909
0.157576
0.339394
0.339394
0.339394
0.339394
0
0
0
0.004386
0.167883
274
8
83
34.25
0.719298
0
0
0
0
0
0.624088
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.571429
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
4
ecfbbfe29587c2338e0dc2d3bd7eceef35478003
216
py
Python
redis_metrics/__init__.py
bradmontgomery/django-redis-metrics
b1466b5742f3f1e3aac4264cb8b73e25e765e972
[ "MIT" ]
52
2015-01-03T19:40:50.000Z
2022-01-23T14:08:43.000Z
redis_metrics/__init__.py
bradmontgomery/django-redis-metrics
b1466b5742f3f1e3aac4264cb8b73e25e765e972
[ "MIT" ]
31
2015-01-05T10:28:50.000Z
2020-03-30T15:42:35.000Z
redis_metrics/__init__.py
bradmontgomery/django-redis-metrics
b1466b5742f3f1e3aac4264cb8b73e25e765e972
[ "MIT" ]
11
2015-03-07T12:15:53.000Z
2019-11-03T15:31:59.000Z
__version__ = "2.0.0" try: from .utils import gauge, metric, set_metric # NOQA except ImportError: # pragma: no cover pass # pragma: no cover default_app_config = 'redis_metrics.apps.RedisMetricsConfig'
24
60
0.726852
29
216
5.137931
0.827586
0.107383
0.174497
0
0
0
0
0
0
0
0
0.016949
0.180556
216
8
61
27
0.824859
0.175926
0
0
0
0
0.241379
0.212644
0
0
0
0
0
1
0
false
0.166667
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
0
1
1
0
0
0
0
4
a60fa6673e51b66befeaa525a35e31a492143372
299
py
Python
ice/icalendar/doctype/caldav_account/test_caldav_account.py
canlann/ice
1639b5217265ea62c441dbde4c7cf772755f909b
[ "MIT" ]
1
2021-10-05T14:02:33.000Z
2021-10-05T14:02:33.000Z
ice/icalendar/doctype/caldav_account/test_caldav_account.py
canlann/ice
1639b5217265ea62c441dbde4c7cf772755f909b
[ "MIT" ]
2
2020-11-28T11:14:30.000Z
2020-11-28T11:15:14.000Z
ice/icalendar/doctype/caldav_account/test_caldav_account.py
canlann/ice
1639b5217265ea62c441dbde4c7cf772755f909b
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Copyright (c) 2020, IT-Geräte und IT-Lösungen wie Server, Rechner, Netzwerke und E-Mailserver sowie auch Backups, and Contributors # See license.txt from __future__ import unicode_literals # import frappe import unittest class TestCalDavAccount(unittest.TestCase): pass
27.181818
132
0.77592
40
299
5.675
0.875
0
0
0
0
0
0
0
0
0
0
0.01938
0.137124
299
10
133
29.9
0.860465
0.608696
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.25
0.5
0
0.75
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
a620c144c9ce72265e617fc6ceae835dc720e634
36,392
py
Python
SloppyCell/lmopt.py
bcdaniels/SloppyCell
17e68127a6aba19056a5067748a2d18241cc4d76
[ "BSD-3-Clause" ]
2
2020-05-26T19:29:39.000Z
2020-08-26T20:54:52.000Z
SloppyCell/lmopt.py
bcdaniels/SloppyCell
17e68127a6aba19056a5067748a2d18241cc4d76
[ "BSD-3-Clause" ]
1
2020-05-26T16:50:49.000Z
2021-07-08T20:35:35.000Z
SloppyCell/lmopt.py
bcdaniels/SloppyCell
17e68127a6aba19056a5067748a2d18241cc4d76
[ "BSD-3-Clause" ]
3
2017-09-12T03:12:01.000Z
2018-10-19T11:08:09.000Z
from __future__ import nested_scopes # Levenberg Marquardt minimization routines """ fmin_lm : standard Levenberg Marquardt fmin_lmNoJ : Levenberg Marquardt using a cost function instead of a residual function and a gradient/J^tJ pair instead of the derivative of the residual function. Useful in problems where the number of residuals is very large. fmin_lm_scale : scale invariant Levenberg Marquardt """ import scipy from scipy import absolute, sqrt, asarray, zeros, mat, transpose, ones, dot, sum import scipy.linalg import copy import SloppyCell.Utility save = SloppyCell.Utility.save # module that provides pickled save import SloppyCell.KeyedList_mod as KeyedList_mod KeyedList = KeyedList_mod.KeyedList abs = absolute _epsilon = sqrt(scipy.finfo(scipy.float_).eps) def approx_fprime(xk,f,epsilon,*args): f0 = apply(f,(xk,)+args) grad = scipy.zeros((len(xk),),scipy.float_) ei = scipy.zeros((len(xk),),scipy.float_) for k in range(len(xk)): ei[k] = epsilon grad[k] = (apply(f,(xk+ei,)+args) - f0)/epsilon ei[k] = 0.0 return grad def approx_fprime1(xk,f,epsilon,*args): """ centred difference formula to approximate fprime """ #f0 = apply(f,(xk,)+args) grad = scipy.zeros((len(xk),),scipy.float_) ei = scipy.zeros((len(xk),),scipy.float_) epsilon = (epsilon**2.0)**(1.0/3.0) # should be macheps^(1/3) for k in range(len(xk)): ei[k] = epsilon grad[k] = (apply(f,(xk+ei,)+args) - apply(f,(xk-ei,)+args))/(2.0*epsilon) ei[k] = 0.0 return grad def approx_fprime2(xk,f,epsilon,*args): """ centred difference formula to approximate the jacobian, given the residual function """ #f0 = apply(f,(xk,)+args) grad = scipy.zeros((len(xk),),scipy.float_) ei = scipy.zeros((len(xk),),scipy.float_) epsilon = (epsilon**2.0)**(1.0/3.0) # should be macheps^(1/3) ei[0] = epsilon resminus = asarray(apply(f,(xk-ei,)+args)) resplus = asarray(apply(f,(xk+ei,)+args)) m = len(resminus) jac = scipy.zeros((m,len(xk)),scipy.float_) jac[:,0] = (resplus-resminus)/(2.0*epsilon) ei[0] = 0.0 for k in range(1,len(xk)): ei[k] = epsilon resplus = asarray(apply(f,(xk+ei,)+args)) resminus = asarray(apply(f,(xk-ei,)+args)) jac[:,k] = (resplus-resminus)/(2.0*epsilon) #jac[k,:] = mat(transpose(mat(apply(f,(xk+ei,)+args) - apply(f,(xk-ei,)+args))))/(2.0*epsilon) ei[k] = 0.0 return jac def check_grad(func, grad, x0, *args): approx_grad = approx_fprime(x0,func,_epsilon,*args) print("Finite difference gradient ", approx_grad) analytic_grad = grad(x0,*args) print("Analytic gradient ", analytic_grad) differencenorm = sqrt(sum(approx_grad-analytic_grad)**2) print("Norm of difference is ", differencenorm) return differencenorm def approx_fhess_p(x0,p,fprime,epsilon,*args): f2 = apply(fprime,(x0+epsilon*p,)+args) f1 = apply(fprime,(x0,)+args) return (f2 - f1)/epsilon def safe_res(f,x,args): """ Applies f to x. Returns f(x) and cost = sum(f(x)**2). In the case that cost = NaN, returns cost = inf. In the case of an exception, returns res = None, cost = inf. """ try: res = asarray(apply(f,(x,)+args)) cost = sum(res**2) except (SloppyCell.Utility.SloppyCellException,OverflowError): res = None cost = scipy.inf if scipy.isnan(cost): cost = scipy.inf return res, cost def safe_fprime(fprime,x,args): """ Applies fprime to x. Returns j and exit code. For nonzero exit codes, j is returned as None. Exit code 0: No errors. Exit code 3: Jacobian contains NaN or inf. Exit code 4: Exception in Jacobian calculation. """ try: j = asarray(apply(fprime,(x,)+args)) err = 0 except SloppyCell.Utility.SloppyCellException: j = None err = 4 if j is not None: if ( scipy.isnan(j).any() or scipy.isinf(j).any() ): j = None err = 3 return j, err def fmin_lm(f, x0, fprime=None, args=(), avegtol=1e-5, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, lambdainit = None, jinit = None, trustradius = 1.0): """Minimizer for a nonlinear least squares problem. Allowed to have more residuals than parameters or vice versa. f : residual function (function of parameters) fprime : derivative of residual function with respect to parameters. Should return a matrix (J) with dimensions number of residuals by number of parameters. x0 : initial parameter set avegtol : convergence tolerance on the gradient vector epsilon : size of steps to use for finite differencing of f (if fprime not passed in) maxiter : maximum number of iterations full_output : 0 to get only the minimum set of parameters back 1 if you also want the best parameter set, the lowest value of f, the number of function calls, the number of gradient calls, the convergence flag, the last Marquardt parameter used (lambda), and the last evaluation of fprime (J matrix) disp : 0 for no display, 1 to give cost at each iteration and convergence conditions at the end retall : 0 for nothing extra to be returned, 1 for all the parameter sets during the optimization to be returned lambdainit : initial value of the Marquardt parameter to use (useful if continuing from an old optimization run jinit : initial evaluation of the residual sensitivity matrix (J). trustradius : set this to the maximum move you want to allow in a single parameter direction. If you are using log parameters, then setting this to 1.0, for example, corresponds to a multiplicative change of exp(1) = 2.718 """ app_fprime = 0 if fprime is None: app_fprime = 1 xcopy = copy.copy(x0) if isinstance(x0,KeyedList) : x0 = asarray(x0.values()) else : x0 = asarray(x0) if lambdainit != None : Lambda = lambdainit else : Lambda = 1.0e-2 Mult = 10.0 n = len(x0) func_calls = 0 grad_calls = 0 res,currentcost = safe_res(f,x0,args) func_calls+=1 m = res.shape[0] if maxiter is None : maxiter = 200*n niters = 0 x = x0 gtol = n*avegtol if retall: allvecs = [x] x1 = x0 x2 = x0 d = zeros(n,scipy.float_) move = zeros(n,scipy.float_) finish = 0 if jinit!=None : j = jinit else : if app_fprime : j = asarray(apply(approx_fprime2,(x,f,epsilon)+args)) func_calls = func_calls + 2*len(x) else : j,err = safe_fprime(fprime,x,args) if err: finish = err grad_calls+=1 # NOTE: Below is actually *half* the gradient (because # we define the cost as the sum of squares of residuals) # However the equations defining the optimization move, dp, # are 2.0*J^tJ dp = -2.0*J^t r, where r is the residual # vector; therefore, the twos cancel both sides if j is not None: grad = mat(res)*mat(j) while (niters<maxiter) and (finish == 0): # note: grad, res and j will be available from the end of the # last iteration. They just need to be computed the zeroth # time aswell (above) lmh = mat(transpose(j))*mat(j) # use more accurate way to get e-vals/dirns #[u,s,v] = scipy.linalg.svd(lmh) [u,ssqrt,vt] = scipy.linalg.svd(j) # want n singular values even if m<n and we have # more parameters than data points. if (len(ssqrt) == n) : s = ssqrt**2 elif (len(ssqrt)<n) : s = zeros((n,),scipy.float_) s[0:len(ssqrt)] = ssqrt**2 #print "s is (in original) ", s #rhsvect = -mat(transpose(u))*mat(transpose(grad)) rhsvect = -mat(vt)*mat(transpose(grad)) rhsvect = asarray(rhsvect)[:,0] move = abs(rhsvect)/(s+Lambda*scipy.ones(n)+1.0e-30*scipy.ones(n)) move = list(move) maxindex = move.index(max(move)) move = asarray(move) if max(move) > trustradius : Lambda = Mult*(1.0/trustradius*abs(rhsvect[maxindex])-s[maxindex]) #print " Increasing lambda to ", Lambda # now do the matrix inversion for i in range(0,n) : if (s[i]+Lambda) < 1.0e-30 : d[i] = 0.0 else : d[i] = 1.0/(s[i]+Lambda) move[i] = d[i]*rhsvect[i] move = asarray(move) # move = asarray(mat(transpose(v))*mat(transpose(mat(move))))[:,0] move = asarray(mat(transpose(vt))*mat(transpose(mat(move))))[:,0] # print move x1 = x + move moveold = move[:] for i in range(0,n) : if (s[i]+Lambda/Mult) < 1.0e-30 : d[i] = 0.0 else : d[i] = 1.0/(s[i]+Lambda/Mult) move[i] = d[i]*rhsvect[i] move = asarray(mat(transpose(vt))*mat(transpose(mat(move))))[:,0] x2 = x + asarray(move) _,currentcost = safe_res(f,x,args) func_calls+=1 res2,costlambdasmaller = safe_res(f,x2,args) func_calls+=1 res1,costlambda = safe_res(f,x1,args) func_calls+=1 if disp : print('Iteration number', niters) print('Current cost', currentcost) print("Move 1 gives cost of" , costlambda) print("Move 2 gives cost of ", costlambdasmaller) #fp = open('LMoutfile','a') #fp.write('Iteration number ' + niters.__str__() + '\n') #fp.write('Current cost ' + currentcost.__str__() + '\n') #fp.write('Move 1 gives cost of ' + costlambda.__str__() + '\n') #fp.write('Move 2 gives cost of ' + costlambdasmaller.__str__() + '\n') #fp.close() oldcost = currentcost oldres = res oldjac = j if costlambdasmaller <= currentcost : xprev = x[:] Lambda = Lambda/Mult x = x2[:] if retall: allvecs.append(x) currentcost = costlambdasmaller if app_fprime : j = asarray(apply(approx_fprime2,(x2,f,epsilon)+args)) func_calls = func_calls + 2*len(x2) else : j,err = safe_fprime(fprime,x2,args) if err: x = xprev[:] finish = err grad_calls+=1 if j is not None: grad = mat(res2)*mat(j) if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 elif costlambda <= currentcost : xprev = x[:] currentcost = costlambda x = x1[:] move = moveold[:] if retall: allvecs.append(x) if app_fprime : j = asarray(apply(approx_fprime2,(x1,f,epsilon)+args)) func_calls = func_calls + 2*len(x1) else : j,err = safe_fprime(fprime,x1,args) if err: x = xprev[:] finish = err grad_calls+=1 if j is not None: grad = mat(res1)*mat(j) if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 else : Lambdamult = Lambda costmult = costlambda piOverFour = .78539816339744825 NTrials = 0 NTrials2 = 0 move = moveold[:] while (costmult > currentcost) and (NTrials < 10) : num = -scipy.dot(grad,move)[0] den = scipy.linalg.norm(grad)*scipy.linalg.norm(move) gamma = scipy.arccos(num/den) NTrials = NTrials+1 # was (gamma>piOverFour) below but that doens't # make much sense to me. I don't think you should # cut back on a given step, I think the trust # region strategy is more successful if (gamma > 0) : Lambdamult = Lambdamult*Mult for i in range(0,n) : if s[i]+Lambdamult < 1.0e-30 : d[i] = 0.0 else : d[i] = 1.0/(s[i]+Lambdamult) move[i] = d[i]*rhsvect[i] move = asarray(mat(transpose(vt))*mat(transpose(mat(move))))[:,0] x1 = x + move res1,costmult = safe_res(f,x1,args) func_calls+=1 else : NTrials2 = 0 while (costmult > currentcost) and (NTrials2 < 10) : NTrials2 = NTrials2 + 1 if disp == 1: print(" Decreasing stepsize ") move = (.5)**NTrials2*moveold x1 = x + asarray(move) res1,costmult = safe_res(f,x1,args) func_calls+=1 if (NTrials==10) or (NTrials2==10) : if disp == 1: print(" Failed to converge") finish = 1 else : xprev = x[:] x = x1[:] if retall: allvecs.append(x) Lambda = Lambdamult if app_fprime : j = asarray(apply(approx_fprime2,(x,f,epsilon)+args)) func_calls = func_calls + 2*len(x) else : j,err = safe_fprime(fprime,x,args) if err: x = xprev[:] finish = err grad_calls+=1 if j is not None: grad = mat(res1)*mat(j) currentcost = costmult if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 niters = niters + 1 # see if we need to reduce the trust region newmodelval = oldres+asarray(mat(oldjac)*mat(transpose(mat(move))))[:,0] oldmodelval = oldres #print oldcost-sum(newmodelval**2) #print trustradius if ((oldcost-sum(newmodelval**2))>1.0e-16) : ratio = (oldcost-currentcost)/(oldcost-sum(newmodelval**2)) if ratio < .25 : trustradius = trustradius/2.0 if ratio >.25 and ratio<=.75 : trustradius = trustradius if ratio > .75 and trustradius<10.0 : trustradius = 2.0*trustradius #save(x,'currentParamsLM') if disp : if (niters>=maxiter) and (finish != 2) : print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) print(" Maximum number of iterations exceeded with no convergence ") if (finish == 2) : print(" Optimization terminated successfully.") print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) if (finish == 3) : print(" Optimization aborted: Jacobian contains nan or inf.") print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) if (finish == 4) : print(" Optimization aborted: Exception in Jacobian calculation.") print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) if isinstance(xcopy,KeyedList) : xcopy.update(x) else : xcopy = x if full_output: retlist = xcopy, currentcost, func_calls, grad_calls, finish, Lambda, j if retall: retlist += (allvecs,) else : retlist = xcopy if retall : retlist = (xcopy,allvecs) return retlist def fmin_lmNoJ(fcost, x0, fjtj, args=(), avegtol=1e-5, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0, trustradius=1.0): """Minimizer for a nonlinear least squares problem. Allowed to have more residuals than parameters or vice versa fcost : the cost function (*not* the residual function) fjtj : this function must return back an ordered pair, the first entry is the gradient of the cost and the second entry is the Levenberg Marquardt (LM) approximation to the cost function. NOTE: If the cost function = 1/2 * sum(residuals**2) then the LM approximation is the matrix matrix product J^t J where J = derivative of residual function with respect to parameters. However if cost = k*sum(residuals**2) for some constant k, then the LM approximation is 2*k*J^t J, so beware of this factor!!! x0 : initial parameter set avegtol : convergence tolerance on the gradient vector epsilon : size of steps to use for finite differencing of f (if fprime not passed in) maxiter : maximum number of iterations full_output : 0 to get only the minimum set of parameters back 1 if you also want the best parameter set, the lowest value of f, the number of function calls, the number of gradient calls, the convergence flag, the last Marquardt parameter used (lambda), and the last evaluation of fprime (J matrix) disp : 0 for no display, 1 to give cost at each iteration and convergence conditions at the end retall : 0 for nothing extra to be returned, 1 for all the parameter sets during the optimization to be returned trustradius : set this to the maximum move you want to allow in a single parameter direction. If you are using log parameters, then setting this to 1.0, for example, corresponds to a multiplicative change of exp(1) = 2.718 This version requires fjtj to pass back an ordered pair with a gradient evaluation of the cost and JtJ, but not a function for J. This is important in problems when there is many residuals and J is too cumbersome to compute and pass around, but JtJ is a lot "slimmer". """ xcopy = copy.copy(x0) if isinstance(x0,KeyedList) : x0 = asarray(x0.values()) else : x0 = asarray(x0) Lambda = 1.0e-02 Mult = 10.0 n = len(x0) func_calls = 0 grad_calls = 0 if maxiter==None : maxiter = 200*n niters = 0 x = x0 gtol = n*avegtol if retall: allvecs = [x] x1 = x0 x2 = x0 d = zeros(n,scipy.float_) move = zeros(n,scipy.float_) finish = 0 grad, lmh = apply(fjtj,(x,)) grad_calls+=1 while (niters<maxiter) and (finish == 0): # estimate what Lambda should be [u,s,v] = scipy.linalg.svd(lmh) #print "s is (in NoJ) ", s #s,u = scipy.linalg.eig(lmh) #s = real(s) #u = real(u) oldlmh = lmh[:,:] oldgrad = grad[:] rhsvect = -scipy.dot(transpose(u),grad) # rhsvect = asarray(rhsvect)[:,0] move = abs(rhsvect)/(s+Lambda*ones(n)+1.0e-30*ones(n)) move = list(move) maxindex = move.index(max(move)) move = asarray(move) if max(move) > trustradius : Lambda = Mult*(1.0/trustradius*abs(rhsvect[maxindex])-s[maxindex]) #print " Increasing lambda to ", Lambda ## lmhreg = lmh + Lambda*eye(n,n,typecode=scipy.float_) ## [u,s,v] = scipy.linalg.svd(lmhreg) rhsvect = -scipy.dot(transpose(u),grad) # rhsvect = asarray(rhsvect)[:,0] for i in range(0,len(s)) : if (s[i]+Lambda) < 1.0e-30 : d[i] = 0.0 else : d[i] = 1.0/(s[i]+Lambda) move[i] = d[i]*rhsvect[i] move = asarray(move) move = dot(asarray(u),move) x1 = x + move moveold = move[:] for i in range(0,len(s)) : if (s[i]+Lambda/Mult) < 1.0e-30 : d[i] = 0.0 else : d[i] = 1.0/(s[i]+Lambda/Mult) move[i] = d[i]*rhsvect[i] move = asarray(move) move = dot(asarray(u),move) x2 = x + asarray(move) currentcost = apply(fcost,(x,)) oldcost = currentcost func_calls+=1 try: costlambdasmaller = apply(fcost,(x2,)) except SloppyCell.Utility.SloppyCellException: costlambdasmaller = scipy.inf func_calls+=1 try: costlambda = apply(fcost,(x1,)) except SloppyCell.Utility.SloppyCellException: costlambda = scipy.inf func_calls+=1 if disp : print('Iteration number', niters) print('Current cost', currentcost) print("Move 1 gives cost of" , costlambda) print("Move 2 gives cost of ", costlambdasmaller) #fp = open('LMoutfile','a') #fp.write('Iteration number ' + niters.__str__() + '\n') #fp.write('Current cost ' + currentcost.__str__() + '\n') #fp.write('Move 1 gives cost of ' + costlambda.__str__() + '\n') #fp.write('Move 2 gives cost of ' + costlambdasmaller.__str__() + '\n') #fp.close() if costlambdasmaller <= currentcost : Lambda = Lambda/Mult x = x2[:] if retall: allvecs.append(x) currentcost = costlambdasmaller grad, lmh = apply(fjtj,(x2,)) grad_calls+=1 #if scipy.linalg.norm(asarray(grad)) < avegtol : if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 elif costlambda <= currentcost : currentcost = costlambda move = moveold[:] x = x1[:] if retall: allvecs.append(x) grad, lmh = apply(fjtj,(x1,)) grad_calls+=1 # if scipy.linalg.norm(asarray(grad)) < avegtol : if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 else : Lambdamult = Lambda costmult = costlambda piOverFour = .78539816339744825 NTrials2 = 0 NTrials = 0 while (costmult > currentcost) and (NTrials < 10) : # num = -dot(transpose(asarray(grad)),asarray(moveold) ) # den = scipy.linalg.norm(grad)*scipy.linalg.norm(moveold) gamma = .1 # scipy.arccos(num/den) NTrials = NTrials+1 if (gamma > 0) : Lambdamult = Lambdamult*Mult for i in range(0,len(s)) : if s[i] + Lambdamult < 1.0e-30 : d[i] = 0.0 else : d[i] = 1.0/(s[i] + Lambdamult) move[i] = d[i]*rhsvect[i] move = asarray(move) move = dot(asarray(u),move) x1 = x + asarray(move) func_calls+=1 costmult = apply(fcost,(x1,)) else : NTrials2 = 0 while (costmult > currentcost) and (NTrials2 < 10) : NTrials2 = NTrials2 + 1 if disp : print(" Decreasing stepsize ") move = (.5)**NTrials2*moveold x1 = x + asarray(moveold) func_calls+=1 costmult = apply(fcost,(x1,)) if (NTrials==10) or (NTrials2==10) : if disp : print(" Failed to converge") finish = 1 else : x = x1[:] if retall: allvecs.append(x) Lambda = Lambdamult grad, lmh = apply(fjtj,(x1,)) grad_calls+=1 currentcost = costmult # if scipy.linalg.norm(grad) < avegtol : if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 niters = niters + 1 # see if we need to reduce the trust region, compare the actual change in # cost to the linear and quadratic change in cost model_change = scipy.dot(scipy.transpose(oldgrad),move) + \ .5*scipy.dot(scipy.transpose(move),scipy.dot(oldlmh,move) ) #print oldcost-sum(newmodelval**2) #print trustradius if model_change>1.0e-16 : ratio = (oldcost-currentcost)/(model_change) if ratio < .25 : trustradius = trustradius/2.0 if ratio >.25 and ratio<=.75 : trustradius = trustradius if ratio > .75 and trustradius<10.0 : trustradius = 2.0*trustradius #save(x,'currentParamsLM') if disp : if (niters>=maxiter) and (finish != 2) : print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) print(" Maximum number of iterations exceeded with no convergence ") if (finish == 2) : print("Optimization terminated successfully.") print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) if isinstance(xcopy,KeyedList) : xcopy.update(x) else : xcopy = x if full_output: retlist = xcopy, currentcost, func_calls, grad_calls, finish, Lambda, lmh if retall: retlist += (allvecs,) else: retlist = xcopy if retall: retlist = (xcopy, allvecs) return retlist def solve_lmsys(Lambda,s,g,rhsvect,currentcost,n) : d = zeros(n,scipy.float_) move = zeros(n,scipy.float_) for i in range(0,n) : if s[i] < 1.0e-20 : d[i] = 0.0 else : d[i] = 1.0/(s[i]) move[i] = d[i]*rhsvect[i] return move def fmin_lm_scale(f, x0, fprime=None, args=(), avegtol=1e-5, epsilon=_epsilon, maxiter=None, full_output=0, disp=1, retall=0,trustradius=1.0): """ Minimizer for a nonlinear least squares problem. Allowed to have more residuals than parameters or vice versa. f : residual function (function of parameters) fprime : derivative of residual function with respect to parameters. Should return a matrix (J) with dimensions number of residuals by number of parameters. x0 : initial parameter set avegtol : convergence tolerance on the gradient vector epsilon : size of steps to use for finite differencing of f (if fprime not passed in) maxiter : maximum number of iterations full_output : 0 to get only the minimum set of parameters back 1 if you also want the best parameter set, the lowest value of f, the number of function calls, the number of gradient calls, the convergence flag, the last Marquardt parameter used (lambda), and the last evaluation of fprime (J matrix) disp : 0 for no display, 1 to give cost at each iteration and convergence conditions at the end retall : 0 for nothing extra to be returned, 1 for all the parameter sets during the optimization to be returned trustradius : set this to the maximum length of move you want. If you are using log parameters, then setting this to 1.0, for example, corresponds to a multiplicative change of exp(1) = 2.718 if the move is along a single parameter direction This version is scale invariant. This means that under a change of scale of the parameters the direction the optimizer chooses to move in does not change. To achieve this, we don't use a Marquardt parameter to impose a trust region but rather take the infinite trust region step and just cut it back to the length given in the variable trustradius. """ app_fprime = 0 if fprime is None: app_fprime = 1 xcopy = copy.copy(x0) if isinstance(x0,KeyedList) : x0 = asarray(x0.values()) else : x0 = asarray(x0) Lambda = 1.0e-02 Mult = 10.0 n = len(x0) func_calls = 0 grad_calls = 0 res = asarray(apply(f,(x0,))) m = res.shape[0] if maxiter is None : maxiter = 200*n niters = 0 x = x0 gtol = n*avegtol if retall: allvecs = [x] x1 = x0 x2 = x0 d = zeros(n,scipy.float_) move = zeros(n,scipy.float_) finish = 0 if app_fprime : j = asarray(apply(approx_fprime2,(x,f,epsilon)+args)) func_calls = func_calls + 2*len(x) else : j = asarray(apply(fprime,(x,))) grad_calls+=1 res = asarray(apply(f,(x,))) func_calls+=1 grad = mat(res)*mat(j) while (niters<maxiter) and (finish == 0): # note: grad, res and j will be available from the end of the # last iteration. They just need to be computed the zeroth # time aswell (above) lmh = mat(transpose(j))*mat(j) # use more accurate way to get e-vals/dirns #[u,s,v] = scipy.linalg.svd(lmh) [u,ssqrt,vt] = scipy.linalg.svd(j) # want n singular values even if m<n and we have # more parameters than data points. if (len(ssqrt) == n) : s = ssqrt**2 elif (len(ssqrt)<n) : s = zeros((n,),scipy.float_) s[0:len(ssqrt)] = ssqrt**2 #rhsvect = -mat(transpose(u))*mat(transpose(grad)) rhsvect = -mat(vt)*mat(transpose(grad)) rhsvect = asarray(rhsvect)[:,0] currentcost = sum(asarray(apply(f,(x,)))**2) g = asarray(grad)[0,:] Lambda = 0 move = solve_lmsys(Lambda,s,g,rhsvect,currentcost,n) move = asarray(move) move = asarray(mat(transpose(vt))*mat(transpose(mat(move))))[:,0] unitmove = move/(scipy.linalg.norm(move)) move1 = unitmove*trustradius # print move x1 = x + move1 move2 = unitmove*trustradius*Mult x2 = x + asarray(move2) func_calls+=1 try: res2 = asarray(apply(f,(x2,))) costlambdasmaller = sum(res2**2) except SloppyCell.Utility.SloppyCellException: costlambdasmaller = scipy.inf func_calls+=1 try: res1 = asarray(apply(f,(x1,))) costlambda = sum(res1**2) except SloppyCell.Utility.SloppyCellException: costlambda = scipy.inf func_calls+=1 if disp : print("Cost is ", currentcost) print("Iteration is", niters) oldcost = currentcost oldres = res oldjac = j if costlambdasmaller <= currentcost : trustradius = trustradius*Mult x = x2 if retall: allvecs.append(x) currentcost = costlambdasmaller if app_fprime : j = asarray(apply(approx_fprime2,(x2,f,epsilon)+args)) func_calls = func_calls + 2*len(x2) else : j = asarray(apply(fprime,(x2,))) grad_calls+=1 grad = mat(res2)*mat(j) if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 move = move2 elif costlambda <= currentcost : currentcost = costlambda x = x1 if retall: allvecs.append(x) if app_fprime : j = asarray(apply(approx_fprime2,(x1,f,epsilon)+args)) func_calls = func_calls + 2*len(x1) else : j = asarray(apply(fprime,(x1,))) grad_calls+=1 grad = mat(res1)*mat(j) if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 move = move1 else : trustradmult = trustradius costmult = costlambda NTrials = 0 move = unitmove while (costmult > currentcost) and (NTrials < 100) : while (costmult > currentcost) and (NTrials < 100) : NTrials = NTrials + 1 #print " Decreasing stepsize " trustradmult = trustradmult/2.0 move = move*trustradmult x1 = x + asarray(move) res1 = asarray(apply(f,(x1,))) func_calls+=1 costmult = sum(res1**2) if (NTrials==100) : if disp : print(" Failed to converge") finish = 1 else : x = x1 if retall: allvecs.append(x) trustradius = trustradmult if app_fprime : j = asarray(apply(approx_fprime2,(x,f,epsilon)+args)) func_calls = func_calls + 2*len(x) else : j = asarray(apply(fprime,(x,))) grad_calls+=1 grad = mat(res1)*mat(j) currentcost = costmult if sum(abs(2.0*grad), axis=None) < gtol : finish = 2 niters = niters + 1 # see if we need to reduce the trust region newmodelval = oldres+asarray(mat(oldjac)*mat(transpose(mat(move))))[:,0] oldmodelval = oldres #print oldcost-sum(newmodelval**2) #print trustradius if ((oldcost-sum(newmodelval**2))>1.0e-16) : ratio = (oldcost-currentcost)/(oldcost-sum(newmodelval**2)) if ratio < .25 : trustradius = trustradius/2.0 if ratio >.25 and ratio<=.75 : trustradius = trustradius if ratio > .75 and trustradius<10.0 : trustradius = 2.0*trustradius if disp : if (niters>=maxiter) and (finish != 2) : print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) print(" Maximum number of iterations exceeded with no convergence ") if (finish == 2) : print("Optimization terminated successfully.") print(" Current function value: %f" % currentcost) print(" Iterations: %d" % niters) print(" Function evaluations: %d" % func_calls) print(" Gradient evaluations: %d" % grad_calls) if isinstance(xcopy,KeyedList) : xcopy.update(x) else : xcopy = x if full_output: retlist = xcopy, currentcost, func_calls, grad_calls, finish, Lambda, j if retall: retlist += (allvecs,) else: retlist = xcopy if retall: retlist = (xcopy, allvecs) return retlist
37.134694
98
0.534348
4,412
36,392
4.361287
0.100181
0.021515
0.008315
0.008315
0.758081
0.727315
0.716921
0.693951
0.675761
0.656792
0
0.027642
0.360794
36,392
979
99
37.172625
0.799544
0.251896
0
0.808759
0
0
0.060336
0
0
0
0
0
0
1
0.016058
false
0
0.010219
0
0.042336
0.084672
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
a66796a9ad19843f2d5c5dd8998d33f90364704e
31,881
py
Python
if97/h2o.py
nikolai-kummer/iapws
9746a653a7588c2993d44a6122a8d99f5acd70e5
[ "MIT" ]
5
2017-09-15T03:24:08.000Z
2018-09-17T04:34:10.000Z
if97/h2o.py
nikolai-kummer/iapws
9746a653a7588c2993d44a6122a8d99f5acd70e5
[ "MIT" ]
null
null
null
if97/h2o.py
nikolai-kummer/iapws
9746a653a7588c2993d44a6122a8d99f5acd70e5
[ "MIT" ]
1
2018-10-04T21:52:54.000Z
2018-10-04T21:52:54.000Z
from if97 import region1, region2, region3, region4 ########################################################### ##### Pressure-Temperature Formulation ##### ########################################################### def idRegion(P, T): """Identification of region from IF97 specification using pressure and temperature as primary varibles""" # Constant boundaries Pbnd0 = region1.Pbnd0 Pbnd1 = region1.Pbnd1 Tbnd01 = region1.Tbnd01 Tbnd25 = region2.Tbnd25 Tbnd13 = region1.Tbnd13 # non-constant boundaries Pbnd32 = region3.bnd23P(min(max(T, Tbnd13), 863.15)) Pbnd4 = satP(min(max(T, Tbnd01), Tbnd13)) region = 0 if (P >= Pbnd0) and (T >= Tbnd01) and (P <= Pbnd1) and (T <= Tbnd25): if (T <= Tbnd13) and (P >= Pbnd4): region = 1 elif (T < Tbnd13) or (P <= Pbnd32): region = 2 else: # region 3 via P,T relations not implemented region = 0 assert (region is not 0), "Water properties not avalable!" return region #### water properties #### def g(P, T, region = 0): """Specific gibbs free energy [kJ / kg K]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.g(P, T) elif region is 2: return region2.g(P, T) else: return 0.000 def v(P, T, region = 0): """Specific volume [m^3 / kg]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.v(P, T) elif region is 2: return region2.v(P, T) else: return 0.000 def u(P, T, region = 0): """Specific internal energy [kJ / kg]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.u(P, T) elif region is 2: return region2.u(P, T) else: return 0.000 def s(P, T, region = 0): """Specific entropy [kJ / kg K]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.s(P, T) elif region is 2: return region2.s(P, T) else: return 0.000 def h(P, T, region = 0): """Specific enthalpy [kJ / kg]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.h(P, T) elif region is 2: return region2.h(P, T) else: return 0.000 def cp(P, T, region = 0): """ Specific isobaric heat capacity [kJ / kg K]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.cp(P, T) elif region is 2: return region2.cp(P, T) else: return 0.000 def cv(P, T, region = 0): """ Specific isochoric heat capacity [kJ / kg K]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.cv(P, T) elif region is 2: return region2.cv(P, T) else: return 0.000 def w(P, T, region = 0): """ Speed of sound [m / s]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.w(P, T) elif region is 2: return region2.w(P, T) else: return 0.000 def a(P, T, region = 0): """Isobaric cubic expansion coefficient [1 / K]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.a(P, T) elif region is 2: return region2.a(P, T) else: return 0.000 def k(P, T, region = 0): """Isothermal compressibility [kg / kJ]""" if region is 0: region = idRegion(P, T) if region is 1: return region1.k(P, T) elif region is 2: return region2.k(P, T) else: return 0.000 #### water property derivatives #### def dgdP(P, T, region = 0): """ Derivative of specific gibbs free energy [kJ m^3 / kg kJ] w.r.t pressure at constant temperature""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dgdP(P, T) elif region is 2: return region2.dgdP(P, T) else: return 0.000 def dvdP(P, T, region = 0): """ Derivative of specific volume [m^3 m^3 / kg kJ] w.r.t pressure at constant temperature""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dvdP(P, T) elif region is 2: return region2.dvdP(P, T) else: return 0.000 def dudP(P, T, region = 0): """ Derivative of specific internal energy [kJ m^3 / kg kJ] w.r.t pressure at constant temperature""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dudP(P, T) elif region is 2: return region2.dudP(P, T) else: return 0.000 def dsdP(P, T, region = 0): """ Derivative of specific entropy [kJ m^3 / kg K kJ] w.r.t pressure at constant temperature""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dsdP(P, T) elif region is 2: return region2.dsdP(P, T) else: return 0.000 def dhdP(P, T, region = 0): """ Derivative of specific enthalpy [kJ m^3 / kg kJ] w.r.t pressure at constant temperature""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dhdP(P, T) elif region is 2: return region2.dhdP(P, T) else: return 0.000 def dgdT(P, T, region = 0): """ Derivative of specific gibbs free energy [kJ / kg K] w.r.t temperature at constant pressure""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dgdT(P, T) elif region is 2: return region2.dgdT(P, T) else: return 0.000 def dvdT(P, T, region = 0): """ Derivative of specific volume [m^3 / kg K] w.r.t temperature at constant pressure""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dvdT(P, T) elif region is 2: return region2.dvdT(P, T) else: return 0.000 def dudT(P, T, region = 0): """ Derivative of specific internal energy [kJ / kg K] w.r.t temperature at constant pressure""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dudT(P, T) elif region is 2: return region2.dudT(P, T) else: return 0.000 def dsdT(P, T, region = 0): """ Derivative of specific entropy [kJ / kg K K] w.r.t temperature at constant pressure""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dsdT(P, T) elif region is 2: return region2.dsdT(P, T) else: return 0.000 def dhdT(P, T, region = 0): """ Derivative of specific enthalpy [kJ / kg K] w.r.t temperature at constant pressure""" if region is 0: region = idRegion(P, T) if region is 1: return region1.dhdT(P, T) elif region is 2: return region2.dhdT(P, T) else: return 0.000 ########################################################### ##### Pressure-Enthalpy Formulation ##### ########################################################### def idRegion_h(P, h): """Identification of region from IF97 specification using pressure and enthalpy as primary variables""" # supporting boundaries Tbnd01 = region1.Tbnd01 Pbnd4 = satP(Tbnd01) Tbnd25 = region2.Tbnd25 Tbnd13 = region1.Tbnd13 Tbnd32 = region3.bnd23T(min(max(P, 16.5292), 100.0)) Tbnd4 = satT(P) # Enthalpy- pressure boundaries Pbnd0 = region1.Pbnd0 Pbnd1 = region1.Pbnd1 hbnd01 = region1.h(Pbnd4, Tbnd01) hbnd25 = region2.h(Pbnd0, Tbnd25) Pbndh1 = satP(Tbnd13) hbnd13 = region1.h(P, Tbnd13) hbnd32 = region2.h(P, Tbnd32) hbnd14 = region1.h(P, Tbnd4) hbnd42 = region2.h(P, Tbnd4) region = 0 if (P >= Pbnd0) and (h >= hbnd01) and (P <= Pbnd1) and (h <= hbnd25): if (P >= Pbndh1): if (h <= hbnd13): region = 1 elif (h >= hbnd32): region = 2 else: # region 3 via P,h relations not implemented region = 0 else: if (h <= hbnd14): region = 1 elif (h >= hbnd42): region = 2 else: region = 4 assert (region is not 0), "Water properties not avalable!" return region #### water properties #### def g_h(P, h, region = 0): """Specific gibbs free energy [kJ / kg]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.g_h(P, h) elif region is 2: return region2.g_h(P, h) elif region is 4: return region4.g_h(P, h) else: return 0.000 def v_h(P, h, region = 0): """Specific volume [m^3 / kg]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.v_h(P, h) elif region is 2: return region2.v_h(P, h) elif region is 4: return region4.v_h(P, h) else: return 0.000 def u_h(P, h, region = 0): """Specific internal energy [kJ / kg]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.u_h(P, h) elif region is 2: return region2.u_h(P, h) elif region is 4: return region4.u_h(P, h) else: return 0.000 def s_h(P, h, region = 0): """Specific entropy [kJ / kg K]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.s_h(P, h) elif region is 2: return region2.s_h(P, h) elif region is 4: return region4.s_h(P, h) else: return 0.000 def T_h(P, h, region = 0): """ Temperature [K]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.T_h(P, h) elif region is 2: return region2.T_h(P, h) elif region is 4: return region4.satT(P) else: return 0.000 def cp_h(P, h, region = 0): """ Specific isobaric heat capacity [kJ / kg K]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.cp_h(P, h) elif region is 2: return region2.cp_h(P, h) elif region is 4: return region4.cp_h(P, h) else: return 0.000 def cv_h(P, h, region = 0): """ Specific isochoric heat capacity [kJ / kg K]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.cv_h(P, h) elif region is 2: return region2.cv_h(P, h) elif region is 4: return region4.cv_h(P, h) else: return 0.000 def w_h(P, h, region = 0): """ Speed of sound [m / s]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.w_h(P, h) elif region is 2: return region2.w_h(P, h) elif region is 4: return region4.w_h(P, h) else: return 0.000 def a_h(P, h, region = 0): """Isobaric cubic expansion coefficient [1 / K]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.a_h(P, h) elif region is 2: return region2.a_h(P, h) elif region is 4: return region4.a_h(P, h) else: return 0.000 def k_h(P, h, region = 0): """Isothermal compressibility [kg / kJ]""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.k_h(P, h) elif region is 2: return region2.k_h(P, h) elif region is 4: return region4.k_h(P, h) else: return 0.000 #### water property derivatives #### def dgdP_h(P, h, region = 0): """ Derivative of specific gibbs free energy [kJ m^3 / kg kJ] w.r.t pressure at constant specific enthalpy""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dgdP_h(P, h) elif region is 2: return region2.dgdP_h(P, h) elif region is 4: return region4.dgdP_h(P, h) else: return 0.000 def dvdP_h(P, h, region = 0): """ Derivative of specific volume [m^3 m^3 / kg kJ] w.r.t pressure at constant specific enthalpy""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dvdp_h(P, h) elif region is 2: return region2.dvdP_h(P, h) elif region is 4: return region4.dvdP_h(P, h) else: return 0.000 def dudP_h(P, h, region = 0): """ Derivative of specific internal energy [kJ m^3 / kg kJ] w.r.t pressure at constant specific enthalpy""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dudP_h(P, h) elif region is 2: return region2.dudP_h(P, h) elif region is 4: return region4.dudP_h(P, h) else: return 0.000 def dsdP_h(P, h, region = 0): """ Derivative of specific entropy [kJ m^3 / kg K kJ] w.r.t pressure at constant specific enthalpy""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dsdP_h(P, h) elif region is 2: return region2.dsdP_h(P, h) elif region is 4: return region4.dsdP_h(P, h) else: return 0.000 def dhdP_h(P, h, region = 0): """ Derivative of specific enthalpy [kJ m^3 / kg kJ] w.r.t pressure at constant specific enthalpy""" if region is 0: region = idRegion_h(P, h) if region is 1: return 0.000 elif region is 2: return 0.000 elif region is 4: return region4.dhdP_h(P, h) else: return 0.000 def dTdP_h(P, h, region = 0): """ Derivative of Temperature [K m^3 / kJ] w.r.t pressure at constant specific enthalpy""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dTdP_h(P, h) elif region is 2: return region2.dTdP_h(P, h) elif region is 4: return region4.dTsdP(P) else: return 0.000 def dgdh_h(P, h, region = 0): """ Derivative of specific gibbs free energy [kJ kg / kg kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dgdh_h(P, h) elif region is 2: return region2.dgdh_h(P, h) elif region is 4: return region4.dgdh_h(P, h) else: return 0.000 def dvdh_h(P, h, region = 0): """ Derivative of specific volume [m^3 kg / kg kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dvdh_h(P, h) elif region is 2: return region2.dvdh_h(P, h) elif region is 4: return region4.dvdh_h(P, h) else: return 0.000 def dudh_h(P, h, region = 0): """ Derivative of specific internal energy [kJ kg / kg kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dudh_h(P, h) elif region is 2: return region2.dudh_h(P, h) elif region is 4: return region4.dudh_h(P, h) else: return 0.000 def dsdh_h(P, h, region = 0): """ Derivative of specific entropy [kJ kg / kg K kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dsdh_h(P, h) elif region is 2: return region2.dsdh_h(P, h) elif region is 4: return region4.dsdh_h(P, h) else: return 0.000 def dhdh_h(P, h, region = 0): """ Derivative of specific enthalpy [kJ kg / kg kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return 1.000 elif region is 2: return 1.000 elif region is 4: return 1.000 else: return 0.000 def dTdh_h(P, h, region = 0): """ Derivative of Temperature [K kg / kJ] w.r.t specific enthalpy at constant pressure""" if region is 0: region = idRegion_h(P, h) if region is 1: return region1.dTdh_h(P, h) elif region is 2: return region2.dTdh_h(P, h) elif region is 4: return 0.000 else: return 0.000 ########################################################### ##### Pressure-Entropy Formulation ##### ########################################################### def idRegion_s(P, s): """Identification of region from IF97 specification using pressure and enthalpy as primary variables""" # supporting boundaries Tbnd01 = region1.Tbnd01 Pbnd4 = satP(Tbnd01) Tbnd25 = region2.Tbnd25 Tbnd13 = region1.Tbnd13 Tbnd32 = region3.bnd23T(min(max(P, 16.5292), 100.0)) Tbnd4 = satT(P) # Enthalpy- pressure boundaries Pbnd0 = region1.Pbnd0 Pbnd1 = region1.Pbnd1 sbnd01 = region1.s(P, Tbnd01) sbnd25 = region2.s(P, Tbnd25) Pbndh1 = satP(Tbnd13) sbnd13 = region1.s(P, Tbnd13) sbnd32 = region2.s(P, Tbnd32) sbnd14 = region1.s(P, Tbnd4) sbnd42 = region2.s(P, Tbnd4) region = 0 if (P >= Pbnd0) and (s >= sbnd01) and (P <= Pbnd1) and (s <= sbnd25): if (P >= Pbndh1): if (s <= sbnd13): region = 1 elif (s >= sbnd32): region = 2 else: # region 3 via P,h relations not implemented region = 0 else: if (s <= sbnd14): region = 1 elif (s >= sbnd42): region = 2 else: region = 4 assert (region is not 0), "Water properties not avalable!" return region #### water properties #### def g_s(P, s, region = 0): """Specific gibbs free energy [kJ / kg]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.g_s(P, s) elif region is 2: return region2.g_s(P, s) elif region is 4: return region4.g_s(P, s) else: return 0.000 def v_s(P, s, region = 0): """Specific volume [m^3 / kg]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.v_s(P, s) elif region is 2: return region2.v_s(P, s) elif region is 4: return region4.v_s(P, s) else: return 0.000 def u_s(P, s, region = 0): """Specific internal energy [kJ / kg]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.u_s(P, s) elif region is 2: return region2.u_s(P, s) elif region is 4: return region4.u_s(P, s) else: return 0.000 def T_s(P, s, region = 0): """ Temperature [K]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.T_s(P, s) elif region is 2: return region2.T_s(P, s) elif region is 4: return region4.satT(P) else: return 0.000 def h_s(P, s, region = 0): """Specific entropy [kJ / kg]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.h_s(P, s) elif region is 2: return region2.h_s(P, s) elif region is 4: return region4.h_s(P, s) else: return 0.000 def cp_s(P, s, region = 0): """ Specific isobaric heat capacity [kJ / kg K]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.cp_s(P, s) elif region is 2: return region2.cp_s(P, s) elif region is 4: return region4.cp_s(P, s) else: return 0.000 def cv_s(P, s, region = 0): """ Specific isochoric heat capacity [kJ / kg K]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.cv_s(P, s) elif region is 2: return region2.cv_s(P, s) elif region is 4: return region4.cv_s(P, s) else: return 0.000 def w_s(P, s, region = 0): """ Speed of sound [m / s]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.w_s(P, s) elif region is 2: return region2.w_s(P, s) elif region is 4: return region4.w_s(P, s) else: return 0.000 def a_s(P, s, region = 0): """Isobaric cubic expansion coefficient [1 / K]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.a_s(P, s) elif region is 2: return region2.a_s(P, s) elif region is 4: return region4.a_s(P, s) else: return 0.000 def k_s(P, s, region = 0): """Isothermal compressibility [kg / kJ]""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.k_s(P, s) elif region is 2: return region2.k_s(P, s) elif region is 4: return region4.k_s(P, s) else: return 0.000 #### water property derivatives #### def dgdP_s(P, s, region = 0): """ Derivative of specific gibbs free energy [kJ m^3 / kg kJ] w.r.t pressure at constant specific entropy""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dgdP_s(P, s) elif region is 2: return region2.dgdP_s(P, s) elif region is 4: return region4.dgdP_s(P, s) else: return 0.000 def dvdP_s(P, s, region = 0): """ Derivative of specific volume [m^3 m^3 / kg kJ] w.r.t pressure at constant specific entropy""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dvdP_s(P, s) elif region is 2: return region2.dvdP_s(P, s) elif region is 4: return region4.dvdP_s(P, s) else: return 0.000 def dudP_s(P, s, region = 0): """ Derivative of specific internal energy [kJ m^3 / kg kJ] w.r.t pressure at constant specific entropy""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dudP_s(P, s) elif region is 2: return region2.dudP_s(P, s) elif region is 4: return region4.dudP_s(P, s) else: return 0.000 def dsdP_s(P, s, region = 0): """ Derivative of specific entropy [kJ m^3 / kg K kJ] w.r.t pressure at constant specific/equilibrium entropy""" if region is 0: region = idRegion_s(P, s) if region is 1: return 0.000 elif region is 2: return 0.000 elif region is 4: return region4.dsdP_s(P, s) else: return 0.000 def dhdP_s(P, s, region = 0): """ Derivative of specific enthalpy [kJ m^3 / kg kJ] w.r.t pressure at constant specific entropy""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dhdP_s(P, s) elif region is 2: return region2.dhdP_s(P, s) elif region is 4: return region4.dhdP_s(P, s) else: return 0.000 def dTdP_s(P, s, region = 0): """ Derivative of Temperature [K m^3 / kJ] w.r.t pressure at constant specific entropy""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dTdP_s(P, s) elif region is 2: return region2.dTdP_s(P, s) elif region is 4: return region4.dTsdP(P) else: return 0.000 def dgds_s(P, s, region = 0): """ Derivative of specific gibbs free energy [kJ kg K / kg kJ] w.r.t specific entropy at constant pressure""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dgds_s(P, s) elif region is 2: return region2.dgds_s(P, s) elif region is 4: return region4.dgds_s(P, s) else: return 0.000 def dvds_s(P, s, region = 0): """ Derivative of specific volume [m^3 kg K / kg kJ] w.r.t specific entropy at constant pressure""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dvds_s(P, s) elif region is 2: return region2.dvds_s(P, s) elif region is 4: return region4.dvds_s(P, s) else: return 0.000 def duds_s(P, s, region = 0): """ Derivative of specific internal energy [kJ kg K / kg kJ] w.r.t specific entropy at constant pressure""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.duds_s(P, s) elif region is 2: return region2.duds_s(P, s) elif region is 4: return region4.duds_s(P, s) else: return 0.000 def dsds_s(P, s, region = 0): """ Derivative of specific entropy [kJ kg K / kg K kJ] w.r.t specific entropy at constant pressure""" if region is 0: region = idRegion_s(P, s) if region is 1: return 1.000 elif region is 2: return 1.000 elif region is 4: return 1.000 else: return 0.000 def dhds_s(P, s, region = 0): """ Derivative of specific enthalpy [kJ kg K / kg kJ] w.r.t specific entropy at constant pressure""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dhds_s(P, s) elif region is 2: return region2.dhds_s(P, s) elif region is 4: return region4.dhds_s(P, s) else: return 0.000 def dTds_s(P, s, region = 0): """ Derivative of Temperature [K kg K / kJ] w.r.t enthalpy at constant pressure""" if region is 0: region = idRegion_s(P, s) if region is 1: return region1.dTds_s(P, s) elif region is 2: return region2.dTds_s(P, s) elif region is 4: return 0.000 else: return 0.000 ########################################################### ##### Pressure Only (Saturation) Formulation ##### ########################################################### #### P-T saturation curves #### def satP(T): """ Saturation Pressure [Mpa] for specified Temperature""" return region4.satP(T) def satT(P): """ Saturation Temperature [K] for specified Pressure""" return region4.satT(P) #### Saturated liquid properties #### def gf(P): """ Specific gibbs free energy [kJ / kg] of saturated liquid""" return region4.gf(P) def vf(P): """ Specific volume [m^3 / kg] of saturated liquid""" return region4.vf(P) def uf(P): """ Specific internal energy [kJ / kg] of saturated liquid""" return region4.uf(P) def sf(P): """ Specific entropy [kJ / kg K] of saturated liquid""" return region4.sf(P) def hf(P): """ Specific enthalpy [kJ / kg] of saturated liquid""" return region4.hf(P) def cpf(P): """ Specific isobaric heat capacity [kJ / kg K] of saturated liquid""" return region4.cpf(P) def cvf(P): """ Specific isochoric heat capacity [kJ / kg K] of saturated liquid""" return region4.cvf(P) def wf(P): """ Speed of sound [m / s] of saturated liquid""" return region4.wf(P) def af(P): """Isobaric cubic expansion coefficient [1 / K] of saturated liquid""" return region4.af(P) def kf(P): """Isothermal compressibility [kg / kJ] of saturated liquid""" return region4.kf(P) #### Saturated vapor properties #### def gg(P): """ Specific gibbs free energy [kJ / kg] of saturated vapor""" return region4.gg(P) def vg(P): """ Specific volume [m^3 / kg] of saturated vapor""" return region4.vg(P) def ug(P): """ Specific internal energy [kJ / kg] of saturated vapor""" return region4.ug(P) def sg(P): """ Specific entropy [kJ / kg K] of saturated vapor""" return region4.sg(P) def hg(P): """ Specific enthalpy [kJ / kg] of saturated vapor""" return region4.hg(P) def cpg(P): """ Specific isobaric heat capacity [kJ / kg K] of saturated vapor""" return region4.cpg(P) def cvg(P): """ Specific isochoric heat capacity [kJ / kg K] of saturated vapor""" return region4.cvg(P) def wg(P): """ Speed of sound [m / s] of saturated vapor""" return region4.wg(P) def ag(P): """Isobaric cubic expansion coefficient [1 / K] of saturated vapor""" return region4.ag(P) def kg(P): """Isothermal compressibility [kg / kJ] of saturated vapor""" return region4.kg(P) #### delta saturation properties #### def gfg(P): """ Specific gibbs free energy; [kJ / kg] saturation rise of""" return region4.gfg(P) def vfg(P): """ Specific volume; [m^3 / kg] saturation rise of""" return region4.vfg(P) def ufg(P): """ Specific internal energy; [kJ / kg] saturation rise of""" return region4.ufg(P) def sfg(P): """ Specific entropy; [kJ / kg K] saturation rise of""" return region4.sfg(P) def hfg(P): """ Specific enthalpy; [kJ / kg] saturation rise of""" return region4.hfg(P) def cpfg(P): """ Specific isobaric heat capacity; [kJ / kg K] saturation rise of""" return region4.cpfg(P) def cvfg(P): """ Specific isochoric heat capacity; [kJ / kg K] saturation rise of""" return region4.cvfg(P) def wfg(P): """ Speed of sound; [m / s] saturation rise of""" return region4.wfg(P) def afg(P): """Isobaric cubic expansion coefficient; [1 / K] saturation rise of""" return region4.afg(P) def kfg(P): """Isothermal compressibility; [kg / kJ] saturation rise of""" return region4.kfg(P) #### Saturated liquid derivatives #### def dgfdP(P): """ Derivative of Specific gibbs free energy [kJ m^3 / kg kJ] of saturated liquid w.r.t. pressure""" return region4.dgfdP(P) def dvfdP(P): """ Derivative of Specific volume [m^3 m^3 / kg kJ] of saturated liquid w.r.t. pressure""" return region4.dvfdP(P) def dufdP(P): """ Derivative of Specific internal energy [kJ m^3 / kg kJ] of saturated liquid w.r.t. pressure""" return region4.dufdP(P) def dsfdP(P): """ Derivative of Specific entropy [kJ m^3 / kg K kJ] of saturated liquid w.r.t. pressure""" return region4.dsfdP(P) def dhfdP(P): """ Derivative of Specific enthalpy [kJ m^3 / kg kJ] of saturated liquid w.r.t. pressure""" return region4.dhfdP(P) #### Saturated vapor derivatives #### def dggdP(P): """ Derivative of Specific gibbs free energy [kJ m^3 / kg kJ] of saturated vapor w.r.t. pressure""" return region4.dggdP(P) def dvgdP(P): """ Derivative of Specific volume [m^3 m^3 / kg kJ] of saturated vapor w.r.t. pressure""" return region4.dvgdP(P) def dugdP(P): """ Derivative of Specific internal energy [kJ m^3 / kg kJ] of saturated vapor w.r.t. pressure""" return region4.dugdP(P) def dsgdP(P): """ Derivative of Specific entropy [kJ m^3 / kg K kJ] of saturated vapor w.r.t. pressure""" return region4.dsgdP(P) def dhgdP(P): """ Derivative of Specific enthalpy [kJ m^3 / kg kJ] of saturated vapor w.r.t. pressure""" return region4.dhgdP(P) #### Delta saturation derivatives #### def dgfgdP(P): """ Derivative of Specific gibbs free energy [kJ m^3 / kg kJ] w.r.t. pressure; saturation rise of""" return region4.dgfgdP(P) def dvfgdP(P): """ Derivative of Specific volume [m^3 m^3 / kg kJ] w.r.t. pressure; saturation rise of""" return region4.dvfgdP(P) def dufgdP(P): """ Derivative of Specific internal energy [kJ m^3 / kg kJ] w.r.t. pressure; saturation rise of""" return region4.dufgdP(P) def dsfgdP(P): """ Derivative of Specific entropy [kJ m^3 / kg K kJ] w.r.t. pressure; saturation rise of""" return region4.dsfgdP(P) def dhfgdP(P): """ Derivative of Specific enthalpy [kJ m^3 / kg kJ] w.r.t. pressure; saturation rise of""" return region4.dhfgdP(P)
26.131967
73
0.565196
4,918
31,881
3.622001
0.04026
0.107337
0.071858
0.039522
0.899062
0.883905
0.86246
0.802167
0.699096
0.548476
0
0.050889
0.306578
31,881
1,220
74
26.131967
0.754874
0.26188
0
0.592899
0
0
0.004107
0
0
0
0
0
0.00355
1
0.134911
false
0
0.001183
0
0.474556
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
a69d01b1acc74d6d299eb70da1f6946cec7ae71f
786
py
Python
pyros_interfaces_mock/mockpublisher.py
pyros-dev/pyros-common
0709538b8777ec055ea31f59cdca5bebaaabb04e
[ "MIT" ]
null
null
null
pyros_interfaces_mock/mockpublisher.py
pyros-dev/pyros-common
0709538b8777ec055ea31f59cdca5bebaaabb04e
[ "MIT" ]
61
2018-04-06T08:56:23.000Z
2019-05-20T19:01:19.000Z
pyros_interfaces_mock/mockpublisher.py
asmodehn/pyros-common
0709538b8777ec055ea31f59cdca5bebaaabb04e
[ "MIT" ]
null
null
null
from __future__ import absolute_import from pyros_interfaces_common.transient_if import TransientIf class MockPublisher(TransientIf): """ MockPublisher is a mock of the class handling conversion from Python API to Publisher call """ def __init__(self, topic_name, topic_type): # getting the fullname to make sure we start with / topic_name = topic_name if topic_name.startswith('/') else '/' + topic_name topic_type = topic_type.msgtype super(MockPublisher, self).__init__(topic_name, topic_type) def cleanup(self): pass def publish(self, msg): # System should be set by system itself ( TODO : investigate proper way to inject dependency for Mock...) return self.system.transfer(msg, self.name)
28.071429
113
0.703562
102
786
5.166667
0.588235
0.102467
0.106262
0.102467
0
0
0
0
0
0
0
0
0.223919
786
27
114
29.111111
0.863934
0.311705
0
0
0
0
0.003831
0
0
0
0
0.037037
0
1
0.272727
false
0.090909
0.181818
0.090909
0.636364
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
1
0
0
1
0
0
4
a6b9e93526c43b3c924be6c2e6871ddf0744e4e7
7,029
py
Python
migrations/versions/13934f10a019_.py
dev-johnlopez/offerly
3d53e64747555318addd35b94b5674e1c3ad99d0
[ "MIT" ]
null
null
null
migrations/versions/13934f10a019_.py
dev-johnlopez/offerly
3d53e64747555318addd35b94b5674e1c3ad99d0
[ "MIT" ]
null
null
null
migrations/versions/13934f10a019_.py
dev-johnlopez/offerly
3d53e64747555318addd35b94b5674e1c3ad99d0
[ "MIT" ]
null
null
null
"""empty message Revision ID: 13934f10a019 Revises: Create Date: 2019-10-04 16:58:16.891916 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '13934f10a019' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('address', sa.Column('id', sa.Integer(), nullable=False), sa.Column('street_address', sa.String(length=255), nullable=True), sa.Column('street_number', sa.String(length=255), nullable=True), sa.Column('route', sa.String(length=255), nullable=True), sa.Column('apt_number', sa.String(length=255), nullable=True), sa.Column('locality', sa.String(length=255), nullable=True), sa.Column('administrative_area_level_1', sa.String(length=2), nullable=True), sa.Column('postal_code', sa.String(length=255), nullable=True), sa.Column('county', sa.String(length=255), nullable=True), sa.Column('country', sa.String(length=255), nullable=True), sa.Column('latitude', sa.Numeric(precision=9, scale=6), nullable=True), sa.Column('longitude', sa.Numeric(precision=9, scale=6), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('role', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(length=80), nullable=True), sa.Column('description', sa.String(length=255), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('email', sa.String(length=255), nullable=True), sa.Column('password', sa.String(length=255), nullable=True), sa.Column('active', sa.Boolean(), nullable=True), sa.Column('confirmed_at', sa.DateTime(), nullable=True), sa.Column('last_login_at', sa.DateTime(), nullable=True), sa.Column('current_login_at', sa.DateTime(), nullable=True), sa.Column('last_login_ip', sa.String(length=40), nullable=True), sa.Column('current_login_ip', sa.String(length=40), nullable=True), sa.Column('login_count', sa.Integer(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('email') ) op.create_table('property', sa.Column('id', sa.Integer(), nullable=False), sa.Column('address_id', sa.Integer(), nullable=True), sa.Column('sq_foot', sa.Integer(), nullable=True), sa.Column('year_built', sa.Integer(), nullable=True), sa.Column('stories_count', sa.Integer(), nullable=True), sa.Column('basement_type', sa.String(length=255), nullable=True), sa.Column('addition_type', sa.String(length=255), nullable=True), sa.Column('bedroom_count', sa.Integer(), nullable=True), sa.Column('full_bath_count', sa.Integer(), nullable=True), sa.Column('half_bath_count', sa.Integer(), nullable=True), sa.Column('parking_type', sa.String(length=255), nullable=True), sa.Column('countertops', sa.String(length=255), nullable=True), sa.Column('appliances', sa.String(length=255), nullable=True), sa.Column('double_oven_ind', sa.Boolean(), nullable=True), sa.Column('walk_in_pantry_ind', sa.Boolean(), nullable=True), sa.Column('separate_cooktop_ind', sa.Boolean(), nullable=True), sa.Column('built_in_oven_ind', sa.Boolean(), nullable=True), sa.Column('built_in_microwave_ind', sa.Boolean(), nullable=True), sa.Column('kitchen_flooring', sa.String(length=255), nullable=True), sa.Column('main_flooring', sa.String(length=255), nullable=True), sa.Column('bathroom_flooring_tile_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_vinyl_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_laminate_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_hardwood_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_travertine_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_saltillo_tile_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_carpet_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_woodplank_tile_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_concrete_ind', sa.Boolean(), nullable=True), sa.Column('bathroom_flooring_other_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_tile_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_vinyl_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_laminate_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_hardwood_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_travertine_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_saltillo_tile_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_carpet_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_woodplank_tile_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_concrete_ind', sa.Boolean(), nullable=True), sa.Column('bedroom_flooring_other_ind', sa.Boolean(), nullable=True), sa.Column('landscaping', sa.String(length=255), nullable=True), sa.Column('pool', sa.Boolean(), nullable=True), sa.Column('hottub', sa.Boolean(), nullable=True), sa.Column('gated_community_ind', sa.Boolean(), nullable=True), sa.Column('hoa_ind', sa.Boolean(), nullable=True), sa.Column('age_restricted_ind', sa.Boolean(), nullable=True), sa.Column('solar_panels_ind', sa.Boolean(), nullable=True), sa.Column('septic_system_ind', sa.Boolean(), nullable=True), sa.Column('well_water_ind', sa.Boolean(), nullable=True), sa.Column('poor_location_ind', sa.Boolean(), nullable=True), sa.Column('sinkholes_ind', sa.Boolean(), nullable=True), sa.Column('foundation_issues', sa.Boolean(), nullable=True), sa.Column('additional_info', sa.String(length=1500), nullable=True), sa.Column('submitter_type', sa.String(length=255), nullable=True), sa.Column('listed_ind', sa.Boolean(), nullable=True), sa.Column('submitter_first_name', sa.String(length=255), nullable=True), sa.Column('submitter_last_name', sa.String(length=255), nullable=True), sa.Column('submitter_phone', sa.String(length=255), nullable=True), sa.Column('submitter_email', sa.String(length=255), nullable=True), sa.ForeignKeyConstraint(['address_id'], ['address.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('roles_users', sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('role_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['role_id'], ['role.id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.id'], ) ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('roles_users') op.drop_table('property') op.drop_table('user') op.drop_table('role') op.drop_table('address') # ### end Alembic commands ###
51.306569
83
0.702803
943
7,029
5.077413
0.168611
0.143693
0.239766
0.321637
0.77548
0.766082
0.701963
0.575188
0.431287
0.117168
0
0.020648
0.118082
7,029
136
84
51.683824
0.751734
0.040262
0
0.067797
0
0
0.226859
0.095543
0
0
0
0
0
1
0.016949
false
0.008475
0.016949
0
0.033898
0
0
0
0
null
0
1
1
0
1
1
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
0
0
0
4
a6ddebbe5883d84110742b1c4b24d4e8a7048a72
142
py
Python
PyQt5/Multi Form/Main.py
kuhakuu04/Python_PyQt5_GUI
1449733e3a9ba0f827ff6dd21279a8db690cbe21
[ "Apache-2.0" ]
null
null
null
PyQt5/Multi Form/Main.py
kuhakuu04/Python_PyQt5_GUI
1449733e3a9ba0f827ff6dd21279a8db690cbe21
[ "Apache-2.0" ]
null
null
null
PyQt5/Multi Form/Main.py
kuhakuu04/Python_PyQt5_GUI
1449733e3a9ba0f827ff6dd21279a8db690cbe21
[ "Apache-2.0" ]
null
null
null
import PyQt5.QtWidgets import MainForm app_module = PyQt5.QtWidgets.QApplication([]) app = MainForm.MainForm() app.show() app_module.exec()
15.777778
45
0.774648
18
142
6
0.5
0.259259
0
0
0
0
0
0
0
0
0
0.015625
0.098592
142
9
46
15.777778
0.828125
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
470c2e1340c122cd06e44a38a02509969c216411
1,163
py
Python
backend/api/decapod_api/views/__init__.py
angry-tony/ceph-lcm-decapod
535944d3ee384c3a7c4af82f74041b0a7792433f
[ "Apache-2.0" ]
41
2016-11-03T16:40:17.000Z
2019-05-23T08:39:17.000Z
backend/api/decapod_api/views/__init__.py
Mirantis/ceph-lcm
fad9bad0b94f2ef608362953583b10a54a841d24
[ "Apache-2.0" ]
30
2016-10-14T10:54:46.000Z
2017-10-20T15:58:01.000Z
backend/api/decapod_api/views/__init__.py
angry-tony/ceph-lcm-decapod
535944d3ee384c3a7c4af82f74041b0a7792433f
[ "Apache-2.0" ]
28
2016-09-17T01:17:36.000Z
2019-07-05T03:32:54.000Z
# -*- coding: utf-8 -*- # Copyright (c) 2016 Mirantis Inc. # # 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. """This module has basic routines for Flask views. Decapod uses Flask as a web framework and leverages by its pluggable views. Currently, registration of views into app is done by traversing a list of subclasses of generic view and this requires explicit module imports. It is ok, because we have a limited set of APIs and do not require to have view as plugins. """ from decapod_api.views import v1 def register_api(application): """Register API endpoints to the application.""" application.register_blueprint(v1.BLUEPRINT, url_prefix="/v1")
35.242424
70
0.759243
182
1,163
4.82967
0.631868
0.068259
0.029579
0.036405
0
0
0
0
0
0
0
0.012435
0.170249
1,163
32
71
36.34375
0.898446
0.842648
0
0
0
0
0.019108
0
0
0
0
0
0
1
0.333333
false
0
0.333333
0
0.666667
0.333333
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
1
0
1
0
0
4
470cb1da91f972756aedd7f0015622585bb0af88
228
py
Python
tests/core/pyspec/eth2spec/utils/hash_function.py
MicahZoltu/eth2.0-specs
1005b5baf8c043982b9a72282996311f9c194569
[ "CC0-1.0" ]
2,161
2018-09-20T09:40:27.000Z
2021-08-17T16:48:29.000Z
tests/core/pyspec/eth2spec/utils/hash_function.py
sthagen/eth2.0-specs
27b0d1f32e4ce430dd13b447c273a0f64b637066
[ "CC0-1.0" ]
1,573
2018-09-22T06:33:19.000Z
2021-08-18T00:54:44.000Z
tests/core/pyspec/eth2spec/utils/hash_function.py
sthagen/eth2.0-specs
27b0d1f32e4ce430dd13b447c273a0f64b637066
[ "CC0-1.0" ]
502
2018-09-22T04:37:36.000Z
2021-08-17T09:34:45.000Z
from hashlib import sha256 from remerkleable.byte_arrays import Bytes32 from typing import Union ZERO_BYTES32 = b'\x00' * 32 def hash(x: Union[bytes, bytearray, memoryview]) -> Bytes32: return Bytes32(sha256(x).digest())
22.8
60
0.754386
32
228
5.3125
0.6875
0
0
0
0
0
0
0
0
0
0
0.092308
0.144737
228
9
61
25.333333
0.779487
0
0
0
0
0
0.017544
0
0
0
0
0
0
1
0.166667
false
0
0.5
0.166667
0.833333
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
0
0
1
1
1
0
0
4
472971d63393a673572ab5bfdfbda17f5e957b88
389
py
Python
slixmpp/plugins/xep_0333/__init__.py
marconfus/slixmpp
bcf186f42dc31d360e0a0af8a4b3aaf1e0b212aa
[ "BSD-3-Clause" ]
null
null
null
slixmpp/plugins/xep_0333/__init__.py
marconfus/slixmpp
bcf186f42dc31d360e0a0af8a4b3aaf1e0b212aa
[ "BSD-3-Clause" ]
null
null
null
slixmpp/plugins/xep_0333/__init__.py
marconfus/slixmpp
bcf186f42dc31d360e0a0af8a4b3aaf1e0b212aa
[ "BSD-3-Clause" ]
null
null
null
""" slixmpp: The Slick XMPP Library Copyright (C) 2016 Emmanuel Gil Peyrot This file is part of slixmpp. See the file LICENSE for copying permission. """ from slixmpp.plugins.base import register_plugin from slixmpp.plugins.xep_0333.stanza import Markable, Received, Displayed, Acknowledged from slixmpp.plugins.xep_0333.hints import XEP_0333 register_plugin(XEP_0333)
25.933333
87
0.77892
55
389
5.4
0.636364
0.094276
0.181818
0.141414
0.16835
0
0
0
0
0
0
0.061162
0.159383
389
14
88
27.785714
0.847095
0.375321
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
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
1
0
1
0
1
0
0
4
472d39031e79b73b690f50955a44d7230a1cec3a
237
py
Python
day01/Quartiles.py
silvioedu/RackerRank-10-days-of-statistic
72a93015f13f343c52e640770f6e22d0bf996fec
[ "MIT" ]
null
null
null
day01/Quartiles.py
silvioedu/RackerRank-10-days-of-statistic
72a93015f13f343c52e640770f6e22d0bf996fec
[ "MIT" ]
null
null
null
day01/Quartiles.py
silvioedu/RackerRank-10-days-of-statistic
72a93015f13f343c52e640770f6e22d0bf996fec
[ "MIT" ]
null
null
null
if __name__ == '__main__': n = int(input()) x = sorted(list(map(int, input().split()))) from statistics import median print(int(median(x[:n//2]))) print(int(median(x))) print(int(median(x[(n+1)//2:])))
23.7
48
0.548523
34
237
3.588235
0.529412
0.196721
0.344262
0.368852
0.262295
0
0
0
0
0
0
0.016304
0.223629
237
9
49
26.333333
0.646739
0
0
0
0
0
0.035088
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.428571
0
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
1
0
4
5b446c1ce74750cf45d1027b0a9822700b7b3776
33
py
Python
readtagger/cli/__init__.py
bardin-lab/read_tagger
9a6e3f209e64f1f65c69fa06b7285ab9575ae002
[ "MIT" ]
3
2018-05-14T12:15:20.000Z
2021-03-01T02:38:36.000Z
readtagger/cli/__init__.py
bardin-lab/read_tagger
9a6e3f209e64f1f65c69fa06b7285ab9575ae002
[ "MIT" ]
413
2017-02-16T16:16:21.000Z
2022-03-31T23:46:40.000Z
readtagger/cli/__init__.py
bardin-lab/tag_reads
9a6e3f209e64f1f65c69fa06b7285ab9575ae002
[ "MIT" ]
2
2019-03-09T03:00:12.000Z
2019-07-16T00:29:56.000Z
"""CLI module for readtagger."""
16.5
32
0.666667
4
33
5.5
1
0
0
0
0
0
0
0
0
0
0
0
0.121212
33
1
33
33
0.758621
0.787879
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
1
0
0
0
0
0
0
4
5b58dd7722c897fee5ffa5ec7e4088bf886b0f8c
174
py
Python
connection_plugin/macros/__init__.py
bakdata/connection_plugin
9466c485b3b77de3777427769de47f6e0c412ad7
[ "MIT" ]
1
2019-07-03T10:48:30.000Z
2019-07-03T10:48:30.000Z
connection_plugin/macros/__init__.py
bakdata/connection_plugin
9466c485b3b77de3777427769de47f6e0c412ad7
[ "MIT" ]
5
2020-07-27T17:48:34.000Z
2022-01-28T22:03:48.000Z
connection_plugin/macros/__init__.py
bakdata/connection_plugin
9466c485b3b77de3777427769de47f6e0c412ad7
[ "MIT" ]
null
null
null
from airflow.hooks.base_hook import BaseHook def get_conn(conn_id): # get connection by name from BaseHook conn = BaseHook.get_connection(conn_id) return conn
19.333333
44
0.752874
26
174
4.846154
0.576923
0.095238
0
0
0
0
0
0
0
0
0
0
0.189655
174
8
45
21.75
0.893617
0.206897
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
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
0
1
0
0
4
5b7a6b267de7b9cdceac69485733a14aa6d135f0
12,026
py
Python
notecoin/huobi/connection/core.py
notechats/notecoin
57e1ed71567ce8864158f24c00ed47addbd9851f
[ "Apache-2.0" ]
null
null
null
notecoin/huobi/connection/core.py
notechats/notecoin
57e1ed71567ce8864158f24c00ed47addbd9851f
[ "Apache-2.0" ]
null
null
null
notecoin/huobi/connection/core.py
notechats/notecoin
57e1ed71567ce8864158f24c00ed47addbd9851f
[ "Apache-2.0" ]
1
2022-03-26T11:42:18.000Z
2022-03-26T11:42:18.000Z
import logging from notecoin.huobi.connection.impl import (RestApiRequest, WebsocketManage, WebsocketRequest, WebSocketWatchDog, call_sync, call_sync_perforence_test) from notecoin.huobi.constant.system import (ApiVersion, HttpMethod, WebSocketDefine, get_default_server_url) from notecoin.huobi.utils.api_signature import create_signature from notecoin.huobi.utils.huobi_api_exception import HuobiApiException from notecoin.huobi.utils.url_params_builder import UrlParamsBuilder from notetool.log import logger class RestApiSyncClient(object): def __init__(self, api_key=None, secret_key=None, url=None, *args, **kwargs): """ Create the request client instance. :param kwargs: The option of request connection. api_key: The public key applied from Huobi. secret_key: The private key applied from Huobi. url: The URL name like "https://api.huobi.pro". performance_test: for performance test init_log: to init logger """ self.__api_key = api_key self.__secret_key = secret_key self.__server_url = url or get_default_server_url(None) self.__init_log = kwargs.get("init_log", None) self.__performance_test = kwargs.get("performance_test", None) if self.__init_log and self.__init_log: logger.addHandler(logging.StreamHandler()) def request_process(self, method, url, params): if self.__performance_test is not None and self.__performance_test is True: return self.request_process_performance(method, url, params) else: return self.request_process_product(method, url, params) def create_request(self, method, url, params): builder = UrlParamsBuilder() if params and len(params): if method in [HttpMethod.GET, HttpMethod.GET_SIGN]: for key, value in params.items(): builder.put_url(key, value) elif method in [HttpMethod.POST, HttpMethod.POST_SIGN]: for key, value in params.items(): builder.put_post(key, value) else: raise HuobiApiException(HuobiApiException.EXEC_ERROR, "[error] undefined HTTP method") if method == HttpMethod.GET: request = self.__create_request_by_get(url, builder) elif method == HttpMethod.GET_SIGN: request = self.__create_request_by_get_with_signature(url, builder) elif method == HttpMethod.POST_SIGN: request = self.__create_request_by_post_with_signature(url, builder) elif method == HttpMethod.POST: request = self.__create_request_by_post_with_signature(url, builder) else: raise HuobiApiException(HuobiApiException.INPUT_ERROR, "[Input] " + method + " is invalid http method") return request def request_process_product(self, method, url, params): request = self.create_request(method, url, params) if request: return call_sync(request) return None def request_process_performance(self, method, url, params): request = self.create_request(method, url, params) if request: return call_sync_perforence_test(request) return None, 0, 0 """ for post batch operation, such as batch create orders[ /v1/order/batch-orders ] """ def create_request_post_batch(self, method, url, params): builder = UrlParamsBuilder() if params and len(params): if method in [HttpMethod.POST, HttpMethod.POST_SIGN]: if isinstance(params, list): builder.post_list = params else: raise HuobiApiException(HuobiApiException.EXEC_ERROR, "[error] undefined HTTP method") request = self.__create_request_by_post_with_signature(url, builder) return request """ for post batch operation, such as batch create orders[ /v1/order/batch-orders ] """ def request_process_post_batch(self, method, url, params): if self.__performance_test is not None and self.__performance_test is True: return self.request_process_post_batch_performance(method, url, params) else: return self.request_process_post_batch_product(method, url, params) def request_process_post_batch_product(self, method, url, params): request = self.create_request_post_batch(method, url, params) if request: return call_sync(request) return None def request_process_post_batch_performance(self, method, url, params): request = self.create_request_post_batch(method, url, params) if request: return call_sync_perforence_test(request) return None, 0, 0 def __create_request_by_get(self, url, builder): request = RestApiRequest() request.method = "GET" request.host = self.__server_url request.header.update({'Content-Type': 'application/json'}) request.url = url + builder.build_url() return request def __create_request_by_post_with_signature(self, url, builder): request = RestApiRequest() request.method = "POST" request.host = self.__server_url create_signature(self.__api_key, self.__secret_key, request.method, request.host + url, builder) request.header.update({'Content-Type': 'application/json'}) if len(builder.post_list): # specify for case : /v1/order/batch-orders request.post_body = builder.post_list else: request.post_body = builder.post_map request.url = url + builder.build_url() return request def __create_request_by_get_with_signature(self, url, builder): request = RestApiRequest() request.method = "GET" request.host = self.__server_url create_signature(self.__api_key, self.__secret_key, request.method, request.host + url, builder) request.header.update({"Content-Type": "application/x-www-form-urlencoded"}) request.url = url + builder.build_url() return request class SubscribeClient(object): subscribe_watch_dog = WebSocketWatchDog() def __init__(self, api_key=None, secret_key=None, **kwargs): """ Create the subscription client to subscribe the update from server. :param kwargs: The option of subscription connection. api_key: The public key applied from Huobi. secret_key: The private key applied from Huobi. url: Set the URI for subscription. init_log: to init logger """ self.__api_key = api_key self.__secret_key = secret_key self.__uri = kwargs.get("url", WebSocketDefine.Uri) self.__init_log = kwargs.get("init_log", None) if self.__init_log and self.__init_log: logger.addHandler(logging.StreamHandler()) self.__websocket_manage_list = list() def __create_websocket_manage(self, request): manager = WebsocketManage(self.__api_key, self.__secret_key, self.__uri, request) self.__websocket_manage_list.append(manager) manager.connect() SubscribeClient.subscribe_watch_dog.on_connection_created(manager) def create_request(self, subscription_handler, callback, error_handler, is_trade, is_mbp_feed=False): request = WebsocketRequest() request.subscription_handler = subscription_handler request.is_trading = is_trade request.is_mbp_feed = is_mbp_feed request.auto_close = False # subscribe need connection. websocket request need close request. request.update_callback = callback request.error_handler = error_handler return request def create_request_v1(self, subscription_handler, callback, error_handler, is_trade=False): request = self.create_request(subscription_handler=subscription_handler, callback=callback, error_handler=error_handler, is_trade=is_trade) request.api_version = ApiVersion.VERSION_V1 return request def create_request_v2(self, subscription_handler, callback, error_handler, is_trade=False): request = self.create_request(subscription_handler=subscription_handler, callback=callback, error_handler=error_handler, is_trade=is_trade) request.api_version = ApiVersion.VERSION_V2 return request def execute_subscribe_v1(self, subscription_handler, callback, error_handler, is_trade=False): request = self.create_request_v1(subscription_handler, callback, error_handler, is_trade) self.__create_websocket_manage(request) def execute_subscribe_v2(self, subscription_handler, callback, error_handler, is_trade=False): request = self.create_request_v2(subscription_handler, callback, error_handler, is_trade) self.__create_websocket_manage(request) def execute_subscribe_mbp(self, subscription_handler, callback, error_handler, is_trade=False, is_mbp_feed=True): request = self.create_request(subscription_handler, callback, error_handler, is_trade, is_mbp_feed) self.__create_websocket_manage(request) def unsubscribe_all(self): for websocket_manage in self.__websocket_manage_list: SubscribeClient.subscribe_watch_dog.on_connection_closed(websocket_manage) websocket_manage.close() self.__websocket_manage_list.clear() class WebSocketReqClient(object): def __init__(self, api_key=None, secret_key=None, **kwargs): """ Create the subscription client to subscribe the update from server. :param kwargs: The option of subscription connection. api_key: The public key applied from Huobi. secret_key: The private key applied from Huobi. url: Set the URI for subscription. init_log: to init logger """ self.__api_key = api_key self.__secret_key = secret_key self.__uri = kwargs.get("url", WebSocketDefine.Uri) self.__init_log = kwargs.get("init_log", None) if self.__init_log and self.__init_log: logger = logging.getLogger("huobi-client") logger.setLevel(level=logging.INFO) handler = logging.StreamHandler() handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')) logger.addHandler(handler) def __create_websocket_manage(self, request): manager = WebsocketManage(self.__api_key, self.__secret_key, self.__uri, request) manager.connect() def create_request(self, subscription_handler, callback, error_handler, is_trade=False, is_mbp_feed=False): request = WebsocketRequest() request.subscription_handler = subscription_handler request.is_trading = is_trade request.is_mbp_feed = is_mbp_feed request.auto_close = True # for websocket request, auto close the connection after request. request.update_callback = callback request.error_handler = error_handler return request def execute_subscribe_v1(self, subscription_handler, callback, error_handler, is_trade=False): request = self.create_request(subscription_handler, callback, error_handler, is_trade) self.__create_websocket_manage(request) def execute_subscribe_mbp(self, subscription_handler, callback, error_handler, is_trade=False, is_mbp_feed=True): request = self.create_request(subscription_handler, callback, error_handler, is_trade, is_mbp_feed) self.__create_websocket_manage(request)
44.873134
116
0.674705
1,390
12,026
5.509353
0.117266
0.042439
0.03134
0.050144
0.788195
0.753852
0.727736
0.713763
0.69509
0.656699
0
0.001769
0.248046
12,026
267
117
45.041199
0.845074
0.088309
0
0.589474
0
0
0.029434
0.003123
0
0
0
0
0
1
0.136842
false
0
0.036842
0
0.305263
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
5b86f361fbbbfacc15ad279f76a94b6b4ebf8fb3
160
py
Python
django_price/settings.py
holg/django_price
5333d46132b0e7ff4e46ead4a048d75224b0e8c5
[ "BSD-3-Clause" ]
4
2015-09-12T21:04:15.000Z
2021-01-28T11:33:54.000Z
django_price/settings.py
holg/django_price
5333d46132b0e7ff4e46ead4a048d75224b0e8c5
[ "BSD-3-Clause" ]
3
2015-12-03T20:00:30.000Z
2016-03-09T08:43:15.000Z
django_price/settings.py
holg/django_price
5333d46132b0e7ff4e46ead4a048d75224b0e8c5
[ "BSD-3-Clause" ]
2
2015-12-03T10:06:56.000Z
2021-02-23T14:44:14.000Z
from django.conf import settings from django.core.exceptions import ImproperlyConfigured DEFAULT_CURRENCY = getattr(settings, 'PRICE_DEFAULT_CURRENCY', None)
26.666667
68
0.84375
19
160
6.947368
0.684211
0.151515
0
0
0
0
0
0
0
0
0
0
0.09375
160
5
69
32
0.910345
0
0
0
0
0
0.138365
0.138365
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
5b876fb6b5339300e4f02324f4f5d8e7293efe78
177
py
Python
ds/util/seed_everything.py
Hattyoriiiiiii/snippets
ecf44f9b226b2c483e1e45b6a37749c858675762
[ "MIT" ]
null
null
null
ds/util/seed_everything.py
Hattyoriiiiiii/snippets
ecf44f9b226b2c483e1e45b6a37749c858675762
[ "MIT" ]
null
null
null
ds/util/seed_everything.py
Hattyoriiiiiii/snippets
ecf44f9b226b2c483e1e45b6a37749c858675762
[ "MIT" ]
null
null
null
def seed_everything(seed=2020): random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) np.random.seed(seed) tf.random.set_seed(seed) seed_everything(42)
25.285714
44
0.694915
25
177
4.8
0.52
0.266667
0.233333
0
0
0
0
0
0
0
0
0.040541
0.163842
177
7
45
25.285714
0.77027
0
0
0
0
0
0.078652
0
0
0
0
0
0
1
0.166667
false
0
0
0
0.166667
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
5b9f77282c6a263efb35ec52bcd5c1f518f4a422
88
py
Python
test/unit/__init__.py
tonchik-tm/yookassa-sdk-python
3aa313f4a515966292e10aae9772b3d7982abbc5
[ "MIT" ]
30
2020-12-10T12:12:13.000Z
2022-03-30T10:20:41.000Z
test/unit/__init__.py
tonchik-tm/yookassa-sdk-python
3aa313f4a515966292e10aae9772b3d7982abbc5
[ "MIT" ]
2
2020-12-28T08:25:09.000Z
2021-05-20T14:06:25.000Z
test/unit/__init__.py
tonchik-tm/yookassa-sdk-python
3aa313f4a515966292e10aae9772b3d7982abbc5
[ "MIT" ]
5
2020-12-08T18:49:29.000Z
2022-01-01T21:20:16.000Z
# -*- coding: utf-8 -*- """Top-level package for YooKassa API Python Client Library."""
29.333333
63
0.659091
12
88
4.833333
1
0
0
0
0
0
0
0
0
0
0
0.013333
0.147727
88
2
64
44
0.76
0.909091
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
5bb2b7aa459b7b47b1aae9923cdf7e9ba39b6795
1,661
py
Python
src/party3rd/elastic.py
yaroslavNikolaev/A.R.M.O.R.
443b50ad39b7ada7562db62c36824c7c4edb842b
[ "MIT" ]
1
2020-03-29T20:53:28.000Z
2020-03-29T20:53:28.000Z
src/party3rd/elastic.py
yaroslavNikolaev/A.R.M.O.R.
443b50ad39b7ada7562db62c36824c7c4edb842b
[ "MIT" ]
null
null
null
src/party3rd/elastic.py
yaroslavNikolaev/A.R.M.O.R.
443b50ad39b7ada7562db62c36824c7c4edb842b
[ "MIT" ]
null
null
null
from utils.collectors import GitHubVersionCollector from utils.configuration import Configuration from abc import ABC owner = "elastic" class BeatsVersionCollector(GitHubVersionCollector, ABC): repo = "beats" def __init__(self, config: Configuration): super().__init__(config, owner, self.repo) class FilebeatCollector(BeatsVersionCollector): @staticmethod def get_application_name() -> str: return "filebeat" class MetricbeatCollector(BeatsVersionCollector): @staticmethod def get_application_name() -> str: return "metricbeat" class AuditbeatCollector(BeatsVersionCollector): @staticmethod def get_application_name() -> str: return "auditbeat" class JournalbeatCollector(BeatsVersionCollector): @staticmethod def get_application_name() -> str: return "journalbeat" class KibanaVersionCollector(GitHubVersionCollector): repo = "kibana" @staticmethod def get_application_name() -> str: return "kibana" def __init__(self, config: Configuration): super().__init__(config, owner, self.repo) class ElasticsearchVersionCollector(GitHubVersionCollector): repo = "elasticsearch" @staticmethod def get_application_name() -> str: return "elasticsearch" def __init__(self, config: Configuration): super().__init__(config, owner, self.repo) class LogstashVersionCollector(GitHubVersionCollector): repo = "logstash" @staticmethod def get_application_name() -> str: return "logstash" def __init__(self, config: Configuration): super().__init__(config, owner, self.repo)
22.445946
60
0.714028
149
1,661
7.651007
0.255034
0.092105
0.110526
0.17807
0.548246
0.548246
0.548246
0.437719
0.216667
0.216667
0
0
0.195665
1,661
73
61
22.753425
0.853293
0
0
0.488889
0
0
0.062613
0
0
0
0
0
0
1
0.244444
false
0
0.066667
0.155556
0.733333
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
0
1
1
0
0
4
5bc1217737a5b5ca0fdc9ec885bef3ec26c1d312
21,433
py
Python
Sintactico.py
LawlietJH/PyCthon
343163209922abac4d0f1f0ff34b1370ee064ddf
[ "MIT" ]
null
null
null
Sintactico.py
LawlietJH/PyCthon
343163209922abac4d0f1f0ff34b1370ee064ddf
[ "MIT" ]
null
null
null
Sintactico.py
LawlietJH/PyCthon
343163209922abac4d0f1f0ff34b1370ee064ddf
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import Lexico import Arbol import string import sys import os class Sintactico(): def __init__(self): with open('entrada.txt','r') as Archivo: self.Cadena = Archivo.read()+'$' Archivo.close() #=============================================================== self.Suma = Arbol.Suma self.Multi = Arbol.Multi self.Asign = Arbol.Asignacion self.ReservIf = Arbol.ReservIf self.ReservPrint = Arbol.ReservPrint self.Separador = Arbol.Separador self.Signo = Arbol.Signo self.ExpresionArb = Arbol.Expre self.Bloque = Arbol.Bloque self.ReservElse = Arbol.ReservElse self.ReservWhile = Arbol.ReservWhile self.Logico = Arbol.Logico self.Relacional = Arbol.Relacional self.Identi = Arbol.Identificador self.Entero = Arbol.Entero self.Flotante = Arbol.Flotante self.CadenaArb = Arbol.Cadena #=============================================================== self.ListaArbolesBloque = [[],[],[],[],[]] # Permite Anidación de hasta 5 niveles. self.ListaArboles = [] self.ArbolActual = [] self.ArbolPila = [] self.lexico = Lexico.Lexico(self.Cadena) self.Cadena = '' self.PalabReserv = ['if', 'else', 'do','while', 'print'] self.BloqueActivo = [False, False, False, False, False] # Permite Anidación de hasta 5 niveles. def Resultado(self, Salida): if Salida == 0: print('\n\n\n\t Error Sintáctico: ', Salida) for x in range(5): self.lexico.sigSimbolo() print(self.lexico.simbolo,end='') Archivo = open('salida.txt','w') Cadena = Archivo.write(str(Salida)) Archivo.close() def error(self): self.Resultado(0) sys.exit() def analiza(self): self.lexico.sigSimbolo() self.A() self.Comprueba(20) def Comprueba(self, Tipo): if self.lexico.tipo == Tipo: try: self.lexico.sigSimbolo() except: self.Resultado(1) else: self.error() def A(self): xD = True if self.lexico.tipo == 2 and self.lexico.simbolo in self.PalabReserv: while xD: xD = False if self.lexico.simbolo == 'if': self.If() xD = True if self.lexico.simbolo == 'do': self.DoWhile() xD = True if self.lexico.simbolo == 'while': self.While() xD = True if self.lexico.simbolo == 'for': self.For() xD = True if self.lexico.simbolo == 'print': self.Print() xD = True self.Asignacion() def Asignacion(self, Bool=True): #=============================================================== Simbolo = None #=============================================================== if self.lexico.tipo == 2: #================================================================ R = self.Identi(None, self.lexico.simbolo) #================================================================ self.lexico.sigSimbolo() self.Comprueba(15) #================================================================ P = self.Expresion() P = self.Asign(R,P) if self.BloqueActivo[0]: if self.BloqueActivo[4]: self.ListaArbolesBloque[4].append(P) elif self.BloqueActivo[3]: self.ListaArbolesBloque[3].append(P) elif self.BloqueActivo[2]: self.ListaArbolesBloque[2].append(P) elif self.BloqueActivo[1]: self.ListaArbolesBloque[1].append(P) elif self.BloqueActivo[0]: self.ListaArbolesBloque[0].append(P) else: self.ListaArboles.append(P) #================================================================ if Bool: self.Comprueba(12) self.A() def If(self): self.lexico.sigSimbolo() self.Comprueba(11) #=============================================================== P = self.ComparacionLogica() R = self.ReservIf() R.SetHijo(P) #=============================================================== self.Comprueba(22) if self.lexico.tipo == 23: #=============================================================== if self.BloqueActivo[0] == False: self.BloqueActivo[0] = True elif self.BloqueActivo[1] == False: self.BloqueActivo[1] = True elif self.BloqueActivo[2] == False: self.BloqueActivo[2] = True elif self.BloqueActivo[3] == False: self.BloqueActivo[3] = True elif self.BloqueActivo[4] == False: self.BloqueActivo[4] = True B = self.Bloque() #=============================================================== self.lexico.sigSimbolo() self.A() self.Comprueba(24) #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: B.SetListaHijos(self.ListaArbolesBloque[4]) self.BloqueActivo[4] = False self.ListaArbolesBloque[4] = [] elif self.BloqueActivo[3]: B.SetListaHijos(self.ListaArbolesBloque[3]) self.BloqueActivo[3] = False self.ListaArbolesBloque[3] = [] elif self.BloqueActivo[2]: B.SetListaHijos(self.ListaArbolesBloque[2]) self.BloqueActivo[2] = False self.ListaArbolesBloque[2] = [] elif self.BloqueActivo[1]: B.SetListaHijos(self.ListaArbolesBloque[1]) self.BloqueActivo[1] = False self.ListaArbolesBloque[1] = [] elif self.BloqueActivo[0]: B.SetListaHijos(self.ListaArbolesBloque[0]) self.BloqueActivo[0] = False self.ListaArbolesBloque[0] = [] R.SetHijo(B) #=============================================================== else: #=============================================================== if self.BloqueActivo[0] == False: self.BloqueActivo[0] = True elif self.BloqueActivo[1] == False: self.BloqueActivo[1] = True elif self.BloqueActivo[2] == False: self.BloqueActivo[2] = True elif self.BloqueActivo[3] == False: self.BloqueActivo[3] = True elif self.BloqueActivo[4] == False: self.BloqueActivo[4] = True B = self.Bloque() #=============================================================== if self.lexico.simbolo == 'print': self.Print() else: self.Asignacion(False) self.Comprueba(12); #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: B.SetListaHijos(self.ListaArbolesBloque[4]) self.BloqueActivo[4] = False self.ListaArbolesBloque[4] = [] elif self.BloqueActivo[3]: B.SetListaHijos(self.ListaArbolesBloque[3]) self.BloqueActivo[3] = False self.ListaArbolesBloque[3] = [] elif self.BloqueActivo[2]: B.SetListaHijos(self.ListaArbolesBloque[2]) self.BloqueActivo[2] = False self.ListaArbolesBloque[2] = [] elif self.BloqueActivo[1]: B.SetListaHijos(self.ListaArbolesBloque[1]) self.BloqueActivo[1] = False self.ListaArbolesBloque[1] = [] elif self.BloqueActivo[0]: B.SetListaHijos(self.ListaArbolesBloque[0]) self.BloqueActivo[0] = False self.ListaArbolesBloque[0] = [] R.SetHijo(B) #=============================================================== if self.lexico.simbolo == 'else': self.lexico.sigSimbolo() if self.lexico.tipo == 23: if self.BloqueActivo[0] == False: self.BloqueActivo[0] = True elif self.BloqueActivo[1] == False: self.BloqueActivo[1] = True elif self.BloqueActivo[2] == False: self.BloqueActivo[2] = True elif self.BloqueActivo[3] == False: self.BloqueActivo[3] = True elif self.BloqueActivo[4] == False: self.BloqueActivo[4] = True E = self.ReservElse() self.lexico.sigSimbolo() self.A() self.Comprueba(24) #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: E.SetListaHijos(self.ListaArbolesBloque[4]) self.BloqueActivo[4] = False self.ListaArbolesBloque[4] = [] elif self.BloqueActivo[3]: E.SetListaHijos(self.ListaArbolesBloque[3]) self.BloqueActivo[3] = False self.ListaArbolesBloque[3] = [] elif self.BloqueActivo[2]: E.SetListaHijos(self.ListaArbolesBloque[2]) self.BloqueActivo[2] = False self.ListaArbolesBloque[2] = [] elif self.BloqueActivo[1]: E.SetListaHijos(self.ListaArbolesBloque[1]) self.BloqueActivo[1] = False self.ListaArbolesBloque[1] = [] elif self.BloqueActivo[0]: E.SetListaHijos(self.ListaArbolesBloque[0]) self.BloqueActivo[0] = False self.ListaArbolesBloque[0] = [] #=============================================================== else: #=============================================================== if self.BloqueActivo[0] == False: self.BloqueActivo[0] = True elif self.BloqueActivo[1] == False: self.BloqueActivo[1] = True elif self.BloqueActivo[2] == False: self.BloqueActivo[2] = True elif self.BloqueActivo[3] == False: self.BloqueActivo[3] = True elif self.BloqueActivo[4] == False: self.BloqueActivo[4] = True E = self.ReservElse() #=============================================================== if self.lexico.simbolo == 'print': self.Print() else: self.Asignacion(False) self.Comprueba(12); #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: E.SetListaHijos(self.ListaArbolesBloque[4]) self.BloqueActivo[4] = False self.ListaArbolesBloque[4] = [] elif self.BloqueActivo[3]: E.SetListaHijos(self.ListaArbolesBloque[3]) self.BloqueActivo[3] = False self.ListaArbolesBloque[3] = [] elif self.BloqueActivo[2]: E.SetListaHijos(self.ListaArbolesBloque[2]) self.BloqueActivo[2] = False self.ListaArbolesBloque[2] = [] elif self.BloqueActivo[1]: E.SetListaHijos(self.ListaArbolesBloque[1]) self.BloqueActivo[1] = False self.ListaArbolesBloque[1] = [] elif self.BloqueActivo[0]: E.SetListaHijos(self.ListaArbolesBloque[0]) self.BloqueActivo[0] = False self.ListaArbolesBloque[0] = [] #=============================================================== #=============================================================== R.SetHijo(E) #=============================================================== #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: self.ListaArbolesBloque[4].append(R) elif self.BloqueActivo[3]: self.ListaArbolesBloque[3].append(R) elif self.BloqueActivo[2]: self.ListaArbolesBloque[2].append(R) elif self.BloqueActivo[1]: self.ListaArbolesBloque[1].append(R) elif self.BloqueActivo[0]: self.ListaArbolesBloque[0].append(R) else: self.ListaArboles.append(R) #=============================================================== def While(self): self.lexico.sigSimbolo() self.Comprueba(11) #=============================================================== P = self.ComparacionLogica() W = self.ReservWhile() W.SetHijo(P) #=============================================================== self.Comprueba(22) if self.lexico.tipo == 23: #=============================================================== if self.BloqueActivo[0] == False: self.BloqueActivo[0] = True elif self.BloqueActivo[1] == False: self.BloqueActivo[1] = True elif self.BloqueActivo[2] == False: self.BloqueActivo[2] = True elif self.BloqueActivo[3] == False: self.BloqueActivo[3] = True elif self.BloqueActivo[4] == False: self.BloqueActivo[4] = True B = self.Bloque() #=============================================================== self.lexico.sigSimbolo() self.A() self.Comprueba(24) #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: B.SetListaHijos(self.ListaArbolesBloque[4]) self.BloqueActivo[4] = False self.ListaArbolesBloque[4] = [] elif self.BloqueActivo[3]: B.SetListaHijos(self.ListaArbolesBloque[3]) self.BloqueActivo[3] = False self.ListaArbolesBloque[3] = [] elif self.BloqueActivo[2]: B.SetListaHijos(self.ListaArbolesBloque[2]) self.BloqueActivo[2] = False self.ListaArbolesBloque[2] = [] elif self.BloqueActivo[1]: B.SetListaHijos(self.ListaArbolesBloque[1]) self.BloqueActivo[1] = False self.ListaArbolesBloque[1] = [] elif self.BloqueActivo[0]: B.SetListaHijos(self.ListaArbolesBloque[0]) self.BloqueActivo[0] = False self.ListaArbolesBloque[0] = [] W.SetHijo(B) #=============================================================== #=============================================================== if self.BloqueActivo[0]: if self.BloqueActivo[4]: self.ListaArbolesBloque[4].append(W) elif self.BloqueActivo[3]: self.ListaArbolesBloque[3].append(W) elif self.BloqueActivo[2]: self.ListaArbolesBloque[2].append(W) elif self.BloqueActivo[1]: self.ListaArbolesBloque[1].append(W) elif self.BloqueActivo[0]: self.ListaArbolesBloque[0].append(W) else: self.ListaArboles.append(W) #=============================================================== def DoWhile(self): self.lexico.sigSimbolo() self.Comprueba(23) self.A() self.Comprueba(24) if self.lexico.simbolo == 'while': self.lexico.sigSimbolo() self.Comprueba(11) self.ComparacionLogica() self.Comprueba(22) self.Comprueba(12) else: self.error() def For(self): self.lexico.sigSimbolo() self.Comprueba(11) self.Asignacion(False) self.Comprueba(12) if (self.lexico.tipo == 2 or self.lexico.tipo == 3 or self.lexico.tipo == 5) and not self.lexico.tipo in self.PalabReserv: self.lexico.sigSimbolo() if self.lexico.tipo == 14: self.lexico.sigSimbolo() if (self.lexico.tipo == 2 or self.lexico.tipo == 3 or self.lexico.tipo == 5) and not self.lexico.tipo in self.PalabReserv: self.lexico.sigSimbolo() self.Comprueba(12) self.Asignacion(False) self.Comprueba(22) if self.lexico.tipo == 23: self.lexico.sigSimbolo() self.A() self.Comprueba(24) def Expresion(self, Bool=True): # Permite Recursividad #================================================================ P = None Q = None Tipo = None xD = False Sign = False ArbolPila = [] #================================================================ if self.lexico.tipo == 9: Sign = self.lexico.simbolo self.lexico.sigSimbolo() if self.lexico.tipo == 11: self.lexico.sigSimbolo() #================================================================ P = self.Expresion() ArbolPila.append(P) #================================================================ self.Comprueba(22) xD = True # 2 = IDENTIFICADOR; 3 = ENTERO; 5 = FLOTANTE; 8 = CADENA = "Hola xD" if self.lexico.tipo == 2 or self.lexico.tipo == 3\ or self.lexico.tipo == 5 or self.lexico.tipo == 8\ or xD == True: if xD == False: #================================================================ if self.lexico.tipo == 2: P = self.Identi(None, self.lexico.simbolo) elif self.lexico.tipo == 3: P = self.Entero('i', self.lexico.simbolo) elif self.lexico.tipo == 5: P = self.Flotante('r', self.lexico.simbolo) elif self.lexico.tipo == 8: P = self.CadenaArb('c', self.lexico.simbolo) ArbolPila.append(P) #================================================================ self.lexico.sigSimbolo() else: xD = False #================================================================ if Sign != False: P = self.Signo(P, Sign) ArbolPila.pop() ArbolPila.append(P) Sign = False #================================================================ while self.lexico.tipo == 9 or self.lexico.tipo == 10: #================================================================ Tipo = (self.lexico.tipo, self.lexico.simbolo) ArbolPila.append(Tipo) #================================================================ self.lexico.sigSimbolo() if self.lexico.tipo == 9: Sign = self.lexico.simbolo self.lexico.sigSimbolo() if self.lexico.tipo == 11: self.lexico.sigSimbolo() #================================================================ Q = self.Expresion() ArbolPila.append(Q) #================================================================ self.Comprueba(22) xD = True if self.lexico.tipo == 2 or self.lexico.tipo == 3\ or self.lexico.tipo == 5 or self.lexico.tipo == 8\ or xD == True: if xD == False: #================================================================ if self.lexico.tipo == 2: Q = self.Identi(None, self.lexico.simbolo) elif self.lexico.tipo == 3: Q = self.Entero('i', self.lexico.simbolo) elif self.lexico.tipo == 5: Q = self.Flotante('r', self.lexico.simbolo) elif self.lexico.tipo == 8: Q = self.CadenaArb('c', self.lexico.simbolo) ArbolPila.append(Q) #================================================================ self.lexico.sigSimbolo() else: xD = False else: self.error() #================================================================ if Sign != False: Q = self.Signo(Q, Sign) ArbolPila.pop() ArbolPila.append(Q) Sign = False if Bool: if Tipo[0] == 9: P = self.Suma(P, Q, Tipo[1]) elif Tipo[0] == 10: P = self.Multi(P, Q, Tipo[1]) #================================================================ if Bool == False: # ~ print('\n') ArbolPila = ArbolPila[::-1] P = ArbolPila.pop(0) # ~ print(P) if ArbolPila != []: Operador = ArbolPila.pop(0) Valor1 = ArbolPila.pop(0) # ~ print(Operador) # ~ print(Valor1) if Operador[0] == 9: P = self.Suma( Valor1, P, Operador[1]) elif Operador[0] == 10: P = self.Multi(Valor1, P, Operador[1]) Cont = 0 for x in ArbolPila: # ~ print(x) if Cont % 2 == 0: Operador = x elif Cont % 2 == 1: Valor1 = x if Operador[0] == 9: P = self.Suma( Valor1, P, Operador[1]) elif Operador[0] == 10: P = self.Multi(Valor1, P, Operador[1]) Cont += 1 return P def Print(self): self.lexico.sigSimbolo() self.Comprueba(11) #=============================================================== P = self.Expresion() P = self.ExpresionArb(P) #=============================================================== self.Comprueba(22) #=============================================================== P = self.ReservPrint(P) if self.BloqueActivo[0]: if self.BloqueActivo[4]: self.ListaArbolesBloque[4].append(P) elif self.BloqueActivo[3]: self.ListaArbolesBloque[3].append(P) elif self.BloqueActivo[2]: self.ListaArbolesBloque[2].append(P) elif self.BloqueActivo[1]: self.ListaArbolesBloque[1].append(P) elif self.BloqueActivo[0]: self.ListaArbolesBloque[0].append(P) else: self.ListaArboles.append(P) #=============================================================== self.Comprueba(12) def ComparacionLogica(self): #================================================================ P = self.ComparacionRelacional() #================================================================ while self.lexico.tipo == 19: self.lexico.sigSimbolo() #================================================================ Q = self.ComparacionRelacional() P = self.Logico(P, Q) #================================================================ #================================================================ return P #================================================================ def ComparacionRelacional(self): #================================================================ P = None Q = None Simbolo = None P = self.Expresion() #================================================================ if self.lexico.tipo == 16: Simbolo = self.lexico.simbolo self.lexico.sigSimbolo() Simbolo += self.lexico.simbolo self.Comprueba(15) #================================================================ Q = self.Expresion() P = self.Relacional(P, Q, Simbolo) #================================================================ elif self.lexico.tipo == 14: Simbolo = self.lexico.simbolo self.lexico.sigSimbolo() #================================================================ Q = self.Expresion() P = self.Relacional(P, Q, Simbolo) #================================================================ #================================================================ return P #================================================================ def P(self): os.system('Pause > Nul')
27.871261
151
0.480894
2,020
21,433
5.100495
0.066337
0.201883
0.108706
0.046588
0.774532
0.740464
0.708046
0.672328
0.61419
0.602543
0
0.020659
0.202771
21,433
768
152
27.907552
0.582314
0.219288
0
0.686499
0
0
0.007327
0
0
0
0
0
0
1
0.036613
false
0
0.011442
0
0.057208
0.01373
0
0
0
null
1
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
0
0
0
0
0
0
4
5bed3b2781e8ac0035dabb90f32cc714cf32d626
67
py
Python
src/ising_animate/examples/__init__.py
davifeliciano/ising_model
7f9beff5647a747a1b64b97012af2c6c040fddb7
[ "MIT" ]
2
2021-10-15T10:58:20.000Z
2021-10-31T15:59:04.000Z
src/ising_animate/examples/__init__.py
davifeliciano/ising_animate
7f9beff5647a747a1b64b97012af2c6c040fddb7
[ "MIT" ]
null
null
null
src/ising_animate/examples/__init__.py
davifeliciano/ising_animate
7f9beff5647a747a1b64b97012af2c6c040fddb7
[ "MIT" ]
null
null
null
""" An set of examples written with the ising_animate package. """
16.75
58
0.731343
10
67
4.8
1
0
0
0
0
0
0
0
0
0
0
0
0.164179
67
3
59
22.333333
0.857143
0.865672
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
75015cfc9373ad495cd4c6e8e7c7a0629cfe1df4
270
py
Python
basicsr/models/losses/__init__.py
Salah856/BasicSR
b96cd11a27727d27676d06353ea782b7fb365da0
[ "Apache-2.0" ]
20
2021-04-12T04:57:15.000Z
2022-02-11T01:55:29.000Z
basicsr/models/losses/__init__.py
Salah856/BasicSR
b96cd11a27727d27676d06353ea782b7fb365da0
[ "Apache-2.0" ]
null
null
null
basicsr/models/losses/__init__.py
Salah856/BasicSR
b96cd11a27727d27676d06353ea782b7fb365da0
[ "Apache-2.0" ]
6
2021-04-10T04:14:50.000Z
2022-03-08T06:14:56.000Z
from .losses import (CharbonnierLoss, GANLoss, GradientPenaltyLoss, L1Loss, MSELoss, PerceptualLoss, WeightedTVLoss) __all__ = [ 'L1Loss', 'MSELoss', 'CharbonnierLoss', 'WeightedTVLoss', 'PerceptualLoss', 'GANLoss', 'GradientPenaltyLoss' ]
33.75
79
0.692593
18
270
10.166667
0.611111
0.284153
0
0
0
0
0
0
0
0
0
0.009132
0.188889
270
7
80
38.571429
0.826484
0
0
0
0
0
0.303704
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
0
1
0
1
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
0
0
0
0
0
4
7511fe4b31f651e8f653e66deca41b585f9ceb04
160
py
Python
astroNN/__init__.py
igomezv/astroNN
50af116f9cbfc684b63e7ddcf8829343a455722b
[ "MIT" ]
156
2017-10-22T01:29:10.000Z
2022-03-14T10:28:09.000Z
astroNN/__init__.py
AbdulfattahBaalawi/astroNN
0b970dd1a8d4d5e6d611ffa52cfd3c2ffdcb4643
[ "MIT" ]
16
2017-11-02T21:29:28.000Z
2022-03-14T08:40:41.000Z
astroNN/__init__.py
AbdulfattahBaalawi/astroNN
0b970dd1a8d4d5e6d611ffa52cfd3c2ffdcb4643
[ "MIT" ]
46
2017-11-01T18:56:03.000Z
2022-03-07T06:44:22.000Z
r""" Deep Learning for Astronomers with Tensorflow """ from pkg_resources import get_distribution version = __version__ = get_distribution('astroNN').version
20
59
0.8
19
160
6.368421
0.789474
0.247934
0
0
0
0
0
0
0
0
0
0
0.11875
160
7
60
22.857143
0.858156
0.28125
0
0
0
0
0.065421
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
75195a26b36a8e0a3b406489c23491b280bee6e2
86
py
Python
example/states.py
BLeAm/trigger
b4bcd5664a91489da6b14386d60481268dc965f5
[ "BSD-3-Clause" ]
null
null
null
example/states.py
BLeAm/trigger
b4bcd5664a91489da6b14386d60481268dc965f5
[ "BSD-3-Clause" ]
null
null
null
example/states.py
BLeAm/trigger
b4bcd5664a91489da6b14386d60481268dc965f5
[ "BSD-3-Clause" ]
null
null
null
from trigger_generator import * @trigger class MyTrigger: counter: int = 0 build()
12.285714
31
0.744186
11
86
5.727273
0.909091
0
0
0
0
0
0
0
0
0
0
0.014085
0.174419
86
7
32
12.285714
0.873239
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.2
0
0.6
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
0
0
1
0
0
4
75346bc09c050a774f7271e22e7006581d4e21d7
144
py
Python
backend/src/applications/session/create_session_request.py
Seina88/attendance-system
afa7ba64c7fd99623a1c5dd3b09151ade759d715
[ "MIT" ]
2
2021-05-12T14:09:44.000Z
2021-06-19T12:38:33.000Z
backend/src/applications/session/create_session_request.py
Seina88/attendance-system
afa7ba64c7fd99623a1c5dd3b09151ade759d715
[ "MIT" ]
10
2021-05-13T12:09:47.000Z
2021-06-07T13:28:17.000Z
backend/src/applications/session/create_session_request.py
Seina88/attendance-system
afa7ba64c7fd99623a1c5dd3b09151ade759d715
[ "MIT" ]
1
2021-06-17T00:54:04.000Z
2021-06-17T00:54:04.000Z
class CreateSessionRequest: def __init__(self, info: str, password: str) -> None: self.info = info self.password = password
28.8
57
0.652778
16
144
5.625
0.5625
0.177778
0
0
0
0
0
0
0
0
0
0
0.25
144
4
58
36
0.833333
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
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
1
0
1
0
0
0
0
0
4
7539b4ea3a23aab986b34ef3f520111a110b9f0f
36
py
Python
modules/2.79/bpy/types/ThemeUserPreferences.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
modules/2.79/bpy/types/ThemeUserPreferences.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
modules/2.79/bpy/types/ThemeUserPreferences.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
ThemeUserPreferences.space = None
9
33
0.805556
3
36
9.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.138889
36
3
34
12
0.935484
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
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
0
0
0
1
0
0
0
0
0
0
4
f334bb348ccf062d4c9bc34a6768ec6a7bb1cbdc
782
py
Python
arekit/contrib/experiment_rusentrel/labels/formatters/rusentiframes.py
nicolay-r/AREk
19c39ec0dc9a17464cade03b9c4da0c6d1d21191
[ "MIT" ]
18
2019-12-14T18:43:11.000Z
2022-03-21T05:55:36.000Z
arekit/contrib/experiment_rusentrel/labels/formatters/rusentiframes.py
nicolay-r/AREk
19c39ec0dc9a17464cade03b9c4da0c6d1d21191
[ "MIT" ]
284
2020-08-08T20:52:44.000Z
2022-03-31T05:26:20.000Z
arekit/contrib/experiment_rusentrel/labels/formatters/rusentiframes.py
nicolay-r/AREk
19c39ec0dc9a17464cade03b9c4da0c6d1d21191
[ "MIT" ]
1
2021-08-07T13:17:43.000Z
2021-08-07T13:17:43.000Z
from arekit.contrib.experiment_rusentrel.labels.types import ExperimentPositiveLabel, ExperimentNegativeLabel from arekit.contrib.source.rusentiframes.labels_fmt import \ RuSentiFramesEffectLabelsFormatter, \ RuSentiFramesLabelsFormatter class ExperimentRuSentiFramesLabelsFormatter(RuSentiFramesLabelsFormatter): @classmethod def _positive_label_type(cls): return ExperimentPositiveLabel @classmethod def _negative_label_type(cls): return ExperimentNegativeLabel class ExperimentRuSentiFramesEffectLabelsFormatter(RuSentiFramesEffectLabelsFormatter): @classmethod def _positive_label_type(cls): return ExperimentPositiveLabel @classmethod def _negative_label_type(cls): return ExperimentNegativeLabel
28.962963
109
0.808184
58
782
10.655172
0.448276
0.090615
0.07767
0.116505
0.407767
0.407767
0.407767
0.407767
0.407767
0.407767
0
0
0.148338
782
26
110
30.076923
0.927928
0
0
0.666667
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.111111
0.222222
0.666667
0
0
0
1
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
1
0
0
0
1
1
0
0
4
f34005571cad86e05e877ec8e710934b0db17bfc
62
py
Python
backend/data/__init__.py
TiFu/runepicker-helper
dcbd7bcce06a80ed5c800b3aaca26d53e4cace8f
[ "MIT" ]
null
null
null
backend/data/__init__.py
TiFu/runepicker-helper
dcbd7bcce06a80ed5c800b3aaca26d53e4cace8f
[ "MIT" ]
1
2018-01-01T03:56:01.000Z
2018-01-01T03:56:01.000Z
backend/data/__init__.py
TiFu/runepicker-helper
dcbd7bcce06a80ed5c800b3aaca26d53e4cace8f
[ "MIT" ]
null
null
null
from .champion import championById from .wiki import wikiById
20.666667
34
0.83871
8
62
6.5
0.75
0
0
0
0
0
0
0
0
0
0
0
0.129032
62
2
35
31
0.962963
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
f350e6d9a49ce60a81d22fe2e932bf1ccbabd6e3
144
py
Python
voicenet/utils/__init__.py
Robofied/Voicenet
cd7c91287dc9f71ef110416879582ddc1383f258
[ "BSD-3-Clause" ]
32
2020-08-08T23:17:02.000Z
2021-03-12T06:04:17.000Z
voicenet/utils/__init__.py
Robofied/Voicenet
cd7c91287dc9f71ef110416879582ddc1383f258
[ "BSD-3-Clause" ]
null
null
null
voicenet/utils/__init__.py
Robofied/Voicenet
cd7c91287dc9f71ef110416879582ddc1383f258
[ "BSD-3-Clause" ]
6
2020-10-28T08:42:49.000Z
2021-02-14T06:43:45.000Z
# from .features_extraction import FeatureExtraction # print("Invoking __init__.py for {}".format(__name__)) # __all__ = ["FeatureExtraction"]
28.8
55
0.763889
14
144
6.928571
0.928571
0
0
0
0
0
0
0
0
0
0
0
0.104167
144
5
56
28.8
0.751938
0.944444
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
f38da31b490b0db1496fd1acce720cb7eec4e1b0
191
py
Python
Y2018/day2/python/day2.py
Khranovskiy/advent-of-code
55167e98b0c6cd8f464ea8fd0402e5558754c37f
[ "MIT" ]
null
null
null
Y2018/day2/python/day2.py
Khranovskiy/advent-of-code
55167e98b0c6cd8f464ea8fd0402e5558754c37f
[ "MIT" ]
null
null
null
Y2018/day2/python/day2.py
Khranovskiy/advent-of-code
55167e98b0c6cd8f464ea8fd0402e5558754c37f
[ "MIT" ]
null
null
null
import itertools print(*[''.join(a for a,b in zip(this,that) if a == b) for this,that in combinations(open('inp', 'r').readlines(),2) if len([a for a,b in zip(this,that) if a != b]) == 1])
38.2
171
0.623037
39
191
3.051282
0.512821
0.067227
0.084034
0.10084
0.386555
0.386555
0.386555
0.386555
0.386555
0.386555
0
0.012422
0.157068
191
4
172
47.75
0.726708
0
0
0
0
0
0.021164
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.5
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
0
1
0
4
f3931b94b3d6fd5f080b0e4d9869f5a54d4ca00e
97
py
Python
polecat/data/examples/helloworld/helloworld/project.py
furious-luke/polecat
7be5110f76dc42b15c922c1bb7d49220e916246d
[ "MIT" ]
4
2019-08-10T12:56:12.000Z
2020-01-21T09:51:20.000Z
polecat/data/examples/helloworld/helloworld/project.py
furious-luke/polecat
7be5110f76dc42b15c922c1bb7d49220e916246d
[ "MIT" ]
71
2019-04-09T05:39:21.000Z
2020-05-16T23:09:24.000Z
polecat/data/examples/helloworld/helloworld/project.py
furious-luke/polecat
7be5110f76dc42b15c922c1bb7d49220e916246d
[ "MIT" ]
null
null
null
from polecat.project import Project class HelloWorldProject(Project): bundle = 'bundle.js'
16.166667
35
0.762887
11
97
6.727273
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.154639
97
5
36
19.4
0.902439
0
0
0
0
0
0.092784
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
f3a728514cc3ba15c513aed141f6d6571efedb54
840
py
Python
grid-navigation-paths-count/tests/test_string_permutations.py
dompuiu/puzzles
539b9aacb5d59f7a1c2c44adfb8a434720922974
[ "MIT" ]
1
2017-08-28T07:04:16.000Z
2017-08-28T07:04:16.000Z
grid-navigation-paths-count/tests/test_string_permutations.py
dompuiu/puzzles
539b9aacb5d59f7a1c2c44adfb8a434720922974
[ "MIT" ]
null
null
null
grid-navigation-paths-count/tests/test_string_permutations.py
dompuiu/puzzles
539b9aacb5d59f7a1c2c44adfb8a434720922974
[ "MIT" ]
null
null
null
from unittest import TestCase from grid_path.string_permutations import Permutations class TestPermutations(TestCase): def test_get_permutations_with_empty_string(self): self.assertEqual(Permutations('').get_permutations(), set([''])) def test_get_permutations_with_one_letter_word(self): self.assertEqual(Permutations('A').get_permutations(), set(['A'])) def test_get_permutations_with_two_letters_word(self): self.assertEqual(Permutations('AB').get_permutations(), set(['AB', 'BA'])) def test_get_permutations_with_three_letters_word(self): self.assertEqual(Permutations('ABC').get_permutations(), set(['ABC', 'ACB', 'BAC', 'BCA', 'CAB', 'CBA'])) def test_get_permutations_with_same_letter_word(self): self.assertEqual(Permutations('AA').get_permutations(), set(['AA']))
44.210526
114
0.732143
102
840
5.676471
0.343137
0.259067
0.086356
0.189983
0.511226
0.286701
0
0
0
0
0
0
0.122619
840
19
115
44.210526
0.785617
0
0
0
0
0
0.039239
0
0
0
0
0
0.384615
1
0.384615
false
0
0.153846
0
0.615385
0
0
0
0
null
1
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
0
0
1
0
0
4
3402fb4068c31fd82422358cf93e1fe33b95a2c5
443
py
Python
app/core/views.py
ariksidney/Webleaf
ec73e16958945243669f0d9e9a96fc8094448396
[ "MIT" ]
5
2018-02-01T21:45:31.000Z
2020-11-01T06:38:46.000Z
app/core/views.py
ariksidney/Webleaf
ec73e16958945243669f0d9e9a96fc8094448396
[ "MIT" ]
null
null
null
app/core/views.py
ariksidney/Webleaf
ec73e16958945243669f0d9e9a96fc8094448396
[ "MIT" ]
2
2018-05-22T17:41:19.000Z
2018-12-25T23:42:32.000Z
from flask import render_template, session, redirect, url_for from flask_login import login_required from . import core @core.route('/', methods=['GET', 'POST']) @login_required def index(): return redirect(url_for('aurora.aurora_overview')) @core.route('/offline.html') def offline(): return core.send_static_file('offline.html') @core.route('/service-worker.js') def sw(): return core.send_static_file('service-worker.js')
22.15
61
0.733634
62
443
5.064516
0.483871
0.085987
0.089172
0.127389
0.152866
0
0
0
0
0
0
0
0.115124
443
19
62
23.315789
0.80102
0
0
0
0
0
0.20316
0.049661
0
0
0
0
0
1
0.230769
true
0
0.230769
0.230769
0.692308
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
1
1
0
0
1
1
0
0
4
34301891806fcf798f0f8afc075d4b593350496b
425
py
Python
jauth/repository/token_base.py
pjongy/jauth
6e09129e263fb64bc7523042715459ebe8215487
[ "MIT" ]
1
2020-09-08T08:15:53.000Z
2020-09-08T08:15:53.000Z
jauth/repository/token_base.py
pjongy/jauth
6e09129e263fb64bc7523042715459ebe8215487
[ "MIT" ]
6
2020-08-03T07:32:45.000Z
2021-08-15T13:15:30.000Z
jauth/repository/token_base.py
pjongy/jauth
6e09129e263fb64bc7523042715459ebe8215487
[ "MIT" ]
1
2020-08-19T08:33:44.000Z
2020-08-19T08:33:44.000Z
import abc from jauth.model.token import Token from jauth.repository import BaseRepository class TokenRepository(BaseRepository, abc.ABC): @abc.abstractmethod async def find_token_by_id(self, _id: str) -> Token: pass @abc.abstractmethod async def create_token(self, user_id: str) -> Token: pass @abc.abstractmethod async def delete_token(self, token_id: str) -> int: pass
22.368421
56
0.698824
55
425
5.254545
0.418182
0.176471
0.228374
0.259516
0.269896
0.269896
0.269896
0.269896
0
0
0
0
0.218824
425
18
57
23.611111
0.870482
0
0
0.461538
0
0
0
0
0
0
0
0
0
1
0
true
0.230769
0.230769
0
0.307692
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
1
1
0
0
0
0
0
4
345f2169a31a17010dd2501e8ae9510278491bd8
4,088
py
Python
Test/test_others.py
LinyueSong/FMLC
2c07d45271b0121c02ad8d86c1646bd6eef6b5d4
[ "BSD-3-Clause-LBNL" ]
null
null
null
Test/test_others.py
LinyueSong/FMLC
2c07d45271b0121c02ad8d86c1646bd6eef6b5d4
[ "BSD-3-Clause-LBNL" ]
null
null
null
Test/test_others.py
LinyueSong/FMLC
2c07d45271b0121c02ad8d86c1646bd6eef6b5d4
[ "BSD-3-Clause-LBNL" ]
null
null
null
import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import time from FMLC.triggering import triggering from FMLC.baseclasses import eFMU from FMLC.stackedclasses import controller_stack class testcontroller1(eFMU): def __init__(self): self.input = {'a': None, 'b': None} self.output = {'c': None} self.init = True def compute(self): self.init= False self.output['c'] = self.input['a'] * self.input['b'] return 'testcontroller1 did a computation!' class testcontroller2(eFMU): def __init__(self): self.input = {'a': None, 'b': None} self.output = {'c': None} self.init = True def compute(self): self.init = False self.output['c'] = self.input['a'] * self.input['b'] time.sleep(0.2) return 'testcontroller2 did a computation!' class testcontroller3(eFMU): def __init__(self): self.input = {'a': None, 'b': None} self.output = {'c': None} self.init = True def compute(self): self.init = False self.output['c'] = self.input['a'] * self.input['b'] time.sleep(1) return 'testcontroller3 did a computation!' class testcontroller4(eFMU): def __init__(self): self.input = {'a': None, 'b': None} self.output = {'c': None} self.init = True def compute(self): self.init = False self.output['c'] = self.input['a'] * self.input['b'] time.sleep(10) return 'testcontroller4 did a computation!' def test_input_errors(): ##CASE1: not all inputs are set. controller = {} controller['forecast1'] = {'fun':testcontroller1, 'sampletime':0} controller['mpc1'] = {'fun':testcontroller2, 'sampletime':'forecast1'} controller['control1'] = {'fun':testcontroller1, 'sampletime':'mpc1'} controller['forecast2'] = {'fun':testcontroller3, 'sampletime':0} controller['forecast3'] = {'fun':testcontroller1, 'sampletime':0} mapping = {} mapping['forecast1_a'] = 10 mapping['forecast1_b'] = 4 mapping['forecast2_a'] = 20 mapping['forecast2_b'] = 4 mapping['forecast3_a'] = 30 mapping['forecast3_b'] = 4 mapping['mpc1_b'] = 'forecast1_a' mapping['control1_a'] = 'mpc1_c' try: controller = controller_stack(controller, mapping, tz=-8, debug=True, parallel=True, timeout=2) AssertionError except KeyError as e: assert 'mapping' in str(e) except: AssertionError ##CASE1: not all given inputs are valid inputs (extra inputs) controller = {} controller['forecast1'] = {'fun':testcontroller1, 'sampletime':0} controller['mpc1'] = {'fun':testcontroller2, 'sampletime':'forecast1'} controller['control1'] = {'fun':testcontroller1, 'sampletime':'mpc1'} controller['forecast2'] = {'fun':testcontroller3, 'sampletime':0} controller['forecast3'] = {'fun':testcontroller1, 'sampletime':0} mapping = {} mapping['forecast1_d'] = 10 mapping['forecast1_a'] = 10 mapping['forecast1_b'] = 4 mapping['forecast2_a'] = 20 mapping['forecast2_b'] = 4 mapping['forecast3_a'] = 30 mapping['forecast3_b'] = 4 mapping['mpc1_a'] = 'forecast1_c' mapping['mpc1_b'] = 'forecast1_a' mapping['control1_a'] = 'mpc1_c' mapping['control1_b'] = 'mpc1_a' try: controller = controller_stack(controller, mapping, tz=-8, debug=True, parallel=True, timeout=2) AssertionError except KeyError as e: assert 'parameter' in str(e) except: AssertionError def test_init_once(): controller = {} controller['forecast1'] = {'fun':testcontroller1, 'sampletime':0} mapping = {} mapping['forecast1_a'] = 10 mapping['forecast1_b'] = 4 controller = controller_stack(controller, mapping, tz=-8, debug=True, parallel=True, timeout=2) obj = controller.controller_objects['forecast1'] for i in range(3): controller.query_control(time.time()) assert controller.controller_objects['forecast1'] is obj
33.235772
103
0.630626
473
4,088
5.327696
0.190275
0.042857
0.031746
0.05754
0.721429
0.700794
0.700794
0.689286
0.689286
0.689286
0
0.033511
0.218933
4,088
122
104
33.508197
0.755716
0.021771
0
0.72381
0
0
0.178723
0
0
0
0
0
0.066667
1
0.095238
false
0
0.057143
0
0.228571
0
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
346cd7a9a5007204522377fa353955cfa4c5b649
304
py
Python
Python_Basics/Programming_in_Python/operators_and_operands.py
samyumobi/A-Complete-Python-Guide-For-Beginners
6ee3d73ebb481dbb5788cb0e615efdaf09079a18
[ "MIT" ]
7
2019-06-04T13:44:27.000Z
2021-01-05T22:42:15.000Z
Python_Basics/Programming_in_Python/operators_and_operands.py
samyumobi/A-Complete-Python-Guide-For-Beginners
6ee3d73ebb481dbb5788cb0e615efdaf09079a18
[ "MIT" ]
null
null
null
Python_Basics/Programming_in_Python/operators_and_operands.py
samyumobi/A-Complete-Python-Guide-For-Beginners
6ee3d73ebb481dbb5788cb0e615efdaf09079a18
[ "MIT" ]
5
2019-09-14T11:37:47.000Z
2021-07-26T19:49:24.000Z
print(100 + 200) # addition print(5 - 2) # subtraction print(3 * 10) # multiplication print(10 / 3) # division print(10 // 3) # integer division print(10 % 3) # modulo print(4**2) # expontation print(10 + 20 / 2) print((10 + 20) / 2)
27.636364
42
0.493421
37
304
4.054054
0.432432
0.233333
0.16
0.213333
0
0
0
0
0
0
0
0.168421
0.375
304
10
43
30.4
0.621053
0.263158
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
1
0
0
0
null
1
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
0
1
0
4
caa09682bc47dad0a063decb3cd264bef8db96d2
44
py
Python
onmydesk/forms/__init__.py
myollie/django-onmydesk
86b6e2697c0136e819ecaf1007062381b8b33b33
[ "MIT" ]
null
null
null
onmydesk/forms/__init__.py
myollie/django-onmydesk
86b6e2697c0136e819ecaf1007062381b8b33b33
[ "MIT" ]
null
null
null
onmydesk/forms/__init__.py
myollie/django-onmydesk
86b6e2697c0136e819ecaf1007062381b8b33b33
[ "MIT" ]
null
null
null
from . import fields __all__ = ('fields',)
11
21
0.659091
5
44
5
0.8
0
0
0
0
0
0
0
0
0
0
0
0.181818
44
3
22
14.666667
0.694444
0
0
0
0
0
0.136364
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
0
0
0
0
1
0
0
0
0
4
cab8ed622f690d7bd2b2adf86e2c56df47234b93
493
py
Python
src/endplay/__init__.py
dominicprice/endplay
9c57a68f83c2044ac0d9863dc2814dcaf4a46664
[ "MIT" ]
4
2021-12-07T12:30:44.000Z
2022-03-26T13:38:25.000Z
src/endplay/__init__.py
dominicprice/endplay
9c57a68f83c2044ac0d9863dc2814dcaf4a46664
[ "MIT" ]
12
2021-11-15T23:06:27.000Z
2022-03-28T15:46:55.000Z
src/endplay/__init__.py
dominicprice/endplay
9c57a68f83c2044ac0d9863dc2814dcaf4a46664
[ "MIT" ]
1
2021-12-07T13:28:40.000Z
2021-12-07T13:28:40.000Z
""" Endplay - A bridge tools library with generating, analysing and scoring. Released under the MIT licence (see the LICENCE file provided with this distribution) """ import endplay._dds as _dds from endplay.dds import * from endplay.dealer import * from endplay.interact import * from endplay.parsers import * from endplay.evaluate import * from endplay.types import * from endplay.config import \ __version__, __version_info__, __author__, \ __buildtime__, suppress_unicode
32.866667
86
0.772819
64
493
5.65625
0.578125
0.212707
0.281768
0
0
0
0
0
0
0
0
0
0.162272
493
15
87
32.866667
0.874092
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.8
null
null
0
0
0
0
null
1
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
1
0
0
0
1
0
0
0
0
4
caf9fe62e6f6b645819d7a7e54ce5b0f0808f31b
104
py
Python
general_reports/apps.py
hisham2k9/IMS-and-CAPA
9f70988a6411c72ab4f0cbc818b84db58a28076f
[ "MIT" ]
null
null
null
general_reports/apps.py
hisham2k9/IMS-and-CAPA
9f70988a6411c72ab4f0cbc818b84db58a28076f
[ "MIT" ]
15
2021-03-19T03:43:56.000Z
2022-03-12T00:30:55.000Z
general_reports/apps.py
hisham2k9/IMS-and-CAPA
9f70988a6411c72ab4f0cbc818b84db58a28076f
[ "MIT" ]
null
null
null
from django.apps import AppConfig class GeneralReportsConfig(AppConfig): name = 'general_reports'
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
1b047cf16b20a98763ea2a38b5df5e5c1c7b38e6
170
py
Python
src/deepsensemaking/__init__.py
deepsensemaking/sensemaking
ba50f75ba591b583f37528f127141588798606e3
[ "Apache-2.0" ]
null
null
null
src/deepsensemaking/__init__.py
deepsensemaking/sensemaking
ba50f75ba591b583f37528f127141588798606e3
[ "Apache-2.0" ]
null
null
null
src/deepsensemaking/__init__.py
deepsensemaking/sensemaking
ba50f75ba591b583f37528f127141588798606e3
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -* """ sensemaking: Auxiliary Python Modules """ from sensemaking.testing import test if __name__ == "__main__": pass
11.333333
37
0.658824
20
170
5.2
0.9
0
0
0
0
0
0
0
0
0
0
0.007246
0.188235
170
14
38
12.142857
0.746377
0.464706
0
0
0
0
0.1
0
0
0
0
0
0
1
0
true
0.333333
0.333333
0
0.333333
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
0
0
0
0
1
1
1
0
0
0
0
4
1b137dd7c089159ce158dcea686a9000b6de7658
8,024
py
Python
alphamind/tests/portfolio/test_optimizers.py
rongliang-tech/alpha-mind
39f720974c637d17e185e445dc05c9fc4863a241
[ "MIT" ]
186
2017-11-27T01:26:44.000Z
2022-03-28T16:11:33.000Z
alphamind/tests/portfolio/test_optimizers.py
rongliang-tech/alpha-mind
39f720974c637d17e185e445dc05c9fc4863a241
[ "MIT" ]
2
2017-12-19T02:47:36.000Z
2021-01-09T05:25:18.000Z
alphamind/tests/portfolio/test_optimizers.py
vishalbelsare/alpha-mind
9b7a23bc3354103f16e46ea31fd1ba6c7b69e0ae
[ "MIT" ]
65
2017-11-27T01:26:47.000Z
2022-03-17T10:50:52.000Z
# -*- coding: utf-8 -*- """ Created on 2017-11-1 @author: cheng.li """ import unittest import numpy as np from alphamind.portfolio.optimizers import LPOptimizer from alphamind.portfolio.optimizers import QuadraticOptimizer from alphamind.portfolio.optimizers import TargetVolOptimizer class TestOptimizers(unittest.TestCase): def test_lpoptimizer(self): er = np.array([-1., -2.]) lower_bound = np.array([0., 0.2]) upper_bound = np.array([1., 0.8]) optimizer = LPOptimizer(objective=-er, cons_matrix=np.array([[1., 1., 1., 1.]]), lbound=lower_bound, ubound=upper_bound) self.assertAlmostEqual(optimizer.feval(), 1.2) np.testing.assert_array_almost_equal(optimizer.x_value(), [0.8, 0.2]) def test_qpoptimizer(self): er = np.array([0.01, 0.02, 0.03]) cov = np.array([[0.02, 0.01, 0.02], [0.01, 0.02, 0.03], [0.02, 0.03, 0.02]]) ids_var = np.diag([0.01, 0.02, 0.03]) cov += ids_var lbound = np.array([0., 0., 0.]) ubound = np.array([0.4, 0.4, 0.5]) cons = np.array([[1., 1., 1.], [1., 0., 1.]]) clbound = np.array([1., 0.3]) cubound = np.array([1., 0.7]) cons_matrix = np.concatenate([cons, clbound.reshape((-1, 1)), cubound.reshape((-1, 1))], axis=1) optimizer = QuadraticOptimizer(objective=-er, cov=cov, lbound=lbound, ubound=ubound, cons_matrix=cons_matrix) # check against matlab result np.testing.assert_array_almost_equal(optimizer.x_value(), [0.2, 0.3, 0.5], 4) def test_qpoptimizer_with_factor_model(self): er = np.array([0.1, 0.2, 0.3]) lbound = np.array([0.0, 0.0, 0.0]) ubound = np.array([1.0, 1.0, 1.0]) factor_var = np.array([[0.5, -0.3], [-0.3, 0.7]]) factor_load = np.array([[0.8, 0.2], [0.5, 0.5], [0.2, 0.8]]) idsync = np.array([0.1, 0.3, 0.2]) cons = np.array([[1., 1., 1.]]) clbound = np.array([1.]) cubound = np.array([1.]) cons_matrix = np.concatenate([cons, clbound.reshape((-1, 1)), cubound.reshape((-1, 1))], axis=1) optimizer = QuadraticOptimizer(objective=-er, lbound=lbound, ubound=ubound, factor_cov=factor_var, factor_load=factor_load, factor_special=idsync, cons_matrix=cons_matrix) # check against cvxpy result np.testing.assert_array_almost_equal(optimizer.x_value(), [0.2866857, 0.21416417, 0.49915014], 4) def test_qpoptimizer_with_identity_matrix(self): er = np.array([-0.02, 0.01, 0.03]) cov = np.diag([1., 1., 1.]) optimizer = QuadraticOptimizer(objective=-er, cov=cov) np.testing.assert_array_almost_equal(optimizer.x_value(), [-0.02, 0.01, 0.03], 4) def test_target_vol_optimizer_without_cons(self): er = np.array([0.1, 0.2, 0.3]) cov = np.array([[0.05, 0.01, 0.02], [0.01, 0.06, 0.03], [0.02, 0.03, 0.07]]) lbound = np.array([-0.3, -0.3, -0.3]) ubound = np.array([0.5, 0.5, 0.5]) target_vol = 0.1 optimizer = TargetVolOptimizer(objective=-er, cov=cov, lbound=lbound, ubound=ubound, target_vol=target_vol) # check against known good result np.testing.assert_array_almost_equal(optimizer.x_value(), [.0231776, 0.1274768, 0.30130881], 4) def test_target_vol_optimizer_with_cons(self): er = np.array([0.1, 0.2, 0.3]) cov = np.array([[0.05, 0.01, 0.02], [0.01, 0.06, 0.03], [0.02, 0.03, 0.07]]) lbound = np.array([-0.3, -0.3, -0.3]) ubound = np.array([0.5, 0.5, 0.5]) cons = np.array([[1., 1., 1.]]) clbound = np.array([0.]) cubound = np.array([0.]) cons_matrix = np.concatenate([cons, clbound.reshape((-1, 1)), cubound.reshape((-1, 1))], axis=1) target_vol = 0.1 optimizer = TargetVolOptimizer(objective=-er, cov=cov, lbound=lbound, ubound=ubound, target_vol=target_vol, cons_matrix=cons_matrix) # check against known good result np.testing.assert_array_almost_equal(optimizer.x_value(), [-0.3, -0.10919033, 0.40919033], 4) def test_target_vol_optimizer_with_factor_model(self): er = np.array([0.1, 0.2, 0.3]) lbound = np.array([0.0, 0.0, 0.0]) ubound = np.array([1.0, 1.0, 1.0]) factor_var = np.array([[0.5, -0.3], [-0.3, 0.7]]) factor_load = np.array([[0.8, 0.2], [0.5, 0.5], [0.2, 0.8]]) idsync = np.array([0.1, 0.3, 0.2]) cons = np.array([[1., 1., 1.]]) clbound = np.array([1.]) cubound = np.array([1.]) target_vol = 0.5 cons_matrix = np.concatenate([cons, clbound.reshape((-1, 1)), cubound.reshape((-1, 1))], axis=1) optimizer = TargetVolOptimizer(objective=-er, factor_cov=factor_var, factor_load=factor_load, factor_special=idsync, lbound=lbound, ubound=ubound, target_vol=target_vol, cons_matrix=cons_matrix) # check against cvxpy result np.testing.assert_array_almost_equal(optimizer.x_value(), [0.26595552, 0.21675092, 0.51729356], 4) def test_target_vol_with_cons_and_ieq(self): er = np.array([0.1, 0.2, 0.3]) cov = np.array([[0.05, 0.01, 0.02], [0.01, 0.06, 0.03], [0.02, 0.03, 0.07]]) lbound = np.array([-0.3, -0.3, -0.3]) ubound = np.array([0.5, 0.5, 0.5]) cons = np.array([[1., 1., 1.]]) clbound = np.array([0.]) cubound = np.array([0.]) target_vol = 0.1 cons_matrix = np.concatenate([cons, clbound.reshape((-1, 1)), cubound.reshape((-1, 1))], axis=1) optimizer = TargetVolOptimizer(objective=-er, cov=cov, lbound=lbound, ubound=ubound, target_vol=target_vol, cons_matrix=cons_matrix) # check against known good result np.testing.assert_array_almost_equal(optimizer.x_value(), [-0.3, -0.10919033, 0.40919033], 4) if __name__ == '__main__': unittest.main()
40.321608
104
0.436565
927
8,024
3.649407
0.111111
0.09932
0.075672
0.030742
0.824121
0.762637
0.729826
0.679574
0.665977
0.665977
0
0.112777
0.426471
8,024
198
105
40.525253
0.622338
0.02991
0
0.686667
0
0
0.00103
0
0
0
0
0
0.06
1
0.053333
false
0
0.033333
0
0.093333
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
1b343b7086a4192bb719a50e112fd1aa354ded20
8,271
py
Python
third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
third_party/blink/renderer/build/scripts/blinkbuild/name_style_converter_test.py
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # pylint: disable=import-error,print-statement,relative-import,protected-access """Unit tests for name_style_converter.py.""" import unittest from name_style_converter import NameStyleConverter from name_style_converter import tokenize_name class SmartTokenizerTest(unittest.TestCase): def test_simple_cases(self): self.assertEqual(tokenize_name('foo'), ['foo']) self.assertEqual(tokenize_name('fooBar'), ['foo', 'Bar']) self.assertEqual(tokenize_name('fooBarBaz'), ['foo', 'Bar', 'Baz']) self.assertEqual(tokenize_name('Baz'), ['Baz']) self.assertEqual(tokenize_name(''), []) self.assertEqual(tokenize_name('FOO'), ['FOO']) self.assertEqual(tokenize_name('foo2'), ['foo', '2']) def test_tricky_cases(self): self.assertEqual(tokenize_name('XMLHttpRequest'), ['XML', 'Http', 'Request']) self.assertEqual(tokenize_name('HTMLElement'), ['HTML', 'Element']) self.assertEqual(tokenize_name('WebGLRenderingContext'), ['WebGL', 'Rendering', 'Context']) self.assertEqual(tokenize_name('CanvasRenderingContext2D'), ['Canvas', 'Rendering', 'Context', '2D']) self.assertEqual(tokenize_name('CanvasRenderingContext2DAPITest'), ['Canvas', 'Rendering', 'Context', '2D', 'API', 'Test']) self.assertEqual(tokenize_name('SVGSVGElement'), ['SVG', 'SVG', 'Element']) self.assertEqual(tokenize_name('CanvasRenderingContext2D'), ['Canvas', 'Rendering', 'Context', '2D']) self.assertEqual(tokenize_name('CSSURLImageValue'), ['CSS', 'URL', 'Image', 'Value']) self.assertEqual(tokenize_name('CSSPropertyAPID'), ['CSS', 'Property', 'API', 'D']) self.assertEqual(tokenize_name('AXARIAGridCell'), ['AX', 'ARIA', 'Grid', 'Cell']) self.assertEqual(tokenize_name('CDATASection'), ['CDATA', 'Section']) self.assertEqual(tokenize_name('ASCIICType'), ['ASCII', 'CType']) self.assertEqual(tokenize_name('CString'), ['CString']) self.assertEqual(tokenize_name('HTMLDListElement'), ['HTML', 'DList', 'Element']) self.assertEqual(tokenize_name('HTMLOListElement'), ['HTML', 'OList', 'Element']) self.assertEqual(tokenize_name('HTMLIFrameElement'), ['HTML', 'IFrame', 'Element']) self.assertEqual(tokenize_name('HTMLPlugInElement'), ['HTML', 'PlugIn', 'Element']) # No special handling for OptGroup, FieldSet, and TextArea. self.assertEqual(tokenize_name('HTMLOptGroupElement'), ['HTML', 'Opt', 'Group', 'Element']) self.assertEqual(tokenize_name('HTMLFieldSetElement'), ['HTML', 'Field', 'Set', 'Element']) self.assertEqual(tokenize_name('HTMLTextAreaElement'), ['HTML', 'Text', 'Area', 'Element']) self.assertEqual(tokenize_name('Path2D'), ['Path', '2D']) self.assertEqual(tokenize_name('Point2D'), ['Point', '2D']) self.assertEqual(tokenize_name('CanvasRenderingContext2DState'), ['Canvas', 'Rendering', 'Context', '2D', 'State']) self.assertEqual(tokenize_name('Accelerated2dCanvas'), ['Accelerated', '2d', 'Canvas']) self.assertEqual(tokenize_name('RTCDTMFSender'), ['RTC', 'DTMF', 'Sender']) self.assertEqual(tokenize_name('WebGLCompressedTextureS3TCsRGB'), ['WebGL', 'Compressed', 'Texture', 'S3TC', 'sRGB']) self.assertEqual(tokenize_name('WebGL2CompressedTextureETC1'), ['WebGL2', 'Compressed', 'Texture', 'ETC1']) self.assertEqual(tokenize_name('EXTsRGB'), ['EXT', 'sRGB']) # 'PVRTC' contains a special token 'RTC', but it should be a # single token. self.assertEqual(tokenize_name('WebGLCompressedTexturePVRTC'), ['WebGL', 'Compressed', 'Texture', 'PVRTC']) self.assertEqual(tokenize_name('SVGFEBlendElement'), ['SVG', 'FE', 'Blend', 'Element']) self.assertEqual(tokenize_name('SVGMPathElement'), ['SVG', 'MPath', 'Element']) self.assertEqual(tokenize_name('SVGTSpanElement'), ['SVG', 'TSpan', 'Element']) self.assertEqual(tokenize_name('SVGURIReference'), ['SVG', 'URI', 'Reference']) self.assertEqual(tokenize_name('UTF16TextIterator'), ['UTF16', 'Text', 'Iterator']) self.assertEqual(tokenize_name('UTF8Decoder'), ['UTF8', 'Decoder']) self.assertEqual(tokenize_name('Uint8Array'), ['Uint8', 'Array']) self.assertEqual(tokenize_name('DOMWindowBase64'), ['DOM', 'Window', 'Base64']) self.assertEqual(tokenize_name('TextCodecLatin1'), ['Text', 'Codec', 'Latin1']) self.assertEqual(tokenize_name('V8BindingForCore'), ['V8', 'Binding', 'For', 'Core']) self.assertEqual(tokenize_name('V8DOMRect'), ['V8', 'DOM', 'Rect']) self.assertEqual(tokenize_name('String16MojomTraits'), ['String16', 'Mojom', 'Traits']) self.assertEqual(tokenize_name('V0InsertionPoint'), ['V0', 'Insertion', 'Point']) self.assertEqual(tokenize_name('ShadowDOMV0Test'), ['Shadow', 'DOM', 'V0', 'Test']) self.assertEqual(tokenize_name('ElementShadowV0'), ['Element', 'Shadow', 'V0']) self.assertEqual(tokenize_name('StubChromeClientForSPv2'), ['Stub', 'Chrome', 'Client', 'For', 'SPv2']) self.assertEqual(tokenize_name('SQLiteAuthorizer'), ['SQLite', 'Authorizer']) self.assertEqual(tokenize_name('XPathEvaluator'), ['XPath', 'Evaluator']) self.assertEqual(tokenize_name('IsXHTMLDocument'), ['Is', 'XHTML', 'Document']) self.assertEqual(tokenize_name('isHTMLDocument'), ['is', 'HTML', 'Document']) self.assertEqual(tokenize_name('matrix3d'), ['matrix', '3d']) def test_ignoring_characters(self): self.assertEqual(tokenize_name('Animation.idl'), ['Animation', 'idl']) self.assertEqual(tokenize_name('-webkit-appearance'), ['webkit', 'appearance']) self.assertEqual(tokenize_name(' foo_bar!#"$'), ['foo', 'bar']) class NameStyleConverterTest(unittest.TestCase): def test_snake_case(self): converter = NameStyleConverter('HTMLElement') self.assertEqual(converter.to_snake_case(), 'html_element') def test_upper_camel_case(self): converter = NameStyleConverter('someSuperThing') self.assertEqual(converter.to_upper_camel_case(), 'SomeSuperThing') converter = NameStyleConverter('SVGElement') self.assertEqual(converter.to_upper_camel_case(), 'SVGElement') converter = NameStyleConverter('cssExternalScannerPreload') self.assertEqual(converter.to_upper_camel_case(), 'CSSExternalScannerPreload') converter = NameStyleConverter('xpathExpression') self.assertEqual(converter.to_upper_camel_case(), 'XPathExpression') converter = NameStyleConverter('feDropShadow') self.assertEqual(converter.to_upper_camel_case(), 'FEDropShadow') def test_lower_camel_case(self): converter = NameStyleConverter('someSuperThing') self.assertEqual(converter.to_lower_camel_case(), 'someSuperThing') converter = NameStyleConverter('SVGElement') self.assertEqual(converter.to_lower_camel_case(), 'svgElement') converter = NameStyleConverter('documentURI') self.assertEqual(converter.to_lower_camel_case(), 'documentURI') converter = NameStyleConverter('-webkit-margin-start') self.assertEqual(converter.to_lower_camel_case(), 'webkitMarginStart') converter = NameStyleConverter('Accelerated2dCanvas') self.assertEqual(converter.to_lower_camel_case(), 'accelerated2dCanvas') def test_macro_case(self): converter = NameStyleConverter('WebGLBaz2D') self.assertEqual(converter.to_macro_case(), 'WEBGL_BAZ_2D') def test_all_cases(self): converter = NameStyleConverter('SVGScriptElement') self.assertEqual(converter.to_all_cases(), { 'snake_case': 'svg_script_element', 'upper_camel_case': 'SVGScriptElement', 'macro_case': 'SVG_SCRIPT_ELEMENT', })
51.69375
99
0.66171
766
8,271
6.971279
0.313316
0.205056
0.258427
0.303371
0.330899
0.183333
0.174906
0.122846
0.122846
0.122846
0
0.009094
0.175674
8,271
159
100
52.018868
0.774127
0.048966
0
0.071429
0
0
0.280112
0.036415
0
0
0
0
0.651786
1
0.071429
false
0
0.026786
0
0.116071
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
59f2c5321c50b54fb66bc8b52178a565d9a8c75a
27
py
Python
wiserHeatingAPI/__init__.py
TobyLL/wiserheatingapi
40121f772b4f6a4edb4bd4998a50e0f308abecd7
[ "MIT" ]
16
2019-12-07T14:06:33.000Z
2022-03-28T18:54:11.000Z
wiserHeatingAPI/__init__.py
TobyLL/wiserheatingapi
40121f772b4f6a4edb4bd4998a50e0f308abecd7
[ "MIT" ]
23
2019-05-02T18:47:39.000Z
2022-03-27T19:36:52.000Z
wiserHeatingAPI/__init__.py
TobyLL/wiserheatingapi
40121f772b4f6a4edb4bd4998a50e0f308abecd7
[ "MIT" ]
16
2019-11-28T20:50:31.000Z
2022-03-28T18:54:22.000Z
name = "wiser-heating-api"
13.5
26
0.703704
4
27
4.75
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
27
1
27
27
0.791667
0
0
0
0
0
0.62963
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
0
0
0
1
0
0
0
0
0
0
0
0
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
94096f2bad3c7c302b005addf55c6225c7a650ed
98
py
Python
utils_v2/__init__.py
lamnguyen95/pyutils_v2
cfa0f3b44427503cb8973614447a77166f70a59f
[ "MIT" ]
null
null
null
utils_v2/__init__.py
lamnguyen95/pyutils_v2
cfa0f3b44427503cb8973614447a77166f70a59f
[ "MIT" ]
null
null
null
utils_v2/__init__.py
lamnguyen95/pyutils_v2
cfa0f3b44427503cb8973614447a77166f70a59f
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 from __future__ import absolute_import from utils_v2.get_stats import *
16.333333
38
0.795918
15
98
4.733333
0.8
0
0
0
0
0
0
0
0
0
0
0.023529
0.132653
98
5
39
19.6
0.811765
0.214286
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
9457c02c515d997315f3cced4d5cb4883d8f0e96
7,746
py
Python
release/stubs.min/System/Windows/Forms/__init___parts/KeysConverter.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/Windows/Forms/__init___parts/KeysConverter.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
release/stubs.min/System/Windows/Forms/__init___parts/KeysConverter.py
tranconbv/ironpython-stubs
a601759e6c6819beff8e6b639d18a24b7e351851
[ "MIT" ]
null
null
null
class KeysConverter(TypeConverter,IComparer): """ Provides a System.ComponentModel.TypeConverter to convert System.Windows.Forms.Keys objects to and from other representations. KeysConverter() """ def Instance(self): """ This function has been arbitrarily put into the stubs""" return KeysConverter() def CanConvertFrom(self,*__args): """ CanConvertFrom(self: KeysConverter,context: ITypeDescriptorContext,sourceType: Type) -> bool Returns a value indicating whether this converter can convert an object in the specified source type to the native type of the converter using the specified context. context: An System.ComponentModel.ITypeDescriptorContext that provides a format context,which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null. sourceType: The System.Type to convert from. Returns: true if the conversion can be performed; otherwise,false. """ pass def CanConvertTo(self,*__args): """ CanConvertTo(self: KeysConverter,context: ITypeDescriptorContext,destinationType: Type) -> bool Returns a value indicating whether this converter can convert an object in the specified source type to the native type of the converter using the specified context. context: An System.ComponentModel.ITypeDescriptorContext that provides a format context,which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null. destinationType: The System.Type to convert to. Returns: true if the conversion can be performed; otherwise,false. """ pass def Compare(self,a,b): """ Compare(self: KeysConverter,a: object,b: object) -> int Compares two key values for equivalence. a: An System.Object that represents the first key to compare. b: An System.Object that represents the second key to compare. Returns: An integer indicating the relationship between the two parameters.Value Type Condition A negative integer. a is less than b. zero a equals b. A positive integer. a is greater than b. """ pass def ConvertFrom(self,*__args): """ ConvertFrom(self: KeysConverter,context: ITypeDescriptorContext,culture: CultureInfo,value: object) -> object Converts the specified object to the converter's native type. context: An ITypeDescriptorContext that provides a format context,which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null. culture: A CultureInfo object to provide locale information. value: The object to convert. Returns: An object that represents the converted value. """ pass def ConvertTo(self,*__args): """ ConvertTo(self: KeysConverter,context: ITypeDescriptorContext,culture: CultureInfo,value: object,destinationType: Type) -> object Converts the specified object to the specified destination type. context: An System.ComponentModel.ITypeDescriptorContext that provides a format context,which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null. culture: A System.Globalization.CultureInfo to provide locale information. value: The System.Object to convert. destinationType: The System.Type to convert the object to. Returns: An System.Object that represents the converted value. """ pass def GetConvertFromException(self,*args): """ GetConvertFromException(self: TypeConverter,value: object) -> Exception Returns an exception to throw when a conversion cannot be performed. value: The System.Object to convert,or null if the object is not available. Returns: An System.Exception that represents the exception to throw when a conversion cannot be performed. """ pass def GetConvertToException(self,*args): """ GetConvertToException(self: TypeConverter,value: object,destinationType: Type) -> Exception Returns an exception to throw when a conversion cannot be performed. value: The System.Object to convert,or null if the object is not available. destinationType: A System.Type that represents the type the conversion was trying to convert to. Returns: An System.Exception that represents the exception to throw when a conversion cannot be performed. """ pass def GetStandardValues(self,context=None): """ GetStandardValues(self: KeysConverter,context: ITypeDescriptorContext) -> StandardValuesCollection Returns a collection of standard values for the data type that this type converter is designed for when provided with a format context. context: An System.ComponentModel.ITypeDescriptorContext that provides a format context,which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null. Returns: A System.ComponentModel.TypeConverter.StandardValuesCollection that holds a standard set of valid values,which can be empty if the data type does not support a standard set of values. """ pass def GetStandardValuesExclusive(self,context=None): """ GetStandardValuesExclusive(self: KeysConverter,context: ITypeDescriptorContext) -> bool Determines if the list of standard values returned from GetStandardValues is an exclusive list using the specified System.ComponentModel.ITypeDescriptorContext. context: A formatter context. This object can be used to extract additional information about the environment this converter is being invoked from. This may be null,so you should always check. Also,properties on the context object may also return null. Returns: true if the collection returned from erload:System.Windows.Forms.KeysConverter.GetStandardValues is an exhaustive list of possible values; otherwise,false if other values are possible. The default implementation for this method always returns false. """ pass def GetStandardValuesSupported(self,context=None): """ GetStandardValuesSupported(self: KeysConverter,context: ITypeDescriptorContext) -> bool Gets a value indicating whether this object supports a standard set of values that can be picked from a list. context: An System.ComponentModel.ITypeDescriptorContext that provides a format context,which can be used to extract additional information about the environment this converter is being invoked from. This parameter or properties of this parameter can be null. Returns: Always returns true. """ pass def SortProperties(self,*args): """ SortProperties(self: TypeConverter,props: PropertyDescriptorCollection,names: Array[str]) -> PropertyDescriptorCollection Sorts a collection of properties. props: A System.ComponentModel.PropertyDescriptorCollection that has the properties to sort. names: An array of names in the order you want the properties to appear in the collection. Returns: A System.ComponentModel.PropertyDescriptorCollection that contains the sorted properties. """ pass def __cmp__(self,*args): """ x.__cmp__(y) <==> cmp(x,y) """ 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
56.540146
264
0.760134
982
7,746
5.9389
0.188391
0.014575
0.028807
0.055213
0.554184
0.503601
0.463649
0.45096
0.410151
0.410151
0
0
0.181255
7,746
136
265
56.955882
0.919584
0.856055
0
0.448276
0
0
0
0
0
0
0
0
0
1
0.482759
false
0.448276
0
0
0.551724
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
1
0
0
1
0
0
4
94838b447f288f0f3ba867f1892d06737fc71e59
274
py
Python
nes/video/video_out.py
Hexadorsimal/pynes
dbb3d40c1240fa27f70fa798bcec09188755eec2
[ "MIT" ]
1
2017-05-13T18:57:09.000Z
2017-05-13T18:57:09.000Z
nes/video/video_out.py
Hexadorsimal/py6502
dbb3d40c1240fa27f70fa798bcec09188755eec2
[ "MIT" ]
7
2020-10-24T17:16:56.000Z
2020-11-01T14:10:23.000Z
nes/video/video_out.py
Hexadorsimal/pynes
dbb3d40c1240fa27f70fa798bcec09188755eec2
[ "MIT" ]
null
null
null
class VideoOut: def power_up(self): pass def power_down(self): pass def pixel(self, x, y, color): raise NotImplementedError def hsync(self): raise NotImplementedError def vsync(self): raise NotImplementedError
17.125
33
0.613139
30
274
5.533333
0.533333
0.433735
0.13253
0
0
0
0
0
0
0
0
0
0.317518
274
15
34
18.266667
0.887701
0
0
0.454545
0
0
0
0
0
0
0
0
0
1
0.454545
false
0.181818
0
0
0.545455
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
1
0
0
1
0
0
4
8495bbe3898eb480aa9f03c853f66f901349c792
131
py
Python
src/titiler/mosaic/titiler/mosaic/__init__.py
kalxas/titiler
5e4e497f1033eb64b65315068c094abe8259cd8c
[ "MIT" ]
null
null
null
src/titiler/mosaic/titiler/mosaic/__init__.py
kalxas/titiler
5e4e497f1033eb64b65315068c094abe8259cd8c
[ "MIT" ]
null
null
null
src/titiler/mosaic/titiler/mosaic/__init__.py
kalxas/titiler
5e4e497f1033eb64b65315068c094abe8259cd8c
[ "MIT" ]
null
null
null
"""titiler.mosaic""" __version__ = "0.6.0" from . import errors, factory # noqa from .factory import MosaicTilerFactory # noqa
18.714286
47
0.709924
16
131
5.5625
0.6875
0
0
0
0
0
0
0
0
0
0
0.027273
0.160305
131
6
48
21.833333
0.781818
0.19084
0
0
0
0
0.050505
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
84a6cd5082efaf016fbef37042aace16f959eab9
18
py
Python
src/carim_discord_bot/__init__.py
schana/carim-discord-bot
c1f5e868404744667156af7ad6d244939998b5a2
[ "Apache-2.0" ]
14
2020-04-06T17:58:09.000Z
2022-02-28T13:29:35.000Z
src/carim_discord_bot/__init__.py
schana/carim-discord-bot
c1f5e868404744667156af7ad6d244939998b5a2
[ "Apache-2.0" ]
48
2020-04-05T11:24:10.000Z
2021-03-10T08:12:19.000Z
src/carim_discord_bot/__init__.py
schana/carim-discord-bot
c1f5e868404744667156af7ad6d244939998b5a2
[ "Apache-2.0" ]
12
2020-03-31T15:08:56.000Z
2021-09-07T17:54:49.000Z
VERSION = '2.2.5'
9
17
0.555556
4
18
2.5
0.75
0
0
0
0
0
0
0
0
0
0
0.2
0.166667
18
1
18
18
0.466667
0
0
0
0
0
0.277778
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
0
0
0
1
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
84c8df82e552b65a037ab2ac93499beb7d3f4ce6
17
py
Python
tests/unit/test_modulegraph/testpkg-packages/pkg/__init__.py
hawkhai/pyinstaller
016a24479b34de161792c72dde455a81ad4c78ae
[ "Apache-2.0" ]
9,267
2015-01-01T04:08:45.000Z
2022-03-31T11:42:38.000Z
tests/unit/test_modulegraph/testpkg-packages/pkg/__init__.py
jeremysanders/pyinstaller
321b24f9a9a5978337735816b36ca6b4a90a2fb4
[ "Apache-2.0" ]
5,150
2015-01-01T12:09:56.000Z
2022-03-31T18:06:12.000Z
tests/unit/test_modulegraph/testpkg-packages/pkg/__init__.py
jeremysanders/pyinstaller
321b24f9a9a5978337735816b36ca6b4a90a2fb4
[ "Apache-2.0" ]
2,101
2015-01-03T10:25:27.000Z
2022-03-30T11:04:42.000Z
""" pkg.init """
8.5
16
0.411765
2
17
3.5
1
0
0
0
0
0
0
0
0
0
0
0
0.176471
17
1
17
17
0.5
0.470588
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
1
0
0
0
0
0
0
4
84f61cc819273f981873ca10d7d5a31e63780573
18
py
Python
cli/tests/__init__.py
2O4/keyt
33d990afc7c31263fe7699ea89bfb738b119ee30
[ "MIT" ]
null
null
null
cli/tests/__init__.py
2O4/keyt
33d990afc7c31263fe7699ea89bfb738b119ee30
[ "MIT" ]
null
null
null
cli/tests/__init__.py
2O4/keyt
33d990afc7c31263fe7699ea89bfb738b119ee30
[ "MIT" ]
null
null
null
"""Keyt tests."""
9
17
0.5
2
18
4.5
1
0
0
0
0
0
0
0
0
0
0
0
0.111111
18
1
18
18
0.5625
0.611111
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
1
0
0
0
0
0
0
4
170312b7141963655650485f4661705b2e62493e
325
py
Python
faker/providers/lorem/tl_PH/__init__.py
jacksmith15/faker
bc5dda1983e4d055aa2698ccf0806a462cb8370e
[ "MIT" ]
12,077
2015-01-01T18:30:07.000Z
2022-03-31T23:22:01.000Z
faker/providers/lorem/tl_PH/__init__.py
jacksmith15/faker
bc5dda1983e4d055aa2698ccf0806a462cb8370e
[ "MIT" ]
1,306
2015-01-03T05:18:55.000Z
2022-03-31T02:43:04.000Z
faker/providers/lorem/tl_PH/__init__.py
jacksmith15/faker
bc5dda1983e4d055aa2698ccf0806a462cb8370e
[ "MIT" ]
1,855
2015-01-08T14:20:10.000Z
2022-03-25T17:23:32.000Z
from ..fil_PH import Provider as FilPhProvider class Provider(FilPhProvider): """Implement lorem provider for ``tl_PH`` locale. There is no difference from the |FilPhLoremProvider|. .. |FilPhLoremProvider| replace:: :meth:`FilPhLoremProvider <faker.providers.lorem.fil_PH.Provider>` """ pass
23.214286
74
0.704615
35
325
6.457143
0.685714
0.044248
0
0
0
0
0
0
0
0
0
0
0.187692
325
13
75
25
0.856061
0.636923
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.333333
0.333333
0
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
0
0
0
0
1
1
1
0
1
0
0
4
ca11dbc4d9439505783780a1ac66f13e604391c0
197
py
Python
pypardot/objects_v3/tests/__init__.py
andyoneal/PyPardotSF
90e3ef1d0eda44daea08d6db5312e8ca7fcaa00d
[ "MIT" ]
2
2021-02-16T18:20:09.000Z
2021-04-25T14:42:21.000Z
pypardot/objects_v3/tests/__init__.py
andyoneal/PyPardotSF
90e3ef1d0eda44daea08d6db5312e8ca7fcaa00d
[ "MIT" ]
3
2021-02-08T19:33:51.000Z
2022-03-07T19:01:38.000Z
pypardot/objects_v3/tests/__init__.py
andyoneal/PyPardotSF
90e3ef1d0eda44daea08d6db5312e8ca7fcaa00d
[ "MIT" ]
3
2021-02-26T13:26:09.000Z
2021-09-02T10:46:05.000Z
# This module (objects) was originally imported from Josh Geller's original implementation # https://github.com/joshgeller/PyPardot/tree/349dde1fad561f32a425324005c4f2a0c4a23d9b/pypardot/objects
39.4
103
0.84264
21
197
7.904762
0.904762
0
0
0
0
0
0
0
0
0
0
0.138122
0.081218
197
4
104
49.25
0.779006
0.964467
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
ca3733532721a60236012ad96421b736735dbe90
161
py
Python
openregistry/assets/core/events.py
EBRD-ProzorroSale/openregistry.assets.core
e4ce9a0de9bcd9ae19ea3350c5c7f1f2bd5340e7
[ "Apache-2.0" ]
null
null
null
openregistry/assets/core/events.py
EBRD-ProzorroSale/openregistry.assets.core
e4ce9a0de9bcd9ae19ea3350c5c7f1f2bd5340e7
[ "Apache-2.0" ]
52
2017-08-01T16:12:27.000Z
2019-02-22T14:22:57.000Z
openregistry/assets/core/events.py
EBRD-ProzorroSale/openregistry.assets.core
e4ce9a0de9bcd9ae19ea3350c5c7f1f2bd5340e7
[ "Apache-2.0" ]
12
2017-07-31T09:15:51.000Z
2018-09-14T11:02:27.000Z
# -*- coding: utf-8 -*- class AssetInitializeEvent(object): """ Asset initialization event. """ def __init__(self, asset): self.asset = asset
17.888889
39
0.614907
16
161
5.9375
0.75
0.189474
0
0
0
0
0
0
0
0
0
0.008065
0.229814
161
8
40
20.125
0.758065
0.31677
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
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
1
0
0
0
0
1
0
0
4
ca380416f81acdcdf6448451bcd8ee47fa6bf3b5
2,437
py
Python
test/test_list_transactions_by_address_response_item.py
xan187/Crypto_APIs_2.0_SDK_Python
a56c75df54ef037b39be1315ed6e54de35bed55b
[ "MIT" ]
null
null
null
test/test_list_transactions_by_address_response_item.py
xan187/Crypto_APIs_2.0_SDK_Python
a56c75df54ef037b39be1315ed6e54de35bed55b
[ "MIT" ]
null
null
null
test/test_list_transactions_by_address_response_item.py
xan187/Crypto_APIs_2.0_SDK_Python
a56c75df54ef037b39be1315ed6e54de35bed55b
[ "MIT" ]
1
2021-07-21T03:35:18.000Z
2021-07-21T03:35:18.000Z
""" CryptoAPIs Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of their blockchain applications. Crypto APIs 2.0 provides unified endpoints and data, raw data, automatic tokens and coins forwardings, callback functionalities, and much more. # noqa: E501 The version of the OpenAPI document: 2.0.0 Contact: developers@cryptoapis.io Generated by: https://openapi-generator.tech """ import sys import unittest import cryptoapis from cryptoapis.model.get_transaction_details_by_transaction_id_response_item_fee import GetTransactionDetailsByTransactionIDResponseItemFee from cryptoapis.model.get_transaction_details_by_transaction_id_response_item_recipients import GetTransactionDetailsByTransactionIDResponseItemRecipients from cryptoapis.model.get_transaction_details_by_transaction_id_response_item_senders import GetTransactionDetailsByTransactionIDResponseItemSenders from cryptoapis.model.list_transactions_by_address_response_item_blockchain_specific import ListTransactionsByAddressResponseItemBlockchainSpecific globals()['GetTransactionDetailsByTransactionIDResponseItemFee'] = GetTransactionDetailsByTransactionIDResponseItemFee globals()['GetTransactionDetailsByTransactionIDResponseItemRecipients'] = GetTransactionDetailsByTransactionIDResponseItemRecipients globals()['GetTransactionDetailsByTransactionIDResponseItemSenders'] = GetTransactionDetailsByTransactionIDResponseItemSenders globals()['ListTransactionsByAddressResponseItemBlockchainSpecific'] = ListTransactionsByAddressResponseItemBlockchainSpecific from cryptoapis.model.list_transactions_by_address_response_item import ListTransactionsByAddressResponseItem class TestListTransactionsByAddressResponseItem(unittest.TestCase): """ListTransactionsByAddressResponseItem unit test stubs""" def setUp(self): pass def tearDown(self): pass def testListTransactionsByAddressResponseItem(self): """Test ListTransactionsByAddressResponseItem""" # FIXME: construct object with mandatory attributes with example values # model = ListTransactionsByAddressResponseItem() # noqa: E501 pass if __name__ == '__main__': unittest.main()
54.155556
484
0.847353
214
2,437
9.443925
0.495327
0.034636
0.047006
0.017813
0.154874
0.154874
0.154874
0.154874
0.154874
0.099456
0
0.006893
0.107099
2,437
44
485
55.386364
0.921875
0.346327
0
0.142857
0
0
0.146169
0.141017
0
0
0
0.022727
0
1
0.142857
false
0.142857
0.380952
0
0.571429
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
1
1
0
1
0
0
4
ca3df6f0a7196874f31372e595f685bea9b3ea1d
163
py
Python
src/bank/bankia/__init__.py
sunbit/banking
958c3d772f0aaca892ad82f14f1e97e094421d6f
[ "MIT" ]
null
null
null
src/bank/bankia/__init__.py
sunbit/banking
958c3d772f0aaca892ad82f14f1e97e094421d6f
[ "MIT" ]
1
2021-06-01T23:53:06.000Z
2021-06-01T23:53:06.000Z
src/bank/bbva/__init__.py
sunbit/banking
958c3d772f0aaca892ad82f14f1e97e094421d6f
[ "MIT" ]
null
null
null
from .scrapping import login, get_account_transactions, get_credit_card_transactions from .parsing import parse_account_transaction, parse_credit_card_transaction
54.333333
84
0.90184
21
163
6.52381
0.571429
0.145985
0
0
0
0
0
0
0
0
0
0
0.067485
163
2
85
81.5
0.901316
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
ca46a4fce966de9b8da03a85b8b48367121f3cc8
167
py
Python
scrapers/NOW-norwich/councillors.py
DemocracyClub/LGSF
21c2a049db08575e03db2fb63a8bccc8de0c636b
[ "MIT" ]
4
2018-10-17T13:30:08.000Z
2021-06-22T13:29:43.000Z
scrapers/NOW-norwich/councillors.py
DemocracyClub/LGSF
21c2a049db08575e03db2fb63a8bccc8de0c636b
[ "MIT" ]
46
2018-10-15T13:47:48.000Z
2022-03-23T10:26:18.000Z
scrapers/NOW-norwich/councillors.py
DemocracyClub/LGSF
21c2a049db08575e03db2fb63a8bccc8de0c636b
[ "MIT" ]
1
2018-10-15T13:36:03.000Z
2018-10-15T13:36:03.000Z
from lgsf.councillors.scrapers import CMISCouncillorScraper class Scraper(CMISCouncillorScraper): base_url = "https://cmis.norwich.gov.uk/live/Councillors.aspx"
27.833333
66
0.808383
19
167
7.052632
0.894737
0
0
0
0
0
0
0
0
0
0
0
0.08982
167
5
67
33.4
0.881579
0
0
0
0
0
0.293413
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
ca4edacb812312b16cc1cf5ee75c2d077142ba6e
203
py
Python
generic_api/generics/entity.py
guestready/generic_api
4830995ec2f6ea77b1b3bff1d86d4152530b0942
[ "BSD-2-Clause" ]
1
2020-11-24T07:49:37.000Z
2020-11-24T07:49:37.000Z
generic_api/generics/entity.py
guestready/generic_api
4830995ec2f6ea77b1b3bff1d86d4152530b0942
[ "BSD-2-Clause" ]
null
null
null
generic_api/generics/entity.py
guestready/generic_api
4830995ec2f6ea77b1b3bff1d86d4152530b0942
[ "BSD-2-Clause" ]
null
null
null
class GenericEntity: def __init__(self, *args, **kwargs): pass def is_valid(self): raise NotImplementedError @property def data(self): raise NotImplementedError
18.454545
40
0.635468
20
203
6.2
0.7
0.145161
0.451613
0
0
0
0
0
0
0
0
0
0.285714
203
10
41
20.3
0.855172
0
0
0.25
0
0
0
0
0
0
0
0
0
1
0.375
false
0.125
0
0
0.5
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
1
0
1
0
0
0
0
0
4
ca4eee740c52a70be10fb709905ba337b4ffa523
1,904
py
Python
test/test_prompts.py
arpansahoo/wikipedia-speedruns
1271cedefb9ad531a4aa6a72f56b4723413923b4
[ "MIT" ]
12
2022-02-01T17:28:54.000Z
2022-03-30T02:35:46.000Z
test/test_prompts.py
arpansahoo/wikipedia-speedruns
1271cedefb9ad531a4aa6a72f56b4723413923b4
[ "MIT" ]
155
2022-01-27T17:11:25.000Z
2022-03-31T23:56:44.000Z
test/test_prompts.py
arpansahoo/wikipedia-speedruns
1271cedefb9ad531a4aa6a72f56b4723413923b4
[ "MIT" ]
8
2022-01-31T06:03:07.000Z
2022-03-09T19:04:12.000Z
import enum import pytest PROMPTS = [ { "start" : "Johns Hopkins University", "end" : "Baltimore", }, { "start" : "A", "end" : "B", }, ] @pytest.fixture() def prompt_set(cursor): query = "INSERT INTO sprint_prompts (prompt_id, start, end) VALUES (%s, %s, %s);" ps = [(i, p["start"], p["end"]) for i, p in enumerate(PROMPTS)] cursor.executemany(query, ps) yield cursor.execute("DELETE FROM sprint_prompts") def test_create_prompt(client, cursor, admin_session): response = client.post("/api/sprints/", json=PROMPTS[0]) assert response.status_code == 200 cursor.execute("SELECT start, end FROM sprint_prompts") assert cursor.fetchone() == PROMPTS[0] cursor.execute("DELETE FROM sprint_prompts") def test_create_no_admin(client, cursor): response = client.post("/api/sprints/", json=PROMPTS[0]) assert response.status_code == 401 cursor.execute("SELECT start, end FROM sprint_prompts") assert cursor.fetchone() is None def test_delete(client, cursor, prompt_set, admin_session): # Try deleting id 1, which should be inserted id = 1 response = client.delete(f"/api/sprints/{id}") assert response.status_code == 200 cursor.execute("SELECT start, end FROM sprint_prompts WHERE prompt_id=%s", (id, )) assert cursor.fetchone() is None def test_delete_nonexistent(client, cursor, prompt_set, admin_session): # Try deleting id 1, which should be inserted id = len(PROMPTS) response = client.delete(f"/api/sprints/{id}") assert response.status_code == 404 def test_delete_no_admin(client, cursor, prompt_set): id = 1 response = client.delete(f"/api/sprints/{id}") assert response.status_code == 401 cursor.execute("SELECT start, end FROM sprint_prompts WHERE prompt_id=%s", (id, )) assert cursor.fetchone() == PROMPTS[id]
28
86
0.667017
253
1,904
4.889328
0.268775
0.073565
0.082458
0.097009
0.71059
0.71059
0.71059
0.71059
0.679871
0.600647
0
0.014455
0.20063
1,904
67
87
28.41791
0.798292
0.045693
0
0.413043
0
0
0.245314
0
0
0
0
0
0.195652
1
0.130435
false
0
0.043478
0
0.173913
0.26087
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
ca6b1babf6d6de08d3bac6e5c89cb39549888c4b
233
py
Python
file_explorer/seabird/dat_file.py
sharksmhi/file_explorer
0d28d16af9ef6562f16c9196821ed96c90651bf9
[ "MIT" ]
null
null
null
file_explorer/seabird/dat_file.py
sharksmhi/file_explorer
0d28d16af9ef6562f16c9196821ed96c90651bf9
[ "MIT" ]
null
null
null
file_explorer/seabird/dat_file.py
sharksmhi/file_explorer
0d28d16af9ef6562f16c9196821ed96c90651bf9
[ "MIT" ]
null
null
null
from file_explorer.file import InstrumentFile class DatFile(InstrumentFile): suffix = '.dat' def _save_info_from_file(self): """ Binary file, sort of """ pass def _save_attributes(self): pass
16.642857
45
0.643777
27
233
5.296296
0.666667
0.111888
0
0
0
0
0
0
0
0
0
0
0.266094
233
13
46
17.923077
0.836257
0.085837
0
0.285714
0
0
0.019608
0
0
0
0
0
0
1
0.285714
false
0.285714
0.142857
0
0.714286
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
0
0
0
1
0
1
0
0
1
0
0
4
ca93e385780e279cba8dfc4f3082e8d18eff15f8
75
py
Python
convert/__init__.py
zyronix/maske
6d7af9bb5ea397512a53438fa19602c17c0804c5
[ "Apache-2.0" ]
null
null
null
convert/__init__.py
zyronix/maske
6d7af9bb5ea397512a53438fa19602c17c0804c5
[ "Apache-2.0" ]
null
null
null
convert/__init__.py
zyronix/maske
6d7af9bb5ea397512a53438fa19602c17c0804c5
[ "Apache-2.0" ]
null
null
null
import keepalived plugins_dic = {} plugins_dic['keepalived'] = keepalived
15
38
0.773333
8
75
7
0.5
0.357143
0
0
0
0
0
0
0
0
0
0
0.12
75
4
39
18.75
0.848485
0
0
0
0
0
0.133333
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
ca966b9fd17bdb7442874ce41d7e793a87d6b408
299
py
Python
examples/worker/simplejob.py
pooya/disco
e03a337b3b20e191459c74a367b9e89e873f71ff
[ "BSD-3-Clause" ]
786
2015-01-01T12:35:40.000Z
2022-03-19T04:39:22.000Z
examples/worker/simplejob.py
pooya/disco
e03a337b3b20e191459c74a367b9e89e873f71ff
[ "BSD-3-Clause" ]
51
2015-01-19T20:07:01.000Z
2019-10-19T21:03:06.000Z
examples/worker/simplejob.py
pooya/disco
e03a337b3b20e191459c74a367b9e89e873f71ff
[ "BSD-3-Clause" ]
122
2015-01-05T18:16:03.000Z
2021-07-10T12:35:22.000Z
from disco.job import SimpleJob class SimpleJob(SimpleJob): def map(self, worker, task, **jobargs): worker.output(task, partition=None).file.append('hello world!') def reduce(self, worker, task, **jobargs): worker.output(task, partition=None).file.append('goodbye world!')
33.222222
73
0.692308
38
299
5.447368
0.552632
0.096618
0.135266
0.202899
0.57971
0.57971
0.57971
0.57971
0.57971
0.57971
0
0
0.160535
299
8
74
37.375
0.824701
0
0
0
0
0
0.086957
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0
0.666667
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
1
0
0
0
0
1
0
0
4